Fixed building printing gui for qt unix port
[mozilla-central.git] / configure.in
blobac17f25b682346b719b48db52afff622e8c6f29c
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}"
72 MOZ_DEB_TIMESTAMP=`date +"%a, %d  %b %Y %T %z"   2>&1` 
73 AC_SUBST(MOZ_DEB_TIMESTAMP)
76 dnl ========================================================
77 dnl =
78 dnl = Don't change the following two lines.  Doing so breaks:
79 dnl =
80 dnl = CFLAGS="-foo" ./configure
81 dnl =
82 dnl ========================================================
83 CFLAGS="${CFLAGS=}"
84 CPPFLAGS="${CPPFLAGS=}"
85 CXXFLAGS="${CXXFLAGS=}"
86 LDFLAGS="${LDFLAGS=}"
87 HOST_CFLAGS="${HOST_CFLAGS=}"
88 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
89 HOST_LDFLAGS="${HOST_LDFLAGS=}"
91 dnl ========================================================
92 dnl = Preserve certain environment flags passed to configure
93 dnl = We want sub projects to receive the same flags
94 dnl = untainted by this configure script
95 dnl ========================================================
96 _SUBDIR_CC="$CC"
97 _SUBDIR_CXX="$CXX"
98 _SUBDIR_CFLAGS="$CFLAGS"
99 _SUBDIR_CPPFLAGS="$CPPFLAGS"
100 _SUBDIR_CXXFLAGS="$CXXFLAGS"
101 _SUBDIR_LDFLAGS="$LDFLAGS"
102 _SUBDIR_HOST_CC="$HOST_CC"
103 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
104 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
105 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
106 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
108 dnl Set the version number of the libs included with mozilla
109 dnl ========================================================
110 MOZJPEG=62
111 MOZPNG=10217
112 MOZZLIB=0x1230
113 NSPR_VERSION=4
114 NSS_VERSION=3
116 dnl Set the minimum version of toolkit libs used by mozilla
117 dnl ========================================================
118 GLIB_VERSION=1.2.0
119 LIBIDL_VERSION=0.6.3
120 PERL_VERSION=5.006
121 LIBART_VERSION=2.3.4
122 CAIRO_VERSION=1.6.0
123 GLITZ_VERSION=0.4.0
124 PANGO_VERSION=1.10.0
125 GTK2_VERSION=2.10.0
126 MAKE_VERSION=3.78
127 WINDRES_VERSION=2.14.90
128 W32API_VERSION=3.8
129 GNOMEVFS_VERSION=2.0
130 GNOMEUI_VERSION=2.2.0
131 GCONF_VERSION=1.2.1
132 LIBGNOME_VERSION=2.0
133 STARTUP_NOTIFICATION_VERSION=0.8
134 DBUS_VERSION=0.60
135 LCMS_VERSION=1.17
136 SQLITE_VERSION=3.5.4
138 MSMANIFEST_TOOL=
140 dnl Set various checks
141 dnl ========================================================
142 MISSING_X=
143 AC_PROG_AWK
145 dnl Initialize the Pthread test variables early so they can be
146 dnl  overridden by each platform.
147 dnl ========================================================
148 USE_PTHREADS=
149 _PTHREAD_LDFLAGS=""
151 dnl Do not allow a separate objdir build if a srcdir build exists.
152 dnl ==============================================================
153 _topsrcdir=`cd \`dirname $0\`; pwd`
154 _objdir=`pwd`
156 if test "$_topsrcdir" != "$_objdir"
157 then
158   # Check for a couple representative files in the source tree
159   _conflict_files=
160   for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
161     if test -f $file; then
162       _conflict_files="$_conflict_files $file"
163     fi
164   done
165   if test "$_conflict_files"; then
166     echo "***"
167     echo "*   Your source tree contains these files:"
168     for file in $_conflict_files; do
169       echo "*         $file"
170     done
171     cat 1>&2 <<-EOF
172         *   This indicates that you previously built in the source tree.
173         *   A source tree build can confuse the separate objdir build.
174         *
175         *   To clean up the source tree:
176         *     1. cd $_topsrcdir
177         *     2. gmake distclean
178         ***
179         EOF
180     exit 1
181     break
182   fi
184 MOZ_BUILD_ROOT=`pwd`
186 dnl Default to MSVC for win32
187 dnl ==============================================================
188 if test -z "$CROSS_COMPILE"; then
189 case "$target" in
190 *-cygwin*|*-mingw*|*-msvc*|*-mks*)
191     MAKE_VERSION=3.79
192     if test -z "$CC"; then CC=cl; fi
193     if test -z "$CXX"; then CXX=cl; fi
194     if test -z "$CPP"; then CPP="cl -E -nologo"; fi
195     if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
196     if test -z "$LD"; then LD=link; fi
197     if test -z "$AS"; then AS=ml; fi
198     if test -z "$MIDL"; then MIDL=midl; fi
199     ;;
200 esac
203 COMPILE_ENVIRONMENT=1
204 MOZ_ARG_ENABLE_BOOL(compile-environment,
205 [  --disable-compile-environment
206                            Disable compiler/library checks.],
207     COMPILE_ENVIRONMENT=1,
208     COMPILE_ENVIRONMENT= )
210 MOZ_ARG_WITH_STRING(l10n-base,
211 [  --with-l10nbase=DIR     path to l10n repositories],
212     L10NBASEDIR=$withval)
213 if test ! -z "$L10NBASEDIR"; then
214     if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
215         AC_MSG_ERROR([--with-l10n-base must specify a path])
216     elif test -d "$L10NBASEDIR"; then
217         L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
218     else
219         AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
220     fi
222 AC_SUBST(L10NBASEDIR)
224 dnl ========================================================
225 dnl Checks for compilers.
226 dnl ========================================================
227 dnl Set CROSS_COMPILE in the environment when running configure
228 dnl to use the cross-compile setup for now
229 dnl ========================================================
231 if test "$COMPILE_ENVIRONMENT"; then
233 dnl Do some special WinCE toolchain stuff
234 case "$target" in
235 *wince)
236     echo -----------------------------------------------------------------------------
237     echo Building Windows CE Shunt Library and Tool Chain
238     echo -----------------------------------------------------------------------------
240     ac_exeext=.exe
242     echo -n "#define TOPSRCDIR \"" > $srcdir/build/wince/tools/topsrcdir.h
243     echo `cd "$_topsrcdir" && pwd -W | tr '\n' '\"'` >> $srcdir/build/wince/tools/topsrcdir.h
244     make -C $srcdir/build/wince/tools
245     echo -----------------------------------------------------------------------------
246     ;;
247 esac
249 if test -n "$CROSS_COMPILE" && test "$target" != "$host"; then
250     echo "cross compiling from $host to $target"
251     cross_compiling=yes
253     _SAVE_CC="$CC"
254     _SAVE_CFLAGS="$CFLAGS"
255     _SAVE_LDFLAGS="$LDFLAGS"
257     AC_MSG_CHECKING([for host c compiler])
258     AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
259     if test -z "$HOST_CC"; then
260         AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
261     fi
262     AC_MSG_RESULT([$HOST_CC])
263     AC_MSG_CHECKING([for host c++ compiler])
264     AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
265     if test -z "$HOST_CXX"; then
266         AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
267     fi
268     AC_MSG_RESULT([$HOST_CXX])
270     if test -z "$HOST_CFLAGS"; then
271         HOST_CFLAGS="$CFLAGS"
272     fi
273     if test -z "$HOST_CXXFLAGS"; then
274         HOST_CXXFLAGS="$CXXFLAGS"
275     fi
276     if test -z "$HOST_LDFLAGS"; then
277         HOST_LDFLAGS="$LDFLAGS"
278     fi
279     AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
280     AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
281     CC="$HOST_CC"
282     CFLAGS="$HOST_CFLAGS"
283     LDFLAGS="$HOST_LDFLAGS"
285     AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
286     AC_TRY_COMPILE([], [return(0);], 
287         [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
288         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
290     CC="$HOST_CXX"
291     CFLAGS="$HOST_CXXFLAGS"
293     AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
294     AC_TRY_COMPILE([], [return(0);], 
295         [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
296         AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
297     
298     CC=$_SAVE_CC
299     CFLAGS=$_SAVE_CFLAGS
300     LDFLAGS=$_SAVE_LDFLAGS
302     case "$build:$target" in
303       powerpc-apple-darwin8*:i?86-apple-darwin*)
304         dnl The Darwin cross compiler doesn't necessarily point itself at a
305         dnl root that has libraries for the proper architecture, it defaults
306         dnl to the system root.  The libraries in the system root on current
307         dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
308         dnl checks will fail.  Fake a working SDK in that case.
309         _SAVE_CFLAGS=$CFLAGS
310         _SAVE_CXXFLAGS=$CXXLAGS
311         CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CFLAGS"
312         CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CXXFLAGS"
313         ;;
314     esac
316     AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
317     unset ac_cv_prog_CC
318     AC_PROG_CC
319     AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
320     unset ac_cv_prog_CXX
321     AC_PROG_CXX
323     case "$build:$target" in
324       powerpc-apple-darwin8*:i?86-apple-darwin*)
325         dnl Revert the changes made above.  From this point on, the target
326         dnl compiler will never be used without applying the SDK to CFLAGS
327         dnl (see --with-macos-sdk below).
328         CFLAGS=$_SAVE_CFLAGS
329         CXXFLAGS=$_SAVE_CXXFLAGS
330         ;;
331     esac
333     AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
334     AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
335     AC_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
336     AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
337     AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
338     AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
339     AC_DEFINE(CROSS_COMPILE)
340 else
341     AC_PROG_CC
342     AC_PROG_CXX
343     AC_PROG_RANLIB
344     AC_PATH_PROGS(AS, $AS as, $CC)
345     AC_CHECK_PROGS(AR, ar, :)
346     AC_CHECK_PROGS(LD, ld, :)
347     AC_CHECK_PROGS(STRIP, strip, :)
348     AC_CHECK_PROGS(WINDRES, windres, :)
349     if test -z "$HOST_CC"; then
350         HOST_CC="$CC"
351     fi
352     if test -z "$HOST_CFLAGS"; then
353         HOST_CFLAGS="$CFLAGS"
354     fi
355     if test -z "$HOST_CXX"; then
356         HOST_CXX="$CXX"
357     fi
358     if test -z "$HOST_CXXFLAGS"; then
359         HOST_CXXFLAGS="$CXXFLAGS"
360     fi
361     if test -z "$HOST_LDFLAGS"; then
362         HOST_LDFLAGS="$LDFLAGS"
363     fi
364     if test -z "$HOST_RANLIB"; then
365         HOST_RANLIB="$RANLIB"
366     fi
367     if test -z "$HOST_AR"; then
368        HOST_AR="$AR"
369     fi
372 GNU_AS=
373 GNU_LD=
374 GNU_CC=
375 GNU_CXX=
376 CC_VERSION='N/A'
377 CXX_VERSION='N/A'
378 if test "$GCC" = "yes"; then
379     GNU_CC=1
380     CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
382 if test "$GXX" = "yes"; then
383     GNU_CXX=1
384     CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
386 if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
387     GNU_AS=1
389 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
390     GNU_LD=1
392 if test "$GNU_CC"; then
393     if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
394         GCC_USE_GNU_LD=1
395     fi
398 INTEL_CC=
399 INTEL_CXX=
400 if test "$GCC" = yes; then
401    if test "`$CC -help 2>&1 | grep -c 'Intel(R) C Compiler'`" != "0"; then
402      INTEL_CC=1
403    fi
406 if test "$GXX" = yes; then
407    if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
408      INTEL_CXX=1
409    fi
412 dnl Special win32 checks
413 dnl ========================================================
414 case "$target" in
415 *-wince)
416     WINVER=500
417     ;;
419     if test -n "$GNU_CC"; then  
420         WINVER=501
421     else    
422         WINVER=500
423     fi
424     ;;
425 esac
427 MOZ_ARG_WITH_STRING(windows-version,
428 [  --with-windows-version=WINVER
429                           Minimum Windows version (WINVER) to support
430                               400: Windows 95
431                               500: Windows 2000
432                               501: Windows XP],
433   WINVER=$withval)
435 case "$WINVER" in
436 400|500|501)
437     ;;
440     AC_MSG_ERROR([Invalid value --with-windows-version, must be 400, 500 or 501]);
441     ;;
443 esac
445 case "$target" in
446 *-cygwin*|*-mingw*|*-msvc*|*-mks*|*-wince)
447     if test "$GCC" != "yes"; then
448         # Check to see if we are really running in a msvc environemnt
449         _WIN32_MSVC=1
450         AC_CHECK_PROGS(MIDL, midl)
452         # Make sure compilers are valid
453         CFLAGS="$CFLAGS -TC -nologo"
454         CXXFLAGS="$CXXFLAGS -TP -nologo"
455         AC_LANG_SAVE
456         AC_LANG_C
457         AC_TRY_COMPILE([#include <stdio.h>],
458             [ printf("Hello World\n"); ],,
459             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
461         AC_LANG_CPLUSPLUS
462         AC_TRY_COMPILE([#include <new.h>],
463             [ unsigned *test = new unsigned(42); ],,
464             AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
465         AC_LANG_RESTORE
466         
467         changequote(,)
468         _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
469         changequote([,])
470         
471         # Determine compiler version
472         CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
473         _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
474         _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
475         _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
476         _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
477         _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
479         CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
480         _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
482         if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
483             AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
484         fi
485         if test "$_CC_MAJOR_VERSION" = "12"; then
486             _CC_SUITE=6
487         elif test "$_CC_MAJOR_VERSION" = "13"; then
488             _CC_SUITE=7
489         elif test "$_CC_MAJOR_VERSION" = "14"; then
490             _CC_SUITE=8
491             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
492             dnl -DYNAMICBASE is only supported on VC8SP1 or newer,
493             dnl so be very specific here!
494             dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762
495             if test $_CC_RELEASE -gt 50727; then
496                _USE_DYNAMICBASE=1
497             elif test $_CC_BUILD -ge 762; then
498                _USE_DYNAMICBASE=1
499             fi
500             AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
501             AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
502         elif test "$_CC_MAJOR_VERSION" = "15"; then
503             _CC_SUITE=9
504             CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
505             LDFLAGS="$LDFLAGS -MANIFESTUAC:NO"
506             _USE_DYNAMICBASE=1
507             AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
508             AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
509         else
510             AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
511         fi
513         _MOZ_RTTI_FLAGS_ON='-GR'
514         _MOZ_RTTI_FLAGS_OFF='-GR-'
515         _MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
516         _MOZ_EXCEPTIONS_FLAGS_OFF=''
518         if test -n "$WIN32_REDIST_DIR"; then
519             WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
520         fi
521         
522         # bug #249782
523         # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
524         if test "$_CC_SUITE" -ge "8"; then
525                 changequote(,)
526                 _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
527                 changequote([,])
529                 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
530                 if test -n "$MSMT_TOOL"; then
531                         MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
532                         if test -z "$MSMANIFEST_TOOL_VERSION"; then
533                                 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
534                         fi
535                         MSMANIFEST_TOOL=1
536                         unset MSMT_TOOL
537                 else
538                         AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
539                 fi
540         fi
542         # Check linker version
543         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
544         _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
545         if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
546             AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
547         fi
548         INCREMENTAL_LINKER=1
550         # Check midl version
551         _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
552         _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
553         _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
554         _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
555          # Add flags if necessary
556          AC_MSG_CHECKING([for midl flags])
557          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
558              # Starting with MIDL version 6.0.359, the MIDL compiler
559              # generates /Oicf /robust stubs by default, which is not
560              # compatible with versions of Windows older than Win2k.
561              # This switches us back to the old behaviour. When we drop
562              # support for Windows older than Win2k, we should remove
563              # this.
564              MIDL_FLAGS="${MIDL_FLAGS} -no_robust"
565              AC_MSG_RESULT([need -no_robust])
566          else
567              MIDL_FLAGS="${MIDL_FLAGS}"
568              AC_MSG_RESULT([none needed])
569         fi
570         
571         unset _MSVC_VER_FILTER
572         
573     else
574         # Check w32api version
575         _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
576         _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
577         AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
578         AC_TRY_COMPILE([#include <w32api.h>],
579             #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
580                 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
581                  __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
582                 #error "test failed."
583             #endif
584             , [ res=yes ], [ res=no ])
585         AC_MSG_RESULT([$res])
586         if test "$res" != "yes"; then
587             AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
588         fi
589         # Check windres version
590         AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
591         _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
592         AC_MSG_RESULT([$_WINDRES_VERSION])
593         _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
594         _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
595         _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
596         WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
597         WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
598         WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
599         if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
600                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
601                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
602                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
603                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
604                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
605         then
606             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
607         fi
608     fi # !GNU_CC
610     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
611     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
612     # Require OS features provided by IE 5.0
613     AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
614     ;;
615 esac
617 dnl Test breaks icc on OS/2 && MSVC
618 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
619     AC_PROG_CC_C_O
620     if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
621         USING_HCC=1
622         _OLDCC=$CC
623         _OLDCXX=$CXX
624         CC="${srcdir}/build/hcc '$CC'"
625         CXX="${srcdir}/build/hcpp '$CXX'"
626     fi
629 AC_PROG_CPP
630 AC_PROG_CXXCPP
632 if test -n "$_WIN32_MSVC"; then
633     SKIP_PATH_CHECKS=1
634     SKIP_COMPILER_CHECKS=1
635     SKIP_LIBRARY_CHECKS=1
638 fi # COMPILE_ENVIRONMENT
640 AC_SUBST(MIDL_FLAGS)
641 AC_SUBST(_MSC_VER)
643 AC_SUBST(GNU_AS)
644 AC_SUBST(GNU_LD)
645 AC_SUBST(GNU_CC)
646 AC_SUBST(GNU_CXX)
647 AC_SUBST(INTEL_CC)
648 AC_SUBST(INTEL_CXX)
650 dnl ========================================================
651 dnl Checks for programs.
652 dnl ========================================================
653 AC_PROG_INSTALL
654 AC_PROG_LN_S
655 AC_PATH_PROGS(PERL, $PERL perl5 perl )
656 if test -z "$PERL" || test "$PERL" = ":"; then
657     AC_MSG_ERROR([perl not found in \$PATH])
660 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
661 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
662 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
663 _perl_res=$?
664 AC_MSG_RESULT([$_perl_version])
666 if test "$_perl_res" != 0; then
667     AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
671 AC_MSG_CHECKING([for full perl installation])
672 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
673 _perl_res=$?
674 if test "$_perl_res" != 0; then
675     AC_MSG_RESULT([no])
676     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
677 else
678     AC_MSG_RESULT([yes])    
681 AC_PATH_PROGS(PYTHON, $PYTHON python)
682 if test -z "$PYTHON"; then
683     AC_MSG_ERROR([python was not found in \$PATH])
685 echo PYTHON="$PYTHON"
687 AC_PATH_PROGS(NSINSTALL_BIN, nsinstall )
688 if test -z "$COMPILE_ENVIRONMENT"; then
689 if test -z "$NSINSTALL_BIN" || test "$NSINSTALL_BIN" = ":"; then
690     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
693 AC_SUBST(NSINSTALL_BIN)
695 AC_PATH_PROG(DOXYGEN, doxygen, :)
696 AC_PATH_PROG(WHOAMI, whoami, :)
697 AC_PATH_PROG(AUTOCONF, autoconf, :)
698 AC_PATH_PROG(UNZIP, unzip, :)
699 AC_PATH_PROGS(ZIP, zip)
700 if test -z "$ZIP" || test "$ZIP" = ":"; then
701     AC_MSG_ERROR([zip not found in \$PATH])
703 AC_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
704 AC_PATH_PROG(XARGS, xargs)
705 if test -z "$XARGS" || test "$XARGS" = ":"; then
706     AC_MSG_ERROR([xargs not found in \$PATH .])
709 if test "$COMPILE_ENVIRONMENT"; then
711 dnl ========================================================
712 dnl = Mac OS X toolchain support
713 dnl ========================================================
715 case "$target_os" in
716 darwin*)
717     dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
718     dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
719     dnl the environment and includedir purposes (when using an SDK, below),
720     dnl but remember the full version number for the libdir (SDK).
721     changequote(,)
722     GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
723     GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
724     changequote([,])
725     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
726         dnl Bug 280479, but this keeps popping up in bug 292530 too because
727         dnl 4.0.0/4061 is the default compiler in Tiger.
728         changequote(,)
729         GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
730         changequote([,])
731         if test "$GCC_BUILD" = "4061" ; then
732             AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
733 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
734 from building Mozilla. Upgrade to Xcode 2.1 or later.])
735         fi
736     fi
738     dnl xcodebuild needs GCC_VERSION defined in the environment, since it
739     dnl doesn't respect the CC/CXX setting.  With GCC_VERSION set, it will use
740     dnl /usr/bin/g(cc|++)-$GCC_VERSION.
741     AC_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
743     case "$PBBUILD" in
744       *xcodebuild*)
745         changequote(,)
746         XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
747         changequote([,])
748         if test -n "$XCODEBUILD_VERSION" && test "$XCODEBUILD_VERSION" -ge 620 ; then
749           HAS_XCODE_2_1=1;
750         fi
751       ;;
752     esac
754     dnl sdp was formerly in /Developer/Tools.  As of Mac OS X 10.4 (Darwin 8),
755     dnl it has moved into /usr/bin.
756     AC_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
757     ;;
758 esac
760 AC_SUBST(GCC_VERSION)
761 AC_SUBST(XCODEBUILD_VERSION)
762 AC_SUBST(HAS_XCODE_2_1)
764 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
765 dnl that a universal binary is being produced.
766 AC_SUBST(UNIVERSAL_BINARY)
768 dnl ========================================================
769 dnl Check for MacOS deployment target version
770 dnl ========================================================
772 MOZ_ARG_ENABLE_STRING(macos-target,
773                       [  --enable-macos-target=VER (default=10.4)
774                           Set the minimum MacOS version needed at runtime],
775                       [_MACOSX_DEPLOYMENT_TARGET=$enableval])
777 case "$target" in
778 *-darwin*)
779     if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
780         dnl Use the specified value
781         export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
782         AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
783     elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then
784         dnl No value specified on the command line or in the environment,
785         dnl use the lesser of the application's minimum or the architecture's
786         dnl minimum.
787         export MACOSX_DEPLOYMENT_TARGET=10.4
788     fi
789     ;;
790 esac
792 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
794 dnl ========================================================
795 dnl = Mac OS X SDK support
796 dnl ========================================================
797 MACOS_SDK_DIR=
798 NEXT_ROOT=
799 MOZ_ARG_WITH_STRING(macos-sdk,
800 [  --with-macos-sdk=dir   Location of platform SDK to use (Mac OS X only)],
801     MACOS_SDK_DIR=$withval)
803 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
804 dnl NEXT_ROOT will be set and exported only if it's needed.
805 AC_SUBST(MACOS_SDK_DIR)
806 AC_SUBST(NEXT_ROOT)
808 if test "$MACOS_SDK_DIR"; then
809   dnl Sync this section with the ones in NSPR and NSS.
810   dnl Changes to the cross environment here need to be accounted for in
811   dnl the libIDL checks (below) and xpidl build.
813   if test ! -d "$MACOS_SDK_DIR"; then
814     AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
815 specify a valid SDK.  SDKs are installed when the optional cross-development
816 tools are selected during the Xcode/Developer Tools installation.])
817   fi
819   GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
820   if test "$GCC_VERSION_MAJOR" -lt "4" ; then
821     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"
822     if test -d "${MACOS_SDK_DIR}/Library/Frameworks" ; then
823       SDK_C_INCLUDE="$SDK_C_INCLUDE -F${MACOS_SDK_DIR}/Library/Frameworks"
824     fi
825     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"
827     CFLAGS="$CFLAGS -nostdinc ${SDK_C_INCLUDE}"
828     CXXFLAGS="$CXXFLAGS -nostdinc -nostdinc++ ${SDK_CXX_INCLUDE} ${SDK_C_INCLUDE}"
830     dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
831     CPP="$CPP -nostdinc ${SDK_C_INCLUDE}"
832     CXXCPP="$CXXCPP -nostdinc -nostdinc++ ${SDK_CXX_INCLUDE} ${SDK_C_INCLUDE}"
834     dnl ld support for -syslibroot is compiler-agnostic, but only available
835     dnl on Tiger.  Although it's possible to switch on the build host's
836     dnl OS release to use ld -syslibroot when available, ld -syslibroot will
837     dnl cause warnings as long as NEXT_ROOT is set.  NEXT_ROOT should be
838     dnl set because both the compiler and linker use it.
839     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"
840     export NEXT_ROOT=$MACOS_SDK_DIR
842     if test -n "$CROSS_COMPILE" ; then
843       dnl NEXT_ROOT will be in the environment, but it shouldn't be set for
844       dnl the build host.  HOST_CXX is presently unused.
845       HOST_CC="NEXT_ROOT= $HOST_CC"
846       HOST_CXX="NEXT_ROOT= $HOST_CXX"
847     fi
848   else
849     dnl gcc >= 4.0 uses different paths than above, but knows how to find
850     dnl them itself.
851     CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
852     CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
854     dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
855     CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
856     CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
858     if test "$GCC_VERSION_FULL" = "4.0.0" ; then
859       dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
860       dnl that supports -syslibroot.  Don't set NEXT_ROOT because it will
861       dnl be ignored and cause warnings when -syslibroot is specified.
862       dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
863       dnl the -isysroot it receives, so this is only needed with 4.0.0.
864       LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
865     fi
866   fi
868   AC_LANG_SAVE
869   AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
870   AC_LANG_CPLUSPLUS
871   AC_TRY_COMPILE([#include <new>
872                  int main() { return 0; }],
873    result=yes,
874    result=no)
875   AC_LANG_RESTORE
876   AC_MSG_RESULT($result)
878   if test "$result" = "no" ; then
879     AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
880   fi
883 fi # COMPILE_ENVIRONMENT
885 dnl Be sure the make we use is GNU make.
886 dnl on win32, gmake.exe is the generally the wrong version
887 case "$host_os" in
888 cygwin*|mingw*|mks*|msvc*)
889     AC_PATH_PROGS(MAKE, $MAKE make gmake, :)
890     ;;
892     AC_PATH_PROGS(MAKE, $MAKE gmake make, :)
893     ;;
894 esac
895 _make_try=`$MAKE --version 2>/dev/null | grep GNU`
896 if test ! "$_make_try"
897 then
898         echo
899         echo "*** $MAKE is not GNU Make.  You will not be able to build Mozilla without GNU Make."
900         echo
901         exit 1
903 dnl Now exit if version if < MAKE_VERSION
904 rm -f dummy.mk
905 echo 'all: ; @echo $(MAKE_VERSION)' > dummy.mk
906 _make_vers=`$MAKE --no-print-directory -f dummy.mk all 2>/dev/null`
907 rm -f dummy.mk
908 _MAKE_MAJOR_VERSION=`echo $_make_vers | $AWK -F\. '{ print $1 }'`
909 _MAKE_MINOR_VERSION=`echo $_make_vers | $AWK -F\. '{ print $2 }'`
910 MAKE_MAJOR_VERSION=`echo $MAKE_VERSION | $AWK -F\. '{ print $1 }'`
911 MAKE_MINOR_VERSION=`echo $MAKE_VERSION | $AWK -F\. '{ print $2 }'`
912 if test "$_MAKE_MAJOR_VERSION" -lt "$MAKE_MAJOR_VERSION" || \
913    test "$_MAKE_MAJOR_VERSION" = "$MAKE_MAJOR_VERSION" -a \
914         "$_MAKE_MINOR_VERSION" -lt "$MAKE_MINOR_VERSION"; then
915    AC_MSG_ERROR([GNU Make $MAKE_VERSION or higher is required to build Mozilla.])
917 AC_SUBST(MAKE)
919 if test "$COMPILE_ENVIRONMENT"; then
921 AC_PATH_XTRA
923 dnl Check in X11 include directory too.
924 if test "$no_x" != "yes"; then
925     CPPFLAGS="$CPPFLAGS $X_CFLAGS"
928 XCFLAGS="$X_CFLAGS"
930 fi # COMPILE_ENVIRONMENT
932 dnl ========================================================
933 dnl set the defaults first
934 dnl ========================================================
935 AS_BIN=$AS
936 AR_FLAGS='cr $@'
937 AR_LIST='$(AR) t'
938 AR_EXTRACT='$(AR) x'
939 AR_DELETE='$(AR) d'
940 AS='$(CC)'
941 AS_DASH_C_FLAG='-c'
942 DLL_PREFIX=lib
943 LIB_PREFIX=lib
944 DLL_SUFFIX=.so
945 OBJ_SUFFIX=o
946 LIB_SUFFIX=a
947 ASM_SUFFIX=s
948 IMPORT_LIB_SUFFIX=
949 TARGET_MD_ARCH=unix
950 DIRENT_INO=d_ino
951 CYGWIN_WRAPPER=
952 WIN_TOP_SRC=
953 MOZ_USER_DIR=".mozilla"
954 HOST_AR='$(AR)'
955 HOST_AR_FLAGS='$(AR_FLAGS)'
957 MOZ_JPEG_CFLAGS=
958 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)'
959 MOZ_ZLIB_CFLAGS=
960 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
961 MOZ_BZ2_CFLAGS=
962 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
963 MOZ_PNG_CFLAGS=
964 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)'
966 MOZ_JS_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
967 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core'
968 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin'
969 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom'
970 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
971 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
972 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
974 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
975 MOZ_XPCOM_OBSOLETE_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom_compat'
977 USE_DEPENDENT_LIBS=1
979 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
980 MOZ_GFX_TOOLKIT='$(MOZ_WIDGET_TOOLKIT)'
982 MOZ_ENABLE_POSTSCRIPT=1 
984 if test -n "$CROSS_COMPILE"; then
985     OS_TARGET="${target_os}"
986     OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
987     OS_RELEASE=
988     case "${target_os}" in
989         linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
990         kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
991         solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
992         mingw*)       OS_ARCH=WINNT ;;
993         wince*)       OS_ARCH=WINCE ;;
994         darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
995     esac
996 else
997     OS_TARGET=`uname -s`
998     OS_ARCH=`uname -s | sed -e 's|/|_|g'`
999     OS_RELEASE=`uname -r`
1002 # Before this used `uname -m` when not cross compiling
1003 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1004 OS_TEST="${target_cpu}"
1006 _COMPILER_PREFIX=
1008 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1010 #######################################################################
1011 # Master "Core Components" macros for getting the OS target           #
1012 #######################################################################
1015 # Note: OS_TARGET should be specified on the command line for gmake.
1016 # When OS_TARGET=WIN95 is specified, then a Windows 95 target is built.
1017 # The difference between the Win95 target and the WinNT target is that
1018 # the WinNT target uses Windows NT specific features not available
1019 # in Windows 95. The Win95 target will run on Windows NT, but (supposedly)
1020 # at lesser performance (the Win95 target uses threads; the WinNT target
1021 # uses fibers).
1023 # When OS_TARGET=WIN16 is specified, then a Windows 3.11 (16bit) target
1024 # is built. See: win16_3.11.mk for lots more about the Win16 target.
1026 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1027 # cross-compilation.
1031 # The following hack allows one to build on a WIN95 machine (as if
1032 # s/he were cross-compiling on a WINNT host for a WIN95 target).
1033 # It also accomodates for MKS's uname.exe.  If you never intend
1034 # to do development on a WIN95 machine, you don't need this hack.
1036 case "$OS_ARCH" in
1037 WIN95)
1038     OS_ARCH=WINNT
1039     OS_TARGET=WIN95
1040     ;;
1041 Windows_95)
1042     OS_ARCH=Windows_NT
1043     OS_TARGET=WIN95
1044     ;;
1045 Windows_98)
1046     OS_ARCH=Windows_NT
1047     OS_TARGET=WIN95
1048     ;;
1049 CYGWIN_9*|CYGWIN_ME*)
1050     OS_ARCH='CYGWIN_NT-4.0'
1051     OS_TARGET=WIN95
1052     ;;
1053 esac
1056 # Define and override various archtecture-specific variables, including
1057 # HOST_OS_ARCH
1058 # OS_ARCH
1059 # OS_TEST
1060 # OS_TARGET
1061 # OS_RELEASE
1062 # OS_MINOR_RELEASE
1065 case "$HOST_OS_ARCH" in
1066 cygwin*|mingw*|mks*|msvc*)
1067     HOST_OS_ARCH=WINNT
1068     ;;
1069 linux*)
1070     HOST_OS_ARCH=Linux
1071     ;;
1072 solaris*)
1073     HOST_OS_ARCH=SunOS
1074     ;;
1075 BSD_386)
1076     HOST_OS_ARCH=BSD
1077     ;;
1078 dgux)
1079     HOST_OS_ARCH=DGUX
1080     ;;
1081 IRIX64)
1082     HOST_OS_ARCH=IRIX
1083     ;;
1084 UNIX_SV)
1085     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1086         HOST_OS_ARCH=NCR
1087     else
1088         HOST_OS_ARCH=UNIXWARE
1089     fi
1090     ;;
1091 ncr)
1092     HOST_OS_ARCH=NCR
1093     ;;
1094 UNIX_SYSTEM_V)
1095     HOST_OS_ARCH=NEC
1096     ;;
1097 OSF1)
1098     ;;
1099 *OpenVMS*)
1100     HOST_OS_ARCH=OpenVMS
1101     ;;
1102 OS_2)
1103     HOST_OS_ARCH=OS2
1104     ;;
1105 QNX)
1106     ;;
1107 SCO_SV)
1108     HOST_OS_ARCH=SCOOS
1109     ;;
1110 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1111     HOST_OS_ARCH=SINIX
1112     ;;
1113 UnixWare)
1114     HOST_OS_ARCH=UNIXWARE
1115     ;;
1116 esac
1118 case "$OS_ARCH" in
1119 WINNT)
1120     OS_TEST=`uname -p`
1121     ;;
1122 Windows_NT)
1124 # If uname -s returns "Windows_NT", we assume that we are using
1125 # the uname.exe in MKS toolkit.
1127 # The -r option of MKS uname only returns the major version number.
1128 # So we need to use its -v option to get the minor version number.
1129 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1131     OS_ARCH=WINNT
1132     OS_TARGET=WINNT
1133     OS_MINOR_RELEASE=`uname -v`
1134     if test "$OS_MINOR_RELEASE" = "00"; then
1135         OS_MINOR_RELEASE=0
1136     fi
1137     OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1138     ;;
1139 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1141 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1142 # the uname.exe in the Cygwin tools.
1143 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1144 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1145 # the uname.exe in the GNU-Win32 tools.
1146 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1147 # the uname.exe in the MSYS tools.
1149     OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1150     OS_ARCH=WINNT
1151     OS_TARGET=WINNT
1152     ;;
1153 AIX)
1154     OS_RELEASE=`uname -v`.`uname -r`
1155     OS_TEST=`uname -p`
1156     ;;
1157 BSD_386)
1158     OS_ARCH=BSD
1159     ;;
1160 dgux)
1161     OS_ARCH=DGUX
1162     ;;
1163 IRIX64)
1164     OS_ARCH=IRIX
1165     ;;
1166 UNIX_SV)
1167     if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1168         OS_ARCH=NCR
1169     else
1170         OS_ARCH=UNIXWARE
1171         OS_RELEASE=`uname -v`
1172     fi
1173     ;;
1174 ncr)
1175     OS_ARCH=NCR
1176     ;;
1177 UNIX_SYSTEM_V)
1178     OS_ARCH=NEC
1179     ;;
1180 OSF1)
1181     case `uname -v` in
1182     148)
1183         OS_RELEASE=V3.2C
1184         ;;
1185     564)
1186         OS_RELEASE=V4.0B
1187         ;;
1188     878)
1189         OS_RELEASE=V4.0D
1190         ;;
1191     esac
1192     ;;
1193 *OpenVMS*)
1194     OS_ARCH=OpenVMS
1195     OS_RELEASE=`uname -v`
1196     OS_TEST=`uname -p`
1197     ;;
1198 OS_2)
1199     OS_ARCH=OS2
1200     OS_TARGET=OS2
1201     OS_RELEASE=`uname -v`
1202     ;;
1203 QNX)
1204     if test "$OS_TARGET" != "NTO"; then
1205         changequote(,)
1206         OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1207         changequote([,])
1208     fi
1209     OS_TEST=x86
1210     ;;
1211 SCO_SV)
1212     OS_ARCH=SCOOS
1213     OS_RELEASE=5.0
1214     ;;
1215 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1216     OS_ARCH=SINIX
1217     OS_TEST=`uname -p`
1218     ;;
1219 UnixWare)
1220     OS_ARCH=UNIXWARE
1221     OS_RELEASE=`uname -v`
1222     ;;
1223 WINCE)
1224     OS_ARCH=WINCE
1225     OS_TARGET=WINCE
1226     ;;
1227 Darwin)
1228     case "${target_cpu}" in
1229     powerpc*)
1230         OS_TEST=ppc
1231         ;;
1232     i*86*)
1233         OS_TEST=i386 
1234         ;;
1235     *)
1236         if test -z "$CROSS_COMPILE" ; then
1237             OS_TEST=`uname -p`
1238         fi
1239         ;;
1240     esac
1241     ;;
1242 esac
1244 if test "$OS_ARCH" = "NCR"; then
1245     changequote(,)
1246     OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1247     changequote([,])
1250 # Only set CPU_ARCH if we recognize the value of OS_TEST
1252 case "$OS_TEST" in
1253 *86 | i86pc)
1254     CPU_ARCH=x86
1255     ;;
1257 powerpc* | ppc)
1258     CPU_ARCH=ppc
1259     ;;
1261 Alpha | alpha | ALPHA)
1262     CPU_ARCH=Alpha
1263     ;;
1265 hppa* | parisc)
1266     CPU_ARCH=hppa
1267     ;;
1269 sun4u | sparc*)
1270     CPU_ARCH=sparc
1271     ;;
1273 x86_64 | ia64)
1274     CPU_ARCH="$OS_TEST"
1275     ;;
1276 esac
1278 if test -z "$OS_TARGET"; then
1279     OS_TARGET=$OS_ARCH
1281 if test "$OS_TARGET" = "WIN95"; then
1282     OS_RELEASE="4.0"
1284 if test "$OS_TARGET" = "WIN16"; then
1285     OS_RELEASE=
1287 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1289 dnl ========================================================
1290 dnl GNU specific defaults
1291 dnl ========================================================
1292 if test "$GNU_CC"; then
1293     # FIXME: Let us build with strict aliasing. bug 414641.
1294     CFLAGS="$CFLAGS -fno-strict-aliasing"
1295     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1296     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1297     DSO_LDOPTS='-shared'
1298     if test "$GCC_USE_GNU_LD"; then
1299         # Don't allow undefined symbols in libraries
1300         DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1301     fi
1302     WARNINGS_AS_ERRORS='-Werror'
1303     DSO_CFLAGS=''
1304     DSO_PIC_CFLAGS='-fPIC'
1305     _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1306     _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1307     _MOZ_EXCEPTIONS_FLAGS_ON='-fhandle-exceptions'
1308     _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-handle-exceptions'
1310     # Turn on GNU specific features
1311     # -Wall - turn on all warnings
1312     # -pedantic - make compiler warn about non-ANSI stuff, and
1313     #             be a little bit stricter
1314     # Warnings slamm took out for now (these were giving more noise than help):
1315     # -Wbad-function-cast - warns when casting a function to a new return type
1316     # -Wconversion - complained when char's or short's were used a function args
1317     # -Wshadow - removed because it generates more noise than help --pete
1318     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1319     if test -z "$INTEL_CC"; then
1320        # Don't use -Wcast-align with ICC
1321        case "$CPU_ARCH" in
1322            # And don't use it on hppa, ia64, sparc, since it's noisy there
1323            hppa | ia64 | sparc)
1324            ;;
1325            *)
1326         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1327            ;;
1328        esac
1329     fi
1331     dnl Turn pedantic on but disable the warnings for long long
1332     _PEDANTIC=1
1334     if test -z "$INTEL_CC"; then
1335       _IGNORE_LONG_LONG_WARNINGS=1
1336       _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1337     else
1338       _IGNORE_LONG_LONG_WARNINGS=
1339     fi
1342     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1343     _USE_CPP_INCLUDE_FLAG=1
1344 else
1345     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1346     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1348     DSO_LDOPTS='-shared'
1349     if test "$GNU_LD"; then
1350         # Don't allow undefined symbols in libraries
1351         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1352     fi
1354     DSO_CFLAGS=''
1355     DSO_PIC_CFLAGS='-KPIC'
1356     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1359 if test "$GNU_CXX"; then
1360     # FIXME: Let us build with strict aliasing. bug 414641.
1361     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1362     # Turn on GNU specific features
1363     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wconversion -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1364     if test -z "$INTEL_CC"; then
1365        # Don't use -Wcast-align with ICC
1366        case "$CPU_ARCH" in
1367            # And don't use it on hppa, ia64, sparc, since it's noisy there
1368            hppa | ia64 | sparc)
1369            ;;
1370            *)
1371         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1372            ;;
1373        esac
1374     fi
1376     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1377     _USE_CPP_INCLUDE_FLAG=1
1378 else
1379     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1382 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1383 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1384 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1385 dnl normal behavior.
1386 dnl ========================================================
1387 MKSHLIB_FORCE_ALL=
1388 MKSHLIB_UNFORCE_ALL=
1390 if test "$COMPILE_ENVIRONMENT"; then
1391 if test "$GNU_CC"; then
1392   AC_MSG_CHECKING(whether ld has archive extraction flags)
1393   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1394    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1395     ac_cv_mkshlib_force_and_unforce="no"
1396     exec 3<&0 <<LOOP_INPUT
1397         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1398         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1399         force="-Wl,-all";              unforce="-Wl,-none"
1400 LOOP_INPUT
1401     while read line
1402     do
1403       eval $line
1404       LDFLAGS=$force
1405       LIBS=$unforce
1406       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1407     done
1408     exec 0<&3 3<&-
1409     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1410    ])
1411   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1412     AC_MSG_RESULT(no)
1413   else
1414     AC_MSG_RESULT(yes)
1415     eval $ac_cv_mkshlib_force_and_unforce
1416     MKSHLIB_FORCE_ALL=$force
1417     MKSHLIB_UNFORCE_ALL=$unforce
1418   fi
1419 fi # GNU_CC
1420 fi # COMPILE_ENVIRONMENT
1422 dnl =================================================================
1423 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1424 dnl which is bad when cross compiling.
1425 dnl =================================================================
1426 if test "$COMPILE_ENVIRONMENT"; then
1427 configure_static_assert_macros='
1428 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1429 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1430 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1433 dnl test that the macros actually work:
1434 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1435 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1436  [AC_LANG_SAVE
1437   AC_LANG_C
1438   ac_cv_static_assertion_macros_work="yes"
1439   AC_TRY_COMPILE([$configure_static_assert_macros],
1440                  [CONFIGURE_STATIC_ASSERT(1)],
1441                  ,
1442                  ac_cv_static_assertion_macros_work="no")
1443   AC_TRY_COMPILE([$configure_static_assert_macros],
1444                  [CONFIGURE_STATIC_ASSERT(0)],
1445                  ac_cv_static_assertion_macros_work="no",
1446                  )
1447   AC_LANG_CPLUSPLUS
1448   AC_TRY_COMPILE([$configure_static_assert_macros],
1449                  [CONFIGURE_STATIC_ASSERT(1)],
1450                  ,
1451                  ac_cv_static_assertion_macros_work="no")
1452   AC_TRY_COMPILE([$configure_static_assert_macros],
1453                  [CONFIGURE_STATIC_ASSERT(0)],
1454                  ac_cv_static_assertion_macros_work="no",
1455                  )
1456   AC_LANG_RESTORE
1457  ])
1458 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1459 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1460     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1463 fi # COMPILE_ENVIRONMENT
1465 dnl ========================================================
1466 dnl Checking for 64-bit OS
1467 dnl ========================================================
1468 if test "$COMPILE_ENVIRONMENT"; then
1469 AC_LANG_SAVE
1470 AC_LANG_C
1471 AC_MSG_CHECKING(for 64-bit OS)
1472 AC_TRY_COMPILE([$configure_static_assert_macros],
1473                [CONFIGURE_STATIC_ASSERT(sizeof(long) == 8)],
1474                result="yes", result="no")
1475 AC_MSG_RESULT("$result")
1476 if test "$result" = "yes"; then
1477     AC_DEFINE(HAVE_64BIT_OS)
1478     HAVE_64BIT_OS=1
1480 AC_SUBST(HAVE_64BIT_OS)
1481 AC_LANG_RESTORE
1482 fi # COMPILE_ENVIRONMENT
1484 dnl ========================================================
1485 dnl Enable high-memory support on OS/2 by default.
1486 dnl ========================================================
1487 MOZ_OS2_HIGH_MEMORY=1
1488 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1489 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1490     MOZ_OS2_HIGH_MEMORY=,
1491     MOZ_OS2_HIGH_MEMORY=1 )
1492 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1494 dnl ========================================================
1495 dnl System overrides of the defaults for host
1496 dnl ========================================================
1497 case "$host" in
1498 *-beos*)
1499     HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1500     HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1501     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1502     ;;
1504 *cygwin*|*mingw*|*mks*|*msvc*|*wince)
1505     if test -n "$_WIN32_MSVC"; then
1506         HOST_AR=lib
1507         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1508         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1509         HOST_RANLIB='echo ranlib'
1510     else
1511         HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1512     fi
1513     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1514     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1515     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1516     HOST_BIN_SUFFIX=.exe
1517     case "$host" in
1518     *mingw*)
1519     dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1520         ;;
1521     *)
1522         CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1523         if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1524             _pwd=`pwd`
1525             CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1526         fi
1527         if test "`${PERL} -v | grep -c cygwin  2>/dev/null`" = 0; then
1528             AS_PERL=1
1529             PERL="${CYGWIN_WRAPPER} $PERL"
1530         fi
1532         if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1533             PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1534         fi
1535         ;;
1536     esac
1537     ;;
1539 *-darwin*)
1540     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1541     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1542     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1543     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1544     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL -lobjc'
1545     ;;
1547 *-linux*|*-kfreebsd*-gnu)
1548     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1549     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1550     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1551     ;;
1553 *os2*)
1554     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1555     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1556     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1557     HOST_BIN_SUFFIX=.exe
1558     MOZ_FIX_LINK_PATHS=
1559     ;;
1561 *-osf*)
1562     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1563     HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1564     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1565     ;;
1568     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1569     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1570     ;;
1571 esac
1573 dnl Get mozilla version from central milestone file
1574 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1576 dnl Get version of various core apps from the version files.
1577 FIREFOX_VERSION=`cat $topsrcdir/browser/config/version.txt`
1578 THUNDERBIRD_VERSION=`cat $topsrcdir/mail/config/version.txt`
1579 SUNBIRD_VERSION=`cat $topsrcdir/calendar/sunbird/config/version.txt`
1580 SEAMONKEY_VERSION=`cat $topsrcdir/suite/config/version.txt`
1582 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1583 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1585 PKG_CHECK_MODULES(LIBHILONMIME,libhildonmime,
1586                   NS_HILDON=1,
1587                   NS_HILDON=)
1588 if test $NS_HILDON; then
1589    AC_DEFINE(NS_HILDON)
1592 PKG_CHECK_MODULES(LIBOSSO,libosso,
1593                   NS_OSSO=1,
1594                   NS_OSSO=)
1596 if test $NS_OSSO; then
1597    AC_DEFINE(NS_OSSO)     
1600 dnl ========================================================
1601 dnl System overrides of the defaults for target
1602 dnl ========================================================
1604 case "$target" in
1605 *-aix*)
1606     AC_DEFINE(AIX)
1607     if test ! "$GNU_CC"; then
1608         if test ! "$HAVE_64BIT_OS"; then
1609             # Compiling with Visual Age C++ object model compat is the
1610             # default. To compile with object model ibm, add 
1611             # AIX_OBJMODEL=ibm to .mozconfig.
1612             if test "$AIX_OBJMODEL" = "ibm"; then
1613                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1614             else
1615                 AIX_OBJMODEL=compat
1616             fi
1617         else
1618             AIX_OBJMODEL=compat
1619         fi
1620         AC_SUBST(AIX_OBJMODEL)
1621         DSO_LDOPTS='-qmkshrobj=1'
1622         DSO_CFLAGS='-qflag=w:w'
1623         DSO_PIC_CFLAGS=
1624         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1625         AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1626         MOZ_FIX_LINK_PATHS=
1627         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1628         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1629         if test "$COMPILE_ENVIRONMENT"; then
1630             AC_LANG_SAVE
1631             AC_LANG_CPLUSPLUS
1632             AC_MSG_CHECKING([for VisualAge C++ compiler version >= 5.0.2.0])
1633             AC_TRY_COMPILE([],
1634                 [#if (__IBMCPP__ < 502)
1635                  #error "Bad compiler"
1636                  #endif],
1637                 _BAD_COMPILER=,_BAD_COMPILER=1)
1638             if test -n "$_BAD_COMPILER"; then
1639                 AC_MSG_RESULT([no])    
1640                 AC_MSG_ERROR([VisualAge C++ version 5.0.2.0 or higher is required to build.])
1641             else
1642                 AC_MSG_RESULT([yes])    
1643             fi
1644             AC_LANG_RESTORE
1645             TARGET_COMPILER_ABI="ibmc"
1646             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1647             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1648         fi
1649     fi
1650     case "${target_os}" in
1651     aix4.1*)
1652         DLL_SUFFIX='_shr.a'
1653         ;;
1654     esac
1655     if test "$COMPILE_ENVIRONMENT"; then
1656         AC_CHECK_HEADERS(sys/inttypes.h)
1657     fi
1658     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1659     ;;
1661 *-beos*)
1662     no_x=yes
1663     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1664     _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
1665     DSO_LDOPTS='-nostart'
1666     TK_LIBS='-lbe -lroot'
1667     LIBS="$LIBS -lbe"
1668     if test "$COMPILE_ENVIRONMENT"; then
1669         AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
1670         AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
1671     fi
1672     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
1673     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
1674     _MOZ_USE_RTTI=1
1675     USE_DEPENDENT_LIBS=
1676     MOZ_USER_DIR="Mozilla"
1677     ;;
1679 *-bsdi*)
1680     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
1681     _PEDANTIC=
1682     _IGNORE_LONG_LONG_WARNINGS=
1683     case $OS_RELEASE in
1684         4.*|5.*)
1685             STRIP="$STRIP -d"
1686             ;;
1687         *)
1688             DSO_CFLAGS=''
1689             DSO_LDOPTS='-r'
1690             _WARNINGS_CFLAGS="-Wall"
1691             _WARNINGS_CXXFLAGS="-Wall"
1692             # The test above doesn't work properly, at least on 3.1.
1693             MKSHLIB_FORCE_ALL=''
1694             MKSHLIB_UNFORCE_ALL=''
1695         ;;
1696     esac
1697     ;;
1699 *-darwin*) 
1700     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1701     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1702     MOZ_OPTIMIZE_FLAGS="-O2"
1703     _PEDANTIC=
1704     CFLAGS="$CFLAGS -fpascal-strings -fno-common"
1705     CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
1706     DLL_SUFFIX=".dylib"
1707     DSO_LDOPTS=''
1708     STRIP="$STRIP -x -S"
1709     _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1710     MOZ_ENABLE_POSTSCRIPT=
1711     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1712     LDFLAGS="$LDFLAGS -framework Cocoa"
1713     # The ExceptionHandling framework is needed for Objective-C exception
1714     # logging code in nsObjCExceptions.h. Currently we only use that in debug
1715     # builds.
1716     MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
1717     # set MACOSX to generate lib/mac/MoreFiles/Makefile
1718     MACOSX=1
1720     dnl DTrace and -dead_strip don't interact well. See bug 403132.
1721     dnl ===================================================================
1722     if test "x$enable_dtrace" = "xyes"; then
1723         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1724     else
1725         dnl check for the presence of the -dead_strip linker flag
1726         AC_MSG_CHECKING([for -dead_strip option to ld])
1727         _SAVE_LDFLAGS=$LDFLAGS
1728         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1729         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1730         if test -n "$_HAVE_DEAD_STRIP" ; then
1731             AC_MSG_RESULT([yes])
1732             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1733         else
1734             AC_MSG_RESULT([no])
1735         fi
1736         
1737         LDFLAGS=$_SAVE_LDFLAGS
1738     fi
1739     ;;
1741 *-freebsd*)
1742     if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
1743         DLL_SUFFIX=".so.1.0"
1744         DSO_LDOPTS="-shared"
1745     fi
1746     if test ! "$GNU_CC"; then
1747         DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
1748     fi
1749 # Can't have force w/o an unforce.
1750 #    # Hack for FreeBSD 2.2
1751 #    if test -z "$MKSHLIB_FORCE_ALL"; then
1752 #       MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive'
1753 #       MKSHLIB_UNFORCE_ALL=''
1754 #    fi
1755     ;; 
1757 *-hpux*)
1758     DLL_SUFFIX=".sl"
1759     if test ! "$GNU_CC"; then
1760         DSO_LDOPTS='-b -Wl,+s'
1761         DSO_CFLAGS=""
1762         DSO_PIC_CFLAGS="+Z"
1763         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1764         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1765         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1766     else
1767         DSO_LDOPTS='-b -E +s'
1768         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1769         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1770     fi
1771     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1772     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1773     ;;
1775 *-irix5*)
1776     AC_DEFINE(IRIX)
1777     DSO_LDOPTS='-elf -shared'
1779     if test "$GNU_CC"; then
1780        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1781        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1782        MKSHLIB_FORCE_ALL='-Wl,-all'
1783        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1784        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1785     else
1786        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1787        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1788        MKSHLIB_FORCE_ALL='-all'
1789        MKSHLIB_UNFORCE_ALL='-none'
1790     fi
1791     ;;
1793 *-irix6*)
1794     AC_DEFINE(IRIX)
1795     dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must* 
1796     dnl compile and link using -n32
1797     USE_N32=1
1798     TARGET_COMPILER_ABI=n32
1799     DSO_LDOPTS='-elf -shared'
1800     MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1801     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1802     _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
1803     _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
1804     if test "$GNU_CC"; then
1805        MKSHLIB_FORCE_ALL='-Wl,-all'
1806        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1807        _WARNINGS_CFLAGS="-Wall"
1808        _WARNINGS_CXXFLAGS="-Wall"
1809        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1810     else
1811        MKSHLIB_FORCE_ALL='-all'
1812        MKSHLIB_UNFORCE_ALL='-none'
1813            AR_LIST="$AR t"
1814            AR_EXTRACT="$AR x"
1815            AR_DELETE="$AR d"
1816            AR='$(CXX) -ar'
1817            AR_FLAGS='-o $@'
1818        CFLAGS="$CFLAGS -woff 3262 -G 4"
1819        CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
1820        if test -n "$USE_N32"; then
1821            ASFLAGS="$ASFLAGS -n32"
1822            CFLAGS="$CFLAGS -n32"
1823            CXXFLAGS="$CXXFLAGS -n32"
1824            LDFLAGS="$LDFLAGS -n32"
1825        fi
1826        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1827        AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
1828        MOZ_FIX_LINK_PATHS=
1829     fi
1830     if test -z "$GNU_CXX"; then
1831       MIPSPRO_CXX=1
1832     fi
1833     ;;
1835 *-*linux*)
1836     if test "$GNU_CC"; then
1837         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
1838         case $GCC_VERSION in
1839         4.1.*|4.2.*)
1840             # -Os is broken on gcc 4.1.x and 4.2.x, we need to tweak it to get good results.
1841             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
1842         esac
1843     fi
1845     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1846     MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions $MOZ_OPTIMIZE_SIZE_TWEAK"
1847     MOZ_DEBUG_FLAGS="-g -fno-inline"  # most people on linux use gcc/gdb,
1848                                       # and that combo is not yet good at
1849                                       # debugging inlined functions (even
1850                                       # when using DWARF2 as the debugging
1851                                       # format)    
1853     MOZ_MEMORY=1
1855     case "${target_cpu}" in
1856     alpha*)
1857         CFLAGS="$CFLAGS -mieee"
1858         CXXFLAGS="$CXXFLAGS -mieee"
1859     ;;
1860     i*86)
1861         USE_ELF_DYNSTR_GC=1
1862         MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1
1863     ;;
1864     mips*)
1865         CFLAGS="$CFLAGS -Wa,-xgot"
1866         CXXFLAGS="$CXXFLAGS -Wa,-xgot"
1867     ;;
1868     esac
1869     ;;
1871 *-wince*)
1873     MOZ_TOOLS_DIR=`echo $MOZ_TOOLS`
1874     AR_LIST="$AR -list"
1875     AR_EXTRACT="$AR -extract"
1876     AR_DELETE="$AR d"
1877     AR_FLAGS='-OUT:"$@"'
1879     DSO_CFLAGS=
1880     DSO_PIC_CFLAGS=
1881     DLL_SUFFIX=.dll
1882     BIN_SUFFIX='.exe'
1883     RC=rc.exe
1884     # certain versions of cygwin's makedepend barf on the 
1885     # #include <string> vs -I./dist/include/string issue so don't use it
1886     SYSTEM_MAKEDEPEND=
1888     HOST_CC=cl
1889     HOST_CXX=cl
1890     HOST_LD=link
1891     HOST_AR='lib -OUT:$@'
1892     HOST_RANLIB='echo ranlib'
1893     HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
1894         
1895         
1896     WARNINGS_AS_ERRORS='-WX'
1897         MOZ_OPTIMIZE_FLAGS='-O1'
1898     AR_FLAGS='-NOLOGO -OUT:"$@"'
1899     ASM_SUFFIX=asm
1900     CFLAGS="$CFLAGS -W3 -Gy -Fd\$(PDBFILE)"
1901     CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(PDBFILE)"
1902     DLL_PREFIX=
1903     DOXYGEN=:
1904     DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
1905     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
1906     GARBAGE=
1907     IMPORT_LIB_SUFFIX=lib
1908     LIBS="$LIBS"
1909     LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
1910     LIB_PREFIX=
1911     LIB_SUFFIX=lib 
1912     MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
1913     MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
1914     MKSHLIB_FORCE_ALL=
1915     MKSHLIB_UNFORCE_ALL=
1916     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1917     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1918     MOZ_DEBUG_FLAGS='-Zi'
1919     MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1920     MOZ_FIX_LINK_PATHS=
1921     MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
1922     MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
1923     OBJ_SUFFIX=obj
1924     RANLIB='echo not_ranlib'
1925     STRIP='echo not_strip'
1926     TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
1927     UNZIP=unzip
1928     XARGS=xargs
1929     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
1930     ZIP=zip
1931     LIBIDL_CFLAGS="-I$MOZ_TOOLS_DIR/include ${GLIB_CFLAGS}"
1932     LIBIDL_LIBS="$MOZ_TOOLS_DIR/lib/libidl-0.6_s.lib $MOZ_TOOLS_DIR/lib/glib-1.2_s.lib"
1933     STATIC_LIBIDL=1
1935     AC_DEFINE(HAVE_SNPRINTF)
1936     AC_DEFINE(_WINDOWS)
1937     AC_DEFINE(_WIN32)
1938     AC_DEFINE(WIN32)
1939     AC_DEFINE(XP_WIN)
1940     AC_DEFINE(XP_WIN32)
1941     AC_DEFINE(HW_THREADS)
1942     AC_DEFINE(STDC_HEADERS)
1943     AC_DEFINE(NEW_H, <new>)
1944     AC_DEFINE(WIN32_LEAN_AND_MEAN)
1946     TARGET_MD_ARCH=win32
1947     _PLATFORM_DEFAULT_TOOLKIT='windows'
1948     BIN_SUFFIX='.exe'
1949     USE_SHORT_LIBNAME=1
1950     MOZ_ENABLE_POSTSCRIPT=
1951     MOZ_USER_DIR="Mozilla"
1955 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
1956     DSO_CFLAGS=
1957     DSO_PIC_CFLAGS=
1958     DLL_SUFFIX=.dll
1959     RC=rc.exe
1960     # certain versions of cygwin's makedepend barf on the 
1961     # #include <string> vs -I./dist/include/string issue so don't use it
1962     SYSTEM_MAKEDEPEND=
1963     if test -n "$GNU_CC"; then
1964         CC="$CC -mno-cygwin"
1965         CXX="$CXX -mno-cygwin"
1966         CPP="$CPP -mno-cygwin"
1967         CFLAGS="$CFLAGS -mms-bitfields"
1968         CXXFLAGS="$CXXFLAGS -mms-bitfields"
1969         DSO_LDOPTS='-shared'
1970         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1971         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1972         RC='$(WINDRES)'
1973         # Use temp file for windres (bug 213281)
1974         RCFLAGS='-O coff --use-temp-file'
1975         # mingw doesn't require kernel32, user32, and advapi32 explicitly
1976         LIBS="$LIBS -lgdi32 -lwinmm -lwsock32"
1977         MOZ_JS_LIBS='-L$(LIBXUL_DIST)/lib -ljs$(MOZ_BITS)$(VERSION_NUMBER)'
1978         MOZ_FIX_LINK_PATHS=
1979         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core'
1980         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom'
1981         DLL_PREFIX=
1982         IMPORT_LIB_SUFFIX=dll.a
1983     else
1984         TARGET_COMPILER_ABI=msvc
1985         HOST_CC='$(CC)'
1986         HOST_CXX='$(CXX)'
1987         HOST_LD='$(LD)'
1988         AR='lib -NOLOGO -OUT:"$@"'
1989         AR_FLAGS=
1990         RANLIB='echo not_ranlib'
1991         STRIP='echo not_strip'
1992         XARGS=xargs
1993         ZIP=zip
1994         UNZIP=unzip
1995         DOXYGEN=:
1996         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
1997         OBJ_SUFFIX=obj
1998         LIB_SUFFIX=lib
1999         DLL_PREFIX=
2000         LIB_PREFIX=
2001         IMPORT_LIB_SUFFIX=lib
2002         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(PDBFILE) $(DSO_LDOPTS)'
2003         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(PDBFILE) $(DSO_LDOPTS)'
2004         MKSHLIB_FORCE_ALL=
2005         MKSHLIB_UNFORCE_ALL=
2006         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2007         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(PDBFILE)"
2008         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(PDBFILE)"
2009         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2010         MOZ_DEBUG_FLAGS='-Zi'
2011         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2012         WARNINGS_AS_ERRORS='-WX'
2013         MOZ_OPTIMIZE_FLAGS='-O1'
2014         MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
2015         MOZ_FIX_LINK_PATHS=
2016         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
2017         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
2018         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2019         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2020         MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
2021         if test $_MSC_VER -ge 1400; then
2022             LDFLAGS="$LDFLAGS -NXCOMPAT -SAFESEH"
2023             dnl For profile-guided optimization
2024             PROFILE_GEN_CFLAGS="-GL"
2025             PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2026             dnl XXX: PGO builds can fail with warnings treated as errors,
2027             dnl specifically "no profile data available" appears to be
2028             dnl treated as an error sometimes. This might be a consequence
2029             dnl of using WARNINGS_AS_ERRORS in some modules, combined
2030             dnl with the linker doing most of the work in the whole-program
2031             dnl optimization/PGO case. I think it's probably a compiler bug,
2032             dnl but we work around it here.
2033             PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2034             dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2035             dnl Probably also a compiler bug, but what can you do?
2036             PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2037             if test -n "$_USE_DYNAMICBASE"; then
2038                LDFLAGS="$LDFLAGS -DYNAMICBASE"
2039             fi
2040         fi
2041     fi
2042     MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg$(MOZ_BITS)$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2043     MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2044     AC_DEFINE(HAVE_SNPRINTF)
2045     AC_DEFINE(_WINDOWS)
2046     AC_DEFINE(_WIN32)
2047     AC_DEFINE(WIN32)
2048     AC_DEFINE(XP_WIN)
2049     AC_DEFINE(XP_WIN32)
2050     AC_DEFINE(HW_THREADS)
2051     AC_DEFINE(STDC_HEADERS)
2052     AC_DEFINE(NEW_H, <new>)
2053     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2054     TARGET_MD_ARCH=win32
2055     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2056     BIN_SUFFIX='.exe'
2057     USE_SHORT_LIBNAME=1
2058     MOZ_ENABLE_POSTSCRIPT=
2059     MOZ_USER_DIR="Mozilla"
2061     dnl Hardcode to win95 for now - cls
2062     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2064     dnl set NO_X11 defines here as the general check is skipped on win32
2065     no_x=yes
2066     AC_DEFINE(NO_X11)
2068     dnl MinGW/MSYS doesn't provide or need cygpath
2069     case "$host" in
2070     *-mingw*)
2071         CYGPATH_W=echo
2072         CYGPATH_S=cat
2073         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2074         ;;
2075     *-cygwin*|*-msvc*|*-mks*)
2076         CYGPATH_W="cygpath -a -w"
2077         CYGPATH_S="sed -e s|\\\\|/|g"
2078         MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2079         ;;
2080     esac
2081     case "$host" in
2082     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2084     if test -z "$MOZ_TOOLS"; then
2085         AC_MSG_ERROR([MOZ_TOOLS is not set])
2086     fi
2088     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd`
2089     if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then
2090         AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2091     fi
2092     if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_DIR/bin:"` = 0; then
2093         AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2094     fi
2095     MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2097     if test -n "$GLIB_PREFIX"; then
2098         _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd`
2099         if test "$?" = "0"; then
2100             if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
2101                 AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
2102             fi
2103             _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
2104         else
2105             AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
2106         fi
2107     else
2108         _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
2109     fi
2110     if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
2111         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
2112     fi
2113     GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
2114     if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
2115         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
2116     elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
2117         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
2118     else
2119         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
2120     fi
2122     if test -n "$LIBIDL_PREFIX"; then
2123         _LIBIDL_PREFIX_DIR=`cd $LIBIDL_PREFIX && pwd`
2124         if test "$?" = "0"; then
2125             if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
2126                 AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
2127             fi
2128             _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
2129         else
2130             AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
2131         fi
2132     else
2133         _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
2134     fi        
2135     if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
2136         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
2137     fi
2138     LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
2139     if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
2140         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
2141         STATIC_LIBIDL=1
2142     elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
2143         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
2144     else
2145         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
2146     fi
2147     LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2148     ;;
2150     *) # else cross-compiling
2151         if test -n "$GLIB_PREFIX"; then
2152             GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
2153             if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
2154                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
2155             elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
2156                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
2157             else
2158                 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
2159             fi
2160         fi
2161         if test -n "$LIBIDL_PREFIX"; then
2162             LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
2163             if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
2164                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
2165                 STATIC_LIBIDL=1
2166             elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
2167                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
2168             else
2169                 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
2170             fi
2171         fi
2172         LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2173         ;;
2174     esac 
2177     case "$host_os" in
2178     cygwin*|msvc*|mks*)
2179         AC_MSG_WARN([Using a cygwin build environment is unsupported. Configure cannot check for the presence of necessary headers. Please upgrade to MozillaBuild; see http://developer.mozilla.org/en/docs/Windows_Build_Prerequisites])
2180         ;;
2182     *)
2183         AC_CHECK_HEADERS(mmintrin.h oleacc.idl)
2185         AC_LANG_SAVE
2186         AC_LANG_CPLUSPLUS
2187         AC_CHECK_HEADERS(atlbase.h wpcapi.h)
2188         AC_LANG_RESTORE
2189         ;;
2190     esac
2192     case "$target" in
2193     i*86-*)
2194         AC_DEFINE(_X86_)
2195         ;;
2196     alpha-*)
2197         AC_DEFINE(_ALPHA_)
2198         ;;
2199     mips-*)
2200         AC_DEFINE(_MIPS_)
2201         ;;
2202     *)
2203         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2204         ;;
2205     esac
2206     ;;
2208 *-netbsd*)
2209     DSO_CFLAGS=''
2210     CFLAGS="$CFLAGS -Dunix"
2211     CXXFLAGS="$CXXFLAGS -Dunix"
2212     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2213         DLL_SUFFIX=".so"
2214         DSO_PIC_CFLAGS='-fPIC -DPIC'
2215         DSO_LDOPTS='-shared'
2216         BIN_FLAGS='-Wl,--export-dynamic'
2217     else
2218         DSO_PIC_CFLAGS='-fPIC -DPIC'
2219         DLL_SUFFIX=".so.1.0"
2220         DSO_LDOPTS='-shared'
2221     fi
2222     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2223     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2224     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2225     if test "$LIBRUNPATH"; then
2226         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2227     fi
2228     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2229     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2230     ;;
2232 *-nto*) 
2233         AC_DEFINE(NTO)  
2234         AC_DEFINE(_QNX_SOURCE)
2235         AC_DEFINE(_i386)
2236         OS_TARGET=NTO
2237         WARNINGS_AS_ERRORS=''
2238         MOZ_OPTIMIZE_FLAGS="-O"
2239         MOZ_DEBUG_FLAGS="-gstabs"
2240         USE_PTHREADS=1
2241         _PEDANTIC=
2242         LIBS="$LIBS -lsocket -lstdc++"
2243         _DEFINES_CFLAGS='-Wp,-include -Wp,$(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2244         _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -Wp,-include -Wp,$(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2245         if test "$with_x" != "yes"
2246         then
2247                 _PLATFORM_DEFAULT_TOOLKIT="photon"
2248             TK_CFLAGS='-I/usr/include/photon'
2249                 TK_LIBS='-lph'
2250         fi
2251         case "${target_cpu}" in
2252         ppc*)
2253         AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)        
2254         ;;
2255         esac
2256         case "${host_cpu}" in
2257         i*86)
2258         USE_ELF_DYNSTR_GC=1
2259         ;;
2260         esac
2261         ;;
2263 *-openbsd*)
2264     DLL_SUFFIX=".so.1.0"
2265     DSO_CFLAGS=''
2266     DSO_PIC_CFLAGS='-fPIC'
2267     DSO_LDOPTS='-shared -fPIC'
2268     if test "$LIBRUNPATH"; then
2269         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2270     fi
2271     ;;
2273 *-openvms*) 
2274     AC_DEFINE(NO_PW_GECOS)
2275     AC_DEFINE(NO_UDSOCK)
2276     AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2277     USE_PTHREADS=1
2278     MKSHLIB_FORCE_ALL='-all'
2279     MKSHLIB_UNFORCE_ALL='-none'
2280     AS='as'
2281     AS_DASH_C_FLAG='-Wc/names=as_is'
2282     AR_FLAGS='c $@'
2283     DSO_LDOPTS='-shared -auto_symvec'
2284     DSO_PIC_CFLAGS=
2285     MOZ_DEBUG_LDFLAGS='-g'
2286     COMPAQ_CXX=1
2287     CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2288     CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2289     ;;
2292 *-os2*)
2293     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2294     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2295     AC_DEFINE(XP_OS2)
2296     USE_SHORT_LIBNAME=1
2297     DLL_PREFIX=
2298     LIB_PREFIX=
2299     LIB_SUFFIX=lib
2300     BIN_SUFFIX=".exe"
2301     DLL_SUFFIX=".dll"
2302     IMPORT_LIB_SUFFIX=lib
2303     DSO_PIC_CFLAGS=
2304     TARGET_MD_ARCH=os2
2305     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2306     MOZ_ENABLE_POSTSCRIPT=
2307     RC=rc.exe
2308     RCFLAGS='-n'
2309     MOZ_USER_DIR="Mozilla"
2311     if test "$MOZTOOLS"; then
2312         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2313     else
2314         AC_MSG_ERROR([MOZTOOLS is not set])
2315     fi
2317     # EMX/GCC build
2318     if test -n "$GNU_CC"; then
2319         AC_DEFINE(OS2)
2320         AC_DEFINE(XP_OS2_EMX)
2321         AC_DEFINE(OS2EMX_PLAIN_CHAR)
2322         AC_DEFINE(TCPV40HDRS)
2323         AR=emxomfar
2324         AR_FLAGS='r $@'
2325         CFLAGS="$CFLAGS -Zomf"
2326         CXXFLAGS="$CXXFLAGS -Zomf"
2327         DSO_LDOPTS='-Zdll'
2328         BIN_FLAGS='-Zlinker /ST:0x100000'
2329         IMPLIB='emximp -o'
2330         FILTER='emxexp -o'
2331         LDFLAGS='-Zmap'
2332         WARNINGS_AS_ERRORS='-Werror'
2333         MOZ_DEBUG_FLAGS="-g -fno-inline"
2334         MOZ_OPTIMIZE_FLAGS="-O2"
2335         MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2336         MOZ_XPCOM_OBSOLETE_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcomct.lib'
2337         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcomcor.lib'
2338         LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2339         if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2340           DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2341           LDFLAGS="$LDFLAGS -Zhigh-mem"
2342           MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2343           AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2344         fi
2346         # GCC for OS/2 currently predefines these, but we don't want them
2347         _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2348         _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2350         AC_CACHE_CHECK(for __declspec(dllexport),
2351            ac_os2_declspec,
2352            [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2353                            [return 0;],
2354                            ac_os2_declspec="yes",
2355                            ac_os2_declspec="no")])
2356         if test "$ac_os2_declspec" = "yes"; then
2357            FILTER='true'
2358            MOZ_OS2_USE_DECLSPEC='1'
2359         fi
2360         
2361     # Visual Age C++ build
2362     elif test "$VACPP" = "yes"; then
2363         MOZ_BUILD_ROOT=`pwd -D`
2364         OBJ_SUFFIX=obj
2365         AR=-ilib
2366         AR_FLAGS='/NOL /NOI /O:$(subst /,\\,$@)'
2367         AR_LIST='/L'
2368         AR_EXTRACT='-*'
2369         AR_DELETE='-'
2370         AS=alp
2371         ASFLAGS='-Mb'
2372         AS_DASH_C_FLAG=''
2373         ASM_SUFFIX=asm
2374         LD='-ilink'
2375         CFLAGS="/Q /qlibansi /Gm+ /Su4 /Mp /Tl9"
2376         CXXFLAGS="/Q /qlibansi /Gm+ /Su4 /Mp /Tl9 /Gx+"
2377         MOZ_DEBUG_FLAGS="/Ti+"
2378         WARNINGS_AS_ERRORS='-WX'
2379         MOZ_OPTIMIZE_FLAGS="/O+ /Gl+ /G5 /qarch=pentium"
2380         LDFLAGS="/NOL /M"
2381         MOZ_DEBUG_LDFLAGS="/DE"
2382         MOZ_OPTIMIZE_LDFLAGS="/OPTFUNC /EXEPACK:2 /PACKCODE /PACKDATA"
2383         DSO_LDOPTS=''
2384         DSO_PIC_CFLAGS=
2385         IMPLIB='implib /NOL /NOI'
2386         FILTER='cppfilt -q -B -P'
2387         AC_DEFINE(NO_ANSI_KEYWORDS)
2388         AC_DEFINE(OS2,4)
2389         AC_DEFINE(_X86_)
2390         AC_DEFINE(XP_OS2_VACPP)
2391         AC_DEFINE(TCPV40HDRS)
2392         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2393         AC_DEFINE(STDC_HEADERS)
2394         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2395         MKSHLIB='$(LD) $(DSO_LDOPTS)'
2396         MKCSHLIB='$(LD) $(DSO_LDOPTS)'
2397         MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2398         MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcomct.lib'
2399         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcomcor.lib'
2400         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2401     fi
2402     ;;
2404 alpha*-*-osf*)
2405     if test "$GNU_CC"; then
2406       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2407       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2409     else
2410         MOZ_DEBUG_FLAGS='-g'
2411         ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2412         CFLAGS="$CFLAGS -ieee"
2413         CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
2414         DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2415         DSO_CFLAGS=
2416         DSO_PIC_CFLAGS=
2417         MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2418         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2419         MKSHLIB_FORCE_ALL='-all'
2420         MKSHLIB_UNFORCE_ALL='-none'
2421         dnl Might fix the libxpcom.so breakage on this platform as well....
2422         AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2423         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2424     fi
2425     if test -z "$GNU_CXX"; then
2426       COMPAQ_CXX=1
2427     fi
2428     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2429     ;;
2431 *-qnx*) 
2432     DIRENT_INO=d_stat.st_ino
2433     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2434     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2435     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2436     dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2437     AC_DEFINE(STDC_HEADERS)
2438     if test "$no_x" = "yes"; then
2439             _PLATFORM_DEFAULT_TOOLKIT='photon'
2440             TK_CFLAGS='-I/usr/nto/include/photon'
2441             TK_LIBS='-lphoton -lphrender'
2442     fi
2443     ;;
2445 *-sco*) 
2446     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2447     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2448     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2449     if test ! "$GNU_CC"; then
2450        DSO_LDOPTS='-G'
2451     fi
2452     ;;
2454 dnl the qsort routine under solaris is faulty
2455 *-solaris*) 
2456     AC_DEFINE(SOLARIS)
2457     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2458     SYSTEM_MAKEDEPEND=
2459     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2460     # libraries one level up (e.g. libnspr4.so)
2461     LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
2462     MOZ_MEMORY=1
2463     if test -z "$GNU_CC"; then
2464        NS_USE_NATIVE=1
2465        MOZ_FIX_LINK_PATHS='-R $(LIBXUL_DIST)/bin'
2466        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2468        if test "$CPU_ARCH" != "sparc"; then
2469           CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all"
2470           CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife -norunpath"
2471        else
2472           # Do not use -xbuiltin on SPARC to get around a bug of compiler
2473           CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%none"
2474           CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%none -features=tmplife -norunpath"
2475        fi
2477        LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
2478        if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
2479            _SAVE_LDFLAGS=$LDFLAGS
2480            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
2481            AC_TRY_LINK([#include <stdio.h>],
2482                        [printf("Hello World\n");],
2483                        ,
2484                        [LDFLAGS=$_SAVE_LDFLAGS])
2485        fi
2486        WARNINGS_AS_ERRORS='-Werror'
2487        MOZ_OPTIMIZE_FLAGS="-xO4"
2488        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2489        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -z muldefs -h $@ -o $@'
2490        MKSHLIB_FORCE_ALL='-z allextract'
2491        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2492        DSO_LDOPTS='-G -z muldefs'
2493        AR_LIST="$AR t"
2494        AR_EXTRACT="$AR x"
2495        AR_DELETE="$AR d"
2496        AR='$(CXX) -xar'
2497        AR_FLAGS='-o $@'
2498        AS='/usr/ccs/bin/as'
2499        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2500        AS_DASH_C_FLAG=''
2501        TARGET_COMPILER_ABI="sunc"
2502         CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2503         CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2504        AC_MSG_CHECKING([for Forte compiler version >= WS6U2])
2505        AC_LANG_SAVE
2506        AC_LANG_CPLUSPLUS
2507        AC_TRY_COMPILE([],
2508            [#if (__SUNPRO_CC < 0x530)
2509            #error "Denied"
2510            #endif],
2511            _BAD_COMPILER=,_BAD_COMPILER=1)
2512         if test -n "$_BAD_COMPILER"; then
2513             _res="no"
2514             AC_MSG_ERROR([Forte version WS6U2 or higher is required to build. Your compiler version is $CC_VERSION .])
2515         else
2516             _res="yes"
2517         fi
2518         AC_MSG_RESULT([$_res])
2519         AC_LANG_RESTORE
2520     else
2521        ASFLAGS="$ASFLAGS -fPIC"
2522        DSO_LDOPTS='-G'
2523        _WARNINGS_CFLAGS=''
2524        _WARNINGS_CXXFLAGS=''
2525        if test "$OS_RELEASE" = "5.3"; then
2526           AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2527        fi
2528     fi
2529     if test "$OS_RELEASE" = "5.5.1"; then
2530        AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2531     fi
2532     ;;
2534 *-sunos*) 
2535     DSO_LDOPTS='-Bdynamic'
2536     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2537     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2538     AC_DEFINE(SUNOS4)
2539     AC_DEFINE(SPRINTF_RETURNS_STRING)
2540     case "$(target_os)" in
2541     sunos4.1*)
2542         DLL_SUFFIX='.so.1.0'
2543         ;;
2544     esac
2545     ;;
2547 *-sysv4.2uw7*) 
2548         NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2549     ;;
2551 *-os2*)
2552     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2553     ;;
2555 esac
2557 dnl Only one oddball right now (QNX), but this gives us flexibility
2558 dnl if any other platforms need to override this in the future.
2559 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2561 dnl ========================================================
2562 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2563 dnl by now will not have any way to link most binaries (tests
2564 dnl as well as viewer, apprunner, etc.), because some symbols
2565 dnl will be left out of the "composite" .so's by ld as unneeded.
2566 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2567 dnl they can link in the static libs that provide the missing
2568 dnl symbols.
2569 dnl ========================================================
2570 NO_LD_ARCHIVE_FLAGS=
2571 if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then
2572     NO_LD_ARCHIVE_FLAGS=1
2574 case "$target" in
2575 *-os2*)
2576     NO_LD_ARCHIVE_FLAGS=
2577     ;;
2578 *-aix4.3*|*-aix5*)
2579     NO_LD_ARCHIVE_FLAGS=
2580     ;;
2581 *-openvms*)
2582     NO_LD_ARCHIVE_FLAGS=
2583     ;;
2584 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince)
2585     if test -z "$GNU_CC"; then
2586         NO_LD_ARCHIVE_FLAGS=
2587     fi
2588     ;;
2589 esac
2590 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2593 dnl Indicate that platform requires special thread safe 
2594 dnl locking when starting up the OJI JVM 
2595 dnl (see mozilla/modules/oji/src/nsJVMManager.cpp)
2596 dnl ========================================================
2597 case "$target" in
2598     *-hpux*)      
2599         AC_DEFINE(MOZ_OJI_REQUIRE_THREAD_SAFE_ON_STARTUP)
2600         ;;
2601 esac
2603 dnl ========================================================
2604 dnl = Flags to strip unused symbols from .so components
2605 dnl ========================================================
2606 case "$target" in
2607     *-linux*|*-kfreebsd*-gnu)
2608         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2609         ;;
2610     *-solaris*)
2611         if test -z "$GNU_CC"; then
2612          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2613         else
2614          if test -z "$GCC_USE_GNU_LD"; then
2615           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2616          else
2617           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2618          fi
2619         fi
2620         ;;
2621     *-nto*) 
2622         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2623         ;;
2624     *-darwin*)
2625         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2626         ;;
2627     *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince)
2628         if test -n "$GNU_CC"; then
2629            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2630         fi
2631         ;;
2632 esac
2634 if test -z "$COMPILE_ENVIRONMENT"; then
2635     SKIP_COMPILER_CHECKS=1
2636     SKIP_LIBRARY_CHECKS=1
2639 if test -z "$SKIP_COMPILER_CHECKS"; then
2640 dnl Checks for typedefs, structures, and compiler characteristics.
2641 dnl ========================================================
2642 AC_LANG_C
2643 AC_HEADER_STDC
2644 AC_C_CONST
2645 AC_TYPE_MODE_T
2646 AC_TYPE_OFF_T
2647 AC_TYPE_PID_T
2648 AC_TYPE_SIZE_T
2649 AC_STRUCT_ST_BLKSIZE
2650 AC_MSG_CHECKING(for siginfo_t)
2651 AC_CACHE_VAL(ac_cv_siginfo_t,
2652  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2653                   #include <signal.h>],
2654                  [siginfo_t* info;],
2655                  [ac_cv_siginfo_t=true],
2656                  [ac_cv_siginfo_t=false])])
2657 if test "$ac_cv_siginfo_t" = true ; then
2658   AC_DEFINE(HAVE_SIGINFO_T)
2659   AC_MSG_RESULT(yes)
2660 else
2661   AC_MSG_RESULT(no)
2664 dnl Visual Age for os/2 also defines size_t and off_t in certain 
2665 dnl  header files.  These defines make Visual Age use the mozilla
2666 dnl  defines types.
2667 if test "$VACPP" = "yes"; then
2668    AC_DEFINE(__size_t)
2669    AC_DEFINE(__off_t)
2672 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2673 dnl ========================================================
2674 AC_MSG_CHECKING(for int16_t)
2675 AC_CACHE_VAL(ac_cv_int16_t,
2676  [AC_TRY_COMPILE([#include <stdio.h>
2677                   #include <sys/types.h>],
2678                  [int16_t foo = 0;],
2679                  [ac_cv_int16_t=true],
2680                  [ac_cv_int16_t=false])])
2681 if test "$ac_cv_int16_t" = true ; then
2682   AC_DEFINE(HAVE_INT16_T)
2683   AC_MSG_RESULT(yes)
2684 else
2685   AC_MSG_RESULT(no)
2687 AC_MSG_CHECKING(for int32_t)
2688 AC_CACHE_VAL(ac_cv_int32_t,
2689  [AC_TRY_COMPILE([#include <stdio.h>
2690                   #include <sys/types.h>],
2691                  [int32_t foo = 0;],
2692                  [ac_cv_int32_t=true],
2693                  [ac_cv_int32_t=false])])
2694 if test "$ac_cv_int32_t" = true ; then
2695   AC_DEFINE(HAVE_INT32_T)
2696   AC_MSG_RESULT(yes)
2697 else
2698   AC_MSG_RESULT(no)
2700 AC_MSG_CHECKING(for int64_t)
2701 AC_CACHE_VAL(ac_cv_int64_t,
2702  [AC_TRY_COMPILE([#include <stdio.h>
2703                   #include <sys/types.h>],
2704                  [int64_t foo = 0;],
2705                  [ac_cv_int64_t=true],
2706                  [ac_cv_int64_t=false])])
2707 if test "$ac_cv_int64_t" = true ; then
2708   AC_DEFINE(HAVE_INT64_T)
2709   AC_MSG_RESULT(yes)
2710 else
2711   AC_MSG_RESULT(no)
2713 AC_MSG_CHECKING(for int64)
2714 AC_CACHE_VAL(ac_cv_int64,
2715  [AC_TRY_COMPILE([#include <stdio.h>
2716                   #include <sys/types.h>],
2717                  [int64 foo = 0;],
2718                  [ac_cv_int64=true],
2719                  [ac_cv_int64=false])])
2720 if test "$ac_cv_int64" = true ; then
2721   AC_DEFINE(HAVE_INT64)
2722   AC_MSG_RESULT(yes)
2723 else
2724   AC_MSG_RESULT(no)
2726 AC_MSG_CHECKING(for uint)
2727 AC_CACHE_VAL(ac_cv_uint,
2728  [AC_TRY_COMPILE([#include <stdio.h>
2729                   #include <sys/types.h>],
2730                  [uint foo = 0;],
2731                  [ac_cv_uint=true],
2732                  [ac_cv_uint=false])])
2733 if test "$ac_cv_uint" = true ; then
2734   AC_DEFINE(HAVE_UINT)
2735   AC_MSG_RESULT(yes)
2736 else
2737   AC_MSG_RESULT(no)
2739 AC_MSG_CHECKING(for uint_t)
2740 AC_CACHE_VAL(ac_cv_uint_t,
2741  [AC_TRY_COMPILE([#include <stdio.h>
2742                   #include <sys/types.h>],
2743                  [uint_t foo = 0;],
2744                  [ac_cv_uint_t=true],
2745                  [ac_cv_uint_t=false])])
2746 if test "$ac_cv_uint_t" = true ; then
2747   AC_DEFINE(HAVE_UINT_T)
2748   AC_MSG_RESULT(yes)
2749 else
2750   AC_MSG_RESULT(no)
2752 AC_MSG_CHECKING(for uint16_t)
2753 AC_CACHE_VAL(ac_cv_uint16_t,
2754  [AC_TRY_COMPILE([#include <stdio.h>
2755                   #include <sys/types.h>],
2756                  [uint16_t foo = 0;],
2757                  [ac_cv_uint16_t=true],
2758                  [ac_cv_uint16_t=false])])
2759 if test "$ac_cv_uint16_t" = true ; then
2760   AC_DEFINE(HAVE_UINT16_T)
2761   AC_MSG_RESULT(yes)
2762 else
2763   AC_MSG_RESULT(no)
2766 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2767 dnl are defined when compiling C++ but not C.  Since the result of this
2768 dnl test is used only in C++, do it in C++.
2769 AC_LANG_CPLUSPLUS
2771 AC_MSG_CHECKING(for uname.domainname)
2772 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2773     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2774         [ struct utsname *res; char *domain; 
2775             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
2776         [ac_cv_have_uname_domainname_field=true],
2777         [ac_cv_have_uname_domainname_field=false])])
2779 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2780     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2781     AC_MSG_RESULT(yes)
2782 else
2783     AC_MSG_RESULT(no)
2786 AC_MSG_CHECKING(for uname.__domainname)
2787 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2788     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2789         [ struct utsname *res; char *domain; 
2790             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
2791         [ac_cv_have_uname_us_domainname_field=true],
2792         [ac_cv_have_uname_us_domainname_field=false])])
2794 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2795     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2796     AC_MSG_RESULT(yes)
2797 else
2798     AC_MSG_RESULT(no)
2801 AC_LANG_C
2803 dnl Check for usable wchar_t (2 bytes, unsigned)
2804 dnl (we really don't need the unsignedness check anymore)
2805 dnl ========================================================
2807 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2808     ac_cv_have_usable_wchar_v2,
2809     [AC_TRY_COMPILE([#include <stddef.h>
2810                      $configure_static_assert_macros],
2811                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2812                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2813                     ac_cv_have_usable_wchar_v2="yes",
2814                     ac_cv_have_usable_wchar_v2="no")])
2815 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2816     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2817     HAVE_CPP_2BYTE_WCHAR_T=1
2818 else
2819 dnl This is really gcc-only
2820 dnl Do this test using CXX only since some versions of gcc
2821 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2822 dnl only have short-wchar support for c++.
2823 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2825     AC_LANG_SAVE
2826     AC_LANG_CPLUSPLUS
2827     _SAVE_CXXFLAGS=$CXXFLAGS
2828     CXXFLAGS="$CXXFLAGS -fshort-wchar"
2830     AC_CACHE_CHECK(for compiler -fshort-wchar option, 
2831         ac_cv_have_usable_wchar_option_v2,
2832         [AC_TRY_LINK([#include <stddef.h>
2833                       $configure_static_assert_macros],
2834                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2835                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2836                      ac_cv_have_usable_wchar_option_v2="yes",
2837                      ac_cv_have_usable_wchar_option_v2="no")])
2839     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2840         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2841         HAVE_CPP_2BYTE_WCHAR_T=1
2842     else    
2843         CXXFLAGS=$_SAVE_CXXFLAGS
2844     fi
2845     AC_LANG_RESTORE
2848 dnl Check for .hidden assembler directive and visibility attribute.
2849 dnl Borrowed from glibc configure.in
2850 dnl ===============================================================
2851 if test "$GNU_CC"; then
2852   AC_CACHE_CHECK(for visibility(hidden) attribute,
2853                  ac_cv_visibility_hidden,
2854                  [cat > conftest.c <<EOF
2855                   int foo __attribute__ ((visibility ("hidden"))) = 1;
2857                   ac_cv_visibility_hidden=no
2858                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2859                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2860                       ac_cv_visibility_hidden=yes
2861                     fi
2862                   fi
2863                   rm -f conftest.[cs]
2864                  ])
2865   if test "$ac_cv_visibility_hidden" = "yes"; then
2866     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2868     AC_CACHE_CHECK(for visibility(default) attribute,
2869                    ac_cv_visibility_default,
2870                    [cat > conftest.c <<EOF
2871                     int foo __attribute__ ((visibility ("default"))) = 1;
2873                     ac_cv_visibility_default=no
2874                     if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2875                       if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2876                         ac_cv_visibility_default=yes
2877                       fi
2878                     fi
2879                     rm -f conftest.[cs]
2880                    ])
2881     if test "$ac_cv_visibility_default" = "yes"; then
2882       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2884       AC_CACHE_CHECK(for visibility pragma support,
2885                      ac_cv_visibility_pragma,
2886                      [cat > conftest.c <<EOF
2887 #pragma GCC visibility push(hidden)
2888                       int foo_hidden = 1;
2889 #pragma GCC visibility push(default)
2890                       int foo_default = 1;
2892                       ac_cv_visibility_pragma=no
2893                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2894                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2895                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2896                             ac_cv_visibility_pragma=yes
2897                           fi
2898                         fi
2899                       fi
2900                       rm -f conftest.[cs]
2901                     ])
2902       if test "$ac_cv_visibility_pragma" = "yes"; then
2903         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2904                        ac_cv_have_visibility_class_bug,
2905                        [cat > conftest.c <<EOF
2906 #pragma GCC visibility push(hidden)
2907 struct __attribute__ ((visibility ("default"))) TestStruct {
2908   static void Init();
2910 __attribute__ ((visibility ("default"))) void TestFunc() {
2911   TestStruct::Init();
2914                        ac_cv_have_visibility_class_bug=no
2915                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2916                          ac_cv_have_visibility_class_bug=yes
2917                        else
2918                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2919                            ac_cv_have_visibility_class_bug=yes
2920                          fi
2921                        fi
2922                        rm -rf conftest.{c,S}
2923                        ])
2925         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2926                        ac_cv_have_visibility_builtin_bug,
2927                        [cat > conftest.c <<EOF
2928 #pragma GCC visibility push(hidden)
2929 #pragma GCC visibility push(default)
2930 #include <string.h>
2931 #pragma GCC visibility pop
2933 __attribute__ ((visibility ("default"))) void Func() {
2934   char c[[100]];
2935   memset(c, 0, sizeof(c));
2938                        ac_cv_have_visibility_builtin_bug=no
2939                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2940                          ac_cv_have_visibility_builtin_bug=yes
2941                        else
2942                          if test `grep -c "@PLT" conftest.S` = 0; then
2943                            ac_cv_visibility_builtin_bug=yes
2944                          fi
2945                        fi
2946                        rm -f conftest.{c,S}
2947                        ])
2948         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2949                 "$ac_cv_have_visibility_class_bug" = "no"; then
2950           VISIBILITY_FLAGS='-I$(DIST)/include/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2951           WRAP_SYSTEM_INCLUDES=1
2952         else
2953           VISIBILITY_FLAGS='-fvisibility=hidden'
2954         fi # have visibility pragma bug
2955       fi   # have visibility pragma
2956     fi     # have visibility(default) attribute
2957   fi       # have visibility(hidden) attribute
2958 fi         # GNU_CC
2960 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2961 AC_SUBST(VISIBILITY_FLAGS)
2963 dnl Checks for header files.
2964 dnl ========================================================
2965 AC_HEADER_DIRENT
2966 case "$target_os" in
2967 freebsd*)
2968 # for stuff like -lXshm
2969     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2970     ;;
2971 esac
2972 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
2973 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
2974 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
2975 AC_CHECK_HEADERS(malloc.h)
2976 AC_CHECK_HEADERS(X11/XKBlib.h)
2978 dnl These are all the places some variant of statfs can be hiding.
2979 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2981 dnl Try for MMX support
2982 dnl NB - later gcc versions require -mmmx for this header to be successfully
2983 dnl included (or another option which implies it, such as -march=pentium-mmx)
2984 AC_CHECK_HEADERS(mmintrin.h)
2986 dnl Check whether the compiler supports the new-style C++ standard
2987 dnl library headers (i.e. <new>) or needs the old "new.h"
2988 AC_LANG_CPLUSPLUS
2989 NEW_H=new.h
2990 AC_CHECK_HEADER(new, [NEW_H=new])
2991 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
2992 AC_LANG_C
2994 AC_ARG_ENABLE(dtrace,
2995               [  --enable-dtrace         build with dtrace support if available (default=no)],
2996               [enable_dtrace="yes"],)
2997 if test "x$enable_dtrace" = "xyes"; then
2998   AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
2999   if test -n "$HAVE_DTRACE"; then
3000       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3001   else
3002       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3003   fi
3005 AC_SUBST(HAVE_DTRACE)
3007 case $target in
3008 *-aix4.3*|*-aix5*)
3009         ;;
3011         AC_CHECK_HEADERS(sys/cdefs.h)
3012         ;;
3013 esac
3015 dnl Checks for libraries.
3016 dnl ========================================================
3017 case $target in
3018 *-hpux11.*)
3019         ;;
3021         AC_CHECK_LIB(c_r, gethostbyname_r)
3022         ;;
3023 esac
3025 dnl We don't want to link with libdl even if it's present on OS X, since
3026 dnl it's not used and not part of the default installation.
3027 dnl The same goes for BeOS.
3028 dnl We don't want to link against libm or libpthread on Darwin since
3029 dnl they both are just symlinks to libSystem and explicitly linking
3030 dnl against libSystem causes issues when debugging (see bug 299601).
3031 case $target in
3032 *-darwin*)
3033     ;;
3034 *-beos*)
3035     ;;
3037     AC_CHECK_LIB(m, atan)
3038     AC_CHECK_LIB(dl, dlopen,
3039     AC_CHECK_HEADER(dlfcn.h, 
3040         LIBS="-ldl $LIBS"
3041         AC_DEFINE(HAVE_LIBDL)))
3042     ;;
3043 esac
3045 _SAVE_CFLAGS="$CFLAGS"
3046 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3047 AC_CHECK_FUNCS(dladdr)
3048 CFLAGS="$_SAVE_CFLAGS"
3050 if test ! "$GNU_CXX"; then
3052     case $target in
3053     *-aix*)
3054         AC_CHECK_LIB(C_r, demangle)
3055         ;;
3056      *)
3057         AC_CHECK_LIB(C, demangle)
3058         ;;
3059      esac
3061 AC_CHECK_LIB(socket, socket)
3063 XLDFLAGS="$X_LIBS"
3064 XLIBS="$X_EXTRA_LIBS"
3066 dnl ========================================================
3067 dnl Checks for X libraries.
3068 dnl Ordering is important.
3069 dnl Xt is dependent upon SM as of X11R6
3070 dnl ========================================================
3071 if test "$no_x" = "yes"; then
3072     AC_DEFINE(NO_X11)
3073 else
3074     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3075         XLIBS="-lX11 $XLIBS"
3076         _SAVE_LDFLAGS="$LDFLAGS"
3077         LDFLAGS="$XLDFLAGS $LDFLAGS"
3078         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3079                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3080         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3081                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3082    
3083      
3084         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3085         unset ac_cv_lib_Xt_XtFree
3086             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3087             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS) 
3088         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3089                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3090         ])
3092     # AIX needs the motif library linked before libXt to prevent
3093     # crashes in plugins linked against Motif - Bug #98892
3094     case "${target_os}" in
3095     aix*)
3096         XT_LIBS="-lXm $XT_LIBS"
3097         ;;
3098     esac
3100     dnl ========================================================
3101     dnl = Check for XShm
3102     dnl ========================================================
3103     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3104         $XLIBS $XEXT_LIBS)
3105     AC_CHECK_HEADER(X11/extensions/XShm.h)
3106     if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3107         test -n "$_HAVE_XSHM_XEXT"; then
3108         AC_DEFINE(HAVE_XSHM)
3109     fi
3111     dnl ========================================================
3112     dnl = Check for XIE
3113     dnl ========================================================
3114     AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3115         $XLIBS $XEXT_LIBS)
3116     AC_CHECK_HEADER(X11/extensions/XIElib.h)
3118     if test "$MOZ_XIE_LIBS"; then
3119         dnl ====================================================
3120         dnl = If XIE is present and is desired, turn it on
3121         dnl ====================================================
3122         case $target in
3123             *-hpux*)
3124                 ;;
3125             *)
3126                 HAVE_XIE=1
3127                 ;;
3128         esac
3129     fi
3131         LDFLAGS="$_SAVE_LDFLAGS"
3133     dnl ========================================================
3134     dnl = Check for freetype2 and its functionality
3135     dnl ========================================================
3136     AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3138     if test "$_HAVE_FREETYPE2"; then
3139         _SAVE_LIBS="$LIBS"
3140         _SAVE_CFLAGS="$CFLAGS"
3141         LIBS="$LIBS $FT2_LIBS"
3142         CFLAGS="$CFLAGS $FT2_CFLAGS"
3144         AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3145             ac_cv_member_FT_Bitmap_Size_y_ppem,
3146             [AC_TRY_COMPILE([#include <ft2build.h>
3147                              #include FT_FREETYPE_H],
3148                             [FT_Bitmap_Size s;
3149                              if (sizeof s.y_ppem) return 0;
3150                              return 1],
3151                             ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3152                             ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3153         if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3154             HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3155         else
3156             HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3157         fi
3158         AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3159                            $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3160                            [FT_Bitmap_Size structure includes y_ppem field])
3162         AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3164         LIBS="$_SAVE_LIBS"
3165         CFLAGS="$_SAVE_CFLAGS"
3166     fi
3168 fi # $no_x
3170 AC_SUBST(XCFLAGS)
3171 AC_SUBST(XLDFLAGS)
3172 AC_SUBST(XLIBS)
3173 AC_SUBST(XT_LIBS)
3175 dnl ========================================================
3176 dnl = pthread support
3177 dnl = Start by checking whether the system support pthreads
3178 dnl ========================================================
3179 case "$target_os" in
3180 darwin*)
3181     USE_PTHREADS=1
3182     ;;
3184     MOZ_CHECK_PTHREADS(pthreads,
3185         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3186         MOZ_CHECK_PTHREADS(pthread,
3187             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3188             MOZ_CHECK_PTHREADS(c_r,
3189                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3190                 MOZ_CHECK_PTHREADS(c,
3191                     USE_PTHREADS=1
3192                 )
3193             )
3194         )
3195     )
3196     ;;
3197 esac
3199 dnl ========================================================
3200 dnl Check the command line for --with-pthreads 
3201 dnl ========================================================
3202 MOZ_ARG_WITH_BOOL(pthreads,
3203 [  --with-pthreads         Force use of system pthread library with NSPR ],
3204 [ if test "$USE_PTHREADS"x = x; then
3205     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3206 fi],
3207     USE_PTHREADS=
3208     _PTHREAD_LDFLAGS=
3211 dnl ========================================================
3212 dnl Do the platform specific pthread hackery
3213 dnl ========================================================
3214 if test "$USE_PTHREADS"x != x
3215 then
3216         dnl
3217         dnl See if -pthread is supported.
3218         dnl
3219         rm -f conftest*
3220         ac_cv_have_dash_pthread=no
3221         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3222         echo 'int main() { return 0; }' | cat > conftest.c
3223         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3224         if test $? -eq 0; then
3225                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3226                         ac_cv_have_dash_pthread=yes
3227                 case "$target_os" in
3228                 freebsd*)
3229 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3230                 ;;
3231                 *)
3232                             CFLAGS="$CFLAGS -pthread"
3233                             CXXFLAGS="$CXXFLAGS -pthread"
3234                 ;;
3235                 esac
3236                 fi
3237         fi
3238         rm -f conftest*
3239     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3241         dnl
3242         dnl See if -pthreads is supported.
3243         dnl
3244     ac_cv_have_dash_pthreads=no
3245     if test "$ac_cv_have_dash_pthread" = "no"; then
3246             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3247         echo 'int main() { return 0; }' | cat > conftest.c
3248             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3249         if test $? -eq 0; then
3250                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3251                             ac_cv_have_dash_pthreads=yes
3252                             CFLAGS="$CFLAGS -pthreads"
3253                             CXXFLAGS="$CXXFLAGS -pthreads"
3254                     fi
3255             fi
3256             rm -f conftest*
3257         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3258     fi
3260         case "$target" in
3261             *-*-freebsd*)
3262                         AC_DEFINE(_REENTRANT)
3263                         AC_DEFINE(_THREAD_SAFE)
3264                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3265                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3266                                 _PTHREAD_LDFLAGS="-pthread"
3267                         else
3268                                 _PTHREAD_LDFLAGS="-lc_r"
3269                         fi
3270                         ;;
3272             *-*-openbsd*|*-*-bsdi*)
3273                         AC_DEFINE(_REENTRANT)
3274                         AC_DEFINE(_THREAD_SAFE)
3275                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3276                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3277                 _PTHREAD_LDFLAGS="-pthread"
3278                         fi
3279                         ;;
3281             *-*-linux*|*-*-kfreebsd*-gnu)
3282                         AC_DEFINE(_REENTRANT) 
3283                         ;;
3285             *-*-nto*) 
3286                         AC_DEFINE(_REENTRANT) 
3287                         ;;
3289             *-aix4.3*|*-aix5*)
3290                         AC_DEFINE(_REENTRANT) 
3291                         ;;
3293             *-hpux11.*)
3294                         AC_DEFINE(_REENTRANT) 
3295                         ;;
3297             alpha*-*-osf*)
3298                         AC_DEFINE(_REENTRANT)
3299                         ;;
3301             *-*-solaris*) 
3302                         AC_DEFINE(_REENTRANT) 
3303                         if test ! "$GNU_CC"; then
3304                                 CFLAGS="$CFLAGS -mt" 
3305                                 CXXFLAGS="$CXXFLAGS -mt" 
3306                         fi
3307                         ;;
3308         esac
3309     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3312 dnl ========================================================
3313 dnl See if mmap sees writes
3314 dnl For cross compiling, just define it as no, which is a safe default
3315 dnl ========================================================
3316 AC_MSG_CHECKING(whether mmap() sees write()s)
3318 changequote(,)
3319 mmap_test_prog='
3320     #include <stdlib.h>
3321     #include <unistd.h>
3322     #include <sys/mman.h>
3323     #include <sys/types.h>
3324     #include <sys/stat.h>
3325     #include <fcntl.h>
3327     char fname[] = "conftest.file";
3328     char zbuff[1024]; /* Fractional page is probably worst case */
3330     int main() {
3331         char *map;
3332         int fd;
3333         int i;
3334         unlink(fname);
3335         fd = open(fname, O_RDWR | O_CREAT, 0660);
3336         if(fd<0) return 1;
3337         unlink(fname);
3338         write(fd, zbuff, sizeof(zbuff));
3339         lseek(fd, 0, SEEK_SET);
3340         map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3341         if(map==(char*)-1) return 2;
3342         for(i=0; fname[i]; i++) {
3343             int rc = write(fd, &fname[i], 1);
3344             if(map[i]!=fname[i]) return 4;
3345         }
3346         return 0;
3347     }
3349 changequote([,])
3351 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3353 AC_MSG_RESULT("$result")
3355 if test "$result" = "no"; then
3356     AC_DEFINE(MMAP_MISSES_WRITES)
3360 dnl Checks for library functions.
3361 dnl ========================================================
3362 AC_PROG_GCC_TRADITIONAL
3363 AC_FUNC_MEMCMP
3364 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64)
3365 AC_CHECK_FUNCS(flockfile getpagesize)
3367 dnl localtime_r and strtok_r are only present on MacOS version 10.2 and higher
3368 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100200"; then
3369   AC_CHECK_FUNCS(localtime_r strtok_r)
3372 dnl check for wcrtomb/mbrtowc
3373 dnl =======================================================================
3374 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3375 AC_LANG_SAVE
3376 AC_LANG_CPLUSPLUS
3377 AC_CACHE_CHECK(for wcrtomb,
3378     ac_cv_have_wcrtomb,
3379     [AC_TRY_LINK([#include <wchar.h>],
3380                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3381                  ac_cv_have_wcrtomb="yes",
3382                  ac_cv_have_wcrtomb="no")])
3383 if test "$ac_cv_have_wcrtomb" = "yes"; then
3384     AC_DEFINE(HAVE_WCRTOMB)
3386 AC_CACHE_CHECK(for mbrtowc,
3387     ac_cv_have_mbrtowc,
3388     [AC_TRY_LINK([#include <wchar.h>],
3389                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3390                  ac_cv_have_mbrtowc="yes",
3391                  ac_cv_have_mbrtowc="no")])
3392 if test "$ac_cv_have_mbrtowc" = "yes"; then
3393     AC_DEFINE(HAVE_MBRTOWC)
3395 AC_LANG_RESTORE
3398 AC_CACHE_CHECK(
3399     [for res_ninit()],
3400     ac_cv_func_res_ninit,
3401     [AC_TRY_LINK([
3402         #ifdef linux
3403         #define _BSD_SOURCE 1
3404         #endif
3405         #include <resolv.h>
3406         ],
3407         [int foo = res_ninit(&_res);],
3408         [ac_cv_func_res_ninit=yes],
3409         [ac_cv_func_res_ninit=no])
3410     ])
3412 if test "$ac_cv_func_res_ninit" = "yes"; then
3413     AC_DEFINE(HAVE_RES_NINIT)
3414 dnl must add the link line we do something as foolish as this... dougt
3415 dnl else
3416 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3417 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3420 AC_LANG_CPLUSPLUS
3421 AC_CACHE_CHECK(
3422     [for gnu_get_libc_version()],
3423     ac_cv_func_gnu_get_libc_version,
3424     [AC_TRY_LINK([
3425         #ifdef HAVE_GNU_LIBC_VERSION_H
3426         #include <gnu/libc-version.h>
3427         #endif
3428         ],
3429         [const char *glibc_version = gnu_get_libc_version();],
3430         [ac_cv_func_gnu_get_libc_version=yes],
3431         [ac_cv_func_gnu_get_libc_version=no] 
3432         )]
3433     )
3435 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3436     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3439 case $target_os in
3440     os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|beos*)
3441         ;;
3442     *)
3443     
3444 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3445     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3446         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3447 _SAVE_LIBS=$LIBS
3448 LIBS="$LIBS $_ICONV_LIBS"
3449 AC_CACHE_CHECK(
3450     [for iconv()],
3451     ac_cv_func_iconv,
3452     [AC_TRY_LINK([
3453         #include <stdlib.h>
3454         #include <iconv.h>
3455         ],
3456         [
3457             iconv_t h = iconv_open("", "");
3458             iconv(h, NULL, NULL, NULL, NULL);
3459             iconv_close(h);
3460         ],
3461         [ac_cv_func_iconv=yes],
3462         [ac_cv_func_iconv=no] 
3463         )]
3464     )
3465 if test "$ac_cv_func_iconv" = "yes"; then
3466     AC_DEFINE(HAVE_ICONV)
3467     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3468     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3469     LIBICONV="$_ICONV_LIBS"
3470     AC_CACHE_CHECK(
3471         [for iconv() with const input],
3472         ac_cv_func_const_iconv,
3473         [AC_TRY_COMPILE([
3474             #include <stdlib.h>
3475             #include <iconv.h>
3476             ],
3477             [
3478                 const char *input = "testing";
3479                 iconv_t h = iconv_open("", "");
3480                 iconv(h, &input, NULL, NULL, NULL);
3481                 iconv_close(h);
3482             ],
3483             [ac_cv_func_const_iconv=yes],
3484             [ac_cv_func_const_iconv=no] 
3485             )]
3486         )
3487     if test "$ac_cv_func_const_iconv" = "yes"; then
3488         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3489     fi
3491 LIBS=$_SAVE_LIBS
3493     ;;
3494 esac
3496 AM_LANGINFO_CODESET
3498 AC_LANG_C
3500 dnl **********************
3501 dnl *** va_copy checks ***
3502 dnl **********************
3503 dnl we currently check for all three va_copy possibilities, so we get
3504 dnl all results in config.log for bug reports.
3505 AC_MSG_CHECKING(for an implementation of va_copy())
3506 AC_CACHE_VAL(ac_cv_va_copy,[
3507     AC_TRY_RUN([
3508         #include <stdarg.h>
3509         void f (int i, ...) {
3510             va_list args1, args2;
3511             va_start (args1, i);
3512             va_copy (args2, args1);
3513             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3514                 exit (1);
3515             va_end (args1); va_end (args2);
3516         }
3517         int main() { f (0, 42); return 0; }],
3518         ac_cv_va_copy=yes,
3519         ac_cv_va_copy=no,
3520         ac_cv_va_copy=no
3521     )
3523 AC_MSG_RESULT($ac_cv_va_copy)
3524 AC_MSG_CHECKING(for an implementation of __va_copy())
3525 AC_CACHE_VAL(ac_cv___va_copy,[
3526     AC_TRY_RUN([
3527         #include <stdarg.h>
3528         void f (int i, ...) {
3529             va_list args1, args2;
3530             va_start (args1, i);
3531             __va_copy (args2, args1);
3532             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3533                 exit (1);
3534             va_end (args1); va_end (args2);
3535         }
3536         int main() { f (0, 42); return 0; }],
3537         ac_cv___va_copy=yes,
3538         ac_cv___va_copy=no,
3539         ac_cv___va_copy=no
3540     )
3542 AC_MSG_RESULT($ac_cv___va_copy)
3543 AC_MSG_CHECKING(whether va_lists can be copied by value)
3544 AC_CACHE_VAL(ac_cv_va_val_copy,[
3545     AC_TRY_RUN([
3546         #include <stdarg.h>
3547         void f (int i, ...) {
3548             va_list args1, args2;
3549             va_start (args1, i);
3550             args2 = args1;
3551             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3552                 exit (1);
3553             va_end (args1); va_end (args2);
3554         }
3555         int main() { f (0, 42); return 0; }],
3556         ac_cv_va_val_copy=yes,
3557         ac_cv_va_val_copy=no,
3558         ac_cv_va_val_copy=yes
3559     )
3561 if test "x$ac_cv_va_copy" = "xyes"; then
3562     AC_DEFINE(VA_COPY, va_copy)
3563     AC_DEFINE(HAVE_VA_COPY)
3564 elif test "x$ac_cv___va_copy" = "xyes"; then
3565     AC_DEFINE(VA_COPY, __va_copy)
3566     AC_DEFINE(HAVE_VA_COPY)
3569 if test "x$ac_cv_va_val_copy" = "xno"; then
3570    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3572 AC_MSG_RESULT($ac_cv_va_val_copy)
3574 dnl Check for dll-challenged libc's.
3575 dnl This check is apparently only needed for Linux.
3576 case "$target" in
3577         *-linux*)
3578             dnl ===================================================================
3579             _curdir=`pwd`
3580             export _curdir
3581             rm -rf conftest* _conftest
3582             mkdir _conftest
3583             cat >> conftest.C <<\EOF
3584 #include <stdio.h>
3585 #include <link.h>
3586 #include <dlfcn.h>
3587 #ifdef _dl_loaded
3588 void __dump_link_map(void) {
3589   struct link_map *map = _dl_loaded;
3590   while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
3592 int main() {
3593   dlopen("./conftest1.so",RTLD_LAZY);
3594   dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
3595   dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
3596   dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
3597   __dump_link_map();
3599 #else
3600 /* _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).*/
3601 int main() { printf("./conftest1.so\n"); }
3602 #endif
3605             $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
3607             cat >> conftest1.C <<\EOF
3608 #include <stdio.h>
3609 void foo(void) {printf("foo in dll called\n");}
3611             ${CXX-g++} -fPIC -c -g conftest1.C
3612             ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
3613             ${CXX-g++} -g conftest.C -o conftest -ldl
3614             cp -f conftest1.so conftest _conftest
3615             cd _conftest
3616             if test `./conftest | grep conftest1.so | wc -l` -gt 1
3617             then
3618                 echo
3619                 echo "*** Your libc has a bug that can result in loading the same dynamic"
3620                 echo "*** library multiple times.  This bug is known to be fixed in glibc-2.0.7-32"
3621                 echo "*** or later.  However, if you choose not to upgrade, the only effect"
3622                 echo "*** will be excessive memory usage at runtime."
3623                 echo
3624             fi
3625             cd ${_curdir}
3626             rm -rf conftest* _conftest
3627             dnl ===================================================================
3628             ;;
3629 esac
3631 dnl ===================================================================
3632 dnl ========================================================
3633 dnl By default, turn rtti and exceptions off on g++/egcs
3634 dnl ========================================================
3635 if test "$GNU_CXX"; then
3637   AC_MSG_CHECKING(for C++ exceptions flag)
3639   dnl They changed -f[no-]handle-exceptions to -f[no-]exceptions in g++ 2.8
3640   AC_CACHE_VAL(ac_cv_cxx_exceptions_flags,
3641   [echo "int main() { return 0; }" | cat > conftest.C
3643   ${CXX-g++} ${CXXFLAGS} -c -fno-handle-exceptions conftest.C > conftest.out 2>&1
3645   if egrep "warning.*renamed" conftest.out >/dev/null; then
3646     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions
3647   else
3648     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-handle-exceptions
3649   fi
3651   rm -f conftest*])
3653   AC_MSG_RESULT($ac_cv_cxx_exceptions_flags)
3654   _MOZ_EXCEPTIONS_FLAGS_OFF=$ac_cv_cxx_exceptions_flags
3655   _MOZ_EXCEPTIONS_FLAGS_ON=`echo $ac_cv_cxx_exceptions_flags | sed 's|no-||'`
3658 dnl ========================================================
3659 dnl Put your C++ language/feature checks below
3660 dnl ========================================================
3661 AC_LANG_CPLUSPLUS
3663 HAVE_GCC3_ABI=
3664 if test "$GNU_CC"; then
3665   AC_CACHE_CHECK(for gcc 3.0 ABI,
3666       ac_cv_gcc_three_abi,
3667       [AC_TRY_COMPILE([],
3668                       [
3669 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
3670   return 0;
3671 #else
3672 #error Not gcc3.
3673 #endif
3674                       ],
3675                       ac_cv_gcc_three_abi="yes",
3676                       ac_cv_gcc_three_abi="no")])
3677   if test "$ac_cv_gcc_three_abi" = "yes"; then
3678       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc3}"
3679       HAVE_GCC3_ABI=1
3680   else
3681       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc2}"
3682   fi
3684 AC_SUBST(HAVE_GCC3_ABI)
3687 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
3688                ac_cv_cpp_explicit,
3689                [AC_TRY_COMPILE(class X {
3690                                public: explicit X(int i) : i_(i) {}
3691                                private: int i_;
3692                                };,
3693                                X x(3);,
3694                                ac_cv_cpp_explicit=yes,
3695                                ac_cv_cpp_explicit=no)])
3696 if test "$ac_cv_cpp_explicit" = yes ; then
3697    AC_DEFINE(HAVE_CPP_EXPLICIT)
3700 AC_CACHE_CHECK(for C++ \"typename\" keyword,
3701                ac_cv_cpp_typename,
3702                [AC_TRY_COMPILE(class param {
3703                                public:
3704                                    typedef unsigned long num_type;
3705                                };
3707                                template <class T> class tplt {
3708                                public:
3709                                    typedef typename T::num_type t_num_type;
3710                                    t_num_type foo(typename T::num_type num) {
3711                                        return num;
3712                                    }
3713                                };,
3714                                tplt<param> A;
3715                                A.foo(0);,
3716                                ac_cv_cpp_typename=yes,
3717                                ac_cv_cpp_typename=no)])
3718 if test "$ac_cv_cpp_typename" = yes ; then
3719    AC_DEFINE(HAVE_CPP_TYPENAME)
3722 dnl Check for support of modern template specialization syntax
3723 dnl Test code and requirement from scc@netscape.com.
3724 dnl Autoconf cut-and-paste job by waterson@netscape.com
3725 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3726                ac_cv_cpp_modern_specialize_template_syntax,
3727                [AC_TRY_COMPILE(template <class T> struct X { int a; };
3728                                class Y {};
3729                                template <> struct X<Y> { double a; };,
3730                                X<int> int_x;
3731                                X<Y> y_x;,
3732                                ac_cv_cpp_modern_specialize_template_syntax=yes,
3733                                ac_cv_cpp_modern_specialize_template_syntax=no)])
3734 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
3735   AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
3739 dnl Some compilers support only full specialization, and some don't.
3740 AC_CACHE_CHECK(whether partial template specialization works,
3741                ac_cv_cpp_partial_specialization,
3742                [AC_TRY_COMPILE(template <class T> class Foo {};
3743                                template <class T> class Foo<T*> {};,
3744                                return 0;,
3745                                ac_cv_cpp_partial_specialization=yes,
3746                                ac_cv_cpp_partial_specialization=no)])
3747 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3748   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3751 dnl Some compilers have limited support for operators with templates;
3752 dnl specifically, it is necessary to define derived operators when a base
3753 dnl class's operator declaration should suffice.
3754 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
3755                ac_cv_need_derived_template_operators,
3756                [AC_TRY_COMPILE([template <class T> class Base { };
3757                                 template <class T>
3758                                 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
3759                                 template <class T> class Derived : public Base<T> { };],
3760                                [Derived<char> a, b;
3761                                 Base<char> c = a + b;
3762                                 return 0;],
3763                                ac_cv_need_derived_template_operators=no,
3764                                ac_cv_need_derived_template_operators=yes)])
3765 if test "$ac_cv_need_derived_template_operators" = yes ; then
3766   AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
3770 dnl Some compilers have trouble detecting that a template class
3771 dnl that derives from another template is actually an instance
3772 dnl of the base class. This test checks for that.
3773 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
3774                ac_cv_need_cpp_template_cast_to_base,
3775                [AC_TRY_COMPILE([template <class T> class Base { };
3776                                 template <class T> class Derived : public Base<T> { };
3777                                 template <class T> int foo(const Base<T>&) { return 0; }],
3778                                [Derived<char> bar; return foo(bar);],
3779                                ac_cv_need_cpp_template_cast_to_base=no,
3780                                ac_cv_need_cpp_template_cast_to_base=yes)])
3781 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
3782   AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
3785 dnl Some compilers have trouble resolving the ambiguity between two
3786 dnl functions whose arguments differ only by cv-qualifications.
3787 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
3788                ac_cv_can_resolve_const_ambiguity,
3789                [AC_TRY_COMPILE([
3790                                 template <class T> class ptrClass {
3791                                   public: T* ptr;
3792                                 };
3794                                 template <class T> T* a(ptrClass<T> *arg) {
3795                                   return arg->ptr;
3796                                 }
3798                                 template <class T>
3799                                 const T* a(const ptrClass<T> *arg) {
3800                                   return arg->ptr;
3801                                 }
3802                                ],
3803                                [ ptrClass<int> i;
3804                                  a(&i); ],
3805                                ac_cv_can_resolve_const_ambiguity=yes,
3806                                ac_cv_can_resolve_const_ambiguity=no)])
3807 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
3808   AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
3812 dnl We don't do exceptions on unix.  The only reason this used to be here
3813 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses 
3814 dnl exceptions.  But, we turn exceptions off by default and this test breaks.
3815 dnl So im commenting this out until someone writes some artificial 
3816 dnl intelligence to detect not only if the compiler has exceptions, but if 
3817 dnl they are enabled as well.
3818 dnl 
3819 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
3820 dnl                ac_cv_cpp_exceptions,
3821 dnl                [AC_TRY_COMPILE(class X { public: X() {} };
3822 dnl                                static void F() { throw X(); },
3823 dnl                                try { F(); } catch(X & e) { },
3824 dnl                                ac_cv_cpp_exceptions=yes,
3825 dnl                                ac_cv_cpp_exceptions=no)])
3826 dnl if test $ac_cv_cpp_exceptions = yes ; then
3827 dnl    AC_DEFINE(HAVE_CPP_EXCEPTIONS)
3828 dnl fi
3830 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
3831 dnl supports it well enough to allow us to use it to change access, but not
3832 dnl to resolve ambiguity. The next two tests determine how well the |using|
3833 dnl keyword is supported.
3835 dnl Check to see if we can change access with |using|.  Test both a
3836 dnl legal and an illegal example.
3837 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
3838                ac_cv_cpp_access_changing_using2,
3839                [AC_TRY_COMPILE(
3840                    class A { protected: int foo() { return 0; } };
3841                    class B : public A { public: using A::foo; };,
3842                    B b; return b.foo();,
3843                    [AC_TRY_COMPILE(
3844                        class A { public: int foo() { return 1; } };
3845                        class B : public A { private: using A::foo; };,
3846                        B b; return b.foo();,
3847                        ac_cv_cpp_access_changing_using2=no,
3848                        ac_cv_cpp_access_changing_using2=yes)],
3849                    ac_cv_cpp_access_changing_using2=no)])
3850 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
3851    AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
3854 dnl Check to see if we can resolve ambiguity with |using|.
3855 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3856                ac_cv_cpp_ambiguity_resolving_using,
3857                [AC_TRY_COMPILE(class X { 
3858                                  public: int go(const X&) {return 3;}
3859                                          int jo(const X&) {return 3;}
3860                                };
3861                                class Y : public X {
3862                                  public:  int go(int) {return 2;}
3863                                           int jo(int) {return 2;}
3864                                           using X::jo;
3865                                  private: using X::go;
3866                                };,
3867                                X x; Y y; y.jo(x);,
3868                                ac_cv_cpp_ambiguity_resolving_using=yes,
3869                                ac_cv_cpp_ambiguity_resolving_using=no)])
3870 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3871    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3874 dnl Check to see if the |std| namespace is supported. If so, we'll want
3875 dnl to qualify any standard library calls with "std::" to ensure that
3876 dnl those functions can be resolved.
3877 AC_CACHE_CHECK(for \"std::\" namespace,
3878                ac_cv_cpp_namespace_std,
3879                [AC_TRY_COMPILE([#include <algorithm>],
3880                                [return std::min(0, 1);],
3881                                ac_cv_cpp_namespace_std=yes,
3882                                ac_cv_cpp_namespace_std=no)])
3883 if test "$ac_cv_cpp_namespace_std" = yes ; then
3884    AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
3887 dnl Older compilers are overly ambitious with respect to using the standard
3888 dnl template library's |operator!=()| when |operator==()| is defined. In
3889 dnl which case, defining |operator!=()| in addition to |operator==()| causes
3890 dnl ambiguity at compile-time. This test checks for that case.
3891 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
3892                ac_cv_cpp_unambiguous_std_notequal,
3893                [AC_TRY_COMPILE([#include <algorithm>
3894                                 struct T1 {};
3895                                 int operator==(const T1&, const T1&) { return 0; }
3896                                 int operator!=(const T1&, const T1&) { return 0; }],
3897                                [T1 a,b; return a != b;],
3898                                ac_cv_cpp_unambiguous_std_notequal=unambiguous,
3899                                ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
3900 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
3901   AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
3905 AC_CACHE_CHECK(for C++ reinterpret_cast,
3906                ac_cv_cpp_reinterpret_cast,
3907                [AC_TRY_COMPILE(struct X { int i; };
3908                                struct Y { int i; };,
3909                                X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
3910                                ac_cv_cpp_reinterpret_cast=yes,
3911                                ac_cv_cpp_reinterpret_cast=no)])
3912 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
3913    AC_DEFINE(HAVE_CPP_NEW_CASTS)
3916 dnl See if a dynamic_cast to void* gives the most derived object.
3917 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3918                ac_cv_cpp_dynamic_cast_void_ptr,
3919                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3920                             class Y { int j; public: virtual ~Y() { } };
3921                             class Z : public X, public Y { int k; };
3923                             int main() {
3924                                  Z mdo;
3925                                  X *subx = (X*)&mdo;
3926                                  Y *suby = (Y*)&mdo;
3927                                  return !((((void*)&mdo != (void*)subx) &&
3928                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3929                                           (((void*)&mdo != (void*)suby) &&
3930                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
3931                             }],
3932                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
3933                            ac_cv_cpp_dynamic_cast_void_ptr=no,
3934                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
3935 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3936    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3940 dnl note that this one is reversed - if the test fails, then
3941 dnl we require implementations of unused virtual methods. Which
3942 dnl really blows because it means we'll have useless vtable
3943 dnl bloat.
3944 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3945                ac_cv_cpp_unused_required,
3946                [AC_TRY_LINK(class X {private: virtual void never_called();};,
3947                                X x;,
3948                                ac_cv_cpp_unused_required=no,
3949                                ac_cv_cpp_unused_required=yes)])
3950 if test "$ac_cv_cpp_unused_required" = yes ; then
3951    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3955 dnl Some compilers have trouble comparing a constant reference to a templatized
3956 dnl class to zero, and require an explicit operator==() to be defined that takes
3957 dnl an int. This test separates the strong from the weak.
3959 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3960                ac_cv_trouble_comparing_to_zero,
3961                [AC_TRY_COMPILE([#include <algorithm>
3962                                 template <class T> class Foo {};
3963                                 class T2;
3964                                 template <class T> int operator==(const T2*, const T&) { return 0; }
3965                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3966                                [Foo<int> f; return (0 != f);],
3967                                ac_cv_trouble_comparing_to_zero=no,
3968                                ac_cv_trouble_comparing_to_zero=yes)])
3969 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3970   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3975 dnl End of C++ language/feature checks
3976 AC_LANG_C
3978 dnl ========================================================
3979 dnl =  Internationalization checks
3980 dnl ========================================================
3982 dnl Internationalization and Locale support is different
3983 dnl on various UNIX platforms.  Checks for specific i18n
3984 dnl features go here.
3986 dnl check for LC_MESSAGES
3987 AC_CACHE_CHECK(for LC_MESSAGES,
3988                 ac_cv_i18n_lc_messages,
3989                 [AC_TRY_COMPILE([#include <locale.h>],
3990                                 [int category = LC_MESSAGES;],
3991                                 ac_cv_i18n_lc_messages=yes,
3992                                 ac_cv_i18n_lc_messages=no)])
3993 if test "$ac_cv_i18n_lc_messages" = yes; then
3994    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3995 fi      
3997 fi # SKIP_COMPILER_CHECKS
3999 TARGET_XPCOM_ABI=
4000 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4001     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4004 dnl Mozilla specific options
4005 dnl ========================================================
4006 dnl The macros used for command line options
4007 dnl are defined in build/autoconf/altoptions.m4.
4010 dnl ========================================================
4011 dnl =
4012 dnl = Check for external package dependencies
4013 dnl =
4014 dnl ========================================================
4015 MOZ_ARG_HEADER(External Packages)
4017 MOZ_ENABLE_LIBXUL=
4019 MOZ_ARG_WITH_STRING(libxul-sdk,
4020 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
4021   LIBXUL_SDK_DIR=$withval)
4023 if test "$LIBXUL_SDK_DIR" = "yes"; then
4024     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4025 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4026     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4028     if test ! -f "$LIBXUL_SDK/sdk/include/xpcom-config.h"; then
4029         AC_MSG_ERROR([$LIBXUL_SDK/sdk/include/xpcom-config.h doesn't exist])
4030     fi
4032     MOZ_ENABLE_LIBXUL=1
4034 AC_SUBST(LIBXUL_SDK)
4036 dnl ========================================================
4037 dnl = If NSPR was not detected in the system, 
4038 dnl = use the one in the source tree (mozilla/nsprpub)
4039 dnl ========================================================
4040 MOZ_ARG_WITH_BOOL(system-nspr,
4041 [  --with-system-nspr      Use system installed NSPR],
4042     _USE_SYSTEM_NSPR=1 )
4044 if test -n "$_USE_SYSTEM_NSPR"; then
4045     AM_PATH_NSPR(4.7.0, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
4048 if test -n "$MOZ_NATIVE_NSPR"; then
4049     _SAVE_CFLAGS=$CFLAGS
4050     CFLAGS="$CFLAGS $NSPR_CFLAGS"
4051     AC_TRY_COMPILE([#include "prlog.h"],
4052                 [#ifndef PR_STATIC_ASSERT
4053                  #error PR_STATIC_ASSERT not defined
4054                  #endif],
4055                 [MOZ_NATIVE_NSPR=1],
4056                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
4057     CFLAGS=$_SAVE_CFLAGS
4058 else
4059     NSPR_CFLAGS='`$(DEPTH)/nsprpub/config/nspr-config --prefix=$(LIBXUL_DIST) --includedir=$(LIBXUL_DIST)/include/nspr --cflags`'
4060     # explicitly set libs for Visual Age C++ for OS/2
4061     if test "$OS_ARCH" = "OS2" -a "$VACPP" = "yes"; then
4062         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''
4063     elif test "$OS_ARCH" = "WINCE"; then
4064         NSPR_CFLAGS='-I$(LIBXUL_DIST)/include/nspr'
4065         NSPR_LIBS='$(LIBXUL_DIST)/lib/nspr'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plc'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plds'$NSPR_VERSION'.lib '
4066     elif test "$OS_ARCH" = "WINNT"; then
4067         NSPR_CFLAGS='-I$(LIBXUL_DIST)/include/nspr'
4068         if test -n "$GNU_CC"; then
4069             NSPR_LIBS="-L\$(LIBXUL_DIST)/lib -lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION"
4070         else
4071             NSPR_LIBS='$(LIBXUL_DIST)/lib/nspr'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plc'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plds'$NSPR_VERSION'.lib '
4072         fi
4073     else
4074         NSPR_LIBS='`$(DEPTH)/nsprpub/config/nspr-config --prefix=$(LIBXUL_DIST) --libdir=$(LIBXUL_DIST)/lib --libs`'
4075     fi
4078 dnl ========================================================
4079 dnl = If NSS was not detected in the system, 
4080 dnl = use the one in the source tree (mozilla/security/nss)
4081 dnl ========================================================
4083 MOZ_ARG_WITH_BOOL(system-nss,
4084 [  --with-system-nss      Use system installed NSS],
4085     _USE_SYSTEM_NSS=1 )
4087 if test -n "$_USE_SYSTEM_NSS"; then
4088     AM_PATH_NSS(3.12.0, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4091 if test -n "$MOZ_NATIVE_NSS"; then
4092    NSS_LIBS="$NSS_LIBS -lcrmf"
4093 else
4094    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4095    NSS_DEP_LIBS="\
4096         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4097         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4098         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4099         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4100         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX) \
4101         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)softokn$NSS_VERSION\$(DLL_SUFFIX)"
4103    if test -z "$GNU_CC" && test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4104        NSS_LIBS="\
4105         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4106         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4107         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4108         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4109         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4110         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)softokn$NSS_VERSION.\$(IMPORT_LIB_SUFFIX)"
4111    else
4112        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION -lsoftokn$NSS_VERSION"
4113    fi
4116 if test -z "$SKIP_LIBRARY_CHECKS"; then
4117 dnl system JPEG support
4118 dnl ========================================================
4119 MOZ_ARG_WITH_STRING(system-jpeg,
4120 [  --with-system-jpeg[=PFX]
4121                           Use system libjpeg [installed at prefix PFX]],
4122     JPEG_DIR=$withval)
4124 _SAVE_CFLAGS=$CFLAGS
4125 _SAVE_LDFLAGS=$LDFLAGS
4126 _SAVE_LIBS=$LIBS
4127 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4128     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4129     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4131 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4132     SYSTEM_JPEG=
4133 else
4134     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4137 if test "$SYSTEM_JPEG" = 1; then
4138     LIBS="$JPEG_LIBS $LIBS"
4139     AC_TRY_COMPILE([ #include <stdio.h>
4140                      #include <sys/types.h>
4141                      #include <jpeglib.h> ],
4142                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4143                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4144                      #endif ],
4145                    SYSTEM_JPEG=1,
4146                    [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=]) 
4147 fi 
4148 CFLAGS=$_SAVE_CFLAGS
4149 LDFLAGS=$_SAVE_LDFLAGS
4150 LIBS=$_SAVE_LIBS
4152 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4153     JPEG_CFLAGS="-I${JPEG_DIR}/include"
4154     JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4157 dnl system ZLIB support
4158 dnl ========================================================
4159 MOZ_ARG_WITH_STRING(system-zlib,
4160 [  --with-system-zlib[=PFX]
4161                           Use system libz [installed at prefix PFX]],
4162     ZLIB_DIR=$withval)
4164 _SAVE_CFLAGS=$CFLAGS
4165 _SAVE_LDFLAGS=$LDFLAGS
4166 _SAVE_LIBS=$LIBS
4167 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4168     CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4169     LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4171 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4172     SYSTEM_ZLIB=
4173 else
4174     AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"], 
4175         [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4177 if test "$SYSTEM_ZLIB" = 1; then
4178     LIBS="$ZLIB_LIBS $LIBS"
4179     AC_TRY_COMPILE([ #include <stdio.h>
4180                      #include <string.h>
4181                      #include <zlib.h> ],
4182                    [ #if ZLIB_VERNUM < $MOZZLIB 
4183                      #error "Insufficient zlib version ($MOZZLIB required)."
4184                      #endif ],
4185                    SYSTEM_ZLIB=1,
4186                    [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=]) 
4188 CFLAGS=$_SAVE_CFLAGS
4189 LDFLAGS=$_SAVE_LDFLAGS
4190 LIBS=$_SAVE_LIBS
4192 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4193     ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4194     ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4197 dnl system BZIP2 Support
4198 dnl ========================================================
4199 MOZ_ARG_WITH_STRING(system-bz2,
4200 [  --with-system-bz2[=PFX]
4201                           Use system libbz2 [installed at prefix PFX]],
4202     BZ2_DIR=$withval)
4204 _SAVE_CFLAGS=$CFLAGS
4205 _SAVE_LDFLAGS=$LDFLAGS
4206 _SAVE_LIBS=$LIBS
4207 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4208     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4209     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4211 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4212     SYSTEM_BZ2=
4213 else
4214     AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4215         [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=], $BZ2_LIBS)
4217 CFLAGS=$_SAVE_CFLAGS
4218 LDFLAGS=$_SAVE_LDFLAGS
4219 LIBS=$_SAVE_LIBS
4221 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4222     BZ2_CFLAGS="-I${BZ2_DIR}/include"
4223     BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4226 dnl system PNG Support
4227 dnl ========================================================
4228 MOZ_ARG_WITH_STRING(system-png, 
4229 [  --with-system-png[=PFX]
4230                           Use system libpng [installed at prefix PFX]],
4231     PNG_DIR=$withval)
4233 _SAVE_CFLAGS=$CFLAGS
4234 _SAVE_LDFLAGS=$LDFLAGS
4235 _SAVE_LIBS=$LIBS
4236 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4237 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4238 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4239     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4240     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4242 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4243     SYSTEM_PNG=
4244 else
4245     _SAVE_PNG_LIBS=$PNG_LIBS
4246     AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4247                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]), 
4248                  $PNG_LIBS)
4249     AC_CHECK_LIB(png, png_get_acTL, ,
4250                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4251                  $_SAVE_PNG_LIBS)
4253 if test "$SYSTEM_PNG" = 1; then
4254     LIBS="$PNG_LIBS $LIBS"
4255     AC_TRY_COMPILE([ #include <stdio.h>
4256                      #include <sys/types.h>
4257                      #include <png.h> ],
4258                    [ #if PNG_LIBPNG_VER < $MOZPNG
4259                      #error "Insufficient libpng version ($MOZPNG required)."
4260                      #endif
4261                      #ifndef PNG_UINT_31_MAX
4262                      #error "Insufficient libpng version."
4263                      #endif ],
4264                    SYSTEM_PNG=1,
4265                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4267 CFLAGS=$_SAVE_CFLAGS
4268 LDFLAGS=$_SAVE_LDFLAGS
4269 LIBS=$_SAVE_LIBS
4271 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4272     PNG_CFLAGS="-I${PNG_DIR}/include"
4273     PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4276 fi # SKIP_LIBRARY_CHECKS
4278 dnl system HunSpell Support
4279 dnl ========================================================
4280 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4281 [  --enable-system-hunspell  Use system hunspell (located with pkgconfig)],
4282     SYSTEM_HUNSPELL=1 )
4284 if test -n "$SYSTEM_HUNSPELL"; then
4285     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4288 AC_SUBST(SYSTEM_HUNSPELL)
4290 dnl check whether to enable glitz
4291 dnl ========================================================
4292 MOZ_ARG_ENABLE_BOOL(glitz,
4293 [  --enable-glitz          Enable Glitz for use with Cairo],
4294     MOZ_ENABLE_GLITZ=1,
4295     MOZ_ENABLE_GLITZ= )
4296 if test "$MOZ_ENABLE_GLITZ"; then
4297     AC_DEFINE(MOZ_ENABLE_GLITZ)
4300 dnl ========================================================
4301 dnl Java SDK support
4302 dnl ========================================================
4303 JAVA_INCLUDE_PATH=
4304 MOZ_ARG_WITH_STRING(java-include-path,
4305 [  --with-java-include-path=dir   Location of Java SDK headers],
4306     JAVA_INCLUDE_PATH=$withval)
4308 JAVA_BIN_PATH=
4309 MOZ_ARG_WITH_STRING(java-bin-path,
4310 [  --with-java-bin-path=dir   Location of Java binaries (java, javac, jar)],
4311     JAVA_BIN_PATH=$withval)
4313 dnl ========================================================
4314 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4315 dnl their usage and use them in spidermonkey.
4316 dnl ========================================================
4317 MOZ_ARG_WITH_BOOL(arm-kuser,
4318 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4319     USE_ARM_KUSER=1,
4320     USE_ARM_KUSER=)
4321 if test -n "$USE_ARM_KUSER"; then
4322    AC_DEFINE(USE_ARM_KUSER)
4325 dnl ========================================================
4326 dnl =
4327 dnl = Application
4328 dnl =
4329 dnl ========================================================
4331 MOZ_ARG_HEADER(Application)
4333 BUILD_STATIC_LIBS=
4334 ENABLE_TESTS=1
4335 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4336 MOZ_BRANDING_DIRECTORY=
4337 MOZ_CALENDAR=
4338 MOZ_DBGRINFO_MODULES=
4339 MOZ_ENABLE_CANVAS=1
4340 MOZ_EXTENSIONS_ALL=" wallet p3p venkman inspector irc typeaheadfind gnomevfs sroaming datetime finger cview layout-debug tasks sql xforms schema-validation reporter"
4341 MOZ_FEEDS=1
4342 MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp xbm icon"
4343 MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
4344 MOZ_IPCD=
4345 MOZ_JAVAXPCOM=
4346 MOZ_JSDEBUGGER=1
4347 MOZ_JSLOADER=1
4348 MOZ_LDAP_XPCOM=
4349 MOZ_LIBART_CFLAGS=
4350 MOZ_LIBART_LIBS=
4351 MOZ_MAIL_NEWS=
4352 MOZ_MATHML=1
4353 MOZ_MOCHITEST=1
4354 MOZ_MORK=1
4355 MOZ_MORKREADER=
4356 MOZ_AUTH_EXTENSION=1
4357 MOZ_NO_ACTIVEX_SUPPORT=1
4358 MOZ_NO_INSPECTOR_APIS=
4359 MOZ_NO_XPCOM_OBSOLETE=
4360 MOZ_NO_FAST_LOAD=
4361 MOZ_OGG=1
4362 MOZ_MEDIA=
4363 MOZ_OJI=1
4364 MOZ_PERMISSIONS=1
4365 MOZ_PLACES=
4366 MOZ_PLAINTEXT_EDITOR_ONLY=
4367 MOZ_PLUGINS=1
4368 MOZ_PREF_EXTENSIONS=1
4369 MOZ_PROFILELOCKING=1
4370 MOZ_PROFILESHARING=1
4371 MOZ_PSM=1
4372 MOZ_PYTHON_EXTENSIONS="xpcom dom"
4373 MOZ_PYTHON=
4374 MOZ_PYTHON_DEBUG_SUFFIX=
4375 MOZ_PYTHON_DLL_SUFFIX=
4376 MOZ_PYTHON_INCLUDES=
4377 MOZ_PYTHON_LIBS=
4378 MOZ_PYTHON_PREFIX=
4379 MOZ_PYTHON_VER=
4380 MOZ_PYTHON_VER_DOTTED=
4381 MOZ_RDF=1
4382 MOZ_REFLOW_PERF=
4383 MOZ_SAFE_BROWSING=
4384 MOZ_HELP_VIEWER=
4385 MOZ_SPELLCHECK=1
4386 MOZ_STATIC_MAIL_BUILD=
4387 MOZ_STORAGE=1
4388 MOZ_SVG=1
4389 MOZ_TIMELINE=
4390 MOZ_UI_LOCALE=en-US
4391 MOZ_UNIVERSALCHARDET=1
4392 MOZ_URL_CLASSIFIER=
4393 MOZ_USE_NATIVE_UCONV=
4394 MOZ_V1_STRING_ABI=
4395 MOZ_VIEW_SOURCE=1
4396 MOZ_XPFE_COMPONENTS=1
4397 MOZ_XPINSTALL=1
4398 MOZ_XSLT_STANDALONE=
4399 MOZ_XTF=1
4400 MOZ_XUL=1
4401 MOZ_XUL_APP=1
4402 MOZ_ZIPWRITER=1
4403 NS_PRINTING=1
4404 NECKO_COOKIES=1
4405 NECKO_DISK_CACHE=1
4406 NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource"
4407 NECKO_SMALL_BUFFERS=
4408 SUNCTL=
4409 JS_STATIC_BUILD=
4410 XPC_IDISPATCH_SUPPORT=
4413 case "$target_os" in
4414 darwin*)
4415     ACCESSIBILITY=
4416     ;;
4418     ACCESSIBILITY=1
4419     ;;
4420 esac
4422 case "$target_os" in
4423     msvc*|mks*|cygwin*|mingw*)
4424         if test -z "$GNU_CC"; then 
4425             XPC_IDISPATCH_SUPPORT=1
4426             MOZ_NO_ACTIVEX_SUPPORT=
4427             MOZ_ACTIVEX_SCRIPTING_SUPPORT=1
4428         fi
4429         ;;
4430 esac
4432 MOZ_ARG_ENABLE_STRING(application,
4433 [  --enable-application=APP
4434                           Options include:
4435                             suite
4436                             browser (Firefox)
4437                             mail (Thunderbird)
4438                             composer
4439                             calendar (Sunbird)
4440                             xulrunner
4441                             camino
4442                             content/xslt (Standalone Transformiix XSLT)
4443                             netwerk (Standalone Necko)
4444                             tools/update-packaging (AUS-related packaging tools)
4445                             standalone (use this for standalone
4446                               xpcom/xpconnect or to manually drive a build)],
4447 [ MOZ_BUILD_APP=$enableval ] )
4449 if test "$MOZ_BUILD_APP" = "macbrowser"; then
4450     AC_MSG_WARN([--enable-application=macbrowser is deprecated. Use --enable-application=camino.])
4451     MOZ_BUILD_APP=camino
4454 MOZ_EMBEDDING_PROFILE=default
4455 MOZ_ARG_WITH_STRING(embedding-profile,
4456 [  --with-embedding-profile=default|basic|minimal
4457                        see http://wiki.mozilla.org/Gecko:Small_Device_Support],
4458 [ MOZ_EMBEDDING_PROFILE=$withval ])
4460 case "$MOZ_EMBEDDING_PROFILE" in
4461 default)
4462   MOZ_EMBEDDING_LEVEL_DEFAULT=1
4463   MOZ_EMBEDDING_LEVEL_BASIC=1
4464   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4465   AC_DEFINE(MOZ_EMBEDDING_LEVEL_DEFAULT)
4466   AC_DEFINE(MOZ_EMBEDDING_LEVEL_BASIC)
4467   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4468   ;;
4470 basic)
4471   MOZ_EMBEDDING_LEVEL_DEFAULT=
4472   MOZ_EMBEDDING_LEVEL_BASIC=1
4473   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4474   AC_DEFINE(MOZ_EMBEDDING_LEVEL_BASIC)
4475   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4476   ENABLE_TESTS=
4477   MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4478   MOZ_COMPOSER=
4479   MOZ_ENABLE_CANVAS=
4480   MOZ_ENABLE_POSTSCRIPT=
4481   MOZ_EXTENSIONS_DEFAULT=" spatialnavigation"
4482   MOZ_IMG_DECODERS_DEFAULT="png gif jpeg"
4483   MOZ_IMG_ENCODERS_DEFAULT=
4484   MOZ_IMG_ENCODERS=
4485   MOZ_INSTALLER=
4486   MOZ_JSDEBUGGER=
4487   MOZ_LDAP_XPCOM=
4488   MOZ_MAIL_NEWS=
4489   MOZ_MATHML=
4490   MOZ_AUTH_EXTENSION=
4491   MOZ_NO_ACTIVEX_SUPPORT=1
4492   MOZ_NO_INSPECTOR_APIS=1
4493   MOZ_NO_XPCOM_OBSOLETE=1
4494   MOZ_NO_FAST_LOAD=1
4495   MOZ_OJI=
4496   MOZ_PLAINTEXT_EDITOR_ONLY=1
4497 #  MOZ_PLUGINS=
4498   MOZ_PREF_EXTENSIONS=
4499   MOZ_PROFILELOCKING=
4500   MOZ_PROFILESHARING=
4501   MOZ_SPELLCHECK=
4502   MOZ_SVG=
4503   MOZ_UNIVERSALCHARDET=
4504   MOZ_UPDATER=
4505   MOZ_USE_NATIVE_UCONV=
4506   MOZ_VIEW_SOURCE=
4507   MOZ_XPFE_COMPONENTS=
4508   MOZ_XPINSTALL=
4509   MOZ_XTF=
4510   MOZ_ZIPWRITER=
4511   NECKO_DISK_CACHE=
4512   NECKO_PROTOCOLS_DEFAULT="about data http file res"
4513   NECKO_SMALL_BUFFERS=1
4514   NS_DISABLE_LOGGING=1
4515   NS_PRINTING=
4516   JS_STATIC_BUILD=1
4517   ;;
4519 minimal)
4520   MOZ_EMBEDDING_LEVEL_DEFAULT=
4521   MOZ_EMBEDDING_LEVEL_BASIC=
4522   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4523   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4524   ENABLE_TESTS=
4525   MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4526   MOZ_COMPOSER=
4527   MOZ_ENABLE_CANVAS=
4528   MOZ_ENABLE_POSTSCRIPT=
4529   MOZ_EXTENSIONS_DEFAULT=" spatialnavigation"
4530   MOZ_IMG_DECODERS_DEFAULT="png gif jpeg"
4531   MOZ_IMG_ENCODERS_DEFAULT=
4532   MOZ_IMG_ENCODERS=
4533   MOZ_INSTALLER=
4534   MOZ_JSDEBUGGER=
4535   MOZ_LDAP_XPCOM=
4536   MOZ_MAIL_NEWS=
4537   MOZ_MATHML=
4538   MOZ_AUTH_EXTENSION=
4539   MOZ_NO_ACTIVEX_SUPPORT=1
4540   MOZ_NO_INSPECTOR_APIS=1
4541   MOZ_NO_XPCOM_OBSOLETE=1
4542   MOZ_NO_FAST_LOAD=1
4543   MOZ_OJI=
4544   MOZ_PLAINTEXT_EDITOR_ONLY=1
4545   MOZ_PLUGINS=
4546   MOZ_PREF_EXTENSIONS=
4547   MOZ_PROFILELOCKING=
4548   MOZ_PROFILESHARING=
4549   MOZ_SPELLCHECK=
4550   MOZ_STORAGE=1
4551   MOZ_PLACES=
4552   MOZ_SVG=
4553   MOZ_UNIVERSALCHARDET=
4554   MOZ_UPDATER=
4555   MOZ_USE_NATIVE_UCONV=1
4556   MOZ_VIEW_SOURCE=
4557   MOZ_XPFE_COMPONENTS=
4558   MOZ_XPINSTALL=
4559   MOZ_XTF=
4560   MOZ_XUL=
4561   MOZ_ZIPWRITER=
4562   MOZ_RDF=
4563   NECKO_DISK_CACHE=
4564   NECKO_PROTOCOLS_DEFAULT="about data http file res"
4565   NECKO_SMALL_BUFFERS=1
4566   NS_DISABLE_LOGGING=1
4567   NS_PRINTING=
4568   JS_STATIC_BUILD=1
4569   ;;
4572   AC_MSG_ERROR([Unrecognized value: --with-embedding-profile=$MOZ_EMBEDDING_PROFILE])
4573   ;;
4574 esac
4576 AC_SUBST(MOZ_EMBEDDING_LEVEL_DEFAULT)
4577 AC_SUBST(MOZ_EMBEDDING_LEVEL_BASIC)
4578 AC_SUBST(MOZ_EMBEDDING_LEVEL_MINIMAL)
4580 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4581 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
4582   XULRUNNER_STUB_NAME=$withval)
4584 if test -z "$XULRUNNER_STUB_NAME"; then
4585   case "$target_os" in
4586   darwin*)
4587     XULRUNNER_STUB_NAME=xulrunner
4588     ;;
4589   *)
4590     XULRUNNER_STUB_NAME=xulrunner-stub
4591   esac
4593 AC_SUBST(XULRUNNER_STUB_NAME)
4595 if test -z "$MOZ_BUILD_APP"; then
4596   AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
4597 else
4598   # We have a valid application only if it has a build.mk file in its top
4599   # directory.
4600   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4601     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4602   fi
4605 # Allow the application to influence configure with a confvars.sh script.
4607 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4608 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4609   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4610   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4611 else
4612   AC_MSG_RESULT([no])
4615 # Now is a good time to test for logic errors, define mismatches, etc.
4616 case "$MOZ_BUILD_APP" in
4617 xulrunner)
4618   if test "$LIBXUL_SDK"; then
4619     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4620   fi
4621   ;;
4623   # Fix this case for folks who forget. Warn them.
4624   if test -n "$LIBXUL_SDK" -a -z "$MOZ_XUL_APP"; then
4625     AC_MSG_WARN([Setting MOZ_XUL_APP since LIBXUL_SDK was set. Add to confvars.sh!])
4626     MOZ_XUL_APP=1
4627   fi
4628   ;;
4629 esac
4631 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4632 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4633 # MOZ_BUILD_APP.
4634 case "$MOZ_BUILD_APP" in
4635 suite)
4636   AC_DEFINE(MOZ_SUITE)
4637   ;;
4639 browser)
4640   AC_DEFINE(MOZ_PHOENIX)
4641   ;;
4643 mail)
4644   AC_DEFINE(MOZ_THUNDERBIRD)
4645   ;;
4647 composer)
4648   AC_DEFINE(MOZ_STANDALONE_COMPOSER)
4649   ;;
4651 calendar)
4652   AC_DEFINE(MOZ_SUNBIRD)
4653   ;;
4655 xulrunner)
4656   AC_DEFINE(MOZ_XULRUNNER)
4657   ;;
4659 camino) 
4660   AC_DEFINE(MOZ_MACBROWSER)
4661   ;;
4663 content/xslt)
4664   AC_DEFINE(TX_EXE)
4665   ;;
4667 standalone) 
4668   MOZ_APP_NAME=mozilla
4669   MOZ_APP_DISPLAYNAME=Mozilla
4670   MOZ_APP_VERSION=$MOZILLA_VERSION
4671   ;;
4673 esac
4675 AC_SUBST(MOZ_BUILD_APP)
4676 AC_SUBST(MOZ_XUL_APP)
4677 AC_SUBST(MOZ_SUITE)
4678 AC_SUBST(MOZ_PHOENIX)
4679 AC_SUBST(MOZ_THUNDERBIRD)
4680 AC_SUBST(MOZ_STANDALONE_COMPOSER)
4681 AC_SUBST(MOZ_SUNBIRD)
4682 AC_SUBST(MOZ_XULRUNNER)
4684 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4686 if test "$MOZ_XUL_APP"; then
4687   MOZ_PROFILESHARING=
4688   AC_DEFINE(MOZ_XUL_APP)
4691 dnl ========================================================
4692 dnl = 
4693 dnl = Toolkit Options
4694 dnl = 
4695 dnl ========================================================
4696 MOZ_ARG_HEADER(Toolkit Options)
4698     dnl ========================================================
4699     dnl = Select the default toolkit
4700     dnl ========================================================
4701         MOZ_ARG_ENABLE_STRING(default-toolkit,
4702         [  --enable-default-toolkit=TK
4703                           Select default toolkit
4704                           Platform specific defaults:
4705                             BeOS - cairo-beos
4706                             Mac OS X - cairo-cocoa
4707                             Neutrino/QNX - photon
4708                             OS/2 - cairo-os2
4709                             Win32 - cairo-windows
4710                             WinCE - windows
4711                             * - cairo-gtk2
4712                             * - cairo-qt],
4713     [ _DEFAULT_TOOLKIT=$enableval ],
4714     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4716     if test "$_DEFAULT_TOOLKIT" = "photon" \
4717         -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4718         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4719         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4720         -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
4721         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4722         -o "$_DEFAULT_TOOLKIT" = "cairo-mac" \
4723         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa"
4724     then
4725         dnl nglayout only supports building with one toolkit,
4726         dnl so ignore everything after the first comma (",").
4727         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4728     else
4729         if test "$no_x" != "yes"; then
4730             AC_MSG_ERROR([Toolkit must be cairo-gtk2 or cairo-qt.])
4731         else
4732             AC_MSG_ERROR([Toolkit must be $_PLATFORM_DEFAULT_TOOLKIT (if supported).])
4733         fi
4734     fi
4736 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_TOOLKIT,"$MOZ_WIDGET_TOOLKIT")
4738 dnl ========================================================
4739 dnl = Enable the toolkit as needed                         =
4740 dnl ========================================================
4742 case "$MOZ_WIDGET_TOOLKIT" in
4743 photon)
4744         MOZ_ENABLE_PHOTON=1
4745         AC_DEFINE(MOZ_WIDGET_PHOTON)
4746     ;;
4748 cairo-windows)
4749     MOZ_WIDGET_TOOLKIT=windows
4750     MOZ_GFX_TOOLKIT=cairo
4751     ;;
4753 cairo-gtk2)
4754     MOZ_WIDGET_TOOLKIT=gtk2
4755     MOZ_GFX_TOOLKIT=cairo
4756     MOZ_ENABLE_GTK2=1
4757     MOZ_ENABLE_XREMOTE=1
4758     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4759     TK_LIBS='$(MOZ_GTK2_LIBS)'
4760     AC_DEFINE(MOZ_WIDGET_GTK2)
4761     ;;
4762 cairo-qt)
4763     MOZ_WIDGET_TOOLKIT=qt
4764     MOZ_GFX_TOOLKIT=cairo
4765     MOZ_ENABLE_QT=1
4766     MOZ_ENABLE_XREMOTE=1
4767     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4768     TK_LIBS='$(MOZ_QT_LIBS)'
4769     AC_DEFINE(MOZ_WIDGET_QT)
4770     ;;
4771 cairo-beos)
4772     MOZ_WIDGET_TOOLKIT=beos
4773     MOZ_GFX_TOOLKIT=cairo
4774     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4775     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4776     ;;
4778 cairo-os2)
4779     MOZ_WIDGET_TOOLKIT=os2
4780     MOZ_GFX_TOOLKIT=cairo
4781     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4782     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4783     ;;
4785 cairo-mac|cairo-cocoa)
4786     if test "$MOZ_WIDGET_TOOLKIT" = "cairo-cocoa"; then
4787         MOZ_WIDGET_TOOLKIT=cocoa
4788         AC_DEFINE(MOZ_WIDGET_COCOA)
4789         MOZ_ENABLE_COCOA=1
4790     else
4791         MOZ_WIDGET_TOOLKIT=mac
4792     fi
4793     MOZ_GFX_TOOLKIT=cairo
4794     MOZ_USER_DIR="Mozilla"
4795     AC_DEFINE(XP_MACOSX)
4796     AC_DEFINE(TARGET_CARBON)
4797     AC_DEFINE(TARGET_API_MAC_CARBON)
4798     TK_LIBS='-framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit'
4799     TK_CFLAGS="-I${MACOS_SDK_DIR}/Developer/Headers/FlatCarbon"
4800     CFLAGS="$CFLAGS $TK_CFLAGS"
4801     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4802     ;;
4803 esac
4805 if test "$MOZ_ENABLE_XREMOTE"; then
4806     AC_DEFINE(MOZ_ENABLE_XREMOTE)
4809 if test "$COMPILE_ENVIRONMENT"; then
4810 if test "$MOZ_ENABLE_GTK2"
4811 then
4812     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 gdk-x11-2.0 glib-2.0 gobject-2.0)
4814 fi # COMPILE_ENVIRONMENT
4816 AC_SUBST(MOZ_DEFAULT_TOOLKIT)
4818 dnl ========================================================
4819 dnl = startup-notification support module
4820 dnl ========================================================
4822 if test "$MOZ_ENABLE_GTK2"
4823 then
4824     MOZ_ENABLE_STARTUP_NOTIFICATION=
4826     MOZ_ARG_ENABLE_BOOL(startup-notification,
4827     [  --enable-startup-notification       Enable startup-notification support (default: disabled) ],
4828         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4829         MOZ_ENABLE_STARTUP_NOTIFICATION=)
4830     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4831     then
4832         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4833                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4834         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4835             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4836             then
4837                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4838             fi
4839             MOZ_ENABLE_STARTUP_NOTIFICATION=
4840         ])
4841     fi
4843     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4844         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4845     fi
4847     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4849 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4850 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4851 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4853 dnl ========================================================
4854 dnl = QT support
4855 dnl ========================================================
4856 if test "$MOZ_ENABLE_QT"
4857 then
4858     PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtUiTools QtCore)
4859     AC_SUBST(MOZ_QT_CFLAGS)
4860     AC_SUBST(MOZ_QT_LIBS)
4862     MOZ_ARG_WITH_STRING(qtdir,
4863     [  --with-qtdir=\$dir       Specify Qt directory ],
4864     [ QTDIR=$withval])
4866     if test -z "$QTDIR"; then
4867       QTDIR="/usr"
4868     fi
4869     QTINCDIR="/include/qt"
4870     if test ! -d "$QTDIR$QTINCDIR"; then
4871        QTINCDIR="/include/X11/qt"
4872     fi
4873     if test ! -d "$QTDIR$QTINCDIR"; then
4874        QTINCDIR="/include"
4875     fi
4877     if test -x "$QTDIR/bin/moc-qt4"; then
4878       HOST_MOC="$QTDIR/bin/moc-qt4"
4879     else
4880       if test -x "$QTDIR/bin/moc"; then
4881         HOST_MOC="$QTDIR/bin/moc"
4882       else
4883         AC_CHECK_PROGS(HOST_MOC, moc, "")
4884       fi
4885     fi
4886     if test -z "$HOST_MOC"; then
4887       AC_MSG_ERROR([no acceptable moc preprocessor found])
4888     fi
4889     MOC=$HOST_MOC
4892 AC_SUBST(GTK_CONFIG)
4893 AC_SUBST(TK_CFLAGS)
4894 AC_SUBST(TK_LIBS)
4896 AC_SUBST(MOZ_ENABLE_GTK2)
4897 AC_SUBST(MOZ_ENABLE_PHOTON)
4898 AC_SUBST(MOZ_ENABLE_COCOA)
4899 AC_SUBST(MOZ_ENABLE_GLITZ)
4900 AC_SUBST(MOZ_ENABLE_QT)
4901 AC_SUBST(MOZ_ENABLE_XREMOTE)
4902 AC_SUBST(MOZ_GTK2_CFLAGS)
4903 AC_SUBST(MOZ_GTK2_LIBS)
4904 AC_SUBST(MOZ_QT_CFLAGS)
4905 AC_SUBST(MOZ_QT_LIBS)
4907 AC_SUBST(MOC)
4909 if test "$MOZ_ENABLE_GTK2" \
4910 || test "$MOZ_ENABLE_QT"
4911 then
4912     AC_DEFINE(MOZ_X11)
4913     MOZ_X11=1
4915 AC_SUBST(MOZ_X11)
4917 dnl ========================================================
4918 dnl =
4919 dnl = Components & Features
4920 dnl = 
4921 dnl ========================================================
4922 MOZ_ARG_HEADER(Components and Features)
4924 dnl ========================================================
4925 dnl = Localization
4926 dnl ========================================================
4927 MOZ_ARG_ENABLE_STRING(ui-locale,
4928 [  --enable-ui-locale=ab-CD
4929                           Select the user interface locale (default: en-US)],
4930     MOZ_UI_LOCALE=$enableval )
4931 AC_SUBST(MOZ_UI_LOCALE)
4933 dnl =========================================================
4934 dnl = Calendar client
4935 dnl =========================================================
4936 MOZ_ARG_ENABLE_BOOL(calendar,,
4937     MOZ_OLD_CALENDAR=1,
4938     MOZ_OLD_CALENDAR= )
4940 if test "$MOZ_OLD_CALENDAR"; then
4941     AC_MSG_WARN([Building with the calendar extension is no longer supported.])
4942     if test "$MOZ_THUNDERBIRD"; then
4943         AC_MSG_WARN([Since you're trying to build mail, you could try adding])
4944         AC_MSG_WARN(['--enable-extensions=default,lightning' to your mozconfig])
4945         AC_MSG_WARN([and building WITH A FRESH TREE.])
4946     fi
4947     AC_MSG_WARN([For more information, please visit:])
4948     AC_MSG_ERROR([http://www.mozilla.org/projects/calendar/])
4951 AC_SUBST(MOZ_CALENDAR)
4953 dnl =========================================================
4954 dnl = Mail & News
4955 dnl =========================================================
4956 MOZ_ARG_DISABLE_BOOL(mailnews,
4957 [  --disable-mailnews      Disable building of mail & news components],
4958     MOZ_MAIL_NEWS=,
4959     MOZ_MAIL_NEWS=1 )
4960 AC_SUBST(MOZ_MAIL_NEWS)
4962 dnl =========================================================
4963 dnl = LDAP
4964 dnl =========================================================
4965 MOZ_ARG_DISABLE_BOOL(ldap,
4966 [  --disable-ldap          Disable LDAP support],
4967     MOZ_LDAP_XPCOM=,
4968     MOZ_LDAP_XPCOM=1)
4970 dnl ========================================================
4971 dnl = Trademarked Branding 
4972 dnl ========================================================
4973 MOZ_ARG_ENABLE_BOOL(official-branding,
4974 [  --enable-official-branding Enable Official mozilla.org Branding
4975                           Do not distribute builds with
4976                           --enable-official-branding unless you have
4977                           permission to use trademarks per
4978                           http://www.mozilla.org/foundation/trademarks/ .],
4979 [case "$MOZ_BUILD_APP" in
4980 browser)
4981     MOZ_BRANDING_DIRECTORY=other-licenses/branding/firefox
4982     MOZ_APP_DISPLAYNAME=Firefox
4983     ;;
4985 calendar)
4986     MOZ_BRANDING_DIRECTORY=other-licenses/branding/sunbird
4987     MOZ_APP_DISPLAYNAME=Sunbird
4988     ;;
4990 mail)
4991     MOZ_BRANDING_DIRECTORY=other-licenses/branding/thunderbird
4992     ;;
4995     AC_MSG_ERROR([Official branding is only available for Firefox Sunbird and Thunderbird.])
4996 esac
4999 MOZ_ARG_WITH_STRING(branding,
5000 [  --with-branding=dir    Use branding from the specified directory.],
5001     MOZ_BRANDING_DIRECTORY=$withval)
5003 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
5004 if test -z "$REAL_BRANDING_DIRECTORY"; then
5005   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
5008 if test -f "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"; then
5009   . "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"
5012 AC_SUBST(MOZ_BRANDING_DIRECTORY)
5014 dnl ========================================================
5015 dnl = Distribution ID
5016 dnl ========================================================
5017 MOZ_ARG_WITH_STRING(distribution-id,
5018 [  --with-distribution-id=ID  Set distribution-specific id (default=org.mozilla)],
5019 [ val=`echo $withval`
5020     MOZ_DISTRIBUTION_ID="$val"])
5022 if test -z "$MOZ_DISTRIBUTION_ID"; then
5023    MOZ_DISTRIBUTION_ID="org.mozilla"
5026 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
5027 AC_SUBST(MOZ_DISTRIBUTION_ID)
5029 dnl ========================================================
5030 dnl = Xft and Pango
5031 dnl ========================================================
5032 if test "$MOZ_ENABLE_GTK2"
5033 then
5034     PKG_CHECK_MODULES(MOZ_XFT, xft)
5035     AC_SUBST(MOZ_XFT_CFLAGS)
5036     AC_SUBST(MOZ_XFT_LIBS)
5038     PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5039     PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangocairo >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
5040     AC_SUBST(MOZ_PANGO_CFLAGS)
5041     AC_SUBST(MOZ_PANGO_LIBS)
5044 dnl ========================================================
5045 dnl = PostScript print module
5046 dnl ========================================================
5047 MOZ_ARG_DISABLE_BOOL(postscript,
5048 [  --disable-postscript    Disable PostScript printing support ],
5049     MOZ_ENABLE_POSTSCRIPT=,
5050     MOZ_ENABLE_POSTSCRIPT=1 )
5052 dnl ========================================================
5053 dnl = GnomeVFS support module
5054 dnl ========================================================
5056 if test "$MOZ_X11"
5057 then
5058     dnl build the gnomevfs extension by default only when the
5059     dnl GTK2 toolkit is in use.
5060     if test "$MOZ_ENABLE_GTK2"
5061     then
5062         MOZ_ENABLE_GNOMEVFS=1
5063         MOZ_ENABLE_GCONF=1
5064         MOZ_ENABLE_LIBGNOME=1
5065     fi
5067     MOZ_ARG_DISABLE_BOOL(gnomevfs,
5068     [  --disable-gnomevfs      Disable GnomeVFS support ],
5069         MOZ_ENABLE_GNOMEVFS=,
5070         MOZ_ENABLE_GNOMEVFS=force)
5072     if test "$MOZ_ENABLE_GNOMEVFS"
5073     then
5074         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5075             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5076             MOZ_ENABLE_GNOMEVFS=1
5077         ],[
5078             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5079             then
5080                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5081             fi
5082             MOZ_ENABLE_GNOMEVFS=
5083         ])
5084     fi
5086     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5087     AC_SUBST(MOZ_GNOMEVFS_LIBS)
5089     if test "$MOZ_ENABLE_GCONF"
5090     then
5091         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION,[
5092             MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5093             MOZ_ENABLE_GCONF=1
5094         ],[
5095             MOZ_ENABLE_GCONF=
5096         ])
5097     fi
5099     if test "$MOZ_ENABLE_GCONF"; then
5100         AC_DEFINE(MOZ_ENABLE_GCONF)
5101     fi
5103     AC_SUBST(MOZ_ENABLE_GCONF)
5104     AC_SUBST(MOZ_GCONF_CFLAGS)
5105     AC_SUBST(MOZ_GCONF_LIBS)
5107     if test "$MOZ_ENABLE_LIBGNOME"
5108     then
5109         PKG_CHECK_MODULES(MOZ_LIBGNOME, libgnome-2.0 >= $LIBGNOME_VERSION,[
5110             MOZ_LIBGNOME_LIBS=`echo $MOZ_LIBGNOME_LIBS | sed 's/-llinc\>//'`
5111             MOZ_ENABLE_LIBGNOME=1
5112         ],[
5113             MOZ_ENABLE_LIBGNOME=
5114         ])
5115     fi
5117     AC_SUBST(MOZ_LIBGNOME_CFLAGS)
5118     AC_SUBST(MOZ_LIBGNOME_LIBS)
5120     # The GNOME component is built if gtk2, gconf, gnome-vfs, and libgnome
5121     # are all available.
5123     if test "$MOZ_ENABLE_GTK2" -a "$MOZ_ENABLE_GCONF" -a \
5124             "$MOZ_ENABLE_GNOMEVFS" -a "$MOZ_ENABLE_LIBGNOME"; then
5125       MOZ_ENABLE_GNOME_COMPONENT=1
5126     else
5127       MOZ_ENABLE_GNOME_COMPONENT=
5128     fi
5130     AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5133 dnl ========================================================
5134 dnl = libgnomeui support module
5135 dnl ========================================================
5137 if test "$MOZ_ENABLE_GTK2"
5138 then
5139     MOZ_ENABLE_GNOMEUI=1
5141     MOZ_ARG_DISABLE_BOOL(gnomeui,
5142     [  --disable-gnomeui       Disable libgnomeui support (default: auto, optional at runtime) ],
5143         MOZ_ENABLE_GNOMEUI=,
5144         MOZ_ENABLE_GNOMEUI=force)
5146     if test "$MOZ_ENABLE_GNOMEUI"
5147     then
5148         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5149         [
5150             MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5151             MOZ_ENABLE_GNOMEUI=1
5152         ],[
5153             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5154             then
5155                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5156             fi
5157             MOZ_ENABLE_GNOMEUI=
5158         ])
5159     fi
5161     if test "$MOZ_ENABLE_GNOMEUI"; then
5162         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5163     fi
5165 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5166 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5167 AC_SUBST(MOZ_GNOMEUI_LIBS)
5169 dnl ========================================================
5170 dnl = dbus support
5171 dnl ========================================================
5173 if test "$MOZ_ENABLE_GTK2"
5174 then
5175     MOZ_ENABLE_DBUS=1
5177     MOZ_ARG_DISABLE_BOOL(dbus,
5178     [  --disable-dbus       Disable dbus support ],
5179         MOZ_ENABLE_DBUS=,
5180         MOZ_ENABLE_DBUS=1)
5182     if test "$MOZ_ENABLE_DBUS"
5183     then
5184         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5185         AC_DEFINE(MOZ_ENABLE_DBUS)
5186     fi
5188 AC_SUBST(MOZ_ENABLE_DBUS)
5189 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5190 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5192 dnl ========================================================
5193 dnl = Build Personal Security Manager
5194 dnl ========================================================
5195 MOZ_ARG_DISABLE_BOOL(crypto,
5196 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5197     MOZ_PSM=,
5198     MOZ_PSM=1 )
5200 dnl ========================================================
5201 dnl = JS Debugger XPCOM component (js/jsd)
5202 dnl ========================================================
5203 MOZ_ARG_DISABLE_BOOL(jsd,
5204 [  --disable-jsd           Disable JavaScript debug library],
5205     MOZ_JSDEBUGGER=,
5206     MOZ_JSDEBUGGER=1)
5209 dnl ========================================================
5210 dnl = Disable plugin support
5211 dnl ========================================================
5212 MOZ_ARG_DISABLE_BOOL(plugins,
5213 [  --disable-plugins       Disable plugins support],
5214     MOZ_PLUGINS=,
5215     MOZ_PLUGINS=1)
5217 dnl ========================================================
5218 dnl = Open JVM Interface (OJI) support
5219 dnl ========================================================
5220 MOZ_ARG_DISABLE_BOOL(oji,
5221 [  --disable-oji           Disable Open JVM Integration support],
5222     MOZ_OJI=,
5223     MOZ_OJI=1)
5224 if test -n "$MOZ_OJI"; then
5225     AC_DEFINE(OJI)
5228 dnl bi-directional support always on
5229 IBMBIDI=1
5230 AC_DEFINE(IBMBIDI)
5232 dnl ========================================================
5233 dnl complex text support off by default
5234 dnl ========================================================
5235 MOZ_ARG_ENABLE_BOOL(ctl,
5236 [  --enable-ctl            Enable Thai Complex Script support],
5237     SUNCTL=1,
5238     SUNCTL= )
5240 dnl ========================================================
5241 dnl view source support on by default
5242 dnl ========================================================
5243 MOZ_ARG_DISABLE_BOOL(view-source,
5244 [  --disable-view-source     Disable view source support],
5245     MOZ_VIEW_SOURCE=,
5246     MOZ_VIEW_SOURCE=1 )
5247 if test "$MOZ_VIEW_SOURCE"; then
5248     AC_DEFINE(MOZ_VIEW_SOURCE)
5252 dnl ========================================================
5253 dnl accessibility support on by default on all platforms 
5254 dnl except OS X.
5255 dnl ========================================================
5256 MOZ_ARG_DISABLE_BOOL(accessibility,
5257 [  --disable-accessibility Disable accessibility support (off by default on OS X)],
5258     ACCESSIBILITY=,
5259     ACCESSIBILITY=1 )
5260 if test "$ACCESSIBILITY"; then
5261     AC_DEFINE(ACCESSIBILITY)
5264 if test -n "$ACCESSIBILITY"; then
5265 case "$target" in
5266 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5267     if test "$ac_cv_header_atlbase_h" = "no"; then
5268         AC_MSG_ERROR([System header atlbase.h is not available. See http://developer.mozilla.org/en/docs/atlbase.h for details on fixing this problem.])
5269     fi
5270     if test "$ac_cv_header_oleacc_idl" = "no"; then
5271         AC_MSG_ERROR([System header oleacc.idl is not available. See http://developer.mozilla.org/en/docs/oleacc.idl for details on fixing this problem.])
5272     fi
5273     ;;
5274 esac
5277 dnl ========================================================
5278 dnl xpfe/components on by default
5279 dnl ========================================================
5280 MOZ_ARG_DISABLE_BOOL(xpfe-components,
5281 [  --disable-xpfe-components
5282                           Disable xpfe components],
5283     MOZ_XPFE_COMPONENTS=,
5284     MOZ_XPFE_COMPONENTS=1 )
5286 dnl ========================================================
5287 dnl xpinstall support on by default
5288 dnl ========================================================
5289 MOZ_ARG_DISABLE_BOOL(xpinstall,
5290 [  --disable-xpinstall     Disable xpinstall support],
5291     MOZ_XPINSTALL=,
5292     MOZ_XPINSTALL=1 )
5293 if test "$MOZ_XPINSTALL"; then
5294     AC_DEFINE(MOZ_XPINSTALL)
5297 dnl ========================================================
5298 dnl xpcom js loader support on by default
5299 dnl ========================================================
5300 MOZ_ARG_DISABLE_BOOL(jsloader,
5301 [  --disable-jsloader      Disable xpcom js loader support],
5302     MOZ_JSLOADER=,
5303     MOZ_JSLOADER=1 )
5304 if test "$MOZ_JSLOADER"; then
5305     AC_DEFINE(MOZ_JSLOADER)
5308 dnl ========================================================
5309 dnl Disable printing
5310 dnl ========================================================
5311 MOZ_ARG_DISABLE_BOOL(printing,
5312 [  --disable-printing  Disable printing support],
5313     NS_PRINTING=,
5314     NS_PRINTING=1 )
5316 if test "$NS_PRINTING"; then
5317     AC_DEFINE(NS_PRINTING)
5318     AC_DEFINE(NS_PRINT_PREVIEW)
5321 dnl ========================================================
5322 dnl use native unicode converters
5323 dnl ========================================================
5324 MOZ_ARG_ENABLE_BOOL(native-uconv,
5325 [  --enable-native-uconv   Enable iconv support],
5326     MOZ_USE_NATIVE_UCONV=1,
5327     MOZ_USE_NATIVE_UCONV= )
5328 if test "$MOZ_USE_NATIVE_UCONV"; then
5329     AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5331 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5332     AC_MSG_ERROR([iconv() not found.  Cannot enable native uconv support.])
5336 dnl ========================================================
5337 dnl Libeditor can be build as plaintext-only,
5338 dnl or as a full html and text editing component.
5339 dnl We build both by default.
5340 dnl ========================================================
5341 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5342 [  --enable-plaintext-editor-only
5343                           Allow only plaintext editing],
5344     MOZ_PLAINTEXT_EDITOR_ONLY=1,
5345     MOZ_PLAINTEXT_EDITOR_ONLY= )
5346 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5347 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5349 dnl ========================================================
5350 dnl Composer is on by default.
5351 dnl ========================================================
5352 MOZ_ARG_DISABLE_BOOL(composer,
5353 [  --disable-composer      Disable building of Composer],
5354     MOZ_COMPOSER=,
5355     MOZ_COMPOSER=1 )
5356 AC_SUBST(MOZ_COMPOSER)
5359 dnl ========================================================
5360 dnl = Drop XPCOM Obsolete library
5361 dnl ========================================================
5362 MOZ_ARG_DISABLE_BOOL(xpcom-obsolete,
5363 [  --disable-xpcom-obsolete           Disable XPCOM Obsolete Library],
5364     MOZ_NO_XPCOM_OBSOLETE=1,
5365     MOZ_NO_XPCOM_OBSOLETE=)
5367 if test -n "$MOZ_NO_XPCOM_OBSOLETE"; then
5368     AC_DEFINE(MOZ_NO_XPCOM_OBSOLETE)
5371 dnl ========================================================
5372 dnl = Disable Fast Load
5373 dnl ========================================================
5374 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5375 [  --disable-xpcom-fastload           Disable XPCOM fastload support],
5376     MOZ_NO_FAST_LOAD=1,
5377     MOZ_NO_FAST_LOAD=)
5379 AC_SUBST(MOZ_NO_FAST_LOAD)
5381 if test -n "$MOZ_NO_FAST_LOAD"; then
5382     AC_DEFINE(MOZ_NO_FAST_LOAD)
5385 dnl ========================================================
5386 dnl = Enable Ogg Codecs
5387 dnl ========================================================
5388 MOZ_ARG_DISABLE_BOOL(ogg,
5389 [  --disable-ogg           Disable Ogg Codec support],
5390     MOZ_OGG=,
5391     MOZ_OGG=1)
5393 AC_SUBST(MOZ_OGG)
5395 if test -n "$MOZ_OGG"; then
5396     AC_DEFINE(MOZ_OGG)
5397     MOZ_MEDIA=1
5400 AC_SUBST(MOZ_MEDIA)
5402 if test -n "$MOZ_MEDIA"; then
5403     AC_DEFINE(MOZ_MEDIA)
5406 dnl If using Ogg with Linux, ensure that the alsa library is available
5407 if test -n "$MOZ_OGG"; then
5408    case "$target_os" in
5409 linux*)
5410       AC_CHECK_LIB(asound, snd_pcm_open,,AC_MSG_ERROR([Ogg support on Linux requires the alsa library]))
5411       ;;
5412    esac
5415 dnl ========================================================
5416 dnl Permissions System
5417 dnl ========================================================
5418 MOZ_ARG_DISABLE_BOOL(permissions,
5419 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
5420     MOZ_PERMISSIONS=,
5421     MOZ_PERMISSIONS=1
5424 dnl ========================================================
5425 dnl NegotiateAuth
5426 dnl ========================================================
5427 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5428 [  --disable-negotiateauth Disable GSS-API negotiation ],
5429     MOZ_AUTH_EXTENSION=,
5430     MOZ_AUTH_EXTENSION=1 )
5432 dnl ========================================================
5433 dnl XTF
5434 dnl ========================================================
5435 MOZ_ARG_DISABLE_BOOL(xtf,
5436 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
5437     MOZ_XTF=,
5438     MOZ_XTF=1 )
5439 if test "$MOZ_XTF"; then
5440   AC_DEFINE(MOZ_XTF)
5443 dnl ========================================================
5444 dnl Inspector APIs
5445 dnl ========================================================
5446 MOZ_ARG_DISABLE_BOOL(inspector-apis,
5447 [  --disable-inspector-apis Disable the DOM inspection APIs ],
5448     MOZ_NO_INSPECTOR_APIS=1,
5449     MOZ_NO_INSPECTOR_APIS= )
5451 dnl ========================================================
5452 dnl Pref extensions (autoconfig and system-pref)
5453 dnl ========================================================
5454 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5455 [  --disable-pref-extensions
5456                           Disable pref extensions such as autoconfig and
5457                           system-pref],
5458   MOZ_PREF_EXTENSIONS=,
5459   MOZ_PREF_EXTENSIONS=1 )
5461 dnl ========================================================
5462 dnl = Universalchardet
5463 dnl ========================================================
5464 MOZ_ARG_DISABLE_BOOL(universalchardet,
5465 [  --disable-universalchardet
5466                           Disable universal encoding detection],
5467   MOZ_UNIVERSALCHARDET=,
5468   MOZ_UNIVERSALCHARDET=1 )
5470 dnl ========================================================
5471 dnl JavaXPCOM
5472 dnl ========================================================
5473 MOZ_ARG_ENABLE_BOOL(javaxpcom,
5474 [  --enable-javaxpcom
5475                           Enable Java-XPCOM bridge],
5476     MOZ_JAVAXPCOM=1,
5477     MOZ_JAVAXPCOM= )
5479 if test -n "${MOZ_JAVAXPCOM}"; then
5480   case "$host_os" in
5481     cygwin*|msvc*|mks*)
5482       if test -n "$JAVA_HOME"; then
5483         JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
5484       fi
5485       ;;
5486     *mingw*)
5487       if test -n "$JAVA_HOME"; then
5488         JAVA_HOME=`cd "$JAVA_HOME" && pwd`
5489       fi
5490       ;;
5491   esac
5493   if test -n "${JAVA_INCLUDE_PATH}"; then
5494     dnl Make sure jni.h exists in the given include path.
5495     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5496       AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
5497     fi
5498   else
5499     case "$target_os" in
5500       darwin*)
5501         dnl Default to java system location
5502         JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
5503         ;;
5504       *)
5505         dnl Try $JAVA_HOME
5506         JAVA_INCLUDE_PATH="$JAVA_HOME/include"
5507         ;;
5508     esac
5509     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5510       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.])
5511     fi
5512   fi
5514   if test -n "${JAVA_BIN_PATH}"; then
5515     dnl Look for javac and jar in the specified path.
5516     JAVA_PATH="$JAVA_BIN_PATH"
5517   else
5518     dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5519     JAVA_PATH="$JAVA_HOME/bin:$PATH"
5520   fi
5522   AC_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5523   AC_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5524   AC_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5525   if test -z "$JAVA" || test "$JAVA" = ":" || test -z "$JAVAC" || test "$JAVAC" = ":" || test -z "$JAR" || test "$JAR" = ":"; then
5526     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.])
5527   fi
5530 dnl ========================================================
5531 dnl = Breakpad crash reporting (on by default on supported platforms)
5532 dnl ========================================================
5534 if (test "$OS_ARCH" = "WINNT" -a -z "$GNU_CC" \
5535     || test "$OS_ARCH" = "Darwin" \
5536     || test "$OS_ARCH" = "Linux" -a "$CPU_ARCH" = "x86" \
5537     || test "$OS_ARCH" = "SunOS") \
5538    && test -z "$HAVE_64BIT_OS"; then
5539    MOZ_CRASHREPORTER=1
5542 MOZ_ARG_DISABLE_BOOL(crashreporter,
5543 [  --disable-crashreporter          Disable breakpad crash reporting],
5544     MOZ_CRASHREPORTER=,
5545     MOZ_CRASHREPORTER=1)
5547 if test -n "$MOZ_CRASHREPORTER"; then
5548    AC_DEFINE(MOZ_CRASHREPORTER)
5550   if (test "$OS_ARCH" = "Linux" || test "$OS_ARCH" = "SunOS") && \
5551     test -z "$SKIP_LIBRARY_CHECKS"; then
5552     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5553     AC_SUBST(MOZ_GTHREAD_CFLAGS)
5554     AC_SUBST(MOZ_GTHREAD_LIBS)
5556     AC_CHECK_HEADERS([curl/curl.h], [], [AC_MSG_ERROR([Couldn't find curl/curl.h which is required for the crash reporter.  Use --disable-crashreporter to disable the crash reporter.])])
5557   fi
5560 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5561 [  --with-crashreporter-enable-percent=NN  Enable sending crash reports by default on NN% of users. (default=100)],
5562 [ val=`echo $withval | sed 's/[^0-9]//g'`
5563     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5565 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5566    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5568 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5571 dnl ========================================================
5572 dnl = Build mochitest JS/DOM tests (on by default)
5573 dnl ========================================================
5574 MOZ_ARG_DISABLE_BOOL(mochitest,
5575 [  --disable-mochitest        Disable mochitest harness],
5576     MOZ_MOCHITEST=,
5577     MOZ_MOCHITEST=1 )
5579 dnl ========================================================
5580 dnl = Enable compilation of specific extension modules
5581 dnl ========================================================
5583 MOZ_ARG_ENABLE_STRING(extensions,
5584 [  --enable-extensions     Enable extensions],
5585 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5586     if test "$option" = "yes" || test "$option" = "all"; then
5587         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_ALL"
5588     elif test "$option" = "no" || test "$option" = "none"; then
5589         MOZ_EXTENSIONS=""
5590     elif test "$option" = "default"; then
5591         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
5592     elif test `echo "$option" | grep -c \^-` != 0; then
5593         option=`echo $option | sed 's/^-//'`
5594         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
5595     else
5596         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
5597     fi
5598 done],
5599     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
5601 if test -z "$MOZ_ENABLE_GNOMEVFS" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5602     # Suppress warning on non-X11 platforms
5603     if test -n "$MOZ_X11"; then
5604         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
5605     fi
5606     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5609 if test -z "$MOZ_JSDEBUGGER" && test `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
5610     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
5611     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
5614 dnl This might be temporary: build tridentprofile only on Windows
5615 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
5616     AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
5617     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5620 dnl cookie must be built before tridentprofile. put it at list's end.
5621 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
5622   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5623   MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
5626 dnl xforms requires xtf and schema-validation
5627 if test -z "$MOZ_XTF" && test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
5628     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
5629     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5631 if test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0 && test `echo "$MOZ_EXTENSIONS" | grep -c schema-validation` -eq 0; then
5632     AC_MSG_WARN([Cannot build XForms without schema validation.  Removing XForms from MOZ_EXTENSIONS.])
5633     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5636 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
5637     AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
5638     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
5641 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
5642     AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
5643     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
5646 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
5647     AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
5648     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
5651 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
5652     AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
5653     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
5656 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
5657     AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
5658     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
5661 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
5662     AC_MSG_WARN([spellcheck is no longer an extension.])
5663     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
5666 if test -n "$MOZ_NO_XPCOM_OBSOLETE" && test `echo "$MOZ_EXTENSIONS" | grep -c sroaming` -ne 0; then
5667     AC_MSG_WARN([Cannot currently build sroaming without xpcom obsolete -- bug 249343. Removing sroaming from MOZ_EXTENSIONS.])
5668     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|sroaming||'`
5671 dnl Remove dupes
5672 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
5674 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
5675 dnl when trying to build a non-existent extension.
5676 for extension in $MOZ_EXTENSIONS; do
5677     if test ! -d "${srcdir}/extensions/${extension}"; then
5678         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
5679     fi
5680 done
5683 dnl ========================================================
5684 dnl Image decoders
5685 dnl ========================================================
5686 case "$MOZ_WIDGET_TOOLKIT" in
5687 beos|windows|os2|mac|cocoa)
5688     ;;
5690     if test -z "$MOZ_ENABLE_GTK2"; then
5691        MOZ_IMG_DECODERS_DEFAULT=`echo $MOZ_IMG_DECODERS_DEFAULT | sed -e 's|icon||'`                
5692     fi
5693     ;;
5694 esac
5696 MOZ_ARG_ENABLE_STRING(image-decoders,
5697 [  --enable-image-decoders[={mod1,mod2,default,all,none}]
5698                           Enable specific image decoders],
5699 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5700     if test "$option" = "yes" || test "$option" = "all"; then
5701         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5702     elif test "$option" = "no" || test "$option" = "none"; then
5703         MOZ_IMG_DECODERS=""
5704     elif test "$option" = "default"; then
5705         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5706     elif test `echo "$option" | grep -c \^-` != 0; then
5707         option=`echo $option | sed 's/^-//'`
5708         MOZ_IMG_DECODERS=`echo "$MOZ_IMG_DECODERS" | sed "s/ ${option}//"`
5709     else
5710         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $option"
5711     fi
5712 done],
5713     MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS_DEFAULT")
5715 dnl Dupes are removed in the encoder section because it will also add decoders
5717 dnl ========================================================
5718 dnl Image encoders
5719 dnl ========================================================
5720 MOZ_ARG_ENABLE_STRING(image-encoders,
5721 [  --enable-image-encoders[={mod1,mod2,default,all,none}]
5722                           Enable specific image encoders],
5723 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5724     if test "$option" = "yes" || test "$option" = "all"; then
5725         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5726     elif test "$option" = "no" || test "$option" = "none"; then
5727         MOZ_IMG_ENCODERS=""
5728         addencoder=""
5729     elif test "$option" = "default"; then
5730         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5731     elif test `echo "$option" | grep -c \^-` != 0; then
5732         option=`echo $option | sed 's/^-//'`
5733         addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
5734     else
5735         addencoder="$option"
5736     fi
5737     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
5738 done],
5739     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
5741 dnl Remove dupes
5742 MOZ_IMG_DECODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_DECODERS}`
5743 MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
5745 dnl ========================================================
5746 dnl experimental ldap features
5747 dnl ========================================================
5748 MOZ_ARG_ENABLE_BOOL(ldap-experimental,
5749 [  --enable-ldap-experimental
5750                           Enable LDAP experimental features],
5751     MOZ_LDAP_XPCOM_EXPERIMENTAL=1,
5752     MOZ_LDAP_XPCOM_EXPERIMENTAL=)
5754 dnl ========================================================
5755 dnl MathML on by default
5756 dnl ========================================================
5757 MOZ_ARG_DISABLE_BOOL(mathml,
5758 [  --disable-mathml        Disable MathML support],
5759     MOZ_MATHML=,
5760     MOZ_MATHML=1 )
5761 if test "$MOZ_MATHML"; then
5762   AC_DEFINE(MOZ_MATHML)
5765 dnl ========================================================
5766 dnl Canvas
5767 dnl ========================================================
5768 MOZ_ARG_DISABLE_BOOL(canvas,
5769 [  --disable-canvas          Disable html:canvas feature],
5770     MOZ_ENABLE_CANVAS=,
5771     MOZ_ENABLE_CANVAS=1 )
5772 if test -n "$MOZ_ENABLE_CANVAS"; then
5773     AC_DEFINE(MOZ_ENABLE_CANVAS)
5775 AC_SUBST(MOZ_ENABLE_CANVAS)
5777 dnl ========================================================
5778 dnl SVG
5779 dnl ========================================================
5780 MOZ_ARG_DISABLE_BOOL(svg,
5781 [  --disable-svg            Disable SVG support],
5782     MOZ_SVG=,
5783     MOZ_SVG=1 )
5784 if test -n "$MOZ_SVG"; then
5785   AC_DEFINE(MOZ_SVG)
5788 MOZ_SVG_FOREIGNOBJECT=1
5789 dnl ========================================================
5790 dnl SVG <foreignObject>
5791 dnl ========================================================
5792 MOZ_ARG_DISABLE_BOOL(svg-foreignobject,
5793    [  --disable-svg-foreignobject
5794                         Disable SVG <foreignObject> support],
5795    MOZ_SVG_FOREIGNOBJECT=,
5796    MOZ_SVG_FOREIGNOBJECT=1 )
5797 if test "$MOZ_SVG_FOREIGNOBJECT"; then
5798   if test "$MOZ_SVG"; then
5799     AC_DEFINE(MOZ_SVG_FOREIGNOBJECT)
5800   else
5801     MOZ_SVG_FOREIGNOBEJCT=
5802   fi
5805 dnl ========================================================
5806 dnl Installer
5807 dnl ========================================================
5808 case "$target_os" in
5809     aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*)
5810         MOZ_INSTALLER=1
5811         ;;
5812 esac
5814 MOZ_ARG_DISABLE_BOOL(installer,
5815 [  --disable-installer     Disable building of installer],
5816     MOZ_INSTALLER=,
5817     MOZ_INSTALLER=1 )
5818 if test -n "$MOZ_INSTALLER" -a -n "$MOZ_XUL_APP" -a "$OS_ARCH" = "WINNT"; then
5819     # Disable installer for Windows builds that use the new toolkit if NSIS
5820     # isn't in the path.
5821     AC_PATH_PROGS(MAKENSIS, makensis)
5822     if test -z "$MAKENSIS" || test "$MAKENSIS" = ":"; then
5823         AC_MSG_ERROR([To build the installer makensis is required in your path. To build without the installer reconfigure using --disable-installer.])
5824     fi
5825     # The Windows build for NSIS requires the iconv command line utility to
5826     # convert the charset of the locale files.
5827     AC_PATH_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
5828     if test -z "$HOST_ICONV"; then
5829         AC_MSG_ERROR([To build the installer iconv is required in your path. To build without the installer reconfigure using --disable-installer.])
5830     fi
5833 # Automatically disable installer if xpinstall isn't built
5834 if test -z "$MOZ_XPINSTALL"; then
5835     MOZ_INSTALLER=
5837 AC_SUBST(MOZ_INSTALLER)
5839 AC_MSG_CHECKING([for tar archiver])
5840 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
5841 if test -z "$TAR"; then
5842     AC_MSG_ERROR([no tar archiver found in \$PATH])
5844 AC_MSG_RESULT([$TAR])
5845 AC_SUBST(TAR)
5847 dnl ========================================================
5848 dnl Updater
5849 dnl ========================================================
5851 MOZ_ARG_DISABLE_BOOL(updater,
5852 [  --disable-updater       Disable building of updater],
5853     MOZ_UPDATER=,
5854     MOZ_UPDATER=1 )
5855 # The Windows build requires the iconv command line utility
5856 # in order to build the updater.
5857 case "$target_os" in
5858     msvc*|mks*|cygwin*|mingw*|wince*)
5859         if test -n "$MOZ_UPDATER"; then
5860             AC_MSG_CHECKING([for iconv])
5861             AC_CHECK_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
5862             if test -z "$HOST_ICONV"; then
5863                 AC_MSG_ERROR([iconv not found in \$PATH])
5864             fi
5865         fi
5866         ;;
5867 esac
5868 AC_SUBST(MOZ_UPDATER)
5870 # app update channel is 'default' when not supplied.
5871 MOZ_ARG_ENABLE_STRING([update-channel],
5872 [  --enable-update-channel=CHANNEL
5873                            Select application update channel (default=default)],
5874     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
5876 if test -z "$MOZ_UPDATE_CHANNEL"; then
5877     MOZ_UPDATE_CHANNEL=default
5879 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
5881 # tools/update-packaging is not checked out by default.
5882 MOZ_ARG_ENABLE_BOOL(update-packaging,
5883 [  --enable-update-packaging
5884                            Enable tools/update-packaging],
5885     MOZ_UPDATE_PACKAGING=1,
5886     MOZ_UPDATE_PACKAGING= )
5887 AC_SUBST(MOZ_UPDATE_PACKAGING)
5889 dnl ========================================================
5890 dnl ActiveX
5891 dnl ========================================================
5893 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
5894 [  --disable-xpconnect-idispatch
5895                           Disable building of xpconnect support for IDispatch
5896                           (win32 only)],
5897     XPC_IDISPATCH_SUPPORT=,
5898     XPC_IDISPATCH_SUPPORT=1)
5899 AC_SUBST(XPC_IDISPATCH_SUPPORT)
5901 MOZ_ARG_DISABLE_BOOL(activex,
5902 [  --disable-activex       Disable building of ActiveX control (win32 only)],
5903     MOZ_NO_ACTIVEX_SUPPORT=1,
5904     MOZ_NO_ACTIVEX_SUPPORT= )
5905 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
5907 MOZ_ARG_DISABLE_BOOL(activex-scripting,
5908 [  --disable-activex-scripting
5909                           Disable building of ActiveX scripting support (win32)],
5910     MOZ_ACTIVEX_SCRIPTING_SUPPORT=,
5911     MOZ_ACTIVEX_SCRIPTING_SUPPORT=1)
5912 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
5914 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
5915 then
5916     AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
5919 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
5920 case "$target" in
5921 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5922     if test "$ac_cv_header_atlbase_h" = "no"; then
5923         AC_MSG_ERROR([System header atlbase.h is not available. See http://developer.mozilla.org/en/docs/atlbase.h for details on fixing this problem.])
5924     fi
5925     ;;
5926 esac
5929 dnl ========================================================
5930 dnl leaky
5931 dnl ========================================================
5932 MOZ_ARG_ENABLE_BOOL(leaky,
5933 [  --enable-leaky          Build leaky memory tool],
5934     MOZ_LEAKY=1,
5935     MOZ_LEAKY=)
5938 dnl ========================================================
5939 dnl xpctools
5940 dnl ========================================================
5941 MOZ_ARG_ENABLE_BOOL(xpctools,
5942 [  --enable-xpctools       Build JS profiling tool],
5943     MOZ_XPCTOOLS=1,
5944     MOZ_XPCTOOLS= )
5947 dnl ========================================================
5948 dnl build the tests by default
5949 dnl ========================================================
5950 MOZ_ARG_DISABLE_BOOL(tests,
5951 [  --disable-tests         Do not build test libraries & programs],
5952     ENABLE_TESTS=,
5953     ENABLE_TESTS=1 )
5955 dnl ========================================================
5956 dnl parental controls (for Windows Vista)
5957 dnl ========================================================
5958 MOZ_ARG_DISABLE_BOOL(parental-controls,
5959 [  --disable-parental-controls
5960                            Do not build parental controls],
5961    MOZ_DISABLE_PARENTAL_CONTROLS=1,
5962    MOZ_DISABLE_PARENTAL_CONTROLS=)
5963 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
5964     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
5967 dnl ========================================================
5968 dnl Vista SDK specific api
5969 dnl ========================================================
5970 MOZ_ARG_DISABLE_BOOL(vista-sdk-requirements,
5971 [  --disable-vista-sdk-requirements
5972                            Do not build Vista SDK specific code],
5973    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1,
5974    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=)
5975 if test -n "$MOZ_DISABLE_VISTA_SDK_REQUIREMENTS"; then
5976     AC_MSG_WARN([Resulting builds will not be compatible with Windows Vista. (bug 428970)])
5977     AC_DEFINE(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
5978     if test -z "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
5979         AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
5980     fi
5981     MOZ_DISABLE_PARENTAL_CONTROLS=1
5982 else
5983 case "$target" in
5984 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5985     if test "$ac_cv_header_wpcapi_h" = "no"; then
5986         AC_MSG_ERROR([System header wpcapi.h is not available. See updated http://developer.mozilla.org/en/docs/wpcapi.h for details on fixing this problem.])
5987     fi
5988     ;;
5989 esac
5991 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
5992 AC_SUBST(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
5994 dnl ========================================================
5995 dnl =
5996 dnl = Module specific options
5997 dnl =
5998 dnl ========================================================
5999 MOZ_ARG_HEADER(Individual module options)
6001 dnl ========================================================
6002 dnl = Enable Lea malloc in xpcom. OFF by default.
6003 dnl ========================================================
6004 MOZ_ARG_ENABLE_BOOL(xpcom-lea,
6005 [  --enable-xpcom-lea      Use Lea malloc in xpcom ],
6006     XPCOM_USE_LEA=1,
6007     XPCOM_USE_LEA= )
6008 if test -n "$XPCOM_USE_LEA"; then
6009     AC_DEFINE(XPCOM_USE_LEA)
6012 dnl ========================================================
6013 dnl = Enable places (new history/bookmarks)
6014 dnl ========================================================
6015 MOZ_ARG_ENABLE_BOOL(places,
6016 [  --enable-places        Enable 'places' bookmark/history implementation],
6017     MOZ_PLACES=1,
6018     MOZ_PLACES= )
6019 if test -n "$MOZ_PLACES"; then
6020     AC_DEFINE(MOZ_PLACES)
6021     if test -z "$MOZ_MAIL_NEWS"; then
6022       MOZ_MORK=
6023     fi
6024     MOZ_MORKREADER=1
6025 else
6026   if test "$MOZ_BUILD_APP" = "browser"; then
6027     AC_MSG_ERROR([Cannot build Firefox with --disable-places.])
6028   fi
6031 dnl ========================================================
6032 dnl = Disable feed handling components
6033 dnl ========================================================
6034 MOZ_ARG_DISABLE_BOOL(feeds,
6035 [  --disable-feeds        Disable feed handling and processing components],
6036     MOZ_FEEDS=,
6037     MOZ_FEEDS=1 )
6038 if test -n "$MOZ_FEEDS"; then
6039     AC_DEFINE(MOZ_FEEDS)
6040 else
6041     if test "$MOZ_BUILD_APP" = "browser"; then
6042         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6043     fi
6046 dnl ========================================================
6047 dnl = Enable mozStorage
6048 dnl ========================================================
6049 dnl Implicitly enabled by default if building calendar or places
6050 MOZ_ARG_ENABLE_BOOL(storage,
6051 [  --enable-storage        Enable mozStorage module and related components],
6052     MOZ_STORAGE=1,
6053     MOZ_STORAGE= )
6054 if test -n "$MOZ_STORAGE"; then
6055     AC_DEFINE(MOZ_STORAGE)
6058 dnl ========================================================
6059 dnl Check for sqlite
6060 dnl ========================================================
6062 MOZ_NATIVE_SQLITE=
6063 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6064 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6065 MOZ_NATIVE_SQLITE=1,
6066 MOZ_NATIVE_SQLITE= )
6068 if test -z "$MOZ_NATIVE_SQLITE"
6069 then
6070     SQLITE_CFLAGS=
6071     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,sqlite3,$(DIST)/lib)'
6072 else
6073     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6076 AC_SUBST(MOZ_NATIVE_SQLITE)
6078 dnl = Enable help viewer (off by default)
6079 dnl ========================================================
6080 MOZ_ARG_ENABLE_BOOL(help-viewer,
6081 [  --enable-help-viewer        Enable help viewer],
6082     MOZ_HELP_VIEWER=1,
6083     MOZ_HELP_VIEWER= )
6084 if test -n "$MOZ_HELP_VIEWER"; then
6085      AC_DEFINE(MOZ_HELP_VIEWER)
6087 AC_SUBST(MOZ_HELP_VIEWER)
6088 if test "$MOZ_BUILD_APP" = "browser" -a -n "$MOZ_HELP_VIEWER"; then
6089     AC_MSG_ERROR([Cannot build Firefox with --enable-help-viewer.])
6092 dnl ========================================================
6093 dnl = Enable safe browsing (anti-phishing)
6094 dnl ========================================================
6095 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6096 [  --enable-safe-browsing        Enable safe browsing (anti-phishing) implementation],
6097     MOZ_SAFE_BROWSING=1,
6098     MOZ_SAFE_BROWSING= )
6099 if test -n "$MOZ_SAFE_BROWSING"; then
6100     AC_DEFINE(MOZ_SAFE_BROWSING)
6102 AC_SUBST(MOZ_SAFE_BROWSING)
6104 dnl ========================================================
6105 dnl = Enable url-classifier
6106 dnl ========================================================
6107 dnl Implicitly enabled by default if building with safe-browsing
6108 if test -n "$MOZ_SAFE_BROWSING"; then
6109     MOZ_URL_CLASSIFIER=1
6111 MOZ_ARG_ENABLE_BOOL(url-classifier,
6112 [  --enable-url-classifier        Enable url classifier module],
6113     MOZ_URL_CLASSIFIER=1,
6114     MOZ_URL_CLASSIFIER= )
6115 if test -n "$MOZ_URL_CLASSIFIER"; then
6116     AC_DEFINE(MOZ_URL_CLASSIFIER)
6118 AC_SUBST(MOZ_URL_CLASSIFIER)
6120 dnl ========================================================
6121 dnl = Disable zipwriter
6122 dnl ========================================================
6123 MOZ_ARG_DISABLE_BOOL(zipwriter,
6124 [  --disable-zipwriter             Disable zipwriter component],
6125     MOZ_ZIPWRITER=,
6126     MOZ_ZIPWRITER=1 )
6127 AC_SUBST(MOZ_ZIPWRITER)
6129 dnl ========================================================
6130 dnl = Enable Ultrasparc specific optimizations for JS
6131 dnl ========================================================
6132 MOZ_ARG_ENABLE_BOOL(js-ultrasparc,
6133 [  --enable-js-ultrasparc  Use UltraSPARC optimizations in JS],
6134     JS_ULTRASPARC_OPTS=1,
6135     JS_ULTRASPARC_OPTS= )
6137 dnl only enable option for ultrasparcs
6138 if test `echo "$target_os" | grep -c \^solaris 2>/dev/null` = 0 -o \
6139     "$OS_TEST" != "sun4u"; then
6140     JS_ULTRASPARC_OPTS=
6142 AC_SUBST(JS_ULTRASPARC_OPTS)
6144 dnl ========================================================
6145 dnl =
6146 dnl = Feature options that require extra sources to be pulled
6147 dnl =
6148 dnl ========================================================
6149 dnl MOZ_ARG_HEADER(Features that require extra sources)
6151 dnl ========================================================
6152 dnl =
6153 dnl = Debugging Options
6154 dnl = 
6155 dnl ========================================================
6156 MOZ_ARG_HEADER(Debugging and Optimizations)
6158 dnl ========================================================
6159 dnl = Disable building with debug info.
6160 dnl = Debugging is OFF by default
6161 dnl ========================================================
6162 if test -z "$MOZ_DEBUG_FLAGS"
6163 then
6164     case "$target" in
6165     *-irix*)
6166         if test "$GNU_CC"; then
6167             GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'`
6168             case "$GCC_VERSION" in
6169             2.95.*)
6170                 MOZ_DEBUG_FLAGS=""
6171                 ;;
6172             *)
6173                 MOZ_DEBUG_FLAGS="-g"
6174                 ;;
6175             esac
6176         else
6177             MOZ_DEBUG_FLAGS="-g"
6178         fi
6179         ;;
6180     *)
6181         MOZ_DEBUG_FLAGS="-g"
6182         ;;
6183     esac
6186 MOZ_ARG_ENABLE_STRING(debug,
6187 [  --enable-debug[=DBG]    Enable building with developer debug info
6188                           (Using compiler flags DBG)],
6189 [ if test "$enableval" != "no"; then
6190     MOZ_DEBUG=1
6191     if test -n "$enableval" && test "$enableval" != "yes"; then
6192         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6193     fi
6194   else
6195     MOZ_DEBUG=
6196   fi ],
6197   MOZ_DEBUG=)
6199 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG"
6200  case "${target_os}" in
6201     beos*)
6202         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${USER}"
6203         ;;
6204     msvc*|mks*|cygwin*|mingw*|os2*|wince*)
6205         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
6206         ;;
6207     *) 
6208         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`$WHOAMI`"
6209         ;;
6210   esac
6211 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DTRACING"
6213 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6215 if test -n "$MOZ_DEBUG"; then
6216     AC_MSG_CHECKING([for valid debug flags])
6217     _SAVE_CFLAGS=$CFLAGS
6218     CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6219     AC_TRY_COMPILE([#include <stdio.h>], 
6220         [printf("Hello World\n");],
6221         _results=yes,
6222         _results=no)
6223     AC_MSG_RESULT([$_results])
6224     if test "$_results" = "no"; then
6225         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6226     fi
6227     CFLAGS=$_SAVE_CFLAGS
6230 dnl ========================================================
6231 dnl = Enable code optimization. ON by default.
6232 dnl ========================================================
6233 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6234         MOZ_OPTIMIZE_FLAGS="-O"
6237 MOZ_ARG_ENABLE_STRING(optimize,
6238 [  --disable-optimize      Disable compiler optimization
6239   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6240 [ if test "$enableval" != "no"; then
6241     MOZ_OPTIMIZE=1
6242     if test -n "$enableval" && test "$enableval" != "yes"; then
6243         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6244         MOZ_OPTIMIZE=2
6245     fi
6246 else
6247     MOZ_OPTIMIZE=
6248 fi ], MOZ_OPTIMIZE=1)
6250 if test "$COMPILE_ENVIRONMENT"; then
6251 if test -n "$MOZ_OPTIMIZE"; then
6252     AC_MSG_CHECKING([for valid optimization flags])
6253     _SAVE_CFLAGS=$CFLAGS
6254     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6255     AC_TRY_COMPILE([#include <stdio.h>], 
6256         [printf("Hello World\n");],
6257         _results=yes,
6258         _results=no)
6259     AC_MSG_RESULT([$_results])
6260     if test "$_results" = "no"; then
6261         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6262     fi
6263     CFLAGS=$_SAVE_CFLAGS
6265 fi # COMPILE_ENVIRONMENT
6267 AC_SUBST(MOZ_OPTIMIZE)
6268 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6269 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6270 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6272 dnl ========================================================
6273 dnl = Enable/disable debug for specific modules only
6274 dnl =   module names beginning with ^ will be disabled 
6275 dnl ========================================================
6276 MOZ_ARG_ENABLE_STRING(debug-modules,
6277 [  --enable-debug-modules  Enable/disable debug info for specific modules],
6278 [ MOZ_DEBUG_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
6280 dnl ========================================================
6281 dnl = Enable/disable generation of debugger info for specific modules only
6282 dnl =    the special module name ALL_MODULES can be used to denote all modules
6283 dnl =    module names beginning with ^ will be disabled
6284 dnl ========================================================
6285 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
6286 [  --enable-debugger-info-modules
6287                           Enable/disable debugger info for specific modules],
6288 [ for i in `echo $enableval | sed 's/,/ /g'`; do
6289       dnl note that the list of module names is reversed as it is copied
6290       dnl this is important, as it will allow config.mk to interpret stuff like
6291       dnl "^ALL_MODULES xpcom" properly
6292       if test "$i" = "no"; then
6293         i="^ALL_MODULES"
6294       fi
6295       if test "$i" = "yes"; then
6296         i="ALL_MODULES"
6297       fi
6298       MOZ_DBGRINFO_MODULES="$i $MOZ_DBGRINFO_MODULES";
6299     done ])
6301 dnl ========================================================
6302 dnl Enable garbage collector
6303 dnl ========================================================
6304 MOZ_ARG_ENABLE_BOOL(boehm,
6305 [  --enable-boehm          Enable the Boehm Garbage Collector],
6306     GC_LEAK_DETECTOR=1,
6307     GC_LEAK_DETECTOR= )
6308 if test -n "$GC_LEAK_DETECTOR"; then
6309     AC_DEFINE(GC_LEAK_DETECTOR)
6312 dnl ========================================================
6313 dnl Disable runtime logging checks
6314 dnl ========================================================
6315 MOZ_ARG_DISABLE_BOOL(logging,
6316 [  --disable-logging       Disable logging facilities],
6317     NS_DISABLE_LOGGING=1,
6318     NS_DISABLE_LOGGING= )
6319 if test "$NS_DISABLE_LOGGING"; then
6320     AC_DEFINE(NS_DISABLE_LOGGING)
6321 else
6322     AC_DEFINE(MOZ_LOGGING)
6325 dnl ========================================================
6326 dnl = dnl This will enable logging of addref, release, ctor, dtor.
6327 dnl ========================================================
6328 _ENABLE_LOGREFCNT=42
6329 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6330 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
6331     _ENABLE_LOGREFCNT=1,
6332     _ENABLE_LOGREFCNT= )
6333 if test "$_ENABLE_LOGREFCNT" = "1"; then
6334     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6335 elif test -z "$_ENABLE_LOGREFCNT"; then
6336     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6339 dnl ========================================================
6340 dnl = Enable trace malloc
6341 dnl ========================================================
6342 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6343 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6344 [  --enable-trace-malloc   Enable malloc tracing],
6345     NS_TRACE_MALLOC=1,
6346     NS_TRACE_MALLOC= )
6347 if test "$NS_TRACE_MALLOC"; then
6348   # Please, Mr. Linker Man, don't take away our symbol names
6349   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6350   USE_ELF_DYNSTR_GC=
6351   AC_DEFINE(NS_TRACE_MALLOC)
6353 AC_SUBST(NS_TRACE_MALLOC)
6355 dnl ========================================================
6356 dnl = Enable jemalloc
6357 dnl ========================================================
6358 MOZ_ARG_ENABLE_BOOL(jemalloc,
6359 [  --enable-jemalloc       Replace memory allocator with jemalloc],
6360     MOZ_MEMORY=1,
6361     MOZ_MEMORY=)
6363 if test "$NS_TRACE_MALLOC"; then
6364     MOZ_MEMORY=
6367 if test "$MOZ_MEMORY"; then
6369   dnl Don't try to run compiler tests on Windows  
6370   if test "$OS_ARCH" = "WINNT"; then
6371     if test -z "$HAVE_64BIT_OS"; then
6372       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6373     else
6374       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6375     fi
6376   else
6377     AC_CHECK_SIZEOF([int *], [4])
6378     case "${ac_cv_sizeof_int_p}" in
6379     4)
6380       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6381       ;;
6382     8)
6383       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6384       ;;
6385     *)
6386       AC_MSG_ERROR([Unexpected pointer size])
6387       ;;
6388     esac
6389   fi
6391   AC_DEFINE(MOZ_MEMORY)
6392   if test "x$MOZ_DEBUG" = "x1"; then
6393     AC_DEFINE(MOZ_MEMORY_DEBUG)
6394   fi
6395   dnl The generic feature tests that determine how to compute ncpus are long and
6396   dnl complicated.  Therefore, simply define special cpp variables for the
6397   dnl platforms we have special knowledge of.
6398   case "${target_os}" in
6399   darwin*)
6400     AC_DEFINE(MOZ_MEMORY_DARWIN)
6401     ;;
6402   *-freebsd*)
6403     AC_DEFINE(MOZ_MEMORY_BSD)
6404     ;;
6405   *linux*)
6406     AC_DEFINE(MOZ_MEMORY_LINUX)
6407     ;;
6408   netbsd*)
6409     AC_DEFINE(MOZ_MEMORY_BSD)
6410     ;;
6411   solaris*)
6412     AC_DEFINE(MOZ_MEMORY_SOLARIS)
6413     ;;
6414   msvc*|mks*|cygwin*|mingw*)
6415     AC_DEFINE(MOZ_MEMORY_WINDOWS)
6416     dnl XXX: should test for vc8sp1 here, otherwise patching the crt src
6417     dnl will fail miserably
6418     if test "$_CC_SUITE" -lt "8"; then
6419         AC_MSG_ERROR([Building jemalloc requires Visual C++ 2005 or better])
6420     fi
6421     if test -z "$WIN32_CRT_SRC_DIR" -a -z "$WIN32_CUSTOM_CRT_DIR"; then
6422       if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
6423         AC_MSG_ERROR([When building jemalloc, either set WIN32_CRT_SRC_DIR to the path to the Visual C++ CRT source (usually VCINSTALLDIR\crt\src), or set WIN32_CUSTOM_CRT_DIR to the path to a folder containing a pre-built CRT DLL.])
6424       else
6425         WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
6426       fi
6427     fi
6428     if test -z "$WIN32_CRT_SRC_DIR"; then
6429       # pre-built dll
6430       WIN32_CUSTOM_CRT_DIR=`cd "$WIN32_CUSTOM_CRT_DIR" && pwd`
6431       _WIN_UNIX_CRT_PATH="$WIN32_CUSTOM_CRT_DIR"
6432     else
6433       # CRT source directory
6434       WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd`
6435       _CRT_BASE_DIR=`basename "$WIN32_CRT_SRC_DIR"`
6436       _WIN_UNIX_CRT_PATH="$_objdir/memory/jemalloc/$_CRT_BASE_DIR/build/intel"
6437     fi
6438     dnl need win32 paths in LIB, hence this python abuse.  extra brackets
6439     dnl are to avoid m4
6440     _WIN_CRT_PATH=[`$PYTHON -c 'import sys, os.path; print os.path.normpath(sys.argv[1])' "$_WIN_UNIX_CRT_PATH"`]
6441     MOZ_LIB="$_WIN_CRT_PATH;$LIB"
6442     dnl Needs to be in PATH too, since our tools will wind up linked against it.
6443     dnl This needs to be unix style.
6444     MOZ_PATH="$PATH:$_WIN_UNIX_CRT_PATH"
6445     dnl Statically link the C++ stdlib.  We only use this for Breakpad anyway.
6446     AC_DEFINE(_STATIC_CPPLIB)
6447     dnl Don't generate a manifest, since we're linking to a custom CRT.
6448     LDFLAGS="$LDFLAGS -MANIFEST:NO"
6449     dnl Also pass this to NSPR/NSS
6450     DLLFLAGS="$DLLFLAGS -MANIFEST:NO"
6451     export DLLFLAGS
6452     ;;
6453   *)
6454     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
6455     ;;
6456   esac
6458   AC_ARG_WITH([valgrind],
6459     [  --with-valgrind         Enable valgrind integration hooks],
6460     [enable_valgrind="yes"], [enable_valgrind="no"])
6461   AC_CHECK_HEADER([valgrind/valgrind.h], [], [enable_valgrind="no"])
6462   if test "x$enable_valgrind" = "xyes" ; then
6463     AC_DEFINE(MOZ_VALGRIND)
6464   fi
6466 AC_SUBST(MOZ_MEMORY)
6467 AC_SUBST(WIN32_CRT_SRC_DIR)
6468 AC_SUBST(WIN32_CUSTOM_CRT_DIR)
6469 AC_SUBST(MOZ_LIB)
6470 AC_SUBST(MOZ_PATH)
6471 dnl Need to set this for make because NSS doesn't have configure
6472 AC_SUBST(DLLFLAGS)
6474 dnl ========================================================
6475 dnl = Use malloc wrapper lib
6476 dnl ========================================================
6477 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
6478 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
6479     _WRAP_MALLOC=1,
6480     _WRAP_MALLOC= )
6482 if test -n "$_WRAP_MALLOC"; then
6483     if test "$GNU_CC"; then
6484     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"
6485     MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) -o $@'
6486     fi
6489 dnl ========================================================
6490 dnl = Location of malloc wrapper lib
6491 dnl ========================================================
6492 MOZ_ARG_WITH_STRING(wrap-malloc,
6493 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
6494     WRAP_MALLOC_LIB=$withval)
6496 dnl ========================================================
6497 dnl = Use Electric Fence
6498 dnl ========================================================
6499 MOZ_ARG_ENABLE_BOOL(efence,
6500 [  --enable-efence         Link with Electric Fence],
6501     _ENABLE_EFENCE=1,
6502     _ENABLE_EFENCE= )
6503 if test -n "$_ENABLE_EFENCE"; then
6504     AC_CHECK_LIB(efence,malloc)
6507 dnl ========================================================
6508 dnl jprof
6509 dnl ========================================================
6510 MOZ_ARG_ENABLE_BOOL(jprof,
6511 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof)],
6512     MOZ_JPROF=1,
6513     MOZ_JPROF= )
6514 if test -n "$MOZ_JPROF"; then
6515     AC_DEFINE(MOZ_JPROF)
6518 dnl ========================================================
6519 dnl shark
6520 dnl ========================================================
6521 MOZ_ARG_ENABLE_BOOL(shark,
6522 [  --enable-shark          Enable shark remote profiling (needs CHUD framework)],
6523     MOZ_SHARK=1,
6524     MOZ_SHARK= )
6525 if test -n "$MOZ_SHARK"; then
6526     AC_DEFINE(MOZ_SHARK)
6529 dnl ========================================================
6530 dnl callgrind
6531 dnl ========================================================
6532 MOZ_ARG_ENABLE_BOOL(callgrind,
6533 [  --enable-callgrind      Enable callgrind profiling],
6534     MOZ_CALLGRIND=1,
6535     MOZ_CALLGRIND= )
6536 if test -n "$MOZ_CALLGRIND"; then
6537     AC_DEFINE(MOZ_CALLGRIND)
6540 dnl ========================================================
6541 dnl vtune
6542 dnl ========================================================
6543 MOZ_ARG_ENABLE_BOOL(vtune,
6544 [  --enable-vtune          Enable vtune profiling],
6545     MOZ_VTUNE=1,
6546     MOZ_VTUNE= )
6547 if test -n "$MOZ_VTUNE"; then
6548     AC_DEFINE(MOZ_VTUNE)
6551 dnl ========================================================
6552 dnl = Enable static checking using gcc-dehydra
6553 dnl ========================================================
6555 MOZ_ARG_WITH_STRING(static-checking,
6556 [  --with-static-checking=path/to/gcc_dehydra.so
6557                             Enable static checking of code using GCC-dehydra],
6558     DEHYDRA_PATH=$withval,
6559     DEHYDRA_PATH= )
6561 if test -n "$DEHYDRA_PATH"; then
6562     if ! test -f "$DEHYDRA_PATH"; then
6563         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
6564     fi
6565     AC_DEFINE(NS_STATIC_CHECKING)
6567 AC_SUBST(DEHYDRA_PATH)
6569 dnl ========================================================
6570 dnl = Enable stripping of libs & executables
6571 dnl ========================================================
6572 MOZ_ARG_ENABLE_BOOL(strip,
6573 [  --enable-strip          Enable stripping of libs & executables ],
6574     ENABLE_STRIP=1,
6575     ENABLE_STRIP= )
6577 dnl ========================================================
6578 dnl = Enable stripping of libs & executables when packaging
6579 dnl ========================================================
6580 MOZ_ARG_ENABLE_BOOL(install-strip,
6581 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
6582     PKG_SKIP_STRIP= ,
6583     PKG_SKIP_STRIP=1)
6585 dnl ========================================================
6586 dnl = --enable-elf-dynstr-gc
6587 dnl ========================================================
6588 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
6589 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
6590     USE_ELF_DYNSTR_GC=1,
6591     USE_ELF_DYNSTR_GC= )
6593 dnl ========================================================
6594 dnl = --enable-old-abi-compat-wrappers
6595 dnl ========================================================
6596 dnl on x86 linux, the current builds of some popular plugins (notably
6597 dnl flashplayer and real) expect a few builtin symbols from libgcc
6598 dnl which were available in some older versions of gcc.  However,
6599 dnl they're _NOT_ available in newer versions of gcc (eg 3.1), so if
6600 dnl we want those plugin to work with a gcc-3.1 built binary, we need
6601 dnl to provide these symbols.  MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS defaults
6602 dnl to true on x86 linux, and false everywhere else.
6605 MOZ_ARG_ENABLE_BOOL(old-abi-compat-wrappers,
6606 [  --enable-old-abi-compat-wrappers
6607                           Support old GCC ABI symbols to ease the pain 
6608                           of the linux compiler change],
6609     MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1,
6610     MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS= )
6611 if test "$COMPILE_ENVIRONMENT"; then
6612 if test "$MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS"; then
6613     AC_LANG_SAVE
6614     AC_LANG_CPLUSPLUS
6615     AC_CHECK_FUNCS(__builtin_vec_new __builtin_vec_delete __builtin_new __builtin_delete __pure_virtual)
6616     AC_LANG_RESTORE
6617     AC_DEFINE(MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS)
6619 fi # COMPILE_ENVIRONMENT
6621 dnl ========================================================
6622 dnl = --enable-prebinding
6623 dnl ========================================================
6624 MOZ_ARG_ENABLE_BOOL(prebinding,
6625 [  --enable-prebinding     Enable prebinding (Mac OS X only)],
6626     USE_PREBINDING=1,
6627     USE_PREBINDING= )
6629 dnl ========================================================
6630 dnl = 
6631 dnl = Profiling and Instrumenting
6632 dnl = 
6633 dnl ========================================================
6634 MOZ_ARG_HEADER(Profiling and Instrumenting)
6636 dnl ========================================================
6637 dnl = Enable timeline service, which provides lightweight
6638 dnl = instrumentation of mozilla for performance measurement.
6639 dnl = Timeline is off by default.
6640 dnl ========================================================
6641 MOZ_ARG_ENABLE_BOOL(timeline,
6642 [  --enable-timeline       Enable timeline services ],
6643     MOZ_TIMELINE=1,
6644     MOZ_TIMELINE= )
6645 if test -n "$MOZ_TIMELINE"; then
6646     AC_DEFINE(MOZ_TIMELINE)
6649 dnl ========================================================
6650 dnl Turn on reflow counting
6651 dnl ========================================================
6652 MOZ_ARG_ENABLE_BOOL(reflow-perf,
6653 [  --enable-reflow-perf    Enable reflow performance tracing],
6654     MOZ_REFLOW_PERF=1,
6655     MOZ_REFLOW_PERF= )
6656 if test -n "$MOZ_REFLOW_PREF"; then
6657     AC_DEFINE(MOZ_REFLOW_PREF)
6659 AC_SUBST(MOZ_REFLOW_PERF)
6661 dnl ========================================================
6662 dnl Enable performance metrics.
6663 dnl ========================================================
6664 MOZ_ARG_ENABLE_BOOL(perf-metrics,
6665 [  --enable-perf-metrics   Enable performance metrics],
6666     MOZ_PERF_METRICS=1,
6667     MOZ_PERF_METRICS= )
6668 if test -n "$MOZ_PERF_METRICS"; then
6669     AC_DEFINE(MOZ_PERF_METRICS)
6672 dnl ========================================================
6673 dnl Enable code size metrics.
6674 dnl ========================================================
6675 MOZ_ARG_ENABLE_BOOL(codesighs,
6676 [  --enable-codesighs      Enable code size analysis tools],
6677     _ENABLE_CODESIGHS=1,
6678     _ENABLE_CODESIGHS= )
6679 if test -n "$_ENABLE_CODESIGHS"; then
6680     if test -d $srcdir/tools/codesighs; then 
6681         MOZ_MAPINFO=1
6682     else
6683         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
6684     fi
6687 dnl ========================================================
6688 dnl = Add support for Eazel profiler
6689 dnl ========================================================
6690 MOZ_ARG_ENABLE_BOOL(eazel-profiler-support,
6691 [  --enable-eazel-profiler-support
6692                           Enable Corel/Eazel profiler support],
6693     ENABLE_EAZEL_PROFILER=1,
6694     ENABLE_EAZEL_PROFILER= )
6695 if test -n "$ENABLE_EAZEL_PROFILER"; then
6696     AC_DEFINE(ENABLE_EAZEL_PROFILER)
6697     USE_ELF_DYNSTR_GC=
6698     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6699     EAZEL_PROFILER_CFLAGS="-g -O -gdwarf-2 -finstrument-functions -D__NO_STRING_INLINES  -D__NO_MATH_INLINES"
6700     EAZEL_PROFILER_LIBS="-lprofiler -lpthread"
6703 MOZ_ARG_ENABLE_STRING(profile-modules,
6704 [  --enable-profile-modules
6705                           Enable/disable profiling for specific modules],
6706 [ MOZ_PROFILE_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
6708 MOZ_ARG_ENABLE_BOOL(insure,
6709 [  --enable-insure         Enable insure++ instrumentation (linux only)],
6710     _ENABLE_INSURE=1,
6711     _ENABLE_INSURE= )
6712 if test -n "$_ENABLE_INSURE"; then
6713     MOZ_INSURE="insure"
6714     MOZ_INSURIFYING=1
6715     MOZ_INSURE_DIRS="."
6716     MOZ_INSURE_EXCLUDE_DIRS="config"
6719 MOZ_ARG_WITH_STRING(insure-dirs,
6720 [  --with-insure-dirs=DIRS
6721                           Dirs to instrument with insure ],
6722     MOZ_INSURE_DIRS=$withval )
6724 MOZ_ARG_WITH_STRING(insure-exclude-dirs,
6725 [  --with-insure-exclude-dirs=DIRS
6726                           Dirs to not instrument with insure ],
6727     MOZ_INSURE_EXCLUDE_DIRS="config $withval" )
6729 dnl ========================================================
6730 dnl = Support for Quantify (Windows)
6731 dnl ========================================================
6732 MOZ_ARG_ENABLE_BOOL(quantify,
6733 [  --enable-quantify      Enable Quantify support (Windows only) ],
6734     MOZ_QUANTIFY=1,
6735     MOZ_QUANTIFY= )
6737 dnl ========================================================
6738 dnl = Support for demangling undefined symbols
6739 dnl ========================================================
6740 if test -z "$SKIP_LIBRARY_CHECKS"; then
6741     AC_LANG_SAVE
6742     AC_LANG_CPLUSPLUS
6743     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
6744     AC_LANG_RESTORE
6747 # Demangle only for debug or trace-malloc builds
6748 MOZ_DEMANGLE_SYMBOLS=
6749 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
6750     MOZ_DEMANGLE_SYMBOLS=1
6751     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
6753 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
6755 dnl ========================================================
6756 dnl = Support for gcc stack unwinding (from gcc 3.3)
6757 dnl ========================================================
6758 if test "$HAVE_GCC3_ABI" && test -z "$SKIP_LIBRARY_CHECKS"; then
6759     AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
6762 dnl ========================================================
6763 dnl =
6764 dnl = Misc. Options
6765 dnl = 
6766 dnl ========================================================
6767 MOZ_ARG_HEADER(Misc. Options)
6769 dnl ========================================================
6770 dnl update xterm title
6771 dnl ========================================================
6772 MOZ_ARG_ENABLE_BOOL(xterm-updates,
6773 [  --enable-xterm-updates  Update XTERM titles with current command.],
6774     MOZ_UPDATE_XTERM=1,
6775     MOZ_UPDATE_XTERM= )
6777 dnl =========================================================
6778 dnl = Chrome format
6779 dnl =========================================================
6780 MOZ_ARG_ENABLE_STRING([chrome-format],
6781 [  --enable-chrome-format=jar|flat|both|symlink
6782                           Select FORMAT of chrome files (default=jar)],
6783     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
6785 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
6786     MOZ_CHROME_FILE_FORMAT=jar
6789 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" && 
6790     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
6791     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
6792     test "$MOZ_CHROME_FILE_FORMAT" != "both"; then
6793     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, or symlink])
6796 dnl ========================================================
6797 dnl = Define default location for MOZILLA_FIVE_HOME
6798 dnl ========================================================
6799 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
6800 [  --with-default-mozilla-five-home
6801                           Set the default value for MOZILLA_FIVE_HOME],
6802 [ val=`echo $withval`
6803   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
6805 dnl ========================================================
6806 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
6807 dnl ========================================================
6808 MOZ_ARG_WITH_STRING(user-appdir,
6809 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
6810 [ val=`echo $withval`
6811 if echo "$val" | grep "\/" >/dev/null; then
6812     AC_MSG_ERROR("Homedir must be single relative path.")
6813 else 
6814     MOZ_USER_DIR="$val"
6815 fi])
6817 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
6819 dnl ========================================================
6820 dnl = Doxygen configuration
6821 dnl ========================================================
6822 dnl Use commas to specify multiple dirs to this arg
6823 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
6824 MOZ_ARG_WITH_STRING(doc-input-dirs,
6825 [  --with-doc-input-dirs=DIRS
6826                           Header/idl dirs to create docs from],
6827 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
6828 AC_SUBST(MOZ_DOC_INPUT_DIRS)
6830 dnl Use commas to specify multiple dirs to this arg
6831 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
6832 MOZ_ARG_WITH_STRING(doc-include-dirs,
6833 [  --with-doc-include-dirs=DIRS  
6834                           Include dirs to preprocess doc headers],
6835 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
6836 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
6838 MOZ_DOC_OUTPUT_DIR='./dist/docs'
6839 MOZ_ARG_WITH_STRING(doc-output-dir,
6840 [  --with-doc-output-dir=DIR
6841                           Dir to generate docs into],
6842 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
6843 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
6845 if test -z "$SKIP_COMPILER_CHECKS"; then
6846 dnl ========================================================
6847 dnl =
6848 dnl = Compiler Options
6849 dnl = 
6850 dnl ========================================================
6851 MOZ_ARG_HEADER(Compiler Options)
6853 dnl ========================================================
6854 dnl Check for gcc -pipe support
6855 dnl ========================================================
6856 AC_MSG_CHECKING([for gcc -pipe support])
6857 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
6858     echo '#include <stdio.h>' > dummy-hello.c
6859     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
6860     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
6861     cat dummy-hello.s | ${AS_BIN} -o dummy-hello.S - 2>&5
6862     if test $? = 0; then
6863         _res_as_stdin="yes"
6864     else
6865         _res_as_stdin="no"
6866     fi
6867     if test "$_res_as_stdin" = "yes"; then
6868         _SAVE_CFLAGS=$CFLAGS
6869         CFLAGS="$CFLAGS -pipe"
6870         AC_TRY_COMPILE( [ #include <stdio.h> ],
6871             [printf("Hello World\n");],
6872             [_res_gcc_pipe="yes"],
6873             [_res_gcc_pipe="no"] )
6874         CFLAGS=$_SAVE_CFLAGS
6875     fi
6876     if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
6877         _res="yes";
6878         CFLAGS="$CFLAGS -pipe"
6879         CXXFLAGS="$CXXFLAGS -pipe"
6880     else
6881         _res="no"
6882     fi
6883     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
6884     AC_MSG_RESULT([$_res])
6885 else
6886     AC_MSG_RESULT([no])
6889 dnl pass -Wno-long-long to the compiler
6890 MOZ_ARG_ENABLE_BOOL(long-long-warning,
6891 [  --enable-long-long-warning 
6892                           Warn about use of non-ANSI long long type],
6893     _IGNORE_LONG_LONG_WARNINGS=,
6894     _IGNORE_LONG_LONG_WARNINGS=1)
6896 if test "$_IGNORE_LONG_LONG_WARNINGS"; then
6897      _SAVE_CFLAGS="$CFLAGS"
6898      CFLAGS="$CFLAGS ${_COMPILER_PREFIX}-Wno-long-long"
6899      AC_MSG_CHECKING([whether compiler supports -Wno-long-long])
6900      AC_TRY_COMPILE([], [return(0);], 
6901         [ _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
6902           _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
6903           result="yes" ], result="no")
6904      AC_MSG_RESULT([$result])
6905      CFLAGS="$_SAVE_CFLAGS"
6908 dnl ========================================================
6909 dnl Profile guided optimization
6910 dnl ========================================================
6911 dnl Test for profiling options
6912 dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities
6913 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
6915 dnl Provide a switch to disable PGO even when called via profiledbuild.
6916 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
6917 [  --disable-profile-guided-optimization
6918                            Don't build with PGO even if called via make profiledbuild],
6919 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
6920 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
6922 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
6924 _SAVE_CFLAGS="$CFLAGS"
6925 CFLAGS="$CFLAGS -fprofile-generate"
6927 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
6928 AC_TRY_COMPILE([], [return 0;],
6929                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
6930                  result="yes" ], result="no")
6931 AC_MSG_RESULT([$result])
6933 if test $result = "yes"; then
6934   PROFILE_GEN_LDFLAGS="-fprofile-generate"
6935   PROFILE_USE_CFLAGS="-fprofile-use"
6936   PROFILE_USE_LDFLAGS="-fprofile-use"
6937 else
6938   CFLAGS="$_SAVE_CFLAGS -fprofile-arcs"
6939   AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs])
6940   AC_TRY_COMPILE([], [return 0;],
6941                  [ PROFILE_GEN_CFLAGS="-fprofile-arcs"
6942                    result="yes" ], result="no")
6943   AC_MSG_RESULT([$result])
6944   if test $result = "yes"; then
6945     PROFILE_USE_CFLAGS="-fbranch-probabilities"
6946   fi
6947   # don't really care, this is an old GCC
6948   PROFILE_GEN_LDFLAGS=
6949   PROFILE_USE_LDFLAGS=
6952 CFLAGS="$_SAVE_CFLAGS"
6954 if test -n "$INTEL_CC"; then
6955   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
6956   PROFILE_GEN_LDFLAGS=
6957   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
6958   PROFILE_USE_LDFLAGS=
6961 dnl Sun Studio on Solaris
6962 if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
6963   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
6964   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
6965   if test "$CPU_ARCH" != "sparc"; then
6966     PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
6967     PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
6968   else
6969     PROFILE_USE_CFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
6970     PROFILE_USE_LDFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
6971   fi
6974 AC_SUBST(PROFILE_GEN_CFLAGS)
6975 AC_SUBST(PROFILE_GEN_LDFLAGS)
6976 AC_SUBST(PROFILE_USE_CFLAGS)
6977 AC_SUBST(PROFILE_USE_LDFLAGS)
6979 AC_LANG_CPLUSPLUS
6981 dnl ========================================================
6982 dnl Test for -pedantic bustage
6983 dnl ========================================================
6984 MOZ_ARG_DISABLE_BOOL(pedantic,
6985 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
6986 _PEDANTIC= )
6987 if test "$_PEDANTIC"; then
6988     _SAVE_CXXFLAGS=$CXXFLAGS
6989     CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
6990     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
6991     AC_TRY_COMPILE([$configure_static_assert_macros],
6992                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
6993                    result="no", result="yes" )
6994     AC_MSG_RESULT([$result])
6995     CXXFLAGS="$_SAVE_CXXFLAGS"
6997     case "$result" in
6998     no)
6999         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic"
7000         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
7001         ;;
7002     yes)
7003         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
7004         ;;
7005     esac
7008 dnl ========================================================
7009 dnl Test for correct temporary object destruction order
7010 dnl ========================================================
7011 dnl We want to make sure the compiler follows the C++ spec here as 
7012 dnl xpcom and the string classes depend on it (bug 235381).
7013 AC_MSG_CHECKING([for correct temporary object destruction order])
7014 AC_TRY_RUN([ class A {
7015              public:  A(int& x) : mValue(x) {}
7016                       ~A() { mValue--; }
7017                       operator char**() { return 0; }
7018              private:  int& mValue;
7019              };
7020              void func(char **arg) {}
7021              int m=2;
7022              void test() {
7023                   func(A(m));
7024                   if (m==1) m = 0;
7025              }
7026              int main() {
7027                  test();
7028                  return(m);
7029              }
7030              ],
7031      result="yes", result="no", result="maybe")
7032 AC_MSG_RESULT([$result])
7034 if test "$result" = "no"; then
7035     AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
7038 dnl ========================================================
7039 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7040 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7041 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
7042 dnl ========================================================
7043 _SAVE_CXXFLAGS=$CXXFLAGS
7044 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7045 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7046     ac_nscap_nonconst_opeq_bug,
7047     [AC_TRY_COMPILE([
7048                       template <class T>
7049                       class Pointer
7050                         {
7051                         public:
7052                           T* myPtr;
7053                         };
7054                       
7055                       template <class T, class U>
7056                       int operator==(const Pointer<T>& rhs, U* lhs)
7057                         {
7058                           return rhs.myPtr == lhs;
7059                         }
7060                       
7061                       template <class T, class U>
7062                       int operator==(const Pointer<T>& rhs, const U* lhs)
7063                         {
7064                           return rhs.myPtr == lhs;
7065                         }
7066                     ],
7067                     [
7068                       Pointer<int> foo;
7069                       const int* bar;
7070                       return foo == bar;
7071                     ],
7072                     ac_nscap_nonconst_opeq_bug="no",
7073                     ac_nscap_nonconst_opeq_bug="yes")])
7074 CXXFLAGS="$_SAVE_CXXFLAGS"
7076 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7077     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7079 fi # SKIP_COMPILER_CHECKS
7081 dnl ========================================================
7082 dnl C++ rtti
7083 dnl Should be smarter and check that the compiler does indeed have rtti
7084 dnl ========================================================
7085 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
7086 [  --enable-cpp-rtti       Enable C++ RTTI ],
7087 [ _MOZ_USE_RTTI=1 ],
7088 [ _MOZ_USE_RTTI= ])
7090 if test "$_MOZ_USE_RTTI"; then
7091    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
7092 else
7093    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
7096 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
7098 dnl ========================================================
7099 dnl C++ exceptions (g++/egcs only - for now)
7100 dnl Should be smarter and check that the compiler does indeed have exceptions
7101 dnl ========================================================
7102 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
7103 [  --enable-cpp-exceptions Enable C++ exceptions ],
7104 [ _MOZ_CPP_EXCEPTIONS=1 ],
7105 [ _MOZ_CPP_EXCEPTIONS= ])
7107 if test "$_MOZ_CPP_EXCEPTIONS"; then
7108     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
7109 else
7110     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
7113 # Irix & OSF native compilers do not like exception declarations 
7114 # when exceptions are disabled
7115 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
7116     AC_DEFINE(CPP_THROW_NEW, [])
7117 else
7118     AC_DEFINE(CPP_THROW_NEW, [throw()])
7120 AC_LANG_C
7122 dnl ========================================================
7123 dnl =
7124 dnl = Build depencency options
7125 dnl =
7126 dnl ========================================================
7127 MOZ_ARG_HEADER(Build dependencies)
7129 dnl ========================================================
7130 dnl = Do not auto generate dependency info
7131 dnl ========================================================
7132 MOZ_AUTO_DEPS=1
7133 MOZ_ARG_DISABLE_BOOL(auto-deps,
7134 [  --disable-auto-deps     Do not automatically generate dependency info],
7135     MOZ_AUTO_DEPS=,
7136     MOZ_AUTO_DEPS=1)
7138 if test -n "$MOZ_AUTO_DEPS"; then
7139 dnl ========================================================
7140 dnl = Use mkdepend instead of $CC -MD for dependency generation
7141 dnl ========================================================
7142 _cpp_md_flag=
7143 MOZ_ARG_DISABLE_BOOL(md,
7144 [  --disable-md            Do not use compiler-based dependencies ],
7145   [_cpp_md_flag=],
7146   [_cpp_md_flag=1],
7147   [dnl Default is to turn on -MD if using GNU-compatible compilers
7148    if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
7149      _cpp_md_flag=1
7150    fi
7151   dnl Default is to use -xM if using Sun Studio on Solaris
7152    if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
7153      _cpp_md_flag=1
7154    fi])
7155 if test "$_cpp_md_flag"; then
7156   COMPILER_DEPEND=1
7157   if test "$OS_ARCH" = "OpenVMS"; then
7158     _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(*F).pp))'
7159   else
7160     _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(*F).pp)'
7161   fi
7162   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7163   if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
7164     _DEPEND_CFLAGS=
7165   fi
7166 else
7167   COMPILER_DEPEND=
7168   _USE_CPP_INCLUDE_FLAG=
7169   _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7170   _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7172 fi # MOZ_AUTO_DEPS
7173 MDDEPDIR='.deps'
7174 AC_SUBST(MOZ_AUTO_DEPS)
7175 AC_SUBST(COMPILER_DEPEND)
7176 AC_SUBST(MDDEPDIR)
7179 dnl ========================================================
7180 dnl =
7181 dnl = Static Build Options
7182 dnl =
7183 dnl ========================================================
7184 MOZ_ARG_HEADER(Static build options)
7186 MOZ_ARG_ENABLE_BOOL(static,
7187 [  --enable-static         Enable building of internal static libs],
7188     BUILD_STATIC_LIBS=1,
7189     BUILD_STATIC_LIBS=)
7191 dnl Disable libxul in debug builds, but not for xulrunner.
7192 if test -n "$MOZ_DEBUG" -a "$MOZ_BUILD_APP" != "xulrunner"; then
7193    MOZ_ENABLE_LIBXUL=
7196 MOZ_ARG_ENABLE_BOOL(libxul,
7197 [  --enable-libxul         Enable building of libxul],
7198     MOZ_ENABLE_LIBXUL=1,
7199     MOZ_ENABLE_LIBXUL=)
7201 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
7202         AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
7205 if test -n "$MOZ_ENABLE_LIBXUL" -a -z "$MOZ_XUL_APP"; then
7206         AC_MSG_ERROR([--enable-libxul is only compatible with toolkit XUL applications.])
7209 if test -n "$MOZ_ENABLE_LIBXUL"; then
7210     XPCOM_LIBS="$LIBXUL_LIBS"
7211     AC_DEFINE(MOZ_ENABLE_LIBXUL)
7212 else
7213     if test -n "$BUILD_STATIC_LIBS"; then
7214         AC_DEFINE(MOZ_STATIC_BUILD)
7215     fi
7216     XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
7219 dnl ========================================================
7220 dnl = Force JS to be a static lib
7221 dnl ========================================================
7222 MOZ_ARG_ENABLE_BOOL(js-static-build,
7223 [  --enable-js-static-build  Force js to be a static lib],
7224     JS_STATIC_BUILD=1,
7225     JS_STATIC_BUILD= )
7227 AC_SUBST(JS_STATIC_BUILD)
7228         
7229 if test -n "$JS_STATIC_BUILD"; then
7230     AC_DEFINE(EXPORT_JS_API)
7232 if test -z "$BUILD_STATIC_LIBS"; then
7233     AC_MSG_ERROR([--enable-js-static-build is only compatible with --enable-static])
7238 dnl Disable static mail in debug builds, but not with libxul sdk.
7239 if test -n "$MOZ_DEBUG" -a -z "$LIBXUL_SDK"; then
7240    MOZ_STATIC_MAIL_BUILD=
7242 MOZ_ARG_ENABLE_BOOL(static-mail,
7243 [  --enable-static-mail Enable static mail build support],
7244     MOZ_STATIC_MAIL_BUILD=1,
7245     MOZ_STATIC_MAIL_BUILD= )
7247 if test "$MOZ_STATIC_MAIL_BUILD"; then
7248     AC_DEFINE(MOZ_STATIC_MAIL_BUILD)
7251 AC_SUBST(MOZ_STATIC_MAIL_BUILD)
7253 dnl ========================================================
7254 dnl =
7255 dnl = Standalone module options
7256 dnl = 
7257 dnl ========================================================
7258 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7260 dnl Check for GLib and libIDL.
7261 dnl ========================================================
7262 case "$target_os" in
7263 msvc*|mks*|cygwin*|mingw*|wince*)
7264     SKIP_IDL_CHECK="yes"
7265     ;;
7267     SKIP_IDL_CHECK="no"
7268     ;;
7269 esac
7271 if test -z "$COMPILE_ENVIRONMENT"; then
7272     SKIP_IDL_CHECK="yes"
7275 dnl = Allow users to disable libIDL checking for standalone modules
7276 MOZ_ARG_WITHOUT_BOOL(libIDL,
7277 [  --without-libIDL        Skip check for libIDL (standalone modules only)],
7278         SKIP_IDL_CHECK="yes")
7280 if test "$SKIP_IDL_CHECK" = "no"
7281 then
7282     _LIBIDL_FOUND=
7283     if test "$MACOS_SDK_DIR"; then 
7284       dnl xpidl, and therefore libIDL, is only needed on the build host.
7285       dnl Don't build it against the SDK, as that causes problems.
7286       _MACSAVE_CFLAGS="$CFLAGS"
7287       _MACSAVE_LIBS="$LIBS"
7288       _MACSAVE_LDFLAGS="$LDFLAGS"
7289       _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
7290       changequote(,)
7291       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"`
7292       LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
7293       LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
7294       changequote([,])
7295       unset NEXT_ROOT
7296     fi
7298     if test "$MOZ_ENABLE_GTK2"; then
7299         PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
7300     fi
7301     dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
7302     dnl to either libIDL1 or libIDL2.
7303     if test -z "$_LIBIDL_FOUND"; then
7304         AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
7305         if test -z "$_LIBIDL_FOUND"; then
7306             PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
7307         fi
7308     fi
7309     dnl
7310     dnl If we don't have a libIDL config program & not cross-compiling, 
7311     dnl     look for orbit-config instead.
7312     dnl
7313     if test -z "$_LIBIDL_FOUND" && test -z "$CROSS_COMPILE"; then
7314         AC_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
7315         if test -n "$ORBIT_CONFIG"; then
7316             AC_MSG_CHECKING([for ORBit libIDL usability])
7317                 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
7318             _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
7319             _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
7320             _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
7321             LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
7322             LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
7323             LIBIDL_CONFIG=
7324             _SAVE_CFLAGS="$CFLAGS"
7325             _SAVE_LIBS="$LIBS"
7326             CFLAGS="$LIBIDL_CFLAGS $CFLAGS"
7327             LIBS="$LIBIDL_LIBS $LIBS"
7328             AC_TRY_RUN([
7329 #include <stdlib.h>
7330 #include <libIDL/IDL.h>
7331 int main() {
7332   char *s;
7333   s=strdup(IDL_get_libver_string());
7334   if(s==NULL) {
7335     exit(1);
7336   }
7337   exit(0);
7339             ], [_LIBIDL_FOUND=1
7340                 result="yes"],
7341                [LIBIDL_CFLAGS=
7342                 LIBIDL_LIBS=
7343                 result="no"],
7344                [_LIBIDL_FOUND=1
7345                 result="maybe"] )
7346             AC_MSG_RESULT($result)
7347             CFLAGS="$_SAVE_CFLAGS"
7348             LIBS="$_SAVE_LIBS"
7349         fi
7350     fi
7351     if test -z "$_LIBIDL_FOUND"; then
7352         AC_MSG_ERROR([libIDL not found.
7353         libIDL $LIBIDL_VERSION or higher is required.])
7354     fi
7355     if test "$MACOS_SDK_DIR"; then
7356       CFLAGS="$_MACSAVE_CFLAGS"
7357       LIBS="$_MACSAVE_LIBS"
7358       LDFLAGS="$_MACSAVE_LDFLAGS"
7359       if test -n "$_MACSAVE_NEXT_ROOT" ; then
7360         export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
7361       fi
7362     fi
7365 if test -n "$CROSS_COMPILE"; then
7366      if test -z "$HOST_LIBIDL_CONFIG"; then
7367         HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
7368     fi
7369     if test -n "$HOST_LIBIDL_CONFIG" && test "$HOST_LIBIDL_CONFIG" != "no"; then
7370         HOST_LIBIDL_CFLAGS=`${HOST_LIBIDL_CONFIG} --cflags`
7371         HOST_LIBIDL_LIBS=`${HOST_LIBIDL_CONFIG} --libs`
7372     else
7373         HOST_LIBIDL_CFLAGS="$LIBIDL_CFLAGS"
7374         HOST_LIBIDL_LIBS="$LIBIDL_LIBS"
7375     fi
7378 if test -z "$SKIP_PATH_CHECKS"; then
7379 if test -z "${GLIB_CFLAGS}" || test -z "${GLIB_LIBS}" ; then
7380     if test "$MOZ_ENABLE_GTK2"; then
7381         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7382     else
7383         AM_PATH_GLIB(${GLIB_VERSION})
7384     fi
7388 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
7389     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7392 AC_SUBST(LIBIDL_CFLAGS)
7393 AC_SUBST(LIBIDL_LIBS)
7394 AC_SUBST(STATIC_LIBIDL)
7395 AC_SUBST(GLIB_CFLAGS)
7396 AC_SUBST(GLIB_LIBS)
7397 AC_SUBST(GLIB_GMODULE_LIBS)
7398 AC_SUBST(HOST_LIBIDL_CONFIG)
7399 AC_SUBST(HOST_LIBIDL_CFLAGS)
7400 AC_SUBST(HOST_LIBIDL_LIBS)
7402 dnl ========================================================
7403 dnl Check for libart
7404 dnl ========================================================
7405 if test "$MOZ_SVG_RENDERER_LIBART"; then
7406   if test ! -f $topsrcdir/other-licenses/libart_lgpl/Makefile.in; then
7407     AC_MSG_ERROR([You must check out the mozilla version of libart. Use
7408 mk_add_options MOZ_CO_MODULE=mozilla/other-licenses/libart_lgpl])
7409   fi
7411   dnl libart's configure hasn't been run yet, but we know what the
7412   dnl answer should be anyway
7413   MOZ_LIBART_CFLAGS='-I${DIST}/include/libart_lgpl'
7414   case "$target_os" in
7415   msvc*|mks*|cygwin*|mingw*|wince*)
7416       MOZ_LIBART_LIBS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)moz_art_lgpl.$(IMPORT_LIB_SUFFIX)' 
7417       ;;
7418   os2*)
7419       MOZ_LIBART_LIBS='-lmoz_art -lm'
7420       ;;
7421   beos*)
7422       MOZ_LIBART_LIBS='-lmoz_art_lgpl -lroot -lbe'
7423       ;;
7424   *)
7425       MOZ_LIBART_LIBS='-lmoz_art_lgpl -lm'
7426       ;;
7427   esac
7428   AC_FUNC_ALLOCA
7431 AC_SUBST(MOZ_LIBART_CFLAGS)
7432 AC_SUBST(MOZ_LIBART_LIBS)
7434 dnl ========================================================
7435 dnl Check for cairo
7436 dnl ========================================================
7437 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7439 MOZ_TREE_CAIRO=1
7440 MOZ_ARG_ENABLE_BOOL(system-cairo,
7441 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
7442 MOZ_TREE_CAIRO=,
7443 MOZ_TREE_CAIRO=1 )
7445 # Check for headers defining standard int types.
7446 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7448 if test "$MOZ_TREE_CAIRO"; then
7449     AC_DEFINE(MOZ_TREE_CAIRO)
7451     # For now we assume that we will have a uint64_t available through
7452     # one of the above headers or mozstdint.h.
7453     AC_DEFINE(HAVE_UINT64_T)
7455     # Define macros for cairo-features.h
7456     if test "$MOZ_X11"; then
7457         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7458         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7459         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7460         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7461         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7462         MOZ_ENABLE_CAIRO_FT=1
7463         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7464     fi
7465     if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
7466         QPAINTER_SURFACE_FEATURE="#define CAIRO_HAS_QPAINTER_SURFACE 1"
7467     fi
7468     if test "$MOZ_WIDGET_TOOLKIT" = "mac" -o "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
7469         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7470         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7471         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7472     fi
7473     if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
7474         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7475         WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7476         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7477     fi
7478     if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
7479         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
7480         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7481         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7482         MOZ_ENABLE_CAIRO_FT=1
7483         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
7484         CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
7485     fi
7486     if test "$MOZ_ENABLE_GLITZ"; then
7487         GLITZ_SURFACE_FEATURE="#define CAIRO_HAS_GLITZ_SURFACE 1"
7488     fi
7489     if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
7490         PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
7491         BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
7492         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7493         MOZ_ENABLE_CAIRO_FT=1
7494     fi
7495     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
7496     AC_SUBST(CAIRO_FT_CFLAGS)
7498     if test "$MOZ_DEBUG"; then
7499       SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
7500     else
7501       SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
7502     fi
7504     PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
7506     AC_SUBST(PS_SURFACE_FEATURE)
7507     AC_SUBST(PDF_SURFACE_FEATURE)
7508     AC_SUBST(SVG_SURFACE_FEATURE)
7509     AC_SUBST(XLIB_SURFACE_FEATURE)
7510     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
7511     AC_SUBST(QUARTZ_SURFACE_FEATURE)
7512     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
7513     AC_SUBST(XCB_SURFACE_FEATURE)
7514     AC_SUBST(WIN32_SURFACE_FEATURE)
7515     AC_SUBST(OS2_SURFACE_FEATURE)
7516     AC_SUBST(BEOS_SURFACE_FEATURE)
7517     AC_SUBST(GLITZ_SURFACE_FEATURE)
7518     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
7519     AC_SUBST(FT_FONT_FEATURE)
7520     AC_SUBST(WIN32_FONT_FEATURE)
7521     AC_SUBST(QUARTZ_FONT_FEATURE)
7522     AC_SUBST(PNG_FUNCTIONS_FEATURE)
7523     AC_SUBST(QPAINTER_SURFACE_FEATURE)
7525     if test "$_WIN32_MSVC"; then
7526         MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib'
7527         if test "$MOZ_ENABLE_GLITZ"; then
7528             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'$(DEPTH)/gfx/cairo/glitz/src/mozglitz.lib $(DEPTH)/gfx/cairo/glitz/src/wgl/mozglitzwgl.lib'
7529         fi
7530     else
7531         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"
7533         if test "$MOZ_X11"; then
7534             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
7535         fi
7537         if test "$MOZ_ENABLE_GLITZ"; then
7538             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'-L$(DEPTH)/gfx/cairo/glitz/src -lmozglitz'
7539             if test "$MOZ_X11"; then
7540                 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'-L$(DEPTH)/gfx/cairo/glitz/src/glx -lmozglitzglx -lGL'
7541             fi
7542             if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
7543                 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'-L$(DEPTH)/gfx/cairo/glitz/src/wgl -lmozglitzwgl'
7544             fi
7545         fi
7546     fi
7548     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
7549     mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
7551 else
7552    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION freetype2 fontconfig)
7553    MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
7554    MOZ_CAIRO_LIBS=$CAIRO_LIBS
7555    if test "$MOZ_X11"; then
7556         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
7557         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
7558         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
7559    fi
7562 AC_SUBST(MOZ_TREE_CAIRO)
7563 AC_SUBST(MOZ_CAIRO_CFLAGS)
7564 AC_SUBST(MOZ_CAIRO_LIBS)
7566 dnl ========================================================
7567 dnl Check for lcms
7568 dnl ========================================================
7570 MOZ_NATIVE_LCMS=
7571 MOZ_ARG_ENABLE_BOOL(system-lcms,
7572 [ --enable-system-lcms Use system lcms (located with pkgconfig)],
7573 MOZ_NATIVE_LCMS=1,
7574 MOZ_NATIVE_LCMS= )
7576 if test -z "$MOZ_NATIVE_LCMS"
7577 then
7578     LCMS_CFLAGS=
7579     if test "$_WIN32_MSVC"; then
7580         if test -z "$BUILD_STATIC_LIBS" -a -z "$MOZ_ENABLE_LIBXUL"; then
7581             LCMS_CFLAGS=-DLCMS_DLL
7582         fi
7583         LCMS_LIBS='$(LIBXUL_DIST)/lib/mozlcms.lib'
7584     else
7585         LCMS_LIBS='-L$(LIBXUL_DIST)/bin -lmozlcms'
7586     fi
7587 else
7588     PKG_CHECK_MODULES(LCMS, lcms >= $LCMS_VERSION)
7591 AC_SUBST(MOZ_NATIVE_LCMS)
7592 AC_SUBST(LCMS_CFLAGS)
7593 AC_SUBST(LCMS_LIBS)
7595 dnl ========================================================
7596 dnl disable xul
7597 dnl ========================================================
7598 MOZ_ARG_DISABLE_BOOL(xul,
7599 [  --disable-xul           Disable XUL],
7600     MOZ_XUL= )
7601 if test "$MOZ_XUL"; then
7602   AC_DEFINE(MOZ_XUL)
7603 else
7604   dnl remove extensions that require XUL
7605   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
7608 AC_SUBST(MOZ_XUL)
7610 dnl ========================================================
7611 dnl Two ways to enable Python support:
7612 dnl   --enable-extensions=python # select all available.
7613 dnl    (MOZ_PYTHON_EXTENSIONS contains the list of extensions)
7614 dnl or:
7615 dnl   --enable-extensions=python/xpcom,... # select individual ones
7617 dnl If either is used, we locate the Python to use.
7618 dnl ========================================================
7620 dnl If 'python' appears anywhere in the extensions list, go lookin'...
7621 if test `echo "$MOZ_EXTENSIONS" | grep -c python` -ne 0; then
7622     dnl Allow PYTHON to point to the Python interpreter to use
7623     dnl (note that it must be the python executable - which we
7624     dnl run to locate the relevant paths etc)
7625     dnl If not set, we use whatever Python we can find.
7626     MOZ_PYTHON=$PYTHON
7627     dnl Ask Python what its version number is
7628     changequote(,)
7629     MOZ_PYTHON_VER=`$PYTHON -c "import sys;print '%d%d' % sys.version_info[0:2]"`
7630     MOZ_PYTHON_VER_DOTTED=`$PYTHON -c "import sys;print '%d.%d' % sys.version_info[0:2]"`
7631     changequote([,])
7632     dnl Ask for the Python "prefix" (ie, home/source dir)
7633     MOZ_PYTHON_PREFIX=`$PYTHON -c "import sys; print sys.prefix"`
7634     dnl Setup the include and library directories.
7635     if test "$OS_ARCH" = "WINNT"; then
7636         MOZ_PYTHON_PREFIX=`$CYGPATH_W $MOZ_PYTHON_PREFIX | $CYGPATH_S`
7637         dnl Source trees have "include" and "PC" for .h, and "PCbuild" for .lib
7638         dnl Binary trees have "include" for .h, and "libs" for .lib
7639         dnl We add 'em both - along with quotes, to handle spaces.
7640         MOZ_PYTHON_DLL_SUFFIX=.pyd
7641         MOZ_PYTHON_INCLUDES="\"-I$MOZ_PYTHON_PREFIX/include\" \"-I$MOZ_PYTHON_PREFIX/PC\""
7642         MOZ_PYTHON_LIBS="\"/libpath:$MOZ_PYTHON_PREFIX/PCBuild\" \"/libpath:$MOZ_PYTHON_PREFIX/libs\""
7643     else
7644         dnl Non-Windows include and libs
7645         MOZ_PYTHON_DLL_SUFFIX=$DLL_SUFFIX
7646         MOZ_PYTHON_INCLUDES="-I$MOZ_PYTHON_PREFIX/include/python$MOZ_PYTHON_VER_DOTTED"
7647         dnl Check for dynamic Python lib
7648         dnl - A static Python is no good - multiple dynamic libraries (xpcom
7649         dnl - core, xpcom loader, pydom etc) all need to share Python.
7650         dnl - Python 2.3's std --enable-shared configure option will
7651         dnl   create a libpython2.3.so.1.0. We should first try this
7652         dnl   dotted versioned .so file because this is the one that
7653         dnl   the PyXPCOM build mechanics tries to link to.
7654         dnl   XXX Should find a better way than hardcoding "1.0".
7655         dnl - Python developement tree dir layouts are NOT allowed here
7656         dnl   because the PyXPCOM build just dies on it later anyway.
7657         dnl - Fixes to the above by Python/*nix knowledgable people welcome!
7658         if test -f "$MOZ_PYTHON_PREFIX/lib/libpython$MOZ_PYTHON_VER_DOTTED.so.1.0"; then
7659             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib -lpython$MOZ_PYTHON_VER_DOTTED"
7660         elif test -f "$MOZ_PYTHON_PREFIX/lib64/libpython$MOZ_PYTHON_VER_DOTTED.so.1.0"; then
7661             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib64 -lpython$MOZ_PYTHON_VER_DOTTED"
7662         elif test -f "$MOZ_PYTHON_PREFIX/lib/libpython$MOZ_PYTHON_VER_DOTTED.so"; then
7663             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib -lpython$MOZ_PYTHON_VER_DOTTED"
7664         elif test -f "$MOZ_PYTHON_PREFIX/libpython$MOZ_PYTHON_VER_DOTTED.so"; then
7665             dnl Don't Python development tree directory layout.
7666             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX -lpython$MOZ_PYTHON_VER_DOTTED"
7667             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.])
7668         elif test "$OS_ARCH" = "Darwin"; then
7669             dnl We do Darwin last, so if a custom non-framework build of
7670             dnl python is used on OSX, then it will be picked up first by
7671             dnl the logic above.
7672             MOZ_PYTHON_LIBS="-framework Python"
7673         else
7674             AC_MSG_ERROR([Could not find build shared libraries for Python at $MOZ_PYTHON_PREFIX.  This is required for PyXPCOM.])
7675         fi
7676         if test "$OS_ARCH" = "Linux"; then
7677             MOZ_PYTHON_LIBS="$MOZ_PYTHON_LIBS -lutil"
7678         fi
7679     fi
7680     dnl Handle "_d" on Windows
7681     if test "$OS_ARCH" = "WINNT" && test -n "$MOZ_DEBUG"; then
7682         MOZ_PYTHON_DEBUG_SUFFIX="_d"
7683     else
7684         MOZ_PYTHON_DEBUG_SUFFIX=
7685     fi
7686     AC_MSG_RESULT(Building Python extensions using python-$MOZ_PYTHON_VER_DOTTED from $MOZ_PYTHON_PREFIX)
7689 dnl If the user asks for the 'python' extension, then we add
7690 dnl MOZ_PYTHON_EXTENSIONS to MOZ_EXTENSIONS - but with the leading 'python/'
7691 dnl Note the careful regex - it must match 'python' followed by anything
7692 dnl other than a '/', including the end-of-string.
7693 if test `echo "$MOZ_EXTENSIONS" | grep -c 'python\([[^/]]\|$\)'` -ne 0; then
7694     for pyext in $MOZ_PYTHON_EXTENSIONS; do
7695         MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS python/$pyext`
7696     done
7698 dnl Later we may allow MOZ_PYTHON_EXTENSIONS to be specified on the
7699 dnl command-line, but not yet
7700 AC_SUBST(MOZ_PYTHON_EXTENSIONS)
7701 AC_SUBST(MOZ_PYTHON)
7702 AC_SUBST(MOZ_PYTHON_PREFIX)
7703 AC_SUBST(MOZ_PYTHON_INCLUDES)
7704 AC_SUBST(MOZ_PYTHON_LIBS)
7705 AC_SUBST(MOZ_PYTHON_VER)
7706 AC_SUBST(MOZ_PYTHON_VER_DOTTED)
7707 AC_SUBST(MOZ_PYTHON_DEBUG_SUFFIX)
7708 AC_SUBST(MOZ_PYTHON_DLL_SUFFIX)
7710 dnl ========================================================
7711 dnl disable profile sharing
7712 dnl ========================================================
7713 MOZ_ARG_DISABLE_BOOL(profilesharing,
7714 [  --disable-profilesharing           Disable profile sharing],
7715     MOZ_PROFILESHARING=,
7716     MOZ_PROFILESHARING=1 )
7717 if test "$MOZ_PROFILESHARING"; then
7718   MOZ_IPCD=1
7719   AC_DEFINE(MOZ_PROFILESHARING)
7722 dnl ========================================================
7723 dnl enable ipc/ipcd
7724 dnl ========================================================
7725 MOZ_ARG_ENABLE_BOOL(ipcd,
7726 [  --enable-ipcd                      Enable IPC daemon],
7727     MOZ_IPCD=1,
7728     MOZ_IPCD= )
7730 dnl ========================================================
7731 dnl disable profile locking
7732 dnl   do no use this in applications that can have more than
7733 dnl   one process accessing the profile directory.
7734 dnl ========================================================
7735 MOZ_ARG_DISABLE_BOOL(profilelocking,
7736 [  --disable-profilelocking           Disable profile locking],
7737     MOZ_PROFILELOCKING=,
7738     MOZ_PROFILELOCKING=1 )
7739 if test "$MOZ_PROFILELOCKING"; then
7740   AC_DEFINE(MOZ_PROFILELOCKING)
7743 dnl ========================================================
7744 dnl disable rdf services
7745 dnl ========================================================
7746 MOZ_ARG_DISABLE_BOOL(rdf,
7747 [  --disable-rdf           Disable RDF],
7748     MOZ_RDF= )
7749 if test "$MOZ_RDF"; then
7750   AC_DEFINE(MOZ_RDF)
7753 AC_SUBST(MOZ_RDF)
7755 dnl ========================================================
7756 dnl necko configuration options
7757 dnl ========================================================
7760 dnl option to disable various necko protocols
7762 MOZ_ARG_ENABLE_STRING(necko-protocols,
7763 [  --enable-necko-protocols[={http,ftp,default,all,none}]
7764                           Enable/disable specific protocol handlers],
7765 [ for option in `echo $enableval | sed 's/,/ /g'`; do
7766     if test "$option" = "yes" || test "$option" = "all"; then
7767         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7768     elif test "$option" = "no" || test "$option" = "none"; then
7769         NECKO_PROTOCOLS=""
7770     elif test "$option" = "default"; then
7771         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7772     elif test `echo "$option" | grep -c \^-` != 0; then
7773         option=`echo $option | sed 's/^-//'`
7774         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
7775     else
7776         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
7777     fi
7778 done],
7779     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
7780 dnl Remove dupes
7781 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
7782 AC_SUBST(NECKO_PROTOCOLS)
7783 for p in $NECKO_PROTOCOLS; do
7784     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
7785 done
7788 dnl option to disable necko's disk cache
7790 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
7791 [  --disable-necko-disk-cache
7792                           Disable necko disk cache],
7793     NECKO_DISK_CACHE=,
7794     NECKO_DISK_CACHE=1)
7795 AC_SUBST(NECKO_DISK_CACHE)
7796 if test "$NECKO_DISK_CACHE"; then
7797     AC_DEFINE(NECKO_DISK_CACHE)
7801 dnl option to minimize size of necko's i/o buffers
7803 MOZ_ARG_ENABLE_BOOL(necko-small-buffers,
7804 [  --enable-necko-small-buffers
7805                           Minimize size of necko's i/o buffers],
7806     NECKO_SMALL_BUFFERS=1,
7807     NECKO_SMALL_BUFFERS=)
7808 AC_SUBST(NECKO_SMALL_BUFFERS)
7809 if test "$NECKO_SMALL_BUFFERS"; then
7810     AC_DEFINE(NECKO_SMALL_BUFFERS)
7811 fi 
7814 dnl option to disable cookies
7816 MOZ_ARG_DISABLE_BOOL(cookies,
7817 [  --disable-cookies       Disable cookie support],
7818     NECKO_COOKIES=,
7819     NECKO_COOKIES=1)
7820 AC_SUBST(NECKO_COOKIES)
7821 if test "$NECKO_COOKIES"; then
7822     AC_DEFINE(NECKO_COOKIES)
7825 dnl NECKO_ configuration options are not global
7826 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
7828 dnl ========================================================
7829 dnl string api compatibility
7830 dnl ========================================================
7831 MOZ_ARG_DISABLE_BOOL(v1-string-abi,
7832 [  --disable-v1-string-abi   Disable binary compatibility layer for strings],
7833     MOZ_V1_STRING_ABI=,
7834     MOZ_V1_STRING_ABI=1)
7835 AC_SUBST(MOZ_V1_STRING_ABI)
7836 if test "$MOZ_V1_STRING_ABI"; then
7837     AC_DEFINE(MOZ_V1_STRING_ABI)
7840 dnl Only build Mork if it's required
7841 AC_SUBST(MOZ_MORK)
7842 if test "$MOZ_MORK"; then
7843   AC_DEFINE(MOZ_MORK)
7846 dnl Build the lightweight Mork reader if required
7847 AC_SUBST(MOZ_MORKREADER)
7848 if test "$MOZ_MORKREADER"; then
7849   AC_DEFINE(MOZ_MORKREADER)
7852 dnl ========================================================
7853 if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"; then
7854     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7857 if test "$MOZ_LDAP_XPCOM"; then
7858     LDAP_CFLAGS='-I${DIST}/public/ldap'
7859     if test "$OS_ARCH" = "WINNT"; then
7860         if test -n "$GNU_CC"; then
7861             LDAP_LIBS='-L$(DIST)/lib -lnsldap32v60 -lnsldappr32v60 -lnsldif32v60'
7862         else
7863             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}'
7864         fi
7865     elif test "$OS_ARCH" = "OS2"; then
7866             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}'
7867     else
7868         LDAP_LIBS='-L${DIST}/bin -L${DIST}/lib -lldap60 -lprldap60 -lldif60'
7869     fi
7872 if test "$COMPILE_ENVIRONMENT"; then
7873 if test "$SUNCTL"; then
7874     dnl older versions of glib do not seem to have gmodule which ctl needs
7875     _SAVE_CFLAGS=$CFLAGS
7876     CFLAGS="$CFLAGS $GLIB_CFLAGS"
7877     AC_LANG_SAVE
7878     AC_LANG_C
7879     AC_TRY_COMPILE([#include <gmodule.h>],
7880         [ int x = 1; x++; ],,
7881         [AC_MSG_ERROR([Cannot build ctl without gmodule support in glib.])])
7882     AC_LANG_RESTORE
7883     CFLAGS=$_SAVE_CFLAGS
7884     AC_DEFINE(SUNCTL)
7886 fi # COMPILE_ENVIRONMENT
7888 dnl ========================================================
7889 dnl =
7890 dnl = Maintainer debug option (no --enable equivalent)
7891 dnl =
7892 dnl ========================================================
7894 AC_SUBST(AR)
7895 AC_SUBST(AR_FLAGS)
7896 AC_SUBST(AR_LIST)
7897 AC_SUBST(AR_EXTRACT)
7898 AC_SUBST(AR_DELETE)
7899 AC_SUBST(AS)
7900 AC_SUBST(ASFLAGS)
7901 AC_SUBST(AS_DASH_C_FLAG)
7902 AC_SUBST(LD)
7903 AC_SUBST(RC)
7904 AC_SUBST(RCFLAGS)
7905 AC_SUBST(WINDRES)
7906 AC_SUBST(USE_SHORT_LIBNAME)
7907 AC_SUBST(IMPLIB)
7908 AC_SUBST(FILTER)
7909 AC_SUBST(BIN_FLAGS)
7910 AC_SUBST(NS_USE_NATIVE)
7911 AC_SUBST(MOZ_WIDGET_TOOLKIT)
7912 AC_SUBST(MOZ_GFX_TOOLKIT)
7913 AC_SUBST(MOZ_UPDATE_XTERM)
7914 AC_SUBST(MINIMO)
7915 AC_SUBST(NS_HILDON)
7916 AC_SUBST(NS_OSSO)
7917 AC_SUBST(MOZ_AUTH_EXTENSION)
7918 AC_SUBST(MOZ_MATHML)
7919 AC_SUBST(MOZ_PERMISSIONS)
7920 AC_SUBST(MOZ_XTF)
7921 AC_SUBST(MOZ_NO_INSPECTOR_APIS)
7922 AC_SUBST(MOZ_PREF_EXTENSIONS)
7923 AC_SUBST(MOZ_SVG)
7924 AC_SUBST(MOZ_SVG_FOREIGNOBJECT)
7925 AC_SUBST(MOZ_XSLT_STANDALONE)
7926 AC_SUBST(MOZ_JS_LIBS)
7927 AC_SUBST(MOZ_PSM)
7928 AC_SUBST(MOZ_DEBUG)
7929 AC_SUBST(MOZ_DEBUG_MODULES)
7930 AC_SUBST(MOZ_PROFILE_MODULES)
7931 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
7932 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
7933 AC_SUBST(MOZ_DEBUG_FLAGS)
7934 AC_SUBST(MOZ_DEBUG_LDFLAGS)
7935 AC_SUBST(WARNINGS_AS_ERRORS)
7936 AC_SUBST(MOZ_DBGRINFO_MODULES)
7937 AC_SUBST(MOZ_EXTENSIONS)
7938 AC_SUBST(MOZ_IMG_DECODERS)
7939 AC_SUBST(MOZ_IMG_ENCODERS)
7940 AC_SUBST(MOZ_JSDEBUGGER)
7941 AC_SUBST(MOZ_OJI)
7942 AC_SUBST(MOZ_NO_XPCOM_OBSOLETE)
7943 AC_SUBST(MOZ_PLUGINS)
7944 AC_SUBST(ENABLE_EAZEL_PROFILER)
7945 AC_SUBST(EAZEL_PROFILER_CFLAGS)
7946 AC_SUBST(EAZEL_PROFILER_LIBS)
7947 AC_SUBST(MOZ_PERF_METRICS)
7948 AC_SUBST(GC_LEAK_DETECTOR)
7949 AC_SUBST(MOZ_LOG_REFCNT)
7950 AC_SUBST(MOZ_LEAKY)
7951 AC_SUBST(MOZ_JPROF)
7952 AC_SUBST(MOZ_SHARK)
7953 AC_SUBST(MOZ_CALLGRIND)
7954 AC_SUBST(MOZ_VTUNE)
7955 AC_SUBST(MOZ_XPCTOOLS)
7956 AC_SUBST(MOZ_JSLOADER)
7957 AC_SUBST(MOZ_USE_NATIVE_UCONV)
7958 AC_SUBST(MOZ_INSURE)
7959 AC_SUBST(MOZ_INSURE_DIRS)
7960 AC_SUBST(MOZ_INSURE_EXCLUDE_DIRS)
7961 AC_SUBST(MOZ_QUANTIFY)
7962 AC_SUBST(MOZ_INSURIFYING)
7963 AC_SUBST(MOZ_LDAP_XPCOM)
7964 AC_SUBST(MOZ_LDAP_XPCOM_EXPERIMENTAL)
7965 AC_SUBST(LDAP_CFLAGS)
7966 AC_SUBST(LDAP_LIBS)
7967 AC_SUBST(LIBICONV)
7968 AC_SUBST(MOZ_PLACES)
7969 AC_SUBST(MOZ_PLACES_BOOKMARKS)
7970 AC_SUBST(MOZ_STORAGE)
7971 AC_SUBST(MOZ_FEEDS)
7972 AC_SUBST(NS_PRINTING)
7974 AC_SUBST(MOZ_JAVAXPCOM)
7975 AC_SUBST(JAVA_INCLUDE_PATH)
7976 AC_SUBST(JAVA)
7977 AC_SUBST(JAVAC)
7978 AC_SUBST(JAR)
7980 AC_SUBST(MOZ_PROFILESHARING)
7981 AC_SUBST(MOZ_PROFILELOCKING)
7983 AC_SUBST(MOZ_IPCD)
7985 AC_SUBST(HAVE_XIE)
7986 AC_SUBST(MOZ_XIE_LIBS)
7987 AC_SUBST(MOZ_ENABLE_POSTSCRIPT)
7989 AC_SUBST(XPCOM_USE_LEA)
7990 AC_SUBST(BUILD_STATIC_LIBS)
7991 AC_SUBST(MOZ_ENABLE_LIBXUL)
7992 AC_SUBST(ENABLE_TESTS)
7993 AC_SUBST(IBMBIDI)
7994 AC_SUBST(SUNCTL)
7995 AC_SUBST(MOZ_UNIVERSALCHARDET)
7996 AC_SUBST(ACCESSIBILITY)
7997 AC_SUBST(MOZ_XPINSTALL)
7998 AC_SUBST(MOZ_VIEW_SOURCE)
7999 AC_SUBST(MOZ_SPELLCHECK)
8000 AC_SUBST(MOZ_XPFE_COMPONENTS)
8001 AC_SUBST(MOZ_USER_DIR)
8002 AC_SUBST(MOZ_CRASHREPORTER)
8003 AC_SUBST(MOZ_MOCHITEST)
8005 AC_SUBST(ENABLE_STRIP)
8006 AC_SUBST(PKG_SKIP_STRIP)
8007 AC_SUBST(USE_ELF_DYNSTR_GC)
8008 AC_SUBST(USE_PREBINDING)
8009 AC_SUBST(INCREMENTAL_LINKER)
8010 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8011 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8012 AC_SUBST(MOZ_XPCOM_OBSOLETE_LIBS)
8014 AC_SUBST(MOZ_FIX_LINK_PATHS)
8015 AC_SUBST(XPCOM_LIBS)
8016 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8017 AC_SUBST(XPCOM_GLUE_LDOPTS)
8018 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8020 AC_SUBST(USE_DEPENDENT_LIBS)
8022 AC_SUBST(MOZ_BUILD_ROOT)
8023 AC_SUBST(MOZ_OS2_TOOLS)
8024 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
8026 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8027 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8028 AC_SUBST(MOZ_TIMELINE)
8029 AC_SUBST(WINCE)
8030 AC_SUBST(TARGET_DEVICE)
8032 AC_SUBST(MOZ_APP_NAME)
8033 AC_SUBST(MOZ_APP_DISPLAYNAME)
8034 AC_SUBST(MOZ_APP_VERSION)
8035 AC_SUBST(FIREFOX_VERSION)
8036 AC_SUBST(THUNDERBIRD_VERSION)
8037 AC_SUBST(SUNBIRD_VERSION)
8038 AC_SUBST(SEAMONKEY_VERSION)
8040 AC_SUBST(MOZ_PKG_SPECIAL)
8042 AC_SUBST(MOZILLA_OFFICIAL)
8043 AC_SUBST(BUILD_OFFICIAL)
8044 AC_SUBST(MOZ_MILESTONE_RELEASE)
8046 dnl win32 options
8047 AC_SUBST(MOZ_PROFILE)
8048 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8049 AC_SUBST(MOZ_MAPINFO)
8050 AC_SUBST(MOZ_BROWSE_INFO)
8051 AC_SUBST(MOZ_TOOLS_DIR)
8052 AC_SUBST(CYGWIN_WRAPPER)
8053 AC_SUBST(AS_PERL)
8054 AC_SUBST(WIN32_REDIST_DIR)
8055 AC_SUBST(PYTHON)
8057 dnl Echo the CFLAGS to remove extra whitespace.
8058 CFLAGS=`echo \
8059         $_WARNINGS_CFLAGS \
8060         $CFLAGS`
8062 CXXFLAGS=`echo \
8063         $_MOZ_RTTI_FLAGS \
8064         $_MOZ_EXCEPTIONS_FLAGS \
8065         $_WARNINGS_CXXFLAGS \
8066         $CXXFLAGS`
8068 COMPILE_CFLAGS=`echo \
8069     $_DEFINES_CFLAGS \
8070         $_DEPEND_CFLAGS \
8071     $COMPILE_CFLAGS`
8073 COMPILE_CXXFLAGS=`echo \
8074     $_DEFINES_CXXFLAGS \
8075         $_DEPEND_CFLAGS \
8076     $COMPILE_CXXFLAGS`
8078 AC_SUBST(SYSTEM_MAKEDEPEND)
8079 AC_SUBST(SYSTEM_JPEG)
8080 AC_SUBST(SYSTEM_PNG)
8081 AC_SUBST(SYSTEM_ZLIB)
8082 AC_SUBST(SYSTEM_BZ2)
8084 AC_SUBST(JPEG_CFLAGS)
8085 AC_SUBST(JPEG_LIBS)
8086 AC_SUBST(ZLIB_CFLAGS)
8087 AC_SUBST(ZLIB_LIBS)
8088 AC_SUBST(BZ2_CFLAGS)
8089 AC_SUBST(BZ2_LIBS)
8090 AC_SUBST(PNG_CFLAGS)
8091 AC_SUBST(PNG_LIBS)
8093 AC_SUBST(MOZ_JPEG_CFLAGS)
8094 AC_SUBST(MOZ_JPEG_LIBS)
8095 AC_SUBST(MOZ_ZLIB_CFLAGS)
8096 AC_SUBST(MOZ_ZLIB_LIBS)
8097 AC_SUBST(MOZ_BZ2_CFLAGS)
8098 AC_SUBST(MOZ_BZ2_LIBS)
8099 AC_SUBST(MOZ_PNG_CFLAGS)
8100 AC_SUBST(MOZ_PNG_LIBS)
8102 AC_SUBST(NSPR_CFLAGS)
8103 AC_SUBST(NSPR_LIBS)
8104 AC_SUBST(MOZ_NATIVE_NSPR)
8106 AC_SUBST(NSS_CFLAGS)
8107 AC_SUBST(NSS_LIBS)
8108 AC_SUBST(NSS_DEP_LIBS)
8109 AC_SUBST(MOZ_NATIVE_NSS)
8111 AC_SUBST(CFLAGS)
8112 AC_SUBST(CXXFLAGS)
8113 AC_SUBST(CPPFLAGS)
8114 AC_SUBST(COMPILE_CFLAGS)
8115 AC_SUBST(COMPILE_CXXFLAGS)
8116 AC_SUBST(LDFLAGS)
8117 AC_SUBST(LIBS)
8118 AC_SUBST(CROSS_COMPILE)
8120 AC_SUBST(HOST_CC)
8121 AC_SUBST(HOST_CXX)
8122 AC_SUBST(HOST_CFLAGS)
8123 AC_SUBST(HOST_CXXFLAGS)
8124 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8125 AC_SUBST(HOST_AR)
8126 AC_SUBST(HOST_AR_FLAGS)
8127 AC_SUBST(HOST_LD)
8128 AC_SUBST(HOST_RANLIB)
8129 AC_SUBST(HOST_NSPR_MDCPUCFG)
8130 AC_SUBST(HOST_BIN_SUFFIX)
8131 AC_SUBST(HOST_OS_ARCH)
8133 AC_SUBST(TARGET_CPU)
8134 AC_SUBST(TARGET_VENDOR)
8135 AC_SUBST(TARGET_OS)
8136 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8137 AC_SUBST(TARGET_MD_ARCH)
8138 AC_SUBST(TARGET_XPCOM_ABI)
8139 AC_SUBST(OS_TARGET)
8140 AC_SUBST(OS_ARCH)
8141 AC_SUBST(OS_RELEASE)
8142 AC_SUBST(OS_TEST)
8144 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
8145 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8147 AC_SUBST(WRAP_MALLOC_CFLAGS)
8148 AC_SUBST(WRAP_MALLOC_LIB)
8149 AC_SUBST(MKSHLIB)
8150 AC_SUBST(MKCSHLIB)
8151 AC_SUBST(MKSHLIB_FORCE_ALL)
8152 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8153 AC_SUBST(DSO_CFLAGS)
8154 AC_SUBST(DSO_PIC_CFLAGS)
8155 AC_SUBST(DSO_LDOPTS)
8156 AC_SUBST(LIB_PREFIX)
8157 AC_SUBST(DLL_PREFIX)
8158 AC_SUBST(DLL_SUFFIX)
8159 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8160 AC_SUBST(LIB_SUFFIX)
8161 AC_SUBST(OBJ_SUFFIX)
8162 AC_SUBST(BIN_SUFFIX)
8163 AC_SUBST(ASM_SUFFIX)
8164 AC_SUBST(IMPORT_LIB_SUFFIX)
8165 AC_SUBST(USE_N32)
8166 AC_SUBST(CC_VERSION)
8167 AC_SUBST(CXX_VERSION)
8168 AC_SUBST(MSMANIFEST_TOOL)
8170 if test "$USING_HCC"; then
8171    CC='${topsrcdir}/build/hcc'
8172    CC="$CC '$_OLDCC'"
8173    CXX='${topsrcdir}/build/hcpp'
8174    CXX="$CXX '$_OLDCXX'"
8175    AC_SUBST(CC)
8176    AC_SUBST(CXX)
8179 dnl Check for missing components
8180 if test "$COMPILE_ENVIRONMENT"; then
8181 if test "$MOZ_X11"; then
8182     dnl ====================================================
8183     dnl = Check if X headers exist
8184     dnl ====================================================
8185     _SAVE_CFLAGS=$CFLAGS
8186     CFLAGS="$CFLAGS $XCFLAGS"
8187     AC_TRY_COMPILE([
8188         #include <stdio.h>
8189         #include <stdlib.h>
8190         #include <X11/Xlib.h>
8191         #include <X11/Intrinsic.h>
8192     ],
8193     [
8194         Display *dpy = 0;
8195         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8196             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8197             exit(1);
8198         }
8199     ], [], 
8200     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8201     CFLAGS="$_SAVE_CFLAGS"
8203     if test ! -z "$MISSING_X"; then
8204         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8205     fi
8207 fi # MOZ_X11
8208 fi # COMPILE_ENVIRONMENT
8210 dnl Set various defines and substitutions
8211 dnl ========================================================
8213 if test "$OS_ARCH" = "OS2" -a "$VACPP" = "yes"; then
8214       LIBS='so32dll.lib tcp32dll.lib'
8215 elif test "$OS_ARCH" = "BeOS"; then
8216   AC_DEFINE(XP_BEOS)
8217   MOZ_MOVEMAIL=1
8218 elif test "$OS_ARCH" = "Darwin"; then
8219   AC_DEFINE(XP_UNIX)
8220   AC_DEFINE(UNIX_ASYNC_DNS)
8221   MOZ_MOVEMAIL=1
8222 elif test "$OS_ARCH" = "OpenVMS"; then
8223   AC_DEFINE(XP_UNIX)
8224 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
8225   AC_DEFINE(XP_UNIX)
8226   AC_DEFINE(UNIX_ASYNC_DNS)
8227   MOZ_MOVEMAIL=1
8229 AC_SUBST(MOZ_MOVEMAIL)
8231 AC_DEFINE(JS_THREADSAFE)
8233 if test "$MOZ_DEBUG"; then
8234     AC_DEFINE(MOZ_REFLOW_PERF)
8235     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8238 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8239     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8240     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8241     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8242     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8243     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8244     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8245     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8246     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8249 # Used for LD_LIBRARY_PATH of run_viewer target
8250 LIBS_PATH=
8251 for lib_arg in $NSPR_LIBS $TK_LIBS; do
8252   case $lib_arg in
8253     -L* ) LIBS_PATH="${LIBS_PATH:+$LIBS_PATH:}"`expr $lib_arg : "-L\(.*\)"` ;;
8254       * ) ;;
8255   esac
8256 done
8257 AC_SUBST(LIBS_PATH)
8259 dnl ========================================================
8260 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
8261 dnl ========================================================
8262 case "$host_os" in
8263 mingw*)
8264     WIN_TOP_SRC=`cd $srcdir; pwd -W`
8265     ;;
8266 cygwin*|msvc*|mks*)
8267     HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
8268     HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
8269     CC="\$(CYGWIN_WRAPPER) $CC"
8270     CXX="\$(CYGWIN_WRAPPER) $CXX"
8271     CPP="\$(CYGWIN_WRAPPER) $CPP"
8272     LD="\$(CYGWIN_WRAPPER) $LD"
8273     AS="\$(CYGWIN_WRAPPER) $AS"
8274     RC="\$(CYGWIN_WRAPPER) $RC"
8275     MIDL="\$(CYGWIN_WRAPPER) $MIDL"
8276     CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
8277     WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
8278     ;;
8279 esac
8281 AC_SUBST(CYGDRIVE_MOUNT)
8282 AC_SUBST(WIN_TOP_SRC)
8284 AC_SUBST(MOZILLA_VERSION)
8286 . ${srcdir}/config/chrome-versions.sh
8287 AC_DEFINE_UNQUOTED(MOZILLA_LOCALE_VERSION,"$MOZILLA_LOCALE_VERSION")
8288 AC_DEFINE_UNQUOTED(MOZILLA_REGION_VERSION,"$MOZILLA_REGION_VERSION")
8289 AC_DEFINE_UNQUOTED(MOZILLA_SKIN_VERSION,"$MOZILLA_SKIN_VERSION")
8291 AC_SUBST(ac_configure_args)
8293 dnl Spit out some output
8294 dnl ========================================================
8296 dnl The following defines are used by xpcom
8297 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8298 CPP_THROW_NEW
8299 HAVE_CPP_2BYTE_WCHAR_T
8300 HAVE_CPP_ACCESS_CHANGING_USING
8301 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8302 HAVE_CPP_BOOL
8303 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8304 HAVE_CPP_EXPLICIT
8305 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
8306 HAVE_CPP_NAMESPACE_STD
8307 HAVE_CPP_NEW_CASTS
8308 HAVE_CPP_PARTIAL_SPECIALIZATION
8309 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8310 HAVE_CPP_TYPENAME
8311 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
8312 HAVE_STATVFS
8313 NEED_CPP_UNUSED_IMPLEMENTATIONS
8314 NEW_H
8315 HAVE_GETPAGESIZE
8316 HAVE_ICONV
8317 HAVE_ICONV_WITH_CONST_INPUT
8318 HAVE_MBRTOWC
8319 HAVE_SYS_MOUNT_H
8320 HAVE_SYS_VFS_H
8321 HAVE_WCRTOMB
8322 MOZ_V1_STRING_ABI
8325 AC_CONFIG_HEADER(
8326 netwerk/necko-config.h
8327 xpcom/xpcom-config.h
8328 xpcom/xpcom-private.h
8331 # Save the defines header file before autoconf removes it.
8332 # (Do not add AC_DEFINE calls after this line.)
8333   _CONFIG_TMP=confdefs-tmp.h
8334   _CONFIG_DEFS_H=mozilla-config.h
8336   cat > $_CONFIG_TMP <<\EOF
8337 /* List of defines generated by configure. Included with preprocessor flag,
8338  * -include, to avoid long list of -D defines on the compile command-line.
8339  * Do not edit.
8340  */
8342 #ifndef _MOZILLA_CONFIG_H_
8343 #define _MOZILLA_CONFIG_H_
8346 _EGREP_PATTERN='^#define ('
8347 if test -n "$_NON_GLOBAL_ACDEFINES"; then
8348     for f in $_NON_GLOBAL_ACDEFINES; do
8349         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
8350     done
8352 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
8354   sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
8356   cat >> $_CONFIG_TMP <<\EOF
8358 #endif /* _MOZILLA_CONFIG_H_ */
8362   # Only write mozilla-config.h when something changes (or it doesn't exist)
8363   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
8364     rm $_CONFIG_TMP
8365   else
8366     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
8367     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
8369     echo ==== $_CONFIG_DEFS_H =================================
8370     cat $_CONFIG_DEFS_H
8371   fi
8373 dnl Probably shouldn't call this manually but we always want the output of DEFS
8374 rm -f confdefs.h.save
8375 mv confdefs.h confdefs.h.save
8376 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
8377 AC_OUTPUT_MAKE_DEFS()
8378 MOZ_DEFINES=$DEFS
8379 AC_SUBST(MOZ_DEFINES)
8380 rm -f confdefs.h
8381 mv confdefs.h.save confdefs.h
8383 dnl Load the list of Makefiles to generate.
8384 dnl   To add new Makefiles, edit allmakefiles.sh.
8385 dnl   allmakefiles.sh sets the variable, MAKEFILES.
8386 . ${srcdir}/allmakefiles.sh
8387 dnl 
8388 dnl Run a perl script to quickly create the makefiles.
8389 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
8390 dnl   for the files it cannot handle correctly. This way, config.status
8391 dnl   will handle these files.
8392 dnl If it fails, nothing is set and config.status will run as usual.
8394 dnl This does not change the $MAKEFILES variable.
8396 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
8398 if test -z "${AS_PERL}"; then
8399 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
8400 else
8401 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
8403 . ./conftest.sh
8404 rm conftest.sh
8406 echo $MAKEFILES > unallmakefiles
8408 AC_OUTPUT($MAKEFILES)
8410 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
8411 if test "$CAIRO_FEATURES_H"; then
8412   if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
8413     mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
8414   else
8415     rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
8416   fi
8419 dnl ========================================================
8420 dnl = Setup a nice relatively clean build environment for
8421 dnl = sub-configures.
8422 dnl ========================================================
8423 CC="$_SUBDIR_CC" 
8424 CXX="$_SUBDIR_CXX" 
8425 CFLAGS="$_SUBDIR_CFLAGS" 
8426 CPPFLAGS="$_SUBDIR_CPPFLAGS"
8427 CXXFLAGS="$_SUBDIR_CXXFLAGS"
8428 LDFLAGS="$_SUBDIR_LDFLAGS"
8429 HOST_CC="$_SUBDIR_HOST_CC" 
8430 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8431 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
8434 unset MAKEFILES
8435 unset CONFIG_FILES
8437 if test "$COMPILE_ENVIRONMENT"; then
8438 if test -z "$MOZ_NATIVE_NSPR" || test "$MOZ_LDAP_XPCOM"; then
8439     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
8440     if test -z "$MOZ_DEBUG"; then
8441         ac_configure_args="$ac_configure_args --disable-debug"
8442     fi
8443     if test "$MOZ_OPTIMIZE" = "1"; then
8444         ac_configure_args="$ac_configure_args --enable-optimize"
8445     fi
8446     if test "$OS_ARCH" = "WINNT" && test "$NS_TRACE_MALLOC"; then
8447        ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
8448     fi
8449     if test -n "$HAVE_64BIT_OS"; then
8450         ac_configure_args="$ac_configure_args --enable-64bit"
8451     fi
8452     if test -n "$USE_ARM_KUSER"; then
8453         ac_configure_args="$ac_configure_args --with-arm-kuser"
8454     fi
8455     AC_OUTPUT_SUBDIRS(nsprpub)
8456     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8459 if test -z "$MOZ_NATIVE_NSPR"; then
8460     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
8461     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
8462     if test ! "$VACPP" && test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE"; then
8463        _libs=`./nsprpub/config/nspr-config --prefix=$\(LIBXUL_DIST\) --exec-prefix=$\(DIST\) --libdir=$\(LIBXUL_DIST\)/lib --libs`
8464        $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $_libs'" config/autoconf.mk
8465     fi
8466     if test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE" ; then
8467        _cflags=`./nsprpub/config/nspr-config --prefix=$\(LIBXUL_DIST\) --exec-prefix=$\(DIST\) --includedir=$\(LIBXUL_DIST\)/include/nspr --cflags`
8468        $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $_cflags'" config/autoconf.mk
8469     fi
8470     rm -f config/autoconf.mk.bak
8473 # if we're building the LDAP XPCOM component, we need to build 
8474 # the c-sdk first.  
8476 if test "$MOZ_LDAP_XPCOM"; then
8478     # these subdirs may not yet have been created in the build tree.
8479     # don't use the "-p" switch to mkdir, since not all platforms have it
8480     #
8481     if test ! -d "directory"; then
8482         mkdir "directory"
8483     fi
8484     if test ! -d "directory/c-sdk"; then
8485         mkdir "directory/c-sdk"    
8486     fi
8487     if test ! -d "directory/c-sdk/ldap"; then
8488         mkdir "directory/c-sdk/ldap"    
8489     fi
8491     ac_configure_args="$_SUBDIR_CONFIG_ARGS --prefix=$MOZ_BUILD_ROOT/dist --with-dist-prefix=$MOZ_BUILD_ROOT/dist --without-nss --with-mozilla"
8492     if test -z "$MOZ_DEBUG"; then
8493         ac_configure_args="$ac_configure_args --disable-debug"
8494     fi
8495     if test "$MOZ_OPTIMIZE" = "1"; then
8496         ac_configure_args="$ac_configure_args --enable-optimize"
8497     fi
8498     if test -n "$HAVE_64BIT_OS"; then
8499         ac_configure_args="$ac_configure_args --enable-64bit"
8500     fi
8501     AC_OUTPUT_SUBDIRS(directory/c-sdk)
8502     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8504 fi # COMPILE_ENVIRONMENT