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}"
73 MOZ_DEB_TIMESTAMP=`date +"%a, %d %b %Y %T %z" 2>&1`
74 AC_SUBST(MOZ_DEB_TIMESTAMP)
76 dnl ========================================================
78 dnl = Don't change the following two lines. Doing so breaks:
80 dnl = CFLAGS="-foo" ./configure
82 dnl ========================================================
84 CPPFLAGS="${CPPFLAGS=}"
85 CXXFLAGS="${CXXFLAGS=}"
87 HOST_CFLAGS="${HOST_CFLAGS=}"
88 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
89 HOST_LDFLAGS="${HOST_LDFLAGS=}"
91 dnl ========================================================
92 dnl = Preserve certain environment flags passed to configure
93 dnl = We want sub projects to receive the same flags
94 dnl = untainted by this configure script
95 dnl ========================================================
98 _SUBDIR_CFLAGS="$CFLAGS"
99 _SUBDIR_CPPFLAGS="$CPPFLAGS"
100 _SUBDIR_CXXFLAGS="$CXXFLAGS"
101 _SUBDIR_LDFLAGS="$LDFLAGS"
102 _SUBDIR_HOST_CC="$HOST_CC"
103 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
104 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
105 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
106 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
108 dnl Set the version number of the libs included with mozilla
109 dnl ========================================================
116 dnl Set the minimum version of toolkit libs used by mozilla
117 dnl ========================================================
125 WINDRES_VERSION=2.14.90
128 GNOMEUI_VERSION=2.2.0
131 STARTUP_NOTIFICATION_VERSION=0.8
134 LIBNOTIFY_VERSION=0.4
138 dnl Set various checks
139 dnl ========================================================
143 dnl Initialize the Pthread test variables early so they can be
144 dnl overridden by each platform.
145 dnl ========================================================
149 dnl Do not allow a separate objdir build if a srcdir build exists.
150 dnl ==============================================================
151 _topsrcdir=`cd \`dirname $0\`; pwd`
154 if test "$_topsrcdir" != "$_objdir"
156 # Check for a couple representative files in the source tree
158 for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
159 if test -f $file; then
160 _conflict_files="$_conflict_files $file"
163 if test "$_conflict_files"; then
165 echo "* Your source tree contains these files:"
166 for file in $_conflict_files; do
170 * This indicates that you previously built in the source tree.
171 * A source tree build can confuse the separate objdir build.
173 * To clean up the source tree:
184 dnl Default to MSVC for win32 and gcc-4.2 for darwin
185 dnl ==============================================================
186 if test -z "$CROSS_COMPILE"; then
188 *-cygwin*|*-mingw*|*-msvc*|*-mks*)
189 if test -z "$CC"; then CC=cl; fi
190 if test -z "$CXX"; then CXX=cl; fi
191 if test -z "$CPP"; then CPP="cl -E -nologo"; fi
192 if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
193 if test -z "$LD"; then LD=link; fi
194 if test -z "$AS"; then
195 case "${target_cpu}" in
204 if test -z "$MIDL"; then MIDL=midl; fi
207 if test -z "$CC"; then CC=gcc-4.2; fi
208 if test -z "$CXX"; then CXX=g++-4.2; fi
213 COMPILE_ENVIRONMENT=1
214 MOZ_ARG_DISABLE_BOOL(compile-environment,
215 [ --disable-compile-environment
216 Disable compiler/library checks.],
217 COMPILE_ENVIRONMENT= )
218 AC_SUBST(COMPILE_ENVIRONMENT)
220 MOZ_ARG_WITH_STRING(l10n-base,
221 [ --with-l10n-base=DIR path to l10n repositories],
222 L10NBASEDIR=$withval)
223 if test ! -z "$L10NBASEDIR"; then
224 if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
225 AC_MSG_ERROR([--with-l10n-base must specify a path])
226 elif test -d "$L10NBASEDIR"; then
227 L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
229 AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
232 AC_SUBST(L10NBASEDIR)
234 dnl Check for Perl first -- needed for win32 SDK checks
235 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
236 if test -z "$PERL" -o "$PERL" = ":"; then
237 AC_MSG_ERROR([perl not found in \$PATH])
240 dnl ========================================================
241 dnl = Android uses a very custom (hacky) toolchain; we need to do this
242 dnl = here, so that the compiler checks can succeed
243 dnl ========================================================
245 MOZ_ARG_WITH_STRING(android-ndk,
246 [ --with-android-ndk=DIR
247 location where the Android NDK can be found],
248 android_ndk=$withval)
250 MOZ_ARG_WITH_STRING(android-toolchain,
251 [ --with-android-toolchain=DIR
252 location of the android toolchain, default NDK/build/prebuilt/HOST/arm-eabi-4.4.0],
253 android_toolchain=$withval)
256 MOZ_ARG_WITH_STRING(android-version,
257 [ --with-android-version=VER
258 android platform version, default 5],
259 android_version=$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 if test "$target" = "arm-android-eabi" ; then
268 if test -z "$android_ndk" ; then
269 AC_MSG_ERROR([You must specify --with-android-ndk=/path/to/ndk when targeting Android.])
272 if test -z "$android_sdk" ; then
273 AC_MSG_ERROR([You must specify --with-android-sdk=/path/to/sdk when targeting Android.])
276 android_platform_tools="$android_sdk"/../../platform-tools
277 if test ! -d "$android_platform_tools" ; then
278 android_platform_tools="$android_sdk"/tools # SDK Tools < r8
281 if test -z "$android_toolchain" ; then
282 android_toolchain="$android_ndk"/build/prebuilt/`uname -s | tr "[[:upper:]]" "[[:lower:]]"`-x86/arm-eabi-4.4.0
285 if test -z "$android_platform" ; then
286 android_platform="$android_ndk"/build/platforms/android-"$android_version"/arch-"$target_cpu"
290 AS="$android_toolchain"/bin/arm-eabi-as
291 CC="$android_toolchain"/bin/arm-eabi-gcc
292 CXX="$android_toolchain"/bin/arm-eabi-g++
293 CPP="$android_toolchain"/bin/arm-eabi-cpp
294 LD="$android_toolchain"/bin/arm-eabi-ld
295 AR="$android_toolchain"/bin/arm-eabi-ar
296 RANLIB="$android_toolchain"/bin/arm-eabi-ranlib
297 STRIP="$android_toolchain"/bin/arm-eabi-strip
299 CPPFLAGS="-I$android_platform/usr/include $CPPFLAGS"
300 CFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions $CFLAGS"
301 CXXFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions $CXXFLAGS"
303 dnl Add -llog by default, since we use it all over the place.
304 dnl Add --allow-shlib-undefined, because libGLESv2 links to an
305 dnl undefined symbol (present on the hardware, just not in the
307 LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform -llog -Wl,--allow-shlib-undefined $LDFLAGS"
309 dnl prevent cross compile section from using these flags as host flags
310 if test -z "$HOST_CPPFLAGS" ; then
313 if test -z "$HOST_CFLAGS" ; then
316 if test -z "$HOST_CXXFLAGS" ; then
319 if test -z "$HOST_LDFLAGS" ; then
323 ANDROID_NDK="${android_ndk}"
324 ANDROID_TOOLCHAIN="{android_toolchain}"
325 ANDROID_PLATFORM="{android_platform}"
326 ANDROID_SDK="${android_sdk}"
327 ANDROID_PLATFORM_TOOLS="${android_platform_tools}"
328 ANDROID_VERSION="${android_version}"
331 AC_DEFINE_UNQUOTED(ANDROID_VERSION, $android_version)
332 AC_SUBST(ANDROID_VERSION)
334 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_PLATFORM_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" -a "$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.])
652 if test "$_CC_MAJOR_VERSION" = "14"; then
653 dnl Require VC8SP1 or newer.
654 dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762.
655 if test "$_CC_RELEASE" -lt 50727 -o \
656 \( "$_CC_RELEASE" -eq 50727 -a "$_CC_BUILD" -lt 762 \); then
657 AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. You probably need to install Service Pack 1 of Visual Studio 2005. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
661 CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
662 AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
663 AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
664 elif test "$_CC_MAJOR_VERSION" = "15"; then
666 CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
667 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
668 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
669 elif test "$_CC_MAJOR_VERSION" = "16"; then
671 CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
672 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
673 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
675 AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
678 _MOZ_RTTI_FLAGS_ON='-GR'
679 _MOZ_RTTI_FLAGS_OFF='-GR-'
680 _MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
681 _MOZ_EXCEPTIONS_FLAGS_OFF=''
683 if test -n "$WIN32_REDIST_DIR"; then
684 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
687 dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
688 dnl not something else like "magnetic tape manipulation utility".
689 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
690 if test -z "$MSMT_TOOL"; then
691 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
695 _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
697 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
698 if test -z "$MSMANIFEST_TOOL_VERSION"; then
699 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
705 # Check linker version
706 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
707 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
708 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
709 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
715 _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
716 _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
717 _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
718 _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
719 # Add flags if necessary
720 AC_MSG_CHECKING([for midl flags])
723 if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
724 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
725 # MIDL version 7.00.0500 or later has no problem.
726 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
727 AC_MSG_RESULT([need -env win32])
729 AC_MSG_RESULT([none needed])
733 MIDL_FLAGS="${MIDL_FLAGS} -env x64"
736 AC_MSG_RESULT([none needed])
740 # Identify which version of the SDK we're building with
741 # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
743 AC_CHECK_HEADERS([winsdkver.h])
744 if test "$ac_cv_header_winsdkver_h" = "yes"; then
745 # Get the highest _WIN32_WINNT and NTDDI versions supported
746 # Take the higher of the two
747 # This is done because the Windows 7 beta SDK reports its
748 # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
749 AC_CACHE_CHECK(for highest Windows version supported by this SDK,
751 [cat > conftest.h <<EOF
752 #include <winsdkver.h>
753 #include <sdkddkver.h>
755 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
756 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
758 #define WINSDK_MAXVER NTDDI_MAXVER
763 ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
766 MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
768 # The Vista SDK is the only one to have sdkddkver.h but not
770 AC_CHECK_HEADERS([sdkddkver.h])
771 if test "$ac_cv_header_sdkddkver_h" = "yes"; then
772 MOZ_WINSDK_MAXVER=0x06000000
774 # Assume the Server 2003 Platform SDK
775 MOZ_WINSDK_MAXVER=0x05020000
779 unset _MSVC_VER_FILTER
781 AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
785 _SAVE_CXXFLAGS="$CXXFLAGS"
786 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
787 AC_TRY_COMPILE([#include <exception>],
788 [std::_Throw(std::exception()); return 0;],
789 ac_cv_have_std__Throw="yes",
790 ac_cv_have_std__Throw="no")
791 CXXFLAGS="$_SAVE_CXXFLAGS"
795 if test "$ac_cv_have_std__Throw" = "yes"; then
796 AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
797 ac_cv_have_dllimport_exception_bug,
801 _SAVE_CXXFLAGS="$CXXFLAGS"
802 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
803 AC_TRY_LINK([#include <vector>],
804 [std::vector<int> v; return v.at(1);],
805 ac_cv_have_dllimport_exception_bug="no",
806 ac_cv_have_dllimport_exception_bug="yes")
807 CXXFLAGS="$_SAVE_CXXFLAGS"
810 if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
812 MOZ_MSVC_STL_WRAP__Throw=1
813 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
816 AC_CACHE_CHECK(for overridable _RAISE,
821 _SAVE_CXXFLAGS="$CXXFLAGS"
822 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
823 AC_TRY_COMPILE([#include <xstddef>
825 #define _RAISE(x) externallyDefinedFunction((x).what())
828 [std::vector<int> v; return v.at(1);],
829 ac_cv_have__RAISE="no",
830 ac_cv_have__RAISE="yes")
831 CXXFLAGS="$_SAVE_CXXFLAGS"
834 if test "$ac_cv_have__RAISE" = "yes"; then
836 MOZ_MSVC_STL_WRAP__RAISE=1
837 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
839 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.])
843 if test "$WRAP_STL_INCLUDES" = "1"; then
844 STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
847 # Check w32api version
848 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
849 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
850 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
851 AC_TRY_COMPILE([#include <w32api.h>],
852 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
853 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
854 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
855 #error "test failed."
857 , [ res=yes ], [ res=no ])
858 AC_MSG_RESULT([$res])
859 if test "$res" != "yes"; then
860 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
862 # Check windres version
863 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
864 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
865 AC_MSG_RESULT([$_WINDRES_VERSION])
866 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
867 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
868 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
869 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
870 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
871 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
872 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
873 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
874 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
875 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
876 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
877 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
879 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
882 # Server 2003 is the highest version supported
883 MOZ_WINSDK_MAXVER=0x05020000
886 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
887 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
888 # Require OS features provided by IE 5.0
889 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
891 # If the maximum version supported by this SDK is lower than the target
893 AC_MSG_CHECKING([for Windows SDK being recent enough])
894 if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
898 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. Alternatively, try running the Windows SDK Configuration Tool and selecting a newer SDK. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
901 AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
902 # Definitions matching sdkddkver.h
903 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WS03, 0x05020000)
904 AC_DEFINE_UNQUOTED(MOZ_NTDDI_LONGHORN, 0x06000000)
905 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
909 dnl Test breaks icc on OS/2 && MSVC
910 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
912 if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
916 CC="${srcdir}/build/hcc '$CC'"
917 CXX="${srcdir}/build/hcpp '$CXX'"
924 if test -n "$_WIN32_MSVC"; then
926 SKIP_COMPILER_CHECKS=1
927 SKIP_LIBRARY_CHECKS=1
929 # Since we're skipping compiler and library checks, hard-code
936 AC_DEFINE(HAVE_SETBUF)
937 AC_DEFINE(HAVE_ISATTY)
942 fi # COMPILE_ENVIRONMENT
955 AC_SUBST(WRAP_STL_INCLUDES)
956 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
957 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
959 dnl ========================================================
960 dnl Checks for programs.
961 dnl ========================================================
965 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
966 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
967 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
969 AC_MSG_RESULT([$_perl_version])
971 if test "$_perl_res" != 0; then
972 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
976 AC_MSG_CHECKING([for full perl installation])
977 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
979 if test "$_perl_res" != 0; then
981 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
986 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.7 python2.6 python2.5 python)
987 if test -z "$PYTHON"; then
988 AC_MSG_ERROR([python was not found in \$PATH])
991 if test -z "$COMPILE_ENVIRONMENT"; then
992 NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
994 AC_SUBST(NSINSTALL_BIN)
996 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
997 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
998 MOZ_PATH_PROG(UNZIP, unzip, :)
999 MOZ_PATH_PROGS(ZIP, zip)
1000 if test -z "$ZIP" -o "$ZIP" = ":"; then
1001 AC_MSG_ERROR([zip not found in \$PATH])
1003 MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
1004 MOZ_PATH_PROG(XARGS, xargs)
1005 if test -z "$XARGS" -o "$XARGS" = ":"; then
1006 AC_MSG_ERROR([xargs not found in \$PATH .])
1009 if test "$COMPILE_ENVIRONMENT"; then
1011 dnl ========================================================
1012 dnl = Mac OS X toolchain support
1013 dnl ========================================================
1015 case "$target_os" in
1017 dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
1018 dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
1019 dnl the environment and includedir purposes (when using an SDK, below),
1020 dnl but remember the full version number for the libdir (SDK).
1022 GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
1023 GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
1025 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1026 dnl Bug 280479, but this keeps popping up in bug 292530 too because
1027 dnl 4.0.0/4061 is the default compiler in Tiger.
1029 GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
1031 if test "$GCC_BUILD" = "4061" ; then
1032 AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
1033 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
1034 from building Mozilla. Upgrade to Xcode 2.1 or later.])
1038 dnl xcodebuild needs GCC_VERSION defined in the environment, since it
1039 dnl doesn't respect the CC/CXX setting. With GCC_VERSION set, it will use
1040 dnl /usr/bin/g(cc|++)-$GCC_VERSION.
1041 MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
1046 XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
1048 if test -n "$XCODEBUILD_VERSION" && test "$XCODEBUILD_VERSION" -ge 620 ; then
1054 dnl sdp was formerly in /Developer/Tools. As of Mac OS X 10.4 (Darwin 8),
1055 dnl it has moved into /usr/bin.
1056 MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
1060 AC_SUBST(GCC_VERSION)
1061 AC_SUBST(XCODEBUILD_VERSION)
1062 AC_SUBST(HAS_XCODE_2_1)
1064 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
1065 dnl that a universal binary is being produced.
1066 AC_SUBST(UNIVERSAL_BINARY)
1068 dnl ========================================================
1069 dnl Check for MacOS deployment target version
1070 dnl ========================================================
1072 MOZ_ARG_ENABLE_STRING(macos-target,
1073 [ --enable-macos-target=VER (default=10.5)
1074 Set the minimum MacOS version needed at runtime],
1075 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
1079 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
1080 dnl Use the specified value
1081 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
1082 AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
1084 dnl No value specified on the command line or in the environment,
1085 dnl use architecture minimum.
1086 case "${target_cpu}" in
1088 export MACOSX_DEPLOYMENT_TARGET=10.5
1091 export MACOSX_DEPLOYMENT_TARGET=10.5
1094 export MACOSX_DEPLOYMENT_TARGET=10.6
1101 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
1103 dnl ========================================================
1104 dnl = Mac OS X SDK support
1105 dnl ========================================================
1108 MOZ_ARG_WITH_STRING(macos-sdk,
1109 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
1110 MACOS_SDK_DIR=$withval)
1112 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
1113 dnl NEXT_ROOT will be set and exported only if it's needed.
1114 AC_SUBST(MACOS_SDK_DIR)
1117 if test "$MACOS_SDK_DIR"; then
1118 dnl Sync this section with the ones in NSPR and NSS.
1119 dnl Changes to the cross environment here need to be accounted for in
1120 dnl the libIDL checks (below) and xpidl build.
1122 if test ! -d "$MACOS_SDK_DIR"; then
1123 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
1124 specify a valid SDK. SDKs are installed when the optional cross-development
1125 tools are selected during the Xcode/Developer Tools installation.])
1128 GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
1129 if test "$GCC_VERSION_MAJOR" -lt "4" ; then
1130 AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
1132 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
1133 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
1135 dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
1136 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
1137 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
1139 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1140 dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
1141 dnl that supports -syslibroot. Don't set NEXT_ROOT because it will
1142 dnl be ignored and cause warnings when -syslibroot is specified.
1143 dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
1144 dnl the -isysroot it receives, so this is only needed with 4.0.0.
1145 LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
1150 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
1152 AC_TRY_COMPILE([#include <new>
1153 int main() { return 0; }],
1157 AC_MSG_RESULT($result)
1159 if test "$result" = "no" ; then
1160 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
1164 fi # COMPILE_ENVIRONMENT
1166 if test -n "$MAKE"; then
1167 if test `echo $MAKE | grep -c make.py` != 1; then
1173 cygwin*|mingw*|mks*|msvc*)
1174 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
1177 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
1180 if test "$GMAKE" = ":"; then
1181 AC_MSG_ERROR([GNU make not found])
1185 if test "$COMPILE_ENVIRONMENT"; then
1191 fi # COMPILE_ENVIRONMENT
1193 dnl ========================================================
1194 dnl set the defaults first
1195 dnl ========================================================
1198 AR_EXTRACT='$(AR) x'
1213 MOZ_USER_DIR=".mozilla"
1216 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)'
1218 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
1220 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1222 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)'
1224 MOZ_JS_STATIC_LIBS='-L$(LIBXUL_DIST)/bin -ljs_static'
1225 MOZ_JS_SHARED_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
1226 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
1227 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1228 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
1229 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1230 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1231 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1235 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1237 USE_DEPENDENT_LIBS=1
1239 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1241 if test -n "$CROSS_COMPILE"; then
1242 OS_TARGET="${target_os}"
1243 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1245 case "${target_os}" in
1246 linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
1247 kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1248 gnu*) OS_ARCH=GNU ;;
1249 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
1250 mingw*) OS_ARCH=WINNT ;;
1251 wince*) OS_ARCH=WINCE ;;
1252 winmo*) OS_ARCH=WINCE ;;
1253 darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
1256 arm-android-eabi) OS_ARCH=Linux OS_TARGET=Android ;;
1259 OS_TARGET=`uname -s`
1260 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1261 OS_RELEASE=`uname -r`
1264 # Before this used `uname -m` when not cross compiling
1265 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1266 OS_TEST="${target_cpu}"
1270 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1272 #######################################################################
1273 # Master "Core Components" macros for getting the OS target #
1274 #######################################################################
1277 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1278 # cross-compilation.
1282 # Define and override various archtecture-specific variables, including
1291 case "$HOST_OS_ARCH" in
1292 cygwin*|mingw*|mks*|msvc*)
1305 if test -z "$GNU_CC"; then
1306 if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1311 if test -z "$GNU_CXX"; then
1312 if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1313 SOLARIS_SUNPRO_CXX=1
1316 AC_SUBST(SOLARIS_SUNPRO_CC)
1317 AC_SUBST(SOLARIS_SUNPRO_CXX)
1329 if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1332 HOST_OS_ARCH=UNIXWARE
1344 HOST_OS_ARCH=OpenVMS
1354 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1358 HOST_OS_ARCH=UNIXWARE
1364 if test -z "$CROSS_COMPILE" ; then
1370 # If uname -s returns "Windows_NT", we assume that we are using
1371 # the uname.exe in MKS toolkit.
1373 # The -r option of MKS uname only returns the major version number.
1374 # So we need to use its -v option to get the minor version number.
1375 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1379 OS_MINOR_RELEASE=`uname -v`
1380 if test "$OS_MINOR_RELEASE" = "00"; then
1383 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1385 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1387 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1388 # the uname.exe in the Cygwin tools.
1389 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1390 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1391 # the uname.exe in the GNU-Win32 tools.
1392 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1393 # the uname.exe in the MSYS tools.
1395 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1400 OS_RELEASE=`uname -v`.`uname -r`
1401 OS_TEST=${target_cpu}
1413 if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1417 OS_RELEASE=`uname -v`
1441 OS_RELEASE=`uname -v`
1447 OS_RELEASE=`uname -v`
1450 if test "$OS_TARGET" != "NTO"; then
1452 OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1461 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1467 OS_RELEASE=`uname -v`
1471 case "${target_os}" in
1474 WINCE_WINDOWS_MOBILE=1
1475 AC_DEFINE(WINCE_WINDOWS_MOBILE)
1483 case "${target_cpu}" in
1494 if test -z "$CROSS_COMPILE" ; then
1502 if test "$OS_ARCH" = "NCR"; then
1504 OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1508 # Only set CPU_ARCH if we recognize the value of OS_TEST
1519 powerpc | ppc | rs6000)
1523 Alpha | alpha | ALPHA)
1552 if test -z "$OS_TARGET"; then
1555 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1557 dnl ========================================================
1558 dnl GNU specific defaults
1559 dnl ========================================================
1560 if test "$GNU_CC"; then
1561 # FIXME: Let us build with strict aliasing. bug 414641.
1562 CFLAGS="$CFLAGS -fno-strict-aliasing"
1563 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1564 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1565 DSO_LDOPTS='-shared'
1566 if test "$GCC_USE_GNU_LD"; then
1567 # Don't allow undefined symbols in libraries
1568 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1570 WARNINGS_AS_ERRORS='-Werror'
1572 DSO_PIC_CFLAGS='-fPIC'
1573 ASFLAGS="$ASFLAGS -fPIC"
1574 _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1575 _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1576 _MOZ_EXCEPTIONS_FLAGS_ON='-fexceptions'
1577 _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-exceptions'
1579 # Turn on GNU specific features
1580 # -Wall - turn on all warnings
1581 # -pedantic - make compiler warn about non-ANSI stuff, and
1582 # be a little bit stricter
1583 # Warnings slamm took out for now (these were giving more noise than help):
1584 # -Wbad-function-cast - warns when casting a function to a new return type
1585 # -Wshadow - removed because it generates more noise than help --pete
1586 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1587 if test -z "$INTEL_CC"; then
1588 # Don't use -Wcast-align with ICC
1590 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1591 hppa | ia64 | sparc | arm)
1594 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1599 dnl Turn pedantic on but disable the warnings for long long
1602 if test -z "$INTEL_CC"; then
1603 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1606 _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1607 _USE_CPP_INCLUDE_FLAG=1
1608 elif test "$SOLARIS_SUNPRO_CC"; then
1610 if test "$CPU_ARCH" = "sparc"; then
1611 # for Sun Studio on Solaris/SPARC
1612 DSO_PIC_CFLAGS='-xcode=pic32'
1614 DSO_PIC_CFLAGS='-KPIC'
1616 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1618 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1619 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1621 DSO_LDOPTS='-shared'
1622 if test "$GNU_LD"; then
1623 # Don't allow undefined symbols in libraries
1624 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1628 DSO_PIC_CFLAGS='-KPIC'
1629 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1632 if test "$GNU_CXX"; then
1633 # FIXME: Let us build with strict aliasing. bug 414641.
1634 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1635 # Turn on GNU specific features
1636 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1637 if test -z "$INTEL_CC"; then
1638 # Don't use -Wcast-align with ICC
1640 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1641 hppa | ia64 | sparc | arm)
1644 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1649 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1650 _USE_CPP_INCLUDE_FLAG=1
1652 AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1653 ac_has_wno_invalid_offsetof,
1657 _SAVE_CXXFLAGS="$CXXFLAGS"
1658 CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1661 ac_has_wno_invalid_offsetof="yes",
1662 ac_has_wno_invalid_offsetof="no")
1663 CXXFLAGS="$_SAVE_CXXFLAGS"
1666 if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1667 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1670 AC_CACHE_CHECK(whether the compiler supports -Wno-variadic-macros,
1671 ac_has_wno_variadic_macros,
1675 _SAVE_CXXFLAGS="$CXXFLAGS"
1676 CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-variadic-macros"
1679 ac_has_wno_variadic_macros="yes",
1680 ac_has_wno_variadic_macros="no")
1681 CXXFLAGS="$_SAVE_CXXFLAGS"
1684 if test "$ac_has_wno_variadic_macros" = "yes"; then
1685 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-variadic-macros"
1688 AC_CACHE_CHECK(whether the compiler supports -Werror=return-type,
1689 ac_has_werror_return_type,
1693 _SAVE_CXXFLAGS="$CXXFLAGS"
1694 CXXFLAGS="$CXXFLAGS -Werror=return-type"
1697 ac_has_werror_return_type="yes",
1698 ac_has_werror_return_type="no")
1699 CXXFLAGS="$_SAVE_CXXFLAGS"
1702 if test "$ac_has_werror_return_type" = "yes"; then
1703 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=return-type"
1707 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1710 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1711 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1712 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1713 dnl normal behavior.
1714 dnl ========================================================
1716 MKSHLIB_UNFORCE_ALL=
1718 if test "$COMPILE_ENVIRONMENT"; then
1719 if test "$GNU_CC"; then
1720 AC_MSG_CHECKING(whether ld has archive extraction flags)
1721 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1722 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1723 ac_cv_mkshlib_force_and_unforce="no"
1724 exec 3<&0 <<LOOP_INPUT
1725 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
1726 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1727 force="-Wl,-all"; unforce="-Wl,-none"
1734 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1737 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1739 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1743 eval $ac_cv_mkshlib_force_and_unforce
1744 MKSHLIB_FORCE_ALL=$force
1745 MKSHLIB_UNFORCE_ALL=$unforce
1748 fi # COMPILE_ENVIRONMENT
1750 dnl =================================================================
1751 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1752 dnl which is bad when cross compiling.
1753 dnl =================================================================
1754 if test "$COMPILE_ENVIRONMENT"; then
1755 configure_static_assert_macros='
1756 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1757 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1758 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1761 dnl test that the macros actually work:
1762 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1763 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1766 ac_cv_static_assertion_macros_work="yes"
1767 AC_TRY_COMPILE([$configure_static_assert_macros],
1768 [CONFIGURE_STATIC_ASSERT(1)],
1770 ac_cv_static_assertion_macros_work="no")
1771 AC_TRY_COMPILE([$configure_static_assert_macros],
1772 [CONFIGURE_STATIC_ASSERT(0)],
1773 ac_cv_static_assertion_macros_work="no",
1776 AC_TRY_COMPILE([$configure_static_assert_macros],
1777 [CONFIGURE_STATIC_ASSERT(1)],
1779 ac_cv_static_assertion_macros_work="no")
1780 AC_TRY_COMPILE([$configure_static_assert_macros],
1781 [CONFIGURE_STATIC_ASSERT(0)],
1782 ac_cv_static_assertion_macros_work="no",
1786 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1787 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1788 AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1790 fi # COMPILE_ENVIRONMENT
1792 dnl ========================================================
1793 dnl Checking for 64-bit OS
1794 dnl ========================================================
1795 if test "$COMPILE_ENVIRONMENT"; then
1798 AC_MSG_CHECKING(for 64-bit OS)
1799 AC_TRY_COMPILE([$configure_static_assert_macros],
1800 [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1801 result="yes", result="no")
1802 AC_MSG_RESULT("$result")
1803 if test "$result" = "yes"; then
1804 AC_DEFINE(HAVE_64BIT_OS)
1807 AC_SUBST(HAVE_64BIT_OS)
1809 fi # COMPILE_ENVIRONMENT
1811 dnl ========================================================
1812 dnl Enable high-memory support on OS/2 by default.
1813 dnl ========================================================
1814 MOZ_OS2_HIGH_MEMORY=1
1815 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1816 [ --disable-os2-high-mem Disable high-memory support on OS/2],
1817 MOZ_OS2_HIGH_MEMORY=,
1818 MOZ_OS2_HIGH_MEMORY=1 )
1819 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1821 dnl ========================================================
1822 dnl = Use profiling compile flags
1823 dnl ========================================================
1824 MOZ_ARG_ENABLE_BOOL(profiling,
1825 [ --enable-profiling Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1829 dnl ========================================================
1830 dnl System overrides of the defaults for host
1831 dnl ========================================================
1834 HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1835 HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1836 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1839 *cygwin*|*mingw*|*mks*|*msvc*|*wince|*winmo)
1840 if test -n "$_WIN32_MSVC"; then
1842 HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1843 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1844 HOST_RANLIB='echo ranlib'
1846 HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1848 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1849 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1850 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1851 HOST_BIN_SUFFIX=.exe
1854 dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1855 PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1858 CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1859 if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1861 CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1863 if test "`${PERL} -v | grep -c cygwin 2>/dev/null`" = 0; then
1865 PERL="${CYGWIN_WRAPPER} $PERL"
1868 if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1869 PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1874 case "${host_cpu}" in
1876 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1882 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1883 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1884 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1887 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1888 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1889 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1890 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1894 HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1895 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1896 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1897 HOST_BIN_SUFFIX=.exe
1902 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1903 HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1904 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1908 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1909 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1913 dnl We require version 2.5 or newer of Python to build.
1914 AC_MSG_CHECKING([for Python version >= $PYTHON_VERSION but not 3.x])
1916 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1] or sys.version[:2] != '2.')" $PYTHON_VERSION
1919 if test "$_python_res" != 0; then
1920 AC_MSG_ERROR([Python $PYTHON_VERSION or higher (but not Python 3.x) is required.])
1922 AC_MSG_RESULT([yes])
1924 dnl Get mozilla version from central milestone file
1925 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1927 dnl Get version of various core apps from the version files.
1928 FIREFOX_VERSION=`cat $topsrcdir/browser/config/version.txt`
1930 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1931 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1933 dnl ========================================================
1934 dnl System overrides of the defaults for target
1935 dnl ========================================================
1940 if test ! "$GNU_CC"; then
1941 if test ! "$HAVE_64BIT_OS"; then
1942 # Compiling with Visual Age C++ object model compat is the
1943 # default. To compile with object model ibm, add
1944 # AIX_OBJMODEL=ibm to .mozconfig.
1945 if test "$AIX_OBJMODEL" = "ibm"; then
1946 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1953 AC_SUBST(AIX_OBJMODEL)
1954 DSO_LDOPTS='-qmkshrobj=1'
1955 DSO_CFLAGS='-qflag=w:w'
1957 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1958 AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1960 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1961 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1962 if test "$COMPILE_ENVIRONMENT"; then
1965 AC_MSG_CHECKING([for VisualAge C++ compiler version >= 6.0.0.3])
1967 [#if (__IBMCPP__ < 600)
1968 #error "Bad compiler"
1970 _BAD_COMPILER=,_BAD_COMPILER=1)
1971 if test -n "$_BAD_COMPILER"; then
1973 AC_MSG_ERROR([VisualAge C++ version 6.0.0.3 or higher is required to build.])
1975 AC_MSG_RESULT([yes])
1978 TARGET_COMPILER_ABI="ibmc"
1979 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1980 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1983 case "${target_os}" in
1988 if test "$COMPILE_ENVIRONMENT"; then
1989 AC_CHECK_HEADERS(sys/inttypes.h)
1991 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1996 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1997 _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
1998 DSO_LDOPTS='-nostart'
1999 TK_LIBS='-lbe -lroot'
2001 if test "$COMPILE_ENVIRONMENT"; then
2002 AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
2003 AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
2005 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
2006 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
2009 MOZ_USER_DIR="Mozilla"
2013 dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
2022 _WARNINGS_CFLAGS="-Wall"
2023 _WARNINGS_CXXFLAGS="-Wall"
2024 # The test above doesn't work properly, at least on 3.1.
2025 MKSHLIB_FORCE_ALL=''
2026 MKSHLIB_UNFORCE_ALL=''
2032 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2033 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2034 # If we're building with --enable-profiling, we need a frame pointer.
2035 if test -z "$MOZ_PROFILING"; then
2036 MOZ_OPTIMIZE_FLAGS="-O3 -fomit-frame-pointer"
2038 MOZ_OPTIMIZE_FLAGS="-O3 -fno-omit-frame-pointer"
2041 CFLAGS="$CFLAGS -fpascal-strings -fno-common"
2042 CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
2045 STRIP="$STRIP -x -S"
2046 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
2047 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
2048 # The ExceptionHandling framework is needed for Objective-C exception
2049 # logging code in nsObjCExceptions.h. Currently we only use that in debug
2051 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
2053 dnl DTrace and -dead_strip don't interact well. See bug 403132.
2054 dnl ===================================================================
2055 if test "x$enable_dtrace" = "xyes"; then
2056 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
2058 dnl check for the presence of the -dead_strip linker flag
2059 AC_MSG_CHECKING([for -dead_strip option to ld])
2060 _SAVE_LDFLAGS=$LDFLAGS
2061 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
2062 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
2063 if test -n "$_HAVE_DEAD_STRIP" ; then
2064 AC_MSG_RESULT([yes])
2065 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
2070 LDFLAGS=$_SAVE_LDFLAGS
2072 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
2076 if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
2077 DLL_SUFFIX=".so.1.0"
2078 DSO_LDOPTS="-shared"
2080 if test ! "$GNU_CC"; then
2081 DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
2087 if test ! "$GNU_CC"; then
2091 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2092 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2093 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2096 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2097 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2101 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2102 AC_DEFINE(_LARGEFILE64_SOURCE)
2107 if test ! "$GNU_CC"; then
2108 DSO_LDOPTS='-b -Wl,+s'
2111 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2112 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2113 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2115 DSO_LDOPTS='-b -E +s'
2116 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2117 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2119 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2120 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2125 DSO_LDOPTS='-elf -shared'
2127 if test "$GNU_CC"; then
2128 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2129 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2130 MKSHLIB_FORCE_ALL='-Wl,-all'
2131 MKSHLIB_UNFORCE_ALL='-Wl,-none'
2132 CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2134 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2135 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2136 MKSHLIB_FORCE_ALL='-all'
2137 MKSHLIB_UNFORCE_ALL='-none'
2143 dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must*
2144 dnl compile and link using -n32
2146 TARGET_COMPILER_ABI=n32
2147 DSO_LDOPTS='-elf -shared'
2148 MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2149 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2150 _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
2151 _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
2152 if test "$GNU_CC"; then
2153 MKSHLIB_FORCE_ALL='-Wl,-all'
2154 MKSHLIB_UNFORCE_ALL='-Wl,-none'
2155 _WARNINGS_CFLAGS="-Wall"
2156 _WARNINGS_CXXFLAGS="-Wall"
2157 CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2159 MKSHLIB_FORCE_ALL='-all'
2160 MKSHLIB_UNFORCE_ALL='-none'
2166 CFLAGS="$CFLAGS -woff 3262 -G 4"
2167 CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
2168 if test -n "$USE_N32"; then
2169 ASFLAGS="$ASFLAGS -n32"
2170 CFLAGS="$CFLAGS -n32"
2171 CXXFLAGS="$CXXFLAGS -n32"
2172 LDFLAGS="$LDFLAGS -n32"
2174 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2175 AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
2178 if test -z "$GNU_CXX"; then
2184 # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2185 # Similarly for GNU_CXX and INTEL_CXX.
2186 if test "$INTEL_CC" -o "$INTEL_CXX"; then
2187 # -Os has been broken on Intel's C/C++ compilers for quite a
2188 # while; Intel recommends against using it.
2189 MOZ_OPTIMIZE_FLAGS="-O2"
2190 MOZ_DEBUG_FLAGS="-g"
2191 elif test "$GNU_CC" -o "$GNU_CXX"; then
2192 GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2193 case $GCC_VERSION in
2195 # -Os is broken on gcc 4.1.x 4.2.x, 4.5.x we need to tweak it to get good results.
2196 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2198 # If we're building with --enable-profiling, we need a frame pointer.
2199 if test -z "$MOZ_PROFILING"; then
2200 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fomit-frame-pointer $MOZ_OPTIMIZE_SIZE_TWEAK"
2202 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-omit-frame-pointer $MOZ_OPTIMIZE_SIZE_TWEAK"
2204 MOZ_DEBUG_FLAGS="-g"
2207 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2211 case "${target_cpu}" in
2213 CFLAGS="$CFLAGS -mieee"
2214 CXXFLAGS="$CXXFLAGS -mieee"
2220 MOZ_DEBUG_FLAGS="-g" # We want inlining
2226 TARGET_COMPILER_ABI=msvc
2227 _PLATFORM_DEFAULT_TOOLKIT=cairo-windows
2228 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2229 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2231 AR_EXTRACT="$AR -extract"
2233 AR_FLAGS='-OUT:"$@"'
2237 ac_configure_args="$ac_configure_args --enable-win32-target=WINCE"
2239 if test "$AS_BIN"; then
2246 if test -z "$RC"; then
2249 # certain versions of cygwin's makedepend barf on the
2250 # #include <string> vs -I./dist/include/string issue so don't use it
2256 HOST_AR='lib -OUT:$@'
2257 HOST_RANLIB='echo ranlib'
2258 HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
2261 WARNINGS_AS_ERRORS='-WX'
2262 MOZ_OPTIMIZE_FLAGS='-Ox'
2263 AR_FLAGS='-NOLOGO -OUT:"$@"'
2265 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2266 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2269 DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
2270 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2272 IMPORT_LIB_SUFFIX=lib
2273 dnl Need to force-link against mozalloc because it's used in the shunt
2274 LIBS="$LIBS \$(LIBXUL_DIST)/lib/mozalloc.lib"
2275 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2278 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2279 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2281 MKSHLIB_UNFORCE_ALL=
2282 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2283 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2284 MOZ_DEBUG_FLAGS='-Zi'
2285 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2287 MOZ_JS_STATIC_LIBS='$(LIBXUL_DIST)/lib/js_static.lib'
2288 MOZ_JS_SHARED_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2290 RANLIB='echo not_ranlib'
2291 STRIP='echo not_strip'
2292 TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
2295 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2299 AC_DEFINE(HAVE_SNPRINTF)
2304 AC_DEFINE(HW_THREADS)
2305 AC_DEFINE(STDC_HEADERS)
2306 AC_DEFINE(NEW_H, <new>)
2307 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2308 AC_DEFINE(HAVE_LOCALTIME_R)
2310 TARGET_MD_ARCH=win32
2311 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2313 MOZ_USER_DIR="Mozilla"
2315 MOZ_GFX_OPTIMIZE_MOBILE=1
2317 # Sanity check for WINCE_WINDOWS_MOBILE
2318 # XXX disabled until we can fix the mobile tinderbox
2319 ##if test "$WINCE_WINDOWS_MOBILE"; then
2320 ## AC_CHECK_HEADER(tpcshell.h, [],
2321 ## AC_MSG_ERROR([Can't find tpcshell.h in your SDK; are you sure you don't need --disable-windows-mobile-components?]))
2326 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2331 # certain versions of cygwin's makedepend barf on the
2332 # #include <string> vs -I./dist/include/string issue so don't use it
2334 if test -n "$GNU_CC"; then
2335 CC="$CC -mno-cygwin"
2336 CXX="$CXX -mno-cygwin"
2337 CPP="$CPP -mno-cygwin"
2338 CFLAGS="$CFLAGS -mms-bitfields"
2339 CXXFLAGS="$CXXFLAGS -mms-bitfields"
2340 DSO_LDOPTS='-shared'
2341 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2342 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2344 # Use temp file for windres (bug 213281)
2345 RCFLAGS='-O coff --use-temp-file'
2346 # mingw doesn't require kernel32, user32, and advapi32 explicitly
2347 LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32"
2348 MOZ_JS_STATIC_LIBS='-L$(LIBXUL_DIST)/bin -ljs_static'
2349 MOZ_JS_SHARED_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
2351 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2352 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2354 IMPORT_LIB_SUFFIX=dll.a
2355 GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2357 TARGET_COMPILER_ABI=msvc
2361 if test "$AS_BIN"; then
2362 AS="$(basename "$AS_BIN")"
2364 AR='lib -NOLOGO -OUT:"$@"'
2366 RANLIB='echo not_ranlib'
2367 STRIP='echo not_strip'
2373 GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2379 IMPORT_LIB_SUFFIX=lib
2380 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2381 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2383 MKSHLIB_UNFORCE_ALL=
2384 DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2385 _USE_CPP_INCLUDE_FLAG=1
2386 _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2387 _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2388 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2389 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2390 CXXFLAGS="$CXXFLAGS -wd4800" # disable warning "forcing value to bool"
2391 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2392 MOZ_DEBUG_FLAGS='-Zi'
2393 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2394 WARNINGS_AS_ERRORS='-WX'
2395 # If we're building with --enable-profiling, we need -Oy-, which forces a frame pointer.
2396 if test -z "$MOZ_PROFILING"; then
2397 MOZ_OPTIMIZE_FLAGS='-O1'
2399 MOZ_OPTIMIZE_FLAGS='-O1 -Oy-'
2401 MOZ_JS_STATIC_LIBS='$(LIBXUL_DIST)/lib/js_static.lib'
2402 MOZ_JS_SHARED_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2404 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2405 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2406 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2407 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2408 if test $_MSC_VER -ge 1400; then
2409 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2410 dnl For profile-guided optimization
2411 PROFILE_GEN_CFLAGS="-GL"
2412 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2413 dnl XXX: PGO builds can fail with warnings treated as errors,
2414 dnl specifically "no profile data available" appears to be
2415 dnl treated as an error sometimes. This might be a consequence
2416 dnl of using WARNINGS_AS_ERRORS in some modules, combined
2417 dnl with the linker doing most of the work in the whole-program
2418 dnl optimization/PGO case. I think it's probably a compiler bug,
2419 dnl but we work around it here.
2420 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2421 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2422 dnl Probably also a compiler bug, but what can you do?
2423 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2424 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_USER_DIR="Mozilla"
2443 dnl Hardcode to win95 for now - cls
2444 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2446 dnl set NO_X11 defines here as the general check is skipped on win32
2450 dnl MinGW/MSYS doesn't provide or need cygpath
2455 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2457 *-cygwin*|*-msvc*|*-mks*)
2458 CYGPATH_W="cygpath -a -w"
2459 CYGPATH_S="sed -e s|\\\\|/|g"
2460 MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2464 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2466 if test -z "$MOZ_TOOLS"; then
2467 AC_MSG_ERROR([MOZ_TOOLS is not set])
2470 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2471 if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2472 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2474 MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2475 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2476 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2478 MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2485 AC_MSG_WARN([Using a cygwin build environment is unsupported. Configure cannot check for the presence of necessary headers. Please upgrade to MozillaBuild; see https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
2489 AC_CHECK_HEADERS(oleacc.idl)
2493 AC_CHECK_HEADERS(atlbase.h)
2500 if test "$HAVE_64BIT_OS"; then
2501 AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2504 if test $_MSC_VER -ge 1400; then
2505 LDFLAGS="$LDFLAGS -SAFESEH"
2507 AC_CHECK_HEADERS(mmintrin.h)
2520 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2524 if test "$HAVE_64BIT_OS"; then
2531 CFLAGS="$CFLAGS -Dunix"
2532 CXXFLAGS="$CXXFLAGS -Dunix"
2533 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2535 DSO_PIC_CFLAGS='-fPIC -DPIC'
2536 DSO_LDOPTS='-shared'
2537 BIN_FLAGS='-Wl,--export-dynamic'
2539 DSO_PIC_CFLAGS='-fPIC -DPIC'
2540 DLL_SUFFIX=".so.1.0"
2541 DSO_LDOPTS='-shared'
2543 # This will fail on a.out systems prior to 1.5.1_ALPHA.
2544 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2545 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2546 if test "$LIBRUNPATH"; then
2547 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2549 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2550 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2555 AC_DEFINE(_QNX_SOURCE)
2558 WARNINGS_AS_ERRORS=''
2559 MOZ_OPTIMIZE_FLAGS="-O"
2560 MOZ_DEBUG_FLAGS="-gstabs"
2563 LIBS="$LIBS -lsocket -lstdc++"
2564 _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2565 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2566 if test "$with_x" != "yes"
2568 _PLATFORM_DEFAULT_TOOLKIT="photon"
2569 TK_CFLAGS='-I/usr/include/photon'
2572 case "${target_cpu}" in
2574 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
2577 case "${host_cpu}" in
2585 DLL_SUFFIX=".so.1.0"
2587 DSO_PIC_CFLAGS='-fPIC'
2588 DSO_LDOPTS='-shared -fPIC'
2589 if test "$LIBRUNPATH"; then
2590 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2595 AC_DEFINE(NO_PW_GECOS)
2596 AC_DEFINE(NO_UDSOCK)
2597 AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2599 MKSHLIB_FORCE_ALL='-all'
2600 MKSHLIB_UNFORCE_ALL='-none'
2602 AS_DASH_C_FLAG='-Wc/names=as_is'
2604 DSO_LDOPTS='-shared -auto_symvec'
2606 MOZ_DEBUG_LDFLAGS='-g'
2608 CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2609 CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2614 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2615 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2618 AC_DEFINE(OS2EMX_PLAIN_CHAR)
2619 AC_DEFINE(TCPV40HDRS)
2625 IMPORT_LIB_SUFFIX=lib
2629 CFLAGS="$CFLAGS -Zomf"
2630 CXXFLAGS="$CXXFLAGS -Zomf"
2632 BIN_FLAGS='-Zlinker /ST:0x100000'
2636 WARNINGS_AS_ERRORS='-Werror'
2637 MOZ_DEBUG_FLAGS="-g -fno-inline"
2638 MOZ_OPTIMIZE_FLAGS="-O2"
2639 MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2640 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2641 LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2643 _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2646 MOZ_USER_DIR="Mozilla"
2648 if test "$MOZTOOLS"; then
2649 MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2651 AC_MSG_ERROR([MOZTOOLS is not set])
2653 if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2654 DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2655 LDFLAGS="$LDFLAGS -Zhigh-mem"
2656 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2657 AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2660 # GCC for OS/2 currently predefines these, but we don't want them
2661 _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2662 _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2664 AC_CACHE_CHECK(for __declspec(dllexport),
2666 [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2668 ac_os2_declspec="yes",
2669 ac_os2_declspec="no")])
2670 if test "$ac_os2_declspec" != "yes"; then
2671 AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
2676 if test "$GNU_CC"; then
2677 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2678 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2681 MOZ_DEBUG_FLAGS='-g'
2682 ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2683 CFLAGS="$CFLAGS -ieee"
2684 CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee -ptr $(DIST)/cxx_repository'
2685 DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2688 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2689 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2690 MKSHLIB_FORCE_ALL='-all'
2691 MKSHLIB_UNFORCE_ALL='-none'
2692 dnl Might fix the libxpcom.so breakage on this platform as well....
2693 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2694 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2696 if test -z "$GNU_CXX"; then
2699 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2703 DIRENT_INO=d_stat.st_ino
2704 dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2705 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2706 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2707 dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2708 AC_DEFINE(STDC_HEADERS)
2709 if test "$no_x" = "yes"; then
2710 _PLATFORM_DEFAULT_TOOLKIT='photon'
2711 TK_CFLAGS='-I/usr/nto/include/photon'
2712 TK_LIBS='-lphoton -lphrender'
2717 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2718 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2719 CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2720 if test ! "$GNU_CC"; then
2727 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2730 # $ORIGIN/.. is for shared libraries under components/ to locate shared
2731 # libraries one level up (e.g. libnspr4.so)
2732 if test "$SOLARIS_SUNPRO_CC"; then
2733 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2734 LIBS="-lCrun -lCstd -lc $LIBS"
2736 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2737 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2738 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2739 _MOZ_EXCEPTIONS_FLAGS_ON='-features=except'
2740 _MOZ_EXCEPTIONS_FLAGS_OFF='-features=no%except'
2741 LDFLAGS="-xildoff $LDFLAGS"
2742 if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2743 _SAVE_LDFLAGS=$LDFLAGS
2744 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2745 AC_TRY_LINK([#include <stdio.h>],
2746 [printf("Hello World\n");],
2748 [LDFLAGS=$_SAVE_LDFLAGS])
2750 WARNINGS_AS_ERRORS='-Werror'
2751 MOZ_OPTIMIZE_FLAGS="-xO4"
2752 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2753 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2754 MKSHLIB_FORCE_ALL='-z allextract'
2755 MKSHLIB_UNFORCE_ALL='-z defaultextract'
2762 AS='/usr/ccs/bin/as'
2763 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2765 TARGET_COMPILER_ABI="sunc"
2766 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2767 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2768 AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2772 [#if (__SUNPRO_CC < 0x590)
2775 _BAD_COMPILER=,_BAD_COMPILER=1)
2776 if test -n "$_BAD_COMPILER"; then
2778 AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2783 [#if (__SUNPRO_CC >= 0x5100)
2784 #error "Sun C++ 5.10 or above"
2786 _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2787 if test "$_ABOVE_SS12U1"; then
2789 CXXFLAGS="$CXXFLAGS -xannotate=no"
2791 AC_MSG_RESULT([$_res])
2794 LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2796 MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2797 MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2798 ASFLAGS="$ASFLAGS -fPIC"
2799 DSO_LDOPTS='-shared'
2801 _WARNINGS_CXXFLAGS=''
2802 if test "$OS_RELEASE" = "5.3"; then
2803 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2806 if test "$OS_RELEASE" = "5.5.1"; then
2807 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2812 DSO_LDOPTS='-Bdynamic'
2813 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2814 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2816 AC_DEFINE(SPRINTF_RETURNS_STRING)
2817 case "$(target_os)" in
2819 DLL_SUFFIX='.so.1.0'
2825 NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2829 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2833 AC_DEFINE(NO_PW_GECOS)
2835 _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2836 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2838 MOZ_GFX_OPTIMIZE_MOBILE=1
2839 # If we're building with --enable-profiling, we need a frame pointer.
2840 if test -z "$MOZ_PROFILING"; then
2841 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fomit-frame-pointer"
2843 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fno-omit-frame-pointer"
2849 dnl Only one oddball right now (QNX), but this gives us flexibility
2850 dnl if any other platforms need to override this in the future.
2851 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2853 dnl ========================================================
2854 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2855 dnl by now will not have any way to link most binaries (tests
2856 dnl as well as viewer, apprunner, etc.), because some symbols
2857 dnl will be left out of the "composite" .so's by ld as unneeded.
2858 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2859 dnl they can link in the static libs that provide the missing
2861 dnl ========================================================
2862 NO_LD_ARCHIVE_FLAGS=
2863 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2864 NO_LD_ARCHIVE_FLAGS=1
2868 NO_LD_ARCHIVE_FLAGS=
2871 NO_LD_ARCHIVE_FLAGS=
2874 NO_LD_ARCHIVE_FLAGS=
2876 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince|*-winmo)
2877 if test -z "$GNU_CC"; then
2878 NO_LD_ARCHIVE_FLAGS=
2882 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2884 dnl ========================================================
2885 dnl = Flags to strip unused symbols from .so components and
2886 dnl = to export jemalloc symbols when linking a program
2887 dnl ========================================================
2889 *-linux*|*-kfreebsd*-gnu|*-gnu*)
2890 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2891 MOZ_JEMALLOC_STANDALONE_GLUE_LDOPTS='-rdynamic -Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/jemalloc-standalone-linkage-version-script'
2894 if test -z "$GNU_CC"; then
2895 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2897 if test -z "$GCC_USE_GNU_LD"; then
2898 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2900 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2905 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2908 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2910 *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince|*-winmo)
2911 if test -n "$GNU_CC"; then
2912 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2917 if test -z "$COMPILE_ENVIRONMENT"; then
2918 SKIP_COMPILER_CHECKS=1
2919 SKIP_LIBRARY_CHECKS=1
2922 if test -z "$SKIP_COMPILER_CHECKS"; then
2923 dnl Checks for typedefs, structures, and compiler characteristics.
2924 dnl ========================================================
2932 AC_MSG_CHECKING(for __stdcall)
2933 AC_CACHE_VAL(ac_cv___stdcall,
2934 [AC_TRY_COMPILE([template <typename Method> struct foo;
2935 template <> struct foo<void (*)()> {};
2936 template <> struct foo<void (__stdcall*)()> {};],
2938 [ac_cv___stdcall=true],
2939 [ac_cv___stdcall=false])])
2940 if test "$ac_cv___stdcall" = true ; then
2941 AC_DEFINE(HAVE_STDCALL)
2947 AC_MSG_CHECKING(for ssize_t)
2948 AC_CACHE_VAL(ac_cv_type_ssize_t,
2949 [AC_TRY_COMPILE([#include <stdio.h>
2950 #include <sys/types.h>],
2952 [ac_cv_type_ssize_t=true],
2953 [ac_cv_type_ssize_t=false])])
2954 if test "$ac_cv_type_ssize_t" = true ; then
2955 AC_DEFINE(HAVE_SSIZE_T)
2960 AC_STRUCT_ST_BLKSIZE
2961 AC_MSG_CHECKING(for siginfo_t)
2962 AC_CACHE_VAL(ac_cv_siginfo_t,
2963 [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2964 #include <signal.h>],
2966 [ac_cv_siginfo_t=true],
2967 [ac_cv_siginfo_t=false])])
2968 if test "$ac_cv_siginfo_t" = true ; then
2969 AC_DEFINE(HAVE_SIGINFO_T)
2975 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2976 dnl ========================================================
2977 AC_MSG_CHECKING(for int16_t)
2978 AC_CACHE_VAL(ac_cv_int16_t,
2979 [AC_TRY_COMPILE([#include <stdio.h>
2980 #include <sys/types.h>],
2982 [ac_cv_int16_t=true],
2983 [ac_cv_int16_t=false])])
2984 if test "$ac_cv_int16_t" = true ; then
2985 AC_DEFINE(HAVE_INT16_T)
2990 AC_MSG_CHECKING(for int32_t)
2991 AC_CACHE_VAL(ac_cv_int32_t,
2992 [AC_TRY_COMPILE([#include <stdio.h>
2993 #include <sys/types.h>],
2995 [ac_cv_int32_t=true],
2996 [ac_cv_int32_t=false])])
2997 if test "$ac_cv_int32_t" = true ; then
2998 AC_DEFINE(HAVE_INT32_T)
3003 AC_MSG_CHECKING(for int64_t)
3004 AC_CACHE_VAL(ac_cv_int64_t,
3005 [AC_TRY_COMPILE([#include <stdio.h>
3006 #include <sys/types.h>],
3008 [ac_cv_int64_t=true],
3009 [ac_cv_int64_t=false])])
3010 if test "$ac_cv_int64_t" = true ; then
3011 AC_DEFINE(HAVE_INT64_T)
3016 AC_MSG_CHECKING(for int64)
3017 AC_CACHE_VAL(ac_cv_int64,
3018 [AC_TRY_COMPILE([#include <stdio.h>
3019 #include <sys/types.h>],
3022 [ac_cv_int64=false])])
3023 if test "$ac_cv_int64" = true ; then
3024 AC_DEFINE(HAVE_INT64)
3029 AC_MSG_CHECKING(for uint)
3030 AC_CACHE_VAL(ac_cv_uint,
3031 [AC_TRY_COMPILE([#include <stdio.h>
3032 #include <sys/types.h>],
3035 [ac_cv_uint=false])])
3036 if test "$ac_cv_uint" = true ; then
3037 AC_DEFINE(HAVE_UINT)
3042 AC_MSG_CHECKING(for uint_t)
3043 AC_CACHE_VAL(ac_cv_uint_t,
3044 [AC_TRY_COMPILE([#include <stdio.h>
3045 #include <sys/types.h>],
3047 [ac_cv_uint_t=true],
3048 [ac_cv_uint_t=false])])
3049 if test "$ac_cv_uint_t" = true ; then
3050 AC_DEFINE(HAVE_UINT_T)
3055 AC_MSG_CHECKING(for uint16_t)
3056 AC_CACHE_VAL(ac_cv_uint16_t,
3057 [AC_TRY_COMPILE([#include <stdio.h>
3058 #include <sys/types.h>],
3059 [uint16_t foo = 0;],
3060 [ac_cv_uint16_t=true],
3061 [ac_cv_uint16_t=false])])
3062 if test "$ac_cv_uint16_t" = true ; then
3063 AC_DEFINE(HAVE_UINT16_T)
3069 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
3070 dnl are defined when compiling C++ but not C. Since the result of this
3071 dnl test is used only in C++, do it in C++.
3074 AC_MSG_CHECKING(for uname.domainname)
3075 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
3076 [AC_TRY_COMPILE([#include <sys/utsname.h>],
3077 [ struct utsname *res; char *domain;
3078 (void)uname(res); if (res != 0) { domain = res->domainname; } ],
3079 [ac_cv_have_uname_domainname_field=true],
3080 [ac_cv_have_uname_domainname_field=false])])
3082 if test "$ac_cv_have_uname_domainname_field" = "true"; then
3083 AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
3089 AC_MSG_CHECKING(for uname.__domainname)
3090 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
3091 [AC_TRY_COMPILE([#include <sys/utsname.h>],
3092 [ struct utsname *res; char *domain;
3093 (void)uname(res); if (res != 0) { domain = res->__domainname; } ],
3094 [ac_cv_have_uname_us_domainname_field=true],
3095 [ac_cv_have_uname_us_domainname_field=false])])
3097 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
3098 AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
3106 dnl Check for usable char16_t (2 bytes, unsigned)
3107 dnl (we might not need the unsignedness check anymore)
3108 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
3109 ac_cv_have_usable_char16_t,
3110 [AC_TRY_COMPILE([$configure_static_assert_macros],
3111 [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
3112 CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
3113 CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
3114 CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
3115 CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
3116 ac_cv_have_usable_char16_t="yes",
3117 ac_cv_have_usable_char16_t="no")])
3118 if test "$ac_cv_have_usable_char16_t" = "yes"; then
3119 AC_DEFINE(HAVE_CPP_CHAR16_T)
3123 dnl Check for usable wchar_t (2 bytes, unsigned)
3124 dnl (we really don't need the unsignedness check anymore)
3125 dnl ========================================================
3127 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
3128 ac_cv_have_usable_wchar_v2,
3129 [AC_TRY_COMPILE([#include <stddef.h>
3130 $configure_static_assert_macros],
3131 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3132 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3133 ac_cv_have_usable_wchar_v2="yes",
3134 ac_cv_have_usable_wchar_v2="no")])
3135 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
3136 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3137 HAVE_CPP_2BYTE_WCHAR_T=1
3138 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
3139 dnl This is really gcc-only
3140 dnl Do this test using CXX only since some versions of gcc
3141 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
3142 dnl only have short-wchar support for c++.
3143 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
3145 _SAVE_CXXFLAGS=$CXXFLAGS
3146 CXXFLAGS="$CXXFLAGS -fshort-wchar"
3148 AC_CACHE_CHECK(for compiler -fshort-wchar option,
3149 ac_cv_have_usable_wchar_option_v2,
3150 [AC_TRY_LINK([#include <stddef.h>
3151 $configure_static_assert_macros],
3152 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3153 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3154 ac_cv_have_usable_wchar_option_v2="yes",
3155 ac_cv_have_usable_wchar_option_v2="no")])
3157 if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
3158 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3159 HAVE_CPP_2BYTE_WCHAR_T=1
3160 if test "$OS_TARGET" = Android; then
3161 WCHAR_CFLAGS="-fshort-wchar -Wl,--no-wchar-size-warning"
3162 CXXFLAGS="$CXXFLAGS -Wl,--no-wchar-size-warning"
3163 CFLAGS="$CFLAGS -Wl,--no-wchar-size-warning"
3164 DSO_LDOPTS="$DSO_LDOPTS -Wl,--no-wchar-size-warning"
3166 WCHAR_CFLAGS="-fshort-wchar"
3169 CXXFLAGS=$_SAVE_CXXFLAGS
3175 dnl Check for .hidden assembler directive and visibility attribute.
3176 dnl Borrowed from glibc configure.in
3177 dnl ===============================================================
3178 if test "$GNU_CC"; then
3179 AC_CACHE_CHECK(for visibility(hidden) attribute,
3180 ac_cv_visibility_hidden,
3181 [cat > conftest.c <<EOF
3182 int foo __attribute__ ((visibility ("hidden"))) = 1;
3184 ac_cv_visibility_hidden=no
3185 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3186 if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3187 ac_cv_visibility_hidden=yes
3192 if test "$ac_cv_visibility_hidden" = "yes"; then
3193 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
3195 AC_CACHE_CHECK(for visibility(default) attribute,
3196 ac_cv_visibility_default,
3197 [cat > conftest.c <<EOF
3198 int foo __attribute__ ((visibility ("default"))) = 1;
3200 ac_cv_visibility_default=no
3201 if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3202 if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3203 ac_cv_visibility_default=yes
3208 if test "$ac_cv_visibility_default" = "yes"; then
3209 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
3211 AC_CACHE_CHECK(for visibility pragma support,
3212 ac_cv_visibility_pragma,
3213 [cat > conftest.c <<EOF
3214 #pragma GCC visibility push(hidden)
3216 #pragma GCC visibility push(default)
3217 int foo_default = 1;
3219 ac_cv_visibility_pragma=no
3220 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3221 if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
3222 if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
3223 ac_cv_visibility_pragma=yes
3229 if test "$ac_cv_visibility_pragma" = "yes"; then
3230 AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
3231 ac_cv_have_visibility_class_bug,
3232 [cat > conftest.c <<EOF
3233 #pragma GCC visibility push(hidden)
3234 struct __attribute__ ((visibility ("default"))) TestStruct {
3237 __attribute__ ((visibility ("default"))) void TestFunc() {
3241 ac_cv_have_visibility_class_bug=no
3242 if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3243 ac_cv_have_visibility_class_bug=yes
3245 if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
3246 ac_cv_have_visibility_class_bug=yes
3249 rm -rf conftest.{c,S}
3252 AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
3253 ac_cv_have_visibility_builtin_bug,
3254 [cat > conftest.c <<EOF
3255 #pragma GCC visibility push(hidden)
3256 #pragma GCC visibility push(default)
3258 #pragma GCC visibility pop
3260 __attribute__ ((visibility ("default"))) void Func() {
3262 memset(c, 0, sizeof(c));
3265 ac_cv_have_visibility_builtin_bug=no
3266 if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3267 ac_cv_have_visibility_builtin_bug=yes
3269 if test `grep -c "@PLT" conftest.S` = 0; then
3270 ac_cv_visibility_builtin_bug=yes
3273 rm -f conftest.{c,S}
3275 if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
3276 "$ac_cv_have_visibility_class_bug" = "no"; then
3277 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
3278 WRAP_SYSTEM_INCLUDES=1
3279 STL_FLAGS='-I$(DIST)/stl_wrappers'
3282 VISIBILITY_FLAGS='-fvisibility=hidden'
3283 fi # have visibility pragma bug
3284 fi # have visibility pragma
3285 fi # have visibility(default) attribute
3286 fi # have visibility(hidden) attribute
3289 # visibility hidden flag for Sun Studio on Solaris
3290 if test "$SOLARIS_SUNPRO_CC"; then
3291 VISIBILITY_FLAGS='-xldscope=hidden'
3292 fi # Sun Studio on Solaris
3294 AC_SUBST(WRAP_SYSTEM_INCLUDES)
3295 AC_SUBST(VISIBILITY_FLAGS)
3297 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
3298 dnl ========================================================
3299 if test "$GNU_CC"; then
3300 CFLAGS_save="${CFLAGS}"
3301 CFLAGS="${CFLAGS} -Werror"
3302 AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
3303 ac_cv_force_align_arg_pointer,
3304 [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
3306 ac_cv_force_align_arg_pointer="yes",
3307 ac_cv_force_align_arg_pointer="no")])
3308 CFLAGS="${CFLAGS_save}"
3309 if test "$ac_cv_force_align_arg_pointer" = "yes"; then
3310 HAVE_GCC_ALIGN_ARG_POINTER=1
3312 HAVE_GCC_ALIGN_ARG_POINTER=
3315 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
3317 dnl Checks for header files.
3318 dnl ========================================================
3320 case "$target_os" in
3322 # for stuff like -lXshm
3323 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3326 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
3327 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
3328 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
3329 AC_CHECK_HEADERS(malloc.h)
3330 AC_CHECK_HEADERS(X11/XKBlib.h)
3331 AC_CHECK_HEADERS(io.h)
3333 dnl These are all the places some variant of statfs can be hiding.
3334 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3337 AC_CHECK_HEADERS(sys/quota.h)
3338 AC_CHECK_HEADERS(linux/quota.h)
3340 dnl Try for MMX support
3341 dnl NB - later gcc versions require -mmmx for this header to be successfully
3342 dnl included (or another option which implies it, such as -march=pentium-mmx)
3343 AC_CHECK_HEADERS(mmintrin.h)
3345 dnl Check whether the compiler supports the new-style C++ standard
3346 dnl library headers (i.e. <new>) or needs the old "new.h"
3349 AC_CHECK_HEADER(new, [NEW_H=new])
3350 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3353 AC_ARG_ENABLE(dtrace,
3354 [ --enable-dtrace build with dtrace support if available (default=no)],
3355 [enable_dtrace="yes"],)
3356 if test "x$enable_dtrace" = "xyes"; then
3357 AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3358 if test -n "$HAVE_DTRACE"; then
3359 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3361 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3364 AC_SUBST(HAVE_DTRACE)
3370 AC_CHECK_HEADERS(sys/cdefs.h)
3374 dnl Checks for libraries.
3375 dnl ========================================================
3380 AC_CHECK_LIB(c_r, gethostbyname_r)
3384 dnl We don't want to link with libdl even if it's present on OS X, since
3385 dnl it's not used and not part of the default installation.
3386 dnl The same goes for BeOS. OS/2 has dlfcn in libc.
3387 dnl We don't want to link against libm or libpthread on Darwin since
3388 dnl they both are just symlinks to libSystem and explicitly linking
3389 dnl against libSystem causes issues when debugging (see bug 299601).
3398 AC_SEARCH_LIBS(dlopen, dl,
3399 AC_CHECK_HEADER(dlfcn.h,
3400 AC_DEFINE(HAVE_DLOPEN)))
3404 _SAVE_CFLAGS="$CFLAGS"
3405 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3406 AC_CHECK_FUNCS(dladdr)
3407 CFLAGS="$_SAVE_CFLAGS"
3409 if test ! "$GNU_CXX"; then
3413 AC_CHECK_LIB(C_r, demangle)
3416 AC_CHECK_LIB(C, demangle)
3421 dnl OS/2 has socket in libc.
3426 AC_CHECK_LIB(socket, socket)
3429 dnl ========================================================
3430 dnl Check whether we can compile code for Core Text
3431 dnl (available on Mac OS X 10.5 or later)
3432 dnl ========================================================
3435 AC_MSG_CHECKING([for Core Text])
3436 AC_TRY_COMPILE([#include <ApplicationServices/ApplicationServices.h>],
3437 [CTLineRef lineRef;],
3438 ac_cv_have_core_text="yes",
3439 ac_cv_have_core_text="no")
3440 AC_MSG_RESULT([$ac_cv_have_core_text])
3442 if test "$ac_cv_have_core_text" = "no"; then
3443 AC_MSG_ERROR([Core Text is required (available on Mac OS X 10.5 or later).])
3449 XLIBS="$X_EXTRA_LIBS"
3451 dnl ========================================================
3452 dnl Checks for X libraries.
3453 dnl Ordering is important.
3454 dnl Xt is dependent upon SM as of X11R6
3455 dnl ========================================================
3456 if test "$no_x" = "yes"; then
3459 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3460 XLIBS="-lX11 $XLIBS"
3461 _SAVE_LDFLAGS="$LDFLAGS"
3462 LDFLAGS="$XLDFLAGS $LDFLAGS"
3463 AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3464 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3465 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3466 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3468 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3469 unset ac_cv_lib_Xt_XtFree
3470 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3471 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
3472 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3473 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3476 # AIX needs the motif library linked before libXt to prevent
3477 # crashes in plugins linked against Motif - Bug #98892
3478 case "${target_os}" in
3480 XT_LIBS="-lXm $XT_LIBS"
3484 dnl ========================================================
3485 dnl = Check for XShm
3486 dnl ========================================================
3487 AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3489 AC_CHECK_HEADER(X11/extensions/XShm.h)
3490 if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3491 test -n "$_HAVE_XSHM_XEXT"; then
3492 AC_DEFINE(HAVE_XSHM)
3495 dnl ========================================================
3497 dnl ========================================================
3498 AC_CHECK_HEADER(X11/extensions/scrnsaver.h,
3499 AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
3500 [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
3501 AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
3503 dnl ========================================================
3505 dnl ========================================================
3506 AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3508 AC_CHECK_HEADER(X11/extensions/XIElib.h)
3510 if test "$MOZ_XIE_LIBS"; then
3511 dnl ====================================================
3512 dnl = If XIE is present and is desired, turn it on
3513 dnl ====================================================
3523 LDFLAGS="$_SAVE_LDFLAGS"
3525 dnl ========================================================
3526 dnl = Check for freetype2 and its functionality
3527 dnl ========================================================
3528 AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3530 if test "$_HAVE_FREETYPE2"; then
3532 _SAVE_CFLAGS="$CFLAGS"
3533 LIBS="$LIBS $FT2_LIBS"
3534 CFLAGS="$CFLAGS $FT2_CFLAGS"
3536 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3537 ac_cv_member_FT_Bitmap_Size_y_ppem,
3538 [AC_TRY_COMPILE([#include <ft2build.h>
3539 #include FT_FREETYPE_H],
3541 if (sizeof s.y_ppem) return 0;
3543 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3544 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3545 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3546 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3548 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3550 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3551 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3552 [FT_Bitmap_Size structure includes y_ppem field])
3554 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3557 CFLAGS="$_SAVE_CFLAGS"
3569 AC_MSG_CHECKING(for ARM SIMD support in compiler)
3571 [asm("uqadd8 r1, r1, r2");],
3572 result="yes", result="no")
3573 AC_MSG_RESULT("$result")
3574 if test "$result" = "yes"; then
3575 AC_DEFINE(HAVE_ARM_SIMD)
3578 AC_SUBST(HAVE_ARM_SIMD)
3580 AC_MSG_CHECKING(for ARM NEON support in compiler)
3581 _SAVE_CFLAGS="$CFLAGS"
3582 if test "$GNU_CC"; then
3583 # gcc needs -mfpu=neon to recognize NEON instructions
3584 CFLAGS="$CFLAGS -mfpu=neon -mfloat-abi=softfp"
3587 [asm("vadd.i8 d0, d0, d0");],
3588 result="yes", result="no")
3589 AC_MSG_RESULT("$result")
3590 if test "$result" = "yes"; then
3591 AC_DEFINE(HAVE_ARM_NEON)
3594 CFLAGS="$_SAVE_CFLAGS"
3595 AC_SUBST(HAVE_ARM_NEON)
3597 dnl ========================================================
3598 dnl = pthread support
3599 dnl = Start by checking whether the system support pthreads
3600 dnl ========================================================
3601 case "$target_os" in
3606 MOZ_CHECK_PTHREADS(pthreads,
3607 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3608 MOZ_CHECK_PTHREADS(pthread,
3609 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3610 MOZ_CHECK_PTHREADS(c_r,
3611 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3612 MOZ_CHECK_PTHREADS(c,
3621 dnl ========================================================
3622 dnl Check the command line for --with-pthreads
3623 dnl ========================================================
3624 MOZ_ARG_WITH_BOOL(pthreads,
3625 [ --with-pthreads Force use of system pthread library with NSPR ],
3626 [ if test "$USE_PTHREADS"x = x; then
3627 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3633 dnl ========================================================
3634 dnl Do the platform specific pthread hackery
3635 dnl ========================================================
3636 if test "$USE_PTHREADS"x != x
3639 dnl See if -pthread is supported.
3642 ac_cv_have_dash_pthread=no
3643 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3644 echo 'int main() { return 0; }' | cat > conftest.c
3645 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3646 if test $? -eq 0; then
3647 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3648 ac_cv_have_dash_pthread=yes
3649 case "$target_os" in
3651 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3654 CFLAGS="$CFLAGS -pthread"
3655 CXXFLAGS="$CXXFLAGS -pthread"
3661 AC_MSG_RESULT($ac_cv_have_dash_pthread)
3664 dnl See if -pthreads is supported.
3666 ac_cv_have_dash_pthreads=no
3667 if test "$ac_cv_have_dash_pthread" = "no"; then
3668 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3669 echo 'int main() { return 0; }' | cat > conftest.c
3670 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3671 if test $? -eq 0; then
3672 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3673 ac_cv_have_dash_pthreads=yes
3674 CFLAGS="$CFLAGS -pthreads"
3675 CXXFLAGS="$CXXFLAGS -pthreads"
3679 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3684 AC_DEFINE(_REENTRANT)
3685 AC_DEFINE(_THREAD_SAFE)
3686 dnl -pthread links in -lc_r, so don't specify it explicitly.
3687 if test "$ac_cv_have_dash_pthread" = "yes"; then
3688 _PTHREAD_LDFLAGS="-pthread"
3690 _PTHREAD_LDFLAGS="-lc_r"
3694 *-*-openbsd*|*-*-bsdi*)
3695 AC_DEFINE(_REENTRANT)
3696 AC_DEFINE(_THREAD_SAFE)
3697 dnl -pthread links in -lc_r, so don't specify it explicitly.
3698 if test "$ac_cv_have_dash_pthread" = "yes"; then
3699 _PTHREAD_LDFLAGS="-pthread"
3703 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3704 AC_DEFINE(_REENTRANT)
3708 AC_DEFINE(_REENTRANT)
3712 AC_DEFINE(_REENTRANT)
3716 AC_DEFINE(_REENTRANT)
3720 AC_DEFINE(_REENTRANT)
3724 AC_DEFINE(_REENTRANT)
3725 if test "$SOLARIS_SUNPRO_CC"; then
3726 CFLAGS="$CFLAGS -mt"
3727 CXXFLAGS="$CXXFLAGS -mt"
3731 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3734 dnl ========================================================
3735 dnl See if mmap sees writes
3736 dnl For cross compiling, just define it as no, which is a safe default
3737 dnl ========================================================
3738 AC_MSG_CHECKING(whether mmap() sees write()s)
3744 #include <sys/mman.h>
3745 #include <sys/types.h>
3746 #include <sys/stat.h>
3749 char fname[] = "conftest.file";
3750 char zbuff[1024]; /* Fractional page is probably worst case */
3757 fd = open(fname, O_RDWR | O_CREAT, 0660);
3760 write(fd, zbuff, sizeof(zbuff));
3761 lseek(fd, 0, SEEK_SET);
3762 map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3763 if(map==(char*)-1) return 2;
3764 for(i=0; fname[i]; i++) {
3765 int rc = write(fd, &fname[i], 1);
3766 if(map[i]!=fname[i]) return 4;
3773 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3775 AC_MSG_RESULT("$result")
3777 if test "$result" = "no"; then
3778 AC_DEFINE(MMAP_MISSES_WRITES)
3782 dnl Checks for library functions.
3783 dnl ========================================================
3784 AC_PROG_GCC_TRADITIONAL
3786 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3787 AC_CHECK_FUNCS(flockfile getpagesize)
3788 AC_CHECK_FUNCS(localtime_r strtok_r)
3790 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock, and -lrt
3791 _SAVE_LDFLAGS=$LDFLAGS
3792 LDFLAGS="$LDFLAGS -lrt"
3793 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC) and -lrt,
3794 ac_cv_have_clock_monotonic,
3795 [AC_TRY_LINK([#include <time.h>],
3796 [ struct timespec ts;
3797 clock_gettime(CLOCK_MONOTONIC, &ts); ],
3798 ac_cv_have_clock_monotonic=yes,
3799 ac_cv_have_clock_monotonic=no)])
3800 LDFLAGS=$_SAVE_LDFLAGS
3801 if test "$ac_cv_have_clock_monotonic" = "yes"; then
3802 HAVE_CLOCK_MONOTONIC=1
3804 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3805 AC_SUBST(HAVE_CLOCK_MONOTONIC)
3806 AC_SUBST(REALTIME_LIBS)
3809 dnl check for wcrtomb/mbrtowc
3810 dnl =======================================================================
3811 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3814 AC_CACHE_CHECK(for wcrtomb,
3816 [AC_TRY_LINK([#include <wchar.h>],
3817 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3818 ac_cv_have_wcrtomb="yes",
3819 ac_cv_have_wcrtomb="no")])
3820 if test "$ac_cv_have_wcrtomb" = "yes"; then
3821 AC_DEFINE(HAVE_WCRTOMB)
3823 AC_CACHE_CHECK(for mbrtowc,
3825 [AC_TRY_LINK([#include <wchar.h>],
3826 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3827 ac_cv_have_mbrtowc="yes",
3828 ac_cv_have_mbrtowc="no")])
3829 if test "$ac_cv_have_mbrtowc" = "yes"; then
3830 AC_DEFINE(HAVE_MBRTOWC)
3837 ac_cv_func_res_ninit,
3840 #define _BSD_SOURCE 1
3844 [int foo = res_ninit(&_res);],
3845 [ac_cv_func_res_ninit=yes],
3846 [ac_cv_func_res_ninit=no])
3849 if test "$ac_cv_func_res_ninit" = "yes"; then
3850 AC_DEFINE(HAVE_RES_NINIT)
3851 dnl must add the link line we do something as foolish as this... dougt
3853 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3854 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3859 [for gnu_get_libc_version()],
3860 ac_cv_func_gnu_get_libc_version,
3862 #ifdef HAVE_GNU_LIBC_VERSION_H
3863 #include <gnu/libc-version.h>
3866 [const char *glibc_version = gnu_get_libc_version();],
3867 [ac_cv_func_gnu_get_libc_version=yes],
3868 [ac_cv_func_gnu_get_libc_version=no]
3872 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3873 AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3877 os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|winmo*|beos*)
3881 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3882 AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3883 AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3885 LIBS="$LIBS $_ICONV_LIBS"
3894 iconv_t h = iconv_open("", "");
3895 iconv(h, NULL, NULL, NULL, NULL);
3898 [ac_cv_func_iconv=yes],
3899 [ac_cv_func_iconv=no]
3902 if test "$ac_cv_func_iconv" = "yes"; then
3903 AC_DEFINE(HAVE_ICONV)
3904 DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3905 LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3906 LIBICONV="$_ICONV_LIBS"
3908 [for iconv() with const input],
3909 ac_cv_func_const_iconv,
3915 const char *input = "testing";
3916 iconv_t h = iconv_open("", "");
3917 iconv(h, &input, NULL, NULL, NULL);
3920 [ac_cv_func_const_iconv=yes],
3921 [ac_cv_func_const_iconv=no]
3924 if test "$ac_cv_func_const_iconv" = "yes"; then
3925 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3937 dnl **********************
3938 dnl *** va_copy checks ***
3939 dnl **********************
3940 dnl we currently check for all three va_copy possibilities, so we get
3941 dnl all results in config.log for bug reports.
3942 AC_MSG_CHECKING(for an implementation of va_copy())
3943 AC_CACHE_VAL(ac_cv_va_copy,[
3946 void f (int i, ...) {
3947 va_list args1, args2;
3948 va_start (args1, i);
3949 va_copy (args2, args1);
3950 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3952 va_end (args1); va_end (args2);
3954 int main() { f (0, 42); return 0; }],
3960 AC_MSG_RESULT($ac_cv_va_copy)
3961 AC_MSG_CHECKING(for an implementation of __va_copy())
3962 AC_CACHE_VAL(ac_cv___va_copy,[
3965 void f (int i, ...) {
3966 va_list args1, args2;
3967 va_start (args1, i);
3968 __va_copy (args2, args1);
3969 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3971 va_end (args1); va_end (args2);
3973 int main() { f (0, 42); return 0; }],
3974 ac_cv___va_copy=yes,
3979 AC_MSG_RESULT($ac_cv___va_copy)
3980 AC_MSG_CHECKING(whether va_lists can be copied by value)
3981 AC_CACHE_VAL(ac_cv_va_val_copy,[
3984 void f (int i, ...) {
3985 va_list args1, args2;
3986 va_start (args1, i);
3988 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3990 va_end (args1); va_end (args2);
3992 int main() { f (0, 42); return 0; }],
3993 ac_cv_va_val_copy=yes,
3994 ac_cv_va_val_copy=no,
3995 ac_cv_va_val_copy=yes
3998 if test "x$ac_cv_va_copy" = "xyes"; then
3999 AC_DEFINE(VA_COPY, va_copy)
4000 AC_DEFINE(HAVE_VA_COPY)
4001 elif test "x$ac_cv___va_copy" = "xyes"; then
4002 AC_DEFINE(VA_COPY, __va_copy)
4003 AC_DEFINE(HAVE_VA_COPY)
4006 if test "x$ac_cv_va_val_copy" = "xno"; then
4007 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
4009 AC_MSG_RESULT($ac_cv_va_val_copy)
4011 dnl Check for dll-challenged libc's.
4012 dnl This check is apparently only needed for Linux.
4015 dnl ===================================================================
4018 rm -rf conftest* _conftest
4020 cat >> conftest.C <<\EOF
4025 void __dump_link_map(void) {
4026 struct link_map *map = _dl_loaded;
4027 while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
4030 dlopen("./conftest1.so",RTLD_LAZY);
4031 dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
4032 dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
4033 dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
4037 /* _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).*/
4038 int main() { printf("./conftest1.so\n"); }
4042 $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
4044 cat >> conftest1.C <<\EOF
4046 void foo(void) {printf("foo in dll called\n");}
4048 ${CXX-g++} -fPIC -c -g conftest1.C
4049 ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
4050 ${CXX-g++} -g conftest.C -o conftest -ldl
4051 cp -f conftest1.so conftest _conftest
4053 if test `./conftest | grep conftest1.so | wc -l` -gt 1
4056 echo "*** Your libc has a bug that can result in loading the same dynamic"
4057 echo "*** library multiple times. This bug is known to be fixed in glibc-2.0.7-32"
4058 echo "*** or later. However, if you choose not to upgrade, the only effect"
4059 echo "*** will be excessive memory usage at runtime."
4063 rm -rf conftest* _conftest
4064 dnl ===================================================================
4068 dnl ===================================================================
4069 dnl ========================================================
4070 dnl Put your C++ language/feature checks below
4071 dnl ========================================================
4076 if test "$GNU_CC"; then
4077 if test "$CPU_ARCH" = "arm" ; then
4078 AC_CACHE_CHECK(for ARM EABI,
4082 #if defined(__ARM_EABI__)
4085 #error Not ARM EABI.
4088 ac_cv_gcc_arm_eabi="yes",
4089 ac_cv_gcc_arm_eabi="no")])
4090 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
4092 ARM_ABI_PREFIX=eabi-
4094 ARM_ABI_PREFIX=oabi-
4098 AC_CACHE_CHECK(for gcc 3.0 ABI,
4099 ac_cv_gcc_three_abi,
4102 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
4108 ac_cv_gcc_three_abi="yes",
4109 ac_cv_gcc_three_abi="no")])
4110 if test "$ac_cv_gcc_three_abi" = "yes"; then
4111 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
4114 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc2}"
4117 AC_SUBST(HAVE_GCC3_ABI)
4120 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
4122 [AC_TRY_COMPILE(class X {
4123 public: explicit X(int i) : i_(i) {}
4127 ac_cv_cpp_explicit=yes,
4128 ac_cv_cpp_explicit=no)])
4129 if test "$ac_cv_cpp_explicit" = yes ; then
4130 AC_DEFINE(HAVE_CPP_EXPLICIT)
4133 AC_CACHE_CHECK(for C++ \"typename\" keyword,
4135 [AC_TRY_COMPILE(class param {
4137 typedef unsigned long num_type;
4140 template <class T> class tplt {
4142 typedef typename T::num_type t_num_type;
4143 t_num_type foo(typename T::num_type num) {
4149 ac_cv_cpp_typename=yes,
4150 ac_cv_cpp_typename=no)])
4151 if test "$ac_cv_cpp_typename" = yes ; then
4152 AC_DEFINE(HAVE_CPP_TYPENAME)
4155 dnl Check for support of modern template specialization syntax
4156 dnl Test code and requirement from scc@netscape.com.
4157 dnl Autoconf cut-and-paste job by waterson@netscape.com
4158 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
4159 ac_cv_cpp_modern_specialize_template_syntax,
4160 [AC_TRY_COMPILE(template <class T> struct X { int a; };
4162 template <> struct X<Y> { double a; };,
4165 ac_cv_cpp_modern_specialize_template_syntax=yes,
4166 ac_cv_cpp_modern_specialize_template_syntax=no)])
4167 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
4168 AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
4172 dnl Some compilers support only full specialization, and some don't.
4173 AC_CACHE_CHECK(whether partial template specialization works,
4174 ac_cv_cpp_partial_specialization,
4175 [AC_TRY_COMPILE(template <class T> class Foo {};
4176 template <class T> class Foo<T*> {};,
4178 ac_cv_cpp_partial_specialization=yes,
4179 ac_cv_cpp_partial_specialization=no)])
4180 if test "$ac_cv_cpp_partial_specialization" = yes ; then
4181 AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
4184 dnl Some compilers have limited support for operators with templates;
4185 dnl specifically, it is necessary to define derived operators when a base
4186 dnl class's operator declaration should suffice.
4187 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
4188 ac_cv_need_derived_template_operators,
4189 [AC_TRY_COMPILE([template <class T> class Base { };
4191 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
4192 template <class T> class Derived : public Base<T> { };],
4193 [Derived<char> a, b;
4194 Base<char> c = a + b;
4196 ac_cv_need_derived_template_operators=no,
4197 ac_cv_need_derived_template_operators=yes)])
4198 if test "$ac_cv_need_derived_template_operators" = yes ; then
4199 AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
4203 dnl Some compilers have trouble detecting that a template class
4204 dnl that derives from another template is actually an instance
4205 dnl of the base class. This test checks for that.
4206 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
4207 ac_cv_need_cpp_template_cast_to_base,
4208 [AC_TRY_COMPILE([template <class T> class Base { };
4209 template <class T> class Derived : public Base<T> { };
4210 template <class T> int foo(const Base<T>&) { return 0; }],
4211 [Derived<char> bar; return foo(bar);],
4212 ac_cv_need_cpp_template_cast_to_base=no,
4213 ac_cv_need_cpp_template_cast_to_base=yes)])
4214 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
4215 AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
4218 dnl Some compilers have trouble resolving the ambiguity between two
4219 dnl functions whose arguments differ only by cv-qualifications.
4220 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
4221 ac_cv_can_resolve_const_ambiguity,
4223 template <class T> class ptrClass {
4227 template <class T> T* a(ptrClass<T> *arg) {
4232 const T* a(const ptrClass<T> *arg) {
4238 ac_cv_can_resolve_const_ambiguity=yes,
4239 ac_cv_can_resolve_const_ambiguity=no)])
4240 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
4241 AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
4245 dnl We don't do exceptions on unix. The only reason this used to be here
4246 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses
4247 dnl exceptions. But, we turn exceptions off by default and this test breaks.
4248 dnl So im commenting this out until someone writes some artificial
4249 dnl intelligence to detect not only if the compiler has exceptions, but if
4250 dnl they are enabled as well.
4252 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
4253 dnl ac_cv_cpp_exceptions,
4254 dnl [AC_TRY_COMPILE(class X { public: X() {} };
4255 dnl static void F() { throw X(); },
4256 dnl try { F(); } catch(X & e) { },
4257 dnl ac_cv_cpp_exceptions=yes,
4258 dnl ac_cv_cpp_exceptions=no)])
4259 dnl if test $ac_cv_cpp_exceptions = yes ; then
4260 dnl AC_DEFINE(HAVE_CPP_EXCEPTIONS)
4263 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
4264 dnl supports it well enough to allow us to use it to change access, but not
4265 dnl to resolve ambiguity. The next two tests determine how well the |using|
4266 dnl keyword is supported.
4268 dnl Check to see if we can change access with |using|. Test both a
4269 dnl legal and an illegal example.
4270 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
4271 ac_cv_cpp_access_changing_using2,
4273 class A { protected: int foo() { return 0; } };
4274 class B : public A { public: using A::foo; };,
4275 B b; return b.foo();,
4277 class A { public: int foo() { return 1; } };
4278 class B : public A { private: using A::foo; };,
4279 B b; return b.foo();,
4280 ac_cv_cpp_access_changing_using2=no,
4281 ac_cv_cpp_access_changing_using2=yes)],
4282 ac_cv_cpp_access_changing_using2=no)])
4283 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
4284 AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
4287 dnl Check to see if we can resolve ambiguity with |using|.
4288 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
4289 ac_cv_cpp_ambiguity_resolving_using,
4290 [AC_TRY_COMPILE(class X {
4291 public: int go(const X&) {return 3;}
4292 int jo(const X&) {return 3;}
4294 class Y : public X {
4295 public: int go(int) {return 2;}
4296 int jo(int) {return 2;}
4298 private: using X::go;
4301 ac_cv_cpp_ambiguity_resolving_using=yes,
4302 ac_cv_cpp_ambiguity_resolving_using=no)])
4303 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
4304 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
4307 dnl Check to see if the |std| namespace is supported. If so, we'll want
4308 dnl to qualify any standard library calls with "std::" to ensure that
4309 dnl those functions can be resolved.
4310 AC_CACHE_CHECK(for \"std::\" namespace,
4311 ac_cv_cpp_namespace_std,
4312 [AC_TRY_COMPILE([#include <algorithm>],
4313 [return std::min(0, 1);],
4314 ac_cv_cpp_namespace_std=yes,
4315 ac_cv_cpp_namespace_std=no)])
4316 if test "$ac_cv_cpp_namespace_std" = yes ; then
4317 AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
4320 dnl Older compilers are overly ambitious with respect to using the standard
4321 dnl template library's |operator!=()| when |operator==()| is defined. In
4322 dnl which case, defining |operator!=()| in addition to |operator==()| causes
4323 dnl ambiguity at compile-time. This test checks for that case.
4324 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
4325 ac_cv_cpp_unambiguous_std_notequal,
4326 [AC_TRY_COMPILE([#include <algorithm>
4328 int operator==(const T1&, const T1&) { return 0; }
4329 int operator!=(const T1&, const T1&) { return 0; }],
4330 [T1 a,b; return a != b;],
4331 ac_cv_cpp_unambiguous_std_notequal=unambiguous,
4332 ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
4333 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
4334 AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
4338 AC_CACHE_CHECK(for C++ reinterpret_cast,
4339 ac_cv_cpp_reinterpret_cast,
4340 [AC_TRY_COMPILE(struct X { int i; };
4341 struct Y { int i; };,
4342 X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
4343 ac_cv_cpp_reinterpret_cast=yes,
4344 ac_cv_cpp_reinterpret_cast=no)])
4345 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
4346 AC_DEFINE(HAVE_CPP_NEW_CASTS)
4349 dnl See if a dynamic_cast to void* gives the most derived object.
4350 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
4351 ac_cv_cpp_dynamic_cast_void_ptr,
4352 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
4353 class Y { int j; public: virtual ~Y() { } };
4354 class Z : public X, public Y { int k; };
4360 return !((((void*)&mdo != (void*)subx) &&
4361 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
4362 (((void*)&mdo != (void*)suby) &&
4363 ((void*)&mdo == dynamic_cast<void*>(suby))));
4365 ac_cv_cpp_dynamic_cast_void_ptr=yes,
4366 ac_cv_cpp_dynamic_cast_void_ptr=no,
4367 ac_cv_cpp_dynamic_cast_void_ptr=no)])
4368 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
4369 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
4373 dnl note that this one is reversed - if the test fails, then
4374 dnl we require implementations of unused virtual methods. Which
4375 dnl really blows because it means we'll have useless vtable
4377 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
4378 ac_cv_cpp_unused_required,
4379 [AC_TRY_LINK(class X {private: virtual void never_called();};,
4381 ac_cv_cpp_unused_required=no,
4382 ac_cv_cpp_unused_required=yes)])
4383 if test "$ac_cv_cpp_unused_required" = yes ; then
4384 AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
4388 dnl Some compilers have trouble comparing a constant reference to a templatized
4389 dnl class to zero, and require an explicit operator==() to be defined that takes
4390 dnl an int. This test separates the strong from the weak.
4392 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
4393 ac_cv_trouble_comparing_to_zero,
4394 [AC_TRY_COMPILE([#include <algorithm>
4395 template <class T> class Foo {};
4397 template <class T> int operator==(const T2*, const T&) { return 0; }
4398 template <class T> int operator!=(const T2*, const T&) { return 0; }],
4399 [Foo<int> f; return (0 != f);],
4400 ac_cv_trouble_comparing_to_zero=no,
4401 ac_cv_trouble_comparing_to_zero=yes)])
4402 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
4403 AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
4406 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
4407 _SAVE_LDFLAGS=$LDFLAGS
4408 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS"
4409 AC_CACHE_CHECK(for __thread keyword for TLS variables,
4410 ac_cv_thread_keyword,
4411 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
4412 [return tlsIsMainThread;],
4413 ac_cv_thread_keyword=yes,
4414 ac_cv_thread_keyword=no)])
4415 LDFLAGS=$_SAVE_LDFLAGS
4416 if test "$ac_cv_thread_keyword" = yes; then
4417 # mips builds fail with TLS variables because of a binutils bug.
4427 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
4432 dnl Check for the existence of various allocation headers/functions
4435 AC_CHECK_HEADER(malloc.h, [MALLOC_H=malloc.h])
4436 if test "$MALLOC_H" = ""; then
4437 AC_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
4438 if test "$MALLOC_H" = ""; then
4439 AC_CHECK_HEADER(sys/malloc.h, [MALLOC_H=sys/malloc.h])
4442 if test "$MALLOC_H" != ""; then
4443 AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
4446 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
4447 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
4449 dnl See if compiler supports some gcc-style attributes
4451 AC_CACHE_CHECK(for __attribute__((always_inline)),
4452 ac_cv_attribute_always_inline,
4454 [inline void f(void) __attribute__((always_inline));],
4455 ac_cv_attribute_always_inline=yes,
4456 ac_cv_attribute_always_inline=no)])
4458 AC_CACHE_CHECK(for __attribute__((malloc)),
4459 ac_cv_attribute_malloc,
4461 [void* f(int) __attribute__((malloc));],
4462 ac_cv_attribute_malloc=yes,
4463 ac_cv_attribute_malloc=no)])
4465 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
4466 ac_cv_attribute_warn_unused,
4468 [int f(void) __attribute__((warn_unused_result));],
4469 ac_cv_attribute_warn_unused=yes,
4470 ac_cv_attribute_warn_unused=no)])
4472 AC_CACHE_CHECK(for __attribute__((noreturn)),
4473 ac_cv_attribute_noreturn,
4475 [void f(void) __attribute__((noreturn));],
4476 ac_cv_attribute_noreturn=yes,
4477 ac_cv_attribute_noreturn=no)])
4479 dnl End of C++ language/feature checks
4482 dnl ========================================================
4483 dnl = Internationalization checks
4484 dnl ========================================================
4486 dnl Internationalization and Locale support is different
4487 dnl on various UNIX platforms. Checks for specific i18n
4488 dnl features go here.
4490 dnl check for LC_MESSAGES
4491 AC_CACHE_CHECK(for LC_MESSAGES,
4492 ac_cv_i18n_lc_messages,
4493 [AC_TRY_COMPILE([#include <locale.h>],
4494 [int category = LC_MESSAGES;],
4495 ac_cv_i18n_lc_messages=yes,
4496 ac_cv_i18n_lc_messages=no)])
4497 if test "$ac_cv_i18n_lc_messages" = yes; then
4498 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4501 AC_HAVE_FUNCS(localeconv)
4503 fi # SKIP_COMPILER_CHECKS
4506 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4507 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4510 dnl Mozilla specific options
4511 dnl ========================================================
4512 dnl The macros used for command line options
4513 dnl are defined in build/autoconf/altoptions.m4.
4515 dnl If the compiler supports these attributes, define them as
4516 dnl convenience macros.
4517 if test "$ac_cv_attribute_always_inline" = yes ; then
4518 AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
4520 AC_DEFINE(NS_ALWAYS_INLINE,)
4523 if test "$ac_cv_attribute_malloc" = yes ; then
4524 AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
4526 AC_DEFINE(NS_ATTR_MALLOC,)
4529 if test "$ac_cv_attribute_warn_unused" = yes ; then
4530 AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
4532 AC_DEFINE(NS_WARN_UNUSED_RESULT,)
4535 if test "$ac_cv_attribute_noreturn" = yes ; then
4536 AC_DEFINE(NS_NORETURN, [__attribute__((noreturn))])
4538 AC_DEFINE(NS_NORETURN,)
4541 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
4542 dnl features that Windows actually does support.
4544 if test -n "$SKIP_COMPILER_CHECKS"; then
4545 dnl Windows has malloc.h
4546 AC_DEFINE(MALLOC_H, [<malloc.h>])
4547 AC_DEFINE(HAVE_FORCEINLINE)
4548 AC_DEFINE(HAVE_LOCALECONV)
4549 fi # SKIP_COMPILER_CHECKS
4551 dnl ========================================================
4553 dnl = Check for external package dependencies
4555 dnl ========================================================
4556 MOZ_ARG_HEADER(External Packages)
4560 MOZ_ARG_WITH_STRING(libxul-sdk,
4561 [ --with-libxul-sdk=PFX Use the libXUL SDK at <PFX>],
4562 LIBXUL_SDK_DIR=$withval)
4564 if test "$LIBXUL_SDK_DIR" = "yes"; then
4565 AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4566 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4567 LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4569 if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
4570 AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
4575 AC_SUBST(LIBXUL_SDK)
4577 if test -n "$LIBXUL_SDK"; then
4578 LIBXUL_DIST="$LIBXUL_SDK"
4580 LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4582 AC_SUBST(LIBXUL_DIST)
4586 MOZ_ARG_WITH_BOOL(system-libxul,
4587 [ --with-system-libxul Use system installed libxul SDK],
4590 if test -n "$SYSTEM_LIBXUL" -a -z "$MOZ_ENABLE_LIBXUL"; then
4591 AC_MSG_ERROR([--with-system-libxul needs --with-libxul-sdk])
4594 dnl ========================================================
4595 dnl = If NSPR was not detected in the system,
4596 dnl = use the one in the source tree (mozilla/nsprpub)
4597 dnl ========================================================
4598 MOZ_ARG_WITH_BOOL(system-nspr,
4599 [ --with-system-nspr Use system installed NSPR],
4600 _USE_SYSTEM_NSPR=1 )
4602 if test -n "$_USE_SYSTEM_NSPR"; then
4603 AM_PATH_NSPR(4.8.7, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
4606 if test -n "$MOZ_NATIVE_NSPR"; then
4607 _SAVE_CFLAGS=$CFLAGS
4608 CFLAGS="$CFLAGS $NSPR_CFLAGS"
4609 AC_TRY_COMPILE([#include "prtypes.h"],
4610 [#ifndef PR_STATIC_ASSERT
4611 #error PR_STATIC_ASSERT not defined or requires including prlog.h
4613 [MOZ_NATIVE_NSPR=1],
4614 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
4615 CFLAGS=$_SAVE_CFLAGS
4617 if test "$OS_ARCH" = "WINCE"; then
4618 NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4619 NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4620 elif test "$OS_ARCH" = "WINNT"; then
4621 NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4622 if test -n "$GNU_CC"; then
4623 NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4625 NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4628 NSPR_CFLAGS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4629 NSPR_LIBS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4633 dnl system libevent Support
4634 dnl ========================================================
4635 MOZ_ARG_WITH_STRING(system-libevent,
4636 [ --with-system-libevent=[PFX]
4637 Use system libevent [installed at prefix PFX]],
4638 LIBEVENT_DIR=$withval)
4640 _SAVE_CFLAGS=$CFLAGS
4641 _SAVE_LDFLAGS=$LDFLAGS
4643 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
4644 MOZ_NATIVE_LIBEVENT=
4646 if test "${LIBEVENT_DIR}" = "yes"; then
4649 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
4650 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
4651 AC_CHECK_HEADER(event.h,
4652 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
4653 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
4655 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
4656 AC_CHECK_LIB(event, event_init,
4657 [MOZ_NATIVE_LIBEVENT=1
4658 MOZ_LIBEVENT_INCLUDES="${LIBEVENT_DIR}/include"
4659 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
4660 [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_INCLUDES= MOZ_LIBEVENT_LIBS=])
4662 CFLAGS=$_SAVE_CFLAGS
4663 LDFLAGS=$_SAVE_LDFLAGS
4666 AC_SUBST(MOZ_NATIVE_LIBEVENT)
4667 AC_SUBST(MOZ_LIBEVENT_INCLUDES)
4668 AC_SUBST(MOZ_LIBEVENT_LIBS)
4670 dnl ========================================================
4671 dnl = If NSS was not detected in the system,
4672 dnl = use the one in the source tree (mozilla/security/nss)
4673 dnl ========================================================
4675 MOZ_ARG_WITH_BOOL(system-nss,
4676 [ --with-system-nss Use system installed NSS],
4679 if test -n "$_USE_SYSTEM_NSS"; then
4680 AM_PATH_NSS(3.12.9, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4683 if test -n "$MOZ_NATIVE_NSS"; then
4684 NSS_LIBS="$NSS_LIBS -lcrmf"
4686 NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4688 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4689 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4690 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4691 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4692 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
4694 if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4696 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4697 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
4698 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
4699 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
4700 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
4702 NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4706 dnl ======================
4708 dnl ======================
4710 AC_MSG_CHECKING([for YASM assembler])
4711 AC_CHECK_PROGS(YASM, yasm, "")
4713 if test -n "$YASM"; then
4714 dnl Pull out yasm's version string
4716 _YASM_VER_FILTER='s|.* \([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\).*|\1|p'
4719 YASM_VERSION=`yasm --version | sed -ne "$_YASM_VER_FILTER"`
4720 _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
4721 _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
4722 _YASM_RELEASE=` echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
4723 _YASM_BUILD=` echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
4726 if test -z "$SKIP_LIBRARY_CHECKS"; then
4727 dnl system JPEG support
4728 dnl ========================================================
4729 MOZ_ARG_WITH_STRING(system-jpeg,
4730 [ --with-system-jpeg[=PFX]
4731 Use system libjpeg [installed at prefix PFX]],
4734 _SAVE_CFLAGS=$CFLAGS
4735 _SAVE_LDFLAGS=$LDFLAGS
4737 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4738 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4739 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4741 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4744 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4747 if test "$SYSTEM_JPEG" = 1; then
4748 LIBS="$JPEG_LIBS $LIBS"
4749 AC_TRY_COMPILE([ #include <stdio.h>
4750 #include <sys/types.h>
4751 #include <jpeglib.h> ],
4752 [ #if JPEG_LIB_VERSION < $MOZJPEG
4753 #error "Insufficient JPEG library version ($MOZJPEG required)."
4756 [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=])
4758 CFLAGS=$_SAVE_CFLAGS
4759 LDFLAGS=$_SAVE_LDFLAGS
4762 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4763 JPEG_CFLAGS="-I${JPEG_DIR}/include"
4764 JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4767 dnl system ZLIB support
4768 dnl ========================================================
4769 MOZ_ARG_WITH_STRING(system-zlib,
4770 [ --with-system-zlib[=PFX]
4771 Use system libz [installed at prefix PFX]],
4774 _SAVE_CFLAGS=$CFLAGS
4775 _SAVE_LDFLAGS=$LDFLAGS
4777 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4778 CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4779 LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4781 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4784 AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"],
4785 [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4787 if test "$SYSTEM_ZLIB" = 1; then
4788 LIBS="$ZLIB_LIBS $LIBS"
4789 AC_TRY_COMPILE([ #include <stdio.h>
4791 #include <zlib.h> ],
4792 [ #if ZLIB_VERNUM < $MOZZLIB
4793 #error "Insufficient zlib version ($MOZZLIB required)."
4796 [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=])
4798 CFLAGS=$_SAVE_CFLAGS
4799 LDFLAGS=$_SAVE_LDFLAGS
4802 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4803 ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4804 ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4807 dnl system BZIP2 Support
4808 dnl ========================================================
4809 MOZ_ARG_WITH_STRING(system-bz2,
4810 [ --with-system-bz2[=PFX]
4811 Use system libbz2 [installed at prefix PFX]],
4814 _SAVE_CFLAGS=$CFLAGS
4815 _SAVE_LDFLAGS=$LDFLAGS
4817 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4818 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4819 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4821 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4824 AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4825 [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=])
4827 CFLAGS=$_SAVE_CFLAGS
4828 LDFLAGS=$_SAVE_LDFLAGS
4831 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4832 BZ2_CFLAGS="-I${BZ2_DIR}/include"
4833 BZ2_LIBS="-L${BZ2_DIR}/lib ${BZ2_LIBS}"
4836 dnl system PNG Support
4837 dnl ========================================================
4838 MOZ_ARG_WITH_STRING(system-png,
4839 [ --with-system-png[=PFX]
4840 Use system libpng [installed at prefix PFX]],
4843 _SAVE_CFLAGS=$CFLAGS
4844 _SAVE_LDFLAGS=$LDFLAGS
4846 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4847 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4848 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4849 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4850 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4852 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4855 _SAVE_PNG_LIBS=$PNG_LIBS
4856 AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4857 AC_MSG_ERROR([--with-system-png requested but no working libpng found]),
4859 AC_CHECK_LIB(png, png_get_acTL, ,
4860 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4863 if test "$SYSTEM_PNG" = 1; then
4864 LIBS="$PNG_LIBS $LIBS"
4865 AC_TRY_COMPILE([ #include <stdio.h>
4866 #include <sys/types.h>
4868 [ #if PNG_LIBPNG_VER < $MOZPNG
4869 #error "Insufficient libpng version ($MOZPNG required)."
4871 #ifndef PNG_UINT_31_MAX
4872 #error "Insufficient libpng version."
4875 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4877 CFLAGS=$_SAVE_CFLAGS
4878 LDFLAGS=$_SAVE_LDFLAGS
4881 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4882 PNG_CFLAGS="-I${PNG_DIR}/include"
4883 PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4886 fi # SKIP_LIBRARY_CHECKS
4888 dnl system HunSpell Support
4889 dnl ========================================================
4890 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4891 [ --enable-system-hunspell
4892 Use system hunspell (located with pkgconfig)],
4895 if test -n "$SYSTEM_HUNSPELL"; then
4896 PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4899 AC_SUBST(SYSTEM_HUNSPELL)
4901 dnl ========================================================
4902 dnl Java SDK support
4903 dnl ========================================================
4905 MOZ_ARG_WITH_STRING(java-include-path,
4906 [ --with-java-include-path=dir
4907 Location of Java SDK headers],
4908 JAVA_INCLUDE_PATH=$withval)
4911 MOZ_ARG_WITH_STRING(java-bin-path,
4912 [ --with-java-bin-path=dir
4913 Location of Java binaries (java, javac, jar)],
4914 JAVA_BIN_PATH=$withval)
4916 dnl ========================================================
4920 dnl ========================================================
4922 MOZ_ARG_HEADER(Application)
4926 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4927 MOZ_BRANDING_DIRECTORY=
4928 MOZ_OFFICIAL_BRANDING=
4938 MOZ_AUTH_EXTENSION=1
4939 MOZ_NO_ACTIVEX_SUPPORT=1
4959 MOZ_PLAINTEXT_EDITOR_ONLY=
4961 MOZ_PREF_EXTENSIONS=1
4962 MOZ_PROFILELOCKING=1
4975 MOZ_TOOLKIT_SEARCH=1
4977 MOZ_UNIVERSALCHARDET=1
4979 MOZ_USE_NATIVE_UCONV=
4981 MOZ_XSLT_STANDALONE=
4987 MOZ_DISABLE_DOMCRYPTO=
4992 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource wyciwyg"
4995 XPC_IDISPATCH_SUPPORT=
4999 *android*|*darwin*|*wince*|*winmo*)
5007 case "$target_os" in
5008 msvc*|mks*|cygwin*|mingw*)
5010 if test -z "$GNU_CC"; then
5011 if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
5015 if test -n "$NS_ENABLE_TSF"; then
5016 AC_DEFINE(NS_ENABLE_TSF)
5028 MOZ_THEME_FASTSTRIPE=1
5034 MOZ_ARG_ENABLE_STRING(application,
5035 [ --enable-application=APP
5039 content/xslt (Standalone Transformiix XSLT)
5040 netwerk (Standalone Necko)
5041 tools/update-packaging (AUS-related packaging tools)
5042 standalone (use this for standalone
5043 xpcom/xpconnect or to manually drive a build)],
5044 [ MOZ_BUILD_APP=$enableval ] )
5046 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
5047 [ --with-xulrunner-stub-name=appname Create the xulrunner stub with the given name],
5048 XULRUNNER_STUB_NAME=$withval)
5050 if test -z "$XULRUNNER_STUB_NAME"; then
5051 case "$target_os" in
5053 XULRUNNER_STUB_NAME=xulrunner
5056 XULRUNNER_STUB_NAME=xulrunner-stub
5059 AC_SUBST(XULRUNNER_STUB_NAME)
5061 if test -z "$MOZ_BUILD_APP"; then
5062 AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
5064 # We have a valid application only if it has a build.mk file in its top
5066 if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
5067 AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
5071 # Allow the application to influence configure with a confvars.sh script.
5073 AC_MSG_CHECKING([if app-specific confvars.sh exists])
5074 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
5075 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
5076 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
5081 # Now is a good time to test for logic errors, define mismatches, etc.
5082 case "$MOZ_BUILD_APP" in
5084 if test "$LIBXUL_SDK"; then
5085 AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
5090 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
5091 # that haven't made a confvars.sh yet. Don't add new stuff here, use
5093 case "$MOZ_BUILD_APP" in
5095 AC_DEFINE(MOZ_PHOENIX)
5099 AC_DEFINE(MOZ_XULRUNNER)
5107 MOZ_APP_NAME=mozilla
5108 MOZ_APP_DISPLAYNAME=Mozilla
5109 MOZ_APP_VERSION=$MOZILLA_VERSION
5114 AC_SUBST(MOZ_BUILD_APP)
5115 AC_SUBST(MOZ_PHOENIX)
5116 AC_SUBST(MOZ_XULRUNNER)
5118 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
5120 dnl ========================================================
5122 dnl = Toolkit Options
5124 dnl ========================================================
5125 MOZ_ARG_HEADER(Toolkit Options)
5127 dnl ========================================================
5128 dnl = Select the default toolkit
5129 dnl ========================================================
5130 MOZ_ARG_ENABLE_STRING(default-toolkit,
5131 [ --enable-default-toolkit=TK
5132 Select default toolkit
5133 Platform specific defaults:
5135 Mac OS X - cairo-cocoa
5136 Neutrino/QNX - photon
5138 Win32/WinCE - cairo-windows
5139 Gtk2 with DirectFB - cairo-gtk2-dfb
5142 [ _DEFAULT_TOOLKIT=$enableval ],
5143 [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
5145 if test "$_DEFAULT_TOOLKIT" = "photon" \
5146 -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
5147 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
5148 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
5149 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
5150 -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
5151 -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
5152 -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
5153 -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
5154 -o "$_DEFAULT_TOOLKIT" = "cairo-android"
5156 dnl nglayout only supports building with one toolkit,
5157 dnl so ignore everything after the first comma (",").
5158 MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
5160 AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
5163 dnl ========================================================
5164 dnl = Enable the toolkit as needed =
5165 dnl ========================================================
5167 case "$MOZ_WIDGET_TOOLKIT" in
5170 AC_DEFINE(MOZ_WIDGET_PHOTON)
5174 MOZ_WIDGET_TOOLKIT=windows
5184 cairo-gtk2|cairo-gtk2-x11)
5185 MOZ_WIDGET_TOOLKIT=gtk2
5187 MOZ_ENABLE_XREMOTE=1
5195 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
5196 TK_LIBS='$(MOZ_GTK2_LIBS)'
5197 AC_DEFINE(MOZ_WIDGET_GTK2)
5202 MOZ_WIDGET_TOOLKIT=gtk2
5209 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
5210 TK_LIBS='$(MOZ_GTK2_LIBS)'
5211 AC_DEFINE(MOZ_WIDGET_GTK2)
5212 if test "$no_x" != "yes"; then
5213 AC_MSG_WARN([Disabling X when DirectFB is specified.])
5220 MOZ_WIDGET_TOOLKIT=qt
5222 MOZ_ENABLE_XREMOTE=1
5231 TK_CFLAGS='$(MOZ_QT_CFLAGS)'
5232 TK_LIBS='$(MOZ_QT_LIBS)'
5233 AC_DEFINE(MOZ_WIDGET_QT)
5238 MOZ_WIDGET_TOOLKIT=beos
5240 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5241 TK_LIBS='$(MOZ_CAIRO_LIBS)'
5245 MOZ_WIDGET_TOOLKIT=os2
5247 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5248 TK_LIBS='$(MOZ_CAIRO_LIBS)'
5253 MOZ_WIDGET_TOOLKIT=cocoa
5254 AC_DEFINE(MOZ_WIDGET_COCOA)
5255 MOZ_USER_DIR="Mozilla"
5256 AC_DEFINE(XP_MACOSX)
5257 TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
5258 TK_CFLAGS="-DNO_X11"
5259 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
5260 CFLAGS="$CFLAGS $TK_CFLAGS"
5261 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
5262 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
5263 MOZ_FS_LAYOUT=bundle
5268 AC_DEFINE(MOZ_WIDGET_ANDROID)
5269 MOZ_WIDGET_TOOLKIT=android
5270 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5271 TK_LIBS='$(MOZ_CAIRO_LIBS)'
5278 AC_SUBST(MOZ_PDF_PRINTING)
5279 if test "$MOZ_PDF_PRINTING"; then
5280 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
5281 AC_DEFINE(MOZ_PDF_PRINTING)
5284 if test "$MOZ_ENABLE_XREMOTE"; then
5285 AC_DEFINE(MOZ_ENABLE_XREMOTE)
5288 if test "$COMPILE_ENVIRONMENT"; then
5289 if test "$MOZ_ENABLE_GTK2"; then
5290 if test "$MOZ_X11"; then
5291 GDK_PACKAGES=gdk-x11-2.0
5292 elif test "$MOZ_DFB"; then
5293 PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
5294 GDK_PACKAGES=directfb
5297 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
5300 fi # COMPILE_ENVIRONMENT
5302 AC_SUBST(MOZ_FS_LAYOUT)
5304 dnl ========================================================
5305 dnl Use ARM userspace kernel helpers; tell NSPR to enable
5306 dnl their usage and use them in spidermonkey.
5307 dnl ========================================================
5308 MOZ_ARG_WITH_BOOL(arm-kuser,
5309 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
5311 if test -n "$USE_ARM_KUSER"; then
5312 AC_DEFINE(USE_ARM_KUSER)
5315 dnl ========================================================
5316 dnl = startup-notification support module
5317 dnl ========================================================
5319 if test "$MOZ_ENABLE_GTK2"
5321 MOZ_ENABLE_STARTUP_NOTIFICATION=
5323 MOZ_ARG_ENABLE_BOOL(startup-notification,
5324 [ --enable-startup-notification
5325 Enable startup-notification support (default: disabled) ],
5326 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
5327 MOZ_ENABLE_STARTUP_NOTIFICATION=)
5328 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
5330 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
5331 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
5332 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
5333 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
5335 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
5337 MOZ_ENABLE_STARTUP_NOTIFICATION=
5341 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
5342 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
5345 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
5347 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
5348 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
5349 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
5351 dnl ========================================================
5353 dnl ========================================================
5354 if test "$MOZ_ENABLE_QT"
5356 MOZ_ARG_WITH_STRING(qtdir,
5357 [ --with-qtdir=\$dir Specify Qt directory ],
5360 if test -z "$QTDIR"; then
5361 PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
5362 AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
5364 MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtDBus -lQtXml -lQtOpenGL"
5366 MOZ_QT_CFLAGS="-DQT_SHARED"
5367 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
5368 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
5369 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
5370 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
5371 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
5372 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDBus"
5373 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
5374 HOST_MOC="$QTDIR/bin/moc"
5376 if test -z "$HOST_MOC"; then
5377 AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
5382 MOZ_ENABLE_QTNETWORK=
5383 PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
5384 MOZ_ENABLE_QTNETWORK=1,
5385 MOZ_ENABLE_QTNETWORK=)
5387 if test "$MOZ_ENABLE_QTNETWORK"; then
5388 MOZ_ENABLE_QTNETWORK=1
5389 AC_DEFINE(MOZ_ENABLE_QTNETWORK)
5393 AC_SUBST(GTK_CONFIG)
5397 AC_SUBST(MOZ_ENABLE_GTK2)
5398 AC_SUBST(MOZ_ENABLE_PHOTON)
5399 AC_SUBST(MOZ_ENABLE_QT)
5400 AC_SUBST(MOZ_ENABLE_QTNETWORK)
5401 AC_SUBST(MOZ_ENABLE_XREMOTE)
5402 AC_SUBST(MOZ_GTK2_CFLAGS)
5403 AC_SUBST(MOZ_GTK2_LIBS)
5404 AC_SUBST(MOZ_QT_CFLAGS)
5405 AC_SUBST(MOZ_QT_LIBS)
5406 AC_SUBST(MOZ_ENABLE_MEEGOTOUCH)
5413 dnl ========================================================
5415 dnl = Components & Features
5417 dnl ========================================================
5418 MOZ_ARG_HEADER(Components and Features)
5420 dnl ========================================================
5422 dnl ========================================================
5423 MOZ_ARG_ENABLE_STRING(ui-locale,
5424 [ --enable-ui-locale=ab-CD
5425 Select the user interface locale (default: en-US)],
5426 MOZ_UI_LOCALE=$enableval )
5427 AC_SUBST(MOZ_UI_LOCALE)
5429 dnl ========================================================
5430 dnl = Trademarked Branding
5431 dnl ========================================================
5432 MOZ_ARG_ENABLE_BOOL(official-branding,
5433 [ --enable-official-branding
5434 Enable Official mozilla.org Branding
5435 Do not distribute builds with
5436 --enable-official-branding unless you have
5437 permission to use trademarks per
5438 http://www.mozilla.org/foundation/trademarks/ .],
5440 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
5441 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
5443 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
5444 MOZ_OFFICIAL_BRANDING=1
5446 ], MOZ_OFFICIAL_BRANDING=)
5448 AC_SUBST(MOZ_OFFICIAL_BRANDING)
5449 if test -n "$MOZ_OFFICIAL_BRANDING"; then
5450 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
5453 MOZ_ARG_WITH_STRING(branding,
5454 [ --with-branding=dir Use branding from the specified directory.],
5455 MOZ_BRANDING_DIRECTORY=$withval)
5457 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
5458 if test -z "$REAL_BRANDING_DIRECTORY"; then
5459 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
5462 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
5463 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
5466 AC_SUBST(MOZ_BRANDING_DIRECTORY)
5468 dnl ========================================================
5469 dnl = Distribution ID
5470 dnl ========================================================
5471 MOZ_ARG_WITH_STRING(distribution-id,
5472 [ --with-distribution-id=ID
5473 Set distribution-specific id (default=org.mozilla)],
5474 [ val=`echo $withval`
5475 MOZ_DISTRIBUTION_ID="$val"])
5477 if test -z "$MOZ_DISTRIBUTION_ID"; then
5478 MOZ_DISTRIBUTION_ID="org.mozilla"
5481 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
5482 AC_SUBST(MOZ_DISTRIBUTION_ID)
5485 dnl ========================================================
5486 dnl complex text support off by default
5487 dnl ========================================================
5488 MOZ_ARG_DISABLE_BOOL(pango,
5489 [ --disable-pango Disable usage of Pango ],
5493 dnl ========================================================
5495 dnl ========================================================
5496 if test "$MOZ_ENABLE_GTK2"
5500 PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5502 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
5503 AC_SUBST(MOZ_PANGO_CFLAGS)
5504 AC_SUBST(MOZ_PANGO_LIBS)
5505 if test "$MOZ_PANGO"
5507 AC_DEFINE(MOZ_PANGO)
5509 PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5510 AC_SUBST(FT2_CFLAGS)
5515 if test "$MOZ_ENABLE_QT"
5517 if test "$MOZ_PANGO"
5519 PKG_CHECK_MODULES(MOZ_PANGO, [pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION],
5521 AC_SUBST(MOZ_PANGO_CFLAGS)
5522 AC_SUBST(MOZ_PANGO_LIBS)
5523 AC_DEFINE(MOZ_PANGO)
5526 echo "Pango library not found, will use FT2 font engine"
5533 dnl ========================================================
5534 dnl = GnomeVFS, GIO and GConf support module
5535 dnl ========================================================
5539 dnl build the gnomevfs extension by default only when the
5540 dnl GTK2 toolkit is in use.
5541 if test "$MOZ_ENABLE_GTK2"
5543 MOZ_ENABLE_GNOMEVFS=1
5547 dnl ========================================================
5548 dnl = GnomeVFS support module
5549 dnl ========================================================
5550 MOZ_ARG_DISABLE_BOOL(gnomevfs,
5551 [ --disable-gnomevfs Disable GnomeVFS support ],
5552 MOZ_ENABLE_GNOMEVFS=,
5553 MOZ_ENABLE_GNOMEVFS=force)
5555 if test "$MOZ_ENABLE_GNOMEVFS"
5557 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5558 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5559 MOZ_ENABLE_GNOMEVFS=1
5560 AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
5562 if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5564 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5566 MOZ_ENABLE_GNOMEVFS=
5569 if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5570 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5571 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5576 AC_SUBST(MOZ_ENABLE_GNOMEVFS)
5577 AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5578 AC_SUBST(MOZ_GNOMEVFS_LIBS)
5580 dnl ========================================================
5581 dnl = GIO support module
5582 dnl ========================================================
5583 MOZ_ARG_ENABLE_BOOL(gio,
5584 [ --enable-gio Enable GIO support (default: disabled)],
5585 MOZ_ENABLE_GIO=force,
5588 if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
5590 PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
5591 MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
5593 AC_DEFINE(MOZ_ENABLE_GIO)
5595 if test "$MOZ_ENABLE_GIO" = "force"
5597 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
5603 AC_SUBST(MOZ_ENABLE_GIO)
5604 AC_SUBST(MOZ_GIO_CFLAGS)
5605 AC_SUBST(MOZ_GIO_LIBS)
5607 dnl ========================================================
5608 dnl = GConf support module
5609 dnl ========================================================
5610 if test "$MOZ_ENABLE_GCONF"
5612 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
5613 MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5616 if test "$MOZ_ENABLE_GCONF" = "force"
5618 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5624 if test "$MOZ_ENABLE_GCONF"; then
5625 AC_DEFINE(MOZ_ENABLE_GCONF)
5628 AC_SUBST(MOZ_ENABLE_GCONF)
5629 AC_SUBST(MOZ_GCONF_CFLAGS)
5630 AC_SUBST(MOZ_GCONF_LIBS)
5633 dnl ========================================================
5634 dnl = libproxy support
5635 dnl ========================================================
5637 if test "$MOZ_ENABLE_GTK2"
5639 MOZ_ENABLE_LIBPROXY=
5641 MOZ_ARG_ENABLE_BOOL(libproxy,
5642 [ --enable-libproxy Enable libproxy support ],
5643 MOZ_ENABLE_LIBPROXY=1,
5644 MOZ_ENABLE_LIBPROXY=)
5646 if test "$MOZ_ENABLE_LIBPROXY"
5648 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
5649 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
5652 AC_SUBST(MOZ_ENABLE_LIBPROXY)
5653 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
5654 AC_SUBST(MOZ_LIBPROXY_LIBS)
5656 dnl ========================================================
5657 dnl = libnotify support
5658 dnl ========================================================
5660 if test "$MOZ_ENABLE_GTK2"
5662 MOZ_ENABLE_LIBNOTIFY=1
5664 MOZ_ARG_DISABLE_BOOL(libnotify,
5665 [ --disable-libnotify Disable libnotify support ],
5666 MOZ_ENABLE_LIBNOTIFY=,
5667 MOZ_ENABLE_LIBNOTIFY=1)
5669 if test "$MOZ_ENABLE_LIBNOTIFY"
5671 AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5675 if test -z "$SKIP_LIBRARY_CHECKS"
5677 if test "$MOZ_ENABLE_GTK2"
5679 if test "$MOZ_ENABLE_LIBNOTIFY"
5681 PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5685 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5686 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5687 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5689 dnl ========================================================
5690 dnl = GNOME component (mozgnome)
5691 dnl ========================================================
5693 # The GNOME component is built if one of
5694 # gnome-vfs, gio, gconf or libnotify is available.
5695 if test "$MOZ_ENABLE_GCONF" -o \
5696 "$MOZ_ENABLE_GNOMEVFS" -o \
5697 "$MOZ_ENABLE_GIO" -o \
5698 "$MOZ_ENABLE_LIBNOTIFY"; then
5699 MOZ_ENABLE_GNOME_COMPONENT=1
5701 MOZ_ENABLE_GNOME_COMPONENT=
5703 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5705 dnl ========================================================
5706 dnl = libgnomeui support module
5707 dnl ========================================================
5709 if test "$MOZ_ENABLE_GTK2"
5711 MOZ_ENABLE_GNOMEUI=1
5713 MOZ_ARG_DISABLE_BOOL(gnomeui,
5714 [ --disable-gnomeui Disable libgnomeui support (default: auto, optional at runtime) ],
5715 MOZ_ENABLE_GNOMEUI=,
5716 MOZ_ENABLE_GNOMEUI=force)
5718 if test "$MOZ_ENABLE_GNOMEUI"
5720 PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5722 MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5723 MOZ_ENABLE_GNOMEUI=1
5725 if test "$MOZ_ENABLE_GNOMEUI" = "force"
5727 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5733 if test "$MOZ_ENABLE_GNOMEUI"; then
5734 AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5738 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5739 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5740 AC_SUBST(MOZ_GNOMEUI_LIBS)
5742 dnl ========================================================
5744 dnl ========================================================
5746 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5750 MOZ_ARG_DISABLE_BOOL(dbus,
5751 [ --disable-dbus Disable dbus support ],
5755 if test "$MOZ_ENABLE_DBUS"
5757 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5758 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5759 AC_DEFINE(MOZ_ENABLE_DBUS)
5762 AC_SUBST(MOZ_ENABLE_DBUS)
5763 AC_SUBST(MOZ_DBUS_CFLAGS)
5764 AC_SUBST(MOZ_DBUS_LIBS)
5765 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5766 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5768 dnl ========================================================
5769 dnl = Build Personal Security Manager
5770 dnl ========================================================
5771 MOZ_ARG_DISABLE_BOOL(crypto,
5772 [ --disable-crypto Disable crypto support (Personal Security Manager)],
5776 dnl ========================================================
5777 dnl = JS Debugger XPCOM component (js/jsd)
5778 dnl ========================================================
5779 MOZ_ARG_DISABLE_BOOL(jsd,
5780 [ --disable-jsd Disable JavaScript debug library],
5785 dnl ========================================================
5786 dnl = Disable IPC support for tabs and plugins
5787 dnl ========================================================
5788 MOZ_ARG_DISABLE_BOOL(ipc,
5789 [ --disable-ipc Disable IPC supports for tabs and plugins],
5793 if test -n "$MOZ_IPC"; then
5799 dnl ========================================================
5800 dnl = Enable IPDL's "expensive" unit tests
5801 dnl ========================================================
5804 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5805 [ --enable-ipdl-tests Enable expensive IPDL tests],
5809 if test -z "$MOZ_IPC" -a -n "$MOZ_IPDL_TESTS"; then
5810 AC_MSG_ERROR([--enable-ipdl-tests requires --enable-ipc])
5813 if test -n "$MOZ_IPDL_TESTS"; then
5814 AC_DEFINE(MOZ_IPDL_TESTS)
5817 AC_SUBST(MOZ_IPDL_TESTS)
5819 dnl ========================================================
5820 dnl = Disable plugin support
5821 dnl ========================================================
5822 MOZ_ARG_DISABLE_BOOL(plugins,
5823 [ --disable-plugins Disable plugins support],
5827 dnl ========================================================
5828 dnl = Disable building dbm
5829 dnl ========================================================
5830 MOZ_ARG_DISABLE_BOOL(dbm,
5831 [ --disable-dbm Disable building dbm],
5835 dnl bi-directional support always on
5839 dnl ========================================================
5840 dnl view source support on by default
5841 dnl ========================================================
5842 if test "$MOZ_VIEW_SOURCE"; then
5843 AC_DEFINE(MOZ_VIEW_SOURCE)
5846 dnl ========================================================
5847 dnl accessibility support on by default on all platforms
5849 dnl ========================================================
5850 MOZ_ARG_DISABLE_BOOL(accessibility,
5851 [ --disable-accessibility Disable accessibility support (off by default on OS X)],
5854 if test "$ACCESSIBILITY"; then
5855 AC_DEFINE(ACCESSIBILITY)
5858 if test -n "$ACCESSIBILITY" -a "$COMPILE_ENVIRONMENT" = "1"; then
5860 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5861 if test "$ac_cv_header_atlbase_h" = "no"; then
5862 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.])
5864 if test "$ac_cv_header_oleacc_idl" = "no"; then
5865 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.])
5871 dnl ========================================================
5872 dnl xpcom js loader support on by default
5873 dnl ========================================================
5874 if test "$MOZ_JSLOADER"; then
5875 AC_DEFINE(MOZ_JSLOADER)
5878 dnl ========================================================
5879 dnl Disable printing
5880 dnl ========================================================
5881 MOZ_ARG_DISABLE_BOOL(printing,
5882 [ --disable-printing Disable printing support],
5886 if test "$NS_PRINTING"; then
5887 AC_DEFINE(NS_PRINTING)
5888 AC_DEFINE(NS_PRINT_PREVIEW)
5890 dnl ========================================================
5891 dnl use native unicode converters
5892 dnl ========================================================
5893 MOZ_ARG_ENABLE_BOOL(native-uconv,
5894 [ --enable-native-uconv Enable iconv support],
5895 MOZ_USE_NATIVE_UCONV=1,
5896 MOZ_USE_NATIVE_UCONV= )
5897 if test "$MOZ_USE_NATIVE_UCONV"; then
5898 AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5900 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5901 AC_MSG_ERROR([iconv() not found. Cannot enable native uconv support.])
5905 dnl ========================================================
5906 dnl Libeditor can be build as plaintext-only,
5907 dnl or as a full html and text editing component.
5908 dnl We build both by default.
5909 dnl ========================================================
5910 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5911 [ --enable-plaintext-editor-only
5912 Allow only plaintext editing],
5913 MOZ_PLAINTEXT_EDITOR_ONLY=1,
5914 MOZ_PLAINTEXT_EDITOR_ONLY= )
5915 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5916 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5918 dnl ========================================================
5919 dnl = Disable Fast Load
5920 dnl ========================================================
5921 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5922 [ --disable-xpcom-fastload
5923 Disable XPCOM fastload support],
5927 AC_SUBST(MOZ_NO_FAST_LOAD)
5929 if test -n "$MOZ_NO_FAST_LOAD"; then
5930 AC_DEFINE(MOZ_NO_FAST_LOAD)
5933 dnl ========================================================
5934 dnl = Enable Raw Codecs
5935 dnl ========================================================
5936 MOZ_ARG_ENABLE_BOOL(raw,
5937 [ --enable-raw Enable support for RAW media],
5941 if test -n "$MOZ_RAW"; then
5948 dnl ========================================================
5949 dnl = Disable Ogg Codecs
5950 dnl ========================================================
5951 MOZ_ARG_DISABLE_BOOL(ogg,
5952 [ --disable-ogg Disable support for OGG media (Theora video and Vorbis audio)],
5956 if test -n "$MOZ_OGG"; then
5960 case "$target_cpu" in
5969 dnl Checks for __attribute__(aligned()) directive
5970 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5971 [ac_cv_c_attribute_aligned],
5972 [ac_cv_c_attribute_aligned=0
5973 CFLAGS_save="${CFLAGS}"
5974 CFLAGS="${CFLAGS} -Werror"
5975 for ac_cv_c_attr_align_try in 64 32 16 8; do
5976 echo "trying $ac_cv_c_attr_align_try"
5978 [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5979 [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5980 if test "$ac_cv_c_attribute_aligned" != 0; then
5984 CFLAGS="${CFLAGS_save}"])
5985 if test "${ac_cv_c_attribute_aligned}" != "0"; then
5986 AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5987 [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5991 dnl ========================================================
5992 dnl = Disable VP8 decoder support
5993 dnl ========================================================
5994 MOZ_ARG_DISABLE_BOOL(webm,
5995 [ --disable-webm Disable support for WebM media (VP8 video and Vorbis audio)],
5999 dnl system libvpx Support
6000 dnl ========================================================
6001 MOZ_ARG_WITH_STRING(system-libvpx,
6002 [ --with-system-libvpx=[PFX]
6003 Use system libvpx [installed at prefix PFX]],
6004 LIBVPX_DIR=$withval)
6007 MOZ_LIBVPX_INCLUDES=
6010 if test -n "$MOZ_WEBM"; then
6013 if test -n "$LIBVPX_DIR" -a "$LIBVPX_DIR" != no; then
6014 _SAVE_CFLAGS=$CFLAGS
6015 _SAVE_LDFLAGS=$LDFLAGS
6017 if test "${LIBVPX_DIR}" = "yes"; then
6020 CFLAGS="-I${LIBVPX_DIR}/include $CFLAGS"
6021 LDFLAGS="-L${LIBVPX_DIR}/lib $LDFLAGS"
6022 AC_CHECK_HEADER(vpx/vpx_decoder.h,
6023 [if test ! -f "${LIBVPX_DIR}/include/vpx/vpx_decoder.h"; then
6024 AC_MSG_ERROR([vpx/vpx_decoder.h found, but is not in ${LIBVPX_DIR}/include])
6026 AC_MSG_ERROR([--with-system-libvpx requested but vpx/vpx_decoder.h not found]))
6027 AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver,
6028 [MOZ_NATIVE_LIBVPX=1
6029 MOZ_LIBVPX_INCLUDES="-I${LIBVPX_DIR}/include"
6030 MOZ_LIBVPX_LIBS="-L${LIBVPX_DIR}/lib -lvpx"],
6031 ([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found]))
6032 CFLAGS=$_SAVE_CFLAGS
6033 LDFLAGS=$_SAVE_LDFLAGS
6038 AC_SUBST(MOZ_NATIVE_LIBVPX)
6039 AC_SUBST(MOZ_LIBVPX_INCLUDES)
6040 AC_SUBST(MOZ_LIBVPX_LIBS)
6042 if test -n "$MOZ_WEBM" -a -z "$MOZ_NATIVE_LIBVPX"; then
6045 case "$target_cpu" in
6055 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
6056 dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
6057 dnl We currently require gcc on all arm platforms.
6061 dnl See if we have assembly on this platform.
6062 case "$OS_ARCH:$CPU_ARCH" in
6064 VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
6068 VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
6072 VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
6076 VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
6080 VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
6084 VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
6088 if test -z "$GNU_CC"; then
6089 VPX_ASFLAGS="-f x64 -rnasm -pnasm"
6094 if test -z "$GNU_CC"; then
6095 dnl Check for yasm 1.1 or greater.
6096 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
6097 AC_MSG_ERROR([yasm 1.1 or greater is required to build libvpx on Win32, but it appears not to be installed. Install it (included in MozillaBuild 1.5.1 and newer) or configure with --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
6098 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6099 AC_MSG_ERROR([yasm 1.1 or greater is required to build libvpx on Win32, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION. Upgrade to the newest version (included in MozillaBuild 1.5.1 and newer) or configure with --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
6101 VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
6107 if test -n "$GNU_AS" ; then
6109 dnl These flags are a lie; they're just used to enable the requisite
6110 dnl opcodes; actual arch detection is done at runtime.
6111 VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
6112 VPX_DASH_C_FLAG="-c"
6113 VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
6114 VPX_ASM_SUFFIX="$ASM_SUFFIX"
6119 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
6120 AC_MSG_ERROR([yasm is a required build tool for this architecture when webm is enabled. You may either install yasm or --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
6123 if test -n "$VPX_X86_ASM"; then
6124 AC_DEFINE(VPX_X86_ASM)
6125 elif test -n "$VPX_ARM_ASM"; then
6126 AC_DEFINE(VPX_ARM_ASM)
6128 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
6132 dnl ========================================================
6133 dnl = Disable Wave decoder support
6134 dnl ========================================================
6135 MOZ_ARG_DISABLE_BOOL(wave,
6136 [ --disable-wave Disable Wave decoder support],
6140 if test -n "$MOZ_WAVE"; then
6146 dnl ========================================================
6147 dnl = Handle dependent SYDNEYAUDIO and MEDIA defines
6148 dnl ========================================================
6150 if test -n "$MOZ_SYDNEYAUDIO"; then
6151 AC_DEFINE(MOZ_SYDNEYAUDIO)
6154 if test -n "$MOZ_MEDIA"; then
6155 AC_DEFINE(MOZ_MEDIA)
6158 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
6159 AC_MSG_ERROR([MOZ_VORBIS and MOZ_TREMOR are mutually exclusive! The build system should not allow them both to be set, but they are. Please file a bug at https://bugzilla.mozilla.org/])
6162 if test -n "$MOZ_VORBIS"; then
6163 AC_DEFINE(MOZ_VORBIS)
6166 if test -n "$MOZ_TREMOR"; then
6167 AC_DEFINE(MOZ_TREMOR)
6170 dnl ========================================================
6171 dnl = Check alsa availability on Linux if using sydneyaudio
6172 dnl ========================================================
6174 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
6175 if test -n "$MOZ_SYDNEYAUDIO"; then
6176 case "$target_os" in
6178 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
6179 [echo "$MOZ_ALSA_PKG_ERRORS"
6180 AC_MSG_ERROR([Need alsa for Ogg, Wave or WebM decoding on Linux. Disable with --disable-ogg --disable-wave --disable-webm. (On Ubuntu, you might try installing the package libasound2-dev.)])])
6185 dnl ========================================================
6187 dnl ========================================================
6188 AC_ARG_ENABLE(splashscreen,
6189 [ --enable-splashscreen display splashscreen while loading (default=no)],
6190 [enable_splash="yes"],[enable_splash=""])
6191 if test "x$enable_splash" = "xyes"; then
6193 AC_DEFINE(MOZ_SPLASHSCREEN)
6195 AC_SUBST(MOZ_SPLASHSCREEN)
6197 dnl ========================================================
6198 dnl Permissions System
6199 dnl ========================================================
6200 MOZ_ARG_DISABLE_BOOL(permissions,
6201 [ --disable-permissions Disable permissions (popup and cookie blocking)],
6206 dnl ========================================================
6208 dnl ========================================================
6209 MOZ_ARG_DISABLE_BOOL(negotiateauth,
6210 [ --disable-negotiateauth Disable GSS-API negotiation ],
6211 MOZ_AUTH_EXTENSION=,
6212 MOZ_AUTH_EXTENSION=1 )
6214 dnl ========================================================
6216 dnl ========================================================
6217 MOZ_ARG_DISABLE_BOOL(xtf,
6218 [ --disable-xtf Disable XTF (pluggable xml tags) support],
6221 if test "$MOZ_XTF"; then
6225 dnl ========================================================
6226 dnl Pref extensions (autoconfig and system-pref)
6227 dnl ========================================================
6228 MOZ_ARG_DISABLE_BOOL(pref-extensions,
6229 [ --disable-pref-extensions
6230 Disable pref extensions such as autoconfig and
6232 MOZ_PREF_EXTENSIONS=,
6233 MOZ_PREF_EXTENSIONS=1 )
6235 dnl ========================================================
6236 dnl = Universalchardet
6237 dnl ========================================================
6238 MOZ_ARG_DISABLE_BOOL(universalchardet,
6239 [ --disable-universalchardet
6240 Disable universal encoding detection],
6241 MOZ_UNIVERSALCHARDET=,
6242 MOZ_UNIVERSALCHARDET=1 )
6244 dnl ========================================================
6246 dnl ========================================================
6253 MOZ_ARG_ENABLE_BOOL(javaxpcom,
6254 [ --enable-javaxpcom
6255 Enable Java-XPCOM bridge],
6261 if test -n "$JAVA_HOME"; then
6262 JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
6266 if test -n "$JAVA_HOME"; then
6267 JAVA_HOME=`cd "$JAVA_HOME" && pwd`
6272 if test -n "${JAVA_BIN_PATH}"; then
6273 dnl Look for javac and jar in the specified path.
6274 JAVA_PATH="$JAVA_BIN_PATH"
6276 dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
6277 JAVA_PATH="$JAVA_HOME/bin:$PATH"
6280 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
6281 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
6282 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
6284 if test -n "${JAVA_BIN_PATH}" -o "$OS_TARGET" = Android; then
6285 if test -z "$JAVA" -o "$JAVA" = ":" -o -z "$JAVAC" -o "$JAVAC" = ":" -o -z "$JAR" -o "$JAR" = ":"; then
6286 AC_MSG_ERROR([The programs java, javac and jar were not found. Set \$JAVA_HOME to your java sdk directory or use --with-java-bin-path={java-bin-dir}])
6290 if test -n "${MOZ_JAVAXPCOM}"; then
6291 if test -n "${JAVA_INCLUDE_PATH}"; then
6292 dnl Make sure jni.h exists in the given include path.
6293 if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
6294 AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
6297 case "$target_os" in
6299 dnl Default to java system location
6300 JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
6304 JAVA_INCLUDE_PATH="$JAVA_HOME/include"
6307 if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
6308 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.])
6313 dnl ========================================================
6314 dnl = ANGLE OpenGL->D3D translator for WebGL
6315 dnl = * only applies to win32
6316 dnl = * enabled by default (shipping build); requires explicit --disable to disable
6317 dnl ========================================================
6319 MOZ_DIRECTX_SDK_PATH=
6320 case "$target_os" in
6321 *msvc*|*mks*|*cygwin*|*mingw*)
6326 if test -n "$MOZ_ANGLE"; then
6327 MOZ_ARG_DISABLE_BOOL(angle,
6328 [ --disable-angle Disable building of ANGLE for WebGL->D3D translation],
6332 if test -n "$MOZ_ANGLE"; then
6333 if test -z "$_WIN32_MSVC"; then
6334 AC_MSG_ERROR([Building ANGLE requires MSVC. To build without ANGLE, reconfigure with --disable-angle.])
6337 AC_CHECK_HEADER(d3dx9.h, [], [MOZ_ANGLE=])
6339 if test -z "$MOZ_ANGLE"; then
6340 # Try again, but try to get the SDK path from the registry. We're going to hardcode
6341 # the February 2010 SDK, since that's the one that's installed on the tinderboxen.
6342 MOZ_DIRECTX_SDK_PATH=`reg query 'HKLM\Software\Microsoft\DirectX\Microsoft DirectX SDK (February 2010)' //v InstallPath | grep REG_SZ | sed 's, *, ,g' | cut -d' ' -f4`
6343 if test -n "$MOZ_DIRECTX_SDK_PATH" ; then
6344 if test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h && test -f "$MOZ_DIRECTX_SDK_PATH"/lib/x86/dxguid.lib ; then
6345 AC_MSG_WARN([Found DirectX SDK in registry, using $MOZ_DIRECTX_SDK])
6351 if test -z "$MOZ_ANGLE"; then
6352 AC_MSG_WARN([Couldn't find d3dx9.h in your INCLUDE path, needed for ANGLE. Please install the February 2010 DirectX SDK, or make another version available in your LIB and INCLUDE path env variables. To explicitly build without ANGLE, reconfigure with --disable-angle.])
6353 AC_MSG_WARN([This will become an error in the future.])
6358 dnl ========================================================
6359 dnl = Breakpad crash reporting (on by default on supported platforms)
6360 dnl ========================================================
6363 i?86-*-mingw*|x86_64-*-mingw*)
6366 i?86-apple-darwin*|powerpc-apple-darwin*|x86_64-apple-darwin*)
6369 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
6380 MOZ_ARG_DISABLE_BOOL(crashreporter,
6381 [ --disable-crashreporter Disable breakpad crash reporting],
6383 MOZ_CRASHREPORTER=1)
6385 if test -n "$MOZ_CRASHREPORTER"; then
6386 AC_DEFINE(MOZ_CRASHREPORTER)
6388 if (test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS") && \
6389 test -z "$SKIP_LIBRARY_CHECKS"; then
6390 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
6391 AC_SUBST(MOZ_GTHREAD_CFLAGS)
6392 AC_SUBST(MOZ_GTHREAD_LIBS)
6394 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.])])
6398 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
6399 [ --with-crashreporter-enable-percent=NN
6400 Enable sending crash reports by default on NN% of users. (default=100)],
6401 [ val=`echo $withval | sed 's/[^0-9]//g'`
6402 MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
6404 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
6405 MOZ_CRASHREPORTER_ENABLE_PERCENT=100
6407 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
6409 dnl ========================================================
6410 dnl = Enable compilation of specific extension modules
6411 dnl ========================================================
6413 MOZ_ARG_ENABLE_STRING(extensions,
6414 [ --enable-extensions Enable extensions],
6415 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6416 if test "$option" = "yes" -o "$option" = "all"; then
6417 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6418 elif test "$option" = "no" -o "$option" = "none"; then
6420 elif test "$option" = "default"; then
6421 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6422 elif test `echo "$option" | grep -c \^-` != 0; then
6423 option=`echo $option | sed 's/^-//'`
6424 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6426 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6429 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6431 if test -z "$MOZ_ENABLE_GNOMEVFS" -a -z "$MOZ_GNOMEVFS_LIBS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6432 # Suppress warning on non-X11 platforms
6433 if test -n "$MOZ_X11"; then
6434 AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
6436 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6439 dnl Do not build gnomevfs with libxul based apps
6440 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6441 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6444 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6445 # Suppress warning on non-X11 platforms
6446 if test -n "$MOZ_X11"; then
6447 AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
6449 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6452 dnl Do not build gio with libxul based apps
6453 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6454 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6457 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6458 AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6459 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6462 dnl This might be temporary: build tridentprofile only on Windows
6463 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
6464 AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
6465 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
6468 dnl cookie must be built before tridentprofile. put it at list's end.
6469 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
6470 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
6471 MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
6474 dnl xforms requires xtf
6475 if test -z "$MOZ_XTF" -a `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
6476 AC_MSG_WARN([Cannot build XForms without XTF support. Removing XForms from MOZ_EXTENSIONS.])
6477 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6480 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
6481 AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
6482 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
6485 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
6486 AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
6487 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
6490 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
6491 AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
6492 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
6495 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
6496 AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
6497 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
6500 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
6501 AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
6502 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
6505 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
6506 AC_MSG_WARN([spellcheck is no longer an extension.])
6507 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
6511 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6513 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6514 dnl when trying to build a nonexistent extension.
6515 for extension in $MOZ_EXTENSIONS; do
6516 if test ! -d "${srcdir}/extensions/${extension}"; then
6517 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6521 dnl ========================================================
6522 dnl MathML on by default
6523 dnl ========================================================
6524 MOZ_ARG_DISABLE_BOOL(mathml,
6525 [ --disable-mathml Disable MathML support],
6528 if test "$MOZ_MATHML"; then
6529 AC_DEFINE(MOZ_MATHML)
6532 dnl ========================================================
6533 dnl Keeping AC_DEFINE(MOZ_SVG) for the moment in case of something needs it.
6534 dnl ========================================================
6537 dnl ========================================================
6539 dnl ========================================================
6541 MOZ_ARG_DISABLE_BOOL(smil,
6542 [ --disable-smil Disable SMIL animation support],
6545 if test -n "$MOZ_SMIL"; then
6549 dnl ========================================================
6550 dnl Build Freetype in the tree
6551 dnl ========================================================
6552 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6553 [ --enable-tree-freetype Enable Tree FreeType],
6554 MOZ_TREE_FREETYPE=1,
6555 MOZ_TREE_FREETYPE= )
6556 if test -n "$MOZ_TREE_FREETYPE"; then
6557 if test -n "$_WIN32_MSVC"; then
6558 AC_ERROR("building with in-tree freetype is not supported on MSVC")
6560 AC_DEFINE(MOZ_TREE_FREETYPE)
6561 AC_SUBST(MOZ_TREE_FREETYPE)
6562 MOZ_ENABLE_CAIRO_FT=1
6563 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6564 FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6565 CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6566 FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6567 CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6568 AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6569 AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6570 AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6571 AC_SUBST(CAIRO_FT_CFLAGS)
6575 dnl ========================================================
6577 dnl ========================================================
6578 case "$target_os" in
6579 aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*|winmo*)
6584 MOZ_ARG_DISABLE_BOOL(installer,
6585 [ --disable-installer Disable building of installer],
6588 if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then
6589 # Disable installer for Windows builds that use the new toolkit if the
6590 # required major version and minimum minor version of Unicode NSIS isn't in
6592 REQ_NSIS_MAJOR_VER=2
6593 MIN_NSIS_MINOR_VER=33
6594 MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensisu makensis)
6595 if test -z "$MAKENSISU" -o "$MAKENSISU" = ":"; then
6596 AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or Unicode NSIS with a major version of $REQ_NSIS_MAJOR_VER and a minimum minor version of $MIN_NSIS_MINOR_VER in your path. To build without the installer reconfigure using --disable-installer.])
6599 MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\)\-Unicode$/\1/g'`
6601 if test ! "$MAKENSISU_VER" = ""; then
6602 MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6603 MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6605 AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6606 if test "$MAKENSISU_VER" = "" ||
6607 test ! "$MAKENSISU_MAJOR_VER" = "$REQ_NSIS_MAJOR_VER" -o \
6608 ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6610 AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or Unicode NSIS with a major version of $REQ_NSIS_MAJOR_VER and a minimum minor version of $MIN_NSIS_MINOR_VER in your path. To build without the installer reconfigure using --disable-installer.])
6612 AC_MSG_RESULT([yes])
6613 MAKENSISU="${CYGWIN_WRAPPER} $MAKENSISU"
6616 AC_SUBST(MOZ_INSTALLER)
6618 AC_MSG_CHECKING([for tar archiver])
6619 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6620 if test -z "$TAR"; then
6621 AC_MSG_ERROR([no tar archiver found in \$PATH])
6623 AC_MSG_RESULT([$TAR])
6626 AC_MSG_CHECKING([for wget])
6627 AC_CHECK_PROGS(WGET, wget, "")
6628 AC_MSG_RESULT([$WGET])
6631 dnl ========================================================
6633 dnl ========================================================
6635 MOZ_ARG_DISABLE_BOOL(updater,
6636 [ --disable-updater Disable building of updater],
6640 if test -n "$MOZ_UPDATER"; then
6641 AC_DEFINE(MOZ_UPDATER)
6644 # app update channel is 'default' when not supplied.
6645 MOZ_ARG_ENABLE_STRING([update-channel],
6646 [ --enable-update-channel=CHANNEL
6647 Select application update channel (default=default)],
6648 MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6650 if test -z "$MOZ_UPDATE_CHANNEL"; then
6651 MOZ_UPDATE_CHANNEL=default
6653 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6654 AC_SUBST(MOZ_UPDATE_CHANNEL)
6656 # tools/update-packaging is not checked out by default.
6657 MOZ_ARG_ENABLE_BOOL(update-packaging,
6658 [ --enable-update-packaging
6659 Enable tools/update-packaging],
6660 MOZ_UPDATE_PACKAGING=1,
6661 MOZ_UPDATE_PACKAGING= )
6662 AC_SUBST(MOZ_UPDATE_PACKAGING)
6664 dnl ========================================================
6666 dnl ========================================================
6668 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
6669 [ --disable-xpconnect-idispatch
6670 Disable building of xpconnect support for IDispatch
6672 XPC_IDISPATCH_SUPPORT=,
6673 XPC_IDISPATCH_SUPPORT=1)
6674 AC_SUBST(XPC_IDISPATCH_SUPPORT)
6676 MOZ_ARG_DISABLE_BOOL(activex,
6677 [ --disable-activex Disable building of ActiveX control (win32 only)],
6678 MOZ_NO_ACTIVEX_SUPPORT=1,
6679 MOZ_NO_ACTIVEX_SUPPORT= )
6680 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
6682 MOZ_ARG_ENABLE_BOOL(activex-scripting,
6683 [ --enable-activex-scripting
6684 Enable building of ActiveX scripting support (win32)],
6685 MOZ_ACTIVEX_SCRIPTING_SUPPORT=1,
6686 MOZ_ACTIVEX_SCRIPTING_SUPPORT=)
6687 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
6689 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
6691 AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
6694 if test "$COMPILE_ENVIRONMENT" = "1"; then
6695 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
6697 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
6698 if test "$ac_cv_header_atlbase_h" = "no"; then
6699 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.])
6706 dnl ========================================================
6708 dnl ========================================================
6709 MOZ_ARG_ENABLE_BOOL(leaky,
6710 [ --enable-leaky Build leaky memory tool],
6715 dnl ========================================================
6716 dnl build the tests by default
6717 dnl ========================================================
6718 MOZ_ARG_DISABLE_BOOL(tests,
6719 [ --disable-tests Do not build test libraries & programs],
6723 dnl ========================================================
6724 dnl parental controls (for Windows Vista)
6725 dnl ========================================================
6726 MOZ_ARG_DISABLE_BOOL(parental-controls,
6727 [ --disable-parental-controls
6728 Do not build parental controls],
6729 MOZ_DISABLE_PARENTAL_CONTROLS=1,
6730 MOZ_DISABLE_PARENTAL_CONTROLS=)
6731 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6732 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6735 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6737 dnl ========================================================
6738 dnl = Disable DOMCrypto
6739 dnl ========================================================
6740 if test -n "$MOZ_DISABLE_DOMCRYPTO"; then
6741 AC_DEFINE(MOZ_DISABLE_DOMCRYPTO)
6744 dnl ========================================================
6746 dnl = Module specific options
6748 dnl ========================================================
6749 MOZ_ARG_HEADER(Individual module options)
6751 dnl ========================================================
6752 dnl = Disable feed handling components
6753 dnl ========================================================
6754 MOZ_ARG_DISABLE_BOOL(feeds,
6755 [ --disable-feeds Disable feed handling and processing components],
6758 if test -n "$MOZ_FEEDS"; then
6759 AC_DEFINE(MOZ_FEEDS)
6761 if test "$MOZ_BUILD_APP" = "browser"; then
6762 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6766 dnl ========================================================
6767 dnl = Enable mozStorage
6768 dnl ========================================================
6769 dnl Implicitly enabled by default if building calendar or places
6770 MOZ_ARG_ENABLE_BOOL(storage,
6771 [ --enable-storage Enable mozStorage module and related components],
6774 if test -n "$MOZ_STORAGE"; then
6775 AC_DEFINE(MOZ_STORAGE)
6778 dnl ========================================================
6779 dnl Check for sqlite
6780 dnl ========================================================
6783 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6784 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
6785 MOZ_NATIVE_SQLITE=1,
6786 MOZ_NATIVE_SQLITE= )
6788 if test -z "$MOZ_NATIVE_SQLITE"
6791 SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6793 dnl ============================
6794 dnl === SQLite Version check ===
6795 dnl ============================
6796 dnl Check to see if the system SQLite package is new enough.
6797 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6799 dnl ==================================
6800 dnl === SQLITE_SECURE_DELETE check ===
6801 dnl ==================================
6802 dnl Check to see if the system SQLite package is compiled with
6803 dnl SQLITE_SECURE_DELETE enabled.
6804 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6805 _SAVE_CFLAGS="$CFLAGS"
6806 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6808 LIBS="$LIBS $SQLITE_LIBS"
6809 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6811 #include "sqlite3.h"
6813 int main(int argc, char **argv){
6814 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6816 ac_cv_sqlite_secure_delete=yes,
6817 ac_cv_sqlite_secure_delete=no,
6818 ac_cv_sqlite_secure_delete=no
6821 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6822 CFLAGS="$_SAVE_CFLAGS"
6824 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6825 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6828 dnl ===============================
6829 dnl === SQLITE_THREADSAFE check ===
6830 dnl ===============================
6831 dnl Check to see if the system SQLite package is compiled with
6832 dnl SQLITE_THREADSAFE enabled.
6833 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6834 _SAVE_CFLAGS="$CFLAGS"
6835 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6837 LIBS="$LIBS $SQLITE_LIBS"
6838 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6840 #include "sqlite3.h"
6842 int main(int argc, char **argv){
6843 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6845 ac_cv_sqlite_threadsafe=yes,
6846 ac_cv_sqlite_threadsafe=no,
6847 ac_cv_sqlite_threadsafe=no
6850 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6851 CFLAGS="$_SAVE_CFLAGS"
6853 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6854 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6857 dnl ================================
6858 dnl === SQLITE_ENABLE_FTS3 check ===
6859 dnl ================================
6860 dnl check to see if the system SQLite package is compiled with
6861 dnl SQLITE_ENABLE_FTS3 enabled.
6862 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6863 _SAVE_CFLAGS="$CFLAGS"
6864 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6866 LIBS="$LIBS $SQLITE_LIBS"
6867 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6869 #include "sqlite3.h"
6871 int main(int argc, char **argv){
6872 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6874 ac_cv_sqlite_enable_fts3=yes,
6875 ac_cv_sqlite_enable_fts3=no,
6876 ac_cv_sqlite_enable_fts3=no
6879 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6880 CFLAGS="$_SAVE_CFLAGS"
6882 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6883 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6886 dnl =========================================
6887 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6888 dnl =========================================
6889 dnl check to see if the system SQLite package is compiled with
6890 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6891 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6892 _SAVE_CFLAGS="$CFLAGS"
6893 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6895 LIBS="$LIBS $SQLITE_LIBS"
6896 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6898 #include "sqlite3.h"
6900 int main(int argc, char **argv){
6901 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6903 ac_cv_sqlite_enable_unlock_notify=yes,
6904 ac_cv_sqlite_enable_unlock_notify=no,
6905 ac_cv_sqlite_enable_unlock_notify=no
6908 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6909 CFLAGS="$_SAVE_CFLAGS"
6911 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6912 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6916 AC_SUBST(MOZ_NATIVE_SQLITE)
6918 dnl ========================================================
6919 dnl = Enable help viewer (off by default)
6920 dnl ========================================================
6921 if test -n "$MOZ_HELP_VIEWER"; then
6922 dnl Do this if defined in confvars.sh
6923 AC_DEFINE(MOZ_HELP_VIEWER)
6926 dnl ========================================================
6927 dnl = Enable safe browsing (anti-phishing)
6928 dnl ========================================================
6929 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6930 [ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation],
6931 MOZ_SAFE_BROWSING=1,
6932 MOZ_SAFE_BROWSING= )
6933 if test -n "$MOZ_SAFE_BROWSING"; then
6934 AC_DEFINE(MOZ_SAFE_BROWSING)
6936 AC_SUBST(MOZ_SAFE_BROWSING)
6938 dnl ========================================================
6939 dnl = Enable faststart component
6940 dnl ========================================================
6941 MOZ_ARG_ENABLE_BOOL(faststart,
6942 [ --enable-faststart Enable the faststart component],
6945 if test -n "$MOZ_FASTSTART"; then
6946 AC_DEFINE(MOZ_FASTSTART)
6948 AC_SUBST(MOZ_FASTSTART)
6950 dnl ========================================================
6951 dnl = Enable url-classifier
6952 dnl ========================================================
6953 dnl Implicitly enabled by default if building with safe-browsing
6954 if test -n "$MOZ_SAFE_BROWSING"; then
6955 MOZ_URL_CLASSIFIER=1
6957 MOZ_ARG_ENABLE_BOOL(url-classifier,
6958 [ --enable-url-classifier Enable url classifier module],
6959 MOZ_URL_CLASSIFIER=1,
6960 MOZ_URL_CLASSIFIER= )
6961 if test -n "$MOZ_URL_CLASSIFIER"; then
6962 AC_DEFINE(MOZ_URL_CLASSIFIER)
6964 AC_SUBST(MOZ_URL_CLASSIFIER)
6966 dnl ========================================================
6967 dnl = Disable zipwriter
6968 dnl ========================================================
6969 MOZ_ARG_DISABLE_BOOL(zipwriter,
6970 [ --disable-zipwriter Disable zipwriter component],
6973 AC_SUBST(MOZ_ZIPWRITER)
6975 dnl ========================================================
6977 dnl ========================================================
6978 dnl superseded by QtNetwork starting from 4.7
6979 MOZ_ENABLE_LIBCONIC=1
6981 if test -n "$MOZ_ENABLE_QT"; then
6982 if test "$MOZ_ENABLE_QTNETWORK"; then
6983 MOZ_ENABLE_LIBCONIC=
6987 MOZ_ARG_DISABLE_BOOL(libconic,
6988 [ --disable-libconic Disable libconic],
6989 MOZ_ENABLE_LIBCONIC=,
6990 MOZ_ENABLE_LIBCONIC=1 )
6992 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6993 PKG_CHECK_MODULES(LIBCONIC, conic,
6994 MOZ_ENABLE_LIBCONIC=1,
6995 MOZ_ENABLE_LIBCONIC=)
6997 if test "$MOZ_ENABLE_LIBCONIC"; then
6998 AC_DEFINE(MOZ_ENABLE_LIBCONIC)
7001 AC_SUBST(MOZ_ENABLE_LIBCONIC)
7002 AC_SUBST(LIBCONIC_CFLAGS)
7003 AC_SUBST(LIBCONIC_LIBS)
7005 dnl ========================================================
7007 dnl ========================================================
7009 MAEMO_SDK_TARGET_VER=-1
7011 MOZ_ARG_WITH_STRING(maemo-version,
7012 [ --with-maemo-version=MAEMO_SDK_TARGET_VER
7014 MAEMO_SDK_TARGET_VER=$withval)
7016 case "$MAEMO_SDK_TARGET_VER" in
7018 MOZ_PLATFORM_MAEMO=5
7022 MOZ_PLATFORM_MAEMO=6
7026 dnl We aren't compiling for Maemo, move on.
7029 AC_MSG_ERROR([Unknown Maemo Version. Try setting --with-maemo-version to 5 or 6.])
7033 if test $MOZ_PLATFORM_MAEMO; then
7034 AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
7036 if test -z "$MOZ_ENABLE_DBUS"; then
7037 AC_MSG_ERROR([DBus is required when building for Maemo])
7040 MOZ_GFX_OPTIMIZE_MOBILE=1
7042 MOZ_MAEMO_LIBLOCATION=
7044 if test $MOZ_PLATFORM_MAEMO = 5; then
7045 dnl if we have Xcomposite we should also have Xdamage and Xfixes
7046 AC_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
7047 [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
7048 AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
7049 [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
7051 AC_SUBST(XCOMPOSITE_LIBS)
7053 PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
7054 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
7055 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
7056 if test -z "$_LIB_FOUND"; then
7057 AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
7061 PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
7062 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
7063 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
7064 if test -z "$_LIB_FOUND"; then
7065 AC_MSG_ERROR([LibOSSO is required when building for Maemo])
7068 PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
7069 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
7070 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
7071 if test -z "$_LIB_FOUND"; then
7072 AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
7076 if test $MOZ_PLATFORM_MAEMO = 6; then
7077 PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
7078 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTACTION_LIBS"
7079 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTACTION_CFLAGS"
7080 if test -z "$_LIB_FOUND"; then
7081 AC_MSG_ERROR([libcontentaction is required when build for Maemo])
7085 PKG_CHECK_MODULES(MOZ_MEEGOTOUCH, meegotouchcore)
7086 MOZ_ENABLE_MEEGOTOUCH=1
7087 AC_DEFINE(MOZ_ENABLE_MEEGOTOUCH)
7088 MOZ_QT_CFLAGS="$MOZ_MEEGOTOUCH_CFLAGS $MOZ_QT_CFLAGS"
7089 MOZ_QT_LIBS="$MOZ_MEEGOTOUCH_LIBS $MOZ_QT_LIBS"
7092 PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
7093 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
7094 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
7095 if test "$_LIB_FOUND"; then
7096 MOZ_MAEMO_LIBLOCATION=1
7097 AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
7099 AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
7101 AC_SUBST(MOZ_MAEMO_LIBLOCATION)
7103 PKG_CHECK_MODULES(LIBMEEGOTOUCHSHARE, ShareUiInterface-maemo-meegotouch >= 0.3.31 mdatauri, _LIB_FOUND=1, _LIB_FOUND=)
7104 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBMEEGOTOUCHSHARE_LIBS"
7105 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBMEEGOTOUCHSHARE_CFLAGS"
7106 if test "$_LIB_FOUND"; then
7107 MOZ_ENABLE_MEEGOTOUCHSHARE=1
7108 AC_DEFINE(MOZ_ENABLE_MEEGOTOUCHSHARE)
7110 AC_MSG_WARN([Cannot find maemo-meegotouch-interfaces-dev or libmdatauri-dev. Disabling meegotouch share ui.])
7112 AC_SUBST(MOZ_ENABLE_MEEGOTOUCHSHARE)
7114 AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
7115 AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
7118 dnl ========================================================
7119 dnl = Enable building the Thumb2 instruction set
7120 dnl ========================================================
7121 MOZ_ARG_ENABLE_BOOL(thumb2,
7122 [ --enable-thumb2 Enable Thumb2 instruction set],
7126 if test -n "$MOZ_THUMB2"; then
7127 case "$target_cpu" in
7129 if test "$GNU_CC"; then
7130 CFLAGS="$CFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
7131 CXXFLAGS="$CXXFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
7132 ASFLAGS="$ASFLAGS -march=armv7-a -mthumb"
7134 AC_MSG_ERROR([--enable-thumb2 is not supported for non-GNU toolchains])
7138 AC_MSG_ERROR([--enable-thumb2 is not supported for non-ARM CPU architectures])
7142 case "$target_cpu" in
7144 if test "$GNU_CC"; then
7145 CFLAGS="$CFLAGS -march=armv5te -mthumb-interwork -Wa, -march=armv5te -Wa, -mthumb-interwork"
7146 CXXFLAGS="$CXXFLAGS -march=armv5te -mthumb-interwork -Wa, -march=armv5te -Wa, -mthumb-interwork"
7147 ASFLAGS="$ASFLAGS -march=armv5te -mthumb-interwork"
7153 AC_SUBST(MOZ_THUMB2)
7155 dnl ========================================================
7156 dnl = faststripe theme
7157 dnl ========================================================
7158 MOZ_ARG_ENABLE_BOOL(faststripe,
7159 [ --enable-faststripe Use faststripe theme],
7160 MOZ_THEME_FASTSTRIPE=1,
7161 MOZ_THEME_FASTSTRIPE= )
7162 AC_SUBST(MOZ_THEME_FASTSTRIPE)
7164 dnl ========================================================
7166 dnl = Feature options that require extra sources to be pulled
7168 dnl ========================================================
7169 dnl MOZ_ARG_HEADER(Features that require extra sources)
7171 dnl ========================================================
7173 dnl = Debugging Options
7175 dnl ========================================================
7176 MOZ_ARG_HEADER(Debugging and Optimizations)
7178 dnl ========================================================
7179 dnl = Disable building with debug info.
7180 dnl = Debugging is OFF by default
7181 dnl ========================================================
7182 if test -z "$MOZ_DEBUG_FLAGS"; then
7183 MOZ_DEBUG_FLAGS="-g"
7186 MOZ_ARG_ENABLE_STRING(debug,
7187 [ --enable-debug[=DBG] Enable building with developer debug info
7188 (using compiler flags DBG)],
7189 [ if test "$enableval" != "no"; then
7191 if test -n "$enableval" -a "$enableval" != "yes"; then
7192 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7193 _MOZ_DEBUG_FLAGS_SET=1
7200 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
7201 MOZ_ARG_WITH_STRING(debug-label,
7202 [ --with-debug-label=LABELS
7203 Define DEBUG_<value> for each comma-separated
7205 [ for option in `echo $withval | sed 's/,/ /g'`; do
7206 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
7209 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
7211 if test -n "$MOZ_DEBUG"; then
7212 AC_MSG_CHECKING([for valid debug flags])
7213 _SAVE_CFLAGS=$CFLAGS
7214 CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
7215 AC_TRY_COMPILE([#include <stdio.h>],
7216 [printf("Hello World\n");],
7219 AC_MSG_RESULT([$_results])
7220 if test "$_results" = "no"; then
7221 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
7223 CFLAGS=$_SAVE_CFLAGS
7226 dnl ========================================================
7227 dnl enable mobile optimizations
7228 dnl ========================================================
7229 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
7230 [ --enable-mobile-optimize
7231 Enable mobile optimizations],
7232 MOZ_GFX_OPTIMIZE_MOBILE=1)
7234 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
7236 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
7237 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
7240 dnl ========================================================
7241 dnl = Enable code optimization. ON by default.
7242 dnl ========================================================
7243 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
7244 MOZ_OPTIMIZE_FLAGS="-O"
7247 MOZ_ARG_ENABLE_STRING(optimize,
7248 [ --disable-optimize Disable compiler optimization
7249 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
7250 [ if test "$enableval" != "no"; then
7252 if test -n "$enableval" -a "$enableval" != "yes"; then
7253 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
7258 fi ], MOZ_OPTIMIZE=1)
7260 if test "$COMPILE_ENVIRONMENT"; then
7261 if test -n "$MOZ_OPTIMIZE"; then
7262 AC_MSG_CHECKING([for valid optimization flags])
7263 _SAVE_CFLAGS=$CFLAGS
7264 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
7265 AC_TRY_COMPILE([#include <stdio.h>],
7266 [printf("Hello World\n");],
7269 AC_MSG_RESULT([$_results])
7270 if test "$_results" = "no"; then
7271 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
7273 CFLAGS=$_SAVE_CFLAGS
7275 fi # COMPILE_ENVIRONMENT
7277 AC_SUBST(MOZ_OPTIMIZE)
7278 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
7279 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
7280 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
7282 dnl ========================================================
7283 dnl = (Deprecated) generation of debugger info for specific modules
7284 dnl ========================================================
7285 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
7286 [ --enable-debugger-info-modules
7287 Enable/disable debugger info for specific modules],
7288 [ if test "$enableval" != "no"; then
7289 AC_MSG_WARN([--enable-debugger-info-modules is deprecated, use --enable-debug-symbols instead])
7293 dnl ========================================================
7294 dnl = Enable generation of debug symbols
7295 dnl ========================================================
7296 MOZ_ARG_ENABLE_STRING(debug-symbols,
7297 [ --enable-debug-symbols[=DBG]
7298 Enable debugging symbols (using compiler flags DBG)],
7299 [ if test "$enableval" != "no"; then
7301 if test -n "$enableval" -a "$enableval" != "yes"; then
7302 if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
7303 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7305 AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
7310 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
7311 AC_DEFINE(MOZ_DEBUG_SYMBOLS)
7312 export MOZ_DEBUG_SYMBOLS
7315 dnl ========================================================
7316 dnl = Disable any treating of compile warnings as errors
7317 dnl ========================================================
7318 MOZ_ARG_DISABLE_BOOL(warnings-as-errors,
7319 [ --disable-warnings-as-errors
7320 Disable treating of warnings as errors],
7321 MOZ_DISABLE_WARNINGS_AS_ERRORS=1,
7322 MOZ_DISABLE_WARNINGS_AS_ERRORS= )
7323 if test "$MOZ_DISABLE_WARNINGS_AS_ERRORS"; then
7324 WARNINGS_AS_ERRORS=''
7327 dnl ========================================================
7328 dnl = Disable runtime logging checks
7329 dnl ========================================================
7330 MOZ_ARG_DISABLE_BOOL(logging,
7331 [ --disable-logging Disable logging facilities],
7332 NS_DISABLE_LOGGING=1,
7333 NS_DISABLE_LOGGING= )
7334 if test "$NS_DISABLE_LOGGING"; then
7335 AC_DEFINE(NS_DISABLE_LOGGING)
7337 AC_DEFINE(MOZ_LOGGING)
7340 dnl ========================================================
7341 dnl = This will enable logging of addref, release, ctor, dtor.
7342 dnl ========================================================
7343 _ENABLE_LOGREFCNT=42
7344 MOZ_ARG_ENABLE_BOOL(logrefcnt,
7345 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
7346 _ENABLE_LOGREFCNT=1,
7347 _ENABLE_LOGREFCNT= )
7348 if test "$_ENABLE_LOGREFCNT" = "1"; then
7349 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
7350 elif test -z "$_ENABLE_LOGREFCNT"; then
7351 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
7354 dnl ========================================================
7355 dnl = Enable trace malloc
7356 dnl ========================================================
7357 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
7358 MOZ_ARG_ENABLE_BOOL(trace-malloc,
7359 [ --enable-trace-malloc Enable malloc tracing],
7362 if test "$NS_TRACE_MALLOC"; then
7363 # Please, Mr. Linker Man, don't take away our symbol names
7364 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7366 AC_DEFINE(NS_TRACE_MALLOC)
7368 AC_SUBST(NS_TRACE_MALLOC)
7370 dnl ========================================================
7371 dnl = Enable jemalloc
7372 dnl ========================================================
7373 MOZ_ARG_ENABLE_BOOL(jemalloc,
7374 [ --enable-jemalloc Replace memory allocator with jemalloc],
7378 if test "$NS_TRACE_MALLOC"; then
7382 if test "$MOZ_MEMORY"; then
7384 dnl Don't try to run compiler tests on Windows
7385 if test "$OS_ARCH" = "WINNT"; then
7386 if test -z "$HAVE_64BIT_OS"; then
7387 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7389 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7392 AC_CHECK_SIZEOF([int *], [4])
7393 case "${ac_cv_sizeof_int_p}" in
7395 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7398 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7401 AC_MSG_ERROR([Unexpected pointer size])
7406 AC_DEFINE(MOZ_MEMORY)
7407 if test "x$MOZ_DEBUG" = "x1"; then
7408 AC_DEFINE(MOZ_MEMORY_DEBUG)
7410 dnl The generic feature tests that determine how to compute ncpus are long and
7411 dnl complicated. Therefore, simply define special cpp variables for the
7412 dnl platforms we have special knowledge of.
7415 AC_DEFINE(MOZ_MEMORY_DARWIN)
7418 AC_DEFINE(MOZ_MEMORY_BSD)
7421 AC_DEFINE(MOZ_MEMORY_LINUX)
7424 AC_DEFINE(MOZ_MEMORY_BSD)
7427 AC_DEFINE(MOZ_MEMORY_SOLARIS)
7429 *-msvc*|*-mks*|*-cygwin*|*-mingw*)
7430 AC_DEFINE(MOZ_MEMORY_WINDOWS)
7431 dnl This is sort of awful. Will revisit if we add support for more versions
7432 if test "$CC_VERSION" != "14.00.50727.762" -a "$CC_VERSION" != "15.00.30729.01"; then
7433 AC_MSG_ERROR([Building jemalloc requires exactly Visual C++ 2005 SP1 or 2008 SP1 currently.])
7435 if test -z "$WIN32_CRT_SRC_DIR"; then
7436 if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
7437 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).])
7439 WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
7443 case "${target_cpu}" in
7445 MOZ_CRT_CPU_ARCH=intel
7448 MOZ_CRT_CPU_ARCH=amd64
7451 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7455 AC_SUBST(MOZ_CRT_CPU_ARCH)
7457 if test ! -d "$WIN32_CRT_SRC_DIR"; then
7458 AC_MSG_ERROR([Invalid Win32 CRT source directory: ${WIN32_CRT_SRC_DIR}])
7460 WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd -W`
7461 _objdir_win=`pwd -W`
7462 WIN32_CUSTOM_CRT_DIR="$_objdir_win/memory/jemalloc/crtsrc/build/$MOZ_CRT_CPU_ARCH"
7463 MOZ_MEMORY_LDFLAGS="-MANIFEST:NO -LIBPATH:\"$WIN32_CUSTOM_CRT_DIR\" -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt19 -DEFAULTLIB:mozcpp19"
7464 dnl Also pass this to NSPR/NSS
7465 DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
7469 AC_DEFINE(MOZ_MEMORY_WINCE)
7470 AC_DEFINE(MOZ_MEMORY_WINDOWS)
7471 if test -z "$WINCE_WINDOWS_MOBILE"; then
7472 AC_DEFINE(MOZ_MEMORY_WINCE6)
7476 AC_DEFINE(MOZ_MEMORY_WINCE)
7477 AC_DEFINE(MOZ_MEMORY_WINDOWS)
7480 AC_DEFINE(MOZ_MEMORY_LINUX)
7481 AC_DEFINE(MOZ_MEMORY_ANDROID)
7483 export WRAP_MALLOC_LIB="-L$_objdir/dist/lib -lmozalloc -lmozutils"
7484 WRAP_MALLOC_CFLAGS="-Wl,--wrap=dlopen -Wl,--wrap=dlclose -Wl,--wrap=dlerror -Wl,--wrap=dlsym -Wl,--wrap=dladdr"
7487 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7491 if test "$OS_ARCH" != "Darwin"; then
7492 dnl NB: this must be kept in sync with jemalloc.h
7493 AC_DEFINE(HAVE_JEMALLOC_VALLOC)
7494 AC_DEFINE(HAVE_JEMALLOC_POSIX_MEMALIGN)
7495 AC_DEFINE(HAVE_JEMALLOC_MEMALIGN)
7498 AC_SUBST(MOZ_MEMORY)
7499 AC_SUBST(MOZ_MEMORY_LDFLAGS)
7500 AC_SUBST(WIN32_CRT_SRC_DIR)
7501 dnl Need to set this for make because NSS doesn't have configure
7504 dnl ========================================================
7505 dnl = Use malloc wrapper lib
7506 dnl ========================================================
7507 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7508 [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)],
7512 if test -n "$_WRAP_MALLOC"; then
7513 if test "$GNU_CC"; then
7514 WRAP_MALLOC_CFLAGS="${LDFLAGS} ${WRAP_MALLOC_CFLAGS} -Wl,--wrap -Wl,malloc -Wl,--wrap -Wl,calloc -Wl,--wrap -Wl,valloc -Wl,--wrap -Wl,free -Wl,--wrap -Wl,realloc -Wl,--wrap -Wl,memalign -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 -Wl,--wrap -Wl,strdup -Wl,--wrap -Wl,strndup -Wl,--wrap -Wl,posix_memalign"
7515 MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) $(WRAP_MALLOC_LIB) -o $@'
7516 MKCSHLIB='$(CC) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) $(WRAP_MALLOC_LIB) -o $@'
7520 dnl ========================================================
7521 dnl = Location of malloc wrapper lib
7522 dnl ========================================================
7523 MOZ_ARG_WITH_STRING(wrap-malloc,
7524 [ --with-wrap-malloc=DIR Location of malloc wrapper library],
7525 WRAP_MALLOC_LIB=$withval)
7527 dnl ========================================================
7528 dnl = Use JS Call tracing
7529 dnl ========================================================
7530 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7531 [ --enable-trace-jscalls Enable JS call enter/exit callback (default=no)],
7532 MOZ_TRACE_JSCALLS=1,
7533 MOZ_TRACE_JSCALLS= )
7534 if test -n "$MOZ_TRACE_JSCALLS"; then
7535 AC_DEFINE(MOZ_TRACE_JSCALLS)
7538 dnl ========================================================
7540 dnl ========================================================
7541 MOZ_ARG_ENABLE_BOOL(tracevis,
7542 [ --enable-tracevis Enable TraceVis tracing tool (default=no)],
7545 if test -n "$MOZ_TRACEVIS"; then
7546 AC_DEFINE(MOZ_TRACEVIS)
7549 dnl ========================================================
7551 dnl ========================================================
7552 MOZ_ARG_ENABLE_BOOL(gctimer,
7553 [ --enable-gctimer Enable GC timer (default=no)],
7556 if test -n "$MOZ_GCTIMER"; then
7557 AC_DEFINE(MOZ_GCTIMER)
7560 dnl ========================================================
7562 dnl ========================================================
7563 MOZ_ARG_ENABLE_BOOL(valgrind,
7564 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
7567 if test -n "$MOZ_VALGRIND"; then
7568 AC_CHECK_HEADER([valgrind/valgrind.h], [],
7570 [--enable-valgrind specified but Valgrind is not installed]))
7571 AC_DEFINE(MOZ_VALGRIND)
7574 dnl ========================================================
7576 dnl ========================================================
7577 MOZ_ARG_ENABLE_BOOL(jprof,
7578 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
7581 if test -n "$MOZ_JPROF"; then
7583 AC_DEFINE(MOZ_JPROF)
7586 dnl ========================================================
7588 dnl ========================================================
7589 MOZ_ARG_ENABLE_BOOL(shark,
7590 [ --enable-shark Enable shark remote profiling (needs CHUD framework). Implies --enable-profiling.],
7593 if test -n "$MOZ_SHARK"; then
7595 AC_DEFINE(MOZ_SHARK)
7598 dnl ========================================================
7600 dnl ========================================================
7601 MOZ_ARG_ENABLE_BOOL(callgrind,
7602 [ --enable-callgrind Enable callgrind profiling],
7605 if test -n "$MOZ_CALLGRIND"; then
7606 AC_DEFINE(MOZ_CALLGRIND)
7609 dnl ========================================================
7611 dnl ========================================================
7612 MOZ_ARG_ENABLE_BOOL(vtune,
7613 [ --enable-vtune Enable vtune profiling. Implies --enable-profiling.],
7616 if test -n "$MOZ_VTUNE"; then
7618 AC_DEFINE(MOZ_VTUNE)
7621 dnl ========================================================
7622 dnl Zealous JavaScript GC
7623 dnl ========================================================
7624 MOZ_ARG_ENABLE_BOOL(gczeal,
7625 [ --enable-gczeal Enable zealous JavaScript GCing],
7628 if test -n "$JS_GC_ZEAL"; then
7629 AC_DEFINE(JS_GC_ZEAL)
7632 dnl ======================================================
7633 dnl = Enable compiling with ccache
7634 dnl ======================================================
7635 MOZ_ARG_WITH_STRING(ccache,
7636 [ --with-ccache[=path/to/ccache]
7637 Enable compiling with ccache],
7638 CCACHE=$withval, CCACHE="no")
7640 if test "$CCACHE" != "no"; then
7641 if test -z "$CCACHE" -o "$CCACHE" = "yes"; then
7644 if test ! -e "$CCACHE"; then
7645 AC_MSG_ERROR([$CCACHE not found])
7648 MOZ_PATH_PROGS(CCACHE, $CCACHE ccache)
7649 if test -z "$CCACHE" -o "$CCACHE" = ":"; then
7650 AC_MSG_ERROR([ccache not found])
7651 elif test -x "$CCACHE"; then
7655 AC_MSG_ERROR([$CCACHE is not executable])
7659 dnl ========================================================
7660 dnl = Enable static checking using gcc-dehydra
7661 dnl ========================================================
7663 MOZ_ARG_WITH_STRING(static-checking,
7664 [ --with-static-checking=path/to/gcc_dehydra.so
7665 Enable static checking of code using GCC-dehydra],
7666 DEHYDRA_PATH=$withval,
7669 if test -n "$DEHYDRA_PATH"; then
7670 if test ! -f "$DEHYDRA_PATH"; then
7671 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7673 AC_DEFINE(NS_STATIC_CHECKING)
7675 AC_SUBST(DEHYDRA_PATH)
7677 dnl ========================================================
7678 dnl = Enable stripping of libs & executables
7679 dnl ========================================================
7680 MOZ_ARG_ENABLE_BOOL(strip,
7681 [ --enable-strip Enable stripping of libs & executables ],
7685 dnl ========================================================
7686 dnl = Enable stripping of libs & executables when packaging
7687 dnl ========================================================
7688 MOZ_ARG_ENABLE_BOOL(install-strip,
7689 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
7693 dnl ========================================================
7694 dnl = --enable-elf-dynstr-gc
7695 dnl ========================================================
7696 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7697 [ --enable-elf-dynstr-gc Enable elf dynstr garbage collector (opt builds only)],
7698 USE_ELF_DYNSTR_GC=1,
7699 USE_ELF_DYNSTR_GC= )
7701 dnl ========================================================
7703 dnl = Profiling and Instrumenting
7705 dnl ========================================================
7706 MOZ_ARG_HEADER(Profiling and Instrumenting)
7708 dnl ========================================================
7709 dnl = Enable timeline service, which provides lightweight
7710 dnl = instrumentation of mozilla for performance measurement.
7711 dnl = Timeline is off by default.
7712 dnl ========================================================
7713 MOZ_ARG_ENABLE_BOOL(timeline,
7714 [ --enable-timeline Enable timeline services ],
7717 if test -n "$MOZ_TIMELINE"; then
7718 AC_DEFINE(MOZ_TIMELINE)
7721 dnl ========================================================
7722 dnl = Enable NS_FUNCTION_TIMER, which provides Function
7723 dnl = timing for identifying code bottlenecks
7724 dnl = NS_FUNCTION_TIMER is off by default.
7725 dnl ========================================================
7726 MOZ_ARG_ENABLE_BOOL(functiontimer,
7727 [ --enable-functiontimer Enable NS_FUNCTION_TIMER ],
7728 NS_FUNCTION_TIMER=1,
7729 NS_FUNCTION_TIMER= )
7730 if test -n "$NS_FUNCTION_TIMER"; then
7731 AC_DEFINE(NS_FUNCTION_TIMER)
7734 dnl ========================================================
7735 dnl Turn on reflow counting
7736 dnl ========================================================
7737 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7738 [ --enable-reflow-perf Enable reflow performance tracing],
7741 if test -n "$MOZ_REFLOW_PERF"; then
7742 AC_DEFINE(MOZ_REFLOW_PERF)
7745 dnl ========================================================
7746 dnl Enable code size metrics.
7747 dnl ========================================================
7748 MOZ_ARG_ENABLE_BOOL(codesighs,
7749 [ --enable-codesighs Enable code size analysis tools],
7750 _ENABLE_CODESIGHS=1,
7751 _ENABLE_CODESIGHS= )
7752 if test -n "$_ENABLE_CODESIGHS"; then
7753 if test -d $srcdir/tools/codesighs; then
7756 AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7760 dnl ========================================================
7761 dnl = Support for Quantify (Windows)
7762 dnl ========================================================
7763 MOZ_ARG_ENABLE_BOOL(quantify,
7764 [ --enable-quantify Enable Quantify support (Windows only) ],
7768 dnl ========================================================
7769 dnl = Support for demangling undefined symbols
7770 dnl ========================================================
7771 if test -z "$SKIP_LIBRARY_CHECKS"; then
7774 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7778 # Demangle only for debug or trace-malloc builds
7779 MOZ_DEMANGLE_SYMBOLS=
7780 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7781 MOZ_DEMANGLE_SYMBOLS=1
7782 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7784 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7786 dnl ========================================================
7787 dnl = Support for gcc stack unwinding (from gcc 3.3)
7788 dnl ========================================================
7789 if test "$HAVE_GCC3_ABI" -a -z "$SKIP_LIBRARY_CHECKS"; then
7790 AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7793 dnl ========================================================
7797 dnl ========================================================
7798 MOZ_ARG_HEADER(Misc. Options)
7800 dnl ========================================================
7801 dnl update xterm title
7802 dnl ========================================================
7803 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7804 [ --enable-xterm-updates Update XTERM titles with current command.],
7808 dnl =========================================================
7810 dnl =========================================================
7811 MOZ_ARG_ENABLE_STRING([chrome-format],
7812 [ --enable-chrome-format=jar|flat|both|symlink|omni
7813 Select FORMAT of chrome files (default=jar)],
7814 MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7816 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7817 MOZ_CHROME_FILE_FORMAT=jar
7820 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7821 test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7822 test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7823 test "$MOZ_CHROME_FILE_FORMAT" != "both" &&
7824 test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7825 AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, symlink, or omni])
7828 dnl =========================================================
7829 dnl Omnijar packaging (bug 552121)
7830 dnl =========================================================
7831 dnl Omnijar packaging is compatible with flat packaging.
7832 dnl In unpackaged builds, omnijar looks for files as if
7833 dnl things were flat packaged. After packaging, all files
7834 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7835 dnl is set to flat since putting files into jars is only
7836 dnl done during packaging with omnijar.
7837 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7839 AC_DEFINE(MOZ_OMNIJAR)
7840 MOZ_CHROME_FILE_FORMAT=flat
7841 elif test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7842 AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7845 AC_SUBST(MOZ_OMNIJAR)
7847 dnl ========================================================
7848 dnl = Define default location for MOZILLA_FIVE_HOME
7849 dnl ========================================================
7850 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7851 [ --with-default-mozilla-five-home
7852 Set the default value for MOZILLA_FIVE_HOME],
7853 [ val=`echo $withval`
7854 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7856 dnl ========================================================
7857 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7858 dnl ========================================================
7859 MOZ_ARG_WITH_STRING(user-appdir,
7860 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
7861 [ val=`echo $withval`
7862 if echo "$val" | grep "\/" >/dev/null; then
7863 AC_MSG_ERROR("Homedir must be single relative path.")
7868 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7870 dnl ========================================================
7871 dnl = Doxygen configuration
7872 dnl ========================================================
7873 dnl Use commas to specify multiple dirs to this arg
7874 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7875 MOZ_ARG_WITH_STRING(doc-input-dirs,
7876 [ --with-doc-input-dirs=DIRS
7877 Header/idl dirs to create docs from],
7878 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7879 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7881 dnl Use commas to specify multiple dirs to this arg
7882 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7883 MOZ_ARG_WITH_STRING(doc-include-dirs,
7884 [ --with-doc-include-dirs=DIRS
7885 Include dirs to preprocess doc headers],
7886 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7887 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7889 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7890 MOZ_ARG_WITH_STRING(doc-output-dir,
7891 [ --with-doc-output-dir=DIR
7892 Dir to generate docs into],
7893 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7894 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7896 if test -z "$SKIP_COMPILER_CHECKS"; then
7897 dnl ========================================================
7899 dnl = Compiler Options
7901 dnl ========================================================
7902 MOZ_ARG_HEADER(Compiler Options)
7904 dnl ========================================================
7905 dnl Check for gcc -pipe support
7906 dnl ========================================================
7907 AC_MSG_CHECKING([for gcc -pipe support])
7908 if test -n "$GNU_CC" -a -n "$GNU_CXX" -a -n "$GNU_AS"; then
7909 echo '#include <stdio.h>' > dummy-hello.c
7910 echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
7911 ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
7912 cat dummy-hello.s 2> /dev/null | ${AS_BIN} -o dummy-hello.S - 2>&5
7913 if test $? = 0; then
7918 if test "$_res_as_stdin" = "yes"; then
7919 _SAVE_CFLAGS=$CFLAGS
7920 CFLAGS="$CFLAGS -pipe"
7921 AC_TRY_COMPILE( [ #include <stdio.h> ],
7922 [printf("Hello World\n");],
7923 [_res_gcc_pipe="yes"],
7924 [_res_gcc_pipe="no"] )
7925 CFLAGS=$_SAVE_CFLAGS
7927 if test "$_res_as_stdin" = "yes" -a "$_res_gcc_pipe" = "yes"; then
7929 CFLAGS="$CFLAGS -pipe"
7930 CXXFLAGS="$CXXFLAGS -pipe"
7934 rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
7935 AC_MSG_RESULT([$_res])
7940 dnl ========================================================
7941 dnl Profile guided optimization
7942 dnl ========================================================
7943 dnl Test for profiling options
7944 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7946 dnl Provide a switch to disable PGO even when called via profiledbuild.
7947 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
7948 [ --disable-profile-guided-optimization
7949 Don't build with PGO even if called via make profiledbuild],
7950 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
7951 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
7953 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
7955 _SAVE_CFLAGS="$CFLAGS"
7956 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7958 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7959 AC_TRY_COMPILE([], [return 0;],
7960 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7961 result="yes" ], result="no")
7962 AC_MSG_RESULT([$result])
7964 if test $result = "yes"; then
7965 PROFILE_GEN_LDFLAGS="-fprofile-generate"
7966 PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch -freorder-blocks-and-partition"
7967 PROFILE_USE_LDFLAGS="-fprofile-use"
7970 CFLAGS="$_SAVE_CFLAGS"
7972 if test -n "$INTEL_CC"; then
7973 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7974 PROFILE_GEN_LDFLAGS=
7975 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7976 PROFILE_USE_LDFLAGS=
7979 dnl Sun Studio on Solaris
7980 if test "$SOLARIS_SUNPRO_CC"; then
7981 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7982 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7983 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7984 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7987 AC_SUBST(PROFILE_GEN_CFLAGS)
7988 AC_SUBST(PROFILE_GEN_LDFLAGS)
7989 AC_SUBST(PROFILE_USE_CFLAGS)
7990 AC_SUBST(PROFILE_USE_LDFLAGS)
7994 dnl ========================================================
7995 dnl Test for -pedantic bustage
7996 dnl ========================================================
7997 MOZ_ARG_DISABLE_BOOL(pedantic,
7998 [ --disable-pedantic Issue all warnings demanded by strict ANSI C ],
8000 if test "$_PEDANTIC"; then
8001 _SAVE_CXXFLAGS=$CXXFLAGS
8002 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
8003 AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
8004 AC_TRY_COMPILE([$configure_static_assert_macros],
8005 [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
8006 result="no", result="yes" )
8007 AC_MSG_RESULT([$result])
8008 CXXFLAGS="$_SAVE_CXXFLAGS"
8012 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
8013 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
8016 AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic. Reconfigure using --disable-pedantic. ])
8021 dnl ========================================================
8022 dnl Test for correct temporary object destruction order
8023 dnl ========================================================
8024 dnl We want to make sure the compiler follows the C++ spec here as
8025 dnl xpcom and the string classes depend on it (bug 235381).
8026 AC_MSG_CHECKING([for correct temporary object destruction order])
8027 AC_TRY_RUN([ class A {
8028 public: A(int& x) : mValue(x) {}
8030 operator char**() { return 0; }
8031 private: int& mValue;
8033 void func(char **arg) {}
8044 result="yes", result="no", result="maybe")
8045 AC_MSG_RESULT([$result])
8047 if test "$result" = "no"; then
8048 AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
8051 dnl ========================================================
8052 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
8053 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
8054 dnl raw pointers in nsCOMPtr.h. (VC++ has the same bug.)
8055 dnl ========================================================
8056 _SAVE_CXXFLAGS=$CXXFLAGS
8057 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
8058 AC_CACHE_CHECK(for correct overload resolution with const and templates,
8059 ac_nscap_nonconst_opeq_bug,
8068 template <class T, class U>
8069 int operator==(const Pointer<T>& rhs, U* lhs)
8071 return rhs.myPtr == lhs;
8074 template <class T, class U>
8075 int operator==(const Pointer<T>& rhs, const U* lhs)
8077 return rhs.myPtr == lhs;
8085 ac_nscap_nonconst_opeq_bug="no",
8086 ac_nscap_nonconst_opeq_bug="yes")])
8087 CXXFLAGS="$_SAVE_CXXFLAGS"
8089 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
8090 AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
8092 fi # SKIP_COMPILER_CHECKS
8094 dnl ========================================================
8096 dnl Should be smarter and check that the compiler does indeed have rtti
8097 dnl ========================================================
8099 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
8100 [ --enable-cpp-rtti Enable C++ RTTI ],
8101 [ _MOZ_USE_RTTI=1 ],
8104 if test "$_MOZ_USE_RTTI"; then
8105 _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
8107 _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
8110 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
8112 dnl ========================================================
8113 dnl C++ exceptions (g++/VC/irix6/Sun only - for now)
8114 dnl Should be smarter and check that the compiler does indeed have exceptions
8115 dnl ========================================================
8116 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
8117 [ --enable-cpp-exceptions Enable C++ exceptions ],
8118 [ _MOZ_CPP_EXCEPTIONS=1 ],
8119 [ _MOZ_CPP_EXCEPTIONS= ])
8121 if test "$_MOZ_CPP_EXCEPTIONS"; then
8122 _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
8123 AC_DEFINE(MOZ_CPP_EXCEPTIONS)
8125 _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
8128 AC_SUBST(_MOZ_EXCEPTIONS_FLAGS_ON)
8130 # Irix & OSF native compilers do not like exception declarations
8131 # when exceptions are disabled
8132 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
8133 AC_DEFINE(CPP_THROW_NEW, [])
8135 AC_DEFINE(CPP_THROW_NEW, [throw()])
8139 dnl ========================================================
8141 dnl = Build depencency options
8143 dnl ========================================================
8144 MOZ_ARG_HEADER(Build dependencies)
8146 dnl ========================================================
8147 dnl = Do not auto generate dependency info
8148 dnl ========================================================
8150 MOZ_ARG_DISABLE_BOOL(auto-deps,
8151 [ --disable-auto-deps Do not automatically generate dependency info],
8155 if test -n "$MOZ_AUTO_DEPS"; then
8156 dnl ========================================================
8157 dnl = Use mkdepend instead of $CC -MD for dependency generation
8158 dnl ========================================================
8160 MOZ_ARG_DISABLE_BOOL(md,
8161 [ --disable-md Do not use compiler-based dependencies ],
8164 [dnl Default is to turn on -MD if using GNU-compatible compilers
8165 if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
8168 dnl Default is to use -xM if using Sun Studio on Solaris
8169 if test "$SOLARIS_SUNPRO_CC"; then
8172 if test "$_cpp_md_flag"; then
8174 if test "$OS_ARCH" = "OpenVMS"; then
8175 _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
8177 _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(basename $(@F)).pp)'
8179 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
8180 if test "$SOLARIS_SUNPRO_CC"; then
8185 dnl Don't override this for MSVC
8186 if test -z "$_WIN32_MSVC"; then
8187 _USE_CPP_INCLUDE_FLAG=
8188 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
8189 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
8191 echo '#include <stdio.h>' > dummy-hello.c
8193 CL_INCLUDES_PREFIX=`"${CC}" -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
8195 if test -z "$CL_INCLUDES_PREFIX"; then
8196 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
8198 AC_SUBST(CL_INCLUDES_PREFIX)
8200 _topsrcdirwin=`cd \`dirname $0\`; pwd -W`
8201 dnl cl.py provides dependency generation for MSVC
8202 CC_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"
8203 CXX_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"
8209 AC_SUBST(MOZ_AUTO_DEPS)
8210 AC_SUBST(COMPILER_DEPEND)
8212 AC_SUBST(CC_WRAPPER)
8213 AC_SUBST(CXX_WRAPPER)
8216 dnl ========================================================
8218 dnl = Static Build Options
8220 dnl ========================================================
8221 MOZ_ARG_HEADER(Static build options)
8223 MOZ_ARG_ENABLE_BOOL(static,
8224 [ --enable-static Enable building of internal static libs],
8225 BUILD_STATIC_LIBS=1,
8228 MOZ_ARG_ENABLE_BOOL(libxul,
8229 [ --enable-libxul Enable building of libxul],
8230 MOZ_ENABLE_LIBXUL=1,
8233 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
8234 if test "$OS_ARCH" = "WINNT"; then
8238 MOZ_ARG_ENABLE_BOOL(shared-js,
8239 [ --enable-shared-js
8240 Create a shared JavaScript library.],
8244 if test -z "$MOZ_ENABLE_LIBXUL"; then
8245 dnl --disable-libxul implies shared js
8249 if test -n "$ENABLE_SHARED_JS"; then
8251 MOZ_JS_LIBS=$MOZ_JS_SHARED_LIBS
8253 MOZ_JS_LIBS=$MOZ_JS_STATIC_LIBS
8254 AC_DEFINE(MOZ_STATIC_JS)
8256 AC_SUBST(JS_SHARED_LIBRARY)
8258 if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
8259 AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME. You probably want --enable-libxul.])
8262 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
8263 AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
8266 if test -n "$MOZ_IPC" -a -z "$MOZ_ENABLE_LIBXUL"; then
8267 AC_MSG_ERROR([--enable-ipc requires --enable-libxul])
8270 if test -z "$MOZ_ENABLE_LIBXUL" -a -n "$MOZ_OMNIJAR"; then
8271 AC_MSG_ERROR([Omnijar packaging is incompatible with --disable-libxul. Please either --enable-libxul or --enable-chrome-format=jar|flat|symlink]);
8274 AC_SUBST(LIBXUL_LIBS)
8276 if test -n "$MOZ_ENABLE_LIBXUL"; then
8277 XPCOM_LIBS="$LIBXUL_LIBS"
8278 AC_DEFINE(MOZ_ENABLE_LIBXUL)
8280 if test -n "$BUILD_STATIC_LIBS"; then
8281 AC_DEFINE(MOZ_STATIC_BUILD)
8283 XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
8286 dnl ========================================================
8288 dnl = Standalone module options
8290 dnl ========================================================
8291 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
8293 dnl Check for GLib and libIDL.
8294 dnl ========================================================
8297 if test -z "$COMPILE_ENVIRONMENT"; then
8298 SKIP_IDL_CHECK="yes"
8301 dnl = Allow users to disable libIDL checking for standalone modules
8302 MOZ_ARG_WITHOUT_BOOL(libIDL,
8303 [ --without-libIDL Skip check for libIDL (standalone modules only)],
8304 SKIP_IDL_CHECK="yes")
8306 if test -z "$CROSS_COMPILE"; then
8307 if test -z "$HOST_LIBIDL_CONFIG"; then
8308 HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
8310 if test -z "$HOST_LIBIDL_PREFIX"; then
8311 HOST_LIBIDL_PREFIX="$LIBIDL_PREFIX"
8315 if test "$SKIP_IDL_CHECK" = "no"
8319 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
8320 if test -n "$GLIB_PREFIX"; then
8321 _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd -W`
8322 if test "$?" = "0"; then
8323 if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
8324 AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
8326 _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
8328 AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
8331 _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
8333 if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
8334 AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
8336 GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
8337 if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
8338 GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
8339 elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
8340 GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
8342 AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
8345 if test -n "$HOST_LIBIDL_PREFIX"; then
8346 _LIBIDL_PREFIX_DIR=`cd $HOST_LIBIDL_PREFIX && pwd -W`
8347 if test "$?" = "0"; then
8348 if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
8349 AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
8351 _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
8353 AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
8356 _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
8358 if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
8359 AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
8361 HOST_LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
8362 if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
8363 HOST_LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
8365 elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
8366 HOST_LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
8368 AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
8370 HOST_LIBIDL_LIBS="${HOST_LIBIDL_LIBS} ${GLIB_LIBS}"
8375 if test -z "$_LIBIDL_FOUND"; then
8376 if test "$MACOS_SDK_DIR"; then
8377 dnl xpidl, and therefore libIDL, is only needed on the build host.
8378 dnl Don't build it against the SDK, as that causes problems.
8379 _MACSAVE_CFLAGS="$CFLAGS"
8380 _MACSAVE_LIBS="$LIBS"
8381 _MACSAVE_LDFLAGS="$LDFLAGS"
8382 _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
8384 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"`
8385 LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
8386 LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
8391 PKG_CHECK_MODULES(HOST_LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
8394 dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
8395 dnl to either libIDL1 or libIDL2.
8396 if test -z "$_LIBIDL_FOUND"; then
8397 AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
8398 if test -z "$_LIBIDL_FOUND"; then
8399 PKG_CHECK_MODULES(HOST_LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
8403 dnl If we don't have a libIDL config program & not cross-compiling,
8404 dnl look for orbit-config instead.
8406 if test -z "$_LIBIDL_FOUND" -a -z "$CROSS_COMPILE"; then
8407 MOZ_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
8408 if test -n "$ORBIT_CONFIG"; then
8409 AC_MSG_CHECKING([for ORBit libIDL usability])
8410 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
8411 _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
8412 _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
8413 _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
8414 HOST_LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
8415 HOST_LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
8417 _SAVE_CFLAGS="$CFLAGS"
8419 CFLAGS="$HOST_LIBIDL_CFLAGS $CFLAGS"
8420 LIBS="$HOST_LIBIDL_LIBS $LIBS"
8423 #include <libIDL/IDL.h>
8426 s=strdup(IDL_get_libver_string());
8434 [HOST_LIBIDL_CFLAGS=
8439 AC_MSG_RESULT($result)
8440 CFLAGS="$_SAVE_CFLAGS"
8444 if test -z "$_LIBIDL_FOUND"; then
8445 AC_MSG_ERROR([libIDL not found.
8446 libIDL $LIBIDL_VERSION or higher is required.])
8448 if test "$MACOS_SDK_DIR"; then
8449 CFLAGS="$_MACSAVE_CFLAGS"
8450 LIBS="$_MACSAVE_LIBS"
8451 LDFLAGS="$_MACSAVE_LDFLAGS"
8452 if test -n "$_MACSAVE_NEXT_ROOT" ; then
8453 export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
8458 if test -n "$CROSS_COMPILE"; then
8460 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
8461 if test -n "$GLIB_PREFIX"; then
8462 GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
8463 if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
8464 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
8465 elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
8466 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
8468 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
8472 if test -n "$LIBIDL_PREFIX"; then
8473 LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
8474 if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
8475 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
8477 elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
8478 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
8480 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
8483 LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
8486 if test -n "LIBIDL_CONFIG" -a "LIBIDL_CONFIG" != "no"; then
8487 LIBIDL_CFLAGS=`${LIBIDL_CONFIG} --cflags`
8488 LIBIDL_LIBS=`${LIBIDL_CONFIG} --libs`
8493 LIBIDL_CFLAGS="$HOST_LIBIDL_CFLAGS"
8494 LIBIDL_LIBS="$HOST_LIBIDL_LIBS"
8497 if test -z "$SKIP_PATH_CHECKS"; then
8498 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
8499 if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
8500 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
8502 AM_PATH_GLIB(${GLIB_VERSION})
8507 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
8508 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
8511 AC_SUBST(LIBIDL_CFLAGS)
8512 AC_SUBST(LIBIDL_LIBS)
8513 AC_SUBST(STATIC_LIBIDL)
8514 AC_SUBST(GLIB_CFLAGS)
8516 AC_SUBST(GLIB_GMODULE_LIBS)
8517 AC_SUBST(HOST_LIBIDL_CONFIG)
8518 AC_SUBST(HOST_LIBIDL_CFLAGS)
8519 AC_SUBST(HOST_LIBIDL_LIBS)
8521 dnl ========================================================
8523 dnl ========================================================
8524 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8527 MOZ_ARG_ENABLE_BOOL(system-cairo,
8528 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
8533 MOZ_ARG_ENABLE_BOOL(system-pixman,
8534 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
8538 # Check for headers defining standard int types.
8539 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8541 if test "$MOZ_TREE_CAIRO"; then
8542 AC_DEFINE(MOZ_TREE_CAIRO)
8544 # For now we assume that we will have a uint64_t available through
8545 # one of the above headers or mozstdint.h.
8546 AC_DEFINE(HAVE_UINT64_T)
8548 # Define macros for cairo-features.h
8549 if test "$MOZ_X11"; then
8550 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8551 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8552 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8553 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8554 MOZ_ENABLE_CAIRO_FT=1
8555 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8557 if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
8558 QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8560 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
8561 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8562 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8563 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8565 if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
8566 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8567 if test -z "$WINCE"; then
8568 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8569 if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8570 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8571 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8572 MOZ_ENABLE_D2D_SURFACE=1
8573 MOZ_ENABLE_DWRITE_FONT=1
8575 WIN32_DWRITE_FONT_FEATURE=
8576 WIN32_D2D_SURFACE_FEATURE=
8580 WIN32_DWRITE_FONT_FEATURE=
8581 WIN32_D2D_SURFACE_FEATURE=
8584 AC_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8586 dnl D3D10 Layers depend on D2D Surfaces.
8587 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
8588 AC_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
8592 if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
8593 OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
8594 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8595 MOZ_ENABLE_CAIRO_FT=1
8596 CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8597 CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
8599 if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
8600 PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
8601 BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
8602 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8603 MOZ_ENABLE_CAIRO_FT=1
8605 if test "$USE_FC_FREETYPE"; then
8606 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8608 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8609 AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8610 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8611 AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8612 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8613 AC_SUBST(CAIRO_FT_CFLAGS)
8616 if test "$MOZ_DEBUG"; then
8617 SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
8619 SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
8622 PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
8624 AC_SUBST(PS_SURFACE_FEATURE)
8625 AC_SUBST(PDF_SURFACE_FEATURE)
8626 AC_SUBST(SVG_SURFACE_FEATURE)
8627 AC_SUBST(XLIB_SURFACE_FEATURE)
8628 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8629 AC_SUBST(QUARTZ_SURFACE_FEATURE)
8630 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8631 AC_SUBST(XCB_SURFACE_FEATURE)
8632 AC_SUBST(WIN32_SURFACE_FEATURE)
8633 AC_SUBST(OS2_SURFACE_FEATURE)
8634 AC_SUBST(BEOS_SURFACE_FEATURE)
8635 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8636 AC_SUBST(FT_FONT_FEATURE)
8637 AC_SUBST(FC_FONT_FEATURE)
8638 AC_SUBST(WIN32_FONT_FEATURE)
8639 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8640 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8641 AC_SUBST(QUARTZ_FONT_FEATURE)
8642 AC_SUBST(PNG_FUNCTIONS_FEATURE)
8643 AC_SUBST(QT_SURFACE_FEATURE)
8645 MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
8647 if test "$MOZ_TREE_PIXMAN"; then
8648 AC_DEFINE(MOZ_TREE_PIXMAN)
8649 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS"' $(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
8651 PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
8652 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $PIXMAN_CFLAGS"
8653 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $PIXMAN_LIBS"
8656 if test "$MOZ_X11"; then
8657 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
8660 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8661 mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
8664 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION pixman-1 freetype2 fontconfig)
8665 MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
8666 MOZ_CAIRO_LIBS=$CAIRO_LIBS
8667 if test "$MOZ_X11"; then
8668 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8669 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8670 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8674 AC_SUBST(MOZ_TREE_CAIRO)
8675 AC_SUBST(MOZ_CAIRO_CFLAGS)
8676 AC_SUBST(MOZ_CAIRO_LIBS)
8677 AC_SUBST(MOZ_TREE_PIXMAN)
8679 dnl ========================================================
8681 dnl ========================================================
8683 QCMS_LIBS='$(call EXPAND_LIBNAME_PATH,mozqcms,$(DEPTH)/gfx/qcms)'
8686 dnl ========================================================
8688 dnl ========================================================
8689 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8690 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8692 dnl ========================================================
8694 dnl ========================================================
8695 MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)'
8696 AC_SUBST(MOZ_OTS_LIBS)
8698 dnl ========================================================
8700 dnl ========================================================
8701 MOZ_ARG_DISABLE_BOOL(xul,
8702 [ --disable-xul Disable XUL],
8704 if test "$MOZ_XUL"; then
8707 dnl remove extensions that require XUL
8708 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8713 dnl ========================================================
8714 dnl disable profile locking
8715 dnl do no use this in applications that can have more than
8716 dnl one process accessing the profile directory.
8717 dnl ========================================================
8718 MOZ_ARG_DISABLE_BOOL(profilelocking,
8719 [ --disable-profilelocking
8720 Disable profile locking],
8721 MOZ_PROFILELOCKING=,
8722 MOZ_PROFILELOCKING=1 )
8723 if test "$MOZ_PROFILELOCKING"; then
8724 AC_DEFINE(MOZ_PROFILELOCKING)
8727 dnl ========================================================
8728 dnl disable rdf services
8729 dnl ========================================================
8730 MOZ_ARG_DISABLE_BOOL(rdf,
8731 [ --disable-rdf Disable RDF],
8733 if test "$MOZ_RDF"; then
8739 dnl ========================================================
8740 dnl necko configuration options
8741 dnl ========================================================
8744 dnl option to disable various necko protocols
8746 MOZ_ARG_ENABLE_STRING(necko-protocols,
8747 [ --enable-necko-protocols[={http,ftp,default,all,none}]
8748 Enable/disable specific protocol handlers],
8749 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8750 if test "$option" = "yes" -o "$option" = "all"; then
8751 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8752 elif test "$option" = "no" -o "$option" = "none"; then
8754 elif test "$option" = "default"; then
8755 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8756 elif test `echo "$option" | grep -c \^-` != 0; then
8757 option=`echo $option | sed 's/^-//'`
8758 NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8760 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8763 NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8765 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8766 AC_SUBST(NECKO_PROTOCOLS)
8767 for p in $NECKO_PROTOCOLS; do
8768 AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8772 dnl option to disable necko's disk cache
8774 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
8775 [ --disable-necko-disk-cache
8776 Disable necko disk cache],
8779 AC_SUBST(NECKO_DISK_CACHE)
8780 if test "$NECKO_DISK_CACHE"; then
8781 AC_DEFINE(NECKO_DISK_CACHE)
8785 dnl option to disable necko's wifi scanner
8787 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8788 [ --disable-necko-wifi Disable necko wifi scanner],
8792 if test "$OS_ARCH" = "OS2"; then
8793 dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8796 if test "$NECKO_WIFI" -a \
8797 "$OS_ARCH" != "Linux" -a \
8798 "$OS_ARCH" != "Darwin" -a \
8799 "$OS_ARCH" != "SunOS" -a \
8800 "$OS_ARCH" != "WINNT" -a \
8801 "$OS_ARCH" != "WINCE"; then
8802 AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8805 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
8807 AC_CHECK_HEADER([iwlib.h])
8808 if test "$ac_cv_header_iwlib_h" != "yes"; then
8809 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])
8813 if test "$NECKO_WIFI"; then
8814 AC_DEFINE(NECKO_WIFI)
8816 AC_SUBST(NECKO_WIFI)
8819 dnl option to disable cookies
8821 MOZ_ARG_DISABLE_BOOL(cookies,
8822 [ --disable-cookies Disable cookie support],
8825 AC_SUBST(NECKO_COOKIES)
8826 if test "$NECKO_COOKIES"; then
8827 AC_DEFINE(NECKO_COOKIES)
8831 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8833 MOZ_ARG_DISABLE_BOOL(ctypes,
8834 [ --disable-ctypes Disable js-ctypes],
8837 AC_SUBST(BUILD_CTYPES)
8838 if test "$BUILD_CTYPES"; then
8839 if test "$OS_ARCH" = "WINCE" -a `echo $OS_TEST | grep -ic arm` = 1; then
8840 # Disable ctypes for arm/wince.
8843 AC_DEFINE(BUILD_CTYPES)
8847 dnl NECKO_ configuration options are not global
8848 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
8850 dnl Only build Mork if it's required
8852 if test "$MOZ_MORK"; then
8856 dnl Build the lightweight Mork reader if required
8857 AC_SUBST(MOZ_MORKREADER)
8858 if test "$MOZ_MORKREADER"; then
8859 AC_DEFINE(MOZ_MORKREADER)
8862 dnl Build Places if required
8863 if test "$MOZ_PLACES"; then
8864 AC_DEFINE(MOZ_PLACES)
8867 dnl Build Sync Services if required
8868 AC_SUBST(MOZ_SERVICES_SYNC)
8869 if test -n "$MOZ_SERVICES_SYNC"; then
8870 AC_DEFINE(MOZ_SERVICES_SYNC)
8873 dnl ========================================================
8874 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
8875 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8878 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8879 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8882 dnl ========================================================
8884 dnl = Maintainer debug option (no --enable equivalent)
8886 dnl ========================================================
8891 AC_SUBST(AR_EXTRACT)
8895 AC_SUBST(AS_DASH_C_FLAG)
8903 AC_SUBST(NS_USE_NATIVE)
8904 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8905 AC_SUBST(MOZ_UPDATE_XTERM)
8907 AC_SUBST(MOZ_PLATFORM_MAEMO)
8908 AC_SUBST(MOZ_AUTH_EXTENSION)
8909 AC_SUBST(MOZ_MATHML)
8910 AC_SUBST(MOZ_PERMISSIONS)
8912 AC_SUBST(MOZ_PREF_EXTENSIONS)
8915 AC_SUBST(MOZ_XSLT_STANDALONE)
8916 AC_SUBST(MOZ_JS_LIBS)
8919 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8920 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8921 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8922 AC_SUBST(MOZ_DEBUG_FLAGS)
8923 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8924 AC_SUBST(WARNINGS_AS_ERRORS)
8925 AC_SUBST(MOZ_EXTENSIONS)
8926 AC_SUBST(MOZ_JSDEBUGGER)
8927 AC_SUBST(MOZ_PLUGINS)
8928 AC_SUBST(MOZ_LOG_REFCNT)
8932 AC_SUBST(MOZ_CALLGRIND)
8934 AC_SUBST(MOZ_PROFILING)
8935 AC_SUBST(MOZ_JSLOADER)
8936 AC_SUBST(MOZ_USE_NATIVE_UCONV)
8937 AC_SUBST(MOZ_QUANTIFY)
8939 AC_SUBST(MOZ_PLACES)
8940 AC_SUBST(MOZ_PLACES_BOOKMARKS)
8941 AC_SUBST(MOZ_STORAGE)
8942 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8944 AC_SUBST(NS_PRINTING)
8946 AC_SUBST(MOZ_HELP_VIEWER)
8948 AC_SUBST(MOZ_JAVAXPCOM)
8949 AC_SUBST(JAVA_INCLUDE_PATH)
8954 AC_SUBST(MOZ_PROFILELOCKING)
8957 AC_SUBST(MOZ_XIE_LIBS)
8959 AC_SUBST(BUILD_STATIC_LIBS)
8960 AC_SUBST(MOZ_ENABLE_LIBXUL)
8961 AC_SUBST(ENABLE_TESTS)
8963 AC_SUBST(MOZ_UNIVERSALCHARDET)
8964 AC_SUBST(ACCESSIBILITY)
8965 AC_SUBST(MOZ_VIEW_SOURCE)
8966 AC_SUBST(MOZ_SPELLCHECK)
8967 AC_SUBST(MOZ_USER_DIR)
8968 AC_SUBST(MOZ_CRASHREPORTER)
8969 AC_SUBST(MOZ_UPDATER)
8971 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8973 AC_SUBST(ENABLE_STRIP)
8974 AC_SUBST(PKG_SKIP_STRIP)
8975 AC_SUBST(USE_ELF_DYNSTR_GC)
8976 AC_SUBST(INCREMENTAL_LINKER)
8977 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8978 AC_SUBST(MOZ_JEMALLOC_STANDALONE_GLUE_LDOPTS)
8979 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8981 AC_SUBST(MOZ_FIX_LINK_PATHS)
8982 AC_SUBST(XPCOM_LIBS)
8983 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8984 AC_SUBST(XPCOM_GLUE_LDOPTS)
8985 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8987 AC_SUBST(USE_DEPENDENT_LIBS)
8989 AC_SUBST(MOZ_BUILD_ROOT)
8990 AC_SUBST(MOZ_OS2_TOOLS)
8992 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8993 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8994 AC_SUBST(MOZ_TIMELINE)
8995 AC_SUBST(OGLES_SDK_DIR)
8997 AC_SUBST(MOZ_APP_NAME)
8998 AC_SUBST(MOZ_APP_DISPLAYNAME)
8999 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
9000 AC_SUBST(MOZ_APP_UA_NAME)
9001 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
9002 AC_SUBST(MOZ_APP_VERSION)
9003 AC_DEFINE_UNQUOTED(MOZ_UA_FIREFOX_VERSION, "$FIREFOX_VERSION")
9004 AC_SUBST(MOZ_UA_FIREFOX_VERSION)
9005 AC_SUBST(FIREFOX_VERSION)
9006 AC_DEFINE_UNQUOTED(MOZ_UA_BUILDID, "$MOZ_UA_BUILDID")
9007 AC_SUBST(MOZ_UA_BUILDID)
9009 AC_SUBST(MOZ_PKG_SPECIAL)
9011 AC_SUBST(MOZILLA_OFFICIAL)
9014 AC_SUBST(MOZ_MAPINFO)
9015 AC_SUBST(MOZ_BROWSE_INFO)
9016 AC_SUBST(MOZ_TOOLS_DIR)
9017 AC_SUBST(CYGWIN_WRAPPER)
9019 AC_SUBST(WIN32_REDIST_DIR)
9024 AC_SUBST(WINCE_SDK_DIR)
9025 AC_SUBST(WINCE_WINDOWS_MOBILE)
9027 dnl Echo the CFLAGS to remove extra whitespace.
9034 $_MOZ_EXCEPTIONS_FLAGS \
9035 $_WARNINGS_CXXFLAGS \
9038 COMPILE_CFLAGS=`echo \
9043 COMPILE_CXXFLAGS=`echo \
9044 $_DEFINES_CXXFLAGS \
9048 AC_SUBST(SYSTEM_MAKEDEPEND)
9049 AC_SUBST(SYSTEM_LIBXUL)
9050 AC_SUBST(SYSTEM_JPEG)
9051 AC_SUBST(SYSTEM_PNG)
9052 AC_SUBST(SYSTEM_ZLIB)
9053 AC_SUBST(SYSTEM_BZ2)
9055 AC_SUBST(JPEG_CFLAGS)
9057 AC_SUBST(ZLIB_CFLAGS)
9059 AC_SUBST(BZ2_CFLAGS)
9061 AC_SUBST(PNG_CFLAGS)
9064 AC_SUBST(MOZ_JPEG_CFLAGS)
9065 AC_SUBST(MOZ_JPEG_LIBS)
9066 AC_SUBST(MOZ_ZLIB_CFLAGS)
9067 AC_SUBST(MOZ_ZLIB_LIBS)
9068 AC_SUBST(MOZ_BZ2_CFLAGS)
9069 AC_SUBST(MOZ_BZ2_LIBS)
9070 AC_SUBST(MOZ_PNG_CFLAGS)
9071 AC_SUBST(MOZ_PNG_LIBS)
9073 AC_SUBST(NSPR_CFLAGS)
9075 AC_SUBST(MOZ_NATIVE_NSPR)
9077 AC_SUBST(NSS_CFLAGS)
9079 AC_SUBST(NSS_DEP_LIBS)
9080 AC_SUBST(MOZ_NATIVE_NSS)
9081 AC_SUBST(NSS_DISABLE_DBM)
9086 AC_SUBST(COMPILE_CFLAGS)
9087 AC_SUBST(COMPILE_CXXFLAGS)
9090 AC_SUBST(CROSS_COMPILE)
9091 AC_SUBST(WCHAR_CFLAGS)
9095 AC_SUBST(HOST_CFLAGS)
9096 AC_SUBST(HOST_CXXFLAGS)
9097 AC_SUBST(HOST_OPTIMIZE_FLAGS)
9099 AC_SUBST(HOST_AR_FLAGS)
9101 AC_SUBST(HOST_RANLIB)
9102 AC_SUBST(HOST_NSPR_MDCPUCFG)
9103 AC_SUBST(HOST_BIN_SUFFIX)
9104 AC_SUBST(HOST_OS_ARCH)
9106 AC_SUBST(TARGET_CPU)
9107 AC_SUBST(TARGET_VENDOR)
9109 AC_SUBST(TARGET_NSPR_MDCPUCFG)
9110 AC_SUBST(TARGET_MD_ARCH)
9111 AC_SUBST(TARGET_XPCOM_ABI)
9114 AC_SUBST(OS_RELEASE)
9117 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
9118 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
9120 AC_SUBST(WRAP_MALLOC_CFLAGS)
9121 AC_SUBST(WRAP_MALLOC_LIB)
9124 AC_SUBST(MKSHLIB_FORCE_ALL)
9125 AC_SUBST(MKSHLIB_UNFORCE_ALL)
9126 AC_SUBST(DSO_CFLAGS)
9127 AC_SUBST(DSO_PIC_CFLAGS)
9128 AC_SUBST(DSO_LDOPTS)
9129 AC_SUBST(LIB_PREFIX)
9130 AC_SUBST(DLL_PREFIX)
9131 AC_SUBST(DLL_SUFFIX)
9132 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
9133 AC_SUBST(LIB_SUFFIX)
9134 AC_SUBST(OBJ_SUFFIX)
9135 AC_SUBST(BIN_SUFFIX)
9136 AC_SUBST(ASM_SUFFIX)
9137 AC_SUBST(IMPORT_LIB_SUFFIX)
9139 AC_SUBST(CC_VERSION)
9140 AC_SUBST(CXX_VERSION)
9141 AC_SUBST(MSMANIFEST_TOOL)
9142 AC_SUBST(NS_ENABLE_TSF)
9143 AC_SUBST(MOZ_NSS_PATCH)
9144 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
9145 AC_SUBST(MOZ_APP_EXTRA_LIBS)
9148 AC_SUBST(MOZ_SYDNEYAUDIO)
9150 AC_SUBST(MOZ_VORBIS)
9151 AC_SUBST(MOZ_TREMOR)
9154 AC_SUBST(MOZ_ALSA_LIBS)
9156 AC_SUBST(VPX_ASFLAGS)
9157 AC_SUBST(VPX_DASH_C_FLAG)
9158 AC_SUBST(VPX_AS_CONVERSION)
9159 AC_SUBST(VPX_ASM_SUFFIX)
9160 AC_SUBST(VPX_X86_ASM)
9161 AC_SUBST(VPX_ARM_ASM)
9163 if test "$USING_HCC"; then
9164 CC='${topsrcdir}/build/hcc'
9166 CXX='${topsrcdir}/build/hcpp'
9167 CXX="$CXX '$_OLDCXX'"
9172 AC_MSG_CHECKING([for posix_fallocate])
9173 AC_TRY_LINK([#define _XOPEN_SOURCE 600
9174 #include <fcntl.h>],
9175 [posix_fallocate(0, 0, 0);],
9176 [ac_cv___posix_fallocate=true],
9177 [ac_cv___posix_fallocate=false])
9179 if test "$ac_cv___posix_fallocate" = true ; then
9180 AC_DEFINE(HAVE_POSIX_FALLOCATE)
9186 dnl Check for missing components
9187 if test "$COMPILE_ENVIRONMENT"; then
9188 if test "$MOZ_X11"; then
9189 dnl ====================================================
9190 dnl = Check if X headers exist
9191 dnl ====================================================
9192 _SAVE_CFLAGS=$CFLAGS
9193 CFLAGS="$CFLAGS $XCFLAGS"
9197 #include <X11/Xlib.h>
9198 #include <X11/Intrinsic.h>
9202 if ((dpy = XOpenDisplay(NULL)) == NULL) {
9203 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
9207 [ AC_MSG_ERROR([Could not compile basic X program.]) ])
9208 CFLAGS="$_SAVE_CFLAGS"
9210 if test ! -z "$MISSING_X"; then
9211 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
9216 dnl Check for headers, etc. needed by WebGL.
9217 if test -n "$MOZ_WEBGL_GLX"; then
9218 AC_CHECK_HEADER(GL/glx.h)
9219 if test "$ac_cv_header_GL_glx_h" != "yes"; then
9220 AC_MSG_ERROR([Can't find header GL/glx.h for WebGL (install mesa-common-dev (Ubuntu), mesa-libGL-devel (Fedora), or Mesa (SuSE))])
9223 fi # COMPILE_ENVIRONMENT
9225 if test "$USE_FC_FREETYPE"; then
9226 if test "$COMPILE_ENVIRONMENT"; then
9227 _SAVE_CPPFLAGS="$CPPFLAGS"
9228 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
9229 AC_CHECK_HEADERS(fontconfig/fcfreetype.h, ,
9230 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)])
9231 CPPFLAGS="$_SAVE_CPPFLAGS"
9233 AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
9237 dnl Set various defines and substitutions
9238 dnl ========================================================
9240 if test "$OS_ARCH" = "BeOS"; then
9242 elif test "$OS_ARCH" = "Darwin"; then
9244 AC_DEFINE(UNIX_ASYNC_DNS)
9245 elif test "$OS_ARCH" = "OpenVMS"; then
9247 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
9249 AC_DEFINE(UNIX_ASYNC_DNS)
9252 if test "$MOZ_DEBUG"; then
9253 AC_DEFINE(MOZ_REFLOW_PERF)
9254 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
9257 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
9258 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
9259 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
9260 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
9261 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
9262 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
9263 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
9264 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
9265 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
9268 dnl ========================================================
9269 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
9270 dnl ========================================================
9273 WIN_TOP_SRC=`cd $srcdir; pwd -W`
9276 HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
9277 HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
9278 CC="\$(CYGWIN_WRAPPER) $CC"
9279 CXX="\$(CYGWIN_WRAPPER) $CXX"
9280 CPP="\$(CYGWIN_WRAPPER) $CPP"
9281 LD="\$(CYGWIN_WRAPPER) $LD"
9282 AS="\$(CYGWIN_WRAPPER) $AS"
9283 RC="\$(CYGWIN_WRAPPER) $RC"
9284 MIDL="\$(CYGWIN_WRAPPER) $MIDL"
9285 CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
9286 WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
9290 AC_SUBST(CYGDRIVE_MOUNT)
9291 AC_SUBST(WIN_TOP_SRC)
9293 AC_SUBST(MOZILLA_VERSION)
9295 AC_SUBST(ac_configure_args)
9297 dnl Spit out some output
9298 dnl ========================================================
9300 dnl The following defines are used by xpcom
9301 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
9303 HAVE_CPP_2BYTE_WCHAR_T
9304 HAVE_CPP_ACCESS_CHANGING_USING
9305 HAVE_CPP_AMBIGUITY_RESOLVING_USING
9308 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
9310 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
9311 HAVE_CPP_NAMESPACE_STD
9313 HAVE_CPP_PARTIAL_SPECIALIZATION
9314 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
9316 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
9318 NEED_CPP_UNUSED_IMPLEMENTATIONS
9322 HAVE_ICONV_WITH_CONST_INPUT
9330 netwerk/necko-config.h
9331 xpcom/xpcom-config.h
9332 xpcom/xpcom-private.h
9335 # Save the defines header file before autoconf removes it.
9336 # (Do not add AC_DEFINE calls after this line.)
9337 _CONFIG_TMP=confdefs-tmp.h
9338 _CONFIG_DEFS_H=mozilla-config.h
9340 cat > $_CONFIG_TMP <<\EOF
9341 /* List of defines generated by configure. Included with preprocessor flag,
9342 * -include, to avoid long list of -D defines on the compile command-line.
9346 #ifndef _MOZILLA_CONFIG_H_
9347 #define _MOZILLA_CONFIG_H_
9350 _EGREP_PATTERN='^#define ('
9351 if test -n "$_NON_GLOBAL_ACDEFINES"; then
9352 for f in $_NON_GLOBAL_ACDEFINES; do
9353 _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
9356 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
9358 sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
9360 cat >> $_CONFIG_TMP <<\EOF
9362 #endif /* _MOZILLA_CONFIG_H_ */
9366 # Only write mozilla-config.h when something changes (or it doesn't exist)
9367 if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
9370 AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
9371 mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
9373 echo ==== $_CONFIG_DEFS_H =================================
9377 dnl Probably shouldn't call this manually but we always want the output of DEFS
9378 rm -f confdefs.h.save
9379 mv confdefs.h confdefs.h.save
9380 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
9381 AC_OUTPUT_MAKE_DEFS()
9383 AC_SUBST(MOZ_DEFINES)
9385 mv confdefs.h.save confdefs.h
9387 dnl Load the list of Makefiles to generate.
9388 dnl To add new Makefiles, edit allmakefiles.sh.
9389 dnl allmakefiles.sh sets the variable, MAKEFILES.
9390 . ${srcdir}/allmakefiles.sh
9392 dnl Run a perl script to quickly create the makefiles.
9393 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
9394 dnl for the files it cannot handle correctly. This way, config.status
9395 dnl will handle these files.
9396 dnl If it fails, nothing is set and config.status will run as usual.
9398 dnl This does not change the $MAKEFILES variable.
9400 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
9402 if test -z "${AS_PERL}"; then
9403 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
9405 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
9410 echo $MAKEFILES > unallmakefiles
9412 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
9414 AC_OUTPUT($MAKEFILES)
9416 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
9417 if test "$CAIRO_FEATURES_H"; then
9418 if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
9419 echo "$CAIRO_FEATURES_H is unchanged"
9420 mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
9422 rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
9426 # Run freetype configure script
9428 if test "$MOZ_TREE_FREETYPE"; then
9429 export CFLAGS="$CFLAGS -std=c99"
9430 export CPPFLAGS="$CPPFLAGS"
9431 export CXXFLAGS="$CXXFLAGS"
9432 export LDFLAGS="$LDFLAGS"
9433 export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
9434 ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes"
9435 AC_OUTPUT_SUBDIRS(modules/freetype2)
9438 dnl ========================================================
9439 dnl = Setup a nice relatively clean build environment for
9440 dnl = sub-configures.
9441 dnl ========================================================
9444 CFLAGS="$_SUBDIR_CFLAGS"
9445 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9446 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9447 LDFLAGS="$_SUBDIR_LDFLAGS"
9448 HOST_CC="$_SUBDIR_HOST_CC"
9449 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9450 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9456 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9457 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9459 if test -n "$MOZ_THUMB2"; then
9460 _SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --enable-thumb2"
9462 if test -n "$_WRAP_MALLOC"; then
9463 _SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --enable-wrap-malloc"
9466 if test -z "$MOZ_NATIVE_NSPR"; then
9467 ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9468 if test -z "$MOZ_DEBUG"; then
9469 ac_configure_args="$ac_configure_args --disable-debug"
9471 if test "$MOZ_OPTIMIZE" = "1"; then
9472 ac_configure_args="$ac_configure_args --enable-optimize"
9474 if test "$OS_ARCH" = "WINNT" -a "$NS_TRACE_MALLOC"; then
9475 ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
9477 if test -n "$HAVE_64BIT_OS"; then
9478 ac_configure_args="$ac_configure_args --enable-64bit"
9480 if test -n "$USE_ARM_KUSER"; then
9481 ac_configure_args="$ac_configure_args --with-arm-kuser"
9483 AC_OUTPUT_SUBDIRS(nsprpub)
9484 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9487 if test -z "$MOZ_NATIVE_NSPR"; then
9488 # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
9489 AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
9490 if test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
9491 NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
9492 $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
9493 NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
9494 $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
9496 rm -f config/autoconf.mk.bak
9499 # Run the SpiderMonkey 'configure' script.
9500 dist=$MOZ_BUILD_ROOT/dist
9501 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9502 ac_configure_args="$ac_configure_args --enable-threadsafe"
9503 if test "$BUILD_CTYPES"; then
9504 # Build js-ctypes on the platforms we can.
9505 ac_configure_args="$ac_configure_args --enable-ctypes"
9507 if test -z "$JS_SHARED_LIBRARY" ; then
9508 ac_configure_args="$ac_configure_args --disable-shared-js"
9510 if test -z "$MOZ_NATIVE_NSPR"; then
9511 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9512 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9514 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9515 ac_configure_args="$ac_configure_args --prefix=$dist"
9516 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
9517 if test "$MOZ_MEMORY"; then
9518 ac_configure_args="$ac_configure_args --enable-jemalloc"
9519 if test -n "$MOZ_MEMORY_LDFLAGS"; then
9520 export MOZ_MEMORY_LDFLAGS
9523 AC_OUTPUT_SUBDIRS(js/src)
9524 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9526 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
9528 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
9529 dnl Needs to be at the end to respect possible changes from NSPR configure
9530 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
9531 echo "config/autoconf.mk is unchanged"
9532 mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
9534 rm -f config/autoconf.mk.orig 2> /dev/null