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