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>
45 dnl Windows x64 support
46 dnl Makoto Kato <m_kato@ga2.so-net.ne.jp>
48 dnl Alternatively, the contents of this file may be used under the terms of
49 dnl either the GNU General Public License Version 2 or later (the "GPL"), or
50 dnl the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
51 dnl in which case the provisions of the GPL or the LGPL are applicable instead
52 dnl of those above. If you wish to allow use of your version of this file only
53 dnl under the terms of either the GPL or the LGPL, and not to allow others to
54 dnl use your version of this file under the terms of the MPL, indicate your
55 dnl decision by deleting the provisions above and replace them with the notice
56 dnl and other provisions required by the GPL or the LGPL. If you do not delete
57 dnl the provisions above, a recipient may use your version of this file under
58 dnl the terms of any one of the MPL, the GPL or the LGPL.
60 dnl ***** END LICENSE BLOCK *****
62 dnl Process this file with autoconf to produce a configure script.
63 dnl ========================================================
66 AC_INIT(config/config.mk)
67 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
69 TARGET_CPU="${target_cpu}"
70 TARGET_VENDOR="${target_vendor}"
71 TARGET_OS="${target_os}"
74 MOZ_DEB_TIMESTAMP=`date +"%a, %d %b %Y %T %z" 2>&1`
75 AC_SUBST(MOZ_DEB_TIMESTAMP)
78 dnl ========================================================
80 dnl = Don't change the following two lines. Doing so breaks:
82 dnl = CFLAGS="-foo" ./configure
84 dnl ========================================================
86 CPPFLAGS="${CPPFLAGS=}"
87 CXXFLAGS="${CXXFLAGS=}"
89 HOST_CFLAGS="${HOST_CFLAGS=}"
90 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
91 HOST_LDFLAGS="${HOST_LDFLAGS=}"
93 dnl ========================================================
94 dnl = Preserve certain environment flags passed to configure
95 dnl = We want sub projects to receive the same flags
96 dnl = untainted by this configure script
97 dnl ========================================================
100 _SUBDIR_CFLAGS="$CFLAGS"
101 _SUBDIR_CPPFLAGS="$CPPFLAGS"
102 _SUBDIR_CXXFLAGS="$CXXFLAGS"
103 _SUBDIR_LDFLAGS="$LDFLAGS"
104 _SUBDIR_HOST_CC="$HOST_CC"
105 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
106 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
107 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
108 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
110 dnl Set the version number of the libs included with mozilla
111 dnl ========================================================
118 dnl Set the minimum version of toolkit libs used by mozilla
119 dnl ========================================================
127 WINDRES_VERSION=2.14.90
130 GNOMEUI_VERSION=2.2.0
133 STARTUP_NOTIFICATION_VERSION=0.8
135 SQLITE_VERSION=3.6.23.1
136 LIBNOTIFY_VERSION=0.4
140 dnl Set various checks
141 dnl ========================================================
145 dnl Initialize the Pthread test variables early so they can be
146 dnl overridden by each platform.
147 dnl ========================================================
151 dnl Do not allow a separate objdir build if a srcdir build exists.
152 dnl ==============================================================
153 _topsrcdir=`cd \`dirname $0\`; pwd`
156 if test "$_topsrcdir" != "$_objdir"
158 # Check for a couple representative files in the source tree
160 for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
161 if test -f $file; then
162 _conflict_files="$_conflict_files $file"
165 if test "$_conflict_files"; then
167 echo "* Your source tree contains these files:"
168 for file in $_conflict_files; do
172 * This indicates that you previously built in the source tree.
173 * A source tree build can confuse the separate objdir build.
175 * To clean up the source tree:
186 dnl Default to MSVC for win32 and gcc-4.2 for darwin
187 dnl ==============================================================
188 if test -z "$CROSS_COMPILE"; then
190 *-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
197 case "${target_cpu}" in
206 if test -z "$MIDL"; then MIDL=midl; fi
209 if test -z "$CC"; then CC=gcc-4.2; fi
210 if test -z "$CXX"; then CXX=g++-4.2; fi
215 COMPILE_ENVIRONMENT=1
216 MOZ_ARG_DISABLE_BOOL(compile-environment,
217 [ --disable-compile-environment
218 Disable compiler/library checks.],
219 COMPILE_ENVIRONMENT= )
220 AC_SUBST(COMPILE_ENVIRONMENT)
222 MOZ_ARG_WITH_STRING(l10n-base,
223 [ --with-l10n-base=DIR path to l10n repositories],
224 L10NBASEDIR=$withval)
225 if test ! -z "$L10NBASEDIR"; then
226 if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
227 AC_MSG_ERROR([--with-l10n-base must specify a path])
228 elif test -d "$L10NBASEDIR"; then
229 L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
231 AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
234 AC_SUBST(L10NBASEDIR)
236 dnl Check for Perl first -- needed for win32 SDK checks
237 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
238 if test -z "$PERL" || test "$PERL" = ":"; then
239 AC_MSG_ERROR([perl not found in \$PATH])
242 dnl ========================================================
243 dnl = Android uses a very custom (hacky) toolchain; we need to do this
244 dnl = here, so that the compiler checks can succeed
245 dnl ========================================================
247 MOZ_ARG_WITH_STRING(android-ndk,
248 [ --with-android-ndk=DIR
249 location where the Android NDK can be found],
250 android_ndk=$withval)
252 MOZ_ARG_WITH_STRING(android-toolchain,
253 [ --with-android-toolchain=DIR
254 location of the android toolchain, default NDK/build/prebuilt/HOST/arm-eabi-4.4.0],
255 android_toolchain=$withval)
257 MOZ_ARG_WITH_STRING(android-platform,
258 [ --with-android-platform=DIR
259 location of NDK platform dir, default NDK/build/platforms/android-5/arch-arm],
260 android_platform=$withval)
262 MOZ_ARG_WITH_STRING(android-sdk,
263 [ --with-android-sdk=DIR
264 location where the Android SDK can be found (base directory, e.g. .../android/platforms/android-6)],
265 android_sdk=$withval)
267 MOZ_ARG_WITH_STRING(android-tools,
268 [ --with-android-tools=DIR
269 location where the Android Tools can be found (base directory, e.g. .../android/tools)],
270 android_tools=$withval)
272 if test "$target" = "arm-android-eabi" ; then
273 if test -z "$android_ndk" ; then
274 AC_MSG_ERROR([You must specify --with-android-ndk=/path/to/ndk when targeting Android.])
277 if test -z "$android_sdk" ; then
278 AC_MSG_ERROR([You must specify --with-android-sdk=/path/to/sdk when targeting Android.])
281 if test -z "$android_tools" ; then
282 AC_MSG_ERROR([You must specify --with-android-tools=/path/to/sdk/tools when targeting Android.])
285 if test -z "$android_toolchain" ; then
286 android_toolchain="$android_ndk"/build/prebuilt/`uname -s | tr "[[:upper:]]" "[[:lower:]]"`-x86/arm-eabi-4.4.0
289 if test -z "$android_platform" ; then
290 android_platform="$android_ndk"/build/platforms/android-5/arch-arm
294 AS="$android_toolchain"/bin/arm-eabi-as
295 CC="$android_toolchain"/bin/arm-eabi-gcc
296 CXX="$android_toolchain"/bin/arm-eabi-g++
297 CPP="$android_toolchain"/bin/arm-eabi-cpp
298 LD="$android_toolchain"/bin/arm-eabi-ld
299 AR="$android_toolchain"/bin/arm-eabi-ar
300 RANLIB="$android_toolchain"/bin/arm-eabi-ranlib
301 STRIP="$android_toolchain"/bin/arm-eabi-strip
303 CPPFLAGS="-I$android_platform/usr/include $CPPFLAGS"
304 CFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions -march=armv5te -mthumb-interwork $CFLAGS"
305 CXXFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions -march=armv5te -mthumb-interwork $CXXFLAGS"
307 dnl Add -llog by default, since we use it all over the place.
308 dnl Add --allow-shlib-undefined, because libGLESv2 links to an
309 dnl undefined symbol (present on the hardware, just not in the
311 LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform -llog -Wl,--allow-shlib-undefined $LDFLAGS"
313 dnl prevent cross compile section from using these flags as host flags
314 if test -z "$HOST_CPPFLAGS" ; then
317 if test -z "$HOST_CFLAGS" ; then
320 if test -z "$HOST_CXXFLAGS" ; then
323 if test -z "$HOST_LDFLAGS" ; then
327 ANDROID_NDK="${android_ndk}"
328 ANDROID_TOOLCHAIN="{android_toolchain}"
329 ANDROID_PLATFORM="{android_platform}"
330 ANDROID_SDK="${android_sdk}"
331 ANDROID_TOOLS="${android_tools}"
335 MOZ_CHROME_FILE_FORMAT=omni
338 AC_SUBST(ANDROID_NDK)
339 AC_SUBST(ANDROID_TOOLCHAIN)
340 AC_SUBST(ANDROID_PLATFORM)
341 AC_SUBST(ANDROID_SDK)
342 AC_SUBST(ANDROID_TOOLS)
344 dnl ========================================================
345 dnl Checks for compilers.
346 dnl ========================================================
347 dnl Set CROSS_COMPILE in the environment when running configure
348 dnl to use the cross-compile setup for now
349 dnl ========================================================
351 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
354 if test "$COMPILE_ENVIRONMENT"; then
356 dnl Do some special WinCE toolchain stuff
360 MOZ_ARG_WITH_STRING(wince-sdk,
361 [ --with-wince-sdk=WINCE_SDK_DIR
362 The path to the Windows CE SDK],
363 WINCE_SDK_DIR=$withval)
365 MOZ_ARG_WITH_STRING(ogles-sdk,
366 [ --with-ogles-sdk=OGLES_SDK_DIR
367 The path to the OGLES SDK],
368 OGLES_SDK_DIR=$withval)
374 echo -----------------------------------------------------------------------------
375 echo Building Windows CE Shunt Library and Tool Chain
382 _topsrcdirwin=`cd \`dirname $0\`; pwd -W`
383 make OGLES_SDK_DIR="$OGLES_SDK_DIR" WINCE_SDK_DIR="$WINCE_SDK_DIR" \
384 TOPSRCDIR="$_topsrcdirwin" OBJDIR="$_pwd" target="$target" \
385 -C $srcdir/build/wince/tools
387 CC="$_pwd/dist/sdk/bin/$target-gcc.exe"
388 CXX="$_pwd/dist/sdk/bin/$target-gcc.exe"
389 CPP="$_pwd/dist/sdk/bin/$target-gcc.exe -E -nologo"
390 CXXCPP="$_pwd/dist/sdk/bin/$target-gcc.exe -TP -E -nologo"
391 LD="$_pwd/dist/sdk/bin/$target-link.exe"
392 AR="$_pwd/dist/sdk/bin/$target-lib.exe"
393 AS="$_pwd/dist/sdk/bin/$target-as.exe"
394 RC="$_pwd/dist/sdk/bin/$target-res.exe"
397 echo -----------------------------------------------------------------------------
402 if test -n "$CROSS_COMPILE" && test "$target" != "$host"; then
403 echo "cross compiling from $host to $target"
407 _SAVE_CFLAGS="$CFLAGS"
408 _SAVE_LDFLAGS="$LDFLAGS"
410 AC_MSG_CHECKING([for host c compiler])
411 AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
412 if test -z "$HOST_CC"; then
413 AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
415 AC_MSG_RESULT([$HOST_CC])
416 AC_MSG_CHECKING([for host c++ compiler])
417 AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
418 if test -z "$HOST_CXX"; then
419 AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
421 AC_MSG_RESULT([$HOST_CXX])
423 if test -z "$HOST_CFLAGS"; then
424 HOST_CFLAGS="$CFLAGS"
426 if test -z "$HOST_CXXFLAGS"; then
427 HOST_CXXFLAGS="$CXXFLAGS"
429 if test -z "$HOST_LDFLAGS"; then
430 HOST_LDFLAGS="$LDFLAGS"
432 if test -z "$HOST_AR_FLAGS"; then
433 HOST_AR_FLAGS="$AR_FLAGS"
435 AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
436 AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
438 CFLAGS="$HOST_CFLAGS"
439 LDFLAGS="$HOST_LDFLAGS"
441 AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
442 AC_TRY_COMPILE([], [return(0);],
443 [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
444 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
447 CFLAGS="$HOST_CXXFLAGS"
449 AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
450 AC_TRY_COMPILE([], [return(0);],
451 [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
452 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
456 LDFLAGS=$_SAVE_LDFLAGS
458 case "$build:$target" in
459 powerpc-apple-darwin8*:i?86-apple-darwin*)
460 dnl The Darwin cross compiler doesn't necessarily point itself at a
461 dnl root that has libraries for the proper architecture, it defaults
462 dnl to the system root. The libraries in the system root on current
463 dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
464 dnl checks will fail. Fake a working SDK in that case.
466 _SAVE_CXXFLAGS=$CXXLAGS
467 CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CFLAGS"
468 CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CXXFLAGS"
472 AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
475 AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
479 case "$build:$target" in
480 powerpc-apple-darwin8*:i?86-apple-darwin*)
481 dnl Revert the changes made above. From this point on, the target
482 dnl compiler will never be used without applying the SDK to CFLAGS
483 dnl (see --with-macos-sdk below).
485 CXXFLAGS=$_SAVE_CXXFLAGS
489 AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
490 AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
491 MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
492 AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
493 AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
494 AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
495 AC_DEFINE(CROSS_COMPILE)
500 MOZ_PATH_PROGS(AS, $AS as, $CC)
501 AC_CHECK_PROGS(AR, ar, :)
502 AC_CHECK_PROGS(LD, ld, :)
503 AC_CHECK_PROGS(STRIP, strip, :)
504 AC_CHECK_PROGS(WINDRES, windres, :)
505 if test -z "$HOST_CC"; then
508 if test -z "$HOST_CFLAGS"; then
509 HOST_CFLAGS='$(CFLAGS)'
511 if test -z "$HOST_CXX"; then
514 if test -z "$HOST_CXXFLAGS"; then
515 HOST_CXXFLAGS='$(CXXFLAGS)'
517 if test -z "$HOST_LDFLAGS"; then
518 HOST_LDFLAGS='$(LDFLAGS)'
520 if test -z "$HOST_RANLIB"; then
521 HOST_RANLIB='$(RANLIB)'
523 if test -z "$HOST_AR"; then
526 if test -z "$HOST_AR_FLAGS"; then
527 HOST_AR_FLAGS='$(AR_FLAGS)'
537 if test "$GCC" = "yes"; then
539 CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
541 if test "$GXX" = "yes"; then
543 CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
545 if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
548 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
551 if test "$GNU_CC"; then
552 if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
559 if test "$GCC" = yes; then
560 if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
565 if test "$GXX" = yes; then
566 if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
571 dnl Special win32 checks
572 dnl ========================================================
580 dnl Target the Windows 7 SDK by default
585 MOZ_ARG_WITH_STRING(windows-version,
586 [ --with-windows-version=WINSDK_TARGETVER
587 Highest Windows version to target using this SDK
588 502: Windows Server 2003
591 WINSDK_TARGETVER=$withval)
593 case "$WINSDK_TARGETVER" in
595 MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
599 AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER), must be 502, 600 or 601]);
604 if test -n "$COMPILE_ENVIRONMENT"; then
605 if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
606 # We can't build parental controls either
607 MOZ_DISABLE_PARENTAL_CONTROLS=1
612 *-cygwin*|*-mingw*|*-msvc*|*-mks*|*-wince|*-winmo)
613 if test "$GCC" != "yes"; then
614 # Check to see if we are really running in a msvc environemnt
616 AC_CHECK_PROGS(MIDL, midl)
618 # Make sure compilers are valid
619 CFLAGS="$CFLAGS -TC -nologo"
620 CXXFLAGS="$CXXFLAGS -TP -nologo"
623 AC_TRY_COMPILE([#include <stdio.h>],
624 [ printf("Hello World\n"); ],,
625 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
628 AC_TRY_COMPILE([#include <new.h>],
629 [ unsigned *test = new unsigned(42); ],,
630 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
634 _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
637 # Determine compiler version
638 CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
639 _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
640 _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
641 _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
642 _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
643 _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
645 CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
646 _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
648 if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
649 AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
651 if test "$_CC_MAJOR_VERSION" = "13"; then
653 elif test "$_CC_MAJOR_VERSION" = "14"; then
655 CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
656 dnl -DYNAMICBASE is only supported on VC8SP1 or newer,
657 dnl so be very specific here!
658 dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762
659 if test $_CC_RELEASE -gt 50727; then
661 elif test $_CC_BUILD -ge 762; then
664 AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
665 AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
666 elif test "$_CC_MAJOR_VERSION" = "15"; then
668 CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
669 LDFLAGS="$LDFLAGS -MANIFESTUAC:NO"
671 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
672 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
673 elif test "$_CC_MAJOR_VERSION" = "16"; then
675 CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
676 LDFLAGS="$LDFLAGS -MANIFESTUAC:NO"
678 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
679 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
681 AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
684 _MOZ_RTTI_FLAGS_ON='-GR'
685 _MOZ_RTTI_FLAGS_OFF='-GR-'
686 _MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
687 _MOZ_EXCEPTIONS_FLAGS_OFF=''
689 if test -n "$WIN32_REDIST_DIR"; then
690 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
694 # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
695 if test "$_CC_SUITE" -ge "8"; then
697 _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
700 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
701 if test -n "$MSMT_TOOL"; then
702 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
703 if test -z "$MSMANIFEST_TOOL_VERSION"; then
704 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
709 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
713 # Check linker version
714 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
715 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
716 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
717 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
722 _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
723 _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
724 _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
725 _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
726 # Add flags if necessary
727 AC_MSG_CHECKING([for midl flags])
730 if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
731 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
732 # MIDL version 7.00.0500 or later has no problem.
733 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
734 AC_MSG_RESULT([need -env win32])
736 AC_MSG_RESULT([none needed])
740 MIDL_FLAGS="${MIDL_FLAGS} -env x64"
743 AC_MSG_RESULT([none needed])
747 # Identify which version of the SDK we're building with
748 # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
750 AC_CHECK_HEADERS([winsdkver.h])
751 if test "$ac_cv_header_winsdkver_h" = "yes"; then
752 # Get the highest _WIN32_WINNT and NTDDI versions supported
753 # Take the higher of the two
754 # This is done because the Windows 7 beta SDK reports its
755 # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
756 AC_CACHE_CHECK(for highest Windows version supported by this SDK,
758 [cat > conftest.h <<EOF
759 #include <winsdkver.h>
760 #include <sdkddkver.h>
762 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
763 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
765 #define WINSDK_MAXVER NTDDI_MAXVER
770 ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
773 MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
775 # The Vista SDK is the only one to have sdkddkver.h but not
777 AC_CHECK_HEADERS([sdkddkver.h])
778 if test "$ac_cv_header_sdkddkver_h" = "yes"; then
779 MOZ_WINSDK_MAXVER=0x06000000
781 # Assume the Server 2003 Platform SDK
782 MOZ_WINSDK_MAXVER=0x05020000
786 unset _MSVC_VER_FILTER
788 AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
792 _SAVE_CXXFLAGS="$CXXFLAGS"
793 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
794 AC_TRY_COMPILE([#include <exception>],
795 [std::_Throw(std::exception()); return 0;],
796 ac_cv_have_std__Throw="yes",
797 ac_cv_have_std__Throw="no")
798 CXXFLAGS="$_SAVE_CXXFLAGS"
802 if test "$ac_cv_have_std__Throw" == "yes"; then
803 AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
804 ac_cv_have_dllimport_exception_bug,
808 _SAVE_CXXFLAGS="$CXXFLAGS"
809 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
810 AC_TRY_LINK([#include <vector>],
811 [std::vector<int> v; return v.at(1);],
812 ac_cv_have_dllimport_exception_bug="no",
813 ac_cv_have_dllimport_exception_bug="yes")
814 CXXFLAGS="$_SAVE_CXXFLAGS"
817 if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
819 MOZ_MSVC_STL_WRAP__Throw=1
820 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
823 AC_CACHE_CHECK(for overridable _RAISE,
828 _SAVE_CXXFLAGS="$CXXFLAGS"
829 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
830 AC_TRY_COMPILE([#include <xstddef>
832 #define _RAISE(x) externallyDefinedFunction((x).what())
835 [std::vector<int> v; return v.at(1);],
836 ac_cv_have__RAISE="no",
837 ac_cv_have__RAISE="yes")
838 CXXFLAGS="$_SAVE_CXXFLAGS"
841 if test "$ac_cv_have__RAISE" = "yes"; then
843 MOZ_MSVC_STL_WRAP__RAISE=1
844 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
846 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.])
850 if test "$WRAP_STL_INCLUDES" = "1"; then
851 STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
854 # Check w32api version
855 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
856 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
857 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
858 AC_TRY_COMPILE([#include <w32api.h>],
859 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
860 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
861 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
862 #error "test failed."
864 , [ res=yes ], [ res=no ])
865 AC_MSG_RESULT([$res])
866 if test "$res" != "yes"; then
867 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
869 # Check windres version
870 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
871 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
872 AC_MSG_RESULT([$_WINDRES_VERSION])
873 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
874 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
875 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
876 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
877 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
878 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
879 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
880 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
881 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
882 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
883 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
884 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
886 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
889 # Server 2003 is the highest version supported
890 MOZ_WINSDK_MAXVER=0x05020000
893 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
894 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
895 # Require OS features provided by IE 5.0
896 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
898 # If the maximum version supported by this SDK is lower than the target
900 AC_MSG_CHECKING([for Windows SDK being recent enough])
901 if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
905 AC_MSG_ERROR([You are targeting Windows version 0x$MOZ_WINSDK_TARGETVER, but your SDK only supports up to version $MOZ_WINSDK_MAXVER. Install and use an updated SDK, or target a lower version using --with-windows-version. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
908 AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
909 # Definitions matching sdkddkver.h
910 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WS03, 0x05020000)
911 AC_DEFINE_UNQUOTED(MOZ_NTDDI_LONGHORN, 0x06000000)
912 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
916 dnl Test breaks icc on OS/2 && MSVC
917 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
919 if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
923 CC="${srcdir}/build/hcc '$CC'"
924 CXX="${srcdir}/build/hcpp '$CXX'"
931 if test -n "$_WIN32_MSVC"; then
933 SKIP_COMPILER_CHECKS=1
934 SKIP_LIBRARY_CHECKS=1
936 # Since we're skipping compiler and library checks, hard-code
943 AC_DEFINE(HAVE_SETBUF)
944 AC_DEFINE(HAVE_ISATTY)
949 fi # COMPILE_ENVIRONMENT
962 AC_SUBST(WRAP_STL_INCLUDES)
963 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
964 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
966 dnl ========================================================
967 dnl Checks for programs.
968 dnl ========================================================
972 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
973 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
974 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
976 AC_MSG_RESULT([$_perl_version])
978 if test "$_perl_res" != 0; then
979 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
983 AC_MSG_CHECKING([for full perl installation])
984 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
986 if test "$_perl_res" != 0; then
988 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
993 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.6 python2.5 python2.4 python)
994 if test -z "$PYTHON"; then
995 AC_MSG_ERROR([python was not found in \$PATH])
998 if test -z "$COMPILE_ENVIRONMENT"; then
999 NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
1001 AC_SUBST(NSINSTALL_BIN)
1003 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
1004 MOZ_PATH_PROG(WHOAMI, whoami, :)
1005 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
1006 MOZ_PATH_PROG(UNZIP, unzip, :)
1007 MOZ_PATH_PROGS(ZIP, zip)
1008 if test -z "$ZIP" || test "$ZIP" = ":"; then
1009 AC_MSG_ERROR([zip not found in \$PATH])
1011 MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
1012 MOZ_PATH_PROG(XARGS, xargs)
1013 if test -z "$XARGS" || test "$XARGS" = ":"; then
1014 AC_MSG_ERROR([xargs not found in \$PATH .])
1017 if test "$COMPILE_ENVIRONMENT"; then
1019 dnl ========================================================
1020 dnl = Mac OS X toolchain support
1021 dnl ========================================================
1023 case "$target_os" in
1025 dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
1026 dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
1027 dnl the environment and includedir purposes (when using an SDK, below),
1028 dnl but remember the full version number for the libdir (SDK).
1030 GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
1031 GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
1033 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1034 dnl Bug 280479, but this keeps popping up in bug 292530 too because
1035 dnl 4.0.0/4061 is the default compiler in Tiger.
1037 GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
1039 if test "$GCC_BUILD" = "4061" ; then
1040 AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
1041 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
1042 from building Mozilla. Upgrade to Xcode 2.1 or later.])
1046 dnl xcodebuild needs GCC_VERSION defined in the environment, since it
1047 dnl doesn't respect the CC/CXX setting. With GCC_VERSION set, it will use
1048 dnl /usr/bin/g(cc|++)-$GCC_VERSION.
1049 MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
1054 XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
1056 if test -n "$XCODEBUILD_VERSION" && test "$XCODEBUILD_VERSION" -ge 620 ; then
1062 dnl sdp was formerly in /Developer/Tools. As of Mac OS X 10.4 (Darwin 8),
1063 dnl it has moved into /usr/bin.
1064 MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
1068 AC_SUBST(GCC_VERSION)
1069 AC_SUBST(XCODEBUILD_VERSION)
1070 AC_SUBST(HAS_XCODE_2_1)
1072 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
1073 dnl that a universal binary is being produced.
1074 AC_SUBST(UNIVERSAL_BINARY)
1076 dnl ========================================================
1077 dnl Check for MacOS deployment target version
1078 dnl ========================================================
1080 MOZ_ARG_ENABLE_STRING(macos-target,
1081 [ --enable-macos-target=VER (default=10.5)
1082 Set the minimum MacOS version needed at runtime],
1083 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
1087 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
1088 dnl Use the specified value
1089 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
1090 AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
1091 elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then
1092 dnl No value specified on the command line or in the environment,
1093 dnl use architecture minimum.
1094 export MACOSX_DEPLOYMENT_TARGET=10.5
1099 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
1101 dnl ========================================================
1102 dnl = Mac OS X SDK support
1103 dnl ========================================================
1106 MOZ_ARG_WITH_STRING(macos-sdk,
1107 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
1108 MACOS_SDK_DIR=$withval)
1110 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
1111 dnl NEXT_ROOT will be set and exported only if it's needed.
1112 AC_SUBST(MACOS_SDK_DIR)
1115 if test "$MACOS_SDK_DIR"; then
1116 dnl Sync this section with the ones in NSPR and NSS.
1117 dnl Changes to the cross environment here need to be accounted for in
1118 dnl the libIDL checks (below) and xpidl build.
1120 if test ! -d "$MACOS_SDK_DIR"; then
1121 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
1122 specify a valid SDK. SDKs are installed when the optional cross-development
1123 tools are selected during the Xcode/Developer Tools installation.])
1126 GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
1127 if test "$GCC_VERSION_MAJOR" -lt "4" ; then
1128 AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
1130 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
1131 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
1133 dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
1134 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
1135 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
1137 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1138 dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
1139 dnl that supports -syslibroot. Don't set NEXT_ROOT because it will
1140 dnl be ignored and cause warnings when -syslibroot is specified.
1141 dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
1142 dnl the -isysroot it receives, so this is only needed with 4.0.0.
1143 LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
1148 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
1150 AC_TRY_COMPILE([#include <new>
1151 int main() { return 0; }],
1155 AC_MSG_RESULT($result)
1157 if test "$result" = "no" ; then
1158 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
1162 fi # COMPILE_ENVIRONMENT
1164 if test -n "$MAKE"; then
1165 if test `echo $MAKE | grep -c make.py` != 1; then
1171 cygwin*|mingw*|mks*|msvc*)
1172 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
1175 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
1178 if test "$GMAKE" = ":"; then
1179 AC_MSG_ERROR([GNU make not found])
1183 if test "$COMPILE_ENVIRONMENT"; then
1189 fi # COMPILE_ENVIRONMENT
1191 dnl ========================================================
1192 dnl set the defaults first
1193 dnl ========================================================
1196 AR_EXTRACT='$(AR) x'
1211 MOZ_USER_DIR=".mozilla"
1214 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)'
1216 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
1218 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1220 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)'
1222 MOZ_JS_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
1223 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
1224 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1225 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
1226 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1227 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1228 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1232 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1234 USE_DEPENDENT_LIBS=1
1236 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1238 MOZ_ENABLE_POSTSCRIPT=1
1240 if test -n "$CROSS_COMPILE"; then
1241 OS_TARGET="${target_os}"
1242 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1244 case "${target_os}" in
1245 linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
1246 kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1247 gnu*) OS_ARCH=GNU ;;
1248 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
1249 mingw*) OS_ARCH=WINNT ;;
1250 wince*) OS_ARCH=WINCE ;;
1251 winmo*) OS_ARCH=WINCE ;;
1252 darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
1255 arm-android-eabi) OS_ARCH=Linux OS_TARGET=Android ;;
1258 OS_TARGET=`uname -s`
1259 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1260 OS_RELEASE=`uname -r`
1263 # Before this used `uname -m` when not cross compiling
1264 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1265 OS_TEST="${target_cpu}"
1269 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1271 #######################################################################
1272 # Master "Core Components" macros for getting the OS target #
1273 #######################################################################
1276 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1277 # cross-compilation.
1281 # Define and override various archtecture-specific variables, including
1290 case "$HOST_OS_ARCH" in
1291 cygwin*|mingw*|mks*|msvc*)
1304 if test -z "$GNU_CC"; then
1305 if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1310 if test -z "$GNU_CXX"; then
1311 if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1312 SOLARIS_SUNPRO_CXX=1
1315 AC_SUBST(SOLARIS_SUNPRO_CC)
1316 AC_SUBST(SOLARIS_SUNPRO_CXX)
1328 if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1331 HOST_OS_ARCH=UNIXWARE
1343 HOST_OS_ARCH=OpenVMS
1353 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1357 HOST_OS_ARCH=UNIXWARE
1363 if test -z "$CROSS_COMPILE" ; then
1369 # If uname -s returns "Windows_NT", we assume that we are using
1370 # the uname.exe in MKS toolkit.
1372 # The -r option of MKS uname only returns the major version number.
1373 # So we need to use its -v option to get the minor version number.
1374 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1378 OS_MINOR_RELEASE=`uname -v`
1379 if test "$OS_MINOR_RELEASE" = "00"; then
1382 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1384 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1386 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1387 # the uname.exe in the Cygwin tools.
1388 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1389 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1390 # the uname.exe in the GNU-Win32 tools.
1391 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1392 # the uname.exe in the MSYS tools.
1394 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1399 OS_RELEASE=`uname -v`.`uname -r`
1400 OS_TEST=${target_cpu}
1412 if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1416 OS_RELEASE=`uname -v`
1440 OS_RELEASE=`uname -v`
1446 OS_RELEASE=`uname -v`
1449 if test "$OS_TARGET" != "NTO"; then
1451 OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1460 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1466 OS_RELEASE=`uname -v`
1470 case "${target_os}" in
1473 WINCE_WINDOWS_MOBILE=1
1474 AC_DEFINE(WINCE_WINDOWS_MOBILE)
1482 case "${target_cpu}" in
1493 if test -z "$CROSS_COMPILE" ; then
1501 if test "$OS_ARCH" = "NCR"; then
1503 OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1507 # Only set CPU_ARCH if we recognize the value of OS_TEST
1518 powerpc | ppc | rs6000)
1522 Alpha | alpha | ALPHA)
1551 if test -z "$OS_TARGET"; then
1554 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1556 dnl ========================================================
1557 dnl GNU specific defaults
1558 dnl ========================================================
1559 if test "$GNU_CC"; then
1560 # FIXME: Let us build with strict aliasing. bug 414641.
1561 CFLAGS="$CFLAGS -fno-strict-aliasing"
1562 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1563 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1564 DSO_LDOPTS='-shared'
1565 if test "$GCC_USE_GNU_LD"; then
1566 # Don't allow undefined symbols in libraries
1567 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1568 LDFLAGS="$LDFLAGS -Wl,--gc-sections"
1569 CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
1570 CXXFLAGS="$CXXFLAGS -ffunction-sections -fdata-sections"
1572 WARNINGS_AS_ERRORS='-Werror'
1574 DSO_PIC_CFLAGS='-fPIC'
1575 ASFLAGS="$ASFLAGS -fPIC"
1576 _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1577 _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1578 _MOZ_EXCEPTIONS_FLAGS_ON='-fhandle-exceptions'
1579 _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-handle-exceptions'
1581 # Turn on GNU specific features
1582 # -Wall - turn on all warnings
1583 # -pedantic - make compiler warn about non-ANSI stuff, and
1584 # be a little bit stricter
1585 # Warnings slamm took out for now (these were giving more noise than help):
1586 # -Wbad-function-cast - warns when casting a function to a new return type
1587 # -Wshadow - removed because it generates more noise than help --pete
1588 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1589 if test -z "$INTEL_CC"; then
1590 # Don't use -Wcast-align with ICC
1592 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1593 hppa | ia64 | sparc | arm)
1596 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1601 dnl Turn pedantic on but disable the warnings for long long
1604 if test -z "$INTEL_CC"; then
1605 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1608 _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1609 _USE_CPP_INCLUDE_FLAG=1
1610 elif test "$SOLARIS_SUNPRO_CC"; then
1611 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1612 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1614 DSO_LDOPTS='-shared'
1615 if test "$GNU_LD"; then
1616 # Don't allow undefined symbols in libraries
1617 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1621 if test "$CPU_ARCH" = "sparc"; then
1622 # for Sun Studio on Solaris/SPARC
1623 DSO_PIC_CFLAGS='-xcode=pic32'
1625 DSO_PIC_CFLAGS='-KPIC'
1627 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1629 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1630 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1632 DSO_LDOPTS='-shared'
1633 if test "$GNU_LD"; then
1634 # Don't allow undefined symbols in libraries
1635 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1639 DSO_PIC_CFLAGS='-KPIC'
1640 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1643 if test "$GNU_CXX"; then
1644 # FIXME: Let us build with strict aliasing. bug 414641.
1645 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1646 # Turn on GNU specific features
1647 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1648 if test -z "$INTEL_CC"; then
1649 # Don't use -Wcast-align with ICC
1651 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1652 hppa | ia64 | sparc | arm)
1655 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1660 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1661 _USE_CPP_INCLUDE_FLAG=1
1663 AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1664 ac_has_wno_invalid_offsetof,
1668 _SAVE_CXXFLAGS="$CXXFLAGS"
1669 CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1672 ac_has_wno_invalid_offsetof="yes",
1673 ac_has_wno_invalid_offsetof="no")
1674 CXXFLAGS="$_SAVE_CXXFLAGS"
1677 if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1678 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1681 AC_CACHE_CHECK(whether the compiler supports -Wno-variadic-macros,
1682 ac_has_wno_variadic_macros,
1686 _SAVE_CXXFLAGS="$CXXFLAGS"
1687 CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-variadic-macros"
1690 ac_has_wno_variadic_macros="yes",
1691 ac_has_wno_variadic_macros="no")
1692 CXXFLAGS="$_SAVE_CXXFLAGS"
1695 if test "$ac_has_wno_variadic_macros" = "yes"; then
1696 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-variadic-macros"
1699 AC_CACHE_CHECK(whether the compiler supports -Werror=return-type,
1700 ac_has_werror_return_type,
1704 _SAVE_CXXFLAGS="$CXXFLAGS"
1705 CXXFLAGS="$CXXFLAGS -Werror=return-type"
1708 ac_has_werror_return_type="yes",
1709 ac_has_werror_return_type="no")
1710 CXXFLAGS="$_SAVE_CXXFLAGS"
1713 if test "$ac_has_werror_return_type" = "yes"; then
1714 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=return-type"
1718 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1721 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1722 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1723 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1724 dnl normal behavior.
1725 dnl ========================================================
1727 MKSHLIB_UNFORCE_ALL=
1729 if test "$COMPILE_ENVIRONMENT"; then
1730 if test "$GNU_CC"; then
1731 AC_MSG_CHECKING(whether ld has archive extraction flags)
1732 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1733 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1734 ac_cv_mkshlib_force_and_unforce="no"
1735 exec 3<&0 <<LOOP_INPUT
1736 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
1737 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1738 force="-Wl,-all"; unforce="-Wl,-none"
1745 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1748 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1750 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1754 eval $ac_cv_mkshlib_force_and_unforce
1755 MKSHLIB_FORCE_ALL=$force
1756 MKSHLIB_UNFORCE_ALL=$unforce
1759 fi # COMPILE_ENVIRONMENT
1761 dnl =================================================================
1762 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1763 dnl which is bad when cross compiling.
1764 dnl =================================================================
1765 if test "$COMPILE_ENVIRONMENT"; then
1766 configure_static_assert_macros='
1767 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1768 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1769 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1772 dnl test that the macros actually work:
1773 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1774 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1777 ac_cv_static_assertion_macros_work="yes"
1778 AC_TRY_COMPILE([$configure_static_assert_macros],
1779 [CONFIGURE_STATIC_ASSERT(1)],
1781 ac_cv_static_assertion_macros_work="no")
1782 AC_TRY_COMPILE([$configure_static_assert_macros],
1783 [CONFIGURE_STATIC_ASSERT(0)],
1784 ac_cv_static_assertion_macros_work="no",
1787 AC_TRY_COMPILE([$configure_static_assert_macros],
1788 [CONFIGURE_STATIC_ASSERT(1)],
1790 ac_cv_static_assertion_macros_work="no")
1791 AC_TRY_COMPILE([$configure_static_assert_macros],
1792 [CONFIGURE_STATIC_ASSERT(0)],
1793 ac_cv_static_assertion_macros_work="no",
1797 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1798 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1799 AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1801 fi # COMPILE_ENVIRONMENT
1803 dnl ========================================================
1804 dnl Checking for 64-bit OS
1805 dnl ========================================================
1806 if test "$COMPILE_ENVIRONMENT"; then
1809 AC_MSG_CHECKING(for 64-bit OS)
1810 AC_TRY_COMPILE([$configure_static_assert_macros],
1811 [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1812 result="yes", result="no")
1813 AC_MSG_RESULT("$result")
1814 if test "$result" = "yes"; then
1815 AC_DEFINE(HAVE_64BIT_OS)
1818 AC_SUBST(HAVE_64BIT_OS)
1820 fi # COMPILE_ENVIRONMENT
1822 dnl ========================================================
1823 dnl Enable high-memory support on OS/2 by default.
1824 dnl ========================================================
1825 MOZ_OS2_HIGH_MEMORY=1
1826 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1827 [ --disable-os2-high-mem Disable high-memory support on OS/2],
1828 MOZ_OS2_HIGH_MEMORY=,
1829 MOZ_OS2_HIGH_MEMORY=1 )
1830 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1832 dnl ========================================================
1833 dnl System overrides of the defaults for host
1834 dnl ========================================================
1837 HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1838 HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1839 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1842 *cygwin*|*mingw*|*mks*|*msvc*|*wince|*winmo)
1843 # we need Python 2.5 on Windows
1845 if test -n "$_WIN32_MSVC"; then
1847 HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1848 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1849 HOST_RANLIB='echo ranlib'
1851 HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1853 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1854 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1855 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1856 HOST_BIN_SUFFIX=.exe
1859 dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1860 PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1863 CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1864 if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1866 CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1868 if test "`${PERL} -v | grep -c cygwin 2>/dev/null`" = 0; then
1870 PERL="${CYGWIN_WRAPPER} $PERL"
1873 if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1874 PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1879 case "${host_cpu}" in
1881 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1887 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1888 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1889 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1892 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1893 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1894 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1895 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1899 HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1900 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1901 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1902 HOST_BIN_SUFFIX=.exe
1907 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1908 HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1909 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1913 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1914 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1918 dnl We require version 2.4 or newer of Python to build,
1919 dnl and 2.5 or newer on Windows.
1920 AC_MSG_CHECKING([for minimum required Python version >= $PYTHON_VERSION])
1922 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1])" $PYTHON_VERSION
1925 if test "$_python_res" != 0; then
1926 AC_MSG_ERROR([Python $PYTHON_VERSION or higher is required.])
1928 AC_MSG_RESULT([yes])
1930 dnl Get mozilla version from central milestone file
1931 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1933 dnl Get version of various core apps from the version files.
1934 FIREFOX_VERSION=`cat $topsrcdir/browser/config/version.txt`
1936 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1937 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1939 dnl ========================================================
1940 dnl System overrides of the defaults for target
1941 dnl ========================================================
1946 if test ! "$GNU_CC"; then
1947 if test ! "$HAVE_64BIT_OS"; then
1948 # Compiling with Visual Age C++ object model compat is the
1949 # default. To compile with object model ibm, add
1950 # AIX_OBJMODEL=ibm to .mozconfig.
1951 if test "$AIX_OBJMODEL" = "ibm"; then
1952 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1959 AC_SUBST(AIX_OBJMODEL)
1960 DSO_LDOPTS='-qmkshrobj=1'
1961 DSO_CFLAGS='-qflag=w:w'
1963 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1964 AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1966 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1967 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1968 if test "$COMPILE_ENVIRONMENT"; then
1971 AC_MSG_CHECKING([for VisualAge C++ compiler version >= 6.0.0.3])
1973 [#if (__IBMCPP__ < 600)
1974 #error "Bad compiler"
1976 _BAD_COMPILER=,_BAD_COMPILER=1)
1977 if test -n "$_BAD_COMPILER"; then
1979 AC_MSG_ERROR([VisualAge C++ version 6.0.0.3 or higher is required to build.])
1981 AC_MSG_RESULT([yes])
1984 TARGET_COMPILER_ABI="ibmc"
1985 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1986 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1989 case "${target_os}" in
1994 if test "$COMPILE_ENVIRONMENT"; then
1995 AC_CHECK_HEADERS(sys/inttypes.h)
1997 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2002 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
2003 _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
2004 DSO_LDOPTS='-nostart'
2005 TK_LIBS='-lbe -lroot'
2007 if test "$COMPILE_ENVIRONMENT"; then
2008 AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
2009 AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
2011 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
2012 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
2015 MOZ_USER_DIR="Mozilla"
2019 dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
2028 _WARNINGS_CFLAGS="-Wall"
2029 _WARNINGS_CXXFLAGS="-Wall"
2030 # The test above doesn't work properly, at least on 3.1.
2031 MKSHLIB_FORCE_ALL=''
2032 MKSHLIB_UNFORCE_ALL=''
2038 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2039 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2040 MOZ_OPTIMIZE_FLAGS="-O3"
2042 CFLAGS="$CFLAGS -fpascal-strings -fno-common"
2043 CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
2046 STRIP="$STRIP -x -S"
2047 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
2048 MOZ_ENABLE_POSTSCRIPT=
2049 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
2050 # The ExceptionHandling framework is needed for Objective-C exception
2051 # logging code in nsObjCExceptions.h. Currently we only use that in debug
2053 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
2055 dnl DTrace and -dead_strip don't interact well. See bug 403132.
2056 dnl ===================================================================
2057 if test "x$enable_dtrace" = "xyes"; then
2058 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
2060 dnl check for the presence of the -dead_strip linker flag
2061 AC_MSG_CHECKING([for -dead_strip option to ld])
2062 _SAVE_LDFLAGS=$LDFLAGS
2063 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
2064 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
2065 if test -n "$_HAVE_DEAD_STRIP" ; then
2066 AC_MSG_RESULT([yes])
2067 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
2072 LDFLAGS=$_SAVE_LDFLAGS
2074 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
2078 if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
2079 DLL_SUFFIX=".so.1.0"
2080 DSO_LDOPTS="-shared"
2082 if test ! "$GNU_CC"; then
2083 DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
2085 # Can't have force w/o an unforce.
2086 # # Hack for FreeBSD 2.2
2087 # if test -z "$MKSHLIB_FORCE_ALL"; then
2088 # MKSHLIB_FORCE_ALL='-Wl,-Bforcearchive'
2089 # MKSHLIB_UNFORCE_ALL=''
2095 if test ! "$GNU_CC"; then
2099 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2100 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2101 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2104 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2105 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2109 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2110 AC_DEFINE(_LARGEFILE64_SOURCE)
2115 if test ! "$GNU_CC"; then
2116 DSO_LDOPTS='-b -Wl,+s'
2119 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2120 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2121 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2123 DSO_LDOPTS='-b -E +s'
2124 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2125 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2127 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2128 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2133 DSO_LDOPTS='-elf -shared'
2135 if test "$GNU_CC"; then
2136 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2137 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2138 MKSHLIB_FORCE_ALL='-Wl,-all'
2139 MKSHLIB_UNFORCE_ALL='-Wl,-none'
2140 CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2142 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2143 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2144 MKSHLIB_FORCE_ALL='-all'
2145 MKSHLIB_UNFORCE_ALL='-none'
2151 dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must*
2152 dnl compile and link using -n32
2154 TARGET_COMPILER_ABI=n32
2155 DSO_LDOPTS='-elf -shared'
2156 MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2157 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2158 _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
2159 _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
2160 if test "$GNU_CC"; then
2161 MKSHLIB_FORCE_ALL='-Wl,-all'
2162 MKSHLIB_UNFORCE_ALL='-Wl,-none'
2163 _WARNINGS_CFLAGS="-Wall"
2164 _WARNINGS_CXXFLAGS="-Wall"
2165 CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2167 MKSHLIB_FORCE_ALL='-all'
2168 MKSHLIB_UNFORCE_ALL='-none'
2174 CFLAGS="$CFLAGS -woff 3262 -G 4"
2175 CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
2176 if test -n "$USE_N32"; then
2177 ASFLAGS="$ASFLAGS -n32"
2178 CFLAGS="$CFLAGS -n32"
2179 CXXFLAGS="$CXXFLAGS -n32"
2180 LDFLAGS="$LDFLAGS -n32"
2182 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2183 AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
2186 if test -z "$GNU_CXX"; then
2192 # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2193 # Similarly for GNU_CXX and INTEL_CXX.
2194 if test "$INTEL_CC" || test "$INTEL_CXX"; then
2195 # -Os has been broken on Intel's C/C++ compilers for quite a
2196 # while; Intel recommends against using it.
2197 MOZ_OPTIMIZE_FLAGS="-O2"
2198 MOZ_DEBUG_FLAGS="-g"
2199 elif test "$GNU_CC" || test "$GNU_CXX"; then
2200 GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2201 case $GCC_VERSION in
2203 # -Os is broken on gcc 4.1.x and 4.2.x, we need to tweak it to get good results.
2204 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2206 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fomit-frame-pointer $MOZ_OPTIMIZE_SIZE_TWEAK"
2207 MOZ_DEBUG_FLAGS="-g"
2210 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2214 case "${target_cpu}" in
2216 CFLAGS="$CFLAGS -mieee"
2217 CXXFLAGS="$CXXFLAGS -mieee"
2223 MOZ_DEBUG_FLAGS="-g" # We want inlining
2229 TARGET_COMPILER_ABI=msvc
2230 _PLATFORM_DEFAULT_TOOLKIT=cairo-windows
2231 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2232 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2234 AR_EXTRACT="$AR -extract"
2236 AR_FLAGS='-OUT:"$@"'
2240 ac_configure_args="$ac_configure_args --enable-win32-target=WINCE"
2242 if test "$AS_BIN"; then
2249 if test -z "$RC"; then
2252 # certain versions of cygwin's makedepend barf on the
2253 # #include <string> vs -I./dist/include/string issue so don't use it
2259 HOST_AR='lib -OUT:$@'
2260 HOST_RANLIB='echo ranlib'
2261 HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
2264 WARNINGS_AS_ERRORS='-WX'
2265 MOZ_OPTIMIZE_FLAGS='-Ox'
2266 AR_FLAGS='-NOLOGO -OUT:"$@"'
2268 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2269 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2272 DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
2273 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2275 IMPORT_LIB_SUFFIX=lib
2276 dnl Need to force-link against mozalloc because it's used in the shunt
2277 LIBS="$LIBS \$(LIBXUL_DIST)/lib/mozalloc.lib"
2278 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2281 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2282 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2284 MKSHLIB_UNFORCE_ALL=
2285 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2286 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2287 MOZ_DEBUG_FLAGS='-Zi'
2288 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2290 MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2292 RANLIB='echo not_ranlib'
2293 STRIP='echo not_strip'
2294 TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
2297 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2299 LIBIDL_CFLAGS="-I$MOZ_TOOLS_DIR/include ${GLIB_CFLAGS}"
2300 LIBIDL_LIBS="$MOZ_TOOLS_DIR/lib/libidl-0.6_s.lib $MOZ_TOOLS_DIR/lib/glib-1.2_s.lib"
2304 AC_DEFINE(HAVE_SNPRINTF)
2309 AC_DEFINE(HW_THREADS)
2310 AC_DEFINE(STDC_HEADERS)
2311 AC_DEFINE(NEW_H, <new>)
2312 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2313 AC_DEFINE(HAVE_LOCALTIME_R)
2315 TARGET_MD_ARCH=win32
2316 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2318 MOZ_ENABLE_POSTSCRIPT=
2319 MOZ_USER_DIR="Mozilla"
2321 MOZ_GFX_OPTIMIZE_MOBILE=1
2323 # Sanity check for WINCE_WINDOWS_MOBILE
2324 # XXX disabled until we can fix the mobile tinderbox
2325 ##if test "$WINCE_WINDOWS_MOBILE"; then
2326 ## AC_CHECK_HEADER(tpcshell.h, [],
2327 ## AC_MSG_ERROR([Can't find tpcshell.h in your SDK; are you sure you don't need --disable-windows-mobile-components?]))
2332 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2337 # certain versions of cygwin's makedepend barf on the
2338 # #include <string> vs -I./dist/include/string issue so don't use it
2340 if test -n "$GNU_CC"; then
2341 CC="$CC -mno-cygwin"
2342 CXX="$CXX -mno-cygwin"
2343 CPP="$CPP -mno-cygwin"
2344 CFLAGS="$CFLAGS -mms-bitfields"
2345 CXXFLAGS="$CXXFLAGS -mms-bitfields"
2346 DSO_LDOPTS='-shared'
2347 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2348 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2350 # Use temp file for windres (bug 213281)
2351 RCFLAGS='-O coff --use-temp-file'
2352 # mingw doesn't require kernel32, user32, and advapi32 explicitly
2353 LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32"
2354 MOZ_JS_LIBS='-L$(LIBXUL_DIST)/lib -lmozjs'
2356 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2357 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2359 IMPORT_LIB_SUFFIX=dll.a
2360 GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2362 TARGET_COMPILER_ABI=msvc
2366 if test "$AS_BIN"; then
2367 AS="$(basename "$AS_BIN")"
2369 AR='lib -NOLOGO -OUT:"$@"'
2371 RANLIB='echo not_ranlib'
2372 STRIP='echo not_strip'
2377 GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2383 IMPORT_LIB_SUFFIX=lib
2384 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2385 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2387 MKSHLIB_UNFORCE_ALL=
2388 DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2389 _USE_CPP_INCLUDE_FLAG=1
2390 _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2391 _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2392 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2393 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2394 CXXFLAGS="$CXXFLAGS -wd4800" # disable warning "forcing value to bool"
2395 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2396 MOZ_DEBUG_FLAGS='-Zi'
2397 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2398 WARNINGS_AS_ERRORS='-WX'
2399 MOZ_OPTIMIZE_FLAGS='-O1'
2400 MOZ_JS_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2402 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2403 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2404 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2405 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2406 if test $_MSC_VER -ge 1400; then
2407 LDFLAGS="$LDFLAGS -NXCOMPAT"
2408 dnl For profile-guided optimization
2409 PROFILE_GEN_CFLAGS="-GL"
2410 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2411 dnl XXX: PGO builds can fail with warnings treated as errors,
2412 dnl specifically "no profile data available" appears to be
2413 dnl treated as an error sometimes. This might be a consequence
2414 dnl of using WARNINGS_AS_ERRORS in some modules, combined
2415 dnl with the linker doing most of the work in the whole-program
2416 dnl optimization/PGO case. I think it's probably a compiler bug,
2417 dnl but we work around it here.
2418 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2419 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2420 dnl Probably also a compiler bug, but what can you do?
2421 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2422 if test -n "$_USE_DYNAMICBASE"; then
2423 LDFLAGS="$LDFLAGS -DYNAMICBASE"
2427 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg32$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2428 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2429 AC_DEFINE(HAVE_SNPRINTF)
2434 AC_DEFINE(HW_THREADS)
2435 AC_DEFINE(STDC_HEADERS)
2436 AC_DEFINE(NEW_H, <new>)
2437 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2438 TARGET_MD_ARCH=win32
2439 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2441 MOZ_ENABLE_POSTSCRIPT=
2442 MOZ_USER_DIR="Mozilla"
2444 dnl Hardcode to win95 for now - cls
2445 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2447 dnl set NO_X11 defines here as the general check is skipped on win32
2451 dnl MinGW/MSYS doesn't provide or need cygpath
2456 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2458 *-cygwin*|*-msvc*|*-mks*)
2459 CYGPATH_W="cygpath -a -w"
2460 CYGPATH_S="sed -e s|\\\\|/|g"
2461 MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2465 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2467 if test -z "$MOZ_TOOLS"; then
2468 AC_MSG_ERROR([MOZ_TOOLS is not set])
2471 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2472 if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then
2473 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2475 MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2476 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2477 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2479 MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2481 if test -n "$GLIB_PREFIX"; then
2482 _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd -W`
2483 if test "$?" = "0"; then
2484 if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
2485 AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
2487 _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
2489 AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
2492 _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
2494 if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
2495 AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
2497 GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
2498 if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
2499 GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
2500 elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
2501 GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
2503 AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
2506 if test -n "$LIBIDL_PREFIX"; then
2507 _LIBIDL_PREFIX_DIR=`cd $LIBIDL_PREFIX && pwd -W`
2508 if test "$?" = "0"; then
2509 if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
2510 AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
2512 _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
2514 AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
2517 _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
2519 if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
2520 AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
2522 LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
2523 if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
2524 LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
2526 elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
2527 LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
2529 AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
2531 LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2534 *) # else cross-compiling
2535 if test -n "$GLIB_PREFIX"; then
2536 GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
2537 if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
2538 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
2539 elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
2540 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
2542 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
2545 if test -n "$LIBIDL_PREFIX"; then
2546 LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
2547 if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
2548 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
2550 elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
2551 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
2553 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
2556 LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
2563 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])
2567 AC_CHECK_HEADERS(oleacc.idl)
2571 AC_CHECK_HEADERS(atlbase.h)
2578 if test "$HAVE_64BIT_OS"; then
2579 AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2582 if test $_MSC_VER -ge 1400; then
2583 LDFLAGS="$LDFLAGS -SAFESEH"
2585 AC_CHECK_HEADERS(mmintrin.h)
2598 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2602 if test "$HAVE_64BIT_OS"; then
2609 CFLAGS="$CFLAGS -Dunix"
2610 CXXFLAGS="$CXXFLAGS -Dunix"
2611 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2613 DSO_PIC_CFLAGS='-fPIC -DPIC'
2614 DSO_LDOPTS='-shared'
2615 BIN_FLAGS='-Wl,--export-dynamic'
2617 DSO_PIC_CFLAGS='-fPIC -DPIC'
2618 DLL_SUFFIX=".so.1.0"
2619 DSO_LDOPTS='-shared'
2621 # This will fail on a.out systems prior to 1.5.1_ALPHA.
2622 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2623 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2624 if test "$LIBRUNPATH"; then
2625 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2627 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2628 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2633 AC_DEFINE(_QNX_SOURCE)
2636 WARNINGS_AS_ERRORS=''
2637 MOZ_OPTIMIZE_FLAGS="-O"
2638 MOZ_DEBUG_FLAGS="-gstabs"
2641 LIBS="$LIBS -lsocket -lstdc++"
2642 _DEFINES_CFLAGS='-Wp,-include -Wp,$(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2643 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -Wp,-include -Wp,$(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2644 if test "$with_x" != "yes"
2646 _PLATFORM_DEFAULT_TOOLKIT="photon"
2647 TK_CFLAGS='-I/usr/include/photon'
2650 case "${target_cpu}" in
2652 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
2655 case "${host_cpu}" in
2663 DLL_SUFFIX=".so.1.0"
2665 DSO_PIC_CFLAGS='-fPIC'
2666 DSO_LDOPTS='-shared -fPIC'
2667 if test "$LIBRUNPATH"; then
2668 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2673 AC_DEFINE(NO_PW_GECOS)
2674 AC_DEFINE(NO_UDSOCK)
2675 AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2677 MKSHLIB_FORCE_ALL='-all'
2678 MKSHLIB_UNFORCE_ALL='-none'
2680 AS_DASH_C_FLAG='-Wc/names=as_is'
2682 DSO_LDOPTS='-shared -auto_symvec'
2684 MOZ_DEBUG_LDFLAGS='-g'
2686 CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2687 CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2692 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2693 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2696 AC_DEFINE(OS2EMX_PLAIN_CHAR)
2697 AC_DEFINE(TCPV40HDRS)
2703 IMPORT_LIB_SUFFIX=lib
2707 CFLAGS="$CFLAGS -Zomf"
2708 CXXFLAGS="$CXXFLAGS -Zomf"
2710 BIN_FLAGS='-Zlinker /ST:0x100000'
2714 WARNINGS_AS_ERRORS='-Werror'
2715 MOZ_DEBUG_FLAGS="-g -fno-inline"
2716 MOZ_OPTIMIZE_FLAGS="-O2"
2717 MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2718 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2719 LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2721 _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2722 MOZ_ENABLE_POSTSCRIPT=
2725 MOZ_USER_DIR="Mozilla"
2727 if test "$MOZTOOLS"; then
2728 MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2730 AC_MSG_ERROR([MOZTOOLS is not set])
2732 if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2733 DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2734 LDFLAGS="$LDFLAGS -Zhigh-mem"
2735 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2736 AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2739 # GCC for OS/2 currently predefines these, but we don't want them
2740 _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2741 _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2743 AC_CACHE_CHECK(for __declspec(dllexport),
2745 [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2747 ac_os2_declspec="yes",
2748 ac_os2_declspec="no")])
2749 if test "$ac_os2_declspec" = "yes"; then
2751 MOZ_OS2_USE_DECLSPEC='1'
2756 if test "$GNU_CC"; then
2757 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2758 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2761 MOZ_DEBUG_FLAGS='-g'
2762 ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2763 CFLAGS="$CFLAGS -ieee"
2764 CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee -ptr $(DIST)/cxx_repository'
2765 DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2768 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2769 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2770 MKSHLIB_FORCE_ALL='-all'
2771 MKSHLIB_UNFORCE_ALL='-none'
2772 dnl Might fix the libxpcom.so breakage on this platform as well....
2773 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2774 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2776 if test -z "$GNU_CXX"; then
2779 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2783 DIRENT_INO=d_stat.st_ino
2784 dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2785 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2786 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2787 dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2788 AC_DEFINE(STDC_HEADERS)
2789 if test "$no_x" = "yes"; then
2790 _PLATFORM_DEFAULT_TOOLKIT='photon'
2791 TK_CFLAGS='-I/usr/nto/include/photon'
2792 TK_LIBS='-lphoton -lphrender'
2797 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2798 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2799 CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2800 if test ! "$GNU_CC"; then
2807 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2809 # $ORIGIN/.. is for shared libraries under components/ to locate shared
2810 # libraries one level up (e.g. libnspr4.so)
2811 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
2812 if test "$SOLARIS_SUNPRO_CC"; then
2813 LIBS="-lCrun -lCstd $LIBS"
2816 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2817 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all"
2818 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic -norunpath"
2819 _MOZ_EXCEPTIONS_FLAGS_ON='-features=except'
2820 _MOZ_EXCEPTIONS_FLAGS_OFF='-features=no%except'
2821 LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
2822 if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
2823 _SAVE_LDFLAGS=$LDFLAGS
2824 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2825 AC_TRY_LINK([#include <stdio.h>],
2826 [printf("Hello World\n");],
2828 [LDFLAGS=$_SAVE_LDFLAGS])
2830 WARNINGS_AS_ERRORS='-Werror'
2831 MOZ_OPTIMIZE_FLAGS="-xO4"
2832 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2833 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -z muldefs -h $@ -o $@'
2834 MKSHLIB_FORCE_ALL='-z allextract'
2835 MKSHLIB_UNFORCE_ALL='-z defaultextract'
2836 DSO_LDOPTS='-G -z muldefs'
2842 AS='/usr/ccs/bin/as'
2843 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2845 TARGET_COMPILER_ABI="sunc"
2846 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2847 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2848 AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2852 [#if (__SUNPRO_CC < 0x590)
2855 _BAD_COMPILER=,_BAD_COMPILER=1)
2856 if test -n "$_BAD_COMPILER"; then
2858 AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2862 AC_MSG_RESULT([$_res])
2865 ASFLAGS="$ASFLAGS -fPIC"
2868 _WARNINGS_CXXFLAGS=''
2869 if test "$OS_RELEASE" = "5.3"; then
2870 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2873 if test "$OS_RELEASE" = "5.5.1"; then
2874 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2879 DSO_LDOPTS='-Bdynamic'
2880 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2881 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2883 AC_DEFINE(SPRINTF_RETURNS_STRING)
2884 case "$(target_os)" in
2886 DLL_SUFFIX='.so.1.0'
2892 NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2896 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2900 AC_DEFINE(NO_PW_GECOS)
2902 _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2903 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2905 MOZ_GFX_OPTIMIZE_MOBILE=1
2906 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fomit-frame-pointer"
2913 dnl Only one oddball right now (QNX), but this gives us flexibility
2914 dnl if any other platforms need to override this in the future.
2915 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2917 dnl ========================================================
2918 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2919 dnl by now will not have any way to link most binaries (tests
2920 dnl as well as viewer, apprunner, etc.), because some symbols
2921 dnl will be left out of the "composite" .so's by ld as unneeded.
2922 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2923 dnl they can link in the static libs that provide the missing
2925 dnl ========================================================
2926 NO_LD_ARCHIVE_FLAGS=
2927 if test -z "$MKSHLIB_FORCE_ALL" || test -z "$MKSHLIB_UNFORCE_ALL"; then
2928 NO_LD_ARCHIVE_FLAGS=1
2932 NO_LD_ARCHIVE_FLAGS=
2935 NO_LD_ARCHIVE_FLAGS=
2938 NO_LD_ARCHIVE_FLAGS=
2940 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince|*-winmo)
2941 if test -z "$GNU_CC"; then
2942 NO_LD_ARCHIVE_FLAGS=
2946 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2948 dnl ========================================================
2949 dnl = Flags to strip unused symbols from .so components
2950 dnl ========================================================
2952 *-linux*|*-kfreebsd*-gnu|*-gnu*)
2953 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2956 if test -z "$GNU_CC"; then
2957 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2959 if test -z "$GCC_USE_GNU_LD"; then
2960 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2962 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2967 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2970 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2972 *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince|*-winmo)
2973 if test -n "$GNU_CC"; then
2974 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2979 if test -z "$COMPILE_ENVIRONMENT"; then
2980 SKIP_COMPILER_CHECKS=1
2981 SKIP_LIBRARY_CHECKS=1
2984 if test -z "$SKIP_COMPILER_CHECKS"; then
2985 dnl Checks for typedefs, structures, and compiler characteristics.
2986 dnl ========================================================
2994 AC_MSG_CHECKING(for __stdcall)
2995 AC_CACHE_VAL(ac_cv___stdcall,
2997 [void foo(); void __stdcall foo();],
2998 [ac_cv___stdcall=true],
2999 [ac_cv___stdcall=false])])
3000 if test "$ac_cv___stdcall" = true ; then
3001 AC_DEFINE(HAVE_STDCALL)
3006 AC_MSG_CHECKING(for ssize_t)
3007 AC_CACHE_VAL(ac_cv_type_ssize_t,
3008 [AC_TRY_COMPILE([#include <stdio.h>
3009 #include <sys/types.h>],
3011 [ac_cv_type_ssize_t=true],
3012 [ac_cv_type_ssize_t=false])])
3013 if test "$ac_cv_type_ssize_t" = true ; then
3014 AC_DEFINE(HAVE_SSIZE_T)
3019 AC_STRUCT_ST_BLKSIZE
3020 AC_MSG_CHECKING(for siginfo_t)
3021 AC_CACHE_VAL(ac_cv_siginfo_t,
3022 [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
3023 #include <signal.h>],
3025 [ac_cv_siginfo_t=true],
3026 [ac_cv_siginfo_t=false])])
3027 if test "$ac_cv_siginfo_t" = true ; then
3028 AC_DEFINE(HAVE_SIGINFO_T)
3034 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
3035 dnl ========================================================
3036 AC_MSG_CHECKING(for int16_t)
3037 AC_CACHE_VAL(ac_cv_int16_t,
3038 [AC_TRY_COMPILE([#include <stdio.h>
3039 #include <sys/types.h>],
3041 [ac_cv_int16_t=true],
3042 [ac_cv_int16_t=false])])
3043 if test "$ac_cv_int16_t" = true ; then
3044 AC_DEFINE(HAVE_INT16_T)
3049 AC_MSG_CHECKING(for int32_t)
3050 AC_CACHE_VAL(ac_cv_int32_t,
3051 [AC_TRY_COMPILE([#include <stdio.h>
3052 #include <sys/types.h>],
3054 [ac_cv_int32_t=true],
3055 [ac_cv_int32_t=false])])
3056 if test "$ac_cv_int32_t" = true ; then
3057 AC_DEFINE(HAVE_INT32_T)
3062 AC_MSG_CHECKING(for int64_t)
3063 AC_CACHE_VAL(ac_cv_int64_t,
3064 [AC_TRY_COMPILE([#include <stdio.h>
3065 #include <sys/types.h>],
3067 [ac_cv_int64_t=true],
3068 [ac_cv_int64_t=false])])
3069 if test "$ac_cv_int64_t" = true ; then
3070 AC_DEFINE(HAVE_INT64_T)
3075 AC_MSG_CHECKING(for int64)
3076 AC_CACHE_VAL(ac_cv_int64,
3077 [AC_TRY_COMPILE([#include <stdio.h>
3078 #include <sys/types.h>],
3081 [ac_cv_int64=false])])
3082 if test "$ac_cv_int64" = true ; then
3083 AC_DEFINE(HAVE_INT64)
3088 AC_MSG_CHECKING(for uint)
3089 AC_CACHE_VAL(ac_cv_uint,
3090 [AC_TRY_COMPILE([#include <stdio.h>
3091 #include <sys/types.h>],
3094 [ac_cv_uint=false])])
3095 if test "$ac_cv_uint" = true ; then
3096 AC_DEFINE(HAVE_UINT)
3101 AC_MSG_CHECKING(for uint_t)
3102 AC_CACHE_VAL(ac_cv_uint_t,
3103 [AC_TRY_COMPILE([#include <stdio.h>
3104 #include <sys/types.h>],
3106 [ac_cv_uint_t=true],
3107 [ac_cv_uint_t=false])])
3108 if test "$ac_cv_uint_t" = true ; then
3109 AC_DEFINE(HAVE_UINT_T)
3114 AC_MSG_CHECKING(for uint16_t)
3115 AC_CACHE_VAL(ac_cv_uint16_t,
3116 [AC_TRY_COMPILE([#include <stdio.h>
3117 #include <sys/types.h>],
3118 [uint16_t foo = 0;],
3119 [ac_cv_uint16_t=true],
3120 [ac_cv_uint16_t=false])])
3121 if test "$ac_cv_uint16_t" = true ; then
3122 AC_DEFINE(HAVE_UINT16_T)
3128 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
3129 dnl are defined when compiling C++ but not C. Since the result of this
3130 dnl test is used only in C++, do it in C++.
3133 AC_MSG_CHECKING(for uname.domainname)
3134 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
3135 [AC_TRY_COMPILE([#include <sys/utsname.h>],
3136 [ struct utsname *res; char *domain;
3137 (void)uname(res); if (res != 0) { domain = res->domainname; } ],
3138 [ac_cv_have_uname_domainname_field=true],
3139 [ac_cv_have_uname_domainname_field=false])])
3141 if test "$ac_cv_have_uname_domainname_field" = "true"; then
3142 AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
3148 AC_MSG_CHECKING(for uname.__domainname)
3149 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
3150 [AC_TRY_COMPILE([#include <sys/utsname.h>],
3151 [ struct utsname *res; char *domain;
3152 (void)uname(res); if (res != 0) { domain = res->__domainname; } ],
3153 [ac_cv_have_uname_us_domainname_field=true],
3154 [ac_cv_have_uname_us_domainname_field=false])])
3156 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
3157 AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
3165 dnl Check for usable char16_t (2 bytes, unsigned)
3166 dnl (we might not need the unsignedness check anymore)
3167 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
3168 ac_cv_have_usable_char16_t,
3169 [AC_TRY_COMPILE([$configure_static_assert_macros],
3170 [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
3171 CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
3172 CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
3173 CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
3174 CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
3175 ac_cv_have_usable_char16_t="yes",
3176 ac_cv_have_usable_char16_t="no")])
3177 if test "$ac_cv_have_usable_char16_t" = "yes"; then
3178 AC_DEFINE(HAVE_CPP_CHAR16_T)
3182 dnl Check for usable wchar_t (2 bytes, unsigned)
3183 dnl (we really don't need the unsignedness check anymore)
3184 dnl ========================================================
3186 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
3187 ac_cv_have_usable_wchar_v2,
3188 [AC_TRY_COMPILE([#include <stddef.h>
3189 $configure_static_assert_macros],
3190 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3191 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3192 ac_cv_have_usable_wchar_v2="yes",
3193 ac_cv_have_usable_wchar_v2="no")])
3194 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
3195 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3196 HAVE_CPP_2BYTE_WCHAR_T=1
3197 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
3198 dnl This is really gcc-only
3199 dnl Do this test using CXX only since some versions of gcc
3200 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
3201 dnl only have short-wchar support for c++.
3202 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
3204 _SAVE_CXXFLAGS=$CXXFLAGS
3205 CXXFLAGS="$CXXFLAGS -fshort-wchar"
3207 AC_CACHE_CHECK(for compiler -fshort-wchar option,
3208 ac_cv_have_usable_wchar_option_v2,
3209 [AC_TRY_LINK([#include <stddef.h>
3210 $configure_static_assert_macros],
3211 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3212 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3213 ac_cv_have_usable_wchar_option_v2="yes",
3214 ac_cv_have_usable_wchar_option_v2="no")])
3216 if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
3217 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3218 HAVE_CPP_2BYTE_WCHAR_T=1
3219 WCHAR_CFLAGS="-fshort-wchar"
3221 CXXFLAGS=$_SAVE_CXXFLAGS
3227 dnl Check for .hidden assembler directive and visibility attribute.
3228 dnl Borrowed from glibc configure.in
3229 dnl ===============================================================
3230 if test "$GNU_CC"; then
3231 AC_CACHE_CHECK(for visibility(hidden) attribute,
3232 ac_cv_visibility_hidden,
3233 [cat > conftest.c <<EOF
3234 int foo __attribute__ ((visibility ("hidden"))) = 1;
3236 ac_cv_visibility_hidden=no
3237 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3238 if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3239 ac_cv_visibility_hidden=yes
3244 if test "$ac_cv_visibility_hidden" = "yes"; then
3245 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
3247 AC_CACHE_CHECK(for visibility(default) attribute,
3248 ac_cv_visibility_default,
3249 [cat > conftest.c <<EOF
3250 int foo __attribute__ ((visibility ("default"))) = 1;
3252 ac_cv_visibility_default=no
3253 if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3254 if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3255 ac_cv_visibility_default=yes
3260 if test "$ac_cv_visibility_default" = "yes"; then
3261 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
3263 AC_CACHE_CHECK(for visibility pragma support,
3264 ac_cv_visibility_pragma,
3265 [cat > conftest.c <<EOF
3266 #pragma GCC visibility push(hidden)
3268 #pragma GCC visibility push(default)
3269 int foo_default = 1;
3271 ac_cv_visibility_pragma=no
3272 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3273 if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
3274 if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
3275 ac_cv_visibility_pragma=yes
3281 if test "$ac_cv_visibility_pragma" = "yes"; then
3282 AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
3283 ac_cv_have_visibility_class_bug,
3284 [cat > conftest.c <<EOF
3285 #pragma GCC visibility push(hidden)
3286 struct __attribute__ ((visibility ("default"))) TestStruct {
3289 __attribute__ ((visibility ("default"))) void TestFunc() {
3293 ac_cv_have_visibility_class_bug=no
3294 if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3295 ac_cv_have_visibility_class_bug=yes
3297 if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
3298 ac_cv_have_visibility_class_bug=yes
3301 rm -rf conftest.{c,S}
3304 AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
3305 ac_cv_have_visibility_builtin_bug,
3306 [cat > conftest.c <<EOF
3307 #pragma GCC visibility push(hidden)
3308 #pragma GCC visibility push(default)
3310 #pragma GCC visibility pop
3312 __attribute__ ((visibility ("default"))) void Func() {
3314 memset(c, 0, sizeof(c));
3317 ac_cv_have_visibility_builtin_bug=no
3318 if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3319 ac_cv_have_visibility_builtin_bug=yes
3321 if test `grep -c "@PLT" conftest.S` = 0; then
3322 ac_cv_visibility_builtin_bug=yes
3325 rm -f conftest.{c,S}
3327 if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
3328 "$ac_cv_have_visibility_class_bug" = "no"; then
3329 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
3330 WRAP_SYSTEM_INCLUDES=1
3331 STL_FLAGS='-I$(DIST)/stl_wrappers'
3334 VISIBILITY_FLAGS='-fvisibility=hidden'
3335 fi # have visibility pragma bug
3336 fi # have visibility pragma
3337 fi # have visibility(default) attribute
3338 fi # have visibility(hidden) attribute
3341 # visibility hidden flag for Sun Studio on Solaris
3342 if test "$SOLARIS_SUNPRO_CC"; then
3343 VISIBILITY_FLAGS='-xldscope=hidden'
3344 fi # Sun Studio on Solaris
3346 AC_SUBST(WRAP_SYSTEM_INCLUDES)
3347 AC_SUBST(VISIBILITY_FLAGS)
3349 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
3350 dnl ========================================================
3351 if test "$GNU_CC"; then
3352 CFLAGS_save="${CFLAGS}"
3353 CFLAGS="${CFLAGS} -Werror"
3354 AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
3355 ac_cv_force_align_arg_pointer,
3356 [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
3358 ac_cv_force_align_arg_pointer="yes",
3359 ac_cv_force_align_arg_pointer="no")])
3360 CFLAGS="${CFLAGS_save}"
3361 if test "$ac_cv_force_align_arg_pointer" = "yes"; then
3362 HAVE_GCC_ALIGN_ARG_POINTER=1
3364 HAVE_GCC_ALIGN_ARG_POINTER=
3367 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
3369 dnl Checks for header files.
3370 dnl ========================================================
3372 case "$target_os" in
3374 # for stuff like -lXshm
3375 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3378 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
3379 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
3380 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
3381 AC_CHECK_HEADERS(malloc.h)
3382 AC_CHECK_HEADERS(X11/XKBlib.h)
3383 AC_CHECK_HEADERS(io.h)
3385 dnl These are all the places some variant of statfs can be hiding.
3386 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3389 AC_CHECK_HEADERS(sys/quota.h)
3391 dnl Try for MMX support
3392 dnl NB - later gcc versions require -mmmx for this header to be successfully
3393 dnl included (or another option which implies it, such as -march=pentium-mmx)
3394 AC_CHECK_HEADERS(mmintrin.h)
3396 dnl Check whether the compiler supports the new-style C++ standard
3397 dnl library headers (i.e. <new>) or needs the old "new.h"
3400 AC_CHECK_HEADER(new, [NEW_H=new])
3401 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3404 AC_ARG_ENABLE(dtrace,
3405 [ --enable-dtrace build with dtrace support if available (default=no)],
3406 [enable_dtrace="yes"],)
3407 if test "x$enable_dtrace" = "xyes"; then
3408 AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3409 if test -n "$HAVE_DTRACE"; then
3410 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3412 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3415 AC_SUBST(HAVE_DTRACE)
3421 AC_CHECK_HEADERS(sys/cdefs.h)
3425 dnl Checks for libraries.
3426 dnl ========================================================
3431 AC_CHECK_LIB(c_r, gethostbyname_r)
3435 dnl We don't want to link with libdl even if it's present on OS X, since
3436 dnl it's not used and not part of the default installation.
3437 dnl The same goes for BeOS. OS/2 has dlfcn in libc.
3438 dnl We don't want to link against libm or libpthread on Darwin since
3439 dnl they both are just symlinks to libSystem and explicitly linking
3440 dnl against libSystem causes issues when debugging (see bug 299601).
3449 AC_CHECK_LIB(m, atan)
3450 AC_CHECK_LIB(dl, dlopen,
3451 AC_CHECK_HEADER(dlfcn.h,
3453 AC_DEFINE(HAVE_LIBDL)))
3457 _SAVE_CFLAGS="$CFLAGS"
3458 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3459 AC_CHECK_FUNCS(dladdr)
3460 CFLAGS="$_SAVE_CFLAGS"
3462 if test ! "$GNU_CXX"; then
3466 AC_CHECK_LIB(C_r, demangle)
3469 AC_CHECK_LIB(C, demangle)
3474 dnl OS/2 has socket in libc.
3479 AC_CHECK_LIB(socket, socket)
3482 dnl ========================================================
3483 dnl Check whether we can compile code for Core Text
3484 dnl (available on Mac OS X 10.5 or later)
3485 dnl ========================================================
3488 AC_MSG_CHECKING([for Core Text])
3489 AC_TRY_COMPILE([#include <ApplicationServices/ApplicationServices.h>],
3490 [CTLineRef lineRef;],
3491 ac_cv_have_core_text="yes",
3492 ac_cv_have_core_text="no")
3493 AC_MSG_RESULT([$ac_cv_have_core_text])
3495 if test "$ac_cv_have_core_text" = "no"; then
3496 AC_MSG_ERROR([Core Text is required (available on Mac OS X 10.5 or later).])
3502 XLIBS="$X_EXTRA_LIBS"
3504 dnl ========================================================
3505 dnl Checks for X libraries.
3506 dnl Ordering is important.
3507 dnl Xt is dependent upon SM as of X11R6
3508 dnl ========================================================
3509 if test "$no_x" = "yes"; then
3512 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3513 XLIBS="-lX11 $XLIBS"
3514 _SAVE_LDFLAGS="$LDFLAGS"
3515 LDFLAGS="$XLDFLAGS $LDFLAGS"
3516 AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3517 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3518 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3519 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3521 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3522 unset ac_cv_lib_Xt_XtFree
3523 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3524 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
3525 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3526 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3529 # AIX needs the motif library linked before libXt to prevent
3530 # crashes in plugins linked against Motif - Bug #98892
3531 case "${target_os}" in
3533 XT_LIBS="-lXm $XT_LIBS"
3537 dnl ========================================================
3538 dnl = Check for XShm
3539 dnl ========================================================
3540 AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3542 AC_CHECK_HEADER(X11/extensions/XShm.h)
3543 if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3544 test -n "$_HAVE_XSHM_XEXT"; then
3545 AC_DEFINE(HAVE_XSHM)
3548 dnl ========================================================
3550 dnl ========================================================
3551 AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3553 AC_CHECK_HEADER(X11/extensions/XIElib.h)
3555 if test "$MOZ_XIE_LIBS"; then
3556 dnl ====================================================
3557 dnl = If XIE is present and is desired, turn it on
3558 dnl ====================================================
3568 LDFLAGS="$_SAVE_LDFLAGS"
3570 dnl ========================================================
3571 dnl = Check for freetype2 and its functionality
3572 dnl ========================================================
3573 AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3575 if test "$_HAVE_FREETYPE2"; then
3577 _SAVE_CFLAGS="$CFLAGS"
3578 LIBS="$LIBS $FT2_LIBS"
3579 CFLAGS="$CFLAGS $FT2_CFLAGS"
3581 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3582 ac_cv_member_FT_Bitmap_Size_y_ppem,
3583 [AC_TRY_COMPILE([#include <ft2build.h>
3584 #include FT_FREETYPE_H],
3586 if (sizeof s.y_ppem) return 0;
3588 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3589 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3590 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3591 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3593 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3595 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3596 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3597 [FT_Bitmap_Size structure includes y_ppem field])
3599 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3602 CFLAGS="$_SAVE_CFLAGS"
3613 AC_MSG_CHECKING(for ARM SIMD support in compiler)
3615 [asm("uqadd8 r1, r1, r2");],
3616 result="yes", result="no")
3617 AC_MSG_RESULT("$result")
3618 if test "$result" = "yes"; then
3619 AC_DEFINE(HAVE_ARM_SIMD)
3622 AC_SUBST(HAVE_ARM_SIMD)
3624 AC_MSG_CHECKING(for ARM NEON support in compiler)
3625 _SAVE_CFLAGS="$CFLAGS"
3626 if test "$GNU_CC"; then
3627 # gcc needs -mfpu=neon to recognize NEON instructions
3628 CFLAGS="$CFLAGS -mfpu=neon -mfloat-abi=softfp"
3631 [asm("vadd.i8 d0, d0, d0");],
3632 result="yes", result="no")
3633 AC_MSG_RESULT("$result")
3634 if test "$result" = "yes"; then
3635 AC_DEFINE(HAVE_ARM_NEON)
3638 CFLAGS="$_SAVE_CFLAGS"
3639 AC_SUBST(HAVE_ARM_NEON)
3641 dnl ========================================================
3642 dnl = pthread support
3643 dnl = Start by checking whether the system support pthreads
3644 dnl ========================================================
3645 case "$target_os" in
3650 MOZ_CHECK_PTHREADS(pthreads,
3651 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3652 MOZ_CHECK_PTHREADS(pthread,
3653 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3654 MOZ_CHECK_PTHREADS(c_r,
3655 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3656 MOZ_CHECK_PTHREADS(c,
3665 dnl ========================================================
3666 dnl Check the command line for --with-pthreads
3667 dnl ========================================================
3668 MOZ_ARG_WITH_BOOL(pthreads,
3669 [ --with-pthreads Force use of system pthread library with NSPR ],
3670 [ if test "$USE_PTHREADS"x = x; then
3671 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3677 dnl ========================================================
3678 dnl Do the platform specific pthread hackery
3679 dnl ========================================================
3680 if test "$USE_PTHREADS"x != x
3683 dnl See if -pthread is supported.
3686 ac_cv_have_dash_pthread=no
3687 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3688 echo 'int main() { return 0; }' | cat > conftest.c
3689 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3690 if test $? -eq 0; then
3691 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3692 ac_cv_have_dash_pthread=yes
3693 case "$target_os" in
3695 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3698 CFLAGS="$CFLAGS -pthread"
3699 CXXFLAGS="$CXXFLAGS -pthread"
3705 AC_MSG_RESULT($ac_cv_have_dash_pthread)
3708 dnl See if -pthreads is supported.
3710 ac_cv_have_dash_pthreads=no
3711 if test "$ac_cv_have_dash_pthread" = "no"; then
3712 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3713 echo 'int main() { return 0; }' | cat > conftest.c
3714 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3715 if test $? -eq 0; then
3716 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" && test -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3717 ac_cv_have_dash_pthreads=yes
3718 CFLAGS="$CFLAGS -pthreads"
3719 CXXFLAGS="$CXXFLAGS -pthreads"
3723 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3728 AC_DEFINE(_REENTRANT)
3729 AC_DEFINE(_THREAD_SAFE)
3730 dnl -pthread links in -lc_r, so don't specify it explicitly.
3731 if test "$ac_cv_have_dash_pthread" = "yes"; then
3732 _PTHREAD_LDFLAGS="-pthread"
3734 _PTHREAD_LDFLAGS="-lc_r"
3738 *-*-openbsd*|*-*-bsdi*)
3739 AC_DEFINE(_REENTRANT)
3740 AC_DEFINE(_THREAD_SAFE)
3741 dnl -pthread links in -lc_r, so don't specify it explicitly.
3742 if test "$ac_cv_have_dash_pthread" = "yes"; then
3743 _PTHREAD_LDFLAGS="-pthread"
3747 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3748 AC_DEFINE(_REENTRANT)
3752 AC_DEFINE(_REENTRANT)
3756 AC_DEFINE(_REENTRANT)
3760 AC_DEFINE(_REENTRANT)
3764 AC_DEFINE(_REENTRANT)
3768 AC_DEFINE(_REENTRANT)
3769 if test "$SOLARIS_SUNPRO_CC"; then
3770 CFLAGS="$CFLAGS -mt"
3771 CXXFLAGS="$CXXFLAGS -mt"
3775 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3778 dnl ========================================================
3779 dnl See if mmap sees writes
3780 dnl For cross compiling, just define it as no, which is a safe default
3781 dnl ========================================================
3782 AC_MSG_CHECKING(whether mmap() sees write()s)
3788 #include <sys/mman.h>
3789 #include <sys/types.h>
3790 #include <sys/stat.h>
3793 char fname[] = "conftest.file";
3794 char zbuff[1024]; /* Fractional page is probably worst case */
3801 fd = open(fname, O_RDWR | O_CREAT, 0660);
3804 write(fd, zbuff, sizeof(zbuff));
3805 lseek(fd, 0, SEEK_SET);
3806 map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3807 if(map==(char*)-1) return 2;
3808 for(i=0; fname[i]; i++) {
3809 int rc = write(fd, &fname[i], 1);
3810 if(map[i]!=fname[i]) return 4;
3817 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3819 AC_MSG_RESULT("$result")
3821 if test "$result" = "no"; then
3822 AC_DEFINE(MMAP_MISSES_WRITES)
3826 dnl Checks for library functions.
3827 dnl ========================================================
3828 AC_PROG_GCC_TRADITIONAL
3830 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3831 AC_CHECK_FUNCS(flockfile getpagesize)
3832 AC_CHECK_FUNCS(localtime_r strtok_r)
3834 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock, and -lrt
3835 _SAVE_LDFLAGS=$LDFLAGS
3836 LDFLAGS="$LDFLAGS -lrt"
3837 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC) and -lrt,
3838 ac_cv_have_clock_monotonic,
3839 [AC_TRY_LINK([#include <time.h>],
3840 [ struct timespec ts;
3841 clock_gettime(CLOCK_MONOTONIC, &ts); ],
3842 ac_cv_have_clock_monotonic=yes,
3843 ac_cv_have_clock_monotonic=no)])
3844 LDFLAGS=$_SAVE_LDFLAGS
3845 if test "$ac_cv_have_clock_monotonic" = "yes"; then
3846 HAVE_CLOCK_MONOTONIC=1
3848 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3849 AC_SUBST(HAVE_CLOCK_MONOTONIC)
3850 AC_SUBST(REALTIME_LIBS)
3853 dnl check for wcrtomb/mbrtowc
3854 dnl =======================================================================
3855 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3858 AC_CACHE_CHECK(for wcrtomb,
3860 [AC_TRY_LINK([#include <wchar.h>],
3861 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3862 ac_cv_have_wcrtomb="yes",
3863 ac_cv_have_wcrtomb="no")])
3864 if test "$ac_cv_have_wcrtomb" = "yes"; then
3865 AC_DEFINE(HAVE_WCRTOMB)
3867 AC_CACHE_CHECK(for mbrtowc,
3869 [AC_TRY_LINK([#include <wchar.h>],
3870 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3871 ac_cv_have_mbrtowc="yes",
3872 ac_cv_have_mbrtowc="no")])
3873 if test "$ac_cv_have_mbrtowc" = "yes"; then
3874 AC_DEFINE(HAVE_MBRTOWC)
3881 ac_cv_func_res_ninit,
3884 #define _BSD_SOURCE 1
3888 [int foo = res_ninit(&_res);],
3889 [ac_cv_func_res_ninit=yes],
3890 [ac_cv_func_res_ninit=no])
3893 if test "$ac_cv_func_res_ninit" = "yes"; then
3894 AC_DEFINE(HAVE_RES_NINIT)
3895 dnl must add the link line we do something as foolish as this... dougt
3897 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3898 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3903 [for gnu_get_libc_version()],
3904 ac_cv_func_gnu_get_libc_version,
3906 #ifdef HAVE_GNU_LIBC_VERSION_H
3907 #include <gnu/libc-version.h>
3910 [const char *glibc_version = gnu_get_libc_version();],
3911 [ac_cv_func_gnu_get_libc_version=yes],
3912 [ac_cv_func_gnu_get_libc_version=no]
3916 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3917 AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3921 os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|winmo*|beos*)
3925 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3926 AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3927 AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3929 LIBS="$LIBS $_ICONV_LIBS"
3938 iconv_t h = iconv_open("", "");
3939 iconv(h, NULL, NULL, NULL, NULL);
3942 [ac_cv_func_iconv=yes],
3943 [ac_cv_func_iconv=no]
3946 if test "$ac_cv_func_iconv" = "yes"; then
3947 AC_DEFINE(HAVE_ICONV)
3948 DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3949 LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3950 LIBICONV="$_ICONV_LIBS"
3952 [for iconv() with const input],
3953 ac_cv_func_const_iconv,
3959 const char *input = "testing";
3960 iconv_t h = iconv_open("", "");
3961 iconv(h, &input, NULL, NULL, NULL);
3964 [ac_cv_func_const_iconv=yes],
3965 [ac_cv_func_const_iconv=no]
3968 if test "$ac_cv_func_const_iconv" = "yes"; then
3969 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3981 dnl **********************
3982 dnl *** va_copy checks ***
3983 dnl **********************
3984 dnl we currently check for all three va_copy possibilities, so we get
3985 dnl all results in config.log for bug reports.
3986 AC_MSG_CHECKING(for an implementation of va_copy())
3987 AC_CACHE_VAL(ac_cv_va_copy,[
3990 void f (int i, ...) {
3991 va_list args1, args2;
3992 va_start (args1, i);
3993 va_copy (args2, args1);
3994 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3996 va_end (args1); va_end (args2);
3998 int main() { f (0, 42); return 0; }],
4004 AC_MSG_RESULT($ac_cv_va_copy)
4005 AC_MSG_CHECKING(for an implementation of __va_copy())
4006 AC_CACHE_VAL(ac_cv___va_copy,[
4009 void f (int i, ...) {
4010 va_list args1, args2;
4011 va_start (args1, i);
4012 __va_copy (args2, args1);
4013 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
4015 va_end (args1); va_end (args2);
4017 int main() { f (0, 42); return 0; }],
4018 ac_cv___va_copy=yes,
4023 AC_MSG_RESULT($ac_cv___va_copy)
4024 AC_MSG_CHECKING(whether va_lists can be copied by value)
4025 AC_CACHE_VAL(ac_cv_va_val_copy,[
4028 void f (int i, ...) {
4029 va_list args1, args2;
4030 va_start (args1, i);
4032 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
4034 va_end (args1); va_end (args2);
4036 int main() { f (0, 42); return 0; }],
4037 ac_cv_va_val_copy=yes,
4038 ac_cv_va_val_copy=no,
4039 ac_cv_va_val_copy=yes
4042 if test "x$ac_cv_va_copy" = "xyes"; then
4043 AC_DEFINE(VA_COPY, va_copy)
4044 AC_DEFINE(HAVE_VA_COPY)
4045 elif test "x$ac_cv___va_copy" = "xyes"; then
4046 AC_DEFINE(VA_COPY, __va_copy)
4047 AC_DEFINE(HAVE_VA_COPY)
4050 if test "x$ac_cv_va_val_copy" = "xno"; then
4051 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
4053 AC_MSG_RESULT($ac_cv_va_val_copy)
4055 dnl Check for dll-challenged libc's.
4056 dnl This check is apparently only needed for Linux.
4059 dnl ===================================================================
4062 rm -rf conftest* _conftest
4064 cat >> conftest.C <<\EOF
4069 void __dump_link_map(void) {
4070 struct link_map *map = _dl_loaded;
4071 while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
4074 dlopen("./conftest1.so",RTLD_LAZY);
4075 dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
4076 dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
4077 dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
4081 /* _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).*/
4082 int main() { printf("./conftest1.so\n"); }
4086 $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
4088 cat >> conftest1.C <<\EOF
4090 void foo(void) {printf("foo in dll called\n");}
4092 ${CXX-g++} -fPIC -c -g conftest1.C
4093 ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
4094 ${CXX-g++} -g conftest.C -o conftest -ldl
4095 cp -f conftest1.so conftest _conftest
4097 if test `./conftest | grep conftest1.so | wc -l` -gt 1
4100 echo "*** Your libc has a bug that can result in loading the same dynamic"
4101 echo "*** library multiple times. This bug is known to be fixed in glibc-2.0.7-32"
4102 echo "*** or later. However, if you choose not to upgrade, the only effect"
4103 echo "*** will be excessive memory usage at runtime."
4107 rm -rf conftest* _conftest
4108 dnl ===================================================================
4112 dnl ===================================================================
4113 dnl ========================================================
4114 dnl By default, turn rtti and exceptions off on g++/egcs
4115 dnl ========================================================
4116 if test "$GNU_CXX"; then
4118 AC_MSG_CHECKING(for C++ exceptions flag)
4120 dnl They changed -f[no-]handle-exceptions to -f[no-]exceptions in g++ 2.8
4121 AC_CACHE_VAL(ac_cv_cxx_exceptions_flags,
4122 [echo "int main() { return 0; }" | cat > conftest.C
4124 ${CXX-g++} ${CXXFLAGS} -c -fno-handle-exceptions conftest.C > conftest.out 2>&1
4126 if egrep "warning.*renamed" conftest.out >/dev/null; then
4127 ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-exceptions
4129 ac_cv_cxx_exceptions_flags=${_COMPILER_PREFIX}-fno-handle-exceptions
4134 AC_MSG_RESULT($ac_cv_cxx_exceptions_flags)
4135 _MOZ_EXCEPTIONS_FLAGS_OFF=$ac_cv_cxx_exceptions_flags
4136 _MOZ_EXCEPTIONS_FLAGS_ON=`echo $ac_cv_cxx_exceptions_flags | sed 's|no-||'`
4139 dnl ========================================================
4140 dnl Put your C++ language/feature checks below
4141 dnl ========================================================
4146 if test "$GNU_CC"; then
4147 if test "$CPU_ARCH" = "arm" ; then
4148 AC_CACHE_CHECK(for ARM EABI,
4152 #if defined(__ARM_EABI__)
4155 #error Not ARM EABI.
4158 ac_cv_gcc_arm_eabi="yes",
4159 ac_cv_gcc_arm_eabi="no")])
4160 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
4162 ARM_ABI_PREFIX=eabi-
4164 ARM_ABI_PREFIX=oabi-
4168 AC_CACHE_CHECK(for gcc 3.0 ABI,
4169 ac_cv_gcc_three_abi,
4172 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
4178 ac_cv_gcc_three_abi="yes",
4179 ac_cv_gcc_three_abi="no")])
4180 if test "$ac_cv_gcc_three_abi" = "yes"; then
4181 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
4184 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc2}"
4187 AC_SUBST(HAVE_GCC3_ABI)
4190 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
4192 [AC_TRY_COMPILE(class X {
4193 public: explicit X(int i) : i_(i) {}
4197 ac_cv_cpp_explicit=yes,
4198 ac_cv_cpp_explicit=no)])
4199 if test "$ac_cv_cpp_explicit" = yes ; then
4200 AC_DEFINE(HAVE_CPP_EXPLICIT)
4203 AC_CACHE_CHECK(for C++ \"typename\" keyword,
4205 [AC_TRY_COMPILE(class param {
4207 typedef unsigned long num_type;
4210 template <class T> class tplt {
4212 typedef typename T::num_type t_num_type;
4213 t_num_type foo(typename T::num_type num) {
4219 ac_cv_cpp_typename=yes,
4220 ac_cv_cpp_typename=no)])
4221 if test "$ac_cv_cpp_typename" = yes ; then
4222 AC_DEFINE(HAVE_CPP_TYPENAME)
4225 dnl Check for support of modern template specialization syntax
4226 dnl Test code and requirement from scc@netscape.com.
4227 dnl Autoconf cut-and-paste job by waterson@netscape.com
4228 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
4229 ac_cv_cpp_modern_specialize_template_syntax,
4230 [AC_TRY_COMPILE(template <class T> struct X { int a; };
4232 template <> struct X<Y> { double a; };,
4235 ac_cv_cpp_modern_specialize_template_syntax=yes,
4236 ac_cv_cpp_modern_specialize_template_syntax=no)])
4237 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
4238 AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
4242 dnl Some compilers support only full specialization, and some don't.
4243 AC_CACHE_CHECK(whether partial template specialization works,
4244 ac_cv_cpp_partial_specialization,
4245 [AC_TRY_COMPILE(template <class T> class Foo {};
4246 template <class T> class Foo<T*> {};,
4248 ac_cv_cpp_partial_specialization=yes,
4249 ac_cv_cpp_partial_specialization=no)])
4250 if test "$ac_cv_cpp_partial_specialization" = yes ; then
4251 AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
4254 dnl Some compilers have limited support for operators with templates;
4255 dnl specifically, it is necessary to define derived operators when a base
4256 dnl class's operator declaration should suffice.
4257 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
4258 ac_cv_need_derived_template_operators,
4259 [AC_TRY_COMPILE([template <class T> class Base { };
4261 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
4262 template <class T> class Derived : public Base<T> { };],
4263 [Derived<char> a, b;
4264 Base<char> c = a + b;
4266 ac_cv_need_derived_template_operators=no,
4267 ac_cv_need_derived_template_operators=yes)])
4268 if test "$ac_cv_need_derived_template_operators" = yes ; then
4269 AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
4273 dnl Some compilers have trouble detecting that a template class
4274 dnl that derives from another template is actually an instance
4275 dnl of the base class. This test checks for that.
4276 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
4277 ac_cv_need_cpp_template_cast_to_base,
4278 [AC_TRY_COMPILE([template <class T> class Base { };
4279 template <class T> class Derived : public Base<T> { };
4280 template <class T> int foo(const Base<T>&) { return 0; }],
4281 [Derived<char> bar; return foo(bar);],
4282 ac_cv_need_cpp_template_cast_to_base=no,
4283 ac_cv_need_cpp_template_cast_to_base=yes)])
4284 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
4285 AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
4288 dnl Some compilers have trouble resolving the ambiguity between two
4289 dnl functions whose arguments differ only by cv-qualifications.
4290 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
4291 ac_cv_can_resolve_const_ambiguity,
4293 template <class T> class ptrClass {
4297 template <class T> T* a(ptrClass<T> *arg) {
4302 const T* a(const ptrClass<T> *arg) {
4308 ac_cv_can_resolve_const_ambiguity=yes,
4309 ac_cv_can_resolve_const_ambiguity=no)])
4310 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
4311 AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
4315 dnl We don't do exceptions on unix. The only reason this used to be here
4316 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses
4317 dnl exceptions. But, we turn exceptions off by default and this test breaks.
4318 dnl So im commenting this out until someone writes some artificial
4319 dnl intelligence to detect not only if the compiler has exceptions, but if
4320 dnl they are enabled as well.
4322 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
4323 dnl ac_cv_cpp_exceptions,
4324 dnl [AC_TRY_COMPILE(class X { public: X() {} };
4325 dnl static void F() { throw X(); },
4326 dnl try { F(); } catch(X & e) { },
4327 dnl ac_cv_cpp_exceptions=yes,
4328 dnl ac_cv_cpp_exceptions=no)])
4329 dnl if test $ac_cv_cpp_exceptions = yes ; then
4330 dnl AC_DEFINE(HAVE_CPP_EXCEPTIONS)
4333 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
4334 dnl supports it well enough to allow us to use it to change access, but not
4335 dnl to resolve ambiguity. The next two tests determine how well the |using|
4336 dnl keyword is supported.
4338 dnl Check to see if we can change access with |using|. Test both a
4339 dnl legal and an illegal example.
4340 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
4341 ac_cv_cpp_access_changing_using2,
4343 class A { protected: int foo() { return 0; } };
4344 class B : public A { public: using A::foo; };,
4345 B b; return b.foo();,
4347 class A { public: int foo() { return 1; } };
4348 class B : public A { private: using A::foo; };,
4349 B b; return b.foo();,
4350 ac_cv_cpp_access_changing_using2=no,
4351 ac_cv_cpp_access_changing_using2=yes)],
4352 ac_cv_cpp_access_changing_using2=no)])
4353 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
4354 AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
4357 dnl Check to see if we can resolve ambiguity with |using|.
4358 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
4359 ac_cv_cpp_ambiguity_resolving_using,
4360 [AC_TRY_COMPILE(class X {
4361 public: int go(const X&) {return 3;}
4362 int jo(const X&) {return 3;}
4364 class Y : public X {
4365 public: int go(int) {return 2;}
4366 int jo(int) {return 2;}
4368 private: using X::go;
4371 ac_cv_cpp_ambiguity_resolving_using=yes,
4372 ac_cv_cpp_ambiguity_resolving_using=no)])
4373 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
4374 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
4377 dnl Check to see if the |std| namespace is supported. If so, we'll want
4378 dnl to qualify any standard library calls with "std::" to ensure that
4379 dnl those functions can be resolved.
4380 AC_CACHE_CHECK(for \"std::\" namespace,
4381 ac_cv_cpp_namespace_std,
4382 [AC_TRY_COMPILE([#include <algorithm>],
4383 [return std::min(0, 1);],
4384 ac_cv_cpp_namespace_std=yes,
4385 ac_cv_cpp_namespace_std=no)])
4386 if test "$ac_cv_cpp_namespace_std" = yes ; then
4387 AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
4390 dnl Older compilers are overly ambitious with respect to using the standard
4391 dnl template library's |operator!=()| when |operator==()| is defined. In
4392 dnl which case, defining |operator!=()| in addition to |operator==()| causes
4393 dnl ambiguity at compile-time. This test checks for that case.
4394 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
4395 ac_cv_cpp_unambiguous_std_notequal,
4396 [AC_TRY_COMPILE([#include <algorithm>
4398 int operator==(const T1&, const T1&) { return 0; }
4399 int operator!=(const T1&, const T1&) { return 0; }],
4400 [T1 a,b; return a != b;],
4401 ac_cv_cpp_unambiguous_std_notequal=unambiguous,
4402 ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
4403 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
4404 AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
4408 AC_CACHE_CHECK(for C++ reinterpret_cast,
4409 ac_cv_cpp_reinterpret_cast,
4410 [AC_TRY_COMPILE(struct X { int i; };
4411 struct Y { int i; };,
4412 X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
4413 ac_cv_cpp_reinterpret_cast=yes,
4414 ac_cv_cpp_reinterpret_cast=no)])
4415 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
4416 AC_DEFINE(HAVE_CPP_NEW_CASTS)
4419 dnl See if a dynamic_cast to void* gives the most derived object.
4420 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
4421 ac_cv_cpp_dynamic_cast_void_ptr,
4422 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
4423 class Y { int j; public: virtual ~Y() { } };
4424 class Z : public X, public Y { int k; };
4430 return !((((void*)&mdo != (void*)subx) &&
4431 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
4432 (((void*)&mdo != (void*)suby) &&
4433 ((void*)&mdo == dynamic_cast<void*>(suby))));
4435 ac_cv_cpp_dynamic_cast_void_ptr=yes,
4436 ac_cv_cpp_dynamic_cast_void_ptr=no,
4437 ac_cv_cpp_dynamic_cast_void_ptr=no)])
4438 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
4439 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
4443 dnl note that this one is reversed - if the test fails, then
4444 dnl we require implementations of unused virtual methods. Which
4445 dnl really blows because it means we'll have useless vtable
4447 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
4448 ac_cv_cpp_unused_required,
4449 [AC_TRY_LINK(class X {private: virtual void never_called();};,
4451 ac_cv_cpp_unused_required=no,
4452 ac_cv_cpp_unused_required=yes)])
4453 if test "$ac_cv_cpp_unused_required" = yes ; then
4454 AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
4458 dnl Some compilers have trouble comparing a constant reference to a templatized
4459 dnl class to zero, and require an explicit operator==() to be defined that takes
4460 dnl an int. This test separates the strong from the weak.
4462 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
4463 ac_cv_trouble_comparing_to_zero,
4464 [AC_TRY_COMPILE([#include <algorithm>
4465 template <class T> class Foo {};
4467 template <class T> int operator==(const T2*, const T&) { return 0; }
4468 template <class T> int operator!=(const T2*, const T&) { return 0; }],
4469 [Foo<int> f; return (0 != f);],
4470 ac_cv_trouble_comparing_to_zero=no,
4471 ac_cv_trouble_comparing_to_zero=yes)])
4472 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
4473 AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
4476 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
4477 _SAVE_LDFLAGS=$LDFLAGS
4478 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS"
4479 AC_CACHE_CHECK(for __thread keyword for TLS variables,
4480 ac_cv_thread_keyword,
4481 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
4482 [return tlsIsMainThread;],
4483 ac_cv_thread_keyword=yes,
4484 ac_cv_thread_keyword=no)])
4485 LDFLAGS=$_SAVE_LDFLAGS
4486 if test "$ac_cv_thread_keyword" = yes; then
4487 # mips builds fail with TLS variables because of a binutils bug.
4497 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
4502 dnl Check for the existence of various allocation headers/functions
4505 AC_CHECK_HEADER(malloc.h, [MALLOC_H=malloc.h])
4506 if test "$MALLOC_H" = ""; then
4507 AC_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
4508 if test "$MALLOC_H" = ""; then
4509 AC_CHECK_HEADER(sys/malloc.h, [MALLOC_H=sys/malloc.h])
4512 if test "$MALLOC_H" != ""; then
4513 AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
4516 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
4517 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
4519 dnl See if compiler supports some gcc-style attributes
4521 AC_CACHE_CHECK(for __attribute__((always_inline)),
4522 ac_cv_attribute_always_inline,
4524 [inline void f(void) __attribute__((always_inline));],
4525 ac_cv_attribute_always_inline=yes,
4526 ac_cv_attribute_always_inline=no)])
4528 AC_CACHE_CHECK(for __attribute__((malloc)),
4529 ac_cv_attribute_malloc,
4531 [void* f(int) __attribute__((malloc));],
4532 ac_cv_attribute_malloc=yes,
4533 ac_cv_attribute_malloc=no)])
4535 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
4536 ac_cv_attribute_warn_unused,
4538 [int f(void) __attribute__((warn_unused_result));],
4539 ac_cv_attribute_warn_unused=yes,
4540 ac_cv_attribute_warn_unused=no)])
4542 AC_CACHE_CHECK(for __attribute__((noreturn)),
4543 ac_cv_attribute_noreturn,
4545 [void f(void) __attribute__((noreturn));],
4546 ac_cv_attribute_noreturn=yes,
4547 ac_cv_attribute_noreturn=no)])
4549 dnl End of C++ language/feature checks
4552 dnl ========================================================
4553 dnl = Internationalization checks
4554 dnl ========================================================
4556 dnl Internationalization and Locale support is different
4557 dnl on various UNIX platforms. Checks for specific i18n
4558 dnl features go here.
4560 dnl check for LC_MESSAGES
4561 AC_CACHE_CHECK(for LC_MESSAGES,
4562 ac_cv_i18n_lc_messages,
4563 [AC_TRY_COMPILE([#include <locale.h>],
4564 [int category = LC_MESSAGES;],
4565 ac_cv_i18n_lc_messages=yes,
4566 ac_cv_i18n_lc_messages=no)])
4567 if test "$ac_cv_i18n_lc_messages" = yes; then
4568 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4571 fi # SKIP_COMPILER_CHECKS
4574 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4575 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4578 dnl Mozilla specific options
4579 dnl ========================================================
4580 dnl The macros used for command line options
4581 dnl are defined in build/autoconf/altoptions.m4.
4583 dnl If the compiler supports these attributes, define them as
4584 dnl convenience macros.
4585 if test "$ac_cv_attribute_always_inline" = yes ; then
4586 AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
4588 AC_DEFINE(NS_ALWAYS_INLINE,)
4591 if test "$ac_cv_attribute_malloc" = yes ; then
4592 AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
4594 AC_DEFINE(NS_ATTR_MALLOC,)
4597 if test "$ac_cv_attribute_warn_unused" = yes ; then
4598 AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
4600 AC_DEFINE(NS_WARN_UNUSED_RESULT,)
4603 if test "$ac_cv_attribute_noreturn" = yes ; then
4604 AC_DEFINE(NS_NORETURN, [__attribute__((noreturn))])
4606 AC_DEFINE(NS_NORETURN,)
4609 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
4610 dnl features that Windows actually does support.
4612 if test -n "$SKIP_COMPILER_CHECKS"; then
4613 dnl Windows has malloc.h
4614 AC_DEFINE(MALLOC_H, [<malloc.h>])
4615 AC_DEFINE(HAVE_FORCEINLINE)
4616 fi # SKIP_COMPILER_CHECKS
4618 dnl ========================================================
4620 dnl = Check for external package dependencies
4622 dnl ========================================================
4623 MOZ_ARG_HEADER(External Packages)
4627 MOZ_ARG_WITH_STRING(libxul-sdk,
4628 [ --with-libxul-sdk=PFX Use the libXUL SDK at <PFX>],
4629 LIBXUL_SDK_DIR=$withval)
4631 if test "$LIBXUL_SDK_DIR" = "yes"; then
4632 AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4633 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4634 LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4636 if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
4637 AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
4642 AC_SUBST(LIBXUL_SDK)
4644 if test -n "$LIBXUL_SDK"; then
4645 LIBXUL_DIST="$LIBXUL_SDK"
4647 LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4649 AC_SUBST(LIBXUL_DIST)
4653 MOZ_ARG_WITH_BOOL(system-libxul,
4654 [ --with-system-libxul Use system installed libxul SDK],
4657 if test -n "$SYSTEM_LIBXUL" && test -z "$MOZ_ENABLE_LIBXUL"; then
4658 AC_MSG_ERROR([--with-system-libxul needs --with-libxul-sdk])
4661 dnl ========================================================
4662 dnl = If NSPR was not detected in the system,
4663 dnl = use the one in the source tree (mozilla/nsprpub)
4664 dnl ========================================================
4665 MOZ_ARG_WITH_BOOL(system-nspr,
4666 [ --with-system-nspr Use system installed NSPR],
4667 _USE_SYSTEM_NSPR=1 )
4669 if test -n "$_USE_SYSTEM_NSPR"; then
4670 AM_PATH_NSPR(4.8.0, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
4673 if test -n "$MOZ_NATIVE_NSPR"; then
4674 _SAVE_CFLAGS=$CFLAGS
4675 CFLAGS="$CFLAGS $NSPR_CFLAGS"
4676 AC_TRY_COMPILE([#include "prtypes.h"],
4677 [#ifndef PR_STATIC_ASSERT
4678 #error PR_STATIC_ASSERT not defined or requires including prlog.h
4680 [MOZ_NATIVE_NSPR=1],
4681 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
4682 CFLAGS=$_SAVE_CFLAGS
4684 if test "$OS_ARCH" = "WINCE"; then
4685 NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4686 NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4687 elif test "$OS_ARCH" = "WINNT"; then
4688 NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4689 if test -n "$GNU_CC"; then
4690 NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4692 NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4695 NSPR_CFLAGS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4696 NSPR_LIBS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4700 dnl system libevent Support
4701 dnl ========================================================
4702 MOZ_ARG_WITH_STRING(system-libevent,
4703 [ --with-system-libevent=[PFX]
4704 Use system libevent [installed at prefix PFX]],
4705 LIBEVENT_DIR=$withval)
4707 _SAVE_CFLAGS=$CFLAGS
4708 _SAVE_LDFLAGS=$LDFLAGS
4710 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
4711 MOZ_NATIVE_LIBEVENT=
4713 if test "${LIBEVENT_DIR}" = "yes"; then
4716 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
4717 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
4718 AC_CHECK_HEADER(event.h,
4719 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
4720 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
4722 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
4723 AC_CHECK_LIB(event, event_init,
4724 [MOZ_NATIVE_LIBEVENT=1
4725 MOZ_LIBEVENT_INCLUDES="${LIBEVENT_DIR}/include"
4726 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
4727 [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_INCLUDES= MOZ_LIBEVENT_LIBS=])
4729 CFLAGS=$_SAVE_CFLAGS
4730 LDFLAGS=$_SAVE_LDFLAGS
4733 AC_SUBST(MOZ_NATIVE_LIBEVENT)
4734 AC_SUBST(MOZ_LIBEVENT_INCLUDES)
4735 AC_SUBST(MOZ_LIBEVENT_LIBS)
4737 dnl ========================================================
4738 dnl = If NSS was not detected in the system,
4739 dnl = use the one in the source tree (mozilla/security/nss)
4740 dnl ========================================================
4742 MOZ_ARG_WITH_BOOL(system-nss,
4743 [ --with-system-nss Use system installed NSS],
4746 if test -n "$_USE_SYSTEM_NSS"; then
4747 AM_PATH_NSS(3.12.6, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4750 if test -n "$MOZ_NATIVE_NSS"; then
4751 NSS_LIBS="$NSS_LIBS -lcrmf"
4753 NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4755 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4756 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4757 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4758 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4759 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
4761 if test -z "$GNU_CC" && test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4763 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4764 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
4765 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
4766 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
4767 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
4769 NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4773 if test -z "$SKIP_LIBRARY_CHECKS"; then
4774 dnl system JPEG support
4775 dnl ========================================================
4776 MOZ_ARG_WITH_STRING(system-jpeg,
4777 [ --with-system-jpeg[=PFX]
4778 Use system libjpeg [installed at prefix PFX]],
4781 _SAVE_CFLAGS=$CFLAGS
4782 _SAVE_LDFLAGS=$LDFLAGS
4784 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4785 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4786 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4788 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4791 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4794 if test "$SYSTEM_JPEG" = 1; then
4795 LIBS="$JPEG_LIBS $LIBS"
4796 AC_TRY_COMPILE([ #include <stdio.h>
4797 #include <sys/types.h>
4798 #include <jpeglib.h> ],
4799 [ #if JPEG_LIB_VERSION < $MOZJPEG
4800 #error "Insufficient JPEG library version ($MOZJPEG required)."
4803 [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=])
4805 CFLAGS=$_SAVE_CFLAGS
4806 LDFLAGS=$_SAVE_LDFLAGS
4809 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4810 JPEG_CFLAGS="-I${JPEG_DIR}/include"
4811 JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4814 dnl system ZLIB support
4815 dnl ========================================================
4816 MOZ_ARG_WITH_STRING(system-zlib,
4817 [ --with-system-zlib[=PFX]
4818 Use system libz [installed at prefix PFX]],
4821 _SAVE_CFLAGS=$CFLAGS
4822 _SAVE_LDFLAGS=$LDFLAGS
4824 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4825 CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4826 LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4828 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4831 AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"],
4832 [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4834 if test "$SYSTEM_ZLIB" = 1; then
4835 LIBS="$ZLIB_LIBS $LIBS"
4836 AC_TRY_COMPILE([ #include <stdio.h>
4838 #include <zlib.h> ],
4839 [ #if ZLIB_VERNUM < $MOZZLIB
4840 #error "Insufficient zlib version ($MOZZLIB required)."
4843 [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=])
4845 CFLAGS=$_SAVE_CFLAGS
4846 LDFLAGS=$_SAVE_LDFLAGS
4849 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4850 ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4851 ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4854 dnl system BZIP2 Support
4855 dnl ========================================================
4856 MOZ_ARG_WITH_STRING(system-bz2,
4857 [ --with-system-bz2[=PFX]
4858 Use system libbz2 [installed at prefix PFX]],
4861 _SAVE_CFLAGS=$CFLAGS
4862 _SAVE_LDFLAGS=$LDFLAGS
4864 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4865 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4866 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4868 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4871 AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4872 [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=])
4874 CFLAGS=$_SAVE_CFLAGS
4875 LDFLAGS=$_SAVE_LDFLAGS
4878 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4879 BZ2_CFLAGS="-I${BZ2_DIR}/include"
4880 BZ2_LIBS="-L${BZ2_DIR}/lib ${BZ2_LIBS}"
4883 dnl system PNG Support
4884 dnl ========================================================
4885 MOZ_ARG_WITH_STRING(system-png,
4886 [ --with-system-png[=PFX]
4887 Use system libpng [installed at prefix PFX]],
4890 _SAVE_CFLAGS=$CFLAGS
4891 _SAVE_LDFLAGS=$LDFLAGS
4893 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4894 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4895 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4896 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4897 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4899 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4902 _SAVE_PNG_LIBS=$PNG_LIBS
4903 AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4904 AC_MSG_ERROR([--with-system-png requested but no working libpng found]),
4906 AC_CHECK_LIB(png, png_get_acTL, ,
4907 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4910 if test "$SYSTEM_PNG" = 1; then
4911 LIBS="$PNG_LIBS $LIBS"
4912 AC_TRY_COMPILE([ #include <stdio.h>
4913 #include <sys/types.h>
4915 [ #if PNG_LIBPNG_VER < $MOZPNG
4916 #error "Insufficient libpng version ($MOZPNG required)."
4918 #ifndef PNG_UINT_31_MAX
4919 #error "Insufficient libpng version."
4922 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4924 CFLAGS=$_SAVE_CFLAGS
4925 LDFLAGS=$_SAVE_LDFLAGS
4928 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4929 PNG_CFLAGS="-I${PNG_DIR}/include"
4930 PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4933 fi # SKIP_LIBRARY_CHECKS
4935 dnl system HunSpell Support
4936 dnl ========================================================
4937 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4938 [ --enable-system-hunspell Use system hunspell (located with pkgconfig)],
4941 if test -n "$SYSTEM_HUNSPELL"; then
4942 PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4945 AC_SUBST(SYSTEM_HUNSPELL)
4947 dnl ========================================================
4948 dnl Java SDK support
4949 dnl ========================================================
4951 MOZ_ARG_WITH_STRING(java-include-path,
4952 [ --with-java-include-path=dir Location of Java SDK headers],
4953 JAVA_INCLUDE_PATH=$withval)
4956 MOZ_ARG_WITH_STRING(java-bin-path,
4957 [ --with-java-bin-path=dir Location of Java binaries (java, javac, jar)],
4958 JAVA_BIN_PATH=$withval)
4960 dnl ========================================================
4961 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4962 dnl their usage and use them in spidermonkey.
4963 dnl ========================================================
4964 MOZ_ARG_WITH_BOOL(arm-kuser,
4965 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4968 if test -n "$USE_ARM_KUSER"; then
4969 AC_DEFINE(USE_ARM_KUSER)
4972 dnl ========================================================
4976 dnl ========================================================
4978 MOZ_ARG_HEADER(Application)
4982 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4983 MOZ_BRANDING_DIRECTORY=
4984 MOZ_OFFICIAL_BRANDING=
4986 MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp icon"
4987 MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
4995 MOZ_AUTH_EXTENSION=1
4996 MOZ_NO_ACTIVEX_SUPPORT=1
4997 MOZ_NO_INSPECTOR_APIS=
5006 MOZ_PLAINTEXT_EDITOR_ONLY=
5008 MOZ_PREF_EXTENSIONS=1
5009 MOZ_PROFILELOCKING=1
5021 MOZ_TOOLKIT_SEARCH=1
5023 MOZ_UNIVERSALCHARDET=1
5025 MOZ_USE_NATIVE_UCONV=
5027 MOZ_XSLT_STANDALONE=
5035 NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource"
5037 XPC_IDISPATCH_SUPPORT=
5040 case "$target_os" in
5041 darwin*|*wince*|*winmo*)
5049 case "$target_os" in
5050 msvc*|mks*|cygwin*|mingw*)
5052 if test -z "$GNU_CC"; then
5053 if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
5056 XPC_IDISPATCH_SUPPORT=1
5057 MOZ_NO_ACTIVEX_SUPPORT=
5059 if test -n "$NS_ENABLE_TSF"; then
5060 AC_DEFINE(NS_ENABLE_TSF)
5065 MOZ_ARG_ENABLE_STRING(application,
5066 [ --enable-application=APP
5070 content/xslt (Standalone Transformiix XSLT)
5071 netwerk (Standalone Necko)
5072 tools/update-packaging (AUS-related packaging tools)
5073 standalone (use this for standalone
5074 xpcom/xpconnect or to manually drive a build)],
5075 [ MOZ_BUILD_APP=$enableval ] )
5077 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
5078 [ --with-xulrunner-stub-name=appname Create the xulrunner stub with the given name],
5079 XULRUNNER_STUB_NAME=$withval)
5081 if test -z "$XULRUNNER_STUB_NAME"; then
5082 case "$target_os" in
5084 XULRUNNER_STUB_NAME=xulrunner
5087 XULRUNNER_STUB_NAME=xulrunner-stub
5090 AC_SUBST(XULRUNNER_STUB_NAME)
5092 if test -z "$MOZ_BUILD_APP"; then
5093 AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
5095 # We have a valid application only if it has a build.mk file in its top
5097 if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
5098 AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
5102 # Allow the application to influence configure with a confvars.sh script.
5104 AC_MSG_CHECKING([if app-specific confvars.sh exists])
5105 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
5106 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
5107 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
5112 # Now is a good time to test for logic errors, define mismatches, etc.
5113 case "$MOZ_BUILD_APP" in
5115 if test "$LIBXUL_SDK"; then
5116 AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
5121 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
5122 # that haven't made a confvars.sh yet. Don't add new stuff here, use
5124 case "$MOZ_BUILD_APP" in
5126 AC_DEFINE(MOZ_PHOENIX)
5130 AC_DEFINE(MOZ_XULRUNNER)
5138 MOZ_APP_NAME=mozilla
5139 MOZ_APP_DISPLAYNAME=Mozilla
5140 MOZ_APP_VERSION=$MOZILLA_VERSION
5145 AC_SUBST(MOZ_BUILD_APP)
5146 AC_SUBST(MOZ_PHOENIX)
5147 AC_SUBST(MOZ_XULRUNNER)
5149 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
5151 dnl ========================================================
5153 dnl = Toolkit Options
5155 dnl ========================================================
5156 MOZ_ARG_HEADER(Toolkit Options)
5158 dnl ========================================================
5159 dnl = Select the default toolkit
5160 dnl ========================================================
5161 MOZ_ARG_ENABLE_STRING(default-toolkit,
5162 [ --enable-default-toolkit=TK
5163 Select default toolkit
5164 Platform specific defaults:
5166 Mac OS X - cairo-cocoa
5167 Neutrino/QNX - photon
5169 Win32/WinCE - cairo-windows
5170 Gtk2 with DirectFB - cairo-gtk2-dfb
5173 [ _DEFAULT_TOOLKIT=$enableval ],
5174 [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
5176 if test "$_DEFAULT_TOOLKIT" = "photon" \
5177 -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
5178 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
5179 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
5180 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
5181 -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
5182 -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
5183 -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
5184 -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
5185 -o "$_DEFAULT_TOOLKIT" = "cairo-android"
5187 dnl nglayout only supports building with one toolkit,
5188 dnl so ignore everything after the first comma (",").
5189 MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
5191 AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
5194 dnl ========================================================
5195 dnl = Enable the toolkit as needed =
5196 dnl ========================================================
5198 case "$MOZ_WIDGET_TOOLKIT" in
5201 AC_DEFINE(MOZ_WIDGET_PHOTON)
5205 MOZ_WIDGET_TOOLKIT=windows
5214 cairo-gtk2|cairo-gtk2-x11)
5215 MOZ_WIDGET_TOOLKIT=gtk2
5217 MOZ_ENABLE_XREMOTE=1
5225 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
5226 TK_LIBS='$(MOZ_GTK2_LIBS)'
5227 AC_DEFINE(MOZ_WIDGET_GTK2)
5231 MOZ_WIDGET_TOOLKIT=gtk2
5238 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
5239 TK_LIBS='$(MOZ_GTK2_LIBS)'
5240 AC_DEFINE(MOZ_WIDGET_GTK2)
5241 if test "$no_x" != "yes"; then
5242 AC_MSG_WARN([Disabling X when DirectFB is specified.])
5248 MOZ_WIDGET_TOOLKIT=qt
5250 MOZ_ENABLE_XREMOTE=1
5260 TK_CFLAGS='$(MOZ_QT_CFLAGS)'
5261 TK_LIBS='$(MOZ_QT_LIBS)'
5262 AC_DEFINE(MOZ_WIDGET_QT)
5266 MOZ_WIDGET_TOOLKIT=beos
5268 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5269 TK_LIBS='$(MOZ_CAIRO_LIBS)'
5273 MOZ_WIDGET_TOOLKIT=os2
5275 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5276 TK_LIBS='$(MOZ_CAIRO_LIBS)'
5280 MOZ_WIDGET_TOOLKIT=cocoa
5281 AC_DEFINE(MOZ_WIDGET_COCOA)
5282 MOZ_USER_DIR="Mozilla"
5283 AC_DEFINE(XP_MACOSX)
5284 TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
5285 TK_CFLAGS="-DNO_X11"
5286 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
5287 CFLAGS="$CFLAGS $TK_CFLAGS"
5288 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
5289 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
5290 MOZ_FS_LAYOUT=bundle
5295 AC_DEFINE(MOZ_WIDGET_ANDROID)
5296 MOZ_WIDGET_TOOLKIT=android
5302 if test "$MOZ_ENABLE_XREMOTE"; then
5303 AC_DEFINE(MOZ_ENABLE_XREMOTE)
5306 if test "$COMPILE_ENVIRONMENT"; then
5307 if test "$MOZ_ENABLE_GTK2"; then
5308 if test "$MOZ_X11"; then
5309 GDK_PACKAGES=gdk-x11-2.0
5310 elif test "$MOZ_DFB"; then
5311 PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
5312 GDK_PACKAGES=directfb
5315 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
5318 fi # COMPILE_ENVIRONMENT
5320 AC_SUBST(MOZ_FS_LAYOUT)
5322 dnl ========================================================
5323 dnl = startup-notification support module
5324 dnl ========================================================
5326 if test "$MOZ_ENABLE_GTK2"
5328 MOZ_ENABLE_STARTUP_NOTIFICATION=
5330 MOZ_ARG_ENABLE_BOOL(startup-notification,
5331 [ --enable-startup-notification Enable startup-notification support (default: disabled) ],
5332 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
5333 MOZ_ENABLE_STARTUP_NOTIFICATION=)
5334 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
5336 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
5337 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
5338 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
5339 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
5341 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
5343 MOZ_ENABLE_STARTUP_NOTIFICATION=
5347 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
5348 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
5351 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
5353 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
5354 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
5355 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
5357 dnl ========================================================
5359 dnl ========================================================
5360 if test "$MOZ_ENABLE_QT"
5362 MOZ_ARG_WITH_STRING(qtdir,
5363 [ --with-qtdir=\$dir Specify Qt directory ],
5366 if test -z "$QTDIR"; then
5367 PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
5368 AC_CHECK_PROGS(HOST_MOC, moc, "")
5370 MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtDBus -lQtXml -lQtOpenGL"
5372 MOZ_QT_CFLAGS="-DQT_SHARED"
5373 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
5374 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
5375 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
5376 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
5377 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
5378 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDBus"
5379 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
5380 HOST_MOC="$QTDIR/bin/moc"
5382 if test -z "$HOST_MOC"; then
5383 AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
5389 AC_SUBST(GTK_CONFIG)
5393 AC_SUBST(MOZ_ENABLE_GTK2)
5394 AC_SUBST(MOZ_ENABLE_PHOTON)
5395 AC_SUBST(MOZ_ENABLE_QT)
5396 AC_SUBST(MOZ_ENABLE_XREMOTE)
5397 AC_SUBST(MOZ_GTK2_CFLAGS)
5398 AC_SUBST(MOZ_GTK2_LIBS)
5399 AC_SUBST(MOZ_QT_CFLAGS)
5400 AC_SUBST(MOZ_QT_LIBS)
5407 dnl ========================================================
5409 dnl = Components & Features
5411 dnl ========================================================
5412 MOZ_ARG_HEADER(Components and Features)
5414 dnl ========================================================
5416 dnl ========================================================
5417 MOZ_ARG_ENABLE_STRING(ui-locale,
5418 [ --enable-ui-locale=ab-CD
5419 Select the user interface locale (default: en-US)],
5420 MOZ_UI_LOCALE=$enableval )
5421 AC_SUBST(MOZ_UI_LOCALE)
5423 dnl ========================================================
5424 dnl = Trademarked Branding
5425 dnl ========================================================
5426 MOZ_ARG_ENABLE_BOOL(official-branding,
5427 [ --enable-official-branding Enable Official mozilla.org Branding
5428 Do not distribute builds with
5429 --enable-official-branding unless you have
5430 permission to use trademarks per
5431 http://www.mozilla.org/foundation/trademarks/ .],
5433 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
5434 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
5436 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
5437 MOZ_OFFICIAL_BRANDING=1
5439 ], MOZ_OFFICIAL_BRANDING=)
5441 AC_SUBST(MOZ_OFFICIAL_BRANDING)
5442 if test -n "$MOZ_OFFICIAL_BRANDING"; then
5443 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
5446 MOZ_ARG_WITH_STRING(branding,
5447 [ --with-branding=dir Use branding from the specified directory.],
5448 MOZ_BRANDING_DIRECTORY=$withval)
5450 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
5451 if test -z "$REAL_BRANDING_DIRECTORY"; then
5452 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
5455 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
5456 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
5459 AC_SUBST(MOZ_BRANDING_DIRECTORY)
5461 dnl ========================================================
5462 dnl = Distribution ID
5463 dnl ========================================================
5464 MOZ_ARG_WITH_STRING(distribution-id,
5465 [ --with-distribution-id=ID Set distribution-specific id (default=org.mozilla)],
5466 [ val=`echo $withval`
5467 MOZ_DISTRIBUTION_ID="$val"])
5469 if test -z "$MOZ_DISTRIBUTION_ID"; then
5470 MOZ_DISTRIBUTION_ID="org.mozilla"
5473 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
5474 AC_SUBST(MOZ_DISTRIBUTION_ID)
5477 dnl ========================================================
5478 dnl complex text support off by default
5479 dnl ========================================================
5480 MOZ_ARG_DISABLE_BOOL(pango,
5481 [ --disable-pango Disable usage of Pango ],
5485 dnl ========================================================
5487 dnl ========================================================
5488 if test "$MOZ_ENABLE_GTK2"
5492 PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5494 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
5495 AC_SUBST(MOZ_PANGO_CFLAGS)
5496 AC_SUBST(MOZ_PANGO_LIBS)
5497 if test "$MOZ_PANGO"
5499 AC_DEFINE(MOZ_PANGO)
5501 PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5502 AC_SUBST(FT2_CFLAGS)
5507 if test "$MOZ_ENABLE_QT"
5509 if test "$MOZ_PANGO"
5511 PKG_CHECK_MODULES(MOZ_PANGO, [pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION],
5513 AC_SUBST(MOZ_PANGO_CFLAGS)
5514 AC_SUBST(MOZ_PANGO_LIBS)
5515 AC_DEFINE(MOZ_PANGO)
5518 echo "Pango library not found, will use FT2 font engine"
5525 dnl ========================================================
5526 dnl = GnomeVFS, GIO and GConf support module
5527 dnl ========================================================
5531 dnl build the gnomevfs extension by default only when the
5532 dnl GTK2 toolkit is in use.
5533 if test "$MOZ_ENABLE_GTK2"
5535 MOZ_ENABLE_GNOMEVFS=1
5539 dnl ========================================================
5540 dnl = GnomeVFS support module
5541 dnl ========================================================
5542 MOZ_ARG_DISABLE_BOOL(gnomevfs,
5543 [ --disable-gnomevfs Disable GnomeVFS support ],
5544 MOZ_ENABLE_GNOMEVFS=,
5545 MOZ_ENABLE_GNOMEVFS=force)
5547 if test "$MOZ_ENABLE_GNOMEVFS"
5549 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5550 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5551 MOZ_ENABLE_GNOMEVFS=1
5552 AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
5554 if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5556 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5558 MOZ_ENABLE_GNOMEVFS=
5561 if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5562 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5563 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5568 AC_SUBST(MOZ_ENABLE_GNOMEVFS)
5569 AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5570 AC_SUBST(MOZ_GNOMEVFS_LIBS)
5572 dnl ========================================================
5573 dnl = GIO support module
5574 dnl ========================================================
5575 MOZ_ARG_ENABLE_BOOL(gio,
5576 [ --enable-gio Enable GIO support (default: disabled)],
5577 MOZ_ENABLE_GIO=force,
5580 if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
5582 PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
5583 MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
5585 AC_DEFINE(MOZ_ENABLE_GIO)
5587 if test "$MOZ_ENABLE_GIO" = "force"
5589 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
5595 AC_SUBST(MOZ_ENABLE_GIO)
5596 AC_SUBST(MOZ_GIO_CFLAGS)
5597 AC_SUBST(MOZ_GIO_LIBS)
5599 dnl ========================================================
5600 dnl = GConf support module
5601 dnl ========================================================
5602 if test "$MOZ_ENABLE_GCONF"
5604 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
5605 MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5608 if test "$MOZ_ENABLE_GCONF" = "force"
5610 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5616 if test "$MOZ_ENABLE_GCONF"; then
5617 AC_DEFINE(MOZ_ENABLE_GCONF)
5620 AC_SUBST(MOZ_ENABLE_GCONF)
5621 AC_SUBST(MOZ_GCONF_CFLAGS)
5622 AC_SUBST(MOZ_GCONF_LIBS)
5625 dnl ========================================================
5626 dnl = libnotify support
5627 dnl ========================================================
5629 if test "$MOZ_ENABLE_GTK2"
5631 MOZ_ENABLE_LIBNOTIFY=1
5633 MOZ_ARG_DISABLE_BOOL(libnotify,
5634 [ --disable-libnotify Disable libnotify support ],
5635 MOZ_ENABLE_LIBNOTIFY=,
5636 MOZ_ENABLE_LIBNOTIFY=1)
5638 if test "$MOZ_ENABLE_LIBNOTIFY"
5640 AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5644 if test -z "$SKIP_LIBRARY_CHECKS"
5646 if test "$MOZ_ENABLE_GTK2"
5648 if test "$MOZ_ENABLE_LIBNOTIFY"
5650 PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5654 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5655 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5656 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5658 dnl ========================================================
5659 dnl = GNOME component (mozgnome)
5660 dnl ========================================================
5662 # The GNOME component is built if one of
5663 # gnome-vfs, gio, gconf or libnotify is available.
5664 if test "$MOZ_ENABLE_GCONF" || \
5665 test "$MOZ_ENABLE_GNOMEVFS" || \
5666 test "$MOZ_ENABLE_GIO" || \
5667 test "$MOZ_ENABLE_LIBNOTIFY"; then
5668 MOZ_ENABLE_GNOME_COMPONENT=1
5670 MOZ_ENABLE_GNOME_COMPONENT=
5672 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5674 dnl ========================================================
5675 dnl = libgnomeui support module
5676 dnl ========================================================
5678 if test "$MOZ_ENABLE_GTK2"
5680 MOZ_ENABLE_GNOMEUI=1
5682 MOZ_ARG_DISABLE_BOOL(gnomeui,
5683 [ --disable-gnomeui Disable libgnomeui support (default: auto, optional at runtime) ],
5684 MOZ_ENABLE_GNOMEUI=,
5685 MOZ_ENABLE_GNOMEUI=force)
5687 if test "$MOZ_ENABLE_GNOMEUI"
5689 PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5691 MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5692 MOZ_ENABLE_GNOMEUI=1
5694 if test "$MOZ_ENABLE_GNOMEUI" = "force"
5696 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5702 if test "$MOZ_ENABLE_GNOMEUI"; then
5703 AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5707 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5708 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5709 AC_SUBST(MOZ_GNOMEUI_LIBS)
5711 dnl ========================================================
5713 dnl ========================================================
5715 if test "$MOZ_ENABLE_GTK2" || test "$MOZ_ENABLE_QT"
5719 MOZ_ARG_DISABLE_BOOL(dbus,
5720 [ --disable-dbus Disable dbus support ],
5724 if test "$MOZ_ENABLE_DBUS"
5726 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5727 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5728 AC_DEFINE(MOZ_ENABLE_DBUS)
5731 AC_SUBST(MOZ_ENABLE_DBUS)
5732 AC_SUBST(MOZ_DBUS_CFLAGS)
5733 AC_SUBST(MOZ_DBUS_LIBS)
5734 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5735 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5737 dnl ========================================================
5738 dnl = Build Personal Security Manager
5739 dnl ========================================================
5740 MOZ_ARG_DISABLE_BOOL(crypto,
5741 [ --disable-crypto Disable crypto support (Personal Security Manager)],
5745 dnl ========================================================
5746 dnl = JS Debugger XPCOM component (js/jsd)
5747 dnl ========================================================
5748 MOZ_ARG_DISABLE_BOOL(jsd,
5749 [ --disable-jsd Disable JavaScript debug library],
5754 dnl ========================================================
5755 dnl = Disable IPC support for tabs and plugins
5756 dnl ========================================================
5758 *-wince*|*-android*)
5763 MOZ_ARG_DISABLE_BOOL(ipc,
5764 [ --disable-ipc Disable IPC supports for tabs and plugins],
5768 if test -n "$MOZ_IPC"; then
5774 dnl ========================================================
5775 dnl = Enable IPDL's "expensive" unit tests
5776 dnl ========================================================
5779 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5780 [ --enable-ipdl-tests Enable expensive IPDL tests],
5784 if test -z "$MOZ_IPC" -a -n "$MOZ_IPDL_TESTS"; then
5785 AC_MSG_ERROR([--enable-ipdl-tests requires --enable-ipc])
5788 if test -n "$MOZ_IPDL_TESTS"; then
5789 AC_DEFINE(MOZ_IPDL_TESTS)
5792 AC_SUBST(MOZ_IPDL_TESTS)
5794 dnl ========================================================
5795 dnl = Disable plugin support
5796 dnl ========================================================
5797 MOZ_ARG_DISABLE_BOOL(plugins,
5798 [ --disable-plugins Disable plugins support],
5802 dnl ========================================================
5803 dnl = Disable building dbm
5804 dnl ========================================================
5805 MOZ_ARG_DISABLE_BOOL(dbm,
5806 [ --disable-dbm Disable building dbm],
5810 dnl bi-directional support always on
5814 dnl ========================================================
5815 dnl view source support on by default
5816 dnl ========================================================
5817 if test "$MOZ_VIEW_SOURCE"; then
5818 AC_DEFINE(MOZ_VIEW_SOURCE)
5821 dnl ========================================================
5822 dnl accessibility support on by default on all platforms
5824 dnl ========================================================
5825 MOZ_ARG_DISABLE_BOOL(accessibility,
5826 [ --disable-accessibility Disable accessibility support (off by default on OS X)],
5829 if test "$ACCESSIBILITY"; then
5830 AC_DEFINE(ACCESSIBILITY)
5833 if test -n "$ACCESSIBILITY" -a "$COMPILE_ENVIRONMENT" = "1"; then
5835 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5836 if test "$ac_cv_header_atlbase_h" = "no"; then
5837 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.])
5839 if test "$ac_cv_header_oleacc_idl" = "no"; then
5840 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.])
5846 dnl ========================================================
5847 dnl xpcom js loader support on by default
5848 dnl ========================================================
5849 if test "$MOZ_JSLOADER"; then
5850 AC_DEFINE(MOZ_JSLOADER)
5853 dnl ========================================================
5854 dnl Disable printing
5855 dnl ========================================================
5856 MOZ_ARG_DISABLE_BOOL(printing,
5857 [ --disable-printing Disable printing support],
5861 if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
5862 AC_MSG_WARN([Printing does not work with Qt at this time. Omitting printing support.])
5866 if test "$NS_PRINTING"; then
5867 AC_DEFINE(NS_PRINTING)
5868 AC_DEFINE(NS_PRINT_PREVIEW)
5871 dnl ========================================================
5872 dnl use native unicode converters
5873 dnl ========================================================
5874 MOZ_ARG_ENABLE_BOOL(native-uconv,
5875 [ --enable-native-uconv Enable iconv support],
5876 MOZ_USE_NATIVE_UCONV=1,
5877 MOZ_USE_NATIVE_UCONV= )
5878 if test "$MOZ_USE_NATIVE_UCONV"; then
5879 AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5881 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5882 AC_MSG_ERROR([iconv() not found. Cannot enable native uconv support.])
5886 dnl ========================================================
5887 dnl Libeditor can be build as plaintext-only,
5888 dnl or as a full html and text editing component.
5889 dnl We build both by default.
5890 dnl ========================================================
5891 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5892 [ --enable-plaintext-editor-only
5893 Allow only plaintext editing],
5894 MOZ_PLAINTEXT_EDITOR_ONLY=1,
5895 MOZ_PLAINTEXT_EDITOR_ONLY= )
5896 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5897 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5899 dnl ========================================================
5900 dnl = Disable Fast Load
5901 dnl ========================================================
5902 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5903 [ --disable-xpcom-fastload Disable XPCOM fastload support],
5907 AC_SUBST(MOZ_NO_FAST_LOAD)
5909 if test -n "$MOZ_NO_FAST_LOAD"; then
5910 AC_DEFINE(MOZ_NO_FAST_LOAD)
5913 dnl ========================================================
5914 dnl = Disable Ogg Codecs
5915 dnl ========================================================
5916 MOZ_ARG_DISABLE_BOOL(ogg,
5917 [ --disable-ogg Disable Ogg Codec support],
5923 if test -n "$MOZ_OGG"; then
5928 dnl Checks for __attribute__(aligned()) directive
5929 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5930 [ac_cv_c_attribute_aligned],
5931 [ac_cv_c_attribute_aligned=0
5932 CFLAGS_save="${CFLAGS}"
5933 CFLAGS="${CFLAGS} -Werror"
5934 for ac_cv_c_attr_align_try in 64 32 16 8; do
5935 echo "trying $ac_cv_c_attr_align_try"
5937 [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5938 [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5939 if test "$ac_cv_c_attribute_aligned" != 0; then
5943 CFLAGS="${CFLAGS_save}"])
5944 if test "${ac_cv_c_attribute_aligned}" != "0"; then
5945 AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5946 [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5950 dnl ========================================================
5951 dnl = Disable Wave decoder support
5952 dnl ========================================================
5953 MOZ_ARG_DISABLE_BOOL(wave,
5954 [ --disable-wave Disable Wave decoder support],
5960 if test -n "$MOZ_WAVE"; then
5966 dnl ========================================================
5967 dnl = Handle dependent SYDNEYAUDIO and MEDIA defines
5968 dnl ========================================================
5970 AC_SUBST(MOZ_SYDNEYAUDIO)
5972 if test -n "$MOZ_SYDNEYAUDIO"; then
5973 AC_DEFINE(MOZ_SYDNEYAUDIO)
5978 if test -n "$MOZ_MEDIA"; then
5979 AC_DEFINE(MOZ_MEDIA)
5982 dnl ========================================================
5983 dnl = Check alsa availability on Linux if using sydneyaudio
5984 dnl ========================================================
5986 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5987 if test -n "$MOZ_SYDNEYAUDIO"; then
5988 case "$target_os" in
5990 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5991 [echo "$MOZ_ALSA_PKG_ERRORS"
5992 AC_MSG_ERROR([Need alsa for Ogg or Wave decoding on Linux. Disable with --disable-ogg --disable-wave.])])
5996 AC_SUBST(MOZ_ALSA_LIBS)
5998 dnl ========================================================
6000 dnl ========================================================
6001 AC_ARG_ENABLE(splashscreen,
6002 [ --enable-splashscreen display splashscreen while loading (default=no)],
6003 [enable_splash="yes"],[enable_splash=""])
6004 if test "x$enable_splash" = "xyes"; then
6006 AC_DEFINE(MOZ_SPLASHSCREEN)
6008 AC_SUBST(MOZ_SPLASHSCREEN)
6010 dnl ========================================================
6011 dnl Permissions System
6012 dnl ========================================================
6013 MOZ_ARG_DISABLE_BOOL(permissions,
6014 [ --disable-permissions Disable permissions (popup and cookie blocking)],
6019 dnl ========================================================
6021 dnl ========================================================
6022 MOZ_ARG_DISABLE_BOOL(negotiateauth,
6023 [ --disable-negotiateauth Disable GSS-API negotiation ],
6024 MOZ_AUTH_EXTENSION=,
6025 MOZ_AUTH_EXTENSION=1 )
6027 dnl ========================================================
6029 dnl ========================================================
6030 MOZ_ARG_DISABLE_BOOL(xtf,
6031 [ --disable-xtf Disable XTF (pluggable xml tags) support],
6034 if test "$MOZ_XTF"; then
6038 dnl ========================================================
6039 dnl Pref extensions (autoconfig and system-pref)
6040 dnl ========================================================
6041 MOZ_ARG_DISABLE_BOOL(pref-extensions,
6042 [ --disable-pref-extensions
6043 Disable pref extensions such as autoconfig and
6045 MOZ_PREF_EXTENSIONS=,
6046 MOZ_PREF_EXTENSIONS=1 )
6048 dnl ========================================================
6049 dnl = Universalchardet
6050 dnl ========================================================
6051 MOZ_ARG_DISABLE_BOOL(universalchardet,
6052 [ --disable-universalchardet
6053 Disable universal encoding detection],
6054 MOZ_UNIVERSALCHARDET=,
6055 MOZ_UNIVERSALCHARDET=1 )
6057 dnl ========================================================
6059 dnl ========================================================
6066 MOZ_ARG_ENABLE_BOOL(javaxpcom,
6067 [ --enable-javaxpcom
6068 Enable Java-XPCOM bridge],
6072 if test -n "${MOZ_JAVAXPCOM}"; then
6075 if test -n "$JAVA_HOME"; then
6076 JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
6080 if test -n "$JAVA_HOME"; then
6081 JAVA_HOME=`cd "$JAVA_HOME" && pwd`
6086 if test -n "${JAVA_INCLUDE_PATH}"; then
6087 dnl Make sure jni.h exists in the given include path.
6088 if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
6089 AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
6092 case "$target_os" in
6094 dnl Default to java system location
6095 JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
6099 JAVA_INCLUDE_PATH="$JAVA_HOME/include"
6102 if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
6103 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.])
6107 if test -n "${JAVA_BIN_PATH}"; then
6108 dnl Look for javac and jar in the specified path.
6109 JAVA_PATH="$JAVA_BIN_PATH"
6111 dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
6112 JAVA_PATH="$JAVA_HOME/bin:$PATH"
6115 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
6116 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
6117 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
6118 if test -z "$JAVA" || test "$JAVA" = ":" || test -z "$JAVAC" || test "$JAVAC" = ":" || test -z "$JAR" || test "$JAR" = ":"; then
6119 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.])
6123 dnl ========================================================
6124 dnl = Breakpad crash reporting (on by default on supported platforms)
6125 dnl ========================================================
6131 i?86-apple-darwin*|powerpc-apple-darwin*)
6134 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
6142 MOZ_ARG_DISABLE_BOOL(crashreporter,
6143 [ --disable-crashreporter Disable breakpad crash reporting],
6145 MOZ_CRASHREPORTER=1)
6147 if test -n "$MOZ_CRASHREPORTER"; then
6148 AC_DEFINE(MOZ_CRASHREPORTER)
6150 if (test "$OS_ARCH" = "Linux" || test "$OS_ARCH" = "SunOS") && \
6151 test -z "$SKIP_LIBRARY_CHECKS"; then
6152 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
6153 AC_SUBST(MOZ_GTHREAD_CFLAGS)
6154 AC_SUBST(MOZ_GTHREAD_LIBS)
6156 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.])])
6160 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
6161 [ --with-crashreporter-enable-percent=NN Enable sending crash reports by default on NN% of users. (default=100)],
6162 [ val=`echo $withval | sed 's/[^0-9]//g'`
6163 MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
6165 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
6166 MOZ_CRASHREPORTER_ENABLE_PERCENT=100
6168 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
6170 dnl ========================================================
6171 dnl = Enable compilation of specific extension modules
6172 dnl ========================================================
6174 MOZ_ARG_ENABLE_STRING(extensions,
6175 [ --enable-extensions Enable extensions],
6176 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6177 if test "$option" = "yes" || test "$option" = "all"; then
6178 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6179 elif test "$option" = "no" || test "$option" = "none"; then
6181 elif test "$option" = "default"; then
6182 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6183 elif test `echo "$option" | grep -c \^-` != 0; then
6184 option=`echo $option | sed 's/^-//'`
6185 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6187 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6190 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6192 if test -z "$MOZ_ENABLE_GNOMEVFS" && test -z "$MOZ_GNOMEVFS_LIBS" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6193 # Suppress warning on non-X11 platforms
6194 if test -n "$MOZ_X11"; then
6195 AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
6197 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6200 dnl Do not build gnomevfs with libxul based apps
6201 if test -n "$LIBXUL_SDK_DIR" && test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6202 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6205 if test -z "$MOZ_ENABLE_GIO" && test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6206 # Suppress warning on non-X11 platforms
6207 if test -n "$MOZ_X11"; then
6208 AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
6210 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6213 dnl Do not build gio with libxul based apps
6214 if test -n "$LIBXUL_SDK_DIR" && test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6215 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6218 if test -z "$MOZ_JSDEBUGGER" && test `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6219 AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6220 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6223 dnl This might be temporary: build tridentprofile only on Windows
6224 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
6225 AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
6226 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
6229 dnl cookie must be built before tridentprofile. put it at list's end.
6230 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
6231 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
6232 MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
6235 dnl xforms requires xtf and schema-validation
6236 if test -z "$MOZ_XTF" && test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
6237 AC_MSG_WARN([Cannot build XForms without XTF support. Removing XForms from MOZ_EXTENSIONS.])
6238 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6240 if test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0 && test `echo "$MOZ_EXTENSIONS" | grep -c schema-validation` -eq 0; then
6241 AC_MSG_WARN([Cannot build XForms without schema validation. Removing XForms from MOZ_EXTENSIONS.])
6242 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6245 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
6246 AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
6247 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
6250 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
6251 AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
6252 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
6255 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
6256 AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
6257 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
6260 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
6261 AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
6262 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
6265 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
6266 AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
6267 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
6270 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
6271 AC_MSG_WARN([spellcheck is no longer an extension.])
6272 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
6276 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6278 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6279 dnl when trying to build a nonexistent extension.
6280 for extension in $MOZ_EXTENSIONS; do
6281 if test ! -d "${srcdir}/extensions/${extension}"; then
6282 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6287 dnl ========================================================
6289 dnl ========================================================
6290 case "$MOZ_WIDGET_TOOLKIT" in
6291 beos|windows|os2|mac|cocoa)
6294 if test -z "$MOZ_ENABLE_GTK2" && test -z "$MOZ_ENABLE_QT"; then
6295 MOZ_IMG_DECODERS_DEFAULT=`echo $MOZ_IMG_DECODERS_DEFAULT | sed -e 's|icon||'`
6300 MOZ_ARG_ENABLE_STRING(image-decoders,
6301 [ --enable-image-decoders[={mod1,mod2,default,all,none}]
6302 Enable specific image decoders],
6303 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6304 if test "$option" = "yes" || test "$option" = "all"; then
6305 MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
6306 elif test "$option" = "no" || test "$option" = "none"; then
6308 elif test "$option" = "default"; then
6309 MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $MOZ_IMG_DECODERS_DEFAULT"
6310 elif test `echo "$option" | grep -c \^-` != 0; then
6311 option=`echo $option | sed 's/^-//'`
6312 MOZ_IMG_DECODERS=`echo "$MOZ_IMG_DECODERS" | sed "s/ ${option}//"`
6314 MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS $option"
6317 MOZ_IMG_DECODERS="$MOZ_IMG_DECODERS_DEFAULT")
6319 dnl Dupes are removed in the encoder section because it will also add decoders
6321 dnl ========================================================
6323 dnl ========================================================
6324 MOZ_ARG_ENABLE_STRING(image-encoders,
6325 [ --enable-image-encoders[={mod1,mod2,default,all,none}]
6326 Enable specific image encoders],
6327 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6328 if test "$option" = "yes" || test "$option" = "all"; then
6329 addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
6330 elif test "$option" = "no" || test "$option" = "none"; then
6333 elif test "$option" = "default"; then
6334 addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
6335 elif test `echo "$option" | grep -c \^-` != 0; then
6336 option=`echo $option | sed 's/^-//'`
6337 addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
6339 addencoder="$option"
6341 MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
6343 MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
6346 MOZ_IMG_DECODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_DECODERS}`
6347 MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
6349 dnl ========================================================
6350 dnl MathML on by default
6351 dnl ========================================================
6352 MOZ_ARG_DISABLE_BOOL(mathml,
6353 [ --disable-mathml Disable MathML support],
6356 if test "$MOZ_MATHML"; then
6357 AC_DEFINE(MOZ_MATHML)
6360 dnl ========================================================
6362 dnl ========================================================
6363 MOZ_ARG_DISABLE_BOOL(svg,
6364 [ --disable-svg Disable SVG support],
6367 if test -n "$MOZ_SVG"; then
6371 dnl ========================================================
6373 dnl ========================================================
6375 MOZ_ARG_DISABLE_BOOL(smil,
6376 [ --disable-smil Disable SMIL animation support],
6379 # Automatically disable SMIL if SVG is disabled
6380 if test -z "$MOZ_SVG"; then
6383 if test -n "$MOZ_SMIL"; then
6387 dnl ========================================================
6388 dnl Build Freetype in the tree
6389 dnl ========================================================
6390 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6391 [ --enable-tree-freetype Enable Tree FreeType],
6392 MOZ_TREE_FREETYPE=1,
6393 MOZ_TREE_FREETYPE= )
6394 if test -n "$MOZ_TREE_FREETYPE"; then
6395 AC_DEFINE(MOZ_TREE_FREETYPE)
6396 AC_SUBST(MOZ_TREE_FREETYPE)
6397 MOZ_ENABLE_CAIRO_FT=1
6398 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6399 FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6400 CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6401 FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype2,$(LIBXUL_DIST)/lib)'
6402 CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype2,$(LIBXUL_DIST)/lib)'
6403 AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6404 AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6405 AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6406 AC_SUBST(CAIRO_FT_CFLAGS)
6410 dnl ========================================================
6412 dnl ========================================================
6413 case "$target_os" in
6414 aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*|winmo*)
6419 MOZ_ARG_DISABLE_BOOL(installer,
6420 [ --disable-installer Disable building of installer],
6423 if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then
6424 # Disable installer for Windows builds that use the new toolkit if NSIS
6425 # isn't in the path.
6426 MOZ_PATH_PROGS(MAKENSIS, makensis)
6427 if test -z "$MAKENSIS" || test "$MAKENSIS" = ":"; then
6428 AC_MSG_ERROR([To build the installer makensis is required in your path. To build without the installer reconfigure using --disable-installer.])
6430 # The Windows build for NSIS requires the iconv command line utility to
6431 # convert the charset of the locale files.
6432 MOZ_PATH_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
6433 if test -z "$HOST_ICONV"; then
6434 AC_MSG_ERROR([To build the installer iconv is required in your path. To build without the installer reconfigure using --disable-installer.])
6438 AC_SUBST(MOZ_INSTALLER)
6440 AC_MSG_CHECKING([for tar archiver])
6441 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6442 if test -z "$TAR"; then
6443 AC_MSG_ERROR([no tar archiver found in \$PATH])
6445 AC_MSG_RESULT([$TAR])
6448 AC_MSG_CHECKING([for wget])
6449 AC_CHECK_PROGS(WGET, wget, "")
6450 AC_MSG_RESULT([$WGET])
6453 dnl ========================================================
6455 dnl ========================================================
6457 MOZ_ARG_DISABLE_BOOL(updater,
6458 [ --disable-updater Disable building of updater],
6461 AC_SUBST(MOZ_UPDATER)
6463 # app update channel is 'default' when not supplied.
6464 MOZ_ARG_ENABLE_STRING([update-channel],
6465 [ --enable-update-channel=CHANNEL
6466 Select application update channel (default=default)],
6467 MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6469 if test -z "$MOZ_UPDATE_CHANNEL"; then
6470 MOZ_UPDATE_CHANNEL=default
6472 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6474 # tools/update-packaging is not checked out by default.
6475 MOZ_ARG_ENABLE_BOOL(update-packaging,
6476 [ --enable-update-packaging
6477 Enable tools/update-packaging],
6478 MOZ_UPDATE_PACKAGING=1,
6479 MOZ_UPDATE_PACKAGING= )
6480 AC_SUBST(MOZ_UPDATE_PACKAGING)
6482 dnl ========================================================
6484 dnl ========================================================
6486 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
6487 [ --disable-xpconnect-idispatch
6488 Disable building of xpconnect support for IDispatch
6490 XPC_IDISPATCH_SUPPORT=,
6491 XPC_IDISPATCH_SUPPORT=1)
6492 AC_SUBST(XPC_IDISPATCH_SUPPORT)
6494 MOZ_ARG_DISABLE_BOOL(activex,
6495 [ --disable-activex Disable building of ActiveX control (win32 only)],
6496 MOZ_NO_ACTIVEX_SUPPORT=1,
6497 MOZ_NO_ACTIVEX_SUPPORT= )
6498 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
6500 MOZ_ARG_ENABLE_BOOL(activex-scripting,
6501 [ --enable-activex-scripting
6502 Enable building of ActiveX scripting support (win32)],
6503 MOZ_ACTIVEX_SCRIPTING_SUPPORT=1,
6504 MOZ_ACTIVEX_SCRIPTING_SUPPORT=)
6505 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
6507 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
6509 AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
6512 if test "$COMPILE_ENVIRONMENT" = "1"; then
6513 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
6515 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
6516 if test "$ac_cv_header_atlbase_h" = "no"; then
6517 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.])
6524 dnl ========================================================
6526 dnl ========================================================
6527 MOZ_ARG_ENABLE_BOOL(leaky,
6528 [ --enable-leaky Build leaky memory tool],
6533 dnl ========================================================
6534 dnl build the tests by default
6535 dnl ========================================================
6536 MOZ_ARG_DISABLE_BOOL(tests,
6537 [ --disable-tests Do not build test libraries & programs],
6541 dnl ========================================================
6542 dnl parental controls (for Windows Vista)
6543 dnl ========================================================
6544 MOZ_ARG_DISABLE_BOOL(parental-controls,
6545 [ --disable-parental-controls
6546 Do not build parental controls],
6547 MOZ_DISABLE_PARENTAL_CONTROLS=1,
6548 MOZ_DISABLE_PARENTAL_CONTROLS=)
6549 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6550 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6553 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6555 dnl ========================================================
6557 dnl = Module specific options
6559 dnl ========================================================
6560 MOZ_ARG_HEADER(Individual module options)
6562 dnl ========================================================
6563 dnl = Disable feed handling components
6564 dnl ========================================================
6565 MOZ_ARG_DISABLE_BOOL(feeds,
6566 [ --disable-feeds Disable feed handling and processing components],
6569 if test -n "$MOZ_FEEDS"; then
6570 AC_DEFINE(MOZ_FEEDS)
6572 if test "$MOZ_BUILD_APP" = "browser"; then
6573 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6577 dnl ========================================================
6578 dnl = Enable mozStorage
6579 dnl ========================================================
6580 dnl Implicitly enabled by default if building calendar or places
6581 MOZ_ARG_ENABLE_BOOL(storage,
6582 [ --enable-storage Enable mozStorage module and related components],
6585 if test -n "$MOZ_STORAGE"; then
6586 AC_DEFINE(MOZ_STORAGE)
6589 dnl ========================================================
6590 dnl Check for sqlite
6591 dnl ========================================================
6594 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6595 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
6596 MOZ_NATIVE_SQLITE=1,
6597 MOZ_NATIVE_SQLITE= )
6599 if test -z "$MOZ_NATIVE_SQLITE"
6602 SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6604 dnl ============================
6605 dnl === SQLite Version check ===
6606 dnl ============================
6607 dnl Check to see if the system SQLite package is new enough.
6608 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6610 dnl ==================================
6611 dnl === SQLITE_SECURE_DELETE check ===
6612 dnl ==================================
6613 dnl Check to see if the system SQLite package is compiled with
6614 dnl SQLITE_SECURE_DELETE enabled.
6615 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6616 _SAVE_CFLAGS="$CFLAGS"
6617 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6619 LIBS="$LIBS $SQLITE_LIBS"
6620 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6622 #include "sqlite3.h"
6624 int main(int argc, char **argv){
6625 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6627 ac_cv_sqlite_secure_delete=yes,
6628 ac_cv_sqlite_secure_delete=no,
6629 ac_cv_sqlite_secure_delete=no
6632 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6633 CFLAGS="$_SAVE_CFLAGS"
6635 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6636 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6639 dnl ===============================
6640 dnl === SQLITE_THREADSAFE check ===
6641 dnl ===============================
6642 dnl Check to see if the system SQLite package is compiled with
6643 dnl SQLITE_THREADSAFE enabled.
6644 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6645 _SAVE_CFLAGS="$CFLAGS"
6646 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6648 LIBS="$LIBS $SQLITE_LIBS"
6649 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6651 #include "sqlite3.h"
6653 int main(int argc, char **argv){
6654 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6656 ac_cv_sqlite_threadsafe=yes,
6657 ac_cv_sqlite_threadsafe=no,
6658 ac_cv_sqlite_threadsafe=no
6661 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6662 CFLAGS="$_SAVE_CFLAGS"
6664 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6665 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6668 dnl ================================
6669 dnl === SQLITE_ENABLE_FTS3 check ===
6670 dnl ================================
6671 dnl check to see if the system SQLite package is compiled with
6672 dnl SQLITE_THREADSAFE enabled.
6673 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6674 _SAVE_CFLAGS="$CFLAGS"
6675 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6677 LIBS="$LIBS $SQLITE_LIBS"
6678 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6680 #include "sqlite3.h"
6682 int main(int argc, char **argv){
6683 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6685 ac_cv_sqlite_enable_fts3=yes,
6686 ac_cv_sqlite_enable_fts3=no,
6687 ac_cv_sqlite_enable_fts3=no
6690 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6691 CFLAGS="$_SAVE_CFLAGS"
6693 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6694 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6698 AC_SUBST(MOZ_NATIVE_SQLITE)
6700 dnl ========================================================
6701 dnl = Enable help viewer (off by default)
6702 dnl ========================================================
6703 if test -n "$MOZ_HELP_VIEWER"; then
6704 dnl Do this if defined in confvars.sh
6705 AC_DEFINE(MOZ_HELP_VIEWER)
6708 dnl ========================================================
6709 dnl = Enable safe browsing (anti-phishing)
6710 dnl ========================================================
6711 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6712 [ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation],
6713 MOZ_SAFE_BROWSING=1,
6714 MOZ_SAFE_BROWSING= )
6715 if test -n "$MOZ_SAFE_BROWSING"; then
6716 AC_DEFINE(MOZ_SAFE_BROWSING)
6718 AC_SUBST(MOZ_SAFE_BROWSING)
6720 dnl ========================================================
6721 dnl = Enable faststart component
6722 dnl ========================================================
6723 MOZ_ARG_ENABLE_BOOL(faststart,
6724 [ --enable-faststart Enable the faststart component],
6727 if test -n "$MOZ_FASTSTART"; then
6728 AC_DEFINE(MOZ_FASTSTART)
6730 AC_SUBST(MOZ_FASTSTART)
6732 dnl ========================================================
6733 dnl = Enable url-classifier
6734 dnl ========================================================
6735 dnl Implicitly enabled by default if building with safe-browsing
6736 if test -n "$MOZ_SAFE_BROWSING"; then
6737 MOZ_URL_CLASSIFIER=1
6739 MOZ_ARG_ENABLE_BOOL(url-classifier,
6740 [ --enable-url-classifier Enable url classifier module],
6741 MOZ_URL_CLASSIFIER=1,
6742 MOZ_URL_CLASSIFIER= )
6743 if test -n "$MOZ_URL_CLASSIFIER"; then
6744 AC_DEFINE(MOZ_URL_CLASSIFIER)
6746 AC_SUBST(MOZ_URL_CLASSIFIER)
6748 dnl ========================================================
6749 dnl = Disable zipwriter
6750 dnl ========================================================
6751 MOZ_ARG_DISABLE_BOOL(zipwriter,
6752 [ --disable-zipwriter Disable zipwriter component],
6755 AC_SUBST(MOZ_ZIPWRITER)
6757 dnl ========================================================
6758 dnl = Disable libconic
6759 dnl ========================================================
6760 MOZ_ENABLE_LIBCONIC=1
6761 MOZ_ARG_DISABLE_BOOL(libconic,
6762 [ --disable-libconic Disable libconic],
6763 MOZ_ENABLE_LIBCONIC=,
6764 MOZ_ENABLE_LIBCONIC=1 )
6766 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6767 PKG_CHECK_MODULES(LIBCONIC, conic,
6768 MOZ_ENABLE_LIBCONIC=1,
6769 MOZ_ENABLE_LIBCONIC=)
6771 if test "$MOZ_ENABLE_LIBCONIC"; then
6772 AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6775 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6776 AC_SUBST(LIBCONIC_CFLAGS)
6777 AC_SUBST(LIBCONIC_LIBS)
6779 dnl ========================================================
6781 dnl ========================================================
6783 MAEMO_SDK_TARGET_VER=-1
6785 MOZ_ARG_WITH_STRING(maemo-version,
6786 [ --with-maemo-version=MAEMO_SDK_TARGET_VER
6788 MAEMO_SDK_TARGET_VER=$withval)
6790 case "$MAEMO_SDK_TARGET_VER" in
6792 MOZ_PLATFORM_MAEMO=5
6796 MOZ_PLATFORM_MAEMO=6
6800 dnl We aren't compiling for Maemo, move on.
6803 AC_MSG_ERROR([Unknown Maemo Version. Try setting --with-maemo-version to 5 or 6.])
6807 if test $MOZ_PLATFORM_MAEMO; then
6808 AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6810 if test -z "$MOZ_ENABLE_DBUS"; then
6811 AC_MSG_ERROR([DBus is required when building for Maemo])
6814 MOZ_GFX_OPTIMIZE_MOBILE=1
6816 MOZ_MAEMO_LIBLOCATION=
6818 if test $MOZ_PLATFORM_MAEMO = 5; then
6819 dnl if we have Xcomposite we should also have Xdamage and Xfixes
6820 AC_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6821 [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6822 AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6823 [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6825 AC_SUBST(XCOMPOSITE_LIBS)
6827 PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6828 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6829 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6830 if test -z "$_LIB_FOUND"; then
6831 AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6835 PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6836 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6837 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6838 if test -z "$_LIB_FOUND"; then
6839 AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6842 PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6843 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6844 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6845 if test -z "$_LIB_FOUND"; then
6846 AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6851 PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
6852 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
6853 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
6854 if test "$_LIB_FOUND"; then
6855 MOZ_MAEMO_LIBLOCATION=1
6856 AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
6858 AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
6860 AC_SUBST(MOZ_MAEMO_LIBLOCATION)
6862 AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
6863 AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
6866 dnl ========================================================
6867 dnl = faststripe theme
6868 dnl ========================================================
6869 MOZ_ARG_ENABLE_BOOL(faststripe,
6870 [ --enable-faststripe Use faststripe theme],
6871 MOZ_THEME_FASTSTRIPE=1,
6872 MOZ_THEME_FASTSTRIPE= )
6873 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6875 dnl ========================================================
6877 dnl = Feature options that require extra sources to be pulled
6879 dnl ========================================================
6880 dnl MOZ_ARG_HEADER(Features that require extra sources)
6882 dnl ========================================================
6884 dnl = Debugging Options
6886 dnl ========================================================
6887 MOZ_ARG_HEADER(Debugging and Optimizations)
6889 dnl ========================================================
6890 dnl = Disable building with debug info.
6891 dnl = Debugging is OFF by default
6892 dnl ========================================================
6893 if test -z "$MOZ_DEBUG_FLAGS"
6897 if test "$GNU_CC"; then
6898 GCC_VERSION=`$CC -v 2>&1 | awk '/version/ { print $3 }'`
6899 case "$GCC_VERSION" in
6904 MOZ_DEBUG_FLAGS="-g"
6908 MOZ_DEBUG_FLAGS="-g"
6912 MOZ_DEBUG_FLAGS="-g"
6917 MOZ_ARG_ENABLE_STRING(debug,
6918 [ --enable-debug[=DBG] Enable building with developer debug info
6919 (using compiler flags DBG)],
6920 [ if test "$enableval" != "no"; then
6922 if test -n "$enableval" -a "$enableval" != "yes"; then
6923 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6924 _MOZ_DEBUG_FLAGS_SET=1
6931 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG"
6932 case "${target_os}" in
6934 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${USER}"
6936 msvc*|mks*|cygwin*|mingw*|os2*|wince*|winmo*)
6937 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
6940 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`$WHOAMI`"
6943 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DTRACING"
6945 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6947 if test -n "$MOZ_DEBUG"; then
6948 AC_MSG_CHECKING([for valid debug flags])
6949 _SAVE_CFLAGS=$CFLAGS
6950 CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6951 AC_TRY_COMPILE([#include <stdio.h>],
6952 [printf("Hello World\n");],
6955 AC_MSG_RESULT([$_results])
6956 if test "$_results" = "no"; then
6957 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6959 CFLAGS=$_SAVE_CFLAGS
6962 dnl ========================================================
6963 dnl enable mobile optimizations
6964 dnl ========================================================
6965 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6966 [ --enable-mobile-optimize Enable mobile optimizations],
6967 MOZ_GFX_OPTIMIZE_MOBILE=1)
6969 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6971 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6972 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6975 dnl ========================================================
6976 dnl = Enable code optimization. ON by default.
6977 dnl ========================================================
6978 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6979 MOZ_OPTIMIZE_FLAGS="-O"
6982 MOZ_ARG_ENABLE_STRING(optimize,
6983 [ --disable-optimize Disable compiler optimization
6984 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6985 [ if test "$enableval" != "no"; then
6987 if test -n "$enableval" && test "$enableval" != "yes"; then
6988 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6993 fi ], MOZ_OPTIMIZE=1)
6995 if test "$COMPILE_ENVIRONMENT"; then
6996 if test -n "$MOZ_OPTIMIZE"; then
6997 AC_MSG_CHECKING([for valid optimization flags])
6998 _SAVE_CFLAGS=$CFLAGS
6999 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
7000 AC_TRY_COMPILE([#include <stdio.h>],
7001 [printf("Hello World\n");],
7004 AC_MSG_RESULT([$_results])
7005 if test "$_results" = "no"; then
7006 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
7008 CFLAGS=$_SAVE_CFLAGS
7010 fi # COMPILE_ENVIRONMENT
7012 AC_SUBST(MOZ_OPTIMIZE)
7013 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
7014 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
7015 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
7017 dnl ========================================================
7018 dnl = (Deprecated) generation of debugger info for specific modules
7019 dnl ========================================================
7020 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
7021 [ --enable-debugger-info-modules
7022 Enable/disable debugger info for specific modules],
7023 [ if test "$enableval" != "no"; then
7024 AC_MSG_WARN([--enable-debugger-info-modules is deprecated, use --enable-debug-symbols instead])
7028 dnl ========================================================
7029 dnl = Enable generation of debug symbols
7030 dnl ========================================================
7031 MOZ_ARG_ENABLE_STRING(debug-symbols,
7032 [ --enable-debug-symbols[=DBG] Enable debugging symbols
7033 (using compiler flags DBG)],
7034 [ if test "$enableval" != "no"; then
7036 if test -n "$enableval" -a "$enableval" != "yes"; then
7037 if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
7038 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7040 AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
7045 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
7046 AC_DEFINE(MOZ_DEBUG_SYMBOLS)
7047 export MOZ_DEBUG_SYMBOLS
7050 dnl ========================================================
7051 dnl = Disable any treating of compile warnings as errors
7052 dnl ========================================================
7053 MOZ_ARG_DISABLE_BOOL(warnings-as-errors,
7054 [ --disable-warnings-as-errors Disable treating of warnings as errors],
7055 MOZ_DISABLE_WARNINGS_AS_ERRORS=1,
7056 MOZ_DISABLE_WARNINGS_AS_ERRORS= )
7057 if test "$MOZ_DISABLE_WARNINGS_AS_ERRORS"; then
7058 WARNINGS_AS_ERRORS=''
7061 dnl ========================================================
7062 dnl = Disable runtime logging checks
7063 dnl ========================================================
7064 MOZ_ARG_DISABLE_BOOL(logging,
7065 [ --disable-logging Disable logging facilities],
7066 NS_DISABLE_LOGGING=1,
7067 NS_DISABLE_LOGGING= )
7068 if test "$NS_DISABLE_LOGGING"; then
7069 AC_DEFINE(NS_DISABLE_LOGGING)
7071 AC_DEFINE(MOZ_LOGGING)
7074 dnl ========================================================
7075 dnl = This will enable logging of addref, release, ctor, dtor.
7076 dnl ========================================================
7077 _ENABLE_LOGREFCNT=42
7078 MOZ_ARG_ENABLE_BOOL(logrefcnt,
7079 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
7080 _ENABLE_LOGREFCNT=1,
7081 _ENABLE_LOGREFCNT= )
7082 if test "$_ENABLE_LOGREFCNT" = "1"; then
7083 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
7084 elif test -z "$_ENABLE_LOGREFCNT"; then
7085 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
7088 dnl ========================================================
7089 dnl = Enable trace malloc
7090 dnl ========================================================
7091 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
7092 MOZ_ARG_ENABLE_BOOL(trace-malloc,
7093 [ --enable-trace-malloc Enable malloc tracing],
7096 if test "$NS_TRACE_MALLOC"; then
7097 # Please, Mr. Linker Man, don't take away our symbol names
7098 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7100 AC_DEFINE(NS_TRACE_MALLOC)
7102 AC_SUBST(NS_TRACE_MALLOC)
7104 dnl ========================================================
7105 dnl = Enable jemalloc
7106 dnl ========================================================
7107 MOZ_ARG_ENABLE_BOOL(jemalloc,
7108 [ --enable-jemalloc Replace memory allocator with jemalloc],
7112 if test "$NS_TRACE_MALLOC"; then
7116 if test "$MOZ_MEMORY"; then
7118 dnl Don't try to run compiler tests on Windows
7119 if test "$OS_ARCH" = "WINNT"; then
7120 if test -z "$HAVE_64BIT_OS"; then
7121 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7123 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7126 AC_CHECK_SIZEOF([int *], [4])
7127 case "${ac_cv_sizeof_int_p}" in
7129 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7132 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7135 AC_MSG_ERROR([Unexpected pointer size])
7140 AC_DEFINE(MOZ_MEMORY)
7141 if test "x$MOZ_DEBUG" = "x1"; then
7142 AC_DEFINE(MOZ_MEMORY_DEBUG)
7144 dnl The generic feature tests that determine how to compute ncpus are long and
7145 dnl complicated. Therefore, simply define special cpp variables for the
7146 dnl platforms we have special knowledge of.
7147 case "${target_os}" in
7149 AC_DEFINE(MOZ_MEMORY_DARWIN)
7152 AC_DEFINE(MOZ_MEMORY_BSD)
7155 AC_DEFINE(MOZ_MEMORY_LINUX)
7158 AC_DEFINE(MOZ_MEMORY_BSD)
7161 AC_DEFINE(MOZ_MEMORY_SOLARIS)
7163 msvc*|mks*|cygwin*|mingw*)
7164 AC_DEFINE(MOZ_MEMORY_WINDOWS)
7165 dnl This is sort of awful. Will revisit if we add support for more versions
7166 if test "$CC_VERSION" != "14.00.50727.762" -a "$CC_VERSION" != "15.00.30729.01"; then
7167 AC_MSG_ERROR([Building jemalloc requires exactly Visual C++ 2005 SP1 or 2008 SP1 currently.])
7169 if test -z "$WIN32_CRT_SRC_DIR"; then
7170 if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
7171 AC_MSG_ERROR([When building jemalloc, set WIN32_CRT_SRC_DIR to the path to the Visual C++ CRT source (usually VCINSTALLDIR\crt\src, but VCINSTALLDIR is not set, so I can't autodetect it for you).])
7173 WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
7177 case "${target_cpu}" in
7179 _WIN32_CRT_CPU=intel
7182 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7186 if test ! -d "$WIN32_CRT_SRC_DIR"; then
7187 AC_MSG_ERROR([Invalid Win32 CRT source directory: ${WIN32_CRT_SRC_DIR}])
7189 WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd -W`
7190 _objdir_win=`pwd -W`
7191 WIN32_CUSTOM_CRT_DIR="$_objdir_win/memory/jemalloc/crtsrc/build/$_WIN32_CRT_CPU"
7192 MOZ_MEMORY_LDFLAGS="-MANIFEST:NO -LIBPATH:\"$WIN32_CUSTOM_CRT_DIR\" -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt19 -DEFAULTLIB:mozcpp19"
7193 dnl Also pass this to NSPR/NSS
7194 DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
7198 AC_DEFINE(MOZ_MEMORY_WINCE)
7199 AC_DEFINE(MOZ_MEMORY_WINDOWS)
7200 if test -z "$WINCE_WINDOWS_MOBILE"; then
7201 AC_DEFINE(MOZ_MEMORY_WINCE6)
7205 AC_DEFINE(MOZ_MEMORY_WINCE)
7206 AC_DEFINE(MOZ_MEMORY_WINDOWS)
7209 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7213 if test "$OS_ARCH" != "Darwin"; then
7214 dnl NB: this must be kept in sync with jemalloc.h
7215 AC_DEFINE(HAVE_JEMALLOC_VALLOC)
7216 AC_DEFINE(HAVE_JEMALLOC_POSIX_MEMALIGN)
7217 AC_DEFINE(HAVE_JEMALLOC_MEMALIGN)
7220 AC_SUBST(MOZ_MEMORY)
7221 AC_SUBST(MOZ_MEMORY_LDFLAGS)
7222 AC_SUBST(WIN32_CRT_SRC_DIR)
7223 dnl Need to set this for make because NSS doesn't have configure
7226 dnl ========================================================
7227 dnl = Use malloc wrapper lib
7228 dnl ========================================================
7229 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7230 [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)],
7234 if test -n "$_WRAP_MALLOC"; then
7235 if test "$GNU_CC"; then
7236 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"
7237 MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) -o $@'
7241 dnl ========================================================
7242 dnl = Location of malloc wrapper lib
7243 dnl ========================================================
7244 MOZ_ARG_WITH_STRING(wrap-malloc,
7245 [ --with-wrap-malloc=DIR Location of malloc wrapper library],
7246 WRAP_MALLOC_LIB=$withval)
7248 dnl ========================================================
7250 dnl ========================================================
7251 MOZ_ARG_ENABLE_BOOL(tracevis,
7252 [ --enable-tracevis Enable TraceVis tracing tool (default=no)],
7255 if test -n "$MOZ_TRACEVIS"; then
7256 AC_DEFINE(MOZ_TRACEVIS)
7259 dnl ========================================================
7261 dnl ========================================================
7262 MOZ_ARG_ENABLE_BOOL(gctimer,
7263 [ --enable-gctimer Enable GC timer (default=no)],
7266 if test -n "$MOZ_GCTIMER"; then
7267 AC_DEFINE(MOZ_GCTIMER)
7270 dnl ========================================================
7272 dnl ========================================================
7273 MOZ_ARG_ENABLE_BOOL(valgrind,
7274 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
7277 if test -n "$MOZ_VALGRIND"; then
7278 AC_CHECK_HEADER([valgrind/valgrind.h], [],
7280 [--enable-valgrind specified but Valgrind is not installed]))
7281 AC_DEFINE(MOZ_VALGRIND)
7284 dnl ========================================================
7286 dnl ========================================================
7287 MOZ_ARG_ENABLE_BOOL(jprof,
7288 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof)],
7291 if test -n "$MOZ_JPROF"; then
7292 AC_DEFINE(MOZ_JPROF)
7295 dnl ========================================================
7297 dnl ========================================================
7298 MOZ_ARG_ENABLE_BOOL(shark,
7299 [ --enable-shark Enable shark remote profiling (needs CHUD framework)],
7302 if test -n "$MOZ_SHARK"; then
7303 AC_DEFINE(MOZ_SHARK)
7306 dnl ========================================================
7308 dnl ========================================================
7309 MOZ_ARG_ENABLE_BOOL(callgrind,
7310 [ --enable-callgrind Enable callgrind profiling],
7313 if test -n "$MOZ_CALLGRIND"; then
7314 AC_DEFINE(MOZ_CALLGRIND)
7317 dnl ========================================================
7319 dnl ========================================================
7320 MOZ_ARG_ENABLE_BOOL(vtune,
7321 [ --enable-vtune Enable vtune profiling],
7324 if test -n "$MOZ_VTUNE"; then
7325 AC_DEFINE(MOZ_VTUNE)
7328 dnl ========================================================
7329 dnl Zealous JavaScript GC
7330 dnl ========================================================
7331 MOZ_ARG_ENABLE_BOOL(gczeal,
7332 [ --enable-gczeal Enable zealous JavaScript GCing],
7335 if test -n "$JS_GC_ZEAL"; then
7336 AC_DEFINE(JS_GC_ZEAL)
7339 dnl ========================================================
7340 dnl = Enable static checking using gcc-dehydra
7341 dnl ========================================================
7343 MOZ_ARG_WITH_STRING(static-checking,
7344 [ --with-static-checking=path/to/gcc_dehydra.so
7345 Enable static checking of code using GCC-dehydra],
7346 DEHYDRA_PATH=$withval,
7349 if test -n "$DEHYDRA_PATH"; then
7350 if test ! -f "$DEHYDRA_PATH"; then
7351 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7353 AC_DEFINE(NS_STATIC_CHECKING)
7355 AC_SUBST(DEHYDRA_PATH)
7357 dnl ========================================================
7358 dnl = Enable stripping of libs & executables
7359 dnl ========================================================
7360 MOZ_ARG_ENABLE_BOOL(strip,
7361 [ --enable-strip Enable stripping of libs & executables ],
7365 dnl ========================================================
7366 dnl = Enable stripping of libs & executables when packaging
7367 dnl ========================================================
7368 MOZ_ARG_ENABLE_BOOL(install-strip,
7369 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
7373 dnl ========================================================
7374 dnl = --enable-elf-dynstr-gc
7375 dnl ========================================================
7376 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7377 [ --enable-elf-dynstr-gc Enable elf dynstr garbage collector (opt builds only)],
7378 USE_ELF_DYNSTR_GC=1,
7379 USE_ELF_DYNSTR_GC= )
7381 dnl ========================================================
7383 dnl = Profiling and Instrumenting
7385 dnl ========================================================
7386 MOZ_ARG_HEADER(Profiling and Instrumenting)
7388 dnl ========================================================
7389 dnl = Enable timeline service, which provides lightweight
7390 dnl = instrumentation of mozilla for performance measurement.
7391 dnl = Timeline is off by default.
7392 dnl ========================================================
7393 MOZ_ARG_ENABLE_BOOL(timeline,
7394 [ --enable-timeline Enable timeline services ],
7397 if test -n "$MOZ_TIMELINE"; then
7398 AC_DEFINE(MOZ_TIMELINE)
7401 dnl ========================================================
7402 dnl = Enable NS_FUNCTION_TIMER, which provides Function
7403 dnl = timing for identifying code bottlenecks
7404 dnl = NS_FUNCTION_TIMER is off by default.
7405 dnl ========================================================
7406 MOZ_ARG_ENABLE_BOOL(functiontimer,
7407 [ --enable-functiontimer Enable NS_FUNCTION_TIMER ],
7408 NS_FUNCTION_TIMER=1,
7409 NS_FUNCTION_TIMER= )
7410 if test -n "$NS_FUNCTION_TIMER"; then
7411 AC_DEFINE(NS_FUNCTION_TIMER)
7414 dnl ========================================================
7415 dnl Turn on reflow counting
7416 dnl ========================================================
7417 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7418 [ --enable-reflow-perf Enable reflow performance tracing],
7421 if test -n "$MOZ_REFLOW_PERF"; then
7422 AC_DEFINE(MOZ_REFLOW_PERF)
7425 dnl ========================================================
7426 dnl Enable code size metrics.
7427 dnl ========================================================
7428 MOZ_ARG_ENABLE_BOOL(codesighs,
7429 [ --enable-codesighs Enable code size analysis tools],
7430 _ENABLE_CODESIGHS=1,
7431 _ENABLE_CODESIGHS= )
7432 if test -n "$_ENABLE_CODESIGHS"; then
7433 if test -d $srcdir/tools/codesighs; then
7436 AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7440 dnl ========================================================
7441 dnl = Support for Quantify (Windows)
7442 dnl ========================================================
7443 MOZ_ARG_ENABLE_BOOL(quantify,
7444 [ --enable-quantify Enable Quantify support (Windows only) ],
7448 dnl ========================================================
7449 dnl = Support for demangling undefined symbols
7450 dnl ========================================================
7451 if test -z "$SKIP_LIBRARY_CHECKS"; then
7454 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7458 # Demangle only for debug or trace-malloc builds
7459 MOZ_DEMANGLE_SYMBOLS=
7460 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7461 MOZ_DEMANGLE_SYMBOLS=1
7462 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7464 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7466 dnl ========================================================
7467 dnl = Support for gcc stack unwinding (from gcc 3.3)
7468 dnl ========================================================
7469 if test "$HAVE_GCC3_ABI" && test -z "$SKIP_LIBRARY_CHECKS"; then
7470 AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7473 dnl ========================================================
7477 dnl ========================================================
7478 MOZ_ARG_HEADER(Misc. Options)
7480 dnl ========================================================
7481 dnl update xterm title
7482 dnl ========================================================
7483 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7484 [ --enable-xterm-updates Update XTERM titles with current command.],
7488 dnl =========================================================
7490 dnl =========================================================
7491 MOZ_ARG_ENABLE_STRING([chrome-format],
7492 [ --enable-chrome-format=jar|flat|both|symlink|omni
7493 Select FORMAT of chrome files (default=jar)],
7494 MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7496 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7497 MOZ_CHROME_FILE_FORMAT=jar
7500 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7501 test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7502 test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7503 test "$MOZ_CHROME_FILE_FORMAT" != "both" &&
7504 test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7505 AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, symlink, or omni])
7508 dnl =========================================================
7509 dnl Omnijar packaging (bug 552121)
7510 dnl =========================================================
7511 dnl Omnijar packaging is compatible with flat packaging.
7512 dnl In unpackaged builds, omnijar looks for files as if
7513 dnl things were flat packaged. After packaging, all files
7514 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7515 dnl is set to flat since putting files into jars is only
7516 dnl done during packaging with omnijar.
7517 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7519 AC_DEFINE(MOZ_OMNIJAR)
7520 MOZ_CHROME_FILE_FORMAT=flat
7521 elif test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7522 AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7525 AC_SUBST(MOZ_OMNIJAR)
7527 dnl ========================================================
7528 dnl = Define default location for MOZILLA_FIVE_HOME
7529 dnl ========================================================
7530 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7531 [ --with-default-mozilla-five-home
7532 Set the default value for MOZILLA_FIVE_HOME],
7533 [ val=`echo $withval`
7534 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7536 dnl ========================================================
7537 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7538 dnl ========================================================
7539 MOZ_ARG_WITH_STRING(user-appdir,
7540 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
7541 [ val=`echo $withval`
7542 if echo "$val" | grep "\/" >/dev/null; then
7543 AC_MSG_ERROR("Homedir must be single relative path.")
7548 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7550 dnl ========================================================
7551 dnl = Doxygen configuration
7552 dnl ========================================================
7553 dnl Use commas to specify multiple dirs to this arg
7554 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7555 MOZ_ARG_WITH_STRING(doc-input-dirs,
7556 [ --with-doc-input-dirs=DIRS
7557 Header/idl dirs to create docs from],
7558 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7559 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7561 dnl Use commas to specify multiple dirs to this arg
7562 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7563 MOZ_ARG_WITH_STRING(doc-include-dirs,
7564 [ --with-doc-include-dirs=DIRS
7565 Include dirs to preprocess doc headers],
7566 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7567 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7569 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7570 MOZ_ARG_WITH_STRING(doc-output-dir,
7571 [ --with-doc-output-dir=DIR
7572 Dir to generate docs into],
7573 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7574 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7576 if test -z "$SKIP_COMPILER_CHECKS"; then
7577 dnl ========================================================
7579 dnl = Compiler Options
7581 dnl ========================================================
7582 MOZ_ARG_HEADER(Compiler Options)
7584 dnl ========================================================
7585 dnl Check for gcc -pipe support
7586 dnl ========================================================
7587 AC_MSG_CHECKING([for gcc -pipe support])
7588 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then
7589 echo '#include <stdio.h>' > dummy-hello.c
7590 echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
7591 ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
7592 cat dummy-hello.s 2> /dev/null | ${AS_BIN} -o dummy-hello.S - 2>&5
7593 if test $? = 0; then
7598 if test "$_res_as_stdin" = "yes"; then
7599 _SAVE_CFLAGS=$CFLAGS
7600 CFLAGS="$CFLAGS -pipe"
7601 AC_TRY_COMPILE( [ #include <stdio.h> ],
7602 [printf("Hello World\n");],
7603 [_res_gcc_pipe="yes"],
7604 [_res_gcc_pipe="no"] )
7605 CFLAGS=$_SAVE_CFLAGS
7607 if test "$_res_as_stdin" = "yes" && test "$_res_gcc_pipe" = "yes"; then
7609 CFLAGS="$CFLAGS -pipe"
7610 CXXFLAGS="$CXXFLAGS -pipe"
7614 rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
7615 AC_MSG_RESULT([$_res])
7620 dnl ========================================================
7621 dnl Profile guided optimization
7622 dnl ========================================================
7623 dnl Test for profiling options
7624 dnl Under gcc 3.3, use -fprofile-arcs/-fbranch-probabilities
7625 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7627 dnl Provide a switch to disable PGO even when called via profiledbuild.
7628 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
7629 [ --disable-profile-guided-optimization
7630 Don't build with PGO even if called via make profiledbuild],
7631 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
7632 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
7634 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
7636 _SAVE_CFLAGS="$CFLAGS"
7637 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7639 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7640 AC_TRY_COMPILE([], [return 0;],
7641 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7642 result="yes" ], result="no")
7643 AC_MSG_RESULT([$result])
7645 if test $result = "yes"; then
7646 PROFILE_GEN_LDFLAGS="-fprofile-generate"
7647 PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch -freorder-blocks-and-partition"
7648 PROFILE_USE_LDFLAGS="-fprofile-use"
7650 CFLAGS="$_SAVE_CFLAGS -fprofile-arcs"
7651 AC_MSG_CHECKING([whether C compiler supports -fprofile-arcs])
7652 AC_TRY_COMPILE([], [return 0;],
7653 [ PROFILE_GEN_CFLAGS="-fprofile-arcs"
7654 result="yes" ], result="no")
7655 AC_MSG_RESULT([$result])
7656 if test $result = "yes"; then
7657 PROFILE_USE_CFLAGS="-fbranch-probabilities"
7659 # don't really care, this is an old GCC
7660 PROFILE_GEN_LDFLAGS=
7661 PROFILE_USE_LDFLAGS=
7664 CFLAGS="$_SAVE_CFLAGS"
7666 if test -n "$INTEL_CC"; then
7667 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7668 PROFILE_GEN_LDFLAGS=
7669 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7670 PROFILE_USE_LDFLAGS=
7673 dnl Sun Studio on Solaris
7674 if test "$SOLARIS_SUNPRO_CC"; then
7675 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7676 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7677 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7678 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7681 AC_SUBST(PROFILE_GEN_CFLAGS)
7682 AC_SUBST(PROFILE_GEN_LDFLAGS)
7683 AC_SUBST(PROFILE_USE_CFLAGS)
7684 AC_SUBST(PROFILE_USE_LDFLAGS)
7688 dnl ========================================================
7689 dnl Test for -pedantic bustage
7690 dnl ========================================================
7691 MOZ_ARG_DISABLE_BOOL(pedantic,
7692 [ --disable-pedantic Issue all warnings demanded by strict ANSI C ],
7694 if test "$_PEDANTIC"; then
7695 _SAVE_CXXFLAGS=$CXXFLAGS
7696 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
7697 AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7698 AC_TRY_COMPILE([$configure_static_assert_macros],
7699 [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7700 result="no", result="yes" )
7701 AC_MSG_RESULT([$result])
7702 CXXFLAGS="$_SAVE_CXXFLAGS"
7706 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
7707 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
7710 AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic. Reconfigure using --disable-pedantic. ])
7715 dnl ========================================================
7716 dnl Test for correct temporary object destruction order
7717 dnl ========================================================
7718 dnl We want to make sure the compiler follows the C++ spec here as
7719 dnl xpcom and the string classes depend on it (bug 235381).
7720 AC_MSG_CHECKING([for correct temporary object destruction order])
7721 AC_TRY_RUN([ class A {
7722 public: A(int& x) : mValue(x) {}
7724 operator char**() { return 0; }
7725 private: int& mValue;
7727 void func(char **arg) {}
7738 result="yes", result="no", result="maybe")
7739 AC_MSG_RESULT([$result])
7741 if test "$result" = "no"; then
7742 AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
7745 dnl ========================================================
7746 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7747 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7748 dnl raw pointers in nsCOMPtr.h. (VC++ has the same bug.)
7749 dnl ========================================================
7750 _SAVE_CXXFLAGS=$CXXFLAGS
7751 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7752 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7753 ac_nscap_nonconst_opeq_bug,
7762 template <class T, class U>
7763 int operator==(const Pointer<T>& rhs, U* lhs)
7765 return rhs.myPtr == lhs;
7768 template <class T, class U>
7769 int operator==(const Pointer<T>& rhs, const U* lhs)
7771 return rhs.myPtr == lhs;
7779 ac_nscap_nonconst_opeq_bug="no",
7780 ac_nscap_nonconst_opeq_bug="yes")])
7781 CXXFLAGS="$_SAVE_CXXFLAGS"
7783 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7784 AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7786 fi # SKIP_COMPILER_CHECKS
7788 dnl ========================================================
7790 dnl Should be smarter and check that the compiler does indeed have rtti
7791 dnl ========================================================
7793 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
7794 [ --enable-cpp-rtti Enable C++ RTTI ],
7795 [ _MOZ_USE_RTTI=1 ],
7798 if test "$_MOZ_USE_RTTI"; then
7799 _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
7801 _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
7804 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
7806 dnl ========================================================
7807 dnl C++ exceptions (g++/VC/irix6/Sun only - for now)
7808 dnl Should be smarter and check that the compiler does indeed have exceptions
7809 dnl ========================================================
7810 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
7811 [ --enable-cpp-exceptions Enable C++ exceptions ],
7812 [ _MOZ_CPP_EXCEPTIONS=1 ],
7813 [ _MOZ_CPP_EXCEPTIONS= ])
7815 if test "$_MOZ_CPP_EXCEPTIONS"; then
7816 _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
7817 AC_DEFINE(MOZ_CPP_EXCEPTIONS)
7819 _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
7822 AC_SUBST(_MOZ_EXCEPTIONS_FLAGS_ON)
7824 # Irix & OSF native compilers do not like exception declarations
7825 # when exceptions are disabled
7826 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
7827 AC_DEFINE(CPP_THROW_NEW, [])
7829 AC_DEFINE(CPP_THROW_NEW, [throw()])
7833 dnl ========================================================
7835 dnl = Build depencency options
7837 dnl ========================================================
7838 MOZ_ARG_HEADER(Build dependencies)
7840 dnl ========================================================
7841 dnl = Do not auto generate dependency info
7842 dnl ========================================================
7844 MOZ_ARG_DISABLE_BOOL(auto-deps,
7845 [ --disable-auto-deps Do not automatically generate dependency info],
7849 if test -n "$MOZ_AUTO_DEPS"; then
7850 dnl ========================================================
7851 dnl = Use mkdepend instead of $CC -MD for dependency generation
7852 dnl ========================================================
7854 MOZ_ARG_DISABLE_BOOL(md,
7855 [ --disable-md Do not use compiler-based dependencies ],
7858 [dnl Default is to turn on -MD if using GNU-compatible compilers
7859 if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
7862 dnl Default is to use -xM if using Sun Studio on Solaris
7863 if test "$SOLARIS_SUNPRO_CC"; then
7866 if test "$_cpp_md_flag"; then
7868 if test "$OS_ARCH" = "OpenVMS"; then
7869 _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
7871 _DEPEND_CFLAGS='$(filter-out %/.pp,-Wp,-MD,$(MDDEPDIR)/$(basename $(@F)).pp)'
7873 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7874 if test "$SOLARIS_SUNPRO_CC"; then
7879 dnl Don't override this for MSVC
7880 if test -z "$_WIN32_MSVC"; then
7881 _USE_CPP_INCLUDE_FLAG=
7882 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7883 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7888 AC_SUBST(MOZ_AUTO_DEPS)
7889 AC_SUBST(COMPILER_DEPEND)
7893 dnl ========================================================
7895 dnl = Static Build Options
7897 dnl ========================================================
7898 MOZ_ARG_HEADER(Static build options)
7900 MOZ_ARG_ENABLE_BOOL(static,
7901 [ --enable-static Enable building of internal static libs],
7902 BUILD_STATIC_LIBS=1,
7905 MOZ_ARG_ENABLE_BOOL(libxul,
7906 [ --enable-libxul Enable building of libxul],
7907 MOZ_ENABLE_LIBXUL=1,
7910 if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
7911 AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME. You probably want --enable-libxul.])
7914 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
7915 AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
7918 if test -n "$MOZ_IPC" -a -z "$MOZ_ENABLE_LIBXUL"; then
7919 AC_MSG_ERROR([--enable-ipc requires --enable-libxul])
7922 AC_SUBST(LIBXUL_LIBS)
7924 if test -n "$MOZ_ENABLE_LIBXUL"; then
7925 XPCOM_LIBS="$LIBXUL_LIBS"
7926 AC_DEFINE(MOZ_ENABLE_LIBXUL)
7928 if test -n "$BUILD_STATIC_LIBS"; then
7929 AC_DEFINE(MOZ_STATIC_BUILD)
7931 XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
7934 dnl ========================================================
7936 dnl = Standalone module options
7938 dnl ========================================================
7939 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7941 dnl Check for GLib and libIDL.
7942 dnl ========================================================
7943 case "$target_os" in
7944 msvc*|mks*|cygwin*|mingw*|wince*|winmo*)
7945 SKIP_IDL_CHECK="yes"
7952 if test -z "$COMPILE_ENVIRONMENT"; then
7953 SKIP_IDL_CHECK="yes"
7956 dnl = Allow users to disable libIDL checking for standalone modules
7957 MOZ_ARG_WITHOUT_BOOL(libIDL,
7958 [ --without-libIDL Skip check for libIDL (standalone modules only)],
7959 SKIP_IDL_CHECK="yes")
7961 if test "$SKIP_IDL_CHECK" = "no"
7964 if test "$MACOS_SDK_DIR"; then
7965 dnl xpidl, and therefore libIDL, is only needed on the build host.
7966 dnl Don't build it against the SDK, as that causes problems.
7967 _MACSAVE_CFLAGS="$CFLAGS"
7968 _MACSAVE_LIBS="$LIBS"
7969 _MACSAVE_LDFLAGS="$LDFLAGS"
7970 _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
7972 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"`
7973 LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
7974 LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
7979 if test "$MOZ_ENABLE_GTK2"; then
7980 PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
7982 dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
7983 dnl to either libIDL1 or libIDL2.
7984 if test -z "$_LIBIDL_FOUND"; then
7985 AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
7986 if test -z "$_LIBIDL_FOUND"; then
7987 PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
7991 dnl If we don't have a libIDL config program & not cross-compiling,
7992 dnl look for orbit-config instead.
7994 if test -z "$_LIBIDL_FOUND" && test -z "$CROSS_COMPILE"; then
7995 MOZ_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
7996 if test -n "$ORBIT_CONFIG"; then
7997 AC_MSG_CHECKING([for ORBit libIDL usability])
7998 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
7999 _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
8000 _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
8001 _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
8002 LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
8003 LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
8005 _SAVE_CFLAGS="$CFLAGS"
8007 CFLAGS="$LIBIDL_CFLAGS $CFLAGS"
8008 LIBS="$LIBIDL_LIBS $LIBS"
8011 #include <libIDL/IDL.h>
8014 s=strdup(IDL_get_libver_string());
8027 AC_MSG_RESULT($result)
8028 CFLAGS="$_SAVE_CFLAGS"
8032 if test -z "$_LIBIDL_FOUND"; then
8033 AC_MSG_ERROR([libIDL not found.
8034 libIDL $LIBIDL_VERSION or higher is required.])
8036 if test "$MACOS_SDK_DIR"; then
8037 CFLAGS="$_MACSAVE_CFLAGS"
8038 LIBS="$_MACSAVE_LIBS"
8039 LDFLAGS="$_MACSAVE_LDFLAGS"
8040 if test -n "$_MACSAVE_NEXT_ROOT" ; then
8041 export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
8046 if test -n "$CROSS_COMPILE"; then
8047 if test -z "$HOST_LIBIDL_CONFIG"; then
8048 HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
8050 if test -n "$HOST_LIBIDL_CONFIG" && test "$HOST_LIBIDL_CONFIG" != "no"; then
8051 HOST_LIBIDL_CFLAGS=`${HOST_LIBIDL_CONFIG} --cflags`
8052 HOST_LIBIDL_LIBS=`${HOST_LIBIDL_CONFIG} --libs`
8054 HOST_LIBIDL_CFLAGS="$LIBIDL_CFLAGS"
8055 HOST_LIBIDL_LIBS="$LIBIDL_LIBS"
8059 if test -z "$SKIP_PATH_CHECKS"; then
8060 if test -z "${GLIB_CFLAGS}" || test -z "${GLIB_LIBS}" ; then
8061 if test "$MOZ_ENABLE_GTK2" || test "$USE_ELF_DYNSTR_GC" ; then
8062 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
8064 AM_PATH_GLIB(${GLIB_VERSION})
8069 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
8070 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
8073 AC_SUBST(LIBIDL_CFLAGS)
8074 AC_SUBST(LIBIDL_LIBS)
8075 AC_SUBST(STATIC_LIBIDL)
8076 AC_SUBST(GLIB_CFLAGS)
8078 AC_SUBST(GLIB_GMODULE_LIBS)
8079 AC_SUBST(HOST_LIBIDL_CONFIG)
8080 AC_SUBST(HOST_LIBIDL_CFLAGS)
8081 AC_SUBST(HOST_LIBIDL_LIBS)
8083 dnl ========================================================
8085 dnl ========================================================
8086 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8089 MOZ_ARG_ENABLE_BOOL(system-cairo,
8090 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
8094 # Check for headers defining standard int types.
8095 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8097 if test "$MOZ_TREE_CAIRO"; then
8098 AC_DEFINE(MOZ_TREE_CAIRO)
8100 # For now we assume that we will have a uint64_t available through
8101 # one of the above headers or mozstdint.h.
8102 AC_DEFINE(HAVE_UINT64_T)
8104 # Define macros for cairo-features.h
8105 if test "$MOZ_X11"; then
8106 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8107 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8108 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8109 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
8110 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8111 MOZ_ENABLE_CAIRO_FT=1
8112 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8114 if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
8115 QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8117 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
8118 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8119 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8120 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8122 if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
8123 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8124 if test -z "$WINCE"; then
8125 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8126 if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8127 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8128 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8129 MOZ_ENABLE_D2D_SURFACE=1
8130 MOZ_ENABLE_DWRITE_FONT=1
8132 WIN32_DWRITE_FONT_FEATURE=
8133 WIN32_D2D_SURFACE_FEATURE=
8137 WIN32_DWRITE_FONT_FEATURE=
8138 WIN32_D2D_SURFACE_FEATURE=
8141 AC_TRY_COMPILE([#include <ddraw.h>], [int foo = DDLOCK_WAITNOTBUSY;], HAS_DDRAW=1, HAS_DDRAW=)
8142 if test -z "$HAS_DDRAW"; then
8143 AC_MSG_WARN([DirectDraw ddraw.h header not found or it's missing DDLOCK_WAITNOTBUSY, disabling DirectDraw surface. If you have an older SDK (such as the CE5 SDK), try copying in ddraw.lib and ddraw.h from the WM6 SDK.])
8144 DDRAW_SURFACE_FEATURE=
8146 DDRAW_SURFACE_FEATURE="#define CAIRO_HAS_DDRAW_SURFACE 1"
8149 if test -z "$OGLES_SDK_DIR"; then
8150 OGLES_SURFACE_FEATURE=
8153 #include <EGL/egl.h>
8154 #include <EGL/eglext.h>
8155 #include <GLES2/gl2.h>
8156 #include <GLES2/gl2ext.h>
8157 ], [ EGLDisplay _cairo_ddraw_egl_dpy = EGL_NO_DISPLAY;], HAS_OGLES=1, HAS_OGLES=)
8158 if test -z "$HAS_OGLES"; then
8159 AC_MSG_WARN([OpenGL ES2 headers not found, disabling OpenGL acceleration surfaces.])
8160 OGLES_SURFACE_FEATURE=
8162 OGLES_SURFACE_FEATURE="#define CAIRO_DDRAW_USE_GL 1"
8166 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
8168 if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
8169 OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
8170 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8171 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
8172 MOZ_ENABLE_CAIRO_FT=1
8173 CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8174 CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
8176 if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
8177 PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
8178 BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
8179 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8180 MOZ_ENABLE_CAIRO_FT=1
8182 if test "$USE_FC_FREETYPE"; then
8183 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8185 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8186 AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8187 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8188 AC_SUBST(CAIRO_FT_CFLAGS)
8191 if test "$MOZ_DEBUG"; then
8192 SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
8194 SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
8197 PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
8199 AC_SUBST(PS_SURFACE_FEATURE)
8200 AC_SUBST(PDF_SURFACE_FEATURE)
8201 AC_SUBST(SVG_SURFACE_FEATURE)
8202 AC_SUBST(XLIB_SURFACE_FEATURE)
8203 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8204 AC_SUBST(QUARTZ_SURFACE_FEATURE)
8205 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8206 AC_SUBST(XCB_SURFACE_FEATURE)
8207 AC_SUBST(WIN32_SURFACE_FEATURE)
8208 AC_SUBST(DDRAW_SURFACE_FEATURE)
8209 AC_SUBST(OGLES_SURFACE_FEATURE)
8210 AC_SUBST(OS2_SURFACE_FEATURE)
8211 AC_SUBST(BEOS_SURFACE_FEATURE)
8212 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8213 AC_SUBST(FT_FONT_FEATURE)
8214 AC_SUBST(FC_FONT_FEATURE)
8215 AC_SUBST(WIN32_FONT_FEATURE)
8216 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8217 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8218 AC_SUBST(QUARTZ_FONT_FEATURE)
8219 AC_SUBST(PNG_FUNCTIONS_FEATURE)
8220 AC_SUBST(QT_SURFACE_FEATURE)
8222 if test "$_WIN32_MSVC"; then
8223 MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib'
8225 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"
8227 if test "$MOZ_X11"; then
8228 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
8232 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8233 mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
8236 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION pixman-1 freetype2 fontconfig)
8237 MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
8238 MOZ_CAIRO_LIBS=$CAIRO_LIBS
8239 if test "$MOZ_X11"; then
8240 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8241 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8242 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8246 AC_SUBST(MOZ_TREE_CAIRO)
8247 AC_SUBST(MOZ_CAIRO_CFLAGS)
8248 AC_SUBST(MOZ_CAIRO_LIBS)
8251 dnl ========================================================
8253 QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
8256 dnl ========================================================
8258 dnl ========================================================
8259 MOZ_ARG_DISABLE_BOOL(xul,
8260 [ --disable-xul Disable XUL],
8262 if test "$MOZ_XUL"; then
8265 dnl remove extensions that require XUL
8266 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8271 dnl ========================================================
8272 dnl disable profile locking
8273 dnl do no use this in applications that can have more than
8274 dnl one process accessing the profile directory.
8275 dnl ========================================================
8276 MOZ_ARG_DISABLE_BOOL(profilelocking,
8277 [ --disable-profilelocking Disable profile locking],
8278 MOZ_PROFILELOCKING=,
8279 MOZ_PROFILELOCKING=1 )
8280 if test "$MOZ_PROFILELOCKING"; then
8281 AC_DEFINE(MOZ_PROFILELOCKING)
8284 dnl ========================================================
8285 dnl disable rdf services
8286 dnl ========================================================
8287 MOZ_ARG_DISABLE_BOOL(rdf,
8288 [ --disable-rdf Disable RDF],
8290 if test "$MOZ_RDF"; then
8296 dnl ========================================================
8297 dnl necko configuration options
8298 dnl ========================================================
8301 dnl option to disable various necko protocols
8303 MOZ_ARG_ENABLE_STRING(necko-protocols,
8304 [ --enable-necko-protocols[={http,ftp,default,all,none}]
8305 Enable/disable specific protocol handlers],
8306 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8307 if test "$option" = "yes" || test "$option" = "all"; then
8308 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8309 elif test "$option" = "no" || test "$option" = "none"; then
8311 elif test "$option" = "default"; then
8312 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8313 elif test `echo "$option" | grep -c \^-` != 0; then
8314 option=`echo $option | sed 's/^-//'`
8315 NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8317 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8320 NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8322 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8323 AC_SUBST(NECKO_PROTOCOLS)
8324 for p in $NECKO_PROTOCOLS; do
8325 AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8329 dnl option to disable necko's disk cache
8331 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
8332 [ --disable-necko-disk-cache
8333 Disable necko disk cache],
8336 AC_SUBST(NECKO_DISK_CACHE)
8337 if test "$NECKO_DISK_CACHE"; then
8338 AC_DEFINE(NECKO_DISK_CACHE)
8342 dnl option to disable necko's wifi scanner
8344 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8345 [ --disable-necko-wifi Disable necko wifi scanner],
8350 if test "$OS_ARCH" = "OS2"; then
8351 dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8354 if test "$NECKO_WIFI" -a \
8355 "$OS_ARCH" != "Linux" -a \
8356 "$OS_ARCH" != "Darwin" -a \
8357 "$OS_ARCH" != "SunOS" -a \
8358 "$OS_ARCH" != "WINNT" -a \
8359 "$OS_ARCH" != "WINCE"; then
8360 AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8363 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
8365 AC_CHECK_HEADER([iwlib.h])
8366 if test "$ac_cv_header_iwlib_h" != "yes"; then
8367 AC_MSG_ERROR([Can't find header iwlib.h for Necko WiFi scanning (might be in package libiw-dev (Ubuntu) or wireless-tools-devel (Fedora)); use --disable-necko-wifi to disable])
8371 if test "$NECKO_WIFI"; then
8372 AC_DEFINE(NECKO_WIFI)
8374 AC_SUBST(NECKO_WIFI)
8377 dnl option to disable cookies
8379 MOZ_ARG_DISABLE_BOOL(cookies,
8380 [ --disable-cookies Disable cookie support],
8383 AC_SUBST(NECKO_COOKIES)
8384 if test "$NECKO_COOKIES"; then
8385 AC_DEFINE(NECKO_COOKIES)
8389 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8391 MOZ_ARG_DISABLE_BOOL(ctypes,
8392 [ --disable-ctypes Disable js-ctypes],
8395 AC_SUBST(BUILD_CTYPES)
8396 if test "$BUILD_CTYPES"; then
8397 if test "$OS_ARCH" = "WINCE" -a `echo $OS_TEST | grep -ic arm` = 1; then
8398 # Disable ctypes for arm/wince.
8401 AC_DEFINE(BUILD_CTYPES)
8405 dnl NECKO_ configuration options are not global
8406 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
8408 dnl Only build Mork if it's required
8410 if test "$MOZ_MORK"; then
8414 dnl Build the lightweight Mork reader if required
8415 AC_SUBST(MOZ_MORKREADER)
8416 if test "$MOZ_MORKREADER"; then
8417 AC_DEFINE(MOZ_MORKREADER)
8420 dnl Build Places if required
8421 if test "$MOZ_PLACES"; then
8422 AC_DEFINE(MOZ_PLACES)
8425 dnl ========================================================
8426 if test "$MOZ_DEBUG" || test "$NS_TRACE_MALLOC"; then
8427 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8430 dnl ========================================================
8432 dnl = Maintainer debug option (no --enable equivalent)
8434 dnl ========================================================
8439 AC_SUBST(AR_EXTRACT)
8443 AC_SUBST(AS_DASH_C_FLAG)
8451 AC_SUBST(NS_USE_NATIVE)
8452 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8453 AC_SUBST(MOZ_UPDATE_XTERM)
8455 AC_SUBST(MOZ_PLATFORM_MAEMO)
8456 AC_SUBST(MOZ_AUTH_EXTENSION)
8457 AC_SUBST(MOZ_MATHML)
8458 AC_SUBST(MOZ_PERMISSIONS)
8460 AC_SUBST(MOZ_NO_INSPECTOR_APIS)
8461 AC_SUBST(MOZ_PREF_EXTENSIONS)
8464 AC_SUBST(MOZ_XSLT_STANDALONE)
8465 AC_SUBST(MOZ_JS_LIBS)
8468 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8469 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8470 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8471 AC_SUBST(MOZ_DEBUG_FLAGS)
8472 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8473 AC_SUBST(WARNINGS_AS_ERRORS)
8474 AC_SUBST(MOZ_EXTENSIONS)
8475 AC_SUBST(MOZ_IMG_DECODERS)
8476 AC_SUBST(MOZ_IMG_ENCODERS)
8477 AC_SUBST(MOZ_JSDEBUGGER)
8478 AC_SUBST(MOZ_PLUGINS)
8479 AC_SUBST(MOZ_LOG_REFCNT)
8483 AC_SUBST(MOZ_CALLGRIND)
8485 AC_SUBST(MOZ_JSLOADER)
8486 AC_SUBST(MOZ_USE_NATIVE_UCONV)
8487 AC_SUBST(MOZ_QUANTIFY)
8489 AC_SUBST(MOZ_PLACES)
8490 AC_SUBST(MOZ_PLACES_BOOKMARKS)
8491 AC_SUBST(MOZ_STORAGE)
8492 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8494 AC_SUBST(NS_PRINTING)
8496 AC_SUBST(MOZ_HELP_VIEWER)
8498 AC_SUBST(MOZ_JAVAXPCOM)
8499 AC_SUBST(JAVA_INCLUDE_PATH)
8504 AC_SUBST(MOZ_PROFILELOCKING)
8507 AC_SUBST(MOZ_XIE_LIBS)
8508 AC_SUBST(MOZ_ENABLE_POSTSCRIPT)
8510 AC_SUBST(BUILD_STATIC_LIBS)
8511 AC_SUBST(MOZ_ENABLE_LIBXUL)
8512 AC_SUBST(ENABLE_TESTS)
8514 AC_SUBST(MOZ_UNIVERSALCHARDET)
8515 AC_SUBST(ACCESSIBILITY)
8516 AC_SUBST(MOZ_VIEW_SOURCE)
8517 AC_SUBST(MOZ_SPELLCHECK)
8518 AC_SUBST(MOZ_USER_DIR)
8519 AC_SUBST(MOZ_CRASHREPORTER)
8521 AC_SUBST(ENABLE_STRIP)
8522 AC_SUBST(PKG_SKIP_STRIP)
8523 AC_SUBST(USE_ELF_DYNSTR_GC)
8524 AC_SUBST(INCREMENTAL_LINKER)
8525 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8526 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8528 AC_SUBST(MOZ_FIX_LINK_PATHS)
8529 AC_SUBST(XPCOM_LIBS)
8530 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8531 AC_SUBST(XPCOM_GLUE_LDOPTS)
8532 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8534 AC_SUBST(USE_DEPENDENT_LIBS)
8536 AC_SUBST(MOZ_BUILD_ROOT)
8537 AC_SUBST(MOZ_OS2_TOOLS)
8538 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
8540 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8541 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8542 AC_SUBST(MOZ_TIMELINE)
8543 AC_SUBST(OGLES_SDK_DIR)
8545 AC_SUBST(MOZ_APP_NAME)
8546 AC_SUBST(MOZ_APP_DISPLAYNAME)
8547 AC_SUBST(MOZ_APP_VERSION)
8548 AC_SUBST(MOZ_APP_UA_EXTRA)
8549 AC_SUBST(FIREFOX_VERSION)
8551 AC_SUBST(MOZ_PKG_SPECIAL)
8553 AC_SUBST(MOZILLA_OFFICIAL)
8556 AC_SUBST(MOZ_MAPINFO)
8557 AC_SUBST(MOZ_BROWSE_INFO)
8558 AC_SUBST(MOZ_TOOLS_DIR)
8559 AC_SUBST(CYGWIN_WRAPPER)
8561 AC_SUBST(WIN32_REDIST_DIR)
8565 AC_SUBST(WINCE_SDK_DIR)
8566 AC_SUBST(WINCE_WINDOWS_MOBILE)
8568 dnl Echo the CFLAGS to remove extra whitespace.
8575 $_MOZ_EXCEPTIONS_FLAGS \
8576 $_WARNINGS_CXXFLAGS \
8579 COMPILE_CFLAGS=`echo \
8584 COMPILE_CXXFLAGS=`echo \
8585 $_DEFINES_CXXFLAGS \
8589 AC_SUBST(SYSTEM_MAKEDEPEND)
8590 AC_SUBST(SYSTEM_LIBXUL)
8591 AC_SUBST(SYSTEM_JPEG)
8592 AC_SUBST(SYSTEM_PNG)
8593 AC_SUBST(SYSTEM_ZLIB)
8594 AC_SUBST(SYSTEM_BZ2)
8596 AC_SUBST(JPEG_CFLAGS)
8598 AC_SUBST(ZLIB_CFLAGS)
8600 AC_SUBST(BZ2_CFLAGS)
8602 AC_SUBST(PNG_CFLAGS)
8605 AC_SUBST(MOZ_JPEG_CFLAGS)
8606 AC_SUBST(MOZ_JPEG_LIBS)
8607 AC_SUBST(MOZ_ZLIB_CFLAGS)
8608 AC_SUBST(MOZ_ZLIB_LIBS)
8609 AC_SUBST(MOZ_BZ2_CFLAGS)
8610 AC_SUBST(MOZ_BZ2_LIBS)
8611 AC_SUBST(MOZ_PNG_CFLAGS)
8612 AC_SUBST(MOZ_PNG_LIBS)
8614 AC_SUBST(NSPR_CFLAGS)
8616 AC_SUBST(MOZ_NATIVE_NSPR)
8618 AC_SUBST(NSS_CFLAGS)
8620 AC_SUBST(NSS_DEP_LIBS)
8621 AC_SUBST(MOZ_NATIVE_NSS)
8622 AC_SUBST(NSS_DISABLE_DBM)
8627 AC_SUBST(COMPILE_CFLAGS)
8628 AC_SUBST(COMPILE_CXXFLAGS)
8631 AC_SUBST(CROSS_COMPILE)
8632 AC_SUBST(WCHAR_CFLAGS)
8636 AC_SUBST(HOST_CFLAGS)
8637 AC_SUBST(HOST_CXXFLAGS)
8638 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8640 AC_SUBST(HOST_AR_FLAGS)
8642 AC_SUBST(HOST_RANLIB)
8643 AC_SUBST(HOST_NSPR_MDCPUCFG)
8644 AC_SUBST(HOST_BIN_SUFFIX)
8645 AC_SUBST(HOST_OS_ARCH)
8647 AC_SUBST(TARGET_CPU)
8648 AC_SUBST(TARGET_VENDOR)
8650 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8651 AC_SUBST(TARGET_MD_ARCH)
8652 AC_SUBST(TARGET_XPCOM_ABI)
8655 AC_SUBST(OS_RELEASE)
8658 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
8659 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8661 AC_SUBST(WRAP_MALLOC_CFLAGS)
8662 AC_SUBST(WRAP_MALLOC_LIB)
8665 AC_SUBST(MKSHLIB_FORCE_ALL)
8666 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8667 AC_SUBST(DSO_CFLAGS)
8668 AC_SUBST(DSO_PIC_CFLAGS)
8669 AC_SUBST(DSO_LDOPTS)
8670 AC_SUBST(LIB_PREFIX)
8671 AC_SUBST(DLL_PREFIX)
8672 AC_SUBST(DLL_SUFFIX)
8673 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8674 AC_SUBST(LIB_SUFFIX)
8675 AC_SUBST(OBJ_SUFFIX)
8676 AC_SUBST(BIN_SUFFIX)
8677 AC_SUBST(ASM_SUFFIX)
8678 AC_SUBST(IMPORT_LIB_SUFFIX)
8680 AC_SUBST(CC_VERSION)
8681 AC_SUBST(CXX_VERSION)
8682 AC_SUBST(MSMANIFEST_TOOL)
8683 AC_SUBST(NS_ENABLE_TSF)
8684 AC_SUBST(MOZ_NSS_PATCH)
8686 if test "$USING_HCC"; then
8687 CC='${topsrcdir}/build/hcc'
8689 CXX='${topsrcdir}/build/hcpp'
8690 CXX="$CXX '$_OLDCXX'"
8695 dnl Check for missing components
8696 if test "$COMPILE_ENVIRONMENT"; then
8697 if test "$MOZ_X11"; then
8698 dnl ====================================================
8699 dnl = Check if X headers exist
8700 dnl ====================================================
8701 _SAVE_CFLAGS=$CFLAGS
8702 CFLAGS="$CFLAGS $XCFLAGS"
8706 #include <X11/Xlib.h>
8707 #include <X11/Intrinsic.h>
8711 if ((dpy = XOpenDisplay(NULL)) == NULL) {
8712 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8716 [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8717 CFLAGS="$_SAVE_CFLAGS"
8719 if test ! -z "$MISSING_X"; then
8720 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8725 dnl Check for headers, etc. needed by WebGL.
8726 if test -n "$MOZ_WEBGL_GLX"; then
8727 AC_CHECK_HEADER(GL/glx.h)
8728 if test "$ac_cv_header_GL_glx_h" != "yes"; then
8729 AC_MSG_ERROR([Can't find header GL/glx.h for WebGL (install mesa-common-dev (Ubuntu), mesa-libGL-devel (Fedora), or Mesa (SuSE))])
8732 fi # COMPILE_ENVIRONMENT
8734 if test "$USE_FC_FREETYPE"; then
8735 if test "$COMPILE_ENVIRONMENT"; then
8736 _SAVE_CPPFLAGS="$CPPFLAGS"
8737 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
8738 AC_CHECK_HEADERS(fontconfig/fcfreetype.h, ,
8739 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)])
8740 CPPFLAGS="$_SAVE_CPPFLAGS"
8742 AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
8746 dnl Set various defines and substitutions
8747 dnl ========================================================
8749 if test "$OS_ARCH" = "BeOS"; then
8751 elif test "$OS_ARCH" = "Darwin"; then
8753 AC_DEFINE(UNIX_ASYNC_DNS)
8754 elif test "$OS_ARCH" = "OpenVMS"; then
8756 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
8758 AC_DEFINE(UNIX_ASYNC_DNS)
8761 if test "$MOZ_DEBUG"; then
8762 AC_DEFINE(MOZ_REFLOW_PERF)
8763 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8766 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8767 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8768 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8769 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8770 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8771 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8772 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8773 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8774 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8777 dnl ========================================================
8778 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
8779 dnl ========================================================
8782 WIN_TOP_SRC=`cd $srcdir; pwd -W`
8785 HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
8786 HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
8787 CC="\$(CYGWIN_WRAPPER) $CC"
8788 CXX="\$(CYGWIN_WRAPPER) $CXX"
8789 CPP="\$(CYGWIN_WRAPPER) $CPP"
8790 LD="\$(CYGWIN_WRAPPER) $LD"
8791 AS="\$(CYGWIN_WRAPPER) $AS"
8792 RC="\$(CYGWIN_WRAPPER) $RC"
8793 MIDL="\$(CYGWIN_WRAPPER) $MIDL"
8794 CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
8795 WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
8799 AC_SUBST(CYGDRIVE_MOUNT)
8800 AC_SUBST(WIN_TOP_SRC)
8802 AC_SUBST(MOZILLA_VERSION)
8804 AC_SUBST(ac_configure_args)
8806 dnl Spit out some output
8807 dnl ========================================================
8809 dnl The following defines are used by xpcom
8810 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8812 HAVE_CPP_2BYTE_WCHAR_T
8813 HAVE_CPP_ACCESS_CHANGING_USING
8814 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8817 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8819 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
8820 HAVE_CPP_NAMESPACE_STD
8822 HAVE_CPP_PARTIAL_SPECIALIZATION
8823 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8825 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
8827 NEED_CPP_UNUSED_IMPLEMENTATIONS
8831 HAVE_ICONV_WITH_CONST_INPUT
8839 netwerk/necko-config.h
8840 xpcom/xpcom-config.h
8841 xpcom/xpcom-private.h
8844 # Save the defines header file before autoconf removes it.
8845 # (Do not add AC_DEFINE calls after this line.)
8846 _CONFIG_TMP=confdefs-tmp.h
8847 _CONFIG_DEFS_H=mozilla-config.h
8849 cat > $_CONFIG_TMP <<\EOF
8850 /* List of defines generated by configure. Included with preprocessor flag,
8851 * -include, to avoid long list of -D defines on the compile command-line.
8855 #ifndef _MOZILLA_CONFIG_H_
8856 #define _MOZILLA_CONFIG_H_
8859 _EGREP_PATTERN='^#define ('
8860 if test -n "$_NON_GLOBAL_ACDEFINES"; then
8861 for f in $_NON_GLOBAL_ACDEFINES; do
8862 _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
8865 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
8867 sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
8869 cat >> $_CONFIG_TMP <<\EOF
8871 #endif /* _MOZILLA_CONFIG_H_ */
8875 # Only write mozilla-config.h when something changes (or it doesn't exist)
8876 if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
8879 AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
8880 mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
8882 echo ==== $_CONFIG_DEFS_H =================================
8886 dnl Probably shouldn't call this manually but we always want the output of DEFS
8887 rm -f confdefs.h.save
8888 mv confdefs.h confdefs.h.save
8889 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
8890 AC_OUTPUT_MAKE_DEFS()
8892 AC_SUBST(MOZ_DEFINES)
8894 mv confdefs.h.save confdefs.h
8896 dnl Load the list of Makefiles to generate.
8897 dnl To add new Makefiles, edit allmakefiles.sh.
8898 dnl allmakefiles.sh sets the variable, MAKEFILES.
8899 . ${srcdir}/allmakefiles.sh
8901 dnl Run a perl script to quickly create the makefiles.
8902 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
8903 dnl for the files it cannot handle correctly. This way, config.status
8904 dnl will handle these files.
8905 dnl If it fails, nothing is set and config.status will run as usual.
8907 dnl This does not change the $MAKEFILES variable.
8909 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
8911 if test -z "${AS_PERL}"; then
8912 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
8914 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
8919 echo $MAKEFILES > unallmakefiles
8921 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
8923 AC_OUTPUT($MAKEFILES)
8925 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
8926 if test "$CAIRO_FEATURES_H"; then
8927 if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
8928 echo "$CAIRO_FEATURES_H is unchanged"
8929 mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
8931 rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
8935 dnl ========================================================
8936 dnl = Setup a nice relatively clean build environment for
8937 dnl = sub-configures.
8938 dnl ========================================================
8941 CFLAGS="$_SUBDIR_CFLAGS"
8942 CPPFLAGS="$_SUBDIR_CPPFLAGS"
8943 CXXFLAGS="$_SUBDIR_CXXFLAGS"
8944 LDFLAGS="$_SUBDIR_LDFLAGS"
8945 HOST_CC="$_SUBDIR_HOST_CC"
8946 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8947 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
8953 # No need to run subconfigures when building with LIBXUL_SDK_DIR
8954 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
8956 if test -z "$MOZ_NATIVE_NSPR"; then
8957 ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
8958 if test -z "$MOZ_DEBUG"; then
8959 ac_configure_args="$ac_configure_args --disable-debug"
8961 if test "$MOZ_OPTIMIZE" = "1"; then
8962 ac_configure_args="$ac_configure_args --enable-optimize"
8964 if test "$OS_ARCH" = "WINNT" && test "$NS_TRACE_MALLOC"; then
8965 ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
8967 if test -n "$HAVE_64BIT_OS"; then
8968 ac_configure_args="$ac_configure_args --enable-64bit"
8970 if test -n "$USE_ARM_KUSER"; then
8971 ac_configure_args="$ac_configure_args --with-arm-kuser"
8973 AC_OUTPUT_SUBDIRS(nsprpub)
8974 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8977 if test -z "$MOZ_NATIVE_NSPR"; then
8978 # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
8979 AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
8980 if test "$OS_ARCH" != "WINNT" && test "$OS_ARCH" != "WINCE"; then
8981 NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
8982 $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
8983 NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
8984 $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
8986 rm -f config/autoconf.mk.bak
8989 # Run the SpiderMonkey 'configure' script.
8990 dist=$MOZ_BUILD_ROOT/dist
8991 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8992 ac_configure_args="$ac_configure_args --enable-threadsafe"
8993 if test "$BUILD_CTYPES"; then
8994 # Build js-ctypes on the platforms we can.
8995 ac_configure_args="$ac_configure_args --enable-ctypes"
8997 if test -z "$MOZ_NATIVE_NSPR"; then
8998 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
8999 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9001 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9002 ac_configure_args="$ac_configure_args --prefix=$dist"
9003 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
9004 if test "$MOZ_MEMORY"; then
9005 ac_configure_args="$ac_configure_args --enable-jemalloc"
9006 if test -n "$MOZ_MEMORY_LDFLAGS"; then
9007 export MOZ_MEMORY_LDFLAGS
9010 AC_OUTPUT_SUBDIRS(js/src)
9011 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9013 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
9015 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
9016 dnl Needs to be at the end to respect possible changes from NSPR configure
9017 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
9018 echo "config/autoconf.mk is unchanged"
9019 mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
9021 rm -f config/autoconf.mk.orig 2> /dev/null