michael@0: dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*- michael@0: dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4: michael@0: dnl This Source Code Form is subject to the terms of the Mozilla Public michael@0: dnl License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: dnl file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: dnl Process this file with autoconf to produce a configure script. michael@0: dnl ======================================================== michael@0: michael@0: AC_PREREQ(2.13) michael@0: AC_INIT(js/src/jsapi.h) michael@0: AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf) michael@0: AC_CANONICAL_SYSTEM michael@0: TARGET_CPU="${target_cpu}" michael@0: TARGET_VENDOR="${target_vendor}" michael@0: TARGET_OS="${target_os}" michael@0: michael@0: dnl ======================================================== michael@0: dnl = michael@0: dnl = Don't change the following two lines. Doing so breaks: michael@0: dnl = michael@0: dnl = CFLAGS="-foo" ./configure michael@0: dnl = michael@0: dnl ======================================================== michael@0: CFLAGS="${CFLAGS=}" michael@0: CPPFLAGS="${CPPFLAGS=}" michael@0: CXXFLAGS="${CXXFLAGS=}" michael@0: LDFLAGS="${LDFLAGS=}" michael@0: HOST_CFLAGS="${HOST_CFLAGS=}" michael@0: HOST_CXXFLAGS="${HOST_CXXFLAGS=}" michael@0: HOST_LDFLAGS="${HOST_LDFLAGS=}" michael@0: michael@0: dnl ======================================================== michael@0: dnl = Preserve certain environment flags passed to configure michael@0: dnl = We want sub projects to receive the same flags michael@0: dnl = untainted by this configure script michael@0: dnl ======================================================== michael@0: _SUBDIR_CC="$CC" michael@0: _SUBDIR_CXX="$CXX" michael@0: _SUBDIR_CFLAGS="$CFLAGS" michael@0: _SUBDIR_CPPFLAGS="$CPPFLAGS" michael@0: _SUBDIR_CXXFLAGS="$CXXFLAGS" michael@0: _SUBDIR_LDFLAGS="$LDFLAGS" michael@0: _SUBDIR_HOST_CC="$HOST_CC" michael@0: _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS" michael@0: _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS" michael@0: _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS" michael@0: _SUBDIR_CONFIG_ARGS="$ac_configure_args" michael@0: michael@0: dnl Set the version number of the libs included with mozilla michael@0: dnl ======================================================== michael@0: NSPR_VERSION=4 michael@0: NSPR_MINVER=4.9.2 michael@0: michael@0: dnl Set the minimum version of toolkit libs used by mozilla michael@0: dnl ======================================================== michael@0: PERL_VERSION=5.006 michael@0: WINDRES_VERSION=2.14.90 michael@0: W32API_VERSION=3.14 michael@0: michael@0: MSMANIFEST_TOOL= michael@0: michael@0: dnl Set various checks michael@0: dnl ======================================================== michael@0: MISSING_X= michael@0: AC_PROG_AWK michael@0: michael@0: dnl Initialize the Pthread test variables early so they can be michael@0: dnl overridden by each platform. michael@0: dnl ======================================================== michael@0: USE_PTHREADS= michael@0: _PTHREAD_LDFLAGS="" michael@0: michael@0: dnl Do not allow a separate objdir build if a srcdir build exists. michael@0: dnl ============================================================== michael@0: _topsrcdir=`cd $srcdir; pwd` michael@0: _objdir=`pwd` michael@0: michael@0: if test "$_topsrcdir" != "$_objdir" michael@0: then michael@0: # Check for a couple representative files in the source tree michael@0: _conflict_files= michael@0: for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do michael@0: if test -f $file; then michael@0: _conflict_files="$_conflict_files $file" michael@0: fi michael@0: done michael@0: if test "$_conflict_files"; then michael@0: echo "***" michael@0: echo "* Your source tree contains these files:" michael@0: for file in $_conflict_files; do michael@0: echo "* $file" michael@0: done michael@0: cat 1>&2 <<-EOF michael@0: * This indicates that you previously built in the source tree. michael@0: * A source tree build can confuse the separate objdir build. michael@0: * michael@0: * To clean up the source tree: michael@0: * 1. cd $_topsrcdir michael@0: * 2. gmake distclean michael@0: *** michael@0: EOF michael@0: exit 1 michael@0: break michael@0: fi michael@0: fi michael@0: MOZ_BUILD_ROOT=`pwd` michael@0: michael@0: dnl Choose where to put the 'dist' directory. michael@0: dnl ============================================================== michael@0: michael@0: MOZ_ARG_WITH_STRING(dist-dir, michael@0: [ --with-dist-dir=DIR Use DIR as 'dist' staging area. DIR may be michael@0: relative to the top of SpiderMonkey build tree, michael@0: or absolute.], michael@0: TOP_DIST=$withval, michael@0: TOP_DIST=dist) michael@0: AC_SUBST(TOP_DIST) michael@0: michael@0: MOZ_DEFAULT_COMPILER michael@0: michael@0: COMPILE_ENVIRONMENT=1 michael@0: MOZ_ARG_DISABLE_BOOL(compile-environment, michael@0: [ --disable-compile-environment michael@0: Disable compiler/library checks.], michael@0: COMPILE_ENVIRONMENT= ) michael@0: AC_SUBST(COMPILE_ENVIRONMENT) michael@0: michael@0: dnl Check for Perl first -- needed for win32 SDK checks michael@0: MOZ_PATH_PROGS(PERL, $PERL perl5 perl ) michael@0: if test -z "$PERL" -o "$PERL" = ":"; then michael@0: AC_MSG_ERROR([perl not found in \$PATH]) michael@0: fi michael@0: michael@0: MOZ_ARG_ENABLE_BOOL(shared-js, michael@0: [ --disable-shared-js michael@0: Do not create a shared library.], michael@0: DISABLE_SHARED_JS=0, michael@0: DISABLE_SHARED_JS=1) michael@0: michael@0: MOZ_ARG_DISABLE_BOOL(export-js, michael@0: [ --disable-export-js michael@0: Do not mark JS symbols as DLL exported/visible.], michael@0: DISABLE_EXPORT_JS=1, michael@0: DISABLE_SHARED_JS=) michael@0: michael@0: if test "$DISABLE_SHARED_JS" = "1" ; then michael@0: if test "$DISABLE_EXPORT_JS" = "1"; then michael@0: AC_DEFINE(STATIC_JS_API) michael@0: else michael@0: AC_DEFINE(STATIC_EXPORTABLE_JS_API) michael@0: fi michael@0: else michael@0: if test "$DISABLE_EXPORT_JS" = "1"; then michael@0: AC_MSG_ERROR([Must export JS symbols when building a shared library.]) michael@0: fi michael@0: JS_SHARED_LIBRARY=1 michael@0: fi michael@0: AC_SUBST(JS_SHARED_LIBRARY) michael@0: michael@0: if test "$JS_STANDALONE" = no; then michael@0: autoconfmk=autoconf-js.mk michael@0: JS_STANDALONE= michael@0: else michael@0: JS_STANDALONE=1 michael@0: AC_DEFINE(JS_STANDALONE) michael@0: fi michael@0: AC_SUBST(JS_STANDALONE) michael@0: BUILDING_JS=1 michael@0: AC_SUBST(autoconfmk) michael@0: michael@0: MOZ_ARG_WITH_STRING(gonk, michael@0: [ --with-gonk=DIR michael@0: location of gonk dir], michael@0: gonkdir=$withval) michael@0: michael@0: MOZ_ARG_WITH_STRING(gonk-toolchain-prefix, michael@0: [ --with-gonk-toolchain-prefix=DIR michael@0: prefix to gonk toolchain commands], michael@0: gonk_toolchain_prefix=$withval) michael@0: michael@0: if test -n "$gonkdir" ; then michael@0: kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"` michael@0: michael@0: dnl set up compilers michael@0: AS="$gonk_toolchain_prefix"as michael@0: CC="$gonk_toolchain_prefix"gcc michael@0: CXX="$gonk_toolchain_prefix"g++ michael@0: CPP="$gonk_toolchain_prefix"cpp michael@0: LD="$gonk_toolchain_prefix"ld michael@0: AR="$gonk_toolchain_prefix"ar michael@0: RANLIB="$gonk_toolchain_prefix"ranlib michael@0: STRIP="$gonk_toolchain_prefix"strip michael@0: OBJCOPY="$gonk_toolchain_prefix"objcopy michael@0: michael@0: STLPORT_CPPFLAGS="-I$gonkdir/external/stlport/stlport" michael@0: STLPORT_LIBS="-lstlport" michael@0: michael@0: case "$target_cpu" in michael@0: arm) michael@0: ARCH_DIR=arch-arm michael@0: ;; michael@0: i?86) michael@0: ARCH_DIR=arch-x86 michael@0: ;; michael@0: esac michael@0: michael@0: 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" michael@0: CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS" michael@0: CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS $STLPORT_CPPFLAGS" michael@0: LIBS="$LIBS $STLPORT_LIBS" michael@0: michael@0: dnl Add -llog by default, since we use it all over the place. michael@0: 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" michael@0: michael@0: dnl prevent cross compile section from using these flags as host flags michael@0: if test -z "$HOST_CPPFLAGS" ; then michael@0: HOST_CPPFLAGS=" " michael@0: fi michael@0: if test -z "$HOST_CFLAGS" ; then michael@0: HOST_CFLAGS=" " michael@0: fi michael@0: if test -z "$HOST_CXXFLAGS" ; then michael@0: HOST_CXXFLAGS=" " michael@0: fi michael@0: if test -z "$HOST_LDFLAGS" ; then michael@0: HOST_LDFLAGS=" " michael@0: fi michael@0: michael@0: AC_DEFINE(ANDROID) michael@0: AC_DEFINE(GONK) michael@0: else michael@0: MOZ_ANDROID_NDK michael@0: fi michael@0: michael@0: dnl ============================================================== michael@0: dnl Get mozilla version from central milestone file michael@0: dnl ============================================================== michael@0: MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir` michael@0: MOZILLA_UAVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -uaversion` michael@0: MOZILLA_SYMBOLVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -symbolversion` michael@0: michael@0: AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION") michael@0: AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION) michael@0: AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION") michael@0: AC_SUBST(MOZILLA_SYMBOLVERSION) michael@0: michael@0: # Separate version into components for use in shared object naming etc michael@0: changequote(,) michael@0: MOZJS_MAJOR_VERSION=`echo $MOZILLA_VERSION | sed "s|\(^[0-9]*\)\.[0-9]*.*|\1|"` michael@0: MOZJS_MINOR_VERSION=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.\([0-9]*\).*|\1|"` michael@0: MOZJS_PATCH_VERSION=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.[0-9]*[^0-9]*||"` michael@0: IS_ALPHA=`echo $MOZILLA_VERSION | grep '[ab]'` michael@0: michael@0: dnl XXX in a temporary bid to avoid developer anger at renaming files michael@0: dnl XXX before "js" symlinks exist, don't change names. michael@0: dnl michael@0: dnl if test -n "$JS_STANDALONE"; then michael@0: dnl JS_SHELL_NAME=js$MOZJS_MAJOR_VERSION michael@0: dnl JS_CONFIG_NAME=js$MOZJS_MAJOR_VERSION-config michael@0: dnl else michael@0: JS_SHELL_NAME=js michael@0: JS_CONFIG_NAME=js-config michael@0: dnl fi michael@0: michael@0: changequote([,]) michael@0: if test -n "$IS_ALPHA"; then michael@0: changequote(,) michael@0: MOZJS_ALPHA=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.[0-9\.]*\([^0-9]\).*|\1|"` michael@0: changequote([,]) michael@0: fi michael@0: AC_DEFINE_UNQUOTED(MOZJS_MAJOR_VERSION,$MOZJS_MAJOR_VERSION) michael@0: AC_DEFINE_UNQUOTED(MOZJS_MINOR_VERSION,$MOZJS_MINOR_VERSION) michael@0: AC_SUBST(JS_SHELL_NAME) michael@0: AC_SUBST(JS_CONFIG_NAME) michael@0: AC_SUBST(MOZJS_MAJOR_VERSION) michael@0: AC_SUBST(MOZJS_MINOR_VERSION) michael@0: AC_SUBST(MOZJS_PATCH_VERSION) michael@0: AC_SUBST(MOZJS_ALPHA) michael@0: michael@0: dnl ======================================================== michael@0: dnl Checks for compilers. michael@0: dnl ======================================================== michael@0: michael@0: dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269) michael@0: AR_FLAGS='crs $@' michael@0: michael@0: if test "$COMPILE_ENVIRONMENT"; then michael@0: michael@0: # Note: michael@0: # In Mozilla, we use the names $target, $host and $build incorrectly, but are michael@0: # too far gone to back out now. See Bug 475488: michael@0: # - When we say $target, we mean $host, that is, the system on which michael@0: # Mozilla will be run. michael@0: # - When we say $host, we mean $build, that is, the system on which Mozilla michael@0: # is built. michael@0: # - $target (in its correct usage) is for compilers who generate code for a michael@0: # different platform than $host, so it would not be used by Mozilla. michael@0: if test "$target" != "$host"; then michael@0: MOZ_CROSS_COMPILER michael@0: else michael@0: AC_PROG_CC michael@0: AC_PROG_CXX michael@0: AC_PROG_RANLIB michael@0: MOZ_PATH_PROGS(AS, $AS as, $CC) michael@0: AC_CHECK_PROGS(AR, ar, :) michael@0: AC_CHECK_PROGS(LD, ld, :) michael@0: AC_CHECK_PROGS(STRIP, strip, :) michael@0: AC_CHECK_PROGS(WINDRES, windres, :) michael@0: if test -z "$HOST_CC"; then michael@0: HOST_CC='$(CC)' michael@0: fi michael@0: if test -z "$HOST_CFLAGS"; then michael@0: HOST_CFLAGS='$(CFLAGS)' michael@0: fi michael@0: if test -z "$HOST_CXX"; then michael@0: HOST_CXX='$(CXX)' michael@0: fi michael@0: if test -z "$HOST_CXXFLAGS"; then michael@0: HOST_CXXFLAGS='$(CXXFLAGS)' michael@0: fi michael@0: if test -z "$HOST_LDFLAGS"; then michael@0: HOST_LDFLAGS='$(LDFLAGS)' michael@0: fi michael@0: if test -z "$HOST_RANLIB"; then michael@0: HOST_RANLIB='$(RANLIB)' michael@0: fi michael@0: if test -z "$HOST_AR"; then michael@0: HOST_AR='$(AR)' michael@0: fi michael@0: if test -z "$HOST_AR_FLAGS"; then michael@0: HOST_AR_FLAGS='$(AR_FLAGS)' michael@0: fi michael@0: fi michael@0: michael@0: MOZ_TOOL_VARIABLES michael@0: michael@0: MOZ_CHECK_COMPILER_WRAPPER michael@0: michael@0: if test -n "$GNU_CC" -a -z "$CLANG_CC" ; then michael@0: if test "$GCC_MAJOR_VERSION" -eq 4 -a "$GCC_MINOR_VERSION" -lt 4 || michael@0: test "$GCC_MAJOR_VERSION" -lt 4; then michael@0: AC_MSG_ERROR([Only GCC 4.4 or newer supported]) michael@0: fi michael@0: fi michael@0: michael@0: dnl Special win32 checks michael@0: dnl ======================================================== michael@0: michael@0: MOZ_ARG_ENABLE_BOOL(metro, michael@0: [ --enable-metro Enable Windows Metro build targets], michael@0: MOZ_METRO=1, michael@0: MOZ_METRO=) michael@0: if test -n "$MOZ_METRO"; then michael@0: AC_DEFINE(MOZ_METRO) michael@0: # Target the Windows 8 Kit michael@0: WINSDK_TARGETVER=602 michael@0: WINVER=502 michael@0: else michael@0: # Target the Windows 7 SDK by default michael@0: WINSDK_TARGETVER=601 michael@0: WINVER=502 michael@0: fi michael@0: michael@0: MOZ_ARG_WITH_STRING(windows-version, michael@0: [ --with-windows-version=WINSDK_TARGETVER michael@0: Windows SDK version to target. Lowest version michael@0: currently allowed is 601, highest is 602], michael@0: WINSDK_TARGETVER=$withval) michael@0: michael@0: # Currently only two sdk versions allowed, 601 and 602 michael@0: case "$WINSDK_TARGETVER" in michael@0: 601|602) michael@0: MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000 michael@0: ;; michael@0: michael@0: *) michael@0: AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]); michael@0: ;; michael@0: esac michael@0: michael@0: case "$target" in michael@0: *-mingw*) michael@0: if test "$GCC" != "yes" -a -z "$CLANG_CC"; then michael@0: # Check to see if we are really running in a msvc environemnt michael@0: _WIN32_MSVC=1 michael@0: michael@0: # Make sure compilers are valid michael@0: CFLAGS="$CFLAGS -TC -nologo" michael@0: CXXFLAGS="$CXXFLAGS -TP -nologo" michael@0: # MSVC warning C4345 warns of newly conformant behavior as of VS2003. michael@0: # MSVC warning C4351 warns of newly conformant behavior as of VS2005. michael@0: # MSVC warning C4800 warns when a value is implicitly cast to bool, michael@0: # because this also forces narrowing to a single byte, which can be a michael@0: # perf hit. But this matters so little in practice (and often we want michael@0: # that behavior) that it's better to turn it off. michael@0: # _CRT_SECURE_NO_WARNINGS disables warnings about using MSVC-specific michael@0: # secure CRT functions. michael@0: CXXFLAGS="$CXXFLAGS -wd4345 -wd4351 -wd4800 -D_CRT_SECURE_NO_WARNINGS" michael@0: AC_LANG_SAVE michael@0: AC_LANG_C michael@0: AC_TRY_COMPILE([#include ], michael@0: [ printf("Hello World\n"); ],, michael@0: AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) ) michael@0: michael@0: AC_LANG_CPLUSPLUS michael@0: AC_TRY_COMPILE([#include ], michael@0: [ unsigned *test = new unsigned(42); ],, michael@0: AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) ) michael@0: AC_LANG_RESTORE michael@0: michael@0: changequote(,) michael@0: _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p' michael@0: changequote([,]) michael@0: michael@0: # Determine compiler version michael@0: CC_VERSION=`${CC} -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"` michael@0: _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'` michael@0: _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'` michael@0: _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'` michael@0: _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'` michael@0: _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION} michael@0: michael@0: CXX_VERSION=`${CXX} -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"` michael@0: _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'` michael@0: michael@0: if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then michael@0: AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.]) michael@0: fi michael@0: michael@0: AC_DEFINE(_CRT_SECURE_NO_WARNINGS) michael@0: AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS) michael@0: michael@0: if test "$_CC_MAJOR_VERSION" = "16"; then michael@0: _CC_SUITE=10 michael@0: elif test "$_CC_MAJOR_VERSION" = "17"; then michael@0: _CC_SUITE=11 michael@0: elif test "$_CC_MAJOR_VERSION" = "18"; then michael@0: _CC_SUITE=12 michael@0: else michael@0: AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.]) michael@0: fi michael@0: michael@0: dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool', michael@0: dnl not something else like "magnetic tape manipulation utility". michael@0: MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'` michael@0: if test -z "$MSMT_TOOL"; then michael@0: AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.]) michael@0: fi michael@0: michael@0: changequote(,) michael@0: _MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p' michael@0: changequote([,]) michael@0: MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"` michael@0: if test -z "$MSMANIFEST_TOOL_VERSION"; then michael@0: AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.]) michael@0: fi michael@0: michael@0: MSMANIFEST_TOOL=1 michael@0: unset MSMT_TOOL michael@0: michael@0: # Check linker version michael@0: _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"` michael@0: _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'` michael@0: if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then michael@0: AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.]) michael@0: fi michael@0: michael@0: INCREMENTAL_LINKER=1 michael@0: michael@0: unset _MSVC_VER_FILTER michael@0: elif test -z "$CLANG_CC"; then michael@0: # Check w32api version michael@0: _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'` michael@0: _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'` michael@0: AC_MSG_CHECKING([for w32api version >= $W32API_VERSION]) michael@0: AC_TRY_COMPILE([#include ], michael@0: #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \ michael@0: (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \ michael@0: __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION) michael@0: #error "test failed." michael@0: #endif michael@0: , [ res=yes ], [ res=no ]) michael@0: AC_MSG_RESULT([$res]) michael@0: if test "$res" != "yes"; then michael@0: AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.]) michael@0: fi michael@0: # Check windres version michael@0: AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION]) michael@0: _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'` michael@0: AC_MSG_RESULT([$_WINDRES_VERSION]) michael@0: _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'` michael@0: _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'` michael@0: _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'` michael@0: WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'` michael@0: WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'` michael@0: WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'` michael@0: if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \ michael@0: "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \ michael@0: "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \ michael@0: "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \ michael@0: "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \ michael@0: "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION" michael@0: then michael@0: AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.]) michael@0: fi michael@0: michael@0: MOZ_WINSDK_MAXVER=0x06010000 michael@0: fi # !GNU_CC michael@0: michael@0: # If MSVC or clang michael@0: if test "$GCC" != "yes" -o -n "$CLANG_CC" ; then michael@0: MOZ_FIND_WINSDK_VERSION michael@0: fi michael@0: michael@0: AC_DEFINE_UNQUOTED(WINVER,0x$WINVER) michael@0: AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER) michael@0: # Require OS features provided by IE 6.0 SP2 (XP SP2) michael@0: AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603) michael@0: michael@0: # If the maximum version supported by this SDK is lower than the target michael@0: # version, error out michael@0: AC_MSG_CHECKING([for Windows SDK being recent enough]) michael@0: if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then michael@0: AC_MSG_RESULT("yes") michael@0: else michael@0: AC_MSG_RESULT("no") michael@0: 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.]) michael@0: fi michael@0: michael@0: AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER) michael@0: # Definitions matching sdkddkver.h michael@0: AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000) michael@0: ;; michael@0: esac michael@0: michael@0: AC_PROG_CPP michael@0: AC_PROG_CXXCPP michael@0: michael@0: if test -n "$_WIN32_MSVC"; then michael@0: SKIP_PATH_CHECKS=1 michael@0: SKIP_COMPILER_CHECKS=1 michael@0: SKIP_LIBRARY_CHECKS=1 michael@0: michael@0: # Since we're skipping compiler and library checks, hard-code michael@0: # some facts here. michael@0: michael@0: # Common to all MSVC environments: michael@0: michael@0: AC_DEFINE(HAVE_LOCALECONV) michael@0: AC_DEFINE(HAVE_HYPOT) michael@0: fi michael@0: michael@0: fi # COMPILE_ENVIRONMENT michael@0: michael@0: # Check to see if we are running in a broken QEMU scratchbox. michael@0: # We know that anything below 1.0.16 is broken. michael@0: AC_CHECK_PROGS(SBCONF, sb-conf ve, "") michael@0: if test -n "$SBCONF"; then michael@0: _sb_version=`$SBCONF ve` michael@0: _sb_version_major=`echo $_sb_version | cut -f1 -d.` michael@0: _sb_version_minor=`echo $_sb_version | cut -f2 -d.` michael@0: _sb_version_point=`echo $_sb_version | cut -f3 -d.` michael@0: if test $_sb_version_major -eq 1 -a $_sb_version_minor -eq 0 -a $_sb_version_point -le 16; then michael@0: QEMU_CANT_RUN_JS_SHELL=1 michael@0: fi michael@0: fi michael@0: AC_SUBST(QEMU_CANT_RUN_JS_SHELL) michael@0: michael@0: AC_SUBST(_MSC_VER) michael@0: michael@0: AC_SUBST(GNU_AS) michael@0: AC_SUBST(GNU_LD) michael@0: AC_SUBST(GNU_CC) michael@0: AC_SUBST(GNU_CXX) michael@0: AC_SUBST(INTEL_CC) michael@0: AC_SUBST(INTEL_CXX) michael@0: michael@0: dnl ======================================================== michael@0: dnl Checks for programs. michael@0: dnl ======================================================== michael@0: AC_PROG_INSTALL michael@0: AC_PROG_LN_S michael@0: michael@0: AC_MSG_CHECKING([for tar archiver]) michael@0: AC_CHECK_PROGS(TAR, gnutar gtar tar, "") michael@0: if test -z "$TAR"; then michael@0: AC_MSG_WARN([no tar archiver found in \$PATH]) michael@0: fi michael@0: AC_MSG_RESULT([$TAR]) michael@0: AC_SUBST(TAR) michael@0: michael@0: if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then michael@0: AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION]) michael@0: _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5` michael@0: _perl_res=$? michael@0: AC_MSG_RESULT([$_perl_version]) michael@0: michael@0: if test "$_perl_res" != 0; then michael@0: AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.]) michael@0: fi michael@0: fi michael@0: michael@0: AC_MSG_CHECKING([for full perl installation]) michael@0: _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5` michael@0: _perl_res=$? michael@0: if test "$_perl_res" != 0; then michael@0: AC_MSG_RESULT([no]) michael@0: AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.]) michael@0: else michael@0: AC_MSG_RESULT([yes]) michael@0: fi michael@0: michael@0: MOZ_PYTHON michael@0: michael@0: if test -z "$COMPILE_ENVIRONMENT"; then michael@0: NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py' michael@0: fi michael@0: AC_SUBST(NSINSTALL_BIN) michael@0: michael@0: MOZ_PATH_PROG(DOXYGEN, doxygen, :) michael@0: MOZ_PATH_PROG(AUTOCONF, autoconf, :) michael@0: MOZ_PATH_PROG(XARGS, xargs) michael@0: if test -z "$XARGS" -o "$XARGS" = ":"; then michael@0: AC_MSG_ERROR([xargs not found in \$PATH .]) michael@0: fi michael@0: michael@0: if test "$COMPILE_ENVIRONMENT"; then michael@0: michael@0: dnl ======================================================== michael@0: dnl = Mac OS X toolchain support michael@0: dnl ======================================================== michael@0: michael@0: dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk michael@0: dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS michael@0: dnl when we can run target binaries. michael@0: AC_SUBST(UNIVERSAL_BINARY) michael@0: AC_SUBST(MOZ_CAN_RUN_PROGRAMS) michael@0: michael@0: dnl ======================================================== michael@0: dnl Check for MacOS deployment target version michael@0: dnl ======================================================== michael@0: michael@0: MOZ_ARG_ENABLE_STRING(macos-target, michael@0: [ --enable-macos-target=VER (default=10.6) michael@0: Set the minimum MacOS version needed at runtime], michael@0: [_MACOSX_DEPLOYMENT_TARGET=$enableval]) michael@0: michael@0: if test "$target_cpu" != "arm"; then michael@0: case "$target" in michael@0: *-darwin*) michael@0: if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then michael@0: dnl Use the specified value michael@0: export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET michael@0: else michael@0: dnl No value specified on the command line or in the environment, michael@0: dnl use architecture minimum. michael@0: export MACOSX_DEPLOYMENT_TARGET=10.6 michael@0: fi michael@0: ;; michael@0: esac michael@0: fi michael@0: michael@0: AC_SUBST(MACOSX_DEPLOYMENT_TARGET) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Mac OS X SDK support michael@0: dnl ======================================================== michael@0: MACOS_SDK_DIR= michael@0: MOZ_ARG_WITH_STRING(macos-sdk, michael@0: [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)], michael@0: MACOS_SDK_DIR=$withval) michael@0: michael@0: dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use. michael@0: AC_SUBST(MACOS_SDK_DIR) michael@0: michael@0: if test "$MACOS_SDK_DIR"; then michael@0: dnl Sync this section with the ones in NSPR and NSS. michael@0: dnl Changes to the cross environment here need to be accounted for in michael@0: dnl the libIDL checks (below) and xpidl build. michael@0: michael@0: if test ! -d "$MACOS_SDK_DIR"; then michael@0: AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must michael@0: specify a valid SDK. SDKs are installed when the optional cross-development michael@0: tools are selected during the Xcode/Developer Tools installation.]) michael@0: fi michael@0: michael@0: CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}" michael@0: CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}" michael@0: michael@0: dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER. michael@0: CPP="$CPP -isysroot ${MACOS_SDK_DIR}" michael@0: CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}" michael@0: michael@0: AC_LANG_SAVE michael@0: AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination]) michael@0: AC_LANG_CPLUSPLUS michael@0: AC_TRY_COMPILE([#include michael@0: int main() { return 0; }], michael@0: result=yes, michael@0: result=no) michael@0: AC_LANG_RESTORE michael@0: AC_MSG_RESULT($result) michael@0: michael@0: if test "$result" = "no" ; then michael@0: AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.]) michael@0: fi michael@0: fi michael@0: michael@0: fi # COMPILE_ENVIRONMENT michael@0: michael@0: if test -n "$MAKE"; then michael@0: if test `echo $MAKE | grep -c make.py` != 1; then michael@0: NOT_PYMAKE=$MAKE michael@0: fi michael@0: fi michael@0: michael@0: case "$host_os" in michael@0: mingw*) michael@0: MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :) michael@0: ;; michael@0: *) michael@0: MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :) michael@0: ;; michael@0: esac michael@0: if test "$GMAKE" = ":"; then michael@0: AC_MSG_ERROR([GNU make not found]) michael@0: fi michael@0: michael@0: # MAKE will be set by client.mk, but still need this for standalone js builds michael@0: if test -z "$MAKE"; then michael@0: MAKE=$GMAKE michael@0: fi michael@0: michael@0: if test "$COMPILE_ENVIRONMENT"; then michael@0: michael@0: AC_PATH_XTRA michael@0: michael@0: XCFLAGS="$X_CFLAGS" michael@0: michael@0: fi # COMPILE_ENVIRONMENT michael@0: michael@0: dnl ======================================================== michael@0: dnl set the defaults first michael@0: dnl ======================================================== michael@0: AS_BIN=$AS michael@0: AR_LIST='$(AR) t' michael@0: AR_EXTRACT='$(AR) x' michael@0: AR_DELETE='$(AR) d' michael@0: AS='$(CC)' michael@0: AS_DASH_C_FLAG='-c' michael@0: DLL_PREFIX=lib michael@0: LIB_PREFIX=lib michael@0: DLL_SUFFIX=.so michael@0: OBJ_SUFFIX=o michael@0: LIB_SUFFIX=a michael@0: ASM_SUFFIX=s michael@0: IMPORT_LIB_SUFFIX= michael@0: TARGET_MD_ARCH=unix michael@0: DIRENT_INO=d_ino michael@0: MOZ_USER_DIR=".mozilla" michael@0: michael@0: MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib' michael@0: michael@0: MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)' michael@0: michael@0: USE_DEPENDENT_LIBS=1 michael@0: michael@0: _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2 michael@0: michael@0: if test -n "$CROSS_COMPILE"; then michael@0: OS_TARGET="${target_os}" michael@0: OS_ARCH=`echo $target_os | sed -e 's|/|_|g'` michael@0: OS_RELEASE= michael@0: case "${target_os}" in michael@0: linux*) OS_ARCH=Linux OS_TARGET=Linux ;; michael@0: kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU/kFreeBSD ;; michael@0: gnu*) OS_ARCH=GNU ;; michael@0: solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;; michael@0: mingw*) OS_ARCH=WINNT OS_TARGET=WINNT ;; michael@0: darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;; michael@0: dragonfly*) OS_ARCH=DragonFly OS_TARGET=DragonFly ;; michael@0: freebsd*) OS_ARCH=FreeBSD OS_TARGET=FreeBSD ;; michael@0: netbsd*) OS_ARCH=NetBSD OS_TARGET=NetBSD ;; michael@0: openbsd*) OS_ARCH=OpenBSD OS_TARGET=OpenBSD ;; michael@0: esac michael@0: case "${target}" in michael@0: *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;; michael@0: esac michael@0: else michael@0: OS_TARGET=`uname -s` michael@0: OS_ARCH=`uname -s | sed -e 's|/|_|g'` michael@0: OS_RELEASE=`uname -r` michael@0: fi michael@0: michael@0: # Before this used `uname -m` when not cross compiling michael@0: # but that breaks when you have a 64 bit kernel with a 32 bit userland. michael@0: OS_TEST="${target_cpu}" michael@0: michael@0: HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'` michael@0: michael@0: ####################################################################### michael@0: # Master "Core Components" macros for getting the OS target # michael@0: ####################################################################### michael@0: michael@0: # michael@0: # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no michael@0: # cross-compilation. michael@0: # michael@0: michael@0: # michael@0: # Define and override various archtecture-specific variables, including michael@0: # HOST_OS_ARCH michael@0: # OS_ARCH michael@0: # OS_TEST michael@0: # OS_TARGET michael@0: # OS_RELEASE michael@0: # OS_MINOR_RELEASE michael@0: # michael@0: michael@0: case "$HOST_OS_ARCH" in michael@0: mingw*) michael@0: HOST_OS_ARCH=WINNT michael@0: ;; michael@0: darwin*) michael@0: HOST_OS_ARCH=Darwin michael@0: ;; michael@0: linux*) michael@0: HOST_OS_ARCH=Linux michael@0: ;; michael@0: kfreebsd*-gnu) michael@0: HOST_OS_ARCH=GNU_kFreeBSD michael@0: ;; michael@0: gnu*) michael@0: HOST_OS_ARCH=GNU michael@0: ;; michael@0: dragonfly*) michael@0: HOST_OS_ARCH=DragonFly michael@0: ;; michael@0: freebsd*) michael@0: HOST_OS_ARCH=FreeBSD michael@0: ;; michael@0: netbsd*) michael@0: HOST_OS_ARCH=NetBSD michael@0: ;; michael@0: openbsd*) michael@0: HOST_OS_ARCH=OpenBSD michael@0: ;; michael@0: solaris*) michael@0: HOST_OS_ARCH=SunOS michael@0: SOLARIS_SUNPRO_CC= michael@0: SOLARIS_SUNPRO_CXX= michael@0: if test -z "$GNU_CC"; then michael@0: if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then michael@0: SOLARIS_SUNPRO_CC=1 michael@0: fi michael@0: fi michael@0: michael@0: if test -z "$GNU_CXX"; then michael@0: if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then michael@0: SOLARIS_SUNPRO_CXX=1 michael@0: fi michael@0: fi michael@0: AC_SUBST(SOLARIS_SUNPRO_CC) michael@0: AC_SUBST(SOLARIS_SUNPRO_CXX) michael@0: ;; michael@0: esac michael@0: michael@0: case "$OS_ARCH" in michael@0: WINNT) michael@0: if test -z "$CROSS_COMPILE" ; then michael@0: OS_TEST=`uname -p` michael@0: fi michael@0: ;; michael@0: Windows_NT) michael@0: # michael@0: # If uname -s returns "Windows_NT", we assume that we are using michael@0: # the uname.exe in MKS toolkit. michael@0: # michael@0: # The -r option of MKS uname only returns the major version number. michael@0: # So we need to use its -v option to get the minor version number. michael@0: # Moreover, it doesn't have the -p option, so we need to use uname -m. michael@0: # michael@0: OS_ARCH=WINNT michael@0: OS_TARGET=WINNT michael@0: OS_MINOR_RELEASE=`uname -v` michael@0: if test "$OS_MINOR_RELEASE" = "00"; then michael@0: OS_MINOR_RELEASE=0 michael@0: fi michael@0: OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}" michael@0: ;; michael@0: MINGW*_NT*) michael@0: # michael@0: # If uname -s returns MINGW32_NT-5.1, we assume that we are using michael@0: # the uname.exe in the MSYS tools. michael@0: # michael@0: OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'` michael@0: OS_ARCH=WINNT michael@0: OS_TARGET=WINNT michael@0: ;; michael@0: AIX) michael@0: OS_RELEASE=`uname -v`.`uname -r` michael@0: OS_TEST=${target_cpu} michael@0: if test -z "$GNU_CC"; then michael@0: if test "`$CC -qversion 2>&1 | egrep -c 'IBM XL'`" != "0"; then michael@0: AIX_IBM_XLC=1 michael@0: fi michael@0: fi michael@0: ;; michael@0: Darwin) michael@0: case "${target_cpu}" in michael@0: powerpc*) michael@0: OS_TEST=ppc michael@0: ;; michael@0: i*86*) michael@0: OS_TEST=i386 michael@0: ;; michael@0: x86_64) michael@0: OS_TEST=x86_64 michael@0: ;; michael@0: *) michael@0: if test -z "$CROSS_COMPILE" ; then michael@0: OS_TEST=`uname -p` michael@0: fi michael@0: ;; michael@0: esac michael@0: ;; michael@0: esac michael@0: michael@0: # Only set CPU_ARCH if we recognize the value of OS_TEST michael@0: michael@0: case "$OS_TEST" in michael@0: *86 | i86pc) michael@0: CPU_ARCH=x86 michael@0: ;; michael@0: michael@0: powerpc64 | ppc64 | powerpc64le | ppc64le) michael@0: CPU_ARCH=ppc64 michael@0: ;; michael@0: michael@0: powerpc | ppc | rs6000) michael@0: CPU_ARCH=ppc michael@0: ;; michael@0: michael@0: Alpha | alpha | ALPHA) michael@0: CPU_ARCH=Alpha michael@0: ;; michael@0: michael@0: s390) michael@0: CPU_ARCH=s390 michael@0: ;; michael@0: michael@0: s390x) michael@0: CPU_ARCH=s390x michael@0: ;; michael@0: michael@0: hppa* | parisc) michael@0: CPU_ARCH=hppa michael@0: ;; michael@0: michael@0: sun4u | sparc*) michael@0: CPU_ARCH=sparc michael@0: ;; michael@0: michael@0: x86_64 | ia64) michael@0: CPU_ARCH="$OS_TEST" michael@0: ;; michael@0: michael@0: arm*) michael@0: CPU_ARCH=arm michael@0: ;; michael@0: michael@0: mips|mipsel) michael@0: CPU_ARCH="mips" michael@0: ;; michael@0: michael@0: aarch64*) michael@0: CPU_ARCH=aarch64 michael@0: ;; michael@0: michael@0: esac michael@0: michael@0: if test -z "$OS_TARGET"; then michael@0: OS_TARGET=$OS_ARCH michael@0: fi michael@0: OS_CONFIG="${OS_TARGET}${OS_RELEASE}" michael@0: michael@0: dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64. michael@0: dnl =============================================================== michael@0: INTEL_ARCHITECTURE= michael@0: case "$OS_TEST" in michael@0: x86_64|i?86) michael@0: INTEL_ARCHITECTURE=1 michael@0: esac michael@0: michael@0: dnl Configure platform-specific CPU architecture compiler options. michael@0: dnl ============================================================== michael@0: MOZ_ARCH_OPTS michael@0: michael@0: dnl ================================================================= michael@0: dnl Set up and test static assertion macros used to avoid AC_TRY_RUN, michael@0: dnl which is bad when cross compiling. michael@0: dnl ================================================================= michael@0: if test "$COMPILE_ENVIRONMENT"; then michael@0: configure_static_assert_macros=' michael@0: #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__) michael@0: #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) michael@0: #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1] michael@0: ' michael@0: michael@0: dnl test that the macros actually work: michael@0: AC_MSG_CHECKING(that static assertion macros used in autoconf tests work) michael@0: AC_CACHE_VAL(ac_cv_static_assertion_macros_work, michael@0: [AC_LANG_SAVE michael@0: AC_LANG_C michael@0: ac_cv_static_assertion_macros_work="yes" michael@0: AC_TRY_COMPILE([$configure_static_assert_macros], michael@0: [CONFIGURE_STATIC_ASSERT(1)], michael@0: , michael@0: ac_cv_static_assertion_macros_work="no") michael@0: AC_TRY_COMPILE([$configure_static_assert_macros], michael@0: [CONFIGURE_STATIC_ASSERT(0)], michael@0: ac_cv_static_assertion_macros_work="no", michael@0: ) michael@0: AC_LANG_CPLUSPLUS michael@0: AC_TRY_COMPILE([$configure_static_assert_macros], michael@0: [CONFIGURE_STATIC_ASSERT(1)], michael@0: , michael@0: ac_cv_static_assertion_macros_work="no") michael@0: AC_TRY_COMPILE([$configure_static_assert_macros], michael@0: [CONFIGURE_STATIC_ASSERT(0)], michael@0: ac_cv_static_assertion_macros_work="no", michael@0: ) michael@0: AC_LANG_RESTORE michael@0: ]) michael@0: AC_MSG_RESULT("$ac_cv_static_assertion_macros_work") michael@0: if test "$ac_cv_static_assertion_macros_work" = "no"; then michael@0: AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.]) michael@0: fi michael@0: fi # COMPILE_ENVIRONMENT michael@0: michael@0: dnl ======================================================== michael@0: dnl Android libstdc++, placed here so it can use MOZ_ARCH michael@0: dnl computed above. michael@0: dnl ======================================================== michael@0: michael@0: MOZ_ANDROID_STLPORT michael@0: michael@0: dnl ======================================================== michael@0: dnl Suppress Clang Argument Warnings michael@0: dnl ======================================================== michael@0: if test -n "$CLANG_CC"; then michael@0: _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}" michael@0: CPPFLAGS="-Qunused-arguments ${CPPFLAGS}" michael@0: fi michael@0: if test -n "$CLANG_CXX"; then michael@0: _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}" michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = Use Address Sanitizer michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(address-sanitizer, michael@0: [ --enable-address-sanitizer Enable Address Sanitizer (default=no)], michael@0: MOZ_ASAN=1, michael@0: MOZ_ASAN= ) michael@0: if test -n "$MOZ_ASAN"; then michael@0: MOZ_LLVM_HACKS=1 michael@0: AC_DEFINE(MOZ_ASAN) michael@0: MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer) michael@0: fi michael@0: AC_SUBST(MOZ_ASAN) michael@0: AC_SUBST(LLVM_SYMBOLIZER) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable hacks required for LLVM instrumentations michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(llvm-hacks, michael@0: [ --enable-llvm-hacks Enable workarounds required for several LLVM instrumentations (default=no)], michael@0: MOZ_LLVM_HACKS=1, michael@0: MOZ_LLVM_HACKS= ) michael@0: if test -n "$MOZ_LLVM_HACKS"; then michael@0: MOZ_NO_WLZDEFS=1 michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl GNU specific defaults michael@0: dnl ======================================================== michael@0: if test "$GNU_CC"; then michael@0: # Per bug 719659 comment 2, some of the headers on ancient build machines michael@0: # may require gnu89 inline semantics. But otherwise, we use C99. michael@0: # But on OS X we just use C99 plus GNU extensions, in order to fix michael@0: # bug 917526. michael@0: CFLAGS="$CFLAGS -std=gnu99" michael@0: if test "${OS_ARCH}" != Darwin; then michael@0: CFLAGS="$CFLAGS -fgnu89-inline" michael@0: fi michael@0: MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(notdir $@) -o $@' michael@0: MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(notdir $@) -o $@' michael@0: DSO_LDOPTS='-shared' michael@0: if test "$GCC_USE_GNU_LD"; then michael@0: # Some tools like ASan use a runtime library that is only michael@0: # linked against executables, so we must allow undefined michael@0: # symbols for shared objects in some cases. michael@0: if test -z "$MOZ_NO_WLZDEFS"; then michael@0: # Don't allow undefined symbols in libraries michael@0: DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs" michael@0: fi michael@0: fi michael@0: WARNINGS_AS_ERRORS='-Werror' michael@0: DSO_CFLAGS='' michael@0: DSO_PIC_CFLAGS='-fPIC' michael@0: ASFLAGS="$ASFLAGS -fPIC" michael@0: AC_MSG_CHECKING([for --noexecstack option to as]) michael@0: _SAVE_CFLAGS=$CFLAGS michael@0: CFLAGS="$CFLAGS -Wa,--noexecstack" michael@0: AC_TRY_COMPILE(,,AC_MSG_RESULT([yes]) michael@0: [ASFLAGS="$ASFLAGS -Wa,--noexecstack"], michael@0: AC_MSG_RESULT([no])) michael@0: CFLAGS=$_SAVE_CFLAGS michael@0: AC_MSG_CHECKING([for -z noexecstack option to ld]) michael@0: _SAVE_LDFLAGS=$LDFLAGS michael@0: LDFLAGS="$LDFLAGS -Wl,-z,noexecstack" michael@0: AC_TRY_LINK(,,AC_MSG_RESULT([yes]), michael@0: AC_MSG_RESULT([no]) michael@0: LDFLAGS=$_SAVE_LDFLAGS) michael@0: michael@0: AC_MSG_CHECKING([for -z text option to ld]) michael@0: _SAVE_LDFLAGS=$LDFLAGS michael@0: LDFLAGS="$LDFLAGS -Wl,-z,text" michael@0: AC_TRY_LINK(,,AC_MSG_RESULT([yes]) michael@0: [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,text"], michael@0: AC_MSG_RESULT([no]) michael@0: LDFLAGS=$_SAVE_LDFLAGS) michael@0: michael@0: AC_MSG_CHECKING([for --build-id option to ld]) michael@0: _SAVE_LDFLAGS=$LDFLAGS michael@0: LDFLAGS="$LDFLAGS -Wl,--build-id" michael@0: AC_TRY_LINK(,,AC_MSG_RESULT([yes]) michael@0: [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,--build-id"], michael@0: AC_MSG_RESULT([no]) michael@0: LDFLAGS=$_SAVE_LDFLAGS) michael@0: michael@0: # Turn on GNU-specific warnings: michael@0: # -Wall - turn on a lot of warnings michael@0: # -Wpointer-arith - good to have michael@0: # -Wdeclaration-after-statement - MSVC doesn't like these michael@0: # -Werror=return-type - catches missing returns, zero false positives michael@0: # -Werror=int-to-pointer-cast - catches cast to pointer from integer of different size michael@0: # -Wtype-limits - catches overflow bugs, few false positives michael@0: # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives michael@0: # -Wsign-compare - catches comparison of signed and unsigned types michael@0: # michael@0: _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement" michael@0: MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type) michael@0: MOZ_C_SUPPORTS_WARNING(-W, error=int-to-pointer-cast, ac_c_has_werror_int_to_pointer_cast) michael@0: MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body) michael@0: MOZ_C_SUPPORTS_WARNING(-W, sign-compare, ac_c_has_sign_compare) michael@0: michael@0: # Turn off the following warnings that -Wall turns on: michael@0: # -Wno-unused - lots of violations in third-party code michael@0: # michael@0: _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused" michael@0: michael@0: if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then michael@0: # Don't use -Wcast-align with ICC or clang michael@0: case "$CPU_ARCH" in michael@0: # And don't use it on hppa, ia64, sparc, arm, since it's noisy there michael@0: hppa | ia64 | sparc | arm) michael@0: ;; michael@0: *) michael@0: _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align" michael@0: ;; michael@0: esac michael@0: fi michael@0: michael@0: _DEFINES_CFLAGS='-include $(DEPTH)/js/src/js-confdefs.h -DMOZILLA_CLIENT' michael@0: _USE_CPP_INCLUDE_FLAG=1 michael@0: michael@0: elif test "$SOLARIS_SUNPRO_CC"; then michael@0: DSO_CFLAGS='' michael@0: if test "$CPU_ARCH" = "sparc"; then michael@0: # for Sun Studio on Solaris/SPARC michael@0: DSO_PIC_CFLAGS='-xcode=pic32' michael@0: else michael@0: DSO_PIC_CFLAGS='-KPIC' michael@0: fi michael@0: _DEFINES_CFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT' michael@0: else michael@0: MKSHLIB='$(LD) $(DSO_LDOPTS) -h $(notdir $@) -o $@' michael@0: MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $(notdir $@) -o $@' michael@0: michael@0: DSO_LDOPTS='-shared' michael@0: if test "$GNU_LD"; then michael@0: # Don't allow undefined symbols in libraries michael@0: DSO_LDOPTS="$DSO_LDOPTS -z defs" michael@0: fi michael@0: michael@0: DSO_CFLAGS='' michael@0: DSO_PIC_CFLAGS='-KPIC' michael@0: _DEFINES_CFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT' michael@0: fi michael@0: michael@0: if test "$GNU_CXX"; then michael@0: # Turn on GNU-specific warnings: michael@0: # -Wall - turn on a lot of warnings michael@0: # -Wpointer-arith - good to have michael@0: # -Woverloaded-virtual - ??? michael@0: # -Werror=return-type - catches missing returns, zero false positives michael@0: # -Werror=int-to-pointer-cast - catches cast to pointer from integer of different size michael@0: # -Wtype-limits - catches overflow bugs, few false positives michael@0: # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives michael@0: # -Werror=conversion-null - catches conversions between NULL and non-pointer types michael@0: # -Wsign-compare - catches comparison of signed and unsigned types michael@0: # michael@0: _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual" michael@0: MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type) michael@0: MOZ_CXX_SUPPORTS_WARNING(-W, error=int-to-pointer-cast, ac_cxx_has_werror_int_to_pointer_cast) michael@0: MOZ_CXX_SUPPORTS_WARNING(-W, type-limits, ac_cxx_has_wtype_limits) michael@0: MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body) michael@0: MOZ_CXX_SUPPORTS_WARNING(-W, error=conversion-null, ac_cxx_has_werror_conversion_null) michael@0: MOZ_CXX_SUPPORTS_WARNING(-W, sign-compare, ac_cxx_has_sign_compare) michael@0: michael@0: # Turn off the following warnings that -Wall turns on: michael@0: # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently michael@0: # michael@0: MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof) michael@0: michael@0: if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then michael@0: # Don't use -Wcast-align with ICC or clang michael@0: case "$CPU_ARCH" in michael@0: # And don't use it on hppa, ia64, sparc, arm, since it's noisy there michael@0: hppa | ia64 | sparc | arm) michael@0: ;; michael@0: *) michael@0: _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align" michael@0: ;; michael@0: esac michael@0: fi michael@0: michael@0: _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/js/src/js-confdefs.h' michael@0: _USE_CPP_INCLUDE_FLAG=1 michael@0: michael@0: # Recent clang and gcc support C++11 deleted functions without warnings if michael@0: # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new michael@0: # versions). We can't use -std=c++0x yet, so gcc's support must remain michael@0: # unused. But clang's warning can be disabled, so when compiling with clang michael@0: # we use it to opt out of the warning, enabling (macro-encapsulated) use of michael@0: # deleted function syntax. michael@0: if test "$CLANG_CXX"; then michael@0: _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions" michael@0: MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof) michael@0: fi michael@0: michael@0: else michael@0: _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_JS_CONFDEFS_H_ $(ACDEFINES)' michael@0: fi michael@0: michael@0: dnl gcc can come with its own linker so it is better to use the pass-thru calls michael@0: dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object michael@0: dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to michael@0: dnl normal behavior. michael@0: dnl ======================================================== michael@0: MKSHLIB_FORCE_ALL= michael@0: MKSHLIB_UNFORCE_ALL= michael@0: michael@0: if test "$COMPILE_ENVIRONMENT"; then michael@0: if test "$GNU_CC"; then michael@0: AC_MSG_CHECKING(whether ld has archive extraction flags) michael@0: AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce, michael@0: [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS michael@0: ac_cv_mkshlib_force_and_unforce="no" michael@0: exec 3<&0 < implementation michael@0: dnl ======================================================== michael@0: AC_MSG_CHECKING(for custom implementation) michael@0: if test "$MOZ_CUSTOM_INTTYPES_H"; then michael@0: AC_DEFINE_UNQUOTED(MOZ_CUSTOM_INTTYPES_H, "$MOZ_CUSTOM_INTTYPES_H") michael@0: AC_MSG_RESULT(using $MOZ_CUSTOM_INTTYPES_H) michael@0: else michael@0: AC_MSG_RESULT(none specified) michael@0: fi michael@0: michael@0: MOZ_DOING_LTO(lto_is_enabled) michael@0: michael@0: dnl ======================================================== michael@0: dnl System overrides of the defaults for target michael@0: dnl ======================================================== michael@0: michael@0: case "$target" in michael@0: *-aix*) michael@0: AC_DEFINE(AIX) michael@0: if test ! "$GNU_CC"; then michael@0: if test ! "$HAVE_64BIT_OS"; then michael@0: # Compiling with Visual Age C++ object model compat is the michael@0: # default. To compile with object model ibm, add michael@0: # AIX_OBJMODEL=ibm to .mozconfig. michael@0: if test "$AIX_OBJMODEL" = "ibm"; then michael@0: CXXFLAGS="$CXXFLAGS -qobjmodel=ibm" michael@0: else michael@0: AIX_OBJMODEL=compat michael@0: fi michael@0: else michael@0: AIX_OBJMODEL=compat michael@0: fi michael@0: AC_SUBST(AIX_OBJMODEL) michael@0: DSO_LDOPTS='-qmkshrobj=1' michael@0: DSO_CFLAGS='-qflag=w:w' michael@0: DSO_PIC_CFLAGS= michael@0: LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib" michael@0: MOZ_FIX_LINK_PATHS= michael@0: MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@' michael@0: MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@' michael@0: if test "$COMPILE_ENVIRONMENT"; then michael@0: AC_LANG_SAVE michael@0: AC_LANG_CPLUSPLUS michael@0: AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7]) michael@0: AC_TRY_COMPILE([], michael@0: [#if (__IBMCPP__ < 900) michael@0: #error "Bad compiler" michael@0: #endif], michael@0: _BAD_COMPILER=,_BAD_COMPILER=1) michael@0: if test -n "$_BAD_COMPILER"; then michael@0: AC_MSG_RESULT([no]) michael@0: AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.]) michael@0: else michael@0: AC_MSG_RESULT([yes]) michael@0: fi michael@0: AC_LANG_RESTORE michael@0: TARGET_COMPILER_ABI="ibmc" michael@0: CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'` michael@0: CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'` michael@0: fi michael@0: fi michael@0: case "${target_os}" in michael@0: aix4.1*) michael@0: DLL_SUFFIX='_shr.a' michael@0: ;; michael@0: esac michael@0: if test "$COMPILE_ENVIRONMENT"; then michael@0: MOZ_CHECK_HEADERS(sys/inttypes.h) michael@0: fi michael@0: AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES) michael@0: ;; michael@0: michael@0: *-darwin*) michael@0: MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@' michael@0: MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@' michael@0: MOZ_OPTIMIZE_FLAGS="-O3 -fno-stack-protector" michael@0: CFLAGS="$CFLAGS -fno-common" michael@0: CXXFLAGS="$CXXFLAGS -fno-common" michael@0: DLL_SUFFIX=".dylib" michael@0: DSO_LDOPTS='' michael@0: STRIP="$STRIP -x -S" michael@0: _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa' michael@0: TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"' michael@0: LDFLAGS="$LDFLAGS -lobjc" michael@0: # The ExceptionHandling framework is needed for Objective-C exception michael@0: # logging code in nsObjCExceptions.h. Currently we only use that in debug michael@0: # builds. michael@0: _SAVE_LDFLAGS=$LDFLAGS michael@0: AC_MSG_CHECKING([for -framework ExceptionHandling]) michael@0: LDFLAGS="$LDFLAGS -framework ExceptionHandling" michael@0: AC_TRY_LINK(,[return 0;], michael@0: ac_cv_have_framework_exceptionhandling="yes", michael@0: ac_cv_have_framework_exceptionhandling="no") michael@0: AC_MSG_RESULT([$ac_cv_have_framework_exceptionhandling]) michael@0: if test "$ac_cv_have_framework_exceptionhandling" = "yes"; then michael@0: MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"; michael@0: fi michael@0: LDFLAGS=$_SAVE_LDFLAGS michael@0: michael@0: if test "x$lto_is_enabled" = "xyes"; then michael@0: echo "Skipping -dead_strip because lto is enabled." michael@0: dnl DTrace and -dead_strip don't interact well. See bug 403132. michael@0: dnl =================================================================== michael@0: elif test "x$enable_dtrace" = "xyes"; then michael@0: echo "Skipping -dead_strip because DTrace is enabled. See bug 403132." michael@0: else michael@0: dnl check for the presence of the -dead_strip linker flag michael@0: AC_MSG_CHECKING([for -dead_strip option to ld]) michael@0: _SAVE_LDFLAGS=$LDFLAGS michael@0: LDFLAGS="$LDFLAGS -Wl,-dead_strip" michael@0: AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=) michael@0: if test -n "$_HAVE_DEAD_STRIP" ; then michael@0: AC_MSG_RESULT([yes]) michael@0: MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip" michael@0: else michael@0: AC_MSG_RESULT([no]) michael@0: fi michael@0: michael@0: LDFLAGS=$_SAVE_LDFLAGS michael@0: fi michael@0: MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin' michael@0: ;; michael@0: michael@0: ia64*-hpux*) michael@0: DLL_SUFFIX=".so" michael@0: if test ! "$GNU_CC"; then michael@0: DSO_LDOPTS='-b' michael@0: DSO_CFLAGS="" michael@0: DSO_PIC_CFLAGS= michael@0: MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@' michael@0: MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@' michael@0: CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on" michael@0: else michael@0: DSO_LDOPTS='-b -E' michael@0: MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@' michael@0: MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@' michael@0: fi michael@0: MOZ_FIX_LINK_PATHS= michael@0: AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES) michael@0: AC_DEFINE(_LARGEFILE64_SOURCE) michael@0: ;; michael@0: michael@0: *-hpux*) michael@0: DLL_SUFFIX=".sl" michael@0: if test ! "$GNU_CC"; then michael@0: DSO_LDOPTS='-b -Wl,+s' michael@0: DSO_CFLAGS="" michael@0: DSO_PIC_CFLAGS="+Z" michael@0: MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@' michael@0: MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@' michael@0: CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on" michael@0: else michael@0: DSO_LDOPTS='-b -E +s' michael@0: MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@' michael@0: MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@' michael@0: fi michael@0: MOZ_POST_PROGRAM_COMMAND='chatr +s enable' michael@0: AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES) michael@0: ;; michael@0: michael@0: *-android*|*-linuxandroid*) michael@0: AC_DEFINE(NO_PW_GECOS) michael@0: no_x=yes michael@0: _PLATFORM_DEFAULT_TOOLKIT=cairo-android michael@0: TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"' michael@0: michael@0: MOZ_GFX_OPTIMIZE_MOBILE=1 michael@0: MOZ_OPTIMIZE_FLAGS="-O3 -freorder-blocks -fno-reorder-functions" michael@0: # The Maemo builders don't know about this flag michael@0: MOZ_ARM_VFP_FLAGS="-mfpu=vfp" michael@0: ;; michael@0: michael@0: *-*linux*) michael@0: # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler. michael@0: # Similarly for GNU_CXX and INTEL_CXX. michael@0: if test "$INTEL_CC" -o "$INTEL_CXX"; then michael@0: # -Os has been broken on Intel's C/C++ compilers for quite a michael@0: # while; Intel recommends against using it. michael@0: MOZ_OPTIMIZE_FLAGS="-O2" michael@0: elif test "$GNU_CC" -o "$GNU_CXX"; then michael@0: case $GCC_VERSION in michael@0: 4.5.*) michael@0: # -Os is broken on gcc 4.5.x we need to tweak it to get good results. michael@0: MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50" michael@0: esac michael@0: MOZ_PGO_OPTIMIZE_FLAGS="-O3" michael@0: MOZ_OPTIMIZE_FLAGS="-O3 -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK" michael@0: fi michael@0: michael@0: TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"' michael@0: michael@0: case "${target_cpu}" in michael@0: alpha*) michael@0: CFLAGS="$CFLAGS -mieee" michael@0: CXXFLAGS="$CXXFLAGS -mieee" michael@0: ;; michael@0: esac michael@0: michael@0: if test -z "$MC"; then michael@0: MC=mc.exe michael@0: fi michael@0: ;; michael@0: michael@0: *-mingw*) michael@0: DSO_CFLAGS= michael@0: DSO_PIC_CFLAGS= michael@0: DLL_SUFFIX=.dll michael@0: RC=rc.exe michael@0: MC=mc.exe michael@0: if test -n "$GNU_CC" -o -n "$CLANG_CC"; then michael@0: CC="$CC -mwindows" michael@0: CXX="$CXX -mwindows" michael@0: CPP="$CPP -mwindows" michael@0: CFLAGS="$CFLAGS -mms-bitfields" michael@0: CXXFLAGS="$CXXFLAGS -mms-bitfields" michael@0: DSO_LDOPTS='-shared' michael@0: MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@' michael@0: MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@' michael@0: RC='$(WINDRES)' michael@0: # Use static libgcc and libstdc++ michael@0: LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++" michael@0: # Use temp file for windres (bug 213281) michael@0: RCFLAGS='-O coff --use-temp-file' michael@0: # mingw doesn't require kernel32, user32, and advapi32 explicitly michael@0: LIBS="$LIBS -lgdi32 -lwinmm -lwsock32 -lpsapi" michael@0: MOZ_FIX_LINK_PATHS= michael@0: DLL_PREFIX= michael@0: IMPORT_LIB_SUFFIX=dll.a michael@0: michael@0: # We use mix of both POSIX and Win32 printf format across the tree, so format michael@0: # warnings are useless on mingw. michael@0: MOZ_C_SUPPORTS_WARNING(-Wno-, format, ac_c_has_wno_format) michael@0: MOZ_CXX_SUPPORTS_WARNING(-Wno-, format, ac_cxx_has_wno_format) michael@0: else michael@0: TARGET_COMPILER_ABI=msvc michael@0: HOST_CC='$(CC)' michael@0: HOST_CXX='$(CXX)' michael@0: HOST_LD='$(LD)' michael@0: if test "$AS_BIN"; then michael@0: AS="$(basename "$AS_BIN")" michael@0: fi michael@0: AR='lib' michael@0: AR_FLAGS='-NOLOGO -OUT:$@' michael@0: AR_EXTRACT= michael@0: RANLIB='echo not_ranlib' michael@0: STRIP='echo not_strip' michael@0: PKG_SKIP_STRIP=1 michael@0: XARGS=xargs michael@0: DOXYGEN=: michael@0: ASM_SUFFIX=asm michael@0: OBJ_SUFFIX=obj michael@0: LIB_SUFFIX=lib michael@0: DLL_PREFIX= michael@0: LIB_PREFIX= michael@0: IMPORT_LIB_SUFFIX=lib michael@0: MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)' michael@0: MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)' michael@0: MKSHLIB_FORCE_ALL= michael@0: MKSHLIB_UNFORCE_ALL= michael@0: DSO_LDOPTS=-SUBSYSTEM:WINDOWS michael@0: _USE_CPP_INCLUDE_FLAG=1 michael@0: _DEFINES_CFLAGS='-FI $(DEPTH)/js/src/js-confdefs.h -DMOZILLA_CLIENT' michael@0: _DEFINES_CXXFLAGS='-FI $(DEPTH)/js/src/js-confdefs.h -DMOZILLA_CLIENT' michael@0: CFLAGS="$CFLAGS -W3 -Gy" michael@0: CXXFLAGS="$CXXFLAGS -W3 -Gy" michael@0: if test "$_CC_SUITE" -ge "12"; then michael@0: dnl VS2013+ requires -FS when parallel building by make -jN. michael@0: dnl If nothing, compiler sometimes causes C1041 error. michael@0: dnl michael@0: dnl Visual Studio 2013 supports -Gw flags michael@0: dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx michael@0: CFLAGS="$CFLAGS -FS -Gw" michael@0: CXXFLAGS="$CXXFLAGS -FS -Gw" michael@0: fi michael@0: # khuey says we can safely ignore MSVC warning C4251 michael@0: # MSVC warning C4244 (implicit type conversion may lose data) warns michael@0: # and requires workarounds for perfectly valid code. Also, GCC/clang michael@0: # don't warn about it by default. So for consistency/sanity, we turn michael@0: # it off on MSVC, too. michael@0: CFLAGS="$CFLAGS -wd4244" michael@0: CXXFLAGS="$CXXFLAGS -wd4244 -wd4251" michael@0: # make 'foo == bar;' error out michael@0: CFLAGS="$CFLAGS -we4553" michael@0: CXXFLAGS="$CXXFLAGS -we4553" michael@0: LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib psapi.lib" michael@0: MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV' michael@0: WARNINGS_AS_ERRORS='-WX' michael@0: MOZ_OPTIMIZE_FLAGS="-O2" michael@0: MOZ_FIX_LINK_PATHS= michael@0: MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)' michael@0: LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT" michael@0: if test -z "$DEVELOPER_OPTIONS"; then michael@0: LDFLAGS="$LDFLAGS -RELEASE" michael@0: fi michael@0: dnl For profile-guided optimization michael@0: PROFILE_GEN_CFLAGS="-GL" michael@0: PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT" michael@0: dnl XXX: PGO builds can fail with warnings treated as errors, michael@0: dnl specifically "no profile data available" appears to be michael@0: dnl treated as an error sometimes. This might be a consequence michael@0: dnl of using WARNINGS_AS_ERRORS in some modules, combined michael@0: dnl with the linker doing most of the work in the whole-program michael@0: dnl optimization/PGO case. I think it's probably a compiler bug, michael@0: dnl but we work around it here. michael@0: PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952" michael@0: dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul. michael@0: dnl Probably also a compiler bug, but what can you do? michael@0: PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE" michael@0: LDFLAGS="$LDFLAGS -DYNAMICBASE" michael@0: fi michael@0: AC_DEFINE(HAVE_SNPRINTF) michael@0: AC_DEFINE(_WINDOWS) michael@0: AC_DEFINE(WIN32) michael@0: AC_DEFINE(XP_WIN) michael@0: AC_DEFINE(XP_WIN32) michael@0: AC_DEFINE(HW_THREADS) michael@0: AC_DEFINE(STDC_HEADERS) michael@0: AC_DEFINE(WIN32_LEAN_AND_MEAN) michael@0: TARGET_MD_ARCH=win32 michael@0: _PLATFORM_DEFAULT_TOOLKIT='cairo-windows' michael@0: BIN_SUFFIX='.exe' michael@0: MOZ_USER_DIR="Mozilla" michael@0: michael@0: dnl Hardcode to win95 for now - cls michael@0: TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"' michael@0: michael@0: dnl set NO_X11 defines here as the general check is skipped on win32 michael@0: no_x=yes michael@0: AC_DEFINE(NO_X11) michael@0: michael@0: case "$host" in michael@0: *-mingw*) michael@0: MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W` michael@0: ;; michael@0: esac michael@0: michael@0: case "$host" in michael@0: *-mingw*) michael@0: if test -z "$MOZ_TOOLS"; then michael@0: AC_MSG_ERROR([MOZ_TOOLS is not set]) michael@0: fi michael@0: MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W` michael@0: if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then michael@0: AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS]) michael@0: fi michael@0: MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)" michael@0: if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then michael@0: AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.]) michael@0: fi michael@0: ;; michael@0: esac michael@0: michael@0: case "$host_os" in michael@0: cygwin*|msvc*|mks*) michael@0: 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.]) michael@0: ;; michael@0: esac michael@0: michael@0: case "$target" in michael@0: i*86-*) michael@0: if test "$HAVE_64BIT_OS"; then michael@0: AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.]) michael@0: fi michael@0: michael@0: if test -n "$GNU_CC"; then michael@0: CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport" michael@0: CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport" michael@0: LDFLAGS="$LDFLAGS -Wl,--large-address-aware" michael@0: else michael@0: DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86" michael@0: LDFLAGS="$LDFLAGS -SAFESEH" michael@0: fi michael@0: michael@0: AC_DEFINE(_X86_) michael@0: ;; michael@0: x86_64-*) michael@0: if test -n "$_WIN32_MSVC"; then michael@0: DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64" michael@0: fi michael@0: AC_DEFINE(_AMD64_) michael@0: ;; michael@0: *) michael@0: AC_DEFINE(_CPU_ARCH_NOT_DEFINED) michael@0: ;; michael@0: esac michael@0: ;; michael@0: michael@0: *-netbsd*) michael@0: DSO_CFLAGS='' michael@0: CFLAGS="$CFLAGS -Dunix" michael@0: CXXFLAGS="$CXXFLAGS -Dunix" michael@0: if $CC -E - -dM /dev/null; then michael@0: DLL_SUFFIX=".so" michael@0: DSO_PIC_CFLAGS='-fPIC -DPIC' michael@0: DSO_LDOPTS='-shared' michael@0: BIN_FLAGS='-Wl,--export-dynamic' michael@0: else michael@0: DSO_PIC_CFLAGS='-fPIC -DPIC' michael@0: DLL_SUFFIX=".so.1.0" michael@0: DSO_LDOPTS='-shared' michael@0: fi michael@0: # This will fail on a.out systems prior to 1.5.1_ALPHA. michael@0: MKSHLIB_FORCE_ALL='-Wl,--whole-archive' michael@0: MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive' michael@0: if test "$LIBRUNPATH"; then michael@0: DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS" michael@0: fi michael@0: MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(notdir $@) -o $@' michael@0: MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(notdir $@) -o $@' michael@0: ;; michael@0: michael@0: *-openbsd*) michael@0: DLL_SUFFIX=".so.1.0" michael@0: DSO_CFLAGS='' michael@0: DSO_PIC_CFLAGS='-fPIC' michael@0: DSO_LDOPTS='-shared -fPIC' michael@0: if test "$LIBRUNPATH"; then michael@0: DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS" michael@0: fi michael@0: ;; michael@0: michael@0: *-solaris*) michael@0: AC_DEFINE(SOLARIS) michael@0: TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"' michael@0: if test -z "$CROSS_COMPILE" && pkginfo -q SUNWpr && pkginfo -q SUNWprd; then michael@0: NO_NSPR_CONFIG_SYSTEM_LDFLAGS="-L/usr/lib/mps -R/usr/lib/mps -lnspr4" michael@0: NO_NSPR_CONFIG_SYSTEM_CFLAGS="-I/usr/include/mps" michael@0: NO_NSPR_CONFIG_SYSTEM_VERSION=["`pkgparam SUNWpr SUNW_PRODVERS | sed -e 's/^[1-9][0-9]*\.[0-9][0-9]*$/&.0/'`"] michael@0: fi michael@0: MOZ_FIX_LINK_PATHS= michael@0: # $ORIGIN/.. is for shared libraries under components/ to locate shared michael@0: # libraries one level up (e.g. libnspr4.so) michael@0: if test "$SOLARIS_SUNPRO_CC"; then michael@0: LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs" michael@0: LIBS="-lCrun -lCstd -lc $LIBS" michael@0: AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES) michael@0: CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__" michael@0: CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef" michael@0: LDFLAGS="-xildoff $LDFLAGS" michael@0: if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then michael@0: _SAVE_LDFLAGS=$LDFLAGS michael@0: LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" michael@0: AC_TRY_LINK([#include ], michael@0: [printf("Hello World\n");], michael@0: , michael@0: [LDFLAGS=$_SAVE_LDFLAGS]) michael@0: fi michael@0: MOZ_OPTIMIZE_FLAGS="-xO4" michael@0: MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(notdir $@) -o $@' michael@0: MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(notdir $@) -o $@' michael@0: MKSHLIB_FORCE_ALL='-z allextract' michael@0: MKSHLIB_UNFORCE_ALL='-z defaultextract' michael@0: DSO_LDOPTS='-G' michael@0: AR_LIST="$AR t" michael@0: AR_EXTRACT="$AR x" michael@0: AR_DELETE="$AR d" michael@0: AR='$(CXX) -xar' michael@0: AR_FLAGS='-o $@' michael@0: AS='/usr/ccs/bin/as' michael@0: ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0" michael@0: AS_DASH_C_FLAG='' michael@0: TARGET_COMPILER_ABI="sunc" michael@0: CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'` michael@0: CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'` michael@0: AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9]) michael@0: AC_LANG_SAVE michael@0: AC_LANG_CPLUSPLUS michael@0: AC_TRY_COMPILE([], michael@0: [#if (__SUNPRO_CC < 0x590) michael@0: #error "Denied" michael@0: #endif], michael@0: _BAD_COMPILER=,_BAD_COMPILER=1) michael@0: if test -n "$_BAD_COMPILER"; then michael@0: _res="no" michael@0: AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .]) michael@0: else michael@0: _res="yes" michael@0: fi michael@0: AC_TRY_COMPILE([], michael@0: [#if (__SUNPRO_CC >= 0x5100) michael@0: #error "Sun C++ 5.10 or above" michael@0: #endif], michael@0: _ABOVE_SS12U1=,_ABOVE_SS12U1=1) michael@0: if test "$_ABOVE_SS12U1"; then michael@0: # disable xannotate michael@0: CXXFLAGS="$CXXFLAGS -xannotate=no" michael@0: fi michael@0: AC_MSG_RESULT([$_res]) michael@0: AC_LANG_RESTORE michael@0: else michael@0: LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs" michael@0: LIBS="-lc $LIBS" michael@0: MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract' michael@0: MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract' michael@0: ASFLAGS="$ASFLAGS -fPIC" michael@0: DSO_LDOPTS='-shared' michael@0: WARNINGS_AS_ERRORS='-Werror' michael@0: _WARNINGS_CFLAGS='' michael@0: _WARNINGS_CXXFLAGS='' michael@0: if test "$OS_RELEASE" = "5.3"; then michael@0: AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES) michael@0: fi michael@0: fi michael@0: if test "$OS_RELEASE" = "5.5.1"; then michael@0: AC_DEFINE(NEED_USLEEP_PROTOTYPE) michael@0: fi michael@0: ;; michael@0: michael@0: *-sunos*) michael@0: DSO_LDOPTS='-Bdynamic' michael@0: MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@' michael@0: MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@' michael@0: AC_DEFINE(SUNOS4) michael@0: AC_DEFINE(SPRINTF_RETURNS_STRING) michael@0: case "$(target_os)" in michael@0: sunos4.1*) michael@0: DLL_SUFFIX='.so.1.0' michael@0: ;; michael@0: esac michael@0: ;; michael@0: michael@0: esac michael@0: michael@0: dnl Only one oddball right now (QNX), but this gives us flexibility michael@0: dnl if any other platforms need to override this in the future. michael@0: AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO) michael@0: michael@0: dnl ======================================================== michael@0: dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined michael@0: dnl by now will not have any way to link most binaries (tests michael@0: dnl as well as viewer, apprunner, etc.), because some symbols michael@0: dnl will be left out of the "composite" .so's by ld as unneeded. michael@0: dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms, michael@0: dnl they can link in the static libs that provide the missing michael@0: dnl symbols. michael@0: dnl ======================================================== michael@0: NO_LD_ARCHIVE_FLAGS= michael@0: if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then michael@0: NO_LD_ARCHIVE_FLAGS=1 michael@0: fi michael@0: case "$target" in michael@0: *-aix4.3*|*-aix5*) michael@0: NO_LD_ARCHIVE_FLAGS= michael@0: ;; michael@0: *-mingw*) michael@0: if test -z "$GNU_CC"; then michael@0: NO_LD_ARCHIVE_FLAGS= michael@0: fi michael@0: ;; michael@0: esac michael@0: AC_SUBST(NO_LD_ARCHIVE_FLAGS) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Flags to strip unused symbols from .so components michael@0: dnl ======================================================== michael@0: case "$target" in michael@0: *-linux*|*-kfreebsd*-gnu|*-gnu*) michael@0: MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script' michael@0: ;; michael@0: *-solaris*) michael@0: if test -z "$GNU_CC"; then michael@0: MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile' michael@0: else michael@0: if test -z "$GCC_USE_GNU_LD"; then michael@0: MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile' michael@0: else michael@0: MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script' michael@0: fi michael@0: fi michael@0: ;; michael@0: *-darwin*) michael@0: MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list' michael@0: ;; michael@0: *-mingw*) michael@0: if test -n "$GNU_CC"; then michael@0: MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script' michael@0: fi michael@0: ;; michael@0: esac michael@0: michael@0: if test -z "$COMPILE_ENVIRONMENT"; then michael@0: SKIP_COMPILER_CHECKS=1 michael@0: SKIP_LIBRARY_CHECKS=1 michael@0: fi michael@0: michael@0: dnl Configure JIT support michael@0: michael@0: case "$target" in michael@0: i?86-*) michael@0: ENABLE_ION=1 michael@0: ENABLE_YARR_JIT=1 michael@0: AC_DEFINE(JS_CPU_X86) michael@0: AC_DEFINE(JS_NUNBOX32) michael@0: ;; michael@0: x86_64*-*) michael@0: ENABLE_ION=1 michael@0: ENABLE_YARR_JIT=1 michael@0: AC_DEFINE(JS_CPU_X64) michael@0: AC_DEFINE(JS_PUNBOX64) michael@0: ;; michael@0: arm*-*) michael@0: ENABLE_ION=1 michael@0: ENABLE_YARR_JIT=1 michael@0: AC_DEFINE(JS_CPU_ARM) michael@0: AC_DEFINE(JS_NUNBOX32) michael@0: ;; michael@0: sparc*-*) michael@0: if test ! "$HAVE_64BIT_OS" ; then michael@0: dnl ENABLE_ION=0 michael@0: AC_DEFINE(JS_CPU_SPARC) michael@0: AC_DEFINE(JS_NUNBOX32) michael@0: fi michael@0: ;; michael@0: mips*-*) michael@0: AC_DEFINE(JS_CPU_MIPS) michael@0: AC_DEFINE(JS_NUNBOX32) michael@0: ;; michael@0: esac michael@0: michael@0: MOZ_ARG_DISABLE_BOOL(ion, michael@0: [ --disable-ion Disable use of the IonMonkey JIT], michael@0: ENABLE_ION= ) michael@0: michael@0: MOZ_ARG_DISABLE_BOOL(yarr-jit, michael@0: [ --disable-yarr-jit Disable YARR JIT support], michael@0: ENABLE_YARR_JIT= ) michael@0: michael@0: AC_SUBST(ENABLE_METHODJIT_SPEW) michael@0: michael@0: AC_SUBST(ENABLE_ION) michael@0: michael@0: if test "$ENABLE_ION"; then michael@0: AC_DEFINE(JS_ION) michael@0: fi michael@0: michael@0: AC_SUBST(ENABLE_YARR_JIT) michael@0: michael@0: if test "$ENABLE_YARR_JIT"; then michael@0: AC_DEFINE(ENABLE_YARR_JIT) michael@0: fi michael@0: michael@0: if test -n "$COMPILE_ENVIRONMENT"; then michael@0: MOZ_COMPILER_OPTS michael@0: fi michael@0: michael@0: if test -z "$SKIP_COMPILER_CHECKS"; then michael@0: dnl Checks for typedefs, structures, and compiler characteristics. michael@0: dnl ======================================================== michael@0: AC_HEADER_STDC michael@0: AC_C_CONST michael@0: AC_TYPE_MODE_T michael@0: AC_TYPE_OFF_T michael@0: AC_TYPE_PID_T michael@0: AC_TYPE_SIZE_T michael@0: AC_LANG_CPLUSPLUS michael@0: AC_LANG_C michael@0: AC_MSG_CHECKING(for ssize_t) michael@0: AC_CACHE_VAL(ac_cv_type_ssize_t, michael@0: [AC_TRY_COMPILE([#include michael@0: #include ], michael@0: [ssize_t foo = 0;], michael@0: [ac_cv_type_ssize_t=true], michael@0: [ac_cv_type_ssize_t=false])]) michael@0: if test "$ac_cv_type_ssize_t" = true ; then michael@0: AC_DEFINE(HAVE_SSIZE_T) michael@0: AC_MSG_RESULT(yes) michael@0: else michael@0: AC_MSG_RESULT(no) michael@0: fi michael@0: AC_STRUCT_ST_BLKSIZE michael@0: AC_MSG_CHECKING(for siginfo_t) michael@0: AC_CACHE_VAL(ac_cv_siginfo_t, michael@0: [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L michael@0: #include ], michael@0: [siginfo_t* info;], michael@0: [ac_cv_siginfo_t=true], michael@0: [ac_cv_siginfo_t=false])]) michael@0: if test "$ac_cv_siginfo_t" = true ; then michael@0: AC_DEFINE(HAVE_SIGINFO_T) michael@0: AC_MSG_RESULT(yes) michael@0: else michael@0: AC_MSG_RESULT(no) michael@0: fi michael@0: michael@0: MOZ_CHECK_HEADERS(endian.h) michael@0: if test "$ac_cv_header_endian_h" = yes; then michael@0: AC_DEFINE(JS_HAVE_ENDIAN_H) michael@0: fi michael@0: michael@0: MOZ_CHECK_HEADERS([machine/endian.h],[],[],[#include ]) michael@0: if test "$ac_cv_header_machine_endian_h" = yes; then michael@0: AC_DEFINE(JS_HAVE_MACHINE_ENDIAN_H) michael@0: fi michael@0: michael@0: MOZ_CHECK_HEADERS(sys/isa_defs.h) michael@0: if test "$ac_cv_header_sys_isa_defs_h" = yes; then michael@0: AC_DEFINE(JS_HAVE_SYS_ISA_DEFS_H) michael@0: fi michael@0: michael@0: AC_LANG_CPLUSPLUS michael@0: michael@0: MOZ_CXX11 michael@0: michael@0: dnl Check for .hidden assembler directive and visibility attribute. michael@0: dnl Borrowed from glibc configure.in michael@0: dnl =============================================================== michael@0: if test "$GNU_CC"; then michael@0: AC_CACHE_CHECK(for visibility(hidden) attribute, michael@0: ac_cv_visibility_hidden, michael@0: [cat > conftest.c </dev/null 2>&1; then michael@0: if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then michael@0: ac_cv_visibility_hidden=yes michael@0: fi michael@0: fi michael@0: rm -f conftest.[cs] michael@0: ]) michael@0: if test "$ac_cv_visibility_hidden" = "yes"; then michael@0: AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE) michael@0: michael@0: AC_CACHE_CHECK(for visibility(default) attribute, michael@0: ac_cv_visibility_default, michael@0: [cat > conftest.c </dev/null 2>&1; then michael@0: if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then michael@0: ac_cv_visibility_default=yes michael@0: fi michael@0: fi michael@0: rm -f conftest.[cs] michael@0: ]) michael@0: if test "$ac_cv_visibility_default" = "yes"; then michael@0: AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE) michael@0: michael@0: AC_CACHE_CHECK(for visibility pragma support, michael@0: ac_cv_visibility_pragma, michael@0: [cat > conftest.c </dev/null 2>&1; then michael@0: if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then michael@0: if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then michael@0: ac_cv_visibility_pragma=yes michael@0: fi michael@0: fi michael@0: fi michael@0: rm -f conftest.[cs] michael@0: ]) michael@0: if test "$ac_cv_visibility_pragma" = "yes"; then michael@0: AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905), michael@0: ac_cv_have_visibility_class_bug, michael@0: [cat > conftest.c < /dev/null 2>&1 ; then michael@0: ac_cv_have_visibility_class_bug=yes michael@0: else michael@0: if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then michael@0: ac_cv_have_visibility_class_bug=yes michael@0: fi michael@0: fi michael@0: rm -rf conftest.{c,S} michael@0: ]) michael@0: michael@0: AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297), michael@0: ac_cv_have_visibility_builtin_bug, michael@0: [cat > conftest.c < michael@0: #pragma GCC visibility pop michael@0: michael@0: __attribute__ ((visibility ("default"))) void Func() { michael@0: char c[[100]]; michael@0: memset(c, 0, sizeof(c)); michael@0: } michael@0: EOF michael@0: ac_cv_have_visibility_builtin_bug=no michael@0: if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then michael@0: ac_cv_have_visibility_builtin_bug=yes michael@0: else michael@0: if test `grep -c "@PLT" conftest.S` = 0; then michael@0: ac_cv_visibility_builtin_bug=yes michael@0: fi michael@0: fi michael@0: rm -f conftest.{c,S} michael@0: ]) michael@0: if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \ michael@0: "$ac_cv_have_visibility_class_bug" = "no"; then michael@0: VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h' michael@0: WRAP_SYSTEM_INCLUDES=1 michael@0: else michael@0: VISIBILITY_FLAGS='-fvisibility=hidden' michael@0: fi # have visibility pragma bug michael@0: fi # have visibility pragma michael@0: fi # have visibility(default) attribute michael@0: fi # have visibility(hidden) attribute michael@0: fi # GNU_CC michael@0: michael@0: # visibility hidden flag for Sun Studio on Solaris michael@0: if test "$SOLARIS_SUNPRO_CC"; then michael@0: VISIBILITY_FLAGS='-xldscope=hidden' michael@0: fi # Sun Studio on Solaris michael@0: michael@0: AC_SUBST(WRAP_SYSTEM_INCLUDES) michael@0: AC_SUBST(VISIBILITY_FLAGS) michael@0: michael@0: MOZ_GCC_PR49911 michael@0: MOZ_GCC_PR39608 michael@0: if test "$OS_TARGET" != WINNT; then michael@0: # Only run this test with clang on non-Windows platforms, because clang michael@0: # cannot do enough code gen for now to make this test work correctly. michael@0: MOZ_LLVM_PR8927 michael@0: fi michael@0: michael@0: dnl Checks for header files. michael@0: dnl ======================================================== michael@0: AC_HEADER_DIRENT michael@0: case "$target_os" in michael@0: freebsd*) michael@0: # for stuff like -lXshm michael@0: CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}" michael@0: ;; michael@0: esac michael@0: MOZ_CHECK_COMMON_HEADERS michael@0: michael@0: dnl These are all the places some variant of statfs can be hiding. michael@0: MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h) michael@0: michael@0: dnl Quota support michael@0: MOZ_CHECK_HEADERS(sys/quota.h) michael@0: MOZ_CHECK_HEADERS(linux/quota.h) michael@0: michael@0: AC_ARG_ENABLE(dtrace, michael@0: [ --enable-dtrace build with dtrace support if available (default=no)], michael@0: [enable_dtrace="yes"],) michael@0: if test "x$enable_dtrace" = "xyes"; then michael@0: MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1) michael@0: if test -n "$HAVE_DTRACE"; then michael@0: AC_DEFINE(INCLUDE_MOZILLA_DTRACE) michael@0: else michael@0: AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]); michael@0: fi michael@0: fi michael@0: AC_SUBST(HAVE_DTRACE) michael@0: michael@0: case $target in michael@0: *-aix4.3*|*-aix5*) michael@0: ;; michael@0: *) michael@0: MOZ_CHECK_HEADERS(sys/cdefs.h) michael@0: ;; michael@0: esac michael@0: michael@0: MOZ_LINUX_PERF_EVENT michael@0: michael@0: dnl Checks for libraries. michael@0: dnl ======================================================== michael@0: case $target in michael@0: *-hpux11.*) michael@0: ;; michael@0: *) michael@0: AC_CHECK_LIB(c_r, gethostbyname_r) michael@0: ;; michael@0: esac michael@0: michael@0: dnl We don't want to link with libdl even if it's present on OS X, since michael@0: dnl it's not used and not part of the default installation. OS/2 has dlfcn michael@0: dnl in libc. michael@0: dnl We don't want to link against libm or libpthread on Darwin since michael@0: dnl they both are just symlinks to libSystem and explicitly linking michael@0: dnl against libSystem causes issues when debugging (see bug 299601). michael@0: case $target in michael@0: *-darwin*) michael@0: ;; michael@0: *) michael@0: AC_SEARCH_LIBS(dlopen, dl, michael@0: MOZ_CHECK_HEADER(dlfcn.h, michael@0: AC_DEFINE(HAVE_DLOPEN))) michael@0: ;; michael@0: esac michael@0: michael@0: if test ! "$GNU_CXX"; then michael@0: michael@0: case $target in michael@0: *-aix*) michael@0: AC_CHECK_LIB(C_r, demangle) michael@0: ;; michael@0: *) michael@0: AC_CHECK_LIB(C, demangle) michael@0: ;; michael@0: esac michael@0: fi michael@0: michael@0: AC_CHECK_LIB(socket, socket) michael@0: michael@0: dnl ======================================================== michael@0: dnl = pthread support michael@0: dnl = Start by checking whether the system support pthreads michael@0: dnl ======================================================== michael@0: case "$target_os" in michael@0: darwin*) michael@0: USE_PTHREADS=1 michael@0: ;; michael@0: *) michael@0: MOZ_CHECK_PTHREADS(pthreads, michael@0: USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads", michael@0: MOZ_CHECK_PTHREADS(pthread, michael@0: USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread", michael@0: MOZ_CHECK_PTHREADS(c_r, michael@0: USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r", michael@0: MOZ_CHECK_PTHREADS(c, michael@0: USE_PTHREADS=1 michael@0: ) michael@0: ) michael@0: ) michael@0: ) michael@0: ;; michael@0: esac michael@0: michael@0: dnl ======================================================== michael@0: dnl Check the command line for --with-pthreads michael@0: dnl ======================================================== michael@0: MOZ_ARG_WITH_BOOL(pthreads, michael@0: [ --with-pthreads Force use of system pthread library with NSPR ], michael@0: [ if test "$USE_PTHREADS"x = x; then michael@0: AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]); michael@0: fi], michael@0: USE_PTHREADS= michael@0: _PTHREAD_LDFLAGS= michael@0: ) michael@0: michael@0: dnl ======================================================== michael@0: dnl Do the platform specific pthread hackery michael@0: dnl ======================================================== michael@0: if test "$USE_PTHREADS"x != x michael@0: then michael@0: dnl michael@0: dnl See if -pthread is supported. michael@0: dnl michael@0: rm -f conftest* michael@0: ac_cv_have_dash_pthread=no michael@0: AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread) michael@0: echo 'int main() { return 0; }' | cat > conftest.c michael@0: ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1 michael@0: if test $? -eq 0; then michael@0: if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then michael@0: ac_cv_have_dash_pthread=yes michael@0: case "$target_os" in michael@0: freebsd*) michael@0: # Freebsd doesn't use -pthread for compiles, it uses them for linking michael@0: ;; michael@0: *) michael@0: CFLAGS="$CFLAGS -pthread" michael@0: CXXFLAGS="$CXXFLAGS -pthread" michael@0: ;; michael@0: esac michael@0: fi michael@0: fi michael@0: rm -f conftest* michael@0: AC_MSG_RESULT($ac_cv_have_dash_pthread) michael@0: michael@0: dnl michael@0: dnl See if -pthreads is supported. michael@0: dnl michael@0: ac_cv_have_dash_pthreads=no michael@0: if test "$ac_cv_have_dash_pthread" = "no"; then michael@0: AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads) michael@0: echo 'int main() { return 0; }' | cat > conftest.c michael@0: ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1 michael@0: if test $? -eq 0; then michael@0: if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then michael@0: ac_cv_have_dash_pthreads=yes michael@0: CFLAGS="$CFLAGS -pthreads" michael@0: CXXFLAGS="$CXXFLAGS -pthreads" michael@0: fi michael@0: fi michael@0: rm -f conftest* michael@0: AC_MSG_RESULT($ac_cv_have_dash_pthreads) michael@0: fi michael@0: michael@0: case "$target" in michael@0: *-*-freebsd*) michael@0: AC_DEFINE(_REENTRANT) michael@0: AC_DEFINE(_THREAD_SAFE) michael@0: dnl -pthread links in -lpthread, so don't specify it explicitly. michael@0: if test "$ac_cv_have_dash_pthread" = "yes"; then michael@0: _PTHREAD_LDFLAGS="-pthread" michael@0: fi michael@0: ;; michael@0: michael@0: *-*-openbsd*|*-*-bsdi*) michael@0: AC_DEFINE(_REENTRANT) michael@0: AC_DEFINE(_THREAD_SAFE) michael@0: dnl -pthread links in -lc_r, so don't specify it explicitly. michael@0: if test "$ac_cv_have_dash_pthread" = "yes"; then michael@0: _PTHREAD_LDFLAGS="-pthread" michael@0: fi michael@0: ;; michael@0: michael@0: *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*) michael@0: AC_DEFINE(_REENTRANT) michael@0: ;; michael@0: michael@0: *-aix4.3*|*-aix5*) michael@0: AC_DEFINE(_REENTRANT) michael@0: ;; michael@0: michael@0: *-hpux11.*) michael@0: AC_DEFINE(_REENTRANT) michael@0: ;; michael@0: michael@0: *-*-solaris*) michael@0: AC_DEFINE(_REENTRANT) michael@0: if test "$SOLARIS_SUNPRO_CC"; then michael@0: CFLAGS="$CFLAGS -mt" michael@0: CXXFLAGS="$CXXFLAGS -mt" michael@0: fi michael@0: ;; michael@0: esac michael@0: LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}" michael@0: fi michael@0: michael@0: michael@0: dnl Checks for library functions. michael@0: dnl ======================================================== michael@0: AC_PROG_GCC_TRADITIONAL michael@0: AC_FUNC_MEMCMP michael@0: AC_CHECK_FUNCS([getc_unlocked _getc_nolock localtime_r]) michael@0: michael@0: michael@0: dnl Checks for math functions. michael@0: dnl ======================================================== michael@0: AC_CHECK_LIB(m, sin) michael@0: AC_CHECK_FUNCS([log2 log1p expm1 sqrt1pm1 acosh asinh atanh trunc cbrt]) michael@0: michael@0: michael@0: dnl check for wcrtomb/mbrtowc michael@0: dnl ======================================================================= michael@0: if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then michael@0: AC_LANG_SAVE michael@0: AC_LANG_CPLUSPLUS michael@0: AC_CACHE_CHECK(for wcrtomb, michael@0: ac_cv_have_wcrtomb, michael@0: [AC_TRY_LINK([#include ], michael@0: [mbstate_t ps={0};wcrtomb(0,'f',&ps);], michael@0: ac_cv_have_wcrtomb="yes", michael@0: ac_cv_have_wcrtomb="no")]) michael@0: if test "$ac_cv_have_wcrtomb" = "yes"; then michael@0: AC_DEFINE(HAVE_WCRTOMB) michael@0: fi michael@0: AC_CACHE_CHECK(for mbrtowc, michael@0: ac_cv_have_mbrtowc, michael@0: [AC_TRY_LINK([#include ], michael@0: [mbstate_t ps={0};mbrtowc(0,0,0,&ps);], michael@0: ac_cv_have_mbrtowc="yes", michael@0: ac_cv_have_mbrtowc="no")]) michael@0: if test "$ac_cv_have_mbrtowc" = "yes"; then michael@0: AC_DEFINE(HAVE_MBRTOWC) michael@0: fi michael@0: AC_LANG_RESTORE michael@0: fi michael@0: michael@0: AC_CACHE_CHECK( michael@0: [for res_ninit()], michael@0: ac_cv_func_res_ninit, michael@0: [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then michael@0: dnl no need for res_ninit() on NetBSD and OpenBSD michael@0: ac_cv_func_res_ninit=no michael@0: else michael@0: AC_TRY_LINK([ michael@0: #ifdef linux michael@0: #define _BSD_SOURCE 1 michael@0: #endif michael@0: #include michael@0: #include michael@0: #include michael@0: #include michael@0: ], michael@0: [int foo = res_ninit(&_res);], michael@0: [ac_cv_func_res_ninit=yes], michael@0: [ac_cv_func_res_ninit=no]) michael@0: fi michael@0: ]) michael@0: michael@0: if test "$ac_cv_func_res_ninit" = "yes"; then michael@0: AC_DEFINE(HAVE_RES_NINIT) michael@0: dnl must add the link line we do something as foolish as this... dougt michael@0: dnl else michael@0: dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT), michael@0: dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT))) michael@0: fi michael@0: michael@0: AM_LANGINFO_CODESET michael@0: michael@0: AC_LANG_C michael@0: michael@0: dnl ********************** michael@0: dnl *** va_copy checks *** michael@0: dnl ********************** michael@0: AC_CACHE_CHECK([for an implementation of va_copy()], michael@0: ac_cv_va_copy, michael@0: [AC_TRY_COMPILE([#include michael@0: #include michael@0: void f (int i, ...) { michael@0: va_list args1, args2; michael@0: va_start (args1, i); michael@0: va_copy (args2, args1); michael@0: if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42) michael@0: exit (1); michael@0: va_end (args1); va_end (args2); michael@0: }], michael@0: [f(0, 42); return 0], michael@0: [ac_cv_va_copy=yes], michael@0: [ac_cv_va_copy=no] michael@0: )] michael@0: ) michael@0: AC_CACHE_CHECK([whether va_list can be copied by value], michael@0: ac_cv_va_val_copy, michael@0: [AC_TRY_COMPILE([#include michael@0: #include michael@0: void f (int i, ...) { michael@0: va_list args1, args2; michael@0: va_start (args1, i); michael@0: args2 = args1; michael@0: if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42) michael@0: exit (1); michael@0: va_end (args1); va_end (args2); michael@0: }], michael@0: [f(0, 42); return 0], michael@0: [ac_cv_va_val_copy=yes], michael@0: [ac_cv_va_val_copy=no], michael@0: )] michael@0: ) michael@0: if test "x$ac_cv_va_copy" = "xyes"; then michael@0: AC_DEFINE(VA_COPY, va_copy) michael@0: AC_DEFINE(HAVE_VA_COPY) michael@0: fi michael@0: michael@0: if test "x$ac_cv_va_val_copy" = "xno"; then michael@0: AC_DEFINE(HAVE_VA_LIST_AS_ARRAY) michael@0: fi michael@0: michael@0: dnl =================================================================== michael@0: dnl ======================================================== michael@0: dnl Put your C++ language/feature checks below michael@0: dnl ======================================================== michael@0: AC_LANG_CPLUSPLUS michael@0: michael@0: ARM_ABI_PREFIX= michael@0: if test "$GNU_CC"; then michael@0: if test "$CPU_ARCH" = "arm" ; then michael@0: AC_CACHE_CHECK(for ARM EABI, michael@0: ac_cv_gcc_arm_eabi, michael@0: [AC_TRY_COMPILE([], michael@0: [ michael@0: #if defined(__ARM_EABI__) michael@0: return 0; michael@0: #else michael@0: #error Not ARM EABI. michael@0: #endif michael@0: ], michael@0: ac_cv_gcc_arm_eabi="yes", michael@0: ac_cv_gcc_arm_eabi="no")]) michael@0: if test "$ac_cv_gcc_arm_eabi" = "yes"; then michael@0: HAVE_ARM_EABI=1 michael@0: ARM_ABI_PREFIX=eabi- michael@0: else michael@0: ARM_ABI_PREFIX=oabi- michael@0: fi michael@0: fi michael@0: michael@0: TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}" michael@0: fi michael@0: michael@0: dnl Check to see if we can resolve ambiguity with |using|. michael@0: AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity, michael@0: ac_cv_cpp_ambiguity_resolving_using, michael@0: [AC_TRY_COMPILE(class X { michael@0: public: int go(const X&) {return 3;} michael@0: int jo(const X&) {return 3;} michael@0: }; michael@0: class Y : public X { michael@0: public: int go(int) {return 2;} michael@0: int jo(int) {return 2;} michael@0: using X::jo; michael@0: private: using X::go; michael@0: };, michael@0: X x; Y y; y.jo(x);, michael@0: ac_cv_cpp_ambiguity_resolving_using=yes, michael@0: ac_cv_cpp_ambiguity_resolving_using=no)]) michael@0: if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then michael@0: AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING) michael@0: fi michael@0: michael@0: dnl See if a dynamic_cast to void* gives the most derived object. michael@0: AC_CACHE_CHECK(for C++ dynamic_cast to void*, michael@0: ac_cv_cpp_dynamic_cast_void_ptr, michael@0: [AC_TRY_RUN([class X { int i; public: virtual ~X() { } }; michael@0: class Y { int j; public: virtual ~Y() { } }; michael@0: class Z : public X, public Y { int k; }; michael@0: michael@0: int main() { michael@0: Z mdo; michael@0: X *subx = (X*)&mdo; michael@0: Y *suby = (Y*)&mdo; michael@0: return !((((void*)&mdo != (void*)subx) && michael@0: ((void*)&mdo == dynamic_cast(subx))) || michael@0: (((void*)&mdo != (void*)suby) && michael@0: ((void*)&mdo == dynamic_cast(suby)))); michael@0: }], michael@0: ac_cv_cpp_dynamic_cast_void_ptr=yes, michael@0: ac_cv_cpp_dynamic_cast_void_ptr=no, michael@0: ac_cv_cpp_dynamic_cast_void_ptr=no)]) michael@0: if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then michael@0: AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR) michael@0: fi michael@0: michael@0: michael@0: dnl note that this one is reversed - if the test fails, then michael@0: dnl we require implementations of unused virtual methods. Which michael@0: dnl really blows because it means we'll have useless vtable michael@0: dnl bloat. michael@0: AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods, michael@0: ac_cv_cpp_unused_required, michael@0: [AC_TRY_LINK(class X {private: virtual void never_called();};, michael@0: X x;, michael@0: ac_cv_cpp_unused_required=no, michael@0: ac_cv_cpp_unused_required=yes)]) michael@0: if test "$ac_cv_cpp_unused_required" = yes ; then michael@0: AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS) michael@0: fi michael@0: michael@0: michael@0: dnl Some compilers have trouble comparing a constant reference to a templatized michael@0: dnl class to zero, and require an explicit operator==() to be defined that takes michael@0: dnl an int. This test separates the strong from the weak. michael@0: michael@0: AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(), michael@0: ac_cv_trouble_comparing_to_zero, michael@0: [AC_TRY_COMPILE([#include michael@0: template class Foo {}; michael@0: class T2; michael@0: template int operator==(const T2*, const T&) { return 0; } michael@0: template int operator!=(const T2*, const T&) { return 0; }], michael@0: [Foo f; return (0 != f);], michael@0: ac_cv_trouble_comparing_to_zero=no, michael@0: ac_cv_trouble_comparing_to_zero=yes)]) michael@0: if test "$ac_cv_trouble_comparing_to_zero" = yes ; then michael@0: AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO) michael@0: fi michael@0: michael@0: # try harder, when checking for __thread support, see bug 521750 comment #33 and below michael@0: # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is michael@0: # enabled, the linker in xcode 4.1 will crash. Without this it would crash when michael@0: # linking XUL. michael@0: _SAVE_LDFLAGS=$LDFLAGS michael@0: LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS" michael@0: AC_CACHE_CHECK(for __thread keyword for TLS variables, michael@0: ac_cv_thread_keyword, michael@0: [AC_TRY_LINK([__thread bool tlsIsMainThread = false;], michael@0: [return tlsIsMainThread;], michael@0: ac_cv_thread_keyword=yes, michael@0: ac_cv_thread_keyword=no)]) michael@0: LDFLAGS=$_SAVE_LDFLAGS michael@0: if test "$ac_cv_thread_keyword" = yes; then michael@0: # mips builds fail with TLS variables because of a binutils bug. michael@0: # See bug 528687 michael@0: case "${target}" in michael@0: mips*-*) michael@0: : michael@0: ;; michael@0: *-android*|*-linuxandroid*) michael@0: : michael@0: ;; michael@0: *) michael@0: AC_DEFINE(HAVE_THREAD_TLS_KEYWORD) michael@0: ;; michael@0: esac michael@0: fi michael@0: michael@0: dnl See if compiler supports some gcc-style attributes michael@0: michael@0: AC_CACHE_CHECK(for __attribute__((always_inline)), michael@0: ac_cv_attribute_always_inline, michael@0: [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));], michael@0: [], michael@0: ac_cv_attribute_always_inline=yes, michael@0: ac_cv_attribute_always_inline=no)]) michael@0: michael@0: AC_CACHE_CHECK(for __attribute__((malloc)), michael@0: ac_cv_attribute_malloc, michael@0: [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));], michael@0: [], michael@0: ac_cv_attribute_malloc=yes, michael@0: ac_cv_attribute_malloc=no)]) michael@0: michael@0: AC_CACHE_CHECK(for __attribute__((warn_unused_result)), michael@0: ac_cv_attribute_warn_unused, michael@0: [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));], michael@0: [], michael@0: ac_cv_attribute_warn_unused=yes, michael@0: ac_cv_attribute_warn_unused=no)]) michael@0: michael@0: dnl End of C++ language/feature checks michael@0: AC_LANG_C michael@0: michael@0: dnl ======================================================== michael@0: dnl = Internationalization checks michael@0: dnl ======================================================== michael@0: dnl michael@0: dnl Internationalization and Locale support is different michael@0: dnl on various UNIX platforms. Checks for specific i18n michael@0: dnl features go here. michael@0: michael@0: dnl check for LC_MESSAGES michael@0: AC_CACHE_CHECK(for LC_MESSAGES, michael@0: ac_cv_i18n_lc_messages, michael@0: [AC_TRY_COMPILE([#include ], michael@0: [int category = LC_MESSAGES;], michael@0: ac_cv_i18n_lc_messages=yes, michael@0: ac_cv_i18n_lc_messages=no)]) michael@0: if test "$ac_cv_i18n_lc_messages" = yes; then michael@0: AC_DEFINE(HAVE_I18N_LC_MESSAGES) michael@0: fi michael@0: michael@0: AC_HAVE_FUNCS(localeconv) michael@0: fi # ! SKIP_COMPILER_CHECKS michael@0: michael@0: TARGET_XPCOM_ABI= michael@0: if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then michael@0: TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}" michael@0: fi michael@0: michael@0: dnl Mozilla specific options michael@0: dnl ======================================================== michael@0: dnl The macros used for command line options michael@0: dnl are defined in build/autoconf/altoptions.m4. michael@0: michael@0: dnl If the compiler supports these attributes, define them as michael@0: dnl convenience macros. michael@0: if test "$ac_cv_attribute_malloc" = yes ; then michael@0: AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))]) michael@0: else michael@0: AC_DEFINE(NS_ATTR_MALLOC,) michael@0: fi michael@0: michael@0: if test "$ac_cv_attribute_warn_unused" = yes ; then michael@0: AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))]) michael@0: else michael@0: AC_DEFINE(NS_WARN_UNUSED_RESULT,) michael@0: fi michael@0: michael@0: dnl We can't run TRY_COMPILE tests on Windows, so hard-code some michael@0: dnl features that Windows actually does support. michael@0: michael@0: if test -n "$SKIP_COMPILER_CHECKS"; then michael@0: dnl Windows has malloc.h michael@0: AC_DEFINE(MALLOC_H, []) michael@0: AC_DEFINE(HAVE_FORCEINLINE) michael@0: AC_DEFINE(HAVE_LOCALECONV) michael@0: fi # SKIP_COMPILER_CHECKS michael@0: michael@0: dnl ======================================================== michael@0: dnl = Mozilla update channel, used for disabling features michael@0: dnl = not wanted for release. michael@0: dnl ======================================================== michael@0: michael@0: # app update channel is 'default' when not supplied. michael@0: MOZ_ARG_ENABLE_STRING([update-channel], michael@0: [ --enable-update-channel=CHANNEL michael@0: Select application update channel (default=default)], michael@0: MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`) michael@0: michael@0: if test -z "$MOZ_UPDATE_CHANNEL"; then michael@0: MOZ_UPDATE_CHANNEL=default michael@0: fi michael@0: AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL) michael@0: AC_SUBST(MOZ_UPDATE_CHANNEL) michael@0: michael@0: michael@0: dnl set GRE_MILESTONE michael@0: dnl ======================================================== michael@0: GRE_MILESTONE=`tail -n 1 "$_topsrcdir"/config/milestone.txt 2>/dev/null || tail -1 "$_topsrcdir"/config/milestone.txt` michael@0: AC_SUBST(GRE_MILESTONE) michael@0: michael@0: dnl set RELEASE_BUILD and NIGHTLY_BUILD variables depending on the cycle we're in michael@0: dnl The logic works like this: michael@0: dnl - if we have "a1" in GRE_MILESTONE, we're building Nightly (define NIGHTLY_BUILD) michael@0: dnl - otherwise, we're building Release/Beta (define RELEASE_BUILD) michael@0: case "$GRE_MILESTONE" in michael@0: *a1*) michael@0: NIGHTLY_BUILD=1 michael@0: AC_DEFINE(NIGHTLY_BUILD) michael@0: ;; michael@0: *) michael@0: RELEASE_BUILD=1 michael@0: AC_DEFINE(RELEASE_BUILD) michael@0: ;; michael@0: esac michael@0: AC_SUBST(NIGHTLY_BUILD) michael@0: AC_SUBST(RELEASE_BUILD) michael@0: michael@0: dnl ======================================================== michael@0: dnl Disable compiling sources in unified mode. michael@0: dnl ======================================================== michael@0: michael@0: if test -z "$NIGHTLY_BUILD"; then michael@0: MOZ_DISABLE_UNIFIED_COMPILATION=1 michael@0: fi michael@0: michael@0: MOZ_ARG_DISABLE_BOOL(unified-compilation, michael@0: [ --disable-unified-compilation michael@0: Disable unified compilation of some C/C++ sources], michael@0: MOZ_DISABLE_UNIFIED_COMPILATION=1, michael@0: MOZ_DISABLE_UNIFIED_COMPILATION=) michael@0: AC_SUBST(MOZ_DISABLE_UNIFIED_COMPILATION) michael@0: michael@0: dnl ======================================================== michael@0: dnl = michael@0: dnl = Check for external package dependencies michael@0: dnl = michael@0: dnl ======================================================== michael@0: MOZ_ARG_HEADER(External Packages) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Find the right NSPR to use. michael@0: dnl ======================================================== michael@0: MOZ_ARG_WITH_BOOL(system-nspr, michael@0: [ --with-system-nspr Use an NSPR that is already built and installed. michael@0: Use the 'nspr-config' script in the current path, michael@0: or look for the script in the directories given with michael@0: --with-nspr-exec-prefix or --with-nspr-prefix. michael@0: (Those flags are only checked if you specify michael@0: --with-system-nspr.)], michael@0: _USE_SYSTEM_NSPR=1 ) michael@0: michael@0: MOZ_ARG_WITH_STRING(nspr-cflags, michael@0: [ --with-nspr-cflags=FLAGS michael@0: Pass FLAGS to CC when building code that uses NSPR. michael@0: Use this when there's no accurate nspr-config michael@0: script available. This is the case when building michael@0: SpiderMonkey as part of the Mozilla tree: the michael@0: top-level configure script computes NSPR flags michael@0: that accomodate the quirks of that environment.], michael@0: NSPR_CFLAGS=$withval) michael@0: MOZ_ARG_WITH_STRING(nspr-libs, michael@0: [ --with-nspr-libs=LIBS Pass LIBS to LD when linking code that uses NSPR. michael@0: See --with-nspr-cflags for more details.], michael@0: NSPR_LIBS=$withval) michael@0: AC_SUBST(NSPR_CFLAGS) michael@0: AC_SUBST(NSPR_LIBS) michael@0: michael@0: JS_THREADSAFE=1 michael@0: MOZ_ARG_DISABLE_BOOL(threadsafe, michael@0: [ --disable-threadsafe Disable support for multiple threads.], michael@0: JS_THREADSAFE= , michael@0: JS_THREADSAFE=1 ) michael@0: if test -n "$JS_THREADSAFE"; then michael@0: AC_DEFINE(JS_THREADSAFE) michael@0: fi michael@0: michael@0: if test "$_USE_SYSTEM_NSPR" || (test "$NSPR_CFLAGS" -o "$NSPR_LIBS"); then michael@0: _HAS_NSPR=1 michael@0: fi michael@0: michael@0: case "$target" in michael@0: *linux*|*darwin*|*dragonfly*|*freebsd*|*netbsd*|*openbsd*) michael@0: if test -z "$_HAS_NSPR" && test "$JS_THREADSAFE"; then michael@0: JS_POSIX_NSPR_DEFAULT=1 michael@0: fi michael@0: ;; michael@0: esac michael@0: michael@0: MOZ_ARG_ENABLE_BOOL(posix-nspr-emulation, michael@0: [ --enable-posix-nspr-emulation michael@0: Enable emulation of NSPR for POSIX systems], michael@0: JS_POSIX_NSPR=1, michael@0: JS_POSIX_NSPR=, michael@0: JS_POSIX_NSPR="$JS_POSIX_NSPR_DEFAULT" ) michael@0: if test -n "$JS_POSIX_NSPR"; then michael@0: AC_DEFINE(JS_POSIX_NSPR) michael@0: fi michael@0: michael@0: AC_SUBST(JS_POSIX_NSPR) michael@0: michael@0: dnl Pass either --with-system-nspr or (--with-nspr-cflags and michael@0: dnl --with-nspr-libs), but not both. michael@0: if test "$_USE_SYSTEM_NSPR" && (test "$NSPR_CFLAGS" -o "$NSPR_LIBS"); then michael@0: AC_MSG_ERROR([--with-system-nspr and --with-nspr-libs/cflags are mutually exclusive. michael@0: See 'configure --help'.]) michael@0: fi michael@0: michael@0: dnl Can't use --enable-posix-nspr-emulation if compiling with NSPR. michael@0: if test "$_HAS_NSPR" && test "$JS_POSIX_NSPR"; then michael@0: AC_MSG_ERROR([--enable-posix-nspr-emulation is mututally exclusive with --with-system-nspr michael@0: and --with-nspr-libs/cflags. See 'configure --help'.]) michael@0: fi michael@0: michael@0: if test -n "$_USE_SYSTEM_NSPR"; then michael@0: MOZ_NATIVE_NSPR= michael@0: AM_PATH_NSPR($NSPR_MINVER, [MOZ_NATIVE_NSPR=1], [AC_MSG_ERROR([your don't have NSPR installed or your version is too old])]) michael@0: fi michael@0: michael@0: NSPR_PKGCONF_CHECK="nspr" michael@0: if test -n "$MOZ_NATIVE_NSPR"; then michael@0: # piggy back on $MOZ_NATIVE_NSPR to set a variable for the nspr check for js.pc michael@0: NSPR_PKGCONF_CHECK="nspr >= $NSPR_MINVER" michael@0: michael@0: _SAVE_CFLAGS=$CFLAGS michael@0: CFLAGS="$CFLAGS $NSPR_CFLAGS" michael@0: AC_TRY_COMPILE([#include "prlog.h"], michael@0: [#ifndef PR_STATIC_ASSERT michael@0: #error PR_STATIC_ASSERT not defined michael@0: #endif], michael@0: [MOZ_NATIVE_NSPR=1], michael@0: AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT])) michael@0: CFLAGS=$_SAVE_CFLAGS michael@0: fi michael@0: AC_SUBST(NSPR_PKGCONF_CHECK) michael@0: michael@0: dnl ======================================================== michael@0: dnl system zlib Support michael@0: dnl ======================================================== michael@0: dnl Standalone js defaults to system zlib michael@0: ZLIB_DIR=yes michael@0: michael@0: MOZ_ZLIB_CHECK([1.2.3]) michael@0: michael@0: if test -n "$ZLIB_IN_MOZGLUE"; then michael@0: AC_DEFINE(ZLIB_IN_MOZGLUE) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl system libffi Support michael@0: dnl ======================================================== michael@0: MOZ_CONFIG_FFI() michael@0: michael@0: dnl ======================================================== michael@0: dnl = michael@0: dnl = Application michael@0: dnl = michael@0: dnl ======================================================== michael@0: michael@0: MOZ_ARG_HEADER(Application) michael@0: michael@0: ENABLE_TESTS=1 michael@0: michael@0: USE_ARM_KUSER= michael@0: michael@0: case "${target}" in michael@0: arm*-android*|arm*-linuxandroid*) michael@0: USE_ARM_KUSER=1 michael@0: ;; michael@0: esac michael@0: michael@0: dnl ======================================================== michael@0: dnl Use ARM userspace kernel helpers; tell NSPR to enable michael@0: dnl their usage and use them in spidermonkey. michael@0: dnl ======================================================== michael@0: MOZ_ARG_WITH_BOOL(arm-kuser, michael@0: [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)], michael@0: USE_ARM_KUSER=1,) michael@0: if test -n "$USE_ARM_KUSER"; then michael@0: AC_DEFINE(USE_ARM_KUSER) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = michael@0: dnl = Components & Features michael@0: dnl = michael@0: dnl ======================================================== michael@0: MOZ_ARG_HEADER(Components and Features) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Localization michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_STRING(ui-locale, michael@0: [ --enable-ui-locale=ab-CD michael@0: Select the user interface locale (default: en-US)], michael@0: MOZ_UI_LOCALE=$enableval ) michael@0: AC_SUBST(MOZ_UI_LOCALE) michael@0: michael@0: dnl ======================================================== michael@0: dnl build the tests by default michael@0: dnl ======================================================== michael@0: MOZ_ARG_DISABLE_BOOL(tests, michael@0: [ --disable-tests Do not build test libraries & programs], michael@0: ENABLE_TESTS=, michael@0: ENABLE_TESTS=1 ) michael@0: michael@0: dnl ======================================================== michael@0: dnl = michael@0: dnl = Module specific options michael@0: dnl = michael@0: dnl ======================================================== michael@0: MOZ_ARG_HEADER(Individual module options) michael@0: michael@0: dnl ======================================================== michael@0: dnl = michael@0: dnl = Debugging Options michael@0: dnl = michael@0: dnl ======================================================== michael@0: MOZ_ARG_HEADER(Debugging and Optimizations) michael@0: michael@0: if test "$ENABLE_METHODJIT_SPEW"; then michael@0: AC_DEFINE(JS_METHODJIT_SPEW) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable code optimization. ON by default. michael@0: dnl ======================================================== michael@0: if test -z "$MOZ_OPTIMIZE_FLAGS"; then michael@0: MOZ_OPTIMIZE_FLAGS="-O" michael@0: fi michael@0: michael@0: MOZ_ARG_ENABLE_STRING(optimize, michael@0: [ --disable-optimize Disable compiler optimization michael@0: --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]], michael@0: [ if test "$enableval" != "no"; then michael@0: MOZ_OPTIMIZE=1 michael@0: if test -n "$enableval" -a "$enableval" != "yes"; then michael@0: MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'` michael@0: MOZ_OPTIMIZE=2 michael@0: fi michael@0: else michael@0: MOZ_OPTIMIZE= michael@0: fi ], MOZ_OPTIMIZE=1) michael@0: michael@0: MOZ_SET_FRAMEPTR_FLAGS michael@0: michael@0: if test "$COMPILE_ENVIRONMENT"; then michael@0: if test -n "$MOZ_OPTIMIZE"; then michael@0: AC_MSG_CHECKING([for valid optimization flags]) michael@0: _SAVE_CFLAGS=$CFLAGS michael@0: CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS" michael@0: AC_TRY_COMPILE([#include ], michael@0: [printf("Hello World\n");], michael@0: _results=yes, michael@0: _results=no) michael@0: AC_MSG_RESULT([$_results]) michael@0: if test "$_results" = "no"; then michael@0: AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS]) michael@0: fi michael@0: CFLAGS=$_SAVE_CFLAGS michael@0: fi michael@0: fi # COMPILE_ENVIRONMENT michael@0: michael@0: AC_SUBST(MOZ_OPTIMIZE) michael@0: AC_SUBST(MOZ_FRAMEPTR_FLAGS) michael@0: AC_SUBST(MOZ_OPTIMIZE_FLAGS) michael@0: AC_SUBST(MOZ_OPTIMIZE_LDFLAGS) michael@0: AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK) michael@0: AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable trace logging michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(trace-logging, michael@0: [ --enable-trace-logging Enable trace logging], michael@0: ENABLE_TRACE_LOGGING=1, michael@0: ENABLE_TRACE_LOGGING= ) michael@0: michael@0: AC_SUBST(ENABLE_TRACE_LOGGING) michael@0: michael@0: if test "$ENABLE_TRACE_LOGGING"; then michael@0: AC_DEFINE(JS_TRACE_LOGGING) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable any treating of compile warnings as errors michael@0: dnl ======================================================== michael@0: MOZ_ARG_DISABLE_BOOL(warnings-as-errors, michael@0: [ --enable-warnings-as-errors michael@0: Enable treating of warnings as errors], michael@0: MOZ_ENABLE_WARNINGS_AS_ERRORS=1, michael@0: MOZ_ENABLE_WARNINGS_AS_ERRORS=) michael@0: if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then michael@0: WARNINGS_AS_ERRORS='' michael@0: elif test "$GNU_CC"; then michael@0: # Prevent the following GCC warnings from being treated as errors: michael@0: # -Wuninitialized - too many false positives michael@0: # -Wmaybe-uninitialized - too many false positives michael@0: # -Wdeprecated-declarations - we don't want our builds held hostage when a michael@0: # platform-specific API becomes deprecated. michael@0: MOZ_C_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_c_has_noerror_uninitialized) michael@0: MOZ_CXX_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_cxx_has_noerror_uninitialized) michael@0: MOZ_C_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_c_has_noerror_maybe_uninitialized) michael@0: MOZ_CXX_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_cxx_has_noerror_maybe_uninitialized) michael@0: MOZ_C_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_c_has_noerror_deprecated_declarations) michael@0: MOZ_CXX_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_cxx_has_noerror_deprecated_declarations) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable treating compile warnings as errors michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(sm-fail-on-warnings, michael@0: [ --enable-sm-fail-on-warnings michael@0: Enable warnings as errors], michael@0: FAIL_ON_WARNINGS=1, michael@0: FAIL_ON_WARNINGS= ) michael@0: michael@0: AC_SUBST(FAIL_ON_WARNINGS) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable trace malloc michael@0: dnl ======================================================== michael@0: NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC} michael@0: MOZ_ARG_ENABLE_BOOL(trace-malloc, michael@0: [ --enable-trace-malloc Enable malloc tracing], michael@0: NS_TRACE_MALLOC=1, michael@0: NS_TRACE_MALLOC= ) michael@0: if test "$NS_TRACE_MALLOC"; then michael@0: # Please, Mr. Linker Man, don't take away our symbol names michael@0: MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS= michael@0: AC_DEFINE(NS_TRACE_MALLOC) michael@0: fi michael@0: AC_SUBST(NS_TRACE_MALLOC) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable DMD michael@0: dnl ======================================================== michael@0: michael@0: MOZ_ARG_ENABLE_BOOL(dmd, michael@0: [ --enable-dmd Enable DMD; also enables jemalloc and replace-malloc], michael@0: MOZ_DMD=1, michael@0: MOZ_DMD= ) michael@0: michael@0: if test "$NS_TRACE_MALLOC"; then # trace-malloc disables DMD michael@0: MOZ_DMD= michael@0: fi michael@0: if test "$MOZ_DMD"; then michael@0: AC_DEFINE(MOZ_DMD) michael@0: michael@0: if test "${CPU_ARCH}" = "arm"; then michael@0: CFLAGS="$CFLAGS -funwind-tables" michael@0: CXXFLAGS="$CXXFLAGS -funwind-tables" michael@0: fi michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable jemalloc michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(jemalloc, michael@0: [ --enable-jemalloc Replace memory allocator with jemalloc], michael@0: MOZ_MEMORY=1, michael@0: MOZ_MEMORY=) michael@0: michael@0: if test "$NS_TRACE_MALLOC"; then michael@0: MOZ_MEMORY= michael@0: fi michael@0: michael@0: if test "$MOZ_MEMORY"; then michael@0: AC_DEFINE(MOZ_MEMORY) michael@0: if test "x$MOZ_DEBUG" = "x1"; then michael@0: AC_DEFINE(MOZ_MEMORY_DEBUG) michael@0: fi michael@0: dnl The generic feature tests that determine how to compute ncpus are long and michael@0: dnl complicated. Therefore, simply define special cpp variables for the michael@0: dnl platforms we have special knowledge of. michael@0: case "${target}" in michael@0: *-darwin*) michael@0: AC_DEFINE(MOZ_MEMORY_DARWIN) michael@0: ;; michael@0: *-*freebsd*) michael@0: AC_DEFINE(MOZ_MEMORY_BSD) michael@0: ;; michael@0: *-android*|*-linuxandroid*) michael@0: AC_DEFINE(MOZ_MEMORY_LINUX) michael@0: AC_DEFINE(MOZ_MEMORY_ANDROID) michael@0: ;; michael@0: *-*linux*) michael@0: AC_DEFINE(MOZ_MEMORY_LINUX) michael@0: ;; michael@0: *-netbsd*) michael@0: AC_DEFINE(MOZ_MEMORY_BSD) michael@0: ;; michael@0: *-solaris*) michael@0: AC_DEFINE(MOZ_MEMORY_SOLARIS) michael@0: ;; michael@0: *-mingw*) michael@0: AC_DEFINE(MOZ_MEMORY_WINDOWS) michael@0: # the interesting bits will get passed down in MOZ_GLUE_LDFLAGS michael@0: ;; michael@0: *) michael@0: AC_MSG_ERROR([--enable-jemalloc not supported on ${target}]) michael@0: ;; michael@0: esac michael@0: fi michael@0: AC_SUBST(MOZ_MEMORY) michael@0: AC_SUBST(MOZ_GLUE_LDFLAGS) michael@0: AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Use malloc wrapper lib michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(wrap-malloc, michael@0: [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)], michael@0: _WRAP_MALLOC=1, michael@0: _WRAP_MALLOC= ) michael@0: michael@0: if test -n "$_WRAP_MALLOC"; then michael@0: if test "$GNU_CC"; then michael@0: WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign" michael@0: WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete" michael@0: WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup" michael@0: WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size" michael@0: dnl Wrap operator new and operator delete on Android. michael@0: if test "$OS_TARGET" = "Android"; then michael@0: WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_Znwj,--wrap=_Znaj,--wrap=_ZdlPv,--wrap=_ZdaPv" michael@0: fi michael@0: else michael@0: AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains]) michael@0: fi michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = Location of malloc wrapper lib michael@0: dnl ======================================================== michael@0: MOZ_ARG_WITH_STRING(wrap-malloc, michael@0: [ --with-wrap-malloc=DIR Location of malloc wrapper library], michael@0: WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval") michael@0: michael@0: dnl ======================================================== michael@0: dnl = Use JS Call tracing michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(trace-jscalls, michael@0: [ --enable-trace-jscalls Enable JS call enter/exit callback (default=no)], michael@0: MOZ_TRACE_JSCALLS=1, michael@0: MOZ_TRACE_JSCALLS= ) michael@0: if test -n "$MOZ_TRACE_JSCALLS"; then michael@0: AC_DEFINE(MOZ_TRACE_JSCALLS) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = Use incremental GC michael@0: dnl ======================================================== michael@0: JSGC_INCREMENTAL=1 michael@0: MOZ_ARG_DISABLE_BOOL(gcincremental, michael@0: [ --disable-gcincremental Disable incremental GC], michael@0: JSGC_INCREMENTAL= ) michael@0: if test -n "$JSGC_INCREMENTAL"; then michael@0: AC_DEFINE(JSGC_INCREMENTAL) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = Use generational GC michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(gcgenerational, michael@0: [ --enable-gcgenerational Enable generational GC], michael@0: JSGC_GENERATIONAL=1, michael@0: JSGC_GENERATIONAL= ) michael@0: if test -n "$JSGC_GENERATIONAL"; then michael@0: AC_DEFINE(JSGC_GENERATIONAL) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = Use exact stack rooting for GC michael@0: dnl ======================================================== michael@0: MOZ_ARG_DISABLE_BOOL(exact-rooting, michael@0: [ --enable-exact-rooting Enable use of conservative stack scanning for GC], michael@0: JSGC_USE_EXACT_ROOTING=1 , michael@0: JSGC_USE_EXACT_ROOTING= ) michael@0: if test -n "$JSGC_USE_EXACT_ROOTING"; then michael@0: AC_DEFINE(JSGC_USE_EXACT_ROOTING) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = Use Valgrind michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(valgrind, michael@0: [ --enable-valgrind Enable Valgrind integration hooks (default=no)], michael@0: MOZ_VALGRIND=1, michael@0: MOZ_VALGRIND= ) michael@0: if test -n "$MOZ_VALGRIND"; then michael@0: MOZ_CHECK_HEADER([valgrind/valgrind.h], [], michael@0: AC_MSG_ERROR( michael@0: [--enable-valgrind specified but Valgrind is not installed])) michael@0: AC_DEFINE(MOZ_VALGRIND) michael@0: MOZ_VALGRIND=1 michael@0: fi michael@0: AC_SUBST(MOZ_VALGRIND) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Use ARM JIT code simulator. Requires an x86 build. michael@0: dnl ======================================================== michael@0: dnl Also define JS_CODEGEN_ARM in this case. If the simulator is not used, michael@0: dnl JS_CODEGEN_foo is defined if JS_CPU_foo is defined. michael@0: MOZ_ARG_ENABLE_BOOL(arm-simulator, michael@0: [ --enable-arm-simulator Enable ARM simulator for JIT code], michael@0: JS_ARM_SIMULATOR=1, michael@0: JS_ARM_SIMULATOR= ) michael@0: if test -n "$JS_ARM_SIMULATOR"; then michael@0: if test "$CPU_ARCH" != "x86"; then michael@0: AC_MSG_ERROR([The ARM simulator only works on x86.]) michael@0: fi michael@0: AC_DEFINE(JS_ARM_SIMULATOR) michael@0: AC_DEFINE(JS_CODEGEN_ARM) michael@0: JS_CODEGEN_ARM=1 michael@0: elif test "$CPU_ARCH" = "x86"; then michael@0: AC_DEFINE(JS_CODEGEN_X86) michael@0: JS_CODEGEN_X86=1 michael@0: elif test "$CPU_ARCH" = "x86_64"; then michael@0: AC_DEFINE(JS_CODEGEN_X64) michael@0: JS_CODEGEN_X64=1 michael@0: elif test "$CPU_ARCH" = "arm"; then michael@0: AC_DEFINE(JS_CODEGEN_ARM) michael@0: JS_CODEGEN_ARM=1 michael@0: fi michael@0: michael@0: AC_SUBST(JS_ARM_SIMULATOR) michael@0: AC_SUBST(JS_CODEGEN_ARM) michael@0: AC_SUBST(JS_CODEGEN_X86) michael@0: AC_SUBST(JS_CODEGEN_X64) michael@0: michael@0: dnl ======================================================== michael@0: dnl jprof michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(jprof, michael@0: [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.], michael@0: MOZ_JPROF=1, michael@0: MOZ_JPROF= ) michael@0: if test -n "$MOZ_JPROF"; then michael@0: MOZ_PROFILING=1 michael@0: AC_DEFINE(MOZ_JPROF) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl shark michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(shark, michael@0: [ --enable-shark Enable shark remote profiling. Implies --enable-profiling.], michael@0: MOZ_SHARK=1, michael@0: MOZ_SHARK= ) michael@0: if test -n "$MOZ_SHARK"; then michael@0: MOZ_PROFILING=1 michael@0: AC_DEFINE(MOZ_SHARK) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl instruments michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(instruments, michael@0: [ --enable-instruments Enable instruments remote profiling. Implies --enable-profiling.], michael@0: MOZ_INSTRUMENTS=1, michael@0: MOZ_INSTRUMENTS= ) michael@0: if test -n "$MOZ_INSTRUMENTS"; then michael@0: MOZ_PROFILING=1 michael@0: AC_DEFINE(MOZ_INSTRUMENTS) michael@0: LIBS="$LIBS -framework CoreFoundation" michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl callgrind michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(callgrind, michael@0: [ --enable-callgrind Enable callgrind profiling. Implies --enable-profiling.], michael@0: MOZ_CALLGRIND=1, michael@0: MOZ_CALLGRIND= ) michael@0: if test -n "$MOZ_CALLGRIND"; then michael@0: MOZ_PROFILING=1 michael@0: AC_DEFINE(MOZ_CALLGRIND) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl vtune michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(vtune, michael@0: [ --enable-vtune Enable vtune profiling. Implies --enable-profiling.], michael@0: MOZ_VTUNE=1, michael@0: MOZ_VTUNE= ) michael@0: michael@0: dnl ======================================================== michael@0: dnl Debug (see Bug 939505) michael@0: dnl ======================================================== michael@0: if test -n "$MOZ_DEBUG"; then michael@0: AC_DEFINE(JS_DEBUG) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl Profiling michael@0: dnl ======================================================== michael@0: if test -n "$MOZ_PROFILING"; then michael@0: AC_DEFINE(MOZ_PROFILING) michael@0: michael@0: case "$OS_TARGET" in michael@0: Linux) MOZ_VTUNE=1 ;; michael@0: WINNT) MOZ_VTUNE=1 ;; michael@0: esac michael@0: fi michael@0: michael@0: if test -n "$MOZ_VTUNE"; then michael@0: AC_DEFINE(MOZ_VTUNE) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl Zealous JavaScript GC michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(gczeal, michael@0: [ --enable-gczeal Enable zealous GCing], michael@0: JS_GC_ZEAL=1, michael@0: JS_GC_ZEAL= ) michael@0: if test -n "$JS_GC_ZEAL" -o -n "$MOZ_DEBUG"; then michael@0: AC_DEFINE(JS_GC_ZEAL) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable perf logging for ion. michael@0: dnl = Perf logging is OFF by default michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(perf, michael@0: [ --enable-perf Enable Linux perf integration], michael@0: JS_ION_PERF=1, michael@0: JS_ION_PERF= ) michael@0: if test -n "$JS_ION_PERF"; then michael@0: AC_DEFINE(JS_ION_PERF) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl JS opt-mode assertions and minidump instrumentation michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(js-diagnostics, michael@0: [ --enable-js-diagnostics michael@0: Enable JS diagnostic assertions and breakpad data], michael@0: JS_CRASH_DIAGNOSTICS=1, michael@0: JS_CRASH_DIAGNOSTICS= ) michael@0: if test -n "$JS_CRASH_DIAGNOSTICS"; then michael@0: AC_DEFINE(JS_CRASH_DIAGNOSTICS) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl Enable changes that make the shell more deterministic michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(more-deterministic, michael@0: [ --enable-more-deterministic michael@0: Enable changes that make the shell more deterministic], michael@0: JS_MORE_DETERMINISTIC=1, michael@0: JS_MORE_DETERMINISTIC= ) michael@0: if test -n "$JS_MORE_DETERMINISTIC"; then michael@0: AC_DEFINE(JS_MORE_DETERMINISTIC) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl Enable breakpoint for artificial OOMs michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(oom-breakpoint, michael@0: [ --enable-oom-breakpoint michael@0: Enable a breakpoint function for artificial OOMs], michael@0: JS_OOM_BREAKPOINT=1, michael@0: JS_OOM_BREAKPOINT= ) michael@0: if test -n "$JS_OOM_BREAKPOINT"; then michael@0: AC_DEFINE(JS_OOM_BREAKPOINT) michael@0: fi michael@0: michael@0: MOZ_CHECK_CCACHE michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable static checking using gcc-dehydra michael@0: dnl ======================================================== michael@0: michael@0: MOZ_ARG_WITH_STRING(static-checking, michael@0: [ --with-static-checking=path/to/gcc_dehydra.so michael@0: Enable static checking of code using GCC-dehydra], michael@0: DEHYDRA_PATH=$withval, michael@0: DEHYDRA_PATH= ) michael@0: michael@0: if test -n "$DEHYDRA_PATH"; then michael@0: if test ! -f "$DEHYDRA_PATH"; then michael@0: AC_MSG_ERROR([The dehydra plugin is not at the specified path.]) michael@0: fi michael@0: AC_DEFINE(NS_STATIC_CHECKING) michael@0: fi michael@0: AC_SUBST(DEHYDRA_PATH) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable using the clang plugin to build michael@0: dnl ======================================================== michael@0: michael@0: MOZ_ARG_ENABLE_BOOL(clang-plugin, michael@0: [ --enable-clang-plugin Enable building with the mozilla clang plugin ], michael@0: ENABLE_CLANG_PLUGIN=1, michael@0: ENABLE_CLANG_PLUGIN= ) michael@0: if test -n "$ENABLE_CLANG_PLUGIN"; then michael@0: if test -z "$CLANG_CC"; then michael@0: AC_MSG_ERROR([Can't use clang plugin without clang.]) michael@0: fi michael@0: AC_DEFINE(MOZ_CLANG_PLUGIN) michael@0: fi michael@0: michael@0: AC_SUBST(ENABLE_CLANG_PLUGIN) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable static checking using sixgill michael@0: dnl ======================================================== michael@0: michael@0: MOZ_ARG_WITH_STRING(sixgill, michael@0: [ --with-sixgill=path/to/sixgill michael@0: Enable static checking of code using sixgill], michael@0: SIXGILL_PATH=$withval, michael@0: SIXGILL_PATH= ) michael@0: michael@0: if test -n "$SIXGILL_PATH"; then michael@0: if test ! -x "$SIXGILL_PATH/bin/xdbfind" || test ! -f "$SIXGILL_PATH/gcc/xgill.so" || test ! -x "$SIXGILL_PATH/scripts/wrap_gcc/g++"; then michael@0: AC_MSG_ERROR([The sixgill plugin and binaries are not at the specified path.]) michael@0: fi michael@0: fi michael@0: AC_SUBST(SIXGILL_PATH) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable stripping of libs & executables michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(strip, michael@0: [ --enable-strip Enable stripping of libs & executables ], michael@0: ENABLE_STRIP=1, michael@0: ENABLE_STRIP= ) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable stripping of libs & executables when packaging michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(install-strip, michael@0: [ --enable-install-strip Enable stripping of libs & executables when packaging ], michael@0: PKG_SKIP_STRIP= , michael@0: PKG_SKIP_STRIP=1) michael@0: michael@0: dnl ======================================================== michael@0: dnl = michael@0: dnl = Profiling and Instrumenting michael@0: dnl = michael@0: dnl ======================================================== michael@0: MOZ_ARG_HEADER(Profiling and Instrumenting) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Support for demangling undefined symbols michael@0: dnl ======================================================== michael@0: if test -z "$SKIP_LIBRARY_CHECKS"; then michael@0: AC_LANG_SAVE michael@0: AC_LANG_CPLUSPLUS michael@0: AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=) michael@0: AC_LANG_RESTORE michael@0: fi michael@0: michael@0: # Demangle only for debug or trace-malloc or DMD builds michael@0: MOZ_DEMANGLE_SYMBOLS= michael@0: if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then michael@0: MOZ_DEMANGLE_SYMBOLS=1 michael@0: AC_DEFINE(MOZ_DEMANGLE_SYMBOLS) michael@0: fi michael@0: AC_SUBST(MOZ_DEMANGLE_SYMBOLS) michael@0: michael@0: dnl ======================================================== michael@0: dnl JIT observers michael@0: dnl ======================================================== michael@0: michael@0: MOZ_ARG_WITH_STRING(jitreport-granularity, michael@0: [ --jitreport-granularity=N michael@0: Default granularity at which to report JIT code michael@0: to external tools michael@0: 0 - no info michael@0: 1 - code ranges for whole functions only michael@0: 2 - per-line information michael@0: 3 - per-op information], michael@0: JITREPORT_GRANULARITY=$withval, michael@0: JITREPORT_GRANULARITY=3) michael@0: michael@0: AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY) michael@0: michael@0: dnl ======================================================== michael@0: dnl = michael@0: dnl = Misc. Options michael@0: dnl = michael@0: dnl ======================================================== michael@0: MOZ_ARG_HEADER(Misc. Options) michael@0: michael@0: dnl ======================================================== michael@0: dnl update xterm title michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(xterm-updates, michael@0: [ --enable-xterm-updates Update XTERM titles with current command.], michael@0: MOZ_UPDATE_XTERM=1, michael@0: MOZ_UPDATE_XTERM= ) michael@0: michael@0: if test -z "$SKIP_COMPILER_CHECKS"; then michael@0: dnl ======================================================== michael@0: dnl = michael@0: dnl = Compiler Options michael@0: dnl = michael@0: dnl ======================================================== michael@0: MOZ_ARG_HEADER(Compiler Options) michael@0: michael@0: dnl ======================================================== michael@0: dnl Check for gcc -pipe support michael@0: dnl ======================================================== michael@0: AC_MSG_CHECKING([for -pipe support]) michael@0: if test -n "$GNU_CC" -a -n "$GNU_CXX"; then michael@0: dnl Any gcc that supports firefox supports -pipe. michael@0: CFLAGS="$CFLAGS -pipe" michael@0: CXXFLAGS="$CXXFLAGS -pipe" michael@0: AC_MSG_RESULT([yes]) michael@0: else michael@0: AC_MSG_RESULT([no]) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl Profile guided optimization (gcc checks) michael@0: dnl ======================================================== michael@0: dnl Test for profiling options michael@0: dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use michael@0: michael@0: _SAVE_CFLAGS="$CFLAGS" michael@0: CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction" michael@0: michael@0: AC_MSG_CHECKING([whether C compiler supports -fprofile-generate]) michael@0: AC_TRY_COMPILE([], [return 0;], michael@0: [ PROFILE_GEN_CFLAGS="-fprofile-generate" michael@0: result="yes" ], result="no") michael@0: AC_MSG_RESULT([$result]) michael@0: michael@0: if test $result = "yes"; then michael@0: PROFILE_GEN_LDFLAGS="-fprofile-generate" michael@0: PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch" michael@0: PROFILE_USE_LDFLAGS="-fprofile-use" michael@0: fi michael@0: michael@0: CFLAGS="$_SAVE_CFLAGS" michael@0: michael@0: if test -n "$INTEL_CC"; then michael@0: PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ." michael@0: PROFILE_GEN_LDFLAGS= michael@0: PROFILE_USE_CFLAGS="-prof-use -prof-dir ." michael@0: PROFILE_USE_LDFLAGS= michael@0: fi michael@0: michael@0: dnl Sun Studio on Solaris michael@0: if test "$SOLARIS_SUNPRO_CC"; then michael@0: PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application" michael@0: PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application" michael@0: PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application" michael@0: PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application" michael@0: fi michael@0: michael@0: AC_SUBST(PROFILE_GEN_CFLAGS) michael@0: AC_SUBST(PROFILE_GEN_LDFLAGS) michael@0: AC_SUBST(PROFILE_USE_CFLAGS) michael@0: AC_SUBST(PROFILE_USE_LDFLAGS) michael@0: michael@0: AC_LANG_CPLUSPLUS michael@0: michael@0: dnl ======================================================== michael@0: dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't michael@0: dnl provide non-const forms of the operator== for comparing nsCOMPtrs to michael@0: dnl raw pointers in nsCOMPtr.h. (VC++ has the same bug.) michael@0: dnl ======================================================== michael@0: _SAVE_CXXFLAGS=$CXXFLAGS michael@0: CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}" michael@0: AC_CACHE_CHECK(for correct overload resolution with const and templates, michael@0: ac_nscap_nonconst_opeq_bug, michael@0: [AC_TRY_COMPILE([ michael@0: template michael@0: class Pointer michael@0: { michael@0: public: michael@0: T* myPtr; michael@0: }; michael@0: michael@0: template michael@0: int operator==(const Pointer& rhs, U* lhs) michael@0: { michael@0: return rhs.myPtr == lhs; michael@0: } michael@0: michael@0: template michael@0: int operator==(const Pointer& rhs, const U* lhs) michael@0: { michael@0: return rhs.myPtr == lhs; michael@0: } michael@0: ], michael@0: [ michael@0: Pointer foo; michael@0: const int* bar; michael@0: return foo == bar; michael@0: ], michael@0: ac_nscap_nonconst_opeq_bug="no", michael@0: ac_nscap_nonconst_opeq_bug="yes")]) michael@0: CXXFLAGS="$_SAVE_CXXFLAGS" michael@0: michael@0: if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then michael@0: AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl Check for tm_zone, tm_gmtoff in struct tm michael@0: dnl ======================================================== michael@0: AC_CACHE_CHECK(for tm_zone tm_gmtoff in struct tm, michael@0: ac_cv_struct_tm_zone_tm_gmtoff, michael@0: [AC_TRY_COMPILE([#include ], michael@0: [struct tm tm; tm.tm_zone = 0; tm.tm_gmtoff = 1;], michael@0: [ac_cv_struct_tm_zone_tm_gmtoff="yes"], michael@0: [ac_cv_struct_tm_zone_tm_gmtoff="no"])]) michael@0: if test "$ac_cv_struct_tm_zone_tm_gmtoff" = "yes" ; then michael@0: AC_DEFINE(HAVE_TM_ZONE_TM_GMTOFF) michael@0: fi michael@0: fi # ! SKIP_COMPILER_CHECKS michael@0: michael@0: AC_DEFINE(CPP_THROW_NEW, [throw()]) michael@0: AC_LANG_C michael@0: michael@0: MOZ_EXPAND_LIBS michael@0: michael@0: dnl ======================================================== michael@0: dnl = michael@0: dnl = Build depencency options michael@0: dnl = michael@0: dnl ======================================================== michael@0: MOZ_ARG_HEADER(Build dependencies) michael@0: michael@0: if test "$GNU_CC" -a "$GNU_CXX"; then michael@0: _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp' michael@0: dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk michael@0: elif test "$SOLARIS_SUNPRO_CC"; then michael@0: _DEPEND_CFLAGS= michael@0: else michael@0: dnl Don't override this for MSVC michael@0: if test -z "$_WIN32_MSVC"; then michael@0: _USE_CPP_INCLUDE_FLAG= michael@0: _DEFINES_CFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT' michael@0: _DEFINES_CXXFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT' michael@0: else michael@0: echo '#include ' > dummy-hello.c michael@0: changequote(,) michael@0: dnl This output is localized, split at the first double space or colon and space. michael@0: _CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*stdio.h\)$" michael@0: CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'` michael@0: _CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'` michael@0: changequote([,]) michael@0: if ! test -e "$_CL_STDIO_PATH"; then michael@0: AC_MSG_ERROR([Unable to parse cl -showIncludes prefix. This compiler's locale has an unsupported formatting.]) michael@0: fi michael@0: if test -z "$CL_INCLUDES_PREFIX"; then michael@0: AC_MSG_ERROR([Cannot find cl -showIncludes prefix.]) michael@0: fi michael@0: AC_SUBST(CL_INCLUDES_PREFIX) michael@0: rm -f dummy-hello.c michael@0: michael@0: dnl Make sure that the build system can handle non-ASCII characters michael@0: dnl in environment variables to prevent it from breaking silently on michael@0: dnl non-English systems. michael@0: NONASCII=$'\241\241' michael@0: AC_SUBST(NONASCII) michael@0: fi michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = Disable -fstrict-aliasing with GCC 4.4 and earlier. michael@0: dnl = See bugs 821502 and 832623. michael@0: dnl ======================================================== michael@0: if test -n "$GNU_CC" -a -z "$CLANG_CC"; then michael@0: dnl GCC 3.x isn't supported, so we don't need to check for that. michael@0: if test "$GCC_MAJOR_VERSION" -eq "4" -a "$GCC_MINOR_VERSION" -lt "5" ; then michael@0: CFLAGS="$CFLAGS -fno-strict-aliasing" michael@0: CXXFLAGS="$CXXFLAGS -fno-strict-aliasing" michael@0: fi michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = Link js shell to system readline michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(readline, michael@0: [ --enable-readline Link js shell to system readline library], michael@0: JS_WANT_READLINE=1, michael@0: JS_WANT_READLINE= ) michael@0: michael@0: JS_NATIVE_EDITLINE= michael@0: EDITLINE_LIBS= michael@0: JS_DISABLE_SHELL= michael@0: michael@0: case "$target" in michael@0: *-mingw*) michael@0: NO_EDITLINE=1 michael@0: ;; michael@0: *) michael@0: ;; michael@0: esac michael@0: michael@0: if test -z "$SKIP_LIBRARY_CHECKS" -a -z "$NO_EDITLINE"; then michael@0: if test -n "$JS_WANT_READLINE"; then michael@0: AC_CHECK_LIB(readline, readline, michael@0: EDITLINE_LIBS="-lreadline", michael@0: AC_MSG_ERROR([No system readline library found.])) michael@0: else michael@0: dnl By default, we use editline michael@0: JS_NATIVE_EDITLINE=1 michael@0: EDITLINE_LIBS='$(DEPTH)/js/src/editline/$(LIB_PREFIX)editline.$(LIB_SUFFIX)' michael@0: fi michael@0: michael@0: dnl Either way, we want to build with line editing support. michael@0: AC_DEFINE(EDITLINE) michael@0: fi michael@0: AC_SUBST(JS_NATIVE_EDITLINE) michael@0: AC_SUBST(JS_DISABLE_SHELL) michael@0: AC_SUBST(EDITLINE_LIBS) michael@0: michael@0: dnl ======================================================== michael@0: dnl = michael@0: dnl = Standalone module options michael@0: dnl = michael@0: dnl ======================================================== michael@0: MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla)) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Build jsctypes if it's enabled michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(ctypes, michael@0: [ --enable-ctypes Enable js-ctypes (default=no)], michael@0: BUILD_CTYPES=1, michael@0: BUILD_CTYPES= ) michael@0: JS_HAS_CTYPES=$BUILD_CTYPES michael@0: AC_SUBST(JS_HAS_CTYPES) michael@0: AC_SUBST(BUILD_CTYPES) michael@0: if test "$JS_HAS_CTYPES"; then michael@0: dnl Error out if we're on MSVC and MASM is unavailable. michael@0: if test -n "$_MSC_VER" -a \( "$AS" != "ml.exe" -a "$AS" != "ml64.exe" \); then michael@0: 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.]) michael@0: fi michael@0: AC_DEFINE(JS_HAS_CTYPES) michael@0: fi michael@0: michael@0: if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then michael@0: MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS= michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = michael@0: dnl = Options for generating the shell as a script michael@0: dnl = michael@0: dnl ======================================================== michael@0: michael@0: MOZ_ARG_WITH_STRING(qemu-exe, michael@0: [ --with-qemu-exe=path Use path as an arm emulator on host platforms], michael@0: QEMU_EXE=$withval) michael@0: AC_SUBST(QEMU_EXE) michael@0: MOZ_ARG_WITH_STRING(cross-lib, michael@0: [ --with-cross-lib=dir Use dir as the location for arm libraries], michael@0: CROSS_LIB=$withval, michael@0: CROSS_LIB=/usr/$target) michael@0: AC_SUBST(CROSS_LIB) michael@0: dnl ======================================================== michael@0: dnl = michael@0: dnl = Maintainer debug option (no --enable equivalent) michael@0: dnl = michael@0: dnl ======================================================== michael@0: michael@0: AC_SUBST(AR) michael@0: AC_SUBST(AR_FLAGS) michael@0: AC_SUBST(AR_LIST) michael@0: AC_SUBST(AR_EXTRACT) michael@0: AC_SUBST(AR_DELETE) michael@0: AC_SUBST(AS) michael@0: AC_SUBST(ASFLAGS) michael@0: AC_SUBST(AS_DASH_C_FLAG) michael@0: AC_SUBST(LD) michael@0: AC_SUBST(RC) michael@0: AC_SUBST(RCFLAGS) michael@0: AC_SUBST(MC) michael@0: AC_SUBST(WINDRES) michael@0: AC_SUBST(IMPLIB) michael@0: AC_SUBST(FILTER) michael@0: AC_SUBST(BIN_FLAGS) michael@0: AC_SUBST(MOZ_DEBUG) michael@0: AC_SUBST(MOZ_DEBUG_SYMBOLS) michael@0: AC_SUBST(MOZ_DEBUG_ENABLE_DEFS) michael@0: AC_SUBST(MOZ_DEBUG_DISABLE_DEFS) michael@0: AC_SUBST(MOZ_DEBUG_LDFLAGS) michael@0: AC_SUBST(WARNINGS_AS_ERRORS) michael@0: AC_SUBST(MOZ_JPROF) michael@0: AC_SUBST(MOZ_SHARK) michael@0: AC_SUBST(MOZ_INSTRUMENTS) michael@0: AC_SUBST(MOZ_CALLGRIND) michael@0: AC_SUBST(MOZ_VTUNE) michael@0: AC_SUBST(MOZ_PROFILING) michael@0: AC_SUBST(LIBICONV) michael@0: michael@0: AC_SUBST(ENABLE_TESTS) michael@0: michael@0: AC_SUBST(ENABLE_STRIP) michael@0: AC_SUBST(PKG_SKIP_STRIP) michael@0: AC_SUBST(INCREMENTAL_LINKER) michael@0: AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS) michael@0: AC_SUBST(MOZ_COMPONENT_NSPR_LIBS) michael@0: michael@0: AC_SUBST(MOZ_FIX_LINK_PATHS) michael@0: michael@0: AC_SUBST(USE_DEPENDENT_LIBS) michael@0: michael@0: AC_SUBST(MOZ_BUILD_ROOT) michael@0: michael@0: AC_SUBST(MOZ_POST_DSO_LIB_COMMAND) michael@0: AC_SUBST(MOZ_POST_PROGRAM_COMMAND) michael@0: michael@0: AC_SUBST(MOZ_APP_NAME) michael@0: AC_SUBST(MOZ_APP_DISPLAYNAME) michael@0: AC_SUBST(MOZ_APP_VERSION) michael@0: michael@0: AC_SUBST(MOZ_PKG_SPECIAL) michael@0: michael@0: AC_SUBST(MOZILLA_OFFICIAL) michael@0: michael@0: dnl win32 options michael@0: AC_SUBST(MOZ_BROWSE_INFO) michael@0: AC_SUBST(MOZ_TOOLS_DIR) michael@0: michael@0: dnl Echo the CFLAGS to remove extra whitespace. michael@0: CFLAGS=`echo \ michael@0: $_WARNINGS_CFLAGS \ michael@0: $CFLAGS` michael@0: michael@0: CXXFLAGS=`echo \ michael@0: $_WARNINGS_CXXFLAGS \ michael@0: $CXXFLAGS` michael@0: michael@0: COMPILE_CFLAGS=`echo \ michael@0: $_DEFINES_CFLAGS \ michael@0: $_DEPEND_CFLAGS \ michael@0: $COMPILE_CFLAGS` michael@0: michael@0: COMPILE_CXXFLAGS=`echo \ michael@0: $_DEFINES_CXXFLAGS \ michael@0: $_DEPEND_CFLAGS \ michael@0: $COMPILE_CXXFLAGS` michael@0: michael@0: HOST_CFLAGS=`echo \ michael@0: $HOST_CFLAGS \ michael@0: $_DEPEND_CFLAGS` michael@0: michael@0: HOST_CXXFLAGS=`echo \ michael@0: $HOST_CXXFLAGS \ michael@0: $_DEPEND_CFLAGS` michael@0: michael@0: AC_SUBST(NSPR_CFLAGS) michael@0: AC_SUBST(NSPR_LIBS) michael@0: AC_SUBST(MOZ_NATIVE_NSPR) michael@0: michael@0: if test -n "$MOZ_NUWA_PROCESS"; then michael@0: AC_DEFINE(MOZ_NUWA_PROCESS) michael@0: fi michael@0: michael@0: OS_CFLAGS="$CFLAGS" michael@0: OS_CXXFLAGS="$CXXFLAGS" michael@0: OS_CPPFLAGS="$CPPFLAGS" michael@0: OS_COMPILE_CFLAGS="$COMPILE_CFLAGS" michael@0: OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS" michael@0: OS_LDFLAGS="$LDFLAGS" michael@0: OS_LIBS="$LIBS" michael@0: AC_SUBST(OS_CFLAGS) michael@0: AC_SUBST(OS_CXXFLAGS) michael@0: AC_SUBST(OS_CPPFLAGS) michael@0: AC_SUBST(OS_COMPILE_CFLAGS) michael@0: AC_SUBST(OS_COMPILE_CXXFLAGS) michael@0: AC_SUBST(OS_LDFLAGS) michael@0: AC_SUBST(OS_LIBS) michael@0: AC_SUBST(CROSS_COMPILE) michael@0: AC_SUBST(MOZ_METRO) michael@0: michael@0: AC_SUBST(HOST_CC) michael@0: AC_SUBST(HOST_CXX) michael@0: AC_SUBST(HOST_CFLAGS) michael@0: AC_SUBST(HOST_CXXFLAGS) michael@0: AC_SUBST(HOST_LDFLAGS) michael@0: AC_SUBST(HOST_OPTIMIZE_FLAGS) michael@0: AC_SUBST(HOST_AR) michael@0: AC_SUBST(HOST_AR_FLAGS) michael@0: AC_SUBST(HOST_LD) michael@0: AC_SUBST(HOST_RANLIB) michael@0: AC_SUBST(HOST_NSPR_MDCPUCFG) michael@0: AC_SUBST(HOST_BIN_SUFFIX) michael@0: AC_SUBST(HOST_OS_ARCH) michael@0: michael@0: AC_SUBST(TARGET_CPU) michael@0: AC_SUBST(TARGET_VENDOR) michael@0: AC_SUBST(TARGET_OS) michael@0: AC_SUBST(TARGET_NSPR_MDCPUCFG) michael@0: AC_SUBST(TARGET_MD_ARCH) michael@0: AC_SUBST(TARGET_XPCOM_ABI) michael@0: AC_SUBST(OS_TARGET) michael@0: AC_SUBST(OS_ARCH) michael@0: AC_SUBST(OS_RELEASE) michael@0: AC_SUBST(OS_TEST) michael@0: AC_SUBST(CPU_ARCH) michael@0: AC_SUBST(INTEL_ARCHITECTURE) michael@0: michael@0: AC_SUBST(WRAP_LDFLAGS) michael@0: AC_SUBST(MKSHLIB) michael@0: AC_SUBST(MKCSHLIB) michael@0: AC_SUBST(MKSHLIB_FORCE_ALL) michael@0: AC_SUBST(MKSHLIB_UNFORCE_ALL) michael@0: AC_SUBST(DSO_CFLAGS) michael@0: AC_SUBST(DSO_PIC_CFLAGS) michael@0: AC_SUBST(DSO_LDOPTS) michael@0: AC_SUBST(LIB_PREFIX) michael@0: AC_SUBST(DLL_PREFIX) michael@0: AC_SUBST(DLL_SUFFIX) michael@0: AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX") michael@0: AC_SUBST(LIB_SUFFIX) michael@0: AC_SUBST(OBJ_SUFFIX) michael@0: AC_SUBST(BIN_SUFFIX) michael@0: AC_SUBST(ASM_SUFFIX) michael@0: AC_SUBST(IMPORT_LIB_SUFFIX) michael@0: AC_SUBST(USE_N32) michael@0: AC_SUBST(CC_VERSION) michael@0: AC_SUBST(CXX_VERSION) michael@0: AC_SUBST(MSMANIFEST_TOOL) michael@0: AC_SUBST(MOZ_LINKER) michael@0: michael@0: AC_CHECK_FUNCS(posix_fadvise posix_fallocate) michael@0: michael@0: dnl Check for missing components michael@0: if test "$COMPILE_ENVIRONMENT"; then michael@0: if test "$MOZ_X11"; then michael@0: dnl ==================================================== michael@0: dnl = Check if X headers exist michael@0: dnl ==================================================== michael@0: _SAVE_CFLAGS=$CFLAGS michael@0: CFLAGS="$CFLAGS $XCFLAGS" michael@0: AC_TRY_COMPILE([ michael@0: #include michael@0: #include michael@0: #include michael@0: #include michael@0: ], michael@0: [ michael@0: Display *dpy = 0; michael@0: if ((dpy = XOpenDisplay(NULL)) == NULL) { michael@0: fprintf(stderr, ": can't open %s\n", XDisplayName(NULL)); michael@0: exit(1); michael@0: } michael@0: ], [], michael@0: [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ]) michael@0: CFLAGS="$_SAVE_CFLAGS" michael@0: michael@0: if test -n "$MISSING_X"; then michael@0: AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]); michael@0: fi michael@0: michael@0: fi # MOZ_X11 michael@0: fi # COMPILE_ENVIRONMENT michael@0: michael@0: dnl Set various defines and substitutions michael@0: dnl ======================================================== michael@0: michael@0: if test "$OS_ARCH" = "Darwin"; then michael@0: AC_DEFINE(XP_MACOSX) michael@0: AC_DEFINE(XP_UNIX) michael@0: elif test "$OS_ARCH" != "WINNT"; then michael@0: AC_DEFINE(XP_UNIX) michael@0: fi michael@0: michael@0: if test "$MOZ_DEBUG"; then michael@0: AC_DEFINE(MOZ_REFLOW_PERF) michael@0: AC_DEFINE(MOZ_REFLOW_PERF_DSP) michael@0: fi michael@0: michael@0: if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then michael@0: AC_DEFINE(MOZ_ACCESSIBILITY_ATK) michael@0: ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk` michael@0: ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'` michael@0: ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'` michael@0: ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'` michael@0: AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION) michael@0: AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION) michael@0: AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION) michael@0: fi michael@0: michael@0: michael@0: dnl ======================================================== michael@0: dnl ECMAScript Internationalization API Support (uses ICU) michael@0: dnl ======================================================== michael@0: michael@0: dnl top-level configure may override this with --without-intl-api michael@0: _INTL_API=yes michael@0: michael@0: MOZ_CONFIG_ICU() michael@0: michael@0: MOZ_SUBCONFIGURE_ICU() michael@0: michael@0: dnl ======================================================== michael@0: dnl JavaScript shell michael@0: dnl ======================================================== michael@0: michael@0: AC_HAVE_FUNCS(setlocale) michael@0: AC_HAVE_FUNCS(localeconv) michael@0: michael@0: AC_SUBST(MOZILLA_VERSION) michael@0: michael@0: AC_SUBST(ac_configure_args) michael@0: michael@0: AC_SUBST(TOOLCHAIN_PREFIX) michael@0: michael@0: michael@0: if test -n "$JS_STANDALONE"; then michael@0: MOZ_APP_NAME="mozjs" michael@0: MOZ_APP_VERSION="$MOZILLA_SYMBOLVERSION" michael@0: JS_LIBRARY_NAME="mozjs-$MOZILLA_SYMBOLVERSION" michael@0: else michael@0: JS_LIBRARY_NAME="mozjs" michael@0: fi michael@0: JS_CONFIG_LIBS="$NSPR_LIBS $LIBS" michael@0: if test -n "$GNU_CC"; then michael@0: JS_CONFIG_MOZ_JS_LIBS='-L${libdir} -l${JS_LIBRARY_NAME}' michael@0: else michael@0: JS_CONFIG_MOZ_JS_LIBS='${libdir}/${JS_LIBRARY_NAME}.lib' michael@0: fi michael@0: AC_SUBST(JS_LIBRARY_NAME) michael@0: AC_SUBST(JS_CONFIG_MOZ_JS_LIBS) michael@0: AC_SUBST(JS_CONFIG_LIBS) michael@0: michael@0: MOZ_SUBCONFIGURE_FFI() michael@0: michael@0: dnl Spit out some output michael@0: dnl ======================================================== michael@0: MOZ_CREATE_CONFIG_STATUS() michael@0: michael@0: if test "$JS_STANDALONE"; then michael@0: MOZ_RUN_CONFIG_STATUS() michael@0: fi