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