Bug 451040 ? Passwords Manager Empty after convert to MozStorage. r=gavin
[wine-gecko.git] / configure.in
blob96e931cea6e57527c4f3136c65b1ae3ba42e10dc
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-l10n-base=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 -Wl,-rpath-link,$(PREFIX)/lib'
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     # -Wshadow - removed because it generates more noise than help --pete
1317     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1318     if test -z "$INTEL_CC"; then
1319        # Don't use -Wcast-align with ICC
1320        case "$CPU_ARCH" in
1321            # And don't use it on hppa, ia64, sparc, since it's noisy there
1322            hppa | ia64 | sparc)
1323            ;;
1324            *)
1325         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1326            ;;
1327        esac
1328     fi
1330     dnl Turn pedantic on but disable the warnings for long long
1331     _PEDANTIC=1
1333     if test -z "$INTEL_CC"; then
1334       _IGNORE_LONG_LONG_WARNINGS=1
1335       _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1336     else
1337       _IGNORE_LONG_LONG_WARNINGS=
1338     fi
1341     _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1342     _USE_CPP_INCLUDE_FLAG=1
1343 else
1344     MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1345     MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1347     DSO_LDOPTS='-shared'
1348     if test "$GNU_LD"; then
1349         # Don't allow undefined symbols in libraries
1350         DSO_LDOPTS="$DSO_LDOPTS -z defs"
1351     fi
1353     DSO_CFLAGS=''
1354     DSO_PIC_CFLAGS='-KPIC'
1355     _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1358 if test "$GNU_CXX"; then
1359     # FIXME: Let us build with strict aliasing. bug 414641.
1360     CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1361     # Turn on GNU specific features
1362     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1363     if test -z "$INTEL_CC"; then
1364        # Don't use -Wcast-align with ICC
1365        case "$CPU_ARCH" in
1366            # And don't use it on hppa, ia64, sparc, since it's noisy there
1367            hppa | ia64 | sparc)
1368            ;;
1369            *)
1370         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1371            ;;
1372        esac
1373     fi
1375     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1376     _USE_CPP_INCLUDE_FLAG=1
1377 else
1378     _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1381 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1382 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1383 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1384 dnl normal behavior.
1385 dnl ========================================================
1386 MKSHLIB_FORCE_ALL=
1387 MKSHLIB_UNFORCE_ALL=
1389 if test "$COMPILE_ENVIRONMENT"; then
1390 if test "$GNU_CC"; then
1391   AC_MSG_CHECKING(whether ld has archive extraction flags)
1392   AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1393    [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1394     ac_cv_mkshlib_force_and_unforce="no"
1395     exec 3<&0 <<LOOP_INPUT
1396         force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
1397         force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1398         force="-Wl,-all";              unforce="-Wl,-none"
1399 LOOP_INPUT
1400     while read line
1401     do
1402       eval $line
1403       LDFLAGS=$force
1404       LIBS=$unforce
1405       AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1406     done
1407     exec 0<&3 3<&-
1408     LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1409    ])
1410   if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1411     AC_MSG_RESULT(no)
1412   else
1413     AC_MSG_RESULT(yes)
1414     eval $ac_cv_mkshlib_force_and_unforce
1415     MKSHLIB_FORCE_ALL=$force
1416     MKSHLIB_UNFORCE_ALL=$unforce
1417   fi
1418 fi # GNU_CC
1419 fi # COMPILE_ENVIRONMENT
1421 dnl =================================================================
1422 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1423 dnl which is bad when cross compiling.
1424 dnl =================================================================
1425 if test "$COMPILE_ENVIRONMENT"; then
1426 configure_static_assert_macros='
1427 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1428 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1429 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1432 dnl test that the macros actually work:
1433 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1434 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1435  [AC_LANG_SAVE
1436   AC_LANG_C
1437   ac_cv_static_assertion_macros_work="yes"
1438   AC_TRY_COMPILE([$configure_static_assert_macros],
1439                  [CONFIGURE_STATIC_ASSERT(1)],
1440                  ,
1441                  ac_cv_static_assertion_macros_work="no")
1442   AC_TRY_COMPILE([$configure_static_assert_macros],
1443                  [CONFIGURE_STATIC_ASSERT(0)],
1444                  ac_cv_static_assertion_macros_work="no",
1445                  )
1446   AC_LANG_CPLUSPLUS
1447   AC_TRY_COMPILE([$configure_static_assert_macros],
1448                  [CONFIGURE_STATIC_ASSERT(1)],
1449                  ,
1450                  ac_cv_static_assertion_macros_work="no")
1451   AC_TRY_COMPILE([$configure_static_assert_macros],
1452                  [CONFIGURE_STATIC_ASSERT(0)],
1453                  ac_cv_static_assertion_macros_work="no",
1454                  )
1455   AC_LANG_RESTORE
1456  ])
1457 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1458 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1459     AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1462 fi # COMPILE_ENVIRONMENT
1464 dnl ========================================================
1465 dnl Checking for 64-bit OS
1466 dnl ========================================================
1467 if test "$COMPILE_ENVIRONMENT"; then
1468 AC_LANG_SAVE
1469 AC_LANG_C
1470 AC_MSG_CHECKING(for 64-bit OS)
1471 AC_TRY_COMPILE([$configure_static_assert_macros],
1472                [CONFIGURE_STATIC_ASSERT(sizeof(long) == 8)],
1473                result="yes", result="no")
1474 AC_MSG_RESULT("$result")
1475 if test "$result" = "yes"; then
1476     AC_DEFINE(HAVE_64BIT_OS)
1477     HAVE_64BIT_OS=1
1479 AC_SUBST(HAVE_64BIT_OS)
1480 AC_LANG_RESTORE
1481 fi # COMPILE_ENVIRONMENT
1483 dnl ========================================================
1484 dnl Enable high-memory support on OS/2 by default.
1485 dnl ========================================================
1486 MOZ_OS2_HIGH_MEMORY=1
1487 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1488 [  --disable-os2-high-mem  Disable high-memory support on OS/2],
1489     MOZ_OS2_HIGH_MEMORY=,
1490     MOZ_OS2_HIGH_MEMORY=1 )
1491 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1493 dnl ========================================================
1494 dnl System overrides of the defaults for host
1495 dnl ========================================================
1496 case "$host" in
1497 *-beos*)
1498     HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1499     HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1500     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1501     ;;
1503 *cygwin*|*mingw*|*mks*|*msvc*|*wince)
1504     if test -n "$_WIN32_MSVC"; then
1505         HOST_AR=lib
1506         HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1507         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1508         HOST_RANLIB='echo ranlib'
1509     else
1510         HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1511     fi
1512     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1513     HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1514     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1515     HOST_BIN_SUFFIX=.exe
1516     case "$host" in
1517     *mingw*)
1518     dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1519         ;;
1520     *)
1521         CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1522         if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1523             _pwd=`pwd`
1524             CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1525         fi
1526         if test "`${PERL} -v | grep -c cygwin  2>/dev/null`" = 0; then
1527             AS_PERL=1
1528             PERL="${CYGWIN_WRAPPER} $PERL"
1529         fi
1531         if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1532             PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1533         fi
1534         ;;
1535     esac
1536     ;;
1538 *-darwin*)
1539     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1540     HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1541     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1542     MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1543     LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL -lobjc'
1544     ;;
1546 *-linux*|*-kfreebsd*-gnu)
1547     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1548     HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1549     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1550     ;;
1552 *os2*)
1553     HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1554     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1555     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1556     HOST_BIN_SUFFIX=.exe
1557     MOZ_FIX_LINK_PATHS=
1558     ;;
1560 *-osf*)
1561     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1562     HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1563     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1564     ;;
1567     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1568     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1569     ;;
1570 esac
1572 dnl Get mozilla version from central milestone file
1573 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1575 dnl Get version of various core apps from the version files.
1576 FIREFOX_VERSION=`cat $topsrcdir/browser/config/version.txt`
1577 THUNDERBIRD_VERSION=`cat $topsrcdir/mail/config/version.txt`
1578 SUNBIRD_VERSION=`cat $topsrcdir/calendar/sunbird/config/version.txt`
1579 SEAMONKEY_VERSION=`cat $topsrcdir/suite/config/version.txt`
1581 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1582 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1584 dnl ========================================================
1585 dnl System overrides of the defaults for target
1586 dnl ========================================================
1588 case "$target" in
1589 *-aix*)
1590     AC_DEFINE(AIX)
1591     if test ! "$GNU_CC"; then
1592         if test ! "$HAVE_64BIT_OS"; then
1593             # Compiling with Visual Age C++ object model compat is the
1594             # default. To compile with object model ibm, add 
1595             # AIX_OBJMODEL=ibm to .mozconfig.
1596             if test "$AIX_OBJMODEL" = "ibm"; then
1597                 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1598             else
1599                 AIX_OBJMODEL=compat
1600             fi
1601         else
1602             AIX_OBJMODEL=compat
1603         fi
1604         AC_SUBST(AIX_OBJMODEL)
1605         DSO_LDOPTS='-qmkshrobj=1'
1606         DSO_CFLAGS='-qflag=w:w'
1607         DSO_PIC_CFLAGS=
1608         LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1609         AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1610         MOZ_FIX_LINK_PATHS=
1611         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1612         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1613         if test "$COMPILE_ENVIRONMENT"; then
1614             AC_LANG_SAVE
1615             AC_LANG_CPLUSPLUS
1616             AC_MSG_CHECKING([for VisualAge C++ compiler version >= 5.0.2.0])
1617             AC_TRY_COMPILE([],
1618                 [#if (__IBMCPP__ < 502)
1619                  #error "Bad compiler"
1620                  #endif],
1621                 _BAD_COMPILER=,_BAD_COMPILER=1)
1622             if test -n "$_BAD_COMPILER"; then
1623                 AC_MSG_RESULT([no])    
1624                 AC_MSG_ERROR([VisualAge C++ version 5.0.2.0 or higher is required to build.])
1625             else
1626                 AC_MSG_RESULT([yes])    
1627             fi
1628             AC_LANG_RESTORE
1629             TARGET_COMPILER_ABI="ibmc"
1630             CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1631             CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1632         fi
1633     fi
1634     case "${target_os}" in
1635     aix4.1*)
1636         DLL_SUFFIX='_shr.a'
1637         ;;
1638     esac
1639     if test "$COMPILE_ENVIRONMENT"; then
1640         AC_CHECK_HEADERS(sys/inttypes.h)
1641     fi
1642     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1643     ;;
1645 *-beos*)
1646     no_x=yes
1647     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1648     _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
1649     DSO_LDOPTS='-nostart'
1650     TK_LIBS='-lbe -lroot'
1651     LIBS="$LIBS -lbe"
1652     if test "$COMPILE_ENVIRONMENT"; then
1653         AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
1654         AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
1655     fi
1656     _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
1657     _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
1658     _MOZ_USE_RTTI=1
1659     USE_DEPENDENT_LIBS=
1660     MOZ_USER_DIR="Mozilla"
1661     ;;
1663 *-bsdi*)
1664     dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
1665     _PEDANTIC=
1666     _IGNORE_LONG_LONG_WARNINGS=
1667     case $OS_RELEASE in
1668         4.*|5.*)
1669             STRIP="$STRIP -d"
1670             ;;
1671         *)
1672             DSO_CFLAGS=''
1673             DSO_LDOPTS='-r'
1674             _WARNINGS_CFLAGS="-Wall"
1675             _WARNINGS_CXXFLAGS="-Wall"
1676             # The test above doesn't work properly, at least on 3.1.
1677             MKSHLIB_FORCE_ALL=''
1678             MKSHLIB_UNFORCE_ALL=''
1679         ;;
1680     esac
1681     ;;
1683 *-darwin*) 
1684     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1685     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1686     MOZ_OPTIMIZE_FLAGS="-O2"
1687     _PEDANTIC=
1688     CFLAGS="$CFLAGS -fpascal-strings -fno-common"
1689     CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
1690     DLL_SUFFIX=".dylib"
1691     DSO_LDOPTS=''
1692     STRIP="$STRIP -x -S"
1693     _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1694     MOZ_ENABLE_POSTSCRIPT=
1695     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1696     LDFLAGS="$LDFLAGS -framework Cocoa"
1697     # The ExceptionHandling framework is needed for Objective-C exception
1698     # logging code in nsObjCExceptions.h. Currently we only use that in debug
1699     # builds.
1700     MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
1701     # set MACOSX to generate lib/mac/MoreFiles/Makefile
1702     MACOSX=1
1704     dnl DTrace and -dead_strip don't interact well. See bug 403132.
1705     dnl ===================================================================
1706     if test "x$enable_dtrace" = "xyes"; then
1707         echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1708     else
1709         dnl check for the presence of the -dead_strip linker flag
1710         AC_MSG_CHECKING([for -dead_strip option to ld])
1711         _SAVE_LDFLAGS=$LDFLAGS
1712         LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1713         AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1714         if test -n "$_HAVE_DEAD_STRIP" ; then
1715             AC_MSG_RESULT([yes])
1716             MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1717         else
1718             AC_MSG_RESULT([no])
1719         fi
1720         
1721         LDFLAGS=$_SAVE_LDFLAGS
1722     fi
1723     ;;
1725 *-freebsd*)
1726     if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
1727         DLL_SUFFIX=".so.1.0"
1728         DSO_LDOPTS="-shared"
1729     fi
1730     if test ! "$GNU_CC"; then
1731         DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
1732     fi
1733 # Can't have force w/o an unforce.
1734 #    # Hack for FreeBSD 2.2
1735 #    if test -z "$MKSHLIB_FORCE_ALL"; then
1736 #       MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive'
1737 #       MKSHLIB_UNFORCE_ALL=''
1738 #    fi
1739     ;; 
1741 *-hpux*)
1742     DLL_SUFFIX=".sl"
1743     if test ! "$GNU_CC"; then
1744         DSO_LDOPTS='-b -Wl,+s'
1745         DSO_CFLAGS=""
1746         DSO_PIC_CFLAGS="+Z"
1747         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1748         MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1749         CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1750     else
1751         DSO_LDOPTS='-b -E +s'
1752         MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1753         MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1754     fi
1755     MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1756     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1757     ;;
1759 *-irix5*)
1760     AC_DEFINE(IRIX)
1761     DSO_LDOPTS='-elf -shared'
1763     if test "$GNU_CC"; then
1764        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1765        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1766        MKSHLIB_FORCE_ALL='-Wl,-all'
1767        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1768        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1769     else
1770        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1771        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1772        MKSHLIB_FORCE_ALL='-all'
1773        MKSHLIB_UNFORCE_ALL='-none'
1774     fi
1775     ;;
1777 *-irix6*)
1778     AC_DEFINE(IRIX)
1779     dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must* 
1780     dnl compile and link using -n32
1781     USE_N32=1
1782     TARGET_COMPILER_ABI=n32
1783     DSO_LDOPTS='-elf -shared'
1784     MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1785     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1786     _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
1787     _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
1788     if test "$GNU_CC"; then
1789        MKSHLIB_FORCE_ALL='-Wl,-all'
1790        MKSHLIB_UNFORCE_ALL='-Wl,-none'
1791        _WARNINGS_CFLAGS="-Wall"
1792        _WARNINGS_CXXFLAGS="-Wall"
1793        CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1794     else
1795        MKSHLIB_FORCE_ALL='-all'
1796        MKSHLIB_UNFORCE_ALL='-none'
1797            AR_LIST="$AR t"
1798            AR_EXTRACT="$AR x"
1799            AR_DELETE="$AR d"
1800            AR='$(CXX) -ar'
1801            AR_FLAGS='-o $@'
1802        CFLAGS="$CFLAGS -woff 3262 -G 4"
1803        CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
1804        if test -n "$USE_N32"; then
1805            ASFLAGS="$ASFLAGS -n32"
1806            CFLAGS="$CFLAGS -n32"
1807            CXXFLAGS="$CXXFLAGS -n32"
1808            LDFLAGS="$LDFLAGS -n32"
1809        fi
1810        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1811        AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
1812        MOZ_FIX_LINK_PATHS=
1813     fi
1814     if test -z "$GNU_CXX"; then
1815       MIPSPRO_CXX=1
1816     fi
1817     ;;
1819 *-*linux*)
1820     if test "$GNU_CC"; then
1821         GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
1822         case $GCC_VERSION in
1823         4.1.*|4.2.*)
1824             # -Os is broken on gcc 4.1.x and 4.2.x, we need to tweak it to get good results.
1825             MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
1826         esac
1827     fi
1829     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1830     MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions $MOZ_OPTIMIZE_SIZE_TWEAK"
1831     MOZ_DEBUG_FLAGS="-g -fno-inline"  # most people on linux use gcc/gdb,
1832                                       # and that combo is not yet good at
1833                                       # debugging inlined functions (even
1834                                       # when using DWARF2 as the debugging
1835                                       # format)    
1837     MOZ_MEMORY=1
1839     case "${target_cpu}" in
1840     alpha*)
1841         CFLAGS="$CFLAGS -mieee"
1842         CXXFLAGS="$CXXFLAGS -mieee"
1843     ;;
1844     i*86)
1845         USE_ELF_DYNSTR_GC=1
1846         MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1
1847     ;;
1848     mips*)
1849         CFLAGS="$CFLAGS -Wa,-xgot"
1850         CXXFLAGS="$CXXFLAGS -Wa,-xgot"
1851     ;;
1852     esac
1853     ;;
1855 *-wince*)
1857     MOZ_TOOLS_DIR=`echo $MOZ_TOOLS`
1858     AR_LIST="$AR -list"
1859     AR_EXTRACT="$AR -extract"
1860     AR_DELETE="$AR d"
1861     AR_FLAGS='-OUT:"$@"'
1863     DSO_CFLAGS=
1864     DSO_PIC_CFLAGS=
1865     DLL_SUFFIX=.dll
1866     BIN_SUFFIX='.exe'
1867     RC=rc.exe
1868     # certain versions of cygwin's makedepend barf on the 
1869     # #include <string> vs -I./dist/include/string issue so don't use it
1870     SYSTEM_MAKEDEPEND=
1872     HOST_CC=cl
1873     HOST_CXX=cl
1874     HOST_LD=link
1875     HOST_AR='lib -OUT:$@'
1876     HOST_RANLIB='echo ranlib'
1877     HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
1878         
1879         
1880     WARNINGS_AS_ERRORS='-WX'
1881         MOZ_OPTIMIZE_FLAGS='-O1'
1882     AR_FLAGS='-NOLOGO -OUT:"$@"'
1883     ASM_SUFFIX=asm
1884     CFLAGS="$CFLAGS -W3 -Gy -Fd\$(PDBFILE)"
1885     CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(PDBFILE)"
1886     DLL_PREFIX=
1887     DOXYGEN=:
1888     DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
1889     DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
1890     GARBAGE=
1891     IMPORT_LIB_SUFFIX=lib
1892     LIBS="$LIBS"
1893     LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
1894     LIB_PREFIX=
1895     LIB_SUFFIX=lib 
1896     MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
1897     MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
1898     MKSHLIB_FORCE_ALL=
1899     MKSHLIB_UNFORCE_ALL=
1900     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1901     MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1902     MOZ_DEBUG_FLAGS='-Zi'
1903     MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1904     MOZ_FIX_LINK_PATHS=
1905     MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
1906     MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
1907     OBJ_SUFFIX=obj
1908     RANLIB='echo not_ranlib'
1909     STRIP='echo not_strip'
1910     TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
1911     UNZIP=unzip
1912     XARGS=xargs
1913     XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
1914     ZIP=zip
1915     LIBIDL_CFLAGS="-I$MOZ_TOOLS_DIR/include ${GLIB_CFLAGS}"
1916     LIBIDL_LIBS="$MOZ_TOOLS_DIR/lib/libidl-0.6_s.lib $MOZ_TOOLS_DIR/lib/glib-1.2_s.lib"
1917     STATIC_LIBIDL=1
1919     AC_DEFINE(HAVE_SNPRINTF)
1920     AC_DEFINE(_WINDOWS)
1921     AC_DEFINE(_WIN32)
1922     AC_DEFINE(WIN32)
1923     AC_DEFINE(XP_WIN)
1924     AC_DEFINE(XP_WIN32)
1925     AC_DEFINE(HW_THREADS)
1926     AC_DEFINE(STDC_HEADERS)
1927     AC_DEFINE(NEW_H, <new>)
1928     AC_DEFINE(WIN32_LEAN_AND_MEAN)
1930     TARGET_MD_ARCH=win32
1931     _PLATFORM_DEFAULT_TOOLKIT='windows'
1932     BIN_SUFFIX='.exe'
1933     USE_SHORT_LIBNAME=1
1934     MOZ_ENABLE_POSTSCRIPT=
1935     MOZ_USER_DIR="Mozilla"
1939 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
1940     DSO_CFLAGS=
1941     DSO_PIC_CFLAGS=
1942     DLL_SUFFIX=.dll
1943     RC=rc.exe
1944     # certain versions of cygwin's makedepend barf on the 
1945     # #include <string> vs -I./dist/include/string issue so don't use it
1946     SYSTEM_MAKEDEPEND=
1947     if test -n "$GNU_CC"; then
1948         CC="$CC -mno-cygwin"
1949         CXX="$CXX -mno-cygwin"
1950         CPP="$CPP -mno-cygwin"
1951         CFLAGS="$CFLAGS -mms-bitfields"
1952         CXXFLAGS="$CXXFLAGS -mms-bitfields"
1953         DSO_LDOPTS='-shared'
1954         MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1955         MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1956         RC='$(WINDRES)'
1957         # Use temp file for windres (bug 213281)
1958         RCFLAGS='-O coff --use-temp-file'
1959         # mingw doesn't require kernel32, user32, and advapi32 explicitly
1960         LIBS="$LIBS -lgdi32 -lwinmm -lwsock32"
1961         MOZ_JS_LIBS='-L$(LIBXUL_DIST)/lib -ljs$(MOZ_BITS)$(VERSION_NUMBER)'
1962         MOZ_FIX_LINK_PATHS=
1963         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core'
1964         XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom'
1965         DLL_PREFIX=
1966         IMPORT_LIB_SUFFIX=dll.a
1967     else
1968         TARGET_COMPILER_ABI=msvc
1969         HOST_CC='$(CC)'
1970         HOST_CXX='$(CXX)'
1971         HOST_LD='$(LD)'
1972         AR='lib -NOLOGO -OUT:"$@"'
1973         AR_FLAGS=
1974         RANLIB='echo not_ranlib'
1975         STRIP='echo not_strip'
1976         XARGS=xargs
1977         ZIP=zip
1978         UNZIP=unzip
1979         DOXYGEN=:
1980         GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
1981         OBJ_SUFFIX=obj
1982         LIB_SUFFIX=lib
1983         DLL_PREFIX=
1984         LIB_PREFIX=
1985         IMPORT_LIB_SUFFIX=lib
1986         MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(PDBFILE) $(DSO_LDOPTS)'
1987         MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(PDBFILE) $(DSO_LDOPTS)'
1988         MKSHLIB_FORCE_ALL=
1989         MKSHLIB_UNFORCE_ALL=
1990         DSO_LDOPTS=-SUBSYSTEM:WINDOWS
1991         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(PDBFILE)"
1992         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(PDBFILE)"
1993         LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
1994         MOZ_DEBUG_FLAGS='-Zi'
1995         MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1996         WARNINGS_AS_ERRORS='-WX'
1997         MOZ_OPTIMIZE_FLAGS='-O1'
1998         MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
1999         MOZ_FIX_LINK_PATHS=
2000         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
2001         XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
2002         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2003         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2004         MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
2005         if test $_MSC_VER -ge 1400; then
2006             LDFLAGS="$LDFLAGS -NXCOMPAT -SAFESEH"
2007             dnl For profile-guided optimization
2008             PROFILE_GEN_CFLAGS="-GL"
2009             PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2010             dnl XXX: PGO builds can fail with warnings treated as errors,
2011             dnl specifically "no profile data available" appears to be
2012             dnl treated as an error sometimes. This might be a consequence
2013             dnl of using WARNINGS_AS_ERRORS in some modules, combined
2014             dnl with the linker doing most of the work in the whole-program
2015             dnl optimization/PGO case. I think it's probably a compiler bug,
2016             dnl but we work around it here.
2017             PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2018             dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2019             dnl Probably also a compiler bug, but what can you do?
2020             PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2021             if test -n "$_USE_DYNAMICBASE"; then
2022                LDFLAGS="$LDFLAGS -DYNAMICBASE"
2023             fi
2024         fi
2025     fi
2026     MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg$(MOZ_BITS)$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2027     MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2028     AC_DEFINE(HAVE_SNPRINTF)
2029     AC_DEFINE(_WINDOWS)
2030     AC_DEFINE(_WIN32)
2031     AC_DEFINE(WIN32)
2032     AC_DEFINE(XP_WIN)
2033     AC_DEFINE(XP_WIN32)
2034     AC_DEFINE(HW_THREADS)
2035     AC_DEFINE(STDC_HEADERS)
2036     AC_DEFINE(NEW_H, <new>)
2037     AC_DEFINE(WIN32_LEAN_AND_MEAN)
2038     TARGET_MD_ARCH=win32
2039     _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2040     BIN_SUFFIX='.exe'
2041     USE_SHORT_LIBNAME=1
2042     MOZ_ENABLE_POSTSCRIPT=
2043     MOZ_USER_DIR="Mozilla"
2045     dnl Hardcode to win95 for now - cls
2046     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2048     dnl set NO_X11 defines here as the general check is skipped on win32
2049     no_x=yes
2050     AC_DEFINE(NO_X11)
2052     dnl MinGW/MSYS doesn't provide or need cygpath
2053     case "$host" in
2054     *-mingw*)
2055         CYGPATH_W=echo
2056         CYGPATH_S=cat
2057         MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2058         ;;
2059     *-cygwin*|*-msvc*|*-mks*)
2060         CYGPATH_W="cygpath -a -w"
2061         CYGPATH_S="sed -e s|\\\\|/|g"
2062         MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2063         ;;
2064     esac
2065     case "$host" in
2066     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2068     if test -z "$MOZ_TOOLS"; then
2069         AC_MSG_ERROR([MOZ_TOOLS is not set])
2070     fi
2072     MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd`
2073     if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then
2074         AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2075     fi
2076     if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_DIR/bin:"` = 0; then
2077         AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2078     fi
2079     MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2081     if test -n "$GLIB_PREFIX"; then
2082         _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd`
2083         if test "$?" = "0"; then
2084             if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
2085                 AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
2086             fi
2087             _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
2088         else
2089             AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
2090         fi
2091     else
2092         _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
2093     fi
2094     if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
2095         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
2096     fi
2097     GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
2098     if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
2099         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
2100     elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
2101         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
2102     else
2103         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
2104     fi
2106     if test -n "$LIBIDL_PREFIX"; then
2107         _LIBIDL_PREFIX_DIR=`cd $LIBIDL_PREFIX && pwd`
2108         if test "$?" = "0"; then
2109             if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
2110                 AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
2111             fi
2112             _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
2113         else
2114             AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
2115         fi
2116     else
2117         _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
2118     fi        
2119     if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
2120         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
2121     fi
2122     LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
2123     if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
2124         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
2125         STATIC_LIBIDL=1
2126     elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
2127         LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
2128     else
2129         AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
2130     fi
2131     LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2132     ;;
2134     *) # else cross-compiling
2135         if test -n "$GLIB_PREFIX"; then
2136             GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
2137             if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
2138                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
2139             elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
2140                 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
2141             else
2142                 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
2143             fi
2144         fi
2145         if test -n "$LIBIDL_PREFIX"; then
2146             LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
2147             if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
2148                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
2149                 STATIC_LIBIDL=1
2150             elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
2151                 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
2152             else
2153                 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
2154             fi
2155         fi
2156         LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2157         ;;
2158     esac 
2161     case "$host_os" in
2162     cygwin*|msvc*|mks*)
2163         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])
2164         ;;
2166     *)
2167         AC_CHECK_HEADERS(mmintrin.h oleacc.idl)
2169         AC_LANG_SAVE
2170         AC_LANG_CPLUSPLUS
2171         AC_CHECK_HEADERS(atlbase.h wpcapi.h)
2172         AC_LANG_RESTORE
2173         ;;
2174     esac
2176     case "$target" in
2177     i*86-*)
2178         AC_DEFINE(_X86_)
2179         ;;
2180     alpha-*)
2181         AC_DEFINE(_ALPHA_)
2182         ;;
2183     mips-*)
2184         AC_DEFINE(_MIPS_)
2185         ;;
2186     *)
2187         AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2188         ;;
2189     esac
2190     ;;
2192 *-netbsd*)
2193     DSO_CFLAGS=''
2194     CFLAGS="$CFLAGS -Dunix"
2195     CXXFLAGS="$CXXFLAGS -Dunix"
2196     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2197         DLL_SUFFIX=".so"
2198         DSO_PIC_CFLAGS='-fPIC -DPIC'
2199         DSO_LDOPTS='-shared'
2200         BIN_FLAGS='-Wl,--export-dynamic'
2201     else
2202         DSO_PIC_CFLAGS='-fPIC -DPIC'
2203         DLL_SUFFIX=".so.1.0"
2204         DSO_LDOPTS='-shared'
2205     fi
2206     # This will fail on a.out systems prior to 1.5.1_ALPHA.
2207     MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2208     MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2209     if test "$LIBRUNPATH"; then
2210         DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2211     fi
2212     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2213     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2214     ;;
2216 *-nto*) 
2217         AC_DEFINE(NTO)  
2218         AC_DEFINE(_QNX_SOURCE)
2219         AC_DEFINE(_i386)
2220         OS_TARGET=NTO
2221         WARNINGS_AS_ERRORS=''
2222         MOZ_OPTIMIZE_FLAGS="-O"
2223         MOZ_DEBUG_FLAGS="-gstabs"
2224         USE_PTHREADS=1
2225         _PEDANTIC=
2226         LIBS="$LIBS -lsocket -lstdc++"
2227         _DEFINES_CFLAGS='-Wp,-include -Wp,$(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2228         _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -Wp,-include -Wp,$(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2229         if test "$with_x" != "yes"
2230         then
2231                 _PLATFORM_DEFAULT_TOOLKIT="photon"
2232             TK_CFLAGS='-I/usr/include/photon'
2233                 TK_LIBS='-lph'
2234         fi
2235         case "${target_cpu}" in
2236         ppc*)
2237         AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)        
2238         ;;
2239         esac
2240         case "${host_cpu}" in
2241         i*86)
2242         USE_ELF_DYNSTR_GC=1
2243         ;;
2244         esac
2245         ;;
2247 *-openbsd*)
2248     DLL_SUFFIX=".so.1.0"
2249     DSO_CFLAGS=''
2250     DSO_PIC_CFLAGS='-fPIC'
2251     DSO_LDOPTS='-shared -fPIC'
2252     if test "$LIBRUNPATH"; then
2253         DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2254     fi
2255     ;;
2257 *-openvms*) 
2258     AC_DEFINE(NO_PW_GECOS)
2259     AC_DEFINE(NO_UDSOCK)
2260     AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2261     USE_PTHREADS=1
2262     MKSHLIB_FORCE_ALL='-all'
2263     MKSHLIB_UNFORCE_ALL='-none'
2264     AS='as'
2265     AS_DASH_C_FLAG='-Wc/names=as_is'
2266     AR_FLAGS='c $@'
2267     DSO_LDOPTS='-shared -auto_symvec'
2268     DSO_PIC_CFLAGS=
2269     MOZ_DEBUG_LDFLAGS='-g'
2270     COMPAQ_CXX=1
2271     CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2272     CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2273     ;;
2276 *-os2*)
2277     MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2278     MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2279     AC_DEFINE(XP_OS2)
2280     USE_SHORT_LIBNAME=1
2281     DLL_PREFIX=
2282     LIB_PREFIX=
2283     LIB_SUFFIX=lib
2284     BIN_SUFFIX=".exe"
2285     DLL_SUFFIX=".dll"
2286     IMPORT_LIB_SUFFIX=lib
2287     DSO_PIC_CFLAGS=
2288     TARGET_MD_ARCH=os2
2289     _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2290     MOZ_ENABLE_POSTSCRIPT=
2291     RC=rc.exe
2292     RCFLAGS='-n'
2293     MOZ_USER_DIR="Mozilla"
2295     if test "$MOZTOOLS"; then
2296         MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2297     else
2298         AC_MSG_ERROR([MOZTOOLS is not set])
2299     fi
2301     # EMX/GCC build
2302     if test -n "$GNU_CC"; then
2303         AC_DEFINE(OS2)
2304         AC_DEFINE(XP_OS2_EMX)
2305         AC_DEFINE(OS2EMX_PLAIN_CHAR)
2306         AC_DEFINE(TCPV40HDRS)
2307         AR=emxomfar
2308         AR_FLAGS='r $@'
2309         CFLAGS="$CFLAGS -Zomf"
2310         CXXFLAGS="$CXXFLAGS -Zomf"
2311         DSO_LDOPTS='-Zdll'
2312         BIN_FLAGS='-Zlinker /ST:0x100000'
2313         IMPLIB='emximp -o'
2314         FILTER='emxexp -o'
2315         LDFLAGS='-Zmap'
2316         WARNINGS_AS_ERRORS='-Werror'
2317         MOZ_DEBUG_FLAGS="-g -fno-inline"
2318         MOZ_OPTIMIZE_FLAGS="-O2"
2319         MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2320         MOZ_XPCOM_OBSOLETE_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcomct.lib'
2321         DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcomcor.lib'
2322         LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2323         if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2324           DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2325           LDFLAGS="$LDFLAGS -Zhigh-mem"
2326           MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2327           AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2328         fi
2330         # GCC for OS/2 currently predefines these, but we don't want them
2331         _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2332         _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2334         AC_CACHE_CHECK(for __declspec(dllexport),
2335            ac_os2_declspec,
2336            [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2337                            [return 0;],
2338                            ac_os2_declspec="yes",
2339                            ac_os2_declspec="no")])
2340         if test "$ac_os2_declspec" = "yes"; then
2341            FILTER='true'
2342            MOZ_OS2_USE_DECLSPEC='1'
2343         fi
2344         
2345     # Visual Age C++ build
2346     elif test "$VACPP" = "yes"; then
2347         MOZ_BUILD_ROOT=`pwd -D`
2348         OBJ_SUFFIX=obj
2349         AR=-ilib
2350         AR_FLAGS='/NOL /NOI /O:$(subst /,\\,$@)'
2351         AR_LIST='/L'
2352         AR_EXTRACT='-*'
2353         AR_DELETE='-'
2354         AS=alp
2355         ASFLAGS='-Mb'
2356         AS_DASH_C_FLAG=''
2357         ASM_SUFFIX=asm
2358         LD='-ilink'
2359         CFLAGS="/Q /qlibansi /Gm+ /Su4 /Mp /Tl9"
2360         CXXFLAGS="/Q /qlibansi /Gm+ /Su4 /Mp /Tl9 /Gx+"
2361         MOZ_DEBUG_FLAGS="/Ti+"
2362         WARNINGS_AS_ERRORS='-WX'
2363         MOZ_OPTIMIZE_FLAGS="/O+ /Gl+ /G5 /qarch=pentium"
2364         LDFLAGS="/NOL /M"
2365         MOZ_DEBUG_LDFLAGS="/DE"
2366         MOZ_OPTIMIZE_LDFLAGS="/OPTFUNC /EXEPACK:2 /PACKCODE /PACKDATA"
2367         DSO_LDOPTS=''
2368         DSO_PIC_CFLAGS=
2369         IMPLIB='implib /NOL /NOI'
2370         FILTER='cppfilt -q -B -P'
2371         AC_DEFINE(NO_ANSI_KEYWORDS)
2372         AC_DEFINE(OS2,4)
2373         AC_DEFINE(_X86_)
2374         AC_DEFINE(XP_OS2_VACPP)
2375         AC_DEFINE(TCPV40HDRS)
2376         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2377         AC_DEFINE(STDC_HEADERS)
2378         MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2379         MKSHLIB='$(LD) $(DSO_LDOPTS)'
2380         MKCSHLIB='$(LD) $(DSO_LDOPTS)'
2381         MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2382         MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcomct.lib'
2383         DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcomcor.lib'
2384         LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2385     fi
2386     ;;
2388 alpha*-*-osf*)
2389     if test "$GNU_CC"; then
2390       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2391       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2393     else
2394         MOZ_DEBUG_FLAGS='-g'
2395         ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2396         CFLAGS="$CFLAGS -ieee"
2397         CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
2398         DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2399         DSO_CFLAGS=
2400         DSO_PIC_CFLAGS=
2401         MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2402         MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2403         MKSHLIB_FORCE_ALL='-all'
2404         MKSHLIB_UNFORCE_ALL='-none'
2405         dnl Might fix the libxpcom.so breakage on this platform as well....
2406         AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2407         AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2408     fi
2409     if test -z "$GNU_CXX"; then
2410       COMPAQ_CXX=1
2411     fi
2412     AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2413     ;;
2415 *-qnx*) 
2416     DIRENT_INO=d_stat.st_ino
2417     dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2418     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2419     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2420     dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2421     AC_DEFINE(STDC_HEADERS)
2422     if test "$no_x" = "yes"; then
2423             _PLATFORM_DEFAULT_TOOLKIT='photon'
2424             TK_CFLAGS='-I/usr/nto/include/photon'
2425             TK_LIBS='-lphoton -lphrender'
2426     fi
2427     ;;
2429 *-sco*) 
2430     AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2431     AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2432     CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2433     if test ! "$GNU_CC"; then
2434        DSO_LDOPTS='-G'
2435     fi
2436     ;;
2438 dnl the qsort routine under solaris is faulty
2439 *-solaris*) 
2440     AC_DEFINE(SOLARIS)
2441     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2442     SYSTEM_MAKEDEPEND=
2443     # $ORIGIN/.. is for shared libraries under components/ to locate shared
2444     # libraries one level up (e.g. libnspr4.so)
2445     LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
2446     MOZ_MEMORY=1
2447     if test -z "$GNU_CC"; then
2448        NS_USE_NATIVE=1
2449        MOZ_FIX_LINK_PATHS='-R $(LIBXUL_DIST)/bin'
2450        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2452        if test "$CPU_ARCH" != "sparc"; then
2453           CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all"
2454           CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife -norunpath"
2455        else
2456           # Do not use -xbuiltin on SPARC to get around a bug of compiler
2457           CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%none"
2458           CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%none -features=tmplife -norunpath"
2459        fi
2461        LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
2462        if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
2463            _SAVE_LDFLAGS=$LDFLAGS
2464            LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" 
2465            AC_TRY_LINK([#include <stdio.h>],
2466                        [printf("Hello World\n");],
2467                        ,
2468                        [LDFLAGS=$_SAVE_LDFLAGS])
2469        fi
2470        WARNINGS_AS_ERRORS='-Werror'
2471        MOZ_OPTIMIZE_FLAGS="-xO4"
2472        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2473        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -z muldefs -h $@ -o $@'
2474        MKSHLIB_FORCE_ALL='-z allextract'
2475        MKSHLIB_UNFORCE_ALL='-z defaultextract'
2476        DSO_LDOPTS='-G -z muldefs'
2477        AR_LIST="$AR t"
2478        AR_EXTRACT="$AR x"
2479        AR_DELETE="$AR d"
2480        AR='$(CXX) -xar'
2481        AR_FLAGS='-o $@'
2482        AS='/usr/ccs/bin/as'
2483        ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2484        AS_DASH_C_FLAG=''
2485        TARGET_COMPILER_ABI="sunc"
2486         CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2487         CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2488        AC_MSG_CHECKING([for Forte compiler version >= WS6U2])
2489        AC_LANG_SAVE
2490        AC_LANG_CPLUSPLUS
2491        AC_TRY_COMPILE([],
2492            [#if (__SUNPRO_CC < 0x530)
2493            #error "Denied"
2494            #endif],
2495            _BAD_COMPILER=,_BAD_COMPILER=1)
2496         if test -n "$_BAD_COMPILER"; then
2497             _res="no"
2498             AC_MSG_ERROR([Forte version WS6U2 or higher is required to build. Your compiler version is $CC_VERSION .])
2499         else
2500             _res="yes"
2501         fi
2502         AC_MSG_RESULT([$_res])
2503         AC_LANG_RESTORE
2504     else
2505        ASFLAGS="$ASFLAGS -fPIC"
2506        DSO_LDOPTS='-G'
2507        _WARNINGS_CFLAGS=''
2508        _WARNINGS_CXXFLAGS=''
2509        if test "$OS_RELEASE" = "5.3"; then
2510           AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2511        fi
2512     fi
2513     if test "$OS_RELEASE" = "5.5.1"; then
2514        AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2515     fi
2516     ;;
2518 *-sunos*) 
2519     DSO_LDOPTS='-Bdynamic'
2520     MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2521     MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2522     AC_DEFINE(SUNOS4)
2523     AC_DEFINE(SPRINTF_RETURNS_STRING)
2524     case "$(target_os)" in
2525     sunos4.1*)
2526         DLL_SUFFIX='.so.1.0'
2527         ;;
2528     esac
2529     ;;
2531 *-sysv4.2uw7*) 
2532         NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2533     ;;
2535 *-os2*)
2536     HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2537     ;;
2539 esac
2541 dnl Only one oddball right now (QNX), but this gives us flexibility
2542 dnl if any other platforms need to override this in the future.
2543 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2545 dnl ========================================================
2546 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2547 dnl by now will not have any way to link most binaries (tests
2548 dnl as well as viewer, apprunner, etc.), because some symbols
2549 dnl will be left out of the "composite" .so's by ld as unneeded.
2550 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2551 dnl they can link in the static libs that provide the missing
2552 dnl symbols.
2553 dnl ========================================================
2554 NO_LD_ARCHIVE_FLAGS=
2555 if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then
2556     NO_LD_ARCHIVE_FLAGS=1
2558 case "$target" in
2559 *-os2*)
2560     NO_LD_ARCHIVE_FLAGS=
2561     ;;
2562 *-aix4.3*|*-aix5*)
2563     NO_LD_ARCHIVE_FLAGS=
2564     ;;
2565 *-openvms*)
2566     NO_LD_ARCHIVE_FLAGS=
2567     ;;
2568 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince)
2569     if test -z "$GNU_CC"; then
2570         NO_LD_ARCHIVE_FLAGS=
2571     fi
2572     ;;
2573 esac
2574 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2577 dnl Indicate that platform requires special thread safe 
2578 dnl locking when starting up the OJI JVM 
2579 dnl (see mozilla/modules/oji/src/nsJVMManager.cpp)
2580 dnl ========================================================
2581 case "$target" in
2582     *-hpux*)      
2583         AC_DEFINE(MOZ_OJI_REQUIRE_THREAD_SAFE_ON_STARTUP)
2584         ;;
2585 esac
2587 dnl ========================================================
2588 dnl = Flags to strip unused symbols from .so components
2589 dnl ========================================================
2590 case "$target" in
2591     *-linux*|*-kfreebsd*-gnu)
2592         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2593         ;;
2594     *-solaris*)
2595         if test -z "$GNU_CC"; then
2596          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2597         else
2598          if test -z "$GCC_USE_GNU_LD"; then
2599           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2600          else
2601           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2602          fi
2603         fi
2604         ;;
2605     *-nto*) 
2606         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2607         ;;
2608     *-darwin*)
2609         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2610         ;;
2611     *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince)
2612         if test -n "$GNU_CC"; then
2613            MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2614         fi
2615         ;;
2616 esac
2618 if test -z "$COMPILE_ENVIRONMENT"; then
2619     SKIP_COMPILER_CHECKS=1
2620     SKIP_LIBRARY_CHECKS=1
2623 if test -z "$SKIP_COMPILER_CHECKS"; then
2624 dnl Checks for typedefs, structures, and compiler characteristics.
2625 dnl ========================================================
2626 AC_LANG_C
2627 AC_HEADER_STDC
2628 AC_C_CONST
2629 AC_TYPE_MODE_T
2630 AC_TYPE_OFF_T
2631 AC_TYPE_PID_T
2632 AC_TYPE_SIZE_T
2633 AC_STRUCT_ST_BLKSIZE
2634 AC_MSG_CHECKING(for siginfo_t)
2635 AC_CACHE_VAL(ac_cv_siginfo_t,
2636  [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2637                   #include <signal.h>],
2638                  [siginfo_t* info;],
2639                  [ac_cv_siginfo_t=true],
2640                  [ac_cv_siginfo_t=false])])
2641 if test "$ac_cv_siginfo_t" = true ; then
2642   AC_DEFINE(HAVE_SIGINFO_T)
2643   AC_MSG_RESULT(yes)
2644 else
2645   AC_MSG_RESULT(no)
2648 dnl Visual Age for os/2 also defines size_t and off_t in certain 
2649 dnl  header files.  These defines make Visual Age use the mozilla
2650 dnl  defines types.
2651 if test "$VACPP" = "yes"; then
2652    AC_DEFINE(__size_t)
2653    AC_DEFINE(__off_t)
2656 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2657 dnl ========================================================
2658 AC_MSG_CHECKING(for int16_t)
2659 AC_CACHE_VAL(ac_cv_int16_t,
2660  [AC_TRY_COMPILE([#include <stdio.h>
2661                   #include <sys/types.h>],
2662                  [int16_t foo = 0;],
2663                  [ac_cv_int16_t=true],
2664                  [ac_cv_int16_t=false])])
2665 if test "$ac_cv_int16_t" = true ; then
2666   AC_DEFINE(HAVE_INT16_T)
2667   AC_MSG_RESULT(yes)
2668 else
2669   AC_MSG_RESULT(no)
2671 AC_MSG_CHECKING(for int32_t)
2672 AC_CACHE_VAL(ac_cv_int32_t,
2673  [AC_TRY_COMPILE([#include <stdio.h>
2674                   #include <sys/types.h>],
2675                  [int32_t foo = 0;],
2676                  [ac_cv_int32_t=true],
2677                  [ac_cv_int32_t=false])])
2678 if test "$ac_cv_int32_t" = true ; then
2679   AC_DEFINE(HAVE_INT32_T)
2680   AC_MSG_RESULT(yes)
2681 else
2682   AC_MSG_RESULT(no)
2684 AC_MSG_CHECKING(for int64_t)
2685 AC_CACHE_VAL(ac_cv_int64_t,
2686  [AC_TRY_COMPILE([#include <stdio.h>
2687                   #include <sys/types.h>],
2688                  [int64_t foo = 0;],
2689                  [ac_cv_int64_t=true],
2690                  [ac_cv_int64_t=false])])
2691 if test "$ac_cv_int64_t" = true ; then
2692   AC_DEFINE(HAVE_INT64_T)
2693   AC_MSG_RESULT(yes)
2694 else
2695   AC_MSG_RESULT(no)
2697 AC_MSG_CHECKING(for int64)
2698 AC_CACHE_VAL(ac_cv_int64,
2699  [AC_TRY_COMPILE([#include <stdio.h>
2700                   #include <sys/types.h>],
2701                  [int64 foo = 0;],
2702                  [ac_cv_int64=true],
2703                  [ac_cv_int64=false])])
2704 if test "$ac_cv_int64" = true ; then
2705   AC_DEFINE(HAVE_INT64)
2706   AC_MSG_RESULT(yes)
2707 else
2708   AC_MSG_RESULT(no)
2710 AC_MSG_CHECKING(for uint)
2711 AC_CACHE_VAL(ac_cv_uint,
2712  [AC_TRY_COMPILE([#include <stdio.h>
2713                   #include <sys/types.h>],
2714                  [uint foo = 0;],
2715                  [ac_cv_uint=true],
2716                  [ac_cv_uint=false])])
2717 if test "$ac_cv_uint" = true ; then
2718   AC_DEFINE(HAVE_UINT)
2719   AC_MSG_RESULT(yes)
2720 else
2721   AC_MSG_RESULT(no)
2723 AC_MSG_CHECKING(for uint_t)
2724 AC_CACHE_VAL(ac_cv_uint_t,
2725  [AC_TRY_COMPILE([#include <stdio.h>
2726                   #include <sys/types.h>],
2727                  [uint_t foo = 0;],
2728                  [ac_cv_uint_t=true],
2729                  [ac_cv_uint_t=false])])
2730 if test "$ac_cv_uint_t" = true ; then
2731   AC_DEFINE(HAVE_UINT_T)
2732   AC_MSG_RESULT(yes)
2733 else
2734   AC_MSG_RESULT(no)
2736 AC_MSG_CHECKING(for uint16_t)
2737 AC_CACHE_VAL(ac_cv_uint16_t,
2738  [AC_TRY_COMPILE([#include <stdio.h>
2739                   #include <sys/types.h>],
2740                  [uint16_t foo = 0;],
2741                  [ac_cv_uint16_t=true],
2742                  [ac_cv_uint16_t=false])])
2743 if test "$ac_cv_uint16_t" = true ; then
2744   AC_DEFINE(HAVE_UINT16_T)
2745   AC_MSG_RESULT(yes)
2746 else
2747   AC_MSG_RESULT(no)
2750 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2751 dnl are defined when compiling C++ but not C.  Since the result of this
2752 dnl test is used only in C++, do it in C++.
2753 AC_LANG_CPLUSPLUS
2755 AC_MSG_CHECKING(for uname.domainname)
2756 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2757     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2758         [ struct utsname *res; char *domain; 
2759             (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
2760         [ac_cv_have_uname_domainname_field=true],
2761         [ac_cv_have_uname_domainname_field=false])])
2763 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2764     AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2765     AC_MSG_RESULT(yes)
2766 else
2767     AC_MSG_RESULT(no)
2770 AC_MSG_CHECKING(for uname.__domainname)
2771 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2772     [AC_TRY_COMPILE([#include <sys/utsname.h>],
2773         [ struct utsname *res; char *domain; 
2774             (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
2775         [ac_cv_have_uname_us_domainname_field=true],
2776         [ac_cv_have_uname_us_domainname_field=false])])
2778 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2779     AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2780     AC_MSG_RESULT(yes)
2781 else
2782     AC_MSG_RESULT(no)
2785 AC_LANG_C
2787 dnl Check for usable wchar_t (2 bytes, unsigned)
2788 dnl (we really don't need the unsignedness check anymore)
2789 dnl ========================================================
2791 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2792     ac_cv_have_usable_wchar_v2,
2793     [AC_TRY_COMPILE([#include <stddef.h>
2794                      $configure_static_assert_macros],
2795                     [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2796                      CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2797                     ac_cv_have_usable_wchar_v2="yes",
2798                     ac_cv_have_usable_wchar_v2="no")])
2799 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2800     AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2801     HAVE_CPP_2BYTE_WCHAR_T=1
2802 else
2803 dnl This is really gcc-only
2804 dnl Do this test using CXX only since some versions of gcc
2805 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2806 dnl only have short-wchar support for c++.
2807 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2809     AC_LANG_SAVE
2810     AC_LANG_CPLUSPLUS
2811     _SAVE_CXXFLAGS=$CXXFLAGS
2812     CXXFLAGS="$CXXFLAGS -fshort-wchar"
2814     AC_CACHE_CHECK(for compiler -fshort-wchar option, 
2815         ac_cv_have_usable_wchar_option_v2,
2816         [AC_TRY_LINK([#include <stddef.h>
2817                       $configure_static_assert_macros],
2818                      [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2819                       CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2820                      ac_cv_have_usable_wchar_option_v2="yes",
2821                      ac_cv_have_usable_wchar_option_v2="no")])
2823     if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2824         AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2825         HAVE_CPP_2BYTE_WCHAR_T=1
2826     else    
2827         CXXFLAGS=$_SAVE_CXXFLAGS
2828     fi
2829     AC_LANG_RESTORE
2832 dnl Check for .hidden assembler directive and visibility attribute.
2833 dnl Borrowed from glibc configure.in
2834 dnl ===============================================================
2835 if test "$GNU_CC"; then
2836   AC_CACHE_CHECK(for visibility(hidden) attribute,
2837                  ac_cv_visibility_hidden,
2838                  [cat > conftest.c <<EOF
2839                   int foo __attribute__ ((visibility ("hidden"))) = 1;
2841                   ac_cv_visibility_hidden=no
2842                   if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2843                     if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2844                       ac_cv_visibility_hidden=yes
2845                     fi
2846                   fi
2847                   rm -f conftest.[cs]
2848                  ])
2849   if test "$ac_cv_visibility_hidden" = "yes"; then
2850     AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2852     AC_CACHE_CHECK(for visibility(default) attribute,
2853                    ac_cv_visibility_default,
2854                    [cat > conftest.c <<EOF
2855                     int foo __attribute__ ((visibility ("default"))) = 1;
2857                     ac_cv_visibility_default=no
2858                     if ${CC-cc} -fvisibility=hidden -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_default=yes
2861                       fi
2862                     fi
2863                     rm -f conftest.[cs]
2864                    ])
2865     if test "$ac_cv_visibility_default" = "yes"; then
2866       AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2868       AC_CACHE_CHECK(for visibility pragma support,
2869                      ac_cv_visibility_pragma,
2870                      [cat > conftest.c <<EOF
2871 #pragma GCC visibility push(hidden)
2872                       int foo_hidden = 1;
2873 #pragma GCC visibility push(default)
2874                       int foo_default = 1;
2876                       ac_cv_visibility_pragma=no
2877                       if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2878                         if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2879                           if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2880                             ac_cv_visibility_pragma=yes
2881                           fi
2882                         fi
2883                       fi
2884                       rm -f conftest.[cs]
2885                     ])
2886       if test "$ac_cv_visibility_pragma" = "yes"; then
2887         AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2888                        ac_cv_have_visibility_class_bug,
2889                        [cat > conftest.c <<EOF
2890 #pragma GCC visibility push(hidden)
2891 struct __attribute__ ((visibility ("default"))) TestStruct {
2892   static void Init();
2894 __attribute__ ((visibility ("default"))) void TestFunc() {
2895   TestStruct::Init();
2898                        ac_cv_have_visibility_class_bug=no
2899                        if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2900                          ac_cv_have_visibility_class_bug=yes
2901                        else
2902                          if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2903                            ac_cv_have_visibility_class_bug=yes
2904                          fi
2905                        fi
2906                        rm -rf conftest.{c,S}
2907                        ])
2909         AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2910                        ac_cv_have_visibility_builtin_bug,
2911                        [cat > conftest.c <<EOF
2912 #pragma GCC visibility push(hidden)
2913 #pragma GCC visibility push(default)
2914 #include <string.h>
2915 #pragma GCC visibility pop
2917 __attribute__ ((visibility ("default"))) void Func() {
2918   char c[[100]];
2919   memset(c, 0, sizeof(c));
2922                        ac_cv_have_visibility_builtin_bug=no
2923                        if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2924                          ac_cv_have_visibility_builtin_bug=yes
2925                        else
2926                          if test `grep -c "@PLT" conftest.S` = 0; then
2927                            ac_cv_visibility_builtin_bug=yes
2928                          fi
2929                        fi
2930                        rm -f conftest.{c,S}
2931                        ])
2932         if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2933                 "$ac_cv_have_visibility_class_bug" = "no"; then
2934           VISIBILITY_FLAGS='-I$(DIST)/include/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2935           WRAP_SYSTEM_INCLUDES=1
2936         else
2937           VISIBILITY_FLAGS='-fvisibility=hidden'
2938         fi # have visibility pragma bug
2939       fi   # have visibility pragma
2940     fi     # have visibility(default) attribute
2941   fi       # have visibility(hidden) attribute
2942 fi         # GNU_CC
2944 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2945 AC_SUBST(VISIBILITY_FLAGS)
2947 dnl Checks for header files.
2948 dnl ========================================================
2949 AC_HEADER_DIRENT
2950 case "$target_os" in
2951 freebsd*)
2952 # for stuff like -lXshm
2953     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2954     ;;
2955 esac
2956 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
2957 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
2958 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
2959 AC_CHECK_HEADERS(malloc.h)
2960 AC_CHECK_HEADERS(X11/XKBlib.h)
2962 dnl These are all the places some variant of statfs can be hiding.
2963 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2965 dnl Try for MMX support
2966 dnl NB - later gcc versions require -mmmx for this header to be successfully
2967 dnl included (or another option which implies it, such as -march=pentium-mmx)
2968 AC_CHECK_HEADERS(mmintrin.h)
2970 dnl Check whether the compiler supports the new-style C++ standard
2971 dnl library headers (i.e. <new>) or needs the old "new.h"
2972 AC_LANG_CPLUSPLUS
2973 NEW_H=new.h
2974 AC_CHECK_HEADER(new, [NEW_H=new])
2975 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
2976 AC_LANG_C
2978 AC_ARG_ENABLE(dtrace,
2979               [  --enable-dtrace         build with dtrace support if available (default=no)],
2980               [enable_dtrace="yes"],)
2981 if test "x$enable_dtrace" = "xyes"; then
2982   AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
2983   if test -n "$HAVE_DTRACE"; then
2984       AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
2985   else
2986       AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
2987   fi
2989 AC_SUBST(HAVE_DTRACE)
2991 case $target in
2992 *-aix4.3*|*-aix5*)
2993         ;;
2995         AC_CHECK_HEADERS(sys/cdefs.h)
2996         ;;
2997 esac
2999 dnl Checks for libraries.
3000 dnl ========================================================
3001 case $target in
3002 *-hpux11.*)
3003         ;;
3005         AC_CHECK_LIB(c_r, gethostbyname_r)
3006         ;;
3007 esac
3009 dnl We don't want to link with libdl even if it's present on OS X, since
3010 dnl it's not used and not part of the default installation.
3011 dnl The same goes for BeOS.
3012 dnl We don't want to link against libm or libpthread on Darwin since
3013 dnl they both are just symlinks to libSystem and explicitly linking
3014 dnl against libSystem causes issues when debugging (see bug 299601).
3015 case $target in
3016 *-darwin*)
3017     ;;
3018 *-beos*)
3019     ;;
3021     AC_CHECK_LIB(m, atan)
3022     AC_CHECK_LIB(dl, dlopen,
3023     AC_CHECK_HEADER(dlfcn.h, 
3024         LIBS="-ldl $LIBS"
3025         AC_DEFINE(HAVE_LIBDL)))
3026     ;;
3027 esac
3029 _SAVE_CFLAGS="$CFLAGS"
3030 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3031 AC_CHECK_FUNCS(dladdr)
3032 CFLAGS="$_SAVE_CFLAGS"
3034 if test ! "$GNU_CXX"; then
3036     case $target in
3037     *-aix*)
3038         AC_CHECK_LIB(C_r, demangle)
3039         ;;
3040      *)
3041         AC_CHECK_LIB(C, demangle)
3042         ;;
3043      esac
3045 AC_CHECK_LIB(socket, socket)
3047 XLDFLAGS="$X_LIBS"
3048 XLIBS="$X_EXTRA_LIBS"
3050 dnl ========================================================
3051 dnl Checks for X libraries.
3052 dnl Ordering is important.
3053 dnl Xt is dependent upon SM as of X11R6
3054 dnl ========================================================
3055 if test "$no_x" = "yes"; then
3056     AC_DEFINE(NO_X11)
3057 else
3058     AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3059         XLIBS="-lX11 $XLIBS"
3060         _SAVE_LDFLAGS="$LDFLAGS"
3061         LDFLAGS="$XLDFLAGS $LDFLAGS"
3062         AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3063                 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3064         AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3065                 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3066    
3067      
3068         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3069         unset ac_cv_lib_Xt_XtFree
3070             AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3071             AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS) 
3072         AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3073                     [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3074         ])
3076     # AIX needs the motif library linked before libXt to prevent
3077     # crashes in plugins linked against Motif - Bug #98892
3078     case "${target_os}" in
3079     aix*)
3080         XT_LIBS="-lXm $XT_LIBS"
3081         ;;
3082     esac
3084     dnl ========================================================
3085     dnl = Check for XShm
3086     dnl ========================================================
3087     AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3088         $XLIBS $XEXT_LIBS)
3089     AC_CHECK_HEADER(X11/extensions/XShm.h)
3090     if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3091         test -n "$_HAVE_XSHM_XEXT"; then
3092         AC_DEFINE(HAVE_XSHM)
3093     fi
3095     dnl ========================================================
3096     dnl = Check for XIE
3097     dnl ========================================================
3098     AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3099         $XLIBS $XEXT_LIBS)
3100     AC_CHECK_HEADER(X11/extensions/XIElib.h)
3102     if test "$MOZ_XIE_LIBS"; then
3103         dnl ====================================================
3104         dnl = If XIE is present and is desired, turn it on
3105         dnl ====================================================
3106         case $target in
3107             *-hpux*)
3108                 ;;
3109             *)
3110                 HAVE_XIE=1
3111                 ;;
3112         esac
3113     fi
3115         LDFLAGS="$_SAVE_LDFLAGS"
3117     dnl ========================================================
3118     dnl = Check for freetype2 and its functionality
3119     dnl ========================================================
3120     AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3122     if test "$_HAVE_FREETYPE2"; then
3123         _SAVE_LIBS="$LIBS"
3124         _SAVE_CFLAGS="$CFLAGS"
3125         LIBS="$LIBS $FT2_LIBS"
3126         CFLAGS="$CFLAGS $FT2_CFLAGS"
3128         AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3129             ac_cv_member_FT_Bitmap_Size_y_ppem,
3130             [AC_TRY_COMPILE([#include <ft2build.h>
3131                              #include FT_FREETYPE_H],
3132                             [FT_Bitmap_Size s;
3133                              if (sizeof s.y_ppem) return 0;
3134                              return 1],
3135                             ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3136                             ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3137         if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3138             HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3139         else
3140             HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3141         fi
3142         AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3143                            $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3144                            [FT_Bitmap_Size structure includes y_ppem field])
3146         AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3148         LIBS="$_SAVE_LIBS"
3149         CFLAGS="$_SAVE_CFLAGS"
3150     fi
3152 fi # $no_x
3154 AC_SUBST(XCFLAGS)
3155 AC_SUBST(XLDFLAGS)
3156 AC_SUBST(XLIBS)
3157 AC_SUBST(XT_LIBS)
3159 dnl ========================================================
3160 dnl = pthread support
3161 dnl = Start by checking whether the system support pthreads
3162 dnl ========================================================
3163 case "$target_os" in
3164 darwin*)
3165     USE_PTHREADS=1
3166     ;;
3168     MOZ_CHECK_PTHREADS(pthreads,
3169         USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3170         MOZ_CHECK_PTHREADS(pthread,
3171             USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3172             MOZ_CHECK_PTHREADS(c_r,
3173                 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3174                 MOZ_CHECK_PTHREADS(c,
3175                     USE_PTHREADS=1
3176                 )
3177             )
3178         )
3179     )
3180     ;;
3181 esac
3183 dnl ========================================================
3184 dnl Check the command line for --with-pthreads 
3185 dnl ========================================================
3186 MOZ_ARG_WITH_BOOL(pthreads,
3187 [  --with-pthreads         Force use of system pthread library with NSPR ],
3188 [ if test "$USE_PTHREADS"x = x; then
3189     AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3190 fi],
3191     USE_PTHREADS=
3192     _PTHREAD_LDFLAGS=
3195 dnl ========================================================
3196 dnl Do the platform specific pthread hackery
3197 dnl ========================================================
3198 if test "$USE_PTHREADS"x != x
3199 then
3200         dnl
3201         dnl See if -pthread is supported.
3202         dnl
3203         rm -f conftest*
3204         ac_cv_have_dash_pthread=no
3205         AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3206         echo 'int main() { return 0; }' | cat > conftest.c
3207         ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3208         if test $? -eq 0; then
3209                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3210                         ac_cv_have_dash_pthread=yes
3211                 case "$target_os" in
3212                 freebsd*)
3213 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3214                 ;;
3215                 *)
3216                             CFLAGS="$CFLAGS -pthread"
3217                             CXXFLAGS="$CXXFLAGS -pthread"
3218                 ;;
3219                 esac
3220                 fi
3221         fi
3222         rm -f conftest*
3223     AC_MSG_RESULT($ac_cv_have_dash_pthread)
3225         dnl
3226         dnl See if -pthreads is supported.
3227         dnl
3228     ac_cv_have_dash_pthreads=no
3229     if test "$ac_cv_have_dash_pthread" = "no"; then
3230             AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3231         echo 'int main() { return 0; }' | cat > conftest.c
3232             ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3233         if test $? -eq 0; then
3234                 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3235                             ac_cv_have_dash_pthreads=yes
3236                             CFLAGS="$CFLAGS -pthreads"
3237                             CXXFLAGS="$CXXFLAGS -pthreads"
3238                     fi
3239             fi
3240             rm -f conftest*
3241         AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3242     fi
3244         case "$target" in
3245             *-*-freebsd*)
3246                         AC_DEFINE(_REENTRANT)
3247                         AC_DEFINE(_THREAD_SAFE)
3248                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3249                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3250                                 _PTHREAD_LDFLAGS="-pthread"
3251                         else
3252                                 _PTHREAD_LDFLAGS="-lc_r"
3253                         fi
3254                         ;;
3256             *-*-openbsd*|*-*-bsdi*)
3257                         AC_DEFINE(_REENTRANT)
3258                         AC_DEFINE(_THREAD_SAFE)
3259                         dnl -pthread links in -lc_r, so don't specify it explicitly.
3260                         if test "$ac_cv_have_dash_pthread" = "yes"; then
3261                 _PTHREAD_LDFLAGS="-pthread"
3262                         fi
3263                         ;;
3265             *-*-linux*|*-*-kfreebsd*-gnu)
3266                         AC_DEFINE(_REENTRANT) 
3267                         ;;
3269             *-*-nto*) 
3270                         AC_DEFINE(_REENTRANT) 
3271                         ;;
3273             *-aix4.3*|*-aix5*)
3274                         AC_DEFINE(_REENTRANT) 
3275                         ;;
3277             *-hpux11.*)
3278                         AC_DEFINE(_REENTRANT) 
3279                         ;;
3281             alpha*-*-osf*)
3282                         AC_DEFINE(_REENTRANT)
3283                         ;;
3285             *-*-solaris*) 
3286                         AC_DEFINE(_REENTRANT) 
3287                         if test ! "$GNU_CC"; then
3288                                 CFLAGS="$CFLAGS -mt" 
3289                                 CXXFLAGS="$CXXFLAGS -mt" 
3290                         fi
3291                         ;;
3292         esac
3293     LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3296 dnl ========================================================
3297 dnl See if mmap sees writes
3298 dnl For cross compiling, just define it as no, which is a safe default
3299 dnl ========================================================
3300 AC_MSG_CHECKING(whether mmap() sees write()s)
3302 changequote(,)
3303 mmap_test_prog='
3304     #include <stdlib.h>
3305     #include <unistd.h>
3306     #include <sys/mman.h>
3307     #include <sys/types.h>
3308     #include <sys/stat.h>
3309     #include <fcntl.h>
3311     char fname[] = "conftest.file";
3312     char zbuff[1024]; /* Fractional page is probably worst case */
3314     int main() {
3315         char *map;
3316         int fd;
3317         int i;
3318         unlink(fname);
3319         fd = open(fname, O_RDWR | O_CREAT, 0660);
3320         if(fd<0) return 1;
3321         unlink(fname);
3322         write(fd, zbuff, sizeof(zbuff));
3323         lseek(fd, 0, SEEK_SET);
3324         map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3325         if(map==(char*)-1) return 2;
3326         for(i=0; fname[i]; i++) {
3327             int rc = write(fd, &fname[i], 1);
3328             if(map[i]!=fname[i]) return 4;
3329         }
3330         return 0;
3331     }
3333 changequote([,])
3335 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3337 AC_MSG_RESULT("$result")
3339 if test "$result" = "no"; then
3340     AC_DEFINE(MMAP_MISSES_WRITES)
3344 dnl Checks for library functions.
3345 dnl ========================================================
3346 AC_PROG_GCC_TRADITIONAL
3347 AC_FUNC_MEMCMP
3348 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64)
3349 AC_CHECK_FUNCS(flockfile getpagesize)
3351 dnl localtime_r and strtok_r are only present on MacOS version 10.2 and higher
3352 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100200"; then
3353   AC_CHECK_FUNCS(localtime_r strtok_r)
3356 dnl check for wcrtomb/mbrtowc
3357 dnl =======================================================================
3358 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3359 AC_LANG_SAVE
3360 AC_LANG_CPLUSPLUS
3361 AC_CACHE_CHECK(for wcrtomb,
3362     ac_cv_have_wcrtomb,
3363     [AC_TRY_LINK([#include <wchar.h>],
3364                  [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3365                  ac_cv_have_wcrtomb="yes",
3366                  ac_cv_have_wcrtomb="no")])
3367 if test "$ac_cv_have_wcrtomb" = "yes"; then
3368     AC_DEFINE(HAVE_WCRTOMB)
3370 AC_CACHE_CHECK(for mbrtowc,
3371     ac_cv_have_mbrtowc,
3372     [AC_TRY_LINK([#include <wchar.h>],
3373                  [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3374                  ac_cv_have_mbrtowc="yes",
3375                  ac_cv_have_mbrtowc="no")])
3376 if test "$ac_cv_have_mbrtowc" = "yes"; then
3377     AC_DEFINE(HAVE_MBRTOWC)
3379 AC_LANG_RESTORE
3382 AC_CACHE_CHECK(
3383     [for res_ninit()],
3384     ac_cv_func_res_ninit,
3385     [AC_TRY_LINK([
3386         #ifdef linux
3387         #define _BSD_SOURCE 1
3388         #endif
3389         #include <resolv.h>
3390         ],
3391         [int foo = res_ninit(&_res);],
3392         [ac_cv_func_res_ninit=yes],
3393         [ac_cv_func_res_ninit=no])
3394     ])
3396 if test "$ac_cv_func_res_ninit" = "yes"; then
3397     AC_DEFINE(HAVE_RES_NINIT)
3398 dnl must add the link line we do something as foolish as this... dougt
3399 dnl else
3400 dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3401 dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3404 AC_LANG_CPLUSPLUS
3405 AC_CACHE_CHECK(
3406     [for gnu_get_libc_version()],
3407     ac_cv_func_gnu_get_libc_version,
3408     [AC_TRY_LINK([
3409         #ifdef HAVE_GNU_LIBC_VERSION_H
3410         #include <gnu/libc-version.h>
3411         #endif
3412         ],
3413         [const char *glibc_version = gnu_get_libc_version();],
3414         [ac_cv_func_gnu_get_libc_version=yes],
3415         [ac_cv_func_gnu_get_libc_version=no] 
3416         )]
3417     )
3419 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3420     AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3423 case $target_os in
3424     os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|beos*)
3425         ;;
3426     *)
3427     
3428 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3429     AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3430         AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3431 _SAVE_LIBS=$LIBS
3432 LIBS="$LIBS $_ICONV_LIBS"
3433 AC_CACHE_CHECK(
3434     [for iconv()],
3435     ac_cv_func_iconv,
3436     [AC_TRY_LINK([
3437         #include <stdlib.h>
3438         #include <iconv.h>
3439         ],
3440         [
3441             iconv_t h = iconv_open("", "");
3442             iconv(h, NULL, NULL, NULL, NULL);
3443             iconv_close(h);
3444         ],
3445         [ac_cv_func_iconv=yes],
3446         [ac_cv_func_iconv=no] 
3447         )]
3448     )
3449 if test "$ac_cv_func_iconv" = "yes"; then
3450     AC_DEFINE(HAVE_ICONV)
3451     DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3452     LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3453     LIBICONV="$_ICONV_LIBS"
3454     AC_CACHE_CHECK(
3455         [for iconv() with const input],
3456         ac_cv_func_const_iconv,
3457         [AC_TRY_COMPILE([
3458             #include <stdlib.h>
3459             #include <iconv.h>
3460             ],
3461             [
3462                 const char *input = "testing";
3463                 iconv_t h = iconv_open("", "");
3464                 iconv(h, &input, NULL, NULL, NULL);
3465                 iconv_close(h);
3466             ],
3467             [ac_cv_func_const_iconv=yes],
3468             [ac_cv_func_const_iconv=no] 
3469             )]
3470         )
3471     if test "$ac_cv_func_const_iconv" = "yes"; then
3472         AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3473     fi
3475 LIBS=$_SAVE_LIBS
3477     ;;
3478 esac
3480 AM_LANGINFO_CODESET
3482 AC_LANG_C
3484 dnl **********************
3485 dnl *** va_copy checks ***
3486 dnl **********************
3487 dnl we currently check for all three va_copy possibilities, so we get
3488 dnl all results in config.log for bug reports.
3489 AC_MSG_CHECKING(for an implementation of va_copy())
3490 AC_CACHE_VAL(ac_cv_va_copy,[
3491     AC_TRY_RUN([
3492         #include <stdarg.h>
3493         void f (int i, ...) {
3494             va_list args1, args2;
3495             va_start (args1, i);
3496             va_copy (args2, args1);
3497             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3498                 exit (1);
3499             va_end (args1); va_end (args2);
3500         }
3501         int main() { f (0, 42); return 0; }],
3502         ac_cv_va_copy=yes,
3503         ac_cv_va_copy=no,
3504         ac_cv_va_copy=no
3505     )
3507 AC_MSG_RESULT($ac_cv_va_copy)
3508 AC_MSG_CHECKING(for an implementation of __va_copy())
3509 AC_CACHE_VAL(ac_cv___va_copy,[
3510     AC_TRY_RUN([
3511         #include <stdarg.h>
3512         void f (int i, ...) {
3513             va_list args1, args2;
3514             va_start (args1, i);
3515             __va_copy (args2, args1);
3516             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3517                 exit (1);
3518             va_end (args1); va_end (args2);
3519         }
3520         int main() { f (0, 42); return 0; }],
3521         ac_cv___va_copy=yes,
3522         ac_cv___va_copy=no,
3523         ac_cv___va_copy=no
3524     )
3526 AC_MSG_RESULT($ac_cv___va_copy)
3527 AC_MSG_CHECKING(whether va_lists can be copied by value)
3528 AC_CACHE_VAL(ac_cv_va_val_copy,[
3529     AC_TRY_RUN([
3530         #include <stdarg.h>
3531         void f (int i, ...) {
3532             va_list args1, args2;
3533             va_start (args1, i);
3534             args2 = args1;
3535             if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3536                 exit (1);
3537             va_end (args1); va_end (args2);
3538         }
3539         int main() { f (0, 42); return 0; }],
3540         ac_cv_va_val_copy=yes,
3541         ac_cv_va_val_copy=no,
3542         ac_cv_va_val_copy=yes
3543     )
3545 if test "x$ac_cv_va_copy" = "xyes"; then
3546     AC_DEFINE(VA_COPY, va_copy)
3547     AC_DEFINE(HAVE_VA_COPY)
3548 elif test "x$ac_cv___va_copy" = "xyes"; then
3549     AC_DEFINE(VA_COPY, __va_copy)
3550     AC_DEFINE(HAVE_VA_COPY)
3553 if test "x$ac_cv_va_val_copy" = "xno"; then
3554    AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3556 AC_MSG_RESULT($ac_cv_va_val_copy)
3558 dnl Check for dll-challenged libc's.
3559 dnl This check is apparently only needed for Linux.
3560 case "$target" in
3561         *-linux*)
3562             dnl ===================================================================
3563             _curdir=`pwd`
3564             export _curdir
3565             rm -rf conftest* _conftest
3566             mkdir _conftest
3567             cat >> conftest.C <<\EOF
3568 #include <stdio.h>
3569 #include <link.h>
3570 #include <dlfcn.h>
3571 #ifdef _dl_loaded
3572 void __dump_link_map(void) {
3573   struct link_map *map = _dl_loaded;
3574   while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
3576 int main() {
3577   dlopen("./conftest1.so",RTLD_LAZY);
3578   dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
3579   dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
3580   dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
3581   __dump_link_map();
3583 #else
3584 /* _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).*/
3585 int main() { printf("./conftest1.so\n"); }
3586 #endif
3589             $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
3591             cat >> conftest1.C <<\EOF
3592 #include <stdio.h>
3593 void foo(void) {printf("foo in dll called\n");}
3595             ${CXX-g++} -fPIC -c -g conftest1.C
3596             ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
3597             ${CXX-g++} -g conftest.C -o conftest -ldl
3598             cp -f conftest1.so conftest _conftest
3599             cd _conftest
3600             if test `./conftest | grep conftest1.so | wc -l` -gt 1
3601             then
3602                 echo
3603                 echo "*** Your libc has a bug that can result in loading the same dynamic"
3604                 echo "*** library multiple times.  This bug is known to be fixed in glibc-2.0.7-32"
3605                 echo "*** or later.  However, if you choose not to upgrade, the only effect"
3606                 echo "*** will be excessive memory usage at runtime."
3607                 echo
3608             fi
3609             cd ${_curdir}
3610             rm -rf conftest* _conftest
3611             dnl ===================================================================
3612             ;;
3613 esac
3615 dnl ===================================================================
3616 dnl ========================================================
3617 dnl By default, turn rtti and exceptions off on g++/egcs
3618 dnl ========================================================
3619 if test "$GNU_CXX"; then
3621   AC_MSG_CHECKING(for C++ exceptions flag)
3623   dnl They changed -f[no-]handle-exceptions to -f[no-]exceptions in g++ 2.8
3624   AC_CACHE_VAL(ac_cv_cxx_exceptions_flags,
3625   [echo "int main() { return 0; }" | cat > conftest.C
3627   ${CXX-g++} ${CXXFLAGS} -c -fno-handle-exceptions conftest.C > conftest.out 2>&1
3629   if egrep "warning.*renamed" conftest.out >/dev/null; then
3630     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions
3631   else
3632     ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-handle-exceptions
3633   fi
3635   rm -f conftest*])
3637   AC_MSG_RESULT($ac_cv_cxx_exceptions_flags)
3638   _MOZ_EXCEPTIONS_FLAGS_OFF=$ac_cv_cxx_exceptions_flags
3639   _MOZ_EXCEPTIONS_FLAGS_ON=`echo $ac_cv_cxx_exceptions_flags | sed 's|no-||'`
3642 dnl ========================================================
3643 dnl Put your C++ language/feature checks below
3644 dnl ========================================================
3645 AC_LANG_CPLUSPLUS
3647 HAVE_GCC3_ABI=
3648 if test "$GNU_CC"; then
3649   AC_CACHE_CHECK(for gcc 3.0 ABI,
3650       ac_cv_gcc_three_abi,
3651       [AC_TRY_COMPILE([],
3652                       [
3653 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
3654   return 0;
3655 #else
3656 #error Not gcc3.
3657 #endif
3658                       ],
3659                       ac_cv_gcc_three_abi="yes",
3660                       ac_cv_gcc_three_abi="no")])
3661   if test "$ac_cv_gcc_three_abi" = "yes"; then
3662       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc3}"
3663       HAVE_GCC3_ABI=1
3664   else
3665       TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc2}"
3666   fi
3668 AC_SUBST(HAVE_GCC3_ABI)
3671 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
3672                ac_cv_cpp_explicit,
3673                [AC_TRY_COMPILE(class X {
3674                                public: explicit X(int i) : i_(i) {}
3675                                private: int i_;
3676                                };,
3677                                X x(3);,
3678                                ac_cv_cpp_explicit=yes,
3679                                ac_cv_cpp_explicit=no)])
3680 if test "$ac_cv_cpp_explicit" = yes ; then
3681    AC_DEFINE(HAVE_CPP_EXPLICIT)
3684 AC_CACHE_CHECK(for C++ \"typename\" keyword,
3685                ac_cv_cpp_typename,
3686                [AC_TRY_COMPILE(class param {
3687                                public:
3688                                    typedef unsigned long num_type;
3689                                };
3691                                template <class T> class tplt {
3692                                public:
3693                                    typedef typename T::num_type t_num_type;
3694                                    t_num_type foo(typename T::num_type num) {
3695                                        return num;
3696                                    }
3697                                };,
3698                                tplt<param> A;
3699                                A.foo(0);,
3700                                ac_cv_cpp_typename=yes,
3701                                ac_cv_cpp_typename=no)])
3702 if test "$ac_cv_cpp_typename" = yes ; then
3703    AC_DEFINE(HAVE_CPP_TYPENAME)
3706 dnl Check for support of modern template specialization syntax
3707 dnl Test code and requirement from scc@netscape.com.
3708 dnl Autoconf cut-and-paste job by waterson@netscape.com
3709 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3710                ac_cv_cpp_modern_specialize_template_syntax,
3711                [AC_TRY_COMPILE(template <class T> struct X { int a; };
3712                                class Y {};
3713                                template <> struct X<Y> { double a; };,
3714                                X<int> int_x;
3715                                X<Y> y_x;,
3716                                ac_cv_cpp_modern_specialize_template_syntax=yes,
3717                                ac_cv_cpp_modern_specialize_template_syntax=no)])
3718 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
3719   AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
3723 dnl Some compilers support only full specialization, and some don't.
3724 AC_CACHE_CHECK(whether partial template specialization works,
3725                ac_cv_cpp_partial_specialization,
3726                [AC_TRY_COMPILE(template <class T> class Foo {};
3727                                template <class T> class Foo<T*> {};,
3728                                return 0;,
3729                                ac_cv_cpp_partial_specialization=yes,
3730                                ac_cv_cpp_partial_specialization=no)])
3731 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3732   AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3735 dnl Some compilers have limited support for operators with templates;
3736 dnl specifically, it is necessary to define derived operators when a base
3737 dnl class's operator declaration should suffice.
3738 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
3739                ac_cv_need_derived_template_operators,
3740                [AC_TRY_COMPILE([template <class T> class Base { };
3741                                 template <class T>
3742                                 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
3743                                 template <class T> class Derived : public Base<T> { };],
3744                                [Derived<char> a, b;
3745                                 Base<char> c = a + b;
3746                                 return 0;],
3747                                ac_cv_need_derived_template_operators=no,
3748                                ac_cv_need_derived_template_operators=yes)])
3749 if test "$ac_cv_need_derived_template_operators" = yes ; then
3750   AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
3754 dnl Some compilers have trouble detecting that a template class
3755 dnl that derives from another template is actually an instance
3756 dnl of the base class. This test checks for that.
3757 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
3758                ac_cv_need_cpp_template_cast_to_base,
3759                [AC_TRY_COMPILE([template <class T> class Base { };
3760                                 template <class T> class Derived : public Base<T> { };
3761                                 template <class T> int foo(const Base<T>&) { return 0; }],
3762                                [Derived<char> bar; return foo(bar);],
3763                                ac_cv_need_cpp_template_cast_to_base=no,
3764                                ac_cv_need_cpp_template_cast_to_base=yes)])
3765 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
3766   AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
3769 dnl Some compilers have trouble resolving the ambiguity between two
3770 dnl functions whose arguments differ only by cv-qualifications.
3771 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
3772                ac_cv_can_resolve_const_ambiguity,
3773                [AC_TRY_COMPILE([
3774                                 template <class T> class ptrClass {
3775                                   public: T* ptr;
3776                                 };
3778                                 template <class T> T* a(ptrClass<T> *arg) {
3779                                   return arg->ptr;
3780                                 }
3782                                 template <class T>
3783                                 const T* a(const ptrClass<T> *arg) {
3784                                   return arg->ptr;
3785                                 }
3786                                ],
3787                                [ ptrClass<int> i;
3788                                  a(&i); ],
3789                                ac_cv_can_resolve_const_ambiguity=yes,
3790                                ac_cv_can_resolve_const_ambiguity=no)])
3791 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
3792   AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
3796 dnl We don't do exceptions on unix.  The only reason this used to be here
3797 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses 
3798 dnl exceptions.  But, we turn exceptions off by default and this test breaks.
3799 dnl So im commenting this out until someone writes some artificial 
3800 dnl intelligence to detect not only if the compiler has exceptions, but if 
3801 dnl they are enabled as well.
3802 dnl 
3803 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
3804 dnl                ac_cv_cpp_exceptions,
3805 dnl                [AC_TRY_COMPILE(class X { public: X() {} };
3806 dnl                                static void F() { throw X(); },
3807 dnl                                try { F(); } catch(X & e) { },
3808 dnl                                ac_cv_cpp_exceptions=yes,
3809 dnl                                ac_cv_cpp_exceptions=no)])
3810 dnl if test $ac_cv_cpp_exceptions = yes ; then
3811 dnl    AC_DEFINE(HAVE_CPP_EXCEPTIONS)
3812 dnl fi
3814 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
3815 dnl supports it well enough to allow us to use it to change access, but not
3816 dnl to resolve ambiguity. The next two tests determine how well the |using|
3817 dnl keyword is supported.
3819 dnl Check to see if we can change access with |using|.  Test both a
3820 dnl legal and an illegal example.
3821 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
3822                ac_cv_cpp_access_changing_using2,
3823                [AC_TRY_COMPILE(
3824                    class A { protected: int foo() { return 0; } };
3825                    class B : public A { public: using A::foo; };,
3826                    B b; return b.foo();,
3827                    [AC_TRY_COMPILE(
3828                        class A { public: int foo() { return 1; } };
3829                        class B : public A { private: using A::foo; };,
3830                        B b; return b.foo();,
3831                        ac_cv_cpp_access_changing_using2=no,
3832                        ac_cv_cpp_access_changing_using2=yes)],
3833                    ac_cv_cpp_access_changing_using2=no)])
3834 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
3835    AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
3838 dnl Check to see if we can resolve ambiguity with |using|.
3839 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3840                ac_cv_cpp_ambiguity_resolving_using,
3841                [AC_TRY_COMPILE(class X { 
3842                                  public: int go(const X&) {return 3;}
3843                                          int jo(const X&) {return 3;}
3844                                };
3845                                class Y : public X {
3846                                  public:  int go(int) {return 2;}
3847                                           int jo(int) {return 2;}
3848                                           using X::jo;
3849                                  private: using X::go;
3850                                };,
3851                                X x; Y y; y.jo(x);,
3852                                ac_cv_cpp_ambiguity_resolving_using=yes,
3853                                ac_cv_cpp_ambiguity_resolving_using=no)])
3854 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3855    AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3858 dnl Check to see if the |std| namespace is supported. If so, we'll want
3859 dnl to qualify any standard library calls with "std::" to ensure that
3860 dnl those functions can be resolved.
3861 AC_CACHE_CHECK(for \"std::\" namespace,
3862                ac_cv_cpp_namespace_std,
3863                [AC_TRY_COMPILE([#include <algorithm>],
3864                                [return std::min(0, 1);],
3865                                ac_cv_cpp_namespace_std=yes,
3866                                ac_cv_cpp_namespace_std=no)])
3867 if test "$ac_cv_cpp_namespace_std" = yes ; then
3868    AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
3871 dnl Older compilers are overly ambitious with respect to using the standard
3872 dnl template library's |operator!=()| when |operator==()| is defined. In
3873 dnl which case, defining |operator!=()| in addition to |operator==()| causes
3874 dnl ambiguity at compile-time. This test checks for that case.
3875 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
3876                ac_cv_cpp_unambiguous_std_notequal,
3877                [AC_TRY_COMPILE([#include <algorithm>
3878                                 struct T1 {};
3879                                 int operator==(const T1&, const T1&) { return 0; }
3880                                 int operator!=(const T1&, const T1&) { return 0; }],
3881                                [T1 a,b; return a != b;],
3882                                ac_cv_cpp_unambiguous_std_notequal=unambiguous,
3883                                ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
3884 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
3885   AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
3889 AC_CACHE_CHECK(for C++ reinterpret_cast,
3890                ac_cv_cpp_reinterpret_cast,
3891                [AC_TRY_COMPILE(struct X { int i; };
3892                                struct Y { int i; };,
3893                                X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
3894                                ac_cv_cpp_reinterpret_cast=yes,
3895                                ac_cv_cpp_reinterpret_cast=no)])
3896 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
3897    AC_DEFINE(HAVE_CPP_NEW_CASTS)
3900 dnl See if a dynamic_cast to void* gives the most derived object.
3901 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3902                ac_cv_cpp_dynamic_cast_void_ptr,
3903                [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3904                             class Y { int j; public: virtual ~Y() { } };
3905                             class Z : public X, public Y { int k; };
3907                             int main() {
3908                                  Z mdo;
3909                                  X *subx = (X*)&mdo;
3910                                  Y *suby = (Y*)&mdo;
3911                                  return !((((void*)&mdo != (void*)subx) &&
3912                                            ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3913                                           (((void*)&mdo != (void*)suby) &&
3914                                            ((void*)&mdo == dynamic_cast<void*>(suby))));
3915                             }],
3916                            ac_cv_cpp_dynamic_cast_void_ptr=yes,
3917                            ac_cv_cpp_dynamic_cast_void_ptr=no,
3918                            ac_cv_cpp_dynamic_cast_void_ptr=no)])
3919 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3920    AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3924 dnl note that this one is reversed - if the test fails, then
3925 dnl we require implementations of unused virtual methods. Which
3926 dnl really blows because it means we'll have useless vtable
3927 dnl bloat.
3928 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3929                ac_cv_cpp_unused_required,
3930                [AC_TRY_LINK(class X {private: virtual void never_called();};,
3931                                X x;,
3932                                ac_cv_cpp_unused_required=no,
3933                                ac_cv_cpp_unused_required=yes)])
3934 if test "$ac_cv_cpp_unused_required" = yes ; then
3935    AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3939 dnl Some compilers have trouble comparing a constant reference to a templatized
3940 dnl class to zero, and require an explicit operator==() to be defined that takes
3941 dnl an int. This test separates the strong from the weak.
3943 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3944                ac_cv_trouble_comparing_to_zero,
3945                [AC_TRY_COMPILE([#include <algorithm>
3946                                 template <class T> class Foo {};
3947                                 class T2;
3948                                 template <class T> int operator==(const T2*, const T&) { return 0; }
3949                                 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3950                                [Foo<int> f; return (0 != f);],
3951                                ac_cv_trouble_comparing_to_zero=no,
3952                                ac_cv_trouble_comparing_to_zero=yes)])
3953 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3954   AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3959 dnl End of C++ language/feature checks
3960 AC_LANG_C
3962 dnl ========================================================
3963 dnl =  Internationalization checks
3964 dnl ========================================================
3966 dnl Internationalization and Locale support is different
3967 dnl on various UNIX platforms.  Checks for specific i18n
3968 dnl features go here.
3970 dnl check for LC_MESSAGES
3971 AC_CACHE_CHECK(for LC_MESSAGES,
3972                 ac_cv_i18n_lc_messages,
3973                 [AC_TRY_COMPILE([#include <locale.h>],
3974                                 [int category = LC_MESSAGES;],
3975                                 ac_cv_i18n_lc_messages=yes,
3976                                 ac_cv_i18n_lc_messages=no)])
3977 if test "$ac_cv_i18n_lc_messages" = yes; then
3978    AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3979 fi      
3981 fi # SKIP_COMPILER_CHECKS
3983 TARGET_XPCOM_ABI=
3984 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3985     TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3988 dnl Mozilla specific options
3989 dnl ========================================================
3990 dnl The macros used for command line options
3991 dnl are defined in build/autoconf/altoptions.m4.
3994 dnl ========================================================
3995 dnl =
3996 dnl = Check for external package dependencies
3997 dnl =
3998 dnl ========================================================
3999 MOZ_ARG_HEADER(External Packages)
4001 MOZ_ENABLE_LIBXUL=
4003 MOZ_ARG_WITH_STRING(libxul-sdk,
4004 [  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
4005   LIBXUL_SDK_DIR=$withval)
4007 if test "$LIBXUL_SDK_DIR" = "yes"; then
4008     AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4009 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4010     LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4012     if test ! -f "$LIBXUL_SDK/sdk/include/xpcom-config.h"; then
4013         AC_MSG_ERROR([$LIBXUL_SDK/sdk/include/xpcom-config.h doesn't exist])
4014     fi
4016     MOZ_ENABLE_LIBXUL=1
4018 AC_SUBST(LIBXUL_SDK)
4020 dnl ========================================================
4021 dnl = If NSPR was not detected in the system, 
4022 dnl = use the one in the source tree (mozilla/nsprpub)
4023 dnl ========================================================
4024 MOZ_ARG_WITH_BOOL(system-nspr,
4025 [  --with-system-nspr      Use system installed NSPR],
4026     _USE_SYSTEM_NSPR=1 )
4028 if test -n "$_USE_SYSTEM_NSPR"; then
4029     AM_PATH_NSPR(4.7.0, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
4032 if test -n "$MOZ_NATIVE_NSPR"; then
4033     _SAVE_CFLAGS=$CFLAGS
4034     CFLAGS="$CFLAGS $NSPR_CFLAGS"
4035     AC_TRY_COMPILE([#include "prlog.h"],
4036                 [#ifndef PR_STATIC_ASSERT
4037                  #error PR_STATIC_ASSERT not defined
4038                  #endif],
4039                 [MOZ_NATIVE_NSPR=1],
4040                 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
4041     CFLAGS=$_SAVE_CFLAGS
4042 else
4043     NSPR_CFLAGS='`$(DEPTH)/nsprpub/config/nspr-config --prefix=$(LIBXUL_DIST) --includedir=$(LIBXUL_DIST)/include/nspr --cflags`'
4044     # explicitly set libs for Visual Age C++ for OS/2
4045     if test "$OS_ARCH" = "OS2" -a "$VACPP" = "yes"; then
4046         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''
4047     elif test "$OS_ARCH" = "WINCE"; then
4048         NSPR_CFLAGS='-I$(LIBXUL_DIST)/include/nspr'
4049         NSPR_LIBS='$(LIBXUL_DIST)/lib/nspr'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plc'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plds'$NSPR_VERSION'.lib '
4050     elif test "$OS_ARCH" = "WINNT"; then
4051         NSPR_CFLAGS='-I$(LIBXUL_DIST)/include/nspr'
4052         if test -n "$GNU_CC"; then
4053             NSPR_LIBS="-L\$(LIBXUL_DIST)/lib -lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION"
4054         else
4055             NSPR_LIBS='$(LIBXUL_DIST)/lib/nspr'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plc'$NSPR_VERSION'.lib $(LIBXUL_DIST)/lib/plds'$NSPR_VERSION'.lib '
4056         fi
4057     else
4058         NSPR_LIBS='`$(DEPTH)/nsprpub/config/nspr-config --prefix=$(LIBXUL_DIST) --libdir=$(LIBXUL_DIST)/lib --libs`'
4059     fi
4062 dnl ========================================================
4063 dnl = If NSS was not detected in the system, 
4064 dnl = use the one in the source tree (mozilla/security/nss)
4065 dnl ========================================================
4067 MOZ_ARG_WITH_BOOL(system-nss,
4068 [  --with-system-nss      Use system installed NSS],
4069     _USE_SYSTEM_NSS=1 )
4071 if test -n "$_USE_SYSTEM_NSS"; then
4072     AM_PATH_NSS(3.12.0, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4075 if test -n "$MOZ_NATIVE_NSS"; then
4076    NSS_LIBS="$NSS_LIBS -lcrmf"
4077 else
4078    NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4079    NSS_DEP_LIBS="\
4080         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4081         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4082         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4083         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4084         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX) \
4085         \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)softokn$NSS_VERSION\$(DLL_SUFFIX)"
4087    if test -z "$GNU_CC" && test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4088        NSS_LIBS="\
4089         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4090         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4091         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4092         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4093         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4094         \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)softokn$NSS_VERSION.\$(IMPORT_LIB_SUFFIX)"
4095    else
4096        NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION -lsoftokn$NSS_VERSION"
4097    fi
4100 if test -z "$SKIP_LIBRARY_CHECKS"; then
4101 dnl system JPEG support
4102 dnl ========================================================
4103 MOZ_ARG_WITH_STRING(system-jpeg,
4104 [  --with-system-jpeg[=PFX]
4105                           Use system libjpeg [installed at prefix PFX]],
4106     JPEG_DIR=$withval)
4108 _SAVE_CFLAGS=$CFLAGS
4109 _SAVE_LDFLAGS=$LDFLAGS
4110 _SAVE_LIBS=$LIBS
4111 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4112     CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4113     LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4115 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4116     SYSTEM_JPEG=
4117 else
4118     AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4121 if test "$SYSTEM_JPEG" = 1; then
4122     LIBS="$JPEG_LIBS $LIBS"
4123     AC_TRY_COMPILE([ #include <stdio.h>
4124                      #include <sys/types.h>
4125                      #include <jpeglib.h> ],
4126                    [ #if JPEG_LIB_VERSION < $MOZJPEG
4127                      #error "Insufficient JPEG library version ($MOZJPEG required)."
4128                      #endif ],
4129                    SYSTEM_JPEG=1,
4130                    [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=]) 
4131 fi 
4132 CFLAGS=$_SAVE_CFLAGS
4133 LDFLAGS=$_SAVE_LDFLAGS
4134 LIBS=$_SAVE_LIBS
4136 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4137     JPEG_CFLAGS="-I${JPEG_DIR}/include"
4138     JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4141 dnl system ZLIB support
4142 dnl ========================================================
4143 MOZ_ARG_WITH_STRING(system-zlib,
4144 [  --with-system-zlib[=PFX]
4145                           Use system libz [installed at prefix PFX]],
4146     ZLIB_DIR=$withval)
4148 _SAVE_CFLAGS=$CFLAGS
4149 _SAVE_LDFLAGS=$LDFLAGS
4150 _SAVE_LIBS=$LIBS
4151 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4152     CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4153     LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4155 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4156     SYSTEM_ZLIB=
4157 else
4158     AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"], 
4159         [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4161 if test "$SYSTEM_ZLIB" = 1; then
4162     LIBS="$ZLIB_LIBS $LIBS"
4163     AC_TRY_COMPILE([ #include <stdio.h>
4164                      #include <string.h>
4165                      #include <zlib.h> ],
4166                    [ #if ZLIB_VERNUM < $MOZZLIB 
4167                      #error "Insufficient zlib version ($MOZZLIB required)."
4168                      #endif ],
4169                    SYSTEM_ZLIB=1,
4170                    [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=]) 
4172 CFLAGS=$_SAVE_CFLAGS
4173 LDFLAGS=$_SAVE_LDFLAGS
4174 LIBS=$_SAVE_LIBS
4176 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4177     ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4178     ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4181 dnl system BZIP2 Support
4182 dnl ========================================================
4183 MOZ_ARG_WITH_STRING(system-bz2,
4184 [  --with-system-bz2[=PFX]
4185                           Use system libbz2 [installed at prefix PFX]],
4186     BZ2_DIR=$withval)
4188 _SAVE_CFLAGS=$CFLAGS
4189 _SAVE_LDFLAGS=$LDFLAGS
4190 _SAVE_LIBS=$LIBS
4191 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4192     CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4193     LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4195 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4196     SYSTEM_BZ2=
4197 else
4198     AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4199         [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=], $BZ2_LIBS)
4201 CFLAGS=$_SAVE_CFLAGS
4202 LDFLAGS=$_SAVE_LDFLAGS
4203 LIBS=$_SAVE_LIBS
4205 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4206     BZ2_CFLAGS="-I${BZ2_DIR}/include"
4207     BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4210 dnl system PNG Support
4211 dnl ========================================================
4212 MOZ_ARG_WITH_STRING(system-png, 
4213 [  --with-system-png[=PFX]
4214                           Use system libpng [installed at prefix PFX]],
4215     PNG_DIR=$withval)
4217 _SAVE_CFLAGS=$CFLAGS
4218 _SAVE_LDFLAGS=$LDFLAGS
4219 _SAVE_LIBS=$LIBS
4220 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4221 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4222 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4223     CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4224     LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4226 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4227     SYSTEM_PNG=
4228 else
4229     _SAVE_PNG_LIBS=$PNG_LIBS
4230     AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4231                  AC_MSG_ERROR([--with-system-png requested but no working libpng found]), 
4232                  $PNG_LIBS)
4233     AC_CHECK_LIB(png, png_get_acTL, ,
4234                  AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4235                  $_SAVE_PNG_LIBS)
4237 if test "$SYSTEM_PNG" = 1; then
4238     LIBS="$PNG_LIBS $LIBS"
4239     AC_TRY_COMPILE([ #include <stdio.h>
4240                      #include <sys/types.h>
4241                      #include <png.h> ],
4242                    [ #if PNG_LIBPNG_VER < $MOZPNG
4243                      #error "Insufficient libpng version ($MOZPNG required)."
4244                      #endif
4245                      #ifndef PNG_UINT_31_MAX
4246                      #error "Insufficient libpng version."
4247                      #endif ],
4248                    SYSTEM_PNG=1,
4249                    AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4251 CFLAGS=$_SAVE_CFLAGS
4252 LDFLAGS=$_SAVE_LDFLAGS
4253 LIBS=$_SAVE_LIBS
4255 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4256     PNG_CFLAGS="-I${PNG_DIR}/include"
4257     PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4260 fi # SKIP_LIBRARY_CHECKS
4262 dnl system HunSpell Support
4263 dnl ========================================================
4264 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4265 [  --enable-system-hunspell  Use system hunspell (located with pkgconfig)],
4266     SYSTEM_HUNSPELL=1 )
4268 if test -n "$SYSTEM_HUNSPELL"; then
4269     PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4272 AC_SUBST(SYSTEM_HUNSPELL)
4274 dnl check whether to enable glitz
4275 dnl ========================================================
4276 MOZ_ARG_ENABLE_BOOL(glitz,
4277 [  --enable-glitz          Enable Glitz for use with Cairo],
4278     MOZ_ENABLE_GLITZ=1,
4279     MOZ_ENABLE_GLITZ= )
4280 if test "$MOZ_ENABLE_GLITZ"; then
4281     AC_DEFINE(MOZ_ENABLE_GLITZ)
4284 dnl ========================================================
4285 dnl Java SDK support
4286 dnl ========================================================
4287 JAVA_INCLUDE_PATH=
4288 MOZ_ARG_WITH_STRING(java-include-path,
4289 [  --with-java-include-path=dir   Location of Java SDK headers],
4290     JAVA_INCLUDE_PATH=$withval)
4292 JAVA_BIN_PATH=
4293 MOZ_ARG_WITH_STRING(java-bin-path,
4294 [  --with-java-bin-path=dir   Location of Java binaries (java, javac, jar)],
4295     JAVA_BIN_PATH=$withval)
4297 dnl ========================================================
4298 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4299 dnl their usage and use them in spidermonkey.
4300 dnl ========================================================
4301 MOZ_ARG_WITH_BOOL(arm-kuser,
4302 [  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4303     USE_ARM_KUSER=1,
4304     USE_ARM_KUSER=)
4305 if test -n "$USE_ARM_KUSER"; then
4306    AC_DEFINE(USE_ARM_KUSER)
4309 dnl ========================================================
4310 dnl =
4311 dnl = Application
4312 dnl =
4313 dnl ========================================================
4315 MOZ_ARG_HEADER(Application)
4317 BUILD_STATIC_LIBS=
4318 ENABLE_TESTS=1
4319 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4320 MOZ_BRANDING_DIRECTORY=
4321 MOZ_CALENDAR=
4322 MOZ_DBGRINFO_MODULES=
4323 MOZ_ENABLE_CANVAS=1
4324 MOZ_EXTENSIONS_ALL=" wallet p3p venkman inspector irc typeaheadfind gnomevfs sroaming datetime finger cview layout-debug tasks sql xforms schema-validation reporter"
4325 MOZ_FEEDS=1
4326 MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp xbm icon"
4327 MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
4328 MOZ_IPCD=
4329 MOZ_JAVAXPCOM=
4330 MOZ_JSDEBUGGER=1
4331 MOZ_JSLOADER=1
4332 MOZ_LDAP_XPCOM=
4333 MOZ_LIBART_CFLAGS=
4334 MOZ_LIBART_LIBS=
4335 MOZ_MAIL_NEWS=
4336 MOZ_MATHML=1
4337 MOZ_MOCHITEST=1
4338 MOZ_MORK=1
4339 MOZ_MORKREADER=
4340 MOZ_AUTH_EXTENSION=1
4341 MOZ_NO_ACTIVEX_SUPPORT=1
4342 MOZ_NO_INSPECTOR_APIS=
4343 MOZ_NO_XPCOM_OBSOLETE=
4344 MOZ_NO_FAST_LOAD=
4345 MOZ_OGG=1
4346 MOZ_MEDIA=
4347 MOZ_OJI=1
4348 MOZ_PERMISSIONS=1
4349 MOZ_PLACES=
4350 MOZ_PLAINTEXT_EDITOR_ONLY=
4351 MOZ_PLUGINS=1
4352 MOZ_PREF_EXTENSIONS=1
4353 MOZ_PROFILELOCKING=1
4354 MOZ_PROFILESHARING=1
4355 MOZ_PSM=1
4356 MOZ_PYTHON_EXTENSIONS="xpcom dom"
4357 MOZ_PYTHON=
4358 MOZ_PYTHON_DEBUG_SUFFIX=
4359 MOZ_PYTHON_DLL_SUFFIX=
4360 MOZ_PYTHON_INCLUDES=
4361 MOZ_PYTHON_LIBS=
4362 MOZ_PYTHON_PREFIX=
4363 MOZ_PYTHON_VER=
4364 MOZ_PYTHON_VER_DOTTED=
4365 MOZ_RDF=1
4366 MOZ_REFLOW_PERF=
4367 MOZ_SAFE_BROWSING=
4368 MOZ_HELP_VIEWER=
4369 MOZ_SPELLCHECK=1
4370 MOZ_STATIC_MAIL_BUILD=
4371 MOZ_STORAGE=1
4372 MOZ_SVG=1
4373 MOZ_TIMELINE=
4374 MOZ_UI_LOCALE=en-US
4375 MOZ_UNIVERSALCHARDET=1
4376 MOZ_URL_CLASSIFIER=
4377 MOZ_USE_NATIVE_UCONV=
4378 MOZ_V1_STRING_ABI=
4379 MOZ_VIEW_SOURCE=1
4380 MOZ_XPFE_COMPONENTS=1
4381 MOZ_XPINSTALL=1
4382 MOZ_XSLT_STANDALONE=
4383 MOZ_XTF=1
4384 MOZ_XUL=1
4385 MOZ_XUL_APP=1
4386 MOZ_ZIPWRITER=1
4387 NS_PRINTING=1
4388 NECKO_COOKIES=1
4389 NECKO_DISK_CACHE=1
4390 NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource"
4391 NECKO_SMALL_BUFFERS=
4392 JS_STATIC_BUILD=
4393 XPC_IDISPATCH_SUPPORT=
4396 case "$target_os" in
4397 darwin*)
4398     ACCESSIBILITY=
4399     ;;
4401     ACCESSIBILITY=1
4402     ;;
4403 esac
4405 case "$target_os" in
4406     msvc*|mks*|cygwin*|mingw*)
4407         if test -z "$GNU_CC"; then 
4408             XPC_IDISPATCH_SUPPORT=1
4409             MOZ_NO_ACTIVEX_SUPPORT=
4410             MOZ_ACTIVEX_SCRIPTING_SUPPORT=1
4411         fi
4412         ;;
4413 esac
4415 MOZ_ARG_ENABLE_STRING(application,
4416 [  --enable-application=APP
4417                           Options include:
4418                             suite
4419                             browser (Firefox)
4420                             mail (Thunderbird)
4421                             composer
4422                             calendar (Sunbird)
4423                             xulrunner
4424                             camino
4425                             content/xslt (Standalone Transformiix XSLT)
4426                             netwerk (Standalone Necko)
4427                             tools/update-packaging (AUS-related packaging tools)
4428                             standalone (use this for standalone
4429                               xpcom/xpconnect or to manually drive a build)],
4430 [ MOZ_BUILD_APP=$enableval ] )
4432 if test "$MOZ_BUILD_APP" = "macbrowser"; then
4433     AC_MSG_WARN([--enable-application=macbrowser is deprecated. Use --enable-application=camino.])
4434     MOZ_BUILD_APP=camino
4437 MOZ_EMBEDDING_PROFILE=default
4438 MOZ_ARG_WITH_STRING(embedding-profile,
4439 [  --with-embedding-profile=default|basic|minimal
4440                        see http://wiki.mozilla.org/Gecko:Small_Device_Support],
4441 [ MOZ_EMBEDDING_PROFILE=$withval ])
4443 case "$MOZ_EMBEDDING_PROFILE" in
4444 default)
4445   MOZ_EMBEDDING_LEVEL_DEFAULT=1
4446   MOZ_EMBEDDING_LEVEL_BASIC=1
4447   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4448   AC_DEFINE(MOZ_EMBEDDING_LEVEL_DEFAULT)
4449   AC_DEFINE(MOZ_EMBEDDING_LEVEL_BASIC)
4450   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4451   ;;
4453 basic)
4454   MOZ_EMBEDDING_LEVEL_DEFAULT=
4455   MOZ_EMBEDDING_LEVEL_BASIC=1
4456   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4457   AC_DEFINE(MOZ_EMBEDDING_LEVEL_BASIC)
4458   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4459   ENABLE_TESTS=
4460   MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4461   MOZ_COMPOSER=
4462   MOZ_ENABLE_CANVAS=
4463   MOZ_ENABLE_POSTSCRIPT=
4464   MOZ_EXTENSIONS_DEFAULT=" spatialnavigation"
4465   MOZ_IMG_DECODERS_DEFAULT="png gif jpeg"
4466   MOZ_IMG_ENCODERS_DEFAULT=
4467   MOZ_IMG_ENCODERS=
4468   MOZ_INSTALLER=
4469   MOZ_JSDEBUGGER=
4470   MOZ_LDAP_XPCOM=
4471   MOZ_MAIL_NEWS=
4472   MOZ_MATHML=
4473   MOZ_AUTH_EXTENSION=
4474   MOZ_NO_ACTIVEX_SUPPORT=1
4475   MOZ_NO_INSPECTOR_APIS=1
4476   MOZ_NO_XPCOM_OBSOLETE=1
4477   MOZ_NO_FAST_LOAD=1
4478   MOZ_OJI=
4479   MOZ_PLAINTEXT_EDITOR_ONLY=1
4480 #  MOZ_PLUGINS=
4481   MOZ_PREF_EXTENSIONS=
4482   MOZ_PROFILELOCKING=
4483   MOZ_PROFILESHARING=
4484   MOZ_SPELLCHECK=
4485   MOZ_SVG=
4486   MOZ_UNIVERSALCHARDET=
4487   MOZ_UPDATER=
4488   MOZ_USE_NATIVE_UCONV=
4489   MOZ_VIEW_SOURCE=
4490   MOZ_XPFE_COMPONENTS=
4491   MOZ_XPINSTALL=
4492   MOZ_XTF=
4493   MOZ_ZIPWRITER=
4494   NECKO_DISK_CACHE=
4495   NECKO_PROTOCOLS_DEFAULT="about data http file res"
4496   NECKO_SMALL_BUFFERS=1
4497   NS_DISABLE_LOGGING=1
4498   NS_PRINTING=
4499   JS_STATIC_BUILD=1
4500   ;;
4502 minimal)
4503   MOZ_EMBEDDING_LEVEL_DEFAULT=
4504   MOZ_EMBEDDING_LEVEL_BASIC=
4505   MOZ_EMBEDDING_LEVEL_MINIMAL=1
4506   AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4507   ENABLE_TESTS=
4508   MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4509   MOZ_COMPOSER=
4510   MOZ_ENABLE_CANVAS=
4511   MOZ_ENABLE_POSTSCRIPT=
4512   MOZ_EXTENSIONS_DEFAULT=" spatialnavigation"
4513   MOZ_IMG_DECODERS_DEFAULT="png gif jpeg"
4514   MOZ_IMG_ENCODERS_DEFAULT=
4515   MOZ_IMG_ENCODERS=
4516   MOZ_INSTALLER=
4517   MOZ_JSDEBUGGER=
4518   MOZ_LDAP_XPCOM=
4519   MOZ_MAIL_NEWS=
4520   MOZ_MATHML=
4521   MOZ_AUTH_EXTENSION=
4522   MOZ_NO_ACTIVEX_SUPPORT=1
4523   MOZ_NO_INSPECTOR_APIS=1
4524   MOZ_NO_XPCOM_OBSOLETE=1
4525   MOZ_NO_FAST_LOAD=1
4526   MOZ_OJI=
4527   MOZ_PLAINTEXT_EDITOR_ONLY=1
4528   MOZ_PLUGINS=
4529   MOZ_PREF_EXTENSIONS=
4530   MOZ_PROFILELOCKING=
4531   MOZ_PROFILESHARING=
4532   MOZ_SPELLCHECK=
4533   MOZ_STORAGE=1
4534   MOZ_PLACES=
4535   MOZ_SVG=
4536   MOZ_UNIVERSALCHARDET=
4537   MOZ_UPDATER=
4538   MOZ_USE_NATIVE_UCONV=1
4539   MOZ_VIEW_SOURCE=
4540   MOZ_XPFE_COMPONENTS=
4541   MOZ_XPINSTALL=
4542   MOZ_XTF=
4543   MOZ_XUL=
4544   MOZ_ZIPWRITER=
4545   MOZ_RDF=
4546   NECKO_DISK_CACHE=
4547   NECKO_PROTOCOLS_DEFAULT="about data http file res"
4548   NECKO_SMALL_BUFFERS=1
4549   NS_DISABLE_LOGGING=1
4550   NS_PRINTING=
4551   JS_STATIC_BUILD=1
4552   ;;
4555   AC_MSG_ERROR([Unrecognized value: --with-embedding-profile=$MOZ_EMBEDDING_PROFILE])
4556   ;;
4557 esac
4559 AC_SUBST(MOZ_EMBEDDING_LEVEL_DEFAULT)
4560 AC_SUBST(MOZ_EMBEDDING_LEVEL_BASIC)
4561 AC_SUBST(MOZ_EMBEDDING_LEVEL_MINIMAL)
4563 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4564 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
4565   XULRUNNER_STUB_NAME=$withval)
4567 if test -z "$XULRUNNER_STUB_NAME"; then
4568   case "$target_os" in
4569   darwin*)
4570     XULRUNNER_STUB_NAME=xulrunner
4571     ;;
4572   *)
4573     XULRUNNER_STUB_NAME=xulrunner-stub
4574   esac
4576 AC_SUBST(XULRUNNER_STUB_NAME)
4578 if test -z "$MOZ_BUILD_APP"; then
4579   AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
4580 else
4581   # We have a valid application only if it has a build.mk file in its top
4582   # directory.
4583   if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4584     AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4585   fi
4588 # Allow the application to influence configure with a confvars.sh script.
4590 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4591 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4592   AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4593   . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4594 else
4595   AC_MSG_RESULT([no])
4598 # Now is a good time to test for logic errors, define mismatches, etc.
4599 case "$MOZ_BUILD_APP" in
4600 xulrunner)
4601   if test "$LIBXUL_SDK"; then
4602     AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4603   fi
4604   ;;
4606   # Fix this case for folks who forget. Warn them.
4607   if test -n "$LIBXUL_SDK" -a -z "$MOZ_XUL_APP"; then
4608     AC_MSG_WARN([Setting MOZ_XUL_APP since LIBXUL_SDK was set. Add to confvars.sh!])
4609     MOZ_XUL_APP=1
4610   fi
4611   ;;
4612 esac
4614 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4615 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4616 # MOZ_BUILD_APP.
4617 case "$MOZ_BUILD_APP" in
4618 suite)
4619   AC_DEFINE(MOZ_SUITE)
4620   ;;
4622 browser)
4623   AC_DEFINE(MOZ_PHOENIX)
4624   ;;
4626 mail)
4627   AC_DEFINE(MOZ_THUNDERBIRD)
4628   ;;
4630 composer)
4631   AC_DEFINE(MOZ_STANDALONE_COMPOSER)
4632   ;;
4634 calendar)
4635   AC_DEFINE(MOZ_SUNBIRD)
4636   ;;
4638 xulrunner)
4639   AC_DEFINE(MOZ_XULRUNNER)
4640   ;;
4642 camino) 
4643   AC_DEFINE(MOZ_MACBROWSER)
4644   ;;
4646 content/xslt)
4647   AC_DEFINE(TX_EXE)
4648   ;;
4650 standalone) 
4651   MOZ_APP_NAME=mozilla
4652   MOZ_APP_DISPLAYNAME=Mozilla
4653   MOZ_APP_VERSION=$MOZILLA_VERSION
4654   ;;
4656 esac
4658 AC_SUBST(MOZ_BUILD_APP)
4659 AC_SUBST(MOZ_XUL_APP)
4660 AC_SUBST(MOZ_SUITE)
4661 AC_SUBST(MOZ_PHOENIX)
4662 AC_SUBST(MOZ_THUNDERBIRD)
4663 AC_SUBST(MOZ_STANDALONE_COMPOSER)
4664 AC_SUBST(MOZ_SUNBIRD)
4665 AC_SUBST(MOZ_XULRUNNER)
4667 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4669 if test "$MOZ_XUL_APP"; then
4670   MOZ_PROFILESHARING=
4671   AC_DEFINE(MOZ_XUL_APP)
4674 dnl ========================================================
4675 dnl = 
4676 dnl = Toolkit Options
4677 dnl = 
4678 dnl ========================================================
4679 MOZ_ARG_HEADER(Toolkit Options)
4681     dnl ========================================================
4682     dnl = Select the default toolkit
4683     dnl ========================================================
4684         MOZ_ARG_ENABLE_STRING(default-toolkit,
4685         [  --enable-default-toolkit=TK
4686                           Select default toolkit
4687                           Platform specific defaults:
4688                             BeOS - cairo-beos
4689                             Mac OS X - cairo-cocoa
4690                             Neutrino/QNX - photon
4691                             OS/2 - cairo-os2
4692                             Win32 - cairo-windows
4693                             WinCE - windows
4694                             Gtk2 with DirectFB - cairo-gtk2-dfb
4695                             * - cairo-gtk2
4696                             * - cairo-qt],
4697     [ _DEFAULT_TOOLKIT=$enableval ],
4698     [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4700     if test "$_DEFAULT_TOOLKIT" = "photon" \
4701         -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4702         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4703         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
4704         -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4705         -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4706         -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
4707         -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4708         -o "$_DEFAULT_TOOLKIT" = "cairo-mac" \
4709         -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa"
4710     then
4711         dnl nglayout only supports building with one toolkit,
4712         dnl so ignore everything after the first comma (",").
4713         MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4714     else
4715         AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4716     fi
4718 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_TOOLKIT,"$MOZ_WIDGET_TOOLKIT")
4720 dnl ========================================================
4721 dnl = Enable the toolkit as needed                         =
4722 dnl ========================================================
4724 case "$MOZ_WIDGET_TOOLKIT" in
4725 photon)
4726         MOZ_ENABLE_PHOTON=1
4727         AC_DEFINE(MOZ_WIDGET_PHOTON)
4728     ;;
4730 cairo-windows)
4731     MOZ_WIDGET_TOOLKIT=windows
4732     MOZ_GFX_TOOLKIT=cairo
4733     ;;
4735 cairo-gtk2|cairo-gtk2-x11)
4736     MOZ_WIDGET_TOOLKIT=gtk2
4737     MOZ_GFX_TOOLKIT=cairo
4738     MOZ_ENABLE_GTK2=1
4739     MOZ_ENABLE_XREMOTE=1
4741     AC_DEFINE(MOZ_X11)
4742     MOZ_X11=1
4744     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4745     TK_LIBS='$(MOZ_GTK2_LIBS)'
4746     AC_DEFINE(MOZ_WIDGET_GTK2)
4747     ;;
4749 cairo-gtk2-dfb)
4750     MOZ_WIDGET_TOOLKIT=gtk2
4751     MOZ_GFX_TOOLKIT=cairo
4752     MOZ_ENABLE_GTK2=1
4754     AC_DEFINE(MOZ_DFB)
4755     MOZ_DFB=1
4757     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4758     TK_LIBS='$(MOZ_GTK2_LIBS)'
4759     AC_DEFINE(MOZ_WIDGET_GTK2)
4760     if test "$no_x" != "yes"; then
4761         AC_MSG_WARN([Disabling X when DirectFB is specified.])
4762         no_x=yes
4763     fi
4764     ;;
4766 cairo-qt)
4767     MOZ_WIDGET_TOOLKIT=qt
4768     MOZ_GFX_TOOLKIT=cairo
4769     MOZ_ENABLE_QT=1
4770     MOZ_ENABLE_XREMOTE=1
4772     AC_DEFINE(MOZ_X11)
4773     MOZ_X11=1
4775     TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4776     TK_LIBS='$(MOZ_QT_LIBS)'
4777     AC_DEFINE(MOZ_WIDGET_QT)
4778     ;;
4780 cairo-beos)
4781     MOZ_WIDGET_TOOLKIT=beos
4782     MOZ_GFX_TOOLKIT=cairo
4783     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4784     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4785     ;;
4787 cairo-os2)
4788     MOZ_WIDGET_TOOLKIT=os2
4789     MOZ_GFX_TOOLKIT=cairo
4790     TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4791     TK_LIBS='$(MOZ_CAIRO_LIBS)'
4792     ;;
4794 cairo-mac|cairo-cocoa)
4795     if test "$MOZ_WIDGET_TOOLKIT" = "cairo-cocoa"; then
4796         MOZ_WIDGET_TOOLKIT=cocoa
4797         AC_DEFINE(MOZ_WIDGET_COCOA)
4798         MOZ_ENABLE_COCOA=1
4799     else
4800         MOZ_WIDGET_TOOLKIT=mac
4801     fi
4802     MOZ_GFX_TOOLKIT=cairo
4803     MOZ_USER_DIR="Mozilla"
4804     AC_DEFINE(XP_MACOSX)
4805     AC_DEFINE(TARGET_CARBON)
4806     AC_DEFINE(TARGET_API_MAC_CARBON)
4807     TK_LIBS='-framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit'
4808     TK_CFLAGS="-I${MACOS_SDK_DIR}/Developer/Headers/FlatCarbon"
4809     CFLAGS="$CFLAGS $TK_CFLAGS"
4810     CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4811     ;;
4812 esac
4814 if test "$MOZ_ENABLE_XREMOTE"; then
4815     AC_DEFINE(MOZ_ENABLE_XREMOTE)
4818 if test "$COMPILE_ENVIRONMENT"; then
4819   if test "$MOZ_ENABLE_GTK2"; then
4820     if test "$MOZ_X11"; then
4821       GDK_PACKAGES=gdk-x11-2.0
4822     elif test "$MOZ_DFB"; then
4823       PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
4824       GDK_PACKAGES=directfb
4825     fi
4827     PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4828   fi
4830 fi # COMPILE_ENVIRONMENT
4832 AC_SUBST(MOZ_DEFAULT_TOOLKIT)
4834 dnl ========================================================
4835 dnl = startup-notification support module
4836 dnl ========================================================
4838 if test "$MOZ_ENABLE_GTK2"
4839 then
4840     MOZ_ENABLE_STARTUP_NOTIFICATION=
4842     MOZ_ARG_ENABLE_BOOL(startup-notification,
4843     [  --enable-startup-notification       Enable startup-notification support (default: disabled) ],
4844         MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4845         MOZ_ENABLE_STARTUP_NOTIFICATION=)
4846     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4847     then
4848         PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4849                           libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4850         [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4851             if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4852             then
4853                 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4854             fi
4855             MOZ_ENABLE_STARTUP_NOTIFICATION=
4856         ])
4857     fi
4859     if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4860         AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4861     fi
4863     TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4865 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4866 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4867 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4869 dnl ========================================================
4870 dnl = QT support
4871 dnl ========================================================
4872 if test "$MOZ_ENABLE_QT"
4873 then
4874     PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtUiTools QtCore)
4875     AC_SUBST(MOZ_QT_CFLAGS)
4876     AC_SUBST(MOZ_QT_LIBS)
4878     MOZ_ARG_WITH_STRING(qtdir,
4879     [  --with-qtdir=\$dir       Specify Qt directory ],
4880     [ QTDIR=$withval])
4882     if test -z "$QTDIR"; then
4883       QTDIR="/usr"
4884     fi
4885     QTINCDIR="/include/qt"
4886     if test ! -d "$QTDIR$QTINCDIR"; then
4887        QTINCDIR="/include/X11/qt"
4888     fi
4889     if test ! -d "$QTDIR$QTINCDIR"; then
4890        QTINCDIR="/include"
4891     fi
4893     if test -x "$QTDIR/bin/moc-qt4"; then
4894       HOST_MOC="$QTDIR/bin/moc-qt4"
4895     else
4896       if test -x "$QTDIR/bin/moc"; then
4897         HOST_MOC="$QTDIR/bin/moc"
4898       else
4899         AC_CHECK_PROGS(HOST_MOC, moc, "")
4900       fi
4901     fi
4902     if test -z "$HOST_MOC"; then
4903       AC_MSG_ERROR([no acceptable moc preprocessor found])
4904     fi
4905     MOC=$HOST_MOC
4908 AC_SUBST(GTK_CONFIG)
4909 AC_SUBST(TK_CFLAGS)
4910 AC_SUBST(TK_LIBS)
4912 AC_SUBST(MOZ_ENABLE_GTK2)
4913 AC_SUBST(MOZ_ENABLE_PHOTON)
4914 AC_SUBST(MOZ_ENABLE_COCOA)
4915 AC_SUBST(MOZ_ENABLE_GLITZ)
4916 AC_SUBST(MOZ_ENABLE_QT)
4917 AC_SUBST(MOZ_ENABLE_XREMOTE)
4918 AC_SUBST(MOZ_GTK2_CFLAGS)
4919 AC_SUBST(MOZ_GTK2_LIBS)
4920 AC_SUBST(MOZ_QT_CFLAGS)
4921 AC_SUBST(MOZ_QT_LIBS)
4923 AC_SUBST(MOC)
4925 AC_SUBST(MOZ_DFB)
4926 AC_SUBST(MOZ_X11)
4928 dnl ========================================================
4929 dnl =
4930 dnl = Components & Features
4931 dnl = 
4932 dnl ========================================================
4933 MOZ_ARG_HEADER(Components and Features)
4935 dnl ========================================================
4936 dnl = Localization
4937 dnl ========================================================
4938 MOZ_ARG_ENABLE_STRING(ui-locale,
4939 [  --enable-ui-locale=ab-CD
4940                           Select the user interface locale (default: en-US)],
4941     MOZ_UI_LOCALE=$enableval )
4942 AC_SUBST(MOZ_UI_LOCALE)
4944 dnl =========================================================
4945 dnl = Calendar client
4946 dnl =========================================================
4947 MOZ_ARG_ENABLE_BOOL(calendar,,
4948     MOZ_OLD_CALENDAR=1,
4949     MOZ_OLD_CALENDAR= )
4951 if test "$MOZ_OLD_CALENDAR"; then
4952     AC_MSG_WARN([Building with the calendar extension is no longer supported.])
4953     if test "$MOZ_THUNDERBIRD"; then
4954         AC_MSG_WARN([Since you're trying to build mail, you could try adding])
4955         AC_MSG_WARN(['--enable-extensions=default,lightning' to your mozconfig])
4956         AC_MSG_WARN([and building WITH A FRESH TREE.])
4957     fi
4958     AC_MSG_WARN([For more information, please visit:])
4959     AC_MSG_ERROR([http://www.mozilla.org/projects/calendar/])
4962 AC_SUBST(MOZ_CALENDAR)
4964 dnl =========================================================
4965 dnl = Mail & News
4966 dnl =========================================================
4967 MOZ_ARG_DISABLE_BOOL(mailnews,
4968 [  --disable-mailnews      Disable building of mail & news components],
4969     MOZ_MAIL_NEWS=,
4970     MOZ_MAIL_NEWS=1 )
4971 AC_SUBST(MOZ_MAIL_NEWS)
4973 dnl =========================================================
4974 dnl = LDAP
4975 dnl =========================================================
4976 MOZ_ARG_DISABLE_BOOL(ldap,
4977 [  --disable-ldap          Disable LDAP support],
4978     MOZ_LDAP_XPCOM=,
4979     MOZ_LDAP_XPCOM=1)
4981 dnl ========================================================
4982 dnl = Trademarked Branding 
4983 dnl ========================================================
4984 MOZ_ARG_ENABLE_BOOL(official-branding,
4985 [  --enable-official-branding Enable Official mozilla.org Branding
4986                           Do not distribute builds with
4987                           --enable-official-branding unless you have
4988                           permission to use trademarks per
4989                           http://www.mozilla.org/foundation/trademarks/ .],
4990 [case "$MOZ_BUILD_APP" in
4991 browser)
4992     MOZ_BRANDING_DIRECTORY=other-licenses/branding/firefox
4993     MOZ_APP_DISPLAYNAME=Firefox
4994     ;;
4996 calendar)
4997     MOZ_BRANDING_DIRECTORY=other-licenses/branding/sunbird
4998     MOZ_APP_DISPLAYNAME=Sunbird
4999     ;;
5001 mail)
5002     MOZ_BRANDING_DIRECTORY=other-licenses/branding/thunderbird
5003     ;;
5006     AC_MSG_ERROR([Official branding is only available for Firefox Sunbird and Thunderbird.])
5007 esac
5010 MOZ_ARG_WITH_STRING(branding,
5011 [  --with-branding=dir    Use branding from the specified directory.],
5012     MOZ_BRANDING_DIRECTORY=$withval)
5014 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
5015 if test -z "$REAL_BRANDING_DIRECTORY"; then
5016   REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
5019 if test -f "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"; then
5020   . "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"
5023 AC_SUBST(MOZ_BRANDING_DIRECTORY)
5025 dnl ========================================================
5026 dnl = Distribution ID
5027 dnl ========================================================
5028 MOZ_ARG_WITH_STRING(distribution-id,
5029 [  --with-distribution-id=ID  Set distribution-specific id (default=org.mozilla)],
5030 [ val=`echo $withval`
5031     MOZ_DISTRIBUTION_ID="$val"])
5033 if test -z "$MOZ_DISTRIBUTION_ID"; then
5034    MOZ_DISTRIBUTION_ID="org.mozilla"
5037 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
5038 AC_SUBST(MOZ_DISTRIBUTION_ID)
5041 dnl ========================================================
5042 dnl complex text support off by default
5043 dnl ========================================================
5044 MOZ_PANGO=1
5045 MOZ_ARG_DISABLE_BOOL(pango,
5046 [  --disable-pango Disable usage of Pango ],
5047     MOZ_PANGO=,
5048     MOZ_PANGO=1)
5051 dnl ========================================================
5052 dnl = Xft and Pango
5053 dnl ========================================================
5054 if test "$MOZ_ENABLE_GTK2"
5055 then
5056     if test "$MOZ_X11"; then
5057         PKG_CHECK_MODULES(MOZ_XFT, xft)
5058         AC_SUBST(MOZ_XFT_CFLAGS)
5059         AC_SUBST(MOZ_XFT_LIBS)
5060     fi
5062     AC_SUBST(MOZ_PANGO)
5064     PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5066     if test "$MOZ_PANGO"
5067     then
5068         PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangocairo >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
5069         AC_SUBST(MOZ_PANGO_CFLAGS)
5070         AC_SUBST(MOZ_PANGO_LIBS)
5071         AC_DEFINE(MOZ_PANGO)
5072     else
5073         PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
5074         AC_SUBST(MOZ_PANGO_CFLAGS)
5075         AC_SUBST(MOZ_PANGO_LIBS)
5077         PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5078         AC_SUBST(FT2_CFLAGS)
5079         AC_SUBST(FT2_LIBS)
5080     fi
5083 dnl ========================================================
5084 dnl = PostScript print module
5085 dnl ========================================================
5086 MOZ_ARG_DISABLE_BOOL(postscript,
5087 [  --disable-postscript    Disable PostScript printing support ],
5088     MOZ_ENABLE_POSTSCRIPT=,
5089     MOZ_ENABLE_POSTSCRIPT=1 )
5091 dnl ========================================================
5092 dnl = GnomeVFS support module
5093 dnl ========================================================
5095 if test "$MOZ_X11"
5096 then
5097     dnl build the gnomevfs extension by default only when the
5098     dnl GTK2 toolkit is in use.
5099     if test "$MOZ_ENABLE_GTK2"
5100     then
5101         MOZ_ENABLE_GNOMEVFS=1
5102         MOZ_ENABLE_GCONF=1
5103         MOZ_ENABLE_LIBGNOME=1
5104     fi
5106     MOZ_ARG_DISABLE_BOOL(gnomevfs,
5107     [  --disable-gnomevfs      Disable GnomeVFS support ],
5108         MOZ_ENABLE_GNOMEVFS=,
5109         MOZ_ENABLE_GNOMEVFS=force)
5111     if test "$MOZ_ENABLE_GNOMEVFS"
5112     then
5113         PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5114             MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5115             MOZ_ENABLE_GNOMEVFS=1
5116         ],[
5117             if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5118             then
5119                 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5120             fi
5121             MOZ_ENABLE_GNOMEVFS=
5122         ])
5123     fi
5125     AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5126     AC_SUBST(MOZ_GNOMEVFS_LIBS)
5128     if test "$MOZ_ENABLE_GCONF"
5129     then
5130         PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION,[
5131             MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5132             MOZ_ENABLE_GCONF=1
5133         ],[
5134             MOZ_ENABLE_GCONF=
5135         ])
5136     fi
5138     if test "$MOZ_ENABLE_GCONF"; then
5139         AC_DEFINE(MOZ_ENABLE_GCONF)
5140     fi
5142     AC_SUBST(MOZ_ENABLE_GCONF)
5143     AC_SUBST(MOZ_GCONF_CFLAGS)
5144     AC_SUBST(MOZ_GCONF_LIBS)
5146     if test "$MOZ_ENABLE_LIBGNOME"
5147     then
5148         PKG_CHECK_MODULES(MOZ_LIBGNOME, libgnome-2.0 >= $LIBGNOME_VERSION,[
5149             MOZ_LIBGNOME_LIBS=`echo $MOZ_LIBGNOME_LIBS | sed 's/-llinc\>//'`
5150             MOZ_ENABLE_LIBGNOME=1
5151         ],[
5152             MOZ_ENABLE_LIBGNOME=
5153         ])
5154     fi
5156     AC_SUBST(MOZ_LIBGNOME_CFLAGS)
5157     AC_SUBST(MOZ_LIBGNOME_LIBS)
5159     # The GNOME component is built if gtk2, gconf, gnome-vfs, and libgnome
5160     # are all available.
5162     if test "$MOZ_ENABLE_GTK2" -a "$MOZ_ENABLE_GCONF" -a \
5163             "$MOZ_ENABLE_GNOMEVFS" -a "$MOZ_ENABLE_LIBGNOME"; then
5164       MOZ_ENABLE_GNOME_COMPONENT=1
5165     else
5166       MOZ_ENABLE_GNOME_COMPONENT=
5167     fi
5169     AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5172 dnl ========================================================
5173 dnl = libgnomeui support module
5174 dnl ========================================================
5176 if test "$MOZ_ENABLE_GTK2"
5177 then
5178     MOZ_ENABLE_GNOMEUI=1
5180     MOZ_ARG_DISABLE_BOOL(gnomeui,
5181     [  --disable-gnomeui       Disable libgnomeui support (default: auto, optional at runtime) ],
5182         MOZ_ENABLE_GNOMEUI=,
5183         MOZ_ENABLE_GNOMEUI=force)
5185     if test "$MOZ_ENABLE_GNOMEUI"
5186     then
5187         PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5188         [
5189             MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5190             MOZ_ENABLE_GNOMEUI=1
5191         ],[
5192             if test "$MOZ_ENABLE_GNOMEUI" = "force"
5193             then
5194                 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5195             fi
5196             MOZ_ENABLE_GNOMEUI=
5197         ])
5198     fi
5200     if test "$MOZ_ENABLE_GNOMEUI"; then
5201         AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5202     fi
5204 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5205 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5206 AC_SUBST(MOZ_GNOMEUI_LIBS)
5208 dnl ========================================================
5209 dnl = dbus support
5210 dnl ========================================================
5212 if test "$MOZ_ENABLE_GTK2"
5213 then
5214     MOZ_ENABLE_DBUS=1
5216     MOZ_ARG_DISABLE_BOOL(dbus,
5217     [  --disable-dbus       Disable dbus support ],
5218         MOZ_ENABLE_DBUS=,
5219         MOZ_ENABLE_DBUS=1)
5221     if test "$MOZ_ENABLE_DBUS"
5222     then
5223         PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5224         AC_DEFINE(MOZ_ENABLE_DBUS)
5225     fi
5227 AC_SUBST(MOZ_ENABLE_DBUS)
5228 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5229 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5231 dnl ========================================================
5232 dnl = Build Personal Security Manager
5233 dnl ========================================================
5234 MOZ_ARG_DISABLE_BOOL(crypto,
5235 [  --disable-crypto        Disable crypto support (Personal Security Manager)],
5236     MOZ_PSM=,
5237     MOZ_PSM=1 )
5239 dnl ========================================================
5240 dnl = JS Debugger XPCOM component (js/jsd)
5241 dnl ========================================================
5242 MOZ_ARG_DISABLE_BOOL(jsd,
5243 [  --disable-jsd           Disable JavaScript debug library],
5244     MOZ_JSDEBUGGER=,
5245     MOZ_JSDEBUGGER=1)
5248 dnl ========================================================
5249 dnl = Disable plugin support
5250 dnl ========================================================
5251 MOZ_ARG_DISABLE_BOOL(plugins,
5252 [  --disable-plugins       Disable plugins support],
5253     MOZ_PLUGINS=,
5254     MOZ_PLUGINS=1)
5256 dnl ========================================================
5257 dnl = Open JVM Interface (OJI) support
5258 dnl ========================================================
5259 MOZ_ARG_DISABLE_BOOL(oji,
5260 [  --disable-oji           Disable Open JVM Integration support],
5261     MOZ_OJI=,
5262     MOZ_OJI=1)
5263 if test -n "$MOZ_OJI"; then
5264     AC_DEFINE(OJI)
5267 dnl bi-directional support always on
5268 IBMBIDI=1
5269 AC_DEFINE(IBMBIDI)
5271 dnl ========================================================
5272 dnl view source support on by default
5273 dnl ========================================================
5274 MOZ_ARG_DISABLE_BOOL(view-source,
5275 [  --disable-view-source     Disable view source support],
5276     MOZ_VIEW_SOURCE=,
5277     MOZ_VIEW_SOURCE=1 )
5278 if test "$MOZ_VIEW_SOURCE"; then
5279     AC_DEFINE(MOZ_VIEW_SOURCE)
5283 dnl ========================================================
5284 dnl accessibility support on by default on all platforms 
5285 dnl except OS X.
5286 dnl ========================================================
5287 MOZ_ARG_DISABLE_BOOL(accessibility,
5288 [  --disable-accessibility Disable accessibility support (off by default on OS X)],
5289     ACCESSIBILITY=,
5290     ACCESSIBILITY=1 )
5291 if test "$ACCESSIBILITY"; then
5292     AC_DEFINE(ACCESSIBILITY)
5295 if test -n "$ACCESSIBILITY"; then
5296 case "$target" in
5297 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5298     if test "$ac_cv_header_atlbase_h" = "no"; then
5299         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.])
5300     fi
5301     if test "$ac_cv_header_oleacc_idl" = "no"; then
5302         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.])
5303     fi
5304     ;;
5305 esac
5308 dnl ========================================================
5309 dnl xpfe/components on by default
5310 dnl ========================================================
5311 MOZ_ARG_DISABLE_BOOL(xpfe-components,
5312 [  --disable-xpfe-components
5313                           Disable xpfe components],
5314     MOZ_XPFE_COMPONENTS=,
5315     MOZ_XPFE_COMPONENTS=1 )
5317 dnl ========================================================
5318 dnl xpinstall support on by default
5319 dnl ========================================================
5320 MOZ_ARG_DISABLE_BOOL(xpinstall,
5321 [  --disable-xpinstall     Disable xpinstall support],
5322     MOZ_XPINSTALL=,
5323     MOZ_XPINSTALL=1 )
5324 if test "$MOZ_XPINSTALL"; then
5325     AC_DEFINE(MOZ_XPINSTALL)
5328 dnl ========================================================
5329 dnl xpcom js loader support on by default
5330 dnl ========================================================
5331 MOZ_ARG_DISABLE_BOOL(jsloader,
5332 [  --disable-jsloader      Disable xpcom js loader support],
5333     MOZ_JSLOADER=,
5334     MOZ_JSLOADER=1 )
5335 if test "$MOZ_JSLOADER"; then
5336     AC_DEFINE(MOZ_JSLOADER)
5339 dnl ========================================================
5340 dnl Disable printing
5341 dnl ========================================================
5342 MOZ_ARG_DISABLE_BOOL(printing,
5343 [  --disable-printing  Disable printing support],
5344     NS_PRINTING=,
5345     NS_PRINTING=1 )
5347 if test "$NS_PRINTING"; then
5348     AC_DEFINE(NS_PRINTING)
5349     AC_DEFINE(NS_PRINT_PREVIEW)
5352 dnl ========================================================
5353 dnl use native unicode converters
5354 dnl ========================================================
5355 MOZ_ARG_ENABLE_BOOL(native-uconv,
5356 [  --enable-native-uconv   Enable iconv support],
5357     MOZ_USE_NATIVE_UCONV=1,
5358     MOZ_USE_NATIVE_UCONV= )
5359 if test "$MOZ_USE_NATIVE_UCONV"; then
5360     AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5362 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5363     AC_MSG_ERROR([iconv() not found.  Cannot enable native uconv support.])
5367 dnl ========================================================
5368 dnl Libeditor can be build as plaintext-only,
5369 dnl or as a full html and text editing component.
5370 dnl We build both by default.
5371 dnl ========================================================
5372 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5373 [  --enable-plaintext-editor-only
5374                           Allow only plaintext editing],
5375     MOZ_PLAINTEXT_EDITOR_ONLY=1,
5376     MOZ_PLAINTEXT_EDITOR_ONLY= )
5377 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5378 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5380 dnl ========================================================
5381 dnl Composer is on by default.
5382 dnl ========================================================
5383 MOZ_ARG_DISABLE_BOOL(composer,
5384 [  --disable-composer      Disable building of Composer],
5385     MOZ_COMPOSER=,
5386     MOZ_COMPOSER=1 )
5387 AC_SUBST(MOZ_COMPOSER)
5390 dnl ========================================================
5391 dnl = Drop XPCOM Obsolete library
5392 dnl ========================================================
5393 MOZ_ARG_DISABLE_BOOL(xpcom-obsolete,
5394 [  --disable-xpcom-obsolete           Disable XPCOM Obsolete Library],
5395     MOZ_NO_XPCOM_OBSOLETE=1,
5396     MOZ_NO_XPCOM_OBSOLETE=)
5398 if test -n "$MOZ_NO_XPCOM_OBSOLETE"; then
5399     AC_DEFINE(MOZ_NO_XPCOM_OBSOLETE)
5402 dnl ========================================================
5403 dnl = Disable Fast Load
5404 dnl ========================================================
5405 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5406 [  --disable-xpcom-fastload           Disable XPCOM fastload support],
5407     MOZ_NO_FAST_LOAD=1,
5408     MOZ_NO_FAST_LOAD=)
5410 AC_SUBST(MOZ_NO_FAST_LOAD)
5412 if test -n "$MOZ_NO_FAST_LOAD"; then
5413     AC_DEFINE(MOZ_NO_FAST_LOAD)
5416 dnl ========================================================
5417 dnl = Enable Ogg Codecs
5418 dnl ========================================================
5419 MOZ_ARG_DISABLE_BOOL(ogg,
5420 [  --disable-ogg           Disable Ogg Codec support],
5421     MOZ_OGG=,
5422     MOZ_OGG=1)
5424 AC_SUBST(MOZ_OGG)
5426 if test -n "$MOZ_OGG"; then
5427     AC_DEFINE(MOZ_OGG)
5428     MOZ_MEDIA=1
5431 AC_SUBST(MOZ_MEDIA)
5433 if test -n "$MOZ_MEDIA"; then
5434     AC_DEFINE(MOZ_MEDIA)
5437 dnl If using Ogg with Linux, ensure that the alsa library is available
5438 if test -n "$MOZ_OGG"; then
5439    case "$target_os" in
5440 linux*)
5441       AC_CHECK_LIB(asound, snd_pcm_open,,AC_MSG_ERROR([Ogg support on Linux requires the alsa library]))
5442       ;;
5443    esac
5446 dnl ========================================================
5447 dnl Permissions System
5448 dnl ========================================================
5449 MOZ_ARG_DISABLE_BOOL(permissions,
5450 [  --disable-permissions   Disable permissions (popup and cookie blocking)],
5451     MOZ_PERMISSIONS=,
5452     MOZ_PERMISSIONS=1
5455 dnl ========================================================
5456 dnl NegotiateAuth
5457 dnl ========================================================
5458 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5459 [  --disable-negotiateauth Disable GSS-API negotiation ],
5460     MOZ_AUTH_EXTENSION=,
5461     MOZ_AUTH_EXTENSION=1 )
5463 dnl ========================================================
5464 dnl XTF
5465 dnl ========================================================
5466 MOZ_ARG_DISABLE_BOOL(xtf,
5467 [  --disable-xtf           Disable XTF (pluggable xml tags) support],
5468     MOZ_XTF=,
5469     MOZ_XTF=1 )
5470 if test "$MOZ_XTF"; then
5471   AC_DEFINE(MOZ_XTF)
5474 dnl ========================================================
5475 dnl Inspector APIs
5476 dnl ========================================================
5477 MOZ_ARG_DISABLE_BOOL(inspector-apis,
5478 [  --disable-inspector-apis Disable the DOM inspection APIs ],
5479     MOZ_NO_INSPECTOR_APIS=1,
5480     MOZ_NO_INSPECTOR_APIS= )
5482 dnl ========================================================
5483 dnl Pref extensions (autoconfig and system-pref)
5484 dnl ========================================================
5485 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5486 [  --disable-pref-extensions
5487                           Disable pref extensions such as autoconfig and
5488                           system-pref],
5489   MOZ_PREF_EXTENSIONS=,
5490   MOZ_PREF_EXTENSIONS=1 )
5492 dnl ========================================================
5493 dnl = Universalchardet
5494 dnl ========================================================
5495 MOZ_ARG_DISABLE_BOOL(universalchardet,
5496 [  --disable-universalchardet
5497                           Disable universal encoding detection],
5498   MOZ_UNIVERSALCHARDET=,
5499   MOZ_UNIVERSALCHARDET=1 )
5501 dnl ========================================================
5502 dnl JavaXPCOM
5503 dnl ========================================================
5504 MOZ_ARG_ENABLE_BOOL(javaxpcom,
5505 [  --enable-javaxpcom
5506                           Enable Java-XPCOM bridge],
5507     MOZ_JAVAXPCOM=1,
5508     MOZ_JAVAXPCOM= )
5510 if test -n "${MOZ_JAVAXPCOM}"; then
5511   case "$host_os" in
5512     cygwin*|msvc*|mks*)
5513       if test -n "$JAVA_HOME"; then
5514         JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
5515       fi
5516       ;;
5517     *mingw*)
5518       if test -n "$JAVA_HOME"; then
5519         JAVA_HOME=`cd "$JAVA_HOME" && pwd`
5520       fi
5521       ;;
5522   esac
5524   if test -n "${JAVA_INCLUDE_PATH}"; then
5525     dnl Make sure jni.h exists in the given include path.
5526     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5527       AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
5528     fi
5529   else
5530     case "$target_os" in
5531       darwin*)
5532         dnl Default to java system location
5533         JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
5534         ;;
5535       *)
5536         dnl Try $JAVA_HOME
5537         JAVA_INCLUDE_PATH="$JAVA_HOME/include"
5538         ;;
5539     esac
5540     if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5541       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.])
5542     fi
5543   fi
5545   if test -n "${JAVA_BIN_PATH}"; then
5546     dnl Look for javac and jar in the specified path.
5547     JAVA_PATH="$JAVA_BIN_PATH"
5548   else
5549     dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5550     JAVA_PATH="$JAVA_HOME/bin:$PATH"
5551   fi
5553   AC_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5554   AC_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5555   AC_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5556   if test -z "$JAVA" || test "$JAVA" = ":" || test -z "$JAVAC" || test "$JAVAC" = ":" || test -z "$JAR" || test "$JAR" = ":"; then
5557     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.])
5558   fi
5561 dnl ========================================================
5562 dnl = Breakpad crash reporting (on by default on supported platforms)
5563 dnl ========================================================
5565 if (test "$OS_ARCH" = "WINNT" -a -z "$GNU_CC" \
5566     || test "$OS_ARCH" = "Darwin" \
5567     || test "$OS_ARCH" = "Linux" -a "$CPU_ARCH" = "x86" \
5568     || test "$OS_ARCH" = "SunOS") \
5569    && test -z "$HAVE_64BIT_OS"; then
5570    MOZ_CRASHREPORTER=1
5573 MOZ_ARG_DISABLE_BOOL(crashreporter,
5574 [  --disable-crashreporter          Disable breakpad crash reporting],
5575     MOZ_CRASHREPORTER=,
5576     MOZ_CRASHREPORTER=1)
5578 if test -n "$MOZ_CRASHREPORTER"; then
5579    AC_DEFINE(MOZ_CRASHREPORTER)
5581   if (test "$OS_ARCH" = "Linux" || test "$OS_ARCH" = "SunOS") && \
5582     test -z "$SKIP_LIBRARY_CHECKS"; then
5583     PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5584     AC_SUBST(MOZ_GTHREAD_CFLAGS)
5585     AC_SUBST(MOZ_GTHREAD_LIBS)
5587     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.])])
5588   fi
5591 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5592 [  --with-crashreporter-enable-percent=NN  Enable sending crash reports by default on NN% of users. (default=100)],
5593 [ val=`echo $withval | sed 's/[^0-9]//g'`
5594     MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5596 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5597    MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5599 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5602 dnl ========================================================
5603 dnl = Build mochitest JS/DOM tests (on by default)
5604 dnl ========================================================
5605 MOZ_ARG_DISABLE_BOOL(mochitest,
5606 [  --disable-mochitest        Disable mochitest harness],
5607     MOZ_MOCHITEST=,
5608     MOZ_MOCHITEST=1 )
5610 dnl ========================================================
5611 dnl = Enable compilation of specific extension modules
5612 dnl ========================================================
5614 MOZ_ARG_ENABLE_STRING(extensions,
5615 [  --enable-extensions     Enable extensions],
5616 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5617     if test "$option" = "yes" || test "$option" = "all"; then
5618         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_ALL"
5619     elif test "$option" = "no" || test "$option" = "none"; then
5620         MOZ_EXTENSIONS=""
5621     elif test "$option" = "default"; then
5622         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
5623     elif test `echo "$option" | grep -c \^-` != 0; then
5624         option=`echo $option | sed 's/^-//'`
5625         MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
5626     else
5627         MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
5628     fi
5629 done],
5630     MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
5632 if test -z "$MOZ_ENABLE_GNOMEVFS" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5633     # Suppress warning on non-X11 platforms
5634     if test -n "$MOZ_X11"; then
5635         AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
5636     fi
5637     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5640 if test -z "$MOZ_JSDEBUGGER" && test `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
5641     AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
5642     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
5645 dnl This might be temporary: build tridentprofile only on Windows
5646 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
5647     AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
5648     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5651 dnl cookie must be built before tridentprofile. put it at list's end.
5652 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
5653   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5654   MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
5657 dnl xforms requires xtf and schema-validation
5658 if test -z "$MOZ_XTF" && test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
5659     AC_MSG_WARN([Cannot build XForms without XTF support.  Removing XForms from MOZ_EXTENSIONS.])
5660     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5662 if test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0 && test `echo "$MOZ_EXTENSIONS" | grep -c schema-validation` -eq 0; then
5663     AC_MSG_WARN([Cannot build XForms without schema validation.  Removing XForms from MOZ_EXTENSIONS.])
5664     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5667 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
5668     AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
5669     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
5672 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
5673     AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
5674     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
5677 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
5678     AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
5679     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
5682 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
5683     AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
5684     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
5687 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
5688     AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
5689     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
5692 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
5693     AC_MSG_WARN([spellcheck is no longer an extension.])
5694     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
5697 if test -n "$MOZ_NO_XPCOM_OBSOLETE" && test `echo "$MOZ_EXTENSIONS" | grep -c sroaming` -ne 0; then
5698     AC_MSG_WARN([Cannot currently build sroaming without xpcom obsolete -- bug 249343. Removing sroaming from MOZ_EXTENSIONS.])
5699     MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|sroaming||'`
5702 dnl Remove dupes
5703 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
5705 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
5706 dnl when trying to build a non-existent extension.
5707 for extension in $MOZ_EXTENSIONS; do
5708     if test ! -d "${srcdir}/extensions/${extension}"; then
5709         AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
5710     fi
5711 done
5714 dnl ========================================================
5715 dnl Image decoders
5716 dnl ========================================================
5717 case "$MOZ_WIDGET_TOOLKIT" in
5718 beos|windows|os2|mac|cocoa)
5719     ;;
5721     if test -z "$MOZ_ENABLE_GTK2"; then
5722        MOZ_IMG_DECODERS_DEFAULT=`echo $MOZ_IMG_DECODERS_DEFAULT | sed -e 's|icon||'`                
5723     fi
5724     ;;
5725 esac
5727 MOZ_ARG_ENABLE_STRING(image-decoders,
5728 [  --enable-image-decoders[={mod1,mod2,default,all,none}]
5729                           Enable specific image decoders],
5730 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5731     if test "$option" = "yes" || test "$option" = "all"; then
5732         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5733     elif test "$option" = "no" || test "$option" = "none"; then
5734         MOZ_IMG_DECODERS=""
5735     elif test "$option" = "default"; then
5736         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5737     elif test `echo "$option" | grep -c \^-` != 0; then
5738         option=`echo $option | sed 's/^-//'`
5739         MOZ_IMG_DECODERS=`echo "$MOZ_IMG_DECODERS" | sed "s/ ${option}//"`
5740     else
5741         MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $option"
5742     fi
5743 done],
5744     MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS_DEFAULT")
5746 dnl Dupes are removed in the encoder section because it will also add decoders
5748 dnl ========================================================
5749 dnl Image encoders
5750 dnl ========================================================
5751 MOZ_ARG_ENABLE_STRING(image-encoders,
5752 [  --enable-image-encoders[={mod1,mod2,default,all,none}]
5753                           Enable specific image encoders],
5754 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5755     if test "$option" = "yes" || test "$option" = "all"; then
5756         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5757     elif test "$option" = "no" || test "$option" = "none"; then
5758         MOZ_IMG_ENCODERS=""
5759         addencoder=""
5760     elif test "$option" = "default"; then
5761         addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5762     elif test `echo "$option" | grep -c \^-` != 0; then
5763         option=`echo $option | sed 's/^-//'`
5764         addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
5765     else
5766         addencoder="$option"
5767     fi
5768     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
5769 done],
5770     MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
5772 dnl Remove dupes
5773 MOZ_IMG_DECODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_DECODERS}`
5774 MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
5776 dnl ========================================================
5777 dnl experimental ldap features
5778 dnl ========================================================
5779 MOZ_ARG_ENABLE_BOOL(ldap-experimental,
5780 [  --enable-ldap-experimental
5781                           Enable LDAP experimental features],
5782     MOZ_LDAP_XPCOM_EXPERIMENTAL=1,
5783     MOZ_LDAP_XPCOM_EXPERIMENTAL=)
5785 dnl ========================================================
5786 dnl MathML on by default
5787 dnl ========================================================
5788 MOZ_ARG_DISABLE_BOOL(mathml,
5789 [  --disable-mathml        Disable MathML support],
5790     MOZ_MATHML=,
5791     MOZ_MATHML=1 )
5792 if test "$MOZ_MATHML"; then
5793   AC_DEFINE(MOZ_MATHML)
5796 dnl ========================================================
5797 dnl Canvas
5798 dnl ========================================================
5799 MOZ_ARG_DISABLE_BOOL(canvas,
5800 [  --disable-canvas          Disable html:canvas feature],
5801     MOZ_ENABLE_CANVAS=,
5802     MOZ_ENABLE_CANVAS=1 )
5803 if test -n "$MOZ_ENABLE_CANVAS"; then
5804     AC_DEFINE(MOZ_ENABLE_CANVAS)
5806 AC_SUBST(MOZ_ENABLE_CANVAS)
5808 dnl ========================================================
5809 dnl SVG
5810 dnl ========================================================
5811 MOZ_ARG_DISABLE_BOOL(svg,
5812 [  --disable-svg            Disable SVG support],
5813     MOZ_SVG=,
5814     MOZ_SVG=1 )
5815 if test -n "$MOZ_SVG"; then
5816   AC_DEFINE(MOZ_SVG)
5819 dnl ========================================================
5820 dnl Installer
5821 dnl ========================================================
5822 case "$target_os" in
5823     aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*)
5824         MOZ_INSTALLER=1
5825         ;;
5826 esac
5828 MOZ_ARG_DISABLE_BOOL(installer,
5829 [  --disable-installer     Disable building of installer],
5830     MOZ_INSTALLER=,
5831     MOZ_INSTALLER=1 )
5832 if test -n "$MOZ_INSTALLER" -a -n "$MOZ_XUL_APP" -a "$OS_ARCH" = "WINNT"; then
5833     # Disable installer for Windows builds that use the new toolkit if NSIS
5834     # isn't in the path.
5835     AC_PATH_PROGS(MAKENSIS, makensis)
5836     if test -z "$MAKENSIS" || test "$MAKENSIS" = ":"; then
5837         AC_MSG_ERROR([To build the installer makensis is required in your path. To build without the installer reconfigure using --disable-installer.])
5838     fi
5839     # The Windows build for NSIS requires the iconv command line utility to
5840     # convert the charset of the locale files.
5841     AC_PATH_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
5842     if test -z "$HOST_ICONV"; then
5843         AC_MSG_ERROR([To build the installer iconv is required in your path. To build without the installer reconfigure using --disable-installer.])
5844     fi
5847 # Automatically disable installer if xpinstall isn't built
5848 if test -z "$MOZ_XPINSTALL"; then
5849     MOZ_INSTALLER=
5851 AC_SUBST(MOZ_INSTALLER)
5853 AC_MSG_CHECKING([for tar archiver])
5854 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
5855 if test -z "$TAR"; then
5856     AC_MSG_ERROR([no tar archiver found in \$PATH])
5858 AC_MSG_RESULT([$TAR])
5859 AC_SUBST(TAR)
5861 dnl ========================================================
5862 dnl Updater
5863 dnl ========================================================
5865 MOZ_ARG_DISABLE_BOOL(updater,
5866 [  --disable-updater       Disable building of updater],
5867     MOZ_UPDATER=,
5868     MOZ_UPDATER=1 )
5869 # The Windows build requires the iconv command line utility
5870 # in order to build the updater.
5871 case "$target_os" in
5872     msvc*|mks*|cygwin*|mingw*|wince*)
5873         if test -n "$MOZ_UPDATER"; then
5874             AC_MSG_CHECKING([for iconv])
5875             AC_CHECK_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
5876             if test -z "$HOST_ICONV"; then
5877                 AC_MSG_ERROR([iconv not found in \$PATH])
5878             fi
5879         fi
5880         ;;
5881 esac
5882 AC_SUBST(MOZ_UPDATER)
5884 # app update channel is 'default' when not supplied.
5885 MOZ_ARG_ENABLE_STRING([update-channel],
5886 [  --enable-update-channel=CHANNEL
5887                            Select application update channel (default=default)],
5888     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
5890 if test -z "$MOZ_UPDATE_CHANNEL"; then
5891     MOZ_UPDATE_CHANNEL=default
5893 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
5895 # tools/update-packaging is not checked out by default.
5896 MOZ_ARG_ENABLE_BOOL(update-packaging,
5897 [  --enable-update-packaging
5898                            Enable tools/update-packaging],
5899     MOZ_UPDATE_PACKAGING=1,
5900     MOZ_UPDATE_PACKAGING= )
5901 AC_SUBST(MOZ_UPDATE_PACKAGING)
5903 dnl ========================================================
5904 dnl ActiveX
5905 dnl ========================================================
5907 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
5908 [  --disable-xpconnect-idispatch
5909                           Disable building of xpconnect support for IDispatch
5910                           (win32 only)],
5911     XPC_IDISPATCH_SUPPORT=,
5912     XPC_IDISPATCH_SUPPORT=1)
5913 AC_SUBST(XPC_IDISPATCH_SUPPORT)
5915 MOZ_ARG_DISABLE_BOOL(activex,
5916 [  --disable-activex       Disable building of ActiveX control (win32 only)],
5917     MOZ_NO_ACTIVEX_SUPPORT=1,
5918     MOZ_NO_ACTIVEX_SUPPORT= )
5919 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
5921 MOZ_ARG_DISABLE_BOOL(activex-scripting,
5922 [  --disable-activex-scripting
5923                           Disable building of ActiveX scripting support (win32)],
5924     MOZ_ACTIVEX_SCRIPTING_SUPPORT=,
5925     MOZ_ACTIVEX_SCRIPTING_SUPPORT=1)
5926 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
5928 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
5929 then
5930     AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
5933 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
5934 case "$target" in
5935 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5936     if test "$ac_cv_header_atlbase_h" = "no"; then
5937         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.])
5938     fi
5939     ;;
5940 esac
5943 dnl ========================================================
5944 dnl leaky
5945 dnl ========================================================
5946 MOZ_ARG_ENABLE_BOOL(leaky,
5947 [  --enable-leaky          Build leaky memory tool],
5948     MOZ_LEAKY=1,
5949     MOZ_LEAKY=)
5952 dnl ========================================================
5953 dnl xpctools
5954 dnl ========================================================
5955 MOZ_ARG_ENABLE_BOOL(xpctools,
5956 [  --enable-xpctools       Build JS profiling tool],
5957     MOZ_XPCTOOLS=1,
5958     MOZ_XPCTOOLS= )
5961 dnl ========================================================
5962 dnl build the tests by default
5963 dnl ========================================================
5964 MOZ_ARG_DISABLE_BOOL(tests,
5965 [  --disable-tests         Do not build test libraries & programs],
5966     ENABLE_TESTS=,
5967     ENABLE_TESTS=1 )
5969 dnl ========================================================
5970 dnl parental controls (for Windows Vista)
5971 dnl ========================================================
5972 MOZ_ARG_DISABLE_BOOL(parental-controls,
5973 [  --disable-parental-controls
5974                            Do not build parental controls],
5975    MOZ_DISABLE_PARENTAL_CONTROLS=1,
5976    MOZ_DISABLE_PARENTAL_CONTROLS=)
5977 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
5978     AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
5981 dnl ========================================================
5982 dnl Vista SDK specific api
5983 dnl ========================================================
5984 MOZ_ARG_DISABLE_BOOL(vista-sdk-requirements,
5985 [  --disable-vista-sdk-requirements
5986                            Do not build Vista SDK specific code],
5987    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1,
5988    MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=)
5989 if test -n "$MOZ_DISABLE_VISTA_SDK_REQUIREMENTS"; then
5990     AC_MSG_WARN([Resulting builds will not be compatible with Windows Vista. (bug 428970)])
5991     AC_DEFINE(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
5992     if test -z "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
5993         AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
5994     fi
5995     MOZ_DISABLE_PARENTAL_CONTROLS=1
5996 else
5997 case "$target" in
5998 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5999     if test "$ac_cv_header_wpcapi_h" = "no"; then
6000         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.])
6001     fi
6002     ;;
6003 esac
6005 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6006 AC_SUBST(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
6008 dnl ========================================================
6009 dnl =
6010 dnl = Module specific options
6011 dnl =
6012 dnl ========================================================
6013 MOZ_ARG_HEADER(Individual module options)
6015 dnl ========================================================
6016 dnl = Enable Lea malloc in xpcom. OFF by default.
6017 dnl ========================================================
6018 MOZ_ARG_ENABLE_BOOL(xpcom-lea,
6019 [  --enable-xpcom-lea      Use Lea malloc in xpcom ],
6020     XPCOM_USE_LEA=1,
6021     XPCOM_USE_LEA= )
6022 if test -n "$XPCOM_USE_LEA"; then
6023     AC_DEFINE(XPCOM_USE_LEA)
6026 dnl ========================================================
6027 dnl = Enable places (new history/bookmarks)
6028 dnl ========================================================
6029 MOZ_ARG_ENABLE_BOOL(places,
6030 [  --enable-places        Enable 'places' bookmark/history implementation],
6031     MOZ_PLACES=1,
6032     MOZ_PLACES= )
6033 if test -n "$MOZ_PLACES"; then
6034     AC_DEFINE(MOZ_PLACES)
6035     if test -z "$MOZ_MAIL_NEWS"; then
6036       MOZ_MORK=
6037     fi
6038     MOZ_MORKREADER=1
6039 else
6040   if test "$MOZ_BUILD_APP" = "browser"; then
6041     AC_MSG_ERROR([Cannot build Firefox with --disable-places.])
6042   fi
6045 dnl ========================================================
6046 dnl = Disable feed handling components
6047 dnl ========================================================
6048 MOZ_ARG_DISABLE_BOOL(feeds,
6049 [  --disable-feeds        Disable feed handling and processing components],
6050     MOZ_FEEDS=,
6051     MOZ_FEEDS=1 )
6052 if test -n "$MOZ_FEEDS"; then
6053     AC_DEFINE(MOZ_FEEDS)
6054 else
6055     if test "$MOZ_BUILD_APP" = "browser"; then
6056         AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6057     fi
6060 dnl ========================================================
6061 dnl = Enable mozStorage
6062 dnl ========================================================
6063 dnl Implicitly enabled by default if building calendar or places
6064 MOZ_ARG_ENABLE_BOOL(storage,
6065 [  --enable-storage        Enable mozStorage module and related components],
6066     MOZ_STORAGE=1,
6067     MOZ_STORAGE= )
6068 if test -n "$MOZ_STORAGE"; then
6069     AC_DEFINE(MOZ_STORAGE)
6072 dnl ========================================================
6073 dnl Check for sqlite
6074 dnl ========================================================
6076 MOZ_NATIVE_SQLITE=
6077 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6078 [  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
6079 MOZ_NATIVE_SQLITE=1,
6080 MOZ_NATIVE_SQLITE= )
6082 if test -z "$MOZ_NATIVE_SQLITE"
6083 then
6084     SQLITE_CFLAGS=
6085     SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,sqlite3,$(DIST)/lib)'
6086 else
6087     PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6090 AC_SUBST(MOZ_NATIVE_SQLITE)
6092 dnl ========================================================
6093 dnl = Enable help viewer (off by default)
6094 dnl ========================================================
6095 MOZ_ARG_ENABLE_BOOL(help-viewer,
6096 [  --enable-help-viewer        Enable help viewer],
6097     MOZ_HELP_VIEWER=1,
6098     MOZ_HELP_VIEWER= )
6099 if test -n "$MOZ_HELP_VIEWER"; then
6100      AC_DEFINE(MOZ_HELP_VIEWER)
6102 AC_SUBST(MOZ_HELP_VIEWER)
6103 if test "$MOZ_BUILD_APP" = "browser" -a -n "$MOZ_HELP_VIEWER"; then
6104     AC_MSG_ERROR([Cannot build Firefox with --enable-help-viewer.])
6107 dnl ========================================================
6108 dnl = Enable safe browsing (anti-phishing)
6109 dnl ========================================================
6110 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6111 [  --enable-safe-browsing        Enable safe browsing (anti-phishing) implementation],
6112     MOZ_SAFE_BROWSING=1,
6113     MOZ_SAFE_BROWSING= )
6114 if test -n "$MOZ_SAFE_BROWSING"; then
6115     AC_DEFINE(MOZ_SAFE_BROWSING)
6117 AC_SUBST(MOZ_SAFE_BROWSING)
6119 dnl ========================================================
6120 dnl = Enable url-classifier
6121 dnl ========================================================
6122 dnl Implicitly enabled by default if building with safe-browsing
6123 if test -n "$MOZ_SAFE_BROWSING"; then
6124     MOZ_URL_CLASSIFIER=1
6126 MOZ_ARG_ENABLE_BOOL(url-classifier,
6127 [  --enable-url-classifier        Enable url classifier module],
6128     MOZ_URL_CLASSIFIER=1,
6129     MOZ_URL_CLASSIFIER= )
6130 if test -n "$MOZ_URL_CLASSIFIER"; then
6131     AC_DEFINE(MOZ_URL_CLASSIFIER)
6133 AC_SUBST(MOZ_URL_CLASSIFIER)
6135 dnl ========================================================
6136 dnl = Disable zipwriter
6137 dnl ========================================================
6138 MOZ_ARG_DISABLE_BOOL(zipwriter,
6139 [  --disable-zipwriter             Disable zipwriter component],
6140     MOZ_ZIPWRITER=,
6141     MOZ_ZIPWRITER=1 )
6142 AC_SUBST(MOZ_ZIPWRITER)
6144 dnl ========================================================
6145 dnl = Enable Ultrasparc specific optimizations for JS
6146 dnl ========================================================
6147 MOZ_ARG_ENABLE_BOOL(js-ultrasparc,
6148 [  --enable-js-ultrasparc  Use UltraSPARC optimizations in JS],
6149     JS_ULTRASPARC_OPTS=1,
6150     JS_ULTRASPARC_OPTS= )
6152 dnl only enable option for ultrasparcs
6153 if test `echo "$target_os" | grep -c \^solaris 2>/dev/null` = 0 -o \
6154     "$OS_TEST" != "sun4u"; then
6155     JS_ULTRASPARC_OPTS=
6157 AC_SUBST(JS_ULTRASPARC_OPTS)
6159 dnl ========================================================
6160 dnl = Hildon and OSSO checks
6161 dnl ========================================================
6162 PKG_CHECK_MODULES(LIBHILONMIME,libhildonmime,
6163                   NS_HILDON=1,
6164                   NS_HILDON=)
6165 if test $NS_HILDON; then
6166    AC_DEFINE(NS_HILDON)
6169 PKG_CHECK_MODULES(LIBOSSO,libosso,
6170                   NS_OSSO=1,
6171                   NS_OSSO=)
6173 if test $NS_OSSO; then
6174     if test -z "$MOZ_ENABLE_DBUS"; then
6175         AC_MSG_ERROR([DBus is required when building for OSSO])
6176     fi
6177     AC_DEFINE(NS_OSSO)     
6180 dnl ========================================================
6181 dnl =
6182 dnl = Feature options that require extra sources to be pulled
6183 dnl =
6184 dnl ========================================================
6185 dnl MOZ_ARG_HEADER(Features that require extra sources)
6187 dnl ========================================================
6188 dnl =
6189 dnl = Debugging Options
6190 dnl = 
6191 dnl ========================================================
6192 MOZ_ARG_HEADER(Debugging and Optimizations)
6194 dnl ========================================================
6195 dnl = Disable building with debug info.
6196 dnl = Debugging is OFF by default
6197 dnl ========================================================
6198 if test -z "$MOZ_DEBUG_FLAGS"
6199 then
6200     case "$target" in
6201     *-irix*)
6202         if test "$GNU_CC"; then
6203             GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'`
6204             case "$GCC_VERSION" in
6205             2.95.*)
6206                 MOZ_DEBUG_FLAGS=""
6207                 ;;
6208             *)
6209                 MOZ_DEBUG_FLAGS="-g"
6210                 ;;
6211             esac
6212         else
6213             MOZ_DEBUG_FLAGS="-g"
6214         fi
6215         ;;
6216     *)
6217         MOZ_DEBUG_FLAGS="-g"
6218         ;;
6219     esac
6222 MOZ_ARG_ENABLE_STRING(debug,
6223 [  --enable-debug[=DBG]    Enable building with developer debug info
6224                           (Using compiler flags DBG)],
6225 [ if test "$enableval" != "no"; then
6226     MOZ_DEBUG=1
6227     if test -n "$enableval" && test "$enableval" != "yes"; then
6228         MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6229     fi
6230   else
6231     MOZ_DEBUG=
6232   fi ],
6233   MOZ_DEBUG=)
6235 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG"
6236  case "${target_os}" in
6237     beos*)
6238         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${USER}"
6239         ;;
6240     msvc*|mks*|cygwin*|mingw*|os2*|wince*)
6241         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
6242         ;;
6243     *) 
6244         MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`$WHOAMI`"
6245         ;;
6246   esac
6247 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DTRACING"
6249 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6251 if test -n "$MOZ_DEBUG"; then
6252     AC_MSG_CHECKING([for valid debug flags])
6253     _SAVE_CFLAGS=$CFLAGS
6254     CFLAGS="$CFLAGS $MOZ_DEBUG_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_DEBUG_FLAGS])
6262     fi
6263     CFLAGS=$_SAVE_CFLAGS
6266 dnl ========================================================
6267 dnl = Enable code optimization. ON by default.
6268 dnl ========================================================
6269 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6270         MOZ_OPTIMIZE_FLAGS="-O"
6273 MOZ_ARG_ENABLE_STRING(optimize,
6274 [  --disable-optimize      Disable compiler optimization
6275   --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6276 [ if test "$enableval" != "no"; then
6277     MOZ_OPTIMIZE=1
6278     if test -n "$enableval" && test "$enableval" != "yes"; then
6279         MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6280         MOZ_OPTIMIZE=2
6281     fi
6282 else
6283     MOZ_OPTIMIZE=
6284 fi ], MOZ_OPTIMIZE=1)
6286 if test "$COMPILE_ENVIRONMENT"; then
6287 if test -n "$MOZ_OPTIMIZE"; then
6288     AC_MSG_CHECKING([for valid optimization flags])
6289     _SAVE_CFLAGS=$CFLAGS
6290     CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6291     AC_TRY_COMPILE([#include <stdio.h>], 
6292         [printf("Hello World\n");],
6293         _results=yes,
6294         _results=no)
6295     AC_MSG_RESULT([$_results])
6296     if test "$_results" = "no"; then
6297         AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6298     fi
6299     CFLAGS=$_SAVE_CFLAGS
6301 fi # COMPILE_ENVIRONMENT
6303 AC_SUBST(MOZ_OPTIMIZE)
6304 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6305 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6306 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6308 dnl ========================================================
6309 dnl = Enable/disable debug for specific modules only
6310 dnl =   module names beginning with ^ will be disabled 
6311 dnl ========================================================
6312 MOZ_ARG_ENABLE_STRING(debug-modules,
6313 [  --enable-debug-modules  Enable/disable debug info for specific modules],
6314 [ MOZ_DEBUG_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
6316 dnl ========================================================
6317 dnl = Enable/disable generation of debugger info for specific modules only
6318 dnl =    the special module name ALL_MODULES can be used to denote all modules
6319 dnl =    module names beginning with ^ will be disabled
6320 dnl ========================================================
6321 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
6322 [  --enable-debugger-info-modules
6323                           Enable/disable debugger info for specific modules],
6324 [ for i in `echo $enableval | sed 's/,/ /g'`; do
6325       dnl note that the list of module names is reversed as it is copied
6326       dnl this is important, as it will allow config.mk to interpret stuff like
6327       dnl "^ALL_MODULES xpcom" properly
6328       if test "$i" = "no"; then
6329         i="^ALL_MODULES"
6330       fi
6331       if test "$i" = "yes"; then
6332         i="ALL_MODULES"
6333       fi
6334       MOZ_DBGRINFO_MODULES="$i $MOZ_DBGRINFO_MODULES";
6335     done ])
6337 dnl ========================================================
6338 dnl Enable garbage collector
6339 dnl ========================================================
6340 MOZ_ARG_ENABLE_BOOL(boehm,
6341 [  --enable-boehm          Enable the Boehm Garbage Collector],
6342     GC_LEAK_DETECTOR=1,
6343     GC_LEAK_DETECTOR= )
6344 if test -n "$GC_LEAK_DETECTOR"; then
6345     AC_DEFINE(GC_LEAK_DETECTOR)
6348 dnl ========================================================
6349 dnl Disable runtime logging checks
6350 dnl ========================================================
6351 MOZ_ARG_DISABLE_BOOL(logging,
6352 [  --disable-logging       Disable logging facilities],
6353     NS_DISABLE_LOGGING=1,
6354     NS_DISABLE_LOGGING= )
6355 if test "$NS_DISABLE_LOGGING"; then
6356     AC_DEFINE(NS_DISABLE_LOGGING)
6357 else
6358     AC_DEFINE(MOZ_LOGGING)
6361 dnl ========================================================
6362 dnl = dnl This will enable logging of addref, release, ctor, dtor.
6363 dnl ========================================================
6364 _ENABLE_LOGREFCNT=42
6365 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6366 [  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
6367     _ENABLE_LOGREFCNT=1,
6368     _ENABLE_LOGREFCNT= )
6369 if test "$_ENABLE_LOGREFCNT" = "1"; then
6370     AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6371 elif test -z "$_ENABLE_LOGREFCNT"; then
6372     AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6375 dnl ========================================================
6376 dnl = Enable trace malloc
6377 dnl ========================================================
6378 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6379 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6380 [  --enable-trace-malloc   Enable malloc tracing],
6381     NS_TRACE_MALLOC=1,
6382     NS_TRACE_MALLOC= )
6383 if test "$NS_TRACE_MALLOC"; then
6384   # Please, Mr. Linker Man, don't take away our symbol names
6385   MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6386   USE_ELF_DYNSTR_GC=
6387   AC_DEFINE(NS_TRACE_MALLOC)
6389 AC_SUBST(NS_TRACE_MALLOC)
6391 dnl ========================================================
6392 dnl = Enable jemalloc
6393 dnl ========================================================
6394 MOZ_ARG_ENABLE_BOOL(jemalloc,
6395 [  --enable-jemalloc       Replace memory allocator with jemalloc],
6396     MOZ_MEMORY=1,
6397     MOZ_MEMORY=)
6399 if test "$NS_TRACE_MALLOC"; then
6400     MOZ_MEMORY=
6403 if test "$MOZ_MEMORY"; then
6405   dnl Don't try to run compiler tests on Windows  
6406   if test "$OS_ARCH" = "WINNT"; then
6407     if test -z "$HAVE_64BIT_OS"; then
6408       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6409     else
6410       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6411     fi
6412   else
6413     AC_CHECK_SIZEOF([int *], [4])
6414     case "${ac_cv_sizeof_int_p}" in
6415     4)
6416       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6417       ;;
6418     8)
6419       AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6420       ;;
6421     *)
6422       AC_MSG_ERROR([Unexpected pointer size])
6423       ;;
6424     esac
6425   fi
6427   AC_DEFINE(MOZ_MEMORY)
6428   if test "x$MOZ_DEBUG" = "x1"; then
6429     AC_DEFINE(MOZ_MEMORY_DEBUG)
6430   fi
6431   dnl The generic feature tests that determine how to compute ncpus are long and
6432   dnl complicated.  Therefore, simply define special cpp variables for the
6433   dnl platforms we have special knowledge of.
6434   case "${target_os}" in
6435   darwin*)
6436     AC_DEFINE(MOZ_MEMORY_DARWIN)
6437     ;;
6438   *-freebsd*)
6439     AC_DEFINE(MOZ_MEMORY_BSD)
6440     ;;
6441   *linux*)
6442     AC_DEFINE(MOZ_MEMORY_LINUX)
6443     ;;
6444   netbsd*)
6445     AC_DEFINE(MOZ_MEMORY_BSD)
6446     ;;
6447   solaris*)
6448     AC_DEFINE(MOZ_MEMORY_SOLARIS)
6449     ;;
6450   msvc*|mks*|cygwin*|mingw*)
6451     AC_DEFINE(MOZ_MEMORY_WINDOWS)
6452     dnl XXX: should test for vc8sp1 here, otherwise patching the crt src
6453     dnl will fail miserably
6454     if test "$_CC_SUITE" -lt "8"; then
6455         AC_MSG_ERROR([Building jemalloc requires Visual C++ 2005 or better])
6456     fi
6457     if test -z "$WIN32_CRT_SRC_DIR" -a -z "$WIN32_CUSTOM_CRT_DIR"; then
6458       if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
6459         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.])
6460       else
6461         WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
6462       fi
6463     fi
6464     if test -z "$WIN32_CRT_SRC_DIR"; then
6465       # pre-built dll
6466       WIN32_CUSTOM_CRT_DIR=`cd "$WIN32_CUSTOM_CRT_DIR" && pwd`
6467       _WIN_UNIX_CRT_PATH="$WIN32_CUSTOM_CRT_DIR"
6468     else
6469       # CRT source directory
6470       WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd`
6471       _CRT_BASE_DIR=`basename "$WIN32_CRT_SRC_DIR"`
6472       _WIN_UNIX_CRT_PATH="$_objdir/memory/jemalloc/$_CRT_BASE_DIR/build/intel"
6473     fi
6474     dnl need win32 paths in LIB, hence this python abuse.  extra brackets
6475     dnl are to avoid m4
6476     _WIN_CRT_PATH=[`$PYTHON -c 'import sys, os.path; print os.path.normpath(sys.argv[1])' "$_WIN_UNIX_CRT_PATH"`]
6477     MOZ_LIB="$_WIN_CRT_PATH;$LIB"
6478     dnl Needs to be in PATH too, since our tools will wind up linked against it.
6479     dnl This needs to be unix style.
6480     MOZ_PATH="$PATH:$_WIN_UNIX_CRT_PATH"
6481     dnl Statically link the C++ stdlib.  We only use this for Breakpad anyway.
6482     AC_DEFINE(_STATIC_CPPLIB)
6483     dnl Don't generate a manifest, since we're linking to a custom CRT.
6484     LDFLAGS="$LDFLAGS -MANIFEST:NO"
6485     dnl Also pass this to NSPR/NSS
6486     DLLFLAGS="$DLLFLAGS -MANIFEST:NO"
6487     export DLLFLAGS
6488     ;;
6489   *)
6490     AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
6491     ;;
6492   esac
6494   AC_ARG_WITH([valgrind],
6495     [  --with-valgrind         Enable valgrind integration hooks],
6496     [enable_valgrind="yes"], [enable_valgrind="no"])
6497   AC_CHECK_HEADER([valgrind/valgrind.h], [], [enable_valgrind="no"])
6498   if test "x$enable_valgrind" = "xyes" ; then
6499     AC_DEFINE(MOZ_VALGRIND)
6500   fi
6502 AC_SUBST(MOZ_MEMORY)
6503 AC_SUBST(WIN32_CRT_SRC_DIR)
6504 AC_SUBST(WIN32_CUSTOM_CRT_DIR)
6505 AC_SUBST(MOZ_LIB)
6506 AC_SUBST(MOZ_PATH)
6507 dnl Need to set this for make because NSS doesn't have configure
6508 AC_SUBST(DLLFLAGS)
6510 dnl ========================================================
6511 dnl = Use malloc wrapper lib
6512 dnl ========================================================
6513 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
6514 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
6515     _WRAP_MALLOC=1,
6516     _WRAP_MALLOC= )
6518 if test -n "$_WRAP_MALLOC"; then
6519     if test "$GNU_CC"; then
6520     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"
6521     MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) -o $@'
6522     fi
6525 dnl ========================================================
6526 dnl = Location of malloc wrapper lib
6527 dnl ========================================================
6528 MOZ_ARG_WITH_STRING(wrap-malloc,
6529 [  --with-wrap-malloc=DIR  Location of malloc wrapper library],
6530     WRAP_MALLOC_LIB=$withval)
6532 dnl ========================================================
6533 dnl = Use Electric Fence
6534 dnl ========================================================
6535 MOZ_ARG_ENABLE_BOOL(efence,
6536 [  --enable-efence         Link with Electric Fence],
6537     _ENABLE_EFENCE=1,
6538     _ENABLE_EFENCE= )
6539 if test -n "$_ENABLE_EFENCE"; then
6540     AC_CHECK_LIB(efence,malloc)
6543 dnl ========================================================
6544 dnl jprof
6545 dnl ========================================================
6546 MOZ_ARG_ENABLE_BOOL(jprof,
6547 [  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof)],
6548     MOZ_JPROF=1,
6549     MOZ_JPROF= )
6550 if test -n "$MOZ_JPROF"; then
6551     AC_DEFINE(MOZ_JPROF)
6554 dnl ========================================================
6555 dnl shark
6556 dnl ========================================================
6557 MOZ_ARG_ENABLE_BOOL(shark,
6558 [  --enable-shark          Enable shark remote profiling (needs CHUD framework)],
6559     MOZ_SHARK=1,
6560     MOZ_SHARK= )
6561 if test -n "$MOZ_SHARK"; then
6562     AC_DEFINE(MOZ_SHARK)
6565 dnl ========================================================
6566 dnl callgrind
6567 dnl ========================================================
6568 MOZ_ARG_ENABLE_BOOL(callgrind,
6569 [  --enable-callgrind      Enable callgrind profiling],
6570     MOZ_CALLGRIND=1,
6571     MOZ_CALLGRIND= )
6572 if test -n "$MOZ_CALLGRIND"; then
6573     AC_DEFINE(MOZ_CALLGRIND)
6576 dnl ========================================================
6577 dnl vtune
6578 dnl ========================================================
6579 MOZ_ARG_ENABLE_BOOL(vtune,
6580 [  --enable-vtune          Enable vtune profiling],
6581     MOZ_VTUNE=1,
6582     MOZ_VTUNE= )
6583 if test -n "$MOZ_VTUNE"; then
6584     AC_DEFINE(MOZ_VTUNE)
6587 dnl ========================================================
6588 dnl = Enable static checking using gcc-dehydra
6589 dnl ========================================================
6591 MOZ_ARG_WITH_STRING(static-checking,
6592 [  --with-static-checking=path/to/gcc_dehydra.so
6593                             Enable static checking of code using GCC-dehydra],
6594     DEHYDRA_PATH=$withval,
6595     DEHYDRA_PATH= )
6597 if test -n "$DEHYDRA_PATH"; then
6598     if ! test -f "$DEHYDRA_PATH"; then
6599         AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
6600     fi
6601     AC_DEFINE(NS_STATIC_CHECKING)
6603 AC_SUBST(DEHYDRA_PATH)
6605 dnl ========================================================
6606 dnl = Enable stripping of libs & executables
6607 dnl ========================================================
6608 MOZ_ARG_ENABLE_BOOL(strip,
6609 [  --enable-strip          Enable stripping of libs & executables ],
6610     ENABLE_STRIP=1,
6611     ENABLE_STRIP= )
6613 dnl ========================================================
6614 dnl = Enable stripping of libs & executables when packaging
6615 dnl ========================================================
6616 MOZ_ARG_ENABLE_BOOL(install-strip,
6617 [  --enable-install-strip  Enable stripping of libs & executables when packaging ],
6618     PKG_SKIP_STRIP= ,
6619     PKG_SKIP_STRIP=1)
6621 dnl ========================================================
6622 dnl = --enable-elf-dynstr-gc
6623 dnl ========================================================
6624 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
6625 [  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
6626     USE_ELF_DYNSTR_GC=1,
6627     USE_ELF_DYNSTR_GC= )
6629 dnl ========================================================
6630 dnl = --enable-old-abi-compat-wrappers
6631 dnl ========================================================
6632 dnl on x86 linux, the current builds of some popular plugins (notably
6633 dnl flashplayer and real) expect a few builtin symbols from libgcc
6634 dnl which were available in some older versions of gcc.  However,
6635 dnl they're _NOT_ available in newer versions of gcc (eg 3.1), so if
6636 dnl we want those plugin to work with a gcc-3.1 built binary, we need
6637 dnl to provide these symbols.  MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS defaults
6638 dnl to true on x86 linux, and false everywhere else.
6641 MOZ_ARG_ENABLE_BOOL(old-abi-compat-wrappers,
6642 [  --enable-old-abi-compat-wrappers
6643                           Support old GCC ABI symbols to ease the pain 
6644                           of the linux compiler change],
6645     MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1,
6646     MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS= )
6647 if test "$COMPILE_ENVIRONMENT"; then
6648 if test "$MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS"; then
6649     AC_LANG_SAVE
6650     AC_LANG_CPLUSPLUS
6651     AC_CHECK_FUNCS(__builtin_vec_new __builtin_vec_delete __builtin_new __builtin_delete __pure_virtual)
6652     AC_LANG_RESTORE
6653     AC_DEFINE(MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS)
6655 fi # COMPILE_ENVIRONMENT
6657 dnl ========================================================
6658 dnl = --enable-prebinding
6659 dnl ========================================================
6660 MOZ_ARG_ENABLE_BOOL(prebinding,
6661 [  --enable-prebinding     Enable prebinding (Mac OS X only)],
6662     USE_PREBINDING=1,
6663     USE_PREBINDING= )
6665 dnl ========================================================
6666 dnl = 
6667 dnl = Profiling and Instrumenting
6668 dnl = 
6669 dnl ========================================================
6670 MOZ_ARG_HEADER(Profiling and Instrumenting)
6672 dnl ========================================================
6673 dnl = Enable timeline service, which provides lightweight
6674 dnl = instrumentation of mozilla for performance measurement.
6675 dnl = Timeline is off by default.
6676 dnl ========================================================
6677 MOZ_ARG_ENABLE_BOOL(timeline,
6678 [  --enable-timeline       Enable timeline services ],
6679     MOZ_TIMELINE=1,
6680     MOZ_TIMELINE= )
6681 if test -n "$MOZ_TIMELINE"; then
6682     AC_DEFINE(MOZ_TIMELINE)
6685 dnl ========================================================
6686 dnl Turn on reflow counting
6687 dnl ========================================================
6688 MOZ_ARG_ENABLE_BOOL(reflow-perf,
6689 [  --enable-reflow-perf    Enable reflow performance tracing],
6690     MOZ_REFLOW_PERF=1,
6691     MOZ_REFLOW_PERF= )
6692 if test -n "$MOZ_REFLOW_PREF"; then
6693     AC_DEFINE(MOZ_REFLOW_PREF)
6695 AC_SUBST(MOZ_REFLOW_PERF)
6697 dnl ========================================================
6698 dnl Enable performance metrics.
6699 dnl ========================================================
6700 MOZ_ARG_ENABLE_BOOL(perf-metrics,
6701 [  --enable-perf-metrics   Enable performance metrics],
6702     MOZ_PERF_METRICS=1,
6703     MOZ_PERF_METRICS= )
6704 if test -n "$MOZ_PERF_METRICS"; then
6705     AC_DEFINE(MOZ_PERF_METRICS)
6708 dnl ========================================================
6709 dnl Enable code size metrics.
6710 dnl ========================================================
6711 MOZ_ARG_ENABLE_BOOL(codesighs,
6712 [  --enable-codesighs      Enable code size analysis tools],
6713     _ENABLE_CODESIGHS=1,
6714     _ENABLE_CODESIGHS= )
6715 if test -n "$_ENABLE_CODESIGHS"; then
6716     if test -d $srcdir/tools/codesighs; then 
6717         MOZ_MAPINFO=1
6718     else
6719         AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
6720     fi
6723 dnl ========================================================
6724 dnl = Add support for Eazel profiler
6725 dnl ========================================================
6726 MOZ_ARG_ENABLE_BOOL(eazel-profiler-support,
6727 [  --enable-eazel-profiler-support
6728                           Enable Corel/Eazel profiler support],
6729     ENABLE_EAZEL_PROFILER=1,
6730     ENABLE_EAZEL_PROFILER= )
6731 if test -n "$ENABLE_EAZEL_PROFILER"; then
6732     AC_DEFINE(ENABLE_EAZEL_PROFILER)
6733     USE_ELF_DYNSTR_GC=
6734     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6735     EAZEL_PROFILER_CFLAGS="-g -O -gdwarf-2 -finstrument-functions -D__NO_STRING_INLINES  -D__NO_MATH_INLINES"
6736     EAZEL_PROFILER_LIBS="-lprofiler -lpthread"
6739 MOZ_ARG_ENABLE_STRING(profile-modules,
6740 [  --enable-profile-modules
6741                           Enable/disable profiling for specific modules],
6742 [ MOZ_PROFILE_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
6744 MOZ_ARG_ENABLE_BOOL(insure,
6745 [  --enable-insure         Enable insure++ instrumentation (linux only)],
6746     _ENABLE_INSURE=1,
6747     _ENABLE_INSURE= )
6748 if test -n "$_ENABLE_INSURE"; then
6749     MOZ_INSURE="insure"
6750     MOZ_INSURIFYING=1
6751     MOZ_INSURE_DIRS="."
6752     MOZ_INSURE_EXCLUDE_DIRS="config"
6755 MOZ_ARG_WITH_STRING(insure-dirs,
6756 [  --with-insure-dirs=DIRS
6757                           Dirs to instrument with insure ],
6758     MOZ_INSURE_DIRS=$withval )
6760 MOZ_ARG_WITH_STRING(insure-exclude-dirs,
6761 [  --with-insure-exclude-dirs=DIRS
6762                           Dirs to not instrument with insure ],
6763     MOZ_INSURE_EXCLUDE_DIRS="config $withval" )
6765 dnl ========================================================
6766 dnl = Support for Quantify (Windows)
6767 dnl ========================================================
6768 MOZ_ARG_ENABLE_BOOL(quantify,
6769 [  --enable-quantify      Enable Quantify support (Windows only) ],
6770     MOZ_QUANTIFY=1,
6771     MOZ_QUANTIFY= )
6773 dnl ========================================================
6774 dnl = Support for demangling undefined symbols
6775 dnl ========================================================
6776 if test -z "$SKIP_LIBRARY_CHECKS"; then
6777     AC_LANG_SAVE
6778     AC_LANG_CPLUSPLUS
6779     AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
6780     AC_LANG_RESTORE
6783 # Demangle only for debug or trace-malloc builds
6784 MOZ_DEMANGLE_SYMBOLS=
6785 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
6786     MOZ_DEMANGLE_SYMBOLS=1
6787     AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
6789 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
6791 dnl ========================================================
6792 dnl = Support for gcc stack unwinding (from gcc 3.3)
6793 dnl ========================================================
6794 if test "$HAVE_GCC3_ABI" && test -z "$SKIP_LIBRARY_CHECKS"; then
6795     AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
6798 dnl ========================================================
6799 dnl =
6800 dnl = Misc. Options
6801 dnl = 
6802 dnl ========================================================
6803 MOZ_ARG_HEADER(Misc. Options)
6805 dnl ========================================================
6806 dnl update xterm title
6807 dnl ========================================================
6808 MOZ_ARG_ENABLE_BOOL(xterm-updates,
6809 [  --enable-xterm-updates  Update XTERM titles with current command.],
6810     MOZ_UPDATE_XTERM=1,
6811     MOZ_UPDATE_XTERM= )
6813 dnl =========================================================
6814 dnl = Chrome format
6815 dnl =========================================================
6816 MOZ_ARG_ENABLE_STRING([chrome-format],
6817 [  --enable-chrome-format=jar|flat|both|symlink
6818                           Select FORMAT of chrome files (default=jar)],
6819     MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
6821 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
6822     MOZ_CHROME_FILE_FORMAT=jar
6825 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" && 
6826     test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
6827     test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
6828     test "$MOZ_CHROME_FILE_FORMAT" != "both"; then
6829     AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, or symlink])
6832 dnl ========================================================
6833 dnl = Define default location for MOZILLA_FIVE_HOME
6834 dnl ========================================================
6835 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
6836 [  --with-default-mozilla-five-home
6837                           Set the default value for MOZILLA_FIVE_HOME],
6838 [ val=`echo $withval`
6839   AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
6841 dnl ========================================================
6842 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
6843 dnl ========================================================
6844 MOZ_ARG_WITH_STRING(user-appdir,
6845 [  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
6846 [ val=`echo $withval`
6847 if echo "$val" | grep "\/" >/dev/null; then
6848     AC_MSG_ERROR("Homedir must be single relative path.")
6849 else 
6850     MOZ_USER_DIR="$val"
6851 fi])
6853 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
6855 dnl ========================================================
6856 dnl = Doxygen configuration
6857 dnl ========================================================
6858 dnl Use commas to specify multiple dirs to this arg
6859 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
6860 MOZ_ARG_WITH_STRING(doc-input-dirs,
6861 [  --with-doc-input-dirs=DIRS
6862                           Header/idl dirs to create docs from],
6863 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
6864 AC_SUBST(MOZ_DOC_INPUT_DIRS)
6866 dnl Use commas to specify multiple dirs to this arg
6867 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
6868 MOZ_ARG_WITH_STRING(doc-include-dirs,
6869 [  --with-doc-include-dirs=DIRS  
6870                           Include dirs to preprocess doc headers],
6871 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
6872 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
6874 MOZ_DOC_OUTPUT_DIR='./dist/docs'
6875 MOZ_ARG_WITH_STRING(doc-output-dir,
6876 [  --with-doc-output-dir=DIR
6877                           Dir to generate docs into],
6878 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
6879 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
6881 if test -z "$SKIP_COMPILER_CHECKS"; then
6882 dnl ========================================================
6883 dnl =
6884 dnl = Compiler Options
6885 dnl = 
6886 dnl ========================================================
6887 MOZ_ARG_HEADER(Compiler Options)
6889 dnl ========================================================
6890 dnl Check for gcc -pipe support
6891 dnl ========================================================
6892 AC_MSG_CHECKING([for gcc -pipe support])
6893 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
6894     echo '#include <stdio.h>' > dummy-hello.c
6895     echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
6896     ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
6897     cat dummy-hello.s | ${AS_BIN} -o dummy-hello.S - 2>&5
6898     if test $? = 0; then
6899         _res_as_stdin="yes"
6900     else
6901         _res_as_stdin="no"
6902     fi
6903     if test "$_res_as_stdin" = "yes"; then
6904         _SAVE_CFLAGS=$CFLAGS
6905         CFLAGS="$CFLAGS -pipe"
6906         AC_TRY_COMPILE( [ #include <stdio.h> ],
6907             [printf("Hello World\n");],
6908             [_res_gcc_pipe="yes"],
6909             [_res_gcc_pipe="no"] )
6910         CFLAGS=$_SAVE_CFLAGS
6911     fi
6912     if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
6913         _res="yes";
6914         CFLAGS="$CFLAGS -pipe"
6915         CXXFLAGS="$CXXFLAGS -pipe"
6916     else
6917         _res="no"
6918     fi
6919     rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
6920     AC_MSG_RESULT([$_res])
6921 else
6922     AC_MSG_RESULT([no])
6925 dnl pass -Wno-long-long to the compiler
6926 MOZ_ARG_ENABLE_BOOL(long-long-warning,
6927 [  --enable-long-long-warning 
6928                           Warn about use of non-ANSI long long type],
6929     _IGNORE_LONG_LONG_WARNINGS=,
6930     _IGNORE_LONG_LONG_WARNINGS=1)
6932 if test "$_IGNORE_LONG_LONG_WARNINGS"; then
6933      _SAVE_CFLAGS="$CFLAGS"
6934      CFLAGS="$CFLAGS ${_COMPILER_PREFIX}-Wno-long-long"
6935      AC_MSG_CHECKING([whether compiler supports -Wno-long-long])
6936      AC_TRY_COMPILE([], [return(0);], 
6937         [ _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
6938           _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
6939           result="yes" ], result="no")
6940      AC_MSG_RESULT([$result])
6941      CFLAGS="$_SAVE_CFLAGS"
6944 dnl ========================================================
6945 dnl Profile guided optimization
6946 dnl ========================================================
6947 dnl Test for profiling options
6948 dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities
6949 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
6951 dnl Provide a switch to disable PGO even when called via profiledbuild.
6952 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
6953 [  --disable-profile-guided-optimization
6954                            Don't build with PGO even if called via make profiledbuild],
6955 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
6956 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
6958 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
6960 _SAVE_CFLAGS="$CFLAGS"
6961 CFLAGS="$CFLAGS -fprofile-generate"
6963 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
6964 AC_TRY_COMPILE([], [return 0;],
6965                [ PROFILE_GEN_CFLAGS="-fprofile-generate"
6966                  result="yes" ], result="no")
6967 AC_MSG_RESULT([$result])
6969 if test $result = "yes"; then
6970   PROFILE_GEN_LDFLAGS="-fprofile-generate"
6971   PROFILE_USE_CFLAGS="-fprofile-use"
6972   PROFILE_USE_LDFLAGS="-fprofile-use"
6973 else
6974   CFLAGS="$_SAVE_CFLAGS -fprofile-arcs"
6975   AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs])
6976   AC_TRY_COMPILE([], [return 0;],
6977                  [ PROFILE_GEN_CFLAGS="-fprofile-arcs"
6978                    result="yes" ], result="no")
6979   AC_MSG_RESULT([$result])
6980   if test $result = "yes"; then
6981     PROFILE_USE_CFLAGS="-fbranch-probabilities"
6982   fi
6983   # don't really care, this is an old GCC
6984   PROFILE_GEN_LDFLAGS=
6985   PROFILE_USE_LDFLAGS=
6988 CFLAGS="$_SAVE_CFLAGS"
6990 if test -n "$INTEL_CC"; then
6991   PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
6992   PROFILE_GEN_LDFLAGS=
6993   PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
6994   PROFILE_USE_LDFLAGS=
6997 dnl Sun Studio on Solaris
6998 if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
6999   PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7000   PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7001   if test "$CPU_ARCH" != "sparc"; then
7002     PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7003     PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7004   else
7005     PROFILE_USE_CFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
7006     PROFILE_USE_LDFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
7007   fi
7010 AC_SUBST(PROFILE_GEN_CFLAGS)
7011 AC_SUBST(PROFILE_GEN_LDFLAGS)
7012 AC_SUBST(PROFILE_USE_CFLAGS)
7013 AC_SUBST(PROFILE_USE_LDFLAGS)
7015 AC_LANG_CPLUSPLUS
7017 dnl ========================================================
7018 dnl Test for -pedantic bustage
7019 dnl ========================================================
7020 MOZ_ARG_DISABLE_BOOL(pedantic,
7021 [  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
7022 _PEDANTIC= )
7023 if test "$_PEDANTIC"; then
7024     _SAVE_CXXFLAGS=$CXXFLAGS
7025     CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
7026     AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7027     AC_TRY_COMPILE([$configure_static_assert_macros],
7028                    [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7029                    result="no", result="yes" )
7030     AC_MSG_RESULT([$result])
7031     CXXFLAGS="$_SAVE_CXXFLAGS"
7033     case "$result" in
7034     no)
7035         _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic"
7036         _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
7037         ;;
7038     yes)
7039         AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
7040         ;;
7041     esac
7044 dnl ========================================================
7045 dnl Test for correct temporary object destruction order
7046 dnl ========================================================
7047 dnl We want to make sure the compiler follows the C++ spec here as 
7048 dnl xpcom and the string classes depend on it (bug 235381).
7049 AC_MSG_CHECKING([for correct temporary object destruction order])
7050 AC_TRY_RUN([ class A {
7051              public:  A(int& x) : mValue(x) {}
7052                       ~A() { mValue--; }
7053                       operator char**() { return 0; }
7054              private:  int& mValue;
7055              };
7056              void func(char **arg) {}
7057              int m=2;
7058              void test() {
7059                   func(A(m));
7060                   if (m==1) m = 0;
7061              }
7062              int main() {
7063                  test();
7064                  return(m);
7065              }
7066              ],
7067      result="yes", result="no", result="maybe")
7068 AC_MSG_RESULT([$result])
7070 if test "$result" = "no"; then
7071     AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
7074 dnl ========================================================
7075 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7076 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7077 dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
7078 dnl ========================================================
7079 _SAVE_CXXFLAGS=$CXXFLAGS
7080 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7081 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7082     ac_nscap_nonconst_opeq_bug,
7083     [AC_TRY_COMPILE([
7084                       template <class T>
7085                       class Pointer
7086                         {
7087                         public:
7088                           T* myPtr;
7089                         };
7090                       
7091                       template <class T, class U>
7092                       int operator==(const Pointer<T>& rhs, U* lhs)
7093                         {
7094                           return rhs.myPtr == lhs;
7095                         }
7096                       
7097                       template <class T, class U>
7098                       int operator==(const Pointer<T>& rhs, const U* lhs)
7099                         {
7100                           return rhs.myPtr == lhs;
7101                         }
7102                     ],
7103                     [
7104                       Pointer<int> foo;
7105                       const int* bar;
7106                       return foo == bar;
7107                     ],
7108                     ac_nscap_nonconst_opeq_bug="no",
7109                     ac_nscap_nonconst_opeq_bug="yes")])
7110 CXXFLAGS="$_SAVE_CXXFLAGS"
7112 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7113     AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7115 fi # SKIP_COMPILER_CHECKS
7117 dnl ========================================================
7118 dnl C++ rtti
7119 dnl Should be smarter and check that the compiler does indeed have rtti
7120 dnl ========================================================
7121 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
7122 [  --enable-cpp-rtti       Enable C++ RTTI ],
7123 [ _MOZ_USE_RTTI=1 ],
7124 [ _MOZ_USE_RTTI= ])
7126 if test "$_MOZ_USE_RTTI"; then
7127    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
7128 else
7129    _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
7132 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
7134 dnl ========================================================
7135 dnl C++ exceptions (g++/egcs only - for now)
7136 dnl Should be smarter and check that the compiler does indeed have exceptions
7137 dnl ========================================================
7138 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
7139 [  --enable-cpp-exceptions Enable C++ exceptions ],
7140 [ _MOZ_CPP_EXCEPTIONS=1 ],
7141 [ _MOZ_CPP_EXCEPTIONS= ])
7143 if test "$_MOZ_CPP_EXCEPTIONS"; then
7144     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
7145 else
7146     _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
7149 # Irix & OSF native compilers do not like exception declarations 
7150 # when exceptions are disabled
7151 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
7152     AC_DEFINE(CPP_THROW_NEW, [])
7153 else
7154     AC_DEFINE(CPP_THROW_NEW, [throw()])
7156 AC_LANG_C
7158 dnl ========================================================
7159 dnl =
7160 dnl = Build depencency options
7161 dnl =
7162 dnl ========================================================
7163 MOZ_ARG_HEADER(Build dependencies)
7165 dnl ========================================================
7166 dnl = Do not auto generate dependency info
7167 dnl ========================================================
7168 MOZ_AUTO_DEPS=1
7169 MOZ_ARG_DISABLE_BOOL(auto-deps,
7170 [  --disable-auto-deps     Do not automatically generate dependency info],
7171     MOZ_AUTO_DEPS=,
7172     MOZ_AUTO_DEPS=1)
7174 if test -n "$MOZ_AUTO_DEPS"; then
7175 dnl ========================================================
7176 dnl = Use mkdepend instead of $CC -MD for dependency generation
7177 dnl ========================================================
7178 _cpp_md_flag=
7179 MOZ_ARG_DISABLE_BOOL(md,
7180 [  --disable-md            Do not use compiler-based dependencies ],
7181   [_cpp_md_flag=],
7182   [_cpp_md_flag=1],
7183   [dnl Default is to turn on -MD if using GNU-compatible compilers
7184    if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
7185      _cpp_md_flag=1
7186    fi
7187   dnl Default is to use -xM if using Sun Studio on Solaris
7188    if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
7189      _cpp_md_flag=1
7190    fi])
7191 if test "$_cpp_md_flag"; then
7192   COMPILER_DEPEND=1
7193   if test "$OS_ARCH" = "OpenVMS"; then
7194     _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(*F).pp))'
7195   else
7196     _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(*F).pp)'
7197   fi
7198   dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7199   if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
7200     _DEPEND_CFLAGS=
7201   fi
7202 else
7203   COMPILER_DEPEND=
7204   _USE_CPP_INCLUDE_FLAG=
7205   _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7206   _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7208 fi # MOZ_AUTO_DEPS
7209 MDDEPDIR='.deps'
7210 AC_SUBST(MOZ_AUTO_DEPS)
7211 AC_SUBST(COMPILER_DEPEND)
7212 AC_SUBST(MDDEPDIR)
7215 dnl ========================================================
7216 dnl =
7217 dnl = Static Build Options
7218 dnl =
7219 dnl ========================================================
7220 MOZ_ARG_HEADER(Static build options)
7222 MOZ_ARG_ENABLE_BOOL(static,
7223 [  --enable-static         Enable building of internal static libs],
7224     BUILD_STATIC_LIBS=1,
7225     BUILD_STATIC_LIBS=)
7227 dnl Disable libxul in debug builds, but not for xulrunner.
7228 if test -n "$MOZ_DEBUG" -a "$MOZ_BUILD_APP" != "xulrunner"; then
7229    MOZ_ENABLE_LIBXUL=
7232 MOZ_ARG_ENABLE_BOOL(libxul,
7233 [  --enable-libxul         Enable building of libxul],
7234     MOZ_ENABLE_LIBXUL=1,
7235     MOZ_ENABLE_LIBXUL=)
7237 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
7238         AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
7241 if test -n "$MOZ_ENABLE_LIBXUL" -a -z "$MOZ_XUL_APP"; then
7242         AC_MSG_ERROR([--enable-libxul is only compatible with toolkit XUL applications.])
7245 if test -n "$MOZ_ENABLE_LIBXUL"; then
7246     XPCOM_LIBS="$LIBXUL_LIBS"
7247     AC_DEFINE(MOZ_ENABLE_LIBXUL)
7248 else
7249     if test -n "$BUILD_STATIC_LIBS"; then
7250         AC_DEFINE(MOZ_STATIC_BUILD)
7251     fi
7252     XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
7255 dnl ========================================================
7256 dnl = Force JS to be a static lib
7257 dnl ========================================================
7258 MOZ_ARG_ENABLE_BOOL(js-static-build,
7259 [  --enable-js-static-build  Force js to be a static lib],
7260     JS_STATIC_BUILD=1,
7261     JS_STATIC_BUILD= )
7263 AC_SUBST(JS_STATIC_BUILD)
7264         
7265 if test -n "$JS_STATIC_BUILD"; then
7266     AC_DEFINE(EXPORT_JS_API)
7268 if test -z "$BUILD_STATIC_LIBS"; then
7269     AC_MSG_ERROR([--enable-js-static-build is only compatible with --enable-static])
7274 dnl Disable static mail in debug builds, but not with libxul sdk.
7275 if test -n "$MOZ_DEBUG" -a -z "$LIBXUL_SDK"; then
7276    MOZ_STATIC_MAIL_BUILD=
7278 MOZ_ARG_ENABLE_BOOL(static-mail,
7279 [  --enable-static-mail Enable static mail build support],
7280     MOZ_STATIC_MAIL_BUILD=1,
7281     MOZ_STATIC_MAIL_BUILD= )
7283 if test "$MOZ_STATIC_MAIL_BUILD"; then
7284     AC_DEFINE(MOZ_STATIC_MAIL_BUILD)
7287 AC_SUBST(MOZ_STATIC_MAIL_BUILD)
7289 dnl ========================================================
7290 dnl =
7291 dnl = Standalone module options
7292 dnl = 
7293 dnl ========================================================
7294 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7296 dnl Check for GLib and libIDL.
7297 dnl ========================================================
7298 case "$target_os" in
7299 msvc*|mks*|cygwin*|mingw*|wince*)
7300     SKIP_IDL_CHECK="yes"
7301     ;;
7303     SKIP_IDL_CHECK="no"
7304     ;;
7305 esac
7307 if test -z "$COMPILE_ENVIRONMENT"; then
7308     SKIP_IDL_CHECK="yes"
7311 dnl = Allow users to disable libIDL checking for standalone modules
7312 MOZ_ARG_WITHOUT_BOOL(libIDL,
7313 [  --without-libIDL        Skip check for libIDL (standalone modules only)],
7314         SKIP_IDL_CHECK="yes")
7316 if test "$SKIP_IDL_CHECK" = "no"
7317 then
7318     _LIBIDL_FOUND=
7319     if test "$MACOS_SDK_DIR"; then 
7320       dnl xpidl, and therefore libIDL, is only needed on the build host.
7321       dnl Don't build it against the SDK, as that causes problems.
7322       _MACSAVE_CFLAGS="$CFLAGS"
7323       _MACSAVE_LIBS="$LIBS"
7324       _MACSAVE_LDFLAGS="$LDFLAGS"
7325       _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
7326       changequote(,)
7327       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"`
7328       LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
7329       LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
7330       changequote([,])
7331       unset NEXT_ROOT
7332     fi
7334     if test "$MOZ_ENABLE_GTK2"; then
7335         PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
7336     fi
7337     dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
7338     dnl to either libIDL1 or libIDL2.
7339     if test -z "$_LIBIDL_FOUND"; then
7340         AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
7341         if test -z "$_LIBIDL_FOUND"; then
7342             PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
7343         fi
7344     fi
7345     dnl
7346     dnl If we don't have a libIDL config program & not cross-compiling, 
7347     dnl     look for orbit-config instead.
7348     dnl
7349     if test -z "$_LIBIDL_FOUND" && test -z "$CROSS_COMPILE"; then
7350         AC_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
7351         if test -n "$ORBIT_CONFIG"; then
7352             AC_MSG_CHECKING([for ORBit libIDL usability])
7353                 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
7354             _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
7355             _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
7356             _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
7357             LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
7358             LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
7359             LIBIDL_CONFIG=
7360             _SAVE_CFLAGS="$CFLAGS"
7361             _SAVE_LIBS="$LIBS"
7362             CFLAGS="$LIBIDL_CFLAGS $CFLAGS"
7363             LIBS="$LIBIDL_LIBS $LIBS"
7364             AC_TRY_RUN([
7365 #include <stdlib.h>
7366 #include <libIDL/IDL.h>
7367 int main() {
7368   char *s;
7369   s=strdup(IDL_get_libver_string());
7370   if(s==NULL) {
7371     exit(1);
7372   }
7373   exit(0);
7375             ], [_LIBIDL_FOUND=1
7376                 result="yes"],
7377                [LIBIDL_CFLAGS=
7378                 LIBIDL_LIBS=
7379                 result="no"],
7380                [_LIBIDL_FOUND=1
7381                 result="maybe"] )
7382             AC_MSG_RESULT($result)
7383             CFLAGS="$_SAVE_CFLAGS"
7384             LIBS="$_SAVE_LIBS"
7385         fi
7386     fi
7387     if test -z "$_LIBIDL_FOUND"; then
7388         AC_MSG_ERROR([libIDL not found.
7389         libIDL $LIBIDL_VERSION or higher is required.])
7390     fi
7391     if test "$MACOS_SDK_DIR"; then
7392       CFLAGS="$_MACSAVE_CFLAGS"
7393       LIBS="$_MACSAVE_LIBS"
7394       LDFLAGS="$_MACSAVE_LDFLAGS"
7395       if test -n "$_MACSAVE_NEXT_ROOT" ; then
7396         export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
7397       fi
7398     fi
7401 if test -n "$CROSS_COMPILE"; then
7402      if test -z "$HOST_LIBIDL_CONFIG"; then
7403         HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
7404     fi
7405     if test -n "$HOST_LIBIDL_CONFIG" && test "$HOST_LIBIDL_CONFIG" != "no"; then
7406         HOST_LIBIDL_CFLAGS=`${HOST_LIBIDL_CONFIG} --cflags`
7407         HOST_LIBIDL_LIBS=`${HOST_LIBIDL_CONFIG} --libs`
7408     else
7409         HOST_LIBIDL_CFLAGS="$LIBIDL_CFLAGS"
7410         HOST_LIBIDL_LIBS="$LIBIDL_LIBS"
7411     fi
7414 if test -z "$SKIP_PATH_CHECKS"; then
7415 if test -z "${GLIB_CFLAGS}" || test -z "${GLIB_LIBS}" ; then
7416     if test "$MOZ_ENABLE_GTK2"; then
7417         PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7418     else
7419         AM_PATH_GLIB(${GLIB_VERSION})
7420     fi
7424 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
7425     GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7428 AC_SUBST(LIBIDL_CFLAGS)
7429 AC_SUBST(LIBIDL_LIBS)
7430 AC_SUBST(STATIC_LIBIDL)
7431 AC_SUBST(GLIB_CFLAGS)
7432 AC_SUBST(GLIB_LIBS)
7433 AC_SUBST(GLIB_GMODULE_LIBS)
7434 AC_SUBST(HOST_LIBIDL_CONFIG)
7435 AC_SUBST(HOST_LIBIDL_CFLAGS)
7436 AC_SUBST(HOST_LIBIDL_LIBS)
7438 dnl ========================================================
7439 dnl Check for libart
7440 dnl ========================================================
7441 if test "$MOZ_SVG_RENDERER_LIBART"; then
7442   if test ! -f $topsrcdir/other-licenses/libart_lgpl/Makefile.in; then
7443     AC_MSG_ERROR([You must check out the mozilla version of libart. Use
7444 mk_add_options MOZ_CO_MODULE=mozilla/other-licenses/libart_lgpl])
7445   fi
7447   dnl libart's configure hasn't been run yet, but we know what the
7448   dnl answer should be anyway
7449   MOZ_LIBART_CFLAGS='-I${DIST}/include/libart_lgpl'
7450   case "$target_os" in
7451   msvc*|mks*|cygwin*|mingw*|wince*)
7452       MOZ_LIBART_LIBS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)moz_art_lgpl.$(IMPORT_LIB_SUFFIX)' 
7453       ;;
7454   os2*)
7455       MOZ_LIBART_LIBS='-lmoz_art -lm'
7456       ;;
7457   beos*)
7458       MOZ_LIBART_LIBS='-lmoz_art_lgpl -lroot -lbe'
7459       ;;
7460   *)
7461       MOZ_LIBART_LIBS='-lmoz_art_lgpl -lm'
7462       ;;
7463   esac
7464   AC_FUNC_ALLOCA
7467 AC_SUBST(MOZ_LIBART_CFLAGS)
7468 AC_SUBST(MOZ_LIBART_LIBS)
7470 dnl ========================================================
7471 dnl Check for cairo
7472 dnl ========================================================
7473 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7475 MOZ_TREE_CAIRO=1
7476 MOZ_ARG_ENABLE_BOOL(system-cairo,
7477 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
7478 MOZ_TREE_CAIRO=,
7479 MOZ_TREE_CAIRO=1 )
7481 # Check for headers defining standard int types.
7482 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7484 if test "$MOZ_TREE_CAIRO"; then
7485     AC_DEFINE(MOZ_TREE_CAIRO)
7487     # For now we assume that we will have a uint64_t available through
7488     # one of the above headers or mozstdint.h.
7489     AC_DEFINE(HAVE_UINT64_T)
7491     # Define macros for cairo-features.h
7492     if test "$MOZ_X11"; then
7493         XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7494         XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7495         PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7496         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7497         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7498         MOZ_ENABLE_CAIRO_FT=1
7499         CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7500     fi
7501     if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
7502         QPAINTER_SURFACE_FEATURE="#define CAIRO_HAS_QPAINTER_SURFACE 1"
7503     fi
7504     if test "$MOZ_WIDGET_TOOLKIT" = "mac" -o "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
7505         QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7506         QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7507         QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7508     fi
7509     if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
7510         WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7511         WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7512         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7513     fi
7514     if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
7515         OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
7516         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7517         PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7518         MOZ_ENABLE_CAIRO_FT=1
7519         CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
7520         CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
7521     fi
7522     if test "$MOZ_ENABLE_GLITZ"; then
7523         GLITZ_SURFACE_FEATURE="#define CAIRO_HAS_GLITZ_SURFACE 1"
7524     fi
7525     if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
7526         PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
7527         BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
7528         FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7529         MOZ_ENABLE_CAIRO_FT=1
7530     fi
7531     AC_SUBST(MOZ_ENABLE_CAIRO_FT)
7532     AC_SUBST(CAIRO_FT_CFLAGS)
7534     if test "$MOZ_DEBUG"; then
7535       SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
7536     else
7537       SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
7538     fi
7540     PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
7542     AC_SUBST(PS_SURFACE_FEATURE)
7543     AC_SUBST(PDF_SURFACE_FEATURE)
7544     AC_SUBST(SVG_SURFACE_FEATURE)
7545     AC_SUBST(XLIB_SURFACE_FEATURE)
7546     AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
7547     AC_SUBST(QUARTZ_SURFACE_FEATURE)
7548     AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
7549     AC_SUBST(XCB_SURFACE_FEATURE)
7550     AC_SUBST(WIN32_SURFACE_FEATURE)
7551     AC_SUBST(OS2_SURFACE_FEATURE)
7552     AC_SUBST(BEOS_SURFACE_FEATURE)
7553     AC_SUBST(GLITZ_SURFACE_FEATURE)
7554     AC_SUBST(DIRECTFB_SURFACE_FEATURE)
7555     AC_SUBST(FT_FONT_FEATURE)
7556     AC_SUBST(WIN32_FONT_FEATURE)
7557     AC_SUBST(QUARTZ_FONT_FEATURE)
7558     AC_SUBST(PNG_FUNCTIONS_FEATURE)
7559     AC_SUBST(QPAINTER_SURFACE_FEATURE)
7561     if test "$_WIN32_MSVC"; then
7562         MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib'
7563         if test "$MOZ_ENABLE_GLITZ"; then
7564             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'$(DEPTH)/gfx/cairo/glitz/src/mozglitz.lib $(DEPTH)/gfx/cairo/glitz/src/wgl/mozglitzwgl.lib'
7565         fi
7566     else
7567         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"
7569         if test "$MOZ_X11"; then
7570             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
7571         fi
7573         if test "$MOZ_ENABLE_GLITZ"; then
7574             MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'-L$(DEPTH)/gfx/cairo/glitz/src -lmozglitz'
7575             if test "$MOZ_X11"; then
7576                 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'-L$(DEPTH)/gfx/cairo/glitz/src/glx -lmozglitzglx -lGL'
7577             fi
7578             if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
7579                 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'-L$(DEPTH)/gfx/cairo/glitz/src/wgl -lmozglitzwgl'
7580             fi
7581         fi
7582     fi
7584     CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
7585     mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
7587 else
7588    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION freetype2 fontconfig)
7589    MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
7590    MOZ_CAIRO_LIBS=$CAIRO_LIBS
7591    if test "$MOZ_X11"; then
7592         PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
7593         MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
7594         MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
7595    fi
7598 AC_SUBST(MOZ_TREE_CAIRO)
7599 AC_SUBST(MOZ_CAIRO_CFLAGS)
7600 AC_SUBST(MOZ_CAIRO_LIBS)
7602 dnl ========================================================
7603 dnl Check for lcms
7604 dnl ========================================================
7606 MOZ_NATIVE_LCMS=
7607 MOZ_ARG_ENABLE_BOOL(system-lcms,
7608 [ --enable-system-lcms Use system lcms (located with pkgconfig)],
7609 MOZ_NATIVE_LCMS=1,
7610 MOZ_NATIVE_LCMS= )
7612 if test -z "$MOZ_NATIVE_LCMS"
7613 then
7614     LCMS_CFLAGS=
7615     if test "$_WIN32_MSVC"; then
7616         if test -z "$BUILD_STATIC_LIBS" -a -z "$MOZ_ENABLE_LIBXUL"; then
7617             LCMS_CFLAGS=-DLCMS_DLL
7618         fi
7619         LCMS_LIBS='$(LIBXUL_DIST)/lib/mozlcms.lib'
7620     else
7621         LCMS_LIBS='-L$(LIBXUL_DIST)/bin -lmozlcms'
7622     fi
7623 else
7624     PKG_CHECK_MODULES(LCMS, lcms >= $LCMS_VERSION)
7627 AC_SUBST(MOZ_NATIVE_LCMS)
7628 AC_SUBST(LCMS_CFLAGS)
7629 AC_SUBST(LCMS_LIBS)
7631 dnl ========================================================
7632 dnl disable xul
7633 dnl ========================================================
7634 MOZ_ARG_DISABLE_BOOL(xul,
7635 [  --disable-xul           Disable XUL],
7636     MOZ_XUL= )
7637 if test "$MOZ_XUL"; then
7638   AC_DEFINE(MOZ_XUL)
7639 else
7640   dnl remove extensions that require XUL
7641   MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
7644 AC_SUBST(MOZ_XUL)
7646 dnl ========================================================
7647 dnl Two ways to enable Python support:
7648 dnl   --enable-extensions=python # select all available.
7649 dnl    (MOZ_PYTHON_EXTENSIONS contains the list of extensions)
7650 dnl or:
7651 dnl   --enable-extensions=python/xpcom,... # select individual ones
7653 dnl If either is used, we locate the Python to use.
7654 dnl ========================================================
7656 dnl If 'python' appears anywhere in the extensions list, go lookin'...
7657 if test `echo "$MOZ_EXTENSIONS" | grep -c python` -ne 0; then
7658     dnl Allow PYTHON to point to the Python interpreter to use
7659     dnl (note that it must be the python executable - which we
7660     dnl run to locate the relevant paths etc)
7661     dnl If not set, we use whatever Python we can find.
7662     MOZ_PYTHON=$PYTHON
7663     dnl Ask Python what its version number is
7664     changequote(,)
7665     MOZ_PYTHON_VER=`$PYTHON -c "import sys;print '%d%d' % sys.version_info[0:2]"`
7666     MOZ_PYTHON_VER_DOTTED=`$PYTHON -c "import sys;print '%d.%d' % sys.version_info[0:2]"`
7667     changequote([,])
7668     dnl Ask for the Python "prefix" (ie, home/source dir)
7669     MOZ_PYTHON_PREFIX=`$PYTHON -c "import sys; print sys.prefix"`
7670     dnl Setup the include and library directories.
7671     if test "$OS_ARCH" = "WINNT"; then
7672         MOZ_PYTHON_PREFIX=`$CYGPATH_W $MOZ_PYTHON_PREFIX | $CYGPATH_S`
7673         dnl Source trees have "include" and "PC" for .h, and "PCbuild" for .lib
7674         dnl Binary trees have "include" for .h, and "libs" for .lib
7675         dnl We add 'em both - along with quotes, to handle spaces.
7676         MOZ_PYTHON_DLL_SUFFIX=.pyd
7677         MOZ_PYTHON_INCLUDES="\"-I$MOZ_PYTHON_PREFIX/include\" \"-I$MOZ_PYTHON_PREFIX/PC\""
7678         MOZ_PYTHON_LIBS="\"/libpath:$MOZ_PYTHON_PREFIX/PCBuild\" \"/libpath:$MOZ_PYTHON_PREFIX/libs\""
7679     else
7680         dnl Non-Windows include and libs
7681         MOZ_PYTHON_DLL_SUFFIX=$DLL_SUFFIX
7682         MOZ_PYTHON_INCLUDES="-I$MOZ_PYTHON_PREFIX/include/python$MOZ_PYTHON_VER_DOTTED"
7683         dnl Check for dynamic Python lib
7684         dnl - A static Python is no good - multiple dynamic libraries (xpcom
7685         dnl - core, xpcom loader, pydom etc) all need to share Python.
7686         dnl - Python 2.3's std --enable-shared configure option will
7687         dnl   create a libpython2.3.so.1.0. We should first try this
7688         dnl   dotted versioned .so file because this is the one that
7689         dnl   the PyXPCOM build mechanics tries to link to.
7690         dnl   XXX Should find a better way than hardcoding "1.0".
7691         dnl - Python developement tree dir layouts are NOT allowed here
7692         dnl   because the PyXPCOM build just dies on it later anyway.
7693         dnl - Fixes to the above by Python/*nix knowledgable people welcome!
7694         if test -f "$MOZ_PYTHON_PREFIX/lib/libpython$MOZ_PYTHON_VER_DOTTED.so.1.0"; then
7695             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib -lpython$MOZ_PYTHON_VER_DOTTED"
7696         elif test -f "$MOZ_PYTHON_PREFIX/lib64/libpython$MOZ_PYTHON_VER_DOTTED.so.1.0"; then
7697             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib64 -lpython$MOZ_PYTHON_VER_DOTTED"
7698         elif test -f "$MOZ_PYTHON_PREFIX/lib/libpython$MOZ_PYTHON_VER_DOTTED.so"; then
7699             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib -lpython$MOZ_PYTHON_VER_DOTTED"
7700         elif test -f "$MOZ_PYTHON_PREFIX/libpython$MOZ_PYTHON_VER_DOTTED.so"; then
7701             dnl Don't Python development tree directory layout.
7702             MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX -lpython$MOZ_PYTHON_VER_DOTTED"
7703             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.])
7704         elif test "$OS_ARCH" = "Darwin"; then
7705             dnl We do Darwin last, so if a custom non-framework build of
7706             dnl python is used on OSX, then it will be picked up first by
7707             dnl the logic above.
7708             MOZ_PYTHON_LIBS="-framework Python"
7709         else
7710             AC_MSG_ERROR([Could not find build shared libraries for Python at $MOZ_PYTHON_PREFIX.  This is required for PyXPCOM.])
7711         fi
7712         if test "$OS_ARCH" = "Linux"; then
7713             MOZ_PYTHON_LIBS="$MOZ_PYTHON_LIBS -lutil"
7714         fi
7715     fi
7716     dnl Handle "_d" on Windows
7717     if test "$OS_ARCH" = "WINNT" && test -n "$MOZ_DEBUG"; then
7718         MOZ_PYTHON_DEBUG_SUFFIX="_d"
7719     else
7720         MOZ_PYTHON_DEBUG_SUFFIX=
7721     fi
7722     AC_MSG_RESULT(Building Python extensions using python-$MOZ_PYTHON_VER_DOTTED from $MOZ_PYTHON_PREFIX)
7725 dnl If the user asks for the 'python' extension, then we add
7726 dnl MOZ_PYTHON_EXTENSIONS to MOZ_EXTENSIONS - but with the leading 'python/'
7727 dnl Note the careful regex - it must match 'python' followed by anything
7728 dnl other than a '/', including the end-of-string.
7729 if test `echo "$MOZ_EXTENSIONS" | grep -c 'python\([[^/]]\|$\)'` -ne 0; then
7730     for pyext in $MOZ_PYTHON_EXTENSIONS; do
7731         MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS python/$pyext`
7732     done
7734 dnl Later we may allow MOZ_PYTHON_EXTENSIONS to be specified on the
7735 dnl command-line, but not yet
7736 AC_SUBST(MOZ_PYTHON_EXTENSIONS)
7737 AC_SUBST(MOZ_PYTHON)
7738 AC_SUBST(MOZ_PYTHON_PREFIX)
7739 AC_SUBST(MOZ_PYTHON_INCLUDES)
7740 AC_SUBST(MOZ_PYTHON_LIBS)
7741 AC_SUBST(MOZ_PYTHON_VER)
7742 AC_SUBST(MOZ_PYTHON_VER_DOTTED)
7743 AC_SUBST(MOZ_PYTHON_DEBUG_SUFFIX)
7744 AC_SUBST(MOZ_PYTHON_DLL_SUFFIX)
7746 dnl ========================================================
7747 dnl disable profile sharing
7748 dnl ========================================================
7749 MOZ_ARG_DISABLE_BOOL(profilesharing,
7750 [  --disable-profilesharing           Disable profile sharing],
7751     MOZ_PROFILESHARING=,
7752     MOZ_PROFILESHARING=1 )
7753 if test "$MOZ_PROFILESHARING"; then
7754   MOZ_IPCD=1
7755   AC_DEFINE(MOZ_PROFILESHARING)
7758 dnl ========================================================
7759 dnl enable ipc/ipcd
7760 dnl ========================================================
7761 MOZ_ARG_ENABLE_BOOL(ipcd,
7762 [  --enable-ipcd                      Enable IPC daemon],
7763     MOZ_IPCD=1,
7764     MOZ_IPCD= )
7766 dnl ========================================================
7767 dnl disable profile locking
7768 dnl   do no use this in applications that can have more than
7769 dnl   one process accessing the profile directory.
7770 dnl ========================================================
7771 MOZ_ARG_DISABLE_BOOL(profilelocking,
7772 [  --disable-profilelocking           Disable profile locking],
7773     MOZ_PROFILELOCKING=,
7774     MOZ_PROFILELOCKING=1 )
7775 if test "$MOZ_PROFILELOCKING"; then
7776   AC_DEFINE(MOZ_PROFILELOCKING)
7779 dnl ========================================================
7780 dnl disable rdf services
7781 dnl ========================================================
7782 MOZ_ARG_DISABLE_BOOL(rdf,
7783 [  --disable-rdf           Disable RDF],
7784     MOZ_RDF= )
7785 if test "$MOZ_RDF"; then
7786   AC_DEFINE(MOZ_RDF)
7789 AC_SUBST(MOZ_RDF)
7791 dnl ========================================================
7792 dnl necko configuration options
7793 dnl ========================================================
7796 dnl option to disable various necko protocols
7798 MOZ_ARG_ENABLE_STRING(necko-protocols,
7799 [  --enable-necko-protocols[={http,ftp,default,all,none}]
7800                           Enable/disable specific protocol handlers],
7801 [ for option in `echo $enableval | sed 's/,/ /g'`; do
7802     if test "$option" = "yes" || test "$option" = "all"; then
7803         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7804     elif test "$option" = "no" || test "$option" = "none"; then
7805         NECKO_PROTOCOLS=""
7806     elif test "$option" = "default"; then
7807         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7808     elif test `echo "$option" | grep -c \^-` != 0; then
7809         option=`echo $option | sed 's/^-//'`
7810         NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
7811     else
7812         NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
7813     fi
7814 done],
7815     NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
7816 dnl Remove dupes
7817 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
7818 AC_SUBST(NECKO_PROTOCOLS)
7819 for p in $NECKO_PROTOCOLS; do
7820     AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
7821 done
7824 dnl option to disable necko's disk cache
7826 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
7827 [  --disable-necko-disk-cache
7828                           Disable necko disk cache],
7829     NECKO_DISK_CACHE=,
7830     NECKO_DISK_CACHE=1)
7831 AC_SUBST(NECKO_DISK_CACHE)
7832 if test "$NECKO_DISK_CACHE"; then
7833     AC_DEFINE(NECKO_DISK_CACHE)
7837 dnl option to minimize size of necko's i/o buffers
7839 MOZ_ARG_ENABLE_BOOL(necko-small-buffers,
7840 [  --enable-necko-small-buffers
7841                           Minimize size of necko's i/o buffers],
7842     NECKO_SMALL_BUFFERS=1,
7843     NECKO_SMALL_BUFFERS=)
7844 AC_SUBST(NECKO_SMALL_BUFFERS)
7845 if test "$NECKO_SMALL_BUFFERS"; then
7846     AC_DEFINE(NECKO_SMALL_BUFFERS)
7847 fi 
7850 dnl option to disable cookies
7852 MOZ_ARG_DISABLE_BOOL(cookies,
7853 [  --disable-cookies       Disable cookie support],
7854     NECKO_COOKIES=,
7855     NECKO_COOKIES=1)
7856 AC_SUBST(NECKO_COOKIES)
7857 if test "$NECKO_COOKIES"; then
7858     AC_DEFINE(NECKO_COOKIES)
7861 dnl NECKO_ configuration options are not global
7862 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
7864 dnl ========================================================
7865 dnl string api compatibility
7866 dnl ========================================================
7867 MOZ_ARG_DISABLE_BOOL(v1-string-abi,
7868 [  --disable-v1-string-abi   Disable binary compatibility layer for strings],
7869     MOZ_V1_STRING_ABI=,
7870     MOZ_V1_STRING_ABI=1)
7871 AC_SUBST(MOZ_V1_STRING_ABI)
7872 if test "$MOZ_V1_STRING_ABI"; then
7873     AC_DEFINE(MOZ_V1_STRING_ABI)
7876 dnl Only build Mork if it's required
7877 AC_SUBST(MOZ_MORK)
7878 if test "$MOZ_MORK"; then
7879   AC_DEFINE(MOZ_MORK)
7882 dnl Build the lightweight Mork reader if required
7883 AC_SUBST(MOZ_MORKREADER)
7884 if test "$MOZ_MORKREADER"; then
7885   AC_DEFINE(MOZ_MORKREADER)
7888 dnl ========================================================
7889 if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"; then
7890     MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7893 if test "$MOZ_LDAP_XPCOM"; then
7894     LDAP_CFLAGS='-I${DIST}/public/ldap'
7895     if test "$OS_ARCH" = "WINNT"; then
7896         if test -n "$GNU_CC"; then
7897             LDAP_LIBS='-L$(DIST)/lib -lnsldap32v60 -lnsldappr32v60 -lnsldif32v60'
7898         else
7899             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}'
7900         fi
7901     elif test "$OS_ARCH" = "OS2"; then
7902             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}'
7903     else
7904         LDAP_LIBS='-L${DIST}/bin -L${DIST}/lib -lldap60 -lprldap60 -lldif60'
7905     fi
7908 dnl ========================================================
7909 dnl =
7910 dnl = Maintainer debug option (no --enable equivalent)
7911 dnl =
7912 dnl ========================================================
7914 AC_SUBST(AR)
7915 AC_SUBST(AR_FLAGS)
7916 AC_SUBST(AR_LIST)
7917 AC_SUBST(AR_EXTRACT)
7918 AC_SUBST(AR_DELETE)
7919 AC_SUBST(AS)
7920 AC_SUBST(ASFLAGS)
7921 AC_SUBST(AS_DASH_C_FLAG)
7922 AC_SUBST(LD)
7923 AC_SUBST(RC)
7924 AC_SUBST(RCFLAGS)
7925 AC_SUBST(WINDRES)
7926 AC_SUBST(USE_SHORT_LIBNAME)
7927 AC_SUBST(IMPLIB)
7928 AC_SUBST(FILTER)
7929 AC_SUBST(BIN_FLAGS)
7930 AC_SUBST(NS_USE_NATIVE)
7931 AC_SUBST(MOZ_WIDGET_TOOLKIT)
7932 AC_SUBST(MOZ_GFX_TOOLKIT)
7933 AC_SUBST(MOZ_UPDATE_XTERM)
7934 AC_SUBST(MINIMO)
7935 AC_SUBST(NS_HILDON)
7936 AC_SUBST(NS_OSSO)
7937 AC_SUBST(MOZ_AUTH_EXTENSION)
7938 AC_SUBST(MOZ_MATHML)
7939 AC_SUBST(MOZ_PERMISSIONS)
7940 AC_SUBST(MOZ_XTF)
7941 AC_SUBST(MOZ_NO_INSPECTOR_APIS)
7942 AC_SUBST(MOZ_PREF_EXTENSIONS)
7943 AC_SUBST(MOZ_SVG)
7944 AC_SUBST(MOZ_XSLT_STANDALONE)
7945 AC_SUBST(MOZ_JS_LIBS)
7946 AC_SUBST(MOZ_PSM)
7947 AC_SUBST(MOZ_DEBUG)
7948 AC_SUBST(MOZ_DEBUG_MODULES)
7949 AC_SUBST(MOZ_PROFILE_MODULES)
7950 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
7951 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
7952 AC_SUBST(MOZ_DEBUG_FLAGS)
7953 AC_SUBST(MOZ_DEBUG_LDFLAGS)
7954 AC_SUBST(WARNINGS_AS_ERRORS)
7955 AC_SUBST(MOZ_DBGRINFO_MODULES)
7956 AC_SUBST(MOZ_EXTENSIONS)
7957 AC_SUBST(MOZ_IMG_DECODERS)
7958 AC_SUBST(MOZ_IMG_ENCODERS)
7959 AC_SUBST(MOZ_JSDEBUGGER)
7960 AC_SUBST(MOZ_OJI)
7961 AC_SUBST(MOZ_NO_XPCOM_OBSOLETE)
7962 AC_SUBST(MOZ_PLUGINS)
7963 AC_SUBST(ENABLE_EAZEL_PROFILER)
7964 AC_SUBST(EAZEL_PROFILER_CFLAGS)
7965 AC_SUBST(EAZEL_PROFILER_LIBS)
7966 AC_SUBST(MOZ_PERF_METRICS)
7967 AC_SUBST(GC_LEAK_DETECTOR)
7968 AC_SUBST(MOZ_LOG_REFCNT)
7969 AC_SUBST(MOZ_LEAKY)
7970 AC_SUBST(MOZ_JPROF)
7971 AC_SUBST(MOZ_SHARK)
7972 AC_SUBST(MOZ_CALLGRIND)
7973 AC_SUBST(MOZ_VTUNE)
7974 AC_SUBST(MOZ_XPCTOOLS)
7975 AC_SUBST(MOZ_JSLOADER)
7976 AC_SUBST(MOZ_USE_NATIVE_UCONV)
7977 AC_SUBST(MOZ_INSURE)
7978 AC_SUBST(MOZ_INSURE_DIRS)
7979 AC_SUBST(MOZ_INSURE_EXCLUDE_DIRS)
7980 AC_SUBST(MOZ_QUANTIFY)
7981 AC_SUBST(MOZ_INSURIFYING)
7982 AC_SUBST(MOZ_LDAP_XPCOM)
7983 AC_SUBST(MOZ_LDAP_XPCOM_EXPERIMENTAL)
7984 AC_SUBST(LDAP_CFLAGS)
7985 AC_SUBST(LDAP_LIBS)
7986 AC_SUBST(LIBICONV)
7987 AC_SUBST(MOZ_PLACES)
7988 AC_SUBST(MOZ_PLACES_BOOKMARKS)
7989 AC_SUBST(MOZ_STORAGE)
7990 AC_SUBST(MOZ_FEEDS)
7991 AC_SUBST(NS_PRINTING)
7993 AC_SUBST(MOZ_JAVAXPCOM)
7994 AC_SUBST(JAVA_INCLUDE_PATH)
7995 AC_SUBST(JAVA)
7996 AC_SUBST(JAVAC)
7997 AC_SUBST(JAR)
7999 AC_SUBST(MOZ_PROFILESHARING)
8000 AC_SUBST(MOZ_PROFILELOCKING)
8002 AC_SUBST(MOZ_IPCD)
8004 AC_SUBST(HAVE_XIE)
8005 AC_SUBST(MOZ_XIE_LIBS)
8006 AC_SUBST(MOZ_ENABLE_POSTSCRIPT)
8008 AC_SUBST(XPCOM_USE_LEA)
8009 AC_SUBST(BUILD_STATIC_LIBS)
8010 AC_SUBST(MOZ_ENABLE_LIBXUL)
8011 AC_SUBST(ENABLE_TESTS)
8012 AC_SUBST(IBMBIDI)
8013 AC_SUBST(MOZ_UNIVERSALCHARDET)
8014 AC_SUBST(ACCESSIBILITY)
8015 AC_SUBST(MOZ_XPINSTALL)
8016 AC_SUBST(MOZ_VIEW_SOURCE)
8017 AC_SUBST(MOZ_SPELLCHECK)
8018 AC_SUBST(MOZ_XPFE_COMPONENTS)
8019 AC_SUBST(MOZ_USER_DIR)
8020 AC_SUBST(MOZ_CRASHREPORTER)
8021 AC_SUBST(MOZ_MOCHITEST)
8023 AC_SUBST(ENABLE_STRIP)
8024 AC_SUBST(PKG_SKIP_STRIP)
8025 AC_SUBST(USE_ELF_DYNSTR_GC)
8026 AC_SUBST(USE_PREBINDING)
8027 AC_SUBST(INCREMENTAL_LINKER)
8028 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8029 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8030 AC_SUBST(MOZ_XPCOM_OBSOLETE_LIBS)
8032 AC_SUBST(MOZ_FIX_LINK_PATHS)
8033 AC_SUBST(XPCOM_LIBS)
8034 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8035 AC_SUBST(XPCOM_GLUE_LDOPTS)
8036 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8038 AC_SUBST(USE_DEPENDENT_LIBS)
8040 AC_SUBST(MOZ_BUILD_ROOT)
8041 AC_SUBST(MOZ_OS2_TOOLS)
8042 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
8044 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8045 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8046 AC_SUBST(MOZ_TIMELINE)
8047 AC_SUBST(WINCE)
8048 AC_SUBST(TARGET_DEVICE)
8050 AC_SUBST(MOZ_APP_NAME)
8051 AC_SUBST(MOZ_APP_DISPLAYNAME)
8052 AC_SUBST(MOZ_APP_VERSION)
8053 AC_SUBST(FIREFOX_VERSION)
8054 AC_SUBST(THUNDERBIRD_VERSION)
8055 AC_SUBST(SUNBIRD_VERSION)
8056 AC_SUBST(SEAMONKEY_VERSION)
8058 AC_SUBST(MOZ_PKG_SPECIAL)
8060 AC_SUBST(MOZILLA_OFFICIAL)
8061 AC_SUBST(BUILD_OFFICIAL)
8062 AC_SUBST(MOZ_MILESTONE_RELEASE)
8064 dnl win32 options
8065 AC_SUBST(MOZ_PROFILE)
8066 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8067 AC_SUBST(MOZ_MAPINFO)
8068 AC_SUBST(MOZ_BROWSE_INFO)
8069 AC_SUBST(MOZ_TOOLS_DIR)
8070 AC_SUBST(CYGWIN_WRAPPER)
8071 AC_SUBST(AS_PERL)
8072 AC_SUBST(WIN32_REDIST_DIR)
8073 AC_SUBST(PYTHON)
8075 dnl Echo the CFLAGS to remove extra whitespace.
8076 CFLAGS=`echo \
8077         $_WARNINGS_CFLAGS \
8078         $CFLAGS`
8080 CXXFLAGS=`echo \
8081         $_MOZ_RTTI_FLAGS \
8082         $_MOZ_EXCEPTIONS_FLAGS \
8083         $_WARNINGS_CXXFLAGS \
8084         $CXXFLAGS`
8086 COMPILE_CFLAGS=`echo \
8087     $_DEFINES_CFLAGS \
8088         $_DEPEND_CFLAGS \
8089     $COMPILE_CFLAGS`
8091 COMPILE_CXXFLAGS=`echo \
8092     $_DEFINES_CXXFLAGS \
8093         $_DEPEND_CFLAGS \
8094     $COMPILE_CXXFLAGS`
8096 AC_SUBST(SYSTEM_MAKEDEPEND)
8097 AC_SUBST(SYSTEM_JPEG)
8098 AC_SUBST(SYSTEM_PNG)
8099 AC_SUBST(SYSTEM_ZLIB)
8100 AC_SUBST(SYSTEM_BZ2)
8102 AC_SUBST(JPEG_CFLAGS)
8103 AC_SUBST(JPEG_LIBS)
8104 AC_SUBST(ZLIB_CFLAGS)
8105 AC_SUBST(ZLIB_LIBS)
8106 AC_SUBST(BZ2_CFLAGS)
8107 AC_SUBST(BZ2_LIBS)
8108 AC_SUBST(PNG_CFLAGS)
8109 AC_SUBST(PNG_LIBS)
8111 AC_SUBST(MOZ_JPEG_CFLAGS)
8112 AC_SUBST(MOZ_JPEG_LIBS)
8113 AC_SUBST(MOZ_ZLIB_CFLAGS)
8114 AC_SUBST(MOZ_ZLIB_LIBS)
8115 AC_SUBST(MOZ_BZ2_CFLAGS)
8116 AC_SUBST(MOZ_BZ2_LIBS)
8117 AC_SUBST(MOZ_PNG_CFLAGS)
8118 AC_SUBST(MOZ_PNG_LIBS)
8120 AC_SUBST(NSPR_CFLAGS)
8121 AC_SUBST(NSPR_LIBS)
8122 AC_SUBST(MOZ_NATIVE_NSPR)
8124 AC_SUBST(NSS_CFLAGS)
8125 AC_SUBST(NSS_LIBS)
8126 AC_SUBST(NSS_DEP_LIBS)
8127 AC_SUBST(MOZ_NATIVE_NSS)
8129 AC_SUBST(CFLAGS)
8130 AC_SUBST(CXXFLAGS)
8131 AC_SUBST(CPPFLAGS)
8132 AC_SUBST(COMPILE_CFLAGS)
8133 AC_SUBST(COMPILE_CXXFLAGS)
8134 AC_SUBST(LDFLAGS)
8135 AC_SUBST(LIBS)
8136 AC_SUBST(CROSS_COMPILE)
8138 AC_SUBST(HOST_CC)
8139 AC_SUBST(HOST_CXX)
8140 AC_SUBST(HOST_CFLAGS)
8141 AC_SUBST(HOST_CXXFLAGS)
8142 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8143 AC_SUBST(HOST_AR)
8144 AC_SUBST(HOST_AR_FLAGS)
8145 AC_SUBST(HOST_LD)
8146 AC_SUBST(HOST_RANLIB)
8147 AC_SUBST(HOST_NSPR_MDCPUCFG)
8148 AC_SUBST(HOST_BIN_SUFFIX)
8149 AC_SUBST(HOST_OS_ARCH)
8151 AC_SUBST(TARGET_CPU)
8152 AC_SUBST(TARGET_VENDOR)
8153 AC_SUBST(TARGET_OS)
8154 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8155 AC_SUBST(TARGET_MD_ARCH)
8156 AC_SUBST(TARGET_XPCOM_ABI)
8157 AC_SUBST(OS_TARGET)
8158 AC_SUBST(OS_ARCH)
8159 AC_SUBST(OS_RELEASE)
8160 AC_SUBST(OS_TEST)
8162 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
8163 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8165 AC_SUBST(WRAP_MALLOC_CFLAGS)
8166 AC_SUBST(WRAP_MALLOC_LIB)
8167 AC_SUBST(MKSHLIB)
8168 AC_SUBST(MKCSHLIB)
8169 AC_SUBST(MKSHLIB_FORCE_ALL)
8170 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8171 AC_SUBST(DSO_CFLAGS)
8172 AC_SUBST(DSO_PIC_CFLAGS)
8173 AC_SUBST(DSO_LDOPTS)
8174 AC_SUBST(LIB_PREFIX)
8175 AC_SUBST(DLL_PREFIX)
8176 AC_SUBST(DLL_SUFFIX)
8177 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8178 AC_SUBST(LIB_SUFFIX)
8179 AC_SUBST(OBJ_SUFFIX)
8180 AC_SUBST(BIN_SUFFIX)
8181 AC_SUBST(ASM_SUFFIX)
8182 AC_SUBST(IMPORT_LIB_SUFFIX)
8183 AC_SUBST(USE_N32)
8184 AC_SUBST(CC_VERSION)
8185 AC_SUBST(CXX_VERSION)
8186 AC_SUBST(MSMANIFEST_TOOL)
8188 if test "$USING_HCC"; then
8189    CC='${topsrcdir}/build/hcc'
8190    CC="$CC '$_OLDCC'"
8191    CXX='${topsrcdir}/build/hcpp'
8192    CXX="$CXX '$_OLDCXX'"
8193    AC_SUBST(CC)
8194    AC_SUBST(CXX)
8197 dnl Check for missing components
8198 if test "$COMPILE_ENVIRONMENT"; then
8199 if test "$MOZ_X11"; then
8200     dnl ====================================================
8201     dnl = Check if X headers exist
8202     dnl ====================================================
8203     _SAVE_CFLAGS=$CFLAGS
8204     CFLAGS="$CFLAGS $XCFLAGS"
8205     AC_TRY_COMPILE([
8206         #include <stdio.h>
8207         #include <stdlib.h>
8208         #include <X11/Xlib.h>
8209         #include <X11/Intrinsic.h>
8210     ],
8211     [
8212         Display *dpy = 0;
8213         if ((dpy = XOpenDisplay(NULL)) == NULL) {
8214             fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8215             exit(1);
8216         }
8217     ], [], 
8218     [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8219     CFLAGS="$_SAVE_CFLAGS"
8221     if test ! -z "$MISSING_X"; then
8222         AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8223     fi
8225 fi # MOZ_X11
8226 fi # COMPILE_ENVIRONMENT
8228 dnl Set various defines and substitutions
8229 dnl ========================================================
8231 if test "$OS_ARCH" = "OS2" -a "$VACPP" = "yes"; then
8232       LIBS='so32dll.lib tcp32dll.lib'
8233 elif test "$OS_ARCH" = "BeOS"; then
8234   AC_DEFINE(XP_BEOS)
8235   MOZ_MOVEMAIL=1
8236 elif test "$OS_ARCH" = "Darwin"; then
8237   AC_DEFINE(XP_UNIX)
8238   AC_DEFINE(UNIX_ASYNC_DNS)
8239   MOZ_MOVEMAIL=1
8240 elif test "$OS_ARCH" = "OpenVMS"; then
8241   AC_DEFINE(XP_UNIX)
8242 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
8243   AC_DEFINE(XP_UNIX)
8244   AC_DEFINE(UNIX_ASYNC_DNS)
8245   MOZ_MOVEMAIL=1
8247 AC_SUBST(MOZ_MOVEMAIL)
8249 AC_DEFINE(JS_THREADSAFE)
8251 if test "$MOZ_DEBUG"; then
8252     AC_DEFINE(MOZ_REFLOW_PERF)
8253     AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8256 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8257     AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8258     ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8259     ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8260     ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8261     ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8262     AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8263     AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8264     AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8267 # Used for LD_LIBRARY_PATH of run_viewer target
8268 LIBS_PATH=
8269 for lib_arg in $NSPR_LIBS $TK_LIBS; do
8270   case $lib_arg in
8271     -L* ) LIBS_PATH="${LIBS_PATH:+$LIBS_PATH:}"`expr $lib_arg : "-L\(.*\)"` ;;
8272       * ) ;;
8273   esac
8274 done
8275 AC_SUBST(LIBS_PATH)
8277 dnl ========================================================
8278 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
8279 dnl ========================================================
8280 case "$host_os" in
8281 mingw*)
8282     WIN_TOP_SRC=`cd $srcdir; pwd -W`
8283     ;;
8284 cygwin*|msvc*|mks*)
8285     HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
8286     HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
8287     CC="\$(CYGWIN_WRAPPER) $CC"
8288     CXX="\$(CYGWIN_WRAPPER) $CXX"
8289     CPP="\$(CYGWIN_WRAPPER) $CPP"
8290     LD="\$(CYGWIN_WRAPPER) $LD"
8291     AS="\$(CYGWIN_WRAPPER) $AS"
8292     RC="\$(CYGWIN_WRAPPER) $RC"
8293     MIDL="\$(CYGWIN_WRAPPER) $MIDL"
8294     CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
8295     WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
8296     ;;
8297 esac
8299 AC_SUBST(CYGDRIVE_MOUNT)
8300 AC_SUBST(WIN_TOP_SRC)
8302 AC_SUBST(MOZILLA_VERSION)
8304 . ${srcdir}/config/chrome-versions.sh
8305 AC_DEFINE_UNQUOTED(MOZILLA_LOCALE_VERSION,"$MOZILLA_LOCALE_VERSION")
8306 AC_DEFINE_UNQUOTED(MOZILLA_REGION_VERSION,"$MOZILLA_REGION_VERSION")
8307 AC_DEFINE_UNQUOTED(MOZILLA_SKIN_VERSION,"$MOZILLA_SKIN_VERSION")
8309 AC_SUBST(ac_configure_args)
8311 dnl Spit out some output
8312 dnl ========================================================
8314 dnl The following defines are used by xpcom
8315 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8316 CPP_THROW_NEW
8317 HAVE_CPP_2BYTE_WCHAR_T
8318 HAVE_CPP_ACCESS_CHANGING_USING
8319 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8320 HAVE_CPP_BOOL
8321 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8322 HAVE_CPP_EXPLICIT
8323 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
8324 HAVE_CPP_NAMESPACE_STD
8325 HAVE_CPP_NEW_CASTS
8326 HAVE_CPP_PARTIAL_SPECIALIZATION
8327 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8328 HAVE_CPP_TYPENAME
8329 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
8330 HAVE_STATVFS
8331 NEED_CPP_UNUSED_IMPLEMENTATIONS
8332 NEW_H
8333 HAVE_GETPAGESIZE
8334 HAVE_ICONV
8335 HAVE_ICONV_WITH_CONST_INPUT
8336 HAVE_MBRTOWC
8337 HAVE_SYS_MOUNT_H
8338 HAVE_SYS_VFS_H
8339 HAVE_WCRTOMB
8340 MOZ_V1_STRING_ABI
8343 AC_CONFIG_HEADER(
8344 netwerk/necko-config.h
8345 xpcom/xpcom-config.h
8346 xpcom/xpcom-private.h
8349 # Save the defines header file before autoconf removes it.
8350 # (Do not add AC_DEFINE calls after this line.)
8351   _CONFIG_TMP=confdefs-tmp.h
8352   _CONFIG_DEFS_H=mozilla-config.h
8354   cat > $_CONFIG_TMP <<\EOF
8355 /* List of defines generated by configure. Included with preprocessor flag,
8356  * -include, to avoid long list of -D defines on the compile command-line.
8357  * Do not edit.
8358  */
8360 #ifndef _MOZILLA_CONFIG_H_
8361 #define _MOZILLA_CONFIG_H_
8364 _EGREP_PATTERN='^#define ('
8365 if test -n "$_NON_GLOBAL_ACDEFINES"; then
8366     for f in $_NON_GLOBAL_ACDEFINES; do
8367         _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
8368     done
8370 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
8372   sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
8374   cat >> $_CONFIG_TMP <<\EOF
8376 #endif /* _MOZILLA_CONFIG_H_ */
8380   # Only write mozilla-config.h when something changes (or it doesn't exist)
8381   if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
8382     rm $_CONFIG_TMP
8383   else
8384     AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
8385     mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
8387     echo ==== $_CONFIG_DEFS_H =================================
8388     cat $_CONFIG_DEFS_H
8389   fi
8391 dnl Probably shouldn't call this manually but we always want the output of DEFS
8392 rm -f confdefs.h.save
8393 mv confdefs.h confdefs.h.save
8394 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
8395 AC_OUTPUT_MAKE_DEFS()
8396 MOZ_DEFINES=$DEFS
8397 AC_SUBST(MOZ_DEFINES)
8398 rm -f confdefs.h
8399 mv confdefs.h.save confdefs.h
8401 dnl Load the list of Makefiles to generate.
8402 dnl   To add new Makefiles, edit allmakefiles.sh.
8403 dnl   allmakefiles.sh sets the variable, MAKEFILES.
8404 . ${srcdir}/allmakefiles.sh
8405 dnl 
8406 dnl Run a perl script to quickly create the makefiles.
8407 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
8408 dnl   for the files it cannot handle correctly. This way, config.status
8409 dnl   will handle these files.
8410 dnl If it fails, nothing is set and config.status will run as usual.
8412 dnl This does not change the $MAKEFILES variable.
8414 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
8416 if test -z "${AS_PERL}"; then
8417 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
8418 else
8419 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
8421 . ./conftest.sh
8422 rm conftest.sh
8424 echo $MAKEFILES > unallmakefiles
8426 AC_OUTPUT($MAKEFILES)
8428 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
8429 if test "$CAIRO_FEATURES_H"; then
8430   if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
8431     mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
8432   else
8433     rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
8434   fi
8437 dnl ========================================================
8438 dnl = Setup a nice relatively clean build environment for
8439 dnl = sub-configures.
8440 dnl ========================================================
8441 CC="$_SUBDIR_CC" 
8442 CXX="$_SUBDIR_CXX" 
8443 CFLAGS="$_SUBDIR_CFLAGS" 
8444 CPPFLAGS="$_SUBDIR_CPPFLAGS"
8445 CXXFLAGS="$_SUBDIR_CXXFLAGS"
8446 LDFLAGS="$_SUBDIR_LDFLAGS"
8447 HOST_CC="$_SUBDIR_HOST_CC" 
8448 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8449 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
8452 unset MAKEFILES
8453 unset CONFIG_FILES
8455 if test "$COMPILE_ENVIRONMENT"; then
8456 if test -z "$MOZ_NATIVE_NSPR" || test "$MOZ_LDAP_XPCOM"; then
8457     ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
8458     if test -z "$MOZ_DEBUG"; then
8459         ac_configure_args="$ac_configure_args --disable-debug"
8460     fi
8461     if test "$MOZ_OPTIMIZE" = "1"; then
8462         ac_configure_args="$ac_configure_args --enable-optimize"
8463     fi
8464     if test "$OS_ARCH" = "WINNT" && test "$NS_TRACE_MALLOC"; then
8465        ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
8466     fi
8467     if test -n "$HAVE_64BIT_OS"; then
8468         ac_configure_args="$ac_configure_args --enable-64bit"
8469     fi
8470     if test -n "$USE_ARM_KUSER"; then
8471         ac_configure_args="$ac_configure_args --with-arm-kuser"
8472     fi
8473     AC_OUTPUT_SUBDIRS(nsprpub)
8474     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8477 if test -z "$MOZ_NATIVE_NSPR"; then
8478     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
8479     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
8480     if test ! "$VACPP" && test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE"; then
8481        _libs=`./nsprpub/config/nspr-config --prefix=$\(LIBXUL_DIST\) --exec-prefix=$\(DIST\) --libdir=$\(LIBXUL_DIST\)/lib --libs`
8482        $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $_libs'" config/autoconf.mk
8483     fi
8484     if test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE" ; then
8485        _cflags=`./nsprpub/config/nspr-config --prefix=$\(LIBXUL_DIST\) --exec-prefix=$\(DIST\) --includedir=$\(LIBXUL_DIST\)/include/nspr --cflags`
8486        $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $_cflags'" config/autoconf.mk
8487     fi
8488     rm -f config/autoconf.mk.bak
8491 # if we're building the LDAP XPCOM component, we need to build 
8492 # the c-sdk first.  
8494 if test "$MOZ_LDAP_XPCOM"; then
8496     # these subdirs may not yet have been created in the build tree.
8497     # don't use the "-p" switch to mkdir, since not all platforms have it
8498     #
8499     if test ! -d "directory"; then
8500         mkdir "directory"
8501     fi
8502     if test ! -d "directory/c-sdk"; then
8503         mkdir "directory/c-sdk"    
8504     fi
8505     if test ! -d "directory/c-sdk/ldap"; then
8506         mkdir "directory/c-sdk/ldap"    
8507     fi
8509     ac_configure_args="$_SUBDIR_CONFIG_ARGS --prefix=$MOZ_BUILD_ROOT/dist --with-dist-prefix=$MOZ_BUILD_ROOT/dist --without-nss --with-mozilla"
8510     if test -z "$MOZ_DEBUG"; then
8511         ac_configure_args="$ac_configure_args --disable-debug"
8512     fi
8513     if test "$MOZ_OPTIMIZE" = "1"; then
8514         ac_configure_args="$ac_configure_args --enable-optimize"
8515     fi
8516     if test -n "$HAVE_64BIT_OS"; then
8517         ac_configure_args="$ac_configure_args --enable-64bit"
8518     fi
8519     AC_OUTPUT_SUBDIRS(directory/c-sdk)
8520     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8522 fi # COMPILE_ENVIRONMENT