Return back Qt font using
[mozilla-central.git] / configure.in
blob286647d3a6821700c407e54683d449d0f076a326
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'
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, disabled by default
1452 dnl ========================================================
1453 MOZ_ARG_ENABLE_BOOL(os2-high-mem,
1454 [  --enable-os2-high-mem Enable high-memory support on OS/2],
1455     MOZ_OS2_HIGH_MEMORY=1,
1456     MOZ_OS2_HIGH_MEMORY= )
1457 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1459 dnl ========================================================
1460 dnl System overrides of the defaults for host
1461 dnl ========================================================
1462 case "$host" in
1463 *-beos*)
1464     HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1465     HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1466     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1467     ;;
1469 *cygwin*|*mingw*|*mks*|*msvc*|*wince)
1470     if test -n "$_WIN32_MSVC"; then
1471         HOST_AR=lib
1472         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1473         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1474         HOST_RANLIB='echo ranlib'
1475     else
1476         HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1477     fi
1478     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1479     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1480     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1481     HOST_BIN_SUFFIX=.exe
1482     case "$host" in
1483     *mingw*)
1484     dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1485         ;;
1486     *)
1487         CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1488         if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1489             _pwd=`pwd`
1490             CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1491         fi
1492         if test "`${PERL} -v | grep -c cygwin  2>/dev/null`" = 0; then
1493             AS_PERL=1
1494             PERL="${CYGWIN_WRAPPER} $PERL"
1495         fi
1497         if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1498             PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1499         fi
1500         ;;
1501     esac
1502     ;;
1504 *-darwin*)
1505     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1506     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1507     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1508     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1509     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL -lobjc'
1510     ;;
1512 *-linux*|*-kfreebsd*-gnu)
1513     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1514     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1515     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1516     ;;
1518 *os2*)
1519     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1520     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1521     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1522     HOST_BIN_SUFFIX=.exe
1523     MOZ_FIX_LINK_PATHS=
1524     ;;
1526 *-osf*)
1527     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1528     HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1529     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1530     ;;
1533     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1534     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1535     ;;
1536 esac
1538 dnl Get mozilla version from central milestone file
1539 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1541 dnl Get version of various core apps from the version files.
1542 FIREFOX_VERSION=`cat $topsrcdir/browser/config/version.txt`
1543 THUNDERBIRD_VERSION=`cat $topsrcdir/mail/config/version.txt`
1544 SUNBIRD_VERSION=`cat $topsrcdir/calendar/sunbird/config/version.txt`
1545 SEAMONKEY_VERSION=`cat $topsrcdir/suite/config/version.txt`
1547 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1548 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1550 dnl ========================================================
1551 dnl System overrides of the defaults for target
1552 dnl ========================================================
1554 case "$target" in
1555 *-aix*)
1556     AC_DEFINE(AIX)
1557     if test ! "$GNU_CC"; then
1558         if test ! "$HAVE_64BIT_OS"; then
1559             # Compiling with Visual Age C++ object model compat is the
1560             # default. To compile with object model ibm, add 
1561             # AIX_OBJMODEL=ibm to .mozconfig.
1562             if test "$AIX_OBJMODEL" = "ibm"; then
1563                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1564             else
1565                 AIX_OBJMODEL=compat
1566             fi
1567         else
1568             AIX_OBJMODEL=compat
1569         fi
1570         AC_SUBST(AIX_OBJMODEL)
1571         DSO_LDOPTS='-qmkshrobj=1'
1572         DSO_CFLAGS='-qflag=w:w'
1573         DSO_PIC_CFLAGS=
1574         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1575         AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1576         MOZ_FIX_LINK_PATHS=
1577         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1578         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1579         if test "$COMPILE_ENVIRONMENT"; then
1580             AC_LANG_SAVE
1581             AC_LANG_CPLUSPLUS
1582             AC_MSG_CHECKING([for VisualAge C++ compiler version >= 5.0.2.0])
1583             AC_TRY_COMPILE([],
1584                 [#if (__IBMCPP__ < 502)
1585                  #error "Bad compiler"
1586                  #endif],
1587                 _BAD_COMPILER=,_BAD_COMPILER=1)
1588             if test -n "$_BAD_COMPILER"; then
1589                 AC_MSG_RESULT([no])    
1590                 AC_MSG_ERROR([VisualAge C++ version 5.0.2.0 or higher is required to build.])
1591             else
1592                 AC_MSG_RESULT([yes])    
1593             fi
1594             AC_LANG_RESTORE
1595             TARGET_COMPILER_ABI="ibmc"
1596             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1597             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1598         fi
1599     fi
1600     case "${target_os}" in
1601     aix4.1*)
1602         DLL_SUFFIX='_shr.a'
1603         ;;
1604     esac
1605     if test "$COMPILE_ENVIRONMENT"; then
1606         AC_CHECK_HEADERS(sys/inttypes.h)
1607     fi
1608     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1609     ;;
1611 *-beos*)
1612     no_x=yes
1613     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1614     _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
1615     DSO_LDOPTS='-nostart'
1616     TK_LIBS='-lbe -lroot'
1617     LIBS="$LIBS -lbe"
1618     if test "$COMPILE_ENVIRONMENT"; then
1619         AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
1620         AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
1621     fi
1622     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
1623     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
1624     _MOZ_USE_RTTI=1
1625     USE_DEPENDENT_LIBS=
1626     MOZ_USER_DIR="Mozilla"
1627     ;;
1629 *-bsdi*)
1630     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
1631     _PEDANTIC=
1632     _IGNORE_LONG_LONG_WARNINGS=
1633     case $OS_RELEASE in
1634         4.*|5.*)
1635             STRIP="$STRIP -d"
1636             ;;
1637         *)
1638             DSO_CFLAGS=''
1639             DSO_LDOPTS='-r'
1640             _WARNINGS_CFLAGS="-Wall"
1641             _WARNINGS_CXXFLAGS="-Wall"
1642             # The test above doesn't work properly, at least on 3.1.
1643             MKSHLIB_FORCE_ALL=''
1644             MKSHLIB_UNFORCE_ALL=''
1645         ;;
1646     esac
1647     ;;
1649 *-darwin*) 
1650     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1651     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1652     MOZ_OPTIMIZE_FLAGS="-O2"
1653     _PEDANTIC=
1654     CFLAGS="$CFLAGS -fpascal-strings -fno-common"
1655     CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
1656     DLL_SUFFIX=".dylib"
1657     DSO_LDOPTS=''
1658     STRIP="$STRIP -x -S"
1659     _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1660     MOZ_ENABLE_POSTSCRIPT=
1661     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1662     LDFLAGS="$LDFLAGS -framework Cocoa"
1663     # set MACOSX to generate lib/mac/MoreFiles/Makefile
1664     MACOSX=1
1666     dnl check for the presence of the -dead_strip linker flag
1667     AC_MSG_CHECKING([for -dead_strip option to ld])
1668     _SAVE_LDFLAGS=$LDFLAGS
1669     LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1670     AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1671     if test -n "$_HAVE_DEAD_STRIP" ; then
1672         AC_MSG_RESULT([yes])
1673         MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1674     else
1675         AC_MSG_RESULT([no])
1676     fi
1677     LDFLAGS=$_SAVE_LDFLAGS
1678     ;;
1680 *-freebsd*)
1681     if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` != "elf"; then
1682         DLL_SUFFIX=".so.1.0"
1683         DSO_LDOPTS="-shared"
1684     fi
1685     if test ! "$GNU_CC"; then
1686         DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
1687     fi
1688 # Can't have force w/o an unforce.
1689 #    # Hack for FreeBSD 2.2
1690 #    if test -z "$MKSHLIB_FORCE_ALL"; then
1691 #       MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive'
1692 #       MKSHLIB_UNFORCE_ALL=''
1693 #    fi
1694     ;; 
1696 *-hpux*)
1697     DLL_SUFFIX=".sl"
1698     if test ! "$GNU_CC"; then
1699         DSO_LDOPTS='-b -Wl,+s'
1700         DSO_CFLAGS=""
1701         DSO_PIC_CFLAGS="+Z"
1702         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1703         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1704         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1705     else
1706         DSO_LDOPTS='-b -E +s'
1707         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1708         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1709     fi
1710     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1711     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1712     ;;
1714 *-irix5*)
1715     AC_DEFINE(IRIX)
1716     DSO_LDOPTS='-elf -shared'
1718     if test "$GNU_CC"; then
1719        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1720        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1721        MKSHLIB_FORCE_ALL='-Wl,-all'
1722        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1723        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1724     else
1725        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1726        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1727        MKSHLIB_FORCE_ALL='-all'
1728        MKSHLIB_UNFORCE_ALL='-none'
1729     fi
1730     ;;
1732 *-irix6*)
1733     AC_DEFINE(IRIX)
1734     dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must* 
1735     dnl compile and link using -n32
1736     USE_N32=1
1737     TARGET_COMPILER_ABI=n32
1738     DSO_LDOPTS='-elf -shared'
1739     MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1740     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1741     _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
1742     _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
1743     if test "$GNU_CC"; then
1744        MKSHLIB_FORCE_ALL='-Wl,-all'
1745        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1746        _WARNINGS_CFLAGS="-Wall"
1747        _WARNINGS_CXXFLAGS="-Wall"
1748        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1749     else
1750        MKSHLIB_FORCE_ALL='-all'
1751        MKSHLIB_UNFORCE_ALL='-none'
1752            AR_LIST="$AR t"
1753            AR_EXTRACT="$AR x"
1754            AR_DELETE="$AR d"
1755            AR='$(CXX) -ar'
1756            AR_FLAGS='-o $@'
1757        CFLAGS="$CFLAGS -woff 3262 -G 4"
1758        CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
1759        if test -n "$USE_N32"; then
1760            ASFLAGS="$ASFLAGS -n32"
1761            CFLAGS="$CFLAGS -n32"
1762            CXXFLAGS="$CXXFLAGS -n32"
1763            LDFLAGS="$LDFLAGS -n32"
1764        fi
1765        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1766        AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
1767        MOZ_FIX_LINK_PATHS=
1768     fi
1769     if test -z "$GNU_CXX"; then
1770       MIPSPRO_CXX=1
1771     fi
1772     ;;
1774 *-*linux*)
1775     if test "$GNU_CC"; then
1776         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
1777         case $GCC_VERSION in
1778         4.1.*|4.2.*)
1779             # -Os is broken on gcc 4.1.x and 4.2.x, we need to tweak it to get good results.
1780             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
1781         esac
1782     fi
1784     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1785     MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions $MOZ_OPTIMIZE_SIZE_TWEAK"
1786     MOZ_DEBUG_FLAGS="-g -fno-inline"  # most people on linux use gcc/gdb,
1787                                       # and that combo is not yet good at
1788                                       # debugging inlined functions (even
1789                                       # when using DWARF2 as the debugging
1790                                       # format)    
1792     MOZ_MEMORY=1
1794     case "${target_cpu}" in
1795     alpha*)
1796         CFLAGS="$CFLAGS -mieee"
1797         CXXFLAGS="$CXXFLAGS -mieee"
1798     ;;
1799     i*86)
1800         USE_ELF_DYNSTR_GC=1
1801         MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1
1802     ;;
1803     mips*)
1804         CFLAGS="$CFLAGS -Wa,-xgot"
1805         CXXFLAGS="$CXXFLAGS -Wa,-xgot"
1806     ;;
1807     esac
1808     ;;
1810 *-wince*)
1812     MOZ_TOOLS_DIR=`echo $MOZ_TOOLS`
1813     AR_LIST="$AR -list"
1814     AR_EXTRACT="$AR -extract"
1815     AR_DELETE="$AR d"
1816     AR_FLAGS='-OUT:"$@"'
1818     DSO_CFLAGS=
1819     DSO_PIC_CFLAGS=
1820     DLL_SUFFIX=.dll
1821     BIN_SUFFIX='.exe'
1822     RC=rc.exe
1823     # certain versions of cygwin's makedepend barf on the 
1824     # #include <string> vs -I./dist/include/string issue so don't use it
1825     SYSTEM_MAKEDEPEND=
1827     HOST_CC=cl
1828     HOST_CXX=cl
1829     HOST_LD=link
1830     HOST_AR='lib -OUT:$@'
1831     HOST_RANLIB='echo ranlib'
1832     HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
1833         
1834         
1835     WARNINGS_AS_ERRORS='-WX'
1836         MOZ_OPTIMIZE_FLAGS='-O1'
1837     AR_FLAGS='-NOLOGO -OUT:"$@"'
1838     ASM_SUFFIX=asm
1839     CFLAGS="$CFLAGS -W3 -Gy -Fd\$(PDBFILE)"
1840     CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(PDBFILE)"
1841     DLL_PREFIX=
1842     DOXYGEN=:
1843     DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
1844     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
1845     GARBAGE=
1846     IMPORT_LIB_SUFFIX=lib
1847     LIBS="$LIBS"
1848     LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
1849     LIB_PREFIX=
1850     LIB_SUFFIX=lib 
1851     MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
1852     MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
1853     MKSHLIB_FORCE_ALL=
1854     MKSHLIB_UNFORCE_ALL=
1855     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1856     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1857     MOZ_DEBUG_FLAGS='-Zi'
1858     MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1859     MOZ_FIX_LINK_PATHS=
1860     MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
1861     MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
1862     OBJ_SUFFIX=obj
1863     RANLIB='echo not_ranlib'
1864     STRIP='echo not_strip'
1865     TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
1866     UNZIP=unzip
1867     XARGS=xargs
1868     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
1869     ZIP=zip
1870     LIBIDL_CFLAGS="-I$MOZ_TOOLS_DIR/include ${GLIB_CFLAGS}"
1871     LIBIDL_LIBS="$MOZ_TOOLS_DIR/lib/libidl-0.6_s.lib $MOZ_TOOLS_DIR/lib/glib-1.2_s.lib"
1872     STATIC_LIBIDL=1
1874     AC_DEFINE(HAVE_SNPRINTF)
1875     AC_DEFINE(_WINDOWS)
1876     AC_DEFINE(_WIN32)
1877     AC_DEFINE(WIN32)
1878     AC_DEFINE(XP_WIN)
1879     AC_DEFINE(XP_WIN32)
1880     AC_DEFINE(HW_THREADS)
1881     AC_DEFINE(STDC_HEADERS)
1882     AC_DEFINE(NEW_H, <new>)
1883     AC_DEFINE(WIN32_LEAN_AND_MEAN)
1885     TARGET_MD_ARCH=win32
1886     _PLATFORM_DEFAULT_TOOLKIT='windows'
1887     BIN_SUFFIX='.exe'
1888     USE_SHORT_LIBNAME=1
1889     MOZ_ENABLE_POSTSCRIPT=
1890     MOZ_USER_DIR="Mozilla"
1894 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
1895     DSO_CFLAGS=
1896     DSO_PIC_CFLAGS=
1897     DLL_SUFFIX=.dll
1898     RC=rc.exe
1899     # certain versions of cygwin's makedepend barf on the 
1900     # #include <string> vs -I./dist/include/string issue so don't use it
1901     SYSTEM_MAKEDEPEND=
1902     if test -n "$GNU_CC"; then
1903         CC="$CC -mno-cygwin"
1904         CXX="$CXX -mno-cygwin"
1905         CPP="$CPP -mno-cygwin"
1906         CFLAGS="$CFLAGS -mms-bitfields"
1907         CXXFLAGS="$CXXFLAGS -mms-bitfields"
1908         DSO_LDOPTS='-shared'
1909         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1910         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1911         RC='$(WINDRES)'
1912         # Use temp file for windres (bug 213281)
1913         RCFLAGS='-O coff --use-temp-file'
1914         # mingw doesn't require kernel32, user32, and advapi32 explicitly
1915         LIBS="$LIBS -lgdi32 -lwinmm -lwsock32"
1916         MOZ_JS_LIBS='-L$(LIBXUL_DIST)/lib -ljs$(MOZ_BITS)$(VERSION_NUMBER)'
1917         MOZ_FIX_LINK_PATHS=
1918         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core'
1919         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom'
1920         DLL_PREFIX=
1921         IMPORT_LIB_SUFFIX=dll.a
1922     else
1923         TARGET_COMPILER_ABI=msvc
1924         HOST_CC='$(CC)'
1925         HOST_CXX='$(CXX)'
1926         HOST_LD='$(LD)'
1927         AR='lib -NOLOGO -OUT:"$@"'
1928         AR_FLAGS=
1929         RANLIB='echo not_ranlib'
1930         STRIP='echo not_strip'
1931         XARGS=xargs
1932         ZIP=zip
1933         UNZIP=unzip
1934         DOXYGEN=:
1935         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
1936         OBJ_SUFFIX=obj
1937         LIB_SUFFIX=lib
1938         DLL_PREFIX=
1939         LIB_PREFIX=
1940         IMPORT_LIB_SUFFIX=lib
1941         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(PDBFILE) $(DSO_LDOPTS)'
1942         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(PDBFILE) $(DSO_LDOPTS)'
1943         MKSHLIB_FORCE_ALL=
1944         MKSHLIB_UNFORCE_ALL=
1945         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
1946         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(PDBFILE)"
1947         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(PDBFILE)"
1948         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
1949         MOZ_DEBUG_FLAGS='-Zi'
1950         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1951         WARNINGS_AS_ERRORS='-WX'
1952         MOZ_OPTIMIZE_FLAGS='-O1'
1953         MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
1954         MOZ_FIX_LINK_PATHS=
1955         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
1956         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
1957         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
1958         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1959         MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
1960         if test $_MSC_VER -ge 1400; then
1961             LDFLAGS="$LDFLAGS -NXCOMPAT -SAFESEH"
1962             dnl For profile-guided optimization
1963             PROFILE_GEN_CFLAGS="-GL"
1964             PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
1965             PROFILE_USE_CFLAGS="-GL"
1966             dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul
1967             PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
1968             if test -n "$_USE_DYNAMICBASE"; then
1969                LDFLAGS="$LDFLAGS -DYNAMICBASE"
1970             fi
1971         fi
1972     fi
1973     MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg$(MOZ_BITS)$(VERSION_NUMBER),$(DEPTH)/jpeg)'
1974     MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
1975     AC_DEFINE(HAVE_SNPRINTF)
1976     AC_DEFINE(_WINDOWS)
1977     AC_DEFINE(_WIN32)
1978     AC_DEFINE(WIN32)
1979     AC_DEFINE(XP_WIN)
1980     AC_DEFINE(XP_WIN32)
1981     AC_DEFINE(HW_THREADS)
1982     AC_DEFINE(STDC_HEADERS)
1983     AC_DEFINE(NEW_H, <new>)
1984     AC_DEFINE(WIN32_LEAN_AND_MEAN)
1985     TARGET_MD_ARCH=win32
1986     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
1987     BIN_SUFFIX='.exe'
1988     USE_SHORT_LIBNAME=1
1989     MOZ_ENABLE_POSTSCRIPT=
1990     MOZ_USER_DIR="Mozilla"
1992     dnl Hardcode to win95 for now - cls
1993     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
1995     dnl set NO_X11 defines here as the general check is skipped on win32
1996     no_x=yes
1997     AC_DEFINE(NO_X11)
1999     dnl MinGW/MSYS doesn't provide or need cygpath
2000     case "$host" in
2001     *-mingw*)
2002         CYGPATH_W=echo
2003         CYGPATH_S=cat
2004         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2005         ;;
2006     *-cygwin*|*-msvc*|*-mks*)
2007         CYGPATH_W="cygpath -a -w"
2008         CYGPATH_S="sed -e s|\\\\|/|g"
2009         MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2010         ;;
2011     esac
2012     case "$host" in
2013     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2015     if test -z "$MOZ_TOOLS"; then
2016         AC_MSG_ERROR([MOZ_TOOLS is not set])
2017     fi
2019     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd`
2020     if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then
2021         AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2022     fi
2023     if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_DIR/bin:"` = 0; then
2024         AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2025     fi
2026     MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2028     if test -n "$GLIB_PREFIX"; then
2029         _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd`
2030         if test "$?" = "0"; then
2031             if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
2032                 AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
2033             fi
2034             _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
2035         else
2036             AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
2037         fi
2038     else
2039         _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
2040     fi
2041     if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
2042         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
2043     fi
2044     GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
2045     if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
2046         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
2047     elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
2048         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
2049     else
2050         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
2051     fi
2053     if test -n "$LIBIDL_PREFIX"; then
2054         _LIBIDL_PREFIX_DIR=`cd $LIBIDL_PREFIX && pwd`
2055         if test "$?" = "0"; then
2056             if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
2057                 AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
2058             fi
2059             _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
2060         else
2061             AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
2062         fi
2063     else
2064         _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
2065     fi        
2066     if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
2067         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
2068     fi
2069     LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
2070     if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
2071         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
2072         STATIC_LIBIDL=1
2073     elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
2074         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
2075     else
2076         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
2077     fi
2078     LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2079     ;;
2081     *) # else cross-compiling
2082         if test -n "$GLIB_PREFIX"; then
2083             GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
2084             if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
2085                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
2086             elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
2087                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
2088             else
2089                 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
2090             fi
2091         fi
2092         if test -n "$LIBIDL_PREFIX"; then
2093             LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
2094             if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
2095                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
2096                 STATIC_LIBIDL=1
2097             elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
2098                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
2099             else
2100                 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
2101             fi
2102         fi
2103         LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2104         ;;
2105     esac 
2107     AC_CHECK_HEADERS(mmintrin.h oleacc.idl)
2109     AC_LANG_SAVE
2110     AC_LANG_CPLUSPLUS
2111     AC_CHECK_HEADERS(atlbase.h wpcapi.h)
2112     AC_LANG_RESTORE
2114     case "$target" in
2115     i*86-*)
2116         AC_DEFINE(_X86_)
2117         ;;
2118     alpha-*)
2119         AC_DEFINE(_ALPHA_)
2120         ;;
2121     mips-*)
2122         AC_DEFINE(_MIPS_)
2123         ;;
2124     *)
2125         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2126         ;;
2127     esac
2128     ;;
2130 *-netbsd*)
2131     DSO_CFLAGS=''
2132     CFLAGS="$CFLAGS -Dunix"
2133     CXXFLAGS="$CXXFLAGS -Dunix"
2134     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2135         DLL_SUFFIX=".so"
2136         DSO_PIC_CFLAGS='-fPIC -DPIC'
2137         DSO_LDOPTS='-shared'
2138         BIN_FLAGS='-Wl,--export-dynamic'
2139     else
2140         DSO_PIC_CFLAGS='-fPIC -DPIC'
2141         DLL_SUFFIX=".so.1.0"
2142         DSO_LDOPTS='-shared'
2143     fi
2144     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2145     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2146     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2147     if test "$LIBRUNPATH"; then
2148         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2149     fi
2150     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2151     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2152     ;;
2154 *-nto*) 
2155         AC_DEFINE(NTO)  
2156         AC_DEFINE(_QNX_SOURCE)
2157         AC_DEFINE(_i386)
2158         OS_TARGET=NTO
2159         WARNINGS_AS_ERRORS=''
2160         MOZ_OPTIMIZE_FLAGS="-O"
2161         MOZ_DEBUG_FLAGS="-gstabs"
2162         USE_PTHREADS=1
2163         _PEDANTIC=
2164         LIBS="$LIBS -lsocket -lstdc++"
2165         _DEFINES_CFLAGS='-Wp,-include -Wp,$(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2166         _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -Wp,-include -Wp,$(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2167         if test "$with_x" != "yes"
2168         then
2169                 _PLATFORM_DEFAULT_TOOLKIT="photon"
2170             TK_CFLAGS='-I/usr/include/photon'
2171                 TK_LIBS='-lph'
2172         fi
2173         case "${target_cpu}" in
2174         ppc*)
2175         AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)        
2176         ;;
2177         esac
2178         case "${host_cpu}" in
2179         i*86)
2180         USE_ELF_DYNSTR_GC=1
2181         ;;
2182         esac
2183         ;;
2185 *-openbsd*)
2186     DLL_SUFFIX=".so.1.0"
2187     DSO_CFLAGS=''
2188     DSO_PIC_CFLAGS='-fPIC'
2189     DSO_LDOPTS='-shared -fPIC'
2190     if test "$LIBRUNPATH"; then
2191         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2192     fi
2193     ;;
2195 *-openvms*) 
2196     AC_DEFINE(NO_PW_GECOS)
2197     AC_DEFINE(NO_UDSOCK)
2198     AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2199     USE_PTHREADS=1
2200     MKSHLIB_FORCE_ALL='-all'
2201     MKSHLIB_UNFORCE_ALL='-none'
2202     AS='as'
2203     AS_DASH_C_FLAG='-Wc/names=as_is'
2204     AR_FLAGS='c $@'
2205     DSO_LDOPTS='-shared -auto_symvec'
2206     DSO_PIC_CFLAGS=
2207     MOZ_DEBUG_LDFLAGS='-g'
2208     COMPAQ_CXX=1
2209     CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2210     CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2211     ;;
2214 *-os2*)
2215     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2216     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2217     AC_DEFINE(XP_OS2)
2218     USE_SHORT_LIBNAME=1
2219     DLL_PREFIX=
2220     LIB_PREFIX=
2221     LIB_SUFFIX=lib
2222     BIN_SUFFIX=".exe"
2223     DLL_SUFFIX=".dll"
2224     IMPORT_LIB_SUFFIX=lib
2225     DSO_PIC_CFLAGS=
2226     TARGET_MD_ARCH=os2
2227     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2228     MOZ_ENABLE_POSTSCRIPT=
2229     RC=rc.exe
2230     RCFLAGS='-n'
2231     MOZ_USER_DIR="Mozilla"
2233     if test "$MOZTOOLS"; then
2234         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2235     else
2236         AC_MSG_ERROR([MOZTOOLS is not set])
2237     fi
2239     # EMX/GCC build
2240     if test -n "$GNU_CC"; then
2241         AC_DEFINE(OS2)
2242         AC_DEFINE(XP_OS2_EMX)
2243         AC_DEFINE(OS2EMX_PLAIN_CHAR)
2244         AC_DEFINE(TCPV40HDRS)
2245         AR=emxomfar
2246         AR_FLAGS='r $@'
2247         CFLAGS="$CFLAGS -Zomf"
2248         CXXFLAGS="$CXXFLAGS -Zomf"
2249         DSO_LDOPTS='-Zdll'
2250         BIN_FLAGS='-Zlinker /ST:0x100000'
2251         IMPLIB='emximp -o'
2252         FILTER='emxexp -o'
2253         LDFLAGS='-Zmap'
2254         WARNINGS_AS_ERRORS='-Werror'
2255         MOZ_DEBUG_FLAGS="-g -fno-inline"
2256         MOZ_OPTIMIZE_FLAGS="-O2"
2257         MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2258         MOZ_XPCOM_OBSOLETE_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcomct.lib'
2259         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcomcor.lib'
2260         LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2261         if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2262           DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2263           LDFLAGS="$LDFLAGS -Zhigh-mem"
2264           MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2265           AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2266         fi
2268         # GCC for OS/2 currently predefines these, but we don't want them
2269         _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2270         _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2272         AC_CACHE_CHECK(for __declspec(dllexport),
2273            ac_os2_declspec,
2274            [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2275                            [return 0;],
2276                            ac_os2_declspec="yes",
2277                            ac_os2_declspec="no")])
2278         if test "$ac_os2_declspec" = "yes"; then
2279            FILTER='true'
2280            MOZ_OS2_USE_DECLSPEC='1'
2281         fi
2282         
2283     # Visual Age C++ build
2284     elif test "$VACPP" = "yes"; then
2285         MOZ_BUILD_ROOT=`pwd -D`
2286         OBJ_SUFFIX=obj
2287         AR=-ilib
2288         AR_FLAGS='/NOL /NOI /O:$(subst /,\\,$@)'
2289         AR_LIST='/L'
2290         AR_EXTRACT='-*'
2291         AR_DELETE='-'
2292         AS=alp
2293         ASFLAGS='-Mb'
2294         AS_DASH_C_FLAG=''
2295         ASM_SUFFIX=asm
2296         LD='-ilink'
2297         CFLAGS="/Q /qlibansi /Gm+ /Su4 /Mp /Tl9"
2298         CXXFLAGS="/Q /qlibansi /Gm+ /Su4 /Mp /Tl9 /Gx+"
2299         MOZ_DEBUG_FLAGS="/Ti+"
2300         WARNINGS_AS_ERRORS='-WX'
2301         MOZ_OPTIMIZE_FLAGS="/O+ /Gl+ /G5 /qarch=pentium"
2302         LDFLAGS="/NOL /M"
2303         MOZ_DEBUG_LDFLAGS="/DE"
2304         MOZ_OPTIMIZE_LDFLAGS="/OPTFUNC /EXEPACK:2 /PACKCODE /PACKDATA"
2305         DSO_LDOPTS=''
2306         DSO_PIC_CFLAGS=
2307         IMPLIB='implib /NOL /NOI'
2308         FILTER='cppfilt -q -B -P'
2309         AC_DEFINE(NO_ANSI_KEYWORDS)
2310         AC_DEFINE(OS2,4)
2311         AC_DEFINE(_X86_)
2312         AC_DEFINE(XP_OS2_VACPP)
2313         AC_DEFINE(TCPV40HDRS)
2314         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2315         AC_DEFINE(STDC_HEADERS)
2316         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2317         MKSHLIB='$(LD) $(DSO_LDOPTS)'
2318         MKCSHLIB='$(LD) $(DSO_LDOPTS)'
2319         MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2320         MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcomct.lib'
2321         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcomcor.lib'
2322         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2323     fi
2324     ;;
2326 alpha*-*-osf*)
2327     if test "$GNU_CC"; then
2328       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2329       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2331     else
2332         MOZ_DEBUG_FLAGS='-g'
2333         ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2334         CFLAGS="$CFLAGS -ieee"
2335         CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
2336         DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2337         DSO_CFLAGS=
2338         DSO_PIC_CFLAGS=
2339         MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2340         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2341         MKSHLIB_FORCE_ALL='-all'
2342         MKSHLIB_UNFORCE_ALL='-none'
2343         dnl Might fix the libxpcom.so breakage on this platform as well....
2344         AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2345         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2346     fi
2347     if test -z "$GNU_CXX"; then
2348       COMPAQ_CXX=1
2349     fi
2350     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2351     ;;
2353 *-qnx*) 
2354     DIRENT_INO=d_stat.st_ino
2355     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2356     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2357     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2358     dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2359     AC_DEFINE(STDC_HEADERS)
2360     if test "$no_x" = "yes"; then
2361             _PLATFORM_DEFAULT_TOOLKIT='photon'
2362             TK_CFLAGS='-I/usr/nto/include/photon'
2363             TK_LIBS='-lphoton -lphrender'
2364     fi
2365     ;;
2367 *-sco*) 
2368     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2369     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2370     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2371     if test ! "$GNU_CC"; then
2372        DSO_LDOPTS='-G'
2373     fi
2374     ;;
2376 dnl the qsort routine under solaris is faulty
2377 *-solaris*) 
2378     AC_DEFINE(SOLARIS)
2379     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2380     SYSTEM_MAKEDEPEND=
2381     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2382     # libraries one level up (e.g. libnspr4.so)
2383     LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
2384     if test -z "$GNU_CC"; then
2385        NS_USE_NATIVE=1
2386        MOZ_FIX_LINK_PATHS='-R $(LIBXUL_DIST)/bin'
2387        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2389        if test "$CPU_ARCH" != "sparc"; then
2390           CFLAGS="$CFLAGS -xstrconst -xbuiltin=%all"
2391           CXXFLAGS="$CXXFLAGS -xbuiltin=%all -features=tmplife -norunpath"
2392        else
2393           # Do not use -xbuiltin on SPARC to get around a bug of compiler
2394           CFLAGS="$CFLAGS -xstrconst -xbuiltin=%none"
2395           CXXFLAGS="$CXXFLAGS -xbuiltin=%none -features=tmplife -norunpath"
2396        fi
2398        LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
2399        if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
2400            _SAVE_LDFLAGS=$LDFLAGS
2401            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
2402            AC_TRY_LINK([#include <stdio.h>],
2403                        [printf("Hello World\n");],
2404                        ,
2405                        [LDFLAGS=$_SAVE_LDFLAGS])
2406        fi
2407        WARNINGS_AS_ERRORS='-Werror'
2408        MOZ_OPTIMIZE_FLAGS="-xO4"
2409        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2410        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -z muldefs -h $@ -o $@'
2411        MKSHLIB_FORCE_ALL='-z allextract'
2412        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2413        DSO_LDOPTS='-G -z muldefs'
2414        AR_LIST="$AR t"
2415        AR_EXTRACT="$AR x"
2416        AR_DELETE="$AR d"
2417        AR='$(CXX) -xar'
2418        AR_FLAGS='-o $@'
2419        AS='/usr/ccs/bin/as'
2420        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2421        AS_DASH_C_FLAG=''
2422        TARGET_COMPILER_ABI="sunc"
2423         CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2424         CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2425        AC_MSG_CHECKING([for Forte compiler version >= WS6U2])
2426        AC_LANG_SAVE
2427        AC_LANG_CPLUSPLUS
2428        AC_TRY_COMPILE([],
2429            [#if (__SUNPRO_CC < 0x530)
2430            #error "Denied"
2431            #endif],
2432            _BAD_COMPILER=,_BAD_COMPILER=1)
2433         if test -n "$_BAD_COMPILER"; then
2434             _res="no"
2435             AC_MSG_ERROR([Forte version WS6U2 or higher is required to build. Your compiler version is $CC_VERSION .])
2436         else
2437             _res="yes"
2438         fi
2439         AC_MSG_RESULT([$_res])
2440         AC_LANG_RESTORE
2441     else
2442        ASFLAGS="$ASFLAGS -fPIC"
2443        DSO_LDOPTS='-G'
2444        _WARNINGS_CFLAGS=''
2445        _WARNINGS_CXXFLAGS=''
2446        if test "$OS_RELEASE" = "5.3"; then
2447           AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2448        fi
2449     fi
2450     if test "$OS_RELEASE" = "5.5.1"; then
2451        AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2452     fi
2453     ;;
2455 *-sunos*) 
2456     DSO_LDOPTS='-Bdynamic'
2457     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2458     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2459     AC_DEFINE(SUNOS4)
2460     AC_DEFINE(SPRINTF_RETURNS_STRING)
2461     case "$(target_os)" in
2462     sunos4.1*)
2463         DLL_SUFFIX='.so.1.0'
2464         ;;
2465     esac
2466     ;;
2468 *-sysv4.2uw7*) 
2469         NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2470     ;;
2472 *-os2*)
2473     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2474     ;;
2476 esac
2478 dnl Only one oddball right now (QNX), but this gives us flexibility
2479 dnl if any other platforms need to override this in the future.
2480 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2482 dnl ========================================================
2483 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2484 dnl by now will not have any way to link most binaries (tests
2485 dnl as well as viewer, apprunner, etc.), because some symbols
2486 dnl will be left out of the "composite" .so's by ld as unneeded.
2487 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2488 dnl they can link in the static libs that provide the missing
2489 dnl symbols.
2490 dnl ========================================================
2491 NO_LD_ARCHIVE_FLAGS=
2492 if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then
2493     NO_LD_ARCHIVE_FLAGS=1
2495 case "$target" in
2496 *-os2*)
2497     NO_LD_ARCHIVE_FLAGS=
2498     ;;
2499 *-aix4.3*|*-aix5*)
2500     NO_LD_ARCHIVE_FLAGS=
2501     ;;
2502 *-openvms*)
2503     NO_LD_ARCHIVE_FLAGS=
2504     ;;
2505 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince)
2506     if test -z "$GNU_CC"; then
2507         NO_LD_ARCHIVE_FLAGS=
2508     fi
2509     ;;
2510 esac
2511 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2514 dnl Indicate that platform requires special thread safe 
2515 dnl locking when starting up the OJI JVM 
2516 dnl (see mozilla/modules/oji/src/nsJVMManager.cpp)
2517 dnl ========================================================
2518 case "$target" in
2519     *-hpux*)      
2520         AC_DEFINE(MOZ_OJI_REQUIRE_THREAD_SAFE_ON_STARTUP)
2521         ;;
2522 esac
2524 dnl ========================================================
2525 dnl = Flags to strip unused symbols from .so components
2526 dnl ========================================================
2527 case "$target" in
2528     *-linux*|*-kfreebsd*-gnu)
2529         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2530         ;;
2531     *-solaris*)
2532         if test -z "$GNU_CC"; then
2533          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2534         else
2535          if test -z "$GCC_USE_GNU_LD"; then
2536           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2537          else
2538           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2539          fi
2540         fi
2541         ;;
2542     *-nto*) 
2543         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2544         ;;
2545     *-darwin*)
2546         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2547         ;;
2548     *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince)
2549         if test -n "$GNU_CC"; then
2550            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2551         fi
2552         ;;
2553 esac
2555 if test -z "$COMPILE_ENVIRONMENT"; then
2556     SKIP_COMPILER_CHECKS=1
2557     SKIP_LIBRARY_CHECKS=1
2560 if test -z "$SKIP_COMPILER_CHECKS"; then
2561 dnl Checks for typedefs, structures, and compiler characteristics.
2562 dnl ========================================================
2563 AC_LANG_C
2564 AC_HEADER_STDC
2565 AC_C_CONST
2566 AC_TYPE_MODE_T
2567 AC_TYPE_OFF_T
2568 AC_TYPE_PID_T
2569 AC_TYPE_SIZE_T
2570 AC_STRUCT_ST_BLKSIZE
2571 AC_MSG_CHECKING(for siginfo_t)
2572 AC_CACHE_VAL(ac_cv_siginfo_t,
2573  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2574                   #include <signal.h>],
2575                  [siginfo_t* info;],
2576                  [ac_cv_siginfo_t=true],
2577                  [ac_cv_siginfo_t=false])])
2578 if test "$ac_cv_siginfo_t" = true ; then
2579   AC_DEFINE(HAVE_SIGINFO_T)
2580   AC_MSG_RESULT(yes)
2581 else
2582   AC_MSG_RESULT(no)
2585 dnl Visual Age for os/2 also defines size_t and off_t in certain 
2586 dnl  header files.  These defines make Visual Age use the mozilla
2587 dnl  defines types.
2588 if test "$VACPP" = "yes"; then
2589    AC_DEFINE(__size_t)
2590    AC_DEFINE(__off_t)
2593 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2594 dnl ========================================================
2595 AC_MSG_CHECKING(for int16_t)
2596 AC_CACHE_VAL(ac_cv_int16_t,
2597  [AC_TRY_COMPILE([#include <stdio.h>
2598                   #include <sys/types.h>],
2599                  [int16_t foo = 0;],
2600                  [ac_cv_int16_t=true],
2601                  [ac_cv_int16_t=false])])
2602 if test "$ac_cv_int16_t" = true ; then
2603   AC_DEFINE(HAVE_INT16_T)
2604   AC_MSG_RESULT(yes)
2605 else
2606   AC_MSG_RESULT(no)
2608 AC_MSG_CHECKING(for int32_t)
2609 AC_CACHE_VAL(ac_cv_int32_t,
2610  [AC_TRY_COMPILE([#include <stdio.h>
2611                   #include <sys/types.h>],
2612                  [int32_t foo = 0;],
2613                  [ac_cv_int32_t=true],
2614                  [ac_cv_int32_t=false])])
2615 if test "$ac_cv_int32_t" = true ; then
2616   AC_DEFINE(HAVE_INT32_T)
2617   AC_MSG_RESULT(yes)
2618 else
2619   AC_MSG_RESULT(no)
2621 AC_MSG_CHECKING(for int64_t)
2622 AC_CACHE_VAL(ac_cv_int64_t,
2623  [AC_TRY_COMPILE([#include <stdio.h>
2624                   #include <sys/types.h>],
2625                  [int64_t foo = 0;],
2626                  [ac_cv_int64_t=true],
2627                  [ac_cv_int64_t=false])])
2628 if test "$ac_cv_int64_t" = true ; then
2629   AC_DEFINE(HAVE_INT64_T)
2630   AC_MSG_RESULT(yes)
2631 else
2632   AC_MSG_RESULT(no)
2634 AC_MSG_CHECKING(for int64)
2635 AC_CACHE_VAL(ac_cv_int64,
2636  [AC_TRY_COMPILE([#include <stdio.h>
2637                   #include <sys/types.h>],
2638                  [int64 foo = 0;],
2639                  [ac_cv_int64=true],
2640                  [ac_cv_int64=false])])
2641 if test "$ac_cv_int64" = true ; then
2642   AC_DEFINE(HAVE_INT64)
2643   AC_MSG_RESULT(yes)
2644 else
2645   AC_MSG_RESULT(no)
2647 AC_MSG_CHECKING(for uint)
2648 AC_CACHE_VAL(ac_cv_uint,
2649  [AC_TRY_COMPILE([#include <stdio.h>
2650                   #include <sys/types.h>],
2651                  [uint foo = 0;],
2652                  [ac_cv_uint=true],
2653                  [ac_cv_uint=false])])
2654 if test "$ac_cv_uint" = true ; then
2655   AC_DEFINE(HAVE_UINT)
2656   AC_MSG_RESULT(yes)
2657 else
2658   AC_MSG_RESULT(no)
2660 AC_MSG_CHECKING(for uint_t)
2661 AC_CACHE_VAL(ac_cv_uint_t,
2662  [AC_TRY_COMPILE([#include <stdio.h>
2663                   #include <sys/types.h>],
2664                  [uint_t foo = 0;],
2665                  [ac_cv_uint_t=true],
2666                  [ac_cv_uint_t=false])])
2667 if test "$ac_cv_uint_t" = true ; then
2668   AC_DEFINE(HAVE_UINT_T)
2669   AC_MSG_RESULT(yes)
2670 else
2671   AC_MSG_RESULT(no)
2673 AC_MSG_CHECKING(for uint16_t)
2674 AC_CACHE_VAL(ac_cv_uint16_t,
2675  [AC_TRY_COMPILE([#include <stdio.h>
2676                   #include <sys/types.h>],
2677                  [uint16_t foo = 0;],
2678                  [ac_cv_uint16_t=true],
2679                  [ac_cv_uint16_t=false])])
2680 if test "$ac_cv_uint16_t" = true ; then
2681   AC_DEFINE(HAVE_UINT16_T)
2682   AC_MSG_RESULT(yes)
2683 else
2684   AC_MSG_RESULT(no)
2687 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2688 dnl are defined when compiling C++ but not C.  Since the result of this
2689 dnl test is used only in C++, do it in C++.
2690 AC_LANG_CPLUSPLUS
2692 AC_MSG_CHECKING(for uname.domainname)
2693 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2694     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2695         [ struct utsname *res; char *domain; 
2696             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
2697         [ac_cv_have_uname_domainname_field=true],
2698         [ac_cv_have_uname_domainname_field=false])])
2700 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2701     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2702     AC_MSG_RESULT(yes)
2703 else
2704     AC_MSG_RESULT(no)
2707 AC_MSG_CHECKING(for uname.__domainname)
2708 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2709     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2710         [ struct utsname *res; char *domain; 
2711             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
2712         [ac_cv_have_uname_us_domainname_field=true],
2713         [ac_cv_have_uname_us_domainname_field=false])])
2715 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2716     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2717     AC_MSG_RESULT(yes)
2718 else
2719     AC_MSG_RESULT(no)
2722 AC_LANG_C
2724 dnl Check for usable wchar_t (2 bytes, unsigned)
2725 dnl (we really don't need the unsignedness check anymore)
2726 dnl ========================================================
2728 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2729     ac_cv_have_usable_wchar_v2,
2730     [AC_TRY_COMPILE([#include <stddef.h>
2731                      $configure_static_assert_macros],
2732                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2733                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2734                     ac_cv_have_usable_wchar_v2="yes",
2735                     ac_cv_have_usable_wchar_v2="no")])
2736 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2737     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2738     HAVE_CPP_2BYTE_WCHAR_T=1
2739 else
2740 dnl This is really gcc-only
2741 dnl Do this test using CXX only since some versions of gcc
2742 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2743 dnl only have short-wchar support for c++.
2744 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2746     AC_LANG_SAVE
2747     AC_LANG_CPLUSPLUS
2748     _SAVE_CXXFLAGS=$CXXFLAGS
2749     CXXFLAGS="$CXXFLAGS -fshort-wchar"
2751     AC_CACHE_CHECK(for compiler -fshort-wchar option, 
2752         ac_cv_have_usable_wchar_option_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_option_v2="yes",
2758                         ac_cv_have_usable_wchar_option_v2="no")])
2760     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2761         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2762         HAVE_CPP_2BYTE_WCHAR_T=1
2763     else    
2764         CXXFLAGS=$_SAVE_CXXFLAGS
2765     fi
2766     AC_LANG_RESTORE
2769 dnl Check for .hidden assembler directive and visibility attribute.
2770 dnl Borrowed from glibc configure.in
2771 dnl ===============================================================
2772 if test "$GNU_CC"; then
2773   AC_CACHE_CHECK(for visibility(hidden) attribute,
2774                  ac_cv_visibility_hidden,
2775                  [cat > conftest.c <<EOF
2776                   int foo __attribute__ ((visibility ("hidden"))) = 1;
2778                   ac_cv_visibility_hidden=no
2779                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2780                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2781                       ac_cv_visibility_hidden=yes
2782                     fi
2783                   fi
2784                   rm -f conftest.[cs]
2785                  ])
2786   if test "$ac_cv_visibility_hidden" = "yes"; then
2787     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2789     AC_CACHE_CHECK(for visibility(default) attribute,
2790                    ac_cv_visibility_default,
2791                    [cat > conftest.c <<EOF
2792                     int foo __attribute__ ((visibility ("default"))) = 1;
2794                     ac_cv_visibility_default=no
2795                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2796                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2797                         ac_cv_visibility_default=yes
2798                       fi
2799                     fi
2800                     rm -f conftest.[cs]
2801                    ])
2802     if test "$ac_cv_visibility_default" = "yes"; then
2803       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2805       AC_CACHE_CHECK(for visibility pragma support,
2806                      ac_cv_visibility_pragma,
2807                      [cat > conftest.c <<EOF
2808 #pragma GCC visibility push(hidden)
2809                       int foo_hidden = 1;
2810 #pragma GCC visibility push(default)
2811                       int foo_default = 1;
2813                       ac_cv_visibility_pragma=no
2814                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2815                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2816                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2817                             ac_cv_visibility_pragma=yes
2818                           fi
2819                         fi
2820                       fi
2821                       rm -f conftest.[cs]
2822                     ])
2823       if test "$ac_cv_visibility_pragma" = "yes"; then
2824         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2825                        ac_cv_have_visibility_class_bug,
2826                        [cat > conftest.c <<EOF
2827 #pragma GCC visibility push(hidden)
2828 struct __attribute__ ((visibility ("default"))) TestStruct {
2829   static void Init();
2831 __attribute__ ((visibility ("default"))) void TestFunc() {
2832   TestStruct::Init();
2835                        ac_cv_have_visibility_class_bug=no
2836                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2837                          ac_cv_have_visibility_class_bug=yes
2838                        else
2839                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2840                            ac_cv_have_visibility_class_bug=yes
2841                          fi
2842                        fi
2843                        rm -rf conftest.{c,S}
2844                        ])
2846         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2847                        ac_cv_have_visibility_builtin_bug,
2848                        [cat > conftest.c <<EOF
2849 #pragma GCC visibility push(hidden)
2850 #pragma GCC visibility push(default)
2851 #include <string.h>
2852 #pragma GCC visibility pop
2854 __attribute__ ((visibility ("default"))) void Func() {
2855   char c[[100]];
2856   memset(c, 0, sizeof(c));
2859                        ac_cv_have_visibility_builtin_bug=no
2860                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2861                          ac_cv_have_visibility_builtin_bug=yes
2862                        else
2863                          if test `grep -c "@PLT" conftest.S` = 0; then
2864                            ac_cv_visibility_builtin_bug=yes
2865                          fi
2866                        fi
2867                        rm -f conftest.{c,S}
2868                        ])
2869         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2870                 "$ac_cv_have_visibility_class_bug" = "no"; then
2871           VISIBILITY_FLAGS='-I$(DIST)/include/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2872           WRAP_SYSTEM_INCLUDES=1
2873         else
2874           VISIBILITY_FLAGS='-fvisibility=hidden'
2875         fi # have visibility pragma bug
2876       fi   # have visibility pragma
2877     fi     # have visibility(default) attribute
2878   fi       # have visibility(hidden) attribute
2879 fi         # GNU_CC
2881 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2882 AC_SUBST(VISIBILITY_FLAGS)
2884 dnl Checks for header files.
2885 dnl ========================================================
2886 AC_HEADER_DIRENT
2887 case "$target_os" in
2888 freebsd*)
2889 # for stuff like -lXshm
2890     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2891     ;;
2892 esac
2893 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
2894 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
2895 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
2896 AC_CHECK_HEADERS(malloc.h)
2897 AC_CHECK_HEADERS(X11/XKBlib.h)
2899 dnl These are all the places some variant of statfs can be hiding.
2900 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2902 dnl Try for MMX support
2903 dnl NB - later gcc versions require -mmmx for this header to be successfully
2904 dnl included (or another option which implies it, such as -march=pentium-mmx)
2905 AC_CHECK_HEADERS(mmintrin.h)
2907 dnl Check whether the compiler supports the new-style C++ standard
2908 dnl library headers (i.e. <new>) or needs the old "new.h"
2909 AC_LANG_CPLUSPLUS
2910 NEW_H=new.h
2911 AC_CHECK_HEADER(new, [NEW_H=new])
2912 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
2913 AC_LANG_C
2915 AC_ARG_ENABLE(dtrace,
2916               [  --enable-dtrace         build with dtrace support if available (default=no)],
2917               [enable_dtrace="yes"],)
2918 if test "x$enable_dtrace" = "xyes"; then
2919   AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
2920   if test -n "$HAVE_DTRACE"; then
2921       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
2922   else
2923       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
2924   fi
2926 AC_SUBST(HAVE_DTRACE)
2928 case $target in
2929 *-aix4.3*|*-aix5*)
2930         ;;
2932         AC_CHECK_HEADERS(sys/cdefs.h)
2933         ;;
2934 esac
2936 dnl Checks for libraries.
2937 dnl ========================================================
2938 case $target in
2939 *-hpux11.*)
2940         ;;
2942         AC_CHECK_LIB(c_r, gethostbyname_r)
2943         ;;
2944 esac
2946 dnl We don't want to link with libdl even if it's present on OS X, since
2947 dnl it's not used and not part of the default installation.
2948 dnl The same goes for BeOS.
2949 dnl We don't want to link against libm or libpthread on Darwin since
2950 dnl they both are just symlinks to libSystem and explicitly linking
2951 dnl against libSystem causes issues when debugging (see bug 299601).
2952 case $target in
2953 *-darwin*)
2954     ;;
2955 *-beos*)
2956     ;;
2958     AC_CHECK_LIB(m, atan)
2959     AC_CHECK_LIB(dl, dlopen,
2960     AC_CHECK_HEADER(dlfcn.h, 
2961         LIBS="-ldl $LIBS"
2962         AC_DEFINE(HAVE_LIBDL)))
2963     ;;
2964 esac
2966 _SAVE_CFLAGS="$CFLAGS"
2967 CFLAGS="$CFLAGS -D_GNU_SOURCE"
2968 AC_CHECK_FUNCS(dladdr)
2969 CFLAGS="$_SAVE_CFLAGS"
2971 if test ! "$GNU_CXX"; then
2973     case $target in
2974     *-aix*)
2975         AC_CHECK_LIB(C_r, demangle)
2976         ;;
2977      *)
2978         AC_CHECK_LIB(C, demangle)
2979         ;;
2980      esac
2982 AC_CHECK_LIB(socket, socket)
2984 XLDFLAGS="$X_LIBS"
2985 XLIBS="$X_EXTRA_LIBS"
2987 dnl ========================================================
2988 dnl Checks for X libraries.
2989 dnl Ordering is important.
2990 dnl Xt is dependent upon SM as of X11R6
2991 dnl ========================================================
2992 if test "$no_x" = "yes"; then
2993     AC_DEFINE(NO_X11)
2994 else
2995     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
2996         XLIBS="-lX11 $XLIBS"
2997         _SAVE_LDFLAGS="$LDFLAGS"
2998         LDFLAGS="$XLDFLAGS $LDFLAGS"
2999         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3000                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3001         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3002                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3003    
3004      
3005         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3006         unset ac_cv_lib_Xt_XtFree
3007             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3008             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS) 
3009         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3010                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3011         ])
3013     # AIX needs the motif library linked before libXt to prevent
3014     # crashes in plugins linked against Motif - Bug #98892
3015     case "${target_os}" in
3016     aix*)
3017         XT_LIBS="-lXm $XT_LIBS"
3018         ;;
3019     esac
3021     dnl ========================================================
3022     dnl = Check for XShm
3023     dnl ========================================================
3024     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3025         $XLIBS $XEXT_LIBS)
3026     AC_CHECK_HEADER(X11/extensions/XShm.h)
3027     if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3028         test -n "$_HAVE_XSHM_XEXT"; then
3029         AC_DEFINE(HAVE_XSHM)
3030     fi
3032     dnl ========================================================
3033     dnl = Check for XIE
3034     dnl ========================================================
3035     AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3036         $XLIBS $XEXT_LIBS)
3037     AC_CHECK_HEADER(X11/extensions/XIElib.h)
3039     if test "$MOZ_XIE_LIBS"; then
3040         dnl ====================================================
3041         dnl = If XIE is present and is desired, turn it on
3042         dnl ====================================================
3043         case $target in
3044             *-hpux*)
3045                 ;;
3046             *)
3047                 HAVE_XIE=1
3048                 ;;
3049         esac
3050     fi
3052         LDFLAGS="$_SAVE_LDFLAGS"
3054     dnl ========================================================
3055     dnl = Check for freetype2 and its functionality
3056     dnl ========================================================
3057     AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3059     if test "$_HAVE_FREETYPE2"; then
3060         _SAVE_LIBS="$LIBS"
3061         _SAVE_CFLAGS="$CFLAGS"
3062         LIBS="$LIBS $FT2_LIBS"
3063         CFLAGS="$CFLAGS $FT2_CFLAGS"
3065         AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3066             ac_cv_member_FT_Bitmap_Size_y_ppem,
3067             [AC_TRY_COMPILE([#include <ft2build.h>
3068                              #include FT_FREETYPE_H],
3069                             [FT_Bitmap_Size s;
3070                              if (sizeof s.y_ppem) return 0;
3071                              return 1],
3072                             ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3073                             ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3074         if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3075             HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3076         else
3077             HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3078         fi
3079         AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3080                            $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3081                            [FT_Bitmap_Size structure includes y_ppem field])
3083         AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3085         LIBS="$_SAVE_LIBS"
3086         CFLAGS="$_SAVE_CFLAGS"
3087     fi
3089 fi # $no_x
3091 AC_SUBST(XCFLAGS)
3092 AC_SUBST(XLDFLAGS)
3093 AC_SUBST(XLIBS)
3094 AC_SUBST(XT_LIBS)
3096 dnl ========================================================
3097 dnl = pthread support
3098 dnl = Start by checking whether the system support pthreads
3099 dnl ========================================================
3100 case "$target_os" in
3101 darwin*)
3102     USE_PTHREADS=1
3103     ;;
3105     MOZ_CHECK_PTHREADS(pthreads,
3106         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3107         MOZ_CHECK_PTHREADS(pthread,
3108             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3109             MOZ_CHECK_PTHREADS(c_r,
3110                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3111                 MOZ_CHECK_PTHREADS(c,
3112                     USE_PTHREADS=1
3113                 )
3114             )
3115         )
3116     )
3117     ;;
3118 esac
3120 dnl ========================================================
3121 dnl Check the command line for --with-pthreads 
3122 dnl ========================================================
3123 MOZ_ARG_WITH_BOOL(pthreads,
3124 [  --with-pthreads         Force use of system pthread library with NSPR ],
3125 [ if test "$USE_PTHREADS"x = x; then
3126     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3127 fi],
3128     USE_PTHREADS=
3129     _PTHREAD_LDFLAGS=
3132 dnl ========================================================
3133 dnl Do the platform specific pthread hackery
3134 dnl ========================================================
3135 if test "$USE_PTHREADS"x != x
3136 then
3137         dnl
3138         dnl See if -pthread is supported.
3139         dnl
3140         rm -f conftest*
3141         ac_cv_have_dash_pthread=no
3142         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3143         echo 'int main() { return 0; }' | cat > conftest.c
3144         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3145         if test $? -eq 0; then
3146                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3147                         ac_cv_have_dash_pthread=yes
3148                 case "$target_os" in
3149                 freebsd*)
3150 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3151                 ;;
3152                 *)
3153                             CFLAGS="$CFLAGS -pthread"
3154                             CXXFLAGS="$CXXFLAGS -pthread"
3155                 ;;
3156                 esac
3157                 fi
3158         fi
3159         rm -f conftest*
3160     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3162         dnl
3163         dnl See if -pthreads is supported.
3164         dnl
3165     ac_cv_have_dash_pthreads=no
3166     if test "$ac_cv_have_dash_pthread" = "no"; then
3167             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3168         echo 'int main() { return 0; }' | cat > conftest.c
3169             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3170         if test $? -eq 0; then
3171                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3172                             ac_cv_have_dash_pthreads=yes
3173                             CFLAGS="$CFLAGS -pthreads"
3174                             CXXFLAGS="$CXXFLAGS -pthreads"
3175                     fi
3176             fi
3177             rm -f conftest*
3178         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3179     fi
3181         case "$target" in
3182             *-*-freebsd*)
3183                         AC_DEFINE(_REENTRANT)
3184                         AC_DEFINE(_THREAD_SAFE)
3185                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3186                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3187                                 _PTHREAD_LDFLAGS="-pthread"
3188                         else
3189                                 _PTHREAD_LDFLAGS="-lc_r"
3190                         fi
3191                         ;;
3193             *-*-openbsd*|*-*-bsdi*)
3194                         AC_DEFINE(_REENTRANT)
3195                         AC_DEFINE(_THREAD_SAFE)
3196                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3197                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3198                 _PTHREAD_LDFLAGS="-pthread"
3199                         fi
3200                         ;;
3202             *-*-linux*|*-*-kfreebsd*-gnu)
3203                         AC_DEFINE(_REENTRANT) 
3204                         ;;
3206             *-*-nto*) 
3207                         AC_DEFINE(_REENTRANT) 
3208                         ;;
3210             *-aix4.3*|*-aix5*)
3211                         AC_DEFINE(_REENTRANT) 
3212                         ;;
3214             *-hpux11.*)
3215                         AC_DEFINE(_REENTRANT) 
3216                         ;;
3218             alpha*-*-osf*)
3219                         AC_DEFINE(_REENTRANT)
3220                         ;;
3222             *-*-solaris*) 
3223                         AC_DEFINE(_REENTRANT) 
3224                         if test ! "$GNU_CC"; then
3225                                 CFLAGS="$CFLAGS -mt" 
3226                                 CXXFLAGS="$CXXFLAGS -mt" 
3227                         fi
3228                         ;;
3229         esac
3230     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3233 dnl ========================================================
3234 dnl See if mmap sees writes
3235 dnl For cross compiling, just define it as no, which is a safe default
3236 dnl ========================================================
3237 AC_MSG_CHECKING(whether mmap() sees write()s)
3239 changequote(,)
3240 mmap_test_prog='
3241     #include <stdlib.h>
3242     #include <unistd.h>
3243     #include <sys/mman.h>
3244     #include <sys/types.h>
3245     #include <sys/stat.h>
3246     #include <fcntl.h>
3248     char fname[] = "conftest.file";
3249     char zbuff[1024]; /* Fractional page is probably worst case */
3251     int main() {
3252         char *map;
3253         int fd;
3254         int i;
3255         unlink(fname);
3256         fd = open(fname, O_RDWR | O_CREAT, 0660);
3257         if(fd<0) return 1;
3258         unlink(fname);
3259         write(fd, zbuff, sizeof(zbuff));
3260         lseek(fd, 0, SEEK_SET);
3261         map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3262         if(map==(char*)-1) return 2;
3263         for(i=0; fname[i]; i++) {
3264             int rc = write(fd, &fname[i], 1);
3265             if(map[i]!=fname[i]) return 4;
3266         }
3267         return 0;
3268     }
3270 changequote([,])
3272 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3274 AC_MSG_RESULT("$result")
3276 if test "$result" = "no"; then
3277     AC_DEFINE(MMAP_MISSES_WRITES)
3281 dnl Checks for library functions.
3282 dnl ========================================================
3283 AC_PROG_GCC_TRADITIONAL
3284 AC_FUNC_MEMCMP
3285 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64)
3286 AC_CHECK_FUNCS(flockfile getpagesize)
3288 dnl localtime_r and strtok_r are only present on MacOS version 10.2 and higher
3289 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100200"; then
3290   AC_CHECK_FUNCS(localtime_r strtok_r)
3293 dnl check for wcrtomb/mbrtowc
3294 dnl =======================================================================
3295 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3296 AC_LANG_SAVE
3297 AC_LANG_CPLUSPLUS
3298 AC_CACHE_CHECK(for wcrtomb,
3299     ac_cv_have_wcrtomb,
3300     [AC_TRY_LINK([#include <wchar.h>],
3301                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3302                  ac_cv_have_wcrtomb="yes",
3303                  ac_cv_have_wcrtomb="no")])
3304 if test "$ac_cv_have_wcrtomb" = "yes"; then
3305     AC_DEFINE(HAVE_WCRTOMB)
3307 AC_CACHE_CHECK(for mbrtowc,
3308     ac_cv_have_mbrtowc,
3309     [AC_TRY_LINK([#include <wchar.h>],
3310                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3311                  ac_cv_have_mbrtowc="yes",
3312                  ac_cv_have_mbrtowc="no")])
3313 if test "$ac_cv_have_mbrtowc" = "yes"; then
3314     AC_DEFINE(HAVE_MBRTOWC)
3316 AC_LANG_RESTORE
3319 AC_CACHE_CHECK(
3320     [for res_ninit()],
3321     ac_cv_func_res_ninit,
3322     [AC_TRY_LINK([
3323         #ifdef linux
3324         #define _BSD_SOURCE 1
3325         #endif
3326         #include <resolv.h>
3327         ],
3328         [int foo = res_ninit(&_res);],
3329         [ac_cv_func_res_ninit=yes],
3330         [ac_cv_func_res_ninit=no])
3331     ])
3333 if test "$ac_cv_func_res_ninit" = "yes"; then
3334     AC_DEFINE(HAVE_RES_NINIT)
3335 dnl must add the link line we do something as foolish as this... dougt
3336 dnl else
3337 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3338 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3341 AC_LANG_CPLUSPLUS
3342 AC_CACHE_CHECK(
3343     [for gnu_get_libc_version()],
3344     ac_cv_func_gnu_get_libc_version,
3345     [AC_TRY_LINK([
3346         #ifdef HAVE_GNU_LIBC_VERSION_H
3347         #include <gnu/libc-version.h>
3348         #endif
3349         ],
3350         [const char *glibc_version = gnu_get_libc_version();],
3351         [ac_cv_func_gnu_get_libc_version=yes],
3352         [ac_cv_func_gnu_get_libc_version=no] 
3353         )]
3354     )
3356 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3357     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3360 case $target_os in
3361     os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|beos*)
3362         ;;
3363     *)
3364     
3365 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3366     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3367         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3368 _SAVE_LIBS=$LIBS
3369 LIBS="$LIBS $_ICONV_LIBS"
3370 AC_CACHE_CHECK(
3371     [for iconv()],
3372     ac_cv_func_iconv,
3373     [AC_TRY_LINK([
3374         #include <stdlib.h>
3375         #include <iconv.h>
3376         ],
3377         [
3378             iconv_t h = iconv_open("", "");
3379             iconv(h, NULL, NULL, NULL, NULL);
3380             iconv_close(h);
3381         ],
3382         [ac_cv_func_iconv=yes],
3383         [ac_cv_func_iconv=no] 
3384         )]
3385     )
3386 if test "$ac_cv_func_iconv" = "yes"; then
3387     AC_DEFINE(HAVE_ICONV)
3388     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3389     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3390     LIBICONV="$_ICONV_LIBS"
3391     AC_CACHE_CHECK(
3392         [for iconv() with const input],
3393         ac_cv_func_const_iconv,
3394         [AC_TRY_COMPILE([
3395             #include <stdlib.h>
3396             #include <iconv.h>
3397             ],
3398             [
3399                 const char *input = "testing";
3400                 iconv_t h = iconv_open("", "");
3401                 iconv(h, &input, NULL, NULL, NULL);
3402                 iconv_close(h);
3403             ],
3404             [ac_cv_func_const_iconv=yes],
3405             [ac_cv_func_const_iconv=no] 
3406             )]
3407         )
3408     if test "$ac_cv_func_const_iconv" = "yes"; then
3409         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3410     fi
3412 LIBS=$_SAVE_LIBS
3414     ;;
3415 esac
3417 AM_LANGINFO_CODESET
3419 AC_LANG_C
3421 dnl **********************
3422 dnl *** va_copy checks ***
3423 dnl **********************
3424 dnl we currently check for all three va_copy possibilities, so we get
3425 dnl all results in config.log for bug reports.
3426 AC_MSG_CHECKING(for an implementation of va_copy())
3427 AC_CACHE_VAL(ac_cv_va_copy,[
3428     AC_TRY_RUN([
3429         #include <stdarg.h>
3430         void f (int i, ...) {
3431             va_list args1, args2;
3432             va_start (args1, i);
3433             va_copy (args2, args1);
3434             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3435                 exit (1);
3436             va_end (args1); va_end (args2);
3437         }
3438         int main() { f (0, 42); return 0; }],
3439         ac_cv_va_copy=yes,
3440         ac_cv_va_copy=no,
3441         ac_cv_va_copy=no
3442     )
3444 AC_MSG_RESULT($ac_cv_va_copy)
3445 AC_MSG_CHECKING(for an implementation of __va_copy())
3446 AC_CACHE_VAL(ac_cv___va_copy,[
3447     AC_TRY_RUN([
3448         #include <stdarg.h>
3449         void f (int i, ...) {
3450             va_list args1, args2;
3451             va_start (args1, i);
3452             __va_copy (args2, args1);
3453             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3454                 exit (1);
3455             va_end (args1); va_end (args2);
3456         }
3457         int main() { f (0, 42); return 0; }],
3458         ac_cv___va_copy=yes,
3459         ac_cv___va_copy=no,
3460         ac_cv___va_copy=no
3461     )
3463 AC_MSG_RESULT($ac_cv___va_copy)
3464 AC_MSG_CHECKING(whether va_lists can be copied by value)
3465 AC_CACHE_VAL(ac_cv_va_val_copy,[
3466     AC_TRY_RUN([
3467         #include <stdarg.h>
3468         void f (int i, ...) {
3469             va_list args1, args2;
3470             va_start (args1, i);
3471             args2 = args1;
3472             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3473                 exit (1);
3474             va_end (args1); va_end (args2);
3475         }
3476         int main() { f (0, 42); return 0; }],
3477         ac_cv_va_val_copy=yes,
3478         ac_cv_va_val_copy=no,
3479         ac_cv_va_val_copy=yes
3480     )
3482 if test "x$ac_cv_va_copy" = "xyes"; then
3483     AC_DEFINE(VA_COPY, va_copy)
3484     AC_DEFINE(HAVE_VA_COPY)
3485 elif test "x$ac_cv___va_copy" = "xyes"; then
3486     AC_DEFINE(VA_COPY, __va_copy)
3487     AC_DEFINE(HAVE_VA_COPY)
3490 if test "x$ac_cv_va_val_copy" = "xno"; then
3491    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3493 AC_MSG_RESULT($ac_cv_va_val_copy)
3495 dnl Check for dll-challenged libc's.
3496 dnl This check is apparently only needed for Linux.
3497 case "$target" in
3498         *-linux*)
3499             dnl ===================================================================
3500             _curdir=`pwd`
3501             export _curdir
3502             rm -rf conftest* _conftest
3503             mkdir _conftest
3504             cat >> conftest.C <<\EOF
3505 #include <stdio.h>
3506 #include <link.h>
3507 #include <dlfcn.h>
3508 #ifdef _dl_loaded
3509 void __dump_link_map(void) {
3510   struct link_map *map = _dl_loaded;
3511   while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
3513 int main() {
3514   dlopen("./conftest1.so",RTLD_LAZY);
3515   dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
3516   dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
3517   dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
3518   __dump_link_map();
3520 #else
3521 /* _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).*/
3522 int main() { printf("./conftest1.so\n"); }
3523 #endif
3526             $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
3528             cat >> conftest1.C <<\EOF
3529 #include <stdio.h>
3530 void foo(void) {printf("foo in dll called\n");}
3532             ${CXX-g++} -fPIC -c -g conftest1.C
3533             ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
3534             ${CXX-g++} -g conftest.C -o conftest -ldl
3535             cp -f conftest1.so conftest _conftest
3536             cd _conftest
3537             if test `./conftest | grep conftest1.so | wc -l` -gt 1
3538             then
3539                 echo
3540                 echo "*** Your libc has a bug that can result in loading the same dynamic"
3541                 echo "*** library multiple times.  This bug is known to be fixed in glibc-2.0.7-32"
3542                 echo "*** or later.  However, if you choose not to upgrade, the only effect"
3543                 echo "*** will be excessive memory usage at runtime."
3544                 echo
3545             fi
3546             cd ${_curdir}
3547             rm -rf conftest* _conftest
3548             dnl ===================================================================
3549             ;;
3550 esac
3552 dnl ===================================================================
3553 dnl ========================================================
3554 dnl By default, turn rtti and exceptions off on g++/egcs
3555 dnl ========================================================
3556 if test "$GNU_CXX"; then
3558   AC_MSG_CHECKING(for C++ exceptions flag)
3560   dnl They changed -f[no-]handle-exceptions to -f[no-]exceptions in g++ 2.8
3561   AC_CACHE_VAL(ac_cv_cxx_exceptions_flags,
3562   [echo "int main() { return 0; }" | cat > conftest.C
3564   ${CXX-g++} ${CXXFLAGS} -c -fno-handle-exceptions conftest.C > conftest.out 2>&1
3566   if egrep "warning.*renamed" conftest.out >/dev/null; then
3567     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions
3568   else
3569     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-handle-exceptions
3570   fi
3572   rm -f conftest*])
3574   AC_MSG_RESULT($ac_cv_cxx_exceptions_flags)
3575   _MOZ_EXCEPTIONS_FLAGS_OFF=$ac_cv_cxx_exceptions_flags
3576   _MOZ_EXCEPTIONS_FLAGS_ON=`echo $ac_cv_cxx_exceptions_flags | sed 's|no-||'`
3579 dnl ========================================================
3580 dnl Put your C++ language/feature checks below
3581 dnl ========================================================
3582 AC_LANG_CPLUSPLUS
3584 HAVE_GCC3_ABI=
3585 if test "$GNU_CC"; then
3586   AC_CACHE_CHECK(for gcc 3.0 ABI,
3587       ac_cv_gcc_three_abi,
3588       [AC_TRY_COMPILE([],
3589                       [
3590 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
3591   return 0;
3592 #else
3593 #error Not gcc3.
3594 #endif
3595                       ],
3596                       ac_cv_gcc_three_abi="yes",
3597                       ac_cv_gcc_three_abi="no")])
3598   if test "$ac_cv_gcc_three_abi" = "yes"; then
3599       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc3}"
3600       HAVE_GCC3_ABI=1
3601   else
3602       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc2}"
3603   fi
3605 AC_SUBST(HAVE_GCC3_ABI)
3608 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
3609                ac_cv_cpp_explicit,
3610                [AC_TRY_COMPILE(class X {
3611                                public: explicit X(int i) : i_(i) {}
3612                                private: int i_;
3613                                };,
3614                                X x(3);,
3615                                ac_cv_cpp_explicit=yes,
3616                                ac_cv_cpp_explicit=no)])
3617 if test "$ac_cv_cpp_explicit" = yes ; then
3618    AC_DEFINE(HAVE_CPP_EXPLICIT)
3621 AC_CACHE_CHECK(for C++ \"typename\" keyword,
3622                ac_cv_cpp_typename,
3623                [AC_TRY_COMPILE(class param {
3624                                public:
3625                                    typedef unsigned long num_type;
3626                                };
3628                                template <class T> class tplt {
3629                                public:
3630                                    typedef typename T::num_type t_num_type;
3631                                    t_num_type foo(typename T::num_type num) {
3632                                        return num;
3633                                    }
3634                                };,
3635                                tplt<param> A;
3636                                A.foo(0);,
3637                                ac_cv_cpp_typename=yes,
3638                                ac_cv_cpp_typename=no)])
3639 if test "$ac_cv_cpp_typename" = yes ; then
3640    AC_DEFINE(HAVE_CPP_TYPENAME)
3643 dnl Check for support of modern template specialization syntax
3644 dnl Test code and requirement from scc@netscape.com.
3645 dnl Autoconf cut-and-paste job by waterson@netscape.com
3646 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3647                ac_cv_cpp_modern_specialize_template_syntax,
3648                [AC_TRY_COMPILE(template <class T> struct X { int a; };
3649                                class Y {};
3650                                template <> struct X<Y> { double a; };,
3651                                X<int> int_x;
3652                                X<Y> y_x;,
3653                                ac_cv_cpp_modern_specialize_template_syntax=yes,
3654                                ac_cv_cpp_modern_specialize_template_syntax=no)])
3655 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
3656   AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
3660 dnl Some compilers support only full specialization, and some don't.
3661 AC_CACHE_CHECK(whether partial template specialization works,
3662                ac_cv_cpp_partial_specialization,
3663                [AC_TRY_COMPILE(template <class T> class Foo {};
3664                                template <class T> class Foo<T*> {};,
3665                                return 0;,
3666                                ac_cv_cpp_partial_specialization=yes,
3667                                ac_cv_cpp_partial_specialization=no)])
3668 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3669   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3672 dnl Some compilers have limited support for operators with templates;
3673 dnl specifically, it is necessary to define derived operators when a base
3674 dnl class's operator declaration should suffice.
3675 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
3676                ac_cv_need_derived_template_operators,
3677                [AC_TRY_COMPILE([template <class T> class Base { };
3678                                 template <class T>
3679                                 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
3680                                 template <class T> class Derived : public Base<T> { };],
3681                                [Derived<char> a, b;
3682                                 Base<char> c = a + b;
3683                                 return 0;],
3684                                ac_cv_need_derived_template_operators=no,
3685                                ac_cv_need_derived_template_operators=yes)])
3686 if test "$ac_cv_need_derived_template_operators" = yes ; then
3687   AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
3691 dnl Some compilers have trouble detecting that a template class
3692 dnl that derives from another template is actually an instance
3693 dnl of the base class. This test checks for that.
3694 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
3695                ac_cv_need_cpp_template_cast_to_base,
3696                [AC_TRY_COMPILE([template <class T> class Base { };
3697                                 template <class T> class Derived : public Base<T> { };
3698                                 template <class T> int foo(const Base<T>&) { return 0; }],
3699                                [Derived<char> bar; return foo(bar);],
3700                                ac_cv_need_cpp_template_cast_to_base=no,
3701                                ac_cv_need_cpp_template_cast_to_base=yes)])
3702 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
3703   AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
3706 dnl Some compilers have trouble resolving the ambiguity between two
3707 dnl functions whose arguments differ only by cv-qualifications.
3708 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
3709                ac_cv_can_resolve_const_ambiguity,
3710                [AC_TRY_COMPILE([
3711                                 template <class T> class ptrClass {
3712                                   public: T* ptr;
3713                                 };
3715                                 template <class T> T* a(ptrClass<T> *arg) {
3716                                   return arg->ptr;
3717                                 }
3719                                 template <class T>
3720                                 const T* a(const ptrClass<T> *arg) {
3721                                   return arg->ptr;
3722                                 }
3723                                ],
3724                                [ ptrClass<int> i;
3725                                  a(&i); ],
3726                                ac_cv_can_resolve_const_ambiguity=yes,
3727                                ac_cv_can_resolve_const_ambiguity=no)])
3728 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
3729   AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
3733 dnl We don't do exceptions on unix.  The only reason this used to be here
3734 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses 
3735 dnl exceptions.  But, we turn exceptions off by default and this test breaks.
3736 dnl So im commenting this out until someone writes some artificial 
3737 dnl intelligence to detect not only if the compiler has exceptions, but if 
3738 dnl they are enabled as well.
3739 dnl 
3740 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
3741 dnl                ac_cv_cpp_exceptions,
3742 dnl                [AC_TRY_COMPILE(class X { public: X() {} };
3743 dnl                                static void F() { throw X(); },
3744 dnl                                try { F(); } catch(X & e) { },
3745 dnl                                ac_cv_cpp_exceptions=yes,
3746 dnl                                ac_cv_cpp_exceptions=no)])
3747 dnl if test $ac_cv_cpp_exceptions = yes ; then
3748 dnl    AC_DEFINE(HAVE_CPP_EXCEPTIONS)
3749 dnl fi
3751 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
3752 dnl supports it well enough to allow us to use it to change access, but not
3753 dnl to resolve ambiguity. The next two tests determine how well the |using|
3754 dnl keyword is supported.
3756 dnl Check to see if we can change access with |using|.  Test both a
3757 dnl legal and an illegal example.
3758 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
3759                ac_cv_cpp_access_changing_using2,
3760                [AC_TRY_COMPILE(
3761                    class A { protected: int foo() { return 0; } };
3762                    class B : public A { public: using A::foo; };,
3763                    B b; return b.foo();,
3764                    [AC_TRY_COMPILE(
3765                        class A { public: int foo() { return 1; } };
3766                        class B : public A { private: using A::foo; };,
3767                        B b; return b.foo();,
3768                        ac_cv_cpp_access_changing_using2=no,
3769                        ac_cv_cpp_access_changing_using2=yes)],
3770                    ac_cv_cpp_access_changing_using2=no)])
3771 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
3772    AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
3775 dnl Check to see if we can resolve ambiguity with |using|.
3776 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3777                ac_cv_cpp_ambiguity_resolving_using,
3778                [AC_TRY_COMPILE(class X { 
3779                                  public: int go(const X&) {return 3;}
3780                                          int jo(const X&) {return 3;}
3781                                };
3782                                class Y : public X {
3783                                  public:  int go(int) {return 2;}
3784                                           int jo(int) {return 2;}
3785                                           using X::jo;
3786                                  private: using X::go;
3787                                };,
3788                                X x; Y y; y.jo(x);,
3789                                ac_cv_cpp_ambiguity_resolving_using=yes,
3790                                ac_cv_cpp_ambiguity_resolving_using=no)])
3791 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3792    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3795 dnl Check to see if the |std| namespace is supported. If so, we'll want
3796 dnl to qualify any standard library calls with "std::" to ensure that
3797 dnl those functions can be resolved.
3798 AC_CACHE_CHECK(for \"std::\" namespace,
3799                ac_cv_cpp_namespace_std,
3800                [AC_TRY_COMPILE([#include <algorithm>],
3801                                [return std::min(0, 1);],
3802                                ac_cv_cpp_namespace_std=yes,
3803                                ac_cv_cpp_namespace_std=no)])
3804 if test "$ac_cv_cpp_namespace_std" = yes ; then
3805    AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
3808 dnl Older compilers are overly ambitious with respect to using the standard
3809 dnl template library's |operator!=()| when |operator==()| is defined. In
3810 dnl which case, defining |operator!=()| in addition to |operator==()| causes
3811 dnl ambiguity at compile-time. This test checks for that case.
3812 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
3813                ac_cv_cpp_unambiguous_std_notequal,
3814                [AC_TRY_COMPILE([#include <algorithm>
3815                                 struct T1 {};
3816                                 int operator==(const T1&, const T1&) { return 0; }
3817                                 int operator!=(const T1&, const T1&) { return 0; }],
3818                                [T1 a,b; return a != b;],
3819                                ac_cv_cpp_unambiguous_std_notequal=unambiguous,
3820                                ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
3821 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
3822   AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
3826 AC_CACHE_CHECK(for C++ reinterpret_cast,
3827                ac_cv_cpp_reinterpret_cast,
3828                [AC_TRY_COMPILE(struct X { int i; };
3829                                struct Y { int i; };,
3830                                X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
3831                                ac_cv_cpp_reinterpret_cast=yes,
3832                                ac_cv_cpp_reinterpret_cast=no)])
3833 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
3834    AC_DEFINE(HAVE_CPP_NEW_CASTS)
3837 dnl See if a dynamic_cast to void* gives the most derived object.
3838 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3839                ac_cv_cpp_dynamic_cast_void_ptr,
3840                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3841                             class Y { int j; public: virtual ~Y() { } };
3842                             class Z : public X, public Y { int k; };
3844                             int main() {
3845                                  Z mdo;
3846                                  X *subx = (X*)&mdo;
3847                                  Y *suby = (Y*)&mdo;
3848                                  return !((((void*)&mdo != (void*)subx) &&
3849                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3850                                           (((void*)&mdo != (void*)suby) &&
3851                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
3852                             }],
3853                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
3854                            ac_cv_cpp_dynamic_cast_void_ptr=no,
3855                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
3856 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3857    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3861 dnl note that this one is reversed - if the test fails, then
3862 dnl we require implementations of unused virtual methods. Which
3863 dnl really blows because it means we'll have useless vtable
3864 dnl bloat.
3865 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3866                ac_cv_cpp_unused_required,
3867                [AC_TRY_LINK(class X {private: virtual void never_called();};,
3868                                X x;,
3869                                ac_cv_cpp_unused_required=no,
3870                                ac_cv_cpp_unused_required=yes)])
3871 if test "$ac_cv_cpp_unused_required" = yes ; then
3872    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3876 dnl Some compilers have trouble comparing a constant reference to a templatized
3877 dnl class to zero, and require an explicit operator==() to be defined that takes
3878 dnl an int. This test separates the strong from the weak.
3880 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3881                ac_cv_trouble_comparing_to_zero,
3882                [AC_TRY_COMPILE([#include <algorithm>
3883                                 template <class T> class Foo {};
3884                                 class T2;
3885                                 template <class T> int operator==(const T2*, const T&) { return 0; }
3886                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3887                                [Foo<int> f; return (0 != f);],
3888                                ac_cv_trouble_comparing_to_zero=no,
3889                                ac_cv_trouble_comparing_to_zero=yes)])
3890 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3891   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3896 dnl End of C++ language/feature checks
3897 AC_LANG_C
3899 dnl ========================================================
3900 dnl =  Internationalization checks
3901 dnl ========================================================
3903 dnl Internationalization and Locale support is different
3904 dnl on various UNIX platforms.  Checks for specific i18n
3905 dnl features go here.
3907 dnl check for LC_MESSAGES
3908 AC_CACHE_CHECK(for LC_MESSAGES,
3909                 ac_cv_i18n_lc_messages,
3910                 [AC_TRY_COMPILE([#include <locale.h>],
3911                                 [int category = LC_MESSAGES;],
3912                                 ac_cv_i18n_lc_messages=yes,
3913                                 ac_cv_i18n_lc_messages=no)])
3914 if test "$ac_cv_i18n_lc_messages" = yes; then
3915    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3916 fi      
3918 fi # SKIP_COMPILER_CHECKS
3920 TARGET_XPCOM_ABI=
3921 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3922     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3925 dnl Mozilla specific options
3926 dnl ========================================================
3927 dnl The macros used for command line options
3928 dnl are defined in build/autoconf/altoptions.m4.
3931 dnl ========================================================
3932 dnl =
3933 dnl = Check for external package dependencies
3934 dnl =
3935 dnl ========================================================
3936 MOZ_ARG_HEADER(External Packages)
3938 MOZ_ENABLE_LIBXUL=
3940 MOZ_ARG_WITH_STRING(libxul-sdk,
3941 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
3942   LIBXUL_SDK_DIR=$withval)
3944 if test "$LIBXUL_SDK_DIR" = "yes"; then
3945     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
3946 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
3947     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
3949     if test ! -f "$LIBXUL_SDK/sdk/include/xpcom-config.h"; then
3950         AC_MSG_ERROR([$LIBXUL_SDK/sdk/include/xpcom-config.h doesn't exist])
3951     fi
3953     MOZ_ENABLE_LIBXUL=1
3955 AC_SUBST(LIBXUL_SDK)
3957 dnl ========================================================
3958 dnl = If NSPR was not detected in the system, 
3959 dnl = use the one in the source tree (mozilla/nsprpub)
3960 dnl ========================================================
3961 MOZ_ARG_WITH_BOOL(system-nspr,
3962 [  --with-system-nspr      Use system installed NSPR],
3963     _USE_SYSTEM_NSPR=1 )
3965 if test -n "$_USE_SYSTEM_NSPR"; then
3966     AM_PATH_NSPR(4.7.0, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
3969 if test -n "$MOZ_NATIVE_NSPR"; then
3970     _SAVE_CFLAGS=$CFLAGS
3971     CFLAGS="$CFLAGS $NSPR_CFLAGS"
3972     AC_TRY_COMPILE([#include "prlog.h"],
3973                 [#ifndef PR_STATIC_ASSERT
3974                  #error PR_STATIC_ASSERT not defined
3975                  #endif],
3976                 [MOZ_NATIVE_NSPR=1],
3977                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
3978     CFLAGS=$_SAVE_CFLAGS
3979 else
3980     NSPR_CFLAGS='`$(DEPTH)/nsprpub/config/nspr-config --prefix=$(LIBXUL_DIST) --includedir=$(LIBXUL_DIST)/include/nspr --cflags`'
3981     # explicitly set libs for Visual Age C++ for OS/2
3982     if test "$OS_ARCH" = "OS2" -a "$VACPP" = "yes"; then
3983         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''
3984     elif test "$OS_ARCH" = "WINCE"; then
3985         NSPR_CFLAGS='-I$(LIBXUL_DIST)/include/nspr'
3986         NSPR_LIBS='$(LIBXUL_DIST)/lib/nspr'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plc'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plds'$NSPR_VERSION'.lib '
3987     elif test "$OS_ARCH" = "WINNT"; then
3988         NSPR_CFLAGS='-I$(LIBXUL_DIST)/include/nspr'
3989         if test -n "$GNU_CC"; then
3990             NSPR_LIBS="-L\$(LIBXUL_DIST)/lib -lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION"
3991         else
3992             NSPR_LIBS='$(LIBXUL_DIST)/lib/nspr'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plc'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plds'$NSPR_VERSION'.lib '
3993         fi
3994     else
3995         NSPR_LIBS='`$(DEPTH)/nsprpub/config/nspr-config --prefix=$(LIBXUL_DIST) --libdir=$(LIBXUL_DIST)/lib --libs`'
3996     fi
3999 dnl ========================================================
4000 dnl = If NSS was not detected in the system, 
4001 dnl = use the one in the source tree (mozilla/security/nss)
4002 dnl ========================================================
4004 MOZ_ARG_WITH_BOOL(system-nss,
4005 [  --with-system-nss      Use system installed NSS],
4006     _USE_SYSTEM_NSS=1 )
4008 if test -n "$_USE_SYSTEM_NSS"; then
4009     AM_PATH_NSS(3.12.0, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4012 if test -n "$MOZ_NATIVE_NSS"; then
4013    NSS_LIBS="$NSS_LIBS -lcrmf"
4014 else
4015    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4016    NSS_DEP_LIBS="\
4017         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4018         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4019         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4020         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4021         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX) \
4022         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)softokn$NSS_VERSION\$(DLL_SUFFIX)"
4024    if test -z "$GNU_CC" && test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4025        NSS_LIBS="\
4026         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4027         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4028         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4029         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4030         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4031         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)softokn$NSS_VERSION.\$(IMPORT_LIB_SUFFIX)"
4032    else
4033        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION -lsoftokn$NSS_VERSION"
4034    fi
4037 if test -z "$SKIP_LIBRARY_CHECKS"; then
4038 dnl system JPEG support
4039 dnl ========================================================
4040 MOZ_ARG_WITH_STRING(system-jpeg,
4041 [  --with-system-jpeg[=PFX]
4042                           Use system libjpeg [installed at prefix PFX]],
4043     JPEG_DIR=$withval)
4045 _SAVE_CFLAGS=$CFLAGS
4046 _SAVE_LDFLAGS=$LDFLAGS
4047 _SAVE_LIBS=$LIBS
4048 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4049     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4050     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4052 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4053     SYSTEM_JPEG=
4054 else
4055     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4058 if test "$SYSTEM_JPEG" = 1; then
4059     LIBS="$JPEG_LIBS $LIBS"
4060     AC_TRY_COMPILE([ #include <stdio.h>
4061                      #include <sys/types.h>
4062                      #include <jpeglib.h> ],
4063                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4064                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4065                      #endif ],
4066                    SYSTEM_JPEG=1,
4067                    [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=]) 
4068 fi 
4069 CFLAGS=$_SAVE_CFLAGS
4070 LDFLAGS=$_SAVE_LDFLAGS
4071 LIBS=$_SAVE_LIBS
4073 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4074     JPEG_CFLAGS="-I${JPEG_DIR}/include"
4075     JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4078 dnl system ZLIB support
4079 dnl ========================================================
4080 MOZ_ARG_WITH_STRING(system-zlib,
4081 [  --with-system-zlib[=PFX]
4082                           Use system libz [installed at prefix PFX]],
4083     ZLIB_DIR=$withval)
4085 _SAVE_CFLAGS=$CFLAGS
4086 _SAVE_LDFLAGS=$LDFLAGS
4087 _SAVE_LIBS=$LIBS
4088 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4089     CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4090     LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4092 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4093     SYSTEM_ZLIB=
4094 else
4095     AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"], 
4096         [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4098 if test "$SYSTEM_ZLIB" = 1; then
4099     LIBS="$ZLIB_LIBS $LIBS"
4100     AC_TRY_COMPILE([ #include <stdio.h>
4101                      #include <string.h>
4102                      #include <zlib.h> ],
4103                    [ #if ZLIB_VERNUM < $MOZZLIB 
4104                      #error "Insufficient zlib version ($MOZZLIB required)."
4105                      #endif ],
4106                    SYSTEM_ZLIB=1,
4107                    [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=]) 
4109 CFLAGS=$_SAVE_CFLAGS
4110 LDFLAGS=$_SAVE_LDFLAGS
4111 LIBS=$_SAVE_LIBS
4113 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4114     ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4115     ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4118 dnl system BZIP2 Support
4119 dnl ========================================================
4120 MOZ_ARG_WITH_STRING(system-bz2,
4121 [  --with-system-bz2[=PFX]
4122                           Use system libbz2 [installed at prefix PFX]],
4123     BZ2_DIR=$withval)
4125 _SAVE_CFLAGS=$CFLAGS
4126 _SAVE_LDFLAGS=$LDFLAGS
4127 _SAVE_LIBS=$LIBS
4128 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4129     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4130     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4132 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4133     SYSTEM_BZ2=
4134 else
4135     AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4136         [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=], $BZ2_LIBS)
4138 CFLAGS=$_SAVE_CFLAGS
4139 LDFLAGS=$_SAVE_LDFLAGS
4140 LIBS=$_SAVE_LIBS
4142 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4143     BZ2_CFLAGS="-I${BZ2_DIR}/include"
4144     BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4147 dnl system PNG Support
4148 dnl ========================================================
4149 MOZ_ARG_WITH_STRING(system-png, 
4150 [  --with-system-png[=PFX]
4151                           Use system libpng [installed at prefix PFX]],
4152     PNG_DIR=$withval)
4154 _SAVE_CFLAGS=$CFLAGS
4155 _SAVE_LDFLAGS=$LDFLAGS
4156 _SAVE_LIBS=$LIBS
4157 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4158 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4159 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4160     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4161     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4163 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4164     SYSTEM_PNG=
4165 else
4166     _SAVE_PNG_LIBS=$PNG_LIBS
4167     AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4168                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]), 
4169                  $PNG_LIBS)
4170     AC_CHECK_LIB(png, png_get_acTL, ,
4171                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4172                  $_SAVE_PNG_LIBS)
4174 if test "$SYSTEM_PNG" = 1; then
4175     LIBS="$PNG_LIBS $LIBS"
4176     AC_TRY_COMPILE([ #include <stdio.h>
4177                      #include <sys/types.h>
4178                      #include <png.h> ],
4179                    [ #if PNG_LIBPNG_VER < $MOZPNG
4180                      #error "Insufficient libpng version ($MOZPNG required)."
4181                      #endif
4182                      #ifndef PNG_UINT_31_MAX
4183                      #error "Insufficient libpng version."
4184                      #endif ],
4185                    SYSTEM_PNG=1,
4186                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4188 CFLAGS=$_SAVE_CFLAGS
4189 LDFLAGS=$_SAVE_LDFLAGS
4190 LIBS=$_SAVE_LIBS
4192 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4193     PNG_CFLAGS="-I${PNG_DIR}/include"
4194     PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4197 fi # SKIP_LIBRARY_CHECKS
4199 dnl system HunSpell Support
4200 dnl ========================================================
4201 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4202 [  --enable-system-hunspell  Use system hunspell (located with pkgconfig)],
4203     SYSTEM_HUNSPELL=1 )
4205 if test -n "$SYSTEM_HUNSPELL"; then
4206     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4209 AC_SUBST(SYSTEM_HUNSPELL)
4211 dnl check whether to enable glitz
4212 dnl ========================================================
4213 MOZ_ARG_ENABLE_BOOL(glitz,
4214 [  --enable-glitz          Enable Glitz for use with Cairo],
4215     MOZ_ENABLE_GLITZ=1,
4216     MOZ_ENABLE_GLITZ= )
4217 if test "$MOZ_ENABLE_GLITZ"; then
4218     AC_DEFINE(MOZ_ENABLE_GLITZ)
4221 dnl ========================================================
4222 dnl Java SDK support
4223 dnl ========================================================
4224 JAVA_INCLUDE_PATH=
4225 MOZ_ARG_WITH_STRING(java-include-path,
4226 [  --with-java-include-path=dir   Location of Java SDK headers],
4227     JAVA_INCLUDE_PATH=$withval)
4229 JAVA_BIN_PATH=
4230 MOZ_ARG_WITH_STRING(java-bin-path,
4231 [  --with-java-bin-path=dir   Location of Java binaries (java, javac, jar)],
4232     JAVA_BIN_PATH=$withval)
4234 dnl ========================================================
4235 dnl =
4236 dnl = Application
4237 dnl =
4238 dnl ========================================================
4240 MOZ_ARG_HEADER(Application)
4242 BUILD_STATIC_LIBS=
4243 ENABLE_TESTS=1
4244 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4245 MOZ_BRANDING_DIRECTORY=
4246 MOZ_CALENDAR=
4247 MOZ_DBGRINFO_MODULES=
4248 MOZ_ENABLE_CANVAS=1
4249 MOZ_EXTENSIONS_ALL=" wallet p3p venkman inspector irc typeaheadfind gnomevfs sroaming datetime finger cview layout-debug tasks sql xforms schema-validation reporter"
4250 MOZ_FEEDS=1
4251 MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp xbm icon"
4252 MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
4253 MOZ_IPCD=
4254 MOZ_JAVAXPCOM=
4255 MOZ_JSDEBUGGER=1
4256 MOZ_JSLOADER=1
4257 MOZ_LDAP_XPCOM=
4258 MOZ_LIBART_CFLAGS=
4259 MOZ_LIBART_LIBS=
4260 MOZ_MAIL_NEWS=
4261 MOZ_MATHML=1
4262 MOZ_MOCHITEST=1
4263 MOZ_MORK=1
4264 MOZ_MORKREADER=
4265 MOZ_AUTH_EXTENSION=1
4266 MOZ_NO_ACTIVEX_SUPPORT=1
4267 MOZ_NO_INSPECTOR_APIS=
4268 MOZ_NO_XPCOM_OBSOLETE=
4269 MOZ_NO_FAST_LOAD=
4270 MOZ_OJI=
4271 MOZ_PERMISSIONS=1
4272 MOZ_PLACES=
4273 MOZ_PLAINTEXT_EDITOR_ONLY=
4274 MOZ_PLUGINS=1
4275 MOZ_PREF_EXTENSIONS=1
4276 MOZ_PROFILELOCKING=1
4277 MOZ_PROFILESHARING=1
4278 MOZ_PSM=1
4279 MOZ_PYTHON_EXTENSIONS="xpcom dom"
4280 MOZ_PYTHON=
4281 MOZ_PYTHON_DEBUG_SUFFIX=
4282 MOZ_PYTHON_DLL_SUFFIX=
4283 MOZ_PYTHON_INCLUDES=
4284 MOZ_PYTHON_LIBS=
4285 MOZ_PYTHON_PREFIX=
4286 MOZ_PYTHON_VER=
4287 MOZ_PYTHON_VER_DOTTED=
4288 MOZ_RDF=1
4289 MOZ_REFLOW_PERF=
4290 MOZ_SAFE_BROWSING=
4291 MOZ_HELP_VIEWER=
4292 MOZ_SPELLCHECK=1
4293 MOZ_STATIC_MAIL_BUILD=
4294 MOZ_STORAGE=1
4295 MOZ_SVG=1
4296 MOZ_TIMELINE=
4297 MOZ_UI_LOCALE=en-US
4298 MOZ_UNIVERSALCHARDET=1
4299 MOZ_URL_CLASSIFIER=
4300 MOZ_USE_NATIVE_UCONV=
4301 MOZ_V1_STRING_ABI=
4302 MOZ_VIEW_SOURCE=1
4303 MOZ_XPFE_COMPONENTS=1
4304 MOZ_XPINSTALL=1
4305 MOZ_XSLT_STANDALONE=
4306 MOZ_XTF=1
4307 MOZ_XUL=1
4308 MOZ_XUL_APP=1
4309 MOZ_ZIPWRITER=1
4310 NS_PRINTING=1
4311 NECKO_COOKIES=1
4312 NECKO_DISK_CACHE=1
4313 NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource"
4314 NECKO_SMALL_BUFFERS=
4315 SUNCTL=
4316 JS_STATIC_BUILD=
4317 XPC_IDISPATCH_SUPPORT=
4320 case "$target_os" in
4321 darwin*)
4322     ACCESSIBILITY=
4323     ;;
4325     ACCESSIBILITY=1
4326     ;;
4327 esac
4329 case "$target_os" in
4330     msvc*|mks*|cygwin*|mingw*)
4331         if test -z "$GNU_CC"; then 
4332             XPC_IDISPATCH_SUPPORT=1
4333             MOZ_NO_ACTIVEX_SUPPORT=
4334             MOZ_ACTIVEX_SCRIPTING_SUPPORT=1
4335         fi
4336         ;;
4337 esac
4339 MOZ_ARG_ENABLE_STRING(application,
4340 [  --enable-application=APP
4341                           Options include:
4342                             suite
4343                             browser (Firefox)
4344                             mail (Thunderbird)
4345                             minimo
4346                             composer
4347                             calendar (Sunbird)
4348                             xulrunner
4349                             camino
4350                             content/xslt (Standalone Transformiix XSLT)
4351                             netwerk (Standalone Necko)
4352                             tools/update-packaging (AUS-related packaging tools)
4353                             standalone (use this for standalone
4354                               xpcom/xpconnect or to manually drive a build)],
4355 [ MOZ_BUILD_APP=$enableval ] )
4357 if test "$MOZ_BUILD_APP" = "macbrowser"; then
4358     AC_MSG_WARN([--enable-application=macbrowser is deprecated. Use --enable-application=camino.])
4359     MOZ_BUILD_APP=camino
4362 case "$MOZ_BUILD_APP" in
4363 minimo)
4364   MOZ_EMBEDDING_PROFILE=basic
4365   ;;
4368   MOZ_EMBEDDING_PROFILE=default
4369   ;;
4370 esac
4372 MOZ_ARG_WITH_STRING(embedding-profile,
4373 [  --with-embedding-profile=default|basic|minimal
4374                        see http://wiki.mozilla.org/Gecko:Small_Device_Support],
4375 [ MOZ_EMBEDDING_PROFILE=$withval ])
4377 case "$MOZ_EMBEDDING_PROFILE" in
4378 default)
4379   MOZ_EMBEDDING_LEVEL_DEFAULT=1
4380   MOZ_EMBEDDING_LEVEL_BASIC=1
4381   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4382   AC_DEFINE(MOZ_EMBEDDING_LEVEL_DEFAULT)
4383   AC_DEFINE(MOZ_EMBEDDING_LEVEL_BASIC)
4384   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4385   ;;
4387 basic)
4388   MOZ_EMBEDDING_LEVEL_DEFAULT=
4389   MOZ_EMBEDDING_LEVEL_BASIC=1
4390   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4391   AC_DEFINE(MOZ_EMBEDDING_LEVEL_BASIC)
4392   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4393   ENABLE_TESTS=
4394   MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4395   MOZ_COMPOSER=
4396   MOZ_ENABLE_CANVAS=
4397   MOZ_ENABLE_POSTSCRIPT=
4398   MOZ_EXTENSIONS_DEFAULT=" spatialnavigation"
4399   MOZ_IMG_DECODERS_DEFAULT="png gif jpeg"
4400   MOZ_IMG_ENCODERS_DEFAULT=
4401   MOZ_IMG_ENCODERS=
4402   MOZ_INSTALLER=
4403   MOZ_JSDEBUGGER=
4404   MOZ_LDAP_XPCOM=
4405   MOZ_MAIL_NEWS=
4406   MOZ_MATHML=
4407   MOZ_AUTH_EXTENSION=
4408   MOZ_NO_ACTIVEX_SUPPORT=1
4409   MOZ_NO_INSPECTOR_APIS=1
4410   MOZ_NO_XPCOM_OBSOLETE=1
4411   MOZ_NO_FAST_LOAD=1
4412   MOZ_OJI=
4413   MOZ_PLAINTEXT_EDITOR_ONLY=1
4414 #  MOZ_PLUGINS=
4415   MOZ_PREF_EXTENSIONS=
4416   MOZ_PROFILELOCKING=
4417   MOZ_PROFILESHARING=
4418   MOZ_SPELLCHECK=
4419   MOZ_SVG=
4420   MOZ_UNIVERSALCHARDET=
4421   MOZ_UPDATER=
4422   MOZ_USE_NATIVE_UCONV=
4423   MOZ_VIEW_SOURCE=
4424   MOZ_XPFE_COMPONENTS=
4425   MOZ_XPINSTALL=
4426   MOZ_XTF=
4427   MOZ_ZIPWRITER=
4428   NECKO_DISK_CACHE=
4429   NECKO_PROTOCOLS_DEFAULT="about data http file res"
4430   NECKO_SMALL_BUFFERS=1
4431   NS_DISABLE_LOGGING=1
4432   NS_PRINTING=
4433   JS_STATIC_BUILD=1
4434   ;;
4436 minimal)
4437   MOZ_EMBEDDING_LEVEL_DEFAULT=
4438   MOZ_EMBEDDING_LEVEL_BASIC=
4439   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4440   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4441   ENABLE_TESTS=
4442   MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4443   MOZ_COMPOSER=
4444   MOZ_ENABLE_CANVAS=
4445   MOZ_ENABLE_POSTSCRIPT=
4446   MOZ_EXTENSIONS_DEFAULT=" spatialnavigation"
4447   MOZ_IMG_DECODERS_DEFAULT="png gif jpeg"
4448   MOZ_IMG_ENCODERS_DEFAULT=
4449   MOZ_IMG_ENCODERS=
4450   MOZ_INSTALLER=
4451   MOZ_JSDEBUGGER=
4452   MOZ_LDAP_XPCOM=
4453   MOZ_MAIL_NEWS=
4454   MOZ_MATHML=
4455   MOZ_AUTH_EXTENSION=
4456   MOZ_NO_ACTIVEX_SUPPORT=1
4457   MOZ_NO_INSPECTOR_APIS=1
4458   MOZ_NO_XPCOM_OBSOLETE=1
4459   MOZ_NO_FAST_LOAD=1
4460   MOZ_OJI=
4461   MOZ_PLAINTEXT_EDITOR_ONLY=1
4462   MOZ_PLUGINS=
4463   MOZ_PREF_EXTENSIONS=
4464   MOZ_PROFILELOCKING=
4465   MOZ_PROFILESHARING=
4466   MOZ_SPELLCHECK=
4467   MOZ_STORAGE=1
4468   MOZ_PLACES=
4469   MOZ_SVG=
4470   MOZ_UNIVERSALCHARDET=
4471   MOZ_UPDATER=
4472   MOZ_USE_NATIVE_UCONV=1
4473   MOZ_VIEW_SOURCE=
4474   MOZ_XPFE_COMPONENTS=
4475   MOZ_XPINSTALL=
4476   MOZ_XTF=
4477   MOZ_XUL=
4478   MOZ_ZIPWRITER=
4479   MOZ_RDF=
4480   NECKO_DISK_CACHE=
4481   NECKO_PROTOCOLS_DEFAULT="about data http file res"
4482   NECKO_SMALL_BUFFERS=1
4483   NS_DISABLE_LOGGING=1
4484   NS_PRINTING=
4485   JS_STATIC_BUILD=1
4486   ;;
4489   AC_MSG_ERROR([Unrecognized value: --with-embedding-profile=$MOZ_EMBEDDING_PROFILE])
4490   ;;
4491 esac
4493 AC_SUBST(MOZ_EMBEDDING_LEVEL_DEFAULT)
4494 AC_SUBST(MOZ_EMBEDDING_LEVEL_BASIC)
4495 AC_SUBST(MOZ_EMBEDDING_LEVEL_MINIMAL)
4497 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4498 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
4499   XULRUNNER_STUB_NAME=$withval)
4501 if test -z "$XULRUNNER_STUB_NAME"; then
4502   case "$target_os" in
4503   darwin*)
4504     XULRUNNER_STUB_NAME=xulrunner
4505     ;;
4506   *)
4507     XULRUNNER_STUB_NAME=xulrunner-stub
4508   esac
4510 AC_SUBST(XULRUNNER_STUB_NAME)
4512 if test -z "$MOZ_BUILD_APP"; then
4513   AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
4514 else
4515   # We have a valid application only if it has a build.mk file in its top
4516   # directory.
4517   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4518     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4519   fi
4522 # Allow the application to influence configure with a confvars.sh script.
4524 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4525 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4526   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4527   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4528 else
4529   AC_MSG_RESULT([no])
4532 # Now is a good time to test for logic errors, define mismatches, etc.
4533 case "$MOZ_BUILD_APP" in
4534 xulrunner)
4535   if test "$LIBXUL_SDK"; then
4536     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4537   fi
4538   ;;
4540   # Fix this case for folks who forget. Warn them.
4541   if test -n "$LIBXUL_SDK" -a -z "$MOZ_XUL_APP"; then
4542     AC_MSG_WARN([Setting MOZ_XUL_APP since LIBXUL_SDK was set. Add to confvars.sh!])
4543     MOZ_XUL_APP=1
4544   fi
4545   ;;
4546 esac
4548 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4549 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4550 # MOZ_BUILD_APP.
4551 case "$MOZ_BUILD_APP" in
4552 suite)
4553   AC_DEFINE(MOZ_SUITE)
4554   ;;
4556 browser)
4557   AC_DEFINE(MOZ_PHOENIX)
4558   ;;
4560 minimo)
4561   AC_DEFINE(MINIMO)
4562   ;;
4564 mail)
4565   AC_DEFINE(MOZ_THUNDERBIRD)
4566   ;;
4568 composer)
4569   AC_DEFINE(MOZ_STANDALONE_COMPOSER)
4570   ;;
4572 calendar)
4573   AC_DEFINE(MOZ_SUNBIRD)
4574   ;;
4576 xulrunner)
4577   AC_DEFINE(MOZ_XULRUNNER)
4578   ;;
4580 camino) 
4581   AC_DEFINE(MOZ_MACBROWSER)
4582   ;;
4584 content/xslt)
4585   AC_DEFINE(TX_EXE)
4586   ;;
4588 standalone) 
4589   MOZ_APP_NAME=mozilla
4590   MOZ_APP_DISPLAYNAME=Mozilla
4591   MOZ_APP_VERSION=$MOZILLA_VERSION
4592   ;;
4594 esac
4596 AC_SUBST(MOZ_BUILD_APP)
4597 AC_SUBST(MOZ_XUL_APP)
4598 AC_SUBST(MOZ_SUITE)
4599 AC_SUBST(MOZ_PHOENIX)
4600 AC_SUBST(MOZ_THUNDERBIRD)
4601 AC_SUBST(MOZ_STANDALONE_COMPOSER)
4602 AC_SUBST(MOZ_SUNBIRD)
4603 AC_SUBST(MOZ_XULRUNNER)
4605 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4607 if test "$MOZ_XUL_APP"; then
4608   MOZ_PROFILESHARING=
4609   AC_DEFINE(MOZ_XUL_APP)
4612 dnl ========================================================
4613 dnl = 
4614 dnl = Toolkit Options
4615 dnl = 
4616 dnl ========================================================
4617 MOZ_ARG_HEADER(Toolkit Options)
4619     dnl ========================================================
4620     dnl = Select the default toolkit
4621     dnl ========================================================
4622         MOZ_ARG_ENABLE_STRING(default-toolkit,
4623         [  --enable-default-toolkit=TK
4624                           Select default toolkit
4625                           Platform specific defaults:
4626                             BeOS - cairo-beos
4627                             Mac OS X - cairo-cocoa
4628                             Neutrino/QNX - photon
4629                             OS/2 - cairo-os2
4630                             Win32 - cairo-windows
4631                             WinCE - windows
4632                             * - cairo-gtk2
4633                             * - cairo-qt],
4634     [ _DEFAULT_TOOLKIT=$enableval ],
4635     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4637     if test "$_DEFAULT_TOOLKIT" = "photon" \
4638         -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4639         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4640         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4641         -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
4642         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4643         -o "$_DEFAULT_TOOLKIT" = "cairo-mac" \
4644         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa"
4645     then
4646         dnl nglayout only supports building with one toolkit,
4647         dnl so ignore everything after the first comma (",").
4648         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4649     else
4650         if test "$no_x" != "yes"; then
4651             AC_MSG_ERROR([Toolkit must be cairo-gtk2 or cairo-qt.])
4652         else
4653             AC_MSG_ERROR([Toolkit must be $_PLATFORM_DEFAULT_TOOLKIT (if supported).])
4654         fi
4655     fi
4657 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_TOOLKIT,"$MOZ_WIDGET_TOOLKIT")
4659 dnl ========================================================
4660 dnl = Enable the toolkit as needed                         =
4661 dnl ========================================================
4663 case "$MOZ_WIDGET_TOOLKIT" in
4664 photon)
4665         MOZ_ENABLE_PHOTON=1
4666         AC_DEFINE(MOZ_WIDGET_PHOTON)
4667     ;;
4669 cairo-windows)
4670     MOZ_WIDGET_TOOLKIT=windows
4671     MOZ_GFX_TOOLKIT=cairo
4672     ;;
4674 cairo-gtk2)
4675     MOZ_WIDGET_TOOLKIT=gtk2
4676     MOZ_GFX_TOOLKIT=cairo
4677     MOZ_ENABLE_GTK2=1
4678     MOZ_ENABLE_XREMOTE=1
4679     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4680     TK_LIBS='$(MOZ_GTK2_LIBS)'
4681     AC_DEFINE(MOZ_WIDGET_GTK2)
4682     ;;
4683 cairo-qt)
4684     MOZ_WIDGET_TOOLKIT=qt
4685     MOZ_GFX_TOOLKIT=cairo
4686     MOZ_ENABLE_QT=1
4687     MOZ_ENABLE_XREMOTE=1
4688     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4689     TK_LIBS='$(MOZ_QT_LIBS)'
4690     AC_DEFINE(MOZ_WIDGET_QT)
4691     ;;
4692 cairo-beos)
4693     MOZ_WIDGET_TOOLKIT=beos
4694     MOZ_GFX_TOOLKIT=cairo
4695     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4696     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4697     ;;
4699 cairo-os2)
4700     MOZ_WIDGET_TOOLKIT=os2
4701     MOZ_GFX_TOOLKIT=cairo
4702     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4703     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4704     ;;
4706 cairo-mac|cairo-cocoa)
4707     if test "$MOZ_WIDGET_TOOLKIT" = "cairo-cocoa"; then
4708         MOZ_WIDGET_TOOLKIT=cocoa
4709         AC_DEFINE(MOZ_WIDGET_COCOA)
4710         MOZ_ENABLE_COCOA=1
4711     else
4712         MOZ_WIDGET_TOOLKIT=mac
4713     fi
4714     MOZ_GFX_TOOLKIT=cairo
4715     MOZ_USER_DIR="Mozilla"
4716     AC_DEFINE(XP_MACOSX)
4717     AC_DEFINE(TARGET_CARBON)
4718     AC_DEFINE(TARGET_API_MAC_CARBON)
4719     TK_LIBS='-framework Carbon'
4720     TK_CFLAGS="-I${MACOS_SDK_DIR}/Developer/Headers/FlatCarbon"
4721     CFLAGS="$CFLAGS $TK_CFLAGS"
4722     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4723     ;;
4724 esac
4726 if test "$MOZ_ENABLE_XREMOTE"; then
4727     AC_DEFINE(MOZ_ENABLE_XREMOTE)
4730 if test "$COMPILE_ENVIRONMENT"; then
4731 if test "$MOZ_ENABLE_GTK2"
4732 then
4733     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)
4735 fi # COMPILE_ENVIRONMENT
4737 AC_SUBST(MOZ_DEFAULT_TOOLKIT)
4739 dnl ========================================================
4740 dnl = startup-notification support module
4741 dnl ========================================================
4743 if test "$MOZ_ENABLE_GTK2"
4744 then
4745     MOZ_ENABLE_STARTUP_NOTIFICATION=
4747     MOZ_ARG_ENABLE_BOOL(startup-notification,
4748     [  --enable-startup-notification       Enable startup-notification support (default: disabled) ],
4749         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4750         MOZ_ENABLE_STARTUP_NOTIFICATION=)
4751     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4752     then
4753         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4754                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4755         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4756             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4757             then
4758                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4759             fi
4760             MOZ_ENABLE_STARTUP_NOTIFICATION=
4761         ])
4762     fi
4764     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4765         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4766     fi
4768     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4770 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4771 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4772 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4774 dnl ========================================================
4775 dnl = QT support
4776 dnl ========================================================
4777 if test "$MOZ_ENABLE_QT"
4778 then
4779     PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtScript QtTest QtAssistantClient QtXml QtUiTools QtCore QtSvg)
4780     AC_SUBST(MOZ_QT_CFLAGS)
4781     AC_SUBST(MOZ_QT_LIBS)
4783     MOZ_ARG_WITH_STRING(qtdir,
4784     [  --with-qtdir=\$dir       Specify Qt directory ],
4785     [ QTDIR=$withval])
4787     if test -z "$QTDIR"; then
4788       QTDIR="/usr"
4789     fi
4790     QTINCDIR="/include/qt"
4791     if test ! -d "$QTDIR$QTINCDIR"; then
4792        QTINCDIR="/include/X11/qt"
4793     fi
4794     if test ! -d "$QTDIR$QTINCDIR"; then
4795        QTINCDIR="/include"
4796     fi
4798     if test -x "$QTDIR/bin/moc-qt4"; then
4799       HOST_MOC="$QTDIR/bin/moc-qt4"
4800     else
4801       if test -x "$QTDIR/bin/moc"; then
4802         HOST_MOC="$QTDIR/bin/moc"
4803       else
4804         AC_CHECK_PROGS(HOST_MOC, moc, "")
4805       fi
4806     fi
4807     if test -z "$HOST_MOC"; then
4808       AC_MSG_ERROR([no acceptable moc preprocessor found])
4809     fi
4810     MOC=$HOST_MOC
4813 AC_SUBST(GTK_CONFIG)
4814 AC_SUBST(TK_CFLAGS)
4815 AC_SUBST(TK_LIBS)
4817 AC_SUBST(MOZ_ENABLE_GTK2)
4818 AC_SUBST(MOZ_ENABLE_PHOTON)
4819 AC_SUBST(MOZ_ENABLE_COCOA)
4820 AC_SUBST(MOZ_ENABLE_GLITZ)
4821 AC_SUBST(MOZ_ENABLE_QT)
4822 AC_SUBST(MOZ_ENABLE_XREMOTE)
4823 AC_SUBST(MOZ_GTK2_CFLAGS)
4824 AC_SUBST(MOZ_GTK2_LIBS)
4825 AC_SUBST(MOZ_QT_CFLAGS)
4826 AC_SUBST(MOZ_QT_LIBS)
4828 AC_SUBST(MOC)
4830 if test "$MOZ_ENABLE_GTK2" \
4831 || test "$MOZ_ENABLE_QT"
4832 then
4833     AC_DEFINE(MOZ_X11)
4834     MOZ_X11=1
4836 AC_SUBST(MOZ_X11)
4838 dnl ========================================================
4839 dnl =
4840 dnl = Components & Features
4841 dnl = 
4842 dnl ========================================================
4843 MOZ_ARG_HEADER(Components and Features)
4845 dnl ========================================================
4846 dnl = Localization
4847 dnl ========================================================
4848 MOZ_ARG_ENABLE_STRING(ui-locale,
4849 [  --enable-ui-locale=ab-CD
4850                           Select the user interface locale (default: en-US)],
4851     MOZ_UI_LOCALE=$enableval )
4852 AC_SUBST(MOZ_UI_LOCALE)
4854 dnl =========================================================
4855 dnl = Calendar client
4856 dnl =========================================================
4857 MOZ_ARG_ENABLE_BOOL(calendar,,
4858     MOZ_OLD_CALENDAR=1,
4859     MOZ_OLD_CALENDAR= )
4861 if test "$MOZ_OLD_CALENDAR"; then
4862     AC_MSG_WARN([Building with the calendar extension is no longer supported.])
4863     if test "$MOZ_THUNDERBIRD"; then
4864         AC_MSG_WARN([Since you're trying to build mail, you could try adding])
4865         AC_MSG_WARN(['--enable-extensions=default,lightning' to your mozconfig])
4866         AC_MSG_WARN([and building WITH A FRESH TREE.])
4867     fi
4868     AC_MSG_WARN([For more information, please visit:])
4869     AC_MSG_ERROR([http://www.mozilla.org/projects/calendar/])
4872 AC_SUBST(MOZ_CALENDAR)
4874 dnl =========================================================
4875 dnl = Mail & News
4876 dnl =========================================================
4877 MOZ_ARG_DISABLE_BOOL(mailnews,
4878 [  --disable-mailnews      Disable building of mail & news components],
4879     MOZ_MAIL_NEWS=,
4880     MOZ_MAIL_NEWS=1 )
4881 AC_SUBST(MOZ_MAIL_NEWS)
4883 dnl =========================================================
4884 dnl = LDAP
4885 dnl =========================================================
4886 MOZ_ARG_DISABLE_BOOL(ldap,
4887 [  --disable-ldap          Disable LDAP support],
4888     MOZ_LDAP_XPCOM=,
4889     MOZ_LDAP_XPCOM=1)
4891 dnl ========================================================
4892 dnl = Trademarked Branding 
4893 dnl ========================================================
4894 MOZ_ARG_ENABLE_BOOL(official-branding,
4895 [  --enable-official-branding Enable Official mozilla.org Branding
4896                           Do not distribute builds with
4897                           --enable-official-branding unless you have
4898                           permission to use trademarks per
4899                           http://www.mozilla.org/foundation/trademarks/ .],
4900 [case "$MOZ_BUILD_APP" in
4901 browser)
4902     MOZ_BRANDING_DIRECTORY=other-licenses/branding/firefox
4903     MOZ_APP_DISPLAYNAME=Firefox
4904     ;;
4906 calendar)
4907     MOZ_BRANDING_DIRECTORY=other-licenses/branding/sunbird
4908     MOZ_APP_DISPLAYNAME=Sunbird
4909     ;;
4911 mail)
4912     MOZ_BRANDING_DIRECTORY=other-licenses/branding/thunderbird
4913     ;;
4916     AC_MSG_ERROR([Official branding is only available for Firefox Sunbird and Thunderbird.])
4917 esac
4920 MOZ_ARG_WITH_STRING(branding,
4921 [  --with-branding=dir    Use branding from the specified directory.],
4922     MOZ_BRANDING_DIRECTORY=$withval)
4924 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4925 if test -z "$REAL_BRANDING_DIRECTORY"; then
4926   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4929 if test -f "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4930   . "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"
4933 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4935 dnl ========================================================
4936 dnl = Distribution ID
4937 dnl ========================================================
4938 MOZ_ARG_WITH_STRING(distribution-id,
4939 [  --with-distribution-id=ID  Set distribution-specific id (default=org.mozilla)],
4940 [ val=`echo $withval`
4941     MOZ_DISTRIBUTION_ID="$val"])
4943 if test -z "$MOZ_DISTRIBUTION_ID"; then
4944    MOZ_DISTRIBUTION_ID="org.mozilla"
4947 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4948 AC_SUBST(MOZ_DISTRIBUTION_ID)
4950 dnl ========================================================
4951 dnl = Xft and Pango
4952 dnl ========================================================
4953 if test "$MOZ_ENABLE_GTK2"
4954 then
4955     PKG_CHECK_MODULES(MOZ_XFT, xft)
4956     AC_SUBST(MOZ_XFT_CFLAGS)
4957     AC_SUBST(MOZ_XFT_LIBS)
4959     PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4960     PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangocairo >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
4961     AC_SUBST(MOZ_PANGO_CFLAGS)
4962     AC_SUBST(MOZ_PANGO_LIBS)
4965 dnl ========================================================
4966 dnl = PostScript print module
4967 dnl ========================================================
4968 MOZ_ARG_DISABLE_BOOL(postscript,
4969 [  --disable-postscript    Disable PostScript printing support ],
4970     MOZ_ENABLE_POSTSCRIPT=,
4971     MOZ_ENABLE_POSTSCRIPT=1 )
4973 dnl ========================================================
4974 dnl = GnomeVFS support module
4975 dnl ========================================================
4977 if test "$MOZ_X11"
4978 then
4979     dnl build the gnomevfs extension by default only when the
4980     dnl GTK2 toolkit is in use.
4981     if test "$MOZ_ENABLE_GTK2"
4982     then
4983         MOZ_ENABLE_GNOMEVFS=1
4984         MOZ_ENABLE_GCONF=1
4985         MOZ_ENABLE_LIBGNOME=1
4986     fi
4988     MOZ_ARG_DISABLE_BOOL(gnomevfs,
4989     [  --disable-gnomevfs      Disable GnomeVFS support ],
4990         MOZ_ENABLE_GNOMEVFS=,
4991         MOZ_ENABLE_GNOMEVFS=force)
4993     if test "$MOZ_ENABLE_GNOMEVFS"
4994     then
4995         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
4996             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
4997             MOZ_ENABLE_GNOMEVFS=1
4998         ],[
4999             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5000             then
5001                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5002             fi
5003             MOZ_ENABLE_GNOMEVFS=
5004         ])
5005     fi
5007     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5008     AC_SUBST(MOZ_GNOMEVFS_LIBS)
5010     if test "$MOZ_ENABLE_GCONF"
5011     then
5012         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION,[
5013             MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5014             MOZ_ENABLE_GCONF=1
5015         ],[
5016             MOZ_ENABLE_GCONF=
5017         ])
5018     fi
5020     AC_SUBST(MOZ_GCONF_CFLAGS)
5021     AC_SUBST(MOZ_GCONF_LIBS)
5023     if test "$MOZ_ENABLE_LIBGNOME"
5024     then
5025         PKG_CHECK_MODULES(MOZ_LIBGNOME, libgnome-2.0 >= $LIBGNOME_VERSION,[
5026             MOZ_LIBGNOME_LIBS=`echo $MOZ_LIBGNOME_LIBS | sed 's/-llinc\>//'`
5027             MOZ_ENABLE_LIBGNOME=1
5028         ],[
5029             MOZ_ENABLE_LIBGNOME=
5030         ])
5031     fi
5033     AC_SUBST(MOZ_LIBGNOME_CFLAGS)
5034     AC_SUBST(MOZ_LIBGNOME_LIBS)
5036     # The GNOME component is built if gtk2, gconf, gnome-vfs, and libgnome
5037     # are all available.
5039     if test "$MOZ_ENABLE_GTK2" -a "$MOZ_ENABLE_GCONF" -a \
5040             "$MOZ_ENABLE_GNOMEVFS" -a "$MOZ_ENABLE_LIBGNOME"; then
5041       MOZ_ENABLE_GNOME_COMPONENT=1
5042     else
5043       MOZ_ENABLE_GNOME_COMPONENT=
5044     fi
5046     AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5049 dnl ========================================================
5050 dnl = libgnomeui support module
5051 dnl ========================================================
5053 if test "$MOZ_ENABLE_GTK2"
5054 then
5055     MOZ_ENABLE_GNOMEUI=1
5057     MOZ_ARG_DISABLE_BOOL(gnomeui,
5058     [  --disable-gnomeui       Disable libgnomeui support (default: auto, optional at runtime) ],
5059         MOZ_ENABLE_GNOMEUI=,
5060         MOZ_ENABLE_GNOMEUI=force)
5062     if test "$MOZ_ENABLE_GNOMEUI"
5063     then
5064         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5065         [
5066             MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5067             MOZ_ENABLE_GNOMEUI=1
5068         ],[
5069             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5070             then
5071                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5072             fi
5073             MOZ_ENABLE_GNOMEUI=
5074         ])
5075     fi
5077     if test "$MOZ_ENABLE_GNOMEUI"; then
5078         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5079     fi
5081 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5082 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5083 AC_SUBST(MOZ_GNOMEUI_LIBS)
5085 dnl ========================================================
5086 dnl = dbus support
5087 dnl ========================================================
5089 if test "$MOZ_ENABLE_GTK2"
5090 then
5091     MOZ_ENABLE_DBUS=1
5093     MOZ_ARG_DISABLE_BOOL(dbus,
5094     [  --disable-dbus       Disable dbus support ],
5095         MOZ_ENABLE_DBUS=,
5096         MOZ_ENABLE_DBUS=1)
5098     if test "$MOZ_ENABLE_DBUS"
5099     then
5100         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5101         AC_DEFINE(MOZ_ENABLE_DBUS)
5102     fi
5104 AC_SUBST(MOZ_ENABLE_DBUS)
5105 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5106 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5108 dnl ========================================================
5109 dnl = Build Personal Security Manager
5110 dnl ========================================================
5111 MOZ_ARG_DISABLE_BOOL(crypto,
5112 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5113     MOZ_PSM=,
5114     MOZ_PSM=1 )
5116 dnl ========================================================
5117 dnl = JS Debugger XPCOM component (js/jsd)
5118 dnl ========================================================
5119 MOZ_ARG_DISABLE_BOOL(jsd,
5120 [  --disable-jsd           Disable JavaScript debug library],
5121     MOZ_JSDEBUGGER=,
5122     MOZ_JSDEBUGGER=1)
5125 dnl ========================================================
5126 dnl = Disable plugin support
5127 dnl ========================================================
5128 MOZ_ARG_DISABLE_BOOL(plugins,
5129 [  --disable-plugins       Disable plugins support],
5130     MOZ_PLUGINS=,
5131     MOZ_PLUGINS=1)
5133 dnl ========================================================
5134 dnl = Open JVM Interface (OJI) support
5135 dnl ========================================================
5136 MOZ_ARG_ENABLE_BOOL(oji,
5137 [  --enable-oji           Enable Open JVM Integration support],
5138     MOZ_OJI=1,
5139     MOZ_OJI=)
5140 if test -n "$MOZ_OJI"; then
5141     AC_DEFINE(OJI)
5144 dnl bi-directional support always on
5145 IBMBIDI=1
5146 AC_DEFINE(IBMBIDI)
5148 dnl ========================================================
5149 dnl complex text support off by default
5150 dnl ========================================================
5151 MOZ_ARG_ENABLE_BOOL(ctl,
5152 [  --enable-ctl            Enable Thai Complex Script support],
5153     SUNCTL=1,
5154     SUNCTL= )
5156 dnl ========================================================
5157 dnl view source support on by default
5158 dnl ========================================================
5159 MOZ_ARG_DISABLE_BOOL(view-source,
5160 [  --disable-view-source     Disable view source support],
5161     MOZ_VIEW_SOURCE=,
5162     MOZ_VIEW_SOURCE=1 )
5163 if test "$MOZ_VIEW_SOURCE"; then
5164     AC_DEFINE(MOZ_VIEW_SOURCE)
5168 dnl ========================================================
5169 dnl accessibility support on by default on all platforms 
5170 dnl except OS X.
5171 dnl ========================================================
5172 MOZ_ARG_DISABLE_BOOL(accessibility,
5173 [  --disable-accessibility Disable accessibility support (off by default on OS X)],
5174     ACCESSIBILITY=,
5175     ACCESSIBILITY=1 )
5176 if test "$ACCESSIBILITY"; then
5177     AC_DEFINE(ACCESSIBILITY)
5180 if test -n "$ACCESSIBILITY"; then
5181 case "$target" in
5182 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5183     if test "$ac_cv_header_atlbase_h" = "no"; then
5184         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.])
5185     fi
5186     if test "$ac_cv_header_oleacc_idl" = "no"; then
5187         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.])
5188     fi
5189     ;;
5190 esac
5193 dnl ========================================================
5194 dnl xpfe/components on by default
5195 dnl ========================================================
5196 MOZ_ARG_DISABLE_BOOL(xpfe-components,
5197 [  --disable-xpfe-components
5198                           Disable xpfe components],
5199     MOZ_XPFE_COMPONENTS=,
5200     MOZ_XPFE_COMPONENTS=1 )
5202 dnl ========================================================
5203 dnl xpinstall support on by default
5204 dnl ========================================================
5205 MOZ_ARG_DISABLE_BOOL(xpinstall,
5206 [  --disable-xpinstall     Disable xpinstall support],
5207     MOZ_XPINSTALL=,
5208     MOZ_XPINSTALL=1 )
5209 if test "$MOZ_XPINSTALL"; then
5210     AC_DEFINE(MOZ_XPINSTALL)
5213 dnl ========================================================
5214 dnl xpcom js loader support on by default
5215 dnl ========================================================
5216 MOZ_ARG_DISABLE_BOOL(jsloader,
5217 [  --disable-jsloader      Disable xpcom js loader support],
5218     MOZ_JSLOADER=,
5219     MOZ_JSLOADER=1 )
5220 if test "$MOZ_JSLOADER"; then
5221     AC_DEFINE(MOZ_JSLOADER)
5224 dnl ========================================================
5225 dnl Disable printing
5226 dnl ========================================================
5227 MOZ_ARG_DISABLE_BOOL(printing,
5228 [  --disable-printing  Disable printing support],
5229     NS_PRINTING=,
5230     NS_PRINTING=1 )
5232 if test "$NS_PRINTING"; then
5233     AC_DEFINE(NS_PRINTING)
5234     AC_DEFINE(NS_PRINT_PREVIEW)
5237 dnl ========================================================
5238 dnl use native unicode converters
5239 dnl ========================================================
5240 MOZ_ARG_ENABLE_BOOL(native-uconv,
5241 [  --enable-native-uconv   Enable iconv support],
5242     MOZ_USE_NATIVE_UCONV=1,
5243     MOZ_USE_NATIVE_UCONV= )
5244 if test "$MOZ_USE_NATIVE_UCONV"; then
5245     AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5247 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5248     AC_MSG_ERROR([iconv() not found.  Cannot enable native uconv support.])
5252 dnl ========================================================
5253 dnl Libeditor can be build as plaintext-only,
5254 dnl or as a full html and text editing component.
5255 dnl We build both by default.
5256 dnl ========================================================
5257 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5258 [  --enable-plaintext-editor-only
5259                           Allow only plaintext editing],
5260     MOZ_PLAINTEXT_EDITOR_ONLY=1,
5261     MOZ_PLAINTEXT_EDITOR_ONLY= )
5262 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5263 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5265 dnl ========================================================
5266 dnl Composer is on by default.
5267 dnl ========================================================
5268 MOZ_ARG_DISABLE_BOOL(composer,
5269 [  --disable-composer      Disable building of Composer],
5270     MOZ_COMPOSER=,
5271     MOZ_COMPOSER=1 )
5272 AC_SUBST(MOZ_COMPOSER)
5275 dnl ========================================================
5276 dnl = Drop XPCOM Obsolete library
5277 dnl ========================================================
5278 MOZ_ARG_DISABLE_BOOL(xpcom-obsolete,
5279 [  --disable-xpcom-obsolete           Disable XPCOM Obsolete Library],
5280     MOZ_NO_XPCOM_OBSOLETE=1,
5281     MOZ_NO_XPCOM_OBSOLETE=)
5283 if test -n "$MOZ_NO_XPCOM_OBSOLETE"; then
5284     AC_DEFINE(MOZ_NO_XPCOM_OBSOLETE)
5287 dnl ========================================================
5288 dnl = Disable Fast Load
5289 dnl ========================================================
5290 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5291 [  --disable-xpcom-fastload           Disable XPCOM fastload support],
5292     MOZ_NO_FAST_LOAD=1,
5293     MOZ_NO_FAST_LOAD=)
5295 AC_SUBST(MOZ_NO_FAST_LOAD)
5297 if test -n "$MOZ_NO_FAST_LOAD"; then
5298     AC_DEFINE(MOZ_NO_FAST_LOAD)
5301 dnl ========================================================
5302 dnl Permissions System
5303 dnl ========================================================
5304 MOZ_ARG_DISABLE_BOOL(permissions,
5305 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
5306     MOZ_PERMISSIONS=,
5307     MOZ_PERMISSIONS=1
5310 dnl ========================================================
5311 dnl NegotiateAuth
5312 dnl ========================================================
5313 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5314 [  --disable-negotiateauth Disable GSS-API negotiation ],
5315     MOZ_AUTH_EXTENSION=,
5316     MOZ_AUTH_EXTENSION=1 )
5318 dnl ========================================================
5319 dnl XTF
5320 dnl ========================================================
5321 MOZ_ARG_DISABLE_BOOL(xtf,
5322 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
5323     MOZ_XTF=,
5324     MOZ_XTF=1 )
5325 if test "$MOZ_XTF"; then
5326   AC_DEFINE(MOZ_XTF)
5329 dnl ========================================================
5330 dnl Inspector APIs
5331 dnl ========================================================
5332 MOZ_ARG_DISABLE_BOOL(inspector-apis,
5333 [  --disable-inspector-apis Disable the DOM inspection APIs ],
5334     MOZ_NO_INSPECTOR_APIS=1,
5335     MOZ_NO_INSPECTOR_APIS= )
5337 dnl ========================================================
5338 dnl Pref extensions (autoconfig and system-pref)
5339 dnl ========================================================
5340 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5341 [  --disable-pref-extensions
5342                           Disable pref extensions such as autoconfig and
5343                           system-pref],
5344   MOZ_PREF_EXTENSIONS=,
5345   MOZ_PREF_EXTENSIONS=1 )
5347 dnl ========================================================
5348 dnl = Universalchardet
5349 dnl ========================================================
5350 MOZ_ARG_DISABLE_BOOL(universalchardet,
5351 [  --disable-universalchardet
5352                           Disable universal encoding detection],
5353   MOZ_UNIVERSALCHARDET=,
5354   MOZ_UNIVERSALCHARDET=1 )
5356 dnl ========================================================
5357 dnl JavaXPCOM
5358 dnl ========================================================
5359 MOZ_ARG_ENABLE_BOOL(javaxpcom,
5360 [  --enable-javaxpcom
5361                           Enable Java-XPCOM bridge],
5362     MOZ_JAVAXPCOM=1,
5363     MOZ_JAVAXPCOM= )
5365 if test -n "${MOZ_JAVAXPCOM}"; then
5366   case "$host_os" in
5367     cygwin*|msvc*|mks*)
5368       if test -n "$JAVA_HOME"; then
5369         JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
5370       fi
5371       ;;
5372     *mingw*)
5373       if test -n "$JAVA_HOME"; then
5374         JAVA_HOME=`cd "$JAVA_HOME" && pwd`
5375       fi
5376       ;;
5377   esac
5379   if test -n "${JAVA_INCLUDE_PATH}"; then
5380     dnl Make sure jni.h exists in the given include path.
5381     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5382       AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
5383     fi
5384   else
5385     case "$target_os" in
5386       darwin*)
5387         dnl Default to java system location
5388         JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
5389         ;;
5390       *)
5391         dnl Try $JAVA_HOME
5392         JAVA_INCLUDE_PATH="$JAVA_HOME/include"
5393         ;;
5394     esac
5395     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5396       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.])
5397     fi
5398   fi
5400   if test -n "${JAVA_BIN_PATH}"; then
5401     dnl Look for javac and jar in the specified path.
5402     JAVA_PATH="$JAVA_BIN_PATH"
5403   else
5404     dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5405     JAVA_PATH="$JAVA_HOME/bin:$PATH"
5406   fi
5408   AC_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5409   AC_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5410   AC_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5411   if test -z "$JAVA" || test "$JAVA" = ":" || test -z "$JAVAC" || test "$JAVAC" = ":" || test -z "$JAR" || test "$JAR" = ":"; then
5412     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.])
5413   fi
5416 dnl ========================================================
5417 dnl = Breakpad crash reporting (on by default on supported platforms)
5418 dnl ========================================================
5420 if (test "$OS_ARCH" = "WINNT" -a -z "$GNU_CC" \
5421     || test "$OS_ARCH" = "Darwin" \
5422     || test "$OS_ARCH" = "Linux" -a "$CPU_ARCH" = "x86" \
5423     || test "$OS_ARCH" = "SunOS") \
5424    && test -z "$HAVE_64BIT_OS"; then
5425    MOZ_CRASHREPORTER=1
5428 MOZ_ARG_DISABLE_BOOL(crashreporter,
5429 [  --disable-crashreporter          Disable breakpad crash reporting],
5430     MOZ_CRASHREPORTER=,
5431     MOZ_CRASHREPORTER=1)
5433 if test -n "$MOZ_CRASHREPORTER"; then
5434    AC_DEFINE(MOZ_CRASHREPORTER)
5436   if (test "$OS_ARCH" = "Linux" || test "$OS_ARCH" = "SunOS") && \
5437     test -z "$SKIP_LIBRARY_CHECKS"; then
5438     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5439     AC_SUBST(MOZ_GTHREAD_CFLAGS)
5440     AC_SUBST(MOZ_GTHREAD_LIBS)
5442     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.])])
5443   fi
5446 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5447 [  --with-crashreporter-enable-percent=NN  Enable sending crash reports by default on NN% of users. (default=100)],
5448 [ val=`echo $withval | sed 's/[^0-9]//g'`
5449     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5451 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5452    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5454 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5457 dnl ========================================================
5458 dnl = Build mochitest JS/DOM tests (on by default)
5459 dnl ========================================================
5460 MOZ_ARG_DISABLE_BOOL(mochitest,
5461 [  --disable-mochitest        Disable mochitest harness],
5462     MOZ_MOCHITEST=,
5463     MOZ_MOCHITEST=1 )
5465 dnl ========================================================
5466 dnl = Enable compilation of specific extension modules
5467 dnl ========================================================
5469 MOZ_ARG_ENABLE_STRING(extensions,
5470 [  --enable-extensions     Enable extensions],
5471 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5472     if test "$option" = "yes" || test "$option" = "all"; then
5473         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_ALL"
5474     elif test "$option" = "no" || test "$option" = "none"; then
5475         MOZ_EXTENSIONS=""
5476     elif test "$option" = "default"; then
5477         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
5478     elif test `echo "$option" | grep -c \^-` != 0; then
5479         option=`echo $option | sed 's/^-//'`
5480         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
5481     else
5482         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
5483     fi
5484 done],
5485     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
5487 if test -z "$MOZ_ENABLE_GNOMEVFS" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5488     # Suppress warning on non-X11 platforms
5489     if test -n "$MOZ_X11"; then
5490         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
5491     fi
5492     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5495 if test -z "$MOZ_JSDEBUGGER" && test `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
5496     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
5497     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
5500 dnl This might be temporary: build tridentprofile only on Windows
5501 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
5502     AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
5503     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5506 dnl cookie must be built before tridentprofile. put it at list's end.
5507 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
5508   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5509   MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
5512 dnl xforms requires xtf and schema-validation
5513 if test -z "$MOZ_XTF" && test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
5514     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
5515     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5517 if test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0 && test `echo "$MOZ_EXTENSIONS" | grep -c schema-validation` -eq 0; then
5518     AC_MSG_WARN([Cannot build XForms without schema validation.  Removing XForms from MOZ_EXTENSIONS.])
5519     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5522 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
5523     AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
5524     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
5527 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
5528     AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
5529     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
5532 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
5533     AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
5534     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
5537 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
5538     AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
5539     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
5542 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
5543     AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
5544     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
5547 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
5548     AC_MSG_WARN([spellcheck is no longer an extension.])
5549     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
5552 if test -n "$MOZ_NO_XPCOM_OBSOLETE" && test `echo "$MOZ_EXTENSIONS" | grep -c sroaming` -ne 0; then
5553     AC_MSG_WARN([Cannot currently build sroaming without xpcom obsolete -- bug 249343. Removing sroaming from MOZ_EXTENSIONS.])
5554     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|sroaming||'`
5557 dnl Remove dupes
5558 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
5560 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
5561 dnl when trying to build a non-existent extension.
5562 for extension in $MOZ_EXTENSIONS; do
5563     if test ! -d "${srcdir}/extensions/${extension}"; then
5564         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
5565     fi
5566 done
5569 dnl ========================================================
5570 dnl Image decoders
5571 dnl ========================================================
5572 case "$MOZ_WIDGET_TOOLKIT" in
5573 beos|windows|os2|mac|cocoa)
5574     ;;
5576     if test -z "$MOZ_ENABLE_GTK2"; then
5577        MOZ_IMG_DECODERS_DEFAULT=`echo $MOZ_IMG_DECODERS_DEFAULT | sed -e 's|icon||'`                
5578     fi
5579     ;;
5580 esac
5582 MOZ_ARG_ENABLE_STRING(image-decoders,
5583 [  --enable-image-decoders[={mod1,mod2,default,all,none}]
5584                           Enable specific image decoders],
5585 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5586     if test "$option" = "yes" || test "$option" = "all"; then
5587         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5588     elif test "$option" = "no" || test "$option" = "none"; then
5589         MOZ_IMG_DECODERS=""
5590     elif test "$option" = "default"; then
5591         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5592     elif test `echo "$option" | grep -c \^-` != 0; then
5593         option=`echo $option | sed 's/^-//'`
5594         MOZ_IMG_DECODERS=`echo "$MOZ_IMG_DECODERS" | sed "s/ ${option}//"`
5595     else
5596         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $option"
5597     fi
5598 done],
5599     MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS_DEFAULT")
5601 dnl Dupes are removed in the encoder section because it will also add decoders
5603 dnl ========================================================
5604 dnl Image encoders
5605 dnl ========================================================
5606 MOZ_ARG_ENABLE_STRING(image-encoders,
5607 [  --enable-image-encoders[={mod1,mod2,default,all,none}]
5608                           Enable specific image encoders],
5609 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5610     if test "$option" = "yes" || test "$option" = "all"; then
5611         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5612     elif test "$option" = "no" || test "$option" = "none"; then
5613         MOZ_IMG_ENCODERS=""
5614         addencoder=""
5615     elif test "$option" = "default"; then
5616         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5617     elif test `echo "$option" | grep -c \^-` != 0; then
5618         option=`echo $option | sed 's/^-//'`
5619         addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
5620     else
5621         addencoder="$option"
5622     fi
5623     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
5624 done],
5625     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
5627 dnl Remove dupes
5628 MOZ_IMG_DECODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_DECODERS}`
5629 MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
5631 dnl ========================================================
5632 dnl experimental ldap features
5633 dnl ========================================================
5634 MOZ_ARG_ENABLE_BOOL(ldap-experimental,
5635 [  --enable-ldap-experimental
5636                           Enable LDAP experimental features],
5637     MOZ_LDAP_XPCOM_EXPERIMENTAL=1,
5638     MOZ_LDAP_XPCOM_EXPERIMENTAL=)
5640 dnl ========================================================
5641 dnl MathML on by default
5642 dnl ========================================================
5643 MOZ_ARG_DISABLE_BOOL(mathml,
5644 [  --disable-mathml        Disable MathML support],
5645     MOZ_MATHML=,
5646     MOZ_MATHML=1 )
5647 if test "$MOZ_MATHML"; then
5648   AC_DEFINE(MOZ_MATHML)
5651 dnl ========================================================
5652 dnl Canvas
5653 dnl ========================================================
5654 MOZ_ARG_DISABLE_BOOL(canvas,
5655 [  --disable-canvas          Disable html:canvas feature],
5656     MOZ_ENABLE_CANVAS=,
5657     MOZ_ENABLE_CANVAS=1 )
5658 if test -n "$MOZ_ENABLE_CANVAS"; then
5659     AC_DEFINE(MOZ_ENABLE_CANVAS)
5661 AC_SUBST(MOZ_ENABLE_CANVAS)
5663 dnl ========================================================
5664 dnl SVG
5665 dnl ========================================================
5666 MOZ_ARG_DISABLE_BOOL(svg,
5667 [  --disable-svg            Disable SVG support],
5668     MOZ_SVG=,
5669     MOZ_SVG=1 )
5670 if test -n "$MOZ_SVG"; then
5671   AC_DEFINE(MOZ_SVG)
5674 MOZ_SVG_FOREIGNOBJECT=1
5675 dnl ========================================================
5676 dnl SVG <foreignObject>
5677 dnl ========================================================
5678 MOZ_ARG_DISABLE_BOOL(svg-foreignobject,
5679    [  --disable-svg-foreignobject
5680                         Disable SVG <foreignObject> support],
5681    MOZ_SVG_FOREIGNOBJECT=,
5682    MOZ_SVG_FOREIGNOBJECT=1 )
5683 if test "$MOZ_SVG_FOREIGNOBJECT"; then
5684   if test "$MOZ_SVG"; then
5685     AC_DEFINE(MOZ_SVG_FOREIGNOBJECT)
5686   else
5687     MOZ_SVG_FOREIGNOBEJCT=
5688   fi
5691 dnl ========================================================
5692 dnl Installer
5693 dnl ========================================================
5694 case "$target_os" in
5695     aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*)
5696         MOZ_INSTALLER=1
5697         ;;
5698 esac
5700 MOZ_ARG_DISABLE_BOOL(installer,
5701 [  --disable-installer     Disable building of installer],
5702     MOZ_INSTALLER=,
5703     MOZ_INSTALLER=1 )
5704 if test -n "$MOZ_INSTALLER" -a -n "$MOZ_XUL_APP" -a "$OS_ARCH" = "WINNT"; then
5705     # Disable installer for Windows builds that use the new toolkit if NSIS
5706     # isn't in the path.
5707     AC_PATH_PROGS(MAKENSIS, makensis)
5708     if test -z "$MAKENSIS" || test "$MAKENSIS" = ":"; then
5709         AC_MSG_ERROR([To build the installer makensis is required in your path. To build without the installer reconfigure using --disable-installer.])
5710     fi
5711     # The Windows build for NSIS requires the iconv command line utility to
5712     # convert the charset of the locale files.
5713     AC_PATH_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
5714     if test -z "$HOST_ICONV"; then
5715         AC_MSG_ERROR([To build the installer iconv is required in your path. To build without the installer reconfigure using --disable-installer.])
5716     fi
5719 # Automatically disable installer if xpinstall isn't built
5720 if test -z "$MOZ_XPINSTALL"; then
5721     MOZ_INSTALLER=
5723 AC_SUBST(MOZ_INSTALLER)
5725 AC_MSG_CHECKING([for tar archiver])
5726 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
5727 if test -z "$TAR"; then
5728     AC_MSG_ERROR([no tar archiver found in \$PATH])
5730 AC_MSG_RESULT([$TAR])
5731 AC_SUBST(TAR)
5733 dnl ========================================================
5734 dnl Updater
5735 dnl ========================================================
5737 MOZ_ARG_DISABLE_BOOL(updater,
5738 [  --disable-updater       Disable building of updater],
5739     MOZ_UPDATER=,
5740     MOZ_UPDATER=1 )
5741 # The Windows build requires the iconv command line utility
5742 # in order to build the updater.
5743 case "$target_os" in
5744     msvc*|mks*|cygwin*|mingw*|wince*)
5745         if test -n "$MOZ_UPDATER"; then
5746             AC_MSG_CHECKING([for iconv])
5747             AC_CHECK_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
5748             if test -z "$HOST_ICONV"; then
5749                 AC_MSG_ERROR([iconv not found in \$PATH])
5750             fi
5751         fi
5752         ;;
5753 esac
5754 AC_SUBST(MOZ_UPDATER)
5756 # app update channel is 'default' when not supplied.
5757 MOZ_ARG_ENABLE_STRING([update-channel],
5758 [  --enable-update-channel=CHANNEL
5759                            Select application update channel (default=default)],
5760     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
5762 if test -z "$MOZ_UPDATE_CHANNEL"; then
5763     MOZ_UPDATE_CHANNEL=default
5765 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
5767 # tools/update-packaging is not checked out by default.
5768 MOZ_ARG_ENABLE_BOOL(update-packaging,
5769 [  --enable-update-packaging
5770                            Enable tools/update-packaging],
5771     MOZ_UPDATE_PACKAGING=1,
5772     MOZ_UPDATE_PACKAGING= )
5773 AC_SUBST(MOZ_UPDATE_PACKAGING)
5775 dnl ========================================================
5776 dnl ActiveX
5777 dnl ========================================================
5779 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
5780 [  --disable-xpconnect-idispatch
5781                           Disable building of xpconnect support for IDispatch
5782                           (win32 only)],
5783     XPC_IDISPATCH_SUPPORT=,
5784     XPC_IDISPATCH_SUPPORT=1)
5785 AC_SUBST(XPC_IDISPATCH_SUPPORT)
5787 MOZ_ARG_DISABLE_BOOL(activex,
5788 [  --disable-activex       Disable building of ActiveX control (win32 only)],
5789     MOZ_NO_ACTIVEX_SUPPORT=1,
5790     MOZ_NO_ACTIVEX_SUPPORT= )
5791 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
5793 MOZ_ARG_DISABLE_BOOL(activex-scripting,
5794 [  --disable-activex-scripting
5795                           Disable building of ActiveX scripting support (win32)],
5796     MOZ_ACTIVEX_SCRIPTING_SUPPORT=,
5797     MOZ_ACTIVEX_SCRIPTING_SUPPORT=1)
5798 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
5800 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
5801 then
5802     AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
5805 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
5806 case "$target" in
5807 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5808     if test "$ac_cv_header_atlbase_h" = "no"; then
5809         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.])
5810     fi
5811     ;;
5812 esac
5815 dnl ========================================================
5816 dnl leaky
5817 dnl ========================================================
5818 MOZ_ARG_ENABLE_BOOL(leaky,
5819 [  --enable-leaky          Build leaky memory tool],
5820     MOZ_LEAKY=1,
5821     MOZ_LEAKY=)
5824 dnl ========================================================
5825 dnl xpctools
5826 dnl ========================================================
5827 MOZ_ARG_ENABLE_BOOL(xpctools,
5828 [  --enable-xpctools       Build JS profiling tool],
5829     MOZ_XPCTOOLS=1,
5830     MOZ_XPCTOOLS= )
5833 dnl ========================================================
5834 dnl build the tests by default
5835 dnl ========================================================
5836 MOZ_ARG_DISABLE_BOOL(tests,
5837 [  --disable-tests         Do not build test libraries & programs],
5838     ENABLE_TESTS=,
5839     ENABLE_TESTS=1 )
5841 dnl ========================================================
5842 dnl parental controls (for Windows Vista)
5843 dnl ========================================================
5844 MOZ_ARG_DISABLE_BOOL(parental-controls,
5845 [  --disable-parental-controls
5846                            Do not build parental controls],
5847    MOZ_DISABLE_PARENTAL_CONTROLS=1,
5848    MOZ_DISABLE_PARENTAL_CONTROLS=)
5849 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
5850     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
5851 else
5852 case "$target" in
5853 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5854     if test "$ac_cv_header_wpcapi_h" = "no"; then
5855         AC_MSG_ERROR([System header wpcapi.h is not available. See http://developer.mozilla.org/en/docs/wpcapi.h for details on fixing this problem.])
5856     fi
5857     ;;
5858 esac
5860 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
5862 dnl ========================================================
5863 dnl =
5864 dnl = Module specific options
5865 dnl =
5866 dnl ========================================================
5867 MOZ_ARG_HEADER(Individual module options)
5869 dnl ========================================================
5870 dnl = Enable Lea malloc in xpcom. OFF by default.
5871 dnl ========================================================
5872 MOZ_ARG_ENABLE_BOOL(xpcom-lea,
5873 [  --enable-xpcom-lea      Use Lea malloc in xpcom ],
5874     XPCOM_USE_LEA=1,
5875     XPCOM_USE_LEA= )
5876 if test -n "$XPCOM_USE_LEA"; then
5877     AC_DEFINE(XPCOM_USE_LEA)
5880 dnl ========================================================
5881 dnl = Enable places (new history/bookmarks)
5882 dnl ========================================================
5883 MOZ_ARG_ENABLE_BOOL(places,
5884 [  --enable-places        Enable 'places' bookmark/history implementation],
5885     MOZ_PLACES=1,
5886     MOZ_PLACES= )
5887 if test -n "$MOZ_PLACES"; then
5888     AC_DEFINE(MOZ_PLACES)
5889     if test -z "$MOZ_MAIL_NEWS"; then
5890       MOZ_MORK=
5891     fi
5892     MOZ_MORKREADER=1
5893 else
5894   if test "$MOZ_BUILD_APP" = "browser"; then
5895     AC_MSG_ERROR([Cannot build Firefox with --disable-places.])
5896   fi
5899 dnl ========================================================
5900 dnl = Disable feed handling components
5901 dnl ========================================================
5902 MOZ_ARG_DISABLE_BOOL(feeds,
5903 [  --disable-feeds        Disable feed handling and processing components],
5904     MOZ_FEEDS=,
5905     MOZ_FEEDS=1 )
5906 if test -n "$MOZ_FEEDS"; then
5907     AC_DEFINE(MOZ_FEEDS)
5908 else
5909     if test "$MOZ_BUILD_APP" = "browser"; then
5910         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
5911     fi
5914 dnl ========================================================
5915 dnl = Enable mozStorage
5916 dnl ========================================================
5917 dnl Implicitly enabled by default if building calendar or places
5918 MOZ_ARG_ENABLE_BOOL(storage,
5919 [  --enable-storage        Enable mozStorage module and related components],
5920     MOZ_STORAGE=1,
5921     MOZ_STORAGE= )
5922 if test -n "$MOZ_STORAGE"; then
5923     AC_DEFINE(MOZ_STORAGE)
5926 dnl ========================================================
5927 dnl Check for sqlite
5928 dnl ========================================================
5930 MOZ_NATIVE_SQLITE=
5931 MOZ_ARG_ENABLE_BOOL(system-sqlite,
5932 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
5933 MOZ_NATIVE_SQLITE=1,
5934 MOZ_NATIVE_SQLITE= )
5936 if test -z "$MOZ_NATIVE_SQLITE"
5937 then
5938     SQLITE_CFLAGS=
5939     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,sqlite3,$(DIST)/lib)'
5940 else
5941     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
5944 AC_SUBST(MOZ_NATIVE_SQLITE)
5946 dnl = Enable help viewer (off by default)
5947 dnl ========================================================
5948 MOZ_ARG_ENABLE_BOOL(help-viewer,
5949 [  --enable-help-viewer        Enable help viewer],
5950     MOZ_HELP_VIEWER=1,
5951     MOZ_HELP_VIEWER= )
5952 if test -n "$MOZ_HELP_VIEWER"; then
5953      AC_DEFINE(MOZ_HELP_VIEWER)
5955 AC_SUBST(MOZ_HELP_VIEWER)
5957 dnl ========================================================
5958 dnl = Enable safe browsing (anti-phishing)
5959 dnl ========================================================
5960 MOZ_ARG_ENABLE_BOOL(safe-browsing,
5961 [  --enable-safe-browsing        Enable safe browsing (anti-phishing) implementation],
5962     MOZ_SAFE_BROWSING=1,
5963     MOZ_SAFE_BROWSING= )
5964 if test -n "$MOZ_SAFE_BROWSING"; then
5965     AC_DEFINE(MOZ_SAFE_BROWSING)
5967 AC_SUBST(MOZ_SAFE_BROWSING)
5969 dnl ========================================================
5970 dnl = Enable url-classifier
5971 dnl ========================================================
5972 dnl Implicitly enabled by default if building with safe-browsing
5973 if test -n "$MOZ_SAFE_BROWSING"; then
5974     MOZ_URL_CLASSIFIER=1
5976 MOZ_ARG_ENABLE_BOOL(url-classifier,
5977 [  --enable-url-classifier        Enable url classifier module],
5978     MOZ_URL_CLASSIFIER=1,
5979     MOZ_URL_CLASSIFIER= )
5980 if test -n "$MOZ_URL_CLASSIFIER"; then
5981     AC_DEFINE(MOZ_URL_CLASSIFIER)
5983 AC_SUBST(MOZ_URL_CLASSIFIER)
5985 dnl ========================================================
5986 dnl = Disable zipwriter
5987 dnl ========================================================
5988 MOZ_ARG_DISABLE_BOOL(zipwriter,
5989 [  --disable-zipwriter             Disable zipwriter component],
5990     MOZ_ZIPWRITER=,
5991     MOZ_ZIPWRITER=1 )
5992 AC_SUBST(MOZ_ZIPWRITER)
5994 dnl ========================================================
5995 dnl = Enable Ultrasparc specific optimizations for JS
5996 dnl ========================================================
5997 MOZ_ARG_ENABLE_BOOL(js-ultrasparc,
5998 [  --enable-js-ultrasparc  Use UltraSPARC optimizations in JS],
5999     JS_ULTRASPARC_OPTS=1,
6000     JS_ULTRASPARC_OPTS= )
6002 dnl only enable option for ultrasparcs
6003 if test `echo "$target_os" | grep -c \^solaris 2>/dev/null` = 0 -o \
6004     "$OS_TEST" != "sun4u"; then
6005     JS_ULTRASPARC_OPTS=
6007 AC_SUBST(JS_ULTRASPARC_OPTS)
6009 dnl ========================================================
6010 dnl =
6011 dnl = Feature options that require extra sources to be pulled
6012 dnl =
6013 dnl ========================================================
6014 dnl MOZ_ARG_HEADER(Features that require extra sources)
6016 dnl ========================================================
6017 dnl =
6018 dnl = Debugging Options
6019 dnl = 
6020 dnl ========================================================
6021 MOZ_ARG_HEADER(Debugging and Optimizations)
6023 dnl ========================================================
6024 dnl = Disable building with debug info.
6025 dnl = Debugging is OFF by default
6026 dnl ========================================================
6027 if test -z "$MOZ_DEBUG_FLAGS"
6028 then
6029     case "$target" in
6030     *-irix*)
6031         if test "$GNU_CC"; then
6032             GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'`
6033             case "$GCC_VERSION" in
6034             2.95.*)
6035                 MOZ_DEBUG_FLAGS=""
6036                 ;;
6037             *)
6038                 MOZ_DEBUG_FLAGS="-g"
6039                 ;;
6040             esac
6041         else
6042             MOZ_DEBUG_FLAGS="-g"
6043         fi
6044         ;;
6045     *)
6046         MOZ_DEBUG_FLAGS="-g"
6047         ;;
6048     esac
6051 MOZ_ARG_ENABLE_STRING(debug,
6052 [  --enable-debug[=DBG]    Enable building with developer debug info
6053                           (Using compiler flags DBG)],
6054 [ if test "$enableval" != "no"; then
6055     MOZ_DEBUG=1
6056     if test -n "$enableval" && test "$enableval" != "yes"; then
6057         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6058     fi
6059   else
6060     MOZ_DEBUG=
6061   fi ],
6062   MOZ_DEBUG=)
6064 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG"
6065  case "${target_os}" in
6066     beos*)
6067         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${USER}"
6068         ;;
6069     msvc*|mks*|cygwin*|mingw*|os2*|wince*)
6070         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
6071         ;;
6072     *) 
6073         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`$WHOAMI`"
6074         ;;
6075   esac
6076 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DTRACING"
6078 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6080 if test -n "$MOZ_DEBUG"; then
6081     AC_MSG_CHECKING([for valid debug flags])
6082     _SAVE_CFLAGS=$CFLAGS
6083     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6084     AC_TRY_COMPILE([#include <stdio.h>], 
6085         [printf("Hello World\n");],
6086         _results=yes,
6087         _results=no)
6088     AC_MSG_RESULT([$_results])
6089     if test "$_results" = "no"; then
6090         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6091     fi
6092     CFLAGS=$_SAVE_CFLAGS
6095 dnl ========================================================
6096 dnl = Enable code optimization. ON by default.
6097 dnl ========================================================
6098 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6099         MOZ_OPTIMIZE_FLAGS="-O"
6102 MOZ_ARG_ENABLE_STRING(optimize,
6103 [  --disable-optimize      Disable compiler optimization
6104   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6105 [ if test "$enableval" != "no"; then
6106     MOZ_OPTIMIZE=1
6107     if test -n "$enableval" && test "$enableval" != "yes"; then
6108         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6109         MOZ_OPTIMIZE=2
6110     fi
6111 else
6112     MOZ_OPTIMIZE=
6113 fi ], MOZ_OPTIMIZE=1)
6115 if test "$COMPILE_ENVIRONMENT"; then
6116 if test -n "$MOZ_OPTIMIZE"; then
6117     AC_MSG_CHECKING([for valid optimization flags])
6118     _SAVE_CFLAGS=$CFLAGS
6119     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6120     AC_TRY_COMPILE([#include <stdio.h>], 
6121         [printf("Hello World\n");],
6122         _results=yes,
6123         _results=no)
6124     AC_MSG_RESULT([$_results])
6125     if test "$_results" = "no"; then
6126         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6127     fi
6128     CFLAGS=$_SAVE_CFLAGS
6130 fi # COMPILE_ENVIRONMENT
6132 AC_SUBST(MOZ_OPTIMIZE)
6133 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6134 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6135 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6137 dnl ========================================================
6138 dnl = Enable/disable debug for specific modules only
6139 dnl =   module names beginning with ^ will be disabled 
6140 dnl ========================================================
6141 MOZ_ARG_ENABLE_STRING(debug-modules,
6142 [  --enable-debug-modules  Enable/disable debug info for specific modules],
6143 [ MOZ_DEBUG_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
6145 dnl ========================================================
6146 dnl = Enable/disable generation of debugger info for specific modules only
6147 dnl =    the special module name ALL_MODULES can be used to denote all modules
6148 dnl =    module names beginning with ^ will be disabled
6149 dnl ========================================================
6150 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
6151 [  --enable-debugger-info-modules
6152                           Enable/disable debugger info for specific modules],
6153 [ for i in `echo $enableval | sed 's/,/ /g'`; do
6154       dnl note that the list of module names is reversed as it is copied
6155       dnl this is important, as it will allow config.mk to interpret stuff like
6156       dnl "^ALL_MODULES xpcom" properly
6157       if test "$i" = "no"; then
6158         i="^ALL_MODULES"
6159       fi
6160       if test "$i" = "yes"; then
6161         i="ALL_MODULES"
6162       fi
6163       MOZ_DBGRINFO_MODULES="$i $MOZ_DBGRINFO_MODULES";
6164     done ])
6166 dnl ========================================================
6167 dnl Enable garbage collector
6168 dnl ========================================================
6169 MOZ_ARG_ENABLE_BOOL(boehm,
6170 [  --enable-boehm          Enable the Boehm Garbage Collector],
6171     GC_LEAK_DETECTOR=1,
6172     GC_LEAK_DETECTOR= )
6173 if test -n "$GC_LEAK_DETECTOR"; then
6174     AC_DEFINE(GC_LEAK_DETECTOR)
6177 dnl ========================================================
6178 dnl Disable runtime logging checks
6179 dnl ========================================================
6180 MOZ_ARG_DISABLE_BOOL(logging,
6181 [  --disable-logging       Disable logging facilities],
6182     NS_DISABLE_LOGGING=1,
6183     NS_DISABLE_LOGGING= )
6184 if test "$NS_DISABLE_LOGGING"; then
6185     AC_DEFINE(NS_DISABLE_LOGGING)
6186 else
6187     AC_DEFINE(MOZ_LOGGING)
6190 dnl ========================================================
6191 dnl = dnl This will enable logging of addref, release, ctor, dtor.
6192 dnl ========================================================
6193 _ENABLE_LOGREFCNT=42
6194 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6195 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
6196     _ENABLE_LOGREFCNT=1,
6197     _ENABLE_LOGREFCNT= )
6198 if test "$_ENABLE_LOGREFCNT" = "1"; then
6199     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6200 elif test -z "$_ENABLE_LOGREFCNT"; then
6201     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6204 dnl ========================================================
6205 dnl = Enable trace malloc
6206 dnl ========================================================
6207 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6208 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6209 [  --enable-trace-malloc   Enable malloc tracing],
6210     NS_TRACE_MALLOC=1,
6211     NS_TRACE_MALLOC= )
6212 if test "$NS_TRACE_MALLOC"; then
6213   # Please, Mr. Linker Man, don't take away our symbol names
6214   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6215   USE_ELF_DYNSTR_GC=
6216   AC_DEFINE(NS_TRACE_MALLOC)
6218 AC_SUBST(NS_TRACE_MALLOC)
6220 dnl ========================================================
6221 dnl = Enable jemalloc
6222 dnl ========================================================
6223 MOZ_ARG_ENABLE_BOOL(jemalloc,
6224 [  --enable-jemalloc       Replace memory allocator with jemalloc],
6225     MOZ_MEMORY=1,
6226     MOZ_MEMORY=)
6228 if test "$NS_TRACE_MALLOC"; then
6229     MOZ_MEMORY=
6232 if test "$MOZ_MEMORY"; then
6234   dnl Don't try to run compiler tests on Windows  
6235   if test "$OS_ARCH" = "WINNT"; then
6236     if test -z "$HAVE_64BIT_OS"; then
6237       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6238     else
6239       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6240     fi
6241   else
6242     AC_CHECK_SIZEOF([int *], [4])
6243     case "${ac_cv_sizeof_int_p}" in
6244     4)
6245       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6246       ;;
6247     8)
6248       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6249       ;;
6250     *)
6251       AC_MSG_ERROR([Unexpected pointer size])
6252       ;;
6253     esac
6254   fi
6256   AC_DEFINE(MOZ_MEMORY)
6257   if test "x$MOZ_DEBUG" = "x1"; then
6258     AC_DEFINE(MOZ_MEMORY_DEBUG)
6259   fi
6260   dnl The generic feature tests that determine how to compute ncpus are long and
6261   dnl complicated.  Therefore, simply define special cpp variables for the
6262   dnl platforms we have special knowledge of.
6263   case "${target_os}" in
6264   darwin*)
6265     AC_DEFINE(MOZ_MEMORY_DARWIN)
6266     ;;
6267   *-freebsd*)
6268     AC_DEFINE(MOZ_MEMORY_BSD)
6269     ;;
6270   *linux*)
6271     AC_DEFINE(MOZ_MEMORY_LINUX)
6272     ;;
6273   netbsd*)
6274     AC_DEFINE(MOZ_MEMORY_BSD)
6275     ;;
6276   solaris*)
6277     AC_DEFINE(MOZ_MEMORY_SOLARIS)
6278     ;;
6279   msvc*|mks*|cygwin*|mingw*)
6280     AC_DEFINE(MOZ_MEMORY_WINDOWS)
6281     dnl XXX: should test for vc8sp1 here, otherwise patching the crt src
6282     dnl will fail miserably
6283     if test "$_CC_SUITE" -lt "8"; then
6284         AC_MSG_ERROR([Building jemalloc requires Visual C++ 2005 or better])
6285     fi
6286     if test -z "$WIN32_CRT_SRC_DIR" -a -z "$WIN32_CUSTOM_CRT_DIR"; then
6287       if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
6288         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.])
6289       else
6290         WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
6291       fi
6292     fi
6293     if test -z "$WIN32_CRT_SRC_DIR"; then
6294       # pre-built dll
6295       WIN32_CUSTOM_CRT_DIR=`cd "$WIN32_CUSTOM_CRT_DIR" && pwd`
6296       _WIN_UNIX_CRT_PATH="$WIN32_CUSTOM_CRT_DIR"
6297     else
6298       # CRT source directory
6299       WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd`
6300       _CRT_BASE_DIR=`basename "$WIN32_CRT_SRC_DIR"`
6301       _WIN_UNIX_CRT_PATH="$_objdir/memory/jemalloc/$_CRT_BASE_DIR/build/intel"
6302     fi
6303     dnl need win32 paths in LIB, hence this python abuse.  extra brackets
6304     dnl are to avoid m4
6305     _WIN_CRT_PATH=[`$PYTHON -c 'import sys, os.path; print os.path.normpath(sys.argv[1])' "$_WIN_UNIX_CRT_PATH"`]
6306     MOZ_LIB="$_WIN_CRT_PATH;$LIB"
6307     dnl Needs to be in PATH too, since our tools will wind up linked against it.
6308     dnl This needs to be unix style.
6309     MOZ_PATH="$PATH:$_WIN_UNIX_CRT_PATH"
6310     dnl Statically link the C++ stdlib.  We only use this for Breakpad anyway.
6311     AC_DEFINE(_STATIC_CPPLIB)
6312     dnl Don't generate a manifest, since we're linking to a custom CRT.
6313     LDFLAGS="$LDFLAGS -MANIFEST:NO"
6314     dnl Also pass this to NSPR/NSS
6315     DLLFLAGS="$DLLFLAGS -MANIFEST:NO"
6316     export DLLFLAGS
6317     ;;
6318   *)
6319     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
6320     ;;
6321   esac
6323   AC_ARG_WITH([valgrind],
6324     [  --with-valgrind         Enable valgrind integration hooks],
6325     [enable_valgrind="yes"], [enable_valgrind="no"])
6326   AC_CHECK_HEADER([valgrind/valgrind.h], [], [enable_valgrind="no"])
6327   if test "x$enable_valgrind" = "xyes" ; then
6328     AC_DEFINE(MOZ_VALGRIND)
6329   fi
6331 AC_SUBST(MOZ_MEMORY)
6332 AC_SUBST(WIN32_CRT_SRC_DIR)
6333 AC_SUBST(WIN32_CUSTOM_CRT_DIR)
6334 AC_SUBST(MOZ_LIB)
6335 AC_SUBST(MOZ_PATH)
6336 dnl Need to set this for make because NSS doesn't have configure
6337 AC_SUBST(DLLFLAGS)
6339 dnl ========================================================
6340 dnl = Use malloc wrapper lib
6341 dnl ========================================================
6342 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
6343 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
6344     _WRAP_MALLOC=1,
6345     _WRAP_MALLOC= )
6347 if test -n "$_WRAP_MALLOC"; then
6348     if test "$GNU_CC"; then
6349     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"
6350     MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) -o $@'
6351     fi
6354 dnl ========================================================
6355 dnl = Location of malloc wrapper lib
6356 dnl ========================================================
6357 MOZ_ARG_WITH_STRING(wrap-malloc,
6358 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
6359     WRAP_MALLOC_LIB=$withval)
6361 dnl ========================================================
6362 dnl = Use Electric Fence
6363 dnl ========================================================
6364 MOZ_ARG_ENABLE_BOOL(efence,
6365 [  --enable-efence         Link with Electric Fence],
6366     _ENABLE_EFENCE=1,
6367     _ENABLE_EFENCE= )
6368 if test -n "$_ENABLE_EFENCE"; then
6369     AC_CHECK_LIB(efence,malloc)
6372 dnl ========================================================
6373 dnl jprof
6374 dnl ========================================================
6375 MOZ_ARG_ENABLE_BOOL(jprof,
6376 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof)],
6377     MOZ_JPROF=1,
6378     MOZ_JPROF= )
6379 if test -n "$MOZ_JPROF"; then
6380     AC_DEFINE(MOZ_JPROF)
6383 dnl ========================================================
6384 dnl shark
6385 dnl ========================================================
6386 MOZ_ARG_ENABLE_BOOL(shark,
6387 [  --enable-shark          Enable shark remote profiling (needs CHUD framework)],
6388     MOZ_SHARK=1,
6389     MOZ_SHARK= )
6390 if test -n "$MOZ_SHARK"; then
6391     AC_DEFINE(MOZ_SHARK)
6394 dnl ========================================================
6395 dnl = Enable static checking using gcc-dehydra
6396 dnl ========================================================
6398 MOZ_ARG_WITH_STRING(static-checking,
6399 [  --with-static-checking=path/to/gcc_dehydra.so
6400                             Enable static checking of code using GCC-dehydra],
6401     DEHYDRA_PATH=$withval,
6402     DEHYDRA_PATH= )
6404 if test -n "$DEHYDRA_PATH"; then
6405     if ! test -f "$DEHYDRA_PATH"; then
6406         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
6407     fi
6408     AC_DEFINE(NS_STATIC_CHECKING)
6410 AC_SUBST(DEHYDRA_PATH)
6412 dnl ========================================================
6413 dnl = Enable stripping of libs & executables
6414 dnl ========================================================
6415 MOZ_ARG_ENABLE_BOOL(strip,
6416 [  --enable-strip          Enable stripping of libs & executables ],
6417     ENABLE_STRIP=1,
6418     ENABLE_STRIP= )
6420 dnl ========================================================
6421 dnl = Enable stripping of libs & executables when packaging
6422 dnl ========================================================
6423 MOZ_ARG_ENABLE_BOOL(install-strip,
6424 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
6425     PKG_SKIP_STRIP= ,
6426     PKG_SKIP_STRIP=1)
6428 dnl ========================================================
6429 dnl = --enable-elf-dynstr-gc
6430 dnl ========================================================
6431 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
6432 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
6433     USE_ELF_DYNSTR_GC=1,
6434     USE_ELF_DYNSTR_GC= )
6436 dnl ========================================================
6437 dnl = --enable-old-abi-compat-wrappers
6438 dnl ========================================================
6439 dnl on x86 linux, the current builds of some popular plugins (notably
6440 dnl flashplayer and real) expect a few builtin symbols from libgcc
6441 dnl which were available in some older versions of gcc.  However,
6442 dnl they're _NOT_ available in newer versions of gcc (eg 3.1), so if
6443 dnl we want those plugin to work with a gcc-3.1 built binary, we need
6444 dnl to provide these symbols.  MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS defaults
6445 dnl to true on x86 linux, and false everywhere else.
6448 MOZ_ARG_ENABLE_BOOL(old-abi-compat-wrappers,
6449 [  --enable-old-abi-compat-wrappers
6450                           Support old GCC ABI symbols to ease the pain 
6451                           of the linux compiler change],
6452     MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1,
6453     MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS= )
6454 if test "$COMPILE_ENVIRONMENT"; then
6455 if test "$MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS"; then
6456     AC_LANG_SAVE
6457     AC_LANG_CPLUSPLUS
6458     AC_CHECK_FUNCS(__builtin_vec_new __builtin_vec_delete __builtin_new __builtin_delete __pure_virtual)
6459     AC_LANG_RESTORE
6460     AC_DEFINE(MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS)
6462 fi # COMPILE_ENVIRONMENT
6464 dnl ========================================================
6465 dnl = --enable-prebinding
6466 dnl ========================================================
6467 MOZ_ARG_ENABLE_BOOL(prebinding,
6468 [  --enable-prebinding     Enable prebinding (Mac OS X only)],
6469     USE_PREBINDING=1,
6470     USE_PREBINDING= )
6472 dnl ========================================================
6473 dnl = 
6474 dnl = Profiling and Instrumenting
6475 dnl = 
6476 dnl ========================================================
6477 MOZ_ARG_HEADER(Profiling and Instrumenting)
6479 dnl ========================================================
6480 dnl = Enable timeline service, which provides lightweight
6481 dnl = instrumentation of mozilla for performance measurement.
6482 dnl = Timeline is off by default.
6483 dnl ========================================================
6484 MOZ_ARG_ENABLE_BOOL(timeline,
6485 [  --enable-timeline       Enable timeline services ],
6486     MOZ_TIMELINE=1,
6487     MOZ_TIMELINE= )
6488 if test -n "$MOZ_TIMELINE"; then
6489     AC_DEFINE(MOZ_TIMELINE)
6492 dnl ========================================================
6493 dnl Turn on reflow counting
6494 dnl ========================================================
6495 MOZ_ARG_ENABLE_BOOL(reflow-perf,
6496 [  --enable-reflow-perf    Enable reflow performance tracing],
6497     MOZ_REFLOW_PERF=1,
6498     MOZ_REFLOW_PERF= )
6499 if test -n "$MOZ_REFLOW_PREF"; then
6500     AC_DEFINE(MOZ_REFLOW_PREF)
6502 AC_SUBST(MOZ_REFLOW_PERF)
6504 dnl ========================================================
6505 dnl Enable performance metrics.
6506 dnl ========================================================
6507 MOZ_ARG_ENABLE_BOOL(perf-metrics,
6508 [  --enable-perf-metrics   Enable performance metrics],
6509     MOZ_PERF_METRICS=1,
6510     MOZ_PERF_METRICS= )
6511 if test -n "$MOZ_PERF_METRICS"; then
6512     AC_DEFINE(MOZ_PERF_METRICS)
6515 dnl ========================================================
6516 dnl Enable code size metrics.
6517 dnl ========================================================
6518 MOZ_ARG_ENABLE_BOOL(codesighs,
6519 [  --enable-codesighs      Enable code size analysis tools],
6520     _ENABLE_CODESIGHS=1,
6521     _ENABLE_CODESIGHS= )
6522 if test -n "$_ENABLE_CODESIGHS"; then
6523     if test -d $srcdir/tools/codesighs; then 
6524         MOZ_MAPINFO=1
6525     else
6526         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
6527     fi
6530 dnl ========================================================
6531 dnl = Add support for Eazel profiler
6532 dnl ========================================================
6533 MOZ_ARG_ENABLE_BOOL(eazel-profiler-support,
6534 [  --enable-eazel-profiler-support
6535                           Enable Corel/Eazel profiler support],
6536     ENABLE_EAZEL_PROFILER=1,
6537     ENABLE_EAZEL_PROFILER= )
6538 if test -n "$ENABLE_EAZEL_PROFILER"; then
6539     AC_DEFINE(ENABLE_EAZEL_PROFILER)
6540     USE_ELF_DYNSTR_GC=
6541     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6542     EAZEL_PROFILER_CFLAGS="-g -O -gdwarf-2 -finstrument-functions -D__NO_STRING_INLINES  -D__NO_MATH_INLINES"
6543     EAZEL_PROFILER_LIBS="-lprofiler -lpthread"
6546 MOZ_ARG_ENABLE_STRING(profile-modules,
6547 [  --enable-profile-modules
6548                           Enable/disable profiling for specific modules],
6549 [ MOZ_PROFILE_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
6551 MOZ_ARG_ENABLE_BOOL(insure,
6552 [  --enable-insure         Enable insure++ instrumentation (linux only)],
6553     _ENABLE_INSURE=1,
6554     _ENABLE_INSURE= )
6555 if test -n "$_ENABLE_INSURE"; then
6556     MOZ_INSURE="insure"
6557     MOZ_INSURIFYING=1
6558     MOZ_INSURE_DIRS="."
6559     MOZ_INSURE_EXCLUDE_DIRS="config"
6562 MOZ_ARG_WITH_STRING(insure-dirs,
6563 [  --with-insure-dirs=DIRS
6564                           Dirs to instrument with insure ],
6565     MOZ_INSURE_DIRS=$withval )
6567 MOZ_ARG_WITH_STRING(insure-exclude-dirs,
6568 [  --with-insure-exclude-dirs=DIRS
6569                           Dirs to not instrument with insure ],
6570     MOZ_INSURE_EXCLUDE_DIRS="config $withval" )
6572 dnl ========================================================
6573 dnl = Support for Quantify (Windows)
6574 dnl ========================================================
6575 MOZ_ARG_ENABLE_BOOL(quantify,
6576 [  --enable-quantify      Enable Quantify support (Windows only) ],
6577     MOZ_QUANTIFY=1,
6578     MOZ_QUANTIFY= )
6580 dnl ========================================================
6581 dnl = Support for demangling undefined symbols
6582 dnl ========================================================
6583 if test -z "$SKIP_LIBRARY_CHECKS"; then
6584     AC_LANG_SAVE
6585     AC_LANG_CPLUSPLUS
6586     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
6587     AC_LANG_RESTORE
6590 # Demangle only for debug or trace-malloc builds
6591 MOZ_DEMANGLE_SYMBOLS=
6592 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
6593     MOZ_DEMANGLE_SYMBOLS=1
6594     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
6596 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
6598 dnl ========================================================
6599 dnl = Support for gcc stack unwinding (from gcc 3.3)
6600 dnl ========================================================
6601 if test "$HAVE_GCC3_ABI" && test -z "$SKIP_LIBRARY_CHECKS"; then
6602     AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
6605 dnl ========================================================
6606 dnl =
6607 dnl = Misc. Options
6608 dnl = 
6609 dnl ========================================================
6610 MOZ_ARG_HEADER(Misc. Options)
6612 dnl ========================================================
6613 dnl update xterm title
6614 dnl ========================================================
6615 MOZ_ARG_ENABLE_BOOL(xterm-updates,
6616 [  --enable-xterm-updates  Update XTERM titles with current command.],
6617     MOZ_UPDATE_XTERM=1,
6618     MOZ_UPDATE_XTERM= )
6620 dnl =========================================================
6621 dnl = Chrome format
6622 dnl =========================================================
6623 MOZ_ARG_ENABLE_STRING([chrome-format],
6624 [  --enable-chrome-format=jar|flat|both|symlink
6625                           Select FORMAT of chrome files (default=jar)],
6626     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
6628 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
6629     MOZ_CHROME_FILE_FORMAT=jar
6632 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" && 
6633     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
6634     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
6635     test "$MOZ_CHROME_FILE_FORMAT" != "both"; then
6636     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, or symlink])
6639 dnl ========================================================
6640 dnl = Define default location for MOZILLA_FIVE_HOME
6641 dnl ========================================================
6642 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
6643 [  --with-default-mozilla-five-home
6644                           Set the default value for MOZILLA_FIVE_HOME],
6645 [ val=`echo $withval`
6646   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
6648 dnl ========================================================
6649 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
6650 dnl ========================================================
6651 MOZ_ARG_WITH_STRING(user-appdir,
6652 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
6653 [ val=`echo $withval`
6654 if echo "$val" | grep "\/" >/dev/null; then
6655     AC_MSG_ERROR("Homedir must be single relative path.")
6656 else 
6657     MOZ_USER_DIR="$val"
6658 fi])
6660 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
6662 dnl ========================================================
6663 dnl = Doxygen configuration
6664 dnl ========================================================
6665 dnl Use commas to specify multiple dirs to this arg
6666 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
6667 MOZ_ARG_WITH_STRING(doc-input-dirs,
6668 [  --with-doc-input-dirs=DIRS
6669                           Header/idl dirs to create docs from],
6670 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
6671 AC_SUBST(MOZ_DOC_INPUT_DIRS)
6673 dnl Use commas to specify multiple dirs to this arg
6674 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
6675 MOZ_ARG_WITH_STRING(doc-include-dirs,
6676 [  --with-doc-include-dirs=DIRS  
6677                           Include dirs to preprocess doc headers],
6678 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
6679 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
6681 MOZ_DOC_OUTPUT_DIR='./dist/docs'
6682 MOZ_ARG_WITH_STRING(doc-output-dir,
6683 [  --with-doc-output-dir=DIR
6684                           Dir to generate docs into],
6685 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
6686 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
6688 if test -z "$SKIP_COMPILER_CHECKS"; then
6689 dnl ========================================================
6690 dnl =
6691 dnl = Compiler Options
6692 dnl = 
6693 dnl ========================================================
6694 MOZ_ARG_HEADER(Compiler Options)
6696 dnl ========================================================
6697 dnl Check for gcc -pipe support
6698 dnl ========================================================
6699 AC_MSG_CHECKING([for gcc -pipe support])
6700 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
6701     echo '#include <stdio.h>' > dummy-hello.c
6702     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
6703     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
6704     cat dummy-hello.s | ${AS_BIN} -o dummy-hello.S - 2>&5
6705     if test $? = 0; then
6706         _res_as_stdin="yes"
6707     else
6708         _res_as_stdin="no"
6709     fi
6710     if test "$_res_as_stdin" = "yes"; then
6711         _SAVE_CFLAGS=$CFLAGS
6712         CFLAGS="$CFLAGS -pipe"
6713         AC_TRY_COMPILE( [ #include <stdio.h> ],
6714             [printf("Hello World\n");],
6715             [_res_gcc_pipe="yes"],
6716             [_res_gcc_pipe="no"] )
6717         CFLAGS=$_SAVE_CFLAGS
6718     fi
6719     if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
6720         _res="yes";
6721         CFLAGS="$CFLAGS -pipe"
6722         CXXFLAGS="$CXXFLAGS -pipe"
6723     else
6724         _res="no"
6725     fi
6726     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
6727     AC_MSG_RESULT([$_res])
6728 else
6729     AC_MSG_RESULT([no])
6732 dnl pass -Wno-long-long to the compiler
6733 MOZ_ARG_ENABLE_BOOL(long-long-warning,
6734 [  --enable-long-long-warning 
6735                           Warn about use of non-ANSI long long type],
6736     _IGNORE_LONG_LONG_WARNINGS=,
6737     _IGNORE_LONG_LONG_WARNINGS=1)
6739 if test "$_IGNORE_LONG_LONG_WARNINGS"; then
6740      _SAVE_CFLAGS="$CFLAGS"
6741      CFLAGS="$CFLAGS ${_COMPILER_PREFIX}-Wno-long-long"
6742      AC_MSG_CHECKING([whether compiler supports -Wno-long-long])
6743      AC_TRY_COMPILE([], [return(0);], 
6744         [ _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
6745           _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
6746           result="yes" ], result="no")
6747      AC_MSG_RESULT([$result])
6748      CFLAGS="$_SAVE_CFLAGS"
6751 dnl ========================================================
6752 dnl Profile guided optimization
6753 dnl ========================================================
6754 dnl Test for profiling options
6755 dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities
6756 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
6758 dnl Provide a switch to disable PGO even when called via profiledbuild.
6759 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
6760 [  --disable-profile-guided-optimization
6761                            Don't build with PGO even if called via make profiledbuild],
6762 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
6763 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
6765 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
6767 _SAVE_CFLAGS="$CFLAGS"
6768 CFLAGS="$CFLAGS -fprofile-generate"
6770 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
6771 AC_TRY_COMPILE([], [return 0;],
6772                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
6773                  result="yes" ], result="no")
6774 AC_MSG_RESULT([$result])
6776 if test $result = "yes"; then
6777   PROFILE_GEN_LDFLAGS="-fprofile-generate"
6778   PROFILE_USE_CFLAGS="-fprofile-use"
6779   PROFILE_USE_LDFLAGS="-fprofile-use"
6780 else
6781   CFLAGS="$_SAVE_CFLAGS -fprofile-arcs"
6782   AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs])
6783   AC_TRY_COMPILE([], [return 0;],
6784                  [ PROFILE_GEN_CFLAGS="-fprofile-arcs"
6785                    result="yes" ], result="no")
6786   AC_MSG_RESULT([$result])
6787   if test $result = "yes"; then
6788     PROFILE_USE_CFLAGS="-fbranch-probabilities"
6789   fi
6790   # don't really care, this is an old GCC
6791   PROFILE_GEN_LDFLAGS=
6792   PROFILE_USE_LDFLAGS=
6795 CFLAGS="$_SAVE_CFLAGS"
6797 if test -n "$INTEL_CC"; then
6798   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
6799   PROFILE_GEN_LDFLAGS=
6800   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
6801   PROFILE_USE_LDFLAGS=
6804 dnl Sun Studio on Solaris
6805 if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
6806   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
6807   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
6808   if test "$CPU_ARCH" != "sparc"; then
6809     PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
6810     PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
6811   else
6812     PROFILE_USE_CFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
6813     PROFILE_USE_LDFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
6814   fi
6817 AC_SUBST(PROFILE_GEN_CFLAGS)
6818 AC_SUBST(PROFILE_GEN_LDFLAGS)
6819 AC_SUBST(PROFILE_USE_CFLAGS)
6820 AC_SUBST(PROFILE_USE_LDFLAGS)
6822 AC_LANG_CPLUSPLUS
6824 dnl ========================================================
6825 dnl Test for -pedantic bustage
6826 dnl ========================================================
6827 MOZ_ARG_DISABLE_BOOL(pedantic,
6828 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
6829 _PEDANTIC= )
6830 if test "$_PEDANTIC"; then
6831     _SAVE_CXXFLAGS=$CXXFLAGS
6832     CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
6833     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
6834     AC_TRY_COMPILE([$configure_static_assert_macros],
6835                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
6836                    result="no", result="yes" )
6837     AC_MSG_RESULT([$result])
6838     CXXFLAGS="$_SAVE_CXXFLAGS"
6840     case "$result" in
6841     no)
6842         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic"
6843         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
6844         ;;
6845     yes)
6846         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
6847         ;;
6848     esac
6851 dnl ========================================================
6852 dnl Test for correct temporary object destruction order
6853 dnl ========================================================
6854 dnl We want to make sure the compiler follows the C++ spec here as 
6855 dnl xpcom and the string classes depend on it (bug 235381).
6856 AC_MSG_CHECKING([for correct temporary object destruction order])
6857 AC_TRY_RUN([ class A {
6858              public:  A(int& x) : mValue(x) {}
6859                       ~A() { mValue--; }
6860                       operator char**() { return 0; }
6861              private:  int& mValue;
6862              };
6863              void func(char **arg) {}
6864              int m=2;
6865              void test() {
6866                   func(A(m));
6867                   if (m==1) m = 0;
6868              }
6869              int main() {
6870                  test();
6871                  return(m);
6872              }
6873              ],
6874      result="yes", result="no", result="maybe")
6875 AC_MSG_RESULT([$result])
6877 if test "$result" = "no"; then
6878     AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
6881 dnl ========================================================
6882 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
6883 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
6884 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
6885 dnl ========================================================
6886 _SAVE_CXXFLAGS=$CXXFLAGS
6887 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
6888 AC_CACHE_CHECK(for correct overload resolution with const and templates,
6889     ac_nscap_nonconst_opeq_bug,
6890     [AC_TRY_COMPILE([
6891                       template <class T>
6892                       class Pointer
6893                         {
6894                         public:
6895                           T* myPtr;
6896                         };
6897                       
6898                       template <class T, class U>
6899                       int operator==(const Pointer<T>& rhs, U* lhs)
6900                         {
6901                           return rhs.myPtr == lhs;
6902                         }
6903                       
6904                       template <class T, class U>
6905                       int operator==(const Pointer<T>& rhs, const U* lhs)
6906                         {
6907                           return rhs.myPtr == lhs;
6908                         }
6909                     ],
6910                     [
6911                       Pointer<int> foo;
6912                       const int* bar;
6913                       return foo == bar;
6914                     ],
6915                     ac_nscap_nonconst_opeq_bug="no",
6916                     ac_nscap_nonconst_opeq_bug="yes")])
6917 CXXFLAGS="$_SAVE_CXXFLAGS"
6919 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
6920     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
6922 fi # SKIP_COMPILER_CHECKS
6924 dnl ========================================================
6925 dnl C++ rtti
6926 dnl Should be smarter and check that the compiler does indeed have rtti
6927 dnl ========================================================
6928 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
6929 [  --enable-cpp-rtti       Enable C++ RTTI ],
6930 [ _MOZ_USE_RTTI=1 ],
6931 [ _MOZ_USE_RTTI= ])
6933 if test "$_MOZ_USE_RTTI"; then
6934    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
6935 else
6936    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
6939 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
6941 dnl ========================================================
6942 dnl C++ exceptions (g++/egcs only - for now)
6943 dnl Should be smarter and check that the compiler does indeed have exceptions
6944 dnl ========================================================
6945 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
6946 [  --enable-cpp-exceptions Enable C++ exceptions ],
6947 [ _MOZ_CPP_EXCEPTIONS=1 ],
6948 [ _MOZ_CPP_EXCEPTIONS= ])
6950 if test "$_MOZ_CPP_EXCEPTIONS"; then
6951     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
6952 else
6953     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
6956 # Irix & OSF native compilers do not like exception declarations 
6957 # when exceptions are disabled
6958 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
6959     AC_DEFINE(CPP_THROW_NEW, [])
6960 else
6961     AC_DEFINE(CPP_THROW_NEW, [throw()])
6963 AC_LANG_C
6965 dnl ========================================================
6966 dnl =
6967 dnl = Build depencency options
6968 dnl =
6969 dnl ========================================================
6970 MOZ_ARG_HEADER(Build dependencies)
6972 dnl ========================================================
6973 dnl = Do not auto generate dependency info
6974 dnl ========================================================
6975 MOZ_AUTO_DEPS=1
6976 MOZ_ARG_DISABLE_BOOL(auto-deps,
6977 [  --disable-auto-deps     Do not automatically generate dependency info],
6978     MOZ_AUTO_DEPS=,
6979     MOZ_AUTO_DEPS=1)
6981 if test -n "$MOZ_AUTO_DEPS"; then
6982 dnl ========================================================
6983 dnl = Use mkdepend instead of $CC -MD for dependency generation
6984 dnl ========================================================
6985 _cpp_md_flag=
6986 MOZ_ARG_DISABLE_BOOL(md,
6987 [  --disable-md            Do not use compiler-based dependencies ],
6988   [_cpp_md_flag=],
6989   [_cpp_md_flag=1],
6990   [dnl Default is to turn on -MD if using GNU-compatible compilers
6991    if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
6992      _cpp_md_flag=1
6993    fi
6994   dnl Default is to use -xM if using Sun Studio on Solaris
6995    if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
6996      _cpp_md_flag=1
6997    fi])
6998 if test "$_cpp_md_flag"; then
6999   COMPILER_DEPEND=1
7000   if test "$OS_ARCH" = "OpenVMS"; then
7001     _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(*F).pp))'
7002   else
7003     _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(*F).pp)'
7004   fi
7005   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7006   if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
7007     _DEPEND_CFLAGS=
7008   fi
7009 else
7010   COMPILER_DEPEND=
7011   _USE_CPP_INCLUDE_FLAG=
7012   _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7013   _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7015 fi # MOZ_AUTO_DEPS
7016 MDDEPDIR='.deps'
7017 AC_SUBST(MOZ_AUTO_DEPS)
7018 AC_SUBST(COMPILER_DEPEND)
7019 AC_SUBST(MDDEPDIR)
7022 dnl ========================================================
7023 dnl =
7024 dnl = Static Build Options
7025 dnl =
7026 dnl ========================================================
7027 MOZ_ARG_HEADER(Static build options)
7029 MOZ_ARG_ENABLE_BOOL(static,
7030 [  --enable-static         Enable building of internal static libs],
7031     BUILD_STATIC_LIBS=1,
7032     BUILD_STATIC_LIBS=)
7034 dnl Disable libxul in debug builds, but not for xulrunner.
7035 if test -n "$MOZ_DEBUG" -a "$MOZ_BUILD_APP" != "xulrunner"; then
7036    MOZ_ENABLE_LIBXUL=
7039 MOZ_ARG_ENABLE_BOOL(libxul,
7040 [  --enable-libxul         Enable building of libxul],
7041     MOZ_ENABLE_LIBXUL=1,
7042     MOZ_ENABLE_LIBXUL=)
7044 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
7045         AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
7048 if test -n "$MOZ_ENABLE_LIBXUL" -a -z "$MOZ_XUL_APP"; then
7049         AC_MSG_ERROR([--enable-libxul is only compatible with toolkit XUL applications.])
7052 if test -n "$MOZ_ENABLE_LIBXUL"; then
7053     XPCOM_LIBS="$LIBXUL_LIBS"
7054     AC_DEFINE(MOZ_ENABLE_LIBXUL)
7055 else
7056     if test -n "$BUILD_STATIC_LIBS"; then
7057         AC_DEFINE(MOZ_STATIC_BUILD)
7058     fi
7059     XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
7062 dnl ========================================================
7063 dnl = Force JS to be a static lib
7064 dnl ========================================================
7065 MOZ_ARG_ENABLE_BOOL(js-static-build,
7066 [  --enable-js-static-build  Force js to be a static lib],
7067     JS_STATIC_BUILD=1,
7068     JS_STATIC_BUILD= )
7070 AC_SUBST(JS_STATIC_BUILD)
7071         
7072 if test -n "$JS_STATIC_BUILD"; then
7073     AC_DEFINE(EXPORT_JS_API)
7075 if test -z "$BUILD_STATIC_LIBS"; then
7076     AC_MSG_ERROR([--enable-js-static-build is only compatible with --enable-static])
7081 dnl Disable static mail in debug builds, but not with libxul sdk.
7082 if test -n "$MOZ_DEBUG" -a -z "$LIBXUL_SDK"; then
7083    MOZ_STATIC_MAIL_BUILD=
7085 MOZ_ARG_ENABLE_BOOL(static-mail,
7086 [  --enable-static-mail Enable static mail build support],
7087     MOZ_STATIC_MAIL_BUILD=1,
7088     MOZ_STATIC_MAIL_BUILD= )
7090 if test "$MOZ_STATIC_MAIL_BUILD"; then
7091     AC_DEFINE(MOZ_STATIC_MAIL_BUILD)
7094 AC_SUBST(MOZ_STATIC_MAIL_BUILD)
7096 dnl ========================================================
7097 dnl =
7098 dnl = Standalone module options
7099 dnl = 
7100 dnl ========================================================
7101 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7103 dnl Check for GLib and libIDL.
7104 dnl ========================================================
7105 case "$target_os" in
7106 msvc*|mks*|cygwin*|mingw*|wince*)
7107     SKIP_IDL_CHECK="yes"
7108     ;;
7110     SKIP_IDL_CHECK="no"
7111     ;;
7112 esac
7114 if test -z "$COMPILE_ENVIRONMENT"; then
7115     SKIP_IDL_CHECK="yes"
7118 dnl = Allow users to disable libIDL checking for standalone modules
7119 MOZ_ARG_WITHOUT_BOOL(libIDL,
7120 [  --without-libIDL        Skip check for libIDL (standalone modules only)],
7121         SKIP_IDL_CHECK="yes")
7123 if test "$SKIP_IDL_CHECK" = "no"
7124 then
7125     _LIBIDL_FOUND=
7126     if test "$MACOS_SDK_DIR"; then 
7127       dnl xpidl, and therefore libIDL, is only needed on the build host.
7128       dnl Don't build it against the SDK, as that causes problems.
7129       _MACSAVE_CFLAGS="$CFLAGS"
7130       _MACSAVE_LIBS="$LIBS"
7131       _MACSAVE_LDFLAGS="$LDFLAGS"
7132       _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
7133       changequote(,)
7134       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"`
7135       LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
7136       LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
7137       changequote([,])
7138       unset NEXT_ROOT
7139     fi
7141     if test "$MOZ_ENABLE_GTK2"; then
7142         PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
7143     fi
7144     dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
7145     dnl to either libIDL1 or libIDL2.
7146     if test -z "$_LIBIDL_FOUND"; then
7147         AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
7148         if test -z "$_LIBIDL_FOUND"; then
7149             PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
7150         fi
7151     fi
7152     dnl
7153     dnl If we don't have a libIDL config program & not cross-compiling, 
7154     dnl     look for orbit-config instead.
7155     dnl
7156     if test -z "$_LIBIDL_FOUND" && test -z "$CROSS_COMPILE"; then
7157         AC_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
7158         if test -n "$ORBIT_CONFIG"; then
7159             AC_MSG_CHECKING([for ORBit libIDL usability])
7160                 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
7161             _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
7162             _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
7163             _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
7164             LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
7165             LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
7166             LIBIDL_CONFIG=
7167             _SAVE_CFLAGS="$CFLAGS"
7168             _SAVE_LIBS="$LIBS"
7169             CFLAGS="$LIBIDL_CFLAGS $CFLAGS"
7170             LIBS="$LIBIDL_LIBS $LIBS"
7171             AC_TRY_RUN([
7172 #include <stdlib.h>
7173 #include <libIDL/IDL.h>
7174 int main() {
7175   char *s;
7176   s=strdup(IDL_get_libver_string());
7177   if(s==NULL) {
7178     exit(1);
7179   }
7180   exit(0);
7182             ], [_LIBIDL_FOUND=1
7183                 result="yes"],
7184                [LIBIDL_CFLAGS=
7185                 LIBIDL_LIBS=
7186                 result="no"],
7187                [_LIBIDL_FOUND=1
7188                 result="maybe"] )
7189             AC_MSG_RESULT($result)
7190             CFLAGS="$_SAVE_CFLAGS"
7191             LIBS="$_SAVE_LIBS"
7192         fi
7193     fi
7194     if test -z "$_LIBIDL_FOUND"; then
7195         AC_MSG_ERROR([libIDL not found.
7196         libIDL $LIBIDL_VERSION or higher is required.])
7197     fi
7198     if test "$MACOS_SDK_DIR"; then
7199       CFLAGS="$_MACSAVE_CFLAGS"
7200       LIBS="$_MACSAVE_LIBS"
7201       LDFLAGS="$_MACSAVE_LDFLAGS"
7202       if test -n "$_MACSAVE_NEXT_ROOT" ; then
7203         export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
7204       fi
7205     fi
7208 if test -n "$CROSS_COMPILE"; then
7209      if test -z "$HOST_LIBIDL_CONFIG"; then
7210         HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
7211     fi
7212     if test -n "$HOST_LIBIDL_CONFIG" && test "$HOST_LIBIDL_CONFIG" != "no"; then
7213         HOST_LIBIDL_CFLAGS=`${HOST_LIBIDL_CONFIG} --cflags`
7214         HOST_LIBIDL_LIBS=`${HOST_LIBIDL_CONFIG} --libs`
7215     else
7216         HOST_LIBIDL_CFLAGS="$LIBIDL_CFLAGS"
7217         HOST_LIBIDL_LIBS="$LIBIDL_LIBS"
7218     fi
7221 if test -z "$SKIP_PATH_CHECKS"; then
7222 if test -z "${GLIB_CFLAGS}" || test -z "${GLIB_LIBS}" ; then
7223     if test "$MOZ_ENABLE_GTK2"; then
7224         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7225     else
7226         AM_PATH_GLIB(${GLIB_VERSION})
7227     fi
7231 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
7232     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7235 AC_SUBST(LIBIDL_CFLAGS)
7236 AC_SUBST(LIBIDL_LIBS)
7237 AC_SUBST(STATIC_LIBIDL)
7238 AC_SUBST(GLIB_CFLAGS)
7239 AC_SUBST(GLIB_LIBS)
7240 AC_SUBST(GLIB_GMODULE_LIBS)
7241 AC_SUBST(HOST_LIBIDL_CONFIG)
7242 AC_SUBST(HOST_LIBIDL_CFLAGS)
7243 AC_SUBST(HOST_LIBIDL_LIBS)
7245 dnl ========================================================
7246 dnl Check for libart
7247 dnl ========================================================
7248 if test "$MOZ_SVG_RENDERER_LIBART"; then
7249   if test ! -f $topsrcdir/other-licenses/libart_lgpl/Makefile.in; then
7250     AC_MSG_ERROR([You must check out the mozilla version of libart. Use
7251 mk_add_options MOZ_CO_MODULE=mozilla/other-licenses/libart_lgpl])
7252   fi
7254   dnl libart's configure hasn't been run yet, but we know what the
7255   dnl answer should be anyway
7256   MOZ_LIBART_CFLAGS='-I${DIST}/include/libart_lgpl'
7257   case "$target_os" in
7258   msvc*|mks*|cygwin*|mingw*|wince*)
7259       MOZ_LIBART_LIBS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)moz_art_lgpl.$(IMPORT_LIB_SUFFIX)' 
7260       ;;
7261   os2*)
7262       MOZ_LIBART_LIBS='-lmoz_art -lm'
7263       ;;
7264   beos*)
7265       MOZ_LIBART_LIBS='-lmoz_art_lgpl -lroot -lbe'
7266       ;;
7267   *)
7268       MOZ_LIBART_LIBS='-lmoz_art_lgpl -lm'
7269       ;;
7270   esac
7271   AC_FUNC_ALLOCA
7274 AC_SUBST(MOZ_LIBART_CFLAGS)
7275 AC_SUBST(MOZ_LIBART_LIBS)
7277 dnl ========================================================
7278 dnl Check for cairo
7279 dnl ========================================================
7280 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7282 MOZ_TREE_CAIRO=1
7283 MOZ_ARG_ENABLE_BOOL(system-cairo,
7284 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
7285 MOZ_TREE_CAIRO=,
7286 MOZ_TREE_CAIRO=1 )
7288 # Check for headers defining standard int types.
7289 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7291 if test "$MOZ_TREE_CAIRO"; then
7292     AC_DEFINE(MOZ_TREE_CAIRO)
7294     # For now we assume that we will have a uint64_t available through
7295     # one of the above headers or mozstdint.h.
7296     AC_DEFINE(HAVE_UINT64_T)
7298     # Define macros for cairo-features.h
7299     if test "$MOZ_X11"; then
7300         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7301         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7302         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7303         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7304         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7305         MOZ_ENABLE_CAIRO_FT=1
7306         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7307     fi
7308     if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
7309         QPAINTER_SURFACE_FEATURE="#define CAIRO_HAS_QPAINTER_SURFACE 1"
7310     fi
7311     if test "$MOZ_WIDGET_TOOLKIT" = "mac" -o "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
7312         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7313         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7314         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7315     fi
7316     if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
7317         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7318         WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7319         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7320     fi
7321     if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
7322         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
7323         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7324         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7325         MOZ_ENABLE_CAIRO_FT=1
7326         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
7327         CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
7328     fi
7329     if test "$MOZ_ENABLE_GLITZ"; then
7330         GLITZ_SURFACE_FEATURE="#define CAIRO_HAS_GLITZ_SURFACE 1"
7331     fi
7332     if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
7333         PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
7334         BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
7335         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7336         MOZ_ENABLE_CAIRO_FT=1
7337     fi
7338     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
7339     AC_SUBST(CAIRO_FT_CFLAGS)
7341     if test "$MOZ_DEBUG"; then
7342       SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
7343     else
7344       SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
7345     fi
7347     PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
7349     AC_SUBST(PS_SURFACE_FEATURE)
7350     AC_SUBST(PDF_SURFACE_FEATURE)
7351     AC_SUBST(SVG_SURFACE_FEATURE)
7352     AC_SUBST(XLIB_SURFACE_FEATURE)
7353     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
7354     AC_SUBST(QUARTZ_SURFACE_FEATURE)
7355     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
7356     AC_SUBST(XCB_SURFACE_FEATURE)
7357     AC_SUBST(WIN32_SURFACE_FEATURE)
7358     AC_SUBST(OS2_SURFACE_FEATURE)
7359     AC_SUBST(BEOS_SURFACE_FEATURE)
7360     AC_SUBST(GLITZ_SURFACE_FEATURE)
7361     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
7362     AC_SUBST(FT_FONT_FEATURE)
7363     AC_SUBST(WIN32_FONT_FEATURE)
7364     AC_SUBST(QUARTZ_FONT_FEATURE)
7365     AC_SUBST(PNG_FUNCTIONS_FEATURE)
7366     AC_SUBST(QPAINTER_SURFACE_FEATURE)
7368     if test "$_WIN32_MSVC"; then
7369         MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib'
7370         if test "$MOZ_ENABLE_GLITZ"; then
7371             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'$(DEPTH)/gfx/cairo/glitz/src/mozglitz.lib $(DEPTH)/gfx/cairo/glitz/src/wgl/mozglitzwgl.lib'
7372         fi
7373     else
7374         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"
7376         if test "$MOZ_X11"; then
7377             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
7378         fi
7380         if test "$MOZ_ENABLE_GLITZ"; then
7381             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'-L$(DEPTH)/gfx/cairo/glitz/src -lmozglitz'
7382             if test "$MOZ_X11"; then
7383                 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'-L$(DEPTH)/gfx/cairo/glitz/src/glx -lmozglitzglx -lGL'
7384             fi
7385             if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
7386                 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'-L$(DEPTH)/gfx/cairo/glitz/src/wgl -lmozglitzwgl'
7387             fi
7388         fi
7389     fi
7390 else
7391    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION freetype2 fontconfig)
7392    MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
7393    MOZ_CAIRO_LIBS=$CAIRO_LIBS
7394    if test "$MOZ_X11"; then
7395         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
7396         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
7397         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
7398    fi
7401 AC_SUBST(MOZ_TREE_CAIRO)
7402 AC_SUBST(MOZ_CAIRO_CFLAGS)
7403 AC_SUBST(MOZ_CAIRO_LIBS)
7405 dnl ========================================================
7406 dnl Check for lcms
7407 dnl ========================================================
7409 MOZ_NATIVE_LCMS=
7410 MOZ_ARG_ENABLE_BOOL(system-lcms,
7411 [ --enable-system-lcms Use system lcms (located with pkgconfig)],
7412 MOZ_NATIVE_LCMS=1,
7413 MOZ_NATIVE_LCMS= )
7415 if test -z "$MOZ_NATIVE_LCMS"
7416 then
7417     LCMS_CFLAGS=
7418     if test "$_WIN32_MSVC"; then
7419         if test -z "$BUILD_STATIC_LIBS" -a -z "$MOZ_ENABLE_LIBXUL"; then
7420             LCMS_CFLAGS=-DLCMS_DLL
7421         fi
7422         LCMS_LIBS='$(LIBXUL_DIST)/lib/mozlcms.lib'
7423     else
7424         LCMS_LIBS='-L$(LIBXUL_DIST)/bin -lmozlcms'
7425     fi
7426 else
7427     PKG_CHECK_MODULES(LCMS, lcms >= $LCMS_VERSION)
7430 AC_SUBST(MOZ_NATIVE_LCMS)
7431 AC_SUBST(LCMS_CFLAGS)
7432 AC_SUBST(LCMS_LIBS)
7434 dnl ========================================================
7435 dnl disable xul
7436 dnl ========================================================
7437 MOZ_ARG_DISABLE_BOOL(xul,
7438 [  --disable-xul           Disable XUL],
7439     MOZ_XUL= )
7440 if test "$MOZ_XUL"; then
7441   AC_DEFINE(MOZ_XUL)
7442 else
7443   dnl remove extensions that require XUL
7444   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
7447 AC_SUBST(MOZ_XUL)
7449 dnl ========================================================
7450 dnl Two ways to enable Python support:
7451 dnl   --enable-extensions=python # select all available.
7452 dnl    (MOZ_PYTHON_EXTENSIONS contains the list of extensions)
7453 dnl or:
7454 dnl   --enable-extensions=python/xpcom,... # select individual ones
7456 dnl If either is used, we locate the Python to use.
7457 dnl ========================================================
7459 dnl If 'python' appears anywhere in the extensions list, go lookin'...
7460 if test `echo "$MOZ_EXTENSIONS" | grep -c python` -ne 0; then
7461     dnl Allow PYTHON to point to the Python interpreter to use
7462     dnl (note that it must be the python executable - which we
7463     dnl run to locate the relevant paths etc)
7464     dnl If not set, we use whatever Python we can find.
7465     MOZ_PYTHON=$PYTHON
7466     dnl Ask Python what its version number is
7467     changequote(,)
7468     MOZ_PYTHON_VER=`$PYTHON -c "import sys;print '%d%d' % sys.version_info[0:2]"`
7469     MOZ_PYTHON_VER_DOTTED=`$PYTHON -c "import sys;print '%d.%d' % sys.version_info[0:2]"`
7470     changequote([,])
7471     dnl Ask for the Python "prefix" (ie, home/source dir)
7472     MOZ_PYTHON_PREFIX=`$PYTHON -c "import sys; print sys.prefix"`
7473     dnl Setup the include and library directories.
7474     if test "$OS_ARCH" = "WINNT"; then
7475         MOZ_PYTHON_PREFIX=`$CYGPATH_W $MOZ_PYTHON_PREFIX | $CYGPATH_S`
7476         dnl Source trees have "include" and "PC" for .h, and "PCbuild" for .lib
7477         dnl Binary trees have "include" for .h, and "libs" for .lib
7478         dnl We add 'em both - along with quotes, to handle spaces.
7479         MOZ_PYTHON_DLL_SUFFIX=.pyd
7480         MOZ_PYTHON_INCLUDES="\"-I$MOZ_PYTHON_PREFIX/include\" \"-I$MOZ_PYTHON_PREFIX/PC\""
7481         MOZ_PYTHON_LIBS="\"/libpath:$MOZ_PYTHON_PREFIX/PCBuild\" \"/libpath:$MOZ_PYTHON_PREFIX/libs\""
7482     else
7483         dnl Non-Windows include and libs
7484         MOZ_PYTHON_DLL_SUFFIX=$DLL_SUFFIX
7485         MOZ_PYTHON_INCLUDES="-I$MOZ_PYTHON_PREFIX/include/python$MOZ_PYTHON_VER_DOTTED"
7486         dnl Check for dynamic Python lib
7487         dnl - A static Python is no good - multiple dynamic libraries (xpcom
7488         dnl - core, xpcom loader, pydom etc) all need to share Python.
7489         dnl - Python 2.3's std --enable-shared configure option will
7490         dnl   create a libpython2.3.so.1.0. We should first try this
7491         dnl   dotted versioned .so file because this is the one that
7492         dnl   the PyXPCOM build mechanics tries to link to.
7493         dnl   XXX Should find a better way than hardcoding "1.0".
7494         dnl - Python developement tree dir layouts are NOT allowed here
7495         dnl   because the PyXPCOM build just dies on it later anyway.
7496         dnl - Fixes to the above by Python/*nix knowledgable people welcome!
7497         if test -f "$MOZ_PYTHON_PREFIX/lib/libpython$MOZ_PYTHON_VER_DOTTED.so.1.0"; then
7498             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib -lpython$MOZ_PYTHON_VER_DOTTED"
7499         elif test -f "$MOZ_PYTHON_PREFIX/lib64/libpython$MOZ_PYTHON_VER_DOTTED.so.1.0"; then
7500             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib64 -lpython$MOZ_PYTHON_VER_DOTTED"
7501         elif test -f "$MOZ_PYTHON_PREFIX/lib/libpython$MOZ_PYTHON_VER_DOTTED.so"; then
7502             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib -lpython$MOZ_PYTHON_VER_DOTTED"
7503         elif test -f "$MOZ_PYTHON_PREFIX/libpython$MOZ_PYTHON_VER_DOTTED.so"; then
7504             dnl Don't Python development tree directory layout.
7505             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX -lpython$MOZ_PYTHON_VER_DOTTED"
7506             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.])
7507         elif test "$OS_ARCH" = "Darwin"; then
7508             dnl We do Darwin last, so if a custom non-framework build of
7509             dnl python is used on OSX, then it will be picked up first by
7510             dnl the logic above.
7511             MOZ_PYTHON_LIBS="-framework Python"
7512         else
7513             AC_MSG_ERROR([Could not find build shared libraries for Python at $MOZ_PYTHON_PREFIX.  This is required for PyXPCOM.])
7514         fi
7515         if test "$OS_ARCH" = "Linux"; then
7516             MOZ_PYTHON_LIBS="$MOZ_PYTHON_LIBS -lutil"
7517         fi
7518     fi
7519     dnl Handle "_d" on Windows
7520     if test "$OS_ARCH" = "WINNT" && test -n "$MOZ_DEBUG"; then
7521         MOZ_PYTHON_DEBUG_SUFFIX="_d"
7522     else
7523         MOZ_PYTHON_DEBUG_SUFFIX=
7524     fi
7525     AC_MSG_RESULT(Building Python extensions using python-$MOZ_PYTHON_VER_DOTTED from $MOZ_PYTHON_PREFIX)
7528 dnl If the user asks for the 'python' extension, then we add
7529 dnl MOZ_PYTHON_EXTENSIONS to MOZ_EXTENSIONS - but with the leading 'python/'
7530 dnl Note the careful regex - it must match 'python' followed by anything
7531 dnl other than a '/', including the end-of-string.
7532 if test `echo "$MOZ_EXTENSIONS" | grep -c 'python\([[^/]]\|$\)'` -ne 0; then
7533     for pyext in $MOZ_PYTHON_EXTENSIONS; do
7534         MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS python/$pyext`
7535     done
7537 dnl Later we may allow MOZ_PYTHON_EXTENSIONS to be specified on the
7538 dnl command-line, but not yet
7539 AC_SUBST(MOZ_PYTHON_EXTENSIONS)
7540 AC_SUBST(MOZ_PYTHON)
7541 AC_SUBST(MOZ_PYTHON_PREFIX)
7542 AC_SUBST(MOZ_PYTHON_INCLUDES)
7543 AC_SUBST(MOZ_PYTHON_LIBS)
7544 AC_SUBST(MOZ_PYTHON_VER)
7545 AC_SUBST(MOZ_PYTHON_VER_DOTTED)
7546 AC_SUBST(MOZ_PYTHON_DEBUG_SUFFIX)
7547 AC_SUBST(MOZ_PYTHON_DLL_SUFFIX)
7549 dnl ========================================================
7550 dnl disable profile sharing
7551 dnl ========================================================
7552 MOZ_ARG_DISABLE_BOOL(profilesharing,
7553 [  --disable-profilesharing           Disable profile sharing],
7554     MOZ_PROFILESHARING=,
7555     MOZ_PROFILESHARING=1 )
7556 if test "$MOZ_PROFILESHARING"; then
7557   MOZ_IPCD=1
7558   AC_DEFINE(MOZ_PROFILESHARING)
7561 dnl ========================================================
7562 dnl enable ipc/ipcd
7563 dnl ========================================================
7564 MOZ_ARG_ENABLE_BOOL(ipcd,
7565 [  --enable-ipcd                      Enable IPC daemon],
7566     MOZ_IPCD=1,
7567     MOZ_IPCD= )
7569 dnl ========================================================
7570 dnl disable profile locking
7571 dnl   do no use this in applications that can have more than
7572 dnl   one process accessing the profile directory.
7573 dnl ========================================================
7574 MOZ_ARG_DISABLE_BOOL(profilelocking,
7575 [  --disable-profilelocking           Disable profile locking],
7576     MOZ_PROFILELOCKING=,
7577     MOZ_PROFILELOCKING=1 )
7578 if test "$MOZ_PROFILELOCKING"; then
7579   AC_DEFINE(MOZ_PROFILELOCKING)
7582 dnl ========================================================
7583 dnl disable rdf services
7584 dnl ========================================================
7585 MOZ_ARG_DISABLE_BOOL(rdf,
7586 [  --disable-rdf           Disable RDF],
7587     MOZ_RDF= )
7588 if test "$MOZ_RDF"; then
7589   AC_DEFINE(MOZ_RDF)
7592 AC_SUBST(MOZ_RDF)
7594 dnl ========================================================
7595 dnl necko configuration options
7596 dnl ========================================================
7599 dnl option to disable various necko protocols
7601 MOZ_ARG_ENABLE_STRING(necko-protocols,
7602 [  --enable-necko-protocols[={http,ftp,default,all,none}]
7603                           Enable/disable specific protocol handlers],
7604 [ for option in `echo $enableval | sed 's/,/ /g'`; do
7605     if test "$option" = "yes" || test "$option" = "all"; then
7606         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7607     elif test "$option" = "no" || test "$option" = "none"; then
7608         NECKO_PROTOCOLS=""
7609     elif test "$option" = "default"; then
7610         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7611     elif test `echo "$option" | grep -c \^-` != 0; then
7612         option=`echo $option | sed 's/^-//'`
7613         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
7614     else
7615         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
7616     fi
7617 done],
7618     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
7619 dnl Remove dupes
7620 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
7621 AC_SUBST(NECKO_PROTOCOLS)
7622 for p in $NECKO_PROTOCOLS; do
7623     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
7624 done
7627 dnl option to disable necko's disk cache
7629 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
7630 [  --disable-necko-disk-cache
7631                           Disable necko disk cache],
7632     NECKO_DISK_CACHE=,
7633     NECKO_DISK_CACHE=1)
7634 AC_SUBST(NECKO_DISK_CACHE)
7635 if test "$NECKO_DISK_CACHE"; then
7636     AC_DEFINE(NECKO_DISK_CACHE)
7640 dnl option to minimize size of necko's i/o buffers
7642 MOZ_ARG_ENABLE_BOOL(necko-small-buffers,
7643 [  --enable-necko-small-buffers
7644                           Minimize size of necko's i/o buffers],
7645     NECKO_SMALL_BUFFERS=1,
7646     NECKO_SMALL_BUFFERS=)
7647 AC_SUBST(NECKO_SMALL_BUFFERS)
7648 if test "$NECKO_SMALL_BUFFERS"; then
7649     AC_DEFINE(NECKO_SMALL_BUFFERS)
7650 fi 
7653 dnl option to disable cookies
7655 MOZ_ARG_DISABLE_BOOL(cookies,
7656 [  --disable-cookies       Disable cookie support],
7657     NECKO_COOKIES=,
7658     NECKO_COOKIES=1)
7659 AC_SUBST(NECKO_COOKIES)
7660 if test "$NECKO_COOKIES"; then
7661     AC_DEFINE(NECKO_COOKIES)
7664 dnl NECKO_ configuration options are not global
7665 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
7667 dnl ========================================================
7668 dnl string api compatibility
7669 dnl ========================================================
7670 MOZ_ARG_DISABLE_BOOL(v1-string-abi,
7671 [  --disable-v1-string-abi   Disable binary compatibility layer for strings],
7672     MOZ_V1_STRING_ABI=,
7673     MOZ_V1_STRING_ABI=1)
7674 AC_SUBST(MOZ_V1_STRING_ABI)
7675 if test "$MOZ_V1_STRING_ABI"; then
7676     AC_DEFINE(MOZ_V1_STRING_ABI)
7679 dnl Only build Mork if it's required
7680 AC_SUBST(MOZ_MORK)
7681 if test "$MOZ_MORK"; then
7682   AC_DEFINE(MOZ_MORK)
7685 dnl Build the lightweight Mork reader if required
7686 AC_SUBST(MOZ_MORKREADER)
7687 if test "$MOZ_MORKREADER"; then
7688   AC_DEFINE(MOZ_MORKREADER)
7691 dnl ========================================================
7692 if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"; then
7693     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7696 if test "$MOZ_LDAP_XPCOM"; then
7697     LDAP_CFLAGS='-I${DIST}/public/ldap'
7698     if test "$OS_ARCH" = "WINNT"; then
7699         if test -n "$GNU_CC"; then
7700             LDAP_LIBS='-L$(DIST)/lib -lnsldap32v60 -lnsldappr32v60 -lnsldif32v60'
7701         else
7702             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}'
7703         fi
7704     elif test "$OS_ARCH" = "OS2"; then
7705             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}'
7706     else
7707         LDAP_LIBS='-L${DIST}/bin -L${DIST}/lib -lldap60 -lprldap60 -lldif60'
7708     fi
7711 if test "$COMPILE_ENVIRONMENT"; then
7712 if test "$SUNCTL"; then
7713     dnl older versions of glib do not seem to have gmodule which ctl needs
7714     _SAVE_CFLAGS=$CFLAGS
7715     CFLAGS="$CFLAGS $GLIB_CFLAGS"
7716     AC_LANG_SAVE
7717     AC_LANG_C
7718     AC_TRY_COMPILE([#include <gmodule.h>],
7719         [ int x = 1; x++; ],,
7720         [AC_MSG_ERROR([Cannot build ctl without gmodule support in glib.])])
7721     AC_LANG_RESTORE
7722     CFLAGS=$_SAVE_CFLAGS
7723     AC_DEFINE(SUNCTL)
7725 fi # COMPILE_ENVIRONMENT
7727 dnl ========================================================
7728 dnl =
7729 dnl = Maintainer debug option (no --enable equivalent)
7730 dnl =
7731 dnl ========================================================
7733 AC_SUBST(AR)
7734 AC_SUBST(AR_FLAGS)
7735 AC_SUBST(AR_LIST)
7736 AC_SUBST(AR_EXTRACT)
7737 AC_SUBST(AR_DELETE)
7738 AC_SUBST(AS)
7739 AC_SUBST(ASFLAGS)
7740 AC_SUBST(AS_DASH_C_FLAG)
7741 AC_SUBST(LD)
7742 AC_SUBST(RC)
7743 AC_SUBST(RCFLAGS)
7744 AC_SUBST(WINDRES)
7745 AC_SUBST(USE_SHORT_LIBNAME)
7746 AC_SUBST(IMPLIB)
7747 AC_SUBST(FILTER)
7748 AC_SUBST(BIN_FLAGS)
7749 AC_SUBST(NS_USE_NATIVE)
7750 AC_SUBST(MOZ_WIDGET_TOOLKIT)
7751 AC_SUBST(MOZ_GFX_TOOLKIT)
7752 AC_SUBST(MOZ_UPDATE_XTERM)
7753 AC_SUBST(MINIMO)
7754 AC_SUBST(MOZ_AUTH_EXTENSION)
7755 AC_SUBST(MOZ_MATHML)
7756 AC_SUBST(MOZ_PERMISSIONS)
7757 AC_SUBST(MOZ_XTF)
7758 AC_SUBST(MOZ_NO_INSPECTOR_APIS)
7759 AC_SUBST(MOZ_PREF_EXTENSIONS)
7760 AC_SUBST(MOZ_SVG)
7761 AC_SUBST(MOZ_SVG_FOREIGNOBJECT)
7762 AC_SUBST(MOZ_XSLT_STANDALONE)
7763 AC_SUBST(MOZ_JS_LIBS)
7764 AC_SUBST(MOZ_PSM)
7765 AC_SUBST(MOZ_DEBUG)
7766 AC_SUBST(MOZ_DEBUG_MODULES)
7767 AC_SUBST(MOZ_PROFILE_MODULES)
7768 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
7769 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
7770 AC_SUBST(MOZ_DEBUG_FLAGS)
7771 AC_SUBST(MOZ_DEBUG_LDFLAGS)
7772 AC_SUBST(WARNINGS_AS_ERRORS)
7773 AC_SUBST(MOZ_DBGRINFO_MODULES)
7774 AC_SUBST(MOZ_EXTENSIONS)
7775 AC_SUBST(MOZ_IMG_DECODERS)
7776 AC_SUBST(MOZ_IMG_ENCODERS)
7777 AC_SUBST(MOZ_JSDEBUGGER)
7778 AC_SUBST(MOZ_OJI)
7779 AC_SUBST(MOZ_NO_XPCOM_OBSOLETE)
7780 AC_SUBST(MOZ_PLUGINS)
7781 AC_SUBST(ENABLE_EAZEL_PROFILER)
7782 AC_SUBST(EAZEL_PROFILER_CFLAGS)
7783 AC_SUBST(EAZEL_PROFILER_LIBS)
7784 AC_SUBST(MOZ_PERF_METRICS)
7785 AC_SUBST(GC_LEAK_DETECTOR)
7786 AC_SUBST(MOZ_LOG_REFCNT)
7787 AC_SUBST(MOZ_LEAKY)
7788 AC_SUBST(MOZ_JPROF)
7789 AC_SUBST(MOZ_SHARK)
7790 AC_SUBST(MOZ_XPCTOOLS)
7791 AC_SUBST(MOZ_JSLOADER)
7792 AC_SUBST(MOZ_USE_NATIVE_UCONV)
7793 AC_SUBST(MOZ_INSURE)
7794 AC_SUBST(MOZ_INSURE_DIRS)
7795 AC_SUBST(MOZ_INSURE_EXCLUDE_DIRS)
7796 AC_SUBST(MOZ_QUANTIFY)
7797 AC_SUBST(MOZ_INSURIFYING)
7798 AC_SUBST(MOZ_LDAP_XPCOM)
7799 AC_SUBST(MOZ_LDAP_XPCOM_EXPERIMENTAL)
7800 AC_SUBST(LDAP_CFLAGS)
7801 AC_SUBST(LDAP_LIBS)
7802 AC_SUBST(LIBICONV)
7803 AC_SUBST(MOZ_PLACES)
7804 AC_SUBST(MOZ_PLACES_BOOKMARKS)
7805 AC_SUBST(MOZ_STORAGE)
7806 AC_SUBST(MOZ_FEEDS)
7807 AC_SUBST(NS_PRINTING)
7809 AC_SUBST(MOZ_JAVAXPCOM)
7810 AC_SUBST(JAVA_INCLUDE_PATH)
7811 AC_SUBST(JAVA)
7812 AC_SUBST(JAVAC)
7813 AC_SUBST(JAR)
7815 AC_SUBST(MOZ_PROFILESHARING)
7816 AC_SUBST(MOZ_PROFILELOCKING)
7818 AC_SUBST(MOZ_IPCD)
7820 AC_SUBST(HAVE_XIE)
7821 AC_SUBST(MOZ_XIE_LIBS)
7822 AC_SUBST(MOZ_ENABLE_POSTSCRIPT)
7824 AC_SUBST(XPCOM_USE_LEA)
7825 AC_SUBST(BUILD_STATIC_LIBS)
7826 AC_SUBST(MOZ_ENABLE_LIBXUL)
7827 AC_SUBST(ENABLE_TESTS)
7828 AC_SUBST(IBMBIDI)
7829 AC_SUBST(SUNCTL)
7830 AC_SUBST(MOZ_UNIVERSALCHARDET)
7831 AC_SUBST(ACCESSIBILITY)
7832 AC_SUBST(MOZ_XPINSTALL)
7833 AC_SUBST(MOZ_VIEW_SOURCE)
7834 AC_SUBST(MOZ_SPELLCHECK)
7835 AC_SUBST(MOZ_XPFE_COMPONENTS)
7836 AC_SUBST(MOZ_USER_DIR)
7837 AC_SUBST(MOZ_CRASHREPORTER)
7838 AC_SUBST(MOZ_MOCHITEST)
7840 AC_SUBST(ENABLE_STRIP)
7841 AC_SUBST(PKG_SKIP_STRIP)
7842 AC_SUBST(USE_ELF_DYNSTR_GC)
7843 AC_SUBST(USE_PREBINDING)
7844 AC_SUBST(INCREMENTAL_LINKER)
7845 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
7846 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
7847 AC_SUBST(MOZ_XPCOM_OBSOLETE_LIBS)
7849 AC_SUBST(MOZ_FIX_LINK_PATHS)
7850 AC_SUBST(XPCOM_LIBS)
7851 AC_SUBST(XPCOM_FROZEN_LDOPTS)
7852 AC_SUBST(XPCOM_GLUE_LDOPTS)
7853 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
7855 AC_SUBST(USE_DEPENDENT_LIBS)
7857 AC_SUBST(MOZ_BUILD_ROOT)
7858 AC_SUBST(MOZ_OS2_TOOLS)
7859 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
7861 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
7862 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
7863 AC_SUBST(MOZ_TIMELINE)
7864 AC_SUBST(WINCE)
7865 AC_SUBST(TARGET_DEVICE)
7867 AC_SUBST(MOZ_APP_NAME)
7868 AC_SUBST(MOZ_APP_DISPLAYNAME)
7869 AC_SUBST(MOZ_APP_VERSION)
7870 AC_SUBST(FIREFOX_VERSION)
7871 AC_SUBST(THUNDERBIRD_VERSION)
7872 AC_SUBST(SUNBIRD_VERSION)
7873 AC_SUBST(SEAMONKEY_VERSION)
7875 AC_SUBST(MOZ_PKG_SPECIAL)
7877 AC_SUBST(MOZILLA_OFFICIAL)
7878 AC_SUBST(BUILD_OFFICIAL)
7879 AC_SUBST(MOZ_MILESTONE_RELEASE)
7881 dnl win32 options
7882 AC_SUBST(MOZ_PROFILE)
7883 AC_SUBST(MOZ_DEBUG_SYMBOLS)
7884 AC_SUBST(MOZ_MAPINFO)
7885 AC_SUBST(MOZ_BROWSE_INFO)
7886 AC_SUBST(MOZ_TOOLS_DIR)
7887 AC_SUBST(CYGWIN_WRAPPER)
7888 AC_SUBST(AS_PERL)
7889 AC_SUBST(WIN32_REDIST_DIR)
7890 AC_SUBST(PYTHON)
7892 dnl Echo the CFLAGS to remove extra whitespace.
7893 CFLAGS=`echo \
7894         $_WARNINGS_CFLAGS \
7895         $CFLAGS`
7897 CXXFLAGS=`echo \
7898         $_MOZ_RTTI_FLAGS \
7899         $_MOZ_EXCEPTIONS_FLAGS \
7900         $_WARNINGS_CXXFLAGS \
7901         $CXXFLAGS`
7903 COMPILE_CFLAGS=`echo \
7904     $_DEFINES_CFLAGS \
7905         $_DEPEND_CFLAGS \
7906     $COMPILE_CFLAGS`
7908 COMPILE_CXXFLAGS=`echo \
7909     $_DEFINES_CXXFLAGS \
7910         $_DEPEND_CFLAGS \
7911     $COMPILE_CXXFLAGS`
7913 AC_SUBST(SYSTEM_MAKEDEPEND)
7914 AC_SUBST(SYSTEM_JPEG)
7915 AC_SUBST(SYSTEM_PNG)
7916 AC_SUBST(SYSTEM_ZLIB)
7917 AC_SUBST(SYSTEM_BZ2)
7919 AC_SUBST(JPEG_CFLAGS)
7920 AC_SUBST(JPEG_LIBS)
7921 AC_SUBST(ZLIB_CFLAGS)
7922 AC_SUBST(ZLIB_LIBS)
7923 AC_SUBST(BZ2_CFLAGS)
7924 AC_SUBST(BZ2_LIBS)
7925 AC_SUBST(PNG_CFLAGS)
7926 AC_SUBST(PNG_LIBS)
7928 AC_SUBST(MOZ_JPEG_CFLAGS)
7929 AC_SUBST(MOZ_JPEG_LIBS)
7930 AC_SUBST(MOZ_ZLIB_CFLAGS)
7931 AC_SUBST(MOZ_ZLIB_LIBS)
7932 AC_SUBST(MOZ_BZ2_CFLAGS)
7933 AC_SUBST(MOZ_BZ2_LIBS)
7934 AC_SUBST(MOZ_PNG_CFLAGS)
7935 AC_SUBST(MOZ_PNG_LIBS)
7937 AC_SUBST(NSPR_CFLAGS)
7938 AC_SUBST(NSPR_LIBS)
7939 AC_SUBST(MOZ_NATIVE_NSPR)
7941 AC_SUBST(NSS_CFLAGS)
7942 AC_SUBST(NSS_LIBS)
7943 AC_SUBST(NSS_DEP_LIBS)
7944 AC_SUBST(MOZ_NATIVE_NSS)
7946 AC_SUBST(CFLAGS)
7947 AC_SUBST(CXXFLAGS)
7948 AC_SUBST(CPPFLAGS)
7949 AC_SUBST(COMPILE_CFLAGS)
7950 AC_SUBST(COMPILE_CXXFLAGS)
7951 AC_SUBST(LDFLAGS)
7952 AC_SUBST(LIBS)
7953 AC_SUBST(CROSS_COMPILE)
7955 AC_SUBST(HOST_CC)
7956 AC_SUBST(HOST_CXX)
7957 AC_SUBST(HOST_CFLAGS)
7958 AC_SUBST(HOST_CXXFLAGS)
7959 AC_SUBST(HOST_OPTIMIZE_FLAGS)
7960 AC_SUBST(HOST_AR)
7961 AC_SUBST(HOST_AR_FLAGS)
7962 AC_SUBST(HOST_LD)
7963 AC_SUBST(HOST_RANLIB)
7964 AC_SUBST(HOST_NSPR_MDCPUCFG)
7965 AC_SUBST(HOST_BIN_SUFFIX)
7966 AC_SUBST(HOST_OS_ARCH)
7968 AC_SUBST(TARGET_CPU)
7969 AC_SUBST(TARGET_VENDOR)
7970 AC_SUBST(TARGET_OS)
7971 AC_SUBST(TARGET_NSPR_MDCPUCFG)
7972 AC_SUBST(TARGET_MD_ARCH)
7973 AC_SUBST(TARGET_XPCOM_ABI)
7974 AC_SUBST(OS_TARGET)
7975 AC_SUBST(OS_ARCH)
7976 AC_SUBST(OS_RELEASE)
7977 AC_SUBST(OS_TEST)
7979 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
7980 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
7982 AC_SUBST(WRAP_MALLOC_CFLAGS)
7983 AC_SUBST(WRAP_MALLOC_LIB)
7984 AC_SUBST(MKSHLIB)
7985 AC_SUBST(MKCSHLIB)
7986 AC_SUBST(MKSHLIB_FORCE_ALL)
7987 AC_SUBST(MKSHLIB_UNFORCE_ALL)
7988 AC_SUBST(DSO_CFLAGS)
7989 AC_SUBST(DSO_PIC_CFLAGS)
7990 AC_SUBST(DSO_LDOPTS)
7991 AC_SUBST(LIB_PREFIX)
7992 AC_SUBST(DLL_PREFIX)
7993 AC_SUBST(DLL_SUFFIX)
7994 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
7995 AC_SUBST(LIB_SUFFIX)
7996 AC_SUBST(OBJ_SUFFIX)
7997 AC_SUBST(BIN_SUFFIX)
7998 AC_SUBST(ASM_SUFFIX)
7999 AC_SUBST(IMPORT_LIB_SUFFIX)
8000 AC_SUBST(USE_N32)
8001 AC_SUBST(CC_VERSION)
8002 AC_SUBST(CXX_VERSION)
8003 AC_SUBST(MSMANIFEST_TOOL)
8005 if test "$USING_HCC"; then
8006    CC='${topsrcdir}/build/hcc'
8007    CC="$CC '$_OLDCC'"
8008    CXX='${topsrcdir}/build/hcpp'
8009    CXX="$CXX '$_OLDCXX'"
8010    AC_SUBST(CC)
8011    AC_SUBST(CXX)
8014 dnl Check for missing components
8015 if test "$COMPILE_ENVIRONMENT"; then
8016 if test "$MOZ_X11"; then
8017     dnl ====================================================
8018     dnl = Check if X headers exist
8019     dnl ====================================================
8020     _SAVE_CFLAGS=$CFLAGS
8021     CFLAGS="$CFLAGS $XCFLAGS"
8022     AC_TRY_COMPILE([
8023         #include <stdio.h>
8024         #include <stdlib.h>
8025         #include <X11/Xlib.h>
8026         #include <X11/Intrinsic.h>
8027     ],
8028     [
8029         Display *dpy = 0;
8030         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8031             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8032             exit(1);
8033         }
8034     ], [], 
8035     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8036     CFLAGS="$_SAVE_CFLAGS"
8038     if test ! -z "$MISSING_X"; then
8039         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8040     fi
8042 fi # MOZ_X11
8043 fi # COMPILE_ENVIRONMENT
8045 dnl Set various defines and substitutions
8046 dnl ========================================================
8048 if test "$OS_ARCH" = "OS2" -a "$VACPP" = "yes"; then
8049       LIBS='so32dll.lib tcp32dll.lib'
8050 elif test "$OS_ARCH" = "BeOS"; then
8051   AC_DEFINE(XP_BEOS)
8052   MOZ_MOVEMAIL=1
8053 elif test "$OS_ARCH" = "Darwin"; then
8054   AC_DEFINE(XP_UNIX)
8055   AC_DEFINE(UNIX_ASYNC_DNS)
8056   MOZ_MOVEMAIL=1
8057 elif test "$OS_ARCH" = "OpenVMS"; then
8058   AC_DEFINE(XP_UNIX)
8059 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
8060   AC_DEFINE(XP_UNIX)
8061   AC_DEFINE(UNIX_ASYNC_DNS)
8062   MOZ_MOVEMAIL=1
8064 AC_SUBST(MOZ_MOVEMAIL)
8066 AC_DEFINE(JS_THREADSAFE)
8068 if test "$MOZ_DEBUG"; then
8069     AC_DEFINE(MOZ_REFLOW_PERF)
8070     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8073 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8074     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8075     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8076     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8077     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8078     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8079     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8080     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8081     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8084 # Used for LD_LIBRARY_PATH of run_viewer target
8085 LIBS_PATH=
8086 for lib_arg in $NSPR_LIBS $TK_LIBS; do
8087   case $lib_arg in
8088     -L* ) LIBS_PATH="${LIBS_PATH:+$LIBS_PATH:}"`expr $lib_arg : "-L\(.*\)"` ;;
8089       * ) ;;
8090   esac
8091 done
8092 AC_SUBST(LIBS_PATH)
8094 dnl ========================================================
8095 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
8096 dnl ========================================================
8097 case "$host_os" in
8098 mingw*)
8099     WIN_TOP_SRC=`cd $srcdir; pwd -W`
8100     ;;
8101 cygwin*|msvc*|mks*)
8102     HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
8103     HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
8104     CC="\$(CYGWIN_WRAPPER) $CC"
8105     CXX="\$(CYGWIN_WRAPPER) $CXX"
8106     CPP="\$(CYGWIN_WRAPPER) $CPP"
8107     LD="\$(CYGWIN_WRAPPER) $LD"
8108     AS="\$(CYGWIN_WRAPPER) $AS"
8109     RC="\$(CYGWIN_WRAPPER) $RC"
8110     MIDL="\$(CYGWIN_WRAPPER) $MIDL"
8111     CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
8112     WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
8113     ;;
8114 esac
8116 AC_SUBST(CYGDRIVE_MOUNT)
8117 AC_SUBST(WIN_TOP_SRC)
8119 AC_SUBST(MOZILLA_VERSION)
8121 . ${srcdir}/config/chrome-versions.sh
8122 AC_DEFINE_UNQUOTED(MOZILLA_LOCALE_VERSION,"$MOZILLA_LOCALE_VERSION")
8123 AC_DEFINE_UNQUOTED(MOZILLA_REGION_VERSION,"$MOZILLA_REGION_VERSION")
8124 AC_DEFINE_UNQUOTED(MOZILLA_SKIN_VERSION,"$MOZILLA_SKIN_VERSION")
8126 AC_SUBST(ac_configure_args)
8128 dnl Spit out some output
8129 dnl ========================================================
8131 dnl The following defines are used by xpcom
8132 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8133 CPP_THROW_NEW
8134 HAVE_CPP_2BYTE_WCHAR_T
8135 HAVE_CPP_ACCESS_CHANGING_USING
8136 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8137 HAVE_CPP_BOOL
8138 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8139 HAVE_CPP_EXPLICIT
8140 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
8141 HAVE_CPP_NAMESPACE_STD
8142 HAVE_CPP_NEW_CASTS
8143 HAVE_CPP_PARTIAL_SPECIALIZATION
8144 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8145 HAVE_CPP_TYPENAME
8146 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
8147 HAVE_STATVFS
8148 NEED_CPP_UNUSED_IMPLEMENTATIONS
8149 NEW_H
8150 HAVE_GETPAGESIZE
8151 HAVE_ICONV
8152 HAVE_ICONV_WITH_CONST_INPUT
8153 HAVE_MBRTOWC
8154 HAVE_SYS_MOUNT_H
8155 HAVE_SYS_VFS_H
8156 HAVE_WCRTOMB
8157 MOZ_V1_STRING_ABI
8160 AC_CONFIG_HEADER(
8161 netwerk/necko-config.h
8162 xpcom/xpcom-config.h
8163 xpcom/xpcom-private.h
8166 # Save the defines header file before autoconf removes it.
8167 # (Do not add AC_DEFINE calls after this line.)
8168   _CONFIG_TMP=confdefs-tmp.h
8169   _CONFIG_DEFS_H=mozilla-config.h
8171   cat > $_CONFIG_TMP <<\EOF
8172 /* List of defines generated by configure. Included with preprocessor flag,
8173  * -include, to avoid long list of -D defines on the compile command-line.
8174  * Do not edit.
8175  */
8177 #ifndef _MOZILLA_CONFIG_H_
8178 #define _MOZILLA_CONFIG_H_
8181 _EGREP_PATTERN='^#define ('
8182 if test -n "$_NON_GLOBAL_ACDEFINES"; then
8183     for f in $_NON_GLOBAL_ACDEFINES; do
8184         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
8185     done
8187 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
8189   sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
8191   cat >> $_CONFIG_TMP <<\EOF
8193 #endif /* _MOZILLA_CONFIG_H_ */
8197   # Only write mozilla-config.h when something changes (or it doesn't exist)
8198   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
8199     rm $_CONFIG_TMP
8200   else
8201     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
8202     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
8204     echo ==== $_CONFIG_DEFS_H =================================
8205     cat $_CONFIG_DEFS_H
8206   fi
8208 dnl Probably shouldn't call this manually but we always want the output of DEFS
8209 rm -f confdefs.h.save
8210 mv confdefs.h confdefs.h.save
8211 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
8212 AC_OUTPUT_MAKE_DEFS()
8213 MOZ_DEFINES=$DEFS
8214 AC_SUBST(MOZ_DEFINES)
8215 rm -f confdefs.h
8216 mv confdefs.h.save confdefs.h
8218 dnl Load the list of Makefiles to generate.
8219 dnl   To add new Makefiles, edit allmakefiles.sh.
8220 dnl   allmakefiles.sh sets the variable, MAKEFILES.
8221 . ${srcdir}/allmakefiles.sh
8222 dnl 
8223 dnl Run a perl script to quickly create the makefiles.
8224 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
8225 dnl   for the files it cannot handle correctly. This way, config.status
8226 dnl   will handle these files.
8227 dnl If it fails, nothing is set and config.status will run as usual.
8229 dnl This does not change the $MAKEFILES variable.
8231 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
8233 if test -z "${AS_PERL}"; then
8234 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
8235 else
8236 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
8238 . ./conftest.sh
8239 rm conftest.sh
8241 echo $MAKEFILES > unallmakefiles
8243 AC_OUTPUT($MAKEFILES)
8245 dnl ========================================================
8246 dnl = Setup a nice relatively clean build environment for
8247 dnl = sub-configures.
8248 dnl ========================================================
8249 CC="$_SUBDIR_CC" 
8250 CXX="$_SUBDIR_CXX" 
8251 CFLAGS="$_SUBDIR_CFLAGS" 
8252 CPPFLAGS="$_SUBDIR_CPPFLAGS"
8253 CXXFLAGS="$_SUBDIR_CXXFLAGS"
8254 LDFLAGS="$_SUBDIR_LDFLAGS"
8255 HOST_CC="$_SUBDIR_HOST_CC" 
8256 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8257 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
8260 unset MAKEFILES
8261 unset CONFIG_FILES
8263 if test "$COMPILE_ENVIRONMENT"; then
8264 if test -z "$MOZ_NATIVE_NSPR" || test "$MOZ_LDAP_XPCOM"; then
8265     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
8266     if test -z "$MOZ_DEBUG"; then
8267         ac_configure_args="$ac_configure_args --disable-debug"
8268     fi
8269     if test "$MOZ_OPTIMIZE" = "1"; then
8270         ac_configure_args="$ac_configure_args --enable-optimize"
8271     fi
8272     if test "$OS_ARCH" = "WINNT" && test "$NS_TRACE_MALLOC"; then
8273        ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
8274     fi
8275     if test -n "$HAVE_64BIT_OS"; then
8276         ac_configure_args="$ac_configure_args --enable-64bit"
8277     fi
8278     AC_OUTPUT_SUBDIRS(nsprpub)
8279     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8282 if test -z "$MOZ_NATIVE_NSPR"; then
8283     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
8284     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
8285     if test ! "$VACPP" && test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE"; then
8286        _libs=`./nsprpub/config/nspr-config --prefix=$\(LIBXUL_DIST\) --exec-prefix=$\(DIST\) --libdir=$\(LIBXUL_DIST\)/lib --libs`
8287        $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $_libs'" config/autoconf.mk
8288     fi
8289     if test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE" ; then
8290        _cflags=`./nsprpub/config/nspr-config --prefix=$\(LIBXUL_DIST\) --exec-prefix=$\(DIST\) --includedir=$\(LIBXUL_DIST\)/include/nspr --cflags`
8291        $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $_cflags'" config/autoconf.mk
8292     fi
8293     rm -f config/autoconf.mk.bak
8296 # if we're building the LDAP XPCOM component, we need to build 
8297 # the c-sdk first.  
8299 if test "$MOZ_LDAP_XPCOM"; then
8301     # these subdirs may not yet have been created in the build tree.
8302     # don't use the "-p" switch to mkdir, since not all platforms have it
8303     #
8304     if test ! -d "directory"; then
8305         mkdir "directory"
8306     fi
8307     if test ! -d "directory/c-sdk"; then
8308         mkdir "directory/c-sdk"    
8309     fi
8310     if test ! -d "directory/c-sdk/ldap"; then
8311         mkdir "directory/c-sdk/ldap"    
8312     fi
8314     ac_configure_args="$_SUBDIR_CONFIG_ARGS --prefix=$MOZ_BUILD_ROOT/dist --with-dist-prefix=$MOZ_BUILD_ROOT/dist --without-nss --with-mozilla"
8315     if test -z "$MOZ_DEBUG"; then
8316         ac_configure_args="$ac_configure_args --disable-debug"
8317     fi
8318     if test "$MOZ_OPTIMIZE" = "1"; then
8319         ac_configure_args="$ac_configure_args --enable-optimize"
8320     fi
8321     if test -n "$HAVE_64BIT_OS"; then
8322         ac_configure_args="$ac_configure_args --enable-64bit"
8323     fi
8324     AC_OUTPUT_SUBDIRS(directory/c-sdk)
8325     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8327 fi # COMPILE_ENVIRONMENT