"Automated configuration bump, release for thunderbird 1.5.0.14rc1"
[mozilla-central.git] / configure.in
blobe5636d259f2829994c94e3111ac833d08a816677
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 $@'
1597     _PEDANTIC=
1598     CFLAGS="$CFLAGS -fpascal-strings -no-cpp-precomp -fno-common"
1599     CXXFLAGS="$CXXFLAGS -fpascal-strings -no-cpp-precomp -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_DEBUG_FLAGS="-g -fno-inline"  # most people on linux use gcc/gdb,
1720                                       # and that combo is not yet good at
1721                                       # debugging inlined functions (even
1722                                       # when using DWARF2 as the debugging
1723                                       # format)    
1725     case "${target_cpu}" in
1726     alpha*)
1727         CFLAGS="$CFLAGS -mieee"
1728         CXXFLAGS="$CXXFLAGS -mieee"
1729     ;;
1730     i*86)
1731         USE_ELF_DYNSTR_GC=1
1732         MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1
1733     ;;
1734     mips*)
1735         CFLAGS="$CFLAGS -Wa,-xgot"
1736         CXXFLAGS="$CXXFLAGS -Wa,-xgot"
1737     ;;
1738     esac
1739     ;;
1741 *-wince*)
1743     MOZ_TOOLS_DIR=`echo $MOZ_TOOLS`
1744     AR_LIST="$AR -list"
1745     AR_EXTRACT="$AR -extract"
1746     AR_DELETE="$AR d"
1747     AR_FLAGS='-OUT:"$@"'
1749     DSO_CFLAGS=
1750     DSO_PIC_CFLAGS=
1751     DLL_SUFFIX=.dll
1752     BIN_SUFFIX='.exe'
1753     RC=rc.exe
1754     # certain versions of cygwin's makedepend barf on the 
1755     # #include <string> vs -I./dist/include/string issue so don't use it
1756     SYSTEM_MAKEDEPEND=
1758     HOST_CC=cl
1759     HOST_CXX=cl
1760     HOST_LD=link
1761     HOST_AR='lib -OUT:$@'
1762     HOST_RANLIB='echo ranlib'
1763         
1764     WARNINGS_AS_ERRORS='-WX'
1765         MOZ_OPTIMIZE_FLAGS='-O1'
1766     AR_FLAGS='-NOLOGO -OUT:"$@"'
1767     ASM_SUFFIX=asm
1768     CFLAGS="$CFLAGS -W3 -Gy -Fd\$(PDBFILE)"
1769     CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(PDBFILE)"
1770     DLL_PREFIX=
1771     DOXYGEN=:
1772     DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
1773     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
1774     GARBAGE=
1775     IMPORT_LIB_SUFFIX=lib
1776     LIBS="$LIBS"
1777     LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
1778     LIB_PREFIX=
1779     LIB_SUFFIX=lib 
1780     MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
1781     MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
1782     MKSHLIB_FORCE_ALL=
1783     MKSHLIB_UNFORCE_ALL=
1784     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1785     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1786     MOZ_DEBUG_FLAGS='-Zi'
1787     MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1788     MOZ_FIX_LINK_PATHS=
1789     MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
1790     MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
1791     OBJ_SUFFIX=obj
1792     RANLIB='echo not_ranlib'
1793     STRIP='echo not_strip'
1794     TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
1795     UNZIP=unzip
1796     XARGS=xargs
1797     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
1798     ZIP=zip
1799     LIBIDL_CFLAGS="-I$MOZ_TOOLS_DIR/include ${GLIB_CFLAGS}"
1800     LIBIDL_LIBS="$MOZ_TOOLS_DIR/lib/libidl-0.6_s.lib $MOZ_TOOLS_DIR/lib/glib-1.2_s.lib"
1801     STATIC_LIBIDL=1
1803     AC_DEFINE(HAVE_SNPRINTF)
1804     AC_DEFINE(_WINDOWS)
1805     AC_DEFINE(_WIN32)
1806     AC_DEFINE(WIN32)
1807     AC_DEFINE(XP_WIN)
1808     AC_DEFINE(XP_WIN32)
1809     AC_DEFINE(HW_THREADS)
1810     AC_DEFINE(STDC_HEADERS)
1811     AC_DEFINE(NEW_H, <new>)
1812     AC_DEFINE(WIN32_LEAN_AND_MEAN)
1814     TARGET_MD_ARCH=win32
1815     _PLATFORM_DEFAULT_TOOLKIT='windows'
1816     BIN_SUFFIX='.exe'
1817     USE_SHORT_LIBNAME=1
1818     MOZ_ENABLE_COREXFONTS=
1819     MOZ_ENABLE_POSTSCRIPT=
1820     MOZ_USER_DIR="Mozilla"
1824 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
1825     DSO_CFLAGS=
1826     DSO_PIC_CFLAGS=
1827     DLL_SUFFIX=.dll
1828     RC=rc.exe
1829     # certain versions of cygwin's makedepend barf on the 
1830     # #include <string> vs -I./dist/include/string issue so don't use it
1831     SYSTEM_MAKEDEPEND=
1832     if test -n "$GNU_CC"; then
1833         CC="$CC -mno-cygwin"
1834         CXX="$CXX -mno-cygwin"
1835         CPP="$CPP -mno-cygwin"
1836         CFLAGS="$CFLAGS -mms-bitfields"
1837         CXXFLAGS="$CXXFLAGS -mms-bitfields"
1838         DSO_LDOPTS='-shared'
1839         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1840         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1841         RC='$(WINDRES)'
1842         # Use temp file for windres (bug 213281)
1843         RCFLAGS='-O coff --use-temp-file'
1844         # mingw doesn't require kernel32, user32, and advapi32 explicitly
1845         LIBS="$LIBS -lgdi32 -lwinmm -lwsock32"
1846         MOZ_JS_LIBS='-L$(LIBXUL_DIST)/lib -ljs$(MOZ_BITS)$(VERSION_NUMBER)'
1847         MOZ_FIX_LINK_PATHS=
1848         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core'
1849         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom'
1850         DLL_PREFIX=
1851         IMPORT_LIB_SUFFIX=dll.a
1852     else
1853         TARGET_COMPILER_ABI=msvc
1854         HOST_CC='$(CC)'
1855         HOST_CXX='$(CXX)'
1856         HOST_LD='$(LD)'
1857         AR='lib -NOLOGO -OUT:"$@"'
1858         AR_FLAGS=
1859         RANLIB='echo not_ranlib'
1860         STRIP='echo not_strip'
1861         XARGS=xargs
1862         ZIP=zip
1863         UNZIP=unzip
1864         DOXYGEN=:
1865         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
1866         OBJ_SUFFIX=obj
1867         LIB_SUFFIX=lib
1868         DLL_PREFIX=
1869         LIB_PREFIX=
1870         IMPORT_LIB_SUFFIX=lib
1871         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(PDBFILE) $(DSO_LDOPTS)'
1872         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(PDBFILE) $(DSO_LDOPTS)'
1873         MKSHLIB_FORCE_ALL=
1874         MKSHLIB_UNFORCE_ALL=
1875         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
1876         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(PDBFILE)"
1877         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(PDBFILE)"
1878         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
1879         MOZ_DEBUG_FLAGS='-Zi'
1880         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1881         WARNINGS_AS_ERRORS='-WX'
1882         MOZ_OPTIMIZE_FLAGS='-O1'
1883         MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
1884         MOZ_FIX_LINK_PATHS=
1885         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
1886         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
1887         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
1888         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1889         MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
1890         if test $_MSC_VER -ge 1400; then
1891             LDFLAGS="$LDFLAGS -NXCOMPAT -SAFESEH"
1892         fi
1893     fi
1894     MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg$(MOZ_BITS)$(VERSION_NUMBER),$(DEPTH)/jpeg)'
1895     MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
1896     AC_DEFINE(HAVE_SNPRINTF)
1897     AC_DEFINE(_WINDOWS)
1898     AC_DEFINE(_WIN32)
1899     AC_DEFINE(WIN32)
1900     AC_DEFINE(XP_WIN)
1901     AC_DEFINE(XP_WIN32)
1902     AC_DEFINE(HW_THREADS)
1903     AC_DEFINE(STDC_HEADERS)
1904     AC_DEFINE(NEW_H, <new>)
1905     AC_DEFINE(WIN32_LEAN_AND_MEAN)
1906     TARGET_MD_ARCH=win32
1907     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
1908     BIN_SUFFIX='.exe'
1909     USE_SHORT_LIBNAME=1
1910     MOZ_ENABLE_POSTSCRIPT=
1911     MOZ_USER_DIR="Mozilla"
1913     dnl Hardcode to win95 for now - cls
1914     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
1916     dnl set NO_X11 defines here as the general check is skipped on win32
1917     no_x=yes
1918     AC_DEFINE(NO_X11)
1920     dnl MinGW/MSYS doesn't provide or need cygpath
1921     case "$host" in
1922     *-mingw*)
1923         CYGPATH_W=echo
1924         CYGPATH_S=cat
1925         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
1926         ;;
1927     *-cygwin*|*-msvc*|*-mks*)
1928         CYGPATH_W="cygpath -a -w"
1929         CYGPATH_S="sed -e s|\\\\|/|g"
1930         MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
1931         ;;
1932     esac
1933     case "$host" in
1934     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
1936     if test -z "$MOZ_TOOLS"; then
1937         AC_MSG_ERROR([MOZ_TOOLS is not set])
1938     fi
1940     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd`
1941     if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then
1942         AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
1943     fi
1944     if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_DIR/bin:"` = 0; then
1945         AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
1946     fi
1947     MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
1949     if test -n "$GLIB_PREFIX"; then
1950         _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd`
1951         if test "$?" = "0"; then
1952             if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
1953                 AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
1954             fi
1955             _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
1956         else
1957             AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
1958         fi
1959     else
1960         _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
1961     fi
1962     if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
1963         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
1964     fi
1965     GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
1966     if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
1967         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
1968     elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
1969         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
1970     else
1971         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
1972     fi
1974     if test -n "$LIBIDL_PREFIX"; then
1975         _LIBIDL_PREFIX_DIR=`cd $LIBIDL_PREFIX && pwd`
1976         if test "$?" = "0"; then
1977             if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
1978                 AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
1979             fi
1980             _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
1981         else
1982             AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
1983         fi
1984     else
1985         _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
1986     fi        
1987     if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
1988         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
1989     fi
1990     LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
1991     if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
1992         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
1993         STATIC_LIBIDL=1
1994     elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
1995         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
1996     else
1997         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
1998     fi
1999     LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2000     ;;
2002     *) # else cross-compiling
2003         if test -n "$GLIB_PREFIX"; then
2004             GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
2005             if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
2006                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
2007             elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
2008                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
2009             else
2010                 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
2011             fi
2012         fi
2013         if test -n "$LIBIDL_PREFIX"; then
2014             LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
2015             if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
2016                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
2017                 STATIC_LIBIDL=1
2018             elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
2019                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
2020             else
2021                 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
2022             fi
2023         fi
2024         LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2025         ;;
2026     esac 
2028     case "$target" in
2029     i*86-*)
2030         AC_DEFINE(_X86_)
2031         ;;
2032     alpha-*)
2033         AC_DEFINE(_ALPHA_)
2034         ;;
2035     mips-*)
2036         AC_DEFINE(_MIPS_)
2037         ;;
2038     *)
2039         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2040         ;;
2041     esac
2042     ;;
2044 *-netbsd*)
2045     DSO_CFLAGS=''
2046     CFLAGS="$CFLAGS -Dunix"
2047     CXXFLAGS="$CXXFLAGS -Dunix"
2048     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2049         DLL_SUFFIX=".so"
2050         DSO_PIC_CFLAGS='-fPIC -DPIC'
2051         DSO_LDOPTS='-shared'
2052         BIN_FLAGS='-Wl,--export-dynamic'
2053     else
2054         DSO_PIC_CFLAGS='-fPIC -DPIC'
2055         DLL_SUFFIX=".so.1.0"
2056         DSO_LDOPTS='-shared'
2057     fi
2058     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2059     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2060     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2061     if test "$LIBRUNPATH"; then
2062         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2063     fi
2064     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2065     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2066     ;;
2068 *-nto*) 
2069         AC_DEFINE(NTO)  
2070         AC_DEFINE(_QNX_SOURCE)
2071         AC_DEFINE(_i386)
2072         OS_TARGET=NTO
2073         WARNINGS_AS_ERRORS=''
2074         MOZ_OPTIMIZE_FLAGS="-O"
2075         MOZ_DEBUG_FLAGS="-gstabs"
2076         USE_PTHREADS=1
2077         _PEDANTIC=
2078         LIBS="$LIBS -lsocket -lstdc++"
2079         _DEFINES_CFLAGS='-Wp,-include -Wp,$(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2080         _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -Wp,-include -Wp,$(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2081         if test "$with_x" != "yes"
2082         then
2083                 _PLATFORM_DEFAULT_TOOLKIT="photon"
2084             TK_CFLAGS='-I/usr/include/photon'
2085                 TK_LIBS='-lph'
2086         fi
2087         case "${target_cpu}" in
2088         ppc*)
2089         AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)        
2090         ;;
2091         esac
2092         case "${host_cpu}" in
2093         i*86)
2094         USE_ELF_DYNSTR_GC=1
2095         ;;
2096         esac
2097         ;;
2099 *-openbsd*)
2100     DLL_SUFFIX=".so.1.0"
2101     DSO_CFLAGS=''
2102     DSO_PIC_CFLAGS='-fPIC'
2103     DSO_LDOPTS='-shared -fPIC'
2104     if test "$LIBRUNPATH"; then
2105         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2106     fi
2107     ;;
2109 *-openvms*) 
2110     AC_DEFINE(NO_PW_GECOS)
2111     AC_DEFINE(NO_UDSOCK)
2112     AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2113     USE_PTHREADS=1
2114     MKSHLIB_FORCE_ALL='-all'
2115     MKSHLIB_UNFORCE_ALL='-none'
2116     AS='as'
2117     AS_DASH_C_FLAG='-Wc/names=as_is'
2118     AR_FLAGS='c $@'
2119     DSO_LDOPTS='-shared -auto_symvec'
2120     DSO_PIC_CFLAGS=
2121     MOZ_DEBUG_LDFLAGS='-g'
2122     COMPAQ_CXX=1
2123     CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2124     CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2125     ;;
2128 *-os2*)
2129     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2130     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2131     AC_DEFINE(XP_OS2)
2132     USE_SHORT_LIBNAME=1
2133     DLL_PREFIX=
2134     LIB_PREFIX=
2135     LIB_SUFFIX=lib
2136     BIN_SUFFIX=".exe"
2137     DLL_SUFFIX=".dll"
2138     IMPORT_LIB_SUFFIX=lib
2139     DSO_PIC_CFLAGS=
2140     TARGET_MD_ARCH=os2
2141     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2142     MOZ_ENABLE_POSTSCRIPT=
2143     RC=rc.exe
2144     RCFLAGS='-n'
2145     MOZ_USER_DIR="Mozilla"
2147     if test "$MOZTOOLS"; then
2148         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2149     else
2150         AC_MSG_ERROR([MOZTOOLS is not set])
2151     fi
2153     # EMX/GCC build
2154     if test -n "$GNU_CC"; then
2155         AC_DEFINE(OS2)
2156         AC_DEFINE(XP_OS2_EMX)
2157         AC_DEFINE(OS2EMX_PLAIN_CHAR)
2158         AC_DEFINE(TCPV40HDRS)
2159         AR=emxomfar
2160         AR_FLAGS='r $@'
2161         CFLAGS="$CFLAGS -Zomf"
2162         CXXFLAGS="$CXXFLAGS -Zomf"
2163         DSO_LDOPTS='-Zdll'
2164         BIN_FLAGS='-Zlinker /ST:0x100000'
2165         IMPLIB='emximp -o'
2166         FILTER='emxexp -o'
2167         LDFLAGS='-Zmap'
2168         WARNINGS_AS_ERRORS='-Werror'
2169         MOZ_DEBUG_FLAGS="-g -fno-inline"
2170         MOZ_OPTIMIZE_FLAGS="-O2 -s"
2171         MOZ_OPTIMIZE_LDFLAGS="-Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2172         MOZ_XPCOM_OBSOLETE_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcomct.lib'
2173         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcomcor.lib'
2174         LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2175         if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2176           DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2177           LDFLAGS="$LDFLAGS -Zhigh-mem"
2178           MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2179           AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2180         fi
2182         # GCC for OS/2 currently predefines these, but we don't want them
2183         _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2184         _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2186         AC_CACHE_CHECK(for __declspec(dllexport),
2187            ac_os2_declspec,
2188            [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2189                            [return 0;],
2190                            ac_os2_declspec="yes",
2191                            ac_os2_declspec="no")])
2192         if test "$ac_os2_declspec" = "yes"; then
2193            FILTER='true'
2194            MOZ_OS2_USE_DECLSPEC='1'
2195         fi
2196         
2197     # Visual Age C++ build
2198     elif test "$VACPP" = "yes"; then
2199         MOZ_BUILD_ROOT=`pwd -D`
2200         OBJ_SUFFIX=obj
2201         AR=-ilib
2202         AR_FLAGS='/NOL /NOI /O:$(subst /,\\,$@)'
2203         AR_LIST='/L'
2204         AR_EXTRACT='-*'
2205         AR_DELETE='-'
2206         AS=alp
2207         ASFLAGS='-Mb'
2208         AS_DASH_C_FLAG=''
2209         ASM_SUFFIX=asm
2210         LD='-ilink'
2211         CFLAGS="/Q /qlibansi /Gm+ /Su4 /Mp /Tl9"
2212         CXXFLAGS="/Q /qlibansi /Gm+ /Su4 /Mp /Tl9 /Gx+"
2213         MOZ_DEBUG_FLAGS="/Ti+"
2214         WARNINGS_AS_ERRORS='-WX'
2215         MOZ_OPTIMIZE_FLAGS="/O+ /Gl+ /G5 /qarch=pentium"
2216         LDFLAGS="/NOL /M"
2217         MOZ_DEBUG_LDFLAGS="/DE"
2218         MOZ_OPTIMIZE_LDFLAGS="/OPTFUNC /EXEPACK:2 /PACKCODE /PACKDATA"
2219         DSO_LDOPTS=''
2220         DSO_PIC_CFLAGS=
2221         IMPLIB='implib /NOL /NOI'
2222         FILTER='cppfilt -q -B -P'
2223         AC_DEFINE(NO_ANSI_KEYWORDS)
2224         AC_DEFINE(OS2,4)
2225         AC_DEFINE(_X86_)
2226         AC_DEFINE(XP_OS2_VACPP)
2227         AC_DEFINE(TCPV40HDRS)
2228         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2229         AC_DEFINE(STDC_HEADERS)
2230         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2231         MKSHLIB='$(LD) $(DSO_LDOPTS)'
2232         MKCSHLIB='$(LD) $(DSO_LDOPTS)'
2233         MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2234         MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcomct.lib'
2235         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcomcor.lib'
2236         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2237     fi
2238     ;;
2240 alpha*-*-osf*)
2241     if test "$GNU_CC"; then
2242       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2243       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2245     else
2246         MOZ_DEBUG_FLAGS='-g'
2247         ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2248         CFLAGS="$CFLAGS -ieee"
2249         CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
2250         DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2251         DSO_CFLAGS=
2252         DSO_PIC_CFLAGS=
2253         MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2254         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2255         MKSHLIB_FORCE_ALL='-all'
2256         MKSHLIB_UNFORCE_ALL='-none'
2257         dnl Might fix the libxpcom.so breakage on this platform as well....
2258         AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2259         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2260     fi
2261     if test -z "$GNU_CXX"; then
2262       COMPAQ_CXX=1
2263     fi
2264     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2265     ;;
2267 *-qnx*) 
2268     DIRENT_INO=d_stat.st_ino
2269     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2270     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2271     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2272     dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2273     AC_DEFINE(STDC_HEADERS)
2274     if test "$no_x" = "yes"; then
2275             _PLATFORM_DEFAULT_TOOLKIT='photon'
2276             TK_CFLAGS='-I/usr/nto/include/photon'
2277             TK_LIBS='-lphoton -lphrender'
2278     fi
2279     ;;
2281 *-sco*) 
2282     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2283     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2284     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2285     if test ! "$GNU_CC"; then
2286        DSO_LDOPTS='-G'
2287     fi
2288     ;;
2290 dnl the qsort routine under solaris is faulty
2291 *-solaris*) 
2292     AC_DEFINE(SOLARIS)
2293     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2294     SYSTEM_MAKEDEPEND=
2295     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2296     # libraries one level up (e.g. libnspr4.so)
2297     LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
2298     if test -z "$GNU_CC"; then
2299        NS_USE_NATIVE=1
2300        MOZ_FIX_LINK_PATHS='-R $(LIBXUL_DIST)/bin'
2301        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2302        CFLAGS="$CFLAGS -xstrconst -xbuiltin=%all"
2303        CXXFLAGS="$CXXFLAGS -xbuiltin=%all -features=tmplife -norunpath"
2304        LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
2305        if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
2306            _SAVE_LDFLAGS=$LDFLAGS
2307            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
2308            AC_TRY_LINK([#include <stdio.h>],
2309                        [printf("Hello World\n");],
2310                        ,
2311                        [LDFLAGS=$_SAVE_LDFLAGS])
2312        fi
2313        WARNINGS_AS_ERRORS='-Werror'
2314        MOZ_OPTIMIZE_FLAGS="-xO4"
2315        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2316        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -z muldefs -h $@ -o $@'
2317        MKSHLIB_FORCE_ALL='-z allextract'
2318        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2319        DSO_LDOPTS='-G -z muldefs'
2320        AR_LIST="$AR t"
2321        AR_EXTRACT="$AR x"
2322        AR_DELETE="$AR d"
2323        AR='$(CXX) -xar'
2324        AR_FLAGS='-o $@'
2325        AS='/usr/ccs/bin/as'
2326        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2327        AS_DASH_C_FLAG=''
2328        TARGET_COMPILER_ABI="sunc"
2329         CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2330         CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2331        AC_MSG_CHECKING([for Forte compiler version >= WS6U2])
2332        AC_LANG_SAVE
2333        AC_LANG_CPLUSPLUS
2334        AC_TRY_COMPILE([],
2335            [#if (__SUNPRO_CC < 0x530)
2336            #error "Denied"
2337            #endif],
2338            _BAD_COMPILER=,_BAD_COMPILER=1)
2339         if test -n "$_BAD_COMPILER"; then
2340             _res="no"
2341             AC_MSG_ERROR([Forte version WS6U2 or higher is required to build. Your compiler version is $CC_VERSION .])
2342         else
2343             _res="yes"
2344         fi
2345         AC_MSG_RESULT([$_res])
2346         AC_LANG_RESTORE
2347     else
2348        ASFLAGS="$ASFLAGS -fPIC"
2349        DSO_LDOPTS='-G'
2350        _WARNINGS_CFLAGS=''
2351        _WARNINGS_CXXFLAGS=''
2352        if test "$OS_RELEASE" = "5.3"; then
2353           AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2354        fi
2355     fi
2356     if test "$OS_RELEASE" = "5.5.1"; then
2357        AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2358     fi
2359     ;;
2361 *-sunos*) 
2362     DSO_LDOPTS='-Bdynamic'
2363     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2364     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2365     AC_DEFINE(SUNOS4)
2366     AC_DEFINE(SPRINTF_RETURNS_STRING)
2367     case "$(target_os)" in
2368     sunos4.1*)
2369         DLL_SUFFIX='.so.1.0'
2370         ;;
2371     esac
2372     ;;
2374 *-sysv4.2uw7*) 
2375         NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2376     ;;
2378 *-os2*)
2379     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2380     ;;
2382 esac
2384 dnl Only one oddball right now (QNX), but this gives us flexibility
2385 dnl if any other platforms need to override this in the future.
2386 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2388 dnl ========================================================
2389 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2390 dnl by now will not have any way to link most binaries (tests
2391 dnl as well as viewer, apprunner, etc.), because some symbols
2392 dnl will be left out of the "composite" .so's by ld as unneeded.
2393 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2394 dnl they can link in the static libs that provide the missing
2395 dnl symbols.
2396 dnl ========================================================
2397 NO_LD_ARCHIVE_FLAGS=
2398 if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then
2399     NO_LD_ARCHIVE_FLAGS=1
2401 case "$target" in
2402 *-os2*)
2403     NO_LD_ARCHIVE_FLAGS=
2404     ;;
2405 *-aix4.3*|*-aix5*)
2406     NO_LD_ARCHIVE_FLAGS=
2407     ;;
2408 *-openvms*)
2409     NO_LD_ARCHIVE_FLAGS=
2410     ;;
2411 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince)
2412     if test -z "$GNU_CC"; then
2413         NO_LD_ARCHIVE_FLAGS=
2414     fi
2415     ;;
2416 esac
2417 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2420 dnl Indicate that platform requires special thread safe 
2421 dnl locking when starting up the OJI JVM 
2422 dnl (see mozilla/modules/oji/src/nsJVMManager.cpp)
2423 dnl ========================================================
2424 case "$target" in
2425     *-hpux*)      
2426         AC_DEFINE(MOZ_OJI_REQUIRE_THREAD_SAFE_ON_STARTUP)
2427         ;;
2428 esac
2430 dnl ========================================================
2431 dnl = Flags to strip unused symbols from .so components
2432 dnl ========================================================
2433 case "$target" in
2434     *-linux*)
2435         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2436         ;;
2437     *-solaris*)
2438         if test -z "$GNU_CC"; then
2439          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2440         else
2441          if test -z "$GCC_USE_GNU_LD"; then
2442           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2443          else
2444           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2445          fi
2446         fi
2447         ;;
2448     *-nto*) 
2449         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2450         ;;
2451     *-darwin*)
2452         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2453         ;;
2454     *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince)
2455         if test -n "$GNU_CC"; then
2456            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2457         fi
2458         ;;
2459 esac
2461 if test -z "$COMPILE_ENVIRONMENT"; then
2462     SKIP_COMPILER_CHECKS=1
2463     SKIP_LIBRARY_CHECKS=1
2466 if test -z "$SKIP_COMPILER_CHECKS"; then
2467 dnl Checks for typedefs, structures, and compiler characteristics.
2468 dnl ========================================================
2469 AC_LANG_C
2470 AC_HEADER_STDC
2471 AC_C_CONST
2472 AC_TYPE_MODE_T
2473 AC_TYPE_OFF_T
2474 AC_TYPE_PID_T
2475 AC_TYPE_SIZE_T
2476 AC_STRUCT_ST_BLKSIZE
2477 AC_MSG_CHECKING(for siginfo_t)
2478 AC_CACHE_VAL(ac_cv_siginfo_t,
2479  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2480                   #include <signal.h>],
2481                  [siginfo_t* info;],
2482                  [ac_cv_siginfo_t=true],
2483                  [ac_cv_siginfo_t=false])])
2484 if test "$ac_cv_siginfo_t" = true ; then
2485   AC_DEFINE(HAVE_SIGINFO_T)
2486   AC_MSG_RESULT(yes)
2487 else
2488   AC_MSG_RESULT(no)
2491 dnl Visual Age for os/2 also defines size_t and off_t in certain 
2492 dnl  header files.  These defines make Visual Age use the mozilla
2493 dnl  defines types.
2494 if test "$VACPP" = "yes"; then
2495    AC_DEFINE(__size_t)
2496    AC_DEFINE(__off_t)
2499 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2500 dnl ========================================================
2501 AC_MSG_CHECKING(for int16_t)
2502 AC_CACHE_VAL(ac_cv_int16_t,
2503  [AC_TRY_COMPILE([#include <stdio.h>
2504                   #include <sys/types.h>],
2505                  [int16_t foo = 0;],
2506                  [ac_cv_int16_t=true],
2507                  [ac_cv_int16_t=false])])
2508 if test "$ac_cv_int16_t" = true ; then
2509   AC_DEFINE(HAVE_INT16_T)
2510   AC_MSG_RESULT(yes)
2511 else
2512   AC_MSG_RESULT(no)
2514 AC_MSG_CHECKING(for int32_t)
2515 AC_CACHE_VAL(ac_cv_int32_t,
2516  [AC_TRY_COMPILE([#include <stdio.h>
2517                   #include <sys/types.h>],
2518                  [int32_t foo = 0;],
2519                  [ac_cv_int32_t=true],
2520                  [ac_cv_int32_t=false])])
2521 if test "$ac_cv_int32_t" = true ; then
2522   AC_DEFINE(HAVE_INT32_T)
2523   AC_MSG_RESULT(yes)
2524 else
2525   AC_MSG_RESULT(no)
2527 AC_MSG_CHECKING(for int64_t)
2528 AC_CACHE_VAL(ac_cv_int64_t,
2529  [AC_TRY_COMPILE([#include <stdio.h>
2530                   #include <sys/types.h>],
2531                  [int64_t foo = 0;],
2532                  [ac_cv_int64_t=true],
2533                  [ac_cv_int64_t=false])])
2534 if test "$ac_cv_int64_t" = true ; then
2535   AC_DEFINE(HAVE_INT64_T)
2536   AC_MSG_RESULT(yes)
2537 else
2538   AC_MSG_RESULT(no)
2540 AC_MSG_CHECKING(for int64)
2541 AC_CACHE_VAL(ac_cv_int64,
2542  [AC_TRY_COMPILE([#include <stdio.h>
2543                   #include <sys/types.h>],
2544                  [int64 foo = 0;],
2545                  [ac_cv_int64=true],
2546                  [ac_cv_int64=false])])
2547 if test "$ac_cv_int64" = true ; then
2548   AC_DEFINE(HAVE_INT64)
2549   AC_MSG_RESULT(yes)
2550 else
2551   AC_MSG_RESULT(no)
2553 AC_MSG_CHECKING(for uint)
2554 AC_CACHE_VAL(ac_cv_uint,
2555  [AC_TRY_COMPILE([#include <stdio.h>
2556                   #include <sys/types.h>],
2557                  [uint foo = 0;],
2558                  [ac_cv_uint=true],
2559                  [ac_cv_uint=false])])
2560 if test "$ac_cv_uint" = true ; then
2561   AC_DEFINE(HAVE_UINT)
2562   AC_MSG_RESULT(yes)
2563 else
2564   AC_MSG_RESULT(no)
2566 AC_MSG_CHECKING(for uint_t)
2567 AC_CACHE_VAL(ac_cv_uint_t,
2568  [AC_TRY_COMPILE([#include <stdio.h>
2569                   #include <sys/types.h>],
2570                  [uint_t foo = 0;],
2571                  [ac_cv_uint_t=true],
2572                  [ac_cv_uint_t=false])])
2573 if test "$ac_cv_uint_t" = true ; then
2574   AC_DEFINE(HAVE_UINT_T)
2575   AC_MSG_RESULT(yes)
2576 else
2577   AC_MSG_RESULT(no)
2579 AC_MSG_CHECKING(for uint16_t)
2580 AC_CACHE_VAL(ac_cv_uint16_t,
2581  [AC_TRY_COMPILE([#include <stdio.h>
2582                   #include <sys/types.h>],
2583                  [uint16_t foo = 0;],
2584                  [ac_cv_uint16_t=true],
2585                  [ac_cv_uint16_t=false])])
2586 if test "$ac_cv_uint16_t" = true ; then
2587   AC_DEFINE(HAVE_UINT16_T)
2588   AC_MSG_RESULT(yes)
2589 else
2590   AC_MSG_RESULT(no)
2593 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2594 dnl are defined when compiling C++ but not C.  Since the result of this
2595 dnl test is used only in C++, do it in C++.
2596 AC_LANG_CPLUSPLUS
2598 AC_MSG_CHECKING(for uname.domainname)
2599 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2600     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2601         [ struct utsname *res; char *domain; 
2602             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
2603         [ac_cv_have_uname_domainname_field=true],
2604         [ac_cv_have_uname_domainname_field=false])])
2606 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2607     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2608     AC_MSG_RESULT(yes)
2609 else
2610     AC_MSG_RESULT(no)
2613 AC_MSG_CHECKING(for uname.__domainname)
2614 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2615     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2616         [ struct utsname *res; char *domain; 
2617             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
2618         [ac_cv_have_uname_us_domainname_field=true],
2619         [ac_cv_have_uname_us_domainname_field=false])])
2621 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2622     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2623     AC_MSG_RESULT(yes)
2624 else
2625     AC_MSG_RESULT(no)
2628 AC_LANG_C
2630 dnl Check for usable wchar_t (2 bytes, unsigned)
2631 dnl (we really don't need the unsignedness check anymore)
2632 dnl ========================================================
2634 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2635     ac_cv_have_usable_wchar_v2,
2636     [AC_TRY_COMPILE([#include <stddef.h>
2637                      $configure_static_assert_macros],
2638                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2639                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2640                     ac_cv_have_usable_wchar_v2="yes",
2641                     ac_cv_have_usable_wchar_v2="no")])
2642 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2643     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2644     HAVE_CPP_2BYTE_WCHAR_T=1
2645 else
2646 dnl This is really gcc-only
2647 dnl Do this test using CXX only since some versions of gcc
2648 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2649 dnl only have short-wchar support for c++.
2650 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2652     AC_LANG_SAVE
2653     AC_LANG_CPLUSPLUS
2654     _SAVE_CXXFLAGS=$CXXFLAGS
2655     CXXFLAGS="$CXXFLAGS -fshort-wchar"
2657     AC_CACHE_CHECK(for compiler -fshort-wchar option, 
2658         ac_cv_have_usable_wchar_option_v2,
2659         [AC_TRY_COMPILE([#include <stddef.h>
2660                          $configure_static_assert_macros],
2661                         [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2662                          CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2663                         ac_cv_have_usable_wchar_option_v2="yes",
2664                         ac_cv_have_usable_wchar_option_v2="no")])
2666     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2667         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2668         HAVE_CPP_2BYTE_WCHAR_T=1
2669     else    
2670         CXXFLAGS=$_SAVE_CXXFLAGS
2671     fi
2672     AC_LANG_RESTORE
2675 dnl Check for .hidden assembler directive and visibility attribute.
2676 dnl Borrowed from glibc configure.in
2677 dnl ===============================================================
2678 if test "$GNU_CC"; then
2679   AC_CACHE_CHECK(for visibility(hidden) attribute,
2680                  ac_cv_visibility_hidden,
2681                  [cat > conftest.c <<EOF
2682                   int foo __attribute__ ((visibility ("hidden"))) = 1;
2684                   ac_cv_visibility_hidden=no
2685                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2686                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2687                       ac_cv_visibility_hidden=yes
2688                     fi
2689                   fi
2690                   rm -f conftest.[cs]
2691                  ])
2692   if test "$ac_cv_visibility_hidden" = "yes"; then
2693     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2695     AC_CACHE_CHECK(for visibility(default) attribute,
2696                    ac_cv_visibility_default,
2697                    [cat > conftest.c <<EOF
2698                     int foo __attribute__ ((visibility ("default"))) = 1;
2700                     ac_cv_visibility_default=no
2701                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2702                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2703                         ac_cv_visibility_default=yes
2704                       fi
2705                     fi
2706                     rm -f conftest.[cs]
2707                    ])
2708     if test "$ac_cv_visibility_default" = "yes"; then
2709       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2711       AC_CACHE_CHECK(for visibility pragma support,
2712                      ac_cv_visibility_pragma,
2713                      [cat > conftest.c <<EOF
2714 #pragma GCC visibility push(hidden)
2715                       int foo_hidden = 1;
2716 #pragma GCC visibility push(default)
2717                       int foo_default = 1;
2719                       ac_cv_visibility_pragma=no
2720                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2721                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2722                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2723                             ac_cv_visibility_pragma=yes
2724                           fi
2725                         fi
2726                       fi
2727                       rm -f conftest.[cs]
2728                     ])
2729       if test "$ac_cv_visibility_pragma" = "yes"; then
2730         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2731                        ac_cv_have_visibility_class_bug,
2732                        [cat > conftest.c <<EOF
2733 #pragma GCC visibility push(hidden)
2734 struct __attribute__ ((visibility ("default"))) TestStruct {
2735   static void Init();
2737 __attribute__ ((visibility ("default"))) void TestFunc() {
2738   TestStruct::Init();
2741                        ac_cv_have_visibility_class_bug=no
2742                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2743                          ac_cv_have_visibility_class_bug=yes
2744                        else
2745                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2746                            ac_cv_have_visibility_class_bug=yes
2747                          fi
2748                        fi
2749                        rm -rf conftest.{c,S}
2750                        ])
2752         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2753                        ac_cv_have_visibility_builtin_bug,
2754                        [cat > conftest.c <<EOF
2755 #pragma GCC visibility push(hidden)
2756 #pragma GCC visibility push(default)
2757 #include <string.h>
2758 #pragma GCC visibility pop
2760 __attribute__ ((visibility ("default"))) void Func() {
2761   char c[[100]];
2762   memset(c, 0, sizeof(c));
2765                        ac_cv_have_visibility_builtin_bug=no
2766                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2767                          ac_cv_have_visibility_builtin_bug=yes
2768                        else
2769                          if test `grep -c "@PLT" conftest.S` = 0; then
2770                            ac_cv_visibility_builtin_bug=yes
2771                          fi
2772                        fi
2773                        rm -f conftest.{c,S}
2774                        ])
2775         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2776                 "$ac_cv_have_visibility_class_bug" = "no"; then
2777           VISIBILITY_FLAGS='-I$(DIST)/include/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2778           WRAP_SYSTEM_INCLUDES=1
2779         else
2780           VISIBILITY_FLAGS='-fvisibility=hidden'
2781         fi # have visibility pragma bug
2782       fi   # have visibility pragma
2783     fi     # have visibility(default) attribute
2784   fi       # have visibility(hidden) attribute
2785 fi         # GNU_CC
2787 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2788 AC_SUBST(VISIBILITY_FLAGS)
2790 dnl Checks for header files.
2791 dnl ========================================================
2792 AC_HEADER_DIRENT
2793 case "$target_os" in
2794 freebsd*)
2795 # for stuff like -lXshm
2796     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2797     ;;
2798 esac
2799 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
2800 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
2801 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
2802 AC_CHECK_HEADERS(malloc.h)
2803 AC_CHECK_HEADERS(X11/XKBlib.h)
2805 dnl These are all the places some variant of statfs can be hiding.
2806 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2808 dnl Try for MMX support
2809 dnl NB - later gcc versions require -mmmx for this header to be successfully
2810 dnl included (or another option which implies it, such as -march=pentium-mmx)
2811 AC_CHECK_HEADERS(mmintrin.h)
2813 dnl Check whether the compiler supports the new-style C++ standard
2814 dnl library headers (i.e. <new>) or needs the old "new.h"
2815 AC_LANG_CPLUSPLUS
2816 NEW_H=new.h
2817 AC_CHECK_HEADER(new, [NEW_H=new])
2818 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
2819 AC_LANG_C
2821 AC_ARG_ENABLE(dtrace,
2822               build with dtrace support if available (default=no),
2823               [enable_dtrace="yes"],)
2824 if test "x$enable_dtrace" = "xyes"; then
2825   AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
2826   if test -n "$HAVE_DTRACE"; then
2827       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
2828   else
2829       AC_MSG_ERROR([dtrace enabled but sys/std.h not found]);
2830   fi
2832 AC_SUBST(HAVE_DTRACE)
2834 case $target in
2835 *-aix4.3*|*-aix5*)
2836         ;;
2838         AC_CHECK_HEADERS(sys/cdefs.h)
2839         ;;
2840 esac
2842 dnl Checks for libraries.
2843 dnl ========================================================
2844 case $target in
2845 *-hpux11.*)
2846         ;;
2848         AC_CHECK_LIB(c_r, gethostbyname_r)
2849         ;;
2850 esac
2852 dnl We don't want to link with libdl even if it's present on OS X, since
2853 dnl it's not used and not part of the default installation.
2854 dnl The same goes for BeOS.
2855 dnl We don't want to link against libm or libpthread on Darwin since
2856 dnl they both are just symlinks to libSystem and explicitly linking
2857 dnl against libSystem causes issues when debugging (see bug 299601).
2858 case $target in
2859 *-darwin*)
2860     ;;
2861 *-beos*)
2862     ;;
2864     AC_CHECK_LIB(m, atan)
2865     AC_CHECK_LIB(dl, dlopen,
2866     AC_CHECK_HEADER(dlfcn.h, 
2867         LIBS="-ldl $LIBS"
2868         AC_DEFINE(HAVE_LIBDL)))
2869     ;;
2870 esac
2872 _SAVE_CFLAGS="$CFLAGS"
2873 CFLAGS="$CFLAGS -D_GNU_SOURCE"
2874 AC_CHECK_FUNCS(dladdr)
2875 CFLAGS="$_SAVE_CFLAGS"
2877 if test ! "$GNU_CXX"; then
2879     case $target in
2880     *-aix*)
2881         AC_CHECK_LIB(C_r, demangle)
2882         ;;
2883      *)
2884         AC_CHECK_LIB(C, demangle)
2885         ;;
2886      esac
2888 AC_CHECK_LIB(socket, socket)
2890 XLDFLAGS="$X_LIBS"
2891 XLIBS="$X_EXTRA_LIBS"
2893 dnl ========================================================
2894 dnl Checks for X libraries.
2895 dnl Ordering is important.
2896 dnl Xt is dependent upon SM as of X11R6
2897 dnl ========================================================
2898 if test "$no_x" = "yes"; then
2899     AC_DEFINE(NO_X11)
2900 else
2901     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
2902         XLIBS="-lX11 $XLIBS"
2903         _SAVE_LDFLAGS="$LDFLAGS"
2904         LDFLAGS="$XLDFLAGS $LDFLAGS"
2905         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
2906                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
2907         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
2908                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
2909    
2910      
2911         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
2912         unset ac_cv_lib_Xt_XtFree
2913             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
2914             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS) 
2915         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
2916                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
2917         ])
2919     # AIX needs the motif library linked before libXt to prevent
2920     # crashes in plugins linked against Motif - Bug #98892
2921     case "${target_os}" in
2922     aix*)
2923         XT_LIBS="-lXm $XT_LIBS"
2924         ;;
2925     esac
2927     dnl ========================================================
2928     dnl = Check for XShm
2929     dnl ========================================================
2930     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
2931         $XLIBS $XEXT_LIBS)
2932     AC_CHECK_HEADER(X11/extensions/XShm.h)
2933     if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
2934         test -n "$_HAVE_XSHM_XEXT"; then
2935         AC_DEFINE(HAVE_XSHM)
2936     fi
2938     dnl ========================================================
2939     dnl = Check for XIE
2940     dnl ========================================================
2941     AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
2942         $XLIBS $XEXT_LIBS)
2943     AC_CHECK_HEADER(X11/extensions/XIElib.h)
2945     if test "$MOZ_XIE_LIBS"; then
2946         dnl ====================================================
2947         dnl = If XIE is present and is desired, turn it on
2948         dnl ====================================================
2949         case $target in
2950             *-hpux*)
2951                 ;;
2952             *)
2953                 HAVE_XIE=1
2954                 ;;
2955         esac
2956     fi
2958         LDFLAGS="$_SAVE_LDFLAGS"
2960     dnl ========================================================
2961     dnl = Check for freetype2 and its functionality
2962     dnl ========================================================
2963     AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
2965     if test "$_HAVE_FREETYPE2"; then
2966         _SAVE_LIBS="$LIBS"
2967         _SAVE_CFLAGS="$CFLAGS"
2968         LIBS="$LIBS $FT2_LIBS"
2969         CFLAGS="$CFLAGS $FT2_CFLAGS"
2971         AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
2972             ac_cv_member_FT_Bitmap_Size_y_ppem,
2973             [AC_TRY_COMPILE([#include <ft2build.h>
2974                              #include FT_FREETYPE_H],
2975                             [FT_Bitmap_Size s;
2976                              if (sizeof s.y_ppem) return 0;
2977                              return 1],
2978                             ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
2979                             ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
2980         if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
2981             HAVE_FT_BITMAP_SIZE_Y_PPEM=1
2982         else
2983             HAVE_FT_BITMAP_SIZE_Y_PPEM=0
2984         fi
2985         AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
2986                            $HAVE_FT_BITMAP_SIZE_Y_PPEM,
2987                            [FT_Bitmap_Size structure includes y_ppem field])
2989         AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
2991         LIBS="$_SAVE_LIBS"
2992         CFLAGS="$_SAVE_CFLAGS"
2993     fi
2995 fi # $no_x
2997 AC_SUBST(XCFLAGS)
2998 AC_SUBST(XLDFLAGS)
2999 AC_SUBST(XLIBS)
3000 AC_SUBST(XT_LIBS)
3002 dnl ========================================================
3003 dnl = pthread support
3004 dnl = Start by checking whether the system support pthreads
3005 dnl ========================================================
3006 case "$target_os" in
3007 darwin*)
3008     USE_PTHREADS=1
3009     ;;
3011     MOZ_CHECK_PTHREADS(pthreads,
3012         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3013         MOZ_CHECK_PTHREADS(pthread,
3014             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3015             MOZ_CHECK_PTHREADS(c_r,
3016                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3017                 MOZ_CHECK_PTHREADS(c,
3018                     USE_PTHREADS=1
3019                 )
3020             )
3021         )
3022     )
3023     ;;
3024 esac
3026 dnl ========================================================
3027 dnl Check the command line for --with-pthreads 
3028 dnl ========================================================
3029 MOZ_ARG_WITH_BOOL(pthreads,
3030 [  --with-pthreads         Force use of system pthread library with NSPR ],
3031 [ if test "$USE_PTHREADS"x = x; then
3032     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3033 fi],
3034     USE_PTHREADS=
3035     _PTHREAD_LDFLAGS=
3038 dnl ========================================================
3039 dnl Do the platform specific pthread hackery
3040 dnl ========================================================
3041 if test "$USE_PTHREADS"x != x
3042 then
3043         dnl
3044         dnl See if -pthread is supported.
3045         dnl
3046         rm -f conftest*
3047         ac_cv_have_dash_pthread=no
3048         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3049         echo 'int main() { return 0; }' | cat > conftest.c
3050         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3051         if test $? -eq 0; then
3052                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3053                         ac_cv_have_dash_pthread=yes
3054                 case "$target_os" in
3055                 freebsd*)
3056 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3057                 ;;
3058                 *)
3059                             CFLAGS="$CFLAGS -pthread"
3060                             CXXFLAGS="$CXXFLAGS -pthread"
3061                 ;;
3062                 esac
3063                 fi
3064         fi
3065         rm -f conftest*
3066     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3068         dnl
3069         dnl See if -pthreads is supported.
3070         dnl
3071     ac_cv_have_dash_pthreads=no
3072     if test "$ac_cv_have_dash_pthread" = "no"; then
3073             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3074         echo 'int main() { return 0; }' | cat > conftest.c
3075             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3076         if test $? -eq 0; then
3077                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3078                             ac_cv_have_dash_pthreads=yes
3079                             CFLAGS="$CFLAGS -pthreads"
3080                             CXXFLAGS="$CXXFLAGS -pthreads"
3081                     fi
3082             fi
3083             rm -f conftest*
3084         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3085     fi
3087         case "$target" in
3088             *-*-freebsd*)
3089                         AC_DEFINE(_REENTRANT)
3090                         AC_DEFINE(_THREAD_SAFE)
3091                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3092                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3093                                 _PTHREAD_LDFLAGS="-pthread"
3094                         else
3095                                 _PTHREAD_LDFLAGS="-lc_r"
3096                         fi
3097                         ;;
3099             *-*-openbsd*|*-*-bsdi*)
3100                         AC_DEFINE(_REENTRANT)
3101                         AC_DEFINE(_THREAD_SAFE)
3102                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3103                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3104                 _PTHREAD_LDFLAGS="-pthread"
3105                         fi
3106                         ;;
3108             *-*-linux*) 
3109                         AC_DEFINE(_REENTRANT) 
3110                         ;;
3112             *-*-nto*) 
3113                         AC_DEFINE(_REENTRANT) 
3114                         ;;
3116             *-aix4.3*|*-aix5*)
3117                         AC_DEFINE(_REENTRANT) 
3118                         ;;
3120             *-hpux11.*)
3121                         AC_DEFINE(_REENTRANT) 
3122                         ;;
3124             alpha*-*-osf*)
3125                         AC_DEFINE(_REENTRANT)
3126                         ;;
3128             *-*-solaris*) 
3129                         AC_DEFINE(_REENTRANT) 
3130                         if test ! "$GNU_CC"; then
3131                                 CFLAGS="$CFLAGS -mt" 
3132                                 CXXFLAGS="$CXXFLAGS -mt" 
3133                         fi
3134                         ;;
3135         esac
3136     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3139 dnl ========================================================
3140 dnl See if mmap sees writes
3141 dnl For cross compiling, just define it as no, which is a safe default
3142 dnl ========================================================
3143 AC_MSG_CHECKING(whether mmap() sees write()s)
3145 changequote(,)
3146 mmap_test_prog='
3147     #include <stdlib.h>
3148     #include <unistd.h>
3149     #include <sys/mman.h>
3150     #include <sys/types.h>
3151     #include <sys/stat.h>
3152     #include <fcntl.h>
3154     char fname[] = "conftest.file";
3155     char zbuff[1024]; /* Fractional page is probably worst case */
3157     int main() {
3158         char *map;
3159         int fd;
3160         int i;
3161         unlink(fname);
3162         fd = open(fname, O_RDWR | O_CREAT, 0660);
3163         if(fd<0) return 1;
3164         unlink(fname);
3165         write(fd, zbuff, sizeof(zbuff));
3166         lseek(fd, 0, SEEK_SET);
3167         map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3168         if(map==(char*)-1) return 2;
3169         for(i=0; fname[i]; i++) {
3170             int rc = write(fd, &fname[i], 1);
3171             if(map[i]!=fname[i]) return 4;
3172         }
3173         return 0;
3174     }
3176 changequote([,])
3178 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3180 AC_MSG_RESULT("$result")
3182 if test "$result" = "no"; then
3183     AC_DEFINE(MMAP_MISSES_WRITES)
3187 dnl Checks for library functions.
3188 dnl ========================================================
3189 AC_PROG_GCC_TRADITIONAL
3190 AC_FUNC_MEMCMP
3191 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64)
3192 AC_CHECK_FUNCS(flockfile getpagesize)
3194 dnl localtime_r and strtok_r are only present on MacOS version 10.2 and higher
3195 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100200"; then
3196   AC_CHECK_FUNCS(localtime_r strtok_r)
3199 dnl check for wcrtomb/mbrtowc
3200 dnl =======================================================================
3201 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3202 AC_LANG_SAVE
3203 AC_LANG_CPLUSPLUS
3204 AC_CACHE_CHECK(for wcrtomb,
3205     ac_cv_have_wcrtomb,
3206     [AC_TRY_LINK([#include <wchar.h>],
3207                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3208                  ac_cv_have_wcrtomb="yes",
3209                  ac_cv_have_wcrtomb="no")])
3210 if test "$ac_cv_have_wcrtomb" = "yes"; then
3211     AC_DEFINE(HAVE_WCRTOMB)
3213 AC_CACHE_CHECK(for mbrtowc,
3214     ac_cv_have_mbrtowc,
3215     [AC_TRY_LINK([#include <wchar.h>],
3216                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3217                  ac_cv_have_mbrtowc="yes",
3218                  ac_cv_have_mbrtowc="no")])
3219 if test "$ac_cv_have_mbrtowc" = "yes"; then
3220     AC_DEFINE(HAVE_MBRTOWC)
3222 AC_LANG_RESTORE
3225 AC_CACHE_CHECK(
3226     [for res_ninit()],
3227     ac_cv_func_res_ninit,
3228     [AC_TRY_LINK([
3229         #ifdef linux
3230         #define _BSD_SOURCE 1
3231         #endif
3232         #include <resolv.h>
3233         ],
3234         [int foo = res_ninit(&_res);],
3235         [ac_cv_func_res_ninit=yes],
3236         [ac_cv_func_res_ninit=no])
3237     ])
3239 if test "$ac_cv_func_res_ninit" = "yes"; then
3240     AC_DEFINE(HAVE_RES_NINIT)
3241 dnl must add the link line we do something as foolish as this... dougt
3242 dnl else
3243 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3244 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3247 AC_LANG_CPLUSPLUS
3248 AC_CACHE_CHECK(
3249     [for gnu_get_libc_version()],
3250     ac_cv_func_gnu_get_libc_version,
3251     [AC_TRY_LINK([
3252         #ifdef HAVE_GNU_LIBC_VERSION_H
3253         #include <gnu/libc-version.h>
3254         #endif
3255         ],
3256         [const char *glibc_version = gnu_get_libc_version();],
3257         [ac_cv_func_gnu_get_libc_version=yes],
3258         [ac_cv_func_gnu_get_libc_version=no] 
3259         )]
3260     )
3262 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3263     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3266 case $target_os in
3267     os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|beos*)
3268         ;;
3269     *)
3270     
3271 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3272     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3273         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3274 _SAVE_LIBS=$LIBS
3275 LIBS="$LIBS $_ICONV_LIBS"
3276 AC_CACHE_CHECK(
3277     [for iconv()],
3278     ac_cv_func_iconv,
3279     [AC_TRY_LINK([
3280         #include <stdlib.h>
3281         #include <iconv.h>
3282         ],
3283         [
3284             iconv_t h = iconv_open("", "");
3285             iconv(h, NULL, NULL, NULL, NULL);
3286             iconv_close(h);
3287         ],
3288         [ac_cv_func_iconv=yes],
3289         [ac_cv_func_iconv=no] 
3290         )]
3291     )
3292 if test "$ac_cv_func_iconv" = "yes"; then
3293     AC_DEFINE(HAVE_ICONV)
3294     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3295     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3296     LIBICONV="$_ICONV_LIBS"
3297     AC_CACHE_CHECK(
3298         [for iconv() with const input],
3299         ac_cv_func_const_iconv,
3300         [AC_TRY_COMPILE([
3301             #include <stdlib.h>
3302             #include <iconv.h>
3303             ],
3304             [
3305                 const char *input = "testing";
3306                 iconv_t h = iconv_open("", "");
3307                 iconv(h, &input, NULL, NULL, NULL);
3308                 iconv_close(h);
3309             ],
3310             [ac_cv_func_const_iconv=yes],
3311             [ac_cv_func_const_iconv=no] 
3312             )]
3313         )
3314     if test "$ac_cv_func_const_iconv" = "yes"; then
3315         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3316     fi
3318 LIBS=$_SAVE_LIBS
3320     ;;
3321 esac
3323 AM_LANGINFO_CODESET
3325 AC_LANG_C
3327 dnl **********************
3328 dnl *** va_copy checks ***
3329 dnl **********************
3330 dnl we currently check for all three va_copy possibilities, so we get
3331 dnl all results in config.log for bug reports.
3332 AC_MSG_CHECKING(for an implementation of va_copy())
3333 AC_CACHE_VAL(ac_cv_va_copy,[
3334     AC_TRY_RUN([
3335         #include <stdarg.h>
3336         void f (int i, ...) {
3337             va_list args1, args2;
3338             va_start (args1, i);
3339             va_copy (args2, args1);
3340             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3341                 exit (1);
3342             va_end (args1); va_end (args2);
3343         }
3344         int main() { f (0, 42); return 0; }],
3345         ac_cv_va_copy=yes,
3346         ac_cv_va_copy=no,
3347         ac_cv_va_copy=no
3348     )
3350 AC_MSG_RESULT($ac_cv_va_copy)
3351 AC_MSG_CHECKING(for an implementation of __va_copy())
3352 AC_CACHE_VAL(ac_cv___va_copy,[
3353     AC_TRY_RUN([
3354         #include <stdarg.h>
3355         void f (int i, ...) {
3356             va_list args1, args2;
3357             va_start (args1, i);
3358             __va_copy (args2, args1);
3359             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3360                 exit (1);
3361             va_end (args1); va_end (args2);
3362         }
3363         int main() { f (0, 42); return 0; }],
3364         ac_cv___va_copy=yes,
3365         ac_cv___va_copy=no,
3366         ac_cv___va_copy=no
3367     )
3369 AC_MSG_RESULT($ac_cv___va_copy)
3370 AC_MSG_CHECKING(whether va_lists can be copied by value)
3371 AC_CACHE_VAL(ac_cv_va_val_copy,[
3372     AC_TRY_RUN([
3373         #include <stdarg.h>
3374         void f (int i, ...) {
3375             va_list args1, args2;
3376             va_start (args1, i);
3377             args2 = args1;
3378             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3379                 exit (1);
3380             va_end (args1); va_end (args2);
3381         }
3382         int main() { f (0, 42); return 0; }],
3383         ac_cv_va_val_copy=yes,
3384         ac_cv_va_val_copy=no,
3385         ac_cv_va_val_copy=yes
3386     )
3388 if test "x$ac_cv_va_copy" = "xyes"; then
3389     AC_DEFINE(VA_COPY, va_copy)
3390     AC_DEFINE(HAVE_VA_COPY)
3391 elif test "x$ac_cv___va_copy" = "xyes"; then
3392     AC_DEFINE(VA_COPY, __va_copy)
3393     AC_DEFINE(HAVE_VA_COPY)
3396 if test "x$ac_cv_va_val_copy" = "xno"; then
3397    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3399 AC_MSG_RESULT($ac_cv_va_val_copy)
3401 dnl Check for dll-challenged libc's.
3402 dnl This check is apparently only needed for Linux.
3403 case "$target" in
3404         *-linux*)
3405             dnl ===================================================================
3406             _curdir=`pwd`
3407             export _curdir
3408             rm -rf conftest* _conftest
3409             mkdir _conftest
3410             cat >> conftest.C <<\EOF
3411 #include <stdio.h>
3412 #include <link.h>
3413 #include <dlfcn.h>
3414 #ifdef _dl_loaded
3415 void __dump_link_map(void) {
3416   struct link_map *map = _dl_loaded;
3417   while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
3419 int main() {
3420   dlopen("./conftest1.so",RTLD_LAZY);
3421   dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
3422   dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
3423   dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
3424   __dump_link_map();
3426 #else
3427 /* _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).*/
3428 int main() { printf("./conftest1.so\n"); }
3429 #endif
3432             $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
3434             cat >> conftest1.C <<\EOF
3435 #include <stdio.h>
3436 void foo(void) {printf("foo in dll called\n");}
3438             ${CXX-g++} -fPIC -c -g conftest1.C
3439             ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
3440             ${CXX-g++} -g conftest.C -o conftest -ldl
3441             cp -f conftest1.so conftest _conftest
3442             cd _conftest
3443             if test `./conftest | grep conftest1.so | wc -l` -gt 1
3444             then
3445                 echo
3446                 echo "*** Your libc has a bug that can result in loading the same dynamic"
3447                 echo "*** library multiple times.  This bug is known to be fixed in glibc-2.0.7-32"
3448                 echo "*** or later.  However, if you choose not to upgrade, the only effect"
3449                 echo "*** will be excessive memory usage at runtime."
3450                 echo
3451             fi
3452             cd ${_curdir}
3453             rm -rf conftest* _conftest
3454             dnl ===================================================================
3455             ;;
3456 esac
3458 dnl ===================================================================
3459 dnl ========================================================
3460 dnl By default, turn rtti and exceptions off on g++/egcs
3461 dnl ========================================================
3462 if test "$GNU_CXX"; then
3464   AC_MSG_CHECKING(for C++ exceptions flag)
3466   dnl They changed -f[no-]handle-exceptions to -f[no-]exceptions in g++ 2.8
3467   AC_CACHE_VAL(ac_cv_cxx_exceptions_flags,
3468   [echo "int main() { return 0; }" | cat > conftest.C
3470   ${CXX-g++} ${CXXFLAGS} -c -fno-handle-exceptions conftest.C > conftest.out 2>&1
3472   if egrep "warning.*renamed" conftest.out >/dev/null; then
3473     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions
3474   else
3475     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-handle-exceptions
3476   fi
3478   rm -f conftest*])
3480   AC_MSG_RESULT($ac_cv_cxx_exceptions_flags)
3481   _MOZ_EXCEPTIONS_FLAGS_OFF=$ac_cv_cxx_exceptions_flags
3482   _MOZ_EXCEPTIONS_FLAGS_ON=`echo $ac_cv_cxx_exceptions_flags | sed 's|no-||'`
3485 dnl ========================================================
3486 dnl Put your C++ language/feature checks below
3487 dnl ========================================================
3488 AC_LANG_CPLUSPLUS
3490 HAVE_GCC3_ABI=
3491 if test "$GNU_CC"; then
3492   AC_CACHE_CHECK(for gcc 3.0 ABI,
3493       ac_cv_gcc_three_abi,
3494       [AC_TRY_COMPILE([],
3495                       [
3496 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
3497   return 0;
3498 #else
3499 #error Not gcc3.
3500 #endif
3501                       ],
3502                       ac_cv_gcc_three_abi="yes",
3503                       ac_cv_gcc_three_abi="no")])
3504   if test "$ac_cv_gcc_three_abi" = "yes"; then
3505       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc3}"
3506       HAVE_GCC3_ABI=1
3507   else
3508       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc2}"
3509   fi
3511 AC_SUBST(HAVE_GCC3_ABI)
3514 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
3515                ac_cv_cpp_explicit,
3516                [AC_TRY_COMPILE(class X {
3517                                public: explicit X(int i) : i_(i) {}
3518                                private: int i_;
3519                                };,
3520                                X x(3);,
3521                                ac_cv_cpp_explicit=yes,
3522                                ac_cv_cpp_explicit=no)])
3523 if test "$ac_cv_cpp_explicit" = yes ; then
3524    AC_DEFINE(HAVE_CPP_EXPLICIT)
3527 AC_CACHE_CHECK(for C++ \"typename\" keyword,
3528                ac_cv_cpp_typename,
3529                [AC_TRY_COMPILE(class param {
3530                                public:
3531                                    typedef unsigned long num_type;
3532                                };
3534                                template <class T> class tplt {
3535                                public:
3536                                    typedef typename T::num_type t_num_type;
3537                                    t_num_type foo(typename T::num_type num) {
3538                                        return num;
3539                                    }
3540                                };,
3541                                tplt<param> A;
3542                                A.foo(0);,
3543                                ac_cv_cpp_typename=yes,
3544                                ac_cv_cpp_typename=no)])
3545 if test "$ac_cv_cpp_typename" = yes ; then
3546    AC_DEFINE(HAVE_CPP_TYPENAME)
3549 dnl Check for support of modern template specialization syntax
3550 dnl Test code and requirement from scc@netscape.com.
3551 dnl Autoconf cut-and-paste job by waterson@netscape.com
3552 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3553                ac_cv_cpp_modern_specialize_template_syntax,
3554                [AC_TRY_COMPILE(template <class T> struct X { int a; };
3555                                class Y {};
3556                                template <> struct X<Y> { double a; };,
3557                                X<int> int_x;
3558                                X<Y> y_x;,
3559                                ac_cv_cpp_modern_specialize_template_syntax=yes,
3560                                ac_cv_cpp_modern_specialize_template_syntax=no)])
3561 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
3562   AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
3566 dnl Some compilers support only full specialization, and some don't.
3567 AC_CACHE_CHECK(whether partial template specialization works,
3568                ac_cv_cpp_partial_specialization,
3569                [AC_TRY_COMPILE(template <class T> class Foo {};
3570                                template <class T> class Foo<T*> {};,
3571                                return 0;,
3572                                ac_cv_cpp_partial_specialization=yes,
3573                                ac_cv_cpp_partial_specialization=no)])
3574 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3575   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3578 dnl Some compilers have limited support for operators with templates;
3579 dnl specifically, it is necessary to define derived operators when a base
3580 dnl class's operator declaration should suffice.
3581 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
3582                ac_cv_need_derived_template_operators,
3583                [AC_TRY_COMPILE([template <class T> class Base { };
3584                                 template <class T>
3585                                 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
3586                                 template <class T> class Derived : public Base<T> { };],
3587                                [Derived<char> a, b;
3588                                 Base<char> c = a + b;
3589                                 return 0;],
3590                                ac_cv_need_derived_template_operators=no,
3591                                ac_cv_need_derived_template_operators=yes)])
3592 if test "$ac_cv_need_derived_template_operators" = yes ; then
3593   AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
3597 dnl Some compilers have trouble detecting that a template class
3598 dnl that derives from another template is actually an instance
3599 dnl of the base class. This test checks for that.
3600 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
3601                ac_cv_need_cpp_template_cast_to_base,
3602                [AC_TRY_COMPILE([template <class T> class Base { };
3603                                 template <class T> class Derived : public Base<T> { };
3604                                 template <class T> int foo(const Base<T>&) { return 0; }],
3605                                [Derived<char> bar; return foo(bar);],
3606                                ac_cv_need_cpp_template_cast_to_base=no,
3607                                ac_cv_need_cpp_template_cast_to_base=yes)])
3608 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
3609   AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
3612 dnl Some compilers have trouble resolving the ambiguity between two
3613 dnl functions whose arguments differ only by cv-qualifications.
3614 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
3615                ac_cv_can_resolve_const_ambiguity,
3616                [AC_TRY_COMPILE([
3617                                 template <class T> class ptrClass {
3618                                   public: T* ptr;
3619                                 };
3621                                 template <class T> T* a(ptrClass<T> *arg) {
3622                                   return arg->ptr;
3623                                 }
3625                                 template <class T>
3626                                 const T* a(const ptrClass<T> *arg) {
3627                                   return arg->ptr;
3628                                 }
3629                                ],
3630                                [ ptrClass<int> i;
3631                                  a(&i); ],
3632                                ac_cv_can_resolve_const_ambiguity=yes,
3633                                ac_cv_can_resolve_const_ambiguity=no)])
3634 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
3635   AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
3639 dnl We don't do exceptions on unix.  The only reason this used to be here
3640 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses 
3641 dnl exceptions.  But, we turn exceptions off by default and this test breaks.
3642 dnl So im commenting this out until someone writes some artificial 
3643 dnl intelligence to detect not only if the compiler has exceptions, but if 
3644 dnl they are enabled as well.
3645 dnl 
3646 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
3647 dnl                ac_cv_cpp_exceptions,
3648 dnl                [AC_TRY_COMPILE(class X { public: X() {} };
3649 dnl                                static void F() { throw X(); },
3650 dnl                                try { F(); } catch(X & e) { },
3651 dnl                                ac_cv_cpp_exceptions=yes,
3652 dnl                                ac_cv_cpp_exceptions=no)])
3653 dnl if test $ac_cv_cpp_exceptions = yes ; then
3654 dnl    AC_DEFINE(HAVE_CPP_EXCEPTIONS)
3655 dnl fi
3657 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
3658 dnl supports it well enough to allow us to use it to change access, but not
3659 dnl to resolve ambiguity. The next two tests determine how well the |using|
3660 dnl keyword is supported.
3662 dnl Check to see if we can change access with |using|.  Test both a
3663 dnl legal and an illegal example.
3664 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
3665                ac_cv_cpp_access_changing_using2,
3666                [AC_TRY_COMPILE(
3667                    class A { protected: int foo() { return 0; } };
3668                    class B : public A { public: using A::foo; };,
3669                    B b; return b.foo();,
3670                    [AC_TRY_COMPILE(
3671                        class A { public: int foo() { return 1; } };
3672                        class B : public A { private: using A::foo; };,
3673                        B b; return b.foo();,
3674                        ac_cv_cpp_access_changing_using2=no,
3675                        ac_cv_cpp_access_changing_using2=yes)],
3676                    ac_cv_cpp_access_changing_using2=no)])
3677 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
3678    AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
3681 dnl Check to see if we can resolve ambiguity with |using|.
3682 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3683                ac_cv_cpp_ambiguity_resolving_using,
3684                [AC_TRY_COMPILE(class X { 
3685                                  public: int go(const X&) {return 3;}
3686                                          int jo(const X&) {return 3;}
3687                                };
3688                                class Y : public X {
3689                                  public:  int go(int) {return 2;}
3690                                           int jo(int) {return 2;}
3691                                           using X::jo;
3692                                  private: using X::go;
3693                                };,
3694                                X x; Y y; y.jo(x);,
3695                                ac_cv_cpp_ambiguity_resolving_using=yes,
3696                                ac_cv_cpp_ambiguity_resolving_using=no)])
3697 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3698    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3701 dnl Check to see if the |std| namespace is supported. If so, we'll want
3702 dnl to qualify any standard library calls with "std::" to ensure that
3703 dnl those functions can be resolved.
3704 AC_CACHE_CHECK(for \"std::\" namespace,
3705                ac_cv_cpp_namespace_std,
3706                [AC_TRY_COMPILE([#include <algorithm>],
3707                                [return std::min(0, 1);],
3708                                ac_cv_cpp_namespace_std=yes,
3709                                ac_cv_cpp_namespace_std=no)])
3710 if test "$ac_cv_cpp_namespace_std" = yes ; then
3711    AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
3714 dnl Older compilers are overly ambitious with respect to using the standard
3715 dnl template library's |operator!=()| when |operator==()| is defined. In
3716 dnl which case, defining |operator!=()| in addition to |operator==()| causes
3717 dnl ambiguity at compile-time. This test checks for that case.
3718 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
3719                ac_cv_cpp_unambiguous_std_notequal,
3720                [AC_TRY_COMPILE([#include <algorithm>
3721                                 struct T1 {};
3722                                 int operator==(const T1&, const T1&) { return 0; }
3723                                 int operator!=(const T1&, const T1&) { return 0; }],
3724                                [T1 a,b; return a != b;],
3725                                ac_cv_cpp_unambiguous_std_notequal=unambiguous,
3726                                ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
3727 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
3728   AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
3732 AC_CACHE_CHECK(for C++ reinterpret_cast,
3733                ac_cv_cpp_reinterpret_cast,
3734                [AC_TRY_COMPILE(struct X { int i; };
3735                                struct Y { int i; };,
3736                                X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
3737                                ac_cv_cpp_reinterpret_cast=yes,
3738                                ac_cv_cpp_reinterpret_cast=no)])
3739 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
3740    AC_DEFINE(HAVE_CPP_NEW_CASTS)
3743 dnl See if a dynamic_cast to void* gives the most derived object.
3744 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3745                ac_cv_cpp_dynamic_cast_void_ptr,
3746                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3747                             class Y { int j; public: virtual ~Y() { } };
3748                             class Z : public X, public Y { int k; };
3750                             int main() {
3751                                  Z mdo;
3752                                  X *subx = (X*)&mdo;
3753                                  Y *suby = (Y*)&mdo;
3754                                  return !((((void*)&mdo != (void*)subx) &&
3755                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3756                                           (((void*)&mdo != (void*)suby) &&
3757                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
3758                             }],
3759                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
3760                            ac_cv_cpp_dynamic_cast_void_ptr=no,
3761                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
3762 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3763    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3767 dnl note that this one is reversed - if the test fails, then
3768 dnl we require implementations of unused virtual methods. Which
3769 dnl really blows because it means we'll have useless vtable
3770 dnl bloat.
3771 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3772                ac_cv_cpp_unused_required,
3773                [AC_TRY_LINK(class X {private: virtual void never_called();};,
3774                                X x;,
3775                                ac_cv_cpp_unused_required=no,
3776                                ac_cv_cpp_unused_required=yes)])
3777 if test "$ac_cv_cpp_unused_required" = yes ; then
3778    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3782 dnl Some compilers have trouble comparing a constant reference to a templatized
3783 dnl class to zero, and require an explicit operator==() to be defined that takes
3784 dnl an int. This test separates the strong from the weak.
3786 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3787                ac_cv_trouble_comparing_to_zero,
3788                [AC_TRY_COMPILE([#include <algorithm>
3789                                 template <class T> class Foo {};
3790                                 class T2;
3791                                 template <class T> int operator==(const T2*, const T&) { return 0; }
3792                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3793                                [Foo<int> f; return (0 != f);],
3794                                ac_cv_trouble_comparing_to_zero=no,
3795                                ac_cv_trouble_comparing_to_zero=yes)])
3796 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3797   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3802 dnl End of C++ language/feature checks
3803 AC_LANG_C
3805 dnl ========================================================
3806 dnl =  Internationalization checks
3807 dnl ========================================================
3809 dnl Internationalization and Locale support is different
3810 dnl on various UNIX platforms.  Checks for specific i18n
3811 dnl features go here.
3813 dnl check for LC_MESSAGES
3814 AC_CACHE_CHECK(for LC_MESSAGES,
3815                 ac_cv_i18n_lc_messages,
3816                 [AC_TRY_COMPILE([#include <locale.h>],
3817                                 [int category = LC_MESSAGES;],
3818                                 ac_cv_i18n_lc_messages=yes,
3819                                 ac_cv_i18n_lc_messages=no)])
3820 if test "$ac_cv_i18n_lc_messages" = yes; then
3821    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3822 fi      
3824 fi # SKIP_COMPILER_CHECKS
3826 TARGET_XPCOM_ABI=
3827 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3828     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3831 dnl Mozilla specific options
3832 dnl ========================================================
3833 dnl The macros used for command line options
3834 dnl are defined in build/autoconf/altoptions.m4.
3837 dnl ========================================================
3838 dnl =
3839 dnl = Check for external package dependencies
3840 dnl =
3841 dnl ========================================================
3842 MOZ_ARG_HEADER(External Packages)
3844 MOZ_ENABLE_LIBXUL=
3846 MOZ_ARG_WITH_STRING(libxul-sdk,
3847 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
3848   LIBXUL_SDK_DIR=$withval)
3850 if test "$LIBXUL_SDK_DIR" = "yes"; then
3851     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
3852 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
3853     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
3855     if test ! -f "$LIBXUL_SDK/sdk/include/xpcom-config.h"; then
3856         AC_MSG_ERROR([$LIBXUL_SDK/sdk/include/xpcom-config.h doesn't exist])
3857     fi
3859     MOZ_ENABLE_LIBXUL=1
3861 AC_SUBST(LIBXUL_SDK)
3863 dnl ========================================================
3864 dnl = If NSPR was not detected in the system, 
3865 dnl = use the one in the source tree (mozilla/nsprpub)
3866 dnl ========================================================
3867 MOZ_ARG_WITH_BOOL(system-nspr,
3868 [  --with-system-nspr      Use system installed NSPR],
3869     _USE_SYSTEM_NSPR=1 )
3871 if test -n "$_USE_SYSTEM_NSPR"; then
3872     AM_PATH_NSPR(4.7.0, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
3875 if test -n "$MOZ_NATIVE_NSPR"; then
3876     _SAVE_CFLAGS=$CFLAGS
3877     CFLAGS="$CFLAGS $NSPR_CFLAGS"
3878     AC_TRY_COMPILE([#include "prlog.h"],
3879                 [#ifndef PR_STATIC_ASSERT
3880                  #error PR_STATIC_ASSERT not defined
3881                  #endif],
3882                 [MOZ_NATIVE_NSPR=1],
3883                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
3884     CFLAGS=$_SAVE_CFLAGS
3885 else
3886     NSPR_CFLAGS='`$(DEPTH)/nsprpub/config/nspr-config --prefix=$(LIBXUL_DIST) --includedir=$(LIBXUL_DIST)/include/nspr --cflags`'
3887     # explicitly set libs for Visual Age C++ for OS/2
3888     if test "$OS_ARCH" = "OS2" -a "$VACPP" = "yes"; then
3889         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''
3890     elif test "$OS_ARCH" = "WINCE"; then
3891         NSPR_CFLAGS='-I$(LIBXUL_DIST)/include/nspr'
3892         NSPR_LIBS='$(LIBXUL_DIST)/lib/nspr'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plc'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plds'$NSPR_VERSION'.lib '
3893     elif test "$OS_ARCH" = "WINNT"; then
3894         NSPR_CFLAGS='-I$(LIBXUL_DIST)/include/nspr'
3895         if test -n "$GNU_CC"; then
3896             NSPR_LIBS="-L\$(LIBXUL_DIST)/lib -lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION"
3897         else
3898             NSPR_LIBS='$(LIBXUL_DIST)/lib/nspr'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plc'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plds'$NSPR_VERSION'.lib '
3899         fi
3900     else
3901         NSPR_LIBS='`$(DEPTH)/nsprpub/config/nspr-config --prefix=$(LIBXUL_DIST) --libdir=$(LIBXUL_DIST)/lib --libs`'
3902     fi
3905 dnl ========================================================
3906 dnl = If NSS was not detected in the system, 
3907 dnl = use the one in the source tree (mozilla/security/nss)
3908 dnl ========================================================
3910 MOZ_ARG_WITH_BOOL(system-nss,
3911 [  --with-system-nss      Use system installed NSS],
3912     _USE_SYSTEM_NSS=1 )
3914 if test -n "$_USE_SYSTEM_NSS"; then
3915     AM_PATH_NSS(3.12.0, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
3918 if test -n "$MOZ_NATIVE_NSS"; then
3919    NSS_LIBS="$NSS_LIBS -lcrmf"
3920 else
3921    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
3922    NSS_DEP_LIBS='\\\
3923         $(LIBXUL_DIST)/lib/$(LIB_PREFIX)crmf.$(LIB_SUFFIX) \\\
3924         $(LIBXUL_DIST)/lib/$(DLL_PREFIX)smime'$NSS_VERSION'$(DLL_SUFFIX) \\\
3925         $(LIBXUL_DIST)/lib/$(DLL_PREFIX)ssl'$NSS_VERSION'$(DLL_SUFFIX) \\\
3926         $(LIBXUL_DIST)/lib/$(DLL_PREFIX)nss'$NSS_VERSION'$(DLL_SUFFIX) \\\
3927         $(LIBXUL_DIST)/lib/$(DLL_PREFIX)softokn'$NSS_VERSION'$(DLL_SUFFIX)'
3929    if test -z "$GNU_CC" && test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
3930        NSS_LIBS='\\\
3931         $(LIBXUL_DIST)/lib/$(LIB_PREFIX)crmf.$(LIB_SUFFIX) \\\
3932         $(LIBXUL_DIST)/lib/$(LIB_PREFIX)smime'$NSS_VERSION'.$(IMPORT_LIB_SUFFIX) \\\
3933         $(LIBXUL_DIST)/lib/$(LIB_PREFIX)ssl'$NSS_VERSION'.$(IMPORT_LIB_SUFFIX) \\\
3934         $(LIBXUL_DIST)/lib/$(LIB_PREFIX)nss'$NSS_VERSION'.$(IMPORT_LIB_SUFFIX) \\\
3935         $(LIBXUL_DIST)/lib/$(LIB_PREFIX)softokn'$NSS_VERSION'.$(IMPORT_LIB_SUFFIX)'
3936    else
3937        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lsoftokn$NSS_VERSION"
3938    fi
3941 if test -z "$SKIP_LIBRARY_CHECKS"; then
3942 dnl system JPEG support
3943 dnl ========================================================
3944 MOZ_ARG_WITH_STRING(system-jpeg,
3945 [  --with-system-jpeg[=PFX]
3946                           Use system libjpeg [installed at prefix PFX]],
3947     JPEG_DIR=$withval)
3949 _SAVE_CFLAGS=$CFLAGS
3950 _SAVE_LDFLAGS=$LDFLAGS
3951 _SAVE_LIBS=$LIBS
3952 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
3953     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
3954     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
3956 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
3957     SYSTEM_JPEG=
3958 else
3959     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
3962 if test "$SYSTEM_JPEG" = 1; then
3963     LIBS="$JPEG_LIBS $LIBS"
3964     AC_TRY_COMPILE([ #include <stdio.h>
3965                      #include <sys/types.h>
3966                      #include <jpeglib.h> ],
3967                    [ #if JPEG_LIB_VERSION < $MOZJPEG
3968                      #error "Insufficient JPEG library version ($MOZJPEG required)."
3969                      #endif ],
3970                    SYSTEM_JPEG=1,
3971                    [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=]) 
3972 fi 
3973 CFLAGS=$_SAVE_CFLAGS
3974 LDFLAGS=$_SAVE_LDFLAGS
3975 LIBS=$_SAVE_LIBS
3977 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
3978     JPEG_CFLAGS="-I${JPEG_DIR}/include"
3979     JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
3982 dnl system ZLIB support
3983 dnl ========================================================
3984 MOZ_ARG_WITH_STRING(system-zlib,
3985 [  --with-system-zlib[=PFX]
3986                           Use system libz [installed at prefix PFX]],
3987     ZLIB_DIR=$withval)
3989 _SAVE_CFLAGS=$CFLAGS
3990 _SAVE_LDFLAGS=$LDFLAGS
3991 _SAVE_LIBS=$LIBS
3992 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
3993     CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
3994     LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
3996 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
3997     SYSTEM_ZLIB=
3998 else
3999     AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"], 
4000         [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4002 if test "$SYSTEM_ZLIB" = 1; then
4003     LIBS="$ZLIB_LIBS $LIBS"
4004     AC_TRY_COMPILE([ #include <stdio.h>
4005                      #include <string.h>
4006                      #include <zlib.h> ],
4007                    [ #if ZLIB_VERNUM < $MOZZLIB 
4008                      #error "Insufficient zlib version ($MOZZLIB required)."
4009                      #endif ],
4010                    SYSTEM_ZLIB=1,
4011                    [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=]) 
4013 CFLAGS=$_SAVE_CFLAGS
4014 LDFLAGS=$_SAVE_LDFLAGS
4015 LIBS=$_SAVE_LIBS
4017 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4018     ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4019     ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4022 dnl system PNG Support
4023 dnl ========================================================
4024 MOZ_ARG_WITH_STRING(system-png, 
4025 [  --with-system-png[=PFX]
4026                           Use system libpng [installed at prefix PFX]],
4027     PNG_DIR=$withval)
4029 _SAVE_CFLAGS=$CFLAGS
4030 _SAVE_LDFLAGS=$LDFLAGS
4031 _SAVE_LIBS=$LIBS
4032 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4033 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4034 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4035     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4036     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4038 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4039     SYSTEM_PNG=
4040 else
4041     _SAVE_PNG_LIBS=$PNG_LIBS
4042     AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4043                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]), 
4044                  $PNG_LIBS)
4045     AC_CHECK_LIB(png, png_get_acTL, ,
4046                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4047                  $_SAVE_PNG_LIBS)
4049 if test "$SYSTEM_PNG" = 1; then
4050     LIBS="$PNG_LIBS $LIBS"
4051     AC_TRY_COMPILE([ #include <stdio.h>
4052                      #include <sys/types.h>
4053                      #include <png.h> ],
4054                    [ #if PNG_LIBPNG_VER < $MOZPNG
4055                      #error "Insufficient libpng version ($MOZPNG required)."
4056                      #endif
4057                      #ifndef PNG_UINT_31_MAX
4058                      #error "Insufficient libpng version."
4059                      #endif ],
4060                    SYSTEM_PNG=1,
4061                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4063 CFLAGS=$_SAVE_CFLAGS
4064 LDFLAGS=$_SAVE_LDFLAGS
4065 LIBS=$_SAVE_LIBS
4067 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4068     PNG_CFLAGS="-I${PNG_DIR}/include"
4069     PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4072 fi # SKIP_LIBRARY_CHECKS
4074 dnl check whether to enable glitz
4075 dnl ========================================================
4076 MOZ_ARG_ENABLE_BOOL(glitz,
4077 [  --enable-glitz          Enable Glitz for use with Cairo],
4078     MOZ_ENABLE_GLITZ=1,
4079     MOZ_ENABLE_GLITZ= )
4080 if test "$MOZ_ENABLE_GLITZ"; then
4081     AC_DEFINE(MOZ_ENABLE_GLITZ)
4084 dnl ========================================================
4085 dnl Java SDK support
4086 dnl ========================================================
4087 JAVA_INCLUDE_PATH=
4088 MOZ_ARG_WITH_STRING(java-include-path,
4089 [  --with-java-include-path=dir   Location of Java SDK headers],
4090     JAVA_INCLUDE_PATH=$withval)
4092 JAVA_BIN_PATH=
4093 MOZ_ARG_WITH_STRING(java-bin-path,
4094 [  --with-java-bin-path=dir   Location of Java binaries (java, javac, jar)],
4095     JAVA_BIN_PATH=$withval)
4097 dnl ========================================================
4098 dnl =
4099 dnl = Application
4100 dnl =
4101 dnl ========================================================
4103 MOZ_ARG_HEADER(Application)
4105 BUILD_STATIC_LIBS=
4106 ENABLE_TESTS=1
4107 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4108 MOZ_BRANDING_DIRECTORY=
4109 MOZ_CALENDAR=
4110 MOZ_DBGRINFO_MODULES=
4111 MOZ_ENABLE_CANVAS=1
4112 MOZ_EXTENSIONS_ALL=" wallet xml-rpc venkman inspector irc typeaheadfind gnomevfs sroaming datetime finger cview layout-debug tasks sql xforms schema-validation reporter"
4113 MOZ_FEEDS=1
4114 MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp xbm icon"
4115 MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
4116 MOZ_IPCD=
4117 MOZ_JAVAXPCOM=
4118 MOZ_JSDEBUGGER=1
4119 MOZ_JSLOADER=1
4120 MOZ_LDAP_XPCOM=
4121 MOZ_LIBART_CFLAGS=
4122 MOZ_LIBART_LIBS=
4123 MOZ_MAIL_NEWS=
4124 MOZ_MATHML=1
4125 MOZ_MOCHITEST=1
4126 MOZ_MORK=1
4127 MOZ_MORKREADER=
4128 MOZ_AUTH_EXTENSION=1
4129 MOZ_NO_ACTIVEX_SUPPORT=1
4130 MOZ_NO_INSPECTOR_APIS=
4131 MOZ_NO_XPCOM_OBSOLETE=
4132 MOZ_NO_FAST_LOAD=
4133 MOZ_OJI=1
4134 MOZ_PERMISSIONS=1
4135 MOZ_PLACES=
4136 MOZ_PLAINTEXT_EDITOR_ONLY=
4137 MOZ_PLUGINS=1
4138 MOZ_PREF_EXTENSIONS=1
4139 MOZ_PROFILELOCKING=1
4140 MOZ_PROFILESHARING=1
4141 MOZ_PSM=1
4142 MOZ_PYTHON_EXTENSIONS="xpcom dom"
4143 MOZ_PYTHON=
4144 MOZ_PYTHON_DEBUG_SUFFIX=
4145 MOZ_PYTHON_DLL_SUFFIX=
4146 MOZ_PYTHON_INCLUDES=
4147 MOZ_PYTHON_LIBS=
4148 MOZ_PYTHON_PREFIX=
4149 MOZ_PYTHON_VER=
4150 MOZ_PYTHON_VER_DOTTED=
4151 MOZ_RDF=1
4152 MOZ_REFLOW_PERF=
4153 MOZ_SAFE_BROWSING=
4154 MOZ_SPELLCHECK=1
4155 MOZ_STATIC_MAIL_BUILD=
4156 MOZ_STORAGE=1
4157 MOZ_SVG=1
4158 MOZ_TIMELINE=
4159 MOZ_UI_LOCALE=en-US
4160 MOZ_UNIVERSALCHARDET=1
4161 MOZ_URL_CLASSIFIER=
4162 MOZ_USE_NATIVE_UCONV=
4163 MOZ_V1_STRING_ABI=
4164 MOZ_VIEW_SOURCE=1
4165 MOZ_WEBSERVICES=
4166 MOZ_XMLEXTRAS=1
4167 MOZ_XPFE_COMPONENTS=1
4168 MOZ_XPINSTALL=1
4169 MOZ_XSLT_STANDALONE=
4170 MOZ_XTF=1
4171 MOZ_XUL=1
4172 MOZ_XUL_APP=1
4173 MOZ_ZIPWRITER=1
4174 NS_PRINTING=1
4175 NECKO_COOKIES=1
4176 NECKO_DISK_CACHE=1
4177 NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource"
4178 NECKO_SMALL_BUFFERS=
4179 SUNCTL=
4180 JS_STATIC_BUILD=
4181 XPC_IDISPATCH_SUPPORT=
4184 case "$target_os" in
4185 darwin*)
4186     ACCESSIBILITY=
4187     ;;
4189     ACCESSIBILITY=1
4190     ;;
4191 esac
4193 case "$target_os" in
4194     msvc*|mks*|cygwin*|mingw*)
4195         if test -z "$GNU_CC"; then 
4196             XPC_IDISPATCH_SUPPORT=1
4197             MOZ_NO_ACTIVEX_SUPPORT=
4198             MOZ_ACTIVEX_SCRIPTING_SUPPORT=1
4199         fi
4200         ;;
4201 esac
4203 MOZ_ARG_ENABLE_STRING(application,
4204 [  --enable-application=APP
4205                           Options include:
4206                             suite
4207                             browser (Firefox)
4208                             mail (Thunderbird)
4209                             minimo
4210                             composer
4211                             calendar (Sunbird)
4212                             xulrunner
4213                             camino
4214                             content/xslt (Standalone Transformiix XSLT)
4215                             netwerk (Standalone Necko)
4216                             tools/update-packaging (AUS-related packaging tools)
4217                             standalone (use this for standalone
4218                               xpcom/xpconnect or to manually drive a build)],
4219 [ MOZ_BUILD_APP=$enableval ] )
4221 if test "$MOZ_BUILD_APP" = "macbrowser"; then
4222     AC_MSG_WARN([--enable-application=macbrowser is deprecated. Use --enable-application=camino.])
4223     MOZ_BUILD_APP=camino
4226 case "$MOZ_BUILD_APP" in
4227 minimo)
4228   MOZ_EMBEDDING_PROFILE=basic
4229   ;;
4232   MOZ_EMBEDDING_PROFILE=default
4233   ;;
4234 esac
4236 MOZ_ARG_WITH_STRING(embedding-profile,
4237 [  --with-embedding-profile=default|basic|minimal
4238                        see http://wiki.mozilla.org/Gecko:Small_Device_Support],
4239 [ MOZ_EMBEDDING_PROFILE=$withval ])
4241 case "$MOZ_EMBEDDING_PROFILE" in
4242 default)
4243   MOZ_EMBEDDING_LEVEL_DEFAULT=1
4244   MOZ_EMBEDDING_LEVEL_BASIC=1
4245   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4246   AC_DEFINE(MOZ_EMBEDDING_LEVEL_DEFAULT)
4247   AC_DEFINE(MOZ_EMBEDDING_LEVEL_BASIC)
4248   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4249   ;;
4251 basic)
4252   MOZ_EMBEDDING_LEVEL_DEFAULT=
4253   MOZ_EMBEDDING_LEVEL_BASIC=1
4254   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4255   AC_DEFINE(MOZ_EMBEDDING_LEVEL_BASIC)
4256   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4257   ENABLE_TESTS=
4258   MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4259   MOZ_COMPOSER=
4260   MOZ_ENABLE_CANVAS=
4261   MOZ_ENABLE_POSTSCRIPT=
4262   MOZ_EXTENSIONS_DEFAULT=" spatialnavigation"
4263   MOZ_IMG_DECODERS_DEFAULT="png gif jpeg"
4264   MOZ_IMG_ENCODERS_DEFAULT=
4265   MOZ_IMG_ENCODERS=
4266   MOZ_INSTALLER=
4267   MOZ_JSDEBUGGER=
4268   MOZ_LDAP_XPCOM=
4269   MOZ_MAIL_NEWS=
4270   MOZ_MATHML=
4271   MOZ_AUTH_EXTENSION=
4272   MOZ_NO_ACTIVEX_SUPPORT=1
4273   MOZ_NO_INSPECTOR_APIS=1
4274   MOZ_NO_XPCOM_OBSOLETE=1
4275   MOZ_NO_FAST_LOAD=1
4276   MOZ_OJI=
4277   MOZ_PLAINTEXT_EDITOR_ONLY=1
4278 #  MOZ_PLUGINS=
4279   MOZ_PREF_EXTENSIONS=
4280   MOZ_PROFILELOCKING=
4281   MOZ_PROFILESHARING=
4282   MOZ_SPELLCHECK=
4283   MOZ_SVG=
4284   MOZ_UNIVERSALCHARDET=
4285   MOZ_UPDATER=
4286   MOZ_USE_NATIVE_UCONV=1
4287   MOZ_VIEW_SOURCE=
4288   MOZ_XPFE_COMPONENTS=
4289   MOZ_XPINSTALL=
4290   MOZ_XTF=
4291   MOZ_ZIPWRITER=
4292   NECKO_DISK_CACHE=
4293   NECKO_PROTOCOLS_DEFAULT="about data http file res"
4294   NECKO_SMALL_BUFFERS=1
4295   NS_DISABLE_LOGGING=1
4296   NS_PRINTING=
4297   JS_STATIC_BUILD=1
4298   ;;
4300 minimal)
4301   MOZ_EMBEDDING_LEVEL_DEFAULT=
4302   MOZ_EMBEDDING_LEVEL_BASIC=
4303   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4304   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4305   ENABLE_TESTS=
4306   MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4307   MOZ_COMPOSER=
4308   MOZ_ENABLE_CANVAS=
4309   MOZ_ENABLE_POSTSCRIPT=
4310   MOZ_EXTENSIONS_DEFAULT=" spatialnavigation"
4311   MOZ_IMG_DECODERS_DEFAULT="png gif jpeg"
4312   MOZ_IMG_ENCODERS_DEFAULT=
4313   MOZ_IMG_ENCODERS=
4314   MOZ_INSTALLER=
4315   MOZ_JSDEBUGGER=
4316   MOZ_LDAP_XPCOM=
4317   MOZ_MAIL_NEWS=
4318   MOZ_MATHML=
4319   MOZ_AUTH_EXTENSION=
4320   MOZ_NO_ACTIVEX_SUPPORT=1
4321   MOZ_NO_INSPECTOR_APIS=1
4322   MOZ_NO_XPCOM_OBSOLETE=1
4323   MOZ_NO_FAST_LOAD=1
4324   MOZ_OJI=
4325   MOZ_PLAINTEXT_EDITOR_ONLY=1
4326   MOZ_PLUGINS=
4327   MOZ_PREF_EXTENSIONS=
4328   MOZ_PROFILELOCKING=
4329   MOZ_PROFILESHARING=
4330   MOZ_SPELLCHECK=
4331   MOZ_STORAGE=1
4332   MOZ_PLACES=
4333   MOZ_SVG=
4334   MOZ_UNIVERSALCHARDET=
4335   MOZ_UPDATER=
4336   MOZ_USE_NATIVE_UCONV=1
4337   MOZ_VIEW_SOURCE=
4338   MOZ_XPFE_COMPONENTS=
4339   MOZ_XPINSTALL=
4340   MOZ_XTF=
4341   MOZ_XUL=
4342   MOZ_ZIPWRITER=
4343   MOZ_RDF=
4344   NECKO_DISK_CACHE=
4345   NECKO_PROTOCOLS_DEFAULT="about data http file res"
4346   NECKO_SMALL_BUFFERS=1
4347   NS_DISABLE_LOGGING=1
4348   NS_PRINTING=
4349   JS_STATIC_BUILD=1
4350   ;;
4353   AC_MSG_ERROR([Unrecognized value: --with-embedding-profile=$MOZ_EMBEDDING_PROFILE])
4354   ;;
4355 esac
4357 AC_SUBST(MOZ_EMBEDDING_LEVEL_DEFAULT)
4358 AC_SUBST(MOZ_EMBEDDING_LEVEL_BASIC)
4359 AC_SUBST(MOZ_EMBEDDING_LEVEL_MINIMAL)
4361 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4362 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
4363   XULRUNNER_STUB_NAME=$withval)
4365 if test -z "$XULRUNNER_STUB_NAME"; then
4366   case "$target_os" in
4367   darwin*)
4368     XULRUNNER_STUB_NAME=xulrunner
4369     ;;
4370   *)
4371     XULRUNNER_STUB_NAME=xulrunner-stub
4372   esac
4374 AC_SUBST(XULRUNNER_STUB_NAME)
4376 if test -z "$MOZ_BUILD_APP"; then
4377   AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
4378 else
4379   # We have a valid application only if it has a build.mk file in its top
4380   # directory.
4381   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4382     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4383   fi
4386 # Allow the application to influence configure with a confvars.sh script.
4388 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4389 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4390   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4391   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4392 else
4393   AC_MSG_RESULT([no])
4396 # Now is a good time to test for logic errors, define mismatches, etc.
4397 case "$MOZ_BUILD_APP" in
4398 xulrunner)
4399   if test "$LIBXUL_SDK"; then
4400     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4401   fi
4402   ;;
4404   # Fix this case for folks who forget. Warn them.
4405   if test -n "$LIBXUL_SDK" -a -z "$MOZ_XUL_APP"; then
4406     AC_MSG_WARN([Setting MOZ_XUL_APP since LIBXUL_SDK was set. Add to confvars.sh!])
4407     MOZ_XUL_APP=1
4408   fi
4409   ;;
4410 esac
4412 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4413 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4414 # MOZ_BUILD_APP.
4415 case "$MOZ_BUILD_APP" in
4416 suite)
4417   AC_DEFINE(MOZ_SUITE)
4418   ;;
4420 browser)
4421   AC_DEFINE(MOZ_PHOENIX)
4422   ;;
4424 minimo)
4425   AC_DEFINE(MINIMO)
4426   ;;
4428 mail)
4429   AC_DEFINE(MOZ_THUNDERBIRD)
4430   ;;
4432 composer)
4433   AC_DEFINE(MOZ_STANDALONE_COMPOSER)
4434   ;;
4436 calendar)
4437   AC_DEFINE(MOZ_SUNBIRD)
4438   ;;
4440 xulrunner)
4441   AC_DEFINE(MOZ_XULRUNNER)
4442   ;;
4444 camino) 
4445   AC_DEFINE(MOZ_MACBROWSER)
4446   ;;
4448 content/xslt)
4449   AC_DEFINE(TX_EXE)
4450   ;;
4452 standalone) 
4453   MOZ_APP_NAME=mozilla
4454   MOZ_APP_DISPLAYNAME=Mozilla
4455   MOZ_APP_VERSION=$MOZILLA_VERSION
4456   ;;
4458 esac
4460 AC_SUBST(MOZ_BUILD_APP)
4461 AC_SUBST(MOZ_XUL_APP)
4462 AC_SUBST(MOZ_SUITE)
4463 AC_SUBST(MOZ_PHOENIX)
4464 AC_SUBST(MOZ_THUNDERBIRD)
4465 AC_SUBST(MOZ_STANDALONE_COMPOSER)
4466 AC_SUBST(MOZ_SUNBIRD)
4467 AC_SUBST(MOZ_XULRUNNER)
4469 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4471 if test "$MOZ_XUL_APP"; then
4472   MOZ_PROFILESHARING=
4473   AC_DEFINE(MOZ_XUL_APP)
4476 dnl ========================================================
4477 dnl = 
4478 dnl = Toolkit Options
4479 dnl = 
4480 dnl ========================================================
4481 MOZ_ARG_HEADER(Toolkit Options)
4483     dnl ========================================================
4484     dnl = Select the default toolkit
4485     dnl ========================================================
4486         MOZ_ARG_ENABLE_STRING(default-toolkit,
4487         [  --enable-default-toolkit=TK
4488                           Select default toolkit
4489                           Platform specific defaults:
4490                             BeOS - cairo-beos
4491                             Mac OS X - cairo-cocoa
4492                             Neutrino/QNX - photon
4493                             OS/2 - cairo-os2
4494                             Win32 - cairo-windows
4495                             WinCE - windows
4496                             * - cairo-gtk2],
4497     [ _DEFAULT_TOOLKIT=$enableval ],
4498     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4500     if test "$_DEFAULT_TOOLKIT" = "photon" \
4501         -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4502         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4503         -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
4504         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4505         -o "$_DEFAULT_TOOLKIT" = "cairo-mac" \
4506         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa"
4507     then
4508         dnl nglayout only supports building with one toolkit,
4509         dnl so ignore everything after the first comma (",").
4510         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4511     else
4512         if test "$no_x" != "yes"; then
4513             AC_MSG_ERROR([Toolkit must be cairo-gtk2.])
4514         else
4515             AC_MSG_ERROR([Toolkit must be $_PLATFORM_DEFAULT_TOOLKIT (if supported).])
4516         fi
4517     fi
4519 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_TOOLKIT,"$MOZ_WIDGET_TOOLKIT")
4521 dnl ========================================================
4522 dnl = Enable the toolkit as needed                         =
4523 dnl ========================================================
4525 case "$MOZ_WIDGET_TOOLKIT" in
4526 photon)
4527         MOZ_ENABLE_PHOTON=1
4528         AC_DEFINE(MOZ_WIDGET_PHOTON)
4529     ;;
4531 cairo-windows)
4532     MOZ_WIDGET_TOOLKIT=windows
4533     MOZ_GFX_TOOLKIT=cairo
4534     MOZ_ENABLE_CAIRO_GFX=1
4535     ;;
4537 cairo-gtk2)
4538     MOZ_WIDGET_TOOLKIT=gtk2
4539     MOZ_GFX_TOOLKIT=cairo
4540     MOZ_ENABLE_CAIRO_GFX=1
4541     MOZ_ENABLE_GTK2=1
4542     MOZ_ENABLE_XREMOTE=1
4543     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4544     TK_LIBS='$(MOZ_GTK2_LIBS)'
4545     AC_DEFINE(MOZ_WIDGET_GTK2)
4546     ;;
4547 cairo-beos)
4548     MOZ_WIDGET_TOOLKIT=beos
4549     MOZ_GFX_TOOLKIT=cairo
4550     MOZ_ENABLE_CAIRO_GFX=1
4551     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4552     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4553     ;;
4555 cairo-os2)
4556     MOZ_WIDGET_TOOLKIT=os2
4557     MOZ_GFX_TOOLKIT=cairo
4558     MOZ_ENABLE_CAIRO_GFX=1
4559     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4560     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4561     ;;
4563 cairo-mac|cairo-cocoa)
4564     if test "$MOZ_WIDGET_TOOLKIT" = "cairo-cocoa"; then
4565         MOZ_WIDGET_TOOLKIT=cocoa
4566         AC_DEFINE(MOZ_WIDGET_COCOA)
4567         MOZ_ENABLE_COCOA=1
4568     else
4569         MOZ_WIDGET_TOOLKIT=mac
4570     fi
4571     MOZ_ENABLE_CAIRO_GFX=1
4572     MOZ_GFX_TOOLKIT=cairo
4573     MOZ_USER_DIR="Mozilla"
4574     AC_DEFINE(XP_MACOSX)
4575     AC_DEFINE(TARGET_CARBON)
4576     AC_DEFINE(TARGET_API_MAC_CARBON)
4577     TK_LIBS='-framework Carbon'
4578     TK_CFLAGS="-I${MACOS_SDK_DIR}/Developer/Headers/FlatCarbon"
4579     CFLAGS="$CFLAGS $TK_CFLAGS"
4580     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4581     ;;
4582 esac
4584 if test "$MOZ_ENABLE_XREMOTE"; then
4585     AC_DEFINE(MOZ_ENABLE_XREMOTE)
4588 if test "$COMPILE_ENVIRONMENT"; then
4589 if test "$MOZ_ENABLE_GTK2"
4590 then
4591     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gdk-x11-2.0 glib-2.0 gobject-2.0)
4593 fi # COMPILE_ENVIRONMENT
4595 AC_SUBST(MOZ_DEFAULT_TOOLKIT)
4597 dnl ========================================================
4598 dnl = startup-notification support module
4599 dnl ========================================================
4601 if test "$MOZ_ENABLE_GTK2"
4602 then
4603     MOZ_ENABLE_STARTUP_NOTIFICATION=
4605     MOZ_ARG_ENABLE_BOOL(startup-notification,
4606     [  --enable-startup-notification       Enable startup-notification support (default: disabled) ],
4607         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4608         MOZ_ENABLE_STARTUP_NOTIFICATION=)
4609     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4610     then
4611         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4612                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4613         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4614             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4615             then
4616                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4617             fi
4618             MOZ_ENABLE_STARTUP_NOTIFICATION=
4619         ])
4620     fi
4622     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4623         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4624     fi
4626     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4628 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4629 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4630 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4632 AC_SUBST(GTK_CONFIG)
4633 AC_SUBST(TK_CFLAGS)
4634 AC_SUBST(TK_LIBS)
4636 AC_SUBST(MOZ_ENABLE_GTK2)
4637 AC_SUBST(MOZ_ENABLE_PHOTON)
4638 AC_SUBST(MOZ_ENABLE_COCOA)
4639 AC_SUBST(MOZ_ENABLE_CAIRO_GFX)
4640 AC_SUBST(MOZ_ENABLE_GLITZ)
4641 AC_SUBST(MOZ_ENABLE_XREMOTE)
4642 AC_SUBST(MOZ_GTK2_CFLAGS)
4643 AC_SUBST(MOZ_GTK2_LIBS)
4645 AC_SUBST(MOC)
4647 if test "$MOZ_ENABLE_CAIRO_GFX"
4648 then
4649     AC_DEFINE(MOZ_THEBES)
4650     AC_DEFINE(MOZ_CAIRO_GFX)
4653 if test "$MOZ_ENABLE_GTK2"
4654 then
4655     AC_DEFINE(MOZ_X11)
4656     MOZ_X11=1
4658 AC_SUBST(MOZ_X11)
4660 dnl ========================================================
4661 dnl =
4662 dnl = Components & Features
4663 dnl = 
4664 dnl ========================================================
4665 MOZ_ARG_HEADER(Components and Features)
4667 dnl ========================================================
4668 dnl = Localization
4669 dnl ========================================================
4670 MOZ_ARG_ENABLE_STRING(ui-locale,
4671 [  --enable-ui-locale=ab-CD
4672                           Select the user interface locale (default: en-US)],
4673     MOZ_UI_LOCALE=$enableval )
4674 AC_SUBST(MOZ_UI_LOCALE)
4676 dnl =========================================================
4677 dnl = Calendar client
4678 dnl =========================================================
4679 MOZ_ARG_ENABLE_BOOL(calendar,,
4680     MOZ_OLD_CALENDAR=1,
4681     MOZ_OLD_CALENDAR= )
4683 if test "$MOZ_OLD_CALENDAR"; then
4684     AC_MSG_WARN([Building with the calendar extension is no longer supported.])
4685     if test "$MOZ_THUNDERBIRD"; then
4686         AC_MSG_WARN([Since you're trying to build mail, you could try adding])
4687         AC_MSG_WARN(['--enable-extensions=default,lightning' to your mozconfig])
4688         AC_MSG_WARN([and building WITH A FRESH TREE.])
4689     fi
4690     AC_MSG_WARN([For more information, please visit:])
4691     AC_MSG_ERROR([http://www.mozilla.org/projects/calendar/])
4694 AC_SUBST(MOZ_CALENDAR)
4696 dnl =========================================================
4697 dnl = Mail & News
4698 dnl =========================================================
4699 MOZ_ARG_DISABLE_BOOL(mailnews,
4700 [  --disable-mailnews      Disable building of mail & news components],
4701     MOZ_MAIL_NEWS=,
4702     MOZ_MAIL_NEWS=1 )
4703 AC_SUBST(MOZ_MAIL_NEWS)
4705 dnl ========================================================
4706 dnl static mail build off by default 
4707 dnl ========================================================
4708 MOZ_ARG_ENABLE_BOOL(static-mail,
4709 [  --enable-static-mail Enable static mail build support],
4710     MOZ_STATIC_MAIL_BUILD=1,
4711     MOZ_STATIC_MAIL_BUILD= )
4713 if test "$MOZ_STATIC_MAIL_BUILD"; then
4714     AC_DEFINE(MOZ_STATIC_MAIL_BUILD)
4717 AC_SUBST(MOZ_STATIC_MAIL_BUILD)
4719 dnl =========================================================
4720 dnl = LDAP
4721 dnl =========================================================
4722 MOZ_ARG_DISABLE_BOOL(ldap,
4723 [  --disable-ldap          Disable LDAP support],
4724     MOZ_LDAP_XPCOM=,
4725     MOZ_LDAP_XPCOM=1)
4727 dnl ========================================================
4728 dnl = Trademarked Branding 
4729 dnl ========================================================
4730 MOZ_ARG_ENABLE_BOOL(official-branding,
4731 [  --enable-official-branding Enable Official mozilla.org Branding
4732                           Do not distribute builds with
4733                           --enable-official-branding unless you have
4734                           permission to use trademarks per
4735                           http://www.mozilla.org/foundation/trademarks/ .],
4736 [case "$MOZ_BUILD_APP" in
4737 browser)
4738     MOZ_BRANDING_DIRECTORY=other-licenses/branding/firefox
4739     MOZ_APP_DISPLAYNAME=Firefox
4740     ;;
4742 calendar)
4743     MOZ_BRANDING_DIRECTORY=other-licenses/branding/sunbird
4744     MOZ_APP_DISPLAYNAME=Sunbird
4745     ;;
4747 mail)
4748     MOZ_BRANDING_DIRECTORY=other-licenses/branding/thunderbird
4749     ;;
4752     AC_MSG_ERROR([Official branding is only available for Firefox Sunbird and Thunderbird.])
4753 esac
4756 MOZ_ARG_WITH_STRING(branding,
4757 [  --with-branding=dir    Use branding from the specified directory.],
4758     MOZ_BRANDING_DIRECTORY=$withval)
4760 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4761 if test -z "$REAL_BRANDING_DIRECTORY"; then
4762   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4765 if test -f "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4766   . "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"
4769 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4771 dnl ========================================================
4772 dnl = Distribution ID
4773 dnl ========================================================
4774 MOZ_ARG_WITH_STRING(distribution-id,
4775 [  --with-distribution-id=ID  Set distribution-specific id (default=org.mozilla)],
4776 [ val=`echo $withval`
4777     MOZ_DISTRIBUTION_ID="$val"])
4779 if test -z "$MOZ_DISTRIBUTION_ID"; then
4780    MOZ_DISTRIBUTION_ID="org.mozilla"
4783 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4784 AC_SUBST(MOZ_DISTRIBUTION_ID)
4786 dnl ========================================================
4787 dnl = Xft
4788 dnl ========================================================
4789 if test "$MOZ_ENABLE_GTK2"; then
4790     MOZ_ENABLE_XFT=1
4793 MOZ_ARG_DISABLE_BOOL(xft,
4794 [  --disable-xft           Disable Xft support ],
4795     MOZ_ENABLE_XFT=,
4796     MOZ_ENABLE_XFT=1)
4798 if test "$MOZ_ENABLE_XFT" && test -z "$MOZ_ENABLE_GTK2"; then
4799     AC_MSG_ERROR([Cannot enable XFT support for non-GTK2 toolkits.])
4802 if test "$MOZ_ENABLE_XFT"
4803 then
4804     AC_DEFINE(MOZ_ENABLE_XFT)
4805     PKG_CHECK_MODULES(MOZ_XFT, xft)
4806     PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4809 AC_SUBST(MOZ_ENABLE_XFT)
4810 AC_SUBST(MOZ_XFT_CFLAGS)
4811 AC_SUBST(MOZ_XFT_LIBS)
4813 dnl ========================================================
4814 dnl = pango font rendering
4815 dnl ========================================================
4816 MOZ_ARG_ENABLE_BOOL(pango,
4817 [  --enable-pango          Enable Pango font rendering support],
4818     MOZ_ENABLE_PANGO=1,
4819     MOZ_ENABLE_PANGO=)
4821 if test "$MOZ_ENABLE_PANGO" && test -z "$MOZ_ENABLE_CAIRO_GFX"
4822 then
4823     AC_MSG_ERROR([Cairo gfx is required for Pango font rendering])
4826 if test "$MOZ_ENABLE_GTK2" && test "$MOZ_ENABLE_CAIRO_GFX"
4827 then
4828     # For gtk2, we require --enable-pango; gtk2 already implies --enable-xft
4829     if test -z "$MOZ_ENABLE_PANGO"
4830     then
4831         AC_MSG_WARN([Pango is required for cairo gfx builds, assuming --enable-pango])
4832         MOZ_ENABLE_PANGO=1
4833     fi
4836 if test "$MOZ_ENABLE_PANGO" && test "$MOZ_ENABLE_CAIRO_GFX"
4837 then
4838     AC_DEFINE(MOZ_ENABLE_PANGO)
4839     PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangocairo >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
4840     AC_SUBST(MOZ_ENABLE_PANGO)
4841     AC_SUBST(MOZ_PANGO_CFLAGS)
4842     AC_SUBST(MOZ_PANGO_LIBS)
4845 dnl ========================================================
4846 dnl = x11 core font support (default and ability to enable depend on toolkit)
4847 dnl ========================================================
4848 if test "$MOZ_X11"
4849 then
4850     MOZ_ENABLE_COREXFONTS=${MOZ_ENABLE_COREXFONTS-1}
4851 else
4852     MOZ_ENABLE_COREXFONTS=
4854 if test "$MOZ_ENABLE_COREXFONTS"
4855 then
4856     AC_DEFINE(MOZ_ENABLE_COREXFONTS)
4859 AC_SUBST(MOZ_ENABLE_COREXFONTS)
4861 dnl ========================================================
4862 dnl = PostScript print module
4863 dnl ========================================================
4864 MOZ_ARG_DISABLE_BOOL(postscript,
4865 [  --disable-postscript    Disable PostScript printing support ],
4866     MOZ_ENABLE_POSTSCRIPT=,
4867     MOZ_ENABLE_POSTSCRIPT=1 )
4869 dnl ========================================================
4870 dnl = GnomeVFS support module
4871 dnl ========================================================
4873 if test "$MOZ_X11"
4874 then
4875     dnl build the gnomevfs extension by default only when the
4876     dnl GTK2 toolkit is in use.
4877     if test "$MOZ_ENABLE_GTK2"
4878     then
4879         MOZ_ENABLE_GNOMEVFS=1
4880         MOZ_ENABLE_GCONF=1
4881         MOZ_ENABLE_LIBGNOME=1
4882     fi
4884     MOZ_ARG_DISABLE_BOOL(gnomevfs,
4885     [  --disable-gnomevfs      Disable GnomeVFS support ],
4886         MOZ_ENABLE_GNOMEVFS=,
4887         MOZ_ENABLE_GNOMEVFS=force)
4889     if test "$MOZ_ENABLE_GNOMEVFS"
4890     then
4891         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
4892             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
4893             MOZ_ENABLE_GNOMEVFS=1
4894         ],[
4895             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
4896             then
4897                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
4898             fi
4899             MOZ_ENABLE_GNOMEVFS=
4900         ])
4901     fi
4903     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
4904     AC_SUBST(MOZ_GNOMEVFS_LIBS)
4906     if test "$MOZ_ENABLE_GCONF"
4907     then
4908         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION,[
4909             MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
4910             MOZ_ENABLE_GCONF=1
4911         ],[
4912             MOZ_ENABLE_GCONF=
4913         ])
4914     fi
4916     AC_SUBST(MOZ_GCONF_CFLAGS)
4917     AC_SUBST(MOZ_GCONF_LIBS)
4919     if test "$MOZ_ENABLE_LIBGNOME"
4920     then
4921         PKG_CHECK_MODULES(MOZ_LIBGNOME, libgnome-2.0 >= $LIBGNOME_VERSION,[
4922             MOZ_LIBGNOME_LIBS=`echo $MOZ_LIBGNOME_LIBS | sed 's/-llinc\>//'`
4923             MOZ_ENABLE_LIBGNOME=1
4924         ],[
4925             MOZ_ENABLE_LIBGNOME=
4926         ])
4927     fi
4929     AC_SUBST(MOZ_LIBGNOME_CFLAGS)
4930     AC_SUBST(MOZ_LIBGNOME_LIBS)
4932     # The GNOME component is built if gtk2, gconf, gnome-vfs, and libgnome
4933     # are all available.
4935     if test "$MOZ_ENABLE_GTK2" -a "$MOZ_ENABLE_GCONF" -a \
4936             "$MOZ_ENABLE_GNOMEVFS" -a "$MOZ_ENABLE_LIBGNOME"; then
4937       MOZ_ENABLE_GNOME_COMPONENT=1
4938     else
4939       MOZ_ENABLE_GNOME_COMPONENT=
4940     fi
4942     AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
4945 dnl ========================================================
4946 dnl = libgnomeui support module
4947 dnl ========================================================
4949 if test "$MOZ_ENABLE_GTK2"
4950 then
4951     MOZ_ENABLE_GNOMEUI=1
4953     MOZ_ARG_DISABLE_BOOL(gnomeui,
4954     [  --disable-gnomeui       Disable libgnomeui support (default: auto, optional at runtime) ],
4955         MOZ_ENABLE_GNOMEUI=,
4956         MOZ_ENABLE_GNOMEUI=force)
4958     if test "$MOZ_ENABLE_GNOMEUI"
4959     then
4960         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
4961         [
4962             MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
4963             MOZ_ENABLE_GNOMEUI=1
4964         ],[
4965             if test "$MOZ_ENABLE_GNOMEUI" = "force"
4966             then
4967                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
4968             fi
4969             MOZ_ENABLE_GNOMEUI=
4970         ])
4971     fi
4973     if test "$MOZ_ENABLE_GNOMEUI"; then
4974         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
4975     fi
4977 AC_SUBST(MOZ_ENABLE_GNOMEUI)
4978 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
4979 AC_SUBST(MOZ_GNOMEUI_LIBS)
4981 dnl ========================================================
4982 dnl = dbus support
4983 dnl ========================================================
4985 if test "$MOZ_ENABLE_GTK2"
4986 then
4987     MOZ_ENABLE_DBUS=1
4989     MOZ_ARG_DISABLE_BOOL(dbus,
4990     [  --disable-dbus       Disable dbus support ],
4991         MOZ_ENABLE_DBUS=,
4992         MOZ_ENABLE_DBUS=1)
4994     if test "$MOZ_ENABLE_DBUS"
4995     then
4996         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
4997         AC_DEFINE(MOZ_ENABLE_DBUS)
4998     fi
5000 AC_SUBST(MOZ_ENABLE_DBUS)
5001 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5002 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5004 dnl ========================================================
5005 dnl = Setting MOZ_EXTRA_X11CONVERTERS turns on additional 
5006 dnl = converters in intl/uconv that are used only by X11 gfx 
5007 dnl = implementations. By default, it's undefined so that 
5008 dnl = those converters are not built on other platforms/toolkits. 
5009 dnl = (see bug 180851)
5010 dnl ========================================================
5012 if test "$MOZ_ENABLE_GTK2" \
5013 && test "$MOZ_ENABLE_COREXFONTS"
5014 then
5015     AC_DEFINE(MOZ_EXTRA_X11CONVERTERS)
5016     MOZ_EXTRA_X11CONVERTERS=1
5018 AC_SUBST(MOZ_EXTRA_X11CONVERTERS)
5020 dnl ========================================================
5021 dnl = Build Personal Security Manager
5022 dnl ========================================================
5023 MOZ_ARG_DISABLE_BOOL(crypto,
5024 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5025     MOZ_PSM=,
5026     MOZ_PSM=1 )
5028 dnl ========================================================
5029 dnl = JS Debugger XPCOM component (js/jsd)
5030 dnl ========================================================
5031 MOZ_ARG_DISABLE_BOOL(jsd,
5032 [  --disable-jsd           Disable JavaScript debug library],
5033     MOZ_JSDEBUGGER=,
5034     MOZ_JSDEBUGGER=1)
5037 dnl ========================================================
5038 dnl = Disable plugin support
5039 dnl ========================================================
5040 MOZ_ARG_DISABLE_BOOL(plugins,
5041 [  --disable-plugins       Disable plugins support],
5042     MOZ_PLUGINS=,
5043     MOZ_PLUGINS=1)
5045 dnl ========================================================
5046 dnl = Open JVM Interface (OJI) support
5047 dnl ========================================================
5048 MOZ_ARG_DISABLE_BOOL(oji,
5049 [  --disable-oji           Disable Open JVM Integration support],
5050     MOZ_OJI=,
5051     MOZ_OJI=1)
5052 if test -n "$MOZ_OJI"; then
5053     AC_DEFINE(OJI)
5056 dnl bi-directional support always on
5057 IBMBIDI=1
5058 AC_DEFINE(IBMBIDI)
5060 dnl ========================================================
5061 dnl complex text support off by default
5062 dnl ========================================================
5063 MOZ_ARG_ENABLE_BOOL(ctl,
5064 [  --enable-ctl            Enable Thai Complex Script support],
5065     SUNCTL=1,
5066     SUNCTL= )
5068 dnl ========================================================
5069 dnl view source support on by default
5070 dnl ========================================================
5071 MOZ_ARG_DISABLE_BOOL(view-source,
5072 [  --disable-view-source     Disable view source support],
5073     MOZ_VIEW_SOURCE=,
5074     MOZ_VIEW_SOURCE=1 )
5075 if test "$MOZ_VIEW_SOURCE"; then
5076     AC_DEFINE(MOZ_VIEW_SOURCE)
5080 dnl ========================================================
5081 dnl accessibility support on by default on all platforms 
5082 dnl except OS X.
5083 dnl ========================================================
5084 MOZ_ARG_DISABLE_BOOL(accessibility,
5085 [  --disable-accessibility Disable accessibility support (off by default on OS X)],
5086     ACCESSIBILITY=,
5087     ACCESSIBILITY=1 )
5088 if test "$ACCESSIBILITY"; then
5089     AC_DEFINE(ACCESSIBILITY)
5092 dnl ========================================================
5093 dnl xpfe/components on by default
5094 dnl ========================================================
5095 MOZ_ARG_DISABLE_BOOL(xpfe-components,
5096 [  --disable-xpfe-components
5097                           Disable xpfe components],
5098     MOZ_XPFE_COMPONENTS=,
5099     MOZ_XPFE_COMPONENTS=1 )
5101 dnl ========================================================
5102 dnl xpinstall support on by default
5103 dnl ========================================================
5104 MOZ_ARG_DISABLE_BOOL(xpinstall,
5105 [  --disable-xpinstall     Disable xpinstall support],
5106     MOZ_XPINSTALL=,
5107     MOZ_XPINSTALL=1 )
5108 if test "$MOZ_XPINSTALL"; then
5109     AC_DEFINE(MOZ_XPINSTALL)
5112 dnl ========================================================
5113 dnl xpcom js loader support on by default
5114 dnl ========================================================
5115 MOZ_ARG_DISABLE_BOOL(jsloader,
5116 [  --disable-jsloader      Disable xpcom js loader support],
5117     MOZ_JSLOADER=,
5118     MOZ_JSLOADER=1 )
5119 if test "$MOZ_JSLOADER"; then
5120     AC_DEFINE(MOZ_JSLOADER)
5123 dnl ========================================================
5124 dnl Disable printing
5125 dnl ========================================================
5126 MOZ_ARG_DISABLE_BOOL(printing,
5127 [  --disable-printing  Disable printing support],
5128     NS_PRINTING=,
5129     NS_PRINTING=1 )
5131 if test "$NS_PRINTING"; then
5132     AC_DEFINE(NS_PRINTING)
5133     AC_DEFINE(NS_PRINT_PREVIEW)
5136 dnl ========================================================
5137 dnl use native unicode converters
5138 dnl ========================================================
5139 MOZ_ARG_ENABLE_BOOL(native-uconv,
5140 [  --enable-native-uconv   Enable iconv support],
5141     MOZ_USE_NATIVE_UCONV=1,
5142     MOZ_USE_NATIVE_UCONV= )
5143 if test "$MOZ_USE_NATIVE_UCONV"; then
5144     AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5146 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5147     AC_MSG_ERROR([iconv() not found.  Cannot enable native uconv support.])
5151 dnl ========================================================
5152 dnl Libeditor can be build as plaintext-only,
5153 dnl or as a full html and text editing component.
5154 dnl We build both by default.
5155 dnl ========================================================
5156 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5157 [  --enable-plaintext-editor-only
5158                           Allow only plaintext editing],
5159     MOZ_PLAINTEXT_EDITOR_ONLY=1,
5160     MOZ_PLAINTEXT_EDITOR_ONLY= )
5161 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5162 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5164 dnl ========================================================
5165 dnl Composer is on by default.
5166 dnl ========================================================
5167 MOZ_ARG_DISABLE_BOOL(composer,
5168 [  --disable-composer      Disable building of Composer],
5169     MOZ_COMPOSER=,
5170     MOZ_COMPOSER=1 )
5171 AC_SUBST(MOZ_COMPOSER)
5174 dnl ========================================================
5175 dnl = Drop XPCOM Obsolete library
5176 dnl ========================================================
5177 MOZ_ARG_DISABLE_BOOL(xpcom-obsolete,
5178 [  --disable-xpcom-obsolete           Disable XPCOM Obsolete Library],
5179     MOZ_NO_XPCOM_OBSOLETE=1,
5180     MOZ_NO_XPCOM_OBSOLETE=)
5182 if test -n "$MOZ_NO_XPCOM_OBSOLETE"; then
5183     AC_DEFINE(MOZ_NO_XPCOM_OBSOLETE)
5186 dnl ========================================================
5187 dnl = Disable Fast Load
5188 dnl ========================================================
5189 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5190 [  --disable-xpcom-fastload           Disable XPCOM fastload support],
5191     MOZ_NO_FAST_LOAD=1,
5192     MOZ_NO_FAST_LOAD=)
5194 AC_SUBST(MOZ_NO_FAST_LOAD)
5196 if test -n "$MOZ_NO_FAST_LOAD"; then
5197     AC_DEFINE(MOZ_NO_FAST_LOAD)
5200 dnl ========================================================
5201 dnl Permissions System
5202 dnl ========================================================
5203 MOZ_ARG_DISABLE_BOOL(permissions,
5204 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
5205     MOZ_PERMISSIONS=,
5206     MOZ_PERMISSIONS=1
5209 dnl ========================================================
5210 dnl NegotiateAuth
5211 dnl ========================================================
5212 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5213 [  --disable-negotiateauth Disable GSS-API negotiation ],
5214     MOZ_AUTH_EXTENSION=,
5215     MOZ_AUTH_EXTENSION=1 )
5217 dnl ========================================================
5218 dnl XTF
5219 dnl ========================================================
5220 MOZ_ARG_DISABLE_BOOL(xtf,
5221 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
5222     MOZ_XTF=,
5223     MOZ_XTF=1 )
5224 if test "$MOZ_XTF"; then
5225   AC_DEFINE(MOZ_XTF)
5228 dnl ========================================================
5229 dnl Inspector APIs
5230 dnl ========================================================
5231 MOZ_ARG_DISABLE_BOOL(inspector-apis,
5232 [  --disable-inspector-apis Disable the DOM inspection APIs ],
5233     MOZ_NO_INSPECTOR_APIS=1,
5234     MOZ_NO_INSPECTOR_APIS= )
5236 dnl ========================================================
5237 dnl XMLExtras
5238 dnl ========================================================
5239 MOZ_ARG_DISABLE_BOOL(xmlextras,
5240 [  --disable-xmlextras Disable XMLExtras such as XPointer support ],
5241     MOZ_XMLEXTRAS=,
5242     MOZ_XMLEXTRAS=1 )
5244 dnl ========================================================
5245 dnl Webservices
5246 dnl ========================================================
5247 MOZ_ARG_ENABLE_BOOL(webservices,
5248 [  --enable-webservices Enable Webservices/SOAP support ],
5249     MOZ_WEBSERVICES=1,
5250     MOZ_WEBSERVICES= )
5252 dnl ========================================================
5253 dnl Pref extensions (autoconfig and system-pref)
5254 dnl ========================================================
5255 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5256 [  --disable-pref-extensions
5257                           Disable pref extensions such as autoconfig and
5258                           system-pref],
5259   MOZ_PREF_EXTENSIONS=,
5260   MOZ_PREF_EXTENSIONS=1 )
5262 dnl ========================================================
5263 dnl = Universalchardet
5264 dnl ========================================================
5265 MOZ_ARG_DISABLE_BOOL(universalchardet,
5266 [  --disable-universalchardet
5267                           Disable universal encoding detection],
5268   MOZ_UNIVERSALCHARDET=,
5269   MOZ_UNIVERSALCHARDET=1 )
5271 dnl ========================================================
5272 dnl JavaXPCOM
5273 dnl ========================================================
5274 MOZ_ARG_ENABLE_BOOL(javaxpcom,
5275 [  --enable-javaxpcom
5276                           Enable Java-XPCOM bridge],
5277     MOZ_JAVAXPCOM=1,
5278     MOZ_JAVAXPCOM= )
5280 if test -n "${MOZ_JAVAXPCOM}"; then
5281   case "$host_os" in
5282     cygwin*|msvc*|mks*)
5283       if test -n "$JAVA_HOME"; then
5284         JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
5285       fi
5286       ;;
5287     *mingw*)
5288       if test -n "$JAVA_HOME"; then
5289         JAVA_HOME=`cd "$JAVA_HOME" && pwd`
5290       fi
5291       ;;
5292   esac
5294   if test -n "${JAVA_INCLUDE_PATH}"; then
5295     dnl Make sure jni.h exists in the given include path.
5296     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5297       AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
5298     fi
5299   else
5300     case "$target_os" in
5301       darwin*)
5302         dnl Default to java system location
5303         JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
5304         ;;
5305       *)
5306         dnl Try $JAVA_HOME
5307         JAVA_INCLUDE_PATH="$JAVA_HOME/include"
5308         ;;
5309     esac
5310     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5311       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.])
5312     fi
5313   fi
5315   if test -n "${JAVA_BIN_PATH}"; then
5316     dnl Look for javac and jar in the specified path.
5317     JAVA_PATH="$JAVA_BIN_PATH"
5318   else
5319     dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5320     JAVA_PATH="$JAVA_HOME/bin:$PATH"
5321   fi
5323   AC_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5324   AC_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5325   AC_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5326   if test -z "$JAVA" || test "$JAVA" = ":" || test -z "$JAVAC" || test "$JAVAC" = ":" || test -z "$JAR" || test "$JAR" = ":"; then
5327     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.])
5328   fi
5331 dnl ========================================================
5332 dnl = Breakpad crash reporting (on by default on supported platforms)
5333 dnl ========================================================
5335 if (test "$OS_ARCH" = "WINNT" -a -z "$GNU_CC" \
5336     || test "$OS_ARCH" = "Darwin" \
5337     || test "$OS_ARCH" = "Linux" -a "$CPU_ARCH" = "x86") \
5338    && test -z "$HAVE_64BIT_OS"; then
5339    MOZ_CRASHREPORTER=1
5342 MOZ_ARG_DISABLE_BOOL(crashreporter,
5343 [  --disable-crashreporter          Disable breakpad crash reporting],
5344     MOZ_CRASHREPORTER=,
5345     MOZ_CRASHREPORTER=1)
5347 if test -n "$MOZ_CRASHREPORTER"; then
5348    AC_DEFINE(MOZ_CRASHREPORTER)
5350   if test "$OS_ARCH" = "Linux" && \
5351      test -z "$SKIP_LIBRARY_CHECKS"; then
5352      _SAVE_LDFLAGS=$LDFLAGS
5353      LDFLAGS="$LDFLAGS -lcurl"
5354      AC_CACHE_CHECK(for libcurl,
5355                     ac_cv_have_libcurl,
5356                     [AC_TRY_LINK([#include <curl/curl.h>],
5357                                  [curl_easy_init();],
5358                                  ac_cv_have_libcurl="yes",
5359                                  ac_cv_have_libcurl="no")])
5360     if test "$ac_cv_have_libcurl" = "no"; then
5361         AC_MSG_ERROR([Couldn't find libcurl, which is required for the crash reporter.  Use --disable-crashreporter to disable the crash reporter.])
5362     fi
5363     LDFLAGS=$_SAVE_LDFLAGS
5364   fi
5367 dnl ========================================================
5368 dnl = Build mochitest JS/DOM tests (on by default)
5369 dnl ========================================================
5370 MOZ_ARG_DISABLE_BOOL(mochitest,
5371 [  --disable-mochitest        Disable mochitest harness],
5372     MOZ_MOCHITEST=,
5373     MOZ_MOCHITEST=1 )
5375 dnl ========================================================
5376 dnl = Enable compilation of specific extension modules
5377 dnl ========================================================
5379 MOZ_ARG_ENABLE_STRING(extensions,
5380 [  --enable-extensions     Enable extensions],
5381 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5382     if test "$option" = "yes" || test "$option" = "all"; then
5383         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_ALL"
5384     elif test "$option" = "no" || test "$option" = "none"; then
5385         MOZ_EXTENSIONS=""
5386     elif test "$option" = "default"; then
5387         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
5388     elif test `echo "$option" | grep -c \^-` != 0; then
5389         option=`echo $option | sed 's/^-//'`
5390         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
5391     else
5392         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
5393     fi
5394 done],
5395     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
5397 if test -z "$MOZ_ENABLE_GNOMEVFS" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5398     # Suppress warning on non-X11 platforms
5399     if test -n "$MOZ_X11"; then
5400         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
5401     fi
5402     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5405 if test -z "$MOZ_JSDEBUGGER" && test `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
5406     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
5407     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
5410 dnl This might be temporary: build tridentprofile only on Windows
5411 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
5412     AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
5413     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5416 dnl cookie must be built before tridentprofile. put it at list's end.
5417 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
5418   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5419   MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
5422 dnl schema-validation requires webservices
5423 if test -z "$MOZ_WEBSERVICES" && test `echo "$MOZ_EXTENSIONS" | grep -c schema-validation` -ne 0; then
5424     AC_MSG_WARN([Cannot build schema-validation without webservices.  Removing schema-validation from MOZ_EXTENSIONS.])
5425     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|schema-validation||g'`
5428 dnl xforms requires xtf and webservices and schema-validation
5429 if test -z "$MOZ_XTF" && test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
5430     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
5431     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5433 if test -z "$MOZ_WEBSERVICES" && test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
5434     AC_MSG_WARN([Cannot build XForms without webservices.  Removing XForms from MOZ_EXTENSIONS.])
5435     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5438 if test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0 && test `echo "$MOZ_EXTENSIONS" | grep -c schema-validation` -eq 0; then
5439     AC_MSG_WARN([Cannot build XForms without schema validation.  Removing XForms from MOZ_EXTENSIONS.])
5440     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5443 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
5444     AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
5445     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
5448 if test `echo "$MOZ_EXTENSIONS" | grep -c xmlextras` -ne 0; then
5449     AC_MSG_WARN([xmlextras is no longer an extension, use --disable-xmlextras to disable.])
5450     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xmlextras||g'`
5453 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
5454     AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
5455     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
5458 if test `echo "$MOZ_EXTENSIONS" | grep -c webservices` -ne 0; then
5459     AC_MSG_WARN([webservices is no longer an extension, use --disable-webservices to disable.])
5460     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|webservices||g'`
5463 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
5464     AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
5465     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
5468 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
5469     AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
5470     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
5473 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
5474     AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
5475     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
5478 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
5479     AC_MSG_WARN([spellcheck is no longer an extension.])
5480     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
5483 if test -n "$MOZ_NO_XPCOM_OBSOLETE" && test `echo "$MOZ_EXTENSIONS" | grep -c sroaming` -ne 0; then
5484     AC_MSG_WARN([Cannot currently build sroaming without xpcom obsolete -- bug 249343. Removing sroaming from MOZ_EXTENSIONS.])
5485     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|sroaming||'`
5488 dnl Remove dupes
5489 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
5491 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
5492 dnl when trying to build a non-existent extension.
5493 for extension in $MOZ_EXTENSIONS; do
5494     if test ! -d "${srcdir}/extensions/${extension}"; then
5495         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
5496     fi
5497 done
5500 dnl ========================================================
5501 dnl Image decoders
5502 dnl ========================================================
5503 case "$MOZ_WIDGET_TOOLKIT" in
5504 beos|windows|os2|mac|cocoa)
5505     ;;
5507     if test -z "$MOZ_ENABLE_GTK2"; then
5508        MOZ_IMG_DECODERS_DEFAULT=`echo $MOZ_IMG_DECODERS_DEFAULT | sed -e 's|icon||'`                
5509     fi
5510     ;;
5511 esac
5513 MOZ_ARG_ENABLE_STRING(image-decoders,
5514 [  --enable-image-decoders[={mod1,mod2,default,all,none}]
5515                           Enable specific image decoders],
5516 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5517     if test "$option" = "yes" || test "$option" = "all"; then
5518         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5519     elif test "$option" = "no" || test "$option" = "none"; then
5520         MOZ_IMG_DECODERS=""
5521     elif test "$option" = "default"; then
5522         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5523     elif test `echo "$option" | grep -c \^-` != 0; then
5524         option=`echo $option | sed 's/^-//'`
5525         MOZ_IMG_DECODERS=`echo "$MOZ_IMG_DECODERS" | sed "s/ ${option}//"`
5526     else
5527         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $option"
5528     fi
5529 done],
5530     MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS_DEFAULT")
5532 dnl Dupes are removed in the encoder section because it will also add decoders
5534 dnl ========================================================
5535 dnl Image encoders
5536 dnl ========================================================
5537 MOZ_ARG_ENABLE_STRING(image-encoders,
5538 [  --enable-image-encoders[={mod1,mod2,default,all,none}]
5539                           Enable specific image encoders],
5540 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5541     if test "$option" = "yes" || test "$option" = "all"; then
5542         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5543     elif test "$option" = "no" || test "$option" = "none"; then
5544         MOZ_IMG_ENCODERS=""
5545         addencoder=""
5546     elif test "$option" = "default"; then
5547         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5548     elif test `echo "$option" | grep -c \^-` != 0; then
5549         option=`echo $option | sed 's/^-//'`
5550         addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
5551     else
5552         addencoder="$option"
5553     fi
5554     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
5555 done],
5556     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
5558 dnl Remove dupes
5559 MOZ_IMG_DECODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_DECODERS}`
5560 MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
5562 dnl ========================================================
5563 dnl experimental ldap features
5564 dnl ========================================================
5565 MOZ_ARG_ENABLE_BOOL(ldap-experimental,
5566 [  --enable-ldap-experimental
5567                           Enable LDAP experimental features],
5568     MOZ_LDAP_XPCOM_EXPERIMENTAL=1,
5569     MOZ_LDAP_XPCOM_EXPERIMENTAL=)
5571 dnl ========================================================
5572 dnl MathML on by default
5573 dnl ========================================================
5574 MOZ_ARG_DISABLE_BOOL(mathml,
5575 [  --disable-mathml        Disable MathML support],
5576     MOZ_MATHML=,
5577     MOZ_MATHML=1 )
5578 if test "$MOZ_MATHML"; then
5579   AC_DEFINE(MOZ_MATHML)
5582 dnl ========================================================
5583 dnl Canvas
5584 dnl ========================================================
5585 MOZ_ARG_DISABLE_BOOL(canvas,
5586 [  --disable-canvas          Disable html:canvas feature],
5587     MOZ_ENABLE_CANVAS=,
5588     MOZ_ENABLE_CANVAS=1 )
5589 if test -n "$MOZ_ENABLE_CANVAS"; then
5590     AC_DEFINE(MOZ_ENABLE_CANVAS)
5592 AC_SUBST(MOZ_ENABLE_CANVAS)
5594 dnl ========================================================
5595 dnl SVG
5596 dnl ========================================================
5597 MOZ_ARG_DISABLE_BOOL(svg,
5598 [  --disable-svg            Disable SVG support],
5599     MOZ_SVG=,
5600     MOZ_SVG=1 )
5601 if test -n "$MOZ_SVG"; then
5602   if test -z "$MOZ_ENABLE_CAIRO_GFX"; then
5603     AC_MSG_ERROR([SVG requires cairo gfx])
5604   else
5605     AC_DEFINE(MOZ_SVG)
5606   fi
5609 MOZ_SVG_FOREIGNOBJECT=$MOZ_ENABLE_CAIRO_GFX
5610 dnl ========================================================
5611 dnl SVG <foreignObject>
5612 dnl ========================================================
5613 MOZ_ARG_DISABLE_BOOL(svg-foreignobject,
5614    [  --disable-svg-foreignobject
5615                         Disable SVG <foreignObject> support],
5616    MOZ_SVG_FOREIGNOBJECT=,
5617    MOZ_SVG_FOREIGNOBJECT=1 )
5618 if test "$MOZ_SVG_FOREIGNOBJECT"; then
5619   if test -z "$MOZ_ENABLE_CAIRO_GFX"; then
5620     AC_MSG_ERROR([<foreignobject> requires cairo gfx])
5621   else
5622     if test "$MOZ_SVG"; then
5623       AC_DEFINE(MOZ_SVG_FOREIGNOBJECT)
5624     else
5625       MOZ_SVG_FOREIGNOBEJCT=
5626     fi
5627   fi
5630 dnl ========================================================
5631 dnl Installer
5632 dnl ========================================================
5633 case "$target_os" in
5634     aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*)
5635         MOZ_INSTALLER=1
5636         ;;
5637 esac
5639 MOZ_ARG_DISABLE_BOOL(installer,
5640 [  --disable-installer     Disable building of installer],
5641     MOZ_INSTALLER=,
5642     MOZ_INSTALLER=1 )
5643 if test -n "$MOZ_INSTALLER" -a -n "$MOZ_XUL_APP" -a "$OS_ARCH" = "WINNT"; then
5644     # Disable installer for Windows builds that use the new toolkit if NSIS
5645     # isn't in the path.
5646     AC_PATH_PROGS(MAKENSIS, makensis)
5647     if test -z "$MAKENSIS" || test "$MAKENSIS" = ":"; then
5648         AC_MSG_ERROR([To build the installer makensis is required in your path. To build without the installer reconfigure using --disable-installer.])
5649     fi
5650     # The Windows build for NSIS requires the iconv command line utility to
5651     # convert the charset of the locale files.
5652     AC_PATH_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
5653     if test -z "$HOST_ICONV"; then
5654         AC_MSG_ERROR([To build the installer iconv is required in your path. To build without the installer reconfigure using --disable-installer.])
5655     fi
5658 # Automatically disable installer if xpinstall isn't built
5659 if test -z "$MOZ_XPINSTALL"; then
5660     MOZ_INSTALLER=
5662 AC_SUBST(MOZ_INSTALLER)
5664 AC_MSG_CHECKING([for tar archiver])
5665 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
5666 if test -z "$TAR"; then
5667     AC_MSG_ERROR([no tar archiver found in \$PATH])
5669 AC_MSG_RESULT([$TAR])
5670 AC_SUBST(TAR)
5672 dnl ========================================================
5673 dnl Updater
5674 dnl ========================================================
5676 MOZ_ARG_DISABLE_BOOL(updater,
5677 [  --disable-updater       Disable building of updater],
5678     MOZ_UPDATER=,
5679     MOZ_UPDATER=1 )
5680 # The Windows build requires the iconv command line utility
5681 # in order to build the updater.
5682 case "$target_os" in
5683     msvc*|mks*|cygwin*|mingw*|wince*)
5684         if test -n "$MOZ_UPDATER"; then
5685             AC_MSG_CHECKING([for iconv])
5686             AC_CHECK_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
5687             if test -z "$HOST_ICONV"; then
5688                 AC_MSG_ERROR([iconv not found in \$PATH])
5689             fi
5690         fi
5691         ;;
5692 esac
5693 AC_SUBST(MOZ_UPDATER)
5695 # app update channel is 'default' when not supplied.
5696 MOZ_ARG_ENABLE_STRING([update-channel],
5697 [  --enable-update-channel=CHANNEL
5698                            Select application update channel (default=default)],
5699     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
5701 if test -z "$MOZ_UPDATE_CHANNEL"; then
5702     MOZ_UPDATE_CHANNEL=default
5704 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
5706 # tools/update-packaging is not checked out by default.
5707 MOZ_ARG_ENABLE_BOOL(update-packaging,
5708 [  --enable-update-packaging
5709                            Enable tools/update-packaging],
5710     MOZ_UPDATE_PACKAGING=1,
5711     MOZ_UPDATE_PACKAGING= )
5712 AC_SUBST(MOZ_UPDATE_PACKAGING)
5714 dnl ========================================================
5715 dnl ActiveX
5716 dnl ========================================================
5718 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
5719 [  --disable-xpconnect-idispatch
5720                           Disable building of xpconnect support for IDispatch
5721                           (win32 only)],
5722     XPC_IDISPATCH_SUPPORT=,
5723     XPC_IDISPATCH_SUPPORT=1)
5724 AC_SUBST(XPC_IDISPATCH_SUPPORT)
5726 MOZ_ARG_DISABLE_BOOL(activex,
5727 [  --disable-activex       Disable building of ActiveX control (win32 only)],
5728     MOZ_NO_ACTIVEX_SUPPORT=1,
5729     MOZ_NO_ACTIVEX_SUPPORT= )
5730 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
5732 MOZ_ARG_DISABLE_BOOL(activex-scripting,
5733 [  --disable-activex-scripting
5734                           Disable building of ActiveX scripting support (win32)],
5735     MOZ_ACTIVEX_SCRIPTING_SUPPORT=,
5736     MOZ_ACTIVEX_SCRIPTING_SUPPORT=1)
5737 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
5739 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
5740 then
5741     AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
5744 dnl ========================================================
5745 dnl leaky
5746 dnl ========================================================
5747 MOZ_ARG_ENABLE_BOOL(leaky,
5748 [  --enable-leaky          Build leaky memory tool],
5749     MOZ_LEAKY=1,
5750     MOZ_LEAKY=)
5753 dnl ========================================================
5754 dnl xpctools
5755 dnl ========================================================
5756 MOZ_ARG_ENABLE_BOOL(xpctools,
5757 [  --enable-xpctools       Build JS profiling tool],
5758     MOZ_XPCTOOLS=1,
5759     MOZ_XPCTOOLS= )
5762 dnl ========================================================
5763 dnl build the tests by default
5764 dnl ========================================================
5765 MOZ_ARG_DISABLE_BOOL(tests,
5766 [  --disable-tests         Do not build test libraries & programs],
5767     ENABLE_TESTS=,
5768     ENABLE_TESTS=1 )
5770 dnl ========================================================
5771 dnl =
5772 dnl = Module specific options
5773 dnl =
5774 dnl ========================================================
5775 MOZ_ARG_HEADER(Individual module options)
5777 dnl ========================================================
5778 dnl = Enable Lea malloc in xpcom. OFF by default.
5779 dnl ========================================================
5780 MOZ_ARG_ENABLE_BOOL(xpcom-lea,
5781 [  --enable-xpcom-lea      Use Lea malloc in xpcom ],
5782     XPCOM_USE_LEA=1,
5783     XPCOM_USE_LEA= )
5784 if test -n "$XPCOM_USE_LEA"; then
5785     AC_DEFINE(XPCOM_USE_LEA)
5788 dnl ========================================================
5789 dnl = Enable places (new history/bookmarks)
5790 dnl ========================================================
5791 MOZ_ARG_ENABLE_BOOL(places,
5792 [  --enable-places        Enable 'places' bookmark/history implementation],
5793     MOZ_PLACES=1,
5794     MOZ_PLACES= )
5795 if test -n "$MOZ_PLACES"; then
5796     AC_DEFINE(MOZ_PLACES)
5797     if test -z "$MOZ_MAIL_NEWS"; then
5798       MOZ_MORK=
5799     fi
5800     MOZ_MORKREADER=1
5801 else
5802   if test "$MOZ_BUILD_APP" = "browser"; then
5803     AC_MSG_ERROR([Cannot build Firefox with --disable-places.])
5804   fi
5807 dnl ========================================================
5808 dnl = Disable feed handling components
5809 dnl ========================================================
5810 MOZ_ARG_DISABLE_BOOL(feeds,
5811 [  --disable-feeds        Disable feed handling and processing components],
5812     MOZ_FEEDS=,
5813     MOZ_FEEDS=1 )
5814 if test -n "$MOZ_FEEDS"; then
5815     AC_DEFINE(MOZ_FEEDS)
5816 else
5817     if test "$MOZ_BUILD_APP" = "browser"; then
5818         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
5819     fi
5822 dnl ========================================================
5823 dnl = Enable mozStorage
5824 dnl = XXX need to implement --with-system-sqlite3 (see bug 263381)
5825 dnl ========================================================
5826 dnl Implicitly enabled by default if building calendar or places
5827 MOZ_ARG_ENABLE_BOOL(storage,
5828 [  --enable-storage        Enable mozStorage module and related components],
5829     MOZ_STORAGE=1,
5830     MOZ_STORAGE= )
5831 if test -n "$MOZ_STORAGE"; then
5832     AC_DEFINE(MOZ_STORAGE)
5835 dnl ========================================================
5836 dnl = Enable safe browsing (anti-phishing)
5837 dnl ========================================================
5838 MOZ_ARG_ENABLE_BOOL(safe-browsing,
5839 [  --enable-safe-browsing        Enable safe browsing (anti-phishing) implementation],
5840     MOZ_SAFE_BROWSING=1,
5841     MOZ_SAFE_BROWSING= )
5842 if test -n "$MOZ_SAFE_BROWSING"; then
5843     AC_DEFINE(MOZ_SAFE_BROWSING)
5845 AC_SUBST(MOZ_SAFE_BROWSING)
5847 dnl ========================================================
5848 dnl = Enable url-classifier
5849 dnl ========================================================
5850 dnl Implicitly enabled by default if building with safe-browsing
5851 if test -n "$MOZ_SAFE_BROWSING"; then
5852     MOZ_URL_CLASSIFIER=1
5854 MOZ_ARG_ENABLE_BOOL(url-classifier,
5855 [  --enable-url-classifier        Enable url classifier module],
5856     MOZ_URL_CLASSIFIER=1,
5857     MOZ_URL_CLASSIFIER= )
5858 if test -n "$MOZ_URL_CLASSIFIER"; then
5859     AC_DEFINE(MOZ_URL_CLASSIFIER)
5861 AC_SUBST(MOZ_URL_CLASSIFIER)
5863 dnl ========================================================
5864 dnl = Disable zipwriter
5865 dnl ========================================================
5866 MOZ_ARG_DISABLE_BOOL(zipwriter,
5867 [  --disable-zipwriter             Disable zipwriter component],
5868     MOZ_ZIPWRITER=,
5869     MOZ_ZIPWRITER=1 )
5870 AC_SUBST(MOZ_ZIPWRITER)
5872 dnl ========================================================
5873 dnl = Enable Ultrasparc specific optimizations for JS
5874 dnl ========================================================
5875 MOZ_ARG_ENABLE_BOOL(js-ultrasparc,
5876 [  --enable-js-ultrasparc  Use UltraSPARC optimizations in JS],
5877     JS_ULTRASPARC_OPTS=1,
5878     JS_ULTRASPARC_OPTS= )
5880 dnl only enable option for ultrasparcs
5881 if test `echo "$target_os" | grep -c \^solaris 2>/dev/null` = 0 -o \
5882     "$OS_TEST" != "sun4u"; then
5883     JS_ULTRASPARC_OPTS=
5885 AC_SUBST(JS_ULTRASPARC_OPTS)
5887 dnl ========================================================
5888 dnl =
5889 dnl = Feature options that require extra sources to be pulled
5890 dnl =
5891 dnl ========================================================
5892 dnl MOZ_ARG_HEADER(Features that require extra sources)
5894 dnl ========================================================
5895 dnl =
5896 dnl = Debugging Options
5897 dnl = 
5898 dnl ========================================================
5899 MOZ_ARG_HEADER(Debugging and Optimizations)
5901 dnl ========================================================
5902 dnl = Disable building with debug info.
5903 dnl = Debugging is OFF by default
5904 dnl ========================================================
5905 if test -z "$MOZ_DEBUG_FLAGS"
5906 then
5907     case "$target" in
5908     *-irix*)
5909         if test "$GNU_CC"; then
5910             GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'`
5911             case "$GCC_VERSION" in
5912             2.95.*)
5913                 MOZ_DEBUG_FLAGS=""
5914                 ;;
5915             *)
5916                 MOZ_DEBUG_FLAGS="-g"
5917                 ;;
5918             esac
5919         else
5920             MOZ_DEBUG_FLAGS="-g"
5921         fi
5922         ;;
5923     *)
5924         MOZ_DEBUG_FLAGS="-g"
5925         ;;
5926     esac
5929 MOZ_ARG_ENABLE_STRING(debug,
5930 [  --enable-debug[=DBG]    Enable building with developer debug info
5931                           (Using compiler flags DBG)],
5932 [ if test "$enableval" != "no"; then
5933     MOZ_DEBUG=1
5934     if test -n "$enableval" && test "$enableval" != "yes"; then
5935         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
5936     fi
5937   else
5938     MOZ_DEBUG=
5939   fi ],
5940   MOZ_DEBUG=)
5942 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG"
5943  case "${target_os}" in
5944     beos*)
5945         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${USER}"
5946         ;;
5947     msvc*|mks*|cygwin*|mingw*|os2*|wince*)
5948         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
5949         ;;
5950     *) 
5951         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`$WHOAMI`"
5952         ;;
5953   esac
5954 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DTRACING"
5956 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
5958 if test -n "$MOZ_DEBUG"; then
5959     AC_MSG_CHECKING([for valid debug flags])
5960     _SAVE_CFLAGS=$CFLAGS
5961     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
5962     AC_TRY_COMPILE([#include <stdio.h>], 
5963         [printf("Hello World\n");],
5964         _results=yes,
5965         _results=no)
5966     AC_MSG_RESULT([$_results])
5967     if test "$_results" = "no"; then
5968         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
5969     fi
5970     CFLAGS=$_SAVE_CFLAGS
5973 dnl ========================================================
5974 dnl = Enable code optimization. ON by default.
5975 dnl ========================================================
5976 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
5977         MOZ_OPTIMIZE_FLAGS="-O"
5980 MOZ_ARG_ENABLE_STRING(optimize,
5981 [  --disable-optimize      Disable compiler optimization
5982   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
5983 [ if test "$enableval" != "no"; then
5984     MOZ_OPTIMIZE=1
5985     if test -n "$enableval" && test "$enableval" != "yes"; then
5986         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
5987         MOZ_OPTIMIZE=2
5988     fi
5989 else
5990     MOZ_OPTIMIZE=
5991 fi ], MOZ_OPTIMIZE=1)
5993 if test "$COMPILE_ENVIRONMENT"; then
5994 if test -n "$MOZ_OPTIMIZE"; then
5995     AC_MSG_CHECKING([for valid optimization flags])
5996     _SAVE_CFLAGS=$CFLAGS
5997     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
5998     AC_TRY_COMPILE([#include <stdio.h>], 
5999         [printf("Hello World\n");],
6000         _results=yes,
6001         _results=no)
6002     AC_MSG_RESULT([$_results])
6003     if test "$_results" = "no"; then
6004         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6005     fi
6006     CFLAGS=$_SAVE_CFLAGS
6008 fi # COMPILE_ENVIRONMENT
6010 AC_SUBST(MOZ_OPTIMIZE)
6011 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6012 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6014 dnl ========================================================
6015 dnl = Enable/disable debug for specific modules only
6016 dnl =   module names beginning with ^ will be disabled 
6017 dnl ========================================================
6018 MOZ_ARG_ENABLE_STRING(debug-modules,
6019 [  --enable-debug-modules  Enable/disable debug info for specific modules],
6020 [ MOZ_DEBUG_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
6022 dnl ========================================================
6023 dnl = Enable/disable generation of debugger info for specific modules only
6024 dnl =    the special module name ALL_MODULES can be used to denote all modules
6025 dnl =    module names beginning with ^ will be disabled
6026 dnl ========================================================
6027 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
6028 [  --enable-debugger-info-modules
6029                           Enable/disable debugger info for specific modules],
6030 [ for i in `echo $enableval | sed 's/,/ /g'`; do
6031       dnl note that the list of module names is reversed as it is copied
6032       dnl this is important, as it will allow config.mk to interpret stuff like
6033       dnl "^ALL_MODULES xpcom" properly
6034       if test "$i" = "no"; then
6035         i="^ALL_MODULES"
6036       fi
6037       if test "$i" = "yes"; then
6038         i="ALL_MODULES"
6039       fi
6040       MOZ_DBGRINFO_MODULES="$i $MOZ_DBGRINFO_MODULES";
6041     done ])
6043 dnl ========================================================
6044 dnl Enable garbage collector
6045 dnl ========================================================
6046 MOZ_ARG_ENABLE_BOOL(boehm,
6047 [  --enable-boehm          Enable the Boehm Garbage Collector],
6048     GC_LEAK_DETECTOR=1,
6049     GC_LEAK_DETECTOR= )
6050 if test -n "$GC_LEAK_DETECTOR"; then
6051     AC_DEFINE(GC_LEAK_DETECTOR)
6054 dnl ========================================================
6055 dnl Disable runtime logging checks
6056 dnl ========================================================
6057 MOZ_ARG_DISABLE_BOOL(logging,
6058 [  --disable-logging       Disable logging facilities],
6059     NS_DISABLE_LOGGING=1,
6060     NS_DISABLE_LOGGING= )
6061 if test "$NS_DISABLE_LOGGING"; then
6062     AC_DEFINE(NS_DISABLE_LOGGING)
6063 else
6064     AC_DEFINE(MOZ_LOGGING)
6067 dnl ========================================================
6068 dnl = dnl This will enable logging of addref, release, ctor, dtor.
6069 dnl ========================================================
6070 _ENABLE_LOGREFCNT=42
6071 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6072 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
6073     _ENABLE_LOGREFCNT=1,
6074     _ENABLE_LOGREFCNT= )
6075 if test "$_ENABLE_LOGREFCNT" = "1"; then
6076     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6077 elif test -z "$_ENABLE_LOGREFCNT"; then
6078     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6081 dnl ========================================================
6082 dnl = Use malloc wrapper lib
6083 dnl ========================================================
6084 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
6085 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
6086     _WRAP_MALLOC=1,
6087     _WRAP_MALLOC= )
6089 if test -n "$_WRAP_MALLOC"; then
6090     if test "$GNU_CC"; then
6091     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"
6092     MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) -o $@'
6093     fi
6096 dnl ========================================================
6097 dnl = Location of malloc wrapper lib
6098 dnl ========================================================
6099 MOZ_ARG_WITH_STRING(wrap-malloc,
6100 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
6101     WRAP_MALLOC_LIB=$withval)
6103 dnl ========================================================
6104 dnl = Use Electric Fence
6105 dnl ========================================================
6106 MOZ_ARG_ENABLE_BOOL(efence,
6107 [  --enable-efence         Link with Electric Fence],
6108     _ENABLE_EFENCE=1,
6109     _ENABLE_EFENCE= )
6110 if test -n "$_ENABLE_EFENCE"; then
6111     AC_CHECK_LIB(efence,malloc)
6114 dnl ========================================================
6115 dnl jprof
6116 dnl ========================================================
6117 MOZ_ARG_ENABLE_BOOL(jprof,
6118 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof)],
6119     MOZ_JPROF=1,
6120     MOZ_JPROF= )
6121 if test -n "$MOZ_JPROF"; then
6122     AC_DEFINE(MOZ_JPROF)
6126 dnl ========================================================
6127 dnl = Enable stripping of libs & executables
6128 dnl ========================================================
6129 MOZ_ARG_ENABLE_BOOL(strip,
6130 [  --enable-strip          Enable stripping of libs & executables ],
6131     ENABLE_STRIP=1,
6132     ENABLE_STRIP= )
6134 dnl ========================================================
6135 dnl = Enable stripping of libs & executables when packaging
6136 dnl ========================================================
6137 MOZ_ARG_ENABLE_BOOL(install-strip,
6138 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
6139     PKG_SKIP_STRIP= ,
6140     PKG_SKIP_STRIP=1)
6142 dnl ========================================================
6143 dnl = --enable-elf-dynstr-gc
6144 dnl ========================================================
6145 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
6146 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
6147     USE_ELF_DYNSTR_GC=1,
6148     USE_ELF_DYNSTR_GC= )
6150 dnl ========================================================
6151 dnl = --enable-old-abi-compat-wrappers
6152 dnl ========================================================
6153 dnl on x86 linux, the current builds of some popular plugins (notably
6154 dnl flashplayer and real) expect a few builtin symbols from libgcc
6155 dnl which were available in some older versions of gcc.  However,
6156 dnl they're _NOT_ available in newer versions of gcc (eg 3.1), so if
6157 dnl we want those plugin to work with a gcc-3.1 built binary, we need
6158 dnl to provide these symbols.  MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS defaults
6159 dnl to true on x86 linux, and false everywhere else.
6162 MOZ_ARG_ENABLE_BOOL(old-abi-compat-wrappers,
6163 [  --enable-old-abi-compat-wrappers
6164                           Support old GCC ABI symbols to ease the pain 
6165                           of the linux compiler change],
6166     MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1,
6167     MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS= )
6168 if test "$COMPILE_ENVIRONMENT"; then
6169 if test "$MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS"; then
6170     AC_LANG_SAVE
6171     AC_LANG_CPLUSPLUS
6172     AC_CHECK_FUNCS(__builtin_vec_new __builtin_vec_delete __builtin_new __builtin_delete __pure_virtual)
6173     AC_LANG_RESTORE
6174     AC_DEFINE(MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS)
6176 fi # COMPILE_ENVIRONMENT
6178 dnl ========================================================
6179 dnl = --enable-prebinding
6180 dnl ========================================================
6181 MOZ_ARG_ENABLE_BOOL(prebinding,
6182 [  --enable-prebinding     Enable prebinding (Mac OS X only)],
6183     USE_PREBINDING=1,
6184     USE_PREBINDING= )
6186 dnl ========================================================
6187 dnl = 
6188 dnl = Profiling and Instrumenting
6189 dnl = 
6190 dnl ========================================================
6191 MOZ_ARG_HEADER(Profiling and Instrumenting)
6193 dnl ========================================================
6194 dnl = Enable timeline service, which provides lightweight
6195 dnl = instrumentation of mozilla for performance measurement.
6196 dnl = Timeline is off by default.
6197 dnl ========================================================
6198 MOZ_ARG_ENABLE_BOOL(timeline,
6199 [  --enable-timeline       Enable timeline services ],
6200     MOZ_TIMELINE=1,
6201     MOZ_TIMELINE= )
6202 if test -n "$MOZ_TIMELINE"; then
6203     AC_DEFINE(MOZ_TIMELINE)
6206 dnl ========================================================
6207 dnl Turn on reflow counting
6208 dnl ========================================================
6209 MOZ_ARG_ENABLE_BOOL(reflow-perf,
6210 [  --enable-reflow-perf    Enable reflow performance tracing],
6211     MOZ_REFLOW_PERF=1,
6212     MOZ_REFLOW_PERF= )
6213 if test -n "$MOZ_REFLOW_PREF"; then
6214     AC_DEFINE(MOZ_REFLOW_PREF)
6216 AC_SUBST(MOZ_REFLOW_PERF)
6218 dnl ========================================================
6219 dnl Enable performance metrics.
6220 dnl ========================================================
6221 MOZ_ARG_ENABLE_BOOL(perf-metrics,
6222 [  --enable-perf-metrics   Enable performance metrics],
6223     MOZ_PERF_METRICS=1,
6224     MOZ_PERF_METRICS= )
6225 if test -n "$MOZ_PERF_METRICS"; then
6226     AC_DEFINE(MOZ_PERF_METRICS)
6229 dnl ========================================================
6230 dnl Enable code size metrics.
6231 dnl ========================================================
6232 MOZ_ARG_ENABLE_BOOL(codesighs,
6233 [  --enable-codesighs      Enable code size analysis tools],
6234     _ENABLE_CODESIGHS=1,
6235     _ENABLE_CODESIGHS= )
6236 if test -n "$_ENABLE_CODESIGHS"; then
6237     if test -d $srcdir/tools/codesighs; then 
6238         MOZ_MAPINFO=1
6239     else
6240         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
6241     fi
6244 dnl ========================================================
6245 dnl = Enable trace malloc
6246 dnl ========================================================
6247 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6248 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6249 [  --enable-trace-malloc   Enable malloc tracing],
6250     NS_TRACE_MALLOC=1,
6251     NS_TRACE_MALLOC= )
6252 if test "$NS_TRACE_MALLOC"; then
6253   # Please, Mr. Linker Man, don't take away our symbol names
6254   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6255   USE_ELF_DYNSTR_GC=
6256   AC_DEFINE(NS_TRACE_MALLOC)
6258 AC_SUBST(NS_TRACE_MALLOC)
6260 dnl ========================================================
6261 dnl = Add support for Eazel profiler
6262 dnl ========================================================
6263 MOZ_ARG_ENABLE_BOOL(eazel-profiler-support,
6264 [  --enable-eazel-profiler-support
6265                           Enable Corel/Eazel profiler support],
6266     ENABLE_EAZEL_PROFILER=1,
6267     ENABLE_EAZEL_PROFILER= )
6268 if test -n "$ENABLE_EAZEL_PROFILER"; then
6269     AC_DEFINE(ENABLE_EAZEL_PROFILER)
6270     USE_ELF_DYNSTR_GC=
6271     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6272     EAZEL_PROFILER_CFLAGS="-g -O -gdwarf-2 -finstrument-functions -D__NO_STRING_INLINES  -D__NO_MATH_INLINES"
6273     EAZEL_PROFILER_LIBS="-lprofiler -lpthread"
6276 MOZ_ARG_ENABLE_STRING(profile-modules,
6277 [  --enable-profile-modules
6278                           Enable/disable profiling for specific modules],
6279 [ MOZ_PROFILE_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
6281 MOZ_ARG_ENABLE_BOOL(insure,
6282 [  --enable-insure         Enable insure++ instrumentation (linux only)],
6283     _ENABLE_INSURE=1,
6284     _ENABLE_INSURE= )
6285 if test -n "$_ENABLE_INSURE"; then
6286     MOZ_INSURE="insure"
6287     MOZ_INSURIFYING=1
6288     MOZ_INSURE_DIRS="."
6289     MOZ_INSURE_EXCLUDE_DIRS="config"
6292 MOZ_ARG_WITH_STRING(insure-dirs,
6293 [  --with-insure-dirs=DIRS
6294                           Dirs to instrument with insure ],
6295     MOZ_INSURE_DIRS=$withval )
6297 MOZ_ARG_WITH_STRING(insure-exclude-dirs,
6298 [  --with-insure-exclude-dirs=DIRS
6299                           Dirs to not instrument with insure ],
6300     MOZ_INSURE_EXCLUDE_DIRS="config $withval" )
6302 dnl ========================================================
6303 dnl = Support for Quantify (Windows)
6304 dnl ========================================================
6305 MOZ_ARG_ENABLE_BOOL(quantify,
6306 [  --enable-quantify      Enable Quantify support (Windows only) ],
6307     MOZ_QUANTIFY=1,
6308     MOZ_QUANTIFY= )
6310 dnl ========================================================
6311 dnl = Support for demangling undefined symbols
6312 dnl ========================================================
6313 if test -z "$SKIP_LIBRARY_CHECKS"; then
6314     AC_LANG_SAVE
6315     AC_LANG_CPLUSPLUS
6316     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
6317     AC_LANG_RESTORE
6320 # Demangle only for debug or trace-malloc builds
6321 MOZ_DEMANGLE_SYMBOLS=
6322 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
6323     MOZ_DEMANGLE_SYMBOLS=1
6324     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
6326 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
6328 dnl ========================================================
6329 dnl = Support for gcc stack unwinding (from gcc 3.3)
6330 dnl ========================================================
6331 if test "$HAVE_GCC3_ABI" && test -z "$SKIP_LIBRARY_CHECKS"; then
6332     AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
6335 dnl ========================================================
6336 dnl =
6337 dnl = Misc. Options
6338 dnl = 
6339 dnl ========================================================
6340 MOZ_ARG_HEADER(Misc. Options)
6342 dnl ========================================================
6343 dnl update xterm title
6344 dnl ========================================================
6345 MOZ_ARG_ENABLE_BOOL(xterm-updates,
6346 [  --enable-xterm-updates  Update XTERM titles with current command.],
6347     MOZ_UPDATE_XTERM=1,
6348     MOZ_UPDATE_XTERM= )
6350 dnl =========================================================
6351 dnl = Chrome format
6352 dnl =========================================================
6353 MOZ_ARG_ENABLE_STRING([chrome-format],
6354 [  --enable-chrome-format=jar|flat|both|symlink
6355                           Select FORMAT of chrome files (default=jar)],
6356     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
6358 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
6359     MOZ_CHROME_FILE_FORMAT=jar
6362 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" && 
6363     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
6364     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
6365     test "$MOZ_CHROME_FILE_FORMAT" != "both"; then
6366     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, or symlink])
6369 dnl ========================================================
6370 dnl = Define default location for MOZILLA_FIVE_HOME
6371 dnl ========================================================
6372 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
6373 [  --with-default-mozilla-five-home
6374                           Set the default value for MOZILLA_FIVE_HOME],
6375 [ val=`echo $withval`
6376   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
6378 dnl ========================================================
6379 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
6380 dnl ========================================================
6381 MOZ_ARG_WITH_STRING(user-appdir,
6382 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
6383 [ val=`echo $withval`
6384 if echo "$val" | grep "\/" >/dev/null; then
6385     AC_MSG_ERROR("Homedir must be single relative path.")
6386 else 
6387     MOZ_USER_DIR="$val"
6388 fi])
6390 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
6392 dnl ========================================================
6393 dnl = Doxygen configuration
6394 dnl ========================================================
6395 dnl Use commas to specify multiple dirs to this arg
6396 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
6397 MOZ_ARG_WITH_STRING(doc-input-dirs,
6398 [  --with-doc-input-dirs=DIRS
6399                           Header/idl dirs to create docs from],
6400 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
6401 AC_SUBST(MOZ_DOC_INPUT_DIRS)
6403 dnl Use commas to specify multiple dirs to this arg
6404 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
6405 MOZ_ARG_WITH_STRING(doc-include-dirs,
6406 [  --with-doc-include-dirs=DIRS  
6407                           Include dirs to preprocess doc headers],
6408 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
6409 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
6411 MOZ_DOC_OUTPUT_DIR='./dist/docs'
6412 MOZ_ARG_WITH_STRING(doc-output-dir,
6413 [  --with-doc-output-dir=DIR
6414                           Dir to generate docs into],
6415 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
6416 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
6418 if test -z "$SKIP_COMPILER_CHECKS"; then
6419 dnl ========================================================
6420 dnl =
6421 dnl = Compiler Options
6422 dnl = 
6423 dnl ========================================================
6424 MOZ_ARG_HEADER(Compiler Options)
6426 dnl ========================================================
6427 dnl Check for gcc -pipe support
6428 dnl ========================================================
6429 AC_MSG_CHECKING([for gcc -pipe support])
6430 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
6431     echo '#include <stdio.h>' > dummy-hello.c
6432     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
6433     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
6434     cat dummy-hello.s | ${AS_BIN} -o dummy-hello.S - 2>&5
6435     if test $? = 0; then
6436         _res_as_stdin="yes"
6437     else
6438         _res_as_stdin="no"
6439     fi
6440     if test "$_res_as_stdin" = "yes"; then
6441         _SAVE_CFLAGS=$CFLAGS
6442         CFLAGS="$CFLAGS -pipe"
6443         AC_TRY_COMPILE( [ #include <stdio.h> ],
6444             [printf("Hello World\n");],
6445             [_res_gcc_pipe="yes"],
6446             [_res_gcc_pipe="no"] )
6447         CFLAGS=$_SAVE_CFLAGS
6448     fi
6449     if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
6450         _res="yes";
6451         CFLAGS="$CFLAGS -pipe"
6452         CXXFLAGS="$CXXFLAGS -pipe"
6453     else
6454         _res="no"
6455     fi
6456     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
6457     AC_MSG_RESULT([$_res])
6458 else
6459     AC_MSG_RESULT([no])
6462 dnl pass -Wno-long-long to the compiler
6463 MOZ_ARG_ENABLE_BOOL(long-long-warning,
6464 [  --enable-long-long-warning 
6465                           Warn about use of non-ANSI long long type],
6466     _IGNORE_LONG_LONG_WARNINGS=,
6467     _IGNORE_LONG_LONG_WARNINGS=1)
6469 if test "$_IGNORE_LONG_LONG_WARNINGS"; then
6470      _SAVE_CFLAGS="$CFLAGS"
6471      CFLAGS="$CFLAGS ${_COMPILER_PREFIX}-Wno-long-long"
6472      AC_MSG_CHECKING([whether compiler supports -Wno-long-long])
6473      AC_TRY_COMPILE([], [return(0);], 
6474         [ _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
6475           _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
6476           result="yes" ], result="no")
6477      AC_MSG_RESULT([$result])
6478      CFLAGS="$_SAVE_CFLAGS"
6481 dnl Test for profiling options
6482 dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities
6483 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
6485 _SAVE_CFLAGS="$CFLAGS"
6486 CFLAGS="$CFLAGS -fprofile-generate"
6488 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
6489 AC_TRY_COMPILE([], [return 0;],
6490                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
6491                  result="yes" ], result="no")
6492 AC_MSG_RESULT([$result])
6494 if test $result = "yes"; then
6495   PROFILE_USE_CFLAGS="-fprofile-use"
6496 else
6497   CFLAGS="$_SAVE_CFLAGS -fprofile-arcs"
6498   AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs])
6499   AC_TRY_COMPILE([], [return 0;],
6500                  [ PROFILE_GEN_CFLAGS="-fprofile-arcs"
6501                    result="yes" ], result="no")
6502   AC_MSG_RESULT([$result])
6503   if test $result = "yes"; then
6504     PROFILE_USE_CFLAGS="-fbranch-probabilities"
6505   fi
6508 CFLAGS="$_SAVE_CFLAGS"
6510 AC_SUBST(PROFILE_GEN_CFLAGS)
6511 AC_SUBST(PROFILE_USE_CFLAGS)
6513 AC_LANG_CPLUSPLUS
6515 dnl ========================================================
6516 dnl Test for -pedantic bustage
6517 dnl ========================================================
6518 MOZ_ARG_DISABLE_BOOL(pedantic,
6519 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
6520 _PEDANTIC= )
6521 if test "$_PEDANTIC"; then
6522     _SAVE_CXXFLAGS=$CXXFLAGS
6523     CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
6524     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
6525     AC_TRY_COMPILE([$configure_static_assert_macros],
6526                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
6527                    result="no", result="yes" )
6528     AC_MSG_RESULT([$result])
6529     CXXFLAGS="$_SAVE_CXXFLAGS"
6531     case "$result" in
6532     no)
6533         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic"
6534         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
6535         ;;
6536     yes)
6537         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
6538         ;;
6539     esac
6542 dnl ========================================================
6543 dnl Test for correct temporary object destruction order
6544 dnl ========================================================
6545 dnl We want to make sure the compiler follows the C++ spec here as 
6546 dnl xpcom and the string classes depend on it (bug 235381).
6547 AC_MSG_CHECKING([for correct temporary object destruction order])
6548 AC_TRY_RUN([ class A {
6549              public:  A(int& x) : mValue(x) {}
6550                       ~A() { mValue--; }
6551                       operator char**() { return 0; }
6552              private:  int& mValue;
6553              };
6554              void func(char **arg) {}
6555              int m=2;
6556              void test() {
6557                   func(A(m));
6558                   if (m==1) m = 0;
6559              }
6560              int main() {
6561                  test();
6562                  return(m);
6563              }
6564              ],
6565      result="yes", result="no", result="maybe")
6566 AC_MSG_RESULT([$result])
6568 if test "$result" = "no"; then
6569     AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
6572 dnl ========================================================
6573 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
6574 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
6575 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
6576 dnl ========================================================
6577 _SAVE_CXXFLAGS=$CXXFLAGS
6578 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
6579 AC_CACHE_CHECK(for correct overload resolution with const and templates,
6580     ac_nscap_nonconst_opeq_bug,
6581     [AC_TRY_COMPILE([
6582                       template <class T>
6583                       class Pointer
6584                         {
6585                         public:
6586                           T* myPtr;
6587                         };
6588                       
6589                       template <class T, class U>
6590                       int operator==(const Pointer<T>& rhs, U* lhs)
6591                         {
6592                           return rhs.myPtr == lhs;
6593                         }
6594                       
6595                       template <class T, class U>
6596                       int operator==(const Pointer<T>& rhs, const U* lhs)
6597                         {
6598                           return rhs.myPtr == lhs;
6599                         }
6600                     ],
6601                     [
6602                       Pointer<int> foo;
6603                       const int* bar;
6604                       return foo == bar;
6605                     ],
6606                     ac_nscap_nonconst_opeq_bug="no",
6607                     ac_nscap_nonconst_opeq_bug="yes")])
6608 CXXFLAGS="$_SAVE_CXXFLAGS"
6610 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
6611     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
6613 fi # SKIP_COMPILER_CHECKS
6615 dnl ========================================================
6616 dnl C++ rtti
6617 dnl Should be smarter and check that the compiler does indeed have rtti
6618 dnl ========================================================
6619 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
6620 [  --enable-cpp-rtti       Enable C++ RTTI ],
6621 [ _MOZ_USE_RTTI=1 ],
6622 [ _MOZ_USE_RTTI= ])
6624 if test "$_MOZ_USE_RTTI"; then
6625    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
6626 else
6627    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
6630 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
6632 dnl ========================================================
6633 dnl C++ exceptions (g++/egcs only - for now)
6634 dnl Should be smarter and check that the compiler does indeed have exceptions
6635 dnl ========================================================
6636 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
6637 [  --enable-cpp-exceptions Enable C++ exceptions ],
6638 [ _MOZ_CPP_EXCEPTIONS=1 ],
6639 [ _MOZ_CPP_EXCEPTIONS= ])
6641 if test "$_MOZ_CPP_EXCEPTIONS"; then
6642     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
6643 else
6644     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
6647 # Irix & OSF native compilers do not like exception declarations 
6648 # when exceptions are disabled
6649 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
6650     AC_DEFINE(CPP_THROW_NEW, [])
6651 else
6652     AC_DEFINE(CPP_THROW_NEW, [throw()])
6654 AC_LANG_C
6656 dnl ========================================================
6657 dnl =
6658 dnl = Build depencency options
6659 dnl =
6660 dnl ========================================================
6661 MOZ_ARG_HEADER(Build dependencies)
6663 dnl ========================================================
6664 dnl = Do not auto generate dependency info
6665 dnl ========================================================
6666 MOZ_AUTO_DEPS=1
6667 MOZ_ARG_DISABLE_BOOL(auto-deps,
6668 [  --disable-auto-deps     Do not automatically generate dependency info],
6669     MOZ_AUTO_DEPS=,
6670     MOZ_AUTO_DEPS=1)
6672 if test -n "$MOZ_AUTO_DEPS"; then
6673 dnl ========================================================
6674 dnl = Use mkdepend instead of $CC -MD for dependency generation
6675 dnl ========================================================
6676 _cpp_md_flag=
6677 MOZ_ARG_DISABLE_BOOL(md,
6678 [  --disable-md            Do not use compiler-based dependencies ],
6679   [_cpp_md_flag=],
6680   [_cpp_md_flag=1],
6681   [dnl Default is to turn on -MD if using GNU-compatible compilers
6682    if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
6683      _cpp_md_flag=1
6684    fi
6685   dnl Default is to use -xM if using Sun Studio on Solaris
6686    if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
6687      _cpp_md_flag=1
6688    fi])
6689 if test "$_cpp_md_flag"; then
6690   COMPILER_DEPEND=1
6691   if test "$OS_ARCH" = "OpenVMS"; then
6692     _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(*F).pp))'
6693   else
6694     _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(*F).pp)'
6695   fi
6696   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
6697   if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
6698     _DEPEND_CFLAGS=
6699   fi
6700 else
6701   COMPILER_DEPEND=
6702   _USE_CPP_INCLUDE_FLAG=
6703   _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
6704   _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
6706 fi # MOZ_AUTO_DEPS
6707 MDDEPDIR='.deps'
6708 AC_SUBST(MOZ_AUTO_DEPS)
6709 AC_SUBST(COMPILER_DEPEND)
6710 AC_SUBST(MDDEPDIR)
6713 dnl ========================================================
6714 dnl =
6715 dnl = Static Build Options
6716 dnl =
6717 dnl ========================================================
6718 MOZ_ARG_HEADER(Static build options)
6720 MOZ_ARG_ENABLE_BOOL(static,
6721 [  --enable-static         Enable building of internal static libs],
6722     BUILD_STATIC_LIBS=1,
6723     BUILD_STATIC_LIBS=)
6725 dnl Disable libxul in debug builds, but not for xulrunner.
6726 if test -n "$MOZ_DEBUG" -a "$MOZ_BUILD_APP" != "xulrunner"; then
6727    MOZ_ENABLE_LIBXUL=
6730 MOZ_ARG_ENABLE_BOOL(libxul,
6731 [  --enable-libxul         Enable building of libxul],
6732     MOZ_ENABLE_LIBXUL=1,
6733     MOZ_ENABLE_LIBXUL=)
6735 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
6736         AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
6739 if test -n "$MOZ_ENABLE_LIBXUL" -a -z "$MOZ_XUL_APP"; then
6740         AC_MSG_ERROR([--enable-libxul is only compatible with toolkit XUL applications.])
6743 if test -n "$MOZ_ENABLE_LIBXUL"; then
6744     XPCOM_LIBS="$LIBXUL_LIBS"
6745     AC_DEFINE(MOZ_ENABLE_LIBXUL)
6746 else
6747     if test -n "$BUILD_STATIC_LIBS"; then
6748         AC_DEFINE(MOZ_STATIC_BUILD)
6749     fi
6750     XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
6753 dnl ========================================================
6754 dnl = Force JS to be a static lib
6755 dnl ========================================================
6756 MOZ_ARG_ENABLE_BOOL(js-static-build,
6757 [  --enable-js-static-build  Force js to be a static lib],
6758     JS_STATIC_BUILD=1,
6759     JS_STATIC_BUILD= )
6761 AC_SUBST(JS_STATIC_BUILD)
6762         
6763 if test -n "$JS_STATIC_BUILD"; then
6764     AC_DEFINE(EXPORT_JS_API)
6766 if test -z "$BUILD_STATIC_LIBS"; then
6767     AC_MSG_ERROR([--enable-js-static-build is only compatible with --enable-static])
6772 dnl ========================================================
6773 dnl =
6774 dnl = Standalone module options
6775 dnl = 
6776 dnl ========================================================
6777 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
6779 dnl Check for GLib and libIDL.
6780 dnl ========================================================
6781 case "$target_os" in
6782 msvc*|mks*|cygwin*|mingw*|wince*)
6783     SKIP_IDL_CHECK="yes"
6784     ;;
6786     SKIP_IDL_CHECK="no"
6787     ;;
6788 esac
6790 if test -z "$COMPILE_ENVIRONMENT"; then
6791     SKIP_IDL_CHECK="yes"
6794 dnl = Allow users to disable libIDL checking for standalone modules
6795 MOZ_ARG_WITHOUT_BOOL(libIDL,
6796 [  --without-libIDL        Skip check for libIDL (standalone modules only)],
6797         SKIP_IDL_CHECK="yes")
6799 if test "$SKIP_IDL_CHECK" = "no"
6800 then
6801     _LIBIDL_FOUND=
6802     if test "$MACOS_SDK_DIR"; then 
6803       dnl xpidl, and therefore libIDL, is only needed on the build host.
6804       dnl Don't build it against the SDK, as that causes problems.
6805       _MACSAVE_CFLAGS="$CFLAGS"
6806       _MACSAVE_LIBS="$LIBS"
6807       _MACSAVE_LDFLAGS="$LDFLAGS"
6808       _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
6809       changequote(,)
6810       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"`
6811       LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
6812       LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
6813       changequote([,])
6814       unset NEXT_ROOT
6815     fi
6817     if test "$MOZ_ENABLE_GTK2"; then
6818         PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
6819     fi
6820     dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
6821     dnl to either libIDL1 or libIDL2.
6822     if test -z "$_LIBIDL_FOUND"; then
6823         AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
6824         if test -z "$_LIBIDL_FOUND"; then
6825             PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
6826         fi
6827     fi
6828     dnl
6829     dnl If we don't have a libIDL config program & not cross-compiling, 
6830     dnl     look for orbit-config instead.
6831     dnl
6832     if test -z "$_LIBIDL_FOUND" && test -z "$CROSS_COMPILE"; then
6833         AC_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
6834         if test -n "$ORBIT_CONFIG"; then
6835             AC_MSG_CHECKING([for ORBit libIDL usability])
6836                 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
6837             _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
6838             _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
6839             _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
6840             LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
6841             LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
6842             LIBIDL_CONFIG=
6843             _SAVE_CFLAGS="$CFLAGS"
6844             _SAVE_LIBS="$LIBS"
6845             CFLAGS="$LIBIDL_CFLAGS $CFLAGS"
6846             LIBS="$LIBIDL_LIBS $LIBS"
6847             AC_TRY_RUN([
6848 #include <stdlib.h>
6849 #include <libIDL/IDL.h>
6850 int main() {
6851   char *s;
6852   s=strdup(IDL_get_libver_string());
6853   if(s==NULL) {
6854     exit(1);
6855   }
6856   exit(0);
6858             ], [_LIBIDL_FOUND=1
6859                 result="yes"],
6860                [LIBIDL_CFLAGS=
6861                 LIBIDL_LIBS=
6862                 result="no"],
6863                [_LIBIDL_FOUND=1
6864                 result="maybe"] )
6865             AC_MSG_RESULT($result)
6866             CFLAGS="$_SAVE_CFLAGS"
6867             LIBS="$_SAVE_LIBS"
6868         fi
6869     fi
6870     if test -z "$_LIBIDL_FOUND"; then
6871         AC_MSG_ERROR([libIDL not found.
6872         libIDL $LIBIDL_VERSION or higher is required.])
6873     fi
6874     if test "$MACOS_SDK_DIR"; then
6875       CFLAGS="$_MACSAVE_CFLAGS"
6876       LIBS="$_MACSAVE_LIBS"
6877       LDFLAGS="$_MACSAVE_LDFLAGS"
6878       if test -n "$_MACSAVE_NEXT_ROOT" ; then
6879         export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
6880       fi
6881     fi
6884 if test -n "$CROSS_COMPILE"; then
6885      if test -z "$HOST_LIBIDL_CONFIG"; then
6886         HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
6887     fi
6888     if test -n "$HOST_LIBIDL_CONFIG" && test "$HOST_LIBIDL_CONFIG" != "no"; then
6889         HOST_LIBIDL_CFLAGS=`${HOST_LIBIDL_CONFIG} --cflags`
6890         HOST_LIBIDL_LIBS=`${HOST_LIBIDL_CONFIG} --libs`
6891     else
6892         HOST_LIBIDL_CFLAGS="$LIBIDL_CFLAGS"
6893         HOST_LIBIDL_LIBS="$LIBIDL_LIBS"
6894     fi
6897 if test -z "$SKIP_PATH_CHECKS"; then
6898 if test -z "${GLIB_CFLAGS}" || test -z "${GLIB_LIBS}" ; then
6899     if test "$MOZ_ENABLE_GTK2"; then
6900         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
6901     else
6902         AM_PATH_GLIB(${GLIB_VERSION})
6903     fi
6907 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
6908     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
6911 AC_SUBST(LIBIDL_CFLAGS)
6912 AC_SUBST(LIBIDL_LIBS)
6913 AC_SUBST(STATIC_LIBIDL)
6914 AC_SUBST(GLIB_CFLAGS)
6915 AC_SUBST(GLIB_LIBS)
6916 AC_SUBST(GLIB_GMODULE_LIBS)
6917 AC_SUBST(HOST_LIBIDL_CONFIG)
6918 AC_SUBST(HOST_LIBIDL_CFLAGS)
6919 AC_SUBST(HOST_LIBIDL_LIBS)
6921 dnl ========================================================
6922 dnl Check for libart
6923 dnl ========================================================
6924 if test "$MOZ_SVG_RENDERER_LIBART"; then
6925   if test ! -f $topsrcdir/other-licenses/libart_lgpl/Makefile.in; then
6926     AC_MSG_ERROR([You must check out the mozilla version of libart. Use
6927 mk_add_options MOZ_CO_MODULE=mozilla/other-licenses/libart_lgpl])
6928   fi
6930   dnl libart's configure hasn't been run yet, but we know what the
6931   dnl answer should be anyway
6932   MOZ_LIBART_CFLAGS='-I${DIST}/include/libart_lgpl'
6933   case "$target_os" in
6934   msvc*|mks*|cygwin*|mingw*|wince*)
6935       MOZ_LIBART_LIBS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)moz_art_lgpl.$(IMPORT_LIB_SUFFIX)' 
6936       ;;
6937   os2*)
6938       MOZ_LIBART_LIBS='-lmoz_art -lm'
6939       ;;
6940   beos*)
6941       MOZ_LIBART_LIBS='-lmoz_art_lgpl -lroot -lbe'
6942       ;;
6943   *)
6944       MOZ_LIBART_LIBS='-lmoz_art_lgpl -lm'
6945       ;;
6946   esac
6947   AC_FUNC_ALLOCA
6950 AC_SUBST(MOZ_LIBART_CFLAGS)
6951 AC_SUBST(MOZ_LIBART_LIBS)
6953 dnl ========================================================
6954 dnl Check for cairo
6955 dnl ========================================================
6956 if test "$MOZ_SVG" -o "$MOZ_ENABLE_CANVAS" -o "$MOZ_ENABLE_CAIRO_GFX" ; then
6957    MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
6959    MOZ_TREE_CAIRO=1
6960    MOZ_ARG_ENABLE_BOOL(system-cairo,
6961    [ --enable-system-cairo Use system cairo (located with pkgconfig)],
6962    MOZ_TREE_CAIRO=,
6963    MOZ_TREE_CAIRO=1 )
6965    # Check for headers defining standard int types.
6966    AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
6968    if test "$MOZ_TREE_CAIRO"; then
6969        # For now we assume that we will have a uint64_t available through
6970        # one of the above headers or mozstdint.h.
6971        AC_DEFINE(HAVE_UINT64_T)
6973        # Define macros for cairo-features.h
6974        if test "$MOZ_X11"; then
6975            XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
6976            XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
6977            PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
6978            PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
6979            FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6980            MOZ_ENABLE_CAIRO_FT=1
6981            CAIRO_FT_CFLAGS="$FT2_CFLAGS"
6982        fi
6983        if test "$MOZ_WIDGET_TOOLKIT" = "mac" -o "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
6984            QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
6985            ATSUI_FONT_FEATURE="#define CAIRO_HAS_ATSUI_FONT 1"
6986        fi
6987        if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
6988            WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
6989            WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
6990            PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
6991        fi
6992        if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
6993            OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
6994            FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6995            PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
6996            MOZ_ENABLE_CAIRO_FT=1
6997            CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
6998            CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
6999        fi
7000        if test "$MOZ_ENABLE_GLITZ"; then
7001            GLITZ_SURFACE_FEATURE="#define CAIRO_HAS_GLITZ_SURFACE 1"
7002        fi
7003        if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
7004            PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
7005            BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
7006            FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7007            MOZ_ENABLE_CAIRO_FT=1
7008        fi
7009        AC_SUBST(MOZ_ENABLE_CAIRO_FT)
7010        AC_SUBST(CAIRO_FT_CFLAGS)
7012        if test "$MOZ_DEBUG"; then
7013          SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
7014        else
7015          SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
7016        fi
7018        PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
7020        AC_SUBST(PS_SURFACE_FEATURE)
7021        AC_SUBST(PDF_SURFACE_FEATURE)
7022        AC_SUBST(SVG_SURFACE_FEATURE)
7023        AC_SUBST(XLIB_SURFACE_FEATURE)
7024        AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
7025        AC_SUBST(QUARTZ_SURFACE_FEATURE)
7026        AC_SUBST(NQUARTZ_SURFACE_FEATURE)
7027        AC_SUBST(XCB_SURFACE_FEATURE)
7028        AC_SUBST(WIN32_SURFACE_FEATURE)
7029        AC_SUBST(OS2_SURFACE_FEATURE)
7030        AC_SUBST(BEOS_SURFACE_FEATURE)
7031        AC_SUBST(GLITZ_SURFACE_FEATURE)
7032        AC_SUBST(DIRECTFB_SURFACE_FEATURE)
7033        AC_SUBST(FT_FONT_FEATURE)
7034        AC_SUBST(WIN32_FONT_FEATURE)
7035        AC_SUBST(ATSUI_FONT_FEATURE)
7036        AC_SUBST(PNG_FUNCTIONS_FEATURE)
7038        if test "$_WIN32_MSVC"; then
7039            MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib'
7040            if test "$MOZ_ENABLE_GLITZ"; then
7041                MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'$(DEPTH)/gfx/cairo/glitz/src/mozglitz.lib $(DEPTH)/gfx/cairo/glitz/src/wgl/mozglitzwgl.lib'
7042            fi
7043        else
7044            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"
7046            if test "$MOZ_X11"; then
7047                MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
7048            fi
7050            if test "$MOZ_ENABLE_GLITZ"; then
7051                MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'-L$(DEPTH)/gfx/cairo/glitz/src -lmozglitz'
7052                if test "$MOZ_X11"; then
7053                    MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'-L$(DEPTH)/gfx/cairo/glitz/src/glx -lmozglitzglx -lGL'
7054                fi
7055                if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
7056                    MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'-L$(DEPTH)/gfx/cairo/glitz/src/wgl -lmozglitzwgl'
7057                fi
7058            fi
7059        fi
7060    else
7061       PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION freetype2 fontconfig)
7062       MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
7063       MOZ_CAIRO_LIBS=$CAIRO_LIBS
7064    fi
7067 AC_SUBST(MOZ_TREE_CAIRO)
7068 AC_SUBST(MOZ_CAIRO_CFLAGS)
7069 AC_SUBST(MOZ_CAIRO_LIBS)
7071 dnl ========================================================
7072 dnl Check for lcms
7073 dnl ========================================================
7075 MOZ_NATIVE_LCMS=
7076 MOZ_ARG_ENABLE_BOOL(system-lcms,
7077 [ --enable-system-lcms Use system lcms (located with pkgconfig)],
7078 MOZ_NATIVE_LCMS=1,
7079 MOZ_NATIVE_LCMS= )
7081 if test -z "$MOZ_NATIVE_LCMS"
7082 then
7083     LCMS_CFLAGS=
7084     if test "$_WIN32_MSVC"; then
7085         if test -z "$BUILD_STATIC_LIBS" -a -z "$MOZ_ENABLE_LIBXUL"; then
7086             LCMS_CFLAGS=-DLCMS_DLL
7087         fi
7088         LCMS_LIBS='$(LIBXUL_DIST)/lib/mozlcms.lib'
7089     else
7090         LCMS_LIBS='-L$(LIBXUL_DIST)/bin -lmozlcms'
7091     fi
7092 else
7093     PKG_CHECK_MODULES(LCMS, lcms >= $LCMS_VERSION)
7096 AC_SUBST(MOZ_NATIVE_LCMS)
7097 AC_SUBST(LCMS_CFLAGS)
7098 AC_SUBST(LCMS_LIBS)
7100 dnl ========================================================
7101 dnl disable xul
7102 dnl ========================================================
7103 MOZ_ARG_DISABLE_BOOL(xul,
7104 [  --disable-xul           Disable XUL],
7105     MOZ_XUL= )
7106 if test "$MOZ_XUL"; then
7107   AC_DEFINE(MOZ_XUL)
7108 else
7109   dnl remove extensions that require XUL
7110   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
7113 AC_SUBST(MOZ_XUL)
7115 dnl ========================================================
7116 dnl Two ways to enable Python support:
7117 dnl   --enable-extensions=python # select all available.
7118 dnl    (MOZ_PYTHON_EXTENSIONS contains the list of extensions)
7119 dnl or:
7120 dnl   --enable-extensions=python/xpcom,... # select individual ones
7122 dnl If either is used, we locate the Python to use.
7123 dnl ========================================================
7125 dnl If 'python' appears anywhere in the extensions list, go lookin'...
7126 if test `echo "$MOZ_EXTENSIONS" | grep -c python` -ne 0; then
7127     dnl Allow PYTHON to point to the Python interpreter to use
7128     dnl (note that it must be the python executable - which we
7129     dnl run to locate the relevant paths etc)
7130     dnl If not set, we use whatever Python we can find.
7131     MOZ_PYTHON=$PYTHON
7132     dnl Ask Python what its version number is
7133     changequote(,)
7134     MOZ_PYTHON_VER=`$PYTHON -c "import sys;print '%d%d' % sys.version_info[0:2]"`
7135     MOZ_PYTHON_VER_DOTTED=`$PYTHON -c "import sys;print '%d.%d' % sys.version_info[0:2]"`
7136     changequote([,])
7137     dnl Ask for the Python "prefix" (ie, home/source dir)
7138     MOZ_PYTHON_PREFIX=`$PYTHON -c "import sys; print sys.prefix"`
7139     dnl Setup the include and library directories.
7140     if test "$OS_ARCH" = "WINNT"; then
7141         MOZ_PYTHON_PREFIX=`$CYGPATH_W $MOZ_PYTHON_PREFIX | $CYGPATH_S`
7142         dnl Source trees have "include" and "PC" for .h, and "PCbuild" for .lib
7143         dnl Binary trees have "include" for .h, and "libs" for .lib
7144         dnl We add 'em both - along with quotes, to handle spaces.
7145         MOZ_PYTHON_DLL_SUFFIX=.pyd
7146         MOZ_PYTHON_INCLUDES="\"-I$MOZ_PYTHON_PREFIX/include\" \"-I$MOZ_PYTHON_PREFIX/PC\""
7147         MOZ_PYTHON_LIBS="\"/libpath:$MOZ_PYTHON_PREFIX/PCBuild\" \"/libpath:$MOZ_PYTHON_PREFIX/libs\""
7148     else
7149         dnl Non-Windows include and libs
7150         MOZ_PYTHON_DLL_SUFFIX=$DLL_SUFFIX
7151         MOZ_PYTHON_INCLUDES="-I$MOZ_PYTHON_PREFIX/include/python$MOZ_PYTHON_VER_DOTTED"
7152         dnl Check for dynamic Python lib
7153         dnl - A static Python is no good - multiple dynamic libraries (xpcom
7154         dnl - core, xpcom loader, pydom etc) all need to share Python.
7155         dnl - Python 2.3's std --enable-shared configure option will
7156         dnl   create a libpython2.3.so.1.0. We should first try this
7157         dnl   dotted versioned .so file because this is the one that
7158         dnl   the PyXPCOM build mechanics tries to link to.
7159         dnl   XXX Should find a better way than hardcoding "1.0".
7160         dnl - Python developement tree dir layouts are NOT allowed here
7161         dnl   because the PyXPCOM build just dies on it later anyway.
7162         dnl - Fixes to the above by Python/*nix knowledgable people welcome!
7163         if test -f "$MOZ_PYTHON_PREFIX/lib/libpython$MOZ_PYTHON_VER_DOTTED.so.1.0"; then
7164             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib -lpython$MOZ_PYTHON_VER_DOTTED"
7165         elif test -f "$MOZ_PYTHON_PREFIX/lib/libpython$MOZ_PYTHON_VER_DOTTED.so"; then
7166             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib -lpython$MOZ_PYTHON_VER_DOTTED"
7167         elif test -f "$MOZ_PYTHON_PREFIX/libpython$MOZ_PYTHON_VER_DOTTED.so"; then
7168             dnl Don't Python development tree directory layout.
7169             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX -lpython$MOZ_PYTHON_VER_DOTTED"
7170             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.])
7171         elif test "$OS_ARCH" = "Darwin"; then
7172             dnl We do Darwin last, so if a custom non-framework build of
7173             dnl python is used on OSX, then it will be picked up first by
7174             dnl the logic above.
7175             MOZ_PYTHON_LIBS="-framework Python"
7176         else
7177             AC_MSG_ERROR([Could not find build shared libraries for Python at $MOZ_PYTHON_PREFIX.  This is required for PyXPCOM.])
7178         fi
7179         if test "$OS_ARCH" = "Linux"; then
7180             MOZ_PYTHON_LIBS="$MOZ_PYTHON_LIBS -lutil"
7181         fi
7182     fi
7183     dnl Handle "_d" on Windows
7184     if test "$OS_ARCH" = "WINNT" && test -n "$MOZ_DEBUG"; then
7185         MOZ_PYTHON_DEBUG_SUFFIX="_d"
7186     else
7187         MOZ_PYTHON_DEBUG_SUFFIX=
7188     fi
7189     AC_MSG_RESULT(Building Python extensions using python-$MOZ_PYTHON_VER_DOTTED from $MOZ_PYTHON_PREFIX)
7192 dnl If the user asks for the 'python' extension, then we add
7193 dnl MOZ_PYTHON_EXTENSIONS to MOZ_EXTENSIONS - but with the leading 'python/'
7194 dnl Note the careful regex - it must match 'python' followed by anything
7195 dnl other than a '/', including the end-of-string.
7196 if test `echo "$MOZ_EXTENSIONS" | grep -c 'python\([[^/]]\|$\)'` -ne 0; then
7197     for pyext in $MOZ_PYTHON_EXTENSIONS; do
7198         MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS python/$pyext`
7199     done
7201 dnl Later we may allow MOZ_PYTHON_EXTENSIONS to be specified on the
7202 dnl command-line, but not yet
7203 AC_SUBST(MOZ_PYTHON_EXTENSIONS)
7204 AC_SUBST(MOZ_PYTHON)
7205 AC_SUBST(MOZ_PYTHON_PREFIX)
7206 AC_SUBST(MOZ_PYTHON_INCLUDES)
7207 AC_SUBST(MOZ_PYTHON_LIBS)
7208 AC_SUBST(MOZ_PYTHON_VER)
7209 AC_SUBST(MOZ_PYTHON_VER_DOTTED)
7210 AC_SUBST(MOZ_PYTHON_DEBUG_SUFFIX)
7211 AC_SUBST(MOZ_PYTHON_DLL_SUFFIX)
7213 dnl ========================================================
7214 dnl disable profile sharing
7215 dnl ========================================================
7216 MOZ_ARG_DISABLE_BOOL(profilesharing,
7217 [  --disable-profilesharing           Disable profile sharing],
7218     MOZ_PROFILESHARING=,
7219     MOZ_PROFILESHARING=1 )
7220 if test "$MOZ_PROFILESHARING"; then
7221   MOZ_IPCD=1
7222   AC_DEFINE(MOZ_PROFILESHARING)
7225 dnl ========================================================
7226 dnl enable ipc/ipcd
7227 dnl ========================================================
7228 MOZ_ARG_ENABLE_BOOL(ipcd,
7229 [  --enable-ipcd                      Enable IPC daemon],
7230     MOZ_IPCD=1,
7231     MOZ_IPCD= )
7233 dnl ========================================================
7234 dnl disable profile locking
7235 dnl   do no use this in applications that can have more than
7236 dnl   one process accessing the profile directory.
7237 dnl ========================================================
7238 MOZ_ARG_DISABLE_BOOL(profilelocking,
7239 [  --disable-profilelocking           Disable profile locking],
7240     MOZ_PROFILELOCKING=,
7241     MOZ_PROFILELOCKING=1 )
7242 if test "$MOZ_PROFILELOCKING"; then
7243   AC_DEFINE(MOZ_PROFILELOCKING)
7246 dnl ========================================================
7247 dnl disable rdf services
7248 dnl ========================================================
7249 MOZ_ARG_DISABLE_BOOL(rdf,
7250 [  --disable-rdf           Disable RDF],
7251     MOZ_RDF= )
7252 if test "$MOZ_RDF"; then
7253   AC_DEFINE(MOZ_RDF)
7256 AC_SUBST(MOZ_RDF)
7258 dnl ========================================================
7259 dnl necko configuration options
7260 dnl ========================================================
7263 dnl option to disable various necko protocols
7265 MOZ_ARG_ENABLE_STRING(necko-protocols,
7266 [  --enable-necko-protocols[={http,ftp,default,all,none}]
7267                           Enable/disable specific protocol handlers],
7268 [ for option in `echo $enableval | sed 's/,/ /g'`; do
7269     if test "$option" = "yes" || test "$option" = "all"; then
7270         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7271     elif test "$option" = "no" || test "$option" = "none"; then
7272         NECKO_PROTOCOLS=""
7273     elif test "$option" = "default"; then
7274         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7275     elif test `echo "$option" | grep -c \^-` != 0; then
7276         option=`echo $option | sed 's/^-//'`
7277         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
7278     else
7279         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
7280     fi
7281 done],
7282     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
7283 dnl Remove dupes
7284 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
7285 AC_SUBST(NECKO_PROTOCOLS)
7286 for p in $NECKO_PROTOCOLS; do
7287     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
7288 done
7291 dnl option to disable necko's disk cache
7293 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
7294 [  --disable-necko-disk-cache
7295                           Disable necko disk cache],
7296     NECKO_DISK_CACHE=,
7297     NECKO_DISK_CACHE=1)
7298 AC_SUBST(NECKO_DISK_CACHE)
7299 if test "$NECKO_DISK_CACHE"; then
7300     AC_DEFINE(NECKO_DISK_CACHE)
7304 dnl option to minimize size of necko's i/o buffers
7306 MOZ_ARG_ENABLE_BOOL(necko-small-buffers,
7307 [  --enable-necko-small-buffers
7308                           Minimize size of necko's i/o buffers],
7309     NECKO_SMALL_BUFFERS=1,
7310     NECKO_SMALL_BUFFERS=)
7311 AC_SUBST(NECKO_SMALL_BUFFERS)
7312 if test "$NECKO_SMALL_BUFFERS"; then
7313     AC_DEFINE(NECKO_SMALL_BUFFERS)
7314 fi 
7317 dnl option to disable cookies
7319 MOZ_ARG_DISABLE_BOOL(cookies,
7320 [  --disable-cookies       Disable cookie support],
7321     NECKO_COOKIES=,
7322     NECKO_COOKIES=1)
7323 AC_SUBST(NECKO_COOKIES)
7324 if test "$NECKO_COOKIES"; then
7325     AC_DEFINE(NECKO_COOKIES)
7328 dnl NECKO_ configuration options are not global
7329 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
7331 dnl ========================================================
7332 dnl string api compatibility
7333 dnl ========================================================
7334 MOZ_ARG_DISABLE_BOOL(v1-string-abi,
7335 [  --disable-v1-string-abi   Disable binary compatibility layer for strings],
7336     MOZ_V1_STRING_ABI=,
7337     MOZ_V1_STRING_ABI=1)
7338 AC_SUBST(MOZ_V1_STRING_ABI)
7339 if test "$MOZ_V1_STRING_ABI"; then
7340     AC_DEFINE(MOZ_V1_STRING_ABI)
7343 dnl Only build Mork if it's required
7344 AC_SUBST(MOZ_MORK)
7345 if test "$MOZ_MORK"; then
7346   AC_DEFINE(MOZ_MORK)
7349 dnl Build the lightweight Mork reader if required
7350 AC_SUBST(MOZ_MORKREADER)
7351 if test "$MOZ_MORKREADER"; then
7352   AC_DEFINE(MOZ_MORKREADER)
7355 dnl ========================================================
7356 if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"; then
7357     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7360 if test "$MOZ_LDAP_XPCOM"; then
7361     LDAP_CFLAGS='-I${DIST}/public/ldap'
7362     if test "$OS_ARCH" = "WINNT"; then
7363         if test -n "$GNU_CC"; then
7364             LDAP_LIBS='-L$(DIST)/lib -lnsldap32v60 -lnsldappr32v60 -lnsldif32v60'
7365         else
7366             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}'
7367         fi
7368     elif test "$OS_ARCH" = "OS2"; then
7369             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}'
7370     else
7371         LDAP_LIBS='-L${DIST}/bin -L${DIST}/lib -lldap60 -lprldap60 -lldif60'
7372     fi
7375 if test "$COMPILE_ENVIRONMENT"; then
7376 if test "$SUNCTL"; then
7377     dnl older versions of glib do not seem to have gmodule which ctl needs
7378     _SAVE_CFLAGS=$CFLAGS
7379     CFLAGS="$CFLAGS $GLIB_CFLAGS"
7380     AC_LANG_SAVE
7381     AC_LANG_C
7382     AC_TRY_COMPILE([#include <gmodule.h>],
7383         [ int x = 1; x++; ],,
7384         [AC_MSG_ERROR([Cannot build ctl without gmodule support in glib.])])
7385     AC_LANG_RESTORE
7386     CFLAGS=$_SAVE_CFLAGS
7387     AC_DEFINE(SUNCTL)
7389 fi # COMPILE_ENVIRONMENT
7391 dnl ========================================================
7392 dnl =
7393 dnl = Maintainer debug option (no --enable equivalent)
7394 dnl =
7395 dnl ========================================================
7397 AC_SUBST(AR)
7398 AC_SUBST(AR_FLAGS)
7399 AC_SUBST(AR_LIST)
7400 AC_SUBST(AR_EXTRACT)
7401 AC_SUBST(AR_DELETE)
7402 AC_SUBST(AS)
7403 AC_SUBST(ASFLAGS)
7404 AC_SUBST(AS_DASH_C_FLAG)
7405 AC_SUBST(LD)
7406 AC_SUBST(RC)
7407 AC_SUBST(RCFLAGS)
7408 AC_SUBST(WINDRES)
7409 AC_SUBST(USE_SHORT_LIBNAME)
7410 AC_SUBST(IMPLIB)
7411 AC_SUBST(FILTER)
7412 AC_SUBST(BIN_FLAGS)
7413 AC_SUBST(NS_USE_NATIVE)
7414 AC_SUBST(MOZ_WIDGET_TOOLKIT)
7415 AC_SUBST(MOZ_GFX_TOOLKIT)
7416 AC_SUBST(MOZ_UPDATE_XTERM)
7417 AC_SUBST(MINIMO)
7418 AC_SUBST(MOZ_AUTH_EXTENSION)
7419 AC_SUBST(MOZ_MATHML)
7420 AC_SUBST(MOZ_PERMISSIONS)
7421 AC_SUBST(MOZ_XTF)
7422 AC_SUBST(MOZ_XMLEXTRAS)
7423 AC_SUBST(MOZ_NO_INSPECTOR_APIS)
7424 AC_SUBST(MOZ_WEBSERVICES)
7425 AC_SUBST(MOZ_PREF_EXTENSIONS)
7426 AC_SUBST(MOZ_SVG)
7427 AC_SUBST(MOZ_SVG_FOREIGNOBJECT)
7428 AC_SUBST(MOZ_XSLT_STANDALONE)
7429 AC_SUBST(MOZ_JS_LIBS)
7430 AC_SUBST(MOZ_PSM)
7431 AC_SUBST(MOZ_DEBUG)
7432 AC_SUBST(MOZ_DEBUG_MODULES)
7433 AC_SUBST(MOZ_PROFILE_MODULES)
7434 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
7435 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
7436 AC_SUBST(MOZ_DEBUG_FLAGS)
7437 AC_SUBST(MOZ_DEBUG_LDFLAGS)
7438 AC_SUBST(WARNINGS_AS_ERRORS)
7439 AC_SUBST(MOZ_DBGRINFO_MODULES)
7440 AC_SUBST(MOZ_EXTENSIONS)
7441 AC_SUBST(MOZ_IMG_DECODERS)
7442 AC_SUBST(MOZ_IMG_ENCODERS)
7443 AC_SUBST(MOZ_JSDEBUGGER)
7444 AC_SUBST(MOZ_OJI)
7445 AC_SUBST(MOZ_NO_XPCOM_OBSOLETE)
7446 AC_SUBST(MOZ_PLUGINS)
7447 AC_SUBST(ENABLE_EAZEL_PROFILER)
7448 AC_SUBST(EAZEL_PROFILER_CFLAGS)
7449 AC_SUBST(EAZEL_PROFILER_LIBS)
7450 AC_SUBST(MOZ_PERF_METRICS)
7451 AC_SUBST(GC_LEAK_DETECTOR)
7452 AC_SUBST(MOZ_LOG_REFCNT)
7453 AC_SUBST(MOZ_LEAKY)
7454 AC_SUBST(MOZ_JPROF)
7455 AC_SUBST(MOZ_XPCTOOLS)
7456 AC_SUBST(MOZ_JSLOADER)
7457 AC_SUBST(MOZ_USE_NATIVE_UCONV)
7458 AC_SUBST(MOZ_INSURE)
7459 AC_SUBST(MOZ_INSURE_DIRS)
7460 AC_SUBST(MOZ_INSURE_EXCLUDE_DIRS)
7461 AC_SUBST(MOZ_QUANTIFY)
7462 AC_SUBST(MOZ_INSURIFYING)
7463 AC_SUBST(MOZ_LDAP_XPCOM)
7464 AC_SUBST(MOZ_LDAP_XPCOM_EXPERIMENTAL)
7465 AC_SUBST(LDAP_CFLAGS)
7466 AC_SUBST(LDAP_LIBS)
7467 AC_SUBST(LIBICONV)
7468 AC_SUBST(MOZ_PLACES)
7469 AC_SUBST(MOZ_PLACES_BOOKMARKS)
7470 AC_SUBST(MOZ_STORAGE)
7471 AC_SUBST(MOZ_FEEDS)
7472 AC_SUBST(NS_PRINTING)
7474 AC_SUBST(MOZ_JAVAXPCOM)
7475 AC_SUBST(JAVA_INCLUDE_PATH)
7476 AC_SUBST(JAVA)
7477 AC_SUBST(JAVAC)
7478 AC_SUBST(JAR)
7480 AC_SUBST(MOZ_PROFILESHARING)
7481 AC_SUBST(MOZ_PROFILELOCKING)
7483 AC_SUBST(MOZ_IPCD)
7485 AC_SUBST(HAVE_XIE)
7486 AC_SUBST(MOZ_XIE_LIBS)
7487 AC_SUBST(MOZ_ENABLE_POSTSCRIPT)
7489 AC_SUBST(XPCOM_USE_LEA)
7490 AC_SUBST(BUILD_STATIC_LIBS)
7491 AC_SUBST(MOZ_ENABLE_LIBXUL)
7492 AC_SUBST(ENABLE_TESTS)
7493 AC_SUBST(IBMBIDI)
7494 AC_SUBST(SUNCTL)
7495 AC_SUBST(MOZ_UNIVERSALCHARDET)
7496 AC_SUBST(ACCESSIBILITY)
7497 AC_SUBST(MOZ_XPINSTALL)
7498 AC_SUBST(MOZ_VIEW_SOURCE)
7499 AC_SUBST(MOZ_SPELLCHECK)
7500 AC_SUBST(MOZ_XPFE_COMPONENTS)
7501 AC_SUBST(MOZ_USER_DIR)
7502 AC_SUBST(MOZ_CRASHREPORTER)
7503 AC_SUBST(MOZ_MOCHITEST)
7505 AC_SUBST(ENABLE_STRIP)
7506 AC_SUBST(PKG_SKIP_STRIP)
7507 AC_SUBST(USE_ELF_DYNSTR_GC)
7508 AC_SUBST(USE_PREBINDING)
7509 AC_SUBST(INCREMENTAL_LINKER)
7510 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
7511 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
7512 AC_SUBST(MOZ_XPCOM_OBSOLETE_LIBS)
7514 AC_SUBST(MOZ_FIX_LINK_PATHS)
7515 AC_SUBST(XPCOM_LIBS)
7516 AC_SUBST(XPCOM_FROZEN_LDOPTS)
7517 AC_SUBST(XPCOM_GLUE_LDOPTS)
7518 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
7520 AC_SUBST(USE_DEPENDENT_LIBS)
7522 AC_SUBST(MOZ_BUILD_ROOT)
7523 AC_SUBST(MOZ_OS2_TOOLS)
7524 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
7526 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
7527 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
7528 AC_SUBST(MOZ_TIMELINE)
7529 AC_SUBST(WINCE)
7530 AC_SUBST(TARGET_DEVICE)
7532 AC_SUBST(MOZ_APP_NAME)
7533 AC_SUBST(MOZ_APP_DISPLAYNAME)
7534 AC_SUBST(MOZ_APP_VERSION)
7535 AC_SUBST(FIREFOX_VERSION)
7536 AC_SUBST(THUNDERBIRD_VERSION)
7537 AC_SUBST(SUNBIRD_VERSION)
7538 AC_SUBST(SEAMONKEY_VERSION)
7540 AC_SUBST(MOZ_PKG_SPECIAL)
7542 AC_SUBST(MOZILLA_OFFICIAL)
7543 AC_SUBST(BUILD_OFFICIAL)
7544 AC_SUBST(MOZ_MILESTONE_RELEASE)
7546 dnl win32 options
7547 AC_SUBST(MOZ_PROFILE)
7548 AC_SUBST(MOZ_DEBUG_SYMBOLS)
7549 AC_SUBST(MOZ_MAPINFO)
7550 AC_SUBST(MOZ_BROWSE_INFO)
7551 AC_SUBST(MOZ_TOOLS_DIR)
7552 AC_SUBST(CYGWIN_WRAPPER)
7553 AC_SUBST(AS_PERL)
7554 AC_SUBST(WIN32_REDIST_DIR)
7555 AC_SUBST(PYTHON)
7557 dnl Echo the CFLAGS to remove extra whitespace.
7558 CFLAGS=`echo \
7559         $_WARNINGS_CFLAGS \
7560         $CFLAGS`
7562 CXXFLAGS=`echo \
7563         $_MOZ_RTTI_FLAGS \
7564         $_MOZ_EXCEPTIONS_FLAGS \
7565         $_WARNINGS_CXXFLAGS \
7566         $CXXFLAGS`
7568 COMPILE_CFLAGS=`echo \
7569     $_DEFINES_CFLAGS \
7570         $_DEPEND_CFLAGS \
7571     $COMPILE_CFLAGS`
7573 COMPILE_CXXFLAGS=`echo \
7574     $_DEFINES_CXXFLAGS \
7575         $_DEPEND_CFLAGS \
7576     $COMPILE_CXXFLAGS`
7578 AC_SUBST(SYSTEM_MAKEDEPEND)
7579 AC_SUBST(SYSTEM_JPEG)
7580 AC_SUBST(SYSTEM_PNG)
7581 AC_SUBST(SYSTEM_ZLIB)
7583 AC_SUBST(JPEG_CFLAGS)
7584 AC_SUBST(JPEG_LIBS)
7585 AC_SUBST(ZLIB_CFLAGS)
7586 AC_SUBST(ZLIB_LIBS)
7587 AC_SUBST(PNG_CFLAGS)
7588 AC_SUBST(PNG_LIBS)
7590 AC_SUBST(MOZ_JPEG_CFLAGS)
7591 AC_SUBST(MOZ_JPEG_LIBS)
7592 AC_SUBST(MOZ_ZLIB_CFLAGS)
7593 AC_SUBST(MOZ_ZLIB_LIBS)
7594 AC_SUBST(MOZ_PNG_CFLAGS)
7595 AC_SUBST(MOZ_PNG_LIBS)
7597 AC_SUBST(NSPR_CFLAGS)
7598 AC_SUBST(NSPR_LIBS)
7599 AC_SUBST(MOZ_NATIVE_NSPR)
7601 AC_SUBST(NSS_CFLAGS)
7602 AC_SUBST(NSS_LIBS)
7603 AC_SUBST(NSS_DEP_LIBS)
7604 AC_SUBST(MOZ_NATIVE_NSS)
7606 AC_SUBST(CFLAGS)
7607 AC_SUBST(CXXFLAGS)
7608 AC_SUBST(CPPFLAGS)
7609 AC_SUBST(COMPILE_CFLAGS)
7610 AC_SUBST(COMPILE_CXXFLAGS)
7611 AC_SUBST(LDFLAGS)
7612 AC_SUBST(LIBS)
7613 AC_SUBST(CROSS_COMPILE)
7615 AC_SUBST(HOST_CC)
7616 AC_SUBST(HOST_CXX)
7617 AC_SUBST(HOST_CFLAGS)
7618 AC_SUBST(HOST_CXXFLAGS)
7619 AC_SUBST(HOST_OPTIMIZE_FLAGS)
7620 AC_SUBST(HOST_AR)
7621 AC_SUBST(HOST_AR_FLAGS)
7622 AC_SUBST(HOST_LD)
7623 AC_SUBST(HOST_RANLIB)
7624 AC_SUBST(HOST_NSPR_MDCPUCFG)
7625 AC_SUBST(HOST_BIN_SUFFIX)
7626 AC_SUBST(HOST_OS_ARCH)
7628 AC_SUBST(TARGET_CPU)
7629 AC_SUBST(TARGET_VENDOR)
7630 AC_SUBST(TARGET_OS)
7631 AC_SUBST(TARGET_NSPR_MDCPUCFG)
7632 AC_SUBST(TARGET_MD_ARCH)
7633 AC_SUBST(TARGET_XPCOM_ABI)
7634 AC_SUBST(OS_TARGET)
7635 AC_SUBST(OS_ARCH)
7636 AC_SUBST(OS_RELEASE)
7637 AC_SUBST(OS_TEST)
7639 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
7640 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
7642 AC_SUBST(WRAP_MALLOC_CFLAGS)
7643 AC_SUBST(WRAP_MALLOC_LIB)
7644 AC_SUBST(MKSHLIB)
7645 AC_SUBST(MKCSHLIB)
7646 AC_SUBST(MKSHLIB_FORCE_ALL)
7647 AC_SUBST(MKSHLIB_UNFORCE_ALL)
7648 AC_SUBST(DSO_CFLAGS)
7649 AC_SUBST(DSO_PIC_CFLAGS)
7650 AC_SUBST(DSO_LDOPTS)
7651 AC_SUBST(LIB_PREFIX)
7652 AC_SUBST(DLL_PREFIX)
7653 AC_SUBST(DLL_SUFFIX)
7654 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
7655 AC_SUBST(LIB_SUFFIX)
7656 AC_SUBST(OBJ_SUFFIX)
7657 AC_SUBST(BIN_SUFFIX)
7658 AC_SUBST(ASM_SUFFIX)
7659 AC_SUBST(IMPORT_LIB_SUFFIX)
7660 AC_SUBST(USE_N32)
7661 AC_SUBST(CC_VERSION)
7662 AC_SUBST(CXX_VERSION)
7663 AC_SUBST(MSMANIFEST_TOOL)
7665 if test "$USING_HCC"; then
7666    CC='${topsrcdir}/build/hcc'
7667    CC="$CC '$_OLDCC'"
7668    CXX='${topsrcdir}/build/hcpp'
7669    CXX="$CXX '$_OLDCXX'"
7670    AC_SUBST(CC)
7671    AC_SUBST(CXX)
7674 dnl Check for missing components
7675 if test "$COMPILE_ENVIRONMENT"; then
7676 if test "$MOZ_X11"; then
7677     dnl ====================================================
7678     dnl = Check if X headers exist
7679     dnl ====================================================
7680     _SAVE_CFLAGS=$CFLAGS
7681     CFLAGS="$CFLAGS $XCFLAGS"
7682     AC_TRY_COMPILE([
7683         #include <stdio.h>
7684         #include <X11/Xlib.h>
7685         #include <X11/Intrinsic.h>
7686     ],
7687     [
7688         Display *dpy = 0;
7689         if ((dpy = XOpenDisplay(NULL)) == NULL) {
7690             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
7691             exit(1);
7692         }
7693     ], [], 
7694     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
7695     CFLAGS="$_SAVE_CFLAGS"
7697     if test ! -z "$MISSING_X"; then
7698         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
7699     fi
7701 fi # MOZ_X11
7702 fi # COMPILE_ENVIRONMENT
7704 dnl Set various defines and substitutions
7705 dnl ========================================================
7707 if test "$OS_ARCH" = "OS2" -a "$VACPP" = "yes"; then
7708       LIBS='so32dll.lib tcp32dll.lib'
7709 elif test "$OS_ARCH" = "BeOS"; then
7710   AC_DEFINE(XP_BEOS)
7711   MOZ_MOVEMAIL=1
7712 elif test "$OS_ARCH" = "Darwin"; then
7713   AC_DEFINE(XP_UNIX)
7714   AC_DEFINE(UNIX_ASYNC_DNS)
7715   MOZ_MOVEMAIL=1
7716 elif test "$OS_ARCH" = "OpenVMS"; then
7717   AC_DEFINE(XP_UNIX)
7718 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
7719   AC_DEFINE(XP_UNIX)
7720   AC_DEFINE(UNIX_ASYNC_DNS)
7721   MOZ_MOVEMAIL=1
7723 AC_SUBST(MOZ_MOVEMAIL)
7725 AC_DEFINE(JS_THREADSAFE)
7727 if test "$MOZ_DEBUG"; then
7728     AC_DEFINE(MOZ_REFLOW_PERF)
7729     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
7732 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
7733     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
7734     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
7735     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
7736     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
7737     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
7738     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
7739     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
7740     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
7743 # Used for LD_LIBRARY_PATH of run_viewer target
7744 LIBS_PATH=
7745 for lib_arg in $NSPR_LIBS $TK_LIBS; do
7746   case $lib_arg in
7747     -L* ) LIBS_PATH="${LIBS_PATH:+$LIBS_PATH:}"`expr $lib_arg : "-L\(.*\)"` ;;
7748       * ) ;;
7749   esac
7750 done
7751 AC_SUBST(LIBS_PATH)
7753 dnl ========================================================
7754 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
7755 dnl ========================================================
7756 case "$host_os" in
7757 mingw*)
7758     WIN_TOP_SRC=`cd $srcdir; pwd -W`
7759     ;;
7760 cygwin*|msvc*|mks*)
7761     HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
7762     HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
7763     CC="\$(CYGWIN_WRAPPER) $CC"
7764     CXX="\$(CYGWIN_WRAPPER) $CXX"
7765     CPP="\$(CYGWIN_WRAPPER) $CPP"
7766     LD="\$(CYGWIN_WRAPPER) $LD"
7767     AS="\$(CYGWIN_WRAPPER) $AS"
7768     RC="\$(CYGWIN_WRAPPER) $RC"
7769     MIDL="\$(CYGWIN_WRAPPER) $MIDL"
7770     CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
7771     WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
7772     ;;
7773 esac
7775 AC_SUBST(CYGDRIVE_MOUNT)
7776 AC_SUBST(WIN_TOP_SRC)
7778 AC_SUBST(MOZILLA_VERSION)
7780 . ${srcdir}/config/chrome-versions.sh
7781 AC_DEFINE_UNQUOTED(MOZILLA_LOCALE_VERSION,"$MOZILLA_LOCALE_VERSION")
7782 AC_DEFINE_UNQUOTED(MOZILLA_REGION_VERSION,"$MOZILLA_REGION_VERSION")
7783 AC_DEFINE_UNQUOTED(MOZILLA_SKIN_VERSION,"$MOZILLA_SKIN_VERSION")
7785 AC_SUBST(ac_configure_args)
7787 dnl Spit out some output
7788 dnl ========================================================
7790 dnl The following defines are used by xpcom
7791 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
7792 CPP_THROW_NEW
7793 HAVE_CPP_2BYTE_WCHAR_T
7794 HAVE_CPP_ACCESS_CHANGING_USING
7795 HAVE_CPP_AMBIGUITY_RESOLVING_USING
7796 HAVE_CPP_BOOL
7797 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
7798 HAVE_CPP_EXPLICIT
7799 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
7800 HAVE_CPP_NAMESPACE_STD
7801 HAVE_CPP_NEW_CASTS
7802 HAVE_CPP_PARTIAL_SPECIALIZATION
7803 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
7804 HAVE_CPP_TYPENAME
7805 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
7806 HAVE_STATVFS
7807 NEED_CPP_UNUSED_IMPLEMENTATIONS
7808 NEW_H
7809 HAVE_GETPAGESIZE
7810 HAVE_ICONV
7811 HAVE_ICONV_WITH_CONST_INPUT
7812 HAVE_MBRTOWC
7813 HAVE_SYS_MOUNT_H
7814 HAVE_SYS_VFS_H
7815 HAVE_WCRTOMB
7816 MOZ_V1_STRING_ABI
7819 AC_CONFIG_HEADER(
7820 gfx/gfx-config.h
7821 netwerk/necko-config.h
7822 xpcom/xpcom-config.h
7823 xpcom/xpcom-private.h
7826 # Save the defines header file before autoconf removes it.
7827 # (Do not add AC_DEFINE calls after this line.)
7828   _CONFIG_TMP=confdefs-tmp.h
7829   _CONFIG_DEFS_H=mozilla-config.h
7831   cat > $_CONFIG_TMP <<\EOF
7832 /* List of defines generated by configure. Included with preprocessor flag,
7833  * -include, to avoid long list of -D defines on the compile command-line.
7834  * Do not edit.
7835  */
7837 #ifndef _MOZILLA_CONFIG_H_
7838 #define _MOZILLA_CONFIG_H_
7841 _EGREP_PATTERN='^#define ('
7842 if test -n "$_NON_GLOBAL_ACDEFINES"; then
7843     for f in $_NON_GLOBAL_ACDEFINES; do
7844         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
7845     done
7847 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
7849   sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
7851   cat >> $_CONFIG_TMP <<\EOF
7853 #endif /* _MOZILLA_CONFIG_H_ */
7857   # Only write mozilla-config.h when something changes (or it doesn't exist)
7858   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
7859     rm $_CONFIG_TMP
7860   else
7861     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
7862     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
7864     echo ==== $_CONFIG_DEFS_H =================================
7865     cat $_CONFIG_DEFS_H
7866   fi
7868 dnl Probably shouldn't call this manually but we always want the output of DEFS
7869 rm -f confdefs.h.save
7870 mv confdefs.h confdefs.h.save
7871 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
7872 AC_OUTPUT_MAKE_DEFS()
7873 MOZ_DEFINES=$DEFS
7874 AC_SUBST(MOZ_DEFINES)
7875 rm -f confdefs.h
7876 mv confdefs.h.save confdefs.h
7878 dnl Load the list of Makefiles to generate.
7879 dnl   To add new Makefiles, edit allmakefiles.sh.
7880 dnl   allmakefiles.sh sets the variable, MAKEFILES.
7881 . ${srcdir}/allmakefiles.sh
7882 dnl 
7883 dnl Run a perl script to quickly create the makefiles.
7884 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
7885 dnl   for the files it cannot handle correctly. This way, config.status
7886 dnl   will handle these files.
7887 dnl If it fails, nothing is set and config.status will run as usual.
7889 dnl This does not change the $MAKEFILES variable.
7891 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
7893 if test -z "${AS_PERL}"; then
7894 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
7895 else
7896 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
7898 . ./conftest.sh
7899 rm conftest.sh
7901 echo $MAKEFILES > unallmakefiles
7903 AC_OUTPUT($MAKEFILES)
7905 dnl ========================================================
7906 dnl = Setup a nice relatively clean build environment for
7907 dnl = sub-configures.
7908 dnl ========================================================
7909 CC="$_SUBDIR_CC" 
7910 CXX="$_SUBDIR_CXX" 
7911 CFLAGS="$_SUBDIR_CFLAGS" 
7912 CPPFLAGS="$_SUBDIR_CPPFLAGS"
7913 CXXFLAGS="$_SUBDIR_CXXFLAGS"
7914 LDFLAGS="$_SUBDIR_LDFLAGS"
7915 HOST_CC="$_SUBDIR_HOST_CC" 
7916 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
7917 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
7920 unset MAKEFILES
7921 unset CONFIG_FILES
7923 if test "$COMPILE_ENVIRONMENT"; then
7924 if test -z "$MOZ_NATIVE_NSPR" || test "$MOZ_LDAP_XPCOM"; then
7925     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
7926     if test -z "$MOZ_DEBUG"; then
7927         ac_configure_args="$ac_configure_args --disable-debug"
7928     fi
7929     if test "$MOZ_OPTIMIZE" = "1"; then
7930         ac_configure_args="$ac_configure_args --enable-optimize"
7931     fi
7932     if test "$OS_ARCH" = "WINNT" && test "$NS_TRACE_MALLOC"; then
7933        ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
7934     fi
7935     if test -n "$HAVE_64BIT_OS"; then
7936         ac_configure_args="$ac_configure_args --enable-64bit"
7937     fi
7938     AC_OUTPUT_SUBDIRS(nsprpub)
7939     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
7942 if test -z "$MOZ_NATIVE_NSPR"; then
7943     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
7944     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
7945     if test ! "$VACPP" && test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE"; then
7946        _libs=`./nsprpub/config/nspr-config --prefix=$\(LIBXUL_DIST\) --exec-prefix=$\(DIST\) --libdir=$\(LIBXUL_DIST\)/lib --libs`
7947        $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $_libs'" config/autoconf.mk
7948     fi
7949     if test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE" ; then
7950        _cflags=`./nsprpub/config/nspr-config --prefix=$\(LIBXUL_DIST\) --exec-prefix=$\(DIST\) --includedir=$\(LIBXUL_DIST\)/include/nspr --cflags`
7951        $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $_cflags'" config/autoconf.mk
7952     fi
7953     rm -f config/autoconf.mk.bak
7956 # if we're building the LDAP XPCOM component, we need to build 
7957 # the c-sdk first.  
7959 if test "$MOZ_LDAP_XPCOM"; then
7961     # these subdirs may not yet have been created in the build tree.
7962     # don't use the "-p" switch to mkdir, since not all platforms have it
7963     #
7964     if test ! -d "directory"; then
7965         mkdir "directory"
7966     fi
7967     if test ! -d "directory/c-sdk"; then
7968         mkdir "directory/c-sdk"    
7969     fi
7970     if test ! -d "directory/c-sdk/ldap"; then
7971         mkdir "directory/c-sdk/ldap"    
7972     fi
7974     ac_configure_args="$_SUBDIR_CONFIG_ARGS --prefix=$MOZ_BUILD_ROOT/dist --with-dist-prefix=$MOZ_BUILD_ROOT/dist --without-nss --with-mozilla"
7975     if test -z "$MOZ_DEBUG"; then
7976         ac_configure_args="$ac_configure_args --disable-debug"
7977     fi
7978     if test "$MOZ_OPTIMIZE" = "1"; then
7979         ac_configure_args="$ac_configure_args --enable-optimize"
7980     fi
7981     if test -n "$HAVE_64BIT_OS"; then
7982         ac_configure_args="$ac_configure_args --enable-64bit"
7983     fi
7984     AC_OUTPUT_SUBDIRS(directory/c-sdk)
7985     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
7987 fi # COMPILE_ENVIRONMENT