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