source: trunk/third/firefox/configure.in @ 21771

Revision 21771, 191.9 KB checked in by rbasch, 20 years ago (diff)
Prefer the Athena krb5 GSSAPI libraries.
Line 
1dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
2dnl vi: set tabstop=4 shiftwidth=4 expandtab:
3dnl The contents of this file are subject to the Mozilla Public
4dnl License Version 1.1 (the "License"); you may not use this file
5dnl except in compliance with the License. You may obtain a copy of
6dnl the License at http://www.mozilla.org/MPL/
7dnl
8dnl Software distributed under the License is distributed on an "AS
9dnl IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
10dnl implied. See the License for the specific language governing
11dnl rights and limitations under the License.
12dnl
13dnl The Original Code is this file as it was released upon August 6, 1998.
14dnl
15dnl The Initial Developer of the Original Code is Christopher
16dnl Seawood. Portions created by Christopher Seawood are
17dnl Copyright (C) 1998-2001 Christopher Seawood. All Rights Reserved.
18dnl
19dnl Contributor(s): Jamie Zawinski <jwz@jwz.org>
20dnl                 gettimeofday args check
21dnl               Christopher Blizzard <blizzard@appliedtheory.com>
22dnl                 gnomefe update & enable-pthreads
23dnl               Ramiro Estrugo <ramiro@netscape.com>
24dnl                 X11 makedepend support
25dnl                 Insure support.
26dnl               Henry Sobotka <sobotka@axess.com>
27dnl                 OS/2 support
28dnl               Dan Mosedale <dmose@mozilla.org>
29dnl                 LDAP support
30dnl               Seth Spitzer <sspitzer@netscape.com>
31dnl                 xpctools support
32dnl
33dnl Process this file with autoconf to produce a configure script.
34dnl ========================================================
35
36AC_PREREQ(2.12)
37AC_INIT(config/config.mk)
38AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
39AC_CANONICAL_SYSTEM
40TARGET_CPU="${target_cpu}"
41TARGET_VENDOR="${target_vendor}"
42TARGET_OS="${target_os}"
43
44dnl ========================================================
45dnl =
46dnl = Dont change the following two lines.  Doing so breaks:
47dnl =
48dnl = CFLAGS="-foo" ./configure
49dnl =
50dnl ========================================================
51CFLAGS="${CFLAGS=}"
52CPPFLAGS="${CPPFLAGS=}"
53CXXFLAGS="${CXXFLAGS=}"
54LDFLAGS="${LDFLAGS=}"
55HOST_CFLAGS="${HOST_CFLAGS=}"
56HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
57HOST_LDFLAGS="${HOST_LDFLAGS=}"
58
59dnl ========================================================
60dnl = Preserve certain environment flags passed to configure
61dnl = We want sub projects to receive the same flags
62dnl = untainted by this configure script
63dnl ========================================================
64_SUBDIR_CC="$CC"
65_SUBDIR_CXX="$CXX"
66_SUBDIR_CFLAGS="$CFLAGS"
67_SUBDIR_CPPFLAGS="$CPPFLAGS"
68_SUBDIR_CXXFLAGS="$CFLAGS"
69_SUBDIR_LDFLAGS="$LDFLAGS"
70_SUBDIR_HOST_CC="$HOST_CC"
71_SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
72_SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
73_SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
74_SUBDIR_CONFIG_ARGS="$ac_configure_args"
75
76dnl Set the version number of the libs included with mozilla
77dnl ========================================================
78MOZJPEG=62
79MOZPNG=10200
80MOZZLIB=1.0.0
81NSPR_VERSION=4
82
83dnl Set the minimum version of toolkit libs used by mozilla
84dnl ========================================================
85GLIB_VERSION=1.2.0
86GTK_VERSION=1.2.0
87LIBIDL_VERSION=0.6.3
88PERL_VERSION=5.004
89LIBART_VERSION=2.3.4
90CAIRO_VERSION=0.1.17
91GTK2_VERSION=1.3.7
92MAKE_VERSION=3.78
93WINDRES_VERSION=2.14.90
94W32API_VERSION=2.4
95GNOMEVFS_VERSION=2.0
96GCONF_VERSION=1.2.1
97LIBGNOME_VERSION=2.0
98
99dnl Set various checks
100dnl ========================================================
101MISSING_X=
102
103dnl Initialize the Pthread test variables early so they can be
104dnl  overridden by each platform.
105dnl ========================================================
106USE_PTHREADS=
107_PTHREAD_LDFLAGS=""
108
109dnl Do not allow a separate objdir build if a srcdir build exists.
110dnl ==============================================================
111_topsrcdir=`cd \`dirname $0\`; pwd`
112_objdir=`pwd`
113if test "$_topsrcdir" != "$_objdir"
114then
115  # Check for a couple representative files in the source tree
116  _conflict_files=
117  for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
118    if test -f $file; then
119      _conflict_files="$_conflict_files $file"
120    fi
121  done
122  if test "$_conflict_files"; then
123    echo "***"
124    echo "*   Your source tree contains these files:"
125    for file in $_conflict_files; do
126      echo "*         $file"
127    done
128    cat 1>&2 <<-EOF
129        *   This indicates that you previously built in the source tree.
130        *   A source tree build can confuse the separate objdir build.
131        *
132        *   To clean up the source tree:
133        *     1. cd $_topsrcdir
134        *     2. gmake distclean
135        ***
136        EOF
137    exit 1
138    break
139  fi
140fi
141MOZ_BUILD_ROOT=`pwd`
142
143dnl Default to MSVC for win32
144dnl ==============================================================
145if test -z "$CROSS_COMPILE"; then
146case "$target" in
147*-cygwin*|*-mingw*|*-msvc*|*-mks*)
148    MAKE_VERSION=3.79
149    if test -z "$CC"; then CC=cl; fi
150    if test -z "$CXX"; then CXX=cl; fi
151    if test -z "$CPP"; then CPP=cl; fi
152    if test -z "$LD"; then LD=link; fi
153    if test -z "$AS"; then AS=ml; fi
154    if test -z "$MIDL"; then MIDL=midl; fi
155    ;;
156esac
157fi
158
159dnl ========================================================
160dnl Checks for compilers.
161dnl ========================================================
162dnl Set CROSS_COMPILE in the environment when running configure
163dnl to use the cross-compile setup for now
164dnl ========================================================
165if test -n "$CROSS_COMPILE" && test "$target" != "$host"; then
166    echo "cross compiling from $host to $target"
167    cross_compiling=yes
168
169    _SAVE_CC="$CC"
170    _SAVE_CFLAGS="$CFLAGS"
171    _SAVE_LDFLAGS="$LDFLAGS"
172
173    AC_MSG_CHECKING([for host c compiler])
174    AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
175    if test -z "$HOST_CC"; then
176        AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
177    fi
178    AC_MSG_RESULT([$HOST_CC])
179    AC_MSG_CHECKING([for host c++ compiler])
180    AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
181    if test -z "$HOST_CXX"; then
182        AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
183    fi
184    AC_MSG_RESULT([$HOST_CXX])
185
186    if test -z "$HOST_CFLAGS"; then
187        HOST_CFLAGS="$CFLAGS"
188    fi
189    if test -z "$HOST_CXXFLAGS"; then
190        HOST_CXXFLAGS="$CXXFLAGS"
191    fi
192    if test -z "$HOST_LDFLAGS"; then
193        HOST_LDFLAGS="$LDFLAGS"
194    fi
195    AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
196    AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
197    CC="$HOST_CC"
198    CFLAGS="$HOST_CFLAGS"
199    LDFLAGS="$HOST_LDFLAGS"
200
201    AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
202    AC_TRY_COMPILE([], [return(0);],
203        [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
204        AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
205
206    CC="$HOST_CXX"
207    CFLAGS="$HOST_CXXFLAGS"
208
209    AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
210    AC_TRY_COMPILE([], [return(0);],
211        [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
212        AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
213   
214    CC=$_SAVE_CC
215    CFLAGS=$_SAVE_CFLAGS
216    LDFLAGS=$_SAVE_LDFLAGS
217
218    AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
219    unset ac_cv_prog_CC
220    AC_PROG_CC
221    AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
222    unset ac_cv_prog_CXX
223    AC_PROG_CXX
224    AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
225    AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
226    AC_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
227    AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
228    AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
229    AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
230    AC_DEFINE(CROSS_COMPILE)
231else
232    AC_PROG_CC
233    AC_PROG_CXX
234    AC_PROG_RANLIB
235    AC_PATH_PROGS(AS, $AS as, $CC)
236    AC_CHECK_PROGS(AR, ar, :)
237    AC_CHECK_PROGS(LD, ld, :)
238    AC_CHECK_PROGS(STRIP, strip, :)
239    AC_CHECK_PROGS(WINDRES, windres, :)
240    if test -z "$HOST_CC"; then
241        HOST_CC="$CC"
242    fi
243    if test -z "$HOST_CFLAGS"; then
244        HOST_CFLAGS="$CFLAGS"
245    fi
246    if test -z "$HOST_CXX"; then
247        HOST_CXX="$CXX"
248    fi
249    if test -z "$HOST_CXXFLAGS"; then
250        HOST_CXXFLAGS="$CXXFLAGS"
251    fi
252    if test -z "$HOST_LDFLAGS"; then
253        HOST_LDFLAGS="$LDFLAGS"
254    fi
255    if test -z "$HOST_RANLIB"; then
256        HOST_RANLIB="$RANLIB"
257    fi
258    if test -z "$HOST_AR"; then
259       HOST_AR="$AR"
260    fi
261fi
262
263GNU_AS=
264GNU_LD=
265GNU_CC=
266GNU_CXX=
267CC_VERSION='N/A'
268CXX_VERSION='N/A'
269if test "$GCC" = "yes"; then
270    GNU_CC=1
271    CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
272fi
273if test "$GXX" = "yes"; then
274    GNU_CXX=1
275    CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
276fi
277if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
278    GNU_AS=1
279fi
280if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
281    GNU_LD=1
282fi
283if test "$GNU_CC"; then
284    if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
285        GCC_USE_GNU_LD=1
286    fi
287fi
288
289AC_PROG_AWK
290
291dnl Special win32 checks
292dnl ========================================================
293case "$target" in
294*-cygwin*|*-mingw*|*-msvc*|*-mks*)
295    if test "$GCC" != "yes"; then
296        # Check to see if we are really running in a msvc environemnt
297        _WIN32_MSVC=1
298        AC_CHECK_PROGS(MIDL, midl)
299
300        # Make sure compilers are valid
301        CFLAGS="$CFLAGS -TC -nologo"
302        CXXFLAGS="$CXXFLAGS -TP -nologo"
303        AC_LANG_SAVE
304        AC_LANG_C
305        AC_TRY_COMPILE([#include <stdio.h>],
306            [ printf("Hello World\n"); ],,
307            AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
308
309        AC_LANG_CPLUSPLUS
310        AC_TRY_COMPILE([#include <new.h>],
311            [ unsigned *test = new unsigned(42); ],,
312            AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
313        AC_LANG_RESTORE
314
315        # Determine compiler version
316        CC_VERSION=`"${CC}" -v 2>&1 | grep Version | sed -e 's|.* Version ||' -e 's| .*||'`
317        _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
318
319        CXX_VERSION=`"${CXX}" -v 2>&1 | grep Version | sed -e 's|.* Version ||' -e 's| .*||'`
320        _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
321
322        if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
323            AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
324        fi
325        if test "$_CC_MAJOR_VERSION" = "12"; then
326            _CC_SUITE=6
327        elif test "$_CC_MAJOR_VERSION" = "13"; then
328            _CC_SUITE=7
329        else
330            AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
331        fi
332
333        # Check linker version
334        _LD_FULL_VERSION=`"${LD}" -v 2>&1 | grep Version | sed -e 's|.* Version ||' -e 's| .*||'`
335        _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
336        if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
337            AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
338        fi
339        INCREMENTAL_LINKER=1
340
341        # Check midl version
342        _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | grep Version | sed -e 's|.* Version ||' -e 's| .*||'`
343        _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
344        _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
345        _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
346         if test "$_MIDL_MAJOR_VERSION" != "5" -a "$_MIDL_FULL_VERSION" != "6.00.0347" -a "$_MIDL_FULL_VERSION" != "6.00.0361"; then
347             AC_MSG_ERROR([Midl version $_MIDL_FULL_VERSION was found.  Midl version must be 5.x.x (VC6*) or 6.00.0347 (VC7) or 6.00.0361 (VC.net 2003).])
348         fi
349
350         # Add flags if necessary
351         AC_MSG_CHECKING([for midl flags])
352         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
353             # Starting with MIDL version 6.0.359, the MIDL compiler
354             # generates /Oicf /robust stubs by default, which is not
355             # compatible with versions of Windows older than Win2k.
356             # This switches us back to the old behaviour. When we drop
357             # support for Windows older than Win2k, we should remove
358             # this.
359             MIDL_FLAGS="${MIDL_FLAGS} /no_robust"
360             AC_MSG_RESULT([need /no_robust])
361         else
362             MIDL_FLAGS="${MIDL_FLAGS}"
363             AC_MSG_RESULT([none needed])
364        fi
365    else
366        # Check w32api version
367        _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
368        _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
369        AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
370        AC_TRY_COMPILE([#include <w32api.h>],
371            #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
372                (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
373                 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
374                #error "test failed."
375            #endif
376            , [ res=yes ], [ res=no ])
377        AC_MSG_RESULT([$res])
378        if test "$res" != "yes"; then
379            AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
380        fi
381        # Check windres version
382        AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
383        _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
384        AC_MSG_RESULT([$_WINDRES_VERSION])
385        _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
386        _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
387        _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
388        WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
389        WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
390        WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
391        if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
392                "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
393                "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
394                "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
395                "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
396                "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
397        then
398            AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
399        fi
400    fi # !GNU_CC
401    ;;
402esac
403
404AC_SUBST(MIDL_FLAGS)
405
406if test -n "$_WIN32_MSVC"; then
407    SKIP_PATH_CHECKS=1
408    SKIP_COMPILER_CHECKS=1
409    SKIP_LIBRARY_CHECKS=1
410    AC_CHECK_HEADERS(mmintrin.h)
411fi
412
413dnl Test breaks icc on OS/2 && MSVC
414if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
415    AC_PROG_CC_C_O
416    if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
417        USING_HCC=1
418        _OLDCC=$CC
419        _OLDCXX=$CXX
420        CC="${srcdir}/build/hcc '$CC'"
421        CXX="${srcdir}/build/hcpp '$CXX'"
422    fi
423fi
424
425AC_SUBST(GNU_AS)
426AC_SUBST(GNU_LD)
427AC_SUBST(GNU_CC)
428AC_SUBST(GNU_CXX)
429
430dnl ========================================================
431dnl = Mac OS X SDK support
432dnl ========================================================
433MACOS_SDK_DIR=
434MOZ_ARG_WITH_STRING(macos-sdk,
435[  --with-macos-sdk=dir   Location of platform SDK to use (Mac OS X only)],
436    MACOS_SDK_DIR=$withval)
437
438AC_SUBST(MACOS_SDK_DIR)
439
440if test "$MACOS_SDK_DIR"; then
441  export NEXT_ROOT=$MACOS_SDK_DIR
442  CFLAGS="-I${MACOS_SDK_DIR}/usr/include $CFLAGS"
443  CXXFLAGS="-I${MACOS_SDK_DIR}/usr/include $CXXFLAGS"
444  changequote(,)
445  GCC_VERSION=`echo $CXX_VERSION | perl -pe "s/gcc version ([^ ]*).*/\1/"`
446  changequote([,])
447  LIBS="-L${MACOS_SDK_DIR}/usr/lib/gcc/darwin/${GCC_VERSION} -L${MACOS_SDK_DIR}/usr/lib $LIBS"
448fi
449
450dnl ========================================================
451dnl Checks for programs.
452dnl ========================================================
453AC_PROG_CPP
454AC_PROG_CXXCPP
455AC_PROG_INSTALL
456AC_PROG_LN_S
457AC_PATH_PROGS(PERL, $PERL perl5 perl )
458if test -z "$PERL" || test "$PERL" = ":"; then
459    AC_MSG_ERROR([perl not found in \$PATH])
460fi
461
462AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
463_perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
464_perl_res=$?
465AC_MSG_RESULT([$_perl_version])
466
467if test "$_perl_res" != 0; then
468    AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
469fi
470
471AC_MSG_CHECKING([for full perl installation])
472_perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
473_perl_res=$?
474if test "$_perl_res" != 0; then
475    AC_MSG_RESULT([no])
476    AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
477else
478    AC_MSG_RESULT([yes])   
479fi
480
481AC_PATH_PROG(DOXYGEN, doxygen, :)
482AC_PATH_PROG(WHOAMI, whoami, :)
483AC_PATH_PROG(AUTOCONF, autoconf, :)
484AC_PATH_PROG(UNZIP, unzip, :)
485AC_PATH_PROGS(ZIP, zip)
486if test -z "$ZIP" || test "$ZIP" = ":"; then
487    AC_MSG_ERROR([zip not found in \$PATH])
488fi
489AC_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
490AC_PATH_PROG(XARGS, xargs)
491if test -z "$XARGS" || test "$XARGS" = ":"; then
492    AC_MSG_ERROR([xargs not found in \$PATH .])
493fi
494case "$target_os" in
495darwin*)
496    AC_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
497    ;;
498esac
499
500dnl Be sure the make we use is GNU make.
501dnl on win32, gmake.exe is the generally the wrong version
502case "$target_os" in
503cygwin*|mingw*|mks*|msvc*)
504    AC_PATH_PROGS(MAKE, $MAKE make gmake, :)
505    ;;
506*)
507    AC_PATH_PROGS(MAKE, $MAKE gmake make, :)
508    ;;
509esac
510_make_try=`$MAKE --version 2>/dev/null | grep GNU`
511if test ! "$_make_try"
512then
513        echo
514        echo "*** $MAKE is not GNU Make.  You will not be able to build Mozilla without GNU Make."
515        echo
516        exit 1
517fi
518dnl Now exit if version if < MAKE_VERSION
519rm -f dummy.mk
520echo 'all: ; @echo $(MAKE_VERSION)' > dummy.mk
521_make_vers=`$MAKE --no-print-directory -f dummy.mk all 2>/dev/null`
522rm -f dummy.mk
523_MAKE_MAJOR_VERSION=`echo $_make_vers | $AWK -F\. '{ print $1 }'`
524_MAKE_MINOR_VERSION=`echo $_make_vers | $AWK -F\. '{ print $2 }'`
525MAKE_MAJOR_VERSION=`echo $MAKE_VERSION | $AWK -F\. '{ print $1 }'`
526MAKE_MINOR_VERSION=`echo $MAKE_VERSION | $AWK -F\. '{ print $2 }'`
527if test "$_MAKE_MAJOR_VERSION" -lt "$MAKE_MAJOR_VERSION" || \
528   test "$_MAKE_MAJOR_VERSION" = "$MAKE_MAJOR_VERSION" -a \
529        "$_MAKE_MINOR_VERSION" -lt "$MAKE_MINOR_VERSION"; then
530   AC_MSG_ERROR([GNU Make $MAKE_VERSION or higher is required to build Mozilla.])
531fi
532AC_SUBST(MAKE)
533
534AC_PATH_XTRA
535
536dnl Check in X11 include directory too.
537if test "$no_x" != "yes"; then
538    CPPFLAGS="$CPPFLAGS $X_CFLAGS"
539fi
540
541XCFLAGS="$X_CFLAGS"
542
543dnl ========================================================
544dnl set the defaults first
545dnl ========================================================
546AS_BIN=$AS
547AR_FLAGS='cr $@'
548AR_LIST='$(AR) t'
549AR_EXTRACT='$(AR) x'
550AR_DELETE='$(AR) d'
551AS='$(CC)'
552AS_DASH_C_FLAG='-c'
553DLL_PREFIX=lib
554LIB_PREFIX=lib
555DLL_SUFFIX=.so
556OBJ_SUFFIX=o
557LIB_SUFFIX=a
558ASM_SUFFIX=s
559IMPORT_LIB_SUFFIX=
560TARGET_MD_ARCH=unix
561DIRENT_INO=d_ino
562CYGWIN_WRAPPER=
563MOZ_USER_DIR=".mozilla"
564MOZ_APP_NAME=mozilla
565MOZ_APP_DISPLAYNAME=Mozilla
566
567MOZ_JPEG_CFLAGS=
568MOZ_JPEG_LIBS='-L$(DIST)/lib -lmozjpeg'
569MOZ_ZLIB_CFLAGS=
570MOZ_ZLIB_LIBS='-L$(DIST)/lib -lmozz'
571MOZ_PNG_CFLAGS=
572MOZ_PNG_LIBS='-L$(DIST)/lib -lmozpng'
573
574MOZ_JS_LIBS='-L$(DIST)/bin -lmozjs'
575XPCOM_LIBS='-L$(DIST)/bin -lxpcom'
576
577MOZ_COMPONENT_NSPR_LIBS='-L$(DIST)/bin $(NSPR_LIBS)'
578MOZ_COMPONENT_XPCOM_LIBS='$(XPCOM_LIBS)'
579MOZ_XPCOM_OBSOLETE_LIBS='-L$(DIST)/lib -lxpcom_compat'
580
581USE_DEPENDENT_LIBS=1
582
583USE_GSSAPI=1
584
585_PLATFORM_DEFAULT_TOOLKIT=gtk
586MOZ_WIDGET_TOOLKIT_LDFLAGS='-lwidget_$(MOZ_WIDGET_TOOLKIT)'
587MOZ_GFX_TOOLKIT_LDFLAGS='-lgfx_$(MOZ_WIDGET_TOOLKIT) $(MOZ_XLIBRGB_LDFLAGS)'
588WIDGET_DLL='\"libwidget_$(MOZ_WIDGET_TOOLKIT)$(DLL_SUFFIX)\"'
589GFXWIN_DLL='\"libgfx_$(MOZ_GFX_TOOLKIT)$(DLL_SUFFIX)\"'
590
591MOZ_ENABLE_POSTSCRIPT=1
592
593if test -n "$CROSS_COMPILE"; then
594    OS_TARGET="${target_os}"
595    OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
596    OS_RELEASE=
597    OS_TEST="${target_cpu}"
598    case "${target_os}" in
599        linux*)       OS_ARCH=Linux ;;
600        solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
601        mingw*)       OS_ARCH=WINNT ;;
602    esac
603else
604    OS_TARGET=`uname -s`
605    OS_ARCH=`uname -s | sed -e 's|/|_|g'`
606    OS_RELEASE=`uname -r`
607    OS_TEST=`uname -m`
608fi
609_COMPILER_PREFIX=
610
611#######################################################################
612# Master "Core Components" macros for getting the OS target           #
613#######################################################################
614
615#
616# Note: OS_TARGET should be specified on the command line for gmake.
617# When OS_TARGET=WIN95 is specified, then a Windows 95 target is built.
618# The difference between the Win95 target and the WinNT target is that
619# the WinNT target uses Windows NT specific features not available
620# in Windows 95. The Win95 target will run on Windows NT, but (supposedly)
621# at lesser performance (the Win95 target uses threads; the WinNT target
622# uses fibers).
623#
624# When OS_TARGET=WIN16 is specified, then a Windows 3.11 (16bit) target
625# is built. See: win16_3.11.mk for lots more about the Win16 target.
626#
627# If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
628# cross-compilation.
629#
630
631#
632# The following hack allows one to build on a WIN95 machine (as if
633# s/he were cross-compiling on a WINNT host for a WIN95 target).
634# It also accomodates for MKS's uname.exe.  If you never intend
635# to do development on a WIN95 machine, you don't need this hack.
636#
637if test "$OS_ARCH" = "WIN95"; then
638    OS_ARCH=WINNT
639    OS_TARGET=WIN95
640elif test "$OS_ARCH" = 'Windows_95'; then
641    OS_ARCH=Windows_NT
642    OS_TARGET=WIN95
643elif test "$OS_ARCH" = 'Windows_98'; then
644    OS_ARCH=Windows_NT
645    OS_TARGET=WIN95
646elif test "`echo $OS_ARCH | egrep -c '^(CYGWIN_9|CYGWIN_ME)' 2>/dev/null`" != 0; then
647    OS_ARCH='CYGWIN_NT-4.0'
648    OS_TARGET=WIN95
649elif test "$OS_ARCH" = "OS_2"; then
650    OS_ARCH=OS2
651    OS_TARGET=OS2
652fi
653
654#
655# On WIN32, we also define the variable CPU_ARCH.
656#
657
658if test "$OS_ARCH" = "WINNT"; then
659    CPU_ARCH=`uname -p`
660    if test "$CPU_ARCH" = "I386"; then
661        CPU_ARCH=x86
662    fi
663elif test "$OS_ARCH" = "Windows_NT"; then
664#
665# If uname -s returns "Windows_NT", we assume that we are using
666# the uname.exe in MKS toolkit.
667#
668# The -r option of MKS uname only returns the major version number.
669# So we need to use its -v option to get the minor version number.
670# Moreover, it doesn't have the -p option, so we need to use uname -m.
671#
672    OS_ARCH=WINNT
673    OS_TARGET=WINNT
674    OS_MINOR_RELEASE=`uname -v`
675    if test "$OS_MINOR_RELEASE" = "00"; then
676        OS_MINOR_RELEASE=0
677    fi
678    OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
679    CPU_ARCH=`uname -m`
680    #
681    # MKS's uname -m returns "586" on a Pentium machine.
682    #
683    if echo "$CPU_ARCH" | grep -c 86 >/dev/null; then
684        CPU_ARCH=x86
685    fi
686elif echo "$OS_ARCH" | grep -c CYGWIN_NT >/dev/null; then
687#
688# If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
689# the uname.exe in the Cygwin tools.
690#
691    OS_RELEASE=`echo $OS_ARCH | sed 's|^CYGWIN_NT-||'`
692    OS_ARCH=WINNT
693    OS_TARGET=WINNT
694    CPU_ARCH=`uname -m`
695    #
696    # Cygwin's uname -m returns "i686" on a Pentium Pro machine.
697    #
698    if echo "$CPU_ARCH" | grep -c 86 >/dev/null; then
699        CPU_ARCH=x86
700    fi
701elif test "$OS_ARCH" = "CYGWIN32_NT"; then
702#
703# Prior to the Beta 20 release, Cygwin was called GNU-Win32.
704# If uname -s returns "CYGWIN32/NT", we assume that we are using
705# the uname.exe in the GNU-Win32 tools.
706#
707    OS_ARCH=WINNT
708    OS_TARGET=WINNT
709    CPU_ARCH=`uname -m`
710    #
711    # GNU-Win32's uname -m returns "i686" on a Pentium Pro machine.
712    #
713    if echo "$CPU_ARCH" | grep -c 86 >/dev/null; then
714        CPU_ARCH=x86
715    fi
716fi
717
718if test -z "$OS_TARGET"; then
719    OS_TARGET=$OS_ARCH
720fi
721if test "$OS_TARGET" = "WIN95"; then
722    OS_RELEASE="4.0"
723fi
724if test "$OS_TARGET" = "WIN16"; then
725    OS_RELEASE=
726fi
727OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
728
729dnl ========================================================
730dnl GNU specific defaults
731dnl ========================================================
732if test "$GNU_CC"; then
733    MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
734    MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
735    DSO_LDOPTS='-shared -Wl,-h -Wl,$@'
736    DSO_CFLAGS=''
737    DSO_PIC_CFLAGS='-fPIC'
738    _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
739    _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
740    _MOZ_EXCEPTIONS_FLAGS_ON='-fhandle-exceptions'
741    _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-handle-exceptions'
742
743    # Turn on GNU specific features
744    # -Wall - turn on all warnings
745    # -pedantic - make compiler warn about non-ANSI stuff, and
746    #             be a little bit stricter
747    # Warnings slamm took out for now (these were giving more noise than help):
748    # -Wbad-function-cast - warns when casting a function to a new return type
749    # -Wconversion - complained when char's or short's were used a function args
750    # -Wshadow - removed because it generates more noise than help --pete
751    _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith -Wcast-align"
752
753    dnl Turn pedantic on but disable the warnings for long long
754    _PEDANTIC=1
755    _IGNORE_LONG_LONG_WARNINGS=1
756
757    _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
758    _USE_CPP_INCLUDE_FLAG=1
759else
760    MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
761    MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
762    DSO_LDOPTS='-shared -h $@'
763    DSO_CFLAGS=''
764    DSO_PIC_CFLAGS='-KPIC'
765    _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
766fi
767
768if test "$GNU_CXX"; then
769    # Turn on GNU specific features
770    _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wconversion -Wpointer-arith -Wcast-align -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
771
772    _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
773    _USE_CPP_INCLUDE_FLAG=1
774else
775    _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
776fi
777
778dnl gcc can come with its own linker so it is better to use the pass-thru calls
779dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
780dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
781dnl normal behavior.
782dnl ========================================================
783MKSHLIB_FORCE_ALL=
784MKSHLIB_UNFORCE_ALL=
785if test "$GNU_CC"; then
786  AC_MSG_CHECKING(whether ld has archive extraction flags)
787  AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
788   [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
789    ac_cv_mkshlib_force_and_unforce="no"
790    exec 3<&0 <<LOOP_INPUT
791        force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
792        force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
793        force="-Wl,-all";              unforce="-Wl,-none"
794LOOP_INPUT
795    while read line
796    do
797      eval $line
798      LDFLAGS=$force
799      LIBS=$unforce
800      AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
801    done
802    exec 0<&3 3<&-
803    LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
804   ])
805  if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
806    AC_MSG_RESULT(no)
807  else
808    AC_MSG_RESULT(yes)
809    eval $ac_cv_mkshlib_force_and_unforce
810    MKSHLIB_FORCE_ALL=$force
811    MKSHLIB_UNFORCE_ALL=$unforce
812  fi
813fi
814
815dnl ========================================================
816dnl Checking for 64-bit OS
817dnl ========================================================
818AC_LANG_SAVE
819AC_LANG_C
820AC_MSG_CHECKING(for 64-bit OS)
821AC_TRY_RUN([ int main () {
822    if (sizeof(long) == 8) { return 0; } return 1; } ],
823        result="yes", result="no", result="maybe" )
824AC_MSG_RESULT("$result")
825if test "$result" = "yes"; then
826    AC_DEFINE(HAVE_64BIT_OS)
827    HAVE_64BIT_OS=1
828fi
829AC_SUBST(HAVE_64BIT_OS)
830
831if test "$HAVE_64BIT_OS"; then
832       case "$target_os" in
833       solaris*) TARGET_NSPR_MDCPUCFG='\"md/_solaris64.cfg\"' ;;
834       esac
835fi
836AC_LANG_RESTORE
837
838dnl ========================================================
839dnl System overrides of the defaults for host
840dnl ========================================================
841case "$host" in
842*-beos*)
843    HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
844    HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
845    HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
846    ;;
847
848*cygwin*|*mingw*|*mks*|*msvc*)
849    if test -n "$_WIN32_MSVC"; then
850        HOST_CFLAGS="$HOST_CFLAGS -TC -nologo"
851    else
852        HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
853    fi
854    HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
855    HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
856    HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
857    HOST_BIN_SUFFIX=.exe
858    CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
859    if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
860        _pwd=`pwd`
861        CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
862    fi
863    if test "`${PERL} -v | grep -c cygwin  2>/dev/null`" = 0; then
864        _AS_PERL=1
865        PERL="${CYGWIN_WRAPPER} $PERL"
866    fi
867    ;;
868
869*-darwin*)
870    HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
871    HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
872    HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
873    ;;
874
875*-linux*)
876    HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
877    HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
878    HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
879    ;;
880
881*os2*)
882    HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11"
883    HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
884    HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
885    HOST_BIN_SUFFIX=.exe
886    ;;
887
888*-osf*)
889    HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
890    HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
891    HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
892    ;;
893
894*)
895    HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
896    HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
897    ;;
898esac
899
900dnl Get mozilla version from central milestone file
901MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
902AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
903MOZ_APP_VERSION=$MOZILLA_VERSION
904
905dnl ========================================================
906dnl System overrides of the defaults for target
907dnl ========================================================
908case "$target" in
909*-aix*)
910    AC_DEFINE(AIX)
911    if test ! "$GNU_CC"; then
912        if test ! "$HAVE_64BIT_OS"; then
913            # Compiling with Visual Age C++ object model compat is the
914            # default. To compile with object model ibm, add
915            # AIX_OBJMODEL=ibm to .mozconfig.
916            if test "$AIX_OBJMODEL" = "ibm"; then
917                CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
918            else
919                AIX_OBJMODEL=compat
920            fi
921        else
922            AIX_OBJMODEL=compat
923        fi
924        AC_SUBST(AIX_OBJMODEL)
925        DSO_LDOPTS='-qmkshrobj=1'
926        DSO_CFLAGS='-qflag=w:w'
927        DSO_PIC_CFLAGS=
928        LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
929        MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
930        MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
931        AC_LANG_SAVE
932        AC_LANG_CPLUSPLUS
933        AC_MSG_CHECKING([for VisualAge C++ compiler version >= 5.0.2.0])
934        AC_TRY_COMPILE([],
935            [#if (__IBMCPP__ < 502)
936             #error "Bad compiler"
937             #endif],
938            _BAD_COMPILER=,_BAD_COMPILER=1)
939        if test -n "$_BAD_COMPILER"; then
940            AC_MSG_RESULT([no])   
941            AC_MSG_ERROR([VisualAge C++ version 5.0.2.0 or higher is required to build.])
942        else
943            AC_MSG_RESULT([yes])   
944        fi
945        AC_LANG_RESTORE
946        CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
947        CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
948    fi
949    case "${target_os}" in
950    aix4.1*)
951        DLL_SUFFIX='_shr.a'
952        ;;
953    esac
954    AC_CHECK_HEADERS(sys/inttypes.h)
955    AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
956    ;;
957
958*-beos*)
959    no_x=yes
960    MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
961    _PLATFORM_DEFAULT_TOOLKIT="beos"
962    DSO_LDOPTS='-nostart -Wl,-h -Wl,$@'
963    TK_LIBS='-lbe -lroot'
964    LIBS="$LIBS -lbe"
965    AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
966    _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
967    _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
968    _MOZ_USE_RTTI=1
969    USE_DEPENDENT_LIBS=
970    MOZ_USER_DIR="Mozilla"
971    ;;
972
973*-bsdi*)
974    dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
975    _PEDANTIC=
976    _IGNORE_LONG_LONG_WARNINGS=
977    case $OS_RELEASE in
978        4.*|5.*)
979            STRIP="$STRIP -d"
980            ;;
981        *)
982            DSO_CFLAGS=''
983            DSO_LDOPTS='-r'
984            _WARNINGS_CFLAGS="-Wall"
985            _WARNINGS_CXXFLAGS="-Wall"
986            # The test above doesn't work properly, at least on 3.1.
987            MKSHLIB_FORCE_ALL=''
988            MKSHLIB_UNFORCE_ALL=''
989        ;;
990    esac
991    ;;
992
993*-darwin*)
994    _PEDANTIC=
995    CFLAGS="$CFLAGS -fpascal-strings -no-cpp-precomp -fno-common"
996    CXXFLAGS="$CXXFLAGS -fpascal-strings -no-cpp-precomp -fno-common"
997    DLL_SUFFIX=".dylib"
998    DSO_LDOPTS=''
999    STRIP="$STRIP -x -S"
1000    case "${target_cpu}" in
1001    powerpc*)
1002        _PLATFORM_DEFAULT_TOOLKIT='mac'
1003        DSO_LDOPTS="$DSO_LDOPTS -arch ppc"
1004        MOZ_ENABLE_POSTSCRIPT=
1005        # set MACOSX to generate lib/mac/MoreFiles/Makefile
1006        MACOSX=1
1007        ;;
1008    esac
1009    ;;
1010
1011*-freebsd*)
1012    if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` != "elf"; then
1013        DLL_SUFFIX=".so.1.0"
1014        DSO_LDOPTS="-shared"
1015    fi
1016    if test ! "$GNU_CC"; then
1017        DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
1018    fi
1019# Can't have force w/o an unforce.
1020#    # Hack for FreeBSD 2.2
1021#    if test -z "$MKSHLIB_FORCE_ALL"; then
1022#       MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive'
1023#       MKSHLIB_UNFORCE_ALL=''
1024#    fi
1025    ;;
1026
1027*-hpux*)
1028    DLL_SUFFIX=".sl"
1029    if test ! "$GNU_CC"; then
1030        DSO_LDOPTS='-b -Wl,+s -L$(DIST)/bin'
1031        DSO_CFLAGS=""
1032        DSO_PIC_CFLAGS="+Z"
1033        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
1034        MKCSHLIB='$(LD) -b +s -L$(DIST)/bin -o $@'
1035        CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1036    else
1037        DSO_LDOPTS='-b -E +s -L$(DIST)/bin -L$(DIST)/lib'
1038        MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1039        MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1040    fi
1041    MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1042    AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1043    ;;
1044
1045*-irix5*)
1046    AC_DEFINE(IRIX)
1047    DSO_LDOPTS='-elf -shared'
1048    if test "$GNU_CC"; then
1049       MKSHLIB_FORCE_ALL='-Wl,-all'
1050       MKSHLIB_UNFORCE_ALL='-Wl,-none'
1051       CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1052    else
1053       MKSHLIB_FORCE_ALL='-all'
1054       MKSHLIB_UNFORCE_ALL='-none'
1055    fi
1056    ;;
1057
1058*-irix6*)
1059    AC_DEFINE(IRIX)
1060    dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must*
1061    dnl compile and link using -n32
1062    USE_N32=1
1063    DSO_LDOPTS='-elf -shared'
1064    MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1065    MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1066    _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
1067    _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
1068    if test "$GNU_CC"; then
1069       MKSHLIB_FORCE_ALL='-Wl,-all'
1070       MKSHLIB_UNFORCE_ALL='-Wl,-none'
1071       _WARNINGS_CFLAGS="-Wall"
1072       _WARNINGS_CXXFLAGS="-Wall"
1073       CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1074    else
1075       MKSHLIB_FORCE_ALL='-all'
1076       MKSHLIB_UNFORCE_ALL='-none'
1077           AR_LIST="$AR t"
1078           AR_EXTRACT="$AR x"
1079           AR_DELETE="$AR d"
1080           AR='$(CXX) -ar'
1081           AR_FLAGS='-o $@'
1082       CFLAGS="$CFLAGS -woff 3262 -G 4"
1083       CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
1084       if test -n "$USE_N32"; then
1085           ASFLAGS="$ASFLAGS -n32"
1086           CFLAGS="$CFLAGS -n32"
1087           CXXFLAGS="$CXXFLAGS -n32"
1088           LDFLAGS="$LDFLAGS -n32"
1089       fi
1090       AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1091    fi
1092    if test -z "$GNU_CXX"; then
1093      MIPSPRO_CXX=1
1094    fi
1095    ;;
1096
1097*-*linux*)
1098    TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1099    MOZ_DEBUG_FLAGS="-g -fno-inline"  # most people on linux use gcc/gdb,
1100                                      # and that combo is not yet good at
1101                                      # debugging inlined functions (even
1102                                      # when using DWARF2 as the debugging
1103                                      # format)   
1104
1105    case "${target_cpu}" in
1106    alpha*)
1107        CFLAGS="$CFLAGS -mieee"
1108        CXXFLAGS="$CXXFLAGS -mieee"
1109    ;;
1110    i*86)
1111        USE_ELF_DYNSTR_GC=1
1112        MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1
1113    ;;
1114    mips*)
1115        CFLAGS="$CFLAGS -Wa,-xgot"
1116        CXXFLAGS="$CXXFLAGS -Wa,-xgot"
1117    ;;
1118    esac
1119    ;;
1120
1121*-mingw*|*-cygwin*|*-msvc*|*-mks*)
1122    DSO_CFLAGS=
1123    DSO_PIC_CFLAGS=
1124    DLL_SUFFIX=.dll
1125    RC=rc.exe
1126    # certain versions of cygwin's makedepend barf on the
1127    # #include <string> vs -I./dist/include/string issue so don't use it
1128    SYSTEM_MAKEDEPEND=
1129    if test -n "$GNU_CC"; then
1130        CC="$CC -mno-cygwin"
1131        CXX="$CXX -mno-cygwin"
1132        CPP="$CPP -mno-cygwin"
1133        CFLAGS="$CFLAGS -mms-bitfields"
1134        CXXFLAGS="$CXXFLAGS -mms-bitfields"
1135        DSO_LDOPTS='-shared'
1136        MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1137        MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1138        RC='$(WINDRES)'
1139        # Use temp file for windres (bug 213281)
1140        RCFLAGS='-O coff --use-temp-file'
1141        MOZ_JPEG_LIBS='-L$(DIST)/lib -ljpeg$(MOZ_BITS)$(VERSION_NUMBER)'
1142        MOZ_ZLIB_LIBS='-L$(DIST)/lib -lmozz'
1143        MOZ_PNG_LIBS='-L$(DIST)/lib -lpng'
1144        MOZ_JS_LIBS='-L$(DIST)/lib -ljs$(MOZ_BITS)$(VERSION_NUMBER)'
1145        XPCOM_LIBS='-L$(DIST)/lib -lxpcom'
1146        DLL_PREFIX=
1147        IMPORT_LIB_SUFFIX=dll.a
1148    else
1149        HOST_CC='$(CC)'
1150        HOST_CXX='$(CXX)'
1151        HOST_LD='$(LD)'
1152        AR='lib -NOLOGO -OUT:"$@"'
1153        AR_FLAGS=
1154        RANLIB='echo not_ranlib'
1155        STRIP='echo not_strip'
1156        XARGS=xargs
1157        ZIP=zip
1158        UNZIP=unzip
1159        DOXYGEN=:
1160        GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
1161        OBJ_SUFFIX=obj
1162        LIB_SUFFIX=lib
1163        DLL_PREFIX=
1164        LIB_PREFIX=
1165        IMPORT_LIB_SUFFIX=lib
1166        MKSHLIB='$(LD) /NOLOGO /DLL /OUT:$@ /PDB:$(PDBFILE) $(DSO_LDOPTS)'
1167        MKCSHLIB='$(LD) /NOLOGO /DLL /OUT:$@ /PDB:$(PDBFILE) $(DSO_LDOPTS)'
1168        MKSHLIB_FORCE_ALL=
1169        MKSHLIB_UNFORCE_ALL=
1170        DSO_LDOPTS=/SUBSYSTEM:WINDOWS
1171        CFLAGS="$CFLAGS -W3 -nologo -Gy -Fd\$(PDBFILE)"
1172        CXXFLAGS="$CXXFLAGS -W3 -nologo -Gy -Fd\$(PDBFILE)"
1173        LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
1174        MOZ_DEBUG_FLAGS='-Zi'
1175        MOZ_DEBUG_LDFLAGS='/DEBUG /DEBUGTYPE:CV'
1176        MOZ_OPTIMIZE_FLAGS='-O1'
1177        MOZ_JPEG_LIBS='$(DIST)/lib/jpeg$(MOZ_BITS)$(VERSION_NUMBER).lib'
1178        MOZ_ZLIB_LIBS='$(DIST)/lib/mozz.lib'
1179        MOZ_PNG_LIBS='$(DIST)/lib/png.lib'
1180        MOZ_JS_LIBS='$(DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
1181        XPCOM_LIBS='$(DIST)/lib/xpcom.lib'
1182        MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1183        MOZ_COMPONENT_XPCOM_LIBS='$(XPCOM_LIBS)'
1184        MOZ_XPCOM_OBSOLETE_LIBS='$(DIST)/lib/xpcom_compat.lib'
1185    fi
1186    AC_DEFINE(HAVE_SNPRINTF)
1187    AC_DEFINE(_WINDOWS)
1188    AC_DEFINE(_WIN32)
1189    AC_DEFINE(WIN32)
1190    AC_DEFINE(XP_WIN)
1191    AC_DEFINE(XP_WIN32)
1192    AC_DEFINE(HW_THREADS)
1193    AC_DEFINE_UNQUOTED(WINVER,0x400)
1194    AC_DEFINE(STDC_HEADERS)
1195    AC_DEFINE(NEW_H, <new>)
1196    AC_DEFINE(WIN32_LEAN_AND_MEAN)
1197    TARGET_MD_ARCH=win32
1198    _PLATFORM_DEFAULT_TOOLKIT='windows'
1199    BIN_SUFFIX='.exe'
1200    USE_SHORT_LIBNAME=1
1201    MOZ_ENABLE_COREXFONTS=
1202    MOZ_ENABLE_POSTSCRIPT=
1203    MOZ_USER_DIR="Mozilla"
1204
1205    dnl Do not perform checks for GSSAPI.  We're going to use SSPI instead.
1206    USE_GSSAPI=
1207
1208    dnl Hardcode to win95 for now - cls
1209    TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
1210    dnl set NO_X11 defines here as the general check is skipped on win32
1211    no_x=yes
1212    AC_DEFINE(NO_X11)
1213
1214    case "$host" in
1215    *-mingw*|*-cygwin*|*-msvc*|*-mks*)
1216
1217    dnl Remove cygwinism from MOZ_BUILD_ROOT
1218    MOZ_BUILD_ROOT=`cygpath -w $MOZ_BUILD_ROOT | sed -e 's|\\\\|/|g'`
1219
1220    if test -z "$MOZ_TOOLS"; then
1221        AC_MSG_ERROR([MOZ_TOOLS is not set])
1222    fi
1223
1224    MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd`
1225    if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then
1226        AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
1227    fi
1228    if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_DIR/bin:"` = 0; then
1229        AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
1230    fi
1231    MOZ_TOOLS_DIR=`cygpath -w $MOZ_TOOLS_DIR | sed -e 's|\\\\|/|g'`
1232
1233    if test -n "$GLIB_PREFIX"; then
1234        _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd`
1235        if test "$?" = "0"; then
1236            if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
1237                AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
1238            fi
1239            _GLIB_PREFIX_DIR=`cygpath -w $_GLIB_PREFIX_DIR | sed -e 's|\\\\|/|g'`
1240        else
1241            AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
1242        fi
1243    else
1244        _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
1245    fi
1246    if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
1247        AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
1248    fi
1249    GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
1250    GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
1251
1252    if test -n "$LIBIDL_PREFIX"; then
1253        _LIBIDL_PREFIX_DIR=`cd $LIBIDL_PREFIX && pwd`
1254        if test "$?" = "0"; then
1255            if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
1256                AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
1257            fi
1258            _LIBIDL_PREFIX_DIR=`cygpath -w $_LIBIDL_PREFIX_DIR | sed -e 's|\\\\|/|g'`
1259        else
1260            AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
1261        fi
1262    else
1263        _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
1264    fi       
1265    if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
1266        AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
1267    fi
1268    LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
1269    LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib ${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
1270    ;;
1271    *) # else cross-compiling
1272        if test -n "$GLIB_PREFIX"; then
1273            GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
1274            GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
1275        fi
1276        if test -n "$LIBIDL_PREFIX"; then
1277            LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
1278            LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib ${GLIB_LIBS}"
1279        fi
1280        ;;
1281    esac
1282
1283    case "$target" in
1284    i*86-*)
1285        AC_DEFINE(_X86_)
1286        ;;
1287    alpha-*)
1288        AC_DEFINE(_ALPHA_)
1289        ;;
1290    mips-*)
1291        AC_DEFINE(_MIPS_)
1292        ;;
1293    *)
1294        AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
1295        ;;
1296    esac
1297    ;;
1298
1299*-netbsd*)
1300    DSO_CFLAGS=''
1301    CFLAGS="$CFLAGS -Dunix"
1302    CXXFLAGS="$CXXFLAGS -Dunix"
1303    if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
1304        DLL_SUFFIX=".so"
1305        DSO_PIC_CFLAGS='-fPIC -DPIC'
1306        DSO_LDOPTS='-shared -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX)'
1307        BIN_FLAGS='-Wl,--export-dynamic'
1308    else
1309        DSO_PIC_CFLAGS='-fPIC -DPIC'
1310        DLL_SUFFIX=".so.1.0"
1311        DSO_LDOPTS='-shared'
1312    fi
1313    # This will fail on a.out systems prior to 1.5.1_ALPHA.
1314    MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
1315    MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
1316    if test "$LIBRUNPATH"; then
1317        DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
1318    fi
1319    ;;
1320
1321*-nto*)
1322        AC_DEFINE(NTO) 
1323        AC_DEFINE(_QNX_SOURCE)
1324        AC_DEFINE(_i386)
1325        OS_TARGET=NTO
1326        MOZ_OPTIMIZE_FLAGS="-O"
1327        MOZ_DEBUG_FLAGS="-gstabs"
1328        USE_PTHREADS=1
1329        _PEDANTIC=
1330        LIBS="$LIBS -lsocket -lstdc++"
1331        _DEFINES_CFLAGS='-Wp,-include -Wp,$(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
1332        _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -Wp,-include -Wp,$(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
1333        if test "$with_x" != "yes"
1334        then
1335                _PLATFORM_DEFAULT_TOOLKIT="photon"
1336            TK_CFLAGS='-I/usr/include/photon'
1337                TK_LIBS='-lph'
1338        fi
1339        case "${target_cpu}" in
1340        ppc*)
1341        AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)       
1342        ;;
1343        esac
1344        case "${host_cpu}" in
1345        i*86)
1346        USE_ELF_DYNSTR_GC=1
1347        ;;
1348        esac
1349        ;;
1350
1351*-openbsd*)
1352    DLL_SUFFIX=".so.1.0"
1353    DSO_CFLAGS=''
1354    DSO_PIC_CFLAGS='-fPIC'
1355    DSO_LDOPTS='-shared -fPIC'
1356    if test "$LIBRUNPATH"; then
1357        DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
1358    fi
1359    ;;
1360
1361*-openvms*)
1362    AC_DEFINE(NO_PW_GECOS)
1363    AC_DEFINE(NO_UDSOCK)
1364    AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
1365    USE_PTHREADS=1
1366    MKSHLIB_FORCE_ALL='-all'
1367    MKSHLIB_UNFORCE_ALL='-none'
1368    AS='as'
1369    AS_DASH_C_FLAG='-Wc/names=as_is'
1370    AR_FLAGS='c $@'
1371    DSO_LDOPTS='-shared -auto_symvec'
1372    DSO_PIC_CFLAGS=
1373    MOZ_DEBUG_LDFLAGS='-g'
1374    COMPAQ_CXX=1
1375    CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
1376    CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
1377    ;;
1378
1379
1380*-os2*)
1381    AC_DEFINE(XP_OS2)
1382    USE_SHORT_LIBNAME=1
1383    DLL_PREFIX=
1384    LIB_PREFIX=
1385    LIB_SUFFIX=lib
1386    BIN_SUFFIX=".exe"
1387    DLL_SUFFIX=".dll"
1388    IMPORT_LIB_SUFFIX=lib
1389    DSO_PIC_CFLAGS=
1390    TARGET_MD_ARCH=os2
1391    _PLATFORM_DEFAULT_TOOLKIT=os2
1392    WIDGET_DLL='\"wdgt$(MOZ_WIDGET_TOOLKIT)$(DLL_SUFFIX)\"'
1393    GFXWIN_DLL='\"gfx_$(MOZ_GFX_TOOLKIT)$(DLL_SUFFIX)\"'
1394    MOZ_ENABLE_POSTSCRIPT=
1395    RC=rc.exe
1396    RCFLAGS='-n'
1397    MOZ_USER_DIR="Mozilla"
1398
1399    if test "$MOZTOOLS"; then
1400        MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
1401    else
1402        AC_MSG_ERROR([MOZTOOLS is not set])
1403    fi
1404
1405    # EMX/GCC build
1406    if test -n "$GNU_CC"; then
1407        AC_DEFINE(OS2)
1408        AC_DEFINE(XP_OS2_EMX)
1409        AC_DEFINE(OS2EMX_PLAIN_CHAR)
1410        AC_DEFINE(TCPV40HDRS)
1411        AR=emxomfar
1412        AR_FLAGS='r $@'
1413        CFLAGS="$CFLAGS -Zomf"
1414        CXXFLAGS="$CXXFLAGS -Zomf"
1415        DSO_LDOPTS='-Zdll'
1416        BIN_FLAGS='-Zlinker /ST:0x100000'
1417        IMPLIB='emximp -o'
1418        FILTER='emxexp -o'
1419        LDFLAGS='-Zmap'
1420        MOZ_DEBUG_FLAGS="-g -fno-inline"
1421        MOZ_OPTIMIZE_FLAGS="-O2 -s"
1422        MOZ_OPTIMIZE_LDFLAGS="-Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
1423        MOZ_WIDGET_TOOLKIT_LDFLAGS='-lwdgt$(MOZ_WIDGET_TOOLKIT)'
1424        MOZ_GFX_TOOLKIT_LDFLAGS='-lgfx_$(MOZ_WIDGET_TOOLKIT)'
1425        MOZ_XPCOM_OBSOLETE_LIBS='-L$(DIST)/lib $(DIST)/lib/xpcomct.lib'
1426
1427        # GCC for OS/2 currently predefines these, but we don't want them
1428        _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
1429        _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
1430
1431    # Visual Age C++ build
1432    elif test "$VACPP" = "yes"; then
1433        MOZ_BUILD_ROOT=`pwd -D`
1434        OBJ_SUFFIX=obj
1435        AR=-ilib
1436        AR_FLAGS='/NOL /NOI /O:$(subst /,\\,$@)'
1437        AR_LIST='/L'
1438        AR_EXTRACT='-*'
1439        AR_DELETE='-'
1440        AS=alp
1441        ASFLAGS='-Mb'
1442        AS_DASH_C_FLAG=''
1443        ASM_SUFFIX=asm
1444        LD='-ilink'
1445        CFLAGS="/Q /qlibansi /Gm+ /Su4 /Mp /Tl9"
1446        CXXFLAGS="/Q /qlibansi /Gm+ /Su4 /Mp /Tl9 /Gx+"
1447        MOZ_DEBUG_FLAGS="/Ti+"
1448        MOZ_OPTIMIZE_FLAGS="/O+ /Gl+ /G5 /qarch=pentium"
1449        LDFLAGS="/NOL /M"
1450        MOZ_DEBUG_LDFLAGS="/DE"
1451        MOZ_OPTIMIZE_LDFLAGS="/OPTFUNC /EXEPACK:2 /PACKCODE /PACKDATA"
1452        DSO_LDOPTS=''
1453        DSO_PIC_CFLAGS=
1454        IMPLIB='implib /NOL /NOI'
1455        FILTER='cppfilt -q -B -P'
1456        AC_DEFINE(NO_ANSI_KEYWORDS)
1457        AC_DEFINE(OS2,4)
1458        AC_DEFINE(_X86_)
1459        AC_DEFINE(XP_OS2_VACPP)
1460        AC_DEFINE(TCPV40HDRS)
1461        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1462        AC_DEFINE(STDC_HEADERS)
1463        MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1464        MKSHLIB='$(LD) $(DSO_LDOPTS)'
1465        MKCSHLIB='$(LD) $(DSO_LDOPTS)'
1466        MOZ_JS_LIBS='$(DIST)/lib/mozjs.lib'
1467        MOZ_COMPONENT_XPCOM_LIBS='$(DIST)/lib/xpcom.lib'
1468        MOZ_XPCOM_OBSOLETE_LIBS='$(DIST)/lib/xpcomct.lib'
1469        XPCOM_LIBS='$(DIST)/lib/xpcom.lib'
1470        MOZ_JPEG_LIBS='$(DIST)/lib/mozjpeg.$(LIB_SUFFIX)'
1471        MOZ_ZLIB_LIBS='$(DIST)/lib/mozz.$(LIB_SUFFIX)'
1472        MOZ_PNG_LIBS='$(DIST)/lib/mozpng.$(LIB_SUFFIX)'
1473        MOZ_WIDGET_TOOLKIT_LDFLAGS='$(DIST)/lib/wdgt$(MOZ_WIDGET_TOOLKIT)'
1474        MOZ_GFX_TOOLKIT_LDFLAGS='$(DIST)/lib/gfx_$(MOZ_WIDGET_TOOLKIT)'
1475    fi
1476    ;;
1477
1478alpha*-*-osf*)
1479    if test "$GNU_CC"; then
1480        DSO_LDOPTS='-shared -Wl,-soname -Wl,$@'
1481    else
1482        MOZ_DEBUG_FLAGS='-g'
1483        ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
1484        CFLAGS="$CFLAGS -ieee"
1485        CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee  -ptr $(DIST)/cxx_repository'
1486        DSO_LDOPTS='-shared -msym -expect_unresolved \* -soname $@ -update_registry $(DIST)/so_locations'
1487        DSO_CFLAGS=
1488        DSO_PIC_CFLAGS=
1489        MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1490        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1491        MKSHLIB_FORCE_ALL='-all'
1492        MKSHLIB_UNFORCE_ALL='-none'
1493        dnl Might fix the libxpcom.so breakage on this platform as well....
1494        AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
1495        AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1496    fi
1497    if test -z "$GNU_CXX"; then
1498      COMPAQ_CXX=1
1499    fi
1500    AC_DEFINE(NEED_USLEEP_PROTOTYPE)
1501    ;;
1502
1503*-qnx*)
1504    DIRENT_INO=d_stat.st_ino
1505    dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
1506    AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
1507    AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1508    dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
1509    AC_DEFINE(STDC_HEADERS)
1510    if test "$no_x" = "yes"; then
1511            _PLATFORM_DEFAULT_TOOLKIT='photon'
1512            TK_CFLAGS='-I/usr/nto/include/photon'
1513            TK_LIBS='-lphoton -lphrender'
1514    fi
1515    ;;
1516
1517*-sco*)
1518    AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
1519    AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1520    CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
1521    if test ! "$GNU_CC"; then
1522       DSO_LDOPTS='-G -h $@'
1523    fi
1524    ;;
1525
1526dnl the qsort routine under solaris is faulty
1527*-solaris*)
1528    AC_DEFINE(SOLARIS)
1529    TARGET_NSPR_MDCPUCFG='\"md/_solaris32.cfg\"'
1530    SYSTEM_MAKEDEPEND=
1531    if test -z "$GNU_CC"; then
1532       NS_USE_NATIVE=1
1533       AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1534       CFLAGS="$CFLAGS -xstrconst -xbuiltin=%all"
1535       CXXFLAGS="$CXXFLAGS -xbuiltin=%all -features=tmplife"
1536       LDFLAGS="-xildoff -zlazyload -zcombreloc $LDFLAGS"
1537       MOZ_OPTIMIZE_FLAGS="-xO4"
1538       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -o $@'
1539       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -Wl,-z -Wl,muldefs -o $@'
1540       MKSHLIB_FORCE_ALL='-Qoption ld -z,allextract'
1541       MKSHLIB_UNFORCE_ALL=''
1542       DSO_LDOPTS='-G -Qoption ld -z,muldefs -h $@'
1543       AR_LIST="$AR t"
1544       AR_EXTRACT="$AR x"
1545       AR_DELETE="$AR d"
1546       AR='$(CXX) -xar'
1547       AR_FLAGS='-o $@'
1548       AS='/usr/ccs/bin/as'
1549       ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
1550       AS_DASH_C_FLAG=''
1551        CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
1552        CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
1553       AC_MSG_CHECKING([for Forte compiler version >= WS6U2])
1554       AC_TRY_COMPILE([],
1555           [#if (__SUNPRO_C < 0x530)
1556           #error "Denied"
1557           #endif],
1558           _BAD_COMPILER=,_BAD_COMPILER=1)
1559        if test -n "$_BAD_COMPILER"; then
1560            _res="no"
1561            AC_MSG_ERROR([Forte version WS6U2 or higher is required to build. Your compiler version is $CC_VERSION .])
1562        else
1563            _res="yes"
1564        fi
1565        AC_MSG_RESULT([$_res])
1566    else
1567       ASFLAGS="$ASFLAGS -fPIC"
1568       DSO_LDOPTS='-G -h $@'
1569       _WARNINGS_CFLAGS=''
1570       _WARNINGS_CXXFLAGS=''
1571       if test "$OS_RELEASE" = "5.3"; then
1572          AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
1573       fi
1574    fi
1575    if test "$OS_RELEASE" = "5.5.1"; then
1576       AC_DEFINE(NEED_USLEEP_PROTOTYPE)
1577    fi
1578    ;;
1579
1580*-sunos*)
1581    DSO_LDOPTS='-Bdynamic'
1582    MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
1583    MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
1584    AC_DEFINE(SUNOS4)
1585    AC_DEFINE(SPRINTF_RETURNS_STRING)
1586    case "$(target_os)" in
1587    sunos4.1*)
1588        DLL_SUFFIX='.so.1.0'
1589        ;;
1590    esac
1591    ;;
1592
1593*-sysv4.2uw7*)
1594        NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
1595    ;;
1596
1597*-os2*)
1598    HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1599    ;;
1600
1601esac
1602
1603dnl Only one oddball right now (QNX), but this gives us flexibility
1604dnl if any other platforms need to override this in the future.
1605AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
1606
1607dnl ========================================================
1608dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
1609dnl by now will not have any way to link most binaries (tests
1610dnl as well as viewer, apprunner, etc.), because some symbols
1611dnl will be left out of the "composite" .so's by ld as unneeded.
1612dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
1613dnl they can link in the static libs that provide the missing
1614dnl symbols.
1615dnl ========================================================
1616NO_LD_ARCHIVE_FLAGS=
1617if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then
1618    NO_LD_ARCHIVE_FLAGS=1
1619fi
1620case "$target" in
1621*-os2*)
1622    NO_LD_ARCHIVE_FLAGS=
1623    ;;
1624*-aix4.3*|*-aix5*)
1625    NO_LD_ARCHIVE_FLAGS=
1626    ;;
1627*-openvms*)
1628    NO_LD_ARCHIVE_FLAGS=
1629    ;;
1630*-msvc*|*-mks*|*-mingw*|*-cygwin*)
1631    if test -z "$GNU_CC"; then
1632        NO_LD_ARCHIVE_FLAGS=
1633    fi
1634    ;;
1635esac
1636AC_SUBST(NO_LD_ARCHIVE_FLAGS)
1637
1638dnl
1639dnl Indicate that platform requires special thread safe
1640dnl locking when starting up the OJI JVM
1641dnl (see mozilla/modules/oji/src/nsJVMManager.cpp)
1642dnl ========================================================
1643case "$target" in
1644    *-hpux*)     
1645        AC_DEFINE(MOZ_OJI_REQUIRE_THREAD_SAFE_ON_STARTUP)
1646        ;;
1647esac
1648
1649dnl ========================================================
1650dnl = Flags to strip unused symbols from .so components
1651dnl ========================================================
1652case "$target" in
1653    *-linux*)
1654        MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
1655        ;;
1656    *-solaris*)
1657        if test -z "$GNU_CC"; then
1658         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
1659        else
1660         if test -z "$GCC_USE_GNU_LD"; then
1661          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
1662         else
1663          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
1664         fi
1665        fi
1666        ;;
1667    *-nto*)
1668        MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
1669        ;;
1670    *-darwin*)
1671        AC_MSG_CHECKING(for -exported_symbols_list option to ld)
1672        AC_CACHE_VAL(ac_cv_exported_symbols_list,
1673         [
1674           if $LD -exported_symbols_list | grep "argument missing" >/dev/null; then
1675             ac_cv_exported_symbols_list=true
1676           else
1677             ac_cv_exported_symbols_list=false
1678           fi
1679         ])
1680        if test "$ac_cv_exported_symbols_list" = true; then
1681          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
1682          AC_MSG_RESULT(yes)
1683        else
1684          AC_MSG_RESULT(no)
1685        fi
1686        ;;
1687    *-cygwin*|*-mingw*|*-mks*|*-msvc)
1688        if test -n "$GNU_CC"; then
1689           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
1690        fi
1691        ;;
1692esac
1693
1694if test -z "$SKIP_COMPILER_CHECKS"; then
1695dnl Checks for typedefs, structures, and compiler characteristics.
1696dnl ========================================================
1697AC_LANG_C
1698AC_HEADER_STDC
1699AC_C_CONST
1700AC_TYPE_MODE_T
1701AC_TYPE_OFF_T
1702AC_TYPE_PID_T
1703AC_TYPE_SIZE_T
1704AC_TYPE_UID_T
1705AC_STRUCT_ST_BLKSIZE
1706AC_MSG_CHECKING(for siginfo_t)
1707AC_CACHE_VAL(ac_cv_siginfo_t,
1708 [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
1709                  #include <signal.h>],
1710                 [siginfo_t* info;],
1711                 [ac_cv_siginfo_t=true],
1712                 [ac_cv_siginfo_t=false])])
1713if test "$ac_cv_siginfo_t" = true ; then
1714  AC_DEFINE(HAVE_SIGINFO_T)
1715  AC_MSG_RESULT(yes)
1716else
1717  AC_MSG_RESULT(no)
1718fi
1719
1720dnl Visual Age for os/2 also defines size_t and off_t in certain
1721dnl  header files.  These defines make Visual Age use the mozilla
1722dnl  defines types.
1723if test "$VACPP" = "yes"; then
1724   AC_DEFINE(__size_t)
1725   AC_DEFINE(__off_t)
1726fi
1727
1728dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
1729dnl ========================================================
1730AC_MSG_CHECKING(for int16_t)
1731AC_CACHE_VAL(ac_cv_int16_t,
1732 [AC_TRY_COMPILE([#include <stdio.h>
1733                  #include <sys/types.h>],
1734                 [int16_t foo = 0;],
1735                 [ac_cv_int16_t=true],
1736                 [ac_cv_int16_t=false])])
1737if test "$ac_cv_int16_t" = true ; then
1738  AC_DEFINE(HAVE_INT16_T)
1739  AC_MSG_RESULT(yes)
1740else
1741  AC_MSG_RESULT(no)
1742fi
1743AC_MSG_CHECKING(for int32_t)
1744AC_CACHE_VAL(ac_cv_int32_t,
1745 [AC_TRY_COMPILE([#include <stdio.h>
1746                  #include <sys/types.h>],
1747                 [int32_t foo = 0;],
1748                 [ac_cv_int32_t=true],
1749                 [ac_cv_int32_t=false])])
1750if test "$ac_cv_int32_t" = true ; then
1751  AC_DEFINE(HAVE_INT32_T)
1752  AC_MSG_RESULT(yes)
1753else
1754  AC_MSG_RESULT(no)
1755fi
1756AC_MSG_CHECKING(for int64_t)
1757AC_CACHE_VAL(ac_cv_int64_t,
1758 [AC_TRY_COMPILE([#include <stdio.h>
1759                  #include <sys/types.h>],
1760                 [int64_t foo = 0;],
1761                 [ac_cv_int64_t=true],
1762                 [ac_cv_int64_t=false])])
1763if test "$ac_cv_int64_t" = true ; then
1764  AC_DEFINE(HAVE_INT64_T)
1765  AC_MSG_RESULT(yes)
1766else
1767  AC_MSG_RESULT(no)
1768fi
1769AC_MSG_CHECKING(for int64)
1770AC_CACHE_VAL(ac_cv_int64,
1771 [AC_TRY_COMPILE([#include <stdio.h>
1772                  #include <sys/types.h>],
1773                 [int64 foo = 0;],
1774                 [ac_cv_int64=true],
1775                 [ac_cv_int64=false])])
1776if test "$ac_cv_int64" = true ; then
1777  AC_DEFINE(HAVE_INT64)
1778  AC_MSG_RESULT(yes)
1779else
1780  AC_MSG_RESULT(no)
1781fi
1782AC_MSG_CHECKING(for uint)
1783AC_CACHE_VAL(ac_cv_uint,
1784 [AC_TRY_COMPILE([#include <stdio.h>
1785                  #include <sys/types.h>],
1786                 [uint foo = 0;],
1787                 [ac_cv_uint=true],
1788                 [ac_cv_uint=false])])
1789if test "$ac_cv_uint" = true ; then
1790  AC_DEFINE(HAVE_UINT)
1791  AC_MSG_RESULT(yes)
1792else
1793  AC_MSG_RESULT(no)
1794fi
1795AC_MSG_CHECKING(for uint_t)
1796AC_CACHE_VAL(ac_cv_uint_t,
1797 [AC_TRY_COMPILE([#include <stdio.h>
1798                  #include <sys/types.h>],
1799                 [uint_t foo = 0;],
1800                 [ac_cv_uint_t=true],
1801                 [ac_cv_uint_t=false])])
1802if test "$ac_cv_uint_t" = true ; then
1803  AC_DEFINE(HAVE_UINT_T)
1804  AC_MSG_RESULT(yes)
1805else
1806  AC_MSG_RESULT(no)
1807fi
1808AC_MSG_CHECKING(for uint16_t)
1809AC_CACHE_VAL(ac_cv_uint16_t,
1810 [AC_TRY_COMPILE([#include <stdio.h>
1811                  #include <sys/types.h>],
1812                 [uint16_t foo = 0;],
1813                 [ac_cv_uint16_t=true],
1814                 [ac_cv_uint16_t=false])])
1815if test "$ac_cv_uint16_t" = true ; then
1816  AC_DEFINE(HAVE_UINT16_T)
1817  AC_MSG_RESULT(yes)
1818else
1819  AC_MSG_RESULT(no)
1820fi
1821
1822dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
1823dnl are defined when compiling C++ but not C.  Since the result of this
1824dnl test is used only in C++, do it in C++.
1825AC_LANG_CPLUSPLUS
1826
1827AC_MSG_CHECKING(for uname.domainname)
1828AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
1829    [AC_TRY_COMPILE([#include <sys/utsname.h>],
1830        [ struct utsname *res; char *domain;
1831            (void)uname(res);  if (res != 0) { domain = res->domainname; } ],
1832        [ac_cv_have_uname_domainname_field=true],
1833        [ac_cv_have_uname_domainname_field=false])])
1834
1835if test "$ac_cv_have_uname_domainname_field" = "true"; then
1836    AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
1837    AC_MSG_RESULT(yes)
1838else
1839    AC_MSG_RESULT(no)
1840fi
1841
1842AC_MSG_CHECKING(for uname.__domainname)
1843AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
1844    [AC_TRY_COMPILE([#include <sys/utsname.h>],
1845        [ struct utsname *res; char *domain;
1846            (void)uname(res);  if (res != 0) { domain = res->__domainname; } ],
1847        [ac_cv_have_uname_us_domainname_field=true],
1848        [ac_cv_have_uname_us_domainname_field=false])])
1849
1850if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
1851    AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
1852    AC_MSG_RESULT(yes)
1853else
1854    AC_MSG_RESULT(no)
1855fi
1856
1857AC_LANG_C
1858
1859dnl Check for usable wchar_t (2 bytes, unsigned)
1860dnl (we really don't need the unsignedness check anymore)
1861dnl ========================================================
1862
1863AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
1864    ac_cv_have_usable_wchar,
1865    [AC_TRY_RUN([#include <stddef.h>
1866                 int main () {
1867                   return (sizeof(wchar_t) != 2) ||
1868                          (wchar_t)-1 < (wchar_t) 0 ; } ],
1869                ac_cv_have_usable_wchar="yes",
1870                ac_cv_have_usable_wchar="no",
1871                ac_cv_have_usable_wchar="maybe")])
1872if test "$ac_cv_have_usable_wchar" = "yes"; then
1873    AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
1874    HAVE_CPP_2BYTE_WCHAR_T=1
1875else
1876dnl This is really gcc-only
1877dnl Do this test using CXX only since some versions of gcc
1878dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
1879dnl only have short-wchar support for c++.
1880dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
1881
1882    AC_LANG_SAVE
1883    AC_LANG_CPLUSPLUS
1884    _SAVE_CXXFLAGS=$CXXFLAGS
1885    CXXFLAGS="$CXXFLAGS -fshort-wchar"
1886
1887    AC_CACHE_CHECK(for compiler -fshort-wchar option,
1888        ac_cv_have_usable_wchar_option,
1889        [AC_TRY_RUN([#include <stddef.h>
1890                     int main () {
1891                       return (sizeof(wchar_t) != 2) ||
1892                              (wchar_t)-1 < (wchar_t) 0 ; } ],
1893                    ac_cv_have_usable_wchar_option="yes",
1894                    ac_cv_have_usable_wchar_option="no",
1895                    ac_cv_have_usable_wchar_option="maybe")])
1896
1897    if test "$ac_cv_have_usable_wchar_option" = "yes"; then
1898        AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
1899        HAVE_CPP_2BYTE_WCHAR_T=1
1900    else   
1901        CXXFLAGS=$_SAVE_CXXFLAGS
1902    fi
1903    AC_LANG_RESTORE
1904fi
1905
1906dnl Check for .hidden assembler directive and visibility attribute.
1907dnl Borrowed from glibc configure.in
1908dnl ===============================================================
1909if test "$GNU_CC"; then
1910  AC_CACHE_CHECK(for .hidden assembler directive,
1911                 ac_cv_asm_hidden_directive, [dnl
1912    cat > conftest.s <<EOF
1913.hidden foo
1914foo:
1915EOF
1916    if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&5); then
1917      ac_cv_asm_hidden_directive=yes
1918    else
1919      ac_cv_asm_hidden_directive=no
1920    fi
1921    rm -f conftest*])
1922
1923  if test $ac_cv_asm_hidden_directive = yes; then
1924    AC_CACHE_CHECK(whether __attribute__((visibility())) is supported,
1925                 ac_cv_visibility_attribute,
1926                 [cat > conftest.c <<EOF
1927                  int foo __attribute__ ((visibility ("hidden"))) = 1;
1928EOF
1929                  ac_cv_visibility_attribute=no
1930                  if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
1931                    if grep '\.hidden.*foo' conftest.s >/dev/null; then
1932                      ac_cv_visibility_attribute=yes
1933                    fi
1934                  fi
1935                  rm -f conftest.[cs]
1936                 ])
1937    if test $ac_cv_visibility_attribute = yes; then
1938      AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
1939    fi
1940  fi   # have hidden directive
1941fi     # GNU_CC
1942
1943dnl Checks for header files.
1944dnl ========================================================
1945AC_HEADER_DIRENT
1946case "$target_os" in
1947freebsd*)
1948# for stuff like -lXshm
1949    CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
1950    ;;
1951esac
1952AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
1953AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
1954AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
1955AC_CHECK_HEADERS(malloc.h)
1956AC_CHECK_HEADERS(X11/XKBlib.h)
1957
1958dnl These are all the places some variant of statfs can be hiding.
1959AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
1960
1961dnl Try for MMX support
1962dnl NB - later gcc versions require -mmmx for this header to be successfully
1963dnl included (or another option which implies it, such as -march=pentium-mmx)
1964AC_CHECK_HEADERS(mmintrin.h)
1965
1966dnl Check whether the compiler supports the new-style C++ standard
1967dnl library headers (i.e. <new>) or needs the old "new.h"
1968AC_LANG_CPLUSPLUS
1969NEW_H=new.h
1970AC_CHECK_HEADER(new, [NEW_H=new])
1971AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
1972AC_LANG_C
1973
1974case $target in
1975*-aix4.3*|*-aix5*)
1976        ;;
1977*)
1978        AC_CHECK_HEADERS(sys/cdefs.h)
1979        ;;
1980esac
1981
1982dnl Checks for libraries.
1983dnl ========================================================
1984case $target in
1985*-hpux11.*)
1986        ;;
1987*)
1988        AC_CHECK_LIB(c_r, gethostbyname_r)
1989        ;;
1990esac
1991AC_CHECK_LIB(m, atan)
1992
1993dnl We don't want to link with libdl even if it's present on OS X, since
1994dnl it's not used and not part of the default installation.
1995
1996case $target in
1997*-darwin*)
1998        ;;
1999*)
2000        AC_CHECK_LIB(dl, dlopen,
2001        AC_CHECK_HEADER(dlfcn.h,
2002            LIBS="-ldl $LIBS"
2003            AC_DEFINE(HAVE_LIBDL)))
2004        ;;
2005esac
2006if test ! "$GNU_CXX"; then
2007
2008    case $target in
2009    *-aix*)
2010        AC_CHECK_LIB(C_r, demangle)
2011        ;;
2012     *)
2013        AC_CHECK_LIB(C, demangle)
2014        ;;
2015     esac
2016fi
2017AC_CHECK_LIB(socket, socket)
2018
2019XLDFLAGS="$X_LIBS"
2020XLIBS="$X_EXTRA_LIBS"
2021
2022dnl ========================================================
2023dnl Checks for X libraries.
2024dnl Ordering is important.
2025dnl Xt is dependent upon SM as of X11R6
2026dnl ========================================================
2027if test "$no_x" = "yes"; then
2028    AC_DEFINE(NO_X11)
2029else
2030    AC_DEFINE_UNQUOTED(FUNCPROTO,15)
2031        XLIBS="-lX11 $XLIBS"
2032        _SAVE_LDFLAGS="$LDFLAGS"
2033        LDFLAGS="$XLDFLAGS $LDFLAGS"
2034        AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
2035                [MISSING_X="$MISSING_X -lX11"], $XLIBS)
2036        AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
2037                [MISSING_X="$MISSING_X -lXext"], $XLIBS)
2038   
2039     
2040        AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
2041        unset ac_cv_lib_Xt_XtFree
2042            AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
2043            AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
2044        AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
2045                    [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
2046        ])
2047
2048    # AIX needs the motif library linked before libXt to prevent
2049    # crashes in plugins linked against Motif - Bug #98892
2050    case "${target_os}" in
2051    aix*)
2052        XT_LIBS="-lXm $XT_LIBS"
2053        ;;
2054    esac
2055
2056    dnl ========================================================
2057    dnl = Check for Xinerama
2058    dnl ========================================================
2059    AC_CHECK_LIB(Xinerama, XineramaIsActive, [MOZ_XINERAMA_LIBS="-lXinerama"],,
2060        $XLIBS $XEXT_LIBS)
2061    AC_CHECK_HEADER(X11/extensions/Xinerama.h)
2062
2063    dnl ========================================================
2064    dnl = Check for XShm
2065    dnl ========================================================
2066    AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
2067        $XLIBS $XEXT_LIBS)
2068    AC_CHECK_HEADER(X11/extensions/XShm.h)
2069    if test -n "$ac_cv_header_X11_extensions_XShm_h" &&
2070        test -n "$_HAVE_XSHM_XEXT"; then
2071        AC_DEFINE(HAVE_XSHM)
2072    fi
2073
2074    dnl ========================================================
2075    dnl = Check for XIE
2076    dnl ========================================================
2077    AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
2078        $XLIBS $XEXT_LIBS)
2079    AC_CHECK_HEADER(X11/extensions/XIElib.h)
2080
2081    if test "$MOZ_XIE_LIBS"; then
2082        dnl ====================================================
2083        dnl = If XIE is present and is desired, turn it on
2084        dnl ====================================================
2085        case $target in
2086            *-hpux*)
2087                ;;
2088            *)
2089                HAVE_XIE=1
2090                ;;
2091        esac
2092    fi
2093
2094        LDFLAGS="$_SAVE_LDFLAGS"
2095
2096    AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
2097
2098fi # $no_x
2099
2100AC_SUBST(XCFLAGS)
2101AC_SUBST(XLDFLAGS)
2102AC_SUBST(XLIBS)
2103AC_SUBST(XT_LIBS)
2104
2105dnl ========================================================
2106dnl = pthread support
2107dnl = Start by checking whether the system support pthreads
2108dnl ========================================================
2109MOZ_CHECK_PTHREADS(pthreads,
2110    USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
2111    MOZ_CHECK_PTHREADS(pthread,
2112        USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
2113        MOZ_CHECK_PTHREADS(c_r,
2114            USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
2115            MOZ_CHECK_PTHREADS(c,
2116                USE_PTHREADS=1
2117            )
2118        )
2119    )
2120)
2121
2122dnl ========================================================
2123dnl Check the command line for --with-pthreads
2124dnl ========================================================
2125MOZ_ARG_WITH_BOOL(pthreads,
2126[  --with-pthreads         Force use of system pthread library with NSPR ],
2127[ if test "$USE_PTHREADS"x = x; then
2128    AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
2129fi],
2130    USE_PTHREADS=
2131    _PTHREAD_LDFLAGS=
2132)
2133
2134dnl ========================================================
2135dnl Do the platform specific pthread hackery
2136dnl ========================================================
2137if test "$USE_PTHREADS"x != x
2138then
2139        dnl
2140        dnl See if -pthread is supported.
2141        dnl
2142        rm -f conftest*
2143        ac_cv_have_dash_pthread=no
2144        AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
2145        echo 'int main() { return 0; }' | cat > conftest.c
2146        ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
2147        if test $? -eq 0; then
2148                if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2149                        ac_cv_have_dash_pthread=yes
2150                case "$target_os" in
2151                freebsd*)
2152# Freebsd doesn't use -pthread for compiles, it uses them for linking
2153                ;;
2154                *)
2155                            CFLAGS="$CFLAGS -pthread"
2156                            CXXFLAGS="$CXXFLAGS -pthread"
2157                ;;
2158                esac
2159                fi
2160        fi
2161        rm -f conftest*
2162    AC_MSG_RESULT($ac_cv_have_dash_pthread)
2163
2164        dnl
2165        dnl See if -pthreads is supported.
2166        dnl
2167    ac_cv_have_dash_pthreads=no
2168    if test "$ac_cv_have_dash_pthread" = "no"; then
2169            AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
2170        echo 'int main() { return 0; }' | cat > conftest.c
2171            ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
2172        if test $? -eq 0; then
2173                if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2174                            ac_cv_have_dash_pthreads=yes
2175                            CFLAGS="$CFLAGS -pthreads"
2176                            CXXFLAGS="$CXXFLAGS -pthreads"
2177                    fi
2178            fi
2179            rm -f conftest*
2180        AC_MSG_RESULT($ac_cv_have_dash_pthreads)
2181    fi
2182
2183        case "$target" in
2184            *-*-freebsd*)
2185                        AC_DEFINE(_REENTRANT)
2186                        AC_DEFINE(_THREAD_SAFE)
2187                        dnl -pthread links in -lc_r, so don't specify it explicitly.
2188                        if test "$ac_cv_have_dash_pthread" = "yes"; then
2189                                _PTHREAD_LDFLAGS="-pthread"
2190                        else
2191                                _PTHREAD_LDFLAGS="-lc_r"
2192                        fi
2193                        ;;
2194
2195            *-*-openbsd*|*-*-bsdi*)
2196                        AC_DEFINE(_REENTRANT)
2197                        AC_DEFINE(_THREAD_SAFE)
2198                        dnl -pthread links in -lc_r, so don't specify it explicitly.
2199                        if test "$ac_cv_have_dash_pthread" = "yes"; then
2200                _PTHREAD_LDFLAGS="-pthread"
2201                LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
2202                        fi
2203                        ;;
2204
2205            *-*-linux*)
2206                        AC_DEFINE(_REENTRANT)
2207                        ;;
2208
2209            *-*-nto*)
2210                        AC_DEFINE(_REENTRANT)
2211                        ;;
2212
2213            *-aix4.3*|*-aix5*)
2214                        AC_DEFINE(_REENTRANT)
2215                        ;;
2216
2217            *-hpux11.*)
2218                        AC_DEFINE(_REENTRANT)
2219                        ;;
2220
2221            alpha*-*-osf*)
2222                        AC_DEFINE(_REENTRANT)
2223                        ;;
2224
2225            *-*-solaris*)
2226                        AC_DEFINE(_REENTRANT)
2227                        if test ! "$GNU_CC"; then
2228                                CFLAGS="$CFLAGS -mt"
2229                                CXXFLAGS="$CXXFLAGS -mt"
2230                        fi
2231                        ;;
2232        esac
2233fi
2234
2235dnl ========================================================
2236dnl Check for MacOS deployment target version
2237dnl ========================================================
2238
2239MOZ_ARG_ENABLE_STRING(macos-target,
2240                      [  --enable-macos-target=VER (default=10.1)
2241                          Set the minimum MacOS version needed at runtime],
2242                      [MACOS_DEPLOYMENT_TARGET_STR=$enableval],
2243                      [MACOS_DEPLOYMENT_TARGET_STR=10.1])
2244
2245case "$target" in
2246*-darwin*)
2247    dnl The C preprocessor can only handle integers in comparisons, so convert
2248    dnl the version to the form AABBCC where AA=major release, BB=minor release,
2249    dnl and CC=point/micro release.
2250
2251    MACOS_VERSION_MAJOR=`echo $MACOS_DEPLOYMENT_TARGET_STR | cut -d . -f 1`
2252    MACOS_VERSION_MINOR=`echo $MACOS_DEPLOYMENT_TARGET_STR | cut -d . -f 2`
2253    MACOS_VERSION_MICRO=`echo $MACOS_DEPLOYMENT_TARGET_STR | cut -d . -f 3`
2254    if test -z "$MACOS_VERSION_MINOR"; then
2255        MACOS_VERSION_MINOR=0
2256    fi
2257    if test -z "$MACOS_VERSION_MICRO"; then
2258        MACOS_VERSION_MICRO=0
2259    fi
2260
2261    MACOS_DEPLOYMENT_TARGET=`printf "%02d%02d%02d" "$MACOS_VERSION_MAJOR" "$MACOS_VERSION_MINOR" "$MACOS_VERSION_MICRO"`
2262    AC_DEFINE_UNQUOTED(MACOS_DEPLOYMENT_TARGET, $MACOS_DEPLOYMENT_TARGET)
2263    ;;
2264*)
2265    MACOS_DEPLOYMENT_TARGET=
2266    ;;
2267esac
2268
2269AC_SUBST(MACOS_DEPLOYMENT_TARGET)
2270
2271dnl ========================================================
2272dnl See if mmap sees writes
2273dnl For cross compiling, just define it as no, which is a safe default
2274dnl ========================================================
2275AC_MSG_CHECKING(whether mmap() sees write()s)
2276
2277changequote(,)
2278mmap_test_prog='
2279    #include <stdlib.h>
2280    #include <unistd.h>
2281    #include <sys/mman.h>
2282    #include <sys/types.h>
2283    #include <sys/stat.h>
2284    #include <fcntl.h>
2285
2286    char fname[] = "conftest.file";
2287    char zbuff[1024]; /* Fractional page is probably worst case */
2288
2289    int main() {
2290        char *map;
2291        int fd;
2292        int i;
2293        unlink(fname);
2294        fd = open(fname, O_RDWR | O_CREAT, 0660);
2295        if(fd<0) return 1;
2296        unlink(fname);
2297        write(fd, zbuff, sizeof(zbuff));
2298        lseek(fd, 0, SEEK_SET);
2299        map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
2300        if(map==(char*)-1) return 2;
2301        for(i=0; fname[i]; i++) {
2302            int rc = write(fd, &fname[i], 1);
2303            if(map[i]!=fname[i]) return 4;
2304        }
2305        return 0;
2306    }
2307'
2308changequote([,])
2309
2310AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
2311
2312AC_MSG_RESULT("$result")
2313
2314if test "$result" = "no"; then
2315    AC_DEFINE(MMAP_MISSES_WRITES)
2316fi
2317
2318
2319dnl Checks for library functions.
2320dnl ========================================================
2321AC_PROG_GCC_TRADITIONAL
2322AC_FUNC_MEMCMP
2323AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint)
2324AC_CHECK_FUNCS(flockfile getpagesize)
2325
2326dnl localtime_r and strtok_r are only present on MacOS version 10.2 and higher
2327if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100200"; then
2328  AC_CHECK_FUNCS(localtime_r strtok_r)
2329fi
2330
2331dnl check for wcrtomb/mbrtowc
2332dnl =======================================================================
2333if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
2334AC_LANG_SAVE
2335AC_LANG_CPLUSPLUS
2336AC_CACHE_CHECK(for wcrtomb,
2337    ac_cv_have_wcrtomb,
2338    [AC_TRY_LINK([#include <wchar.h>],
2339                 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
2340                 ac_cv_have_wcrtomb="yes",
2341                 ac_cv_have_wcrtomb="no")])
2342if test "$ac_cv_have_wcrtomb" = "yes"; then
2343    AC_DEFINE(HAVE_WCRTOMB)
2344fi
2345AC_CACHE_CHECK(for mbrtowc,
2346    ac_cv_have_mbrtowc,
2347    [AC_TRY_LINK([#include <wchar.h>],
2348                 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
2349                 ac_cv_have_mbrtowc="yes",
2350                 ac_cv_have_mbrtowc="no")])
2351if test "$ac_cv_have_mbrtowc" = "yes"; then
2352    AC_DEFINE(HAVE_MBRTOWC)
2353fi
2354AC_LANG_RESTORE
2355fi
2356
2357AC_CACHE_CHECK(
2358    [for res_ninit()],
2359    ac_cv_func_res_ninit,
2360    [AC_TRY_LINK([
2361        #ifdef linux
2362        #define _BSD_SOURCE 1
2363        #endif
2364        #include <resolv.h>
2365        ],
2366        [int foo = res_ninit(&_res);],
2367        [ac_cv_func_res_ninit=yes],
2368        [ac_cv_func_res_ninit=no])
2369    ])
2370
2371if test "$ac_cv_func_res_ninit" = "yes"; then
2372    AC_DEFINE(HAVE_RES_NINIT)
2373dnl must add the link line we do something as foolish as this... dougt
2374dnl else
2375dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
2376dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
2377fi
2378
2379AC_LANG_CPLUSPLUS
2380AC_CACHE_CHECK(
2381    [for gnu_get_libc_version()],
2382    ac_cv_func_gnu_get_libc_version,
2383    [AC_TRY_LINK([
2384        #ifdef HAVE_GNU_LIBC_VERSION_H
2385        #include <gnu/libc-version.h>
2386        #endif
2387        ],
2388        [const char *glibc_version = gnu_get_libc_version();],
2389        [ac_cv_func_gnu_get_libc_version=yes],
2390        [ac_cv_func_gnu_get_libc_version=no]
2391        )]
2392    )
2393
2394if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
2395    AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
2396fi
2397
2398case $target_os in
2399    os2*|msvc*|mks*|cygwin*|mingw*|darwin*)
2400        ;;
2401    *)
2402   
2403AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
2404    AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
2405        AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
2406_SAVE_LIBS=$LIBS
2407LIBS="$LIBS $_ICONV_LIBS"
2408AC_CACHE_CHECK(
2409    [for iconv()],
2410    ac_cv_func_iconv,
2411    [AC_TRY_LINK([
2412        #include <stdlib.h>
2413        #include <iconv.h>
2414        ],
2415        [
2416            iconv_t h = iconv_open("", "");
2417            iconv(h, NULL, NULL, NULL, NULL);
2418            iconv_close(h);
2419        ],
2420        [ac_cv_func_iconv=yes],
2421        [ac_cv_func_iconv=no]
2422        )]
2423    )
2424if test "$ac_cv_func_iconv" = "yes"; then
2425    AC_DEFINE(HAVE_ICONV)
2426    XPCOM_LIBS="$XPCOM_LIBS $_ICONV_LIBS"
2427    LIBICONV="$_ICONV_LIBS"
2428    AC_CACHE_CHECK(
2429        [for iconv() with const input],
2430        ac_cv_func_const_iconv,
2431        [AC_TRY_COMPILE([
2432            #include <stdlib.h>
2433            #include <iconv.h>
2434            ],
2435            [
2436                const char *input = "testing";
2437                iconv_t h = iconv_open("", "");
2438                iconv(h, &input, NULL, NULL, NULL);
2439                iconv_close(h);
2440            ],
2441            [ac_cv_func_const_iconv=yes],
2442            [ac_cv_func_const_iconv=no]
2443            )]
2444        )
2445    if test "$ac_cv_func_const_iconv" = "yes"; then
2446        AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
2447    fi
2448fi
2449LIBS=$_SAVE_LIBS
2450
2451    ;;
2452esac
2453
2454AM_LANGINFO_CODESET
2455
2456AC_LANG_C
2457
2458dnl **********************
2459dnl *** va_copy checks ***
2460dnl **********************
2461dnl we currently check for all three va_copy possibilities, so we get
2462dnl all results in config.log for bug reports.
2463AC_MSG_CHECKING(for an implementation of va_copy())
2464AC_CACHE_VAL(ac_cv_va_copy,[
2465    AC_TRY_RUN([
2466        #include <stdarg.h>
2467        void f (int i, ...) {
2468            va_list args1, args2;
2469            va_start (args1, i);
2470            va_copy (args2, args1);
2471            if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
2472                exit (1);
2473            va_end (args1); va_end (args2);
2474        }
2475        int main() { f (0, 42); return 0; }],
2476        ac_cv_va_copy=yes,
2477        ac_cv_va_copy=no,
2478        ac_cv_va_copy=no
2479    )
2480])
2481AC_MSG_RESULT($ac_cv_va_copy)
2482AC_MSG_CHECKING(for an implementation of __va_copy())
2483AC_CACHE_VAL(ac_cv___va_copy,[
2484    AC_TRY_RUN([
2485        #include <stdarg.h>
2486        void f (int i, ...) {
2487            va_list args1, args2;
2488            va_start (args1, i);
2489            __va_copy (args2, args1);
2490            if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
2491                exit (1);
2492            va_end (args1); va_end (args2);
2493        }
2494        int main() { f (0, 42); return 0; }],
2495        ac_cv___va_copy=yes,
2496        ac_cv___va_copy=no,
2497        ac_cv___va_copy=no
2498    )
2499])
2500AC_MSG_RESULT($ac_cv___va_copy)
2501AC_MSG_CHECKING(whether va_lists can be copied by value)
2502AC_CACHE_VAL(ac_cv_va_val_copy,[
2503    AC_TRY_RUN([
2504        #include <stdarg.h>
2505        void f (int i, ...) {
2506            va_list args1, args2;
2507            va_start (args1, i);
2508            args2 = args1;
2509            if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
2510                exit (1);
2511            va_end (args1); va_end (args2);
2512        }
2513        int main() { f (0, 42); return 0; }],
2514        ac_cv_va_val_copy=yes,
2515        ac_cv_va_val_copy=no,
2516        ac_cv_va_val_copy=yes
2517    )
2518])
2519if test "x$ac_cv_va_copy" = "xyes"; then
2520    AC_DEFINE(VA_COPY, va_copy)
2521    AC_DEFINE(HAVE_VA_COPY)
2522elif test "x$ac_cv___va_copy" = "xyes"; then
2523    AC_DEFINE(VA_COPY, __va_copy)
2524    AC_DEFINE(HAVE_VA_COPY)
2525fi
2526
2527if test "x$ac_cv_va_val_copy" = "xno"; then
2528   AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
2529fi
2530AC_MSG_RESULT($ac_cv_va_val_copy)
2531
2532dnl Check for dll-challenged libc's.
2533dnl This check is apparently only needed for Linux.
2534case "$target" in
2535        *-linux*)
2536            dnl ===================================================================
2537            _curdir=`pwd`
2538            export _curdir
2539            rm -rf conftest* _conftest
2540            mkdir _conftest
2541            cat >> conftest.C <<\EOF
2542#include <stdio.h>
2543#include <link.h>
2544#include <dlfcn.h>
2545#ifdef _dl_loaded
2546void __dump_link_map(void) {
2547  struct link_map *map = _dl_loaded;
2548  while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
2549}
2550int main() {
2551  dlopen("./conftest1.so",RTLD_LAZY);
2552  dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
2553  dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
2554  dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
2555  __dump_link_map();
2556}
2557#else
2558/* _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).*/
2559int main() { printf("./conftest1.so\n"); }
2560#endif
2561EOF
2562
2563            $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
2564
2565            cat >> conftest1.C <<\EOF
2566#include <stdio.h>
2567void foo(void) {printf("foo in dll called\n");}
2568EOF
2569            ${CXX-g++} -fPIC -c -g conftest1.C
2570            ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
2571            ${CXX-g++} -g conftest.C -o conftest -ldl
2572            cp -f conftest1.so conftest _conftest
2573            cd _conftest
2574            if test `./conftest | grep conftest1.so | wc -l` -gt 1
2575            then
2576                echo
2577                echo "*** Your libc has a bug that can result in loading the same dynamic"
2578                echo "*** library multiple times.  This bug is known to be fixed in glibc-2.0.7-32"
2579                echo "*** or later.  However, if you choose not to upgrade, the only effect"
2580                echo "*** will be excessive memory usage at runtime."
2581                echo
2582            fi
2583            cd ${_curdir}
2584            rm -rf conftest* _conftest
2585            dnl ===================================================================
2586            ;;
2587esac
2588
2589dnl ===================================================================
2590dnl ========================================================
2591dnl By default, turn rtti and exceptions off on g++/egcs
2592dnl ========================================================
2593if test "$GNU_CXX"; then
2594
2595  AC_MSG_CHECKING(for C++ exceptions flag)
2596
2597  dnl They changed -f[no-]handle-exceptions to -f[no-]exceptions in g++ 2.8
2598  AC_CACHE_VAL(ac_cv_cxx_exceptions_flags,
2599  [echo "int main() { return 0; }" | cat > conftest.C
2600
2601  ${CXX-g++} ${CXXFLAGS} -c -fno-handle-exceptions conftest.C > conftest.out 2>&1
2602
2603  if egrep "warning.*renamed" conftest.out >/dev/null; then
2604    ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions
2605  else
2606    ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-handle-exceptions
2607  fi
2608
2609  rm -f conftest*])
2610
2611  AC_MSG_RESULT($ac_cv_cxx_exceptions_flags)
2612  _MOZ_EXCEPTIONS_FLAGS_OFF=$ac_cv_cxx_exceptions_flags
2613  _MOZ_EXCEPTIONS_FLAGS_ON=`echo $ac_cv_cxx_exceptions_flags | sed 's|no-||'`
2614fi
2615
2616dnl ========================================================
2617dnl Put your C++ language/feature checks below
2618dnl ========================================================
2619AC_LANG_CPLUSPLUS
2620
2621HAVE_GCC3_ABI=
2622if test "$GNU_CC"; then
2623  AC_CACHE_CHECK(for gcc 3.0 ABI,
2624      ac_cv_gcc_three_abi,
2625      [AC_TRY_COMPILE([],
2626                      [
2627#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
2628  return 0;
2629#else
2630#error Not gcc3.
2631#endif
2632                      ],
2633                      ac_cv_gcc_three_abi="yes",
2634                      ac_cv_gcc_three_abi="no")])
2635  if test "$ac_cv_gcc_three_abi" = "yes"; then
2636      HAVE_GCC3_ABI=1
2637  fi
2638fi
2639AC_SUBST(HAVE_GCC3_ABI)
2640
2641
2642AC_CACHE_CHECK(for C++ \"explicit\" keyword,
2643               ac_cv_cpp_explicit,
2644               [AC_TRY_COMPILE(class X {
2645                               public: explicit X(int i) : i_(i) {}
2646                               private: int i_;
2647                               };,
2648                               X x(3);,
2649                               ac_cv_cpp_explicit=yes,
2650                               ac_cv_cpp_explicit=no)])
2651if test "$ac_cv_cpp_explicit" = yes ; then
2652   AC_DEFINE(HAVE_CPP_EXPLICIT)
2653fi
2654
2655AC_CACHE_CHECK(for C++ \"typename\" keyword,
2656               ac_cv_cpp_typename,
2657               [AC_TRY_COMPILE(class param {
2658                               public:
2659                                   typedef unsigned long num_type;
2660                               };
2661
2662                               template <class T> class tplt {
2663                               public:
2664                                   typedef typename T::num_type t_num_type;
2665                                   t_num_type foo(typename T::num_type num) {
2666                                       return num;
2667                                   }
2668                               };,
2669                               tplt<param> A;
2670                               A.foo(0);,
2671                               ac_cv_cpp_typename=yes,
2672                               ac_cv_cpp_typename=no)])
2673if test "$ac_cv_cpp_typename" = yes ; then
2674   AC_DEFINE(HAVE_CPP_TYPENAME)
2675fi
2676
2677dnl Check for support of modern template specialization syntax
2678dnl Test code and requirement from scc@netscape.com.
2679dnl Autoconf cut-and-paste job by waterson@netscape.com
2680AC_CACHE_CHECK(for modern C++ template specialization syntax support,
2681               ac_cv_cpp_modern_specialize_template_syntax,
2682               [AC_TRY_COMPILE(template <class T> struct X { int a; };
2683                               class Y {};
2684                               template <> struct X<Y> { double a; };,
2685                               X<int> int_x;
2686                               X<Y> y_x;,
2687                               ac_cv_cpp_modern_specialize_template_syntax=yes,
2688                               ac_cv_cpp_modern_specialize_template_syntax=no)])
2689if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
2690  AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
2691fi
2692
2693
2694dnl Some compilers support only full specialization, and some don't.
2695AC_CACHE_CHECK(whether partial template specialization works,
2696               ac_cv_cpp_partial_specialization,
2697               [AC_TRY_COMPILE(template <class T> class Foo {};
2698                               template <class T> class Foo<T*> {};,
2699                               return 0;,
2700                               ac_cv_cpp_partial_specialization=yes,
2701                               ac_cv_cpp_partial_specialization=no)])
2702if test "$ac_cv_cpp_partial_specialization" = yes ; then
2703  AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
2704fi
2705
2706dnl Some compilers have limited support for operators with templates;
2707dnl specifically, it is necessary to define derived operators when a base
2708dnl class's operator declaration should suffice.
2709AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
2710               ac_cv_need_derived_template_operators,
2711               [AC_TRY_COMPILE([template <class T> class Base { };
2712                                template <class T>
2713                                Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
2714                                template <class T> class Derived : public Base<T> { };],
2715                               [Derived<char> a, b;
2716                                Base<char> c = a + b;
2717                                return 0;],
2718                               ac_cv_need_derived_template_operators=no,
2719                               ac_cv_need_derived_template_operators=yes)])
2720if test "$ac_cv_need_derived_template_operators" = yes ; then
2721  AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
2722fi
2723
2724
2725dnl Some compilers have trouble detecting that a template class
2726dnl that derives from another template is actually an instance
2727dnl of the base class. This test checks for that.
2728AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
2729               ac_cv_need_cpp_template_cast_to_base,
2730               [AC_TRY_COMPILE([template <class T> class Base { };
2731                                template <class T> class Derived : public Base<T> { };
2732                                template <class T> int foo(const Base<T>&) { return 0; }],
2733                               [Derived<char> bar; return foo(bar);],
2734                               ac_cv_need_cpp_template_cast_to_base=no,
2735                               ac_cv_need_cpp_template_cast_to_base=yes)])
2736if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
2737  AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
2738fi
2739
2740dnl Some compilers have trouble resolving the ambiguity between two
2741dnl functions whose arguments differ only by cv-qualifications.
2742AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
2743               ac_cv_can_resolve_const_ambiguity,
2744               [AC_TRY_COMPILE([
2745                                template <class T> class ptrClass {
2746                                  public: T* ptr;
2747                                };
2748
2749                                template <class T> T* a(ptrClass<T> *arg) {
2750                                  return arg->ptr;
2751                                }
2752
2753                                template <class T>
2754                                const T* a(const ptrClass<T> *arg) {
2755                                  return arg->ptr;
2756                                }
2757                               ],
2758                               [ ptrClass<int> i;
2759                                 a(&i); ],
2760                               ac_cv_can_resolve_const_ambiguity=yes,
2761                               ac_cv_can_resolve_const_ambiguity=no)])
2762if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
2763  AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
2764fi
2765
2766dnl
2767dnl We dont do exceptions on unix.  The only reason this used to be here
2768dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses
2769dnl exceptions.  But, we turn exceptions off by default and this test breaks.
2770dnl So im commenting this out until someone writes some artificial
2771dnl intelligence to detect not only if the compiler has exceptions, but if
2772dnl they are enabled as well.
2773dnl
2774dnl AC_CACHE_CHECK(for C++ \"exceptions\",
2775dnl                ac_cv_cpp_exceptions,
2776dnl                [AC_TRY_COMPILE(class X { public: X() {} };
2777dnl                                static void F() { throw X(); },
2778dnl                                try { F(); } catch(X & e) { },
2779dnl                                ac_cv_cpp_exceptions=yes,
2780dnl                                ac_cv_cpp_exceptions=no)])
2781dnl if test $ac_cv_cpp_exceptions = yes ; then
2782dnl    AC_DEFINE(HAVE_CPP_EXCEPTIONS)
2783dnl fi
2784
2785dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
2786dnl supports it well enough to allow us to use it to change access, but not
2787dnl to resolve ambiguity. The next two tests determine how well the |using|
2788dnl keyword is supported.
2789dnl
2790dnl Check to see if we can change access with |using|.  Test both a
2791dnl legal and an illegal example.
2792AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
2793               ac_cv_cpp_access_changing_using2,
2794               [AC_TRY_COMPILE(
2795                   class A { protected: int foo() { return 0; } };
2796                   class B : public A { public: using A::foo; };,
2797                   B b; return b.foo();,
2798                   [AC_TRY_COMPILE(
2799                       class A { public: int foo() { return 1; } };
2800                       class B : public A { private: using A::foo; };,
2801                       B b; return b.foo();,
2802                       ac_cv_cpp_access_changing_using2=no,
2803                       ac_cv_cpp_access_changing_using2=yes)],
2804                   ac_cv_cpp_access_changing_using2=no)])
2805if test "$ac_cv_cpp_access_changing_using2" = yes ; then
2806   AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
2807fi
2808
2809dnl Check to see if we can resolve ambiguity with |using|.
2810AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
2811               ac_cv_cpp_ambiguity_resolving_using,
2812               [AC_TRY_COMPILE(class X {
2813                                 public: int go(const X&) {return 3;}
2814                                         int jo(const X&) {return 3;}
2815                               };
2816                               class Y : public X {
2817                                 public:  int go(int) {return 2;}
2818                                          int jo(int) {return 2;}
2819                                          using X::jo;
2820                                 private: using X::go;
2821                               };,
2822                               X x; Y y; y.jo(x);,
2823                               ac_cv_cpp_ambiguity_resolving_using=yes,
2824                               ac_cv_cpp_ambiguity_resolving_using=no)])
2825if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
2826   AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
2827fi
2828
2829dnl Check to see if the |std| namespace is supported. If so, we'll want
2830dnl to qualify any standard library calls with "std::" to ensure that
2831dnl those functions can be resolved.
2832AC_CACHE_CHECK(for \"std::\" namespace,
2833               ac_cv_cpp_namespace_std,
2834               [AC_TRY_COMPILE([#include <algorithm>],
2835                               [return std::min(0, 1);],
2836                               ac_cv_cpp_namespace_std=yes,
2837                               ac_cv_cpp_namespace_std=no)])
2838if test "$ac_cv_cpp_namespace_std" = yes ; then
2839   AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
2840fi
2841
2842dnl Older compilers are overly ambitious with respect to using the standard
2843dnl template library's |operator!=()| when |operator==()| is defined. In
2844dnl which case, defining |operator!=()| in addition to |operator==()| causes
2845dnl ambiguity at compile-time. This test checks for that case.
2846AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
2847               ac_cv_cpp_unambiguous_std_notequal,
2848               [AC_TRY_COMPILE([#include <algorithm>
2849                                struct T1 {};
2850                                int operator==(const T1&, const T1&) { return 0; }
2851                                int operator!=(const T1&, const T1&) { return 0; }],
2852                               [T1 a,b; return a != b;],
2853                               ac_cv_cpp_unambiguous_std_notequal=unambiguous,
2854                               ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
2855if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
2856  AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
2857fi
2858
2859
2860AC_CACHE_CHECK(for C++ reinterpret_cast,
2861               ac_cv_cpp_reinterpret_cast,
2862               [AC_TRY_COMPILE(struct X { int i; };
2863                               struct Y { int i; };,
2864                               X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
2865                               ac_cv_cpp_reinterpret_cast=yes,
2866                               ac_cv_cpp_reinterpret_cast=no)])
2867if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
2868   AC_DEFINE(HAVE_CPP_NEW_CASTS)
2869fi
2870
2871dnl See if a dynamic_cast to void* gives the most derived object.
2872AC_CACHE_CHECK(for C++ dynamic_cast to void*,
2873               ac_cv_cpp_dynamic_cast_void_ptr,
2874               [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
2875                            class Y { int j; public: virtual ~Y() { } };
2876                            class Z : public X, public Y { int k; };
2877
2878                            int main() {
2879                                 Z mdo;
2880                                 X *subx = (X*)&mdo;
2881                                 Y *suby = (Y*)&mdo;
2882                                 return !((((void*)&mdo != (void*)subx) &&
2883                                           ((void*)&mdo == dynamic_cast<void*>(subx))) ||
2884                                          (((void*)&mdo != (void*)suby) &&
2885                                           ((void*)&mdo == dynamic_cast<void*>(suby))));
2886                            }],
2887                           ac_cv_cpp_dynamic_cast_void_ptr=yes,
2888                           ac_cv_cpp_dynamic_cast_void_ptr=no,
2889                           ac_cv_cpp_dynamic_cast_void_ptr=no)])
2890if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
2891   AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
2892fi
2893
2894
2895dnl note that this one is reversed - if the test fails, then
2896dnl we require implementations of unused virtual methods. Which
2897dnl really blows because it means we'll have useless vtable
2898dnl bloat.
2899AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
2900               ac_cv_cpp_unused_required,
2901               [AC_TRY_LINK(class X {private: virtual void never_called();};,
2902                               X x;,
2903                               ac_cv_cpp_unused_required=no,
2904                               ac_cv_cpp_unused_required=yes)])
2905if test "$ac_cv_cpp_unused_required" = yes ; then
2906   AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
2907fi
2908
2909
2910dnl Some compilers have trouble comparing a constant reference to a templatized
2911dnl class to zero, and require an explicit operator==() to be defined that takes
2912dnl an int. This test separates the strong from the weak.
2913
2914AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
2915               ac_cv_trouble_comparing_to_zero,
2916               [AC_TRY_COMPILE([#include <algorithm>
2917                                template <class T> class Foo {};
2918                                class T2;
2919                                template <class T> int operator==(const T2*, const T&) { return 0; }
2920                                template <class T> int operator!=(const T2*, const T&) { return 0; }],
2921                               [Foo<int> f; return (0 != f);],
2922                               ac_cv_trouble_comparing_to_zero=no,
2923                               ac_cv_trouble_comparing_to_zero=yes)])
2924if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
2925  AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
2926fi
2927
2928
2929
2930dnl End of C++ language/feature checks
2931AC_LANG_C
2932
2933dnl ========================================================
2934dnl =  Internationalization checks
2935dnl ========================================================
2936dnl
2937dnl Internationalization and Locale support is different
2938dnl on various UNIX platforms.  Checks for specific i18n
2939dnl features go here.
2940
2941dnl check for LC_MESSAGES
2942AC_CACHE_CHECK(for LC_MESSAGES,
2943                ac_cv_i18n_lc_messages,
2944                [AC_TRY_COMPILE([#include <locale.h>],
2945                                [int category = LC_MESSAGES;],
2946                                ac_cv_i18n_lc_messages=yes,
2947                                ac_cv_i18n_lc_messages=no)])
2948if test "$ac_cv_i18n_lc_messages" = yes; then
2949   AC_DEFINE(HAVE_I18N_LC_MESSAGES)
2950fi     
2951
2952fi # SKIP_COMPILER_CHECKS
2953
2954dnl Mozilla specific options
2955dnl ========================================================
2956dnl The macros used for command line options
2957dnl are defined in build/autoconf/altoptions.m4.
2958
2959
2960dnl ========================================================
2961dnl =
2962dnl = Check for external package dependencies
2963dnl =
2964dnl ========================================================
2965MOZ_ARG_HEADER(External Packages)
2966
2967dnl ========================================================
2968dnl = If NSPR was not detected in the system,
2969dnl = use the one in the source tree (mozilla/nsprpub)
2970dnl ========================================================
2971MOZ_ARG_WITH_BOOL(system-nspr,
2972[  --with-system-nspr      Use system installed NSPR],
2973    _USE_SYSTEM_NSPR=1 )
2974
2975if test -n "$_USE_SYSTEM_NSPR"; then
2976    AM_PATH_NSPR(4.0.0, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
2977fi
2978
2979if test -z "$MOZ_NATIVE_NSPR"; then
2980    NSPR_CFLAGS='`$(DEPTH)/nsprpub/config/nspr-config --prefix=$(DIST) --cflags`'
2981    # explicitly set libs for Visual Age C++ for OS/2
2982    if test "$OS_ARCH" = "OS2" -a "$VACPP" = "yes"; then
2983        NSPR_LIBS='$(DIST)/lib/nspr'$NSPR_VERSION'.lib $(DIST)/lib/plc'$NSPR_VERSION'.lib $(DIST)/lib/plds'$NSPR_VERSION'.lib '$_PTHREAD_LDFLAGS''
2984    elif test "$OS_ARCH" = "WINNT"; then
2985        NSPR_CFLAGS='-I$(DIST)/include/nspr'
2986        if test -n "$GNU_CC"; then
2987            NSPR_LIBS="-L\$(DIST)/lib -lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION"
2988        else
2989            NSPR_LIBS='$(DIST)/lib/nspr'$NSPR_VERSION'.lib $(DIST)/lib/plc'$NSPR_VERSION'.lib $(DIST)/lib/plds'$NSPR_VERSION'.lib '
2990        fi
2991    else
2992        NSPR_LIBS='`$(DEPTH)/nsprpub/config/nspr-config --prefix=$(DIST) --libs`'
2993    fi
2994fi
2995
2996if test -z "$SKIP_LIBRARY_CHECKS"; then
2997dnl system JPEG support
2998dnl ========================================================
2999MOZ_ARG_WITH_STRING(system-jpeg,
3000[  --with-system-jpeg[=PFX]
3001                          Use system libjpeg [installed at prefix PFX]],
3002    JPEG_DIR=$withval)
3003
3004_SAVE_CFLAGS=$CFLAGS
3005_SAVE_LDFLAGS=$LDFLAGS
3006_SAVE_LIBS=$LIBS
3007if test -n "${JPEG_DIR}"; then
3008    CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
3009    LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
3010fi
3011if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
3012    SYSTEM_JPEG=
3013else
3014    AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
3015fi
3016
3017if test "$SYSTEM_JPEG" = 1; then
3018    LIBS="$JPEG_LIBS $LIBS"
3019    AC_TRY_RUN(
3020        #include <stdio.h>
3021        #include <sys/types.h>
3022        #include <jpeglib.h>
3023        int main () {
3024            #if JPEG_LIB_VERSION >= $MOZJPEG
3025                exit(0);
3026            #else
3027                exit(1);
3028            #endif
3029        }
3030        , SYSTEM_JPEG=1, [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=], SYSTEM_JPEG= )
3031    rm -f core
3032fi
3033CFLAGS=$_SAVE_CFLAGS
3034LDFLAGS=$_SAVE_LDFLAGS
3035LIBS=$_SAVE_LIBS
3036
3037if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
3038    JPEG_CFLAGS="-I${JPEG_DIR}/include"
3039    JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
3040fi
3041
3042dnl system ZLIB support
3043dnl ========================================================
3044MOZ_ARG_WITH_STRING(system-zlib,
3045[  --with-system-zlib[=PFX]
3046                          Use system libz [installed at prefix PFX]],
3047    ZLIB_DIR=$withval)
3048
3049_SAVE_CFLAGS=$CFLAGS
3050_SAVE_LDFLAGS=$LDFLAGS
3051_SAVE_LIBS=$LIBS
3052if test -n "${ZLIB_DIR}"; then
3053    CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
3054    LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
3055fi
3056if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
3057    SYSTEM_ZLIB=
3058else
3059    AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"],
3060        [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
3061fi
3062if test "$SYSTEM_ZLIB" = 1; then
3063    LIBS="$ZLIB_LIBS $LIBS"
3064    AC_TRY_RUN([
3065    #include <stdio.h>
3066    #include <string.h>
3067    #include <zlib.h>
3068    int parse_version(const char *str, int *ver) {
3069      return (sscanf(str, "%d.%d.%d", ver, ver+1, ver+2)==3?0:1);
3070    }
3071    int main() {
3072      int sys[3], req[3];
3073      if (parse_version(zlib_version, sys) || parse_version("$MOZZLIB", req))
3074        exit(1);
3075      if ((sys[0] == req[0]) &&
3076          ((sys[1] > req[1]) || ((sys[1] == req[1]) && (sys[2] >= req[2]))))
3077        exit(0);
3078      else
3079        exit(1);
3080    }
3081    ], SYSTEM_ZLIB=1, [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], SYSTEM_ZLIB= )
3082    rm -f core
3083fi
3084CFLAGS=$_SAVE_CFLAGS
3085LDFLAGS=$_SAVE_LDFLAGS
3086LIBS=$_SAVE_LIBS
3087
3088if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
3089    ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
3090    ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
3091fi
3092
3093dnl system PNG Support
3094dnl ========================================================
3095MOZ_ARG_WITH_STRING(system-png,
3096[  --with-system-png[=PFX]
3097                          Use system libpng [installed at prefix PFX]],
3098    PNG_DIR=$withval)
3099
3100_SAVE_CFLAGS=$CFLAGS
3101_SAVE_LDFLAGS=$LDFLAGS
3102_SAVE_LIBS=$LIBS
3103CFLAGS="$ZLIB_CFLAGS $CFLAGS"
3104LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
3105if test -n "${PNG_DIR}"; then
3106    CFLAGS="-I${PNG_DIR}/include $CFLAGS"
3107    LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
3108fi
3109if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
3110    SYSTEM_PNG=
3111else
3112    AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
3113                 SYSTEM_PNG=, $PNG_LIBS)
3114fi
3115if test "$SYSTEM_PNG" = 1; then
3116    LIBS="$PNG_LIBS $LIBS"
3117    AC_TRY_RUN(
3118        #include <stdio.h>
3119        #include <sys/types.h>
3120        #include <png.h>
3121        int main () {
3122            #if PNG_LIBPNG_VER >= $MOZPNG
3123                exit(0);
3124            #else
3125                exit(1);
3126            #endif
3127        }
3128        , SYSTEM_PNG=1, [SYSTEM_PNG= PNG_CFLAGS= PNG_LIBS=], SYSTEM_PNG= )
3129    rm -f core
3130fi
3131CFLAGS=$_SAVE_CFLAGS
3132LDFLAGS=$_SAVE_LDFLAGS
3133LIBS=$_SAVE_LIBS
3134
3135if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
3136    PNG_CFLAGS="-I${PNG_DIR}/include"
3137    PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
3138fi
3139
3140fi # SKIP_LIBRARY_CHECKS
3141
3142dnl ========================================================
3143dnl =
3144dnl = Toolkit Options
3145dnl =
3146dnl ========================================================
3147MOZ_ARG_HEADER(Toolkit Options)
3148
3149    dnl ========================================================
3150    dnl = Select the default toolkit
3151    dnl ========================================================
3152        MOZ_ARG_ENABLE_STRING(default-toolkit,
3153        [  --enable-default-toolkit=TK
3154                          Select default toolkit
3155                          Platform specific defaults:
3156                            BeOS - beos
3157                            Mac OS X - mac (carbon)
3158                            Neutrino/QNX - photon
3159                            OS/2 - os2
3160                            Win32 - windows
3161                            * - gtk],
3162    [ _DEFAULT_TOOLKIT=$enableval ],
3163    [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
3164
3165    if test "$_DEFAULT_TOOLKIT" = "gtk" \
3166        -o "$_DEFAULT_TOOLKIT" = "gtk2" \
3167        -o "$_DEFAULT_TOOLKIT" = "xlib" \
3168        -o "$_DEFAULT_TOOLKIT" = "os2" \
3169        -o "$_DEFAULT_TOOLKIT" = "beos" \
3170        -o "$_DEFAULT_TOOLKIT" = "photon" \
3171        -o "$_DEFAULT_TOOLKIT" = "mac" \
3172        -o "$_DEFAULT_TOOLKIT" = "windows" \
3173        -o "$_DEFAULT_TOOLKIT" = "cocoa"
3174    then
3175        dnl nglayout only supports building with one toolkit,
3176        dnl so ignore everything after the first comma (",").
3177        MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
3178    else
3179        if test "$no_x" != "yes"; then
3180            AC_MSG_ERROR([Toolkit must be xlib, gtk or gtk2.])
3181        else
3182            AC_MSG_ERROR([Toolkit must be $_PLATFORM_DEFAULT_TOOLKIT.])
3183        fi
3184    fi
3185
3186AC_DEFINE_UNQUOTED(MOZ_DEFAULT_TOOLKIT,"$MOZ_WIDGET_TOOLKIT")
3187
3188dnl ========================================================
3189dnl = Enable the toolkit as needed                         =
3190dnl ========================================================
3191
3192case "$MOZ_WIDGET_TOOLKIT" in
3193gtk)
3194        MOZ_ENABLE_GTK=1
3195    MOZ_ENABLE_XREMOTE=1
3196    TK_CFLAGS='$(MOZ_GTK_CFLAGS)'
3197    TK_LIBS='$(MOZ_GTK_LDFLAGS)'
3198        AC_DEFINE(MOZ_WIDGET_GTK)
3199    ;;
3200
3201gtk2)
3202    MOZ_ENABLE_GTK2=1
3203    MOZ_ENABLE_XREMOTE=1
3204    TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
3205    TK_LIBS='$(MOZ_GTK2_LIBS)'
3206    AC_DEFINE(MOZ_WIDGET_GTK2)
3207    ;;
3208
3209xlib)
3210        MOZ_ENABLE_XLIB=1
3211
3212        TK_CFLAGS='$(MOZ_XLIB_CFLAGS)'
3213        TK_LIBS='$(MOZ_XLIB_LDFLAGS)'
3214        AC_DEFINE(MOZ_WIDGET_XLIB)
3215    ;;
3216
3217photon)
3218        MOZ_ENABLE_PHOTON=1
3219        AC_DEFINE(MOZ_WIDGET_PHOTON)
3220    ;;
3221mac|cocoa)
3222    TK_LIBS='-framework Carbon'
3223    TK_CFLAGS="-I${MACOS_SDK_DIR}/Developer/Headers/FlatCarbon"
3224    CFLAGS="$CFLAGS $TK_CFLAGS"
3225    CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
3226    MOZ_USER_DIR="Mozilla"
3227    AC_DEFINE(XP_MACOSX)
3228    AC_DEFINE(TARGET_CARBON)
3229    AC_DEFINE(TARGET_API_MAC_CARBON)
3230    if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
3231        MOZ_ENABLE_COCOA=1
3232        AC_DEFINE(MOZ_WIDGET_COCOA)
3233    fi
3234    ;;
3235esac
3236
3237if test "$MOZ_ENABLE_XREMOTE"; then
3238    AC_DEFINE(MOZ_ENABLE_XREMOTE)
3239fi
3240
3241if test "$MOZ_ENABLE_GTK"
3242then
3243    AM_PATH_GTK($GTK_VERSION,,
3244      AC_MSG_ERROR(Test for GTK failed.))
3245
3246    MOZ_GTK_LDFLAGS=$GTK_LIBS
3247    MOZ_GTK_CFLAGS=$GTK_CFLAGS
3248fi
3249
3250if test "$MOZ_ENABLE_GTK2"
3251then
3252    PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= 1.3.7)
3253fi
3254
3255if test "$MOZ_ENABLE_XLIB"
3256then
3257    MOZ_XLIB_CFLAGS="$X_CFLAGS"
3258    MOZ_XLIB_LDFLAGS="$XLDFLAGS"
3259    MOZ_XLIB_LDFLAGS="$MOZ_XLIB_LDFLAGS $XEXT_LIBS $X11_LIBS"
3260fi
3261
3262AC_SUBST(MOZ_DEFAULT_TOOLKIT)
3263
3264AC_SUBST(GTK_CONFIG)
3265AC_SUBST(TK_CFLAGS)
3266AC_SUBST(TK_LIBS)
3267
3268AC_SUBST(MOZ_ENABLE_GTK)
3269AC_SUBST(MOZ_ENABLE_XLIB)
3270AC_SUBST(MOZ_ENABLE_GTK2)
3271AC_SUBST(MOZ_ENABLE_PHOTON)
3272AC_SUBST(MOZ_ENABLE_COCOA)
3273AC_SUBST(MOZ_ENABLE_XREMOTE)
3274AC_SUBST(MOZ_GTK_CFLAGS)
3275AC_SUBST(MOZ_GTK_LDFLAGS)
3276AC_SUBST(MOZ_GTK2_CFLAGS)
3277AC_SUBST(MOZ_GTK2_LIBS)
3278AC_SUBST(MOZ_XLIB_CFLAGS)
3279AC_SUBST(MOZ_XLIB_LDFLAGS)
3280
3281AC_SUBST(MOC)
3282
3283if test "$MOZ_ENABLE_GTK" \
3284|| test "$MOZ_ENABLE_XLIB" \
3285|| test "$MOZ_ENABLE_GTK2"
3286then
3287    AC_DEFINE(MOZ_X11)
3288    MOZ_X11=1
3289fi
3290AC_SUBST(MOZ_X11)
3291
3292dnl ========================================================
3293dnl =
3294dnl = Components & Features
3295dnl =
3296dnl ========================================================
3297MOZ_ARG_HEADER(Components and Features)
3298
3299dnl =========================================================
3300dnl = Localization
3301dnl =========================================================
3302
3303MOZ_ARG_ENABLE_STRING(ui-locale,
3304[  --enable-ui-locale=ab-CD
3305                          Select the default UI locale],
3306    MOZ_UI_LOCALE=$enableval,
3307    MOZ_UI_LOCALE=en-US)
3308AC_SUBST(MOZ_UI_LOCALE)
3309
3310dnl =========================================================
3311dnl = Calendar client
3312dnl =========================================================
3313MOZ_ARG_ENABLE_BOOL(calendar,
3314[  --enable-calendar       Enable building of the calendar client],
3315    MOZ_CALENDAR=1,
3316    MOZ_CALENDAR= )
3317AC_SUBST(MOZ_CALENDAR)
3318
3319dnl =========================================================
3320dnl = Mail & News
3321dnl =========================================================
3322MOZ_MAIL_NEWS=1
3323MOZ_ARG_DISABLE_BOOL(mailnews,
3324[  --disable-mailnews      Disable building of mail & news components],
3325    MOZ_MAIL_NEWS= )
3326AC_SUBST(MOZ_MAIL_NEWS)
3327
3328dnl ========================================================
3329dnl static mail build off by default
3330dnl ========================================================
3331MOZ_ARG_ENABLE_BOOL(static-mail,
3332[  --enable-static-mail Enable static mail build support],
3333    MOZ_STATIC_MAIL_BUILD=1,
3334    MOZ_STATIC_MAIL_BUILD= )
3335
3336if test "$MOZ_STATIC_MAIL_BUILD"; then
3337    AC_DEFINE(MOZ_STATIC_MAIL_BUILD)
3338fi
3339
3340AC_SUBST(MOZ_STATIC_MAIL_BUILD)
3341
3342dnl =========================================================
3343dnl = LDAP
3344dnl =========================================================
3345MOZ_LDAP_XPCOM=1
3346MOZ_ARG_DISABLE_BOOL(ldap,
3347[  --disable-ldap          Disable LDAP support],
3348    MOZ_LDAP_XPCOM=,
3349    MOZ_LDAP_XPCOM=1)
3350
3351dnl ========================================================
3352dnl = Trademarked Branding
3353dnl ========================================================
3354MOZ_ARG_ENABLE_BOOL(official-branding,
3355[  --enable-official-branding Enable Official mozilla.org Branding
3356                          Do not distribute builds with
3357                          --enable-official-branding unless you have
3358                          permission to use trademarks per
3359                          http://www.mozilla.org/foundation/trademarks/ .],
3360    MOZ_USE_OFFICIAL_BRANDING=1,
3361    MOZ_USE_OFFICIAL_BRANDING= )
3362
3363AC_SUBST(MOZ_USE_OFFICIAL_BRANDING)
3364
3365dnl ========================================================
3366dnl = Distribution ID
3367dnl ========================================================
3368MOZ_ARG_WITH_STRING(distribution-id,
3369[  --with-distribution-id=ID  Set distribution-specific id (default=org.mozilla)],
3370[ val=`echo $withval`
3371    MOZ_DISTRIBUTION_ID="$val"])
3372
3373if test -z "$MOZ_DISTRIBUTION_ID"; then
3374   MOZ_DISTRIBUTION_ID=org.mozilla
3375fi
3376
3377AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID_UNQUOTED, $MOZ_DISTRIBUTION_ID)
3378AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
3379AC_SUBST(MOZ_DISTRIBUTION_ID_UNQUOTED)
3380AC_SUBST(MOZ_DISTRIBUTION_ID)
3381
3382dnl ========================================================
3383dnl = Phoenix
3384dnl ========================================================
3385MOZ_XUL_APP=
3386if test "$MOZ_PHOENIX"; then
3387   AC_DEFINE(MOZ_PHOENIX)
3388   MOZ_XUL_APP=1
3389   AC_DEFINE(MOZ_XUL_APP)
3390   MOZ_APP_NAME=firefox
3391   MOZ_APP_DISPLAYNAME=Firefox
3392   MOZ_APP_VERSION=`cat $topsrcdir/browser/config/version.txt`
3393fi
3394
3395AC_SUBST(MOZ_PHOENIX)
3396
3397dnl ========================================================
3398dnl = Thunderbird
3399dnl ========================================================
3400if test "$MOZ_THUNDERBIRD"; then
3401   AC_DEFINE(MOZ_THUNDERBIRD)
3402
3403   MOZ_STATIC_MAIL_BUILD=1
3404   AC_DEFINE(MOZ_STATIC_MAIL_BUILD)
3405   
3406   MOZ_XUL_APP=1
3407   AC_DEFINE(MOZ_XUL_APP)
3408   MOZ_APP_NAME=thunderbird
3409   MOZ_APP_DISPLAYNAME=Thunderbird
3410   MOZ_APP_VERSION=`cat $topsrcdir/mail/config/version.txt`
3411fi
3412
3413AC_SUBST(MOZ_THUNDERBIRD)
3414AC_SUBST(MOZ_XUL_APP)
3415
3416dnl ========================================================
3417dnl = Standalone Composer
3418dnl ========================================================
3419if test "$MOZ_STANDALONE_COMPOSER"; then
3420   AC_DEFINE(MOZ_STANDALONE_COMPOSER)
3421   
3422   MOZ_XUL_APP=1
3423   AC_DEFINE(MOZ_XUL_APP)
3424   MOZ_APP_NAME=nvu
3425   MOZ_APP_DISPLAYNAME=NVU
3426   MOZ_APP_VERSION=0.17+
3427fi
3428
3429AC_SUBST(MOZ_STANDALONE_COMPOSER)
3430AC_SUBST(MOZ_XUL_APP)
3431AC_DEFINE_UNQUOTED(MOZ_APP_NAME, "$MOZ_APP_NAME")
3432
3433dnl ========================================================
3434dnl = FreeType2
3435dnl = Enable freetype by default if building against X11
3436dnl = and freetype is available
3437dnl ========================================================
3438MOZ_ARG_DISABLE_BOOL(freetype2,
3439[  --disable-freetype2     Disable FreeType2 support ],
3440    MOZ_ENABLE_FREETYPE2=,
3441    MOZ_ENABLE_FREETYPE2=1,
3442    [if test "$MOZ_X11" -a "$_HAVE_FREETYPE2"; then
3443         MOZ_ENABLE_FREETYPE2=1
3444     fi])
3445
3446if test "$MOZ_ENABLE_FREETYPE2" && test -z "$MOZ_X11" -o -z "$_HAVE_FREETYPE2"; then
3447    AC_MSG_ERROR([Cannot enable FreeType2 support for non-X11 toolkits or if FreeType2 is not detected.])
3448fi
3449
3450if test "$MOZ_ENABLE_FREETYPE2"; then
3451    AC_DEFINE(MOZ_ENABLE_FREETYPE2)
3452    _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES MOZ_ENABLE_FREETYPE2"
3453fi
3454AC_SUBST(MOZ_ENABLE_FREETYPE2)
3455
3456dnl ========================================================
3457dnl = Xft
3458dnl ========================================================
3459MOZ_ARG_ENABLE_BOOL(xft,
3460[  --enable-xft            Enable Xft support ],
3461    MOZ_ENABLE_XFT=1,
3462    MOZ_ENABLE_XFT= )
3463
3464if test "$MOZ_ENABLE_XFT"
3465then
3466    AC_DEFINE(MOZ_ENABLE_XFT)
3467    PKG_CHECK_MODULES(MOZ_XFT, xft)
3468    if test "$MOZ_ENABLE_GTK2"; then
3469        PKG_CHECK_MODULES(_PANGOCHK, pango >= 1.1.0)
3470    fi
3471fi
3472
3473AC_SUBST(MOZ_ENABLE_XFT)
3474AC_SUBST(MOZ_XFT_CFLAGS)
3475AC_SUBST(MOZ_XFT_LIBS)
3476
3477dnl ========================================================
3478dnl = disabling x11 core support, enabled by default
3479dnl ========================================================
3480MOZ_ENABLE_COREXFONTS=${MOZ_ENABLE_COREXFONTS-1}
3481if test "$MOZ_ENABLE_COREXFONTS"
3482then
3483    AC_DEFINE(MOZ_ENABLE_COREXFONTS)
3484fi
3485
3486AC_SUBST(MOZ_ENABLE_COREXFONTS)
3487
3488dnl ========================================================
3489dnl = PostScript print module
3490dnl ========================================================
3491MOZ_ARG_DISABLE_BOOL(postscript,
3492[  --disable-postscript    Disable PostScript printing support ],
3493    MOZ_ENABLE_POSTSCRIPT=,
3494    MOZ_ENABLE_POSTSCRIPT=1 )
3495
3496dnl ========================================================
3497dnl = Xprint print module
3498dnl ========================================================
3499if test "$MOZ_X11"
3500then
3501    MOZ_ENABLE_XPRINT=1
3502
3503    _SAVE_LDFLAGS="$LDFLAGS"
3504    LDFLAGS="$XLDFLAGS $LDFLAGS"
3505    AC_CHECK_LIB(Xp, XpGetPrinterList, [XPRINT_LIBS="-lXp"],
3506        MOZ_ENABLE_XPRINT=, $XEXT_LIBS $XLIBS)
3507    LDFLAGS="$_SAVE_LDFLAGS"
3508
3509    MOZ_XPRINT_CFLAGS="$X_CFLAGS"
3510    MOZ_XPRINT_LDFLAGS="$XLDFLAGS $XPRINT_LIBS"
3511    MOZ_XPRINT_LDFLAGS="$MOZ_XPRINT_LDFLAGS $XEXT_LIBS $X11_LIBS"
3512
3513    MOZ_ARG_DISABLE_BOOL(xprint,
3514    [  --disable-xprint        Disable Xprint printing support ],
3515        MOZ_ENABLE_XPRINT=,
3516        MOZ_ENABLE_XPRINT=1 )
3517fi
3518
3519dnl ========================================================
3520dnl = GnomeVFS support module
3521dnl ========================================================
3522
3523if test "$MOZ_X11"
3524then
3525    dnl build the gnomevfs extension by default only when the
3526    dnl GTK2 toolkit is in use.
3527    if test "$MOZ_ENABLE_GTK2"
3528    then
3529        MOZ_ENABLE_GNOMEVFS=1
3530        MOZ_ENABLE_GCONF=1
3531        MOZ_ENABLE_LIBGNOME=1
3532    fi
3533
3534    MOZ_ARG_DISABLE_BOOL(gnomevfs,
3535    [  --disable-gnomevfs      Disable GnomeVFS support ],
3536        MOZ_ENABLE_GNOMEVFS=,
3537        MOZ_ENABLE_GNOMEVFS=force)
3538
3539    if test "$MOZ_ENABLE_GNOMEVFS"
3540    then
3541        PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
3542            MOZ_ENABLE_GNOMEVFS=1
3543        ],[
3544            if test "$MOZ_ENABLE_GNOMEVFS" = "force"
3545            then
3546                AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
3547            fi
3548            MOZ_ENABLE_GNOMEVFS=
3549        ])
3550    fi
3551
3552    AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
3553    AC_SUBST(MOZ_GNOMEVFS_LIBS)
3554
3555    if test "$MOZ_ENABLE_GCONF"
3556    then
3557        PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION,[
3558            MOZ_ENABLE_GCONF=1
3559        ],[
3560            MOZ_ENABLE_GCONF=
3561        ])
3562    fi
3563
3564    AC_SUBST(MOZ_GCONF_CFLAGS)
3565    AC_SUBST(MOZ_GCONF_LIBS)
3566
3567    if test "$MOZ_ENABLE_LIBGNOME"
3568    then
3569        PKG_CHECK_MODULES(MOZ_LIBGNOME, libgnome-2.0 >= $LIBGNOME_VERSION,[
3570            MOZ_ENABLE_LIBGNOME=1
3571        ],[
3572            MOZ_ENABLE_LIBGNOME=
3573        ])
3574    fi
3575
3576    AC_SUBST(MOZ_LIBGNOME_CFLAGS)
3577    AC_SUBST(MOZ_LIBGNOME_LIBS)
3578
3579    # The GNOME component is built if gtk2, gconf, gnome-vfs, and libgnome
3580    # are all available.
3581
3582    if test "$MOZ_ENABLE_GTK2" -a "$MOZ_ENABLE_GCONF" -a \
3583            "$MOZ_ENABLE_GNOMEVFS" -a "$MOZ_ENABLE_LIBGNOME"; then
3584      MOZ_ENABLE_GNOME_COMPONENT=1
3585    else
3586      MOZ_ENABLE_GNOME_COMPONENT=
3587    fi
3588
3589    AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
3590fi
3591
3592dnl ========================================================
3593dnl = Setting MOZ_EXTRA_X11CONVERTERS turns on additional
3594dnl = converters in intl/uconv that are used only by X11 gfx
3595dnl = implementations. By default, it's undefined so that
3596dnl = those converters are not built on other platforms/toolkits.
3597dnl = (see bug 180851)
3598dnl ========================================================
3599
3600if (test "$MOZ_ENABLE_GTK"  || test "$MOZ_ENABLE_GTK2") \
3601&& test "$MOZ_ENABLE_COREXFONTS" \
3602|| test "$MOZ_ENABLE_XLIB" \
3603|| test "$MOZ_ENABLE_XPRINT"
3604then
3605    AC_DEFINE(MOZ_EXTRA_X11CONVERTERS)
3606    MOZ_EXTRA_X11CONVERTERS=1
3607fi
3608AC_SUBST(MOZ_EXTRA_X11CONVERTERS)
3609
3610dnl ========================================================
3611dnl = Build Personal Security Manager
3612dnl ========================================================
3613MOZ_ARG_ENABLE_BOOL(crypto,
3614[  --enable-crypto         Enable crypto support (Personal Security Manager)],
3615    MOZ_PSM=1,
3616    MOZ_PSM= )
3617case $target in
3618*-cygwin*|*-mingw*|*-msvc*|*-mks*)
3619    if test -n "$MOZ_PSM" -a ! -e "$AS_BIN"; then
3620        AC_MSG_ERROR([Building crypto support requires a valid version of the standalone assembler (ml.exe for MSVC).])
3621    fi
3622    ;;
3623esac
3624
3625dnl ========================================================
3626dnl = JS Debugger XPCOM component (js/jsd)
3627dnl ========================================================
3628MOZ_JSDEBUGGER=1
3629MOZ_ARG_DISABLE_BOOL(jsd,
3630[  --disable-jsd           Disable JavaScript debug library],
3631    MOZ_JSDEBUGGER=,
3632    MOZ_JSDEBUGGER=1)
3633
3634
3635dnl ========================================================
3636dnl = Disable plugin support
3637dnl ========================================================
3638MOZ_PLUGINS=1
3639MOZ_ARG_DISABLE_BOOL(plugins,
3640[  --disable-plugins       Disable plugins support],
3641    MOZ_PLUGINS=,
3642    MOZ_PLUGINS=1)
3643
3644dnl ========================================================
3645dnl = Open JVM Interface (OJI) support
3646dnl ========================================================
3647MOZ_OJI=1
3648MOZ_ARG_DISABLE_BOOL(oji,
3649[  --disable-oji           Disable Open JVM Integration support],
3650    MOZ_OJI=,
3651    MOZ_OJI=1)
3652if test -n "$MOZ_OJI"; then
3653    AC_DEFINE(OJI)
3654fi
3655
3656dnl ========================================================
3657dnl = This turns on xinerama support.  We just can't use the
3658dnl = autodetection of the libraries since on Red Hat 7 linking with
3659dnl = Xinerama crashes the dynamic loader.  Make people turn it on
3660dnl = explicitly.  The autodetection is done above in the Xlib
3661dnl = detection routines.
3662dnl ========================================================
3663MOZ_ARG_ENABLE_BOOL(xinerama,
3664[  --enable-xinerama       Enable Xinerama support
3665                           ( not safe for Red Hat 7.0 ) ],
3666    _ENABLE_XINERAMA=1,
3667    _ENABLE_XINERAMA= )
3668
3669if test -n "$_ENABLE_XINERAMA" -a -n "$MOZ_XINERAMA_LIBS" -a \
3670    -n "$ac_cv_header_X11_extensions_Xinerama_h"; then
3671    MOZ_ENABLE_XINERAMA=1
3672    AC_DEFINE(MOZ_ENABLE_XINERAMA)
3673fi
3674
3675dnl bi-directional support always on
3676IBMBIDI=1
3677AC_DEFINE(IBMBIDI)
3678
3679dnl ========================================================
3680dnl complex text support off by default
3681dnl ========================================================
3682SUNCTL=
3683MOZ_ARG_ENABLE_BOOL(ctl,
3684[  --enable-ctl            Enable Thai Complex Script support],
3685    SUNCTL=1,
3686    SUNCTL= )
3687
3688dnl ========================================================
3689dnl view source support on by default
3690dnl ========================================================
3691MOZ_VIEW_SOURCE=1
3692MOZ_ARG_DISABLE_BOOL(view-source,
3693[  --disable-view-source     Disable view source support],
3694    MOZ_VIEW_SOURCE=,
3695    MOZ_VIEW_SOURCE=1 )
3696if test "$MOZ_VIEW_SOURCE"; then
3697    AC_DEFINE(MOZ_VIEW_SOURCE)
3698fi
3699
3700
3701dnl ========================================================
3702dnl accessibility support on by default
3703dnl ========================================================
3704ACCESSIBILITY=1
3705MOZ_ARG_DISABLE_BOOL(accessibility,
3706[  --disable-accessibility Disable accessibility support],
3707    ACCESSIBILITY=,
3708    ACCESSIBILITY=1 )
3709if test "$ACCESSIBILITY"; then
3710    AC_DEFINE(ACCESSIBILITY)
3711fi
3712
3713dnl ========================================================
3714dnl xpfe/components on by default
3715dnl ========================================================
3716MOZ_XPFE_COMPONENTS=1
3717MOZ_ARG_DISABLE_BOOL(xpfe-components,
3718[  --disable-xpfe-components
3719                          Disable xpfe components],
3720    MOZ_XPFE_COMPONENTS=,
3721    MOZ_XPFE_COMPONENTS=1 )
3722
3723dnl ========================================================
3724dnl xpinstall support on by default
3725dnl ========================================================
3726MOZ_XPINSTALL=1
3727MOZ_ARG_DISABLE_BOOL(xpinstall,
3728[  --disable-xpinstall     Disable xpinstall support],
3729    MOZ_XPINSTALL=,
3730    MOZ_XPINSTALL=1 )
3731if test "$MOZ_XPINSTALL"; then
3732    AC_DEFINE(MOZ_XPINSTALL)
3733fi
3734
3735dnl ========================================================
3736dnl Single profile support off by default
3737dnl ========================================================
3738MOZ_SINGLE_PROFILE=
3739MOZ_ARG_ENABLE_BOOL(single-profile,
3740[  --enable-single-profile Enable single profile support ],
3741    MOZ_SINGLE_PROFILE=1,
3742    MOZ_SINGLE_PROFILE= )
3743
3744dnl ========================================================
3745dnl xpcom js loader support on by default
3746dnl ========================================================
3747MOZ_JSLOADER=1
3748MOZ_ARG_DISABLE_BOOL(jsloader,
3749[  --disable-jsloader      Disable xpcom js loader support],
3750    MOZ_JSLOADER=,
3751    MOZ_JSLOADER=1 )
3752if test "$MOZ_JSLOADER"; then
3753    AC_DEFINE(MOZ_JSLOADER)
3754fi
3755
3756dnl ========================================================
3757dnl use native unicode converters
3758dnl ========================================================
3759MOZ_USE_NATIVE_UCONV=
3760MOZ_ARG_ENABLE_BOOL(native-uconv,
3761[  --enable-native-uconv   Enable iconv support],
3762    MOZ_USE_NATIVE_UCONV=1,
3763    MOZ_USE_NATIVE_UCONV= )
3764if test "$MOZ_USE_NATIVE_UCONV"; then
3765    AC_DEFINE(MOZ_USE_NATIVE_UCONV)
3766fi
3767if test "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
3768    AC_MSG_ERROR([iconv() not found.  Cannot enable native uconv support.])
3769fi
3770
3771dnl ========================================================
3772dnl Libeditor can be build as plaintext-only,
3773dnl or as a full html and text editing component.
3774dnl We build both by default.
3775dnl ========================================================
3776MOZ_PLAINTEXT_EDITOR_ONLY=
3777MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
3778[  --enable-plaintext-editor-only
3779                          Allow only plaintext editing],
3780    MOZ_PLAINTEXT_EDITOR_ONLY=1,
3781    MOZ_PLAINTEXT_EDITOR_ONLY= )
3782dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
3783AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
3784
3785dnl ========================================================
3786dnl Composer is on by default.
3787dnl ========================================================
3788MOZ_COMPOSER=1
3789MOZ_ARG_DISABLE_BOOL(composer,
3790[  --disable-composer      Disable building of Composer],
3791    MOZ_COMPOSER=,
3792    MOZ_COMPOSER=1 )
3793AC_SUBST(MOZ_COMPOSER)
3794
3795dnl ========================================================
3796dnl = Enable compilation of specific extension modules
3797dnl ========================================================
3798
3799MOZ_EXTENSIONS_DEFAULT=" cookie wallet content-packs xml-rpc xmlextras help p3p pref transformiix venkman inspector irc universalchardet typeaheadfind webservices spellcheck gnomevfs negotiateauth"
3800
3801MOZ_EXTENSIONS_ALL="$MOZ_EXTENSIONS_DEFAULT xmlterm datetime finger cview layout-debug tasks"
3802
3803MOZ_ARG_ENABLE_STRING(extensions,
3804[  --enable-extensions     Enable extensions],
3805[ for option in `echo $enableval | sed 's/,/ /g'`; do
3806    if test "$option" = "yes" || test "$option" = "all"; then
3807        MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_ALL"
3808    elif test "$option" = "no" || test "$option" = "none"; then
3809        MOZ_EXTENSIONS=""
3810    elif test "$option" = "default"; then
3811        MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
3812    elif test `echo "$option" | grep -c \^-` != 0; then
3813        option=`echo $option | sed 's/^-//'`
3814        MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
3815    else
3816        MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
3817    fi
3818done],
3819    MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
3820
3821if test -z "$MOZ_ENABLE_GTK" && test `echo "$MOZ_EXTENSIONS" | grep -c xmlterm` -ne 0; then
3822    AC_MSG_WARN([Cannot build xmlterm without gtk toolkit. Removing xmlterm from MOZ_EXTENSIONS.])
3823    MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xmlterm||'`
3824fi
3825
3826if test -z "$MOZ_ENABLE_GNOMEVFS" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
3827    # Suppress warning on non-X11 platforms
3828    if test -n "$MOZ_X11"; then
3829        AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
3830    fi
3831    MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
3832fi
3833
3834if test -z "$MOZ_JSDEBUGGER" && test `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
3835    AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
3836    MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
3837fi
3838
3839dnl This might be temporary: build tridentprofile only on Windows
3840if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
3841    AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
3842    MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
3843fi
3844
3845dnl cookie must be built before tridentprofile. put it at list's end.
3846if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
3847  MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
3848  if test `echo "$MOZ_EXTENSIONS" | grep -c cookie` -eq 0; then
3849    AC_MSG_WARN([tridentprofile extension requires cookie. Removing tridentprofile.])
3850  else
3851    MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
3852  fi
3853fi
3854
3855dnl ========================================================
3856dnl Check for GSSAPI libraries and headers needed for
3857dnl integrated windows authentication support (disable
3858dnl negotiateauth extension if GSSAPI is not available).
3859dnl
3860dnl If we are not using GSSAPI to implement this extension,
3861dnl then we can obviously skip these checks.
3862dnl ========================================================
3863
3864if test -n "$USE_GSSAPI" && test `echo "$MOZ_EXTENSIONS" | grep -c negotiateauth` -ne 0; then
3865    dnl
3866    dnl Check for alternative location for GSSAPI libraries.
3867    dnl
3868    MOZ_ARG_WITH_STRING(gssapi,
3869        [  --with-gssapi=PFX       Location of GSSAPI libraries],
3870        GSSAPI_DIR=$withval)
3871
3872    dnl
3873    dnl If not specified, assume GSSAPI lives under /usr
3874    dnl
3875    if test -z "$GSSAPI_DIR"; then
3876        dnl
3877        dnl RedHat Linux 7, 8, and 9 install GSSAPI headers and libraries under
3878        dnl /usr/kerberos -- perhaps other platforms do the same.  If not, then
3879        dnl we count on the default search paths.  Fedora Core 1, at least,
3880        dnl puts the headers and libraries under /usr, but it still has
3881        dnl /usr/kerberos for the other KRB5 components.
3882        dnl
3883        if test -d "/usr/kerberos/include"; then
3884            GSSAPI_DIR="/usr/kerberos"
3885        else
3886            GSSAPI_DIR="/usr"
3887        fi
3888    fi
3889
3890    _SAVE_CPPFLAGS="$CPPFLAGS"
3891    _SAVE_LDFLAGS="$LDFLAGS"
3892    _SAVE_LIBS="$LIBS"
3893
3894    CPPFLAGS="$CPPFLAGS -I$GSSAPI_DIR/include"
3895    LDFLAGS="$LDFLAGS -L$GSSAPI_DIR/lib"
3896
3897    dnl
3898    dnl Try to set GSSAPI_INCLUDES ...
3899    dnl
3900    AC_CHECK_HEADERS(gssapi.h,
3901        [GSSAPI_INCLUDES="-I$GSSAPI_DIR/include"])
3902    if test -z "$GSSAPI_INCLUDES" ; then
3903        AC_CHECK_HEADERS(gssapi/gssapi.h,
3904            [GSSAPI_INCLUDES="-I$GSSAPI_DIR/include"])
3905    fi
3906    CPPFLAGS="$_SAVE_CPPFLAGS $GSSAPI_INCLUDES"
3907
3908    dnl
3909    dnl Try to set GSSAPI_LIBS ...
3910    dnl
3911    dnl Athena mod: First look for the MIT Kerberos V5 GSSAPI libraries.
3912    dnl
3913    dnl We only need to link to libgssapi_krb5.so
3914    dnl
3915    _GSS_LIBS="-L$GSSAPI_DIR/lib -lgssapi_krb5"
3916    LIBS="$LIBS $_GSS_LIBS"
3917    AC_CHECK_FUNC(gss_init_sec_context,
3918        [GSSAPI_LIBS="$_GSS_LIBS"],)
3919    LIBS="$_SAVE_LIBS"
3920
3921    dnl
3922    dnl If the MIT Kerberos V5 GSSAPI libraries were not found,
3923    dnl look for libgss.
3924    dnl
3925    if test -z "$GSSAPI_LIBS" ; then
3926        AC_CHECK_LIB(gss, gss_init_sec_context,
3927            [GSSAPI_LIBS="-L$GSSAPI_DIR/lib -lgss"],)
3928    fi
3929
3930    dnl
3931    dnl If GSS libs were STILL not found, try looking for Heimdal
3932    dnl Kerberos V5 libraries.
3933    dnl
3934    if test -z "$GSSAPI_LIBS" ; then
3935        if test -x "$GSSAPI_DIR/bin/krb5-config" ; then
3936            krb5cfg="$GSSAPI_DIR/bin/krb5-config"
3937            TMP_GSSAPI_LIBS=`$krb5cfg --libs gssapi 2>/dev/null`
3938            TMP_GSSAPI_INCLUDES=`$krb5cfg --cflags gssapi 2>/dev/null`
3939
3940            LIBS="$LIBS $TMP_GSSAPI_LIBS"
3941            AC_CHECK_LIB(gssapi, gss_init_sec_context,
3942                [GSSAPI_LIBS="$TMP_GSSAPI_LIBS"
3943                 GSSAPI_INCLUDES="$TMP_GSSAPI_INCLUDES"],
3944                [GSSAPI_LIBS=""])
3945
3946            CPPFLAGS="$_SAVE_CPPFLAGS $GSSAPI_INCLUDES"
3947        fi
3948    fi
3949
3950    dnl
3951    dnl If GSSAPI libs were not found, remove extension from the list to be
3952    dnl built.
3953    dnl
3954    if test -z "$GSSAPI_LIBS" ; then
3955        AC_MSG_WARN([Cannot build negotiateauth without GSSAPI. Removing negotatiate from MOZ_EXTENSIONS.])
3956        MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|negotiateauth||'`
3957        GSSAPI_INCLUDES=
3958    else
3959        dnl
3960        dnl Try to determine if the GSS_C_NT_HOSTBASED_SERVICE value is
3961        dnl defined.  Older MIT releases did not define this correctly.
3962        dnl
3963        AC_CHECK_HEADERS([gssapi_generic.h])
3964        AC_CHECK_HEADERS([gssapi/gssapi_generic.h])
3965
3966        AC_TRY_COMPILE([ #if defined(HAVE_GSSAPI_H)
3967                         #include <gssapi.h>
3968                         #elif defined(HAVE_GSSAPI_GSSAPI_H)
3969                         #include <gssapi/gssapi.h>
3970                         #endif ],
3971            [ gss_OID oid = GSS_C_NT_HOSTBASED_SERVICE; ],
3972            [AC_DEFINE(HAVE_GSS_C_NT_HOSTBASED_SERVICE)],[
3973             AC_MSG_WARN([GSS_C_NT_HOSTBASED_SERVICE not found])
3974            ])
3975    fi
3976
3977    LIBS="$_SAVE_LIBS"
3978    LDFLAGS="$_SAVE_LDFLAGS"
3979    CPPFLAGS="$_SAVE_CPPFLAGS"
3980
3981    AC_SUBST(GSSAPI_INCLUDES)
3982    AC_SUBST(GSSAPI_LIBS)
3983fi
3984
3985
3986dnl Remove dupes
3987MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
3988
3989dnl ========================================================
3990dnl Image decoders
3991dnl ========================================================
3992MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp xbm"
3993case "$target_os" in
3994cygwin*|mingw*|msvc*|mks*|os2*)
3995    MOZ_IMG_DECODERS_DEFAULT="$MOZ_IMG_DECODERS_DEFAULT icon"
3996    ;;
3997darwin*)
3998    if test "$MOZ_WIDGET_TOOLKIT" = "mac" -o "$MOZ_WIDGET_TOOLKIT" = "cocoa";
3999    then
4000        MOZ_IMG_DECODERS_DEFAULT="$MOZ_IMG_DECODERS_DEFAULT icon"
4001    fi
4002    ;;
4003esac
4004
4005MOZ_ARG_ENABLE_STRING(image-decoders,
4006[  --enable-image-decoders[={mod1,mod2,default,all,none}]
4007                          Enable specific image decoders],
4008[ for option in `echo $enableval | sed 's/,/ /g'`; do
4009    if test "$option" = "yes" || test "$option" = "all"; then
4010        MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
4011    elif test "$option" = "no" || test "$option" = "none"; then
4012        MOZ_IMG_DECODERS=""
4013    elif test "$option" = "default"; then
4014        MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
4015    elif test `echo "$option" | grep -c \^-` != 0; then
4016        option=`echo $option | sed 's/^-//'`
4017        MOZ_IMG_DECODERS=`echo "$MOZ_IMG_DECODERS" | sed "s/ ${option}//"`
4018    else
4019        MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $option"
4020    fi
4021done],
4022    MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS_DEFAULT")
4023
4024dnl Remove dupes
4025MOZ_IMG_DECODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_DECODERS}`
4026
4027dnl ========================================================
4028dnl experimental ldap features
4029dnl ========================================================
4030MOZ_ARG_ENABLE_BOOL(ldap-experimental,
4031[  --enable-ldap-experimental
4032                          Enable LDAP experimental features],
4033    MOZ_LDAP_XPCOM_EXPERIMENTAL=1,
4034    MOZ_LDAP_XPCOM_EXPERIMENTAL=)
4035
4036dnl ========================================================
4037dnl MathML on by default
4038dnl ========================================================
4039MOZ_MATHML=1
4040MOZ_ARG_DISABLE_BOOL(mathml,
4041[  --disable-mathml        Disable MathML support],
4042    MOZ_MATHML=,
4043    MOZ_MATHML=1 )
4044if test "$MOZ_MATHML"; then
4045  AC_DEFINE(MOZ_MATHML)
4046fi
4047
4048dnl ========================================================
4049dnl SVG
4050dnl ========================================================
4051MOZ_ARG_ENABLE_BOOL(svg,
4052[  --enable-svg            Enable SVG support],
4053    MOZ_SVG=1,
4054    MOZ_SVG= )
4055if test -n "$MOZ_SVG"; then
4056  AC_DEFINE(MOZ_SVG)
4057fi
4058
4059MOZ_ARG_ENABLE_BOOL(svg-renderer-gdiplus,
4060[  --enable-svg-renderer-gdiplus Enable SVG gdi+ renderer],
4061    MOZ_SVG_RENDERER_GDIPLUS=1,
4062    MOZ_SVG_RENDERER_GDIPLUS= )
4063if test -n "$MOZ_SVG_RENDERER_GDIPLUS"; then
4064  dnl XXX This is the test we'd like to perform but it isn't working
4065  dnl under Windows for some reason:
4066  dnl   AC_CHECK_HEADER(Gdiplus.h,,
4067  dnl                   AC_MSG_ERROR([Gdiplus.h not found!]))
4068  dnl So do this instead:
4069  AC_MSG_CHECKING(for Gdiplus.h)
4070  AC_LANG_SAVE
4071  AC_LANG_CPLUSPLUS
4072  AC_TRY_COMPILE([#include <windows.h>
4073                  #include <unknwn.h>
4074                  #include <Gdiplus.h>],,AC_MSG_RESULT(yes),
4075                 AC_MSG_ERROR([Building the SVG GDI+ renderer requires an appropriate Microsoft SDK.]))
4076  AC_LANG_RESTORE
4077  AC_DEFINE(MOZ_SVG_RENDERER_GDIPLUS)
4078fi
4079
4080MOZ_ARG_ENABLE_BOOL(svg-renderer-libart,
4081[  --enable-svg-renderer-libart Enable SVG libart renderer],
4082    MOZ_SVG_RENDERER_LIBART=1,
4083    MOZ_SVG_RENDERER_LIBART= )
4084if test -n "$MOZ_SVG_RENDERER_LIBART"; then
4085  AC_DEFINE(MOZ_SVG_RENDERER_LIBART)
4086fi
4087
4088MOZ_ARG_ENABLE_BOOL(svg-renderer-cairo,
4089[  --enable-svg-renderer-cairo Enable SVG cairo renderer ],
4090    MOZ_SVG_RENDERER_CAIRO=1,
4091    MOZ_SVG_RENDERER_CAIRO= )
4092if test -n "$MOZ_SVG_RENDERER_CAIRO"; then
4093  AC_DEFINE(MOZ_SVG_RENDERER_CAIRO)
4094fi
4095AC_SUBST(MOZ_SVG_RENDERER_CAIRO)
4096
4097dnl To build transformiix standalone, set TX_EXE while configuring
4098if test "$TX_EXE"; then
4099  AC_DEFINE(TX_EXE)
4100fi
4101
4102dnl ========================================================
4103dnl Installer
4104dnl ========================================================
4105case "$target_os" in
4106    aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*)
4107        MOZ_INSTALLER=1
4108        ;;
4109esac
4110
4111MOZ_ARG_DISABLE_BOOL(installer,
4112[  --disable-installer     Disable building of installer],
4113    MOZ_INSTALLER=,
4114    MOZ_INSTALLER=1 )
4115# Automatically disable installer if xpinstall isn't built
4116if test -z "$MOZ_XPINSTALL"; then
4117    MOZ_INSTALLER=
4118fi
4119AC_SUBST(MOZ_INSTALLER)
4120
4121dnl ========================================================
4122dnl ActiveX
4123dnl ========================================================
4124MOZ_NO_ACTIVEX_SUPPORT=1
4125MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4126case "$target_os" in
4127    msvc*|mks*|cygwin*|mingw*)
4128        if test -z "$GNU_CC"; then
4129            MOZ_NO_ACTIVEX_SUPPORT=
4130            MOZ_ACTIVEX_SCRIPTING_SUPPORT=1
4131        fi
4132        ;;
4133esac
4134
4135MOZ_ARG_DISABLE_BOOL(activex,
4136[  --disable-activex       Disable building of ActiveX control (win32 only)],
4137    MOZ_NO_ACTIVEX_SUPPORT=1,
4138    MOZ_NO_ACTIVEX_SUPPORT= )
4139AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
4140
4141MOZ_ARG_DISABLE_BOOL(activex-scripting,
4142[  --disable-activex-scripting
4143                          Disable building of ActiveX scripting support (win32)],
4144    MOZ_ACTIVEX_SCRIPTING_SUPPORT=,
4145    MOZ_ACTIVEX_SCRIPTING_SUPPORT=1)
4146AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
4147
4148if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
4149then
4150    AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
4151fi
4152
4153
4154dnl ========================================================
4155dnl leaky
4156dnl ========================================================
4157MOZ_ARG_ENABLE_BOOL(leaky,
4158[  --enable-leaky          Build leaky memory tool],
4159    MOZ_LEAKY=1,
4160    MOZ_LEAKY=)
4161
4162
4163dnl ========================================================
4164dnl xpctools
4165dnl ========================================================
4166MOZ_ARG_ENABLE_BOOL(xpctools,
4167[  --enable-xpctools       Build JS profiling tool],
4168    MOZ_XPCTOOLS=1,
4169    MOZ_XPCTOOLS= )
4170
4171
4172dnl ========================================================
4173dnl build the tests by default
4174dnl ========================================================
4175ENABLE_TESTS=1
4176MOZ_ARG_DISABLE_BOOL(tests,
4177[  --disable-tests         Do not build test libraries & programs],
4178    ENABLE_TESTS=,
4179    ENABLE_TESTS=1 )
4180
4181dnl ========================================================
4182dnl =
4183dnl = Module specific options
4184dnl =
4185dnl ========================================================
4186MOZ_ARG_HEADER(Individual module options)
4187
4188dnl ========================================================
4189dnl = Enable Lea malloc in xpcom. OFF by default.
4190dnl ========================================================
4191MOZ_ARG_ENABLE_BOOL(xpcom-lea,
4192[  --enable-xpcom-lea      Use Lea malloc in xpcom ],
4193    XPCOM_USE_LEA=1,
4194    XPCOM_USE_LEA= )
4195if test -n "$XPCOM_USE_LEA"; then
4196    AC_DEFINE(XPCOM_USE_LEA)
4197fi
4198
4199dnl ========================================================
4200dnl = Enable Ultrasparc specific optimizations for JS
4201dnl ========================================================
4202MOZ_ARG_ENABLE_BOOL(js-ultrasparc,
4203[  --enable-js-ultrasparc  Use UltraSPARC optimizations in JS],
4204    JS_ULTRASPARC_OPTS=1,
4205    JS_ULTRASPARC_OPTS= )
4206
4207dnl only enable option for ultrasparcs
4208if test `echo "$target_os" | grep -c \^solaris 2>/dev/null` = 0 -o \
4209    "$OS_TEST" != "sun4u"; then
4210    JS_ULTRASPARC_OPTS=
4211fi
4212AC_SUBST(JS_ULTRASPARC_OPTS)
4213
4214dnl ========================================================
4215dnl =
4216dnl = Feature options that require extra sources to be pulled
4217dnl =
4218dnl ========================================================
4219dnl MOZ_ARG_HEADER(Features that require extra sources)
4220
4221dnl ========================================================
4222dnl =
4223dnl = Debugging Options
4224dnl =
4225dnl ========================================================
4226MOZ_ARG_HEADER(Debugging and Optimizations)
4227
4228dnl ========================================================
4229dnl = Disable building with debug info.
4230dnl = Debugging is ON by default so that we get more useful
4231dnl = bug reports.
4232dnl ========================================================
4233MOZ_DEBUG=1
4234
4235if test -z "$MOZ_DEBUG_FLAGS"
4236then
4237    case "$target" in
4238    *-irix*)
4239        if test "$GNU_CC"; then
4240            GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'`
4241            case "$GCC_VERSION" in
4242            2.95.*)
4243                MOZ_DEBUG_FLAGS=""
4244                ;;
4245            *)
4246                MOZ_DEBUG_FLAGS="-g"
4247                ;;
4248            esac
4249        else
4250            MOZ_DEBUG_FLAGS="-g"
4251        fi
4252        ;;
4253    *)
4254        MOZ_DEBUG_FLAGS="-g"
4255        ;;
4256    esac
4257fi
4258
4259MOZ_ARG_DISABLE_BOOL(debug,
4260[  --disable-debug         Disable building with debug info],
4261    MOZ_DEBUG=)
4262
4263MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG"
4264 case "${target_os}" in
4265    beos*)
4266        MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${USER}"
4267        ;;
4268    msvc*|mks*|cygwin*|mingw*|os2*)
4269        MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
4270        ;;
4271    *)
4272        MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`$WHOAMI`"
4273        ;;
4274  esac
4275MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DTRACING"
4276
4277MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
4278
4279dnl ========================================================
4280dnl = Enable code optimization. OFF by default.
4281dnl ========================================================
4282MOZ_OPTIMIZE=
4283if test -z "$MOZ_OPTIMIZE_FLAGS"; then
4284        MOZ_OPTIMIZE_FLAGS="-O"
4285fi
4286
4287MOZ_ARG_ENABLE_STRING(optimize,
4288[  --enable-optimize[=OPT] Enable optimizations using compiler flags [OPT=-O]],
4289[ if test "$enableval" != "no"; then
4290    MOZ_OPTIMIZE=1
4291    if test -n "$enableval" && test "$enableval" != "yes"; then
4292        MOZ_OPTIMIZE_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
4293        MOZ_OPTIMIZE=2
4294    fi
4295fi ])
4296
4297if test -n "$MOZ_OPTIMIZE"; then
4298    AC_MSG_CHECKING([for valid optimization flags])
4299    _SAVE_CFLAGS=$CFLAGS
4300    CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
4301    AC_TRY_COMPILE([#include <stdio.h>],
4302        [printf("Hello World\n");],
4303        _results=yes,
4304        _results=no)
4305    AC_MSG_RESULT([$_results])
4306    if test "$_results" = "no"; then
4307        AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
4308    fi
4309    CFLAGS=$_SAVE_CFLAGS
4310fi
4311
4312AC_SUBST(MOZ_OPTIMIZE)
4313AC_SUBST(MOZ_OPTIMIZE_FLAGS)
4314AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
4315
4316dnl ========================================================
4317dnl = Enable/disable debug for specific modules only
4318dnl =   module names beginning with ^ will be disabled
4319dnl ========================================================
4320MOZ_ARG_ENABLE_STRING(debug-modules,
4321[  --enable-debug-modules  Enable/disable debug info for specific modules],
4322[ MOZ_DEBUG_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
4323
4324dnl ========================================================
4325dnl = Enable/disable generation of debugger info for specific modules only
4326dnl =    the special module name ALL_MODULES can be used to denote all modules
4327dnl =    module names beginning with ^ will be disabled
4328dnl ========================================================
4329MOZ_DBGRINFO_MODULES=
4330MOZ_ARG_ENABLE_STRING(debugger-info-modules,
4331[  --enable-debugger-info-modules
4332                          Enable/disable debugger info for specific modules],
4333[ for i in `echo $enableval | sed 's/,/ /g'`; do
4334      dnl note that the list of module names is reversed as it is copied
4335      dnl this is important, as it will allow config.mk to interpret stuff like
4336      dnl "^ALL_MODULES xpcom" properly
4337      if test "$i" = "no"; then
4338        i="^ALL_MODULES"
4339      fi
4340      if test "$i" = "yes"; then
4341        i="ALL_MODULES"
4342      fi
4343      MOZ_DBGRINFO_MODULES="$i $MOZ_DBGRINFO_MODULES";
4344    done ])
4345
4346dnl ========================================================
4347dnl Enable garbage collector
4348dnl ========================================================
4349MOZ_ARG_ENABLE_BOOL(boehm,
4350[  --enable-boehm          Enable the Boehm Garbage Collector],
4351    GC_LEAK_DETECTOR=1,
4352    GC_LEAK_DETECTOR= )
4353if test -n "$GC_LEAK_DETECTOR"; then
4354    AC_DEFINE(GC_LEAK_DETECTOR)
4355fi
4356
4357dnl ========================================================
4358dnl Disable runtime logging checks
4359dnl ========================================================
4360MOZ_ARG_DISABLE_BOOL(logging,
4361[  --disable-logging       Disable logging facilities],
4362    NS_DISABLE_LOGGING=1,
4363    NS_DISABLE_LOGGING= )
4364if test "$NS_DISABLE_LOGGING"; then
4365    AC_DEFINE(NS_DISABLE_LOGGING)
4366else
4367    AC_DEFINE(MOZ_LOGGING)
4368fi
4369
4370dnl ========================================================
4371dnl Crash on assert
4372dnl ========================================================
4373MOZ_ARG_ENABLE_BOOL(crash-on-assert,
4374[  --enable-crash-on-assert
4375                          Make NS_ASSERTION crash on Unix],
4376    _CRASH_ON_ASSERT=1,
4377    _CRASH_ON_ASSERT= )
4378if test "$_CRASH_ON_ASSERT"; then
4379    AC_DEFINE(UNIX_CRASH_ON_ASSERT)
4380fi
4381
4382dnl ========================================================
4383dnl = Enable function reordering. Off by default
4384dnl ========================================================
4385MOZ_REORDER=
4386MOZ_ARG_ENABLE_BOOL(reorder,
4387[  --enable-reorder        Enable function reordering (requires GNU ld) ],
4388    _ENABLE_REORDER=1,
4389    _ENABLE_REORDER= )
4390if test -n "$_ENABLE_REORDER"; then
4391    if test -z "$GNU_LD"; then
4392        AC_MSG_WARN([Reordering only works with GNU ld. Not reordering.])
4393    else
4394        MOZ_REORDER=1
4395    fi
4396fi
4397
4398dnl ========================================================
4399dnl = dnl This will enable logging of addref, release, ctor, dtor.
4400dnl ========================================================
4401_ENABLE_LOGREFCNT=42
4402MOZ_ARG_ENABLE_BOOL(logrefcnt,
4403[  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
4404    _ENABLE_LOGREFCNT=1,
4405    _ENABLE_LOGREFCNT= )
4406if test "$_ENABLE_LOGREFCNT" = "1"; then
4407    AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
4408elif test -z "$_ENABLE_LOGREFCNT"; then
4409    AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
4410fi
4411
4412dnl ========================================================
4413dnl = detect webshell leaks
4414dnl ========================================================
4415MOZ_ARG_ENABLE_BOOL(detect-webshell-leaks,
4416[  --enable-detect-webshell-leaks
4417                          Enable detection of webshell leaks
4418                          (default=debug)],
4419    _DETECT_WEBSHELL_LEAKS=1,
4420    _DETECT_WEBSHELL_LEAKS=,
4421    [ if test "$MOZ_DEBUG"; then
4422        _DETECT_WEBSHELL_LEAKS=1
4423    fi])
4424
4425if test "$_DETECT_WEBSHELL_LEAKS"; then
4426  AC_DEFINE(DETECT_WEBSHELL_LEAKS)
4427  AC_SUBST(DETECT_WEBSHELL_LEAKS)
4428fi
4429
4430dnl ========================================================
4431dnl = Use malloc wrapper lib
4432dnl ========================================================
4433MOZ_ARG_ENABLE_BOOL(wrap-malloc,
4434[  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
4435    _WRAP_MALLOC=1,
4436    _WRAP_MALLOC= )
4437
4438if test -n "$_WRAP_MALLOC"; then
4439    if test "$GNU_CC"; then
4440    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"
4441    MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) -o $@'
4442    fi
4443fi
4444
4445dnl ========================================================
4446dnl = Location of malloc wrapper lib
4447dnl ========================================================
4448MOZ_ARG_WITH_STRING(wrap-malloc,
4449[  --with-wrap-malloc=DIR  Location of malloc wrapper library],
4450    WRAP_MALLOC_LIB=$withval)
4451
4452dnl ========================================================
4453dnl = Use Electric Fence
4454dnl ========================================================
4455MOZ_ARG_ENABLE_BOOL(efence,
4456[  --enable-efence         Link with Electric Fence],
4457    _ENABLE_EFENCE=1,
4458    _ENABLE_EFENCE= )
4459if test -n "$_ENABLE_EFENCE"; then
4460    AC_CHECK_LIB(efence,malloc)
4461fi
4462
4463dnl ========================================================
4464dnl jprof
4465dnl ========================================================
4466MOZ_ARG_ENABLE_BOOL(jprof,
4467[  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof)],
4468    MOZ_JPROF=1,
4469    MOZ_JPROF= )
4470if test -n "$MOZ_JPROF"; then
4471    AC_DEFINE(MOZ_JPROF)
4472fi
4473
4474
4475dnl ========================================================
4476dnl = Enable stripping of libs & executables
4477dnl ========================================================
4478MOZ_ARG_ENABLE_BOOL(strip,
4479[  --enable-strip          Enable stripping of libs & executables ],
4480    ENABLE_STRIP=1,
4481    ENABLE_STRIP= )
4482
4483dnl ========================================================
4484dnl = --enable-elf-dynstr-gc
4485dnl ========================================================
4486MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
4487[  --enable-elf-dynstr-gc  Enable elf dynstr garbage collector (opt builds only)],
4488    USE_ELF_DYNSTR_GC=1,
4489    USE_ELF_DYNSTR_GC= )
4490
4491dnl ========================================================
4492dnl = --enable-old-abi-compat-wrappers
4493dnl ========================================================
4494dnl on x86 linux, the current builds of some popular plugins (notably
4495dnl flashplayer and real) expect a few builtin symbols from libgcc
4496dnl which were available in some older versions of gcc.  However,
4497dnl they're _NOT_ available in newer versions of gcc (eg 3.1), so if
4498dnl we want those plugin to work with a gcc-3.1 built binary, we need
4499dnl to provide these symbols.  MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS defaults
4500dnl to true on x86 linux, and false everywhere else.
4501dnl
4502
4503MOZ_ARG_ENABLE_BOOL(old-abi-compat-wrappers,
4504[  --enable-old-abi-compat-wrappers
4505                          Support old GCC ABI symbols to ease the pain
4506                          of the linux compiler change],
4507    MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1,
4508    MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS= )
4509if test "$MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS"; then
4510    AC_LANG_SAVE
4511    AC_LANG_CPLUSPLUS
4512    AC_CHECK_FUNCS(__builtin_vec_new __builtin_vec_delete __builtin_new __builtin_delete __pure_virtual)
4513    AC_LANG_RESTORE
4514    AC_DEFINE(MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS)
4515fi
4516
4517dnl ========================================================
4518dnl = --enable-prebinding
4519dnl ========================================================
4520MOZ_ARG_ENABLE_BOOL(prebinding,
4521[  --enable-prebinding     Enable prebinding (Mac OS X only)],
4522    USE_PREBINDING=1,
4523    USE_PREBINDING= )
4524
4525dnl ========================================================
4526dnl =
4527dnl = Profiling and Instrumenting
4528dnl =
4529dnl ========================================================
4530MOZ_ARG_HEADER(Profiling and Instrumenting)
4531
4532dnl ========================================================
4533dnl = Enable timeline service, which provides lightweight
4534dnl = instrumentation of mozilla for performance measurement.
4535dnl = Timeline is off by default.
4536dnl ========================================================
4537MOZ_TIMELINE=
4538MOZ_ARG_ENABLE_BOOL(timeline,
4539[  --enable-timeline       Enable timeline services ],
4540    MOZ_TIMELINE=1,
4541    MOZ_TIMELINE= )
4542if test -n "$MOZ_TIMELINE"; then
4543    AC_DEFINE(MOZ_TIMELINE)
4544fi
4545
4546dnl ========================================================
4547dnl Turn on reflow counting
4548dnl ========================================================
4549MOZ_REFLOW_PERF=
4550MOZ_ARG_ENABLE_BOOL(reflow-perf,
4551[  --enable-reflow-perf    Enable reflow performance tracing],
4552    MOZ_REFLOW_PERF=1,
4553    MOZ_REFLOW_PERF= )
4554if test -n "$MOZ_REFLOW_PREF"; then
4555    AC_DEFINE(MOZ_REFLOW_PREF)
4556fi
4557AC_SUBST(MOZ_REFLOW_PERF)
4558
4559dnl ========================================================
4560dnl Enable performance metrics.
4561dnl ========================================================
4562MOZ_ARG_ENABLE_BOOL(perf-metrics,
4563[  --enable-perf-metrics   Enable performance metrics],
4564    MOZ_PERF_METRICS=1,
4565    MOZ_PERF_METRICS= )
4566if test -n "$MOZ_PERF_METRICS"; then
4567    AC_DEFINE(MOZ_PERF_METRICS)
4568fi
4569
4570dnl ========================================================
4571dnl Enable code size metrics.
4572dnl ========================================================
4573MOZ_ARG_ENABLE_BOOL(codesighs,
4574[  --enable-codesighs      Enable code size analysis tools],
4575    _ENABLE_CODESIGHS=1,
4576    _ENABLE_CODESIGHS= )
4577if test -n "$_ENABLE_CODESIGHS"; then
4578    if test -d $srcdir/tools/codesighs; then
4579        MOZ_MAPINFO=1
4580    else
4581        AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
4582    fi
4583fi
4584
4585dnl ========================================================
4586dnl = Enable trace malloc
4587dnl ========================================================
4588NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
4589MOZ_ARG_ENABLE_BOOL(trace-malloc,
4590[  --enable-trace-malloc   Enable malloc tracing],
4591    NS_TRACE_MALLOC=1,
4592    NS_TRACE_MALLOC= )
4593if test "$NS_TRACE_MALLOC"; then
4594  # Please, Mr. Linker Man, don't take away our symbol names
4595  MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
4596  USE_ELF_DYNSTR_GC=
4597  AC_DEFINE(NS_TRACE_MALLOC)
4598fi
4599AC_SUBST(NS_TRACE_MALLOC)
4600
4601dnl ========================================================
4602dnl = Add support for Eazel profiler
4603dnl ========================================================
4604MOZ_ARG_ENABLE_BOOL(eazel-profiler-support,
4605[  --enable-eazel-profiler-support
4606                          Enable Corel/Eazel profiler support],
4607    ENABLE_EAZEL_PROFILER=1,
4608    ENABLE_EAZEL_PROFILER= )
4609if test -n "$ENABLE_EAZEL_PROFILER"; then
4610    AC_DEFINE(ENABLE_EAZEL_PROFILER)
4611    USE_ELF_DYNSTR_GC=
4612    MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
4613    EAZEL_PROFILER_CFLAGS="-g -O -gdwarf-2 -finstrument-functions -D__NO_STRING_INLINES  -D__NO_MATH_INLINES"
4614    EAZEL_PROFILER_LIBS="-lprofiler -lpthread"
4615fi
4616
4617MOZ_ARG_ENABLE_STRING(profile-modules,
4618[  --enable-profile-modules
4619                          Enable/disable profiling for specific modules],
4620[ MOZ_PROFILE_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
4621
4622MOZ_ARG_ENABLE_BOOL(insure,
4623[  --enable-insure         Enable insure++ instrumentation (linux only)],
4624    _ENABLE_INSURE=1,
4625    _ENABLE_INSURE= )
4626if test -n "$_ENABLE_INSURE"; then
4627    MOZ_INSURE="insure"
4628    MOZ_INSURIFYING=1
4629    MOZ_INSURE_DIRS="."
4630    MOZ_INSURE_EXCLUDE_DIRS="config"
4631fi
4632
4633MOZ_ARG_WITH_STRING(insure-dirs,
4634[  --with-insure-dirs=DIRS
4635                          Dirs to instrument with insure ],
4636    MOZ_INSURE_DIRS=$withval )
4637
4638MOZ_ARG_WITH_STRING(insure-exclude-dirs,
4639[  --with-insure-exclude-dirs=DIRS
4640                          Dirs to not instrument with insure ],
4641    MOZ_INSURE_EXCLUDE_DIRS="config $withval" )
4642
4643dnl ========================================================
4644dnl = Support for Quantify (Windows)
4645dnl ========================================================
4646MOZ_ARG_ENABLE_BOOL(quantify,
4647[  --enable-quantify      Enable Quantify support (Windows only) ],
4648    MOZ_QUANTIFY=1,
4649    MOZ_QUANTIFY= )
4650
4651dnl ========================================================
4652dnl = Support for demangling undefined symbols
4653dnl ========================================================
4654if test -z "$SKIP_LIBRARY_CHECKS"; then
4655    AC_LANG_SAVE
4656    AC_LANG_CPLUSPLUS
4657    AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
4658    AC_LANG_RESTORE
4659fi
4660
4661# Demangle only for debug or trace-malloc builds
4662MOZ_DEMANGLE_SYMBOLS=
4663if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
4664    MOZ_DEMANGLE_SYMBOLS=1
4665    AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
4666fi
4667AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
4668
4669
4670dnl ========================================================
4671dnl =
4672dnl = Misc. Options
4673dnl =
4674dnl ========================================================
4675MOZ_ARG_HEADER(Misc. Options)
4676
4677dnl ========================================================
4678dnl update xterm title
4679dnl ========================================================
4680MOZ_ARG_ENABLE_BOOL(xterm-updates,
4681[  --enable-xterm-updates  Update XTERM titles with current command.],
4682    MOZ_UPDATE_XTERM=1,
4683    MOZ_UPDATE_XTERM= )
4684
4685dnl =========================================================
4686dnl = Chrome format
4687dnl =========================================================
4688MOZ_ARG_ENABLE_STRING([chrome-format],
4689[  --enable-chrome-format=jar|flat|both|symlink
4690                          Select FORMAT of chrome files (default=jar)],
4691    MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
4692
4693if test -z "$MOZ_CHROME_FILE_FORMAT"; then
4694    MOZ_CHROME_FILE_FORMAT=jar
4695fi
4696
4697if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
4698    test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
4699    test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
4700    test "$MOZ_CHROME_FILE_FORMAT" != "both"; then
4701    AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, or symlink])
4702fi
4703
4704dnl ========================================================
4705dnl = Define default location for MOZILLA_FIVE_HOME
4706dnl ========================================================
4707MOZ_ARG_WITH_STRING(default-mozilla-five-home,
4708[  --with-default-mozilla-five-home
4709                          Set the default value for MOZILLA_FIVE_HOME],
4710[ val=`echo $withval`
4711  AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
4712
4713dnl ========================================================
4714dnl = Location of the mozilla user directory (default is ~/.mozilla).],
4715dnl ========================================================
4716MOZ_ARG_WITH_STRING(user-appdir,
4717[  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
4718[ val=`echo $withval`
4719if echo "$val" | grep "\/" >/dev/null; then
4720    AC_MSG_ERROR("Homedir must be single relative path.")
4721else
4722    MOZ_USER_DIR="$val"
4723fi])
4724
4725AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
4726
4727dnl ========================================================
4728dnl = Doxygen configuration
4729dnl ========================================================
4730dnl Use commas to specify multiple dirs to this arg
4731MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
4732MOZ_ARG_WITH_STRING(doc-input-dirs,
4733[  --with-doc-input-dirs=DIRS
4734                          Header/idl dirs to create docs from],
4735[ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
4736AC_SUBST(MOZ_DOC_INPUT_DIRS)
4737
4738dnl Use commas to specify multiple dirs to this arg
4739MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
4740MOZ_ARG_WITH_STRING(doc-include-dirs,
4741[  --with-doc-include-dirs=DIRS 
4742                          Include dirs to preprocess doc headers],
4743[ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
4744AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
4745
4746MOZ_DOC_OUTPUT_DIR='./dist/docs'
4747MOZ_ARG_WITH_STRING(doc-output-dir,
4748[  --with-doc-output-dir=DIR
4749                          Dir to generate docs into],
4750[ MOZ_DOC_OUTPUT_DIR=$withval ] )
4751AC_SUBST(MOZ_DOC_OUTPUT_DIR)
4752
4753if test -z "$SKIP_COMPILER_CHECKS"; then
4754dnl ========================================================
4755dnl =
4756dnl = Compiler Options
4757dnl =
4758dnl ========================================================
4759MOZ_ARG_HEADER(Compiler Options)
4760
4761dnl ========================================================
4762dnl Check for gcc -pipe support
4763dnl ========================================================
4764AC_MSG_CHECKING([for gcc -pipe support])
4765if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
4766    echo '#include <stdio.h>' > dummy-hello.c
4767    echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
4768    ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
4769    cat dummy-hello.s | ${AS_BIN} -o dummy-hello.S - 2>&5
4770    if test $? = 0; then
4771        _res_as_stdin="yes"
4772    else
4773        _res_as_stdin="no"
4774    fi
4775    if test "$_res_as_stdin" = "yes"; then
4776        _SAVE_CFLAGS=$CFLAGS
4777        CFLAGS="$CFLAGS -pipe"
4778        AC_TRY_COMPILE( [ #include <stdio.h> ],
4779            [printf("Hello World\n");],
4780            [_res_gcc_pipe="yes"],
4781            [_res_gcc_pipe="no"] )
4782        CFLAGS=$_SAVE_CFLAGS
4783    fi
4784    if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
4785        _res="yes";
4786        CFLAGS="$CFLAGS -pipe"
4787        CXXFLAGS="$CXXFLAGS -pipe"
4788    else
4789        _res="no"
4790    fi
4791    rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
4792    AC_MSG_RESULT([$_res])
4793else
4794    AC_MSG_RESULT([no])
4795fi
4796
4797dnl pass -Wno-long-long to the compiler
4798MOZ_ARG_ENABLE_BOOL(long-long-warning,
4799[  --enable-long-long-warning
4800                          Warn about use of non-ANSI long long type],
4801    _IGNORE_LONG_LONG_WARNINGS=,
4802    _IGNORE_LONG_LONG_WARNINGS=1)
4803
4804if test "$_IGNORE_LONG_LONG_WARNINGS"; then
4805     _SAVE_CFLAGS="$CFLAGS"
4806     CFLAGS="$CFLAGS ${_COMPILER_PREFIX}-Wno-long-long"
4807     AC_MSG_CHECKING([whether compiler supports -Wno-long-long])
4808     AC_TRY_COMPILE([], [return(0);],
4809        [ _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
4810          _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
4811          result="yes" ], result="no")
4812     AC_MSG_RESULT([$result])
4813     CFLAGS="$_SAVE_CFLAGS"
4814fi
4815
4816dnl Test for profiling options
4817dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities
4818dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
4819
4820_SAVE_CFLAGS="$CFLAGS"
4821CFLAGS="$CFLAGS -fprofile-generate"
4822
4823AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
4824AC_TRY_COMPILE([], [return 0;],
4825               [ PROFILE_GEN_CFLAGS="-fprofile-generate"
4826                 result="yes" ], result="no")
4827AC_MSG_RESULT([$result])
4828
4829if test $result = "yes"; then
4830  PROFILE_USE_CFLAGS="-fprofile-use"
4831else
4832  CFLAGS="$_SAVE_CFLAGS -fprofile-arcs"
4833  AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs])
4834  AC_TRY_COMPILE([], [return 0;],
4835                 [ PROFILE_GEN_CFLAGS="-fprofile-arcs"
4836                   result="yes" ], result="no")
4837  AC_MSG_RESULT([$result])
4838  if test $result = "yes"; then
4839    PROFILE_USE_CFLAGS="-fbranch-probabilities"
4840  fi
4841fi
4842
4843CFLAGS="$_SAVE_CFLAGS"
4844
4845AC_SUBST(PROFILE_GEN_CFLAGS)
4846AC_SUBST(PROFILE_USE_CFLAGS)
4847
4848AC_LANG_CPLUSPLUS
4849
4850dnl ========================================================
4851dnl Test for -pedantic bustage
4852dnl ========================================================
4853MOZ_ARG_DISABLE_BOOL(pedantic,
4854[  --disable-pedantic      Issue all warnings demanded by strict ANSI C ],
4855_PEDANTIC= )
4856if test "$_PEDANTIC"; then
4857    _SAVE_CXXFLAGS=$CXXFLAGS
4858    CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
4859    AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
4860    AC_TRY_RUN([ int main () {
4861                if (sizeof(long long) != 8) { return 1; }
4862                    return 0; } ],
4863        result="no", result="yes", result="maybe" )
4864    AC_MSG_RESULT([$result])
4865    CXXFLAGS="$_SAVE_CXXFLAGS"
4866
4867    case "$result" in
4868    no)
4869        _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic"
4870        _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
4871        ;;
4872    yes)
4873        AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic. ])
4874        ;;
4875    maybe)
4876        AC_MSG_WARN([Cannot test -pedantic long long bug when cross-compiling.])
4877        ;;
4878    esac
4879fi
4880
4881dnl ========================================================
4882dnl Test for correct temporary object destruction order
4883dnl ========================================================
4884dnl We want to make sure the compiler follows the C++ spec here as
4885dnl xpcom and the string classes depend on it (bug 235381).
4886AC_MSG_CHECKING([for correct temporary object destruction order])
4887AC_TRY_RUN([ class A {
4888             public:  A(int& x) : mValue(x) {}
4889                      ~A() { mValue--; }
4890                      operator char**() { return 0; }
4891             private:  int& mValue;
4892             };
4893             void func(char **arg) {}
4894             int m=2;
4895             void test() {
4896                  func(A(m));
4897                  if (m==1) m = 0;
4898             }
4899             int main() {
4900                 test();
4901                 return(m);
4902             }
4903             ],
4904     result="yes", result="no", result="maybe")
4905AC_MSG_RESULT([$result])
4906
4907if test "$result" = "no"; then
4908    AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
4909fi
4910
4911dnl ========================================================
4912dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
4913dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
4914dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
4915dnl ========================================================
4916_SAVE_CXXFLAGS=$CXXFLAGS
4917CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
4918AC_CACHE_CHECK(for correct overload resolution with const and templates,
4919    ac_nscap_nonconst_opeq_bug,
4920    [AC_TRY_COMPILE([
4921                      template <class T>
4922                      class Pointer
4923                        {
4924                        public:
4925                          T* myPtr;
4926                        };
4927                     
4928                      template <class T, class U>
4929                      int operator==(const Pointer<T>& rhs, U* lhs)
4930                        {
4931                          return rhs.myPtr == lhs;
4932                        }
4933                     
4934                      template <class T, class U>
4935                      int operator==(const Pointer<T>& rhs, const U* lhs)
4936                        {
4937                          return rhs.myPtr == lhs;
4938                        }
4939                    ],
4940                    [
4941                      Pointer<int> foo;
4942                      const int* bar;
4943                      return foo == bar;
4944                    ],
4945                    ac_nscap_nonconst_opeq_bug="no",
4946                    ac_nscap_nonconst_opeq_bug="yes")])
4947CXXFLAGS="$_SAVE_CXXFLAGS"
4948
4949if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
4950    AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
4951fi
4952fi
4953
4954dnl ========================================================
4955dnl C++ rtti
4956dnl Should be smarter and check that the compiler does indeed have rtti
4957dnl ========================================================
4958MOZ_ARG_ENABLE_BOOL(cpp-rtti,
4959[  --enable-cpp-rtti       Enable C++ RTTI ],
4960[ _MOZ_USE_RTTI=1 ],
4961[ _MOZ_USE_RTTI= ])
4962
4963if test "$_MOZ_USE_RTTI"; then
4964   _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
4965else
4966   _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
4967fi
4968
4969dnl ========================================================
4970dnl C++ exceptions (g++/egcs only - for now)
4971dnl Should be smarter and check that the compiler does indeed have exceptions
4972dnl ========================================================
4973MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
4974[  --enable-cpp-exceptions Enable C++ exceptions ],
4975[ _MOZ_CPP_EXCEPTIONS=1 ],
4976[ _MOZ_CPP_EXCEPTIONS= ])
4977
4978if test "$_MOZ_CPP_EXCEPTIONS"; then
4979    _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
4980else
4981    _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
4982fi
4983
4984# Irix & OSF native compilers do not like exception declarations
4985# when exceptions are disabled
4986if test "$_MOZ_CPP_EXCEPTIONS" -o -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
4987    AC_DEFINE(CPP_THROW_NEW, [])
4988else
4989    AC_DEFINE(CPP_THROW_NEW, [throw()])
4990fi
4991AC_LANG_C
4992
4993dnl ========================================================
4994dnl =
4995dnl = Build depencency options
4996dnl =
4997dnl ========================================================
4998MOZ_ARG_HEADER(Build dependencies)
4999
5000dnl ========================================================
5001dnl = Do not auto generate dependency info
5002dnl ========================================================
5003MOZ_AUTO_DEPS=1
5004MOZ_ARG_DISABLE_BOOL(auto-deps,
5005[  --disable-auto-deps     Do not automatically generate dependency info],
5006    MOZ_AUTO_DEPS=,
5007    MOZ_AUTO_DEPS=1)
5008
5009if test -n "$MOZ_AUTO_DEPS"; then
5010dnl ========================================================
5011dnl = Use mkdepend instead of $CC -MD for dependency generation
5012dnl ========================================================
5013_cpp_md_flag=
5014MOZ_ARG_DISABLE_BOOL(md,
5015[  --disable-md            Do not use compiler-based dependencies ],
5016  [_cpp_md_flag=],
5017  [_cpp_md_flag=1],
5018  [dnl Default is to turn on -MD if using GNU-compatible compilers
5019   if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT"; then
5020     _cpp_md_flag=1
5021   fi])
5022if test "$_cpp_md_flag"; then
5023  COMPILER_DEPEND=1
5024  if test "$OS_ARCH" = "OpenVMS"; then
5025    _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(*F).pp))'
5026  else
5027    _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(*F).pp)'
5028  fi
5029else
5030  COMPILER_DEPEND=
5031  _USE_CPP_INCLUDE_FLAG=
5032  _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
5033  _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
5034fi
5035fi # MOZ_AUTO_DEPS
5036MDDEPDIR='.deps'
5037AC_SUBST(MOZ_AUTO_DEPS)
5038AC_SUBST(COMPILER_DEPEND)
5039AC_SUBST(MDDEPDIR)
5040
5041
5042dnl ========================================================
5043dnl =
5044dnl = Static Build Options
5045dnl =
5046dnl ========================================================
5047MOZ_ARG_HEADER(Static build options)
5048
5049BUILD_SHARED_LIBS=1
5050BUILD_STATIC_LIBS=
5051MOZ_STATIC_COMPONENT_LIBS=
5052
5053MOZ_ARG_DISABLE_BOOL(shared,
5054[  --disable-shared        Disable building of internal shared libs],
5055    BUILD_SHARED_LIBS=)
5056
5057MOZ_ARG_ENABLE_BOOL(static,
5058[  --enable-static         Enable building of internal static libs],
5059    BUILD_STATIC_LIBS=1
5060    MOZ_STATIC_COMPONENT_LIBS=1)
5061
5062if (test -z "$BUILD_SHARED_LIBS" && test -z "$BUILD_STATIC_LIBS") ||
5063    (test -n "$BUILD_SHARED_LIBS" && test -n "$BUILD_STATIC_LIBS") ; then
5064    AC_MSG_ERROR([Only one of --enable-shared or --enable-static must be specified.])
5065fi
5066
5067dnl ========================================================
5068dnl static component loader
5069dnl ========================================================
5070MOZ_STATIC_COMPONENT_LOADER=1
5071MOZ_ARG_DISABLE_BOOL(static-component-loader,
5072[  --disable-static-component-loader
5073                          Disable the static component loader],
5074    MOZ_STATIC_COMPONENT_LOADER=)
5075
5076if test -n "$MOZ_STATIC_COMPONENT_LOADER"; then
5077    AC_DEFINE(ENABLE_STATIC_COMPONENT_LOADER)
5078fi
5079
5080dnl ========================================================
5081dnl Generate static component from list of modules
5082dnl ========================================================
5083MOZ_ARG_ENABLE_STRING(meta-component-modules,
5084[  --enable-meta-component-modules=mod1[,mod2]
5085                          Build single meta-component from specified modules],
5086[ MOZ_STATIC_COMPONENTS=`echo $enableval | sed 's/,/ /g'` ] )
5087
5088dnl ========================================================
5089dnl Enable the use of predefined meta components
5090dnl ========================================================
5091MOZ_ARG_ENABLE_STRING(meta-components,
5092[  --enable-meta-components
5093                          Build predefined meta-components],
5094  [ MOZ_META_COMPONENTS=`echo $enableval | sed 's/,/ /g'` ] )
5095
5096if test -n "$MOZ_STATIC_COMPONENTS" && test -n "$MOZ_META_COMPONENTS"; then
5097    AC_MSG_ERROR([Simultaneous use of meta-module-components & meta-components is not supported.])
5098fi
5099
5100MOZ_COMPONENTLIB=
5101MOZ_ARG_ENABLE_BOOL(componentlib,
5102[  --enable-componentlib  Build a shared library containing all of the components],
5103   MOZ_COMPONENTLIB=1,
5104   MOZ_COMPONENTLIB= )
5105
5106AC_SUBST(MOZ_COMPONENTLIB)
5107if test "$MOZ_COMPONENTLIB"; then
5108   BUILD_SHARED_LIBS=
5109   BUILD_STATIC_LIBS=1
5110   MOZ_STATIC_COMPONENT_LIBS=1
5111   MOZ_META_COMPONENTS=mozcomps
5112fi
5113
5114dnl ========================================================
5115dnl =
5116dnl = Standalone module options
5117dnl =
5118dnl ========================================================
5119MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
5120
5121dnl ========================================================
5122dnl = Only selectively build modules
5123dnl ========================================================
5124BUILD_MODULES=all
5125MOZ_ARG_ENABLE_STRING(standalone-modules,
5126[  --enable-standalone-modules=mod1[,mod2]
5127                          Enable standalone build of specific modules],
5128[ BUILD_MODULES=`echo $enableval | sed 's/,/ /g'` ] )
5129
5130dnl Disable ldap if LDAP is not building all of Mozilla
5131dnl and ldap isn't in the standalone list
5132if test "$BUILD_MODULES" != "all" &&
5133    test `echo "$BUILD_MODULES" | grep -c ldap` = 0 &&
5134    test "$enable_ldap" != "yes"; then
5135    MOZ_LDAP_XPCOM=
5136fi
5137
5138dnl Check for GLib and libIDL.
5139dnl ========================================================
5140case "$target_os" in
5141msvc*|mks*|cygwin*|mingw*)
5142    SKIP_IDL_CHECK="yes"
5143    ;;
5144*)
5145    SKIP_IDL_CHECK="no"
5146    ;;
5147esac
5148
5149dnl = Allow users to disable libIDL checking for standalone modules
5150MOZ_ARG_WITHOUT_BOOL(libIDL,
5151[  --without-libIDL        Skip check for libIDL (standalone modules only)],
5152        SKIP_IDL_CHECK="yes")
5153
5154if test "$SKIP_IDL_CHECK" = "no"
5155then
5156    _LIBIDL_FOUND=
5157    if test "$MACOS_SDK_DIR"; then
5158      changequote(,)
5159      LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
5160      changequote([,])
5161      unset NEXT_ROOT
5162    fi
5163
5164    if test "$MOZ_ENABLE_GTK2"; then
5165        PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
5166    fi
5167    if test -z "$_LIBIDL_FOUND"; then
5168        AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
5169    fi
5170    dnl
5171    dnl If we don't have a libIDL config program & not cross-compiling,
5172    dnl     look for orbit-config instead.
5173    dnl
5174    if test -z "$_LIBIDL_FOUND" && test -z "$CROSS_COMPILE"; then
5175        AC_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
5176        if test -n "$ORBIT_CONFIG"; then
5177                _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
5178            _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
5179            _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
5180            _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
5181            LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
5182            LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
5183            LIBIDL_CONFIG=
5184            _LIBIDL_FOUND=1
5185        fi
5186    fi
5187    if test -z "$_LIBIDL_FOUND"; then
5188        AC_MSG_ERROR([libIDL not found.
5189        libIDL $LIBIDL_VERSION or higher is required.])
5190    fi
5191    if test "$MACOS_SDK_DIR"; then
5192      LIBS="-L${MACOS_SDK_DIR}/usr/lib/gcc/darwin/${GCC_VERSION} -L${MACOS_SDK_DIR}/usr/lib $LIBS"
5193      export NEXT_ROOT=$MACOS_SDK_DIR
5194    fi
5195fi
5196
5197if test -n "$CROSS_COMPILE"; then
5198    if test -z "$HOST_LIBIDL_CONFIG"; then
5199        HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
5200    fi
5201    if test -n "$HOST_LIBIDL_CONFIG"; then
5202        HOST_LIBIDL_CFLAGS=`${HOST_LIBIDL_CONFIG} --cflags`
5203        HOST_LIBIDL_LIBS=`${HOST_LIBIDL_CONFIG} --libs`
5204    else
5205        HOST_LIBIDL_CFLAGS="$LIBIDL_CFLAGS"
5206        HOST_LIBIDL_LIBS="$LIBIDL_LIBS"
5207    fi
5208fi
5209
5210if test -z "$SKIP_PATH_CHECKS"; then
5211if test -z "${GLIB_CFLAGS}" || test -z "${GLIB_LIBS}" ; then
5212    if test "$MOZ_ENABLE_GTK2"; then
5213        PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7)
5214    else
5215        AM_PATH_GLIB(${GLIB_VERSION})
5216    fi
5217fi
5218fi
5219
5220if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
5221    GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
5222fi
5223
5224AC_SUBST(LIBIDL_CFLAGS)
5225AC_SUBST(LIBIDL_LIBS)
5226AC_SUBST(GLIB_CFLAGS)
5227AC_SUBST(GLIB_LIBS)
5228AC_SUBST(GLIB_GMODULE_LIBS)
5229AC_SUBST(HOST_LIBIDL_CONFIG)
5230AC_SUBST(HOST_LIBIDL_CFLAGS)
5231AC_SUBST(HOST_LIBIDL_LIBS)
5232
5233dnl ========================================================
5234dnl Check for libart
5235dnl ========================================================
5236MOZ_LIBART_CFLAGS=
5237MOZ_LIBART_LIBS=
5238
5239if test "$MOZ_SVG_RENDERER_LIBART"; then
5240  if test "$MOZ_INTERNAL_LIBART_LGPL"; then
5241    dnl libart's configure hasn't been run yet, but we know what the
5242    dnl answer should be anyway
5243    MOZ_LIBART_CFLAGS='-I${DIST}/include/libart_lgpl'
5244    case "$target_os" in
5245    msvc*|mks*|cygwin*|mingw*)
5246        MOZ_LIBART_LIBS='$(DIST)/lib/$(LIB_PREFIX)moz_art_lgpl.$(IMPORT_LIB_SUFFIX)'
5247        ;;
5248    beos*)
5249        MOZ_LIBART_LIBS='-lmoz_art_lgpl -lroot -lbe'
5250        ;;
5251    *)
5252        MOZ_LIBART_LIBS='-lmoz_art_lgpl -lm'
5253        ;;
5254    esac
5255    AC_FUNC_ALLOCA
5256  else
5257dnl Disable system libart until the pixel format changes are merged upstream
5258    AC_MSG_ERROR([SVG requires a modified version of libart. To pull and build
5259this LGPL library, set MOZ_INTERNAL_LIBART_LGPL, and then rerun the
5260checkout stage])
5261dnl    AM_PATH_LIBART($LIBART_VERSION,
5262dnl      AC_MSG_ERROR(SVG requires at least version $LIBART_VERSION of libart))
5263dnl
5264dnl    MOZ_LIBART_CFLAGS=$LIBART_CFLAGS
5265dnl    MOZ_LIBART_LIBS=$LIBART_LIBS
5266  fi
5267fi
5268
5269AC_SUBST(MOZ_LIBART_CFLAGS)
5270AC_SUBST(MOZ_LIBART_LIBS)
5271AC_SUBST(MOZ_INTERNAL_LIBART_LGPL)
5272
5273dnl ========================================================
5274dnl Check for cairo
5275dnl ========================================================
5276MOZ_CAIRO_CFLAGS=
5277MOZ_CAIRO_LIBS=
5278
5279if test "$MOZ_SVG_RENDERER_CAIRO"; then
5280   PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
5281   MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
5282   MOZ_CAIRO_LIBS=$CAIRO_LIBS
5283fi
5284
5285AC_SUBST(MOZ_CAIRO_CFLAGS)
5286AC_SUBST(MOZ_CAIRO_LIBS)
5287
5288dnl ========================================================
5289dnl disable xul
5290dnl ========================================================
5291MOZ_XUL=1
5292MOZ_ARG_DISABLE_BOOL(xul,
5293[  --disable-xul           Disable XUL],
5294    MOZ_XUL= )
5295if test "$MOZ_XUL"; then
5296  AC_DEFINE(MOZ_XUL)
5297else
5298  dnl remove extensions that require XUL
5299  MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
5300fi
5301
5302AC_SUBST(MOZ_XUL)
5303
5304dnl ========================================================
5305dnl disable profile sharing
5306dnl ========================================================
5307MOZ_PROFILESHARING=1
5308MOZ_IPCD=
5309MOZ_ARG_DISABLE_BOOL(profilesharing,
5310[  --disable-profilesharing           Disable profile sharing],
5311    MOZ_PROFILESHARING=,
5312    MOZ_PROFILESHARING=1 )
5313if test "$MOZ_PROFILESHARING"; then
5314  MOZ_IPCD=1
5315  AC_DEFINE(MOZ_PROFILESHARING)
5316fi
5317
5318dnl ========================================================
5319dnl disable profile locking
5320dnl   do no use this in applications that can have more than
5321dnl   one process accessing the profile directory.
5322dnl ========================================================
5323MOZ_PROFILELOCKING=1
5324MOZ_ARG_DISABLE_BOOL(profilelocking,
5325[  --disable-profilelocking           Disable profile locking],
5326    MOZ_PROFILELOCKING=,
5327    MOZ_PROFILELOCKING=1 )
5328if test "$MOZ_PROFILELOCKING"; then
5329  AC_DEFINE(MOZ_PROFILELOCKING)
5330fi
5331
5332
5333dnl ========================================================
5334dnl necko configuration options
5335dnl ========================================================
5336
5337dnl
5338dnl option to disable various necko protocols
5339dnl
5340NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http jar keyword res viewsource"
5341MOZ_ARG_ENABLE_STRING(necko-protocols,
5342[  --enable-necko-protocols[={http,ftp,default,all,none}]
5343                          Enable/disable specific protocol handlers],
5344[ for option in `echo $enableval | sed 's/,/ /g'`; do
5345    if test "$option" = "yes" || test "$option" = "all"; then
5346        NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
5347    elif test "$option" = "no" || test "$option" = "none"; then
5348        NECKO_PROTOCOLS=""
5349    elif test "$option" = "default"; then
5350        NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
5351    elif test `echo "$option" | grep -c \^-` != 0; then
5352        option=`echo $option | sed 's/^-//'`
5353        NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
5354    else
5355        NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
5356    fi
5357done],
5358    NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
5359dnl Remove dupes
5360NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
5361AC_SUBST(NECKO_PROTOCOLS)
5362for p in $NECKO_PROTOCOLS; do
5363    AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
5364done
5365
5366dnl
5367dnl option to disable necko's disk cache
5368dnl
5369NECKO_DISK_CACHE=1
5370MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
5371[  --disable-necko-disk-cache
5372                          Disable necko disk cache],
5373    NECKO_DISK_CACHE=,
5374    NECKO_DISK_CACHE=1)
5375AC_SUBST(NECKO_DISK_CACHE)
5376if test "$NECKO_DISK_CACHE"; then
5377    AC_DEFINE(NECKO_DISK_CACHE)
5378fi
5379
5380dnl
5381dnl option to minimize size of necko's i/o buffers
5382dnl
5383NECKO_SMALL_BUFFERS=
5384MOZ_ARG_ENABLE_BOOL(necko-small-buffers,
5385[  --enable-necko-small-buffers
5386                          Minimize size of necko's i/o buffers],
5387    NECKO_SMALL_BUFFERS=1,
5388    NECKO_SMALL_BUFFERS=)
5389AC_SUBST(NECKO_SMALL_BUFFERS)
5390if test "$NECKO_SMALL_BUFFERS"; then
5391    AC_DEFINE(NECKO_SMALL_BUFFERS)
5392fi
5393
5394dnl
5395dnl option to disable cookies
5396dnl
5397NECKO_COOKIES=1
5398MOZ_ARG_DISABLE_BOOL(cookies,
5399[  --disable-cookies       Disable cookie support],
5400    NECKO_COOKIES=,
5401    NECKO_COOKIES=1)
5402AC_SUBST(NECKO_COOKIES)
5403if test "$NECKO_COOKIES"; then
5404    AC_DEFINE(NECKO_COOKIES)
5405fi
5406
5407dnl NECKO_ configuration options are not global
5408_NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
5409
5410dnl ========================================================
5411dnl =
5412dnl = Cleanup section for misc ordering snafus
5413dnl =
5414if test "$OS_ARCH" = "WINNT" -a -z "$GNU_CC"; then
5415    XPCOM_GLUE_LIBS='$(DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX) $(DIST)/lib/$(LIB_PREFIX)string_s.$(LIB_SUFFIX)'
5416else
5417    XPCOM_GLUE_LIBS='-L${DIST}/bin -L${DIST}/lib -lxpcomglue -lstring_s'
5418fi
5419
5420dnl ========================================================
5421if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"; then
5422    MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
5423fi
5424
5425if test "$MOZ_LDAP_XPCOM"; then
5426    LDAP_CFLAGS='-I${DIST}/public/ldap'
5427    if test "$OS_ARCH" = "WINNT"; then
5428        if test -n "$GNU_CC"; then
5429            LDAP_LIBS='-L$(DIST)/lib -lnsldap32v50 -lnsldappr32v50'
5430        else
5431            LDAP_LIBS='$(DIST)/lib/$(LIB_PREFIX)nsldap32v50.${IMPORT_LIB_SUFFIX} $(DIST)/lib/$(LIB_PREFIX)nsldappr32v50.${IMPORT_LIB_SUFFIX}'
5432        fi
5433    elif test "$VACPP"; then
5434            LDAP_LIBS='$(DIST)/lib/$(LIB_PREFIX)ldap50.${IMPORT_LIB_SUFFIX} $(DIST)/lib/$(LIB_PREFIX)prldap50.${IMPORT_LIB_SUFFIX}'
5435    else
5436        LDAP_LIBS='-L${DIST}/bin -L${DIST}/lib -lldap50 -llber50 -lprldap50'
5437    fi
5438fi
5439
5440if test "$SUNCTL"; then
5441    dnl older versions of glib do not seem to have gmodule which ctl needs
5442    _SAVE_CFLAGS=$CFLAGS
5443    CFLAGS="$CFLAGS $GLIB_CFLAGS"
5444    AC_LANG_SAVE
5445    AC_LANG_C
5446    AC_TRY_COMPILE([#include <gmodule.h>],
5447        [ int x = 1; x++; ],,
5448        [AC_MSG_ERROR([Cannot build ctl without gmodule support in glib.])])
5449    AC_LANG_RESTORE
5450    CFLAGS=$_SAVE_CFLAGS
5451    AC_DEFINE(SUNCTL)
5452fi
5453
5454dnl ========================================================
5455dnl =
5456dnl = Maintainer debug option (no --enable equivalent)
5457dnl =
5458dnl ========================================================
5459
5460AC_SUBST(AR)
5461AC_SUBST(AR_FLAGS)
5462AC_SUBST(AR_LIST)
5463AC_SUBST(AR_EXTRACT)
5464AC_SUBST(AR_DELETE)
5465AC_SUBST(AS)
5466AC_SUBST(ASFLAGS)
5467AC_SUBST(AS_DASH_C_FLAG)
5468AC_SUBST(LD)
5469AC_SUBST(RC)
5470AC_SUBST(RCFLAGS)
5471AC_SUBST(WINDRES)
5472AC_SUBST(USE_SHORT_LIBNAME)
5473AC_SUBST(IMPLIB)
5474AC_SUBST(FILTER)
5475AC_SUBST(BIN_FLAGS)
5476AC_SUBST(NS_USE_NATIVE)
5477AC_SUBST(MOZ_WIDGET_TOOLKIT)
5478AC_SUBST(MOZ_WIDGET_TOOLKIT_LDFLAGS)
5479AC_SUBST(WIDGET_DLL)
5480AC_SUBST(GFXWIN_DLL)
5481AC_SUBST(MOZ_GFX_TOOLKIT)
5482AC_SUBST(MOZ_GFX_TOOLKIT_LDFLAGS)
5483AC_SUBST(MOZ_UPDATE_XTERM)
5484AC_SUBST(MINIMO)
5485AC_SUBST(MOZ_MATHML)
5486AC_SUBST(MOZ_SVG)
5487AC_SUBST(MOZ_SVG_RENDERER_GDIPLUS)
5488AC_SUBST(MOZ_SVG_RENDERER_LIBART)
5489AC_SUBST(TX_EXE)
5490AC_SUBST(MOZ_JS_LIBS)
5491AC_SUBST(MOZ_PSM)
5492AC_SUBST(BUILD_MODULES)
5493AC_SUBST(MOZ_DEBUG)
5494AC_SUBST(MOZ_DEBUG_MODULES)
5495AC_SUBST(MOZ_PROFILE_MODULES)
5496AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
5497AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
5498AC_SUBST(MOZ_DEBUG_FLAGS)
5499AC_SUBST(MOZ_DEBUG_LDFLAGS)
5500AC_SUBST(MOZ_DBGRINFO_MODULES)
5501AC_SUBST(MOZ_EXTENSIONS)
5502AC_SUBST(MOZ_IMG_DECODERS)
5503AC_SUBST(MOZ_JSDEBUGGER)
5504AC_SUBST(MOZ_OJI)
5505AC_SUBST(MOZ_PLUGINS)
5506AC_SUBST(ENABLE_EAZEL_PROFILER)
5507AC_SUBST(EAZEL_PROFILER_CFLAGS)
5508AC_SUBST(EAZEL_PROFILER_LIBS)
5509AC_SUBST(XPCOM_GLUE_LIBS)
5510AC_SUBST(MOZ_PERF_METRICS)
5511AC_SUBST(GC_LEAK_DETECTOR)
5512AC_SUBST(MOZ_LOG_REFCNT)
5513AC_SUBST(MOZ_LEAKY)
5514AC_SUBST(MOZ_JPROF)
5515AC_SUBST(MOZ_XPCTOOLS)
5516AC_SUBST(MOZ_JSLOADER)
5517AC_SUBST(MOZ_USE_NATIVE_UCONV)
5518AC_SUBST(MOZ_INSURE)
5519AC_SUBST(MOZ_INSURE_DIRS)
5520AC_SUBST(MOZ_INSURE_EXCLUDE_DIRS)
5521AC_SUBST(MOZ_QUANTIFY)
5522AC_SUBST(MOZ_INSURIFYING)
5523AC_SUBST(MOZ_LDAP_XPCOM)
5524AC_SUBST(MOZ_LDAP_XPCOM_EXPERIMENTAL)
5525AC_SUBST(LDAP_CFLAGS)
5526AC_SUBST(LDAP_LIBS)
5527AC_SUBST(LIBICONV)
5528
5529AC_SUBST(MOZ_PROFILESHARING)
5530AC_SUBST(MOZ_PROFILELOCKING)
5531
5532AC_SUBST(MOZ_IPCD)
5533
5534AC_SUBST(HAVE_XIE)
5535AC_SUBST(MOZ_XIE_LIBS)
5536AC_SUBST(MOZ_XPRINT_CFLAGS)
5537AC_SUBST(MOZ_XPRINT_LDFLAGS)
5538AC_SUBST(MOZ_ENABLE_XPRINT)
5539AC_SUBST(MOZ_ENABLE_POSTSCRIPT)
5540AC_SUBST(MOZ_XINERAMA_LIBS)
5541AC_SUBST(MOZ_ENABLE_XINERAMA)
5542
5543AC_SUBST(XPCOM_USE_LEA)
5544AC_SUBST(BUILD_SHARED_LIBS)
5545AC_SUBST(BUILD_STATIC_LIBS)
5546AC_SUBST(MOZ_STATIC_COMPONENT_LOADER)
5547AC_SUBST(MOZ_STATIC_COMPONENT_LIBS)
5548AC_SUBST(MOZ_STATIC_COMPONENTS)
5549AC_SUBST(MOZ_META_COMPONENTS)
5550AC_SUBST(ENABLE_TESTS)
5551AC_SUBST(IBMBIDI)
5552AC_SUBST(SUNCTL)
5553AC_SUBST(ACCESSIBILITY)
5554AC_SUBST(MOZ_XPINSTALL)
5555AC_SUBST(MOZ_VIEW_SOURCE)
5556AC_SUBST(MOZ_SINGLE_PROFILE)
5557AC_SUBST(MOZ_XPFE_COMPONENTS)
5558AC_SUBST(MOZ_USER_DIR)
5559
5560AC_SUBST(ENABLE_STRIP)
5561AC_SUBST(USE_ELF_DYNSTR_GC)
5562AC_SUBST(USE_PREBINDING)
5563AC_SUBST(INCREMENTAL_LINKER)
5564AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
5565AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
5566AC_SUBST(MOZ_COMPONENT_XPCOM_LIBS)
5567AC_SUBST(MOZ_XPCOM_OBSOLETE_LIBS)
5568AC_SUBST(XPCOM_LIBS)
5569AC_SUBST(USE_DEPENDENT_LIBS)
5570
5571AC_SUBST(MOZ_BUILD_ROOT)
5572AC_SUBST(MOZ_OS2_TOOLS)
5573AC_SUBST(MOZ_OS2_EMX_OBJECTFORMAT)
5574
5575AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
5576AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
5577AC_SUBST(MOZ_REORDER)
5578AC_SUBST(MOZ_TIMELINE)
5579
5580AC_SUBST(MOZ_APP_NAME)
5581AC_SUBST(MOZ_APP_VERSION)
5582AC_SUBST(MOZ_APP_DISPLAYNAME)
5583
5584dnl win32 options
5585AC_SUBST(MOZ_PROFILE)
5586AC_SUBST(MOZ_DEBUG_SYMBOLS)
5587AC_SUBST(MOZ_COVERAGE)
5588AC_SUBST(MOZ_MAPINFO)
5589AC_SUBST(MOZ_BROWSE_INFO)
5590AC_SUBST(MOZ_TOOLS_DIR)
5591AC_SUBST(CYGWIN_WRAPPER)
5592
5593dnl Disable profile at startup, hack for tinderbox.
5594if test "$MOZ_BYPASS_PROFILE_AT_STARTUP"; then
5595  AC_DEFINE(MOZ_BYPASS_PROFILE_AT_STARTUP)
5596fi
5597
5598dnl Echo the CFLAGS to remove extra whitespace.
5599CFLAGS=`echo \
5600        $_WARNINGS_CFLAGS \
5601        $CFLAGS`
5602
5603CXXFLAGS=`echo \
5604        $_MOZ_RTTI_FLAGS \
5605        $_MOZ_EXCEPTIONS_FLAGS \
5606        $_WARNINGS_CXXFLAGS \
5607        $CXXFLAGS`
5608
5609COMPILE_CFLAGS=`echo \
5610    $_DEFINES_CFLAGS \
5611        $_DEPEND_CFLAGS \
5612    $COMPILE_CFLAGS`
5613
5614COMPILE_CXXFLAGS=`echo \
5615    $_DEFINES_CXXFLAGS \
5616        $_DEPEND_CFLAGS \
5617    $COMPILE_CXXFLAGS`
5618
5619dnl
5620dnl It is perfectly legal to build with both -O and -g even though
5621dnl some compilers/platforms might not support this.
5622dnl
5623
5624dnl # Clean out '-O' flags if doing a debug build.
5625dnl if test "$MOZ_DEBUG"
5626dnl then
5627dnl   changequote(,)dnl
5628dnl   CFLAGS=`  echo $CFLAGS   | sed 's/ *-O[^ ]*//g;'`
5629dnl   CXXFLAGS=`echo $CXXFLAGS | sed 's/ *-O[^ ]*//g;'`
5630dnl   LDFLAGS=`echo  $LDFLAGS  | sed 's/ *-O[^ ]*//g;'`
5631dnl   changequote([,])dnl
5632dnl fi
5633
5634AC_SUBST(SYSTEM_MAKEDEPEND)
5635AC_SUBST(SYSTEM_JPEG)
5636AC_SUBST(SYSTEM_PNG)
5637AC_SUBST(SYSTEM_ZLIB)
5638
5639AC_SUBST(JPEG_CFLAGS)
5640AC_SUBST(JPEG_LIBS)
5641AC_SUBST(ZLIB_CFLAGS)
5642AC_SUBST(ZLIB_LIBS)
5643AC_SUBST(PNG_CFLAGS)
5644AC_SUBST(PNG_LIBS)
5645
5646AC_SUBST(MOZ_JPEG_CFLAGS)
5647AC_SUBST(MOZ_JPEG_LIBS)
5648AC_SUBST(MOZ_ZLIB_CFLAGS)
5649AC_SUBST(MOZ_ZLIB_LIBS)
5650AC_SUBST(MOZ_PNG_CFLAGS)
5651AC_SUBST(MOZ_PNG_LIBS)
5652
5653AC_SUBST(NSPR_CFLAGS)
5654AC_SUBST(NSPR_LIBS)
5655AC_SUBST(MOZ_NATIVE_NSPR)
5656
5657AC_SUBST(CFLAGS)
5658AC_SUBST(CXXFLAGS)
5659AC_SUBST(CPPFLAGS)
5660AC_SUBST(COMPILE_CFLAGS)
5661AC_SUBST(COMPILE_CXXFLAGS)
5662AC_SUBST(LDFLAGS)
5663AC_SUBST(LIBS)
5664AC_SUBST(CROSS_COMPILE)
5665
5666AC_SUBST(HOST_CC)
5667AC_SUBST(HOST_CXX)
5668AC_SUBST(HOST_CFLAGS)
5669AC_SUBST(HOST_CXXFLAGS)
5670AC_SUBST(HOST_OPTIMIZE_FLAGS)
5671AC_SUBST(HOST_AR)
5672AC_SUBST(HOST_LD)
5673AC_SUBST(HOST_RANLIB)
5674AC_SUBST(HOST_NSPR_MDCPUCFG)
5675AC_SUBST(HOST_BIN_SUFFIX)
5676
5677AC_SUBST(TARGET_CPU)
5678AC_SUBST(TARGET_VENDOR)
5679AC_SUBST(TARGET_OS)
5680AC_SUBST(TARGET_NSPR_MDCPUCFG)
5681AC_SUBST(TARGET_MD_ARCH)
5682AC_SUBST(OS_TARGET)
5683AC_SUBST(OS_ARCH)
5684AC_SUBST(OS_RELEASE)
5685AC_SUBST(OS_TEST)
5686
5687AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
5688AC_SUBST(MOZ_CHROME_FILE_FORMAT)
5689
5690AC_SUBST(WRAP_MALLOC_CFLAGS)
5691AC_SUBST(WRAP_MALLOC_LIB)
5692AC_SUBST(MKSHLIB)
5693AC_SUBST(MKCSHLIB)
5694AC_SUBST(MKSHLIB_FORCE_ALL)
5695AC_SUBST(MKSHLIB_UNFORCE_ALL)
5696AC_SUBST(DSO_CFLAGS)
5697AC_SUBST(DSO_PIC_CFLAGS)
5698AC_SUBST(DSO_LDOPTS)
5699AC_SUBST(LIB_PREFIX)
5700AC_SUBST(DLL_PREFIX)
5701AC_SUBST(DLL_SUFFIX)
5702AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
5703AC_SUBST(LIB_SUFFIX)
5704AC_SUBST(OBJ_SUFFIX)
5705AC_SUBST(BIN_SUFFIX)
5706AC_SUBST(ASM_SUFFIX)
5707AC_SUBST(IMPORT_LIB_SUFFIX)
5708AC_SUBST(USE_N32)
5709AC_SUBST(CC_VERSION)
5710AC_SUBST(CXX_VERSION)
5711
5712if test "$USING_HCC"; then
5713   CC='${topsrcdir}/build/hcc'
5714   CC="$CC '$_OLDCC'"
5715   CXX='${topsrcdir}/build/hcpp'
5716   CXX="$CXX '$_OLDCXX'"
5717   AC_SUBST(CC)
5718   AC_SUBST(CXX)
5719fi
5720
5721dnl Check for missing components
5722if test -n "$MOZ_X11"; then
5723    dnl ====================================================
5724    dnl = Check if X headers exist
5725    dnl ====================================================
5726    _SAVE_CFLAGS=$CFLAGS
5727    CFLAGS="$CFLAGS $XCFLAGS"
5728    AC_TRY_COMPILE([
5729        #include <stdio.h>
5730        #include <X11/Xlib.h>
5731    ],
5732    [
5733        Display *dpy = 0;
5734        if ((dpy = XOpenDisplay(NULL)) == NULL) {
5735            fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
5736            exit(1);
5737        }
5738    ], [],
5739    [ AC_MSG_ERROR([Could not compile basic X program.]) ])
5740    CFLAGS="$_SAVE_CFLAGS"
5741
5742    if test ! -z "$MISSING_X"; then
5743        AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
5744    fi
5745
5746fi # MOZ_X11
5747
5748dnl Set various defines and substitutions
5749dnl ========================================================
5750
5751if test "$OS_ARCH" = "OS2" -a "$VACPP" = "yes"; then
5752      LIBS='so32dll.lib tcp32dll.lib'
5753elif test "$OS_ARCH" = "BeOS"; then
5754  AC_DEFINE(XP_BEOS)
5755  MOZ_MOVEMAIL=1
5756elif test "$OS_ARCH" = "Darwin"; then
5757  AC_DEFINE(XP_UNIX)
5758  AC_DEFINE(UNIX_ASYNC_DNS)
5759elif test "$OS_ARCH" = "OpenVMS"; then
5760  AC_DEFINE(XP_UNIX)
5761elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2"; then
5762  AC_DEFINE(XP_UNIX)
5763  AC_DEFINE(UNIX_ASYNC_DNS)
5764  MOZ_MOVEMAIL=1
5765fi
5766AC_SUBST(MOZ_MOVEMAIL)
5767
5768AC_DEFINE(JS_THREADSAFE)
5769AC_DEFINE(NS_PRINT_PREVIEW)
5770AC_DEFINE(NS_PRINTING)
5771
5772if test "$MOZ_DEBUG"; then
5773    AC_DEFINE(MOZ_REFLOW_PERF)
5774    AC_DEFINE(MOZ_REFLOW_PERF_DSP)
5775fi
5776
5777if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
5778    AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
5779fi
5780
5781# Used for LD_LIBRARY_PATH of run_viewer target
5782LIBS_PATH=
5783for lib_arg in $NSPR_LIBS $TK_LIBS; do
5784  case $lib_arg in
5785    -L* ) LIBS_PATH="${LIBS_PATH:+$LIBS_PATH:}"`expr $lib_arg : "-L\(.*\)"` ;;
5786      * ) ;;
5787  esac
5788done
5789AC_SUBST(LIBS_PATH)
5790
5791dnl ========================================================
5792dnl Use cygwin wrapper for win32 builds
5793dnl ========================================================
5794case "$host_os" in
5795mingw*|cygwin*|msvc*|mks*)
5796    HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
5797    HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
5798    CC="\$(CYGWIN_WRAPPER) $CC"
5799    CXX="\$(CYGWIN_WRAPPER) $CXX"
5800    CPP="\$(CYGWIN_WRAPPER) $CPP"
5801    LD="\$(CYGWIN_WRAPPER) $LD"
5802    AS="\$(CYGWIN_WRAPPER) $AS"
5803    RC="\$(CYGWIN_WRAPPER) $RC"
5804    MIDL="\$(CYGWIN_WRAPPER) $MIDL"
5805    CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
5806    ;;
5807esac
5808
5809AC_SUBST(CYGDRIVE_MOUNT)
5810
5811AC_SUBST(MOZILLA_VERSION)
5812
5813. ${srcdir}/config/chrome-versions.sh
5814AC_SUBST(MOZILLA_LOCALE_VERSION)
5815AC_SUBST(MOZILLA_REGION_VERSION)
5816AC_DEFINE_UNQUOTED(MOZILLA_LOCALE_VERSION,"$MOZILLA_LOCALE_VERSION")
5817AC_DEFINE_UNQUOTED(MOZILLA_REGION_VERSION,"$MOZILLA_REGION_VERSION")
5818AC_DEFINE_UNQUOTED(MOZILLA_SKIN_VERSION,"$MOZILLA_SKIN_VERSION")
5819
5820AC_SUBST(ac_configure_args)
5821
5822dnl Spit out some output
5823dnl ========================================================
5824
5825dnl The following defines are used by xpcom
5826_NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
5827CPP_THROW_NEW
5828HAVE_CPP_2BYTE_WCHAR_T
5829HAVE_CPP_ACCESS_CHANGING_USING
5830HAVE_CPP_AMBIGUITY_RESOLVING_USING
5831HAVE_CPP_BOOL
5832HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
5833HAVE_CPP_EXPLICIT
5834HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
5835HAVE_CPP_NAMESPACE_STD
5836HAVE_CPP_NEW_CASTS
5837HAVE_CPP_PARTIAL_SPECIALIZATION
5838HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
5839HAVE_CPP_TYPENAME
5840HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
5841HAVE_STATVFS
5842NEED_CPP_UNUSED_IMPLEMENTATIONS
5843NEW_H
5844HAVE_GETPAGESIZE
5845HAVE_ICONV
5846HAVE_ICONV_WITH_CONST_INPUT
5847HAVE_MBRTOWC
5848HAVE_SYS_MOUNT_H
5849HAVE_SYS_VFS_H
5850HAVE_WCRTOMB
5851ENABLE_STATIC_COMPONENT_LOADER
5852"
5853
5854AC_CONFIG_HEADER(
5855gfx/gfx-config.h
5856netwerk/necko-config.h
5857xpcom/xpcom-config.h
5858xpcom/xpcom-private.h
5859)
5860
5861# Save the defines header file before autoconf removes it.
5862# (Do not add AC_DEFINE calls after this line.)
5863  _CONFIG_TMP=confdefs-tmp.h
5864  _CONFIG_DEFS_H=mozilla-config.h
5865
5866  cat > $_CONFIG_TMP <<\EOF
5867/* List of defines generated by configure. Included with preprocessor flag,
5868 * -include, to avoid long list of -D defines on the compile command-line.
5869 * Do not edit.
5870 */
5871
5872#ifndef _MOZILLA_CONFIG_H_
5873#define _MOZILLA_CONFIG_H_
5874EOF
5875
5876_EGREP_PATTERN='^#define ('
5877if test -n "$_NON_GLOBAL_ACDEFINES"; then
5878    for f in $_NON_GLOBAL_ACDEFINES; do
5879        _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
5880    done
5881fi
5882_EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
5883 
5884  sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
5885
5886  cat >> $_CONFIG_TMP <<\EOF
5887
5888#endif /* _MOZILLA_CONFIG_H_ */
5889
5890EOF
5891
5892  # Only write mozilla-config.h when something changes (or it doesn't exist)
5893  if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
5894    rm $_CONFIG_TMP
5895  else
5896    AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
5897    mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
5898
5899    echo ==== $_CONFIG_DEFS_H =================================
5900    cat $_CONFIG_DEFS_H
5901  fi
5902
5903dnl Probably shouldn't call this manually but we always want the output of DEFS
5904rm -f confdefs.h.save
5905mv confdefs.h confdefs.h.save
5906egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
5907AC_OUTPUT_MAKE_DEFS()
5908MOZ_DEFINES=$DEFS
5909AC_SUBST(MOZ_DEFINES)
5910rm -f confdefs.h
5911mv confdefs.h.save confdefs.h
5912
5913dnl Load the list of Makefiles to generate.
5914dnl   To add new Makefiles, edit allmakefiles.sh.
5915dnl   allmakefiles.sh sets the variable, MAKEFILES.
5916. ${srcdir}/allmakefiles.sh
5917dnl
5918dnl Run a perl script to quickly create the makefiles.
5919dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
5920dnl   for the files it cannot handle correctly. This way, config.status
5921dnl   will handle these files.
5922dnl If it fails, nothing is set and config.status will run as usual.
5923dnl
5924dnl This does not change the $MAKEFILES variable.
5925dnl
5926dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
5927dnl
5928if test -z "${_AS_PERL}"; then
5929echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
5930else
5931echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
5932fi
5933. ./conftest.sh
5934rm conftest.sh
5935
5936echo $MAKEFILES > unallmakefiles
5937
5938AC_OUTPUT($MAKEFILES)
5939
5940dnl ========================================================
5941dnl = Setup a nice relatively clean build environment for
5942dnl = sub-configures.
5943dnl ========================================================
5944CC="$_SUBDIR_CC"
5945CXX="$_SUBDIR_CXX"
5946CFLAGS="$_SUBDIR_CFLAGS"
5947CPPFLAGS="$_SUBDIR_CPPFLAGS"
5948CXXFLAGS="$_SUBDIR_CXXFLAGS"
5949LDFLAGS="$_SUBDIR_LDFLAGS"
5950HOST_CC="$_SUBDIR_HOST_CC"
5951HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
5952HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
5953RC=
5954
5955unset MAKEFILES
5956unset CONFIG_FILES
5957
5958if test -z "$MOZ_NATIVE_NSPR" || test "$MOZ_LDAP_XPCOM"; then
5959    ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
5960    if test "$OS_ARCH" = "WINNT" && test "$NS_TRACE_MALLOC"; then
5961       ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
5962    fi
5963    if test -n "$HAVE_64BIT_OS"; then
5964        ac_configure_args="$ac_configure_args --enable-64bit"
5965    fi
5966    AC_OUTPUT_SUBDIRS(nsprpub)
5967    ac_configure_args="$_SUBDIR_CONFIG_ARGS"
5968fi
5969
5970if test -z "$MOZ_NATIVE_NSPR"; then
5971    # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
5972    AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
5973    if test ! "$VACPP" && test "$OS_ARCH" != "WINNT"; then
5974        NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$MOZ_BUILD_ROOT/dist --exec-prefix=$MOZ_BUILD_ROOT/dist --libs`
5975        $PERL -pi.bak -e "s {^NSPR_LIBS\s*=.*} {NSPR_LIBS = $NSPR_LIBS }" config/autoconf.mk
5976    fi
5977    if test "$OS_ARCH" != "WINNT"; then
5978        NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$MOZ_BUILD_ROOT/dist --exec-prefix=$MOZ_BUILD_ROOT/dist --cflags`
5979        $PERL -pi.bak -e "s {^NSPR_CFLAGS\s*=.*} {NSPR_CFLAGS = $NSPR_CFLAGS }" config/autoconf.mk
5980    fi
5981    rm -f config/autoconf.mk.bak
5982fi
5983
5984# if we're building the LDAP XPCOM component, we need to build
5985# the c-sdk first. 
5986#
5987if test "$MOZ_LDAP_XPCOM"; then
5988
5989    # these subdirs may not yet have been created in the build tree.
5990    # don't use the "-p" switch to mkdir, since not all platforms have it
5991    #
5992    if test ! -d "directory"; then
5993        mkdir "directory"
5994    fi
5995    if test ! -d "directory/c-sdk"; then
5996        mkdir "directory/c-sdk"   
5997    fi
5998    if test ! -d "directory/c-sdk/ldap"; then
5999        mkdir "directory/c-sdk/ldap"   
6000    fi
6001
6002    ac_configure_args="$_SUBDIR_CONFIG_ARGS --prefix=$MOZ_BUILD_ROOT/dist --with-dist-prefix=$MOZ_BUILD_ROOT/dist --without-nss --with-mozilla"
6003    if test -n "$HAVE_64BIT_OS"; then
6004        ac_configure_args="$ac_configure_args --enable-64bit"
6005    fi
6006    AC_OUTPUT_SUBDIRS(directory/c-sdk)
6007    ac_configure_args="$_SUBDIR_CONFIG_ARGS"
6008fi
Note: See TracBrowser for help on using the repository browser.