1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
2 dnl vi: set tabstop=4 shiftwidth=4 expandtab:
3 dnl ***** BEGIN LICENSE BLOCK *****
4 dnl Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 dnl The contents of this file are subject to the Mozilla Public License Version
7 dnl 1.1 (the "License"); you may not use this file except in compliance with
8 dnl the License. You may obtain a copy of the License at
9 dnl http://www.mozilla.org/MPL/
11 dnl Software distributed under the License is distributed on an "AS IS" basis,
12 dnl WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 dnl for the specific language governing rights and limitations under the
16 dnl The Original Code is this file as it was released upon August 6, 1998.
18 dnl The Initial Developer of the Original Code is
19 dnl Christopher Seawood.
20 dnl Portions created by the Initial Developer are Copyright (C) 1998-2001
21 dnl the Initial Developer. All Rights Reserved.
24 dnl Jamie Zawinski <jwz@jwz.org>
25 dnl gettimeofday args check
26 dnl Christopher Blizzard <blizzard@appliedtheory.com>
27 dnl gnomefe update & enable-pthreads
28 dnl Ramiro Estrugo <ramiro@netscape.com>
29 dnl X11 makedepend support
31 dnl Henry Sobotka <sobotka@axess.com>
33 dnl Dan Mosedale <dmose@mozilla.org>
35 dnl Seth Spitzer <sspitzer@netscape.com>
37 dnl Benjamin Smedberg <benjamin@smedbergs.us>
38 dnl Howard Chu <hyc@symas.com>
40 dnl Mark Mentovai <mark@moxienet.com>:
41 dnl Mac OS X 10.4 support
42 dnl Giorgio Maone <g.maone@informaction.com>
43 dnl MSVC l10n compatible version check
44 dnl Ben Turner <mozilla@songbirdnest.com>
46 dnl Alternatively, the contents of this file may be used under the terms of
47 dnl either the GNU General Public License Version 2 or later (the "GPL"), or
48 dnl the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
49 dnl in which case the provisions of the GPL or the LGPL are applicable instead
50 dnl of those above. If you wish to allow use of your version of this file only
51 dnl under the terms of either the GPL or the LGPL, and not to allow others to
52 dnl use your version of this file under the terms of the MPL, indicate your
53 dnl decision by deleting the provisions above and replace them with the notice
54 dnl and other provisions required by the GPL or the LGPL. If you do not delete
55 dnl the provisions above, a recipient may use your version of this file under
56 dnl the terms of any one of the MPL, the GPL or the LGPL.
58 dnl ***** END LICENSE BLOCK *****
60 dnl Process this file with autoconf to produce a configure script.
61 dnl ========================================================
64 AC_INIT(config/config.mk)
65 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
67 TARGET_CPU="${target_cpu}"
68 TARGET_VENDOR="${target_vendor}"
69 TARGET_OS="${target_os}"
72 MOZ_DEB_TIMESTAMP=`date +"%a, %d %b %Y %T %z" 2>&1`
73 AC_SUBST(MOZ_DEB_TIMESTAMP)
76 dnl ========================================================
78 dnl = Don't change the following two lines. Doing so breaks:
80 dnl = CFLAGS="-foo" ./configure
82 dnl ========================================================
84 CPPFLAGS="${CPPFLAGS=}"
85 CXXFLAGS="${CXXFLAGS=}"
87 HOST_CFLAGS="${HOST_CFLAGS=}"
88 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
89 HOST_LDFLAGS="${HOST_LDFLAGS=}"
91 dnl ========================================================
92 dnl = Preserve certain environment flags passed to configure
93 dnl = We want sub projects to receive the same flags
94 dnl = untainted by this configure script
95 dnl ========================================================
98 _SUBDIR_CFLAGS="$CFLAGS"
99 _SUBDIR_CPPFLAGS="$CPPFLAGS"
100 _SUBDIR_CXXFLAGS="$CXXFLAGS"
101 _SUBDIR_LDFLAGS="$LDFLAGS"
102 _SUBDIR_HOST_CC="$HOST_CC"
103 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
104 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
105 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
106 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
108 dnl Set the version number of the libs included with mozilla
109 dnl ========================================================
116 dnl Set the minimum version of toolkit libs used by mozilla
117 dnl ========================================================
125 WINDRES_VERSION=2.14.90
128 GNOMEUI_VERSION=2.2.0
131 STARTUP_NOTIFICATION_VERSION=0.8
135 LIBNOTIFY_VERSION=0.4
139 dnl Set various checks
140 dnl ========================================================
144 dnl Initialize the Pthread test variables early so they can be
145 dnl overridden by each platform.
146 dnl ========================================================
150 dnl Do not allow a separate objdir build if a srcdir build exists.
151 dnl ==============================================================
152 _topsrcdir=`cd \`dirname $0\`; pwd`
155 if test "$_topsrcdir" != "$_objdir"
157 # Check for a couple representative files in the source tree
159 for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
160 if test -f $file; then
161 _conflict_files="$_conflict_files $file"
164 if test "$_conflict_files"; then
166 echo "* Your source tree contains these files:"
167 for file in $_conflict_files; do
171 * This indicates that you previously built in the source tree.
172 * A source tree build can confuse the separate objdir build.
174 * To clean up the source tree:
185 dnl Default to MSVC for win32
186 dnl ==============================================================
187 if test -z "$CROSS_COMPILE"; then
189 *-cygwin*|*-mingw*|*-msvc*|*-mks*)
191 if test -z "$CC"; then CC=cl; fi
192 if test -z "$CXX"; then CXX=cl; fi
193 if test -z "$CPP"; then CPP="cl -E -nologo"; fi
194 if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
195 if test -z "$LD"; then LD=link; fi
196 if test -z "$AS"; then AS=ml; fi
197 if test -z "$MIDL"; then MIDL=midl; fi
202 COMPILE_ENVIRONMENT=1
203 MOZ_ARG_ENABLE_BOOL(compile-environment,
204 [ --disable-compile-environment
205 Disable compiler/library checks.],
206 COMPILE_ENVIRONMENT=1,
207 COMPILE_ENVIRONMENT= )
209 MOZ_ARG_WITH_STRING(l10n-base,
210 [ --with-l10n-base=DIR path to l10n repositories],
211 L10NBASEDIR=$withval)
212 if test ! -z "$L10NBASEDIR"; then
213 if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
214 AC_MSG_ERROR([--with-l10n-base must specify a path])
215 elif test -d "$L10NBASEDIR"; then
216 L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
218 AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
221 AC_SUBST(L10NBASEDIR)
223 dnl ========================================================
224 dnl Checks for compilers.
225 dnl ========================================================
226 dnl Set CROSS_COMPILE in the environment when running configure
227 dnl to use the cross-compile setup for now
228 dnl ========================================================
230 if test "$COMPILE_ENVIRONMENT"; then
232 dnl Do some special WinCE toolchain stuff
236 MOZ_ARG_WITH_STRING(wince-sdk,
237 [ --with-wince-sdk=WINCE_SDK_DIR
238 The path to the windows mobile sdk],
239 WINCE_SDK_DIR=$withval)
243 echo -----------------------------------------------------------------------------
244 echo Building Windows CE Shunt Library and Tool Chain
252 make WINCE_SDK_DIR="$WINCE_SDK_DIR" TOPSRCDIR="$srcdir" OBJDIR="$_pwdw" -C $srcdir/build/wince/tools
254 CC="$_pwd/dist/sdk/bin/arm-wince-gcc"
255 CXX="$_pwd/dist/sdk/bin/arm-wince-gcc"
256 CPP="$_pwd/dist/sdk/bin/arm-wince-gcc"
257 LD="$_pwd/dist/sdk/bin/arm-wince-link"
258 AR="$_pwd/dist/sdk/bin/arm-wince-lib"
259 AS="$_pwd/dist/sdk/bin/arm-wince-as"
260 RC="$_pwd/dist/sdk/bin/arm-wince-res"
263 echo -----------------------------------------------------------------------------
268 if test -n "$CROSS_COMPILE" && test "$target" != "$host"; then
269 echo "cross compiling from $host to $target"
273 _SAVE_CFLAGS="$CFLAGS"
274 _SAVE_LDFLAGS="$LDFLAGS"
276 AC_MSG_CHECKING([for host c compiler])
277 AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
278 if test -z "$HOST_CC"; then
279 AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
281 AC_MSG_RESULT([$HOST_CC])
282 AC_MSG_CHECKING([for host c++ compiler])
283 AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
284 if test -z "$HOST_CXX"; then
285 AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
287 AC_MSG_RESULT([$HOST_CXX])
289 if test -z "$HOST_CFLAGS"; then
290 HOST_CFLAGS="$CFLAGS"
292 if test -z "$HOST_CXXFLAGS"; then
293 HOST_CXXFLAGS="$CXXFLAGS"
295 if test -z "$HOST_LDFLAGS"; then
296 HOST_LDFLAGS="$LDFLAGS"
298 AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
299 AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
301 CFLAGS="$HOST_CFLAGS"
302 LDFLAGS="$HOST_LDFLAGS"
304 AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
305 AC_TRY_COMPILE([], [return(0);],
306 [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
307 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
310 CFLAGS="$HOST_CXXFLAGS"
312 AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
313 AC_TRY_COMPILE([], [return(0);],
314 [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
315 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
319 LDFLAGS=$_SAVE_LDFLAGS
321 case "$build:$target" in
322 powerpc-apple-darwin8*:i?86-apple-darwin*)
323 dnl The Darwin cross compiler doesn't necessarily point itself at a
324 dnl root that has libraries for the proper architecture, it defaults
325 dnl to the system root. The libraries in the system root on current
326 dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
327 dnl checks will fail. Fake a working SDK in that case.
329 _SAVE_CXXFLAGS=$CXXLAGS
330 CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CFLAGS"
331 CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CXXFLAGS"
335 AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
338 AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
342 case "$build:$target" in
343 powerpc-apple-darwin8*:i?86-apple-darwin*)
344 dnl Revert the changes made above. From this point on, the target
345 dnl compiler will never be used without applying the SDK to CFLAGS
346 dnl (see --with-macos-sdk below).
348 CXXFLAGS=$_SAVE_CXXFLAGS
352 AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
353 AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
354 AC_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
355 AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
356 AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
357 AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
358 AC_DEFINE(CROSS_COMPILE)
363 AC_PATH_PROGS(AS, $AS as, $CC)
364 AC_CHECK_PROGS(AR, ar, :)
365 AC_CHECK_PROGS(LD, ld, :)
366 AC_CHECK_PROGS(STRIP, strip, :)
367 AC_CHECK_PROGS(WINDRES, windres, :)
368 if test -z "$HOST_CC"; then
371 if test -z "$HOST_CFLAGS"; then
372 HOST_CFLAGS="$CFLAGS"
374 if test -z "$HOST_CXX"; then
377 if test -z "$HOST_CXXFLAGS"; then
378 HOST_CXXFLAGS="$CXXFLAGS"
380 if test -z "$HOST_LDFLAGS"; then
381 HOST_LDFLAGS="$LDFLAGS"
383 if test -z "$HOST_RANLIB"; then
384 HOST_RANLIB="$RANLIB"
386 if test -z "$HOST_AR"; then
397 if test "$GCC" = "yes"; then
399 CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
401 if test "$GXX" = "yes"; then
403 CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
405 if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
408 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
411 if test "$GNU_CC"; then
412 if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
419 if test "$GCC" = yes; then
420 if test "`$CC -help 2>&1 | grep -c 'Intel(R) C Compiler'`" != "0"; then
425 if test "$GXX" = yes; then
426 if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
431 dnl Special win32 checks
432 dnl ========================================================
438 if test -n "$GNU_CC"; then
446 MOZ_ARG_WITH_STRING(windows-version,
447 [ --with-windows-version=WINVER
448 Minimum Windows version (WINVER) to support
459 AC_MSG_ERROR([Invalid value --with-windows-version, must be 400, 500 or 501]);
465 *-cygwin*|*-mingw*|*-msvc*|*-mks*|*-wince)
466 if test "$GCC" != "yes"; then
467 # Check to see if we are really running in a msvc environemnt
469 AC_CHECK_PROGS(MIDL, midl)
471 # Make sure compilers are valid
472 CFLAGS="$CFLAGS -TC -nologo"
473 CXXFLAGS="$CXXFLAGS -TP -nologo"
476 AC_TRY_COMPILE([#include <stdio.h>],
477 [ printf("Hello World\n"); ],,
478 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
481 AC_TRY_COMPILE([#include <new.h>],
482 [ unsigned *test = new unsigned(42); ],,
483 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
487 _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
490 # Determine compiler version
491 CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
492 _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
493 _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
494 _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
495 _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
496 _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
498 CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
499 _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
501 if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
502 AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
504 if test "$_CC_MAJOR_VERSION" = "12"; then
506 elif test "$_CC_MAJOR_VERSION" = "13"; then
508 elif test "$_CC_MAJOR_VERSION" = "14"; then
510 CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
511 dnl -DYNAMICBASE is only supported on VC8SP1 or newer,
512 dnl so be very specific here!
513 dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762
514 if test $_CC_RELEASE -gt 50727; then
516 elif test $_CC_BUILD -ge 762; then
519 AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
520 AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
521 elif test "$_CC_MAJOR_VERSION" = "15"; then
523 CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
524 LDFLAGS="$LDFLAGS -MANIFESTUAC:NO"
526 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
527 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
529 AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
532 _MOZ_RTTI_FLAGS_ON='-GR'
533 _MOZ_RTTI_FLAGS_OFF='-GR-'
534 _MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
535 _MOZ_EXCEPTIONS_FLAGS_OFF=''
537 if test -n "$WIN32_REDIST_DIR"; then
538 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
542 # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
543 if test "$_CC_SUITE" -ge "8"; then
545 _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
548 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
549 if test -n "$MSMT_TOOL"; then
550 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
551 if test -z "$MSMANIFEST_TOOL_VERSION"; then
552 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
557 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
561 # Check linker version
562 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
563 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
564 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
565 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
570 _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
571 _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
572 _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
573 _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
574 # Add flags if necessary
575 AC_MSG_CHECKING([for midl flags])
578 if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
579 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
580 # MIDL version 7.00.0500 or later has no problem.
581 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
582 AC_MSG_RESULT([need -env win32])
584 AC_MSG_RESULT([none needed])
588 AC_MSG_RESULT([none needed])
592 unset _MSVC_VER_FILTER
595 # Check w32api version
596 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
597 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
598 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
599 AC_TRY_COMPILE([#include <w32api.h>],
600 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
601 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
602 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
603 #error "test failed."
605 , [ res=yes ], [ res=no ])
606 AC_MSG_RESULT([$res])
607 if test "$res" != "yes"; then
608 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
610 # Check windres version
611 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
612 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
613 AC_MSG_RESULT([$_WINDRES_VERSION])
614 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
615 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
616 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
617 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
618 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
619 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
620 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
621 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
622 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
623 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
624 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
625 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
627 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
631 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
632 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
633 # Require OS features provided by IE 5.0
634 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
638 dnl Test breaks icc on OS/2 && MSVC
639 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
641 if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
645 CC="${srcdir}/build/hcc '$CC'"
646 CXX="${srcdir}/build/hcpp '$CXX'"
653 if test -n "$_WIN32_MSVC"; then
655 SKIP_COMPILER_CHECKS=1
656 SKIP_LIBRARY_CHECKS=1
658 # Since we're skipping compiler and library checks, hard-code
665 AC_DEFINE(HAVE_SETBUF)
666 AC_DEFINE(HAVE_ISATTY)
671 fi # COMPILE_ENVIRONMENT
683 dnl ========================================================
684 dnl Checks for programs.
685 dnl ========================================================
688 AC_PATH_PROGS(PERL, $PERL perl5 perl )
689 if test -z "$PERL" || test "$PERL" = ":"; then
690 AC_MSG_ERROR([perl not found in \$PATH])
693 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
694 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
695 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
697 AC_MSG_RESULT([$_perl_version])
699 if test "$_perl_res" != 0; then
700 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
704 AC_MSG_CHECKING([for full perl installation])
705 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
707 if test "$_perl_res" != 0; then
709 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
714 AC_PATH_PROGS(PYTHON, $PYTHON python)
715 if test -z "$PYTHON"; then
716 AC_MSG_ERROR([python was not found in \$PATH])
719 AC_PATH_PROGS(NSINSTALL_BIN, nsinstall )
720 if test -z "$COMPILE_ENVIRONMENT"; then
721 if test -z "$NSINSTALL_BIN" || test "$NSINSTALL_BIN" = ":"; then
722 NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
725 AC_SUBST(NSINSTALL_BIN)
727 AC_PATH_PROG(DOXYGEN, doxygen, :)
728 AC_PATH_PROG(WHOAMI, whoami, :)
729 AC_PATH_PROG(AUTOCONF, autoconf, :)
730 AC_PATH_PROG(UNZIP, unzip, :)
731 AC_PATH_PROGS(ZIP, zip)
732 if test -z "$ZIP" || test "$ZIP" = ":"; then
733 AC_MSG_ERROR([zip not found in \$PATH])
735 AC_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
736 AC_PATH_PROG(XARGS, xargs)
737 if test -z "$XARGS" || test "$XARGS" = ":"; then
738 AC_MSG_ERROR([xargs not found in \$PATH .])
741 if test "$COMPILE_ENVIRONMENT"; then
743 dnl ========================================================
744 dnl = Mac OS X toolchain support
745 dnl ========================================================
749 dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
750 dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
751 dnl the environment and includedir purposes (when using an SDK, below),
752 dnl but remember the full version number for the libdir (SDK).
754 GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
755 GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
757 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
758 dnl Bug 280479, but this keeps popping up in bug 292530 too because
759 dnl 4.0.0/4061 is the default compiler in Tiger.
761 GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
763 if test "$GCC_BUILD" = "4061" ; then
764 AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
765 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
766 from building Mozilla. Upgrade to Xcode 2.1 or later.])
770 dnl xcodebuild needs GCC_VERSION defined in the environment, since it
771 dnl doesn't respect the CC/CXX setting. With GCC_VERSION set, it will use
772 dnl /usr/bin/g(cc|++)-$GCC_VERSION.
773 AC_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
778 XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
780 if test -n "$XCODEBUILD_VERSION" && test "$XCODEBUILD_VERSION" -ge 620 ; then
786 dnl sdp was formerly in /Developer/Tools. As of Mac OS X 10.4 (Darwin 8),
787 dnl it has moved into /usr/bin.
788 AC_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
792 AC_SUBST(GCC_VERSION)
793 AC_SUBST(XCODEBUILD_VERSION)
794 AC_SUBST(HAS_XCODE_2_1)
796 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
797 dnl that a universal binary is being produced.
798 AC_SUBST(UNIVERSAL_BINARY)
800 dnl ========================================================
801 dnl Check for MacOS deployment target version
802 dnl ========================================================
804 MOZ_ARG_ENABLE_STRING(macos-target,
805 [ --enable-macos-target=VER (default=10.4)
806 Set the minimum MacOS version needed at runtime],
807 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
811 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
812 dnl Use the specified value
813 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
814 AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
815 elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then
816 dnl No value specified on the command line or in the environment,
817 dnl use the lesser of the application's minimum or the architecture's
819 export MACOSX_DEPLOYMENT_TARGET=10.4
824 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
826 dnl ========================================================
827 dnl = Mac OS X SDK support
828 dnl ========================================================
831 MOZ_ARG_WITH_STRING(macos-sdk,
832 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
833 MACOS_SDK_DIR=$withval)
835 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
836 dnl NEXT_ROOT will be set and exported only if it's needed.
837 AC_SUBST(MACOS_SDK_DIR)
840 if test "$MACOS_SDK_DIR"; then
841 dnl Sync this section with the ones in NSPR and NSS.
842 dnl Changes to the cross environment here need to be accounted for in
843 dnl the libIDL checks (below) and xpidl build.
845 if test ! -d "$MACOS_SDK_DIR"; then
846 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
847 specify a valid SDK. SDKs are installed when the optional cross-development
848 tools are selected during the Xcode/Developer Tools installation.])
851 GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
852 if test "$GCC_VERSION_MAJOR" -lt "4" ; then
853 SDK_C_INCLUDE="-isystem ${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION} -isystem ${MACOS_SDK_DIR}/usr/include -F${MACOS_SDK_DIR}/System/Library/Frameworks"
854 if test -d "${MACOS_SDK_DIR}/Library/Frameworks" ; then
855 SDK_C_INCLUDE="$SDK_C_INCLUDE -F${MACOS_SDK_DIR}/Library/Frameworks"
857 SDK_CXX_INCLUDE="-I${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION}/c++ -I${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION}/c++/ppc-darwin -I${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION}/c++/backward"
859 CFLAGS="$CFLAGS -nostdinc ${SDK_C_INCLUDE}"
860 CXXFLAGS="$CXXFLAGS -nostdinc -nostdinc++ ${SDK_CXX_INCLUDE} ${SDK_C_INCLUDE}"
862 dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
863 CPP="$CPP -nostdinc ${SDK_C_INCLUDE}"
864 CXXCPP="$CXXCPP -nostdinc -nostdinc++ ${SDK_CXX_INCLUDE} ${SDK_C_INCLUDE}"
866 dnl ld support for -syslibroot is compiler-agnostic, but only available
867 dnl on Tiger. Although it's possible to switch on the build host's
868 dnl OS release to use ld -syslibroot when available, ld -syslibroot will
869 dnl cause warnings as long as NEXT_ROOT is set. NEXT_ROOT should be
870 dnl set because both the compiler and linker use it.
871 LIBS="-L${MACOS_SDK_DIR}/usr/lib/gcc/darwin -L${MACOS_SDK_DIR}/usr/lib/gcc/darwin/${GCC_VERSION_FULL} -L${MACOS_SDK_DIR}/usr/lib $LIBS"
872 export NEXT_ROOT=$MACOS_SDK_DIR
874 if test -n "$CROSS_COMPILE" ; then
875 dnl NEXT_ROOT will be in the environment, but it shouldn't be set for
876 dnl the build host. HOST_CXX is presently unused.
877 HOST_CC="NEXT_ROOT= $HOST_CC"
878 HOST_CXX="NEXT_ROOT= $HOST_CXX"
881 dnl gcc >= 4.0 uses different paths than above, but knows how to find
883 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
884 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
886 dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
887 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
888 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
890 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
891 dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
892 dnl that supports -syslibroot. Don't set NEXT_ROOT because it will
893 dnl be ignored and cause warnings when -syslibroot is specified.
894 dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
895 dnl the -isysroot it receives, so this is only needed with 4.0.0.
896 LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
901 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
903 AC_TRY_COMPILE([#include <new>
904 int main() { return 0; }],
908 AC_MSG_RESULT($result)
910 if test "$result" = "no" ; then
911 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
915 fi # COMPILE_ENVIRONMENT
917 dnl Be sure the make we use is GNU make.
918 dnl on win32, gmake.exe is the generally the wrong version
920 cygwin*|mingw*|mks*|msvc*)
921 AC_PATH_PROGS(MAKE, $MAKE make gmake, :)
924 AC_PATH_PROGS(MAKE, $MAKE gmake make, :)
927 _make_try=`$MAKE --version 2>/dev/null | grep GNU`
928 if test ! "$_make_try"
931 echo "*** $MAKE is not GNU Make. You will not be able to build Mozilla without GNU Make."
935 dnl Now exit if version if < MAKE_VERSION
937 echo 'all: ; @echo $(MAKE_VERSION)' > dummy.mk
938 _make_vers=`$MAKE --no-print-directory -f dummy.mk all 2>/dev/null`
940 _MAKE_MAJOR_VERSION=`echo $_make_vers | $AWK -F\. '{ print $1 }'`
941 _MAKE_MINOR_VERSION=`echo $_make_vers | $AWK -F\. '{ print $2 }'`
942 MAKE_MAJOR_VERSION=`echo $MAKE_VERSION | $AWK -F\. '{ print $1 }'`
943 MAKE_MINOR_VERSION=`echo $MAKE_VERSION | $AWK -F\. '{ print $2 }'`
944 if test "$_MAKE_MAJOR_VERSION" -lt "$MAKE_MAJOR_VERSION" || \
945 test "$_MAKE_MAJOR_VERSION" = "$MAKE_MAJOR_VERSION" -a \
946 "$_MAKE_MINOR_VERSION" -lt "$MAKE_MINOR_VERSION"; then
947 AC_MSG_ERROR([GNU Make $MAKE_VERSION or higher is required to build Mozilla.])
951 if test "$COMPILE_ENVIRONMENT"; then
955 dnl Check in X11 include directory too.
956 if test "$no_x" != "yes"; then
957 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
962 fi # COMPILE_ENVIRONMENT
964 dnl ========================================================
965 dnl set the defaults first
966 dnl ========================================================
985 MOZ_USER_DIR=".mozilla"
987 HOST_AR_FLAGS='$(AR_FLAGS)'
990 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)'
992 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
994 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
996 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)'
998 MOZ_JS_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
999 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core'
1000 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1001 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom'
1002 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1003 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1004 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1006 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1007 MOZ_XPCOM_OBSOLETE_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom_compat'
1009 USE_DEPENDENT_LIBS=1
1011 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1012 MOZ_GFX_TOOLKIT='$(MOZ_WIDGET_TOOLKIT)'
1014 MOZ_ENABLE_POSTSCRIPT=1
1016 if test -n "$CROSS_COMPILE"; then
1017 OS_TARGET="${target_os}"
1018 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1020 case "${target_os}" in
1021 linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
1022 kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1023 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
1024 mingw*) OS_ARCH=WINNT ;;
1025 wince*) OS_ARCH=WINCE ;;
1026 darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
1029 OS_TARGET=`uname -s`
1030 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1031 OS_RELEASE=`uname -r`
1034 # Before this used `uname -m` when not cross compiling
1035 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1036 OS_TEST="${target_cpu}"
1040 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1042 #######################################################################
1043 # Master "Core Components" macros for getting the OS target #
1044 #######################################################################
1047 # Note: OS_TARGET should be specified on the command line for gmake.
1048 # When OS_TARGET=WIN95 is specified, then a Windows 95 target is built.
1049 # The difference between the Win95 target and the WinNT target is that
1050 # the WinNT target uses Windows NT specific features not available
1051 # in Windows 95. The Win95 target will run on Windows NT, but (supposedly)
1052 # at lesser performance (the Win95 target uses threads; the WinNT target
1055 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1056 # cross-compilation.
1060 # The following hack allows one to build on a WIN95 machine (as if
1061 # s/he were cross-compiling on a WINNT host for a WIN95 target).
1062 # It also accomodates for MKS's uname.exe. If you never intend
1063 # to do development on a WIN95 machine, you don't need this hack.
1078 CYGWIN_9*|CYGWIN_ME*)
1079 OS_ARCH='CYGWIN_NT-4.0'
1085 # Define and override various archtecture-specific variables, including
1094 case "$HOST_OS_ARCH" in
1095 cygwin*|mingw*|mks*|msvc*)
1114 if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1117 HOST_OS_ARCH=UNIXWARE
1129 HOST_OS_ARCH=OpenVMS
1139 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1143 HOST_OS_ARCH=UNIXWARE
1153 # If uname -s returns "Windows_NT", we assume that we are using
1154 # the uname.exe in MKS toolkit.
1156 # The -r option of MKS uname only returns the major version number.
1157 # So we need to use its -v option to get the minor version number.
1158 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1162 OS_MINOR_RELEASE=`uname -v`
1163 if test "$OS_MINOR_RELEASE" = "00"; then
1166 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1168 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1170 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1171 # the uname.exe in the Cygwin tools.
1172 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1173 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1174 # the uname.exe in the GNU-Win32 tools.
1175 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1176 # the uname.exe in the MSYS tools.
1178 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1183 OS_RELEASE=`uname -v`.`uname -r`
1184 OS_TEST=${target_cpu}
1196 if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1200 OS_RELEASE=`uname -v`
1224 OS_RELEASE=`uname -v`
1230 OS_RELEASE=`uname -v`
1233 if test "$OS_TARGET" != "NTO"; then
1235 OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1244 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1250 OS_RELEASE=`uname -v`
1257 case "${target_cpu}" in
1268 if test -z "$CROSS_COMPILE" ; then
1276 if test "$OS_ARCH" = "NCR"; then
1278 OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1282 # Only set CPU_ARCH if we recognize the value of OS_TEST
1289 powerpc* | ppc | rs6000)
1293 Alpha | alpha | ALPHA)
1310 if test -z "$OS_TARGET"; then
1313 if test "$OS_TARGET" = "WIN95"; then
1316 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1318 dnl ========================================================
1319 dnl GNU specific defaults
1320 dnl ========================================================
1321 if test "$GNU_CC"; then
1322 # FIXME: Let us build with strict aliasing. bug 414641.
1323 CFLAGS="$CFLAGS -fno-strict-aliasing"
1324 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1325 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1326 DSO_LDOPTS='-shared'
1327 if test "$GCC_USE_GNU_LD"; then
1328 # Don't allow undefined symbols in libraries
1329 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1331 WARNINGS_AS_ERRORS='-Werror'
1333 DSO_PIC_CFLAGS='-fPIC'
1334 ASFLAGS="$ASFLAGS -fPIC"
1335 _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1336 _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1337 _MOZ_EXCEPTIONS_FLAGS_ON='-fhandle-exceptions'
1338 _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-handle-exceptions'
1340 # Turn on GNU specific features
1341 # -Wall - turn on all warnings
1342 # -pedantic - make compiler warn about non-ANSI stuff, and
1343 # be a little bit stricter
1344 # Warnings slamm took out for now (these were giving more noise than help):
1345 # -Wbad-function-cast - warns when casting a function to a new return type
1346 # -Wshadow - removed because it generates more noise than help --pete
1347 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1348 if test -z "$INTEL_CC"; then
1349 # Don't use -Wcast-align with ICC
1351 # And don't use it on hppa, ia64, sparc, since it's noisy there
1352 hppa | ia64 | sparc)
1355 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1360 dnl Turn pedantic on but disable the warnings for long long
1363 if test -z "$INTEL_CC"; then
1364 _IGNORE_LONG_LONG_WARNINGS=1
1365 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1367 _IGNORE_LONG_LONG_WARNINGS=
1371 _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1372 _USE_CPP_INCLUDE_FLAG=1
1374 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1375 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1377 DSO_LDOPTS='-shared'
1378 if test "$GNU_LD"; then
1379 # Don't allow undefined symbols in libraries
1380 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1384 DSO_PIC_CFLAGS='-KPIC'
1385 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1388 if test "$GNU_CXX"; then
1389 # FIXME: Let us build with strict aliasing. bug 414641.
1390 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1391 # Turn on GNU specific features
1392 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1393 if test -z "$INTEL_CC"; then
1394 # Don't use -Wcast-align with ICC
1396 # And don't use it on hppa, ia64, sparc, since it's noisy there
1397 hppa | ia64 | sparc)
1400 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1405 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1406 _USE_CPP_INCLUDE_FLAG=1
1408 AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1409 ac_has_wno_invalid_offsetof,
1413 _SAVE_CXXFLAGS="$CXXFLAGS"
1414 CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1417 ac_has_wno_invalid_offsetof="yes",
1418 ac_has_wno_invalid_offsetof="no")
1419 CXXFLAGS="$_SAVE_CXXFLAGS"
1422 if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1423 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1426 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1429 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1430 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1431 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1432 dnl normal behavior.
1433 dnl ========================================================
1435 MKSHLIB_UNFORCE_ALL=
1437 if test "$COMPILE_ENVIRONMENT"; then
1438 if test "$GNU_CC"; then
1439 AC_MSG_CHECKING(whether ld has archive extraction flags)
1440 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1441 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1442 ac_cv_mkshlib_force_and_unforce="no"
1443 exec 3<&0 <<LOOP_INPUT
1444 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
1445 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1446 force="-Wl,-all"; unforce="-Wl,-none"
1453 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1456 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1458 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1462 eval $ac_cv_mkshlib_force_and_unforce
1463 MKSHLIB_FORCE_ALL=$force
1464 MKSHLIB_UNFORCE_ALL=$unforce
1467 fi # COMPILE_ENVIRONMENT
1469 dnl =================================================================
1470 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1471 dnl which is bad when cross compiling.
1472 dnl =================================================================
1473 if test "$COMPILE_ENVIRONMENT"; then
1474 configure_static_assert_macros='
1475 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1476 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1477 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1480 dnl test that the macros actually work:
1481 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1482 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1485 ac_cv_static_assertion_macros_work="yes"
1486 AC_TRY_COMPILE([$configure_static_assert_macros],
1487 [CONFIGURE_STATIC_ASSERT(1)],
1489 ac_cv_static_assertion_macros_work="no")
1490 AC_TRY_COMPILE([$configure_static_assert_macros],
1491 [CONFIGURE_STATIC_ASSERT(0)],
1492 ac_cv_static_assertion_macros_work="no",
1495 AC_TRY_COMPILE([$configure_static_assert_macros],
1496 [CONFIGURE_STATIC_ASSERT(1)],
1498 ac_cv_static_assertion_macros_work="no")
1499 AC_TRY_COMPILE([$configure_static_assert_macros],
1500 [CONFIGURE_STATIC_ASSERT(0)],
1501 ac_cv_static_assertion_macros_work="no",
1505 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1506 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1507 AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1509 fi # COMPILE_ENVIRONMENT
1511 dnl ========================================================
1512 dnl Checking for 64-bit OS
1513 dnl ========================================================
1514 if test "$COMPILE_ENVIRONMENT"; then
1517 AC_MSG_CHECKING(for 64-bit OS)
1518 AC_TRY_COMPILE([$configure_static_assert_macros],
1519 [CONFIGURE_STATIC_ASSERT(sizeof(long) == 8)],
1520 result="yes", result="no")
1521 AC_MSG_RESULT("$result")
1522 if test "$result" = "yes"; then
1523 AC_DEFINE(HAVE_64BIT_OS)
1526 AC_SUBST(HAVE_64BIT_OS)
1528 fi # COMPILE_ENVIRONMENT
1530 dnl ========================================================
1531 dnl Enable high-memory support on OS/2 by default.
1532 dnl ========================================================
1533 MOZ_OS2_HIGH_MEMORY=1
1534 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1535 [ --disable-os2-high-mem Disable high-memory support on OS/2],
1536 MOZ_OS2_HIGH_MEMORY=,
1537 MOZ_OS2_HIGH_MEMORY=1 )
1538 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1540 dnl ========================================================
1541 dnl System overrides of the defaults for host
1542 dnl ========================================================
1545 HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1546 HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1547 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1550 *cygwin*|*mingw*|*mks*|*msvc*|*wince)
1551 if test -n "$_WIN32_MSVC"; then
1553 HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1554 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1555 HOST_RANLIB='echo ranlib'
1557 HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1559 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1560 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1561 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1562 HOST_BIN_SUFFIX=.exe
1565 dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1568 CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1569 if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1571 CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1573 if test "`${PERL} -v | grep -c cygwin 2>/dev/null`" = 0; then
1575 PERL="${CYGWIN_WRAPPER} $PERL"
1578 if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1579 PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1586 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1587 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1588 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1589 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1590 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL -lobjc'
1593 *-linux*|*-kfreebsd*-gnu)
1594 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1595 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1596 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1600 HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1601 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1602 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1603 HOST_BIN_SUFFIX=.exe
1608 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1609 HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1610 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1614 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1615 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1619 dnl Get mozilla version from central milestone file
1620 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1622 dnl Get version of various core apps from the version files.
1623 FIREFOX_VERSION=`cat $topsrcdir/browser/config/version.txt`
1625 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1626 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1628 dnl ========================================================
1629 dnl System overrides of the defaults for target
1630 dnl ========================================================
1635 if test ! "$GNU_CC"; then
1636 if test ! "$HAVE_64BIT_OS"; then
1637 # Compiling with Visual Age C++ object model compat is the
1638 # default. To compile with object model ibm, add
1639 # AIX_OBJMODEL=ibm to .mozconfig.
1640 if test "$AIX_OBJMODEL" = "ibm"; then
1641 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1648 AC_SUBST(AIX_OBJMODEL)
1649 DSO_LDOPTS='-qmkshrobj=1'
1650 DSO_CFLAGS='-qflag=w:w'
1652 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1653 AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1655 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1656 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1657 if test "$COMPILE_ENVIRONMENT"; then
1660 AC_MSG_CHECKING([for VisualAge C++ compiler version >= 6.0.0.3])
1662 [#if (__IBMCPP__ < 600)
1663 #error "Bad compiler"
1665 _BAD_COMPILER=,_BAD_COMPILER=1)
1666 if test -n "$_BAD_COMPILER"; then
1668 AC_MSG_ERROR([VisualAge C++ version 6.0.0.3 or higher is required to build.])
1670 AC_MSG_RESULT([yes])
1673 TARGET_COMPILER_ABI="ibmc"
1674 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1675 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1678 case "${target_os}" in
1683 if test "$COMPILE_ENVIRONMENT"; then
1684 AC_CHECK_HEADERS(sys/inttypes.h)
1686 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1691 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1692 _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
1693 DSO_LDOPTS='-nostart'
1694 TK_LIBS='-lbe -lroot'
1696 if test "$COMPILE_ENVIRONMENT"; then
1697 AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
1698 AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
1700 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
1701 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
1704 MOZ_USER_DIR="Mozilla"
1708 dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
1710 _IGNORE_LONG_LONG_WARNINGS=
1718 _WARNINGS_CFLAGS="-Wall"
1719 _WARNINGS_CXXFLAGS="-Wall"
1720 # The test above doesn't work properly, at least on 3.1.
1721 MKSHLIB_FORCE_ALL=''
1722 MKSHLIB_UNFORCE_ALL=''
1728 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1729 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1730 MOZ_OPTIMIZE_FLAGS="-O2"
1732 CFLAGS="$CFLAGS -fpascal-strings -fno-common"
1733 CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
1736 STRIP="$STRIP -x -S"
1737 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1738 MOZ_ENABLE_POSTSCRIPT=
1739 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1740 LDFLAGS="$LDFLAGS -framework Cocoa"
1741 # The ExceptionHandling framework is needed for Objective-C exception
1742 # logging code in nsObjCExceptions.h. Currently we only use that in debug
1744 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
1745 # set MACOSX to generate lib/mac/MoreFiles/Makefile
1748 dnl DTrace and -dead_strip don't interact well. See bug 403132.
1749 dnl ===================================================================
1750 if test "x$enable_dtrace" = "xyes"; then
1751 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1753 dnl check for the presence of the -dead_strip linker flag
1754 AC_MSG_CHECKING([for -dead_strip option to ld])
1755 _SAVE_LDFLAGS=$LDFLAGS
1756 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1757 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1758 if test -n "$_HAVE_DEAD_STRIP" ; then
1759 AC_MSG_RESULT([yes])
1760 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1765 LDFLAGS=$_SAVE_LDFLAGS
1770 if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
1771 DLL_SUFFIX=".so.1.0"
1772 DSO_LDOPTS="-shared"
1774 if test ! "$GNU_CC"; then
1775 DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
1777 # Can't have force w/o an unforce.
1778 # # Hack for FreeBSD 2.2
1779 # if test -z "$MKSHLIB_FORCE_ALL"; then
1780 # MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive'
1781 # MKSHLIB_UNFORCE_ALL=''
1787 if test ! "$GNU_CC"; then
1788 DSO_LDOPTS='-b -Wl,+s'
1791 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1792 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1793 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1795 DSO_LDOPTS='-b -E +s'
1796 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1797 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1799 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1800 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1805 DSO_LDOPTS='-elf -shared'
1807 if test "$GNU_CC"; then
1808 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1809 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1810 MKSHLIB_FORCE_ALL='-Wl,-all'
1811 MKSHLIB_UNFORCE_ALL='-Wl,-none'
1812 CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1814 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1815 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1816 MKSHLIB_FORCE_ALL='-all'
1817 MKSHLIB_UNFORCE_ALL='-none'
1823 dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must*
1824 dnl compile and link using -n32
1826 TARGET_COMPILER_ABI=n32
1827 DSO_LDOPTS='-elf -shared'
1828 MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1829 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1830 _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
1831 _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
1832 if test "$GNU_CC"; then
1833 MKSHLIB_FORCE_ALL='-Wl,-all'
1834 MKSHLIB_UNFORCE_ALL='-Wl,-none'
1835 _WARNINGS_CFLAGS="-Wall"
1836 _WARNINGS_CXXFLAGS="-Wall"
1837 CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
1839 MKSHLIB_FORCE_ALL='-all'
1840 MKSHLIB_UNFORCE_ALL='-none'
1846 CFLAGS="$CFLAGS -woff 3262 -G 4"
1847 CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
1848 if test -n "$USE_N32"; then
1849 ASFLAGS="$ASFLAGS -n32"
1850 CFLAGS="$CFLAGS -n32"
1851 CXXFLAGS="$CXXFLAGS -n32"
1852 LDFLAGS="$LDFLAGS -n32"
1854 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1855 AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
1858 if test -z "$GNU_CXX"; then
1864 # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
1865 # Similarly for GNU_CXX and INTEL_CXX.
1866 if test "$INTEL_CC" || test "$INTEL_CXX"; then
1867 # -Os has been broken on Intel's C/C++ compilers for quite a
1868 # while; Intel recommends against using it.
1869 MOZ_OPTIMIZE_FLAGS="-O2"
1870 MOZ_DEBUG_FLAGS="-g -fno-inline"
1871 elif test "$GNU_CC" || test "$GNU_CXX"; then
1872 GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
1873 case $GCC_VERSION in
1875 # -Os is broken on gcc 4.1.x and 4.2.x, we need to tweak it to get good results.
1876 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
1878 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions $MOZ_OPTIMIZE_SIZE_TWEAK"
1879 MOZ_DEBUG_FLAGS="-g -fno-inline" # most people on linux use gcc/gdb,
1880 # and that combo is not yet good at
1881 # debugging inlined functions (even
1882 # when using DWARF2 as the debugging
1886 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1890 case "${target_cpu}" in
1892 CFLAGS="$CFLAGS -mieee"
1893 CXXFLAGS="$CXXFLAGS -mieee"
1897 MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1
1900 MOZ_DEBUG_FLAGS="-g" # We want inlining
1907 MOZ_TOOLS_DIR=`echo $MOZ_TOOLS`
1909 AR_EXTRACT="$AR -extract"
1911 AR_FLAGS='-OUT:"$@"'
1913 if test "$AS_BIN"; then
1920 if test -z "$RC"; then
1923 # certain versions of cygwin's makedepend barf on the
1924 # #include <string> vs -I./dist/include/string issue so don't use it
1930 HOST_AR='lib -OUT:$@'
1931 HOST_RANLIB='echo ranlib'
1932 HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
1935 WARNINGS_AS_ERRORS='-WX'
1936 MOZ_OPTIMIZE_FLAGS='-O1'
1937 AR_FLAGS='-NOLOGO -OUT:"$@"'
1939 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
1940 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
1943 DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
1944 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
1946 IMPORT_LIB_SUFFIX=lib
1948 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
1951 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
1952 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
1954 MKSHLIB_UNFORCE_ALL=
1955 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1956 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
1957 MOZ_DEBUG_FLAGS='-Zi'
1958 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1960 MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
1961 MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
1963 RANLIB='echo not_ranlib'
1964 STRIP='echo not_strip'
1965 TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
1968 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
1970 LIBIDL_CFLAGS="-I$MOZ_TOOLS_DIR/include ${GLIB_CFLAGS}"
1971 LIBIDL_LIBS="$MOZ_TOOLS_DIR/lib/libidl-0.6_s.lib $MOZ_TOOLS_DIR/lib/glib-1.2_s.lib"
1975 AC_DEFINE(HAVE_SNPRINTF)
1981 AC_DEFINE(HW_THREADS)
1982 AC_DEFINE(STDC_HEADERS)
1983 AC_DEFINE(NEW_H, <new>)
1984 AC_DEFINE(WIN32_LEAN_AND_MEAN)
1986 TARGET_MD_ARCH=win32
1987 _PLATFORM_DEFAULT_TOOLKIT='windows'
1990 MOZ_ENABLE_POSTSCRIPT=
1991 MOZ_USER_DIR="Mozilla"
1993 MOZ_GFX_OPTIMIZE_MOBILE=1
1997 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2002 # certain versions of cygwin's makedepend barf on the
2003 # #include <string> vs -I./dist/include/string issue so don't use it
2005 if test -n "$GNU_CC"; then
2006 CC="$CC -mno-cygwin"
2007 CXX="$CXX -mno-cygwin"
2008 CPP="$CPP -mno-cygwin"
2009 CFLAGS="$CFLAGS -mms-bitfields"
2010 CXXFLAGS="$CXXFLAGS -mms-bitfields"
2011 DSO_LDOPTS='-shared'
2012 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2013 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2015 # Use temp file for windres (bug 213281)
2016 RCFLAGS='-O coff --use-temp-file'
2017 # mingw doesn't require kernel32, user32, and advapi32 explicitly
2018 LIBS="$LIBS -lgdi32 -lwinmm -lwsock32"
2019 MOZ_JS_LIBS='-L$(LIBXUL_DIST)/lib -ljs$(MOZ_BITS)$(VERSION_NUMBER)'
2021 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core'
2022 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom'
2024 IMPORT_LIB_SUFFIX=dll.a
2026 TARGET_COMPILER_ABI=msvc
2030 AR='lib -NOLOGO -OUT:"$@"'
2032 RANLIB='echo not_ranlib'
2033 STRIP='echo not_strip'
2038 GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2043 IMPORT_LIB_SUFFIX=lib
2044 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2045 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2047 MKSHLIB_UNFORCE_ALL=
2048 DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2049 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2050 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2051 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2052 MOZ_DEBUG_FLAGS='-Zi'
2053 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2054 WARNINGS_AS_ERRORS='-WX'
2055 MOZ_OPTIMIZE_FLAGS='-O1'
2056 MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/js$(MOZ_BITS)$(VERSION_NUMBER).lib'
2058 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib'
2059 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib'
2060 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2061 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2062 MOZ_XPCOM_OBSOLETE_LIBS='$(LIBXUL_DIST)/lib/xpcom_compat.lib'
2063 if test $_MSC_VER -ge 1400; then
2064 LDFLAGS="$LDFLAGS -NXCOMPAT -SAFESEH"
2065 dnl For profile-guided optimization
2066 PROFILE_GEN_CFLAGS="-GL"
2067 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2068 dnl XXX: PGO builds can fail with warnings treated as errors,
2069 dnl specifically "no profile data available" appears to be
2070 dnl treated as an error sometimes. This might be a consequence
2071 dnl of using WARNINGS_AS_ERRORS in some modules, combined
2072 dnl with the linker doing most of the work in the whole-program
2073 dnl optimization/PGO case. I think it's probably a compiler bug,
2074 dnl but we work around it here.
2075 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2076 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2077 dnl Probably also a compiler bug, but what can you do?
2078 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2079 if test -n "$_USE_DYNAMICBASE"; then
2080 LDFLAGS="$LDFLAGS -DYNAMICBASE"
2084 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg$(MOZ_BITS)$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2085 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2086 AC_DEFINE(HAVE_SNPRINTF)
2092 AC_DEFINE(HW_THREADS)
2093 AC_DEFINE(STDC_HEADERS)
2094 AC_DEFINE(NEW_H, <new>)
2095 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2096 TARGET_MD_ARCH=win32
2097 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2100 MOZ_ENABLE_POSTSCRIPT=
2101 MOZ_USER_DIR="Mozilla"
2103 dnl Hardcode to win95 for now - cls
2104 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2106 dnl set NO_X11 defines here as the general check is skipped on win32
2110 dnl MinGW/MSYS doesn't provide or need cygpath
2115 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2117 *-cygwin*|*-msvc*|*-mks*)
2118 CYGPATH_W="cygpath -a -w"
2119 CYGPATH_S="sed -e s|\\\\|/|g"
2120 MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2124 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2126 if test -z "$MOZ_TOOLS"; then
2127 AC_MSG_ERROR([MOZ_TOOLS is not set])
2130 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd`
2131 if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then
2132 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2134 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_DIR/bin:"` = 0; then
2135 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2137 MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2139 if test -n "$GLIB_PREFIX"; then
2140 _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd`
2141 if test "$?" = "0"; then
2142 if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
2143 AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
2145 _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
2147 AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
2150 _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
2152 if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
2153 AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
2155 GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
2156 if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
2157 GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
2158 elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
2159 GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
2161 AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
2164 if test -n "$LIBIDL_PREFIX"; then
2165 _LIBIDL_PREFIX_DIR=`cd $LIBIDL_PREFIX && pwd`
2166 if test "$?" = "0"; then
2167 if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
2168 AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
2170 _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
2172 AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
2175 _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
2177 if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
2178 AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
2180 LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
2181 if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
2182 LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
2184 elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
2185 LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
2187 AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
2189 LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2192 *) # else cross-compiling
2193 if test -n "$GLIB_PREFIX"; then
2194 GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
2195 if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
2196 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
2197 elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
2198 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
2200 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
2203 if test -n "$LIBIDL_PREFIX"; then
2204 LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
2205 if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
2206 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
2208 elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
2209 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
2211 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
2214 LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2221 AC_MSG_WARN([Using a cygwin build environment is unsupported. Configure cannot check for the presence of necessary headers. Please upgrade to MozillaBuild; see http://developer.mozilla.org/en/docs/Windows_Build_Prerequisites])
2225 AC_CHECK_HEADERS(mmintrin.h oleacc.idl)
2229 AC_CHECK_HEADERS(atlbase.h wpcapi.h)
2245 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2252 CFLAGS="$CFLAGS -Dunix"
2253 CXXFLAGS="$CXXFLAGS -Dunix"
2254 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2256 DSO_PIC_CFLAGS='-fPIC -DPIC'
2257 DSO_LDOPTS='-shared'
2258 BIN_FLAGS='-Wl,--export-dynamic'
2260 DSO_PIC_CFLAGS='-fPIC -DPIC'
2261 DLL_SUFFIX=".so.1.0"
2262 DSO_LDOPTS='-shared'
2264 # This will fail on a.out systems prior to 1.5.1_ALPHA.
2265 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2266 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2267 if test "$LIBRUNPATH"; then
2268 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2270 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2271 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2276 AC_DEFINE(_QNX_SOURCE)
2279 WARNINGS_AS_ERRORS=''
2280 MOZ_OPTIMIZE_FLAGS="-O"
2281 MOZ_DEBUG_FLAGS="-gstabs"
2284 LIBS="$LIBS -lsocket -lstdc++"
2285 _DEFINES_CFLAGS='-Wp,-include -Wp,$(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2286 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -Wp,-include -Wp,$(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2287 if test "$with_x" != "yes"
2289 _PLATFORM_DEFAULT_TOOLKIT="photon"
2290 TK_CFLAGS='-I/usr/include/photon'
2293 case "${target_cpu}" in
2295 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
2298 case "${host_cpu}" in
2306 DLL_SUFFIX=".so.1.0"
2308 DSO_PIC_CFLAGS='-fPIC'
2309 DSO_LDOPTS='-shared -fPIC'
2310 if test "$LIBRUNPATH"; then
2311 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2316 AC_DEFINE(NO_PW_GECOS)
2317 AC_DEFINE(NO_UDSOCK)
2318 AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2320 MKSHLIB_FORCE_ALL='-all'
2321 MKSHLIB_UNFORCE_ALL='-none'
2323 AS_DASH_C_FLAG='-Wc/names=as_is'
2325 DSO_LDOPTS='-shared -auto_symvec'
2327 MOZ_DEBUG_LDFLAGS='-g'
2329 CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2330 CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2335 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2336 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2339 AC_DEFINE(OS2EMX_PLAIN_CHAR)
2340 AC_DEFINE(TCPV40HDRS)
2347 IMPORT_LIB_SUFFIX=lib
2351 CFLAGS="$CFLAGS -Zomf"
2352 CXXFLAGS="$CXXFLAGS -Zomf"
2354 BIN_FLAGS='-Zlinker /ST:0x100000'
2358 WARNINGS_AS_ERRORS='-Werror'
2359 MOZ_DEBUG_FLAGS="-g -fno-inline"
2360 MOZ_OPTIMIZE_FLAGS="-O2"
2361 MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2362 MOZ_XPCOM_OBSOLETE_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcomct.lib'
2363 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcomcor.lib'
2364 LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib'
2366 _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2367 MOZ_ENABLE_POSTSCRIPT=
2370 MOZ_USER_DIR="Mozilla"
2372 if test "$MOZTOOLS"; then
2373 MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2375 AC_MSG_ERROR([MOZTOOLS is not set])
2377 if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2378 DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2379 LDFLAGS="$LDFLAGS -Zhigh-mem"
2380 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2381 AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2384 # GCC for OS/2 currently predefines these, but we don't want them
2385 _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2386 _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2388 AC_CACHE_CHECK(for __declspec(dllexport),
2390 [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2392 ac_os2_declspec="yes",
2393 ac_os2_declspec="no")])
2394 if test "$ac_os2_declspec" = "yes"; then
2396 MOZ_OS2_USE_DECLSPEC='1'
2401 if test "$GNU_CC"; then
2402 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2403 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2406 MOZ_DEBUG_FLAGS='-g'
2407 ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2408 CFLAGS="$CFLAGS -ieee"
2409 CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee -ptr $(DIST)/cxx_repository'
2410 DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2413 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2414 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2415 MKSHLIB_FORCE_ALL='-all'
2416 MKSHLIB_UNFORCE_ALL='-none'
2417 dnl Might fix the libxpcom.so breakage on this platform as well....
2418 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2419 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2421 if test -z "$GNU_CXX"; then
2424 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2428 DIRENT_INO=d_stat.st_ino
2429 dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2430 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2431 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2432 dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2433 AC_DEFINE(STDC_HEADERS)
2434 if test "$no_x" = "yes"; then
2435 _PLATFORM_DEFAULT_TOOLKIT='photon'
2436 TK_CFLAGS='-I/usr/nto/include/photon'
2437 TK_LIBS='-lphoton -lphrender'
2442 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2443 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2444 CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2445 if test ! "$GNU_CC"; then
2450 dnl the qsort routine under solaris is faulty
2453 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2455 # $ORIGIN/.. is for shared libraries under components/ to locate shared
2456 # libraries one level up (e.g. libnspr4.so)
2457 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
2459 if test -z "$GNU_CC"; then
2460 LIBS="-lCrun -lCstd $LIBS"
2463 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2465 if test "$CPU_ARCH" != "sparc"; then
2466 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all"
2467 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife -norunpath"
2469 # Do not use -xbuiltin on SPARC to get around a bug of compiler
2470 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%none"
2471 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%none -features=tmplife -norunpath"
2474 LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
2475 if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
2476 _SAVE_LDFLAGS=$LDFLAGS
2477 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2478 AC_TRY_LINK([#include <stdio.h>],
2479 [printf("Hello World\n");],
2481 [LDFLAGS=$_SAVE_LDFLAGS])
2483 WARNINGS_AS_ERRORS='-Werror'
2484 MOZ_OPTIMIZE_FLAGS="-xO4"
2485 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2486 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -z muldefs -h $@ -o $@'
2487 MKSHLIB_FORCE_ALL='-z allextract'
2488 MKSHLIB_UNFORCE_ALL='-z defaultextract'
2489 DSO_LDOPTS='-G -z muldefs'
2495 AS='/usr/ccs/bin/as'
2496 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2498 TARGET_COMPILER_ABI="sunc"
2499 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2500 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2501 AC_MSG_CHECKING([for Forte compiler version >= WS6U2])
2505 [#if (__SUNPRO_CC < 0x530)
2508 _BAD_COMPILER=,_BAD_COMPILER=1)
2509 if test -n "$_BAD_COMPILER"; then
2511 AC_MSG_ERROR([Forte version WS6U2 or higher is required to build. Your compiler version is $CC_VERSION .])
2515 AC_MSG_RESULT([$_res])
2518 ASFLAGS="$ASFLAGS -fPIC"
2521 _WARNINGS_CXXFLAGS=''
2522 if test "$OS_RELEASE" = "5.3"; then
2523 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2526 if test "$OS_RELEASE" = "5.5.1"; then
2527 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2532 DSO_LDOPTS='-Bdynamic'
2533 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2534 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2536 AC_DEFINE(SPRINTF_RETURNS_STRING)
2537 case "$(target_os)" in
2539 DLL_SUFFIX='.so.1.0'
2545 NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2549 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2554 dnl Only one oddball right now (QNX), but this gives us flexibility
2555 dnl if any other platforms need to override this in the future.
2556 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2558 dnl ========================================================
2559 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2560 dnl by now will not have any way to link most binaries (tests
2561 dnl as well as viewer, apprunner, etc.), because some symbols
2562 dnl will be left out of the "composite" .so's by ld as unneeded.
2563 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2564 dnl they can link in the static libs that provide the missing
2566 dnl ========================================================
2567 NO_LD_ARCHIVE_FLAGS=
2568 if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then
2569 NO_LD_ARCHIVE_FLAGS=1
2573 NO_LD_ARCHIVE_FLAGS=
2576 NO_LD_ARCHIVE_FLAGS=
2579 NO_LD_ARCHIVE_FLAGS=
2581 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince)
2582 if test -z "$GNU_CC"; then
2583 NO_LD_ARCHIVE_FLAGS=
2587 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2590 dnl Indicate that platform requires special thread safe
2591 dnl locking when starting up the OJI JVM
2592 dnl (see mozilla/modules/oji/src/nsJVMManager.cpp)
2593 dnl ========================================================
2596 AC_DEFINE(MOZ_OJI_REQUIRE_THREAD_SAFE_ON_STARTUP)
2600 dnl ========================================================
2601 dnl = Flags to strip unused symbols from .so components
2602 dnl ========================================================
2604 *-linux*|*-kfreebsd*-gnu)
2605 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2608 if test -z "$GNU_CC"; then
2609 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2611 if test -z "$GCC_USE_GNU_LD"; then
2612 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2614 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2619 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2622 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2624 *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince)
2625 if test -n "$GNU_CC"; then
2626 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2631 if test -z "$COMPILE_ENVIRONMENT"; then
2632 SKIP_COMPILER_CHECKS=1
2633 SKIP_LIBRARY_CHECKS=1
2636 if test -z "$SKIP_COMPILER_CHECKS"; then
2637 dnl Checks for typedefs, structures, and compiler characteristics.
2638 dnl ========================================================
2646 AC_STRUCT_ST_BLKSIZE
2647 AC_MSG_CHECKING(for siginfo_t)
2648 AC_CACHE_VAL(ac_cv_siginfo_t,
2649 [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2650 #include <signal.h>],
2652 [ac_cv_siginfo_t=true],
2653 [ac_cv_siginfo_t=false])])
2654 if test "$ac_cv_siginfo_t" = true ; then
2655 AC_DEFINE(HAVE_SIGINFO_T)
2661 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2662 dnl ========================================================
2663 AC_MSG_CHECKING(for int16_t)
2664 AC_CACHE_VAL(ac_cv_int16_t,
2665 [AC_TRY_COMPILE([#include <stdio.h>
2666 #include <sys/types.h>],
2668 [ac_cv_int16_t=true],
2669 [ac_cv_int16_t=false])])
2670 if test "$ac_cv_int16_t" = true ; then
2671 AC_DEFINE(HAVE_INT16_T)
2676 AC_MSG_CHECKING(for int32_t)
2677 AC_CACHE_VAL(ac_cv_int32_t,
2678 [AC_TRY_COMPILE([#include <stdio.h>
2679 #include <sys/types.h>],
2681 [ac_cv_int32_t=true],
2682 [ac_cv_int32_t=false])])
2683 if test "$ac_cv_int32_t" = true ; then
2684 AC_DEFINE(HAVE_INT32_T)
2689 AC_MSG_CHECKING(for int64_t)
2690 AC_CACHE_VAL(ac_cv_int64_t,
2691 [AC_TRY_COMPILE([#include <stdio.h>
2692 #include <sys/types.h>],
2694 [ac_cv_int64_t=true],
2695 [ac_cv_int64_t=false])])
2696 if test "$ac_cv_int64_t" = true ; then
2697 AC_DEFINE(HAVE_INT64_T)
2702 AC_MSG_CHECKING(for int64)
2703 AC_CACHE_VAL(ac_cv_int64,
2704 [AC_TRY_COMPILE([#include <stdio.h>
2705 #include <sys/types.h>],
2708 [ac_cv_int64=false])])
2709 if test "$ac_cv_int64" = true ; then
2710 AC_DEFINE(HAVE_INT64)
2715 AC_MSG_CHECKING(for uint)
2716 AC_CACHE_VAL(ac_cv_uint,
2717 [AC_TRY_COMPILE([#include <stdio.h>
2718 #include <sys/types.h>],
2721 [ac_cv_uint=false])])
2722 if test "$ac_cv_uint" = true ; then
2723 AC_DEFINE(HAVE_UINT)
2728 AC_MSG_CHECKING(for uint_t)
2729 AC_CACHE_VAL(ac_cv_uint_t,
2730 [AC_TRY_COMPILE([#include <stdio.h>
2731 #include <sys/types.h>],
2733 [ac_cv_uint_t=true],
2734 [ac_cv_uint_t=false])])
2735 if test "$ac_cv_uint_t" = true ; then
2736 AC_DEFINE(HAVE_UINT_T)
2741 AC_MSG_CHECKING(for uint16_t)
2742 AC_CACHE_VAL(ac_cv_uint16_t,
2743 [AC_TRY_COMPILE([#include <stdio.h>
2744 #include <sys/types.h>],
2745 [uint16_t foo = 0;],
2746 [ac_cv_uint16_t=true],
2747 [ac_cv_uint16_t=false])])
2748 if test "$ac_cv_uint16_t" = true ; then
2749 AC_DEFINE(HAVE_UINT16_T)
2755 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2756 dnl are defined when compiling C++ but not C. Since the result of this
2757 dnl test is used only in C++, do it in C++.
2760 AC_MSG_CHECKING(for uname.domainname)
2761 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2762 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2763 [ struct utsname *res; char *domain;
2764 (void)uname(res); if (res != 0) { domain = res->domainname; } ],
2765 [ac_cv_have_uname_domainname_field=true],
2766 [ac_cv_have_uname_domainname_field=false])])
2768 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2769 AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2775 AC_MSG_CHECKING(for uname.__domainname)
2776 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2777 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2778 [ struct utsname *res; char *domain;
2779 (void)uname(res); if (res != 0) { domain = res->__domainname; } ],
2780 [ac_cv_have_uname_us_domainname_field=true],
2781 [ac_cv_have_uname_us_domainname_field=false])])
2783 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2784 AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2792 dnl Check for usable wchar_t (2 bytes, unsigned)
2793 dnl (we really don't need the unsignedness check anymore)
2794 dnl ========================================================
2796 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
2797 ac_cv_have_usable_wchar_v2,
2798 [AC_TRY_COMPILE([#include <stddef.h>
2799 $configure_static_assert_macros],
2800 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2801 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2802 ac_cv_have_usable_wchar_v2="yes",
2803 ac_cv_have_usable_wchar_v2="no")])
2804 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
2805 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2806 HAVE_CPP_2BYTE_WCHAR_T=1
2808 dnl This is really gcc-only
2809 dnl Do this test using CXX only since some versions of gcc
2810 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
2811 dnl only have short-wchar support for c++.
2812 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
2816 _SAVE_CXXFLAGS=$CXXFLAGS
2817 CXXFLAGS="$CXXFLAGS -fshort-wchar"
2819 AC_CACHE_CHECK(for compiler -fshort-wchar option,
2820 ac_cv_have_usable_wchar_option_v2,
2821 [AC_TRY_LINK([#include <stddef.h>
2822 $configure_static_assert_macros],
2823 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
2824 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
2825 ac_cv_have_usable_wchar_option_v2="yes",
2826 ac_cv_have_usable_wchar_option_v2="no")])
2828 if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
2829 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
2830 HAVE_CPP_2BYTE_WCHAR_T=1
2831 WCHAR_CFLAGS="-fshort-wchar"
2833 CXXFLAGS=$_SAVE_CXXFLAGS
2838 dnl Check for .hidden assembler directive and visibility attribute.
2839 dnl Borrowed from glibc configure.in
2840 dnl ===============================================================
2841 if test "$GNU_CC"; then
2842 AC_CACHE_CHECK(for visibility(hidden) attribute,
2843 ac_cv_visibility_hidden,
2844 [cat > conftest.c <<EOF
2845 int foo __attribute__ ((visibility ("hidden"))) = 1;
2847 ac_cv_visibility_hidden=no
2848 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2849 if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2850 ac_cv_visibility_hidden=yes
2855 if test "$ac_cv_visibility_hidden" = "yes"; then
2856 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2858 AC_CACHE_CHECK(for visibility(default) attribute,
2859 ac_cv_visibility_default,
2860 [cat > conftest.c <<EOF
2861 int foo __attribute__ ((visibility ("default"))) = 1;
2863 ac_cv_visibility_default=no
2864 if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2865 if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2866 ac_cv_visibility_default=yes
2871 if test "$ac_cv_visibility_default" = "yes"; then
2872 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2874 AC_CACHE_CHECK(for visibility pragma support,
2875 ac_cv_visibility_pragma,
2876 [cat > conftest.c <<EOF
2877 #pragma GCC visibility push(hidden)
2879 #pragma GCC visibility push(default)
2880 int foo_default = 1;
2882 ac_cv_visibility_pragma=no
2883 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2884 if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2885 if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2886 ac_cv_visibility_pragma=yes
2892 if test "$ac_cv_visibility_pragma" = "yes"; then
2893 AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2894 ac_cv_have_visibility_class_bug,
2895 [cat > conftest.c <<EOF
2896 #pragma GCC visibility push(hidden)
2897 struct __attribute__ ((visibility ("default"))) TestStruct {
2900 __attribute__ ((visibility ("default"))) void TestFunc() {
2904 ac_cv_have_visibility_class_bug=no
2905 if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2906 ac_cv_have_visibility_class_bug=yes
2908 if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2909 ac_cv_have_visibility_class_bug=yes
2912 rm -rf conftest.{c,S}
2915 AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2916 ac_cv_have_visibility_builtin_bug,
2917 [cat > conftest.c <<EOF
2918 #pragma GCC visibility push(hidden)
2919 #pragma GCC visibility push(default)
2921 #pragma GCC visibility pop
2923 __attribute__ ((visibility ("default"))) void Func() {
2925 memset(c, 0, sizeof(c));
2928 ac_cv_have_visibility_builtin_bug=no
2929 if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2930 ac_cv_have_visibility_builtin_bug=yes
2932 if test `grep -c "@PLT" conftest.S` = 0; then
2933 ac_cv_visibility_builtin_bug=yes
2936 rm -f conftest.{c,S}
2938 if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2939 "$ac_cv_have_visibility_class_bug" = "no"; then
2940 VISIBILITY_FLAGS='-I$(DIST)/include/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2941 WRAP_SYSTEM_INCLUDES=1
2943 VISIBILITY_FLAGS='-fvisibility=hidden'
2944 fi # have visibility pragma bug
2945 fi # have visibility pragma
2946 fi # have visibility(default) attribute
2947 fi # have visibility(hidden) attribute
2950 # visibility hidden flag for Sun Studio on Solaris
2951 if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
2952 VISIBILITY_FLAGS='-xldscope=hidden'
2953 fi # Sun Studio on Solaris
2955 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2956 AC_SUBST(VISIBILITY_FLAGS)
2958 dnl Checks for header files.
2959 dnl ========================================================
2961 case "$target_os" in
2963 # for stuff like -lXshm
2964 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2967 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
2968 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
2969 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
2970 AC_CHECK_HEADERS(malloc.h)
2971 AC_CHECK_HEADERS(X11/XKBlib.h)
2972 AC_CHECK_HEADERS(io.h)
2974 dnl These are all the places some variant of statfs can be hiding.
2975 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2977 dnl Try for MMX support
2978 dnl NB - later gcc versions require -mmmx for this header to be successfully
2979 dnl included (or another option which implies it, such as -march=pentium-mmx)
2980 AC_CHECK_HEADERS(mmintrin.h)
2982 dnl Check whether the compiler supports the new-style C++ standard
2983 dnl library headers (i.e. <new>) or needs the old "new.h"
2986 AC_CHECK_HEADER(new, [NEW_H=new])
2987 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
2990 AC_ARG_ENABLE(dtrace,
2991 [ --enable-dtrace build with dtrace support if available (default=no)],
2992 [enable_dtrace="yes"],)
2993 if test "x$enable_dtrace" = "xyes"; then
2994 AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
2995 if test -n "$HAVE_DTRACE"; then
2996 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
2998 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3001 AC_SUBST(HAVE_DTRACE)
3007 AC_CHECK_HEADERS(sys/cdefs.h)
3011 dnl Checks for libraries.
3012 dnl ========================================================
3017 AC_CHECK_LIB(c_r, gethostbyname_r)
3021 dnl We don't want to link with libdl even if it's present on OS X, since
3022 dnl it's not used and not part of the default installation.
3023 dnl The same goes for BeOS.
3024 dnl We don't want to link against libm or libpthread on Darwin since
3025 dnl they both are just symlinks to libSystem and explicitly linking
3026 dnl against libSystem causes issues when debugging (see bug 299601).
3033 AC_CHECK_LIB(m, atan)
3034 AC_CHECK_LIB(dl, dlopen,
3035 AC_CHECK_HEADER(dlfcn.h,
3037 AC_DEFINE(HAVE_LIBDL)))
3041 _SAVE_CFLAGS="$CFLAGS"
3042 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3043 AC_CHECK_FUNCS(dladdr)
3044 CFLAGS="$_SAVE_CFLAGS"
3046 if test ! "$GNU_CXX"; then
3050 AC_CHECK_LIB(C_r, demangle)
3053 AC_CHECK_LIB(C, demangle)
3057 AC_CHECK_LIB(socket, socket)
3060 XLIBS="$X_EXTRA_LIBS"
3062 dnl ========================================================
3063 dnl Checks for X libraries.
3064 dnl Ordering is important.
3065 dnl Xt is dependent upon SM as of X11R6
3066 dnl ========================================================
3067 if test "$no_x" = "yes"; then
3070 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3071 XLIBS="-lX11 $XLIBS"
3072 _SAVE_LDFLAGS="$LDFLAGS"
3073 LDFLAGS="$XLDFLAGS $LDFLAGS"
3074 AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3075 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3076 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3077 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3080 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3081 unset ac_cv_lib_Xt_XtFree
3082 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3083 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
3084 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3085 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3088 # AIX needs the motif library linked before libXt to prevent
3089 # crashes in plugins linked against Motif - Bug #98892
3090 case "${target_os}" in
3092 XT_LIBS="-lXm $XT_LIBS"
3096 dnl ========================================================
3097 dnl = Check for XShm
3098 dnl ========================================================
3099 AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3101 AC_CHECK_HEADER(X11/extensions/XShm.h)
3102 if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3103 test -n "$_HAVE_XSHM_XEXT"; then
3104 AC_DEFINE(HAVE_XSHM)
3107 dnl ========================================================
3109 dnl ========================================================
3110 AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3112 AC_CHECK_HEADER(X11/extensions/XIElib.h)
3114 if test "$MOZ_XIE_LIBS"; then
3115 dnl ====================================================
3116 dnl = If XIE is present and is desired, turn it on
3117 dnl ====================================================
3127 LDFLAGS="$_SAVE_LDFLAGS"
3129 dnl ========================================================
3130 dnl = Check for freetype2 and its functionality
3131 dnl ========================================================
3132 AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3134 if test "$_HAVE_FREETYPE2"; then
3136 _SAVE_CFLAGS="$CFLAGS"
3137 LIBS="$LIBS $FT2_LIBS"
3138 CFLAGS="$CFLAGS $FT2_CFLAGS"
3140 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3141 ac_cv_member_FT_Bitmap_Size_y_ppem,
3142 [AC_TRY_COMPILE([#include <ft2build.h>
3143 #include FT_FREETYPE_H],
3145 if (sizeof s.y_ppem) return 0;
3147 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3148 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3149 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3150 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3152 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3154 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3155 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3156 [FT_Bitmap_Size structure includes y_ppem field])
3158 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3161 CFLAGS="$_SAVE_CFLAGS"
3171 AC_MSG_CHECKING(for ARM SIMD support)
3173 [asm("uqadd8 r1, r1, r2");],
3174 result="yes", result="no")
3175 AC_MSG_RESULT("$result")
3176 if test "$result" = "yes"; then
3177 AC_DEFINE(HAVE_ARM_SIMD)
3180 AC_SUBST(HAVE_ARM_SIMD)
3182 dnl ========================================================
3183 dnl = pthread support
3184 dnl = Start by checking whether the system support pthreads
3185 dnl ========================================================
3186 case "$target_os" in
3191 MOZ_CHECK_PTHREADS(pthreads,
3192 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3193 MOZ_CHECK_PTHREADS(pthread,
3194 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3195 MOZ_CHECK_PTHREADS(c_r,
3196 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3197 MOZ_CHECK_PTHREADS(c,
3206 dnl ========================================================
3207 dnl Check the command line for --with-pthreads
3208 dnl ========================================================
3209 MOZ_ARG_WITH_BOOL(pthreads,
3210 [ --with-pthreads Force use of system pthread library with NSPR ],
3211 [ if test "$USE_PTHREADS"x = x; then
3212 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3218 dnl ========================================================
3219 dnl Do the platform specific pthread hackery
3220 dnl ========================================================
3221 if test "$USE_PTHREADS"x != x
3224 dnl See if -pthread is supported.
3227 ac_cv_have_dash_pthread=no
3228 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3229 echo 'int main() { return 0; }' | cat > conftest.c
3230 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3231 if test $? -eq 0; then
3232 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3233 ac_cv_have_dash_pthread=yes
3234 case "$target_os" in
3236 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3239 CFLAGS="$CFLAGS -pthread"
3240 CXXFLAGS="$CXXFLAGS -pthread"
3246 AC_MSG_RESULT($ac_cv_have_dash_pthread)
3249 dnl See if -pthreads is supported.
3251 ac_cv_have_dash_pthreads=no
3252 if test "$ac_cv_have_dash_pthread" = "no"; then
3253 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3254 echo 'int main() { return 0; }' | cat > conftest.c
3255 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3256 if test $? -eq 0; then
3257 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3258 ac_cv_have_dash_pthreads=yes
3259 CFLAGS="$CFLAGS -pthreads"
3260 CXXFLAGS="$CXXFLAGS -pthreads"
3264 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3269 AC_DEFINE(_REENTRANT)
3270 AC_DEFINE(_THREAD_SAFE)
3271 dnl -pthread links in -lc_r, so don't specify it explicitly.
3272 if test "$ac_cv_have_dash_pthread" = "yes"; then
3273 _PTHREAD_LDFLAGS="-pthread"
3275 _PTHREAD_LDFLAGS="-lc_r"
3279 *-*-openbsd*|*-*-bsdi*)
3280 AC_DEFINE(_REENTRANT)
3281 AC_DEFINE(_THREAD_SAFE)
3282 dnl -pthread links in -lc_r, so don't specify it explicitly.
3283 if test "$ac_cv_have_dash_pthread" = "yes"; then
3284 _PTHREAD_LDFLAGS="-pthread"
3288 *-*-linux*|*-*-kfreebsd*-gnu)
3289 AC_DEFINE(_REENTRANT)
3293 AC_DEFINE(_REENTRANT)
3297 AC_DEFINE(_REENTRANT)
3301 AC_DEFINE(_REENTRANT)
3305 AC_DEFINE(_REENTRANT)
3309 AC_DEFINE(_REENTRANT)
3310 if test ! "$GNU_CC"; then
3311 CFLAGS="$CFLAGS -mt"
3312 CXXFLAGS="$CXXFLAGS -mt"
3316 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3319 dnl ========================================================
3320 dnl See if mmap sees writes
3321 dnl For cross compiling, just define it as no, which is a safe default
3322 dnl ========================================================
3323 AC_MSG_CHECKING(whether mmap() sees write()s)
3329 #include <sys/mman.h>
3330 #include <sys/types.h>
3331 #include <sys/stat.h>
3334 char fname[] = "conftest.file";
3335 char zbuff[1024]; /* Fractional page is probably worst case */
3342 fd = open(fname, O_RDWR | O_CREAT, 0660);
3345 write(fd, zbuff, sizeof(zbuff));
3346 lseek(fd, 0, SEEK_SET);
3347 map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3348 if(map==(char*)-1) return 2;
3349 for(i=0; fname[i]; i++) {
3350 int rc = write(fd, &fname[i], 1);
3351 if(map[i]!=fname[i]) return 4;
3358 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3360 AC_MSG_RESULT("$result")
3362 if test "$result" = "no"; then
3363 AC_DEFINE(MMAP_MISSES_WRITES)
3367 dnl Checks for library functions.
3368 dnl ========================================================
3369 AC_PROG_GCC_TRADITIONAL
3371 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3372 AC_CHECK_FUNCS(flockfile getpagesize)
3373 AC_CHECK_FUNCS(localtime_r strtok_r)
3375 dnl check for wcrtomb/mbrtowc
3376 dnl =======================================================================
3377 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3380 AC_CACHE_CHECK(for wcrtomb,
3382 [AC_TRY_LINK([#include <wchar.h>],
3383 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3384 ac_cv_have_wcrtomb="yes",
3385 ac_cv_have_wcrtomb="no")])
3386 if test "$ac_cv_have_wcrtomb" = "yes"; then
3387 AC_DEFINE(HAVE_WCRTOMB)
3389 AC_CACHE_CHECK(for mbrtowc,
3391 [AC_TRY_LINK([#include <wchar.h>],
3392 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3393 ac_cv_have_mbrtowc="yes",
3394 ac_cv_have_mbrtowc="no")])
3395 if test "$ac_cv_have_mbrtowc" = "yes"; then
3396 AC_DEFINE(HAVE_MBRTOWC)
3403 ac_cv_func_res_ninit,
3406 #define _BSD_SOURCE 1
3410 [int foo = res_ninit(&_res);],
3411 [ac_cv_func_res_ninit=yes],
3412 [ac_cv_func_res_ninit=no])
3415 if test "$ac_cv_func_res_ninit" = "yes"; then
3416 AC_DEFINE(HAVE_RES_NINIT)
3417 dnl must add the link line we do something as foolish as this... dougt
3419 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3420 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3425 [for gnu_get_libc_version()],
3426 ac_cv_func_gnu_get_libc_version,
3428 #ifdef HAVE_GNU_LIBC_VERSION_H
3429 #include <gnu/libc-version.h>
3432 [const char *glibc_version = gnu_get_libc_version();],
3433 [ac_cv_func_gnu_get_libc_version=yes],
3434 [ac_cv_func_gnu_get_libc_version=no]
3438 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3439 AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3443 os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|beos*)
3447 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3448 AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3449 AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3451 LIBS="$LIBS $_ICONV_LIBS"
3460 iconv_t h = iconv_open("", "");
3461 iconv(h, NULL, NULL, NULL, NULL);
3464 [ac_cv_func_iconv=yes],
3465 [ac_cv_func_iconv=no]
3468 if test "$ac_cv_func_iconv" = "yes"; then
3469 AC_DEFINE(HAVE_ICONV)
3470 DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3471 LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3472 LIBICONV="$_ICONV_LIBS"
3474 [for iconv() with const input],
3475 ac_cv_func_const_iconv,
3481 const char *input = "testing";
3482 iconv_t h = iconv_open("", "");
3483 iconv(h, &input, NULL, NULL, NULL);
3486 [ac_cv_func_const_iconv=yes],
3487 [ac_cv_func_const_iconv=no]
3490 if test "$ac_cv_func_const_iconv" = "yes"; then
3491 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3503 dnl **********************
3504 dnl *** va_copy checks ***
3505 dnl **********************
3506 dnl we currently check for all three va_copy possibilities, so we get
3507 dnl all results in config.log for bug reports.
3508 AC_MSG_CHECKING(for an implementation of va_copy())
3509 AC_CACHE_VAL(ac_cv_va_copy,[
3512 void f (int i, ...) {
3513 va_list args1, args2;
3514 va_start (args1, i);
3515 va_copy (args2, args1);
3516 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3518 va_end (args1); va_end (args2);
3520 int main() { f (0, 42); return 0; }],
3526 AC_MSG_RESULT($ac_cv_va_copy)
3527 AC_MSG_CHECKING(for an implementation of __va_copy())
3528 AC_CACHE_VAL(ac_cv___va_copy,[
3531 void f (int i, ...) {
3532 va_list args1, args2;
3533 va_start (args1, i);
3534 __va_copy (args2, args1);
3535 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3537 va_end (args1); va_end (args2);
3539 int main() { f (0, 42); return 0; }],
3540 ac_cv___va_copy=yes,
3545 AC_MSG_RESULT($ac_cv___va_copy)
3546 AC_MSG_CHECKING(whether va_lists can be copied by value)
3547 AC_CACHE_VAL(ac_cv_va_val_copy,[
3550 void f (int i, ...) {
3551 va_list args1, args2;
3552 va_start (args1, i);
3554 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3556 va_end (args1); va_end (args2);
3558 int main() { f (0, 42); return 0; }],
3559 ac_cv_va_val_copy=yes,
3560 ac_cv_va_val_copy=no,
3561 ac_cv_va_val_copy=yes
3564 if test "x$ac_cv_va_copy" = "xyes"; then
3565 AC_DEFINE(VA_COPY, va_copy)
3566 AC_DEFINE(HAVE_VA_COPY)
3567 elif test "x$ac_cv___va_copy" = "xyes"; then
3568 AC_DEFINE(VA_COPY, __va_copy)
3569 AC_DEFINE(HAVE_VA_COPY)
3572 if test "x$ac_cv_va_val_copy" = "xno"; then
3573 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3575 AC_MSG_RESULT($ac_cv_va_val_copy)
3577 dnl Check for dll-challenged libc's.
3578 dnl This check is apparently only needed for Linux.
3581 dnl ===================================================================
3584 rm -rf conftest* _conftest
3586 cat >> conftest.C <<\EOF
3591 void __dump_link_map(void) {
3592 struct link_map *map = _dl_loaded;
3593 while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
3596 dlopen("./conftest1.so",RTLD_LAZY);
3597 dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
3598 dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
3599 dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
3603 /* _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).*/
3604 int main() { printf("./conftest1.so\n"); }
3608 $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
3610 cat >> conftest1.C <<\EOF
3612 void foo(void) {printf("foo in dll called\n");}
3614 ${CXX-g++} -fPIC -c -g conftest1.C
3615 ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
3616 ${CXX-g++} -g conftest.C -o conftest -ldl
3617 cp -f conftest1.so conftest _conftest
3619 if test `./conftest | grep conftest1.so | wc -l` -gt 1
3622 echo "*** Your libc has a bug that can result in loading the same dynamic"
3623 echo "*** library multiple times. This bug is known to be fixed in glibc-2.0.7-32"
3624 echo "*** or later. However, if you choose not to upgrade, the only effect"
3625 echo "*** will be excessive memory usage at runtime."
3629 rm -rf conftest* _conftest
3630 dnl ===================================================================
3634 dnl ===================================================================
3635 dnl ========================================================
3636 dnl By default, turn rtti and exceptions off on g++/egcs
3637 dnl ========================================================
3638 if test "$GNU_CXX"; then
3640 AC_MSG_CHECKING(for C++ exceptions flag)
3642 dnl They changed -f[no-]handle-exceptions to -f[no-]exceptions in g++ 2.8
3643 AC_CACHE_VAL(ac_cv_cxx_exceptions_flags,
3644 [echo "int main() { return 0; }" | cat > conftest.C
3646 ${CXX-g++} ${CXXFLAGS} -c -fno-handle-exceptions conftest.C > conftest.out 2>&1
3648 if egrep "warning.*renamed" conftest.out >/dev/null; then
3649 ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions
3651 ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-handle-exceptions
3656 AC_MSG_RESULT($ac_cv_cxx_exceptions_flags)
3657 _MOZ_EXCEPTIONS_FLAGS_OFF=$ac_cv_cxx_exceptions_flags
3658 _MOZ_EXCEPTIONS_FLAGS_ON=`echo $ac_cv_cxx_exceptions_flags | sed 's|no-||'`
3661 dnl ========================================================
3662 dnl Put your C++ language/feature checks below
3663 dnl ========================================================
3667 if test "$GNU_CC"; then
3668 AC_CACHE_CHECK(for gcc 3.0 ABI,
3669 ac_cv_gcc_three_abi,
3672 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
3678 ac_cv_gcc_three_abi="yes",
3679 ac_cv_gcc_three_abi="no")])
3680 if test "$ac_cv_gcc_three_abi" = "yes"; then
3681 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc3}"
3684 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc2}"
3687 AC_SUBST(HAVE_GCC3_ABI)
3690 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
3692 [AC_TRY_COMPILE(class X {
3693 public: explicit X(int i) : i_(i) {}
3697 ac_cv_cpp_explicit=yes,
3698 ac_cv_cpp_explicit=no)])
3699 if test "$ac_cv_cpp_explicit" = yes ; then
3700 AC_DEFINE(HAVE_CPP_EXPLICIT)
3703 AC_CACHE_CHECK(for C++ \"typename\" keyword,
3705 [AC_TRY_COMPILE(class param {
3707 typedef unsigned long num_type;
3710 template <class T> class tplt {
3712 typedef typename T::num_type t_num_type;
3713 t_num_type foo(typename T::num_type num) {
3719 ac_cv_cpp_typename=yes,
3720 ac_cv_cpp_typename=no)])
3721 if test "$ac_cv_cpp_typename" = yes ; then
3722 AC_DEFINE(HAVE_CPP_TYPENAME)
3725 dnl Check for support of modern template specialization syntax
3726 dnl Test code and requirement from scc@netscape.com.
3727 dnl Autoconf cut-and-paste job by waterson@netscape.com
3728 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3729 ac_cv_cpp_modern_specialize_template_syntax,
3730 [AC_TRY_COMPILE(template <class T> struct X { int a; };
3732 template <> struct X<Y> { double a; };,
3735 ac_cv_cpp_modern_specialize_template_syntax=yes,
3736 ac_cv_cpp_modern_specialize_template_syntax=no)])
3737 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
3738 AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
3742 dnl Some compilers support only full specialization, and some don't.
3743 AC_CACHE_CHECK(whether partial template specialization works,
3744 ac_cv_cpp_partial_specialization,
3745 [AC_TRY_COMPILE(template <class T> class Foo {};
3746 template <class T> class Foo<T*> {};,
3748 ac_cv_cpp_partial_specialization=yes,
3749 ac_cv_cpp_partial_specialization=no)])
3750 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3751 AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3754 dnl Some compilers have limited support for operators with templates;
3755 dnl specifically, it is necessary to define derived operators when a base
3756 dnl class's operator declaration should suffice.
3757 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
3758 ac_cv_need_derived_template_operators,
3759 [AC_TRY_COMPILE([template <class T> class Base { };
3761 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
3762 template <class T> class Derived : public Base<T> { };],
3763 [Derived<char> a, b;
3764 Base<char> c = a + b;
3766 ac_cv_need_derived_template_operators=no,
3767 ac_cv_need_derived_template_operators=yes)])
3768 if test "$ac_cv_need_derived_template_operators" = yes ; then
3769 AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
3773 dnl Some compilers have trouble detecting that a template class
3774 dnl that derives from another template is actually an instance
3775 dnl of the base class. This test checks for that.
3776 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
3777 ac_cv_need_cpp_template_cast_to_base,
3778 [AC_TRY_COMPILE([template <class T> class Base { };
3779 template <class T> class Derived : public Base<T> { };
3780 template <class T> int foo(const Base<T>&) { return 0; }],
3781 [Derived<char> bar; return foo(bar);],
3782 ac_cv_need_cpp_template_cast_to_base=no,
3783 ac_cv_need_cpp_template_cast_to_base=yes)])
3784 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
3785 AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
3788 dnl Some compilers have trouble resolving the ambiguity between two
3789 dnl functions whose arguments differ only by cv-qualifications.
3790 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
3791 ac_cv_can_resolve_const_ambiguity,
3793 template <class T> class ptrClass {
3797 template <class T> T* a(ptrClass<T> *arg) {
3802 const T* a(const ptrClass<T> *arg) {
3808 ac_cv_can_resolve_const_ambiguity=yes,
3809 ac_cv_can_resolve_const_ambiguity=no)])
3810 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
3811 AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
3815 dnl We don't do exceptions on unix. The only reason this used to be here
3816 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses
3817 dnl exceptions. But, we turn exceptions off by default and this test breaks.
3818 dnl So im commenting this out until someone writes some artificial
3819 dnl intelligence to detect not only if the compiler has exceptions, but if
3820 dnl they are enabled as well.
3822 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
3823 dnl ac_cv_cpp_exceptions,
3824 dnl [AC_TRY_COMPILE(class X { public: X() {} };
3825 dnl static void F() { throw X(); },
3826 dnl try { F(); } catch(X & e) { },
3827 dnl ac_cv_cpp_exceptions=yes,
3828 dnl ac_cv_cpp_exceptions=no)])
3829 dnl if test $ac_cv_cpp_exceptions = yes ; then
3830 dnl AC_DEFINE(HAVE_CPP_EXCEPTIONS)
3833 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
3834 dnl supports it well enough to allow us to use it to change access, but not
3835 dnl to resolve ambiguity. The next two tests determine how well the |using|
3836 dnl keyword is supported.
3838 dnl Check to see if we can change access with |using|. Test both a
3839 dnl legal and an illegal example.
3840 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
3841 ac_cv_cpp_access_changing_using2,
3843 class A { protected: int foo() { return 0; } };
3844 class B : public A { public: using A::foo; };,
3845 B b; return b.foo();,
3847 class A { public: int foo() { return 1; } };
3848 class B : public A { private: using A::foo; };,
3849 B b; return b.foo();,
3850 ac_cv_cpp_access_changing_using2=no,
3851 ac_cv_cpp_access_changing_using2=yes)],
3852 ac_cv_cpp_access_changing_using2=no)])
3853 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
3854 AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
3857 dnl Check to see if we can resolve ambiguity with |using|.
3858 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3859 ac_cv_cpp_ambiguity_resolving_using,
3860 [AC_TRY_COMPILE(class X {
3861 public: int go(const X&) {return 3;}
3862 int jo(const X&) {return 3;}
3864 class Y : public X {
3865 public: int go(int) {return 2;}
3866 int jo(int) {return 2;}
3868 private: using X::go;
3871 ac_cv_cpp_ambiguity_resolving_using=yes,
3872 ac_cv_cpp_ambiguity_resolving_using=no)])
3873 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3874 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3877 dnl Check to see if the |std| namespace is supported. If so, we'll want
3878 dnl to qualify any standard library calls with "std::" to ensure that
3879 dnl those functions can be resolved.
3880 AC_CACHE_CHECK(for \"std::\" namespace,
3881 ac_cv_cpp_namespace_std,
3882 [AC_TRY_COMPILE([#include <algorithm>],
3883 [return std::min(0, 1);],
3884 ac_cv_cpp_namespace_std=yes,
3885 ac_cv_cpp_namespace_std=no)])
3886 if test "$ac_cv_cpp_namespace_std" = yes ; then
3887 AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
3890 dnl Older compilers are overly ambitious with respect to using the standard
3891 dnl template library's |operator!=()| when |operator==()| is defined. In
3892 dnl which case, defining |operator!=()| in addition to |operator==()| causes
3893 dnl ambiguity at compile-time. This test checks for that case.
3894 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
3895 ac_cv_cpp_unambiguous_std_notequal,
3896 [AC_TRY_COMPILE([#include <algorithm>
3898 int operator==(const T1&, const T1&) { return 0; }
3899 int operator!=(const T1&, const T1&) { return 0; }],
3900 [T1 a,b; return a != b;],
3901 ac_cv_cpp_unambiguous_std_notequal=unambiguous,
3902 ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
3903 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
3904 AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
3908 AC_CACHE_CHECK(for C++ reinterpret_cast,
3909 ac_cv_cpp_reinterpret_cast,
3910 [AC_TRY_COMPILE(struct X { int i; };
3911 struct Y { int i; };,
3912 X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
3913 ac_cv_cpp_reinterpret_cast=yes,
3914 ac_cv_cpp_reinterpret_cast=no)])
3915 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
3916 AC_DEFINE(HAVE_CPP_NEW_CASTS)
3919 dnl See if a dynamic_cast to void* gives the most derived object.
3920 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3921 ac_cv_cpp_dynamic_cast_void_ptr,
3922 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3923 class Y { int j; public: virtual ~Y() { } };
3924 class Z : public X, public Y { int k; };
3930 return !((((void*)&mdo != (void*)subx) &&
3931 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3932 (((void*)&mdo != (void*)suby) &&
3933 ((void*)&mdo == dynamic_cast<void*>(suby))));
3935 ac_cv_cpp_dynamic_cast_void_ptr=yes,
3936 ac_cv_cpp_dynamic_cast_void_ptr=no,
3937 ac_cv_cpp_dynamic_cast_void_ptr=no)])
3938 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3939 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3943 dnl note that this one is reversed - if the test fails, then
3944 dnl we require implementations of unused virtual methods. Which
3945 dnl really blows because it means we'll have useless vtable
3947 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3948 ac_cv_cpp_unused_required,
3949 [AC_TRY_LINK(class X {private: virtual void never_called();};,
3951 ac_cv_cpp_unused_required=no,
3952 ac_cv_cpp_unused_required=yes)])
3953 if test "$ac_cv_cpp_unused_required" = yes ; then
3954 AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3958 dnl Some compilers have trouble comparing a constant reference to a templatized
3959 dnl class to zero, and require an explicit operator==() to be defined that takes
3960 dnl an int. This test separates the strong from the weak.
3962 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3963 ac_cv_trouble_comparing_to_zero,
3964 [AC_TRY_COMPILE([#include <algorithm>
3965 template <class T> class Foo {};
3967 template <class T> int operator==(const T2*, const T&) { return 0; }
3968 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3969 [Foo<int> f; return (0 != f);],
3970 ac_cv_trouble_comparing_to_zero=no,
3971 ac_cv_trouble_comparing_to_zero=yes)])
3972 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3973 AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3978 dnl End of C++ language/feature checks
3981 dnl ========================================================
3982 dnl = Internationalization checks
3983 dnl ========================================================
3985 dnl Internationalization and Locale support is different
3986 dnl on various UNIX platforms. Checks for specific i18n
3987 dnl features go here.
3989 dnl check for LC_MESSAGES
3990 AC_CACHE_CHECK(for LC_MESSAGES,
3991 ac_cv_i18n_lc_messages,
3992 [AC_TRY_COMPILE([#include <locale.h>],
3993 [int category = LC_MESSAGES;],
3994 ac_cv_i18n_lc_messages=yes,
3995 ac_cv_i18n_lc_messages=no)])
3996 if test "$ac_cv_i18n_lc_messages" = yes; then
3997 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4000 fi # SKIP_COMPILER_CHECKS
4003 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4004 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4007 dnl Mozilla specific options
4008 dnl ========================================================
4009 dnl The macros used for command line options
4010 dnl are defined in build/autoconf/altoptions.m4.
4013 dnl ========================================================
4015 dnl = Check for external package dependencies
4017 dnl ========================================================
4018 MOZ_ARG_HEADER(External Packages)
4022 MOZ_ARG_WITH_STRING(libxul-sdk,
4023 [ --with-libxul-sdk=PFX Use the libXUL SDK at <PFX>],
4024 LIBXUL_SDK_DIR=$withval)
4026 if test "$LIBXUL_SDK_DIR" = "yes"; then
4027 AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4028 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4029 LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4031 if test ! -f "$LIBXUL_SDK/sdk/include/xpcom-config.h"; then
4032 AC_MSG_ERROR([$LIBXUL_SDK/sdk/include/xpcom-config.h doesn't exist])
4037 AC_SUBST(LIBXUL_SDK)
4039 if test -n "$LIBXUL_SDK"; then
4040 LIBXUL_DIST="$LIBXUL_SDK"
4042 LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4044 AC_SUBST(LIBXUL_DIST)
4048 MOZ_ARG_WITH_BOOL(system-libxul,
4049 [ --with-system-libxul Use system installed libxul SDK],
4052 if test -n "$SYSTEM_LIBXUL" && test -z "$MOZ_ENABLE_LIBXUL"; then
4053 AC_MSG_ERROR([--with-system-libxul needs --with-libxul-sdk])
4056 dnl ========================================================
4057 dnl = If NSPR was not detected in the system,
4058 dnl = use the one in the source tree (mozilla/nsprpub)
4059 dnl ========================================================
4060 MOZ_ARG_WITH_BOOL(system-nspr,
4061 [ --with-system-nspr Use system installed NSPR],
4062 _USE_SYSTEM_NSPR=1 )
4064 if test -n "$_USE_SYSTEM_NSPR"; then
4065 AM_PATH_NSPR(4.7.0, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
4068 if test -n "$MOZ_NATIVE_NSPR"; then
4069 _SAVE_CFLAGS=$CFLAGS
4070 CFLAGS="$CFLAGS $NSPR_CFLAGS"
4071 AC_TRY_COMPILE([#include "prlog.h"],
4072 [#ifndef PR_STATIC_ASSERT
4073 #error PR_STATIC_ASSERT not defined
4075 [MOZ_NATIVE_NSPR=1],
4076 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
4077 CFLAGS=$_SAVE_CFLAGS
4079 NSPR_CFLAGS='`$(DEPTH)/nsprpub/config/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4080 if test "$OS_ARCH" = "WINCE"; then
4081 NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4082 NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4083 elif test "$OS_ARCH" = "WINNT"; then
4084 NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4085 if test -n "$GNU_CC"; then
4086 NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4088 NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4091 NSPR_LIBS='`$(DEPTH)/nsprpub/config/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4095 dnl ========================================================
4096 dnl = If NSS was not detected in the system,
4097 dnl = use the one in the source tree (mozilla/security/nss)
4098 dnl ========================================================
4100 MOZ_ARG_WITH_BOOL(system-nss,
4101 [ --with-system-nss Use system installed NSS],
4104 if test -n "$_USE_SYSTEM_NSS"; then
4105 AM_PATH_NSS(3.12.0, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4108 if test -n "$MOZ_NATIVE_NSS"; then
4109 NSS_LIBS="$NSS_LIBS -lcrmf"
4111 NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4113 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4114 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4115 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4116 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4117 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX) \
4118 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)softokn$NSS_VERSION\$(DLL_SUFFIX)"
4120 if test -z "$GNU_CC" && test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4122 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4123 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4124 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4125 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4126 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(IMPORT_LIB_SUFFIX) \
4127 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)softokn$NSS_VERSION.\$(IMPORT_LIB_SUFFIX)"
4129 NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION -lsoftokn$NSS_VERSION"
4133 if test -z "$SKIP_LIBRARY_CHECKS"; then
4134 dnl system JPEG support
4135 dnl ========================================================
4136 MOZ_ARG_WITH_STRING(system-jpeg,
4137 [ --with-system-jpeg[=PFX]
4138 Use system libjpeg [installed at prefix PFX]],
4141 _SAVE_CFLAGS=$CFLAGS
4142 _SAVE_LDFLAGS=$LDFLAGS
4144 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4145 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4146 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4148 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4151 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4154 if test "$SYSTEM_JPEG" = 1; then
4155 LIBS="$JPEG_LIBS $LIBS"
4156 AC_TRY_COMPILE([ #include <stdio.h>
4157 #include <sys/types.h>
4158 #include <jpeglib.h> ],
4159 [ #if JPEG_LIB_VERSION < $MOZJPEG
4160 #error "Insufficient JPEG library version ($MOZJPEG required)."
4163 [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=])
4165 CFLAGS=$_SAVE_CFLAGS
4166 LDFLAGS=$_SAVE_LDFLAGS
4169 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4170 JPEG_CFLAGS="-I${JPEG_DIR}/include"
4171 JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4174 dnl system ZLIB support
4175 dnl ========================================================
4176 MOZ_ARG_WITH_STRING(system-zlib,
4177 [ --with-system-zlib[=PFX]
4178 Use system libz [installed at prefix PFX]],
4181 _SAVE_CFLAGS=$CFLAGS
4182 _SAVE_LDFLAGS=$LDFLAGS
4184 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4185 CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4186 LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4188 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4191 AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"],
4192 [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4194 if test "$SYSTEM_ZLIB" = 1; then
4195 LIBS="$ZLIB_LIBS $LIBS"
4196 AC_TRY_COMPILE([ #include <stdio.h>
4198 #include <zlib.h> ],
4199 [ #if ZLIB_VERNUM < $MOZZLIB
4200 #error "Insufficient zlib version ($MOZZLIB required)."
4203 [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=])
4205 CFLAGS=$_SAVE_CFLAGS
4206 LDFLAGS=$_SAVE_LDFLAGS
4209 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4210 ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4211 ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4214 dnl system BZIP2 Support
4215 dnl ========================================================
4216 MOZ_ARG_WITH_STRING(system-bz2,
4217 [ --with-system-bz2[=PFX]
4218 Use system libbz2 [installed at prefix PFX]],
4221 _SAVE_CFLAGS=$CFLAGS
4222 _SAVE_LDFLAGS=$LDFLAGS
4224 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4225 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4226 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4228 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4231 AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4232 [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=], $BZ2_LIBS)
4234 CFLAGS=$_SAVE_CFLAGS
4235 LDFLAGS=$_SAVE_LDFLAGS
4238 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4239 BZ2_CFLAGS="-I${BZ2_DIR}/include"
4240 BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
4243 dnl system PNG Support
4244 dnl ========================================================
4245 MOZ_ARG_WITH_STRING(system-png,
4246 [ --with-system-png[=PFX]
4247 Use system libpng [installed at prefix PFX]],
4250 _SAVE_CFLAGS=$CFLAGS
4251 _SAVE_LDFLAGS=$LDFLAGS
4253 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4254 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4255 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4256 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4257 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4259 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4262 _SAVE_PNG_LIBS=$PNG_LIBS
4263 AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4264 AC_MSG_ERROR([--with-system-png requested but no working libpng found]),
4266 AC_CHECK_LIB(png, png_get_acTL, ,
4267 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4270 if test "$SYSTEM_PNG" = 1; then
4271 LIBS="$PNG_LIBS $LIBS"
4272 AC_TRY_COMPILE([ #include <stdio.h>
4273 #include <sys/types.h>
4275 [ #if PNG_LIBPNG_VER < $MOZPNG
4276 #error "Insufficient libpng version ($MOZPNG required)."
4278 #ifndef PNG_UINT_31_MAX
4279 #error "Insufficient libpng version."
4282 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4284 CFLAGS=$_SAVE_CFLAGS
4285 LDFLAGS=$_SAVE_LDFLAGS
4288 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4289 PNG_CFLAGS="-I${PNG_DIR}/include"
4290 PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4293 fi # SKIP_LIBRARY_CHECKS
4295 dnl system HunSpell Support
4296 dnl ========================================================
4297 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4298 [ --enable-system-hunspell Use system hunspell (located with pkgconfig)],
4301 if test -n "$SYSTEM_HUNSPELL"; then
4302 PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4305 AC_SUBST(SYSTEM_HUNSPELL)
4307 dnl ========================================================
4308 dnl Java SDK support
4309 dnl ========================================================
4311 MOZ_ARG_WITH_STRING(java-include-path,
4312 [ --with-java-include-path=dir Location of Java SDK headers],
4313 JAVA_INCLUDE_PATH=$withval)
4316 MOZ_ARG_WITH_STRING(java-bin-path,
4317 [ --with-java-bin-path=dir Location of Java binaries (java, javac, jar)],
4318 JAVA_BIN_PATH=$withval)
4320 dnl ========================================================
4321 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4322 dnl their usage and use them in spidermonkey.
4323 dnl ========================================================
4324 MOZ_ARG_WITH_BOOL(arm-kuser,
4325 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4328 if test -n "$USE_ARM_KUSER"; then
4329 AC_DEFINE(USE_ARM_KUSER)
4332 dnl ========================================================
4336 dnl ========================================================
4338 MOZ_ARG_HEADER(Application)
4342 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4343 MOZ_BRANDING_DIRECTORY=
4344 MOZ_DBGRINFO_MODULES=
4347 MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp xbm icon"
4348 MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
4355 MOZ_AUTH_EXTENSION=1
4356 MOZ_NO_ACTIVEX_SUPPORT=1
4357 MOZ_NO_INSPECTOR_APIS=
4358 MOZ_NO_XPCOM_OBSOLETE=
4367 MOZ_PLAINTEXT_EDITOR_ONLY=
4369 MOZ_PREF_EXTENSIONS=1
4370 MOZ_PROFILELOCKING=1
4372 MOZ_PYTHON_EXTENSIONS="xpcom dom"
4374 MOZ_PYTHON_DEBUG_SUFFIX=
4375 MOZ_PYTHON_DLL_SUFFIX=
4376 MOZ_PYTHON_INCLUDES=
4380 MOZ_PYTHON_VER_DOTTED=
4386 MOZ_STATIC_MAIL_BUILD=
4391 MOZ_UNIVERSALCHARDET=1
4393 MOZ_USE_NATIVE_UCONV=
4395 MOZ_XPFE_COMPONENTS=1
4397 MOZ_XSLT_STANDALONE=
4404 NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource"
4405 NECKO_SMALL_BUFFERS=
4406 XPC_IDISPATCH_SUPPORT=
4409 case "$target_os" in
4418 case "$target_os" in
4419 msvc*|mks*|cygwin*|mingw*)
4420 if test -z "$GNU_CC"; then
4421 XPC_IDISPATCH_SUPPORT=1
4422 MOZ_NO_ACTIVEX_SUPPORT=
4423 MOZ_ACTIVEX_SCRIPTING_SUPPORT=1
4428 MOZ_ARG_ENABLE_STRING(application,
4429 [ --enable-application=APP
4433 content/xslt (Standalone Transformiix XSLT)
4434 netwerk (Standalone Necko)
4435 tools/update-packaging (AUS-related packaging tools)
4436 standalone (use this for standalone
4437 xpcom/xpconnect or to manually drive a build)],
4438 [ MOZ_BUILD_APP=$enableval ] )
4440 MOZ_EMBEDDING_PROFILE=default
4441 MOZ_ARG_WITH_STRING(embedding-profile,
4442 [ --with-embedding-profile=default|basic|minimal
4443 see http://wiki.mozilla.org/Gecko:Small_Device_Support],
4444 [ MOZ_EMBEDDING_PROFILE=$withval ])
4446 case "$MOZ_EMBEDDING_PROFILE" in
4448 MOZ_EMBEDDING_LEVEL_DEFAULT=1
4449 MOZ_EMBEDDING_LEVEL_BASIC=1
4450 MOZ_EMBEDDING_LEVEL_MINIMAL=1
4451 AC_DEFINE(MOZ_EMBEDDING_LEVEL_DEFAULT)
4452 AC_DEFINE(MOZ_EMBEDDING_LEVEL_BASIC)
4453 AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4457 MOZ_EMBEDDING_LEVEL_DEFAULT=
4458 MOZ_EMBEDDING_LEVEL_BASIC=1
4459 MOZ_EMBEDDING_LEVEL_MINIMAL=1
4460 AC_DEFINE(MOZ_EMBEDDING_LEVEL_BASIC)
4461 AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4463 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4465 MOZ_ENABLE_POSTSCRIPT=
4466 MOZ_EXTENSIONS_DEFAULT=" spatialnavigation"
4467 MOZ_IMG_DECODERS_DEFAULT="png gif jpeg"
4468 MOZ_IMG_ENCODERS_DEFAULT=
4474 MOZ_NO_ACTIVEX_SUPPORT=1
4475 MOZ_NO_INSPECTOR_APIS=1
4476 MOZ_NO_XPCOM_OBSOLETE=1
4479 MOZ_PLAINTEXT_EDITOR_ONLY=1
4481 MOZ_PREF_EXTENSIONS=
4485 MOZ_UNIVERSALCHARDET=
4487 MOZ_USE_NATIVE_UCONV=
4489 MOZ_XPFE_COMPONENTS=
4494 NECKO_PROTOCOLS_DEFAULT="about data http file res"
4495 NECKO_SMALL_BUFFERS=1
4496 NS_DISABLE_LOGGING=1
4501 MOZ_EMBEDDING_LEVEL_DEFAULT=
4502 MOZ_EMBEDDING_LEVEL_BASIC=
4503 MOZ_EMBEDDING_LEVEL_MINIMAL=1
4504 AC_DEFINE(MOZ_EMBEDDING_LEVEL_MINIMAL)
4506 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4508 MOZ_ENABLE_POSTSCRIPT=
4509 MOZ_EXTENSIONS_DEFAULT=" spatialnavigation"
4510 MOZ_IMG_DECODERS_DEFAULT="png gif jpeg"
4511 MOZ_IMG_ENCODERS_DEFAULT=
4517 MOZ_NO_ACTIVEX_SUPPORT=1
4518 MOZ_NO_INSPECTOR_APIS=1
4519 MOZ_NO_XPCOM_OBSOLETE=1
4522 MOZ_PLAINTEXT_EDITOR_ONLY=1
4524 MOZ_PREF_EXTENSIONS=
4530 MOZ_UNIVERSALCHARDET=
4532 MOZ_USE_NATIVE_UCONV=1
4534 MOZ_XPFE_COMPONENTS=
4541 NECKO_PROTOCOLS_DEFAULT="about data http file res"
4542 NECKO_SMALL_BUFFERS=1
4543 NS_DISABLE_LOGGING=1
4548 AC_MSG_ERROR([Unrecognized value: --with-embedding-profile=$MOZ_EMBEDDING_PROFILE])
4552 AC_SUBST(MOZ_EMBEDDING_LEVEL_DEFAULT)
4553 AC_SUBST(MOZ_EMBEDDING_LEVEL_BASIC)
4554 AC_SUBST(MOZ_EMBEDDING_LEVEL_MINIMAL)
4556 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4557 [ --with-xulrunner-stub-name=appname Create the xulrunner stub with the given name],
4558 XULRUNNER_STUB_NAME=$withval)
4560 if test -z "$XULRUNNER_STUB_NAME"; then
4561 case "$target_os" in
4563 XULRUNNER_STUB_NAME=xulrunner
4566 XULRUNNER_STUB_NAME=xulrunner-stub
4569 AC_SUBST(XULRUNNER_STUB_NAME)
4571 if test -z "$MOZ_BUILD_APP"; then
4572 AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
4574 # We have a valid application only if it has a build.mk file in its top
4576 if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4577 AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4581 # Allow the application to influence configure with a confvars.sh script.
4583 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4584 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4585 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4586 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4591 # Now is a good time to test for logic errors, define mismatches, etc.
4592 case "$MOZ_BUILD_APP" in
4594 if test "$LIBXUL_SDK"; then
4595 AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4600 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4601 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4603 case "$MOZ_BUILD_APP" in
4605 AC_DEFINE(MOZ_PHOENIX)
4609 AC_DEFINE(MOZ_XULRUNNER)
4617 MOZ_APP_NAME=mozilla
4618 MOZ_APP_DISPLAYNAME=Mozilla
4619 MOZ_APP_VERSION=$MOZILLA_VERSION
4624 AC_SUBST(MOZ_BUILD_APP)
4625 AC_SUBST(MOZ_PHOENIX)
4626 AC_SUBST(MOZ_XULRUNNER)
4628 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4630 dnl ========================================================
4632 dnl = Toolkit Options
4634 dnl ========================================================
4635 MOZ_ARG_HEADER(Toolkit Options)
4637 dnl ========================================================
4638 dnl = Select the default toolkit
4639 dnl ========================================================
4640 MOZ_ARG_ENABLE_STRING(default-toolkit,
4641 [ --enable-default-toolkit=TK
4642 Select default toolkit
4643 Platform specific defaults:
4645 Mac OS X - cairo-cocoa
4646 Neutrino/QNX - photon
4648 Win32 - cairo-windows
4650 Gtk2 with DirectFB - cairo-gtk2-dfb
4653 [ _DEFAULT_TOOLKIT=$enableval ],
4654 [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4656 if test "$_DEFAULT_TOOLKIT" = "photon" \
4657 -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4658 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4659 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
4660 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4661 -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4662 -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
4663 -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4664 -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa"
4666 dnl nglayout only supports building with one toolkit,
4667 dnl so ignore everything after the first comma (",").
4668 MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4670 AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4673 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_TOOLKIT,"$MOZ_WIDGET_TOOLKIT")
4675 dnl ========================================================
4676 dnl = Enable the toolkit as needed =
4677 dnl ========================================================
4679 case "$MOZ_WIDGET_TOOLKIT" in
4682 AC_DEFINE(MOZ_WIDGET_PHOTON)
4686 MOZ_WIDGET_TOOLKIT=windows
4687 MOZ_GFX_TOOLKIT=cairo
4690 cairo-gtk2|cairo-gtk2-x11)
4691 MOZ_WIDGET_TOOLKIT=gtk2
4692 MOZ_GFX_TOOLKIT=cairo
4694 MOZ_ENABLE_XREMOTE=1
4699 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4700 TK_LIBS='$(MOZ_GTK2_LIBS)'
4701 AC_DEFINE(MOZ_WIDGET_GTK2)
4705 MOZ_WIDGET_TOOLKIT=gtk2
4706 MOZ_GFX_TOOLKIT=cairo
4712 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4713 TK_LIBS='$(MOZ_GTK2_LIBS)'
4714 AC_DEFINE(MOZ_WIDGET_GTK2)
4715 if test "$no_x" != "yes"; then
4716 AC_MSG_WARN([Disabling X when DirectFB is specified.])
4722 MOZ_WIDGET_TOOLKIT=qt
4723 MOZ_GFX_TOOLKIT=cairo
4725 MOZ_ENABLE_XREMOTE=1
4732 TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4733 TK_LIBS='$(MOZ_QT_LIBS)'
4734 AC_DEFINE(MOZ_WIDGET_QT)
4738 MOZ_WIDGET_TOOLKIT=beos
4739 MOZ_GFX_TOOLKIT=cairo
4740 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4741 TK_LIBS='$(MOZ_CAIRO_LIBS)'
4745 MOZ_WIDGET_TOOLKIT=os2
4746 MOZ_GFX_TOOLKIT=cairo
4747 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4748 TK_LIBS='$(MOZ_CAIRO_LIBS)'
4752 MOZ_WIDGET_TOOLKIT=cocoa
4753 AC_DEFINE(MOZ_WIDGET_COCOA)
4755 MOZ_GFX_TOOLKIT=cairo
4756 MOZ_USER_DIR="Mozilla"
4757 AC_DEFINE(XP_MACOSX)
4758 AC_DEFINE(TARGET_CARBON)
4759 AC_DEFINE(TARGET_API_MAC_CARBON)
4760 TK_LIBS='-framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook'
4761 TK_CFLAGS="-I${MACOS_SDK_DIR}/Developer/Headers/FlatCarbon"
4762 CFLAGS="$CFLAGS $TK_CFLAGS"
4763 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4767 if test "$MOZ_ENABLE_XREMOTE"; then
4768 AC_DEFINE(MOZ_ENABLE_XREMOTE)
4771 if test "$COMPILE_ENVIRONMENT"; then
4772 if test "$MOZ_ENABLE_GTK2"; then
4773 if test "$MOZ_X11"; then
4774 GDK_PACKAGES=gdk-x11-2.0
4775 elif test "$MOZ_DFB"; then
4776 PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
4777 GDK_PACKAGES=directfb
4780 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4783 fi # COMPILE_ENVIRONMENT
4785 AC_SUBST(MOZ_DEFAULT_TOOLKIT)
4787 dnl ========================================================
4788 dnl = startup-notification support module
4789 dnl ========================================================
4791 if test "$MOZ_ENABLE_GTK2"
4793 MOZ_ENABLE_STARTUP_NOTIFICATION=
4795 MOZ_ARG_ENABLE_BOOL(startup-notification,
4796 [ --enable-startup-notification Enable startup-notification support (default: disabled) ],
4797 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4798 MOZ_ENABLE_STARTUP_NOTIFICATION=)
4799 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4801 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4802 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4803 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4804 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4806 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4808 MOZ_ENABLE_STARTUP_NOTIFICATION=
4812 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4813 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4816 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4818 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4819 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4820 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4822 dnl ========================================================
4824 dnl ========================================================
4825 if test "$MOZ_ENABLE_QT"
4827 PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtUiTools QtCore)
4828 AC_SUBST(MOZ_QT_CFLAGS)
4829 AC_SUBST(MOZ_QT_LIBS)
4831 MOZ_ARG_WITH_STRING(qtdir,
4832 [ --with-qtdir=\$dir Specify Qt directory ],
4835 if test -z "$QTDIR"; then
4838 QTINCDIR="/include/qt"
4839 if test ! -d "$QTDIR$QTINCDIR"; then
4840 QTINCDIR="/include/X11/qt"
4842 if test ! -d "$QTDIR$QTINCDIR"; then
4846 if test -x "$QTDIR/bin/moc-qt4"; then
4847 HOST_MOC="$QTDIR/bin/moc-qt4"
4849 if test -x "$QTDIR/bin/moc"; then
4850 HOST_MOC="$QTDIR/bin/moc"
4852 AC_CHECK_PROGS(HOST_MOC, moc, "")
4855 if test -z "$HOST_MOC"; then
4856 AC_MSG_ERROR([no acceptable moc preprocessor found])
4861 AC_SUBST(GTK_CONFIG)
4865 AC_SUBST(MOZ_ENABLE_GTK2)
4866 AC_SUBST(MOZ_ENABLE_PHOTON)
4867 AC_SUBST(MOZ_ENABLE_COCOA)
4868 AC_SUBST(MOZ_ENABLE_QT)
4869 AC_SUBST(MOZ_ENABLE_XREMOTE)
4870 AC_SUBST(MOZ_GTK2_CFLAGS)
4871 AC_SUBST(MOZ_GTK2_LIBS)
4872 AC_SUBST(MOZ_QT_CFLAGS)
4873 AC_SUBST(MOZ_QT_LIBS)
4880 dnl ========================================================
4882 dnl = Components & Features
4884 dnl ========================================================
4885 MOZ_ARG_HEADER(Components and Features)
4887 dnl ========================================================
4889 dnl ========================================================
4890 MOZ_ARG_ENABLE_STRING(ui-locale,
4891 [ --enable-ui-locale=ab-CD
4892 Select the user interface locale (default: en-US)],
4893 MOZ_UI_LOCALE=$enableval )
4894 AC_SUBST(MOZ_UI_LOCALE)
4896 dnl ========================================================
4897 dnl = Trademarked Branding
4898 dnl ========================================================
4899 MOZ_ARG_ENABLE_BOOL(official-branding,
4900 [ --enable-official-branding Enable Official mozilla.org Branding
4901 Do not distribute builds with
4902 --enable-official-branding unless you have
4903 permission to use trademarks per
4904 http://www.mozilla.org/foundation/trademarks/ .],
4905 [case "$MOZ_BUILD_APP" in
4907 MOZ_BRANDING_DIRECTORY=other-licenses/branding/firefox
4908 MOZ_APP_DISPLAYNAME=Firefox
4912 AC_MSG_ERROR([Official branding is only available for Firefox.])
4916 MOZ_ARG_WITH_STRING(branding,
4917 [ --with-branding=dir Use branding from the specified directory.],
4918 MOZ_BRANDING_DIRECTORY=$withval)
4920 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4921 if test -z "$REAL_BRANDING_DIRECTORY"; then
4922 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4925 if test -f "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4926 . "$topsrcdir/$REAL_BRANDING_DIRECTORY/configure.sh"
4929 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4931 dnl ========================================================
4932 dnl = Distribution ID
4933 dnl ========================================================
4934 MOZ_ARG_WITH_STRING(distribution-id,
4935 [ --with-distribution-id=ID Set distribution-specific id (default=org.mozilla)],
4936 [ val=`echo $withval`
4937 MOZ_DISTRIBUTION_ID="$val"])
4939 if test -z "$MOZ_DISTRIBUTION_ID"; then
4940 MOZ_DISTRIBUTION_ID="org.mozilla"
4943 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4944 AC_SUBST(MOZ_DISTRIBUTION_ID)
4947 dnl ========================================================
4948 dnl complex text support off by default
4949 dnl ========================================================
4951 MOZ_ARG_DISABLE_BOOL(pango,
4952 [ --disable-pango Disable usage of Pango ],
4957 dnl ========================================================
4959 dnl ========================================================
4960 if test "$MOZ_ENABLE_GTK2"
4964 PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4966 if test "$MOZ_PANGO"
4968 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
4969 AC_SUBST(MOZ_PANGO_CFLAGS)
4970 AC_SUBST(MOZ_PANGO_LIBS)
4971 AC_DEFINE(MOZ_PANGO)
4973 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
4974 AC_SUBST(MOZ_PANGO_CFLAGS)
4975 AC_SUBST(MOZ_PANGO_LIBS)
4977 PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
4978 AC_SUBST(FT2_CFLAGS)
4983 dnl ========================================================
4984 dnl = PostScript print module
4985 dnl ========================================================
4986 MOZ_ARG_DISABLE_BOOL(postscript,
4987 [ --disable-postscript Disable PostScript printing support ],
4988 MOZ_ENABLE_POSTSCRIPT=,
4989 MOZ_ENABLE_POSTSCRIPT=1 )
4991 dnl ========================================================
4992 dnl = GnomeVFS support module
4993 dnl ========================================================
4997 dnl build the gnomevfs extension by default only when the
4998 dnl GTK2 toolkit is in use.
4999 if test "$MOZ_ENABLE_GTK2"
5001 MOZ_ENABLE_GNOMEVFS=1
5003 MOZ_ENABLE_LIBGNOME=1
5006 MOZ_ARG_DISABLE_BOOL(gnomevfs,
5007 [ --disable-gnomevfs Disable GnomeVFS support ],
5008 MOZ_ENABLE_GNOMEVFS=,
5009 MOZ_ENABLE_GNOMEVFS=force)
5011 if test "$MOZ_ENABLE_GNOMEVFS"
5013 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5014 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5015 MOZ_ENABLE_GNOMEVFS=1
5017 if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5019 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5021 MOZ_ENABLE_GNOMEVFS=
5025 AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5026 AC_SUBST(MOZ_GNOMEVFS_LIBS)
5028 if test "$MOZ_ENABLE_GCONF"
5030 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION,[
5031 MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5038 if test "$MOZ_ENABLE_GCONF"; then
5039 AC_DEFINE(MOZ_ENABLE_GCONF)
5042 AC_SUBST(MOZ_ENABLE_GCONF)
5043 AC_SUBST(MOZ_GCONF_CFLAGS)
5044 AC_SUBST(MOZ_GCONF_LIBS)
5046 if test "$MOZ_ENABLE_LIBGNOME"
5048 PKG_CHECK_MODULES(MOZ_LIBGNOME, libgnome-2.0 >= $LIBGNOME_VERSION,[
5049 MOZ_LIBGNOME_LIBS=`echo $MOZ_LIBGNOME_LIBS | sed 's/-llinc\>//'`
5050 MOZ_ENABLE_LIBGNOME=1
5052 MOZ_ENABLE_LIBGNOME=
5056 AC_SUBST(MOZ_LIBGNOME_CFLAGS)
5057 AC_SUBST(MOZ_LIBGNOME_LIBS)
5059 # The GNOME component is built if gtk2, gconf, gnome-vfs, and libgnome
5060 # are all available.
5062 if test "$MOZ_ENABLE_GTK2" -a "$MOZ_ENABLE_GCONF" -a \
5063 "$MOZ_ENABLE_GNOMEVFS" -a "$MOZ_ENABLE_LIBGNOME"; then
5064 MOZ_ENABLE_GNOME_COMPONENT=1
5066 MOZ_ENABLE_GNOME_COMPONENT=
5069 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5072 dnl ========================================================
5073 dnl = libgnomeui support module
5074 dnl ========================================================
5076 if test "$MOZ_ENABLE_GTK2"
5078 MOZ_ENABLE_GNOMEUI=1
5080 MOZ_ARG_DISABLE_BOOL(gnomeui,
5081 [ --disable-gnomeui Disable libgnomeui support (default: auto, optional at runtime) ],
5082 MOZ_ENABLE_GNOMEUI=,
5083 MOZ_ENABLE_GNOMEUI=force)
5085 if test "$MOZ_ENABLE_GNOMEUI"
5087 PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5089 MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5090 MOZ_ENABLE_GNOMEUI=1
5092 if test "$MOZ_ENABLE_GNOMEUI" = "force"
5094 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5100 if test "$MOZ_ENABLE_GNOMEUI"; then
5101 AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5104 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5105 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5106 AC_SUBST(MOZ_GNOMEUI_LIBS)
5108 dnl ========================================================
5110 dnl ========================================================
5112 if test "$MOZ_ENABLE_GTK2" || test "$MOZ_ENABLE_QT"
5116 MOZ_ARG_DISABLE_BOOL(dbus,
5117 [ --disable-dbus Disable dbus support ],
5121 if test "$MOZ_ENABLE_DBUS"
5123 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5124 AC_DEFINE(MOZ_ENABLE_DBUS)
5127 AC_SUBST(MOZ_ENABLE_DBUS)
5128 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5129 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5131 dnl ========================================================
5132 dnl = libnotify support
5133 dnl ========================================================
5135 MOZ_ARG_ENABLE_BOOL(libnotify,
5136 [ --enable-libnotify Enable libnotify support ],
5137 MOZ_ENABLE_LIBNOTIFY=1,
5138 MOZ_ENABLE_LIBNOTIFY=)
5140 if test "$MOZ_ENABLE_GTK2"
5142 if test "$MOZ_ENABLE_LIBNOTIFY"
5144 AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5148 if test -z "$SKIP_LIBRARY_CHECKS"
5150 if test "$MOZ_ENABLE_GTK2"
5152 if test "$MOZ_ENABLE_LIBNOTIFY"
5154 PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5158 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5159 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5160 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5162 dnl ========================================================
5163 dnl = Build Personal Security Manager
5164 dnl ========================================================
5165 MOZ_ARG_DISABLE_BOOL(crypto,
5166 [ --disable-crypto Disable crypto support (Personal Security Manager)],
5170 dnl ========================================================
5171 dnl = JS Debugger XPCOM component (js/jsd)
5172 dnl ========================================================
5173 MOZ_ARG_DISABLE_BOOL(jsd,
5174 [ --disable-jsd Disable JavaScript debug library],
5179 dnl ========================================================
5180 dnl = Disable plugin support
5181 dnl ========================================================
5182 MOZ_ARG_DISABLE_BOOL(plugins,
5183 [ --disable-plugins Disable plugins support],
5187 dnl ========================================================
5188 dnl = Disable building dbm
5189 dnl ========================================================
5190 MOZ_ARG_DISABLE_BOOL(dbm,
5191 [ --disable-dbm Disable building dbm],
5195 dnl ========================================================
5196 dnl = Open JVM Interface (OJI) support
5197 dnl ========================================================
5198 MOZ_ARG_DISABLE_BOOL(oji,
5199 [ --disable-oji Disable Open JVM Integration support],
5202 if test -n "$MOZ_OJI"; then
5206 dnl bi-directional support always on
5210 dnl ========================================================
5211 dnl view source support on by default
5212 dnl ========================================================
5213 MOZ_ARG_DISABLE_BOOL(view-source,
5214 [ --disable-view-source Disable view source support],
5217 if test "$MOZ_VIEW_SOURCE"; then
5218 AC_DEFINE(MOZ_VIEW_SOURCE)
5222 dnl ========================================================
5223 dnl accessibility support on by default on all platforms
5225 dnl ========================================================
5226 MOZ_ARG_DISABLE_BOOL(accessibility,
5227 [ --disable-accessibility Disable accessibility support (off by default on OS X)],
5230 if test "$ACCESSIBILITY"; then
5231 AC_DEFINE(ACCESSIBILITY)
5234 if test -n "$ACCESSIBILITY" -a "$COMPILE_ENVIRONMENT" = "1"; then
5236 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5237 if test "$ac_cv_header_atlbase_h" = "no"; then
5238 AC_MSG_ERROR([System header atlbase.h is not available. See http://developer.mozilla.org/en/docs/atlbase.h for details on fixing this problem.])
5240 if test "$ac_cv_header_oleacc_idl" = "no"; then
5241 AC_MSG_ERROR([System header oleacc.idl is not available. See http://developer.mozilla.org/en/docs/oleacc.idl for details on fixing this problem.])
5247 dnl ========================================================
5248 dnl xpfe/components on by default
5249 dnl ========================================================
5250 MOZ_ARG_DISABLE_BOOL(xpfe-components,
5251 [ --disable-xpfe-components
5252 Disable xpfe components],
5253 MOZ_XPFE_COMPONENTS=,
5254 MOZ_XPFE_COMPONENTS=1 )
5256 dnl ========================================================
5257 dnl xpinstall support on by default
5258 dnl ========================================================
5259 MOZ_ARG_DISABLE_BOOL(xpinstall,
5260 [ --disable-xpinstall Disable xpinstall support],
5263 if test "$MOZ_XPINSTALL"; then
5264 AC_DEFINE(MOZ_XPINSTALL)
5267 dnl ========================================================
5268 dnl xpcom js loader support on by default
5269 dnl ========================================================
5270 MOZ_ARG_DISABLE_BOOL(jsloader,
5271 [ --disable-jsloader Disable xpcom js loader support],
5274 if test "$MOZ_JSLOADER"; then
5275 AC_DEFINE(MOZ_JSLOADER)
5278 dnl ========================================================
5279 dnl Disable printing
5280 dnl ========================================================
5281 MOZ_ARG_DISABLE_BOOL(printing,
5282 [ --disable-printing Disable printing support],
5286 if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
5287 AC_MSG_WARN([Printing does not work with Qt at this time. Omitting printing support.])
5291 if test "$NS_PRINTING"; then
5292 AC_DEFINE(NS_PRINTING)
5293 AC_DEFINE(NS_PRINT_PREVIEW)
5296 dnl ========================================================
5297 dnl use native unicode converters
5298 dnl ========================================================
5299 MOZ_ARG_ENABLE_BOOL(native-uconv,
5300 [ --enable-native-uconv Enable iconv support],
5301 MOZ_USE_NATIVE_UCONV=1,
5302 MOZ_USE_NATIVE_UCONV= )
5303 if test "$MOZ_USE_NATIVE_UCONV"; then
5304 AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5306 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5307 AC_MSG_ERROR([iconv() not found. Cannot enable native uconv support.])
5311 dnl ========================================================
5312 dnl Libeditor can be build as plaintext-only,
5313 dnl or as a full html and text editing component.
5314 dnl We build both by default.
5315 dnl ========================================================
5316 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5317 [ --enable-plaintext-editor-only
5318 Allow only plaintext editing],
5319 MOZ_PLAINTEXT_EDITOR_ONLY=1,
5320 MOZ_PLAINTEXT_EDITOR_ONLY= )
5321 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5322 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5324 dnl ========================================================
5325 dnl = Drop XPCOM Obsolete library
5326 dnl ========================================================
5327 MOZ_ARG_DISABLE_BOOL(xpcom-obsolete,
5328 [ --disable-xpcom-obsolete Disable XPCOM Obsolete Library],
5329 MOZ_NO_XPCOM_OBSOLETE=1,
5330 MOZ_NO_XPCOM_OBSOLETE=)
5332 if test -n "$MOZ_NO_XPCOM_OBSOLETE"; then
5333 AC_DEFINE(MOZ_NO_XPCOM_OBSOLETE)
5336 dnl ========================================================
5337 dnl = Disable Fast Load
5338 dnl ========================================================
5339 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5340 [ --disable-xpcom-fastload Disable XPCOM fastload support],
5344 AC_SUBST(MOZ_NO_FAST_LOAD)
5346 if test -n "$MOZ_NO_FAST_LOAD"; then
5347 AC_DEFINE(MOZ_NO_FAST_LOAD)
5350 dnl ========================================================
5351 dnl = Disable Ogg Codecs
5352 dnl ========================================================
5353 MOZ_ARG_DISABLE_BOOL(ogg,
5354 [ --disable-ogg Disable Ogg Codec support],
5360 if test -n "$MOZ_OGG"; then
5366 dnl ========================================================
5367 dnl = Disable Wave decoder support
5368 dnl ========================================================
5369 MOZ_ARG_DISABLE_BOOL(wave,
5370 [ --disable-wave Disable Wave decoder support],
5376 if test -n "$MOZ_WAVE"; then
5382 dnl ========================================================
5383 dnl = Handle dependent SYDNEYAUDIO and MEDIA defines
5384 dnl ========================================================
5386 AC_SUBST(MOZ_SYDNEYAUDIO)
5388 if test -n "$MOZ_SYDNEYAUDIO"; then
5389 AC_DEFINE(MOZ_SYDNEYAUDIO)
5394 if test -n "$MOZ_MEDIA"; then
5395 AC_DEFINE(MOZ_MEDIA)
5398 dnl ========================================================
5399 dnl = Check alsa availability on Linux if using sydneyaudio
5400 dnl ========================================================
5402 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5403 if test "$COMPILE_ENVIRONMENT"; then
5404 if test -n "$MOZ_SYDNEYAUDIO"; then
5405 case "$target_os" in
5407 AC_CHECK_LIB(asound, snd_pcm_open,,AC_MSG_ERROR([Ogg support on Linux requires the alsa library]))
5413 dnl ========================================================
5414 dnl Permissions System
5415 dnl ========================================================
5416 MOZ_ARG_DISABLE_BOOL(permissions,
5417 [ --disable-permissions Disable permissions (popup and cookie blocking)],
5422 dnl ========================================================
5424 dnl ========================================================
5425 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5426 [ --disable-negotiateauth Disable GSS-API negotiation ],
5427 MOZ_AUTH_EXTENSION=,
5428 MOZ_AUTH_EXTENSION=1 )
5430 dnl ========================================================
5432 dnl ========================================================
5433 MOZ_ARG_DISABLE_BOOL(xtf,
5434 [ --disable-xtf Disable XTF (pluggable xml tags) support],
5437 if test "$MOZ_XTF"; then
5441 dnl ========================================================
5443 dnl ========================================================
5444 MOZ_ARG_DISABLE_BOOL(inspector-apis,
5445 [ --disable-inspector-apis Disable the DOM inspection APIs ],
5446 MOZ_NO_INSPECTOR_APIS=1,
5447 MOZ_NO_INSPECTOR_APIS= )
5449 dnl ========================================================
5450 dnl Pref extensions (autoconfig and system-pref)
5451 dnl ========================================================
5452 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5453 [ --disable-pref-extensions
5454 Disable pref extensions such as autoconfig and
5456 MOZ_PREF_EXTENSIONS=,
5457 MOZ_PREF_EXTENSIONS=1 )
5459 dnl ========================================================
5460 dnl = Universalchardet
5461 dnl ========================================================
5462 MOZ_ARG_DISABLE_BOOL(universalchardet,
5463 [ --disable-universalchardet
5464 Disable universal encoding detection],
5465 MOZ_UNIVERSALCHARDET=,
5466 MOZ_UNIVERSALCHARDET=1 )
5468 dnl ========================================================
5470 dnl ========================================================
5471 MOZ_ARG_ENABLE_BOOL(javaxpcom,
5472 [ --enable-javaxpcom
5473 Enable Java-XPCOM bridge],
5477 if test -n "${MOZ_JAVAXPCOM}"; then
5480 if test -n "$JAVA_HOME"; then
5481 JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
5485 if test -n "$JAVA_HOME"; then
5486 JAVA_HOME=`cd "$JAVA_HOME" && pwd`
5491 if test -n "${JAVA_INCLUDE_PATH}"; then
5492 dnl Make sure jni.h exists in the given include path.
5493 if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5494 AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
5497 case "$target_os" in
5499 dnl Default to java system location
5500 JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
5504 JAVA_INCLUDE_PATH="$JAVA_HOME/include"
5507 if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
5508 AC_MSG_ERROR([The header jni.h was not found. Set \$JAVA_HOME to your java sdk directory, use --with-java-bin-path={java-bin-dir}, or reconfigure with --disable-javaxpcom.])
5512 if test -n "${JAVA_BIN_PATH}"; then
5513 dnl Look for javac and jar in the specified path.
5514 JAVA_PATH="$JAVA_BIN_PATH"
5516 dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5517 JAVA_PATH="$JAVA_HOME/bin:$PATH"
5520 AC_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5521 AC_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5522 AC_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5523 if test -z "$JAVA" || test "$JAVA" = ":" || test -z "$JAVAC" || test "$JAVAC" = ":" || test -z "$JAR" || test "$JAR" = ":"; then
5524 AC_MSG_ERROR([The programs java, javac and jar were not found. Set \$JAVA_HOME to your java sdk directory, use --with-java-bin-path={java-bin-dir}, or reconfigure with --disable-javaxpcom.])
5528 dnl ========================================================
5529 dnl = Breakpad crash reporting (on by default on supported platforms)
5530 dnl ========================================================
5532 if (test "$OS_ARCH" = "WINNT" -a -z "$GNU_CC" \
5533 || test "$OS_ARCH" = "Darwin" \
5534 || test "$OS_ARCH" = "Linux" -a "$CPU_ARCH" = "x86" \
5535 || test "$OS_ARCH" = "SunOS") \
5536 && test -z "$HAVE_64BIT_OS"; then
5540 MOZ_ARG_DISABLE_BOOL(crashreporter,
5541 [ --disable-crashreporter Disable breakpad crash reporting],
5543 MOZ_CRASHREPORTER=1)
5545 if test -n "$MOZ_CRASHREPORTER"; then
5546 AC_DEFINE(MOZ_CRASHREPORTER)
5548 if (test "$OS_ARCH" = "Linux" || test "$OS_ARCH" = "SunOS") && \
5549 test -z "$SKIP_LIBRARY_CHECKS"; then
5550 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
5551 AC_SUBST(MOZ_GTHREAD_CFLAGS)
5552 AC_SUBST(MOZ_GTHREAD_LIBS)
5554 AC_CHECK_HEADERS([curl/curl.h], [], [AC_MSG_ERROR([Couldn't find curl/curl.h which is required for the crash reporter. Use --disable-crashreporter to disable the crash reporter.])])
5558 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
5559 [ --with-crashreporter-enable-percent=NN Enable sending crash reports by default on NN% of users. (default=100)],
5560 [ val=`echo $withval | sed 's/[^0-9]//g'`
5561 MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
5563 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
5564 MOZ_CRASHREPORTER_ENABLE_PERCENT=100
5566 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
5568 dnl ========================================================
5569 dnl = Enable compilation of specific extension modules
5570 dnl ========================================================
5572 MOZ_ARG_ENABLE_STRING(extensions,
5573 [ --enable-extensions Enable extensions],
5574 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5575 if test "$option" = "yes" || test "$option" = "all"; then
5576 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
5577 elif test "$option" = "no" || test "$option" = "none"; then
5579 elif test "$option" = "default"; then
5580 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
5581 elif test `echo "$option" | grep -c \^-` != 0; then
5582 option=`echo $option | sed 's/^-//'`
5583 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
5585 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
5588 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
5590 if test -z "$MOZ_ENABLE_GNOMEVFS" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5591 # Suppress warning on non-X11 platforms
5592 if test -n "$MOZ_X11"; then
5593 AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
5595 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
5598 if test -z "$MOZ_JSDEBUGGER" && test `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
5599 AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
5600 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
5603 dnl This might be temporary: build tridentprofile only on Windows
5604 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
5605 AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
5606 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5609 dnl cookie must be built before tridentprofile. put it at list's end.
5610 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
5611 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
5612 MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
5615 dnl xforms requires xtf and schema-validation
5616 if test -z "$MOZ_XTF" && test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
5617 AC_MSG_WARN([Cannot build XForms without XTF support. Removing XForms from MOZ_EXTENSIONS.])
5618 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5620 if test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0 && test `echo "$MOZ_EXTENSIONS" | grep -c schema-validation` -eq 0; then
5621 AC_MSG_WARN([Cannot build XForms without schema validation. Removing XForms from MOZ_EXTENSIONS.])
5622 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
5625 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
5626 AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
5627 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
5630 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
5631 AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
5632 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
5635 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
5636 AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
5637 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
5640 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
5641 AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
5642 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
5645 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
5646 AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
5647 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
5650 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
5651 AC_MSG_WARN([spellcheck is no longer an extension.])
5652 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
5655 if test -n "$MOZ_NO_XPCOM_OBSOLETE" && test `echo "$MOZ_EXTENSIONS" | grep -c sroaming` -ne 0; then
5656 AC_MSG_WARN([Cannot currently build sroaming without xpcom obsolete -- bug 249343. Removing sroaming from MOZ_EXTENSIONS.])
5657 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|sroaming||'`
5661 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
5663 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
5664 dnl when trying to build a non-existent extension.
5665 for extension in $MOZ_EXTENSIONS; do
5666 if test ! -d "${srcdir}/extensions/${extension}"; then
5667 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
5672 dnl ========================================================
5674 dnl ========================================================
5675 case "$MOZ_WIDGET_TOOLKIT" in
5676 beos|windows|os2|mac|cocoa)
5679 if test -z "$MOZ_ENABLE_GTK2" && test -z "$MOZ_ENABLE_QT"; then
5680 MOZ_IMG_DECODERS_DEFAULT=`echo $MOZ_IMG_DECODERS_DEFAULT | sed -e 's|icon||'`
5685 MOZ_ARG_ENABLE_STRING(image-decoders,
5686 [ --enable-image-decoders[={mod1,mod2,default,all,none}]
5687 Enable specific image decoders],
5688 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5689 if test "$option" = "yes" || test "$option" = "all"; then
5690 MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5691 elif test "$option" = "no" || test "$option" = "none"; then
5693 elif test "$option" = "default"; then
5694 MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
5695 elif test `echo "$option" | grep -c \^-` != 0; then
5696 option=`echo $option | sed 's/^-//'`
5697 MOZ_IMG_DECODERS=`echo "$MOZ_IMG_DECODERS" | sed "s/ ${option}//"`
5699 MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $option"
5702 MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS_DEFAULT")
5704 dnl Dupes are removed in the encoder section because it will also add decoders
5706 dnl ========================================================
5708 dnl ========================================================
5709 MOZ_ARG_ENABLE_STRING(image-encoders,
5710 [ --enable-image-encoders[={mod1,mod2,default,all,none}]
5711 Enable specific image encoders],
5712 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5713 if test "$option" = "yes" || test "$option" = "all"; then
5714 addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5715 elif test "$option" = "no" || test "$option" = "none"; then
5718 elif test "$option" = "default"; then
5719 addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
5720 elif test `echo "$option" | grep -c \^-` != 0; then
5721 option=`echo $option | sed 's/^-//'`
5722 addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
5724 addencoder="$option"
5726 MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
5728 MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
5731 MOZ_IMG_DECODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_DECODERS}`
5732 MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
5734 dnl ========================================================
5735 dnl MathML on by default
5736 dnl ========================================================
5737 MOZ_ARG_DISABLE_BOOL(mathml,
5738 [ --disable-mathml Disable MathML support],
5741 if test "$MOZ_MATHML"; then
5742 AC_DEFINE(MOZ_MATHML)
5745 dnl ========================================================
5747 dnl ========================================================
5748 MOZ_ARG_DISABLE_BOOL(canvas,
5749 [ --disable-canvas Disable html:canvas feature],
5751 MOZ_ENABLE_CANVAS=1 )
5752 if test -n "$MOZ_ENABLE_CANVAS"; then
5753 AC_DEFINE(MOZ_ENABLE_CANVAS)
5755 AC_SUBST(MOZ_ENABLE_CANVAS)
5757 dnl ========================================================
5759 dnl ========================================================
5760 MOZ_ARG_DISABLE_BOOL(svg,
5761 [ --disable-svg Disable SVG support],
5764 if test -n "$MOZ_SVG"; then
5768 dnl ========================================================
5770 dnl ========================================================
5771 MOZ_ARG_ENABLE_BOOL(smil,
5772 [ --enable-smil Enable SMIL animation support],
5775 if test -n "$MOZ_SMIL"; then
5779 dnl ========================================================
5780 dnl Build Freetype in the tree
5781 dnl ========================================================
5782 MOZ_ARG_ENABLE_BOOL(tree-freetype,
5783 [ --enable-tree-freetype Enable Tree FreeType],
5784 MOZ_TREE_FREETYPE=1,
5785 MOZ_TREE_FREETYPE= )
5786 if test -n "$MOZ_TREE_FREETYPE"; then
5787 AC_DEFINE(MOZ_TREE_FREETYPE)
5788 AC_SUBST(MOZ_TREE_FREETYPE)
5789 MOZ_ENABLE_CAIRO_FT=1
5790 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
5791 FC_FONT_FEATURE="#define CAIRO_DISABLE_FONTCONFIG 1"
5792 FT2_CFLAGS="-I${topsrcdir}/modules/freetype2/include"
5793 CAIRO_FT_CFLAGS="-I${topsrcdir}/modules/freetype2/include"
5794 FT2_LIBS="${LIBXUL_DIST}/lib/freetype2.lib"
5795 CAIRO_FT_LIBS = "${LIBXUL_DIST}/lib/freetype2.lib"
5796 AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
5797 AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
5798 AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
5799 AC_SUBST(CAIRO_FT_CFLAGS)
5803 dnl ========================================================
5805 dnl ========================================================
5806 case "$target_os" in
5807 aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*)
5812 MOZ_ARG_DISABLE_BOOL(installer,
5813 [ --disable-installer Disable building of installer],
5816 if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then
5817 # Disable installer for Windows builds that use the new toolkit if NSIS
5818 # isn't in the path.
5819 AC_PATH_PROGS(MAKENSIS, makensis)
5820 if test -z "$MAKENSIS" || test "$MAKENSIS" = ":"; then
5821 AC_MSG_ERROR([To build the installer makensis is required in your path. To build without the installer reconfigure using --disable-installer.])
5823 # The Windows build for NSIS requires the iconv command line utility to
5824 # convert the charset of the locale files.
5825 AC_PATH_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
5826 if test -z "$HOST_ICONV"; then
5827 AC_MSG_ERROR([To build the installer iconv is required in your path. To build without the installer reconfigure using --disable-installer.])
5831 # Automatically disable installer if xpinstall isn't built
5832 if test -z "$MOZ_XPINSTALL"; then
5835 AC_SUBST(MOZ_INSTALLER)
5837 AC_MSG_CHECKING([for tar archiver])
5838 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
5839 if test -z "$TAR"; then
5840 AC_MSG_ERROR([no tar archiver found in \$PATH])
5842 AC_MSG_RESULT([$TAR])
5845 AC_MSG_CHECKING([for wget])
5846 AC_CHECK_PROGS(WGET, wget, "")
5847 AC_MSG_RESULT([$WGET])
5850 dnl ========================================================
5852 dnl ========================================================
5854 MOZ_ARG_DISABLE_BOOL(updater,
5855 [ --disable-updater Disable building of updater],
5858 AC_SUBST(MOZ_UPDATER)
5860 # app update channel is 'default' when not supplied.
5861 MOZ_ARG_ENABLE_STRING([update-channel],
5862 [ --enable-update-channel=CHANNEL
5863 Select application update channel (default=default)],
5864 MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
5866 if test -z "$MOZ_UPDATE_CHANNEL"; then
5867 MOZ_UPDATE_CHANNEL=default
5869 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
5871 # tools/update-packaging is not checked out by default.
5872 MOZ_ARG_ENABLE_BOOL(update-packaging,
5873 [ --enable-update-packaging
5874 Enable tools/update-packaging],
5875 MOZ_UPDATE_PACKAGING=1,
5876 MOZ_UPDATE_PACKAGING= )
5877 AC_SUBST(MOZ_UPDATE_PACKAGING)
5879 dnl ========================================================
5881 dnl ========================================================
5883 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
5884 [ --disable-xpconnect-idispatch
5885 Disable building of xpconnect support for IDispatch
5887 XPC_IDISPATCH_SUPPORT=,
5888 XPC_IDISPATCH_SUPPORT=1)
5889 AC_SUBST(XPC_IDISPATCH_SUPPORT)
5891 MOZ_ARG_DISABLE_BOOL(activex,
5892 [ --disable-activex Disable building of ActiveX control (win32 only)],
5893 MOZ_NO_ACTIVEX_SUPPORT=1,
5894 MOZ_NO_ACTIVEX_SUPPORT= )
5895 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
5897 MOZ_ARG_DISABLE_BOOL(activex-scripting,
5898 [ --disable-activex-scripting
5899 Disable building of ActiveX scripting support (win32)],
5900 MOZ_ACTIVEX_SCRIPTING_SUPPORT=,
5901 MOZ_ACTIVEX_SCRIPTING_SUPPORT=1)
5902 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
5904 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
5906 AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
5909 if test "$COMPILE_ENVIRONMENT" = "1"; then
5910 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
5912 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5913 if test "$ac_cv_header_atlbase_h" = "no"; then
5914 AC_MSG_ERROR([System header atlbase.h is not available. See http://developer.mozilla.org/en/docs/atlbase.h for details on fixing this problem.])
5921 dnl ========================================================
5923 dnl ========================================================
5924 MOZ_ARG_ENABLE_BOOL(leaky,
5925 [ --enable-leaky Build leaky memory tool],
5930 dnl ========================================================
5932 dnl ========================================================
5933 MOZ_ARG_ENABLE_BOOL(xpctools,
5934 [ --enable-xpctools Build JS profiling tool],
5939 dnl ========================================================
5940 dnl build the tests by default
5941 dnl ========================================================
5942 MOZ_ARG_DISABLE_BOOL(tests,
5943 [ --disable-tests Do not build test libraries & programs],
5947 dnl ========================================================
5948 dnl parental controls (for Windows Vista)
5949 dnl ========================================================
5950 MOZ_ARG_DISABLE_BOOL(parental-controls,
5951 [ --disable-parental-controls
5952 Do not build parental controls],
5953 MOZ_DISABLE_PARENTAL_CONTROLS=1,
5954 MOZ_DISABLE_PARENTAL_CONTROLS=)
5955 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
5956 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
5959 dnl ========================================================
5960 dnl Vista SDK specific api
5961 dnl ========================================================
5962 MOZ_ARG_DISABLE_BOOL(vista-sdk-requirements,
5963 [ --disable-vista-sdk-requirements
5964 Do not build Vista SDK specific code],
5965 MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=1,
5966 MOZ_DISABLE_VISTA_SDK_REQUIREMENTS=)
5967 if test -n "$COMPILE_ENVIRONMENT"; then
5968 if test -n "$MOZ_DISABLE_VISTA_SDK_REQUIREMENTS"; then
5969 AC_MSG_WARN([Resulting builds will not be compatible with Windows Vista. (bug 428970)])
5970 AC_DEFINE(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
5971 if test -z "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
5972 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
5974 MOZ_DISABLE_PARENTAL_CONTROLS=1
5977 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5978 if test "$ac_cv_header_wpcapi_h" = "no"; then
5979 AC_MSG_ERROR([System header wpcapi.h is not available. See updated http://developer.mozilla.org/en/docs/wpcapi.h for details on fixing this problem.])
5985 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
5986 AC_SUBST(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS)
5988 dnl ========================================================
5990 dnl = Module specific options
5992 dnl ========================================================
5993 MOZ_ARG_HEADER(Individual module options)
5995 dnl ========================================================
5996 dnl = Enable Lea malloc in xpcom. OFF by default.
5997 dnl ========================================================
5998 MOZ_ARG_ENABLE_BOOL(xpcom-lea,
5999 [ --enable-xpcom-lea Use Lea malloc in xpcom ],
6002 if test -n "$XPCOM_USE_LEA"; then
6003 AC_DEFINE(XPCOM_USE_LEA)
6006 dnl ========================================================
6007 dnl = Enable places (new history/bookmarks)
6008 dnl ========================================================
6009 MOZ_ARG_ENABLE_BOOL(places,
6010 [ --enable-places Enable 'places' bookmark/history implementation],
6013 if test -n "$MOZ_PLACES"; then
6014 AC_DEFINE(MOZ_PLACES)
6015 if test -z "$MOZ_MAIL_NEWS"; then
6020 if test "$MOZ_BUILD_APP" = "browser"; then
6021 AC_MSG_ERROR([Cannot build Firefox with --disable-places.])
6025 dnl ========================================================
6026 dnl = Disable feed handling components
6027 dnl ========================================================
6028 MOZ_ARG_DISABLE_BOOL(feeds,
6029 [ --disable-feeds Disable feed handling and processing components],
6032 if test -n "$MOZ_FEEDS"; then
6033 AC_DEFINE(MOZ_FEEDS)
6035 if test "$MOZ_BUILD_APP" = "browser"; then
6036 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6040 dnl ========================================================
6041 dnl = Enable mozStorage
6042 dnl ========================================================
6043 dnl Implicitly enabled by default if building calendar or places
6044 MOZ_ARG_ENABLE_BOOL(storage,
6045 [ --enable-storage Enable mozStorage module and related components],
6048 if test -n "$MOZ_STORAGE"; then
6049 AC_DEFINE(MOZ_STORAGE)
6052 dnl ========================================================
6053 dnl Check for sqlite
6054 dnl ========================================================
6057 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6058 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
6059 MOZ_NATIVE_SQLITE=1,
6060 MOZ_NATIVE_SQLITE= )
6062 if test -z "$MOZ_NATIVE_SQLITE"
6065 SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,sqlite3,$(DIST)/lib)'
6067 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6070 AC_SUBST(MOZ_NATIVE_SQLITE)
6072 dnl ========================================================
6073 dnl = Enable help viewer (off by default)
6074 dnl ========================================================
6075 MOZ_ARG_ENABLE_BOOL(help-viewer,
6076 [ --enable-help-viewer Enable help viewer],
6079 if test -n "$MOZ_HELP_VIEWER"; then
6080 AC_DEFINE(MOZ_HELP_VIEWER)
6082 AC_SUBST(MOZ_HELP_VIEWER)
6083 if test "$MOZ_BUILD_APP" = "browser" -a -n "$MOZ_HELP_VIEWER"; then
6084 AC_MSG_ERROR([Cannot build Firefox with --enable-help-viewer.])
6087 dnl ========================================================
6088 dnl = Enable safe browsing (anti-phishing)
6089 dnl ========================================================
6090 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6091 [ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation],
6092 MOZ_SAFE_BROWSING=1,
6093 MOZ_SAFE_BROWSING= )
6094 if test -n "$MOZ_SAFE_BROWSING"; then
6095 AC_DEFINE(MOZ_SAFE_BROWSING)
6097 AC_SUBST(MOZ_SAFE_BROWSING)
6099 dnl ========================================================
6100 dnl = Enable url-classifier
6101 dnl ========================================================
6102 dnl Implicitly enabled by default if building with safe-browsing
6103 if test -n "$MOZ_SAFE_BROWSING"; then
6104 MOZ_URL_CLASSIFIER=1
6106 MOZ_ARG_ENABLE_BOOL(url-classifier,
6107 [ --enable-url-classifier Enable url classifier module],
6108 MOZ_URL_CLASSIFIER=1,
6109 MOZ_URL_CLASSIFIER= )
6110 if test -n "$MOZ_URL_CLASSIFIER"; then
6111 AC_DEFINE(MOZ_URL_CLASSIFIER)
6113 AC_SUBST(MOZ_URL_CLASSIFIER)
6115 dnl ========================================================
6116 dnl = Disable zipwriter
6117 dnl ========================================================
6118 MOZ_ARG_DISABLE_BOOL(zipwriter,
6119 [ --disable-zipwriter Disable zipwriter component],
6122 AC_SUBST(MOZ_ZIPWRITER)
6124 dnl ========================================================
6125 dnl = Enable Ultrasparc specific optimizations for JS
6126 dnl ========================================================
6127 MOZ_ARG_ENABLE_BOOL(js-ultrasparc,
6128 [ --enable-js-ultrasparc Use UltraSPARC optimizations in JS],
6129 JS_ULTRASPARC_OPTS=1,
6130 JS_ULTRASPARC_OPTS= )
6132 dnl only enable option for ultrasparcs
6133 if test `echo "$target_os" | grep -c \^solaris 2>/dev/null` = 0 -o \
6134 "$OS_TEST" != "sun4u"; then
6137 AC_SUBST(JS_ULTRASPARC_OPTS)
6139 dnl ========================================================
6140 dnl = Hildon and OSSO checks
6141 dnl ========================================================
6142 PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime,
6143 MOZ_PLATFORM_HILDON=1,
6144 MOZ_PLATFORM_HILDON=)
6145 if test $MOZ_PLATFORM_HILDON; then
6146 AC_DEFINE(MOZ_PLATFORM_HILDON)
6148 AC_SUBST(LIBHILDONMIME_CFLAGS)
6149 AC_SUBST(LIBHILDONMIME_LIBS)
6151 PKG_CHECK_MODULES(LIBOSSO,libosso,
6155 if test $NS_OSSO; then
6156 if test -z "$MOZ_ENABLE_DBUS"; then
6157 AC_MSG_ERROR([DBus is required when building for OSSO])
6160 MOZ_GFX_OPTIMIZE_MOBILE=1
6162 AC_SUBST(LIBOSSO_CFLAGS)
6163 AC_SUBST(LIBOSSO_LIBS)
6165 PKG_CHECK_MODULES(MOZ_LOCATION, [liblocation gpsbt],
6166 NS_MAEMO_LOCATION=1,
6169 if test $NS_MAEMO_LOCATION; then
6170 AC_DEFINE(NS_MAEMO_LOCATION)
6173 AC_SUBST(MOZ_LOCATION_CFLAGS)
6174 AC_SUBST(MOZ_LOCATION_LIBS)
6176 dnl ========================================================
6178 dnl = Feature options that require extra sources to be pulled
6180 dnl ========================================================
6181 dnl MOZ_ARG_HEADER(Features that require extra sources)
6183 dnl ========================================================
6185 dnl = Debugging Options
6187 dnl ========================================================
6188 MOZ_ARG_HEADER(Debugging and Optimizations)
6190 dnl ========================================================
6191 dnl = Disable building with debug info.
6192 dnl = Debugging is OFF by default
6193 dnl ========================================================
6194 if test -z "$MOZ_DEBUG_FLAGS"
6198 if test "$GNU_CC"; then
6199 GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'`
6200 case "$GCC_VERSION" in
6205 MOZ_DEBUG_FLAGS="-g"
6209 MOZ_DEBUG_FLAGS="-g"
6213 MOZ_DEBUG_FLAGS="-g"
6218 MOZ_ARG_ENABLE_STRING(debug,
6219 [ --enable-debug[=DBG] Enable building with developer debug info
6220 (Using compiler flags DBG)],
6221 [ if test "$enableval" != "no"; then
6223 if test -n "$enableval" && test "$enableval" != "yes"; then
6224 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6231 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG"
6232 case "${target_os}" in
6234 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${USER}"
6236 msvc*|mks*|cygwin*|mingw*|os2*|wince*)
6237 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
6240 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`$WHOAMI`"
6243 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DTRACING"
6245 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6247 if test -n "$MOZ_DEBUG"; then
6248 AC_MSG_CHECKING([for valid debug flags])
6249 _SAVE_CFLAGS=$CFLAGS
6250 CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6251 AC_TRY_COMPILE([#include <stdio.h>],
6252 [printf("Hello World\n");],
6255 AC_MSG_RESULT([$_results])
6256 if test "$_results" = "no"; then
6257 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6259 CFLAGS=$_SAVE_CFLAGS
6262 dnl ========================================================
6263 dnl enable mobile optimizations
6264 dnl ========================================================
6265 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6266 [ --enable-mobile-optimize Enable mobile optimizations],
6267 MOZ_GFX_OPTIMIZE_MOBILE=1)
6269 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6271 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6272 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6275 dnl ========================================================
6276 dnl = Enable code optimization. ON by default.
6277 dnl ========================================================
6278 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6279 MOZ_OPTIMIZE_FLAGS="-O"
6282 MOZ_ARG_ENABLE_STRING(optimize,
6283 [ --disable-optimize Disable compiler optimization
6284 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6285 [ if test "$enableval" != "no"; then
6287 if test -n "$enableval" && test "$enableval" != "yes"; then
6288 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6293 fi ], MOZ_OPTIMIZE=1)
6295 if test "$COMPILE_ENVIRONMENT"; then
6296 if test -n "$MOZ_OPTIMIZE"; then
6297 AC_MSG_CHECKING([for valid optimization flags])
6298 _SAVE_CFLAGS=$CFLAGS
6299 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6300 AC_TRY_COMPILE([#include <stdio.h>],
6301 [printf("Hello World\n");],
6304 AC_MSG_RESULT([$_results])
6305 if test "$_results" = "no"; then
6306 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6308 CFLAGS=$_SAVE_CFLAGS
6310 fi # COMPILE_ENVIRONMENT
6312 AC_SUBST(MOZ_OPTIMIZE)
6313 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6314 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6315 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6317 dnl ========================================================
6318 dnl = Enable/disable debug for specific modules only
6319 dnl = module names beginning with ^ will be disabled
6320 dnl ========================================================
6321 MOZ_ARG_ENABLE_STRING(debug-modules,
6322 [ --enable-debug-modules Enable/disable debug info for specific modules],
6323 [ MOZ_DEBUG_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
6325 dnl ========================================================
6326 dnl = Enable/disable generation of debugger info for specific modules only
6327 dnl = the special module name ALL_MODULES can be used to denote all modules
6328 dnl = module names beginning with ^ will be disabled
6329 dnl ========================================================
6330 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
6331 [ --enable-debugger-info-modules
6332 Enable/disable debugger info for specific modules],
6333 [ for i in `echo $enableval | sed 's/,/ /g'`; do
6334 dnl note that the list of module names is reversed as it is copied
6335 dnl this is important, as it will allow config.mk to interpret stuff like
6336 dnl "^ALL_MODULES xpcom" properly
6337 if test "$i" = "no"; then
6340 if test "$i" = "yes"; then
6343 MOZ_DBGRINFO_MODULES="$i $MOZ_DBGRINFO_MODULES";
6346 dnl ========================================================
6347 dnl Enable garbage collector
6348 dnl ========================================================
6349 MOZ_ARG_ENABLE_BOOL(boehm,
6350 [ --enable-boehm Enable the Boehm Garbage Collector],
6353 if test -n "$GC_LEAK_DETECTOR"; then
6354 AC_DEFINE(GC_LEAK_DETECTOR)
6357 dnl ========================================================
6358 dnl Disable runtime logging checks
6359 dnl ========================================================
6360 MOZ_ARG_DISABLE_BOOL(logging,
6361 [ --disable-logging Disable logging facilities],
6362 NS_DISABLE_LOGGING=1,
6363 NS_DISABLE_LOGGING= )
6364 if test "$NS_DISABLE_LOGGING"; then
6365 AC_DEFINE(NS_DISABLE_LOGGING)
6367 AC_DEFINE(MOZ_LOGGING)
6370 dnl ========================================================
6371 dnl = dnl This will enable logging of addref, release, ctor, dtor.
6372 dnl ========================================================
6373 _ENABLE_LOGREFCNT=42
6374 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6375 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
6376 _ENABLE_LOGREFCNT=1,
6377 _ENABLE_LOGREFCNT= )
6378 if test "$_ENABLE_LOGREFCNT" = "1"; then
6379 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6380 elif test -z "$_ENABLE_LOGREFCNT"; then
6381 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6384 dnl ========================================================
6385 dnl = Enable trace malloc
6386 dnl ========================================================
6387 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
6388 MOZ_ARG_ENABLE_BOOL(trace-malloc,
6389 [ --enable-trace-malloc Enable malloc tracing],
6392 if test "$NS_TRACE_MALLOC"; then
6393 # Please, Mr. Linker Man, don't take away our symbol names
6394 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6396 AC_DEFINE(NS_TRACE_MALLOC)
6398 AC_SUBST(NS_TRACE_MALLOC)
6400 dnl ========================================================
6401 dnl = Enable jemalloc
6402 dnl ========================================================
6403 MOZ_ARG_ENABLE_BOOL(jemalloc,
6404 [ --enable-jemalloc Replace memory allocator with jemalloc],
6408 if test "$NS_TRACE_MALLOC"; then
6412 if test "$MOZ_MEMORY"; then
6414 dnl Don't try to run compiler tests on Windows
6415 if test "$OS_ARCH" = "WINNT"; then
6416 if test -z "$HAVE_64BIT_OS"; then
6417 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6419 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6422 AC_CHECK_SIZEOF([int *], [4])
6423 case "${ac_cv_sizeof_int_p}" in
6425 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
6428 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
6431 AC_MSG_ERROR([Unexpected pointer size])
6436 AC_DEFINE(MOZ_MEMORY)
6437 if test "x$MOZ_DEBUG" = "x1"; then
6438 AC_DEFINE(MOZ_MEMORY_DEBUG)
6440 dnl The generic feature tests that determine how to compute ncpus are long and
6441 dnl complicated. Therefore, simply define special cpp variables for the
6442 dnl platforms we have special knowledge of.
6443 case "${target_os}" in
6445 AC_DEFINE(MOZ_MEMORY_DARWIN)
6448 AC_DEFINE(MOZ_MEMORY_BSD)
6451 AC_DEFINE(MOZ_MEMORY_LINUX)
6454 AC_DEFINE(MOZ_MEMORY_BSD)
6457 AC_DEFINE(MOZ_MEMORY_SOLARIS)
6459 msvc*|mks*|cygwin*|mingw*)
6460 AC_DEFINE(MOZ_MEMORY_WINDOWS)
6461 dnl XXX: should test for vc8sp1 here, otherwise patching the crt src
6462 dnl will fail miserably
6463 if test "$_CC_SUITE" -lt "8"; then
6464 AC_MSG_ERROR([Building jemalloc requires Visual C++ 2005 or better])
6466 if test -z "$WIN32_CRT_SRC_DIR" -a -z "$WIN32_CUSTOM_CRT_DIR"; then
6467 if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
6468 AC_MSG_ERROR([When building jemalloc, either set WIN32_CRT_SRC_DIR to the path to the Visual C++ CRT source (usually VCINSTALLDIR\crt\src), or set WIN32_CUSTOM_CRT_DIR to the path to a folder containing a pre-built CRT DLL.])
6470 WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
6473 if test -z "$WIN32_CRT_SRC_DIR"; then
6475 WIN32_CUSTOM_CRT_DIR=`cd "$WIN32_CUSTOM_CRT_DIR" && pwd`
6476 _WIN_UNIX_CRT_PATH="$WIN32_CUSTOM_CRT_DIR"
6478 # CRT source directory
6479 WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd`
6480 _CRT_BASE_DIR=`basename "$WIN32_CRT_SRC_DIR"`
6481 _WIN_UNIX_CRT_PATH="$_objdir/memory/jemalloc/$_CRT_BASE_DIR/build/intel"
6483 dnl need win32 paths in LIB, hence this python abuse. extra brackets
6485 _WIN_CRT_PATH=[`$PYTHON -c 'import sys, os.path; print os.path.normpath(sys.argv[1])' "$_WIN_UNIX_CRT_PATH"`]
6486 MOZ_LIB="$_WIN_CRT_PATH;$LIB"
6487 dnl Needs to be in PATH too, since our tools will wind up linked against it.
6488 dnl This needs to be unix style.
6489 MOZ_PATH="$PATH:$_WIN_UNIX_CRT_PATH"
6490 dnl Statically link the C++ stdlib. We only use this for Breakpad anyway.
6491 AC_DEFINE(_STATIC_CPPLIB)
6492 dnl Don't generate a manifest, since we're linking to a custom CRT.
6493 LDFLAGS="$LDFLAGS -MANIFEST:NO"
6494 dnl Also pass this to NSPR/NSS
6495 DLLFLAGS="$DLLFLAGS -MANIFEST:NO"
6499 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
6503 AC_ARG_WITH([valgrind],
6504 [ --with-valgrind Enable valgrind integration hooks],
6505 [enable_valgrind="yes"], [enable_valgrind="no"])
6506 AC_CHECK_HEADER([valgrind/valgrind.h], [], [enable_valgrind="no"])
6507 if test "x$enable_valgrind" = "xyes" ; then
6508 AC_DEFINE(MOZ_VALGRIND)
6511 AC_SUBST(MOZ_MEMORY)
6512 AC_SUBST(WIN32_CRT_SRC_DIR)
6513 AC_SUBST(WIN32_CUSTOM_CRT_DIR)
6516 dnl Need to set this for make because NSS doesn't have configure
6519 dnl ========================================================
6520 dnl = Use malloc wrapper lib
6521 dnl ========================================================
6522 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
6523 [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)],
6527 if test -n "$_WRAP_MALLOC"; then
6528 if test "$GNU_CC"; then
6529 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"
6530 MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) -o $@'
6534 dnl ========================================================
6535 dnl = Location of malloc wrapper lib
6536 dnl ========================================================
6537 MOZ_ARG_WITH_STRING(wrap-malloc,
6538 [ --with-wrap-malloc=DIR Location of malloc wrapper library],
6539 WRAP_MALLOC_LIB=$withval)
6541 dnl ========================================================
6542 dnl = Use Electric Fence
6543 dnl ========================================================
6544 MOZ_ARG_ENABLE_BOOL(efence,
6545 [ --enable-efence Link with Electric Fence],
6548 if test -n "$_ENABLE_EFENCE"; then
6549 AC_CHECK_LIB(efence,malloc)
6552 dnl ========================================================
6554 dnl ========================================================
6555 MOZ_ARG_ENABLE_BOOL(jprof,
6556 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof)],
6559 if test -n "$MOZ_JPROF"; then
6560 AC_DEFINE(MOZ_JPROF)
6563 dnl ========================================================
6565 dnl ========================================================
6566 MOZ_ARG_ENABLE_BOOL(shark,
6567 [ --enable-shark Enable shark remote profiling (needs CHUD framework)],
6570 if test -n "$MOZ_SHARK"; then
6571 AC_DEFINE(MOZ_SHARK)
6574 dnl ========================================================
6576 dnl ========================================================
6577 MOZ_ARG_ENABLE_BOOL(callgrind,
6578 [ --enable-callgrind Enable callgrind profiling],
6581 if test -n "$MOZ_CALLGRIND"; then
6582 AC_DEFINE(MOZ_CALLGRIND)
6585 dnl ========================================================
6587 dnl ========================================================
6588 MOZ_ARG_ENABLE_BOOL(vtune,
6589 [ --enable-vtune Enable vtune profiling],
6592 if test -n "$MOZ_VTUNE"; then
6593 AC_DEFINE(MOZ_VTUNE)
6596 dnl ========================================================
6597 dnl Zealous JavaScript GC
6598 dnl ========================================================
6599 MOZ_ARG_ENABLE_BOOL(gczeal,
6600 [ --enable-gczeal Enable zealous JavaScript GCing],
6603 if test -n "$JS_GC_ZEAL"; then
6604 AC_DEFINE(JS_GC_ZEAL)
6607 dnl ========================================================
6608 dnl = Enable static checking using gcc-dehydra
6609 dnl ========================================================
6611 MOZ_ARG_WITH_STRING(static-checking,
6612 [ --with-static-checking=path/to/gcc_dehydra.so
6613 Enable static checking of code using GCC-dehydra],
6614 DEHYDRA_PATH=$withval,
6617 if test -n "$DEHYDRA_PATH"; then
6618 if test ! -f "$DEHYDRA_PATH"; then
6619 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
6621 AC_DEFINE(NS_STATIC_CHECKING)
6623 AC_SUBST(DEHYDRA_PATH)
6625 dnl ========================================================
6626 dnl = Enable stripping of libs & executables
6627 dnl ========================================================
6628 MOZ_ARG_ENABLE_BOOL(strip,
6629 [ --enable-strip Enable stripping of libs & executables ],
6633 dnl ========================================================
6634 dnl = Enable stripping of libs & executables when packaging
6635 dnl ========================================================
6636 MOZ_ARG_ENABLE_BOOL(install-strip,
6637 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
6641 dnl ========================================================
6642 dnl = --enable-elf-dynstr-gc
6643 dnl ========================================================
6644 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
6645 [ --enable-elf-dynstr-gc Enable elf dynstr garbage collector (opt builds only)],
6646 USE_ELF_DYNSTR_GC=1,
6647 USE_ELF_DYNSTR_GC= )
6649 dnl ========================================================
6650 dnl = --enable-old-abi-compat-wrappers
6651 dnl ========================================================
6652 dnl on x86 linux, the current builds of some popular plugins (notably
6653 dnl flashplayer and real) expect a few builtin symbols from libgcc
6654 dnl which were available in some older versions of gcc. However,
6655 dnl they're _NOT_ available in newer versions of gcc (eg 3.1), so if
6656 dnl we want those plugin to work with a gcc-3.1 built binary, we need
6657 dnl to provide these symbols. MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS defaults
6658 dnl to true on x86 linux, and false everywhere else.
6661 MOZ_ARG_ENABLE_BOOL(old-abi-compat-wrappers,
6662 [ --enable-old-abi-compat-wrappers
6663 Support old GCC ABI symbols to ease the pain
6664 of the linux compiler change],
6665 MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS=1,
6666 MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS= )
6667 if test "$COMPILE_ENVIRONMENT"; then
6668 if test "$MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS"; then
6671 AC_CHECK_FUNCS(__builtin_vec_new __builtin_vec_delete __builtin_new __builtin_delete __pure_virtual)
6673 AC_DEFINE(MOZ_ENABLE_OLD_ABI_COMPAT_WRAPPERS)
6675 fi # COMPILE_ENVIRONMENT
6677 dnl ========================================================
6679 dnl = Profiling and Instrumenting
6681 dnl ========================================================
6682 MOZ_ARG_HEADER(Profiling and Instrumenting)
6684 dnl ========================================================
6685 dnl = Enable timeline service, which provides lightweight
6686 dnl = instrumentation of mozilla for performance measurement.
6687 dnl = Timeline is off by default.
6688 dnl ========================================================
6689 MOZ_ARG_ENABLE_BOOL(timeline,
6690 [ --enable-timeline Enable timeline services ],
6693 if test -n "$MOZ_TIMELINE"; then
6694 AC_DEFINE(MOZ_TIMELINE)
6697 dnl ========================================================
6698 dnl Turn on reflow counting
6699 dnl ========================================================
6700 MOZ_ARG_ENABLE_BOOL(reflow-perf,
6701 [ --enable-reflow-perf Enable reflow performance tracing],
6704 if test -n "$MOZ_REFLOW_PREF"; then
6705 AC_DEFINE(MOZ_REFLOW_PREF)
6707 AC_SUBST(MOZ_REFLOW_PERF)
6709 dnl ========================================================
6710 dnl Enable performance metrics.
6711 dnl ========================================================
6712 MOZ_ARG_ENABLE_BOOL(perf-metrics,
6713 [ --enable-perf-metrics Enable performance metrics],
6716 if test -n "$MOZ_PERF_METRICS"; then
6717 AC_DEFINE(MOZ_PERF_METRICS)
6720 dnl ========================================================
6721 dnl Enable code size metrics.
6722 dnl ========================================================
6723 MOZ_ARG_ENABLE_BOOL(codesighs,
6724 [ --enable-codesighs Enable code size analysis tools],
6725 _ENABLE_CODESIGHS=1,
6726 _ENABLE_CODESIGHS= )
6727 if test -n "$_ENABLE_CODESIGHS"; then
6728 if test -d $srcdir/tools/codesighs; then
6731 AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
6735 dnl ========================================================
6736 dnl = Add support for Eazel profiler
6737 dnl ========================================================
6738 MOZ_ARG_ENABLE_BOOL(eazel-profiler-support,
6739 [ --enable-eazel-profiler-support
6740 Enable Corel/Eazel profiler support],
6741 ENABLE_EAZEL_PROFILER=1,
6742 ENABLE_EAZEL_PROFILER= )
6743 if test -n "$ENABLE_EAZEL_PROFILER"; then
6744 AC_DEFINE(ENABLE_EAZEL_PROFILER)
6746 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
6747 EAZEL_PROFILER_CFLAGS="-g -O -gdwarf-2 -finstrument-functions -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
6748 EAZEL_PROFILER_LIBS="-lprofiler -lpthread"
6751 MOZ_ARG_ENABLE_STRING(profile-modules,
6752 [ --enable-profile-modules
6753 Enable/disable profiling for specific modules],
6754 [ MOZ_PROFILE_MODULES=`echo $enableval| sed 's/,/ /g'` ] )
6756 MOZ_ARG_ENABLE_BOOL(insure,
6757 [ --enable-insure Enable insure++ instrumentation (linux only)],
6760 if test -n "$_ENABLE_INSURE"; then
6764 MOZ_INSURE_EXCLUDE_DIRS="config"
6767 MOZ_ARG_WITH_STRING(insure-dirs,
6768 [ --with-insure-dirs=DIRS
6769 Dirs to instrument with insure ],
6770 MOZ_INSURE_DIRS=$withval )
6772 MOZ_ARG_WITH_STRING(insure-exclude-dirs,
6773 [ --with-insure-exclude-dirs=DIRS
6774 Dirs to not instrument with insure ],
6775 MOZ_INSURE_EXCLUDE_DIRS="config $withval" )
6777 dnl ========================================================
6778 dnl = Support for Quantify (Windows)
6779 dnl ========================================================
6780 MOZ_ARG_ENABLE_BOOL(quantify,
6781 [ --enable-quantify Enable Quantify support (Windows only) ],
6785 dnl ========================================================
6786 dnl = Support for demangling undefined symbols
6787 dnl ========================================================
6788 if test -z "$SKIP_LIBRARY_CHECKS"; then
6791 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
6795 # Demangle only for debug or trace-malloc builds
6796 MOZ_DEMANGLE_SYMBOLS=
6797 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
6798 MOZ_DEMANGLE_SYMBOLS=1
6799 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
6801 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
6803 dnl ========================================================
6804 dnl = Support for gcc stack unwinding (from gcc 3.3)
6805 dnl ========================================================
6806 if test "$HAVE_GCC3_ABI" && test -z "$SKIP_LIBRARY_CHECKS"; then
6807 AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
6810 dnl ========================================================
6814 dnl ========================================================
6815 MOZ_ARG_HEADER(Misc. Options)
6817 dnl ========================================================
6818 dnl update xterm title
6819 dnl ========================================================
6820 MOZ_ARG_ENABLE_BOOL(xterm-updates,
6821 [ --enable-xterm-updates Update XTERM titles with current command.],
6825 dnl =========================================================
6827 dnl =========================================================
6828 MOZ_ARG_ENABLE_STRING([chrome-format],
6829 [ --enable-chrome-format=jar|flat|both|symlink
6830 Select FORMAT of chrome files (default=jar)],
6831 MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
6833 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
6834 MOZ_CHROME_FILE_FORMAT=jar
6837 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
6838 test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
6839 test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
6840 test "$MOZ_CHROME_FILE_FORMAT" != "both"; then
6841 AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, or symlink])
6844 dnl ========================================================
6845 dnl = Define default location for MOZILLA_FIVE_HOME
6846 dnl ========================================================
6847 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
6848 [ --with-default-mozilla-five-home
6849 Set the default value for MOZILLA_FIVE_HOME],
6850 [ val=`echo $withval`
6851 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
6853 dnl ========================================================
6854 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
6855 dnl ========================================================
6856 MOZ_ARG_WITH_STRING(user-appdir,
6857 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
6858 [ val=`echo $withval`
6859 if echo "$val" | grep "\/" >/dev/null; then
6860 AC_MSG_ERROR("Homedir must be single relative path.")
6865 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
6867 dnl ========================================================
6868 dnl = Doxygen configuration
6869 dnl ========================================================
6870 dnl Use commas to specify multiple dirs to this arg
6871 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
6872 MOZ_ARG_WITH_STRING(doc-input-dirs,
6873 [ --with-doc-input-dirs=DIRS
6874 Header/idl dirs to create docs from],
6875 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
6876 AC_SUBST(MOZ_DOC_INPUT_DIRS)
6878 dnl Use commas to specify multiple dirs to this arg
6879 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
6880 MOZ_ARG_WITH_STRING(doc-include-dirs,
6881 [ --with-doc-include-dirs=DIRS
6882 Include dirs to preprocess doc headers],
6883 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
6884 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
6886 MOZ_DOC_OUTPUT_DIR='./dist/docs'
6887 MOZ_ARG_WITH_STRING(doc-output-dir,
6888 [ --with-doc-output-dir=DIR
6889 Dir to generate docs into],
6890 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
6891 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
6893 if test -z "$SKIP_COMPILER_CHECKS"; then
6894 dnl ========================================================
6896 dnl = Compiler Options
6898 dnl ========================================================
6899 MOZ_ARG_HEADER(Compiler Options)
6901 dnl ========================================================
6902 dnl Check for gcc -pipe support
6903 dnl ========================================================
6904 AC_MSG_CHECKING([for gcc -pipe support])
6905 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
6906 echo '#include <stdio.h>' > dummy-hello.c
6907 echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
6908 ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
6909 cat dummy-hello.s | ${AS_BIN} -o dummy-hello.S - 2>&5
6910 if test $? = 0; then
6915 if test "$_res_as_stdin" = "yes"; then
6916 _SAVE_CFLAGS=$CFLAGS
6917 CFLAGS="$CFLAGS -pipe"
6918 AC_TRY_COMPILE( [ #include <stdio.h> ],
6919 [printf("Hello World\n");],
6920 [_res_gcc_pipe="yes"],
6921 [_res_gcc_pipe="no"] )
6922 CFLAGS=$_SAVE_CFLAGS
6924 if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
6926 CFLAGS="$CFLAGS -pipe"
6927 CXXFLAGS="$CXXFLAGS -pipe"
6931 rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
6932 AC_MSG_RESULT([$_res])
6937 dnl pass -Wno-long-long to the compiler
6938 MOZ_ARG_ENABLE_BOOL(long-long-warning,
6939 [ --enable-long-long-warning
6940 Warn about use of non-ANSI long long type],
6941 _IGNORE_LONG_LONG_WARNINGS=,
6942 _IGNORE_LONG_LONG_WARNINGS=1)
6944 if test "$_IGNORE_LONG_LONG_WARNINGS"; then
6945 _SAVE_CFLAGS="$CFLAGS"
6946 CFLAGS="$CFLAGS ${_COMPILER_PREFIX}-Wno-long-long"
6947 AC_MSG_CHECKING([whether compiler supports -Wno-long-long])
6948 AC_TRY_COMPILE([], [return(0);],
6949 [ _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
6950 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-long-long"
6951 result="yes" ], result="no")
6952 AC_MSG_RESULT([$result])
6953 CFLAGS="$_SAVE_CFLAGS"
6956 dnl ========================================================
6957 dnl Profile guided optimization
6958 dnl ========================================================
6959 dnl Test for profiling options
6960 dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities
6961 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
6963 dnl Provide a switch to disable PGO even when called via profiledbuild.
6964 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
6965 [ --disable-profile-guided-optimization
6966 Don't build with PGO even if called via make profiledbuild],
6967 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
6968 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
6970 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
6972 _SAVE_CFLAGS="$CFLAGS"
6973 CFLAGS="$CFLAGS -fprofile-generate"
6975 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
6976 AC_TRY_COMPILE([], [return 0;],
6977 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
6978 result="yes" ], result="no")
6979 AC_MSG_RESULT([$result])
6981 if test $result = "yes"; then
6982 PROFILE_GEN_LDFLAGS="-fprofile-generate"
6983 PROFILE_USE_CFLAGS="-fprofile-use"
6984 PROFILE_USE_LDFLAGS="-fprofile-use"
6986 CFLAGS="$_SAVE_CFLAGS -fprofile-arcs"
6987 AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs])
6988 AC_TRY_COMPILE([], [return 0;],
6989 [ PROFILE_GEN_CFLAGS="-fprofile-arcs"
6990 result="yes" ], result="no")
6991 AC_MSG_RESULT([$result])
6992 if test $result = "yes"; then
6993 PROFILE_USE_CFLAGS="-fbranch-probabilities"
6995 # don't really care, this is an old GCC
6996 PROFILE_GEN_LDFLAGS=
6997 PROFILE_USE_LDFLAGS=
7000 CFLAGS="$_SAVE_CFLAGS"
7002 if test -n "$INTEL_CC"; then
7003 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7004 PROFILE_GEN_LDFLAGS=
7005 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7006 PROFILE_USE_LDFLAGS=
7009 dnl Sun Studio on Solaris
7010 if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
7011 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7012 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7013 if test "$CPU_ARCH" != "sparc"; then
7014 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7015 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7017 PROFILE_USE_CFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
7018 PROFILE_USE_LDFLAGS="-xlinkopt=2 -xprofile=use:$_objdir/$enable_application"
7022 AC_SUBST(PROFILE_GEN_CFLAGS)
7023 AC_SUBST(PROFILE_GEN_LDFLAGS)
7024 AC_SUBST(PROFILE_USE_CFLAGS)
7025 AC_SUBST(PROFILE_USE_LDFLAGS)
7029 dnl ========================================================
7030 dnl Test for -pedantic bustage
7031 dnl ========================================================
7032 MOZ_ARG_DISABLE_BOOL(pedantic,
7033 [ --disable-pedantic Issue all warnings demanded by strict ANSI C ],
7035 if test "$_PEDANTIC"; then
7036 _SAVE_CXXFLAGS=$CXXFLAGS
7037 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
7038 AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7039 AC_TRY_COMPILE([$configure_static_assert_macros],
7040 [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7041 result="no", result="yes" )
7042 AC_MSG_RESULT([$result])
7043 CXXFLAGS="$_SAVE_CXXFLAGS"
7047 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic"
7048 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic"
7051 AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic. Reconfigure using --disable-pedantic. ])
7056 dnl ========================================================
7057 dnl Test for correct temporary object destruction order
7058 dnl ========================================================
7059 dnl We want to make sure the compiler follows the C++ spec here as
7060 dnl xpcom and the string classes depend on it (bug 235381).
7061 AC_MSG_CHECKING([for correct temporary object destruction order])
7062 AC_TRY_RUN([ class A {
7063 public: A(int& x) : mValue(x) {}
7065 operator char**() { return 0; }
7066 private: int& mValue;
7068 void func(char **arg) {}
7079 result="yes", result="no", result="maybe")
7080 AC_MSG_RESULT([$result])
7082 if test "$result" = "no"; then
7083 AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
7086 dnl ========================================================
7087 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7088 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7089 dnl raw pointers in nsCOMPtr.h. (VC++ has the same bug.)
7090 dnl ========================================================
7091 _SAVE_CXXFLAGS=$CXXFLAGS
7092 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7093 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7094 ac_nscap_nonconst_opeq_bug,
7103 template <class T, class U>
7104 int operator==(const Pointer<T>& rhs, U* lhs)
7106 return rhs.myPtr == lhs;
7109 template <class T, class U>
7110 int operator==(const Pointer<T>& rhs, const U* lhs)
7112 return rhs.myPtr == lhs;
7120 ac_nscap_nonconst_opeq_bug="no",
7121 ac_nscap_nonconst_opeq_bug="yes")])
7122 CXXFLAGS="$_SAVE_CXXFLAGS"
7124 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7125 AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7127 fi # SKIP_COMPILER_CHECKS
7129 dnl ========================================================
7131 dnl Should be smarter and check that the compiler does indeed have rtti
7132 dnl ========================================================
7133 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
7134 [ --enable-cpp-rtti Enable C++ RTTI ],
7135 [ _MOZ_USE_RTTI=1 ],
7138 if test "$_MOZ_USE_RTTI"; then
7139 _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
7141 _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
7144 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
7146 dnl ========================================================
7147 dnl C++ exceptions (g++/egcs only - for now)
7148 dnl Should be smarter and check that the compiler does indeed have exceptions
7149 dnl ========================================================
7150 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
7151 [ --enable-cpp-exceptions Enable C++ exceptions ],
7152 [ _MOZ_CPP_EXCEPTIONS=1 ],
7153 [ _MOZ_CPP_EXCEPTIONS= ])
7155 if test "$_MOZ_CPP_EXCEPTIONS"; then
7156 _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
7158 _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
7161 # Irix & OSF native compilers do not like exception declarations
7162 # when exceptions are disabled
7163 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
7164 AC_DEFINE(CPP_THROW_NEW, [])
7166 AC_DEFINE(CPP_THROW_NEW, [throw()])
7170 dnl ========================================================
7172 dnl = Build depencency options
7174 dnl ========================================================
7175 MOZ_ARG_HEADER(Build dependencies)
7177 dnl ========================================================
7178 dnl = Do not auto generate dependency info
7179 dnl ========================================================
7181 MOZ_ARG_DISABLE_BOOL(auto-deps,
7182 [ --disable-auto-deps Do not automatically generate dependency info],
7186 if test -n "$MOZ_AUTO_DEPS"; then
7187 dnl ========================================================
7188 dnl = Use mkdepend instead of $CC -MD for dependency generation
7189 dnl ========================================================
7191 MOZ_ARG_DISABLE_BOOL(md,
7192 [ --disable-md Do not use compiler-based dependencies ],
7195 [dnl Default is to turn on -MD if using GNU-compatible compilers
7196 if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
7199 dnl Default is to use -xM if using Sun Studio on Solaris
7200 if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
7203 if test "$_cpp_md_flag"; then
7205 if test "$OS_ARCH" = "OpenVMS"; then
7206 _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
7208 _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(basename $(@F)).pp)'
7210 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7211 if test -z "$GNU_CC" && test -z "$GNU_CXX" && test "$OS_ARCH" = "SunOS"; then
7216 _USE_CPP_INCLUDE_FLAG=
7217 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7218 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7222 AC_SUBST(MOZ_AUTO_DEPS)
7223 AC_SUBST(COMPILER_DEPEND)
7227 dnl ========================================================
7229 dnl = Static Build Options
7231 dnl ========================================================
7232 MOZ_ARG_HEADER(Static build options)
7234 MOZ_ARG_ENABLE_BOOL(static,
7235 [ --enable-static Enable building of internal static libs],
7236 BUILD_STATIC_LIBS=1,
7239 dnl Disable libxul in debug builds, but not for xulrunner.
7240 if test -n "$MOZ_DEBUG" -a "$MOZ_BUILD_APP" != "xulrunner"; then
7244 MOZ_ARG_ENABLE_BOOL(libxul,
7245 [ --enable-libxul Enable building of libxul],
7246 MOZ_ENABLE_LIBXUL=1,
7249 if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
7250 AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME. You probably want --enable-libxul.])
7253 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
7254 AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
7257 AC_SUBST(LIBXUL_LIBS)
7259 if test -n "$MOZ_ENABLE_LIBXUL"; then
7260 XPCOM_LIBS="$LIBXUL_LIBS"
7261 AC_DEFINE(MOZ_ENABLE_LIBXUL)
7263 if test -n "$BUILD_STATIC_LIBS"; then
7264 AC_DEFINE(MOZ_STATIC_BUILD)
7266 XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
7269 dnl ========================================================
7271 dnl = Standalone module options
7273 dnl ========================================================
7274 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7276 dnl Check for GLib and libIDL.
7277 dnl ========================================================
7278 case "$target_os" in
7279 msvc*|mks*|cygwin*|mingw*|wince*)
7280 SKIP_IDL_CHECK="yes"
7287 if test -z "$COMPILE_ENVIRONMENT"; then
7288 SKIP_IDL_CHECK="yes"
7291 dnl = Allow users to disable libIDL checking for standalone modules
7292 MOZ_ARG_WITHOUT_BOOL(libIDL,
7293 [ --without-libIDL Skip check for libIDL (standalone modules only)],
7294 SKIP_IDL_CHECK="yes")
7296 if test "$SKIP_IDL_CHECK" = "no"
7299 if test "$MACOS_SDK_DIR"; then
7300 dnl xpidl, and therefore libIDL, is only needed on the build host.
7301 dnl Don't build it against the SDK, as that causes problems.
7302 _MACSAVE_CFLAGS="$CFLAGS"
7303 _MACSAVE_LIBS="$LIBS"
7304 _MACSAVE_LDFLAGS="$LDFLAGS"
7305 _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
7307 CFLAGS=`echo $CFLAGS|sed -E -e "s%((-I|-isystem )${MACOS_SDK_DIR}/usr/(include|lib/gcc)[^ ]*)|-F${MACOS_SDK_DIR}(/System)?/Library/Frameworks[^ ]*|-nostdinc[^ ]*|-isysroot ${MACOS_SDK_DIR}%%g"`
7308 LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
7309 LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
7314 if test "$MOZ_ENABLE_GTK2"; then
7315 PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
7317 dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
7318 dnl to either libIDL1 or libIDL2.
7319 if test -z "$_LIBIDL_FOUND"; then
7320 AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
7321 if test -z "$_LIBIDL_FOUND"; then
7322 PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
7326 dnl If we don't have a libIDL config program & not cross-compiling,
7327 dnl look for orbit-config instead.
7329 if test -z "$_LIBIDL_FOUND" && test -z "$CROSS_COMPILE"; then
7330 AC_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
7331 if test -n "$ORBIT_CONFIG"; then
7332 AC_MSG_CHECKING([for ORBit libIDL usability])
7333 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
7334 _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
7335 _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
7336 _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
7337 LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
7338 LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
7340 _SAVE_CFLAGS="$CFLAGS"
7342 CFLAGS="$LIBIDL_CFLAGS $CFLAGS"
7343 LIBS="$LIBIDL_LIBS $LIBS"
7346 #include <libIDL/IDL.h>
7349 s=strdup(IDL_get_libver_string());
7362 AC_MSG_RESULT($result)
7363 CFLAGS="$_SAVE_CFLAGS"
7367 if test -z "$_LIBIDL_FOUND"; then
7368 AC_MSG_ERROR([libIDL not found.
7369 libIDL $LIBIDL_VERSION or higher is required.])
7371 if test "$MACOS_SDK_DIR"; then
7372 CFLAGS="$_MACSAVE_CFLAGS"
7373 LIBS="$_MACSAVE_LIBS"
7374 LDFLAGS="$_MACSAVE_LDFLAGS"
7375 if test -n "$_MACSAVE_NEXT_ROOT" ; then
7376 export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
7381 if test -n "$CROSS_COMPILE"; then
7382 if test -z "$HOST_LIBIDL_CONFIG"; then
7383 HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
7385 if test -n "$HOST_LIBIDL_CONFIG" && test "$HOST_LIBIDL_CONFIG" != "no"; then
7386 HOST_LIBIDL_CFLAGS=`${HOST_LIBIDL_CONFIG} --cflags`
7387 HOST_LIBIDL_LIBS=`${HOST_LIBIDL_CONFIG} --libs`
7389 HOST_LIBIDL_CFLAGS="$LIBIDL_CFLAGS"
7390 HOST_LIBIDL_LIBS="$LIBIDL_LIBS"
7394 if test -z "$SKIP_PATH_CHECKS"; then
7395 if test -z "${GLIB_CFLAGS}" || test -z "${GLIB_LIBS}" ; then
7396 if test "$MOZ_ENABLE_GTK2" || test "$USE_ELF_DYNSTR_GC" ; then
7397 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7399 AM_PATH_GLIB(${GLIB_VERSION})
7404 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
7405 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7408 AC_SUBST(LIBIDL_CFLAGS)
7409 AC_SUBST(LIBIDL_LIBS)
7410 AC_SUBST(STATIC_LIBIDL)
7411 AC_SUBST(GLIB_CFLAGS)
7413 AC_SUBST(GLIB_GMODULE_LIBS)
7414 AC_SUBST(HOST_LIBIDL_CONFIG)
7415 AC_SUBST(HOST_LIBIDL_CFLAGS)
7416 AC_SUBST(HOST_LIBIDL_LIBS)
7418 dnl ========================================================
7420 dnl ========================================================
7421 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7424 MOZ_ARG_ENABLE_BOOL(system-cairo,
7425 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
7429 # Check for headers defining standard int types.
7430 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7432 if test "$MOZ_TREE_CAIRO"; then
7433 AC_DEFINE(MOZ_TREE_CAIRO)
7435 # For now we assume that we will have a uint64_t available through
7436 # one of the above headers or mozstdint.h.
7437 AC_DEFINE(HAVE_UINT64_T)
7439 # Define macros for cairo-features.h
7440 if test "$MOZ_X11"; then
7441 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7442 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7443 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7444 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7445 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7446 MOZ_ENABLE_CAIRO_FT=1
7447 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7449 if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
7450 QPAINTER_SURFACE_FEATURE="#define CAIRO_HAS_QPAINTER_SURFACE 1"
7452 if test "$MOZ_WIDGET_TOOLKIT" = "mac" -o "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
7453 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7454 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7455 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7457 if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
7458 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7459 if test -z "$WINCE"; then
7460 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7464 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7466 if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
7467 OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
7468 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7469 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
7470 MOZ_ENABLE_CAIRO_FT=1
7471 CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
7472 CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
7474 if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
7475 PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
7476 BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
7477 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7478 MOZ_ENABLE_CAIRO_FT=1
7480 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
7481 AC_SUBST(CAIRO_FT_CFLAGS)
7483 if test "$MOZ_DEBUG"; then
7484 SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
7486 SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
7489 PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
7491 AC_SUBST(PS_SURFACE_FEATURE)
7492 AC_SUBST(PDF_SURFACE_FEATURE)
7493 AC_SUBST(SVG_SURFACE_FEATURE)
7494 AC_SUBST(XLIB_SURFACE_FEATURE)
7495 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
7496 AC_SUBST(QUARTZ_SURFACE_FEATURE)
7497 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
7498 AC_SUBST(XCB_SURFACE_FEATURE)
7499 AC_SUBST(WIN32_SURFACE_FEATURE)
7500 AC_SUBST(OS2_SURFACE_FEATURE)
7501 AC_SUBST(BEOS_SURFACE_FEATURE)
7502 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
7503 AC_SUBST(FT_FONT_FEATURE)
7504 AC_SUBST(FC_FONT_FEATURE)
7505 AC_SUBST(WIN32_FONT_FEATURE)
7506 AC_SUBST(QUARTZ_FONT_FEATURE)
7507 AC_SUBST(PNG_FUNCTIONS_FEATURE)
7508 AC_SUBST(QPAINTER_SURFACE_FEATURE)
7510 if test "$_WIN32_MSVC"; then
7511 MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib'
7513 MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/$(LIB_PREFIX)mozcairo.$(LIB_SUFFIX) $(DEPTH)/gfx/cairo/libpixman/src/$(LIB_PREFIX)mozlibpixman.$(LIB_SUFFIX)'" $CAIRO_FT_LIBS"
7515 if test "$MOZ_X11"; then
7516 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
7520 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
7521 mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
7524 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION freetype2 fontconfig)
7525 MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
7526 MOZ_CAIRO_LIBS=$CAIRO_LIBS
7527 if test "$MOZ_X11"; then
7528 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
7529 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
7530 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
7534 AC_SUBST(MOZ_TREE_CAIRO)
7535 AC_SUBST(MOZ_CAIRO_CFLAGS)
7536 AC_SUBST(MOZ_CAIRO_LIBS)
7538 dnl ========================================================
7540 dnl ========================================================
7543 if test "$_WIN32_MSVC"; then
7544 if test -z "$BUILD_STATIC_LIBS" -a -z "$MOZ_ENABLE_LIBXUL"; then
7545 LCMS_CFLAGS=-DLCMS_DLL
7547 LCMS_LIBS='$(LIBXUL_DIST)/lib/mozlcms.lib'
7549 LCMS_LIBS='-L$(LIBXUL_DIST)/bin -lmozlcms'
7552 AC_SUBST(LCMS_CFLAGS)
7555 dnl ========================================================
7557 dnl ========================================================
7558 MOZ_ARG_DISABLE_BOOL(xul,
7559 [ --disable-xul Disable XUL],
7561 if test "$MOZ_XUL"; then
7564 dnl remove extensions that require XUL
7565 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
7570 dnl ========================================================
7571 dnl Two ways to enable Python support:
7572 dnl --enable-extensions=python # select all available.
7573 dnl (MOZ_PYTHON_EXTENSIONS contains the list of extensions)
7575 dnl --enable-extensions=python/xpcom,... # select individual ones
7577 dnl If either is used, we locate the Python to use.
7578 dnl ========================================================
7580 dnl If 'python' appears anywhere in the extensions list, go lookin'...
7581 if test `echo "$MOZ_EXTENSIONS" | grep -c python` -ne 0; then
7582 dnl Allow PYTHON to point to the Python interpreter to use
7583 dnl (note that it must be the python executable - which we
7584 dnl run to locate the relevant paths etc)
7585 dnl If not set, we use whatever Python we can find.
7587 dnl Ask Python what its version number is
7589 MOZ_PYTHON_VER=`$PYTHON -c "import sys;print '%d%d' % sys.version_info[0:2]"`
7590 MOZ_PYTHON_VER_DOTTED=`$PYTHON -c "import sys;print '%d.%d' % sys.version_info[0:2]"`
7592 dnl Ask for the Python "prefix" (ie, home/source dir)
7593 MOZ_PYTHON_PREFIX=`$PYTHON -c "import sys; print sys.prefix"`
7594 dnl Setup the include and library directories.
7595 if test "$OS_ARCH" = "WINNT"; then
7596 MOZ_PYTHON_PREFIX=`$CYGPATH_W $MOZ_PYTHON_PREFIX | $CYGPATH_S`
7597 dnl Source trees have "include" and "PC" for .h, and "PCbuild" for .lib
7598 dnl Binary trees have "include" for .h, and "libs" for .lib
7599 dnl We add 'em both - along with quotes, to handle spaces.
7600 MOZ_PYTHON_DLL_SUFFIX=.pyd
7601 MOZ_PYTHON_INCLUDES="\"-I$MOZ_PYTHON_PREFIX/include\" \"-I$MOZ_PYTHON_PREFIX/PC\""
7602 MOZ_PYTHON_LIBS="\"/libpath:$MOZ_PYTHON_PREFIX/PCBuild\" \"/libpath:$MOZ_PYTHON_PREFIX/libs\""
7604 dnl Non-Windows include and libs
7605 MOZ_PYTHON_DLL_SUFFIX=$DLL_SUFFIX
7606 MOZ_PYTHON_INCLUDES="-I$MOZ_PYTHON_PREFIX/include/python$MOZ_PYTHON_VER_DOTTED"
7607 dnl Check for dynamic Python lib
7608 dnl - A static Python is no good - multiple dynamic libraries (xpcom
7609 dnl - core, xpcom loader, pydom etc) all need to share Python.
7610 dnl - Python 2.3's std --enable-shared configure option will
7611 dnl create a libpython2.3.so.1.0. We should first try this
7612 dnl dotted versioned .so file because this is the one that
7613 dnl the PyXPCOM build mechanics tries to link to.
7614 dnl XXX Should find a better way than hardcoding "1.0".
7615 dnl - Python developement tree dir layouts are NOT allowed here
7616 dnl because the PyXPCOM build just dies on it later anyway.
7617 dnl - Fixes to the above by Python/*nix knowledgable people welcome!
7618 if test -f "$MOZ_PYTHON_PREFIX/lib/libpython$MOZ_PYTHON_VER_DOTTED.so.1.0"; then
7619 MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib -lpython$MOZ_PYTHON_VER_DOTTED"
7620 elif test -f "$MOZ_PYTHON_PREFIX/lib64/libpython$MOZ_PYTHON_VER_DOTTED.so.1.0"; then
7621 MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib64 -lpython$MOZ_PYTHON_VER_DOTTED"
7622 elif test -f "$MOZ_PYTHON_PREFIX/lib/libpython$MOZ_PYTHON_VER_DOTTED.so"; then
7623 MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX/lib -lpython$MOZ_PYTHON_VER_DOTTED"
7624 elif test -f "$MOZ_PYTHON_PREFIX/libpython$MOZ_PYTHON_VER_DOTTED.so"; then
7625 dnl Don't Python development tree directory layout.
7626 MOZ_PYTHON_LIBS="-L$MOZ_PYTHON_PREFIX -lpython$MOZ_PYTHON_VER_DOTTED"
7627 AC_MSG_ERROR([The Python at $MOZ_PYTHON_PREFIX looks like a dev tree. The PyXPCOM build cannot handle this yet. You must 'make install' Python and use the installed tree.])
7628 elif test "$OS_ARCH" = "Darwin"; then
7629 dnl We do Darwin last, so if a custom non-framework build of
7630 dnl python is used on OSX, then it will be picked up first by
7631 dnl the logic above.
7632 MOZ_PYTHON_LIBS="-framework Python"
7634 AC_MSG_ERROR([Could not find build shared libraries for Python at $MOZ_PYTHON_PREFIX. This is required for PyXPCOM.])
7636 if test "$OS_ARCH" = "Linux"; then
7637 MOZ_PYTHON_LIBS="$MOZ_PYTHON_LIBS -lutil"
7640 dnl Handle "_d" on Windows
7641 if test "$OS_ARCH" = "WINNT" && test -n "$MOZ_DEBUG"; then
7642 MOZ_PYTHON_DEBUG_SUFFIX="_d"
7644 MOZ_PYTHON_DEBUG_SUFFIX=
7646 AC_MSG_RESULT(Building Python extensions using python-$MOZ_PYTHON_VER_DOTTED from $MOZ_PYTHON_PREFIX)
7649 dnl If the user asks for the 'python' extension, then we add
7650 dnl MOZ_PYTHON_EXTENSIONS to MOZ_EXTENSIONS - but with the leading 'python/'
7651 dnl Note the careful regex - it must match 'python' followed by anything
7652 dnl other than a '/', including the end-of-string.
7653 if test `echo "$MOZ_EXTENSIONS" | grep -c 'python\([[^/]]\|$\)'` -ne 0; then
7654 for pyext in $MOZ_PYTHON_EXTENSIONS; do
7655 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS python/$pyext`
7658 dnl Later we may allow MOZ_PYTHON_EXTENSIONS to be specified on the
7659 dnl command-line, but not yet
7660 AC_SUBST(MOZ_PYTHON_EXTENSIONS)
7661 AC_SUBST(MOZ_PYTHON)
7662 AC_SUBST(MOZ_PYTHON_PREFIX)
7663 AC_SUBST(MOZ_PYTHON_INCLUDES)
7664 AC_SUBST(MOZ_PYTHON_LIBS)
7665 AC_SUBST(MOZ_PYTHON_VER)
7666 AC_SUBST(MOZ_PYTHON_VER_DOTTED)
7667 AC_SUBST(MOZ_PYTHON_DEBUG_SUFFIX)
7668 AC_SUBST(MOZ_PYTHON_DLL_SUFFIX)
7670 dnl ========================================================
7671 dnl disable profile locking
7672 dnl do no use this in applications that can have more than
7673 dnl one process accessing the profile directory.
7674 dnl ========================================================
7675 MOZ_ARG_DISABLE_BOOL(profilelocking,
7676 [ --disable-profilelocking Disable profile locking],
7677 MOZ_PROFILELOCKING=,
7678 MOZ_PROFILELOCKING=1 )
7679 if test "$MOZ_PROFILELOCKING"; then
7680 AC_DEFINE(MOZ_PROFILELOCKING)
7683 dnl ========================================================
7684 dnl disable rdf services
7685 dnl ========================================================
7686 MOZ_ARG_DISABLE_BOOL(rdf,
7687 [ --disable-rdf Disable RDF],
7689 if test "$MOZ_RDF"; then
7695 dnl ========================================================
7696 dnl necko configuration options
7697 dnl ========================================================
7700 dnl option to disable various necko protocols
7702 MOZ_ARG_ENABLE_STRING(necko-protocols,
7703 [ --enable-necko-protocols[={http,ftp,default,all,none}]
7704 Enable/disable specific protocol handlers],
7705 [ for option in `echo $enableval | sed 's/,/ /g'`; do
7706 if test "$option" = "yes" || test "$option" = "all"; then
7707 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7708 elif test "$option" = "no" || test "$option" = "none"; then
7710 elif test "$option" = "default"; then
7711 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7712 elif test `echo "$option" | grep -c \^-` != 0; then
7713 option=`echo $option | sed 's/^-//'`
7714 NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
7716 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
7719 NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
7721 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
7722 AC_SUBST(NECKO_PROTOCOLS)
7723 for p in $NECKO_PROTOCOLS; do
7724 AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
7728 dnl option to disable necko's disk cache
7730 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
7731 [ --disable-necko-disk-cache
7732 Disable necko disk cache],
7735 AC_SUBST(NECKO_DISK_CACHE)
7736 if test "$NECKO_DISK_CACHE"; then
7737 AC_DEFINE(NECKO_DISK_CACHE)
7741 dnl option to minimize size of necko's i/o buffers
7743 MOZ_ARG_ENABLE_BOOL(necko-small-buffers,
7744 [ --enable-necko-small-buffers
7745 Minimize size of necko's i/o buffers],
7746 NECKO_SMALL_BUFFERS=1,
7747 NECKO_SMALL_BUFFERS=)
7748 AC_SUBST(NECKO_SMALL_BUFFERS)
7749 if test "$NECKO_SMALL_BUFFERS"; then
7750 AC_DEFINE(NECKO_SMALL_BUFFERS)
7754 dnl option to disable cookies
7756 MOZ_ARG_DISABLE_BOOL(cookies,
7757 [ --disable-cookies Disable cookie support],
7760 AC_SUBST(NECKO_COOKIES)
7761 if test "$NECKO_COOKIES"; then
7762 AC_DEFINE(NECKO_COOKIES)
7765 dnl NECKO_ configuration options are not global
7766 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
7768 dnl Only build Mork if it's required
7770 if test "$MOZ_MORK"; then
7774 dnl Build the lightweight Mork reader if required
7775 AC_SUBST(MOZ_MORKREADER)
7776 if test "$MOZ_MORKREADER"; then
7777 AC_DEFINE(MOZ_MORKREADER)
7780 dnl ========================================================
7781 if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"; then
7782 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7785 dnl ========================================================
7787 dnl = Maintainer debug option (no --enable equivalent)
7789 dnl ========================================================
7794 AC_SUBST(AR_EXTRACT)
7798 AC_SUBST(AS_DASH_C_FLAG)
7803 AC_SUBST(USE_SHORT_LIBNAME)
7807 AC_SUBST(NS_USE_NATIVE)
7808 AC_SUBST(MOZ_WIDGET_TOOLKIT)
7809 AC_SUBST(MOZ_GFX_TOOLKIT)
7810 AC_SUBST(MOZ_UPDATE_XTERM)
7812 AC_SUBST(MOZ_PLATFORM_HILDON)
7814 AC_SUBST(NS_MAEMO_LOCATION)
7815 AC_SUBST(MOZ_AUTH_EXTENSION)
7816 AC_SUBST(MOZ_MATHML)
7817 AC_SUBST(MOZ_PERMISSIONS)
7819 AC_SUBST(MOZ_NO_INSPECTOR_APIS)
7820 AC_SUBST(MOZ_PREF_EXTENSIONS)
7823 AC_SUBST(MOZ_XSLT_STANDALONE)
7824 AC_SUBST(MOZ_JS_LIBS)
7827 AC_SUBST(MOZ_DEBUG_MODULES)
7828 AC_SUBST(MOZ_PROFILE_MODULES)
7829 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
7830 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
7831 AC_SUBST(MOZ_DEBUG_FLAGS)
7832 AC_SUBST(MOZ_DEBUG_LDFLAGS)
7833 AC_SUBST(WARNINGS_AS_ERRORS)
7834 AC_SUBST(MOZ_DBGRINFO_MODULES)
7835 AC_SUBST(MOZ_EXTENSIONS)
7836 AC_SUBST(MOZ_IMG_DECODERS)
7837 AC_SUBST(MOZ_IMG_ENCODERS)
7838 AC_SUBST(MOZ_JSDEBUGGER)
7840 AC_SUBST(MOZ_NO_XPCOM_OBSOLETE)
7841 AC_SUBST(MOZ_PLUGINS)
7842 AC_SUBST(ENABLE_EAZEL_PROFILER)
7843 AC_SUBST(EAZEL_PROFILER_CFLAGS)
7844 AC_SUBST(EAZEL_PROFILER_LIBS)
7845 AC_SUBST(MOZ_PERF_METRICS)
7846 AC_SUBST(GC_LEAK_DETECTOR)
7847 AC_SUBST(MOZ_LOG_REFCNT)
7851 AC_SUBST(MOZ_CALLGRIND)
7853 AC_SUBST(MOZ_XPCTOOLS)
7854 AC_SUBST(MOZ_JSLOADER)
7855 AC_SUBST(MOZ_USE_NATIVE_UCONV)
7856 AC_SUBST(MOZ_INSURE)
7857 AC_SUBST(MOZ_INSURE_DIRS)
7858 AC_SUBST(MOZ_INSURE_EXCLUDE_DIRS)
7859 AC_SUBST(MOZ_QUANTIFY)
7860 AC_SUBST(MOZ_INSURIFYING)
7862 AC_SUBST(MOZ_PLACES)
7863 AC_SUBST(MOZ_PLACES_BOOKMARKS)
7864 AC_SUBST(MOZ_STORAGE)
7866 AC_SUBST(NS_PRINTING)
7868 AC_SUBST(MOZ_JAVAXPCOM)
7869 AC_SUBST(JAVA_INCLUDE_PATH)
7874 AC_SUBST(MOZ_PROFILELOCKING)
7877 AC_SUBST(MOZ_XIE_LIBS)
7878 AC_SUBST(MOZ_ENABLE_POSTSCRIPT)
7880 AC_SUBST(XPCOM_USE_LEA)
7881 AC_SUBST(BUILD_STATIC_LIBS)
7882 AC_SUBST(MOZ_ENABLE_LIBXUL)
7883 AC_SUBST(ENABLE_TESTS)
7885 AC_SUBST(MOZ_UNIVERSALCHARDET)
7886 AC_SUBST(ACCESSIBILITY)
7887 AC_SUBST(MOZ_XPINSTALL)
7888 AC_SUBST(MOZ_VIEW_SOURCE)
7889 AC_SUBST(MOZ_SPELLCHECK)
7890 AC_SUBST(MOZ_XPFE_COMPONENTS)
7891 AC_SUBST(MOZ_USER_DIR)
7892 AC_SUBST(MOZ_CRASHREPORTER)
7894 AC_SUBST(ENABLE_STRIP)
7895 AC_SUBST(PKG_SKIP_STRIP)
7896 AC_SUBST(USE_ELF_DYNSTR_GC)
7897 AC_SUBST(INCREMENTAL_LINKER)
7898 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
7899 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
7900 AC_SUBST(MOZ_XPCOM_OBSOLETE_LIBS)
7902 AC_SUBST(MOZ_FIX_LINK_PATHS)
7903 AC_SUBST(XPCOM_LIBS)
7904 AC_SUBST(XPCOM_FROZEN_LDOPTS)
7905 AC_SUBST(XPCOM_GLUE_LDOPTS)
7906 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
7908 AC_SUBST(USE_DEPENDENT_LIBS)
7910 AC_SUBST(MOZ_BUILD_ROOT)
7911 AC_SUBST(MOZ_OS2_TOOLS)
7912 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
7914 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
7915 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
7916 AC_SUBST(MOZ_TIMELINE)
7918 AC_SUBST(WINCE_SDK_DIR)
7919 AC_SUBST(TARGET_DEVICE)
7921 AC_SUBST(MOZ_APP_NAME)
7922 AC_SUBST(MOZ_APP_DISPLAYNAME)
7923 AC_SUBST(MOZ_APP_VERSION)
7924 AC_SUBST(FIREFOX_VERSION)
7926 AC_SUBST(MOZ_PKG_SPECIAL)
7928 AC_SUBST(MOZILLA_OFFICIAL)
7929 AC_SUBST(BUILD_OFFICIAL)
7930 AC_SUBST(MOZ_MILESTONE_RELEASE)
7933 AC_SUBST(MOZ_PROFILE)
7934 AC_SUBST(MOZ_DEBUG_SYMBOLS)
7935 AC_SUBST(MOZ_MAPINFO)
7936 AC_SUBST(MOZ_BROWSE_INFO)
7937 AC_SUBST(MOZ_TOOLS_DIR)
7938 AC_SUBST(CYGWIN_WRAPPER)
7940 AC_SUBST(WIN32_REDIST_DIR)
7943 dnl Echo the CFLAGS to remove extra whitespace.
7950 $_MOZ_EXCEPTIONS_FLAGS \
7951 $_WARNINGS_CXXFLAGS \
7954 COMPILE_CFLAGS=`echo \
7959 COMPILE_CXXFLAGS=`echo \
7960 $_DEFINES_CXXFLAGS \
7964 AC_SUBST(SYSTEM_MAKEDEPEND)
7965 AC_SUBST(SYSTEM_LIBXUL)
7966 AC_SUBST(SYSTEM_JPEG)
7967 AC_SUBST(SYSTEM_PNG)
7968 AC_SUBST(SYSTEM_ZLIB)
7969 AC_SUBST(SYSTEM_BZ2)
7971 AC_SUBST(JPEG_CFLAGS)
7973 AC_SUBST(ZLIB_CFLAGS)
7975 AC_SUBST(BZ2_CFLAGS)
7977 AC_SUBST(PNG_CFLAGS)
7980 AC_SUBST(MOZ_JPEG_CFLAGS)
7981 AC_SUBST(MOZ_JPEG_LIBS)
7982 AC_SUBST(MOZ_ZLIB_CFLAGS)
7983 AC_SUBST(MOZ_ZLIB_LIBS)
7984 AC_SUBST(MOZ_BZ2_CFLAGS)
7985 AC_SUBST(MOZ_BZ2_LIBS)
7986 AC_SUBST(MOZ_PNG_CFLAGS)
7987 AC_SUBST(MOZ_PNG_LIBS)
7989 AC_SUBST(NSPR_CFLAGS)
7991 AC_SUBST(MOZ_NATIVE_NSPR)
7993 AC_SUBST(NSS_CFLAGS)
7995 AC_SUBST(NSS_DEP_LIBS)
7996 AC_SUBST(MOZ_NATIVE_NSS)
7997 AC_SUBST(NSS_DISABLE_DBM)
8002 AC_SUBST(COMPILE_CFLAGS)
8003 AC_SUBST(COMPILE_CXXFLAGS)
8006 AC_SUBST(CROSS_COMPILE)
8007 AC_SUBST(WCHAR_CFLAGS)
8011 AC_SUBST(HOST_CFLAGS)
8012 AC_SUBST(HOST_CXXFLAGS)
8013 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8015 AC_SUBST(HOST_AR_FLAGS)
8017 AC_SUBST(HOST_RANLIB)
8018 AC_SUBST(HOST_NSPR_MDCPUCFG)
8019 AC_SUBST(HOST_BIN_SUFFIX)
8020 AC_SUBST(HOST_OS_ARCH)
8022 AC_SUBST(TARGET_CPU)
8023 AC_SUBST(TARGET_VENDOR)
8025 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8026 AC_SUBST(TARGET_MD_ARCH)
8027 AC_SUBST(TARGET_XPCOM_ABI)
8030 AC_SUBST(OS_RELEASE)
8033 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
8034 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8036 AC_SUBST(WRAP_MALLOC_CFLAGS)
8037 AC_SUBST(WRAP_MALLOC_LIB)
8040 AC_SUBST(MKSHLIB_FORCE_ALL)
8041 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8042 AC_SUBST(DSO_CFLAGS)
8043 AC_SUBST(DSO_PIC_CFLAGS)
8044 AC_SUBST(DSO_LDOPTS)
8045 AC_SUBST(LIB_PREFIX)
8046 AC_SUBST(DLL_PREFIX)
8047 AC_SUBST(DLL_SUFFIX)
8048 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8049 AC_SUBST(LIB_SUFFIX)
8050 AC_SUBST(OBJ_SUFFIX)
8051 AC_SUBST(BIN_SUFFIX)
8052 AC_SUBST(ASM_SUFFIX)
8053 AC_SUBST(IMPORT_LIB_SUFFIX)
8055 AC_SUBST(CC_VERSION)
8056 AC_SUBST(CXX_VERSION)
8057 AC_SUBST(MSMANIFEST_TOOL)
8059 if test "$USING_HCC"; then
8060 CC='${topsrcdir}/build/hcc'
8062 CXX='${topsrcdir}/build/hcpp'
8063 CXX="$CXX '$_OLDCXX'"
8068 dnl Check for missing components
8069 if test "$COMPILE_ENVIRONMENT"; then
8070 if test "$MOZ_X11"; then
8071 dnl ====================================================
8072 dnl = Check if X headers exist
8073 dnl ====================================================
8074 _SAVE_CFLAGS=$CFLAGS
8075 CFLAGS="$CFLAGS $XCFLAGS"
8079 #include <X11/Xlib.h>
8080 #include <X11/Intrinsic.h>
8084 if ((dpy = XOpenDisplay(NULL)) == NULL) {
8085 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8089 [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8090 CFLAGS="$_SAVE_CFLAGS"
8092 if test ! -z "$MISSING_X"; then
8093 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8097 fi # COMPILE_ENVIRONMENT
8099 dnl Set various defines and substitutions
8100 dnl ========================================================
8102 if test "$OS_ARCH" = "BeOS"; then
8105 elif test "$OS_ARCH" = "Darwin"; then
8107 AC_DEFINE(UNIX_ASYNC_DNS)
8109 elif test "$OS_ARCH" = "OpenVMS"; then
8111 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
8113 AC_DEFINE(UNIX_ASYNC_DNS)
8116 AC_SUBST(MOZ_MOVEMAIL)
8118 if test "$MOZ_DEBUG"; then
8119 AC_DEFINE(MOZ_REFLOW_PERF)
8120 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8123 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8124 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8125 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8126 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8127 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8128 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8129 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8130 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8131 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8134 # Used for LD_LIBRARY_PATH of run_viewer target
8136 for lib_arg in $NSPR_LIBS $TK_LIBS; do
8138 -L* ) LIBS_PATH="${LIBS_PATH:+$LIBS_PATH:}"`expr $lib_arg : "-L\(.*\)"` ;;
8144 dnl ========================================================
8145 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
8146 dnl ========================================================
8149 WIN_TOP_SRC=`cd $srcdir; pwd -W`
8152 HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
8153 HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
8154 CC="\$(CYGWIN_WRAPPER) $CC"
8155 CXX="\$(CYGWIN_WRAPPER) $CXX"
8156 CPP="\$(CYGWIN_WRAPPER) $CPP"
8157 LD="\$(CYGWIN_WRAPPER) $LD"
8158 AS="\$(CYGWIN_WRAPPER) $AS"
8159 RC="\$(CYGWIN_WRAPPER) $RC"
8160 MIDL="\$(CYGWIN_WRAPPER) $MIDL"
8161 CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
8162 WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
8166 AC_SUBST(CYGDRIVE_MOUNT)
8167 AC_SUBST(WIN_TOP_SRC)
8169 AC_SUBST(MOZILLA_VERSION)
8171 AC_SUBST(ac_configure_args)
8173 dnl Spit out some output
8174 dnl ========================================================
8176 dnl The following defines are used by xpcom
8177 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8179 HAVE_CPP_2BYTE_WCHAR_T
8180 HAVE_CPP_ACCESS_CHANGING_USING
8181 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8183 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8185 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
8186 HAVE_CPP_NAMESPACE_STD
8188 HAVE_CPP_PARTIAL_SPECIALIZATION
8189 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8191 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
8193 NEED_CPP_UNUSED_IMPLEMENTATIONS
8197 HAVE_ICONV_WITH_CONST_INPUT
8205 netwerk/necko-config.h
8206 xpcom/xpcom-config.h
8207 xpcom/xpcom-private.h
8210 # Save the defines header file before autoconf removes it.
8211 # (Do not add AC_DEFINE calls after this line.)
8212 _CONFIG_TMP=confdefs-tmp.h
8213 _CONFIG_DEFS_H=mozilla-config.h
8215 cat > $_CONFIG_TMP <<\EOF
8216 /* List of defines generated by configure. Included with preprocessor flag,
8217 * -include, to avoid long list of -D defines on the compile command-line.
8221 #ifndef _MOZILLA_CONFIG_H_
8222 #define _MOZILLA_CONFIG_H_
8225 _EGREP_PATTERN='^#define ('
8226 if test -n "$_NON_GLOBAL_ACDEFINES"; then
8227 for f in $_NON_GLOBAL_ACDEFINES; do
8228 _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
8231 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
8233 sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
8235 cat >> $_CONFIG_TMP <<\EOF
8237 #endif /* _MOZILLA_CONFIG_H_ */
8241 # Only write mozilla-config.h when something changes (or it doesn't exist)
8242 if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
8245 AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
8246 mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
8248 echo ==== $_CONFIG_DEFS_H =================================
8252 dnl Probably shouldn't call this manually but we always want the output of DEFS
8253 rm -f confdefs.h.save
8254 mv confdefs.h confdefs.h.save
8255 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
8256 AC_OUTPUT_MAKE_DEFS()
8258 AC_SUBST(MOZ_DEFINES)
8260 mv confdefs.h.save confdefs.h
8262 dnl Load the list of Makefiles to generate.
8263 dnl To add new Makefiles, edit allmakefiles.sh.
8264 dnl allmakefiles.sh sets the variable, MAKEFILES.
8265 . ${srcdir}/allmakefiles.sh
8267 dnl Run a perl script to quickly create the makefiles.
8268 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
8269 dnl for the files it cannot handle correctly. This way, config.status
8270 dnl will handle these files.
8271 dnl If it fails, nothing is set and config.status will run as usual.
8273 dnl This does not change the $MAKEFILES variable.
8275 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
8277 if test -z "${AS_PERL}"; then
8278 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
8280 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
8285 echo $MAKEFILES > unallmakefiles
8287 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
8289 AC_OUTPUT($MAKEFILES)
8291 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
8292 if test "$CAIRO_FEATURES_H"; then
8293 if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
8294 echo "$CAIRO_FEATURES_H is unchanged"
8295 mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
8297 rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
8301 dnl ========================================================
8302 dnl = Setup a nice relatively clean build environment for
8303 dnl = sub-configures.
8304 dnl ========================================================
8307 CFLAGS="$_SUBDIR_CFLAGS"
8308 CPPFLAGS="$_SUBDIR_CPPFLAGS"
8309 CXXFLAGS="$_SUBDIR_CXXFLAGS"
8310 LDFLAGS="$_SUBDIR_LDFLAGS"
8311 HOST_CC="$_SUBDIR_HOST_CC"
8312 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8313 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
8319 # No need to run subconfigures when building with LIBXUL_SDK_DIR
8320 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
8322 if test -z "$MOZ_NATIVE_NSPR"; then
8323 ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
8324 if test -z "$MOZ_DEBUG"; then
8325 ac_configure_args="$ac_configure_args --disable-debug"
8327 if test "$MOZ_OPTIMIZE" = "1"; then
8328 ac_configure_args="$ac_configure_args --enable-optimize"
8330 if test "$OS_ARCH" = "WINNT" && test "$NS_TRACE_MALLOC"; then
8331 ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
8333 if test -n "$HAVE_64BIT_OS"; then
8334 ac_configure_args="$ac_configure_args --enable-64bit"
8336 if test -n "$USE_ARM_KUSER"; then
8337 ac_configure_args="$ac_configure_args --with-arm-kuser"
8339 AC_OUTPUT_SUBDIRS(nsprpub)
8340 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8343 if test -z "$MOZ_NATIVE_NSPR"; then
8344 # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
8345 AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
8346 if test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE"; then
8347 NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
8348 $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
8349 NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
8350 $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
8352 rm -f config/autoconf.mk.bak
8355 # Run the SpiderMonkey 'configure' script.
8356 dist=$MOZ_BUILD_ROOT/dist
8357 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8358 ac_configure_args="$ac_configure_args --enable-threadsafe"
8359 if test -z "$MOZ_NATIVE_NSPR"; then
8360 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
8361 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
8363 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
8364 ac_configure_args="$ac_configure_args --includedir=$dist/include"
8365 ac_configure_args="$ac_configure_args --bindir=$dist/bin"
8366 ac_configure_args="$ac_configure_args --libdir=$dist/lib"
8367 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
8368 if test "$MOZ_MEMORY"; then
8369 ac_configure_args="$ac_configure_args --enable-jemalloc"
8371 AC_OUTPUT_SUBDIRS(js/src)
8372 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8374 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
8376 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
8377 dnl Needs to be at the end to respect possible changes from NSPR configure
8378 if cmp -b config/autoconf.mk config/autoconf.mk.orig; then
8379 echo "config/autoconf.mk is unchanged"
8380 mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
8382 rm -f config/autoconf.mk.orig 2> /dev/null