1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
2 dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
3 dnl This Source Code Form is subject to the terms of the Mozilla Public
4 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
5 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 dnl Process this file with autoconf to produce a configure script.
8 dnl ========================================================
11 AC_INIT(js/src/jsapi.h)
12 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
14 TARGET_CPU="${target_cpu}"
15 TARGET_VENDOR="${target_vendor}"
16 TARGET_OS="${target_os}"
18 dnl ========================================================
20 dnl = Don't change the following two lines. Doing so breaks:
22 dnl = CFLAGS="-foo" ./configure
24 dnl ========================================================
26 CPPFLAGS="${CPPFLAGS=}"
27 CXXFLAGS="${CXXFLAGS=}"
29 HOST_CFLAGS="${HOST_CFLAGS=}"
30 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
31 HOST_LDFLAGS="${HOST_LDFLAGS=}"
33 dnl ========================================================
34 dnl = Preserve certain environment flags passed to configure
35 dnl = We want sub projects to receive the same flags
36 dnl = untainted by this configure script
37 dnl ========================================================
40 _SUBDIR_CFLAGS="$CFLAGS"
41 _SUBDIR_CPPFLAGS="$CPPFLAGS"
42 _SUBDIR_CXXFLAGS="$CXXFLAGS"
43 _SUBDIR_LDFLAGS="$LDFLAGS"
44 _SUBDIR_HOST_CC="$HOST_CC"
45 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
46 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
47 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
48 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
50 dnl Set the version number of the libs included with mozilla
51 dnl ========================================================
55 dnl Set the minimum version of toolkit libs used by mozilla
56 dnl ========================================================
58 WINDRES_VERSION=2.14.90
63 dnl Set various checks
64 dnl ========================================================
68 dnl Initialize the Pthread test variables early so they can be
69 dnl overridden by each platform.
70 dnl ========================================================
74 dnl Do not allow objdir == srcdir builds
75 dnl ==============================================================
76 _topsrcdir=`cd $srcdir; pwd`
79 if test "$_topsrcdir" = "$_objdir"
82 echo " * Building directly in the main source directory is not allowed."
84 echo " * To build, you must run configure from a separate directory"
85 echo " * (referred to as an object directory)."
90 # Check for a couple representative files in the source tree
92 for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
93 if test -f $file; then
94 _conflict_files="$_conflict_files $file"
97 if test "$_conflict_files"; then
99 echo "* Your source tree contains these files:"
100 for file in $_conflict_files; do
104 * This indicates that you previously built in the source tree.
105 * A source tree build can confuse the separate objdir build.
107 * To clean up the source tree:
115 MOZ_BUILD_ROOT=`pwd -W 2>/dev/null || pwd`
117 dnl Choose where to put the 'dist' directory.
118 dnl ==============================================================
120 MOZ_ARG_WITH_STRING(dist-dir,
121 [ --with-dist-dir=DIR Use DIR as 'dist' staging area. DIR may be
122 relative to the top of SpiderMonkey build tree,
130 COMPILE_ENVIRONMENT=1
131 MOZ_ARG_DISABLE_BOOL(compile-environment,
132 [ --disable-compile-environment
133 Disable compiler/library checks.],
134 COMPILE_ENVIRONMENT= )
135 AC_SUBST(COMPILE_ENVIRONMENT)
137 dnl Check for Perl first -- needed for win32 SDK checks
138 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
139 if test -z "$PERL" -o "$PERL" = ":"; then
140 AC_MSG_ERROR([perl not found in \$PATH])
143 MOZ_ARG_ENABLE_BOOL(shared-js,
144 [ --disable-shared-js
145 Do not create a shared library.],
149 MOZ_ARG_DISABLE_BOOL(export-js,
150 [ --disable-export-js
151 Do not mark JS symbols as DLL exported/visible.],
155 if test "$DISABLE_SHARED_JS" = "1" ; then
156 if test "$DISABLE_EXPORT_JS" = "1"; then
157 AC_DEFINE(STATIC_JS_API)
159 AC_DEFINE(STATIC_EXPORTABLE_JS_API)
162 if test "$DISABLE_EXPORT_JS" = "1"; then
163 AC_MSG_ERROR([Must export JS symbols when building a shared library.])
167 AC_SUBST(JS_SHARED_LIBRARY)
169 if test "$JS_STANDALONE" = no; then
170 autoconfmk=autoconf-js.mk
174 LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
175 AC_DEFINE(JS_STANDALONE)
177 AC_SUBST(JS_STANDALONE)
181 MOZ_ARG_WITH_STRING(gonk,
183 location of gonk dir],
186 MOZ_ARG_WITH_STRING(gonk-toolchain-prefix,
187 [ --with-gonk-toolchain-prefix=DIR
188 prefix to gonk toolchain commands],
189 gonk_toolchain_prefix=$withval)
191 if test -n "$gonkdir" ; then
192 kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
195 AS="$gonk_toolchain_prefix"as
196 CC="$gonk_toolchain_prefix"gcc
197 CXX="$gonk_toolchain_prefix"g++
198 CPP="$gonk_toolchain_prefix"cpp
199 LD="$gonk_toolchain_prefix"ld
200 AR="$gonk_toolchain_prefix"ar
201 RANLIB="$gonk_toolchain_prefix"ranlib
202 STRIP="$gonk_toolchain_prefix"strip
203 OBJCOPY="$gonk_toolchain_prefix"objcopy
205 STLPORT_CPPFLAGS="-I$gonkdir/external/stlport/stlport"
206 STLPORT_LIBS="-lstlport"
208 case "$target_cpu" in
220 CPPFLAGS="-DANDROID -isystem $gonkdir/bionic/libc/$ARCH_DIR/include -isystem $gonkdir/bionic/libc/include/ -isystem $gonkdir/bionic/libc/kernel/common -isystem $gonkdir/bionic/libc/kernel/$ARCH_DIR -isystem $gonkdir/bionic/libm/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/system/core/include -isystem $gonkdir/bionic $CPPFLAGS -I$gonkdir/external/valgrind/fxos-include"
221 CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
222 CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS $STLPORT_CPPFLAGS"
223 LIBS="$LIBS $STLPORT_LIBS"
225 dnl Add -llog by default, since we use it all over the place.
226 LDFLAGS="-mandroid -L$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib -Wl,-rpath-link=$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib --sysroot=$gonkdir/out/target/product/$GONK_PRODUCT/obj/ -llog $LDFLAGS"
228 dnl prevent cross compile section from using these flags as host flags
229 if test -z "$HOST_CPPFLAGS" ; then
232 if test -z "$HOST_CFLAGS" ; then
235 if test -z "$HOST_CXXFLAGS" ; then
238 if test -z "$HOST_LDFLAGS" ; then
248 dnl ==============================================================
249 dnl Get mozilla version from central milestone file
250 dnl ==============================================================
251 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
252 MOZILLA_UAVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -uaversion`
253 MOZILLA_SYMBOLVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -symbolversion`
255 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
256 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
257 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
258 AC_SUBST(MOZILLA_SYMBOLVERSION)
260 # Separate version into components for use in shared object naming etc
262 MOZJS_MAJOR_VERSION=`echo $MOZILLA_VERSION | sed "s|\(^[0-9]*\)\.[0-9]*.*|\1|"`
263 MOZJS_MINOR_VERSION=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.\([0-9]*\).*|\1|"`
264 MOZJS_PATCH_VERSION=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.[0-9]*[^0-9]*||"`
265 IS_ALPHA=`echo $MOZILLA_VERSION | grep '[ab]'`
267 dnl XXX in a temporary bid to avoid developer anger at renaming files
268 dnl XXX before "js" symlinks exist, don't change names.
270 dnl if test -n "$JS_STANDALONE"; then
271 dnl JS_SHELL_NAME=js$MOZJS_MAJOR_VERSION
272 dnl JS_CONFIG_NAME=js$MOZJS_MAJOR_VERSION-config
275 JS_CONFIG_NAME=js-config
279 if test -n "$IS_ALPHA"; then
281 MOZJS_ALPHA=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.[0-9\.]*\([^0-9]\).*|\1|"`
284 AC_DEFINE_UNQUOTED(MOZJS_MAJOR_VERSION,$MOZJS_MAJOR_VERSION)
285 AC_DEFINE_UNQUOTED(MOZJS_MINOR_VERSION,$MOZJS_MINOR_VERSION)
286 AC_SUBST(JS_SHELL_NAME)
287 AC_SUBST(JS_CONFIG_NAME)
288 AC_SUBST(MOZJS_MAJOR_VERSION)
289 AC_SUBST(MOZJS_MINOR_VERSION)
290 AC_SUBST(MOZJS_PATCH_VERSION)
291 AC_SUBST(MOZJS_ALPHA)
293 dnl ========================================================
294 dnl Checks for compilers.
295 dnl ========================================================
297 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
300 if test "$COMPILE_ENVIRONMENT"; then
303 # In Mozilla, we use the names $target, $host and $build incorrectly, but are
304 # too far gone to back out now. See Bug 475488:
305 # - When we say $target, we mean $host, that is, the system on which
306 # Mozilla will be run.
307 # - When we say $host, we mean $build, that is, the system on which Mozilla
309 # - $target (in its correct usage) is for compilers who generate code for a
310 # different platform than $host, so it would not be used by Mozilla.
311 if test "$target" != "$host"; then
317 MOZ_PATH_PROGS(AS, $AS as, $CC)
318 AC_CHECK_PROGS(AR, ar, :)
319 AC_CHECK_PROGS(LD, ld, :)
320 AC_CHECK_PROGS(STRIP, strip, :)
321 AC_CHECK_PROGS(WINDRES, windres, :)
322 if test -z "$HOST_CC"; then
325 if test -z "$HOST_CFLAGS"; then
326 HOST_CFLAGS='$(CFLAGS)'
328 if test -z "$HOST_CXX"; then
331 if test -z "$HOST_CXXFLAGS"; then
332 HOST_CXXFLAGS='$(CXXFLAGS)'
334 if test -z "$HOST_LDFLAGS"; then
335 HOST_LDFLAGS='$(LDFLAGS)'
337 if test -z "$HOST_RANLIB"; then
338 HOST_RANLIB='$(RANLIB)'
340 if test -z "$HOST_AR"; then
343 if test -z "$HOST_AR_FLAGS"; then
344 HOST_AR_FLAGS='$(AR_FLAGS)'
350 MOZ_CHECK_COMPILER_WRAPPER
352 if test -n "$GNU_CC" -a -z "$CLANG_CC" ; then
353 if test "$GCC_MAJOR_VERSION" -eq 4 -a "$GCC_MINOR_VERSION" -lt 4 ||
354 test "$GCC_MAJOR_VERSION" -lt 4; then
355 AC_MSG_ERROR([Only GCC 4.4 or newer supported])
359 dnl Special win32 checks
360 dnl ========================================================
362 MOZ_ARG_ENABLE_BOOL(metro,
363 [ --enable-metro Enable Windows Metro build targets],
366 if test -n "$MOZ_METRO"; then
368 # Target the Windows 8 Kit
372 # Target the Windows 7 SDK by default
377 MOZ_ARG_WITH_STRING(windows-version,
378 [ --with-windows-version=WINSDK_TARGETVER
379 Windows SDK version to target. Lowest version
380 currently allowed is 601, highest is 602],
381 WINSDK_TARGETVER=$withval)
383 # Currently only two sdk versions allowed, 601 and 602
384 case "$WINSDK_TARGETVER" in
386 MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
390 AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
396 if test "$GCC" != "yes"; then
397 # Check to see if we are really running in a msvc environemnt
400 # Make sure compilers are valid
401 CFLAGS="$CFLAGS -TC -nologo"
402 CXXFLAGS="$CXXFLAGS -TP -nologo"
403 # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
404 # MSVC warning C4351 warns of newly conformant behavior as of VS2005.
405 # MSVC warning C4800 warns when a value is implicitly cast to bool,
406 # because this also forces narrowing to a single byte, which can be a
407 # perf hit. But this matters so little in practice (and often we want
408 # that behavior) that it's better to turn it off.
409 # _CRT_SECURE_NO_WARNINGS disables warnings about using MSVC-specific
410 # secure CRT functions.
411 CXXFLAGS="$CXXFLAGS -wd4345 -wd4351 -wd4800 -D_CRT_SECURE_NO_WARNINGS"
414 AC_TRY_COMPILE([#include <stdio.h>],
415 [ printf("Hello World\n"); ],,
416 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
419 AC_TRY_COMPILE([#include <new.h>],
420 [ unsigned *test = new unsigned(42); ],,
421 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
425 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
428 # Determine compiler version
429 _CC_MAJOR_VERSION=`echo ${CC_VERSION} | cut -c 1-2`
430 _CC_MINOR_VERSION=`echo ${CC_VERSION} | cut -c 3-4`
431 _MSC_VER=${CC_VERSION}
433 _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | cut -c 1-2`
435 if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
436 AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
439 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
440 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
442 if test "$_CC_MAJOR_VERSION" = "16"; then
444 elif test "$_CC_MAJOR_VERSION" = "17"; then
446 elif test "$_CC_MAJOR_VERSION" = "18"; then
449 AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
452 dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
453 dnl not something else like "magnetic tape manipulation utility".
454 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
455 if test -z "$MSMT_TOOL"; then
456 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
460 _MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
462 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
463 if test -z "$MSMANIFEST_TOOL_VERSION"; then
464 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
470 # Check linker version
471 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
472 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
473 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
474 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
479 unset _MSVC_VER_FILTER
481 CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
482 CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
484 MOZ_FIND_WINSDK_VERSION
486 # Check w32api version
487 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
488 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
489 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
490 AC_TRY_COMPILE([#include <w32api.h>],
491 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
492 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
493 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
494 #error "test failed."
496 , [ res=yes ], [ res=no ])
497 AC_MSG_RESULT([$res])
498 if test "$res" != "yes"; then
499 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
501 # Check windres version
502 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
503 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
504 AC_MSG_RESULT([$_WINDRES_VERSION])
505 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
506 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
507 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
508 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
509 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
510 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
511 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
512 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
513 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
514 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
515 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
516 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
518 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
521 MOZ_WINSDK_MAXVER=0x06010000
524 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
525 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
526 # Require OS features provided by IE 6.0 SP2 (XP SP2)
527 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
529 # If the maximum version supported by this SDK is lower than the target
531 AC_MSG_CHECKING([for Windows SDK being recent enough])
532 if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
536 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.])
539 AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
540 # Definitions matching sdkddkver.h
541 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
548 if test -n "$_WIN32_MSVC"; then
550 SKIP_COMPILER_CHECKS=1
551 SKIP_LIBRARY_CHECKS=1
553 # Since we're skipping compiler and library checks, hard-code
556 # Common to all MSVC environments:
558 AC_DEFINE(HAVE_LOCALECONV)
559 AC_DEFINE(HAVE_HYPOT)
560 AC_CHECK_FUNCS([_getc_nolock])
563 fi # COMPILE_ENVIRONMENT
565 # Check to see if we are running in a broken QEMU scratchbox.
566 # We know that anything below 1.0.16 is broken.
567 AC_CHECK_PROGS(SBCONF, sb-conf ve, "")
568 if test -n "$SBCONF"; then
569 _sb_version=`$SBCONF ve`
570 _sb_version_major=`echo $_sb_version | cut -f1 -d.`
571 _sb_version_minor=`echo $_sb_version | cut -f2 -d.`
572 _sb_version_point=`echo $_sb_version | cut -f3 -d.`
573 if test $_sb_version_major -eq 1 -a $_sb_version_minor -eq 0 -a $_sb_version_point -le 16; then
574 QEMU_CANT_RUN_JS_SHELL=1
577 AC_SUBST(QEMU_CANT_RUN_JS_SHELL)
588 dnl ========================================================
589 dnl Checks for programs.
590 dnl ========================================================
594 AC_MSG_CHECKING([for tar archiver])
595 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
596 if test -z "$TAR"; then
597 AC_MSG_WARN([no tar archiver found in \$PATH])
599 AC_MSG_RESULT([$TAR])
602 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
603 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
604 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
606 AC_MSG_RESULT([$_perl_version])
608 if test "$_perl_res" != 0; then
609 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
613 AC_MSG_CHECKING([for full perl installation])
614 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
616 if test "$_perl_res" != 0; then
618 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
625 if test -z "$COMPILE_ENVIRONMENT"; then
626 NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
628 AC_SUBST(NSINSTALL_BIN)
630 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
631 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
632 MOZ_PATH_PROG(XARGS, xargs)
633 if test -z "$XARGS" -o "$XARGS" = ":"; then
634 AC_MSG_ERROR([xargs not found in \$PATH .])
637 if test "$COMPILE_ENVIRONMENT"; then
639 dnl ========================================================
640 dnl = Mac OS X toolchain support
641 dnl ========================================================
643 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
644 dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
645 dnl when we can run target binaries.
646 AC_SUBST(UNIVERSAL_BINARY)
647 AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
649 dnl ========================================================
650 dnl Check for MacOS deployment target version
651 dnl ========================================================
653 MOZ_ARG_ENABLE_STRING(macos-target,
654 [ --enable-macos-target=VER (default=10.6)
655 Set the minimum MacOS version needed at runtime],
656 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
658 if test "$target_cpu" != "arm"; then
661 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
662 dnl Use the specified value
663 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
665 dnl No value specified on the command line or in the environment,
666 dnl use architecture minimum.
667 export MACOSX_DEPLOYMENT_TARGET=10.6
673 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
675 dnl ========================================================
676 dnl = Mac OS X SDK support
677 dnl ========================================================
679 MOZ_ARG_WITH_STRING(macos-sdk,
680 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
681 MACOS_SDK_DIR=$withval)
683 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
684 AC_SUBST(MACOS_SDK_DIR)
686 if test "$MACOS_SDK_DIR"; then
687 dnl Sync this section with the ones in NSPR and NSS.
688 dnl Changes to the cross environment here need to be accounted for in
689 dnl the libIDL checks (below) and xpidl build.
691 if test ! -d "$MACOS_SDK_DIR"; then
692 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
693 specify a valid SDK. SDKs are installed when the optional cross-development
694 tools are selected during the Xcode/Developer Tools installation.])
697 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
698 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
700 dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
701 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
702 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
705 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
707 AC_TRY_COMPILE([#include <new>
708 int main() { return 0; }],
712 AC_MSG_RESULT($result)
714 if test "$result" = "no" ; then
715 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
719 fi # COMPILE_ENVIRONMENT
721 if test -n "$MAKE"; then
722 if test `echo $MAKE | grep -c make.py` != 1; then
729 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
732 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
735 if test "$GMAKE" = ":"; then
736 AC_MSG_ERROR([GNU make not found])
739 # MAKE will be set by client.mk, but still need this for standalone js builds
740 if test -z "$MAKE"; then
744 if test "$COMPILE_ENVIRONMENT"; then
750 fi # COMPILE_ENVIRONMENT
752 dnl ========================================================
753 dnl set the defaults first
754 dnl ========================================================
770 MOZ_USER_DIR=".mozilla"
772 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
776 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
778 if test -n "$CROSS_COMPILE"; then
779 OS_TARGET="${target_os}"
780 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
782 case "${target_os}" in
783 linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
784 kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU/kFreeBSD ;;
786 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
787 mingw*) OS_ARCH=WINNT OS_TARGET=WINNT ;;
788 darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
789 dragonfly*) OS_ARCH=DragonFly OS_TARGET=DragonFly ;;
790 freebsd*) OS_ARCH=FreeBSD OS_TARGET=FreeBSD ;;
791 netbsd*) OS_ARCH=NetBSD OS_TARGET=NetBSD ;;
792 openbsd*) OS_ARCH=OpenBSD OS_TARGET=OpenBSD ;;
795 *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
799 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
800 OS_RELEASE=`uname -r`
803 # Before this used `uname -m` when not cross compiling
804 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
805 OS_TEST="${target_cpu}"
807 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
809 #######################################################################
810 # Master "Core Components" macros for getting the OS target #
811 #######################################################################
814 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
819 # Define and override various archtecture-specific variables, including
828 case "$HOST_OS_ARCH" in
839 HOST_OS_ARCH=GNU_kFreeBSD
845 HOST_OS_ARCH=DragonFly
860 if test -z "$GNU_CC"; then
861 if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
866 if test -z "$GNU_CXX"; then
867 if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
871 AC_SUBST(SOLARIS_SUNPRO_CC)
872 AC_SUBST(SOLARIS_SUNPRO_CXX)
878 if test -z "$CROSS_COMPILE" ; then
884 # If uname -s returns "Windows_NT", we assume that we are using
885 # the uname.exe in MKS toolkit.
887 # The -r option of MKS uname only returns the major version number.
888 # So we need to use its -v option to get the minor version number.
889 # Moreover, it doesn't have the -p option, so we need to use uname -m.
893 OS_MINOR_RELEASE=`uname -v`
894 if test "$OS_MINOR_RELEASE" = "00"; then
897 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
901 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
902 # the uname.exe in the MSYS tools.
904 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
909 OS_RELEASE=`uname -v`.`uname -r`
910 OS_TEST=${target_cpu}
911 if test -z "$GNU_CC"; then
912 if test "`$CC -qversion 2>&1 | egrep -c 'IBM XL'`" != "0"; then
918 case "${target_cpu}" in
929 if test -z "$CROSS_COMPILE" ; then
937 # Only set CPU_ARCH if we recognize the value of OS_TEST
944 powerpc64 | ppc64 | powerpc64le | ppc64le)
948 powerpc | ppc | rs6000)
952 Alpha | alpha | ALPHA)
990 if test -z "$OS_TARGET"; then
993 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
995 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
996 dnl ===============================================================
1000 INTEL_ARCHITECTURE=1
1003 dnl Configure platform-specific CPU architecture compiler options.
1004 dnl ==============================================================
1007 dnl =================================================================
1008 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1009 dnl which is bad when cross compiling.
1010 dnl =================================================================
1011 if test "$COMPILE_ENVIRONMENT"; then
1012 configure_static_assert_macros='
1013 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1014 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1015 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1018 dnl test that the macros actually work:
1019 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1020 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1023 ac_cv_static_assertion_macros_work="yes"
1024 AC_TRY_COMPILE([$configure_static_assert_macros],
1025 [CONFIGURE_STATIC_ASSERT(1)],
1027 ac_cv_static_assertion_macros_work="no")
1028 AC_TRY_COMPILE([$configure_static_assert_macros],
1029 [CONFIGURE_STATIC_ASSERT(0)],
1030 ac_cv_static_assertion_macros_work="no",
1033 AC_TRY_COMPILE([$configure_static_assert_macros],
1034 [CONFIGURE_STATIC_ASSERT(1)],
1036 ac_cv_static_assertion_macros_work="no")
1037 AC_TRY_COMPILE([$configure_static_assert_macros],
1038 [CONFIGURE_STATIC_ASSERT(0)],
1039 ac_cv_static_assertion_macros_work="no",
1043 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1044 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1045 AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1047 fi # COMPILE_ENVIRONMENT
1049 dnl ========================================================
1050 dnl Android libstdc++, placed here so it can use MOZ_ARCH
1052 dnl ========================================================
1056 dnl ========================================================
1057 dnl Suppress Clang Argument Warnings
1058 dnl ========================================================
1059 if test -n "$CLANG_CC"; then
1060 _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
1061 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
1063 if test -n "$CLANG_CXX"; then
1064 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
1067 dnl ========================================================
1068 dnl = Use Address Sanitizer
1069 dnl ========================================================
1070 MOZ_ARG_ENABLE_BOOL(address-sanitizer,
1071 [ --enable-address-sanitizer Enable Address Sanitizer (default=no)],
1074 if test -n "$MOZ_ASAN"; then
1077 MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
1080 AC_SUBST(LLVM_SYMBOLIZER)
1082 dnl ========================================================
1083 dnl = Enable hacks required for LLVM instrumentations
1084 dnl ========================================================
1085 MOZ_ARG_ENABLE_BOOL(llvm-hacks,
1086 [ --enable-llvm-hacks Enable workarounds required for several LLVM instrumentations (default=no)],
1089 if test -n "$MOZ_LLVM_HACKS"; then
1093 dnl ========================================================
1094 dnl GNU specific defaults
1095 dnl ========================================================
1096 if test "$GNU_CC"; then
1097 # Per bug 719659 comment 2, some of the headers on ancient build machines
1098 # may require gnu89 inline semantics. But otherwise, we use C99.
1099 # But on OS X we just use C99 plus GNU extensions, in order to fix
1101 CFLAGS="$CFLAGS -std=gnu99"
1102 if test "${OS_ARCH}" != Darwin; then
1103 CFLAGS="$CFLAGS -fgnu89-inline"
1105 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
1106 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
1107 DSO_LDOPTS='-shared'
1108 if test "$GCC_USE_GNU_LD"; then
1109 # Some tools like ASan use a runtime library that is only
1110 # linked against executables, so we must allow undefined
1111 # symbols for shared objects in some cases.
1112 if test -z "$MOZ_NO_WLZDEFS"; then
1113 # Don't allow undefined symbols in libraries
1114 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1117 WARNINGS_AS_ERRORS='-Werror'
1119 DSO_PIC_CFLAGS='-fPIC'
1120 ASFLAGS="$ASFLAGS -fPIC"
1121 AC_MSG_CHECKING([for --noexecstack option to as])
1122 _SAVE_CFLAGS=$CFLAGS
1123 CFLAGS="$CFLAGS -Wa,--noexecstack"
1124 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
1125 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
1126 AC_MSG_RESULT([no]))
1127 CFLAGS=$_SAVE_CFLAGS
1128 AC_MSG_CHECKING([for -z noexecstack option to ld])
1129 _SAVE_LDFLAGS=$LDFLAGS
1130 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
1131 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
1133 LDFLAGS=$_SAVE_LDFLAGS)
1135 AC_MSG_CHECKING([for -z text option to ld])
1136 _SAVE_LDFLAGS=$LDFLAGS
1137 LDFLAGS="$LDFLAGS -Wl,-z,text"
1138 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1139 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,text"],
1141 LDFLAGS=$_SAVE_LDFLAGS)
1143 AC_MSG_CHECKING([for --build-id option to ld])
1144 _SAVE_LDFLAGS=$LDFLAGS
1145 LDFLAGS="$LDFLAGS -Wl,--build-id"
1146 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1147 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,--build-id"],
1149 LDFLAGS=$_SAVE_LDFLAGS)
1151 # Turn on GNU-specific warnings:
1152 # -Wall - turn on a lot of warnings
1153 # -Wpointer-arith - good to have
1154 # -Wdeclaration-after-statement - MSVC doesn't like these
1155 # -Werror=return-type - catches missing returns, zero false positives
1156 # -Werror=int-to-pointer-cast - catches cast to pointer from integer of different size
1157 # -Wtype-limits - catches overflow bugs, few false positives
1158 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1159 # -Wsign-compare - catches comparison of signed and unsigned types
1161 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
1162 MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
1163 MOZ_C_SUPPORTS_WARNING(-W, error=int-to-pointer-cast, ac_c_has_werror_int_to_pointer_cast)
1164 MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
1165 MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
1166 MOZ_C_SUPPORTS_WARNING(-W, sign-compare, ac_c_has_sign_compare)
1168 # Turn off the following warnings that -Wall turns on:
1169 # -Wno-unused - lots of violations in third-party code
1171 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
1173 if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1174 # Don't use -Wcast-align with ICC or clang
1176 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1177 hppa | ia64 | sparc | arm)
1180 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1185 _DEFINES_CFLAGS='-include $(DEPTH)/js/src/js-confdefs.h -DMOZILLA_CLIENT'
1186 _USE_CPP_INCLUDE_FLAG=1
1188 elif test "$SOLARIS_SUNPRO_CC"; then
1190 if test "$CPU_ARCH" = "sparc"; then
1191 # for Sun Studio on Solaris/SPARC
1192 DSO_PIC_CFLAGS='-xcode=pic32'
1194 DSO_PIC_CFLAGS='-KPIC'
1196 _DEFINES_CFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
1198 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
1199 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
1201 DSO_LDOPTS='-shared'
1202 if test "$GNU_LD"; then
1203 # Don't allow undefined symbols in libraries
1204 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1208 DSO_PIC_CFLAGS='-KPIC'
1209 _DEFINES_CFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
1212 if test "$GNU_CXX"; then
1213 # Turn on GNU-specific warnings:
1214 # -Wall - turn on a lot of warnings
1215 # -Wpointer-arith - good to have
1216 # -Woverloaded-virtual - ???
1217 # -Werror=return-type - catches missing returns, zero false positives
1218 # -Werror=int-to-pointer-cast - catches cast to pointer from integer of different size
1219 # -Wtype-limits - catches overflow bugs, few false positives
1220 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1221 # -Werror=conversion-null - catches conversions between NULL and non-pointer types
1222 # -Wsign-compare - catches comparison of signed and unsigned types
1224 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
1225 MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
1226 MOZ_CXX_SUPPORTS_WARNING(-W, error=int-to-pointer-cast, ac_cxx_has_werror_int_to_pointer_cast)
1227 MOZ_CXX_SUPPORTS_WARNING(-W, type-limits, ac_cxx_has_wtype_limits)
1228 MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
1229 MOZ_CXX_SUPPORTS_WARNING(-W, error=conversion-null, ac_cxx_has_werror_conversion_null)
1230 MOZ_CXX_SUPPORTS_WARNING(-W, sign-compare, ac_cxx_has_sign_compare)
1232 # Turn off the following warnings that -Wall turns on:
1233 # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
1235 MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
1237 if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1238 # Don't use -Wcast-align with ICC or clang
1240 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1241 hppa | ia64 | sparc | arm)
1244 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1249 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/js/src/js-confdefs.h'
1250 _USE_CPP_INCLUDE_FLAG=1
1252 # Recent clang and gcc support C++11 deleted functions without warnings if
1253 # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
1254 # versions). We can't use -std=c++0x yet, so gcc's support must remain
1255 # unused. But clang's warning can be disabled, so when compiling with clang
1256 # we use it to opt out of the warning, enabling (macro-encapsulated) use of
1257 # deleted function syntax.
1258 if test "$CLANG_CXX"; then
1259 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
1260 MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
1264 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_JS_CONFDEFS_H_ $(ACDEFINES)'
1267 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1268 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1269 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1270 dnl normal behavior.
1271 dnl ========================================================
1273 MKSHLIB_UNFORCE_ALL=
1275 if test "$COMPILE_ENVIRONMENT"; then
1276 if test "$GNU_CC"; then
1277 AC_MSG_CHECKING(whether ld has archive extraction flags)
1278 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1279 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1280 ac_cv_mkshlib_force_and_unforce="no"
1281 exec 3<&0 <<LOOP_INPUT
1282 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
1283 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1284 force="-Wl,-all"; unforce="-Wl,-none"
1291 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1294 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1296 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1300 eval $ac_cv_mkshlib_force_and_unforce
1301 MKSHLIB_FORCE_ALL=$force
1302 MKSHLIB_UNFORCE_ALL=$unforce
1305 fi # COMPILE_ENVIRONMENT
1307 dnl ========================================================
1308 dnl Checking for 64-bit OS
1309 dnl ========================================================
1310 if test "$COMPILE_ENVIRONMENT"; then
1313 AC_MSG_CHECKING(for 64-bit OS)
1314 AC_TRY_COMPILE([$configure_static_assert_macros],
1315 [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1316 result="yes", result="no")
1317 AC_MSG_RESULT("$result")
1318 if test "$result" = "yes"; then
1319 AC_DEFINE(HAVE_64BIT_BUILD)
1322 AC_SUBST(HAVE_64BIT_BUILD)
1324 fi # COMPILE_ENVIRONMENT
1326 dnl ========================================================
1327 dnl = Use profiling compile flags
1328 dnl ========================================================
1329 MOZ_ARG_ENABLE_BOOL(profiling,
1330 [ --enable-profiling Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1334 dnl ========================================================
1335 dnl System overrides of the defaults for host
1336 dnl ========================================================
1339 if test -n "$_WIN32_MSVC"; then
1341 HOST_AR_FLAGS='-NOLOGO -OUT:$@'
1342 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo"
1343 HOST_RANLIB='echo ranlib'
1345 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
1347 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
1348 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1349 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1350 HOST_BIN_SUFFIX=.exe
1353 PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1357 case "${host_cpu}" in
1359 if test -n "$_WIN32_MSVC"; then
1360 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
1364 if test -n "$_WIN32_MSVC"; then
1365 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
1367 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1373 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1374 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1375 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1378 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1379 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1380 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1381 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1385 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1386 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1390 dnl Check for using a custom <inttypes.h> implementation
1391 dnl ========================================================
1392 AC_MSG_CHECKING(for custom <inttypes.h> implementation)
1393 if test "$MOZ_CUSTOM_INTTYPES_H"; then
1394 AC_DEFINE_UNQUOTED(MOZ_CUSTOM_INTTYPES_H, "$MOZ_CUSTOM_INTTYPES_H")
1395 AC_MSG_RESULT(using $MOZ_CUSTOM_INTTYPES_H)
1397 AC_MSG_RESULT(none specified)
1400 MOZ_DOING_LTO(lto_is_enabled)
1402 dnl ========================================================
1403 dnl System overrides of the defaults for target
1404 dnl ========================================================
1409 if test ! "$GNU_CC"; then
1410 if test ! "$HAVE_64BIT_BUILD"; then
1411 # Compiling with Visual Age C++ object model compat is the
1412 # default. To compile with object model ibm, add
1413 # AIX_OBJMODEL=ibm to .mozconfig.
1414 if test "$AIX_OBJMODEL" = "ibm"; then
1415 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1422 AC_SUBST(AIX_OBJMODEL)
1423 DSO_LDOPTS='-qmkshrobj=1'
1424 DSO_CFLAGS='-qflag=w:w'
1426 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1428 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1429 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1430 if test "$COMPILE_ENVIRONMENT"; then
1433 AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
1435 [#if (__IBMCPP__ < 900)
1436 #error "Bad compiler"
1438 _BAD_COMPILER=,_BAD_COMPILER=1)
1439 if test -n "$_BAD_COMPILER"; then
1441 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
1443 AC_MSG_RESULT([yes])
1446 TARGET_COMPILER_ABI="ibmc"
1447 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1448 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1451 case "${target_os}" in
1456 if test "$COMPILE_ENVIRONMENT"; then
1457 MOZ_CHECK_HEADERS(sys/inttypes.h)
1459 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1463 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1464 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1465 MOZ_OPTIMIZE_FLAGS="-O3 -fno-stack-protector"
1466 CFLAGS="$CFLAGS -fno-common"
1467 CXXFLAGS="$CXXFLAGS -fno-common"
1470 STRIP="$STRIP -x -S"
1471 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1472 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1473 LDFLAGS="$LDFLAGS -lobjc"
1474 # The ExceptionHandling framework is needed for Objective-C exception
1475 # logging code in nsObjCExceptions.h. Currently we only use that in debug
1477 _SAVE_LDFLAGS=$LDFLAGS
1478 AC_MSG_CHECKING([for -framework ExceptionHandling])
1479 LDFLAGS="$LDFLAGS -framework ExceptionHandling"
1480 AC_TRY_LINK(,[return 0;],
1481 ac_cv_have_framework_exceptionhandling="yes",
1482 ac_cv_have_framework_exceptionhandling="no")
1483 AC_MSG_RESULT([$ac_cv_have_framework_exceptionhandling])
1484 if test "$ac_cv_have_framework_exceptionhandling" = "yes"; then
1485 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
1487 LDFLAGS=$_SAVE_LDFLAGS
1489 if test "x$lto_is_enabled" = "xyes"; then
1490 echo "Skipping -dead_strip because lto is enabled."
1491 dnl DTrace and -dead_strip don't interact well. See bug 403132.
1492 dnl ===================================================================
1493 elif test "x$enable_dtrace" = "xyes"; then
1494 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
1496 dnl check for the presence of the -dead_strip linker flag
1497 AC_MSG_CHECKING([for -dead_strip option to ld])
1498 _SAVE_LDFLAGS=$LDFLAGS
1499 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
1500 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
1501 if test -n "$_HAVE_DEAD_STRIP" ; then
1502 AC_MSG_RESULT([yes])
1503 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
1508 LDFLAGS=$_SAVE_LDFLAGS
1510 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
1515 if test ! "$GNU_CC"; then
1519 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
1520 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
1521 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1524 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1525 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
1528 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1529 AC_DEFINE(_LARGEFILE64_SOURCE)
1534 if test ! "$GNU_CC"; then
1535 DSO_LDOPTS='-b -Wl,+s'
1538 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
1539 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
1540 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
1542 DSO_LDOPTS='-b -E +s'
1543 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1544 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
1546 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
1547 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1550 *-android*|*-linuxandroid*)
1551 AC_DEFINE(NO_PW_GECOS)
1553 _PLATFORM_DEFAULT_TOOLKIT=cairo-android
1554 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1556 MOZ_GFX_OPTIMIZE_MOBILE=1
1557 MOZ_OPTIMIZE_FLAGS="-O3 -fno-reorder-functions"
1558 if test -z "$CLANG_CC"; then
1559 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
1561 # The Maemo builders don't know about this flag
1562 MOZ_ARM_VFP_FLAGS="-mfpu=vfp"
1566 # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
1567 # Similarly for GNU_CXX and INTEL_CXX.
1568 if test "$INTEL_CC" -o "$INTEL_CXX"; then
1569 # -Os has been broken on Intel's C/C++ compilers for quite a
1570 # while; Intel recommends against using it.
1571 MOZ_OPTIMIZE_FLAGS="-O2"
1572 elif test "$GNU_CC" -o "$GNU_CXX"; then
1573 case $GCC_VERSION in
1575 # -Os is broken on gcc 4.5.x we need to tweak it to get good results.
1576 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
1578 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
1579 MOZ_OPTIMIZE_FLAGS="-O3 $MOZ_OPTIMIZE_SIZE_TWEAK"
1580 if test -z "$CLANG_CC"; then
1581 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
1585 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1587 case "${target_cpu}" in
1589 CFLAGS="$CFLAGS -mieee"
1590 CXXFLAGS="$CXXFLAGS -mieee"
1594 if test -z "$MC"; then
1605 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
1607 CXX="$CXX -mwindows"
1608 CPP="$CPP -mwindows"
1609 CFLAGS="$CFLAGS -mms-bitfields"
1610 CXXFLAGS="$CXXFLAGS -mms-bitfields"
1611 DSO_LDOPTS='-shared'
1612 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1613 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1615 # Use static libgcc and libstdc++
1616 LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++"
1617 # Use temp file for windres (bug 213281)
1618 RCFLAGS='-O coff --use-temp-file'
1619 # mingw doesn't require kernel32, user32, and advapi32 explicitly
1620 LIBS="$LIBS -lgdi32 -lwinmm -lwsock32 -lpsapi"
1623 IMPORT_LIB_SUFFIX=dll.a
1625 WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
1626 WIN32_GUI_EXE_LDFLAGS=-mwindows
1628 # We use mix of both POSIX and Win32 printf format across the tree, so format
1629 # warnings are useless on mingw.
1630 MOZ_C_SUPPORTS_WARNING(-Wno-, format, ac_c_has_wno_format)
1631 MOZ_CXX_SUPPORTS_WARNING(-Wno-, format, ac_cxx_has_wno_format)
1633 TARGET_COMPILER_ABI=msvc
1637 if test "$AS_BIN"; then
1638 AS="$(basename "$AS_BIN")"
1641 AR_FLAGS='-NOLOGO -OUT:$@'
1643 RANLIB='echo not_ranlib'
1644 STRIP='echo not_strip'
1653 IMPORT_LIB_SUFFIX=lib
1654 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
1655 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
1657 MKSHLIB_UNFORCE_ALL=
1658 dnl Set subsystem version 5 for Windows XP.
1659 if test "$CPU_ARCH" = "x86"; then
1660 WIN32_SUBSYSTEM_VERSION=5.01
1662 WIN32_SUBSYSTEM_VERSION=5.02
1664 WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
1665 WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
1666 DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
1667 _USE_CPP_INCLUDE_FLAG=1
1668 _DEFINES_CFLAGS='-FI $(DEPTH)/js/src/js-confdefs.h -DMOZILLA_CLIENT'
1669 _DEFINES_CXXFLAGS='-FI $(DEPTH)/js/src/js-confdefs.h -DMOZILLA_CLIENT'
1670 CFLAGS="$CFLAGS -W3 -Gy"
1671 CXXFLAGS="$CXXFLAGS -W3 -Gy"
1672 if test "$_CC_SUITE" -ge "11" -a "$CPU_ARCH" = "x86"; then
1673 dnl VS2012+ defaults to -arch:SSE2.
1674 CFLAGS="$CFLAGS -arch:IA32"
1675 CXXFLAGS="$CXXFLAGS -arch:IA32"
1677 if test "$_CC_SUITE" -ge "12"; then
1678 dnl VS2013+ requires -FS when parallel building by make -jN.
1679 dnl If nothing, compiler sometimes causes C1041 error.
1681 dnl Visual Studio 2013 supports -Gw flags
1682 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
1683 CFLAGS="$CFLAGS -FS -Gw"
1684 CXXFLAGS="$CXXFLAGS -FS -Gw"
1686 # khuey says we can safely ignore MSVC warning C4251
1687 # MSVC warning C4244 (implicit type conversion may lose data) warns
1688 # and requires workarounds for perfectly valid code. Also, GCC/clang
1689 # don't warn about it by default. So for consistency/sanity, we turn
1690 # it off on MSVC, too.
1691 CFLAGS="$CFLAGS -wd4244"
1692 CXXFLAGS="$CXXFLAGS -wd4244 -wd4251"
1693 # make 'foo == bar;' error out
1694 CFLAGS="$CFLAGS -we4553"
1695 CXXFLAGS="$CXXFLAGS -we4553"
1696 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib psapi.lib"
1697 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1698 WARNINGS_AS_ERRORS='-WX'
1699 MOZ_OPTIMIZE_FLAGS="-O2"
1701 # Disable these flags on clang-cl since it doesn't ignore unknown arguments by default, and
1702 # autoconf insists on passing $LDFLAGS to the compiler.
1703 if test -z "$CLANG_CL"; then
1704 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
1705 if test -z "$DEVELOPER_OPTIONS"; then
1706 LDFLAGS="$LDFLAGS -RELEASE"
1709 dnl For profile-guided optimization
1710 PROFILE_GEN_CFLAGS="-GL"
1711 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
1712 dnl XXX: PGO builds can fail with warnings treated as errors,
1713 dnl specifically "no profile data available" appears to be
1714 dnl treated as an error sometimes. This might be a consequence
1715 dnl of using WARNINGS_AS_ERRORS in some modules, combined
1716 dnl with the linker doing most of the work in the whole-program
1717 dnl optimization/PGO case. I think it's probably a compiler bug,
1718 dnl but we work around it here.
1719 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
1720 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
1721 dnl Probably also a compiler bug, but what can you do?
1722 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
1723 LDFLAGS="$LDFLAGS -DYNAMICBASE"
1725 AC_DEFINE(HAVE_SNPRINTF)
1730 AC_DEFINE(HW_THREADS)
1731 AC_DEFINE(STDC_HEADERS)
1732 AC_DEFINE(WIN32_LEAN_AND_MEAN)
1733 TARGET_MD_ARCH=win32
1734 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
1736 MOZ_USER_DIR="Mozilla"
1738 dnl Hardcode to win95 for now - cls
1739 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
1741 dnl set NO_X11 defines here as the general check is skipped on win32
1747 if test -z "$MOZ_TOOLS"; then
1748 AC_MSG_ERROR([MOZ_TOOLS is not set])
1750 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
1751 if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
1752 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
1754 MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
1755 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
1756 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
1763 AC_MSG_ERROR([Using a Cygwin build environment is unsupported. Configure cannot check for presence of necessary headers. Please upgrade to MozillaBuild; see https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
1769 if test "$HAVE_64BIT_BUILD"; then
1770 AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
1773 if test -n "$GNU_CC"; then
1774 CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
1775 CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
1776 LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
1778 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
1779 # Disable this flag on clang-cl since it doesn't ignore unknown arguments by default, and
1780 # autoconf insists on passing $LDFLAGS to the compiler.
1781 if test -z "$CLANG_CL"; then
1782 LDFLAGS="$LDFLAGS -SAFESEH"
1789 if test -n "$_WIN32_MSVC"; then
1790 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
1795 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
1802 CFLAGS="$CFLAGS -Dunix"
1803 CXXFLAGS="$CXXFLAGS -Dunix"
1804 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
1806 DSO_PIC_CFLAGS='-fPIC -DPIC'
1807 DSO_LDOPTS='-shared'
1808 BIN_FLAGS='-Wl,--export-dynamic'
1810 DSO_PIC_CFLAGS='-fPIC -DPIC'
1811 DLL_SUFFIX=".so.1.0"
1812 DSO_LDOPTS='-shared'
1814 # This will fail on a.out systems prior to 1.5.1_ALPHA.
1815 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
1816 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
1817 if test "$LIBRUNPATH"; then
1818 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
1820 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
1821 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
1825 DLL_SUFFIX=".so.1.0"
1827 DSO_PIC_CFLAGS='-fPIC'
1828 DSO_LDOPTS='-shared -fPIC'
1829 if test "$LIBRUNPATH"; then
1830 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
1836 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
1837 if test -z "$CROSS_COMPILE" && pkginfo -q SUNWpr && pkginfo -q SUNWprd; then
1838 NO_NSPR_CONFIG_SYSTEM_LDFLAGS="-L/usr/lib/mps -R/usr/lib/mps -lnspr4"
1839 NO_NSPR_CONFIG_SYSTEM_CFLAGS="-I/usr/include/mps"
1840 NO_NSPR_CONFIG_SYSTEM_VERSION=["`pkgparam SUNWpr SUNW_PRODVERS | sed -e 's/^[1-9][0-9]*\.[0-9][0-9]*$/&.0/'`"]
1843 # $ORIGIN/.. is for shared libraries under components/ to locate shared
1844 # libraries one level up (e.g. libnspr4.so)
1845 if test "$SOLARIS_SUNPRO_CC"; then
1846 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
1847 LIBS="-lCrun -lCstd -lc $LIBS"
1848 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1849 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
1850 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
1851 LDFLAGS="-xildoff $LDFLAGS"
1852 if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
1853 _SAVE_LDFLAGS=$LDFLAGS
1854 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
1855 AC_TRY_LINK([#include <stdio.h>],
1856 [printf("Hello World\n");],
1858 [LDFLAGS=$_SAVE_LDFLAGS])
1860 MOZ_OPTIMIZE_FLAGS="-xO4"
1861 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
1862 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
1863 MKSHLIB_FORCE_ALL='-z allextract'
1864 MKSHLIB_UNFORCE_ALL='-z defaultextract'
1871 AS='/usr/ccs/bin/as'
1872 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
1874 TARGET_COMPILER_ABI="sunc"
1875 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
1876 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
1877 AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
1881 [#if (__SUNPRO_CC < 0x590)
1884 _BAD_COMPILER=,_BAD_COMPILER=1)
1885 if test -n "$_BAD_COMPILER"; then
1887 AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
1892 [#if (__SUNPRO_CC >= 0x5100)
1893 #error "Sun C++ 5.10 or above"
1895 _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
1896 if test "$_ABOVE_SS12U1"; then
1898 CXXFLAGS="$CXXFLAGS -xannotate=no"
1900 AC_MSG_RESULT([$_res])
1903 LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
1905 MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
1906 MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
1907 ASFLAGS="$ASFLAGS -fPIC"
1908 DSO_LDOPTS='-shared'
1909 WARNINGS_AS_ERRORS='-Werror'
1911 _WARNINGS_CXXFLAGS=''
1912 if test "$OS_RELEASE" = "5.3"; then
1913 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
1916 if test "$OS_RELEASE" = "5.5.1"; then
1917 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
1922 DSO_LDOPTS='-Bdynamic'
1923 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
1924 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
1926 AC_DEFINE(SPRINTF_RETURNS_STRING)
1927 case "$(target_os)" in
1929 DLL_SUFFIX='.so.1.0'
1936 dnl Only one oddball right now (QNX), but this gives us flexibility
1937 dnl if any other platforms need to override this in the future.
1938 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
1940 dnl ========================================================
1941 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
1942 dnl by now will not have any way to link most binaries (tests
1943 dnl as well as viewer, apprunner, etc.), because some symbols
1944 dnl will be left out of the "composite" .so's by ld as unneeded.
1945 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
1946 dnl they can link in the static libs that provide the missing
1948 dnl ========================================================
1949 NO_LD_ARCHIVE_FLAGS=
1950 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
1951 NO_LD_ARCHIVE_FLAGS=1
1955 NO_LD_ARCHIVE_FLAGS=
1958 if test -z "$GNU_CC"; then
1959 NO_LD_ARCHIVE_FLAGS=
1963 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
1965 dnl ========================================================
1966 dnl = Flags to strip unused symbols from .so components
1967 dnl ========================================================
1969 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1970 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
1973 if test -z "$GNU_CC"; then
1974 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
1976 if test -z "$GCC_USE_GNU_LD"; then
1977 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
1979 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
1984 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
1987 if test -n "$GNU_CC"; then
1988 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
1993 if test -z "$COMPILE_ENVIRONMENT"; then
1994 SKIP_COMPILER_CHECKS=1
1995 SKIP_LIBRARY_CHECKS=1
1998 dnl Configure JIT support
2003 AC_DEFINE(JS_CPU_X86)
2007 AC_DEFINE(JS_CPU_X64)
2011 AC_DEFINE(JS_CPU_ARM)
2015 AC_DEFINE(JS_CPU_SPARC)
2019 AC_DEFINE(JS_CPU_MIPS)
2025 AC_DEFINE(JS_NUNBOX32)
2028 if test "$HAVE_64BIT_BUILD" ; then
2029 AC_DEFINE(JS_PUNBOX64)
2031 AC_DEFINE(JS_NUNBOX32)
2036 MOZ_ARG_DISABLE_BOOL(ion,
2037 [ --disable-ion Disable use of the IonMonkey JIT],
2040 AC_SUBST(ENABLE_METHODJIT_SPEW)
2042 AC_SUBST(ENABLE_ION)
2044 if test -n "$COMPILE_ENVIRONMENT"; then
2048 if test -z "$SKIP_COMPILER_CHECKS"; then
2049 dnl Checks for typedefs, structures, and compiler characteristics.
2050 dnl ========================================================
2059 AC_MSG_CHECKING(for ssize_t)
2060 AC_CACHE_VAL(ac_cv_type_ssize_t,
2061 [AC_TRY_COMPILE([#include <stdio.h>
2062 #include <sys/types.h>],
2064 [ac_cv_type_ssize_t=true],
2065 [ac_cv_type_ssize_t=false])])
2066 if test "$ac_cv_type_ssize_t" = true ; then
2067 AC_DEFINE(HAVE_SSIZE_T)
2073 MOZ_CHECK_HEADERS(endian.h)
2074 if test "$ac_cv_header_endian_h" = yes; then
2075 AC_DEFINE(JS_HAVE_ENDIAN_H)
2078 MOZ_CHECK_HEADERS([machine/endian.h],[],[],[#include <sys/types.h>])
2079 if test "$ac_cv_header_machine_endian_h" = yes; then
2080 AC_DEFINE(JS_HAVE_MACHINE_ENDIAN_H)
2083 MOZ_CHECK_HEADERS(sys/isa_defs.h)
2084 if test "$ac_cv_header_sys_isa_defs_h" = yes; then
2085 AC_DEFINE(JS_HAVE_SYS_ISA_DEFS_H)
2092 dnl Check for .hidden assembler directive and visibility attribute.
2093 dnl Borrowed from glibc configure.in
2094 dnl ===============================================================
2095 if test "$GNU_CC" -a "$OS_TARGET" != WINNT; then
2096 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2097 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2098 case "$OS_TARGET" in
2100 VISIBILITY_FLAGS='-fvisibility=hidden'
2103 case $GCC_VERSION in
2105 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden_dso_handle.h'
2108 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
2111 WRAP_SYSTEM_INCLUDES=1
2116 # visibility hidden flag for Sun Studio on Solaris
2117 if test "$SOLARIS_SUNPRO_CC"; then
2118 VISIBILITY_FLAGS='-xldscope=hidden'
2119 fi # Sun Studio on Solaris
2121 case "${OS_TARGET}" in
2122 WINNT|Darwin|Android)
2125 STL_FLAGS='-I$(DIST)/stl_wrappers'
2130 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2131 AC_SUBST(VISIBILITY_FLAGS)
2135 if test "$OS_TARGET" != WINNT; then
2136 # Only run this test with clang on non-Windows platforms, because clang
2137 # cannot do enough code gen for now to make this test work correctly.
2141 dnl Checks for header files.
2142 dnl ========================================================
2144 case "$target_os" in
2146 # for stuff like -lXshm
2147 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2150 MOZ_CHECK_COMMON_HEADERS
2152 dnl These are all the places some variant of statfs can be hiding.
2153 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2156 MOZ_CHECK_HEADERS(sys/quota.h)
2157 MOZ_CHECK_HEADERS(linux/quota.h)
2159 MOZ_ARG_ENABLE_BOOL(dtrace,
2160 [ --enable-dtrace build with dtrace support if available (default=no)],
2161 [enable_dtrace="yes"],)
2162 if test "x$enable_dtrace" = "xyes"; then
2163 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
2164 if test -n "$HAVE_DTRACE"; then
2165 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
2167 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
2170 AC_SUBST(HAVE_DTRACE)
2176 MOZ_CHECK_HEADERS(sys/cdefs.h)
2180 MOZ_LINUX_PERF_EVENT
2182 dnl Checks for libraries.
2183 dnl ========================================================
2188 AC_CHECK_LIB(c_r, gethostbyname_r)
2192 dnl We don't want to link with libdl even if it's present on OS X, since
2193 dnl it's not used and not part of the default installation. OS/2 has dlfcn
2195 dnl We don't want to link against libm or libpthread on Darwin since
2196 dnl they both are just symlinks to libSystem and explicitly linking
2197 dnl against libSystem causes issues when debugging (see bug 299601).
2202 AC_SEARCH_LIBS(dlopen, dl,
2203 MOZ_CHECK_HEADER(dlfcn.h,
2204 AC_DEFINE(HAVE_DLOPEN)))
2208 if test ! "$GNU_CXX"; then
2212 AC_CHECK_LIB(C_r, demangle)
2215 AC_CHECK_LIB(C, demangle)
2220 AC_CHECK_LIB(socket, socket)
2222 dnl ========================================================
2223 dnl = pthread support
2224 dnl = Start by checking whether the system support pthreads
2225 dnl ========================================================
2226 case "$target_os" in
2231 AC_CHECK_LIB(pthreads, pthread_create,
2232 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
2233 AC_CHECK_LIB(pthread, pthread_create,
2234 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
2235 AC_CHECK_LIB(c_r, pthread_create,
2236 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
2237 AC_CHECK_LIB(c, pthread_create,
2246 dnl ========================================================
2247 dnl Check the command line for --with-pthreads
2248 dnl ========================================================
2249 MOZ_ARG_WITH_BOOL(pthreads,
2250 [ --with-pthreads Force use of system pthread library with NSPR ],
2251 [ if test "$USE_PTHREADS"x = x; then
2252 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
2258 dnl ========================================================
2259 dnl Do the platform specific pthread hackery
2260 dnl ========================================================
2261 if test "$USE_PTHREADS"x != x
2264 dnl See if -pthread is supported.
2267 ac_cv_have_dash_pthread=no
2268 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
2269 echo 'int main() { return 0; }' | cat > conftest.c
2270 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
2271 if test $? -eq 0; then
2272 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2273 ac_cv_have_dash_pthread=yes
2274 case "$target_os" in
2276 # Freebsd doesn't use -pthread for compiles, it uses them for linking
2279 CFLAGS="$CFLAGS -pthread"
2280 CXXFLAGS="$CXXFLAGS -pthread"
2286 AC_MSG_RESULT($ac_cv_have_dash_pthread)
2289 dnl See if -pthreads is supported.
2291 ac_cv_have_dash_pthreads=no
2292 if test "$ac_cv_have_dash_pthread" = "no"; then
2293 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
2294 echo 'int main() { return 0; }' | cat > conftest.c
2295 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
2296 if test $? -eq 0; then
2297 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2298 ac_cv_have_dash_pthreads=yes
2299 CFLAGS="$CFLAGS -pthreads"
2300 CXXFLAGS="$CXXFLAGS -pthreads"
2304 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
2309 AC_DEFINE(_REENTRANT)
2310 AC_DEFINE(_THREAD_SAFE)
2311 dnl -pthread links in -lpthread, so don't specify it explicitly.
2312 if test "$ac_cv_have_dash_pthread" = "yes"; then
2313 _PTHREAD_LDFLAGS="-pthread"
2317 *-*-openbsd*|*-*-bsdi*)
2318 AC_DEFINE(_REENTRANT)
2319 AC_DEFINE(_THREAD_SAFE)
2320 dnl -pthread links in -lc_r, so don't specify it explicitly.
2321 if test "$ac_cv_have_dash_pthread" = "yes"; then
2322 _PTHREAD_LDFLAGS="-pthread"
2326 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
2327 AC_DEFINE(_REENTRANT)
2331 AC_DEFINE(_REENTRANT)
2335 AC_DEFINE(_REENTRANT)
2339 AC_DEFINE(_REENTRANT)
2340 if test "$SOLARIS_SUNPRO_CC"; then
2341 CFLAGS="$CFLAGS -mt"
2342 CXXFLAGS="$CXXFLAGS -mt"
2346 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
2350 dnl Checks for library functions.
2351 dnl ========================================================
2352 AC_PROG_GCC_TRADITIONAL
2354 AC_CHECK_FUNCS([getc_unlocked _getc_nolock localtime_r])
2357 dnl Checks for math functions.
2358 dnl ========================================================
2359 AC_CHECK_LIB(m, sin)
2360 AC_CHECK_FUNCS([log2 log1p expm1 sqrt1pm1 acosh asinh atanh trunc cbrt])
2363 dnl check for wcrtomb/mbrtowc
2364 dnl =======================================================================
2365 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
2368 AC_CACHE_CHECK(for wcrtomb,
2370 [AC_TRY_LINK([#include <wchar.h>],
2371 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
2372 ac_cv_have_wcrtomb="yes",
2373 ac_cv_have_wcrtomb="no")])
2374 if test "$ac_cv_have_wcrtomb" = "yes"; then
2375 AC_DEFINE(HAVE_WCRTOMB)
2377 AC_CACHE_CHECK(for mbrtowc,
2379 [AC_TRY_LINK([#include <wchar.h>],
2380 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
2381 ac_cv_have_mbrtowc="yes",
2382 ac_cv_have_mbrtowc="no")])
2383 if test "$ac_cv_have_mbrtowc" = "yes"; then
2384 AC_DEFINE(HAVE_MBRTOWC)
2391 ac_cv_func_res_ninit,
2392 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
2393 dnl no need for res_ninit() on NetBSD and OpenBSD
2394 ac_cv_func_res_ninit=no
2398 #define _BSD_SOURCE 1
2400 #include <sys/types.h>
2401 #include <netinet/in.h>
2402 #include <arpa/nameser.h>
2405 [int foo = res_ninit(&_res);],
2406 [ac_cv_func_res_ninit=yes],
2407 [ac_cv_func_res_ninit=no])
2411 if test "$ac_cv_func_res_ninit" = "yes"; then
2412 AC_DEFINE(HAVE_RES_NINIT)
2413 dnl must add the link line we do something as foolish as this... dougt
2415 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
2416 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
2423 dnl **********************
2424 dnl *** va_copy checks ***
2425 dnl **********************
2426 AC_CACHE_CHECK([for an implementation of va_copy()],
2428 [AC_TRY_COMPILE([#include <stdarg.h>
2430 void f (int i, ...) {
2431 va_list args1, args2;
2432 va_start (args1, i);
2433 va_copy (args2, args1);
2434 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
2436 va_end (args1); va_end (args2);
2438 [f(0, 42); return 0],
2439 [ac_cv_va_copy=yes],
2443 AC_CACHE_CHECK([whether va_list can be copied by value],
2445 [AC_TRY_COMPILE([#include <stdarg.h>
2447 void f (int i, ...) {
2448 va_list args1, args2;
2449 va_start (args1, i);
2451 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
2453 va_end (args1); va_end (args2);
2455 [f(0, 42); return 0],
2456 [ac_cv_va_val_copy=yes],
2457 [ac_cv_va_val_copy=no],
2460 if test "x$ac_cv_va_copy" = "xyes"; then
2461 AC_DEFINE(VA_COPY, va_copy)
2462 AC_DEFINE(HAVE_VA_COPY)
2465 if test "x$ac_cv_va_val_copy" = "xno"; then
2466 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
2469 dnl ===================================================================
2470 dnl ========================================================
2471 dnl Put your C++ language/feature checks below
2472 dnl ========================================================
2476 if test "$GNU_CC"; then
2477 if test "$CPU_ARCH" = "arm" ; then
2478 AC_CACHE_CHECK(for ARM EABI,
2482 #if defined(__ARM_EABI__)
2485 #error Not ARM EABI.
2488 ac_cv_gcc_arm_eabi="yes",
2489 ac_cv_gcc_arm_eabi="no")])
2490 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
2492 ARM_ABI_PREFIX=eabi-
2494 ARM_ABI_PREFIX=oabi-
2498 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
2501 dnl Check to see if we can resolve ambiguity with |using|.
2502 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
2503 ac_cv_cpp_ambiguity_resolving_using,
2504 [AC_TRY_COMPILE(class X {
2505 public: int go(const X&) {return 3;}
2506 int jo(const X&) {return 3;}
2508 class Y : public X {
2509 public: int go(int) {return 2;}
2510 int jo(int) {return 2;}
2512 private: using X::go;
2515 ac_cv_cpp_ambiguity_resolving_using=yes,
2516 ac_cv_cpp_ambiguity_resolving_using=no)])
2517 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
2518 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
2521 dnl See if a dynamic_cast to void* gives the most derived object.
2522 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
2523 ac_cv_cpp_dynamic_cast_void_ptr,
2524 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
2525 class Y { int j; public: virtual ~Y() { } };
2526 class Z : public X, public Y { int k; };
2532 return !((((void*)&mdo != (void*)subx) &&
2533 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
2534 (((void*)&mdo != (void*)suby) &&
2535 ((void*)&mdo == dynamic_cast<void*>(suby))));
2537 ac_cv_cpp_dynamic_cast_void_ptr=yes,
2538 ac_cv_cpp_dynamic_cast_void_ptr=no,
2539 ac_cv_cpp_dynamic_cast_void_ptr=no)])
2540 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
2541 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
2545 dnl note that this one is reversed - if the test fails, then
2546 dnl we require implementations of unused virtual methods. Which
2547 dnl really blows because it means we'll have useless vtable
2549 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
2550 ac_cv_cpp_unused_required,
2551 [AC_TRY_LINK(class X {private: virtual void never_called();};,
2553 ac_cv_cpp_unused_required=no,
2554 ac_cv_cpp_unused_required=yes)])
2555 if test "$ac_cv_cpp_unused_required" = yes ; then
2556 AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
2560 dnl Some compilers have trouble comparing a constant reference to a templatized
2561 dnl class to zero, and require an explicit operator==() to be defined that takes
2562 dnl an int. This test separates the strong from the weak.
2564 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
2565 ac_cv_trouble_comparing_to_zero,
2566 [AC_TRY_COMPILE([#include <algorithm>
2567 template <class T> class Foo {};
2569 template <class T> int operator==(const T2*, const T&) { return 0; }
2570 template <class T> int operator!=(const T2*, const T&) { return 0; }],
2571 [Foo<int> f; return (0 != f);],
2572 ac_cv_trouble_comparing_to_zero=no,
2573 ac_cv_trouble_comparing_to_zero=yes)])
2574 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
2575 AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
2578 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
2579 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
2580 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
2582 _SAVE_LDFLAGS=$LDFLAGS
2583 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
2584 AC_CACHE_CHECK(for __thread keyword for TLS variables,
2585 ac_cv_thread_keyword,
2586 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
2587 [return tlsIsMainThread;],
2588 ac_cv_thread_keyword=yes,
2589 ac_cv_thread_keyword=no)])
2590 LDFLAGS=$_SAVE_LDFLAGS
2591 if test "$ac_cv_thread_keyword" = yes; then
2592 # mips builds fail with TLS variables because of a binutils bug.
2598 *-android*|*-linuxandroid*)
2602 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
2607 dnl See if compiler supports some gcc-style attributes
2609 AC_CACHE_CHECK(for __attribute__((always_inline)),
2610 ac_cv_attribute_always_inline,
2611 [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
2613 ac_cv_attribute_always_inline=yes,
2614 ac_cv_attribute_always_inline=no)])
2616 AC_CACHE_CHECK(for __attribute__((malloc)),
2617 ac_cv_attribute_malloc,
2618 [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
2620 ac_cv_attribute_malloc=yes,
2621 ac_cv_attribute_malloc=no)])
2623 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
2624 ac_cv_attribute_warn_unused,
2625 [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
2627 ac_cv_attribute_warn_unused=yes,
2628 ac_cv_attribute_warn_unused=no)])
2630 dnl End of C++ language/feature checks
2633 dnl ========================================================
2634 dnl = Internationalization checks
2635 dnl ========================================================
2637 dnl Internationalization and Locale support is different
2638 dnl on various UNIX platforms. Checks for specific i18n
2639 dnl features go here.
2641 dnl check for LC_MESSAGES
2642 AC_CACHE_CHECK(for LC_MESSAGES,
2643 ac_cv_i18n_lc_messages,
2644 [AC_TRY_COMPILE([#include <locale.h>],
2645 [int category = LC_MESSAGES;],
2646 ac_cv_i18n_lc_messages=yes,
2647 ac_cv_i18n_lc_messages=no)])
2648 if test "$ac_cv_i18n_lc_messages" = yes; then
2649 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
2652 AC_HAVE_FUNCS(localeconv)
2653 fi # ! SKIP_COMPILER_CHECKS
2656 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
2657 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
2660 dnl Mozilla specific options
2661 dnl ========================================================
2662 dnl The macros used for command line options
2663 dnl are defined in build/autoconf/altoptions.m4.
2665 dnl If the compiler supports these attributes, define them as
2666 dnl convenience macros.
2667 if test "$ac_cv_attribute_malloc" = yes ; then
2668 AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
2670 AC_DEFINE(NS_ATTR_MALLOC,)
2673 if test "$ac_cv_attribute_warn_unused" = yes ; then
2674 AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
2676 AC_DEFINE(NS_WARN_UNUSED_RESULT,)
2679 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
2680 dnl features that Windows actually does support.
2682 if test -n "$SKIP_COMPILER_CHECKS"; then
2683 dnl Windows has malloc.h
2684 AC_DEFINE(MALLOC_H, [<malloc.h>])
2685 AC_DEFINE(HAVE_FORCEINLINE)
2686 AC_DEFINE(HAVE_LOCALECONV)
2687 fi # SKIP_COMPILER_CHECKS
2689 dnl ========================================================
2690 dnl = Mozilla update channel, used for disabling features
2691 dnl = not wanted for release.
2692 dnl ========================================================
2694 # app update channel is 'default' when not supplied.
2695 MOZ_ARG_ENABLE_STRING([update-channel],
2696 [ --enable-update-channel=CHANNEL
2697 Select application update channel (default=default)],
2698 MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
2700 if test -z "$MOZ_UPDATE_CHANNEL"; then
2701 MOZ_UPDATE_CHANNEL=default
2703 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
2704 AC_SUBST(MOZ_UPDATE_CHANNEL)
2707 dnl set GRE_MILESTONE
2708 dnl ========================================================
2709 GRE_MILESTONE=`tail -n 1 "$_topsrcdir"/config/milestone.txt 2>/dev/null || tail -1 "$_topsrcdir"/config/milestone.txt`
2710 AC_SUBST(GRE_MILESTONE)
2712 dnl set RELEASE_BUILD and NIGHTLY_BUILD variables depending on the cycle we're in
2713 dnl The logic works like this:
2714 dnl - if we have "a1" in GRE_MILESTONE, we're building Nightly (define NIGHTLY_BUILD)
2715 dnl - otherwise, if we have "a" in GRE_MILESTONE, we're building Nightly or Aurora
2716 dnl - otherwise, we're building Release/Beta (define RELEASE_BUILD)
2717 case "$GRE_MILESTONE" in
2720 AC_DEFINE(NIGHTLY_BUILD)
2726 AC_DEFINE(RELEASE_BUILD)
2729 AC_SUBST(NIGHTLY_BUILD)
2730 AC_SUBST(RELEASE_BUILD)
2732 dnl ========================================================
2733 dnl Disable compiling sources in unified mode.
2734 dnl ========================================================
2736 if test -z "$NIGHTLY_BUILD"; then
2737 MOZ_DISABLE_UNIFIED_COMPILATION=1
2740 MOZ_ARG_DISABLE_BOOL(unified-compilation,
2741 [ --disable-unified-compilation
2742 Disable unified compilation of some C/C++ sources],
2743 MOZ_DISABLE_UNIFIED_COMPILATION=1,
2744 MOZ_DISABLE_UNIFIED_COMPILATION=)
2745 AC_SUBST(MOZ_DISABLE_UNIFIED_COMPILATION)
2747 dnl ========================================================
2749 dnl = Check for external package dependencies
2751 dnl ========================================================
2752 MOZ_ARG_HEADER(External Packages)
2756 dnl ========================================================
2757 dnl system zlib Support
2758 dnl ========================================================
2759 dnl Standalone js defaults to system zlib
2760 if test -n "$JS_STANDALONE"; then
2764 MOZ_ZLIB_CHECK([1.2.3])
2766 if test -n "$ZLIB_IN_MOZGLUE"; then
2767 AC_DEFINE(ZLIB_IN_MOZGLUE)
2769 AC_SUBST(ZLIB_IN_MOZGLUE)
2771 dnl ========================================================
2772 dnl system libffi Support
2773 dnl ========================================================
2776 dnl ========================================================
2780 dnl ========================================================
2782 MOZ_ARG_HEADER(Application)
2789 arm*-android*|arm*-linuxandroid*)
2794 dnl ========================================================
2795 dnl Use ARM userspace kernel helpers; tell NSPR to enable
2796 dnl their usage and use them in spidermonkey.
2797 dnl ========================================================
2798 MOZ_ARG_WITH_BOOL(arm-kuser,
2799 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
2801 if test -n "$USE_ARM_KUSER"; then
2802 AC_DEFINE(USE_ARM_KUSER)
2805 dnl ========================================================
2807 dnl = Components & Features
2809 dnl ========================================================
2810 MOZ_ARG_HEADER(Components and Features)
2812 dnl ========================================================
2814 dnl ========================================================
2815 MOZ_ARG_ENABLE_STRING(ui-locale,
2816 [ --enable-ui-locale=ab-CD
2817 Select the user interface locale (default: en-US)],
2818 MOZ_UI_LOCALE=$enableval )
2819 AC_SUBST(MOZ_UI_LOCALE)
2821 dnl ========================================================
2822 dnl build the tests by default
2823 dnl ========================================================
2824 MOZ_ARG_DISABLE_BOOL(tests,
2825 [ --disable-tests Do not build test libraries & programs],
2829 dnl ========================================================
2831 dnl = Module specific options
2833 dnl ========================================================
2834 MOZ_ARG_HEADER(Individual module options)
2836 dnl ========================================================
2838 dnl = Debugging Options
2840 dnl ========================================================
2841 MOZ_ARG_HEADER(Debugging and Optimizations)
2843 if test "$ENABLE_METHODJIT_SPEW"; then
2844 AC_DEFINE(JS_METHODJIT_SPEW)
2847 dnl ========================================================
2848 dnl = Enable code optimization. ON by default.
2849 dnl ========================================================
2850 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
2851 MOZ_OPTIMIZE_FLAGS="-O"
2854 MOZ_ARG_ENABLE_STRING(optimize,
2855 [ --disable-optimize Disable compiler optimization
2856 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
2857 [ if test "$enableval" != "no"; then
2859 if test -n "$enableval" -a "$enableval" != "yes"; then
2860 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
2865 fi ], MOZ_OPTIMIZE=1)
2867 MOZ_SET_FRAMEPTR_FLAGS
2869 if test "$COMPILE_ENVIRONMENT"; then
2870 if test -n "$MOZ_OPTIMIZE"; then
2871 AC_MSG_CHECKING([for valid optimization flags])
2872 _SAVE_CFLAGS=$CFLAGS
2873 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
2874 AC_TRY_COMPILE([#include <stdio.h>],
2875 [printf("Hello World\n");],
2878 AC_MSG_RESULT([$_results])
2879 if test "$_results" = "no"; then
2880 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
2882 CFLAGS=$_SAVE_CFLAGS
2884 fi # COMPILE_ENVIRONMENT
2886 AC_SUBST(MOZ_OPTIMIZE)
2887 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
2888 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
2889 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
2890 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
2891 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
2893 dnl ========================================================
2894 dnl = Enable trace logging
2895 dnl ========================================================
2896 MOZ_ARG_ENABLE_BOOL(trace-logging,
2897 [ --enable-trace-logging Enable trace logging],
2898 ENABLE_TRACE_LOGGING=1,
2899 ENABLE_TRACE_LOGGING= )
2901 AC_SUBST(ENABLE_TRACE_LOGGING)
2903 if test "$ENABLE_TRACE_LOGGING"; then
2904 AC_DEFINE(JS_TRACE_LOGGING)
2907 dnl ========================================================
2908 dnl = Enable any treating of compile warnings as errors
2909 dnl ========================================================
2910 MOZ_ARG_DISABLE_BOOL(warnings-as-errors,
2911 [ --enable-warnings-as-errors
2912 Enable treating of warnings as errors],
2913 MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
2914 MOZ_ENABLE_WARNINGS_AS_ERRORS=)
2915 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
2916 WARNINGS_AS_ERRORS=''
2917 elif test "$GNU_CC"; then
2918 # Prevent the following GCC warnings from being treated as errors:
2919 # -Wuninitialized - too many false positives
2920 # -Wmaybe-uninitialized - too many false positives
2921 # -Wdeprecated-declarations - we don't want our builds held hostage when a
2922 # platform-specific API becomes deprecated.
2923 MOZ_C_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_c_has_noerror_uninitialized)
2924 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_cxx_has_noerror_uninitialized)
2925 MOZ_C_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_c_has_noerror_maybe_uninitialized)
2926 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_cxx_has_noerror_maybe_uninitialized)
2927 MOZ_C_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_c_has_noerror_deprecated_declarations)
2928 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_cxx_has_noerror_deprecated_declarations)
2930 if test -n "$MOZ_PGO"; then
2931 MOZ_C_SUPPORTS_WARNING(-W, no-error=coverage-mismatch, ac_c_has_noerror_coverage_mismatch)
2932 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=coverage-mismatch, ac_cxx_has_noerror_coverage_mismatch)
2936 dnl ========================================================
2937 dnl = Enable treating compile warnings as errors
2938 dnl ========================================================
2939 MOZ_ARG_ENABLE_BOOL(sm-fail-on-warnings,
2940 [ --enable-sm-fail-on-warnings
2941 Enable warnings as errors],
2945 AC_SUBST(FAIL_ON_WARNINGS)
2947 dnl ========================================================
2948 dnl = Enable trace malloc
2949 dnl ========================================================
2950 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
2951 MOZ_ARG_ENABLE_BOOL(trace-malloc,
2952 [ --enable-trace-malloc Enable malloc tracing],
2955 if test "$NS_TRACE_MALLOC"; then
2956 # Please, Mr. Linker Man, don't take away our symbol names
2957 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
2958 AC_DEFINE(NS_TRACE_MALLOC)
2960 AC_SUBST(NS_TRACE_MALLOC)
2962 dnl ========================================================
2964 dnl ========================================================
2966 MOZ_ARG_ENABLE_BOOL(dmd,
2967 [ --enable-dmd Enable DMD; also enables jemalloc and replace-malloc],
2971 if test "$NS_TRACE_MALLOC"; then # trace-malloc disables DMD
2974 if test "$MOZ_DMD"; then
2977 if test "${CPU_ARCH}" = "arm"; then
2978 CFLAGS="$CFLAGS -funwind-tables"
2979 CXXFLAGS="$CXXFLAGS -funwind-tables"
2983 dnl ========================================================
2984 dnl = Enable jemalloc
2985 dnl ========================================================
2986 MOZ_ARG_ENABLE_BOOL(jemalloc,
2987 [ --enable-jemalloc Replace memory allocator with jemalloc],
2991 if test "$NS_TRACE_MALLOC"; then
2995 if test "$MOZ_MEMORY"; then
2996 AC_DEFINE(MOZ_MEMORY)
2997 if test "x$MOZ_DEBUG" = "x1"; then
2998 AC_DEFINE(MOZ_MEMORY_DEBUG)
3000 dnl The generic feature tests that determine how to compute ncpus are long and
3001 dnl complicated. Therefore, simply define special cpp variables for the
3002 dnl platforms we have special knowledge of.
3005 AC_DEFINE(MOZ_MEMORY_DARWIN)
3008 AC_DEFINE(MOZ_MEMORY_BSD)
3010 *-android*|*-linuxandroid*)
3011 AC_DEFINE(MOZ_MEMORY_LINUX)
3012 AC_DEFINE(MOZ_MEMORY_ANDROID)
3015 AC_DEFINE(MOZ_MEMORY_LINUX)
3018 AC_DEFINE(MOZ_MEMORY_BSD)
3021 AC_DEFINE(MOZ_MEMORY_SOLARIS)
3024 AC_DEFINE(MOZ_MEMORY_WINDOWS)
3025 # the interesting bits will get passed down in MOZ_GLUE_LDFLAGS
3028 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
3032 AC_SUBST(MOZ_MEMORY)
3033 AC_SUBST(MOZ_GLUE_LDFLAGS)
3034 AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
3036 dnl ========================================================
3037 dnl = Use malloc wrapper lib
3038 dnl ========================================================
3039 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
3040 [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)],
3044 if test -n "$_WRAP_MALLOC"; then
3045 if test "$GNU_CC"; then
3046 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
3047 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
3048 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
3049 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
3050 dnl Wrap operator new and operator delete on Android.
3051 if test "$OS_TARGET" = "Android"; then
3052 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_Znwj,--wrap=_Znaj,--wrap=_ZdlPv,--wrap=_ZdaPv"
3055 AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
3059 dnl ========================================================
3060 dnl = Location of malloc wrapper lib
3061 dnl ========================================================
3062 MOZ_ARG_WITH_STRING(wrap-malloc,
3063 [ --with-wrap-malloc=DIR Location of malloc wrapper library],
3064 WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
3066 dnl ========================================================
3067 dnl = Use JS Call tracing
3068 dnl ========================================================
3069 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
3070 [ --enable-trace-jscalls Enable JS call enter/exit callback (default=no)],
3071 MOZ_TRACE_JSCALLS=1,
3072 MOZ_TRACE_JSCALLS= )
3073 if test -n "$MOZ_TRACE_JSCALLS"; then
3074 AC_DEFINE(MOZ_TRACE_JSCALLS)
3077 dnl ========================================================
3078 dnl = Use incremental GC
3079 dnl ========================================================
3081 MOZ_ARG_DISABLE_BOOL(gcincremental,
3082 [ --disable-gcincremental Disable incremental GC],
3084 if test -n "$JSGC_INCREMENTAL"; then
3085 AC_DEFINE(JSGC_INCREMENTAL)
3088 dnl ========================================================
3089 dnl = Use generational GC
3090 dnl ========================================================
3091 dnl Use generational GC by default in all shell builds. The top-level mozilla
3092 dnl configure.in will configure SpiderMonkey with --disable-gcgenerational as
3093 dnl needed on a per-platform basis.
3095 MOZ_ARG_DISABLE_BOOL(gcgenerational,
3096 [ --disable-gcgenerational Disable generational GC],
3097 JSGC_GENERATIONAL= ,
3098 JSGC_GENERATIONAL=1 )
3099 if test -n "$JSGC_GENERATIONAL"; then
3100 AC_DEFINE(JSGC_GENERATIONAL)
3102 JSGC_GENERATIONAL_CONFIGURED=$JSGC_GENERATIONAL
3103 AC_SUBST(JSGC_GENERATIONAL_CONFIGURED)
3105 dnl ========================================================
3106 dnl = Use exact stack rooting for GC
3107 dnl ========================================================
3108 dnl Use exact rooting by default in all shell builds. The top-level mozilla
3109 dnl configure.in will configure SpiderMonkey with --disable-exact-rooting as
3110 dnl needed on a per-platform basis.
3111 JSGC_USE_EXACT_ROOTING=1
3112 MOZ_ARG_DISABLE_BOOL(exact-rooting,
3113 [ --disable-exact-rooting Enable use of conservative stack scanning for GC],
3114 JSGC_USE_EXACT_ROOTING= ,
3115 JSGC_USE_EXACT_ROOTING=1 )
3116 if test -n "$JSGC_USE_EXACT_ROOTING"; then
3117 AC_DEFINE(JSGC_USE_EXACT_ROOTING)
3120 dnl ========================================================
3121 dnl = Use compacting GC
3122 dnl ========================================================
3123 dnl Compact the heap by moving GC things when doing a shrinking colletion.
3124 MOZ_ARG_ENABLE_BOOL(gccompacting,
3125 [ --enable-gccompacting Compact the heap by moving GC things],
3128 if test -n "$JSGC_COMPACTING"; then
3129 AC_DEFINE(JSGC_COMPACTING)
3132 dnl ========================================================
3133 dnl = Use a smaller chunk size for GC chunks
3134 dnl ========================================================
3135 dnl Use large (1MB) chunks by default. For B2G this option is used to give
3136 dnl smaller (currently 256K) chunks.
3137 MOZ_ARG_ENABLE_BOOL(small-chunk-size,
3138 [ --enable-small-chunk-size Allocate memory for JS GC things in smaller chunks],
3139 JS_GC_SMALL_CHUNK_SIZE=1,
3140 JS_GC_SMALL_CHUNK_SIZE= )
3141 if test -n "$JS_GC_SMALL_CHUNK_SIZE"; then
3142 AC_DEFINE(JS_GC_SMALL_CHUNK_SIZE)
3145 dnl ========================================================
3146 dnl = Use GC tracing
3147 dnl ========================================================
3148 MOZ_ARG_ENABLE_BOOL(gc-trace,
3149 [ --enable-gc-trace Enable tracing of allocation and finalization],
3152 if test -n "$JS_GC_TRACE"; then
3153 AC_DEFINE(JS_GC_TRACE)
3156 dnl ========================================================
3158 dnl ========================================================
3159 MOZ_ARG_ENABLE_BOOL(valgrind,
3160 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
3163 if test -n "$MOZ_VALGRIND"; then
3164 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
3166 [--enable-valgrind specified but Valgrind is not installed]))
3167 AC_DEFINE(MOZ_VALGRIND)
3170 AC_SUBST(MOZ_VALGRIND)
3172 dnl ========================================================
3173 dnl = Use ARM JIT code simulator. Requires an x86 build.
3174 dnl ========================================================
3175 dnl Also define JS_CODEGEN_ARM in this case. If the simulator is not used,
3176 dnl JS_CODEGEN_foo is defined if JS_CPU_foo is defined.
3177 MOZ_ARG_ENABLE_BOOL(arm-simulator,
3178 [ --enable-arm-simulator Enable ARM simulator for JIT code],
3181 MOZ_ARG_ENABLE_BOOL(mips-simulator,
3182 [ --enable-mips-simulator Enable MIPS simulator for JIT code],
3183 JS_MIPS_SIMULATOR=1,
3184 JS_MIPS_SIMULATOR= )
3186 if test -n "$JS_ARM_SIMULATOR" && test -n "$JS_MIPS_SIMULATOR"; then
3187 AC_MSG_ERROR([Flags --enable-arm-simulator and --enable-mips-simulator cannot be used together.])
3190 if test -z "$ENABLE_ION"; then
3191 AC_DEFINE(JS_CODEGEN_NONE)
3193 elif test -n "$JS_ARM_SIMULATOR"; then
3194 if test "$CPU_ARCH" != "x86"; then
3195 AC_MSG_ERROR([The ARM simulator only works on x86.])
3197 AC_DEFINE(JS_ARM_SIMULATOR)
3198 AC_DEFINE(JS_CODEGEN_ARM)
3200 elif test -n "$JS_MIPS_SIMULATOR"; then
3201 if test "$CPU_ARCH" != "x86"; then
3202 AC_MSG_ERROR([The MIPS simulator only works on x86.])
3204 AC_DEFINE(JS_MIPS_SIMULATOR)
3205 AC_DEFINE(JS_CODEGEN_MIPS)
3207 elif test "$CPU_ARCH" = "x86"; then
3208 AC_DEFINE(JS_CODEGEN_X86)
3210 elif test "$CPU_ARCH" = "x86_64"; then
3211 AC_DEFINE(JS_CODEGEN_X64)
3213 elif test "$CPU_ARCH" = "arm"; then
3214 AC_DEFINE(JS_CODEGEN_ARM)
3216 elif test "$CPU_ARCH" = "mips"; then
3217 AC_DEFINE(JS_CODEGEN_MIPS)
3221 AC_SUBST(JS_ARM_SIMULATOR)
3222 AC_SUBST(JS_MIPS_SIMULATOR)
3223 AC_SUBST(JS_CODEGEN_ARM)
3224 AC_SUBST(JS_CODEGEN_MIPS)
3225 AC_SUBST(JS_CODEGEN_X86)
3226 AC_SUBST(JS_CODEGEN_X64)
3227 AC_SUBST(JS_CODEGEN_NONE)
3229 dnl ========================================================
3231 dnl ========================================================
3232 MOZ_ARG_ENABLE_BOOL(jprof,
3233 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
3236 if test -n "$MOZ_JPROF"; then
3238 AC_DEFINE(MOZ_JPROF)
3241 dnl ========================================================
3243 dnl ========================================================
3244 MOZ_ARG_ENABLE_BOOL(shark,
3245 [ --enable-shark Enable shark remote profiling. Implies --enable-profiling.],
3248 if test -n "$MOZ_SHARK"; then
3250 AC_DEFINE(MOZ_SHARK)
3253 dnl ========================================================
3255 dnl ========================================================
3256 MOZ_ARG_ENABLE_BOOL(instruments,
3257 [ --enable-instruments Enable instruments remote profiling. Implies --enable-profiling.],
3260 if test -n "$MOZ_INSTRUMENTS"; then
3262 AC_DEFINE(MOZ_INSTRUMENTS)
3263 LIBS="$LIBS -framework CoreFoundation"
3266 dnl ========================================================
3268 dnl ========================================================
3269 MOZ_ARG_ENABLE_BOOL(callgrind,
3270 [ --enable-callgrind Enable callgrind profiling. Implies --enable-profiling.],
3273 if test -n "$MOZ_CALLGRIND"; then
3275 AC_DEFINE(MOZ_CALLGRIND)
3278 dnl ========================================================
3280 dnl ========================================================
3281 MOZ_ARG_ENABLE_BOOL(vtune,
3282 [ --enable-vtune Enable vtune profiling. Implies --enable-profiling.],
3286 dnl ========================================================
3287 dnl Debug (see Bug 939505)
3288 dnl ========================================================
3289 if test -n "$MOZ_DEBUG"; then
3293 dnl ========================================================
3295 dnl ========================================================
3296 if test -n "$MOZ_PROFILING"; then
3297 AC_DEFINE(MOZ_PROFILING)
3299 case "$OS_TARGET" in
3300 Linux) MOZ_VTUNE=1 ;;
3301 WINNT) MOZ_VTUNE=1 ;;
3305 if test -n "$MOZ_VTUNE"; then
3306 AC_DEFINE(MOZ_VTUNE)
3309 dnl ========================================================
3310 dnl Zealous JavaScript GC
3311 dnl ========================================================
3312 MOZ_ARG_ENABLE_BOOL(gczeal,
3313 [ --enable-gczeal Enable zealous GCing],
3316 if test -n "$JS_GC_ZEAL" -o -n "$MOZ_DEBUG"; then
3317 AC_DEFINE(JS_GC_ZEAL)
3320 dnl ========================================================
3321 dnl = Enable perf logging for ion.
3322 dnl = Perf logging is OFF by default
3323 dnl ========================================================
3324 MOZ_ARG_ENABLE_BOOL(perf,
3325 [ --enable-perf Enable Linux perf integration],
3328 if test -n "$JS_ION_PERF"; then
3329 AC_DEFINE(JS_ION_PERF)
3332 dnl ========================================================
3333 dnl JS opt-mode assertions and minidump instrumentation
3334 dnl ========================================================
3335 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
3336 [ --enable-js-diagnostics
3337 Enable JS diagnostic assertions and breakpad data],
3338 JS_CRASH_DIAGNOSTICS=1,
3339 JS_CRASH_DIAGNOSTICS= )
3340 if test -n "$JS_CRASH_DIAGNOSTICS"; then
3341 AC_DEFINE(JS_CRASH_DIAGNOSTICS)
3344 dnl ========================================================
3345 dnl Enable changes that make the shell more deterministic
3346 dnl ========================================================
3347 MOZ_ARG_ENABLE_BOOL(more-deterministic,
3348 [ --enable-more-deterministic
3349 Enable changes that make the shell more deterministic],
3350 JS_MORE_DETERMINISTIC=1,
3351 JS_MORE_DETERMINISTIC= )
3352 if test -n "$JS_MORE_DETERMINISTIC"; then
3353 AC_DEFINE(JS_MORE_DETERMINISTIC)
3356 dnl ========================================================
3357 dnl Enable breakpoint for artificial OOMs
3358 dnl ========================================================
3359 MOZ_ARG_ENABLE_BOOL(oom-breakpoint,
3360 [ --enable-oom-breakpoint
3361 Enable a breakpoint function for artificial OOMs],
3362 JS_OOM_BREAKPOINT=1,
3363 JS_OOM_BREAKPOINT= )
3364 if test -n "$JS_OOM_BREAKPOINT"; then
3365 AC_DEFINE(JS_OOM_BREAKPOINT)
3370 dnl ========================================================
3371 dnl = Enable static checking using gcc-dehydra
3372 dnl ========================================================
3374 MOZ_ARG_WITH_STRING(static-checking,
3375 [ --with-static-checking=path/to/gcc_dehydra.so
3376 Enable static checking of code using GCC-dehydra],
3377 DEHYDRA_PATH=$withval,
3380 if test -n "$DEHYDRA_PATH"; then
3381 if test ! -f "$DEHYDRA_PATH"; then
3382 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
3384 AC_DEFINE(NS_STATIC_CHECKING)
3386 AC_SUBST(DEHYDRA_PATH)
3388 dnl ========================================================
3389 dnl = Enable using the clang plugin to build
3390 dnl ========================================================
3392 MOZ_ARG_ENABLE_BOOL(clang-plugin,
3393 [ --enable-clang-plugin Enable building with the mozilla clang plugin ],
3394 ENABLE_CLANG_PLUGIN=1,
3395 ENABLE_CLANG_PLUGIN= )
3396 if test -n "$ENABLE_CLANG_PLUGIN"; then
3397 if test -z "$CLANG_CC"; then
3398 AC_MSG_ERROR([Can't use clang plugin without clang.])
3400 AC_DEFINE(MOZ_CLANG_PLUGIN)
3403 AC_SUBST(ENABLE_CLANG_PLUGIN)
3405 dnl ========================================================
3406 dnl = Enable static checking using sixgill
3407 dnl ========================================================
3409 MOZ_ARG_WITH_STRING(sixgill,
3410 [ --with-sixgill=path/to/sixgill
3411 Enable static checking of code using sixgill],
3412 SIXGILL_PATH=$withval,
3415 if test -n "$SIXGILL_PATH"; then
3416 if test ! -x "$SIXGILL_PATH/bin/xdbfind" || test ! -f "$SIXGILL_PATH/gcc/xgill.so" || test ! -x "$SIXGILL_PATH/scripts/wrap_gcc/g++"; then
3417 AC_MSG_ERROR([The sixgill plugin and binaries are not at the specified path.])
3420 AC_SUBST(SIXGILL_PATH)
3422 dnl ========================================================
3423 dnl = Enable stripping of libs & executables
3424 dnl ========================================================
3425 MOZ_ARG_ENABLE_BOOL(strip,
3426 [ --enable-strip Enable stripping of libs & executables ],
3430 dnl ========================================================
3431 dnl = Enable stripping of libs & executables when packaging
3432 dnl ========================================================
3433 MOZ_ARG_ENABLE_BOOL(install-strip,
3434 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
3438 dnl ========================================================
3440 dnl = Profiling and Instrumenting
3442 dnl ========================================================
3443 MOZ_ARG_HEADER(Profiling and Instrumenting)
3445 dnl ========================================================
3446 dnl = Support for demangling undefined symbols
3447 dnl ========================================================
3448 if test -z "$SKIP_LIBRARY_CHECKS"; then
3451 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
3455 # Demangle only for debug or trace-malloc or DMD builds
3456 MOZ_DEMANGLE_SYMBOLS=
3457 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
3458 MOZ_DEMANGLE_SYMBOLS=1
3459 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
3461 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
3463 dnl ========================================================
3465 dnl ========================================================
3467 MOZ_ARG_WITH_STRING(jitreport-granularity,
3468 [ --jitreport-granularity=N
3469 Default granularity at which to report JIT code
3472 1 - code ranges for whole functions only
3473 2 - per-line information
3474 3 - per-op information],
3475 JITREPORT_GRANULARITY=$withval,
3476 JITREPORT_GRANULARITY=3)
3478 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
3480 dnl ========================================================
3484 dnl ========================================================
3485 MOZ_ARG_HEADER(Misc. Options)
3487 dnl ========================================================
3488 dnl update xterm title
3489 dnl ========================================================
3490 MOZ_ARG_ENABLE_BOOL(xterm-updates,
3491 [ --enable-xterm-updates Update XTERM titles with current command.],
3495 if test -z "$SKIP_COMPILER_CHECKS"; then
3496 dnl ========================================================
3498 dnl = Compiler Options
3500 dnl ========================================================
3501 MOZ_ARG_HEADER(Compiler Options)
3503 dnl ========================================================
3504 dnl Check for gcc -pipe support
3505 dnl ========================================================
3506 AC_MSG_CHECKING([for -pipe support])
3507 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
3508 dnl Any gcc that supports firefox supports -pipe.
3509 CFLAGS="$CFLAGS -pipe"
3510 CXXFLAGS="$CXXFLAGS -pipe"
3511 AC_MSG_RESULT([yes])
3516 dnl ========================================================
3517 dnl Profile guided optimization (gcc checks)
3518 dnl ========================================================
3519 dnl Test for profiling options
3520 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
3522 _SAVE_CFLAGS="$CFLAGS"
3523 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
3525 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
3526 AC_TRY_COMPILE([], [return 0;],
3527 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
3528 result="yes" ], result="no")
3529 AC_MSG_RESULT([$result])
3531 if test $result = "yes"; then
3532 PROFILE_GEN_LDFLAGS="-fprofile-generate"
3533 PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
3534 PROFILE_USE_LDFLAGS="-fprofile-use"
3537 CFLAGS="$_SAVE_CFLAGS"
3539 if test -n "$INTEL_CC"; then
3540 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
3541 PROFILE_GEN_LDFLAGS=
3542 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
3543 PROFILE_USE_LDFLAGS=
3546 dnl Sun Studio on Solaris
3547 if test "$SOLARIS_SUNPRO_CC"; then
3548 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
3549 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
3550 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
3551 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
3554 AC_SUBST(PROFILE_GEN_CFLAGS)
3555 AC_SUBST(PROFILE_GEN_LDFLAGS)
3556 AC_SUBST(PROFILE_USE_CFLAGS)
3557 AC_SUBST(PROFILE_USE_LDFLAGS)
3561 dnl ========================================================
3562 dnl Check for tm_zone, tm_gmtoff in struct tm
3563 dnl ========================================================
3564 AC_CACHE_CHECK(for tm_zone tm_gmtoff in struct tm,
3565 ac_cv_struct_tm_zone_tm_gmtoff,
3566 [AC_TRY_COMPILE([#include <time.h>],
3567 [struct tm tm; tm.tm_zone = 0; tm.tm_gmtoff = 1;],
3568 [ac_cv_struct_tm_zone_tm_gmtoff="yes"],
3569 [ac_cv_struct_tm_zone_tm_gmtoff="no"])])
3570 if test "$ac_cv_struct_tm_zone_tm_gmtoff" = "yes" ; then
3571 AC_DEFINE(HAVE_TM_ZONE_TM_GMTOFF)
3573 fi # ! SKIP_COMPILER_CHECKS
3575 AC_DEFINE(CPP_THROW_NEW, [throw()])
3580 dnl ========================================================
3582 dnl = Build depencency options
3584 dnl ========================================================
3585 MOZ_ARG_HEADER(Build dependencies)
3587 if test "$GNU_CC" -a "$GNU_CXX"; then
3588 _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
3589 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
3590 elif test "$SOLARIS_SUNPRO_CC"; then
3593 dnl Don't override this for MSVC
3594 if test -z "$_WIN32_MSVC"; then
3595 _USE_CPP_INCLUDE_FLAG=
3596 _DEFINES_CFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
3597 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
3599 echo '#include <stdio.h>' > dummy-hello.c
3601 dnl This output is localized, split at the first double space or colon and space.
3602 _CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*\\\stdio.h\)$"
3603 CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'`
3604 _CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'`
3606 if ! test -e "$_CL_STDIO_PATH"; then
3607 AC_MSG_ERROR([Unable to parse cl -showIncludes prefix. This compiler's locale has an unsupported formatting.])
3609 if test -z "$CL_INCLUDES_PREFIX"; then
3610 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
3612 AC_SUBST(CL_INCLUDES_PREFIX)
3615 dnl Make sure that the build system can handle non-ASCII characters
3616 dnl in environment variables to prevent it from breaking silently on
3617 dnl non-English systems.
3618 NONASCII=$'\241\241'
3623 dnl ========================================================
3624 dnl = Disable -fstrict-aliasing with GCC 4.4 and earlier.
3625 dnl = See bugs 821502 and 832623.
3626 dnl ========================================================
3627 if test -n "$GNU_CC" -a -z "$CLANG_CC"; then
3628 dnl GCC 3.x isn't supported, so we don't need to check for that.
3629 if test "$GCC_MAJOR_VERSION" -eq "4" -a "$GCC_MINOR_VERSION" -lt "5" ; then
3630 CFLAGS="$CFLAGS -fno-strict-aliasing"
3631 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
3635 dnl ========================================================
3636 dnl = Link js shell to system readline
3637 dnl ========================================================
3638 MOZ_ARG_ENABLE_BOOL(readline,
3639 [ --enable-readline Link js shell to system readline library],
3643 JS_BUNDLED_EDITLINE=
3655 if test -z "$SKIP_LIBRARY_CHECKS" -a -z "$NO_EDITLINE"; then
3656 if test -n "$JS_WANT_READLINE"; then
3657 AC_CHECK_LIB(readline, readline,
3658 EDITLINE_LIBS="-lreadline",
3659 AC_MSG_ERROR([No system readline library found.]))
3661 dnl By default, we use editline
3662 JS_BUNDLED_EDITLINE=1
3665 dnl Either way, we want to build with line editing support.
3668 AC_SUBST(JS_BUNDLED_EDITLINE)
3669 AC_SUBST(JS_DISABLE_SHELL)
3670 AC_SUBST_LIST(EDITLINE_LIBS)
3672 dnl ========================================================
3674 dnl = Standalone module options
3676 dnl ========================================================
3677 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
3679 dnl ========================================================
3680 dnl = Build jsctypes if it's enabled
3681 dnl ========================================================
3682 MOZ_ARG_ENABLE_BOOL(ctypes,
3683 [ --enable-ctypes Enable js-ctypes (default=no)],
3686 JS_HAS_CTYPES=$BUILD_CTYPES
3687 AC_SUBST(JS_HAS_CTYPES)
3688 AC_SUBST(BUILD_CTYPES)
3689 if test "$JS_HAS_CTYPES"; then
3690 dnl Error out if we're on MSVC and MASM is unavailable.
3691 if test -n "$_MSC_VER" -a \( "$AS" != "ml.exe" -a "$AS" != "ml64.exe" \); then
3692 AC_MSG_ERROR([\"$AS\" is not a suitable assembler to build js-ctypes. If you are building with MS Visual Studio 8 Express, you may download the MASM 8.0 package, upgrade to Visual Studio 9 Express, or install the Vista SDK. Or do not use --enable-ctypes.])
3694 AC_DEFINE(JS_HAS_CTYPES)
3697 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
3698 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
3701 dnl ========================================================
3703 dnl = Options for generating the shell as a script
3705 dnl ========================================================
3707 MOZ_ARG_WITH_STRING(qemu-exe,
3708 [ --with-qemu-exe=path Use path as an arm emulator on host platforms],
3711 MOZ_ARG_WITH_STRING(cross-lib,
3712 [ --with-cross-lib=dir Use dir as the location for arm libraries],
3714 CROSS_LIB=/usr/$target)
3716 dnl ========================================================
3718 dnl = Maintainer debug option (no --enable equivalent)
3720 dnl ========================================================
3725 AC_SUBST(AR_EXTRACT)
3729 AC_SUBST(AS_DASH_C_FLAG)
3739 AC_SUBST(MOZ_DEBUG_SYMBOLS)
3740 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
3741 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
3742 AC_SUBST(MOZ_DEBUG_LDFLAGS)
3743 AC_SUBST(WARNINGS_AS_ERRORS)
3746 AC_SUBST(MOZ_INSTRUMENTS)
3747 AC_SUBST(MOZ_CALLGRIND)
3749 AC_SUBST(MOZ_PROFILING)
3752 AC_SUBST(ENABLE_TESTS)
3754 AC_SUBST(ENABLE_STRIP)
3755 AC_SUBST(PKG_SKIP_STRIP)
3756 AC_SUBST(INCREMENTAL_LINKER)
3757 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
3759 AC_SUBST(MOZ_FIX_LINK_PATHS)
3761 AC_SUBST(USE_DEPENDENT_LIBS)
3763 AC_SUBST(MOZ_BUILD_ROOT)
3765 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
3766 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
3768 AC_SUBST(MOZ_APP_NAME)
3769 AC_SUBST(MOZ_APP_DISPLAYNAME)
3770 AC_SUBST(MOZ_APP_VERSION)
3772 AC_SUBST(MOZ_PKG_SPECIAL)
3774 AC_SUBST(MOZILLA_OFFICIAL)
3777 AC_SUBST(MOZ_BROWSE_INFO)
3778 AC_SUBST(MOZ_TOOLS_DIR)
3780 dnl Echo the CFLAGS to remove extra whitespace.
3786 $_WARNINGS_CXXFLAGS \
3789 COMPILE_CFLAGS=`echo \
3794 COMPILE_CXXFLAGS=`echo \
3795 $_DEFINES_CXXFLAGS \
3803 HOST_CXXFLAGS=`echo \
3807 AC_SUBST(NSPR_CFLAGS)
3808 AC_SUBST_LIST(NSPR_LIBS)
3809 AC_SUBST(MOZ_NATIVE_NSPR)
3811 if test -n "$MOZ_NUWA_PROCESS"; then
3812 AC_DEFINE(MOZ_NUWA_PROCESS)
3816 OS_CXXFLAGS="$CXXFLAGS"
3817 OS_CPPFLAGS="$CPPFLAGS"
3818 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
3819 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
3820 OS_LDFLAGS="$LDFLAGS"
3823 AC_SUBST(OS_CXXFLAGS)
3824 AC_SUBST(OS_CPPFLAGS)
3825 AC_SUBST(OS_COMPILE_CFLAGS)
3826 AC_SUBST(OS_COMPILE_CXXFLAGS)
3827 AC_SUBST(OS_LDFLAGS)
3829 AC_SUBST(CROSS_COMPILE)
3834 AC_SUBST(HOST_CFLAGS)
3835 AC_SUBST(HOST_CXXFLAGS)
3836 AC_SUBST(HOST_LDFLAGS)
3837 AC_SUBST(HOST_OPTIMIZE_FLAGS)
3839 AC_SUBST(HOST_AR_FLAGS)
3841 AC_SUBST(HOST_RANLIB)
3842 AC_SUBST(HOST_NSPR_MDCPUCFG)
3843 AC_SUBST(HOST_BIN_SUFFIX)
3844 AC_SUBST(HOST_OS_ARCH)
3846 AC_SUBST(TARGET_CPU)
3847 AC_SUBST(TARGET_VENDOR)
3849 AC_SUBST(TARGET_NSPR_MDCPUCFG)
3850 AC_SUBST(TARGET_MD_ARCH)
3851 AC_SUBST(TARGET_XPCOM_ABI)
3854 AC_SUBST(OS_RELEASE)
3857 AC_SUBST(INTEL_ARCHITECTURE)
3859 AC_SUBST(WRAP_LDFLAGS)
3862 AC_SUBST(MKSHLIB_FORCE_ALL)
3863 AC_SUBST(MKSHLIB_UNFORCE_ALL)
3864 AC_SUBST(DSO_CFLAGS)
3865 AC_SUBST(DSO_PIC_CFLAGS)
3866 AC_SUBST(DSO_LDOPTS)
3867 AC_SUBST(LIB_PREFIX)
3868 AC_SUBST(DLL_PREFIX)
3869 AC_SUBST(DLL_SUFFIX)
3870 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
3871 AC_SUBST(LIB_SUFFIX)
3872 AC_SUBST(OBJ_SUFFIX)
3873 AC_SUBST(BIN_SUFFIX)
3874 AC_SUBST(ASM_SUFFIX)
3875 AC_SUBST(IMPORT_LIB_SUFFIX)
3877 AC_SUBST(CC_VERSION)
3878 AC_SUBST(CXX_VERSION)
3879 AC_SUBST(MSMANIFEST_TOOL)
3880 AC_SUBST(MOZ_LINKER)
3881 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
3882 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
3884 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
3886 dnl Set various defines and substitutions
3887 dnl ========================================================
3889 if test "$OS_ARCH" = "Darwin"; then
3890 AC_DEFINE(XP_MACOSX)
3892 elif test "$OS_ARCH" != "WINNT"; then
3896 if test "$MOZ_DEBUG"; then
3897 AC_DEFINE(MOZ_REFLOW_PERF)
3898 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
3901 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
3902 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
3903 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
3904 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
3905 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
3906 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
3907 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
3908 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
3909 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
3913 dnl ========================================================
3914 dnl ECMAScript Internationalization API Support (uses ICU)
3915 dnl ========================================================
3917 dnl top-level configure may override this with --without-intl-api
3922 MOZ_SUBCONFIGURE_ICU()
3924 dnl ========================================================
3925 dnl JavaScript shell
3926 dnl ========================================================
3928 AC_HAVE_FUNCS(setlocale)
3929 AC_HAVE_FUNCS(localeconv)
3931 AC_SUBST(MOZILLA_VERSION)
3933 AC_SUBST(ac_configure_args)
3935 AC_SUBST(TOOLCHAIN_PREFIX)
3937 if test -n "$JS_STANDALONE"; then
3938 MOZ_APP_NAME="mozjs"
3939 MOZ_APP_VERSION="$MOZILLA_SYMBOLVERSION"
3940 JS_LIBRARY_NAME="mozjs-$MOZILLA_SYMBOLVERSION"
3942 JS_LIBRARY_NAME="mozjs"
3944 JS_CONFIG_LIBS="$NSPR_LIBS $LIBS"
3945 if test -n "$GNU_CC"; then
3946 JS_CONFIG_MOZ_JS_LIBS='-L${libdir} -l${JS_LIBRARY_NAME}'
3948 JS_CONFIG_MOZ_JS_LIBS='${libdir}/${JS_LIBRARY_NAME}.lib'
3950 AC_SUBST(JS_LIBRARY_NAME)
3951 AC_SUBST(JS_CONFIG_MOZ_JS_LIBS)
3952 AC_SUBST(JS_CONFIG_LIBS)
3954 if test -n "$MOZ_BUILD_NSPR"; then
3955 MOZ_SUBCONFIGURE_NSPR()
3957 MOZ_SUBCONFIGURE_FFI()
3959 dnl Spit out some output
3960 dnl ========================================================
3961 MOZ_CREATE_CONFIG_STATUS()
3963 if test "$JS_STANDALONE"; then
3964 MOZ_RUN_CONFIG_STATUS()