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