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