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