michael@0: 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(config/config.mk) 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: MOZJPEG=62 michael@0: MOZPNG=10610 michael@0: NSPR_VERSION=4 michael@0: NSS_VERSION=3 michael@0: michael@0: dnl Set the minimum version of toolkit libs used by mozilla michael@0: dnl ======================================================== michael@0: GLIB_VERSION=1.2.0 michael@0: PERL_VERSION=5.006 michael@0: CAIRO_VERSION=1.10 michael@0: PANGO_VERSION=1.22.0 michael@0: GTK2_VERSION=2.10.0 michael@0: GTK3_VERSION=3.0.0 michael@0: WINDRES_VERSION=2.14.90 michael@0: W32API_VERSION=3.14 michael@0: GNOMEVFS_VERSION=2.0 michael@0: GNOMEUI_VERSION=2.2.0 michael@0: GCONF_VERSION=1.2.1 michael@0: GIO_VERSION=2.20 michael@0: STARTUP_NOTIFICATION_VERSION=0.8 michael@0: DBUS_VERSION=0.60 michael@0: SQLITE_VERSION=3.8.4.2 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: MOZ_USE_PTHREADS= michael@0: _PTHREAD_LDFLAGS="" michael@0: michael@0: dnl Do not allow objdir == srcdir builds. michael@0: dnl ============================================================== michael@0: _topsrcdir=`cd \`dirname $0\`; pwd` michael@0: _objdir=`pwd` michael@0: michael@0: michael@0: dnl TODO Don't exempt L10N builds once bug 842760 is resolved. michael@0: if test "$_topsrcdir" = "$_objdir" -a "${with_l10n_base+set}" != set; then michael@0: echo " ***" michael@0: echo " * Building directly in the main source directory is not allowed." michael@0: echo " *" michael@0: echo " * To build, you must run configure from a separate directory" michael@0: echo " * (referred to as an object directory)." michael@0: echo " *" michael@0: echo " * If you are building with a mozconfig, you will need to change your" michael@0: echo " * mozconfig to point to a different object directory." michael@0: echo " ***" michael@0: exit 1 michael@0: fi michael@0: 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: MOZ_BUILD_ROOT=`pwd` michael@0: michael@0: MOZ_PYTHON 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: MOZ_ARG_WITH_STRING(l10n-base, michael@0: [ --with-l10n-base=DIR path to l10n repositories], michael@0: L10NBASEDIR=$withval) michael@0: if test -n "$L10NBASEDIR"; then michael@0: if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then michael@0: AC_MSG_ERROR([--with-l10n-base must specify a path]) michael@0: elif test -d "$L10NBASEDIR"; then michael@0: L10NBASEDIR=`cd "$L10NBASEDIR" && pwd` michael@0: else michael@0: AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist]) michael@0: fi michael@0: fi michael@0: AC_SUBST(L10NBASEDIR) 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: if test -n "$GAIADIR" -a ! -d "$GAIADIR" ; then michael@0: AC_MSG_ERROR([GAIADIR '$GAIADIR' isn't a valid directory]) michael@0: fi michael@0: michael@0: AC_SUBST(GAIADIR) michael@0: if test -n "$GAIADIR" ; then michael@0: AC_DEFINE(PACKAGE_GAIA) michael@0: fi michael@0: michael@0: if test -n "$FXOS_SIMULATOR" -a -z "$GAIADIR" ; then michael@0: AC_MSG_ERROR([FXOS_SIMULATOR=1 requires GAIADIR to be defined]) michael@0: fi michael@0: michael@0: if test -n "$FXOS_SIMULATOR" ; then michael@0: AC_DEFINE(FXOS_SIMULATOR) michael@0: AC_SUBST(FXOS_SIMULATOR) michael@0: fi 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: android_source="$gonkdir" michael@0: ANDROID_SOURCE="$android_source" michael@0: ANDROID_NDK="${ANDROID_SOURCE}/ndk" michael@0: dnl Default to ICS michael@0: ANDROID_VERSION=15 michael@0: if test -n "${PLATFORM_SDK_VERSION}"; then michael@0: ANDROID_VERSION="${PLATFORM_SDK_VERSION}" michael@0: fi michael@0: michael@0: dnl set up compilers michael@0: TOOLCHAIN_PREFIX="$gonk_toolchain_prefix" 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: if ! test -e "$gonkdir/ndk/sources/cxx-stl/stlport/src/iostream.cpp"; then michael@0: AC_MSG_ERROR([Couldn't find path to stlport sources in the gonk tree]) michael@0: fi michael@0: STLPORT_CPPFLAGS="-I$_topsrcdir/build/stlport/stlport -I$gonkdir/ndk/sources/cxx-stl/system/include" michael@0: STLPORT_LIBS="$_objdir/build/stlport/libstlport_static.a" 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: case "$ANDROID_VERSION" in michael@0: 15) michael@0: GONK_INCLUDES="-I$gonkdir/frameworks/base/opengl/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/frameworks/base/include -I$gonkdir/frameworks/base/services/camera -I$gonkdir/frameworks/base/include/media/ -I$gonkdir/frameworks/base/include/media/stagefright -I$gonkdir/frameworks/base/include/media/stagefright/openmax -I$gonkdir/frameworks/base/media/libstagefright/rtsp -I$gonkdir/frameworks/base/media/libstagefright/include -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib -I$gonkdir/dalvik/libnativehelper/include/nativehelper" michael@0: MOZ_B2G_BT=1 michael@0: MOZ_B2G_BT_BLUEZ=1 michael@0: MOZ_NFC=1 michael@0: MOZ_B2G_CAMERA=1 michael@0: MOZ_OMX_DECODER=1 michael@0: AC_SUBST(MOZ_OMX_DECODER) michael@0: MOZ_RTSP=1 michael@0: ;; michael@0: 17|18) michael@0: GONK_INCLUDES="-I$gonkdir/frameworks/native/include -I$gonkdir/frameworks/av/include -I$gonkdir/frameworks/av/include/media -I$gonkdir/frameworks/av/include/camera -I$gonkdir/frameworks/native/include/media/openmax -I$gonkdir/frameworks/av/media/libstagefright/include" michael@0: if test -d "$gonkdir/external/bluetooth/bluez"; then michael@0: GONK_INCLUDES="$GONK_INCLUDES -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib" michael@0: MOZ_B2G_BT=1 michael@0: MOZ_B2G_BT_BLUEZ=1 michael@0: elif test -d "$gonkdir/external/bluetooth/bluedroid"; then michael@0: MOZ_B2G_BT=1 michael@0: MOZ_B2G_BT_BLUEDROID=1 michael@0: fi michael@0: michael@0: MOZ_RTSP=1 michael@0: MOZ_NFC=1 michael@0: MOZ_B2G_CAMERA=1 michael@0: MOZ_OMX_DECODER=1 michael@0: AC_SUBST(MOZ_OMX_DECODER) michael@0: MOZ_OMX_ENCODER=1 michael@0: AC_SUBST(MOZ_OMX_ENCODER) michael@0: AC_DEFINE(MOZ_OMX_ENCODER) michael@0: ;; michael@0: 19) michael@0: GONK_INCLUDES="-I$gonkdir/frameworks/native/include -I$gonkdir/frameworks/av/include -I$gonkdir/frameworks/av/include/media -I$gonkdir/frameworks/av/include/camera -I$gonkdir/frameworks/native/include/media/openmax -I$gonkdir/frameworks/av/media/libstagefright/include" michael@0: MOZ_B2G_CAMERA=1 michael@0: MOZ_B2G_BT=1 michael@0: MOZ_B2G_BT_BLUEDROID=1 michael@0: MOZ_NFC=1 michael@0: MOZ_RTSP=1 michael@0: MOZ_OMX_DECODER=1 michael@0: MOZ_OMX_ENCODER=1 michael@0: AC_DEFINE(MOZ_OMX_ENCODER) michael@0: MOZ_AUDIO_OFFLOAD=1 michael@0: AC_SUBST(MOZ_AUDIO_OFFLOAD) michael@0: AC_DEFINE(MOZ_AUDIO_OFFLOAD) michael@0: michael@0: ;; michael@0: *) michael@0: AC_MSG_ERROR([Unsupported platform version: $ANDROID_VERSION]) michael@0: ;; michael@0: esac 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/system -I$gonkdir/system/core/include -isystem $gonkdir/bionic -I$gonkdir/hardware/libhardware/include -I$gonkdir/external/valgrind/fxos-include $GONK_INCLUDES $CPPFLAGS" 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: dnl Add -llog by default, since we use it all over the place. michael@0: LIBS="$LIBS -llog" michael@0: 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/ $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_UNQUOTED(ANDROID_VERSION, $ANDROID_VERSION) michael@0: AC_SUBST(ANDROID_VERSION) michael@0: AC_DEFINE(HAVE_SYS_UIO_H) michael@0: AC_DEFINE(HAVE_PTHREADS) michael@0: MOZ_CHROME_FILE_FORMAT=omni michael@0: direct_nspr_config=1 michael@0: else michael@0: MOZ_ANDROID_NDK michael@0: michael@0: case "$target" in michael@0: *-android*|*-linuxandroid*) michael@0: if test -z "$ANDROID_PACKAGE_NAME" ; then michael@0: ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)' michael@0: fi michael@0: MOZ_CHROME_FILE_FORMAT=omni michael@0: ZLIB_DIR=yes michael@0: ;; michael@0: *-linux*) michael@0: AC_PATH_PROG(OBJCOPY,objcopy) michael@0: ;; michael@0: esac michael@0: fi michael@0: michael@0: AC_SUBST(ANDROID_SOURCE) michael@0: AC_SUBST(ANDROID_PACKAGE_NAME) michael@0: AC_SUBST(OBJCOPY) 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: if test "$target" != "$host"; then michael@0: MOZ_CROSS_COMPILER michael@0: else michael@0: AC_PROG_CC michael@0: case "$target" in michael@0: *-mingw*) michael@0: # Work around the conftest.exe access problem on Windows michael@0: sleep 2 michael@0: esac 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: if test -n "$MOZ_WINCONSOLE"; then michael@0: AC_DEFINE(MOZ_WINCONSOLE) 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 ======================================================== 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: # toolkit/library/makefile.in needs these, see nsDllMain. michael@0: CRTDLLVERSION=110 michael@0: CRTEXPDLLVERSION=1-1-0 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: AC_SUBST(CRTDLLVERSION) michael@0: AC_SUBST(CRTEXPDLLVERSION) 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 (Win7), highest is 602 (Win8)], 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: AC_CHECK_PROGS(MIDL, midl) michael@0: michael@0: # Make sure compilers are valid michael@0: CFLAGS="$CFLAGS -TC -nologo" michael@0: CXXFLAGS="$CXXFLAGS -TP -nologo" 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: MSVS_VERSION=2010 michael@0: elif test "$_CC_MAJOR_VERSION" = "17"; then michael@0: _CC_SUITE=11 michael@0: MSVS_VERSION=2012 michael@0: elif test "$_CC_MAJOR_VERSION" = "18"; then michael@0: _CC_SUITE=12 michael@0: MSVS_VERSION=2013 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: AC_SUBST(MSVS_VERSION) michael@0: michael@0: AC_DEFINE(HAVE_SEH_EXCEPTIONS) michael@0: michael@0: if test -n "$WIN32_REDIST_DIR"; then michael@0: if test ! -d "$WIN32_REDIST_DIR"; then michael@0: AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}]) michael@0: fi michael@0: WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd` michael@0: fi michael@0: michael@0: dnl Confirm we have the pri tools on win8 builds michael@0: if test -n "$MOZ_METRO"; then michael@0: AC_MSG_CHECKING([for makepri]) michael@0: AC_CHECK_PROGS(MAKEPRI, makepri, "") michael@0: if test -z "MAKEPRI" ; then michael@0: AC_MSG_ERROR([makepri.exe is required for generating metro browser install components. It should be in the Win8 SDK.]) michael@0: fi michael@0: AC_SUBST(MAKEPRI) 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: # Set midl environment michael@0: case "$target" in michael@0: i*86-*) michael@0: MIDL_FLAGS="${MIDL_FLAGS} -env win32" michael@0: ;; michael@0: x86_64-*) michael@0: MIDL_FLAGS="${MIDL_FLAGS} -env x64" michael@0: ;; michael@0: esac michael@0: michael@0: unset _MSVC_VER_FILTER michael@0: michael@0: AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw, michael@0: [ michael@0: AC_LANG_SAVE michael@0: AC_LANG_CPLUSPLUS michael@0: _SAVE_CXXFLAGS="$CXXFLAGS" michael@0: CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0" michael@0: AC_TRY_COMPILE([#include ], michael@0: [std::_Throw(std::exception()); return 0;], michael@0: ac_cv_have_std__Throw="yes", michael@0: ac_cv_have_std__Throw="no") michael@0: CXXFLAGS="$_SAVE_CXXFLAGS" michael@0: AC_LANG_RESTORE michael@0: ]) michael@0: michael@0: if test "$ac_cv_have_std__Throw" = "yes"; then michael@0: AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug, michael@0: ac_cv_have_dllimport_exception_bug, michael@0: [ michael@0: AC_LANG_SAVE michael@0: AC_LANG_CPLUSPLUS michael@0: _SAVE_CXXFLAGS="$CXXFLAGS" michael@0: CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0" michael@0: AC_TRY_LINK([#include ], michael@0: [std::vector v; return v.at(1);], michael@0: ac_cv_have_dllimport_exception_bug="no", michael@0: ac_cv_have_dllimport_exception_bug="yes") michael@0: CXXFLAGS="$_SAVE_CXXFLAGS" michael@0: AC_LANG_RESTORE michael@0: ]) michael@0: if test "$ac_cv_have_dllimport_exception_bug" = "no"; then michael@0: WRAP_STL_INCLUDES=1 michael@0: MOZ_MSVC_STL_WRAP__Throw=1 michael@0: AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw) michael@0: fi michael@0: else michael@0: AC_CACHE_CHECK(for overridable _RAISE, michael@0: ac_cv_have__RAISE, michael@0: [ michael@0: AC_LANG_SAVE michael@0: AC_LANG_CPLUSPLUS michael@0: _SAVE_CXXFLAGS="$CXXFLAGS" michael@0: CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0" michael@0: AC_TRY_COMPILE([#include michael@0: #undef _RAISE michael@0: #define _RAISE(x) externallyDefinedFunction((x).what()) michael@0: #include michael@0: ], michael@0: [std::vector v; return v.at(1);], michael@0: ac_cv_have__RAISE="no", michael@0: ac_cv_have__RAISE="yes") michael@0: CXXFLAGS="$_SAVE_CXXFLAGS" michael@0: AC_LANG_RESTORE michael@0: ]) michael@0: if test "$ac_cv_have__RAISE" = "yes"; then michael@0: WRAP_STL_INCLUDES=1 michael@0: MOZ_MSVC_STL_WRAP__RAISE=1 michael@0: AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE) michael@0: else michael@0: AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.]) michael@0: fi michael@0: fi michael@0: michael@0: if test "$WRAP_STL_INCLUDES" = "1"; then michael@0: STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers' michael@0: fi 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: AC_CHECK_PROGS(MIDL, $target-widl widl) michael@0: if test -n "$MIDL"; then michael@0: case "$target" in michael@0: i*86-*) michael@0: MIDL_FLAGS="$MIDL_FLAGS --win32 -m32" michael@0: ;; michael@0: x86_64-*) michael@0: MIDL_FLAGS="$MIDL_FLAGS --win64 -m64" michael@0: ;; michael@0: esac michael@0: fi michael@0: michael@0: # strsafe.h on mingw uses macros for function deprecation that pollutes namespace michael@0: # causing problems with local implementations with the same name. michael@0: AC_DEFINE(STRSAFE_NO_DEPRECATE) michael@0: michael@0: MOZ_WINSDK_MAXVER=0x06020000 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: AC_DEFINE_UNQUOTED(MOZ_WINSDK_MAXVER,$MOZ_WINSDK_MAXVER) michael@0: AC_SUBST(MOZ_WINSDK_MAXVER) 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: AC_DEFINE(HAVE_IO_H) michael@0: AC_DEFINE(HAVE_SETBUF) michael@0: AC_DEFINE(HAVE_ISATTY) michael@0: fi michael@0: michael@0: fi # COMPILE_ENVIRONMENT michael@0: michael@0: AC_SUBST(MIDL_FLAGS) 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: AC_SUBST(STL_FLAGS) michael@0: AC_SUBST(WRAP_STL_INCLUDES) michael@0: AC_SUBST(MOZ_MSVC_STL_WRAP__Throw) michael@0: AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE) 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: 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: 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_PROGS(UNZIP, unzip) michael@0: if test -z "$UNZIP" -o "$UNZIP" = ":"; then michael@0: AC_MSG_ERROR([unzip not found in \$PATH]) michael@0: fi michael@0: MOZ_PATH_PROGS(ZIP, zip) michael@0: if test -z "$ZIP" -o "$ZIP" = ":"; then michael@0: AC_MSG_ERROR([zip not found in \$PATH]) michael@0: fi 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: MOZ_PATH_PROG(RPMBUILD, rpmbuild, :) michael@0: AC_SUBST(RPMBUILD) 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: MOZ_ARG_WITH_STRING(unify-dist, michael@0: [ --with-unify-dist=dir Location of the dist directory to unify with at packaging time (Mac OS X universal build only)], michael@0: UNIFY_DIST=$withval) michael@0: if test -n "$UNIVERSAL_BINARY"; then michael@0: if test -z "$UNIFY_DIST"; then michael@0: AC_MSG_ERROR([You need to provide the --with-unify-dist=dir argument when performing a universal build]) michael@0: fi michael@0: case "$UNIFY_DIST" in michael@0: /*) michael@0: ;; michael@0: *) michael@0: UNIFY_DIST="${MOZ_BUILD_ROOT}/${UNIFY_DIST}" michael@0: ;; michael@0: esac michael@0: fi michael@0: AC_SUBST(UNIFY_DIST) 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: 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: 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: MACOS_PRIVATE_FRAMEWORKS_DIR_DEFAULTED= michael@0: MOZ_ARG_WITH_STRING(macos-private-frameworks, michael@0: [ --with-macos-private-frameworks=dir Location of private frameworks to use (Mac OS X only)], michael@0: MACOS_PRIVATE_FRAMEWORKS_DIR=$withval, michael@0: MACOS_PRIVATE_FRAMEWORKS_DIR=/System/Library/PrivateFrameworks michael@0: MACOS_PRIVATE_FRAMEWORKS_DEFAULTED=1) michael@0: michael@0: if test -z "${MACOS_PRIVATE_FRAMEWORKS_DEFAULTED}"; then michael@0: if test -z "$CROSS_COMPILE"; then michael@0: AC_MSG_WARN([You should only be using --with-macos-private-frameworks when cross-compiling.]) michael@0: fi michael@0: if test ! -d "$MACOS_PRIVATE_FRAMEWORKS_DIR"; then michael@0: AC_MSG_ERROR([PrivateFrameworks directory not found.]) michael@0: fi michael@0: fi 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: AC_SUBST(MACOS_PRIVATE_FRAMEWORKS_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: 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: AC_MSG_CHECKING([compiler version]) michael@0: # Just print it so it shows up in the logs. michael@0: cc_version=$($CC --version) michael@0: AC_MSG_RESULT([$cc_version]) 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: AC_SUBST(GMAKE) michael@0: 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_JPEG_CFLAGS= michael@0: MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/media/libjpeg)' michael@0: MOZ_BZ2_CFLAGS= michael@0: MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)' michael@0: MOZ_PNG_CFLAGS="-I$_objdir/dist/include" # needed for freetype compilation michael@0: MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/media/libpng)' michael@0: michael@0: MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)' michael@0: MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)' michael@0: MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib' michael@0: XPCOM_FROZEN_LDOPTS='$(call EXPAND_LIBNAME_PATH,xul mozalloc,$(LIBXUL_DIST)/bin)' michael@0: LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS)' michael@0: XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)' michael@0: XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)' michael@0: michael@0: # These are specially defined on Windows only michael@0: case "$target" in michael@0: *-mingw*) michael@0: XPCOM_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)' michael@0: XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime.$(LIB_SUFFIX)' michael@0: ;; michael@0: *) michael@0: XPCOM_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_GLUE_LDOPTS michael@0: XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_STANDALONE_GLUE_LDOPTS michael@0: ;; michael@0: esac michael@0: michael@0: MOZ_FS_LAYOUT=unix 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: ;; 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: 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: MOZ_CFLAGS_NSS=1 michael@0: fi michael@0: AC_SUBST(MOZ_NO_WLZDEFS) michael@0: AC_SUBST(MOZ_CFLAGS_NSS) michael@0: michael@0: dnl ======================================================== michael@0: dnl GNU specific defaults michael@0: dnl ======================================================== michael@0: if test "$GNU_CC"; then michael@0: MMX_FLAGS="-mmmx" michael@0: SSE_FLAGS="-msse" michael@0: SSE2_FLAGS="-msse2" 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: # FIXME: Let us build with strict aliasing. bug 414641. michael@0: CFLAGS="$CFLAGS -fno-strict-aliasing" 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: 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: AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld]) michael@0: HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED= michael@0: _SAVE_LDFLAGS=$LDFLAGS michael@0: LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ" michael@0: AC_TRY_LINK(,,AC_MSG_RESULT([yes]) michael@0: [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1], michael@0: AC_MSG_RESULT([no])) michael@0: LDFLAGS=$_SAVE_LDFLAGS michael@0: michael@0: # Check for -mssse3 on $CC michael@0: AC_MSG_CHECKING([if toolchain supports -mssse3 option]) michael@0: HAVE_TOOLCHAIN_SUPPORT_MSSSE3= michael@0: _SAVE_CFLAGS=$CFLAGS michael@0: CFLAGS="$CFLAGS -mssse3" michael@0: AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes]) michael@0: [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1], michael@0: AC_MSG_RESULT([no])) michael@0: CFLAGS=$_SAVE_CFLAGS michael@0: michael@0: # Check for -msse4.1 on $CC michael@0: AC_MSG_CHECKING([if toolchain supports -msse4.1 option]) michael@0: HAVE_TOOLCHAIN_SUPPORT_MSSE4_1= michael@0: _SAVE_CFLAGS=$CFLAGS michael@0: CFLAGS="$CFLAGS -msse4.1" michael@0: AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes]) michael@0: [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1], michael@0: AC_MSG_RESULT([no])) michael@0: CFLAGS=$_SAVE_CFLAGS michael@0: michael@0: case "${CPU_ARCH}" in michael@0: x86 | x86_64) michael@0: AC_MSG_CHECKING(for x86 AVX2 asm support in compiler) michael@0: AC_TRY_COMPILE([], michael@0: [asm volatile ("vpermq \$0xd8,%ymm0,%ymm0 \n");], michael@0: result="yes", result="no") michael@0: AC_MSG_RESULT("$result") michael@0: if test "$result" = "yes"; then michael@0: HAVE_X86_AVX2=1 michael@0: AC_DEFINE(HAVE_X86_AVX2) michael@0: AC_SUBST(HAVE_X86_AVX2) michael@0: fi michael@0: esac michael@0: 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: michael@0: # BSDs need `environ' exposed for posix_spawn (bug 753046) michael@0: case "$OS_TARGET" in michael@0: DragonFly|FreeBSD|NetBSD|OpenBSD) michael@0: if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then michael@0: DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ" michael@0: else michael@0: DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols" michael@0: fi michael@0: ;; michael@0: esac michael@0: fi michael@0: fi 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, type-limits, ac_c_has_wtype_limits) 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)/mozilla-config.h -DMOZILLA_CLIENT' michael@0: _USE_CPP_INCLUDE_FLAG=1 michael@0: ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS" 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_MOZILLA_CONFIG_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_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT' michael@0: fi michael@0: michael@0: if test "$GNU_CXX"; then michael@0: # FIXME: Let us build with strict aliasing. bug 414641. michael@0: CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing" 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: # -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: # -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, 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: # -Wno-inline-new-delete - we inline 'new' and 'delete' in mozalloc michael@0: # for performance reasons, and because GCC and clang accept it (though michael@0: # clang warns about it). michael@0: # michael@0: MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof) michael@0: MOZ_CXX_SUPPORTS_WARNING(-Wno-, inline-new-delete, ac_cxx_has_wno_inline_new_delete) 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)/mozilla-config.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_MOZILLA_CONFIG_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: dnl Get mozilla version from central milestone file 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: dnl Get version of various core apps from the version files. michael@0: FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt` michael@0: michael@0: if test -z "$FIREFOX_VERSION"; then michael@0: AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.]) michael@0: fi 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: 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" michael@0: # Statically disable jemalloc on 10.5 and 32-bit 10.6. See bug 702250. michael@0: if test "$HAVE_64BIT_OS"; then michael@0: MOZ_MEMORY=1 michael@0: fi michael@0: DLL_SUFFIX=".dylib" michael@0: DSO_LDOPTS='' michael@0: STRIP_FLAGS="$STRIP_FLAGS -x -S" michael@0: # Check whether we're targeting OS X or iOS michael@0: AC_CACHE_CHECK(for iOS target, michael@0: ac_cv_ios_target, michael@0: [AC_TRY_COMPILE([#include michael@0: #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR) michael@0: #error not iOS michael@0: #endif], michael@0: [], michael@0: ac_cv_ios_target="yes", michael@0: ac_cv_ios_target="no")]) michael@0: if test "$ac_cv_ios_target" = "yes"; then michael@0: AC_DEFINE(XP_IOS) michael@0: AC_DEFINE(XP_DARWIN) michael@0: _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit' michael@0: else michael@0: AC_DEFINE(XP_MACOSX) michael@0: AC_DEFINE(XP_DARWIN) michael@0: _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa' 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: MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"; michael@0: fi michael@0: TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"' 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: michael@0: dnl With newer linkers we need to pass -allow_heap_execute because of michael@0: dnl Microsoft Silverlight (5.1.10411.0 at least). michael@0: AC_MSG_CHECKING([for -allow_heap_execute option to ld]) michael@0: _SAVE_LDFLAGS=$LDFLAGS michael@0: LDFLAGS="$LDFLAGS -Wl,-allow_heap_execute" michael@0: AC_TRY_LINK(,[return 0;],_HAVE_ALLOW_HEAP_EXECUTE=1, michael@0: _HAVE_ALLOW_HEAP_EXECUTE=) michael@0: if test -n "$_HAVE_ALLOW_HEAP_EXECUTE" ; then michael@0: AC_MSG_RESULT([yes]) michael@0: MOZ_ALLOW_HEAP_EXECUTE_FLAGS="-Wl,-allow_heap_execute" michael@0: else michael@0: AC_MSG_RESULT([no]) michael@0: fi michael@0: LDFLAGS=$_SAVE_LDFLAGS michael@0: 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: if test -n "$gonkdir"; then michael@0: _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk michael@0: _PLATFORM_HAVE_RIL=1 michael@0: MOZ_B2G_FM=1 michael@0: MOZ_SYNTH_PICO=1 michael@0: else michael@0: _PLATFORM_DEFAULT_TOOLKIT=cairo-android michael@0: MOZ_LINKER=1 michael@0: fi michael@0: TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"' michael@0: michael@0: MOZ_GFX_OPTIMIZE_MOBILE=1 michael@0: MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions" 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="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK" michael@0: fi michael@0: michael@0: TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"' michael@0: michael@0: MOZ_MEMORY=1 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: *-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: # certain versions of cygwin's makedepend barf on the michael@0: # #include vs -I./dist/include/string issue so don't use it michael@0: XPCOM_FROZEN_LDOPTS='$(call EXPAND_LIBNAME_PATH,xul mozalloc,$(LIBXUL_DIST)/lib)' 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: NSPR_LDFLAGS="$NSPR_LDFLAGS -static-libgcc" 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 -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32 -lnetapi32" 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: ZIP=zip michael@0: UNZIP=unzip 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)/dist/include/mozilla-config.h -DMOZILLA_CLIENT' michael@0: _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.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: # 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 C4482 warns when an enum value is refered specifing the michael@0: # name of the enum itself. This behavior is allowed in C++11, and the michael@0: # warning has been removed in VS2012. 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: # MSVC warning C4819 warns some UTF-8 characters (e.g. copyright sign) michael@0: # on non-Western system locales even if it is in a comment. michael@0: CFLAGS="$CFLAGS -wd4244 -wd4819" michael@0: CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4345 -wd4351 -wd4482 -wd4800 -wd4819" 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 secur32.lib netapi32.lib" michael@0: MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV' michael@0: WARNINGS_AS_ERRORS='-WX' michael@0: MOZ_OPTIMIZE_FLAGS='-O1' 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: dnl Minimum reqiurement of Gecko is VS2010 or later which supports michael@0: dnl both SSSE3 and SSE4.1. michael@0: HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1 michael@0: HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1 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: if test -n "$L10NBASEDIR"; then michael@0: L10NBASEDIR=`cd $L10NBASEDIR && pwd -W` michael@0: fi 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,--enable-stdcall-fixup -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: if test "$SO_VERSION"; then michael@0: DLL_SUFFIX=".so.$SO_VERSION" michael@0: else michael@0: DLL_SUFFIX=".so.1.0" michael@0: fi michael@0: MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib' 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: 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: MMX_FLAGS="-xarch=mmx -xO4" michael@0: SSE_FLAGS="-xarch=sse" michael@0: SSE2_FLAGS="-xarch=ssei2 -xO4" 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: AC_SUBST_LIST(MMX_FLAGS) michael@0: AC_SUBST_LIST(SSE_FLAGS) michael@0: AC_SUBST_LIST(SSE2_FLAGS) michael@0: michael@0: case "$target" in michael@0: *-*linux*) michael@0: # Includes linux-android michael@0: AC_DEFINE(XP_LINUX) michael@0: ;; michael@0: esac michael@0: michael@0: AC_SUBST(MOZ_LINKER) michael@0: if test -n "$MOZ_LINKER"; then michael@0: AC_DEFINE(MOZ_LINKER) michael@0: fi 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 and michael@0: dnl = to export jemalloc symbols when linking a program 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: else 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: AC_LANG_CPLUSPLUS michael@0: michael@0: MOZ_CXX11 michael@0: michael@0: AC_LANG_C 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: STL_FLAGS='-I$(DIST)/stl_wrappers' michael@0: WRAP_STL_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 Check for __force_align_arg_pointer__ for SSE2 on gcc michael@0: dnl ======================================================== michael@0: if test "$GNU_CC"; then michael@0: CFLAGS_save="${CFLAGS}" michael@0: CFLAGS="${CFLAGS} -Werror" michael@0: AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute, michael@0: ac_cv_force_align_arg_pointer, michael@0: [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}], michael@0: [], michael@0: ac_cv_force_align_arg_pointer="yes", michael@0: ac_cv_force_align_arg_pointer="no")]) michael@0: CFLAGS="${CFLAGS_save}" michael@0: if test "$ac_cv_force_align_arg_pointer" = "yes"; then michael@0: HAVE_GCC_ALIGN_ARG_POINTER=1 michael@0: else michael@0: HAVE_GCC_ALIGN_ARG_POINTER= michael@0: fi michael@0: fi michael@0: AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER) 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*|openbsd*) 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 sys/sysmacros.h) michael@0: MOZ_CHECK_HEADERS([linux/quota.h],,,[#include ]) michael@0: michael@0: dnl SCTP support - needs various network include headers michael@0: MOZ_CHECK_HEADERS([linux/if_addr.h linux/rtnetlink.h],,,[#include ]) michael@0: michael@0: MOZ_CHECK_HEADERS(sys/types.h netinet/in.h byteswap.h) michael@0: michael@0: dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally michael@0: AC_CACHE_CHECK(for sockaddr_in.sin_len, michael@0: ac_cv_sockaddr_in_sin_len, michael@0: [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H michael@0: #include michael@0: #endif michael@0: #include michael@0: struct sockaddr_in x; michael@0: void *foo = (void*) &x.sin_len;], michael@0: [], michael@0: [ac_cv_sockaddr_in_sin_len=true], michael@0: [ac_cv_sockaddr_in_sin_len=false])]) michael@0: if test "$ac_cv_sockaddr_in_sin_len" = true ; then michael@0: AC_DEFINE(HAVE_SIN_LEN) michael@0: dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too) michael@0: AC_DEFINE(HAVE_SCONN_LEN) michael@0: fi michael@0: michael@0: AC_CACHE_CHECK(for sockaddr_in6.sin6_len, michael@0: ac_cv_sockaddr_in6_sin6_len, michael@0: [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H michael@0: #include michael@0: #endif michael@0: #include michael@0: struct sockaddr_in6 x; michael@0: void *foo = (void*) &x.sin6_len;], michael@0: [], michael@0: [ac_cv_sockaddr_in6_sin6_len=true], michael@0: [ac_cv_sockaddr_in6_sin6_len=false])]) michael@0: if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then michael@0: AC_DEFINE(HAVE_SIN6_LEN) michael@0: fi michael@0: michael@0: AC_CACHE_CHECK(for sockaddr.sa_len, michael@0: ac_cv_sockaddr_sa_len, michael@0: [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H michael@0: #include michael@0: #endif michael@0: #include michael@0: struct sockaddr x; michael@0: void *foo = (void*) &x.sa_len;], michael@0: [], michael@0: [ac_cv_sockaddr_sa_len=true], michael@0: [ac_cv_sockaddr_sa_len=false])]) michael@0: if test "$ac_cv_sockaddr_sa_len" = true ; then michael@0: AC_DEFINE(HAVE_SA_LEN) michael@0: fi 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: _SAVE_CFLAGS="$CFLAGS" michael@0: CFLAGS="$CFLAGS -D_GNU_SOURCE" michael@0: AC_CHECK_FUNCS(dladdr memmem) michael@0: CFLAGS="$_SAVE_CFLAGS" 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: XLDFLAGS="$X_LIBS" michael@0: XLIBS="$X_EXTRA_LIBS" michael@0: michael@0: dnl ======================================================== michael@0: dnl Checks for X libraries. michael@0: dnl Ordering is important. michael@0: dnl Xt is dependent upon SM as of X11R6 michael@0: dnl ======================================================== michael@0: if test "$no_x" = "yes"; then michael@0: AC_DEFINE(NO_X11) michael@0: else michael@0: AC_DEFINE_UNQUOTED(FUNCPROTO,15) michael@0: XLIBS="-lX11 $XLIBS" michael@0: _SAVE_LDFLAGS="$LDFLAGS" michael@0: LDFLAGS="$XLDFLAGS $LDFLAGS" michael@0: AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"], michael@0: [MISSING_X="$MISSING_X -lX11"], $XLIBS) michael@0: AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"], michael@0: [MISSING_X="$MISSING_X -lXext"], $XLIBS) michael@0: michael@0: AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [ michael@0: unset ac_cv_lib_Xt_XtFree michael@0: AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS) michael@0: AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS) michael@0: AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"], michael@0: [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS) michael@0: ]) michael@0: michael@0: # AIX needs the motif library linked before libXt to prevent michael@0: # crashes in plugins linked against Motif - Bug #98892 michael@0: case "${target_os}" in michael@0: aix*) michael@0: XT_LIBS="-lXm $XT_LIBS" michael@0: ;; michael@0: esac michael@0: michael@0: dnl ======================================================== michael@0: dnl = Check for XShm michael@0: dnl ======================================================== michael@0: AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,, michael@0: $XLIBS $XEXT_LIBS) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Check for Xss michael@0: dnl ======================================================== michael@0: MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h, michael@0: AC_CHECK_LIB(Xss, XScreenSaverQueryInfo, michael@0: [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS" michael@0: AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS)) michael@0: michael@0: LDFLAGS="$_SAVE_LDFLAGS" michael@0: fi # $no_x michael@0: michael@0: AC_SUBST(XCFLAGS) michael@0: AC_SUBST(XLDFLAGS) michael@0: AC_SUBST(XLIBS) michael@0: AC_SUBST(XEXT_LIBS) michael@0: AC_SUBST(XT_LIBS) michael@0: AC_SUBST(XSS_LIBS) 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: MOZ_USE_PTHREADS=1 michael@0: ;; michael@0: *) michael@0: MOZ_CHECK_PTHREADS(pthreads, michael@0: MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads", michael@0: MOZ_CHECK_PTHREADS(pthread, michael@0: MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread", michael@0: MOZ_CHECK_PTHREADS(c_r, michael@0: MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r", michael@0: MOZ_CHECK_PTHREADS(c, michael@0: MOZ_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 "$MOZ_USE_PTHREADS"x = x; then michael@0: AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]); michael@0: fi], michael@0: MOZ_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 "$MOZ_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: AC_SUBST(MOZ_USE_PTHREADS) 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(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize localtime_r) michael@0: michael@0: dnl check for clock_gettime(), the CLOCK_MONOTONIC clock michael@0: AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC), michael@0: ac_cv_clock_monotonic, michael@0: [for libs in "" -lrt; do michael@0: _SAVE_LIBS="$LIBS" michael@0: LIBS="$LIBS $libs" michael@0: AC_TRY_LINK([#include ], michael@0: [ struct timespec ts; michael@0: clock_gettime(CLOCK_MONOTONIC, &ts); ], michael@0: ac_cv_clock_monotonic=$libs michael@0: LIBS="$_SAVE_LIBS" michael@0: break, michael@0: ac_cv_clock_monotonic=no) michael@0: LIBS="$_SAVE_LIBS" michael@0: done]) michael@0: if test "$ac_cv_clock_monotonic" != "no"; then michael@0: HAVE_CLOCK_MONOTONIC=1 michael@0: REALTIME_LIBS=$ac_cv_clock_monotonic michael@0: AC_DEFINE(HAVE_CLOCK_MONOTONIC) michael@0: AC_SUBST(HAVE_CLOCK_MONOTONIC) michael@0: AC_SUBST(REALTIME_LIBS) michael@0: fi 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: AC_LANG_CPLUSPLUS michael@0: michael@0: case $target_os in michael@0: darwin*|mingw*) michael@0: ;; michael@0: *) michael@0: michael@0: AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"], michael@0: AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"], michael@0: AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"]))) michael@0: _SAVE_LIBS=$LIBS michael@0: LIBS="$LIBS $_ICONV_LIBS" michael@0: AC_CACHE_CHECK( michael@0: [for iconv()], michael@0: ac_cv_func_iconv, michael@0: [AC_TRY_LINK([ michael@0: #include michael@0: #include michael@0: ], michael@0: [ michael@0: iconv_t h = iconv_open("", ""); michael@0: iconv(h, NULL, NULL, NULL, NULL); michael@0: iconv_close(h); michael@0: ], michael@0: [ac_cv_func_iconv=yes], michael@0: [ac_cv_func_iconv=no] michael@0: )] michael@0: ) michael@0: if test "$ac_cv_func_iconv" = "yes"; then michael@0: AC_DEFINE(HAVE_ICONV) michael@0: LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS" michael@0: LIBICONV="$_ICONV_LIBS" michael@0: AC_CACHE_CHECK( michael@0: [for iconv() with const input], michael@0: ac_cv_func_const_iconv, michael@0: [AC_TRY_COMPILE([ michael@0: #include michael@0: #include michael@0: ], michael@0: [ michael@0: const char *input = "testing"; michael@0: iconv_t h = iconv_open("", ""); michael@0: iconv(h, &input, NULL, NULL, NULL); michael@0: iconv_close(h); michael@0: ], michael@0: [ac_cv_func_const_iconv=yes], michael@0: [ac_cv_func_const_iconv=no] michael@0: )] michael@0: ) michael@0: if test "$ac_cv_func_const_iconv" = "yes"; then michael@0: AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT) michael@0: fi michael@0: fi michael@0: LIBS=$_SAVE_LIBS michael@0: michael@0: ;; michael@0: esac 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: 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: # The custom dynamic linker doesn't support TLS variables michael@0: MOZ_TLS= michael@0: if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then michael@0: # mips builds fail with TLS variables because of a binutils bug. michael@0: # See bug 528687 michael@0: # OpenBSD doesn't have TLS support, and the test succeeds with clang++ michael@0: case "${target}" in michael@0: mips*-*) michael@0: : michael@0: ;; michael@0: *-android*|*-linuxandroid*) michael@0: : michael@0: ;; michael@0: *-openbsd*) michael@0: : michael@0: ;; michael@0: *) michael@0: AC_DEFINE(HAVE_THREAD_TLS_KEYWORD) michael@0: MOZ_TLS=1 michael@0: ;; michael@0: esac michael@0: fi michael@0: michael@0: dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments. michael@0: if test -n "$MOZ_LINKER"; then michael@0: if test "$CPU_ARCH" = arm; then michael@0: dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments michael@0: if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then michael@0: LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000" michael@0: _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000" michael@0: fi michael@0: fi michael@0: fi michael@0: michael@0: dnl The custom linker doesn't support text relocations, but NDK >= r6b michael@0: dnl creates some (http://code.google.com/p/android/issues/detail?id=23203) michael@0: dnl We however want to avoid these text relocations, and this can be done michael@0: dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend michael@0: dnl doesn't contain anything at all, beside placeholders for some sections, michael@0: dnl and crtbegin only contains a finalizer function that calls michael@0: dnl __cxa_finalize. The custom linker actually takes care of calling michael@0: dnl __cxa_finalize when the library doesn't call it itself, which makes it michael@0: dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't michael@0: dnl link crtbegin and crtend at all. michael@0: if test -n "$MOZ_LINKER" -a "$OS_TARGET" = "Android"; then michael@0: AC_CACHE_CHECK([whether the CRT objects have text relocations], michael@0: ac_cv_crt_has_text_relocations, michael@0: [echo 'int foo() { return 0; }' > conftest.cpp michael@0: if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) && michael@0: test -s conftest${DLL_SUFFIX}; then michael@0: if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then michael@0: ac_cv_crt_has_text_relocations=yes michael@0: else michael@0: ac_cv_crt_has_text_relocations=no michael@0: fi michael@0: else michael@0: AC_ERROR([couldn't compile a simple C file]) michael@0: fi michael@0: rm -rf conftest*]) michael@0: if test "$ac_cv_crt_has_text_relocations" = yes; then michael@0: dnl While we want libraries to skip the CRT files, we don't want michael@0: dnl executables to be treated the same way. We thus set the flag michael@0: dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr, michael@0: dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS. michael@0: dnl Using LDFLAGS in nspr is safe, since we only really build michael@0: dnl libraries there. michael@0: DSO_LDOPTS="$DSO_LDOPTS -nostartfiles" michael@0: NSPR_LDFLAGS="$NSPR_LDFLAGS -nostartfiles" michael@0: fi michael@0: fi michael@0: michael@0: dnl Check for the existence of various allocation headers/functions michael@0: michael@0: MALLOC_HEADERS="malloc.h malloc_np.h malloc/malloc.h sys/malloc.h" michael@0: MALLOC_H= michael@0: michael@0: for file in $MALLOC_HEADERS; do michael@0: MOZ_CHECK_HEADER($file, [MALLOC_H=$file]) michael@0: if test "$MALLOC_H" != ""; then michael@0: AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>) michael@0: break michael@0: fi michael@0: done michael@0: michael@0: AC_CHECK_FUNCS(strndup posix_memalign memalign valloc) michael@0: michael@0: AC_CHECK_FUNCS(malloc_usable_size) 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 = 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: MOZ_ARG_WITH_STRING(libxul-sdk, michael@0: [ --with-libxul-sdk=PFX Use the libXUL SDK at ], michael@0: LIBXUL_SDK_DIR=$withval) michael@0: michael@0: if test "$LIBXUL_SDK_DIR" = "yes"; then michael@0: AC_MSG_ERROR([--with-libxul-sdk must specify a path]) michael@0: elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then michael@0: LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd` michael@0: michael@0: if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then michael@0: AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist]) michael@0: fi michael@0: michael@0: fi michael@0: AC_SUBST(LIBXUL_SDK) michael@0: michael@0: if test -n "$LIBXUL_SDK"; then michael@0: LIBXUL_DIST="$LIBXUL_SDK" michael@0: else michael@0: LIBXUL_DIST="$MOZ_BUILD_ROOT/dist" michael@0: fi michael@0: AC_SUBST(LIBXUL_DIST) michael@0: michael@0: SYSTEM_LIBXUL= michael@0: michael@0: MOZ_ARG_WITH_BOOL(system-libxul, michael@0: [ --with-system-libxul Use system installed libxul SDK], michael@0: SYSTEM_LIBXUL=1) michael@0: michael@0: dnl ======================================================== michael@0: dnl = If NSPR was not detected in the system, michael@0: dnl = use the one in the source tree (mozilla/nsprpub) michael@0: dnl ======================================================== michael@0: MOZ_ARG_WITH_BOOL(system-nspr, michael@0: [ --with-system-nspr Use system installed NSPR], michael@0: _USE_SYSTEM_NSPR=1 ) michael@0: michael@0: if test -n "$_USE_SYSTEM_NSPR"; then michael@0: AM_PATH_NSPR(4.10.6, [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: if test -n "$MOZ_NATIVE_NSPR"; then michael@0: _SAVE_CFLAGS=$CFLAGS michael@0: CFLAGS="$CFLAGS $NSPR_CFLAGS" michael@0: AC_TRY_COMPILE([#include "prtypes.h"], michael@0: [#ifndef PR_STATIC_ASSERT michael@0: #error PR_STATIC_ASSERT not defined or requires including prtypes.h michael@0: #endif], michael@0: [MOZ_NATIVE_NSPR=1], michael@0: AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it])) michael@0: AC_TRY_COMPILE([#include "prtypes.h"], michael@0: [#ifndef PR_UINT64 michael@0: #error PR_UINT64 not defined or requires including prtypes.h michael@0: #endif], michael@0: [MOZ_NATIVE_NSPR=1], michael@0: AC_MSG_ERROR([system NSPR does not support PR_UINT64 or including prtypes.h does not provide it])) michael@0: CFLAGS=$_SAVE_CFLAGS michael@0: else michael@0: if test -z "$LIBXUL_SDK"; then michael@0: NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr" michael@0: if test -n "$GNU_CC"; then michael@0: NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}" michael@0: else michael@0: NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib " michael@0: fi michael@0: else michael@0: NSPR_CFLAGS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --includedir="${LIBXUL_DIST}/include/nspr" --cflags` michael@0: NSPR_LIBS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --libdir="${LIBXUL_DIST}"/lib --libs` michael@0: fi michael@0: fi michael@0: michael@0: dnl set GRE_MILESTONE michael@0: dnl ======================================================== michael@0: if test -n "$LIBXUL_SDK"; then michael@0: GRE_MILESTONE=`$PYTHON "$_topsrcdir"/config/printconfigsetting.py "$LIBXUL_DIST"/bin/platform.ini Build Milestone` michael@0: else michael@0: GRE_MILESTONE=`tail -n 1 "$_topsrcdir"/config/milestone.txt 2>/dev/null || tail -1 "$_topsrcdir"/config/milestone.txt` michael@0: fi michael@0: AC_SUBST(GRE_MILESTONE) michael@0: michael@0: # set RELEASE_BUILD and NIGHTLY_BUILD variables depending on the cycle we're in michael@0: # The logic works like this: michael@0: # - if we have "a1" in GRE_MILESTONE, we're building Nightly (define NIGHTLY_BUILD) michael@0: # - 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 system libevent Support michael@0: dnl ======================================================== michael@0: MOZ_ARG_WITH_STRING(system-libevent, michael@0: [ --with-system-libevent[=PFX] michael@0: Use system libevent [installed at prefix PFX]], michael@0: LIBEVENT_DIR=$withval) michael@0: michael@0: _SAVE_CFLAGS=$CFLAGS michael@0: _SAVE_LDFLAGS=$LDFLAGS michael@0: _SAVE_LIBS=$LIBS michael@0: if test "$LIBEVENT_DIR" = yes; then michael@0: PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent, michael@0: MOZ_NATIVE_LIBEVENT=1, michael@0: LIBEVENT_DIR=/usr) michael@0: fi michael@0: if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then michael@0: MOZ_NATIVE_LIBEVENT= michael@0: elif test -z "$MOZ_NATIVE_LIBEVENT"; then michael@0: CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS" michael@0: LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS" michael@0: MOZ_CHECK_HEADER(event.h, michael@0: [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then michael@0: AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include]) michael@0: fi], michael@0: AC_MSG_ERROR([--with-system-libevent requested but event.h not found])) michael@0: AC_CHECK_LIB(event, event_init, michael@0: [MOZ_NATIVE_LIBEVENT=1 michael@0: MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include" michael@0: MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"], michael@0: [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=]) michael@0: fi michael@0: CFLAGS=$_SAVE_CFLAGS michael@0: LDFLAGS=$_SAVE_LDFLAGS michael@0: LIBS=$_SAVE_LIBS michael@0: michael@0: AC_SUBST(MOZ_NATIVE_LIBEVENT) michael@0: AC_SUBST(MOZ_LIBEVENT_CFLAGS) michael@0: AC_SUBST(MOZ_LIBEVENT_LIBS) michael@0: michael@0: dnl ======================================================== michael@0: dnl = If NSS was not detected in the system, michael@0: dnl = use the one in the source tree (mozilla/security/nss) michael@0: dnl ======================================================== michael@0: michael@0: MOZ_ARG_WITH_BOOL(system-nss, michael@0: [ --with-system-nss Use system installed NSS], michael@0: _USE_SYSTEM_NSS=1 ) michael@0: michael@0: if test -n "$_USE_SYSTEM_NSS"; then michael@0: AM_PATH_NSS(3.16.2.3, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])]) michael@0: fi michael@0: michael@0: if test -n "$MOZ_NATIVE_NSS"; then michael@0: NSS_LIBS="$NSS_LIBS -lcrmf" michael@0: else michael@0: NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss' michael@0: michael@0: if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT"; then michael@0: NSS_LIBS="\ michael@0: \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \ michael@0: \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \ michael@0: \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \ michael@0: \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \ michael@0: \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)" michael@0: else michael@0: NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION" michael@0: fi michael@0: fi michael@0: michael@0: dnl ====================== michael@0: dnl Detect yasm michael@0: dnl ====================== michael@0: michael@0: AC_MSG_CHECKING([for YASM assembler]) michael@0: AC_CHECK_PROGS(YASM, yasm, "") michael@0: michael@0: if test -n "$YASM"; then michael@0: dnl Pull out yasm's version string michael@0: YASM_VERSION=`yasm --version | $AWK '/^yasm/ { print $2 }'` michael@0: _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'` michael@0: _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'` michael@0: _YASM_RELEASE=` echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'` michael@0: _YASM_BUILD=` echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'` michael@0: fi michael@0: michael@0: if test -z "$SKIP_LIBRARY_CHECKS"; then michael@0: dnl system JPEG support michael@0: dnl ======================================================== michael@0: MOZ_ARG_WITH_STRING(system-jpeg, michael@0: [ --with-system-jpeg[=PFX] michael@0: Use system libjpeg [installed at prefix PFX]], michael@0: JPEG_DIR=$withval) michael@0: michael@0: _SAVE_CFLAGS=$CFLAGS michael@0: _SAVE_LDFLAGS=$LDFLAGS michael@0: _SAVE_LIBS=$LIBS michael@0: if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then michael@0: CFLAGS="-I${JPEG_DIR}/include $CFLAGS" michael@0: LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS" michael@0: fi michael@0: if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then michael@0: MOZ_NATIVE_JPEG= michael@0: else michael@0: AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_NATIVE_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_NATIVE_JPEG=) michael@0: fi michael@0: michael@0: if test "$MOZ_NATIVE_JPEG" = 1; then michael@0: AC_TRY_COMPILE([ #include michael@0: #include michael@0: #include ], michael@0: [ #if JPEG_LIB_VERSION < $MOZJPEG michael@0: #error "Insufficient JPEG library version ($MOZJPEG required)." michael@0: #endif michael@0: #ifndef JCS_EXTENSIONS michael@0: #error "libjpeg-turbo JCS_EXTENSIONS required" michael@0: #endif michael@0: ], michael@0: MOZ_NATIVE_JPEG=1, michael@0: AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg])) michael@0: fi michael@0: CFLAGS=$_SAVE_CFLAGS michael@0: LDFLAGS=$_SAVE_LDFLAGS michael@0: LIBS=$_SAVE_LIBS michael@0: michael@0: if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_NATIVE_JPEG" = 1; then michael@0: MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include" michael@0: MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}" michael@0: fi michael@0: fi # SKIP_LIBRARY_CHECKS michael@0: michael@0: dnl system ZLIB support michael@0: dnl ======================================================== michael@0: MOZ_ZLIB_CHECK([1.2.3]) michael@0: michael@0: if test "$MOZ_NATIVE_ZLIB" != 1; then michael@0: MOZ_ZLIB_CFLAGS="-I${_topsrcdir}/modules/zlib/src" michael@0: MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,'"$MOZ_BUILD_ROOT"'/modules/zlib/src)' michael@0: fi michael@0: michael@0: if test "$MOZ_LINKER" = 1 -a "$MOZ_NATIVE_ZLIB" != 1; then michael@0: AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib]) michael@0: fi michael@0: michael@0: MOZ_PNG_ARM_NEON= michael@0: michael@0: if test -z "$SKIP_LIBRARY_CHECKS"; then michael@0: dnl system BZIP2 Support michael@0: dnl ======================================================== michael@0: MOZ_ARG_WITH_STRING(system-bz2, michael@0: [ --with-system-bz2[=PFX] michael@0: Use system libbz2 [installed at prefix PFX]], michael@0: BZ2_DIR=$withval) michael@0: michael@0: _SAVE_CFLAGS=$CFLAGS michael@0: _SAVE_LDFLAGS=$LDFLAGS michael@0: _SAVE_LIBS=$LIBS michael@0: if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then michael@0: CFLAGS="-I${BZ2_DIR}/include $CFLAGS" michael@0: LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS" michael@0: fi michael@0: if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then michael@0: MOZ_NATIVE_BZ2= michael@0: else michael@0: AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_NATIVE_BZ2=1 MOZ_BZ2_LIBS="-lbz2"], michael@0: [MOZ_NATIVE_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=]) michael@0: fi michael@0: CFLAGS=$_SAVE_CFLAGS michael@0: LDFLAGS=$_SAVE_LDFLAGS michael@0: LIBS=$_SAVE_LIBS michael@0: michael@0: if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_NATIVE_BZ2" = 1; then michael@0: MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include" michael@0: MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}" michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl system PNG Support michael@0: dnl ======================================================== michael@0: MOZ_ARG_WITH_STRING(system-png, michael@0: [ --with-system-png[=PFX] michael@0: Use system libpng [installed at prefix PFX]], michael@0: PNG_DIR=$withval) michael@0: michael@0: _SAVE_CFLAGS=$CFLAGS michael@0: _SAVE_LDFLAGS=$LDFLAGS michael@0: _SAVE_LIBS=$LIBS michael@0: if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then michael@0: CFLAGS="-I${PNG_DIR}/include $CFLAGS" michael@0: LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS" michael@0: fi michael@0: if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then michael@0: MOZ_NATIVE_PNG= michael@0: else michael@0: AC_CHECK_LIB(png, png_get_valid, [MOZ_NATIVE_PNG=1 MOZ_PNG_LIBS="-lpng"], michael@0: AC_MSG_ERROR([--with-system-png requested but no working libpng found])) michael@0: AC_CHECK_LIB(png, png_get_acTL, , michael@0: AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support])) michael@0: fi michael@0: if test "$MOZ_NATIVE_PNG" = 1; then michael@0: AC_TRY_COMPILE([ #include michael@0: #include michael@0: #include ], michael@0: [ #if PNG_LIBPNG_VER < $MOZPNG michael@0: #error "Insufficient libpng version ($MOZPNG required)." michael@0: #endif michael@0: #ifndef PNG_UINT_31_MAX michael@0: #error "Insufficient libpng version." michael@0: #endif ], michael@0: MOZ_NATIVE_PNG=1, michael@0: AC_MSG_ERROR([--with-system-png requested but no working libpng found])) michael@0: fi michael@0: CFLAGS=$_SAVE_CFLAGS michael@0: LDFLAGS=$_SAVE_LDFLAGS michael@0: LIBS=$_SAVE_LIBS michael@0: michael@0: if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_NATIVE_PNG" = 1; then michael@0: MOZ_PNG_CFLAGS="-I${PNG_DIR}/include" michael@0: MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}" michael@0: fi michael@0: michael@0: MOZ_PNG_ARM_NEON_CHECK= michael@0: if test "$MOZ_NATIVE_PNG" != 1 -a "$CPU_ARCH" = "arm" ; then michael@0: MOZ_ARG_ENABLE_STRING(png-arm-neon-support, michael@0: [ --enable-png-arm-neon-support=TYPE michael@0: Options include: michael@0: no michael@0: check (default) michael@0: nocheck (faster but unsafe)], michael@0: [MOZ_PNG_ARM_NEON_SUPPORT=$enableval ] ) michael@0: case "$MOZ_PNG_ARM_NEON_SUPPORT" in michael@0: no) michael@0: # enable-png-arm-neon-support = no michael@0: ;; michael@0: nocheck) michael@0: # enable-png-arm-neon-support = nocheck michael@0: MOZ_PNG_ARM_NEON=1 michael@0: ;; michael@0: *) michael@0: MOZ_PNG_ARM_NEON=1 michael@0: MOZ_PNG_ARM_NEON_CHECK=1 michael@0: ;; michael@0: esac michael@0: fi michael@0: michael@0: AC_SUBST(MOZ_PNG_ARM_NEON_CHECK) michael@0: michael@0: fi # SKIP_LIBRARY_CHECKS michael@0: michael@0: AC_SUBST(MOZ_PNG_ARM_NEON) michael@0: michael@0: dnl ======================================================== michael@0: dnl system HunSpell Support michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(system-hunspell, michael@0: [ --enable-system-hunspell michael@0: Use system hunspell (located with pkgconfig)], michael@0: MOZ_NATIVE_HUNSPELL=1 ) michael@0: michael@0: if test -n "$MOZ_NATIVE_HUNSPELL"; then michael@0: PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell) michael@0: fi michael@0: michael@0: AC_SUBST(MOZ_NATIVE_HUNSPELL) michael@0: michael@0: dnl ======================================================== michael@0: dnl system libffi Support michael@0: dnl ======================================================== michael@0: MOZ_CONFIG_FFI() michael@0: michael@0: if test -n "$MOZ_NATIVE_FFI"; then michael@0: MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_FFI_LIBS" michael@0: fi michael@0: michael@0: # split JS out by default to avoid VS2005 PGO crash (bug 591836). michael@0: if test "$OS_ARCH" = "WINNT"; then michael@0: JS_SHARED_LIBRARY=1 michael@0: fi michael@0: michael@0: MOZ_ARG_ENABLE_BOOL(shared-js, michael@0: [ --enable-shared-js michael@0: Create a shared JavaScript library.], michael@0: JS_SHARED_LIBRARY=1, michael@0: JS_SHARED_LIBRARY=) michael@0: michael@0: dnl ======================================================== michael@0: dnl Java SDK support michael@0: dnl ======================================================== michael@0: michael@0: JAVA_BIN_PATH= michael@0: MOZ_ARG_WITH_STRING(java-bin-path, michael@0: [ --with-java-bin-path=dir michael@0: Location of Java binaries (java, javac, jar)], michael@0: JAVA_BIN_PATH=$withval) 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: ENABLE_SYSTEM_EXTENSION_DIRS=1 michael@0: MOZ_BRANDING_DIRECTORY= michael@0: MOZ_OFFICIAL_BRANDING= michael@0: MOZ_FEEDS=1 michael@0: MOZ_WEBAPP_RUNTIME= michael@0: MOZ_JSDEBUGGER=1 michael@0: MOZ_AUTH_EXTENSION=1 michael@0: MOZ_RAW= michael@0: MOZ_VORBIS= michael@0: MOZ_TREMOR= michael@0: MOZ_WAVE=1 michael@0: MOZ_SAMPLE_TYPE_FLOAT32= michael@0: MOZ_SAMPLE_TYPE_S16= michael@0: MOZ_OPUS=1 michael@0: MOZ_WEBM=1 michael@0: MOZ_GSTREAMER= michael@0: MOZ_DIRECTSHOW= michael@0: MOZ_WMF= michael@0: MOZ_FMP4= michael@0: MOZ_FFMPEG= michael@0: MOZ_WEBRTC=1 michael@0: MOZ_PEERCONNECTION= michael@0: MOZ_SRTP= michael@0: MOZ_WEBRTC_SIGNALING= michael@0: MOZ_WEBRTC_ASSERT_ALWAYS=1 michael@0: MOZ_SCTP= michael@0: MOZ_MEDIA_PLUGINS= michael@0: MOZ_MEDIA_NAVIGATOR= michael@0: MOZ_OMX_PLUGIN= michael@0: MOZ_VPX= michael@0: MOZ_VPX_ERROR_CONCEALMENT= michael@0: MOZ_WEBSPEECH=1 michael@0: VPX_AS= michael@0: VPX_ASFLAGS= michael@0: VPX_AS_DASH_C_FLAG= michael@0: VPX_AS_CONVERSION= michael@0: VPX_ASM_SUFFIX= michael@0: VPX_X86_ASM= michael@0: VPX_ARM_ASM= michael@0: LIBJPEG_TURBO_AS= michael@0: LIBJPEG_TURBO_ASFLAGS= michael@0: LIBJPEG_TURBO_X86_ASM= michael@0: LIBJPEG_TURBO_X64_ASM= michael@0: LIBJPEG_TURBO_ARM_ASM= michael@0: MOZ_PERMISSIONS=1 michael@0: MOZ_PLACES=1 michael@0: MOZ_SOCIAL=1 michael@0: MOZ_PREF_EXTENSIONS=1 michael@0: MOZ_PROFILELOCKING=1 michael@0: MOZ_REFLOW_PERF= michael@0: MOZ_SAFE_BROWSING= michael@0: MOZ_HELP_VIEWER= michael@0: MOZ_SPELLCHECK=1 michael@0: MOZ_ANDROID_OMTC= michael@0: MOZ_TOOLKIT_SEARCH=1 michael@0: MOZ_UI_LOCALE=en-US michael@0: MOZ_UNIVERSALCHARDET=1 michael@0: MOZ_URL_CLASSIFIER= michael@0: MOZ_XUL=1 michael@0: MOZ_ZIPWRITER=1 michael@0: NS_PRINTING=1 michael@0: MOZ_PDF_PRINTING= michael@0: MOZ_DISABLE_CRYPTOLEGACY= michael@0: NSS_DISABLE_DBM= michael@0: NECKO_COOKIES=1 michael@0: NECKO_PROTOCOLS_DEFAULT="about app data file ftp http res viewsource websocket wyciwyg device" michael@0: if test -n "$MOZ_RTSP"; then michael@0: NECKO_PROTOCOLS_DEFAULT="$NECKO_PROTOCOLS_DEFAULT rtsp" michael@0: fi michael@0: USE_ARM_KUSER= michael@0: BUILD_CTYPES=1 michael@0: MOZ_USE_NATIVE_POPUP_WINDOWS= michael@0: MOZ_ANDROID_HISTORY= michael@0: MOZ_WEBSMS_BACKEND= michael@0: MOZ_ANDROID_BEAM= michael@0: MOZ_ANDROID_SYNTHAPKS= michael@0: ACCESSIBILITY=1 michael@0: MOZ_TIME_MANAGER= michael@0: MOZ_PAY= michael@0: MOZ_AUDIO_CHANNEL_MANAGER= michael@0: NSS_NO_LIBPKIX= michael@0: MOZ_CONTENT_SANDBOX= michael@0: MOZ_CONTENT_SANDBOX_REPORTER=1 michael@0: michael@0: case "$target_os" in michael@0: mingw*) michael@0: NS_ENABLE_TSF=1 michael@0: AC_DEFINE(NS_ENABLE_TSF) michael@0: ;; michael@0: esac michael@0: michael@0: case "${target}" in michael@0: *-android*|*-linuxandroid*) michael@0: if test "$CPU_ARCH" = "arm" ; then michael@0: USE_ARM_KUSER=1 michael@0: fi michael@0: michael@0: NSS_DISABLE_DBM=1 michael@0: MOZ_THEME_FASTSTRIPE=1 michael@0: MOZ_TREE_FREETYPE=1 michael@0: MOZ_MEMORY=1 michael@0: MOZ_RAW=1 michael@0: ;; michael@0: michael@0: esac michael@0: michael@0: MOZ_ARG_WITH_STRING(external-source-dir, michael@0: [ --with-external-source-dir=dir michael@0: External directory containing additional build files.], michael@0: [ EXTERNAL_SOURCE_DIR=$withval]) michael@0: AC_SUBST(EXTERNAL_SOURCE_DIR) michael@0: michael@0: MOZ_ARG_ENABLE_STRING(application, michael@0: [ --enable-application=APP michael@0: Options include: michael@0: browser (Firefox) michael@0: xulrunner michael@0: tools/update-packaging (AUS-related packaging tools)], michael@0: [ MOZ_BUILD_APP=$enableval ] ) michael@0: michael@0: MOZ_ARG_WITH_STRING(xulrunner-stub-name, michael@0: [ --with-xulrunner-stub-name=appname Create the xulrunner stub with the given name], michael@0: XULRUNNER_STUB_NAME=$withval) michael@0: michael@0: if test -z "$XULRUNNER_STUB_NAME"; then michael@0: case "$target_os" in michael@0: darwin*) michael@0: XULRUNNER_STUB_NAME=xulrunner michael@0: ;; michael@0: *) michael@0: XULRUNNER_STUB_NAME=xulrunner-stub michael@0: esac michael@0: fi michael@0: AC_SUBST(XULRUNNER_STUB_NAME) michael@0: michael@0: AC_MSG_CHECKING([for application to build]) michael@0: if test -z "$MOZ_BUILD_APP"; then michael@0: AC_MSG_RESULT([browser]) michael@0: MOZ_BUILD_APP=browser michael@0: else michael@0: # "mobile" no longer exists. michael@0: if test "$MOZ_BUILD_APP" = "mobile" ; then michael@0: AC_MSG_RESULT([none]) michael@0: AC_MSG_ERROR([--enable-application=mobile is no longer supported.]) michael@0: fi michael@0: # We have a valid application only if it has a build.mk file in its top michael@0: # directory. michael@0: if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then michael@0: AC_MSG_RESULT([none]) michael@0: AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).]) michael@0: else michael@0: AC_MSG_RESULT([$MOZ_BUILD_APP]) michael@0: fi michael@0: fi michael@0: michael@0: # The app update channel is 'default' when not supplied. The value is used in michael@0: # the application's confvars.sh so it must be set before confvars.sh is called. 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: # Allow to specify a Mozilla API key file that contains the secret key to be michael@0: # used for various Mozilla API requests. michael@0: MOZ_ARG_WITH_STRING(mozilla-api-keyfile, michael@0: [ --with-mozilla-api-keyfile=file Use the secret key contained in the given keyfile for Mozilla API requests], michael@0: MOZ_MOZILLA_API_KEY=`cat $withval`) michael@0: if test -z "$MOZ_MOZILLA_API_KEY"; then michael@0: MOZ_MOZILLA_API_KEY=no-mozilla-api-key michael@0: fi michael@0: AC_SUBST(MOZ_MOZILLA_API_KEY) michael@0: michael@0: # Allow to specify a Google API key file that contains the secret key to be michael@0: # used for various Google API requests. michael@0: MOZ_ARG_WITH_STRING(google-api-keyfile, michael@0: [ --with-google-api-keyfile=file Use the secret key contained in the given keyfile for Google API requests], michael@0: MOZ_GOOGLE_API_KEY=`cat $withval`) michael@0: if test -z "$MOZ_GOOGLE_API_KEY"; then michael@0: MOZ_GOOGLE_API_KEY=no-google-api-key michael@0: fi michael@0: AC_SUBST(MOZ_GOOGLE_API_KEY) michael@0: michael@0: # Allow the application to influence configure with a confvars.sh script. michael@0: AC_MSG_CHECKING([if app-specific confvars.sh exists]) michael@0: if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then michael@0: AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh]) michael@0: . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" michael@0: else michael@0: AC_MSG_RESULT([no]) michael@0: fi michael@0: michael@0: # Allow influencing configure with a defines.sh script. michael@0: . "${srcdir}/build/defines.sh" michael@0: michael@0: # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is michael@0: # set in defines.sh michael@0: if test "$BUILDING_RELEASE"; then michael@0: # Override value in defines.sh, if any michael@0: EARLY_BETA_OR_EARLIER= michael@0: elif test "$EARLY_BETA_OR_EARLIER"; then michael@0: AC_DEFINE(EARLY_BETA_OR_EARLIER) michael@0: fi michael@0: AC_SUBST(EARLY_BETA_OR_EARLIER) michael@0: michael@0: # Allow the application to provide a subconfigure script michael@0: if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then michael@0: do_output_subdirs() { michael@0: if test -n "$_subconfigure_subdirs"; then michael@0: AC_MSG_ERROR([Cannot specify more than one sub-sub-configure]) michael@0: fi michael@0: _subconfigure_subdir="$1" michael@0: _subconfigure_config_args="$ac_configure_args" michael@0: } michael@0: tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1 michael@0: m4 "${srcdir}/build/autoconf/subconfigure.m4" \ michael@0: "${srcdir}/build/autoconf/altoptions.m4" \ michael@0: "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript michael@0: . $tmpscript michael@0: rm -f $tmpscript michael@0: fi michael@0: michael@0: # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig michael@0: MOZ_ARG_WITH_STRING(app-name, michael@0: [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME], michael@0: WITH_APP_NAME=$withval, michael@0: ) michael@0: michael@0: if test -n "$WITH_APP_NAME" ; then michael@0: MOZ_APP_NAME="$WITH_APP_NAME" michael@0: fi michael@0: michael@0: MOZ_ARG_WITH_STRING(app-basename, michael@0: [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME], michael@0: WITH_APP_BASENAME=$withval, michael@0: ) michael@0: michael@0: if test -n "$WITH_APP_BASENAME" ; then michael@0: MOZ_APP_BASENAME="$WITH_APP_BASENAME" michael@0: fi michael@0: michael@0: # Now is a good time to test for logic errors, define mismatches, etc. michael@0: case "$MOZ_BUILD_APP" in michael@0: xulrunner) michael@0: if test "$LIBXUL_SDK"; then michael@0: AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.]) michael@0: fi michael@0: ;; michael@0: esac michael@0: michael@0: # Special cases where we need to AC_DEFINE something. Also a holdover for apps michael@0: # that haven't made a confvars.sh yet. Don't add new stuff here, use michael@0: # MOZ_BUILD_APP. michael@0: case "$MOZ_BUILD_APP" in michael@0: browser) michael@0: AC_DEFINE(MOZ_PHOENIX) michael@0: ;; michael@0: michael@0: xulrunner) michael@0: AC_DEFINE(MOZ_XULRUNNER) michael@0: ;; michael@0: b2g) michael@0: AC_DEFINE(MOZ_B2G) michael@0: ;; michael@0: esac michael@0: michael@0: AC_SUBST(MOZ_BUILD_APP) michael@0: AC_SUBST(MOZ_PHOENIX) michael@0: AC_SUBST(MOZ_XULRUNNER) michael@0: AC_SUBST(MOZ_B2G) michael@0: AC_SUBST(MOZ_B2G_VERSION) michael@0: michael@0: AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP) michael@0: michael@0: dnl ======================================================== michael@0: dnl Check android sdk version depending on mobile target michael@0: dnl ======================================================== michael@0: michael@0: if test -z "$gonkdir" ; then michael@0: # Minimum Android SDK API Level we require. michael@0: case "$MOZ_BUILD_APP" in michael@0: mobile/android) michael@0: android_min_api_level=16 michael@0: case "$target" in michael@0: *-android*|*-linuxandroid*) michael@0: : michael@0: ;; michael@0: *) michael@0: AC_MSG_ERROR([You must specify --target=arm-linux-androideabi (or some other valid android target) when building with --enable-application=mobile/android. See https://wiki.mozilla.org/Mobile/Fennec/Android#Setup_Fennec_mozconfig for more information about the necessary options]) michael@0: ;; michael@0: esac michael@0: ;; michael@0: esac michael@0: michael@0: MOZ_ANDROID_SDK($android_min_api_level) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = michael@0: dnl = Toolkit Options michael@0: dnl = michael@0: dnl ======================================================== michael@0: MOZ_ARG_HEADER(Toolkit Options) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Select the default toolkit michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_STRING(default-toolkit, michael@0: [ --enable-default-toolkit=TK michael@0: Select default toolkit michael@0: Platform specific defaults: michael@0: Mac OS X - cairo-cocoa michael@0: Win32 - cairo-windows michael@0: * - cairo-gtk2 michael@0: * - cairo-gtk3 michael@0: * - cairo-qt], michael@0: [ _DEFAULT_TOOLKIT=$enableval ], michael@0: [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT]) michael@0: michael@0: if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \ michael@0: -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \ michael@0: -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \ michael@0: -o "$_DEFAULT_TOOLKIT" = "cairo-gtk3" \ michael@0: -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \ michael@0: -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \ michael@0: -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \ michael@0: -o "$_DEFAULT_TOOLKIT" = "cairo-android" \ michael@0: -o "$_DEFAULT_TOOLKIT" = "cairo-gonk" michael@0: then michael@0: dnl nglayout only supports building with one toolkit, michael@0: dnl so ignore everything after the first comma (","). michael@0: MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"` michael@0: else michael@0: AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).]) michael@0: fi michael@0: michael@0: MOZ_ARG_WITHOUT_BOOL(x, michael@0: [ --without-x Build without X11], michael@0: WITHOUT_X11=1) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable the toolkit as needed = michael@0: dnl ======================================================== michael@0: michael@0: MOZ_WIDGET_GTK= michael@0: michael@0: case "$MOZ_WIDGET_TOOLKIT" in michael@0: michael@0: cairo-windows) michael@0: MOZ_WIDGET_TOOLKIT=windows michael@0: MOZ_WEBGL=1 michael@0: MOZ_PDF_PRINTING=1 michael@0: MOZ_INSTRUMENT_EVENT_LOOP=1 michael@0: if test -n "$GNU_CC"; then michael@0: MOZ_FOLD_LIBS= michael@0: fi michael@0: ;; michael@0: michael@0: cairo-gtk3) michael@0: MOZ_WIDGET_TOOLKIT=gtk3 michael@0: MOZ_ENABLE_GTK=1 michael@0: MOZ_ENABLE_GTK3=1 michael@0: MOZ_ENABLE_XREMOTE=1 michael@0: MOZ_WEBGL=1 michael@0: MOZ_GL_DEFAULT_PROVIDER=GLX michael@0: michael@0: AC_DEFINE(MOZ_X11) michael@0: MOZ_X11=1 michael@0: USE_FC_FREETYPE=1 michael@0: michael@0: TK_CFLAGS='$(MOZ_GTK3_CFLAGS)' michael@0: TK_LIBS='$(MOZ_GTK3_LIBS)' michael@0: MOZ_WIDGET_GTK=3 michael@0: AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK) michael@0: MOZ_PDF_PRINTING=1 michael@0: MOZ_INSTRUMENT_EVENT_LOOP=1 michael@0: ;; michael@0: michael@0: cairo-gtk2|cairo-gtk2-x11) michael@0: MOZ_WIDGET_TOOLKIT=gtk2 michael@0: MOZ_ENABLE_GTK=1 michael@0: MOZ_ENABLE_GTK2=1 michael@0: MOZ_ENABLE_XREMOTE=1 michael@0: MOZ_WEBGL=1 michael@0: MOZ_GL_DEFAULT_PROVIDER=GLX michael@0: michael@0: AC_DEFINE(MOZ_X11) michael@0: MOZ_X11=1 michael@0: USE_FC_FREETYPE=1 michael@0: michael@0: TK_CFLAGS='$(MOZ_GTK2_CFLAGS)' michael@0: TK_LIBS='$(MOZ_GTK2_LIBS)' michael@0: AC_DEFINE(MOZ_WIDGET_GTK2) michael@0: MOZ_WIDGET_GTK=2 michael@0: AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK) michael@0: MOZ_PDF_PRINTING=1 michael@0: MOZ_INSTRUMENT_EVENT_LOOP=1 michael@0: ;; michael@0: michael@0: cairo-qt) michael@0: MOZ_WIDGET_TOOLKIT=qt michael@0: MOZ_ENABLE_QT=1 michael@0: if test -z "$WITHOUT_X11"; then michael@0: MOZ_ENABLE_XREMOTE=1 michael@0: MOZ_GL_DEFAULT_PROVIDER=GLX michael@0: MOZ_X11=1 michael@0: AC_DEFINE(MOZ_X11) michael@0: XT_LIBS= michael@0: fi michael@0: michael@0: MOZ_WEBGL=1 michael@0: USE_FC_FREETYPE=1 michael@0: TK_CFLAGS='$(MOZ_QT_CFLAGS)' michael@0: TK_LIBS='$(MOZ_QT_LIBS)' michael@0: AC_DEFINE(MOZ_WIDGET_QT) michael@0: MOZ_PDF_PRINTING=1 michael@0: AC_DEFINE(QT_NO_KEYWORDS) michael@0: ;; michael@0: michael@0: cairo-cocoa) michael@0: MOZ_WIDGET_TOOLKIT=cocoa michael@0: AC_DEFINE(MOZ_WIDGET_COCOA) michael@0: LDFLAGS="$LDFLAGS -framework Cocoa -lobjc" michael@0: TK_LIBS='-framework CoreLocation -framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL' michael@0: TK_CFLAGS="-DNO_X11" michael@0: CFLAGS="$CFLAGS $TK_CFLAGS" michael@0: CXXFLAGS="$CXXFLAGS $TK_CFLAGS" michael@0: XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/bin/XUL $(call EXPAND_LIBNAME_PATH,mozalloc,$(LIBXUL_DIST)/bin)' michael@0: MOZ_USER_DIR="Mozilla" michael@0: MOZ_FS_LAYOUT=bundle michael@0: MOZ_WEBGL=1 michael@0: MOZ_INSTRUMENT_EVENT_LOOP=1 michael@0: ;; michael@0: michael@0: cairo-uikit) michael@0: MOZ_WIDGET_TOOLKIT=uikit michael@0: AC_DEFINE(MOZ_WIDGET_UIKIT) michael@0: LDFLAGS="$LDFLAGS -framework UIKit -lobjc" michael@0: TK_CFLAGS="-DNO_X11" michael@0: TK_LIBS='-framework Foundation -framework CoreFoundation -framework CoreGraphics -framework CoreText' michael@0: CFLAGS="$CFLAGS $TK_CFLAGS" michael@0: CXXFLAGS="$CXXFLAGS $TK_CFLAGS" michael@0: XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/bin/XUL $(call EXPAND_LIBNAME_PATH,mozalloc,$(LIBXUL_DIST)/bin)' michael@0: MOZ_USER_DIR="Mozilla" michael@0: MOZ_FS_LAYOUT=bundle michael@0: ;; michael@0: michael@0: cairo-android) michael@0: AC_DEFINE(MOZ_WIDGET_ANDROID) michael@0: MOZ_WIDGET_TOOLKIT=android michael@0: TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)' michael@0: TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)' michael@0: MOZ_WEBGL=1 michael@0: MOZ_PDF_PRINTING=1 michael@0: MOZ_INSTRUMENT_EVENT_LOOP=1 michael@0: ;; michael@0: michael@0: cairo-gonk) michael@0: XPCOM_FROZEN_LDOPTS='$(call EXPAND_LIBNAME_PATH,xul mozalloc,$(LIBXUL_DIST)/lib)' michael@0: AC_DEFINE(MOZ_WIDGET_GONK) michael@0: AC_DEFINE(MOZ_TOUCH) michael@0: MOZ_WIDGET_TOOLKIT=gonk michael@0: TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)' michael@0: TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)' michael@0: MOZ_WEBGL=1 michael@0: MOZ_PDF_PRINTING=1 michael@0: MOZ_TOUCH=1 michael@0: MOZ_INSTRUMENT_EVENT_LOOP=1 michael@0: ;; michael@0: michael@0: esac michael@0: michael@0: AC_SUBST(MOZ_PDF_PRINTING) michael@0: if test "$MOZ_PDF_PRINTING"; then michael@0: PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1" michael@0: AC_DEFINE(MOZ_PDF_PRINTING) michael@0: fi michael@0: michael@0: if test "$MOZ_ENABLE_XREMOTE"; then michael@0: AC_DEFINE(MOZ_ENABLE_XREMOTE) michael@0: fi michael@0: michael@0: if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then michael@0: AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP) michael@0: fi michael@0: michael@0: if test "$COMPILE_ENVIRONMENT"; then michael@0: if test "$MOZ_ENABLE_GTK3"; then michael@0: PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 $GDK_PACKAGES) michael@0: fi michael@0: if test "$MOZ_ENABLE_GTK2"; then michael@0: if test "$MOZ_X11"; then michael@0: GDK_PACKAGES=gdk-x11-2.0 michael@0: fi michael@0: michael@0: PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES) michael@0: fi michael@0: michael@0: fi # COMPILE_ENVIRONMENT michael@0: michael@0: AC_SUBST(MOZ_FS_LAYOUT) 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 = startup-notification support module michael@0: dnl ======================================================== michael@0: michael@0: if test "$MOZ_ENABLE_GTK" michael@0: then michael@0: MOZ_ENABLE_STARTUP_NOTIFICATION= michael@0: michael@0: MOZ_ARG_ENABLE_BOOL(startup-notification, michael@0: [ --enable-startup-notification michael@0: Enable startup-notification support (default: disabled) ], michael@0: MOZ_ENABLE_STARTUP_NOTIFICATION=force, michael@0: MOZ_ENABLE_STARTUP_NOTIFICATION=) michael@0: if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" michael@0: then michael@0: PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION, michael@0: libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION, michael@0: [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [ michael@0: if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force" michael@0: then michael@0: AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION]) michael@0: fi michael@0: MOZ_ENABLE_STARTUP_NOTIFICATION= michael@0: ]) michael@0: fi michael@0: michael@0: if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then michael@0: AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION) michael@0: fi michael@0: michael@0: TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS" michael@0: fi michael@0: AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION) michael@0: AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS) michael@0: AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS) michael@0: michael@0: dnl ======================================================== michael@0: dnl Disable printing michael@0: dnl ======================================================== michael@0: MOZ_ARG_DISABLE_BOOL(printing, michael@0: [ --disable-printing Disable printing support], michael@0: NS_PRINTING=, michael@0: NS_PRINTING=1) michael@0: michael@0: if test "$NS_PRINTING"; then michael@0: AC_DEFINE(NS_PRINTING) michael@0: AC_DEFINE(NS_PRINT_PREVIEW) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = QT support michael@0: dnl ======================================================== michael@0: if test "$MOZ_ENABLE_QT" michael@0: then michael@0: MOZ_ARG_WITH_STRING(qtdir, michael@0: [ --with-qtdir=\$dir Specify Qt directory ], michael@0: [ QTDIR=$withval]) michael@0: michael@0: if test -z "$QTDIR"; then michael@0: AC_CHECK_PROGS(HOST_QMAKE, $HOST_QMAKE qmake, "") michael@0: else michael@0: HOST_QMAKE="$QTDIR/bin/qmake" michael@0: fi michael@0: QT_VERSION=`$HOST_QMAKE -v | grep 'Using Qt version' | egrep -o '[[0-9]]+\.[[0-9]]+\.[[0-9]]+'` michael@0: michael@0: if test -z "$QTDIR"; then michael@0: case $QT_VERSION in michael@0: 5.*) michael@0: AC_MSG_RESULT("Using qt5: $QT_VERSION") michael@0: PKG_CHECK_MODULES(MOZ_QT, Qt5Gui Qt5Network Qt5Core Qt5Quick, , michael@0: [ michael@0: AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase development packages, (On Ubuntu, you might try installing the packages qtbase5-dev libqt5opengl5-dev.)]) michael@0: ]) michael@0: QT5INCDIR=`pkg-config --variable=includedir Qt5Gui` michael@0: MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QT5INCDIR/QtGui/$QT_VERSION/QtGui" michael@0: if test "$NS_PRINTING"; then michael@0: PKG_CHECK_MODULES(MOZ_QT_WIDGETS, Qt5PrintSupport, , michael@0: [ michael@0: AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase widgets development package]) michael@0: ]) michael@0: MOZ_QT_LIBS="$MOZ_QT_LIBS $MOZ_QT_WIDGETS_LIBS" michael@0: MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $MOZ_QT_WIDGETS_CFLAGS" michael@0: fi michael@0: ;; michael@0: *) michael@0: AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION]) michael@0: ;; michael@0: esac michael@0: michael@0: AC_CHECK_PROGS(HOST_MOC, $MOC moc, "") michael@0: AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "") michael@0: else michael@0: MOZ_QT_CFLAGS="-DQT_SHARED" michael@0: MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include" michael@0: MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui" michael@0: MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore" michael@0: MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork" michael@0: MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml" michael@0: MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative" michael@0: case $QT_VERSION in michael@0: 5.*) michael@0: AC_MSG_RESULT("Using qt5: $QT_VERSION") michael@0: MOZ_QT_LIBS="$MOZ_QT_LIBS -L$QTDIR/lib/ -lQt5Gui -lQt5Network -lQt5Core -lQt5Xml" michael@0: MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui/$QT_VERSION/QtGui" michael@0: if test "$NS_PRINTING"; then michael@0: MOZ_QT_LIBS="$MOZ_QT_LIBS -lQt5Widgets -lQt5PrintSupport" michael@0: MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport" michael@0: fi michael@0: ;; michael@0: *) michael@0: AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION]) michael@0: ;; michael@0: esac michael@0: michael@0: HOST_MOC="$QTDIR/bin/moc" michael@0: HOST_RCC="$QTDIR/bin/rcc" michael@0: fi michael@0: if test -z "$HOST_MOC"; then michael@0: AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is incorrect]) michael@0: fi michael@0: if test -z "$HOST_RCC"; then michael@0: AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is incorrect]) michael@0: fi michael@0: michael@0: MOC=$HOST_MOC michael@0: RCC=$HOST_RCC michael@0: michael@0: MOZ_ENABLE_QMSYSTEM2= michael@0: PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2, michael@0: MOZ_ENABLE_QMSYSTEM2=1, michael@0: MOZ_ENABLE_QMSYSTEM2=) michael@0: michael@0: if test "$MOZ_ENABLE_QMSYSTEM2"; then michael@0: MOZ_ENABLE_QMSYSTEM2=1 michael@0: MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS" michael@0: MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS" michael@0: AC_DEFINE(MOZ_ENABLE_QMSYSTEM2) michael@0: fi michael@0: michael@0: MOZ_ENABLE_QTNETWORK= michael@0: PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7, michael@0: MOZ_ENABLE_QTNETWORK=1, michael@0: MOZ_ENABLE_QTNETWORK=) michael@0: michael@0: if test "$MOZ_ENABLE_QTNETWORK"; then michael@0: MOZ_ENABLE_QTNETWORK=1 michael@0: AC_DEFINE(MOZ_ENABLE_QTNETWORK) michael@0: fi michael@0: michael@0: MOZ_ENABLE_QTMOBILITY= michael@0: PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation, michael@0: MOZ_ENABLE_QTMOBILITY=1, michael@0: MOZ_ENABLE_QTMOBILITY=) michael@0: if test "$MOZ_ENABLE_QTMOBILITY"; then michael@0: MOZ_ENABLE_QTMOBILITY=1 michael@0: MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS" michael@0: MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS" michael@0: AC_DEFINE(MOZ_ENABLE_QTMOBILITY) michael@0: AC_SUBST(MOZ_ENABLE_QTMOBILITY) michael@0: else michael@0: AC_CHECK_LIB(QtSensors, main, [ michael@0: MOZ_ENABLE_QTMOBILITY=1 michael@0: MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility" michael@0: MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors" michael@0: MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback" michael@0: MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation" michael@0: MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation" michael@0: ]) michael@0: fi michael@0: michael@0: MOZ_ENABLE_QT5FEEDBACK= michael@0: PKG_CHECK_MODULES(_QT5FEEDBACK, Qt0Feedback, michael@0: MOZ_ENABLE_QT5FEEDBACK=1, michael@0: MOZ_ENABLE_QT5FEEDBACK=) michael@0: if test "$MOZ_ENABLE_QT5FEEDBACK"; then michael@0: MOZ_ENABLE_QT5FEEDBACK=1 michael@0: MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QT5FEEDBACK_CFLAGS" michael@0: MOZ_QT_LIBS="$MOZ_QT_LIBS $_QT5FEEDBACK_LIBS" michael@0: AC_DEFINE(MOZ_ENABLE_QT5FEEDBACK) michael@0: AC_SUBST(MOZ_ENABLE_QT5FEEDBACK) michael@0: fi michael@0: michael@0: MOZ_ENABLE_QT5GEOPOSITION= michael@0: PKG_CHECK_MODULES(_QT5GEOPOSITION, Qt5Positioning, michael@0: MOZ_ENABLE_QT5GEOPOSITION=1, michael@0: MOZ_ENABLE_QT5GEOPOSITION=) michael@0: if test "$MOZ_ENABLE_QT5GEOPOSITION"; then michael@0: MOZ_ENABLE_QT5GEOPOSITION=1 michael@0: MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QT5GEOPOSITION_CFLAGS" michael@0: MOZ_QT_LIBS="$MOZ_QT_LIBS $_QT5GEOPOSITION_LIBS" michael@0: AC_DEFINE(MOZ_ENABLE_QT5GEOPOSITION) michael@0: AC_SUBST(MOZ_ENABLE_QT5GEOPOSITION) michael@0: fi michael@0: michael@0: if test "$MOZ_ENABLE_CONTENTACTION"; then michael@0: MOZ_ENABLE_CONTENTACTION=1 michael@0: AC_DEFINE(MOZ_ENABLE_CONTENTACTION) michael@0: fi michael@0: michael@0: MOZ_ENABLE_CONTENTACTION= michael@0: PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=) michael@0: if test "$MOZ_ENABLE_CONTENTACTION"; then michael@0: MOZ_ENABLE_CONTENTACTION=1 michael@0: MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_CONTENTACTION_CFLAGS" michael@0: MOZ_QT_LIBS="$MOZ_QT_LIBS $_CONTENTACTION_LIBS" michael@0: AC_DEFINE(MOZ_ENABLE_CONTENTACTION) michael@0: AC_SUBST(MOZ_ENABLE_CONTENTACTION) michael@0: fi michael@0: fi michael@0: michael@0: AC_SUBST(GTK_CONFIG) michael@0: AC_SUBST(TK_CFLAGS) michael@0: AC_SUBST(TK_LIBS) michael@0: michael@0: AC_SUBST(MOZ_ENABLE_GTK2) michael@0: AC_SUBST(MOZ_ENABLE_GTK3) michael@0: AC_SUBST(MOZ_ENABLE_GTK) michael@0: AC_SUBST(MOZ_ENABLE_QT) michael@0: AC_SUBST(MOZ_ENABLE_QTNETWORK) michael@0: AC_SUBST(MOZ_ENABLE_QMSYSTEM2) michael@0: AC_SUBST(MOZ_ENABLE_QTMOBILITY) michael@0: AC_SUBST(MOZ_ENABLE_XREMOTE) michael@0: AC_SUBST(MOZ_GTK2_CFLAGS) michael@0: AC_SUBST(MOZ_GTK2_LIBS) michael@0: AC_SUBST(MOZ_GTK3_CFLAGS) michael@0: AC_SUBST(MOZ_GTK3_LIBS) michael@0: AC_SUBST(MOZ_WIDGET_GTK) michael@0: AC_SUBST(MOZ_QT_CFLAGS) michael@0: AC_SUBST(MOZ_QT_LIBS) michael@0: michael@0: AC_SUBST(MOC) michael@0: AC_SUBST(RCC) michael@0: michael@0: AC_SUBST(MOZ_X11) 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 = Trademarked Branding michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(official-branding, michael@0: [ --enable-official-branding michael@0: Enable Official mozilla.org Branding michael@0: Do not distribute builds with michael@0: --enable-official-branding unless you have michael@0: permission to use trademarks per michael@0: http://www.mozilla.org/foundation/trademarks/ .], michael@0: [ michael@0: if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then michael@0: AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.]) michael@0: else michael@0: MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY} michael@0: MOZ_OFFICIAL_BRANDING=1 michael@0: fi michael@0: ], MOZ_OFFICIAL_BRANDING=) michael@0: michael@0: AC_SUBST(MOZ_OFFICIAL_BRANDING) michael@0: if test -n "$MOZ_OFFICIAL_BRANDING"; then michael@0: AC_DEFINE(MOZ_OFFICIAL_BRANDING) michael@0: fi michael@0: michael@0: MOZ_ARG_WITH_STRING(branding, michael@0: [ --with-branding=dir Use branding from the specified directory.], michael@0: MOZ_BRANDING_DIRECTORY=$withval) michael@0: michael@0: REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}" michael@0: if test -z "$REAL_BRANDING_DIRECTORY"; then michael@0: REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly michael@0: fi michael@0: michael@0: if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then michael@0: . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh" michael@0: fi michael@0: michael@0: AC_SUBST(MOZ_BRANDING_DIRECTORY) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Distribution ID michael@0: dnl ======================================================== michael@0: MOZ_ARG_WITH_STRING(distribution-id, michael@0: [ --with-distribution-id=ID michael@0: Set distribution-specific id (default=org.mozilla)], michael@0: [ val=`echo $withval` michael@0: MOZ_DISTRIBUTION_ID="$val"]) michael@0: michael@0: if test -z "$MOZ_DISTRIBUTION_ID"; then michael@0: MOZ_DISTRIBUTION_ID="org.mozilla" michael@0: fi michael@0: michael@0: AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID") michael@0: AC_SUBST(MOZ_DISTRIBUTION_ID) michael@0: michael@0: michael@0: dnl ======================================================== michael@0: dnl = Pango michael@0: dnl ======================================================== michael@0: if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT" michael@0: then michael@0: PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION) michael@0: michael@0: PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION) michael@0: AC_SUBST(MOZ_PANGO_CFLAGS) michael@0: AC_SUBST(MOZ_PANGO_LIBS) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = GnomeVFS, GIO and GConf support module michael@0: dnl ======================================================== michael@0: michael@0: if test "$MOZ_X11" michael@0: then michael@0: dnl build the GIO extension by default only when the michael@0: dnl GTK2 toolkit is in use. michael@0: if test "$MOZ_ENABLE_GTK" michael@0: then michael@0: MOZ_ENABLE_GIO=1 michael@0: MOZ_ENABLE_GCONF=1 michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = GnomeVFS support module michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(gnomevfs, michael@0: [ --enable-gnomevfs Enable GnomeVFS support (default: disabled)], michael@0: MOZ_ENABLE_GNOMEVFS=force, michael@0: MOZ_ENABLE_GNOMEVFS=) michael@0: michael@0: if test "$MOZ_ENABLE_GNOMEVFS" michael@0: then michael@0: PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[ michael@0: MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'` michael@0: MOZ_ENABLE_GNOMEVFS=1 michael@0: AC_DEFINE(MOZ_ENABLE_GNOMEVFS) michael@0: ],[ michael@0: if test "$MOZ_ENABLE_GNOMEVFS" = "force" michael@0: then michael@0: AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION]) michael@0: fi michael@0: MOZ_ENABLE_GNOMEVFS= michael@0: ]) michael@0: fi michael@0: michael@0: AC_SUBST(MOZ_ENABLE_GNOMEVFS) michael@0: AC_SUBST(MOZ_GNOMEVFS_CFLAGS) michael@0: AC_SUBST(MOZ_GNOMEVFS_LIBS) michael@0: michael@0: dnl ======================================================== michael@0: dnl = GIO support module michael@0: dnl ======================================================== michael@0: MOZ_ARG_DISABLE_BOOL(gio, michael@0: [ --disable-gio Disable GIO support], michael@0: MOZ_ENABLE_GIO=, michael@0: MOZ_ENABLE_GIO=force) michael@0: michael@0: if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK" michael@0: then michael@0: if test "$MOZ_ENABLE_GTK2" michael@0: then michael@0: PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, , michael@0: [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])]) michael@0: fi michael@0: PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[ michael@0: MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'` michael@0: MOZ_ENABLE_GIO=1 michael@0: AC_DEFINE(MOZ_ENABLE_GIO) michael@0: ],[ michael@0: if test "$MOZ_ENABLE_GIO" = "force" michael@0: then michael@0: AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION]) michael@0: fi michael@0: MOZ_ENABLE_GIO= michael@0: ]) michael@0: fi michael@0: michael@0: AC_SUBST(MOZ_ENABLE_GIO) michael@0: AC_SUBST(MOZ_GIO_CFLAGS) michael@0: AC_SUBST(MOZ_GIO_LIBS) michael@0: michael@0: dnl ======================================================== michael@0: dnl = GConf support module michael@0: dnl ======================================================== michael@0: MOZ_ARG_DISABLE_BOOL(gconf, michael@0: [ --disable-gconf Disable Gconf support ], michael@0: MOZ_ENABLE_GCONF=, michael@0: MOZ_ENABLE_GCONF=force) michael@0: michael@0: if test "$MOZ_ENABLE_GCONF" michael@0: then michael@0: PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[ michael@0: MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0` michael@0: MOZ_ENABLE_GCONF=1 michael@0: ],[ michael@0: if test "$MOZ_ENABLE_GCONF" = "force" michael@0: then michael@0: AC_MSG_ERROR([* * * Could not find gconf-2.0 ]) michael@0: fi michael@0: MOZ_ENABLE_GCONF= michael@0: ]) michael@0: fi michael@0: michael@0: if test "$MOZ_ENABLE_GCONF"; then michael@0: AC_DEFINE(MOZ_ENABLE_GCONF) michael@0: fi michael@0: michael@0: AC_SUBST(MOZ_ENABLE_GCONF) michael@0: AC_SUBST(MOZ_GCONF_CFLAGS) michael@0: AC_SUBST(MOZ_GCONF_LIBS) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = libproxy support michael@0: dnl ======================================================== michael@0: michael@0: if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT" michael@0: then michael@0: MOZ_ENABLE_LIBPROXY= michael@0: michael@0: MOZ_ARG_ENABLE_BOOL(libproxy, michael@0: [ --enable-libproxy Enable libproxy support ], michael@0: MOZ_ENABLE_LIBPROXY=1, michael@0: MOZ_ENABLE_LIBPROXY=) michael@0: michael@0: if test "$MOZ_ENABLE_LIBPROXY" michael@0: then michael@0: PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0) michael@0: AC_DEFINE(MOZ_ENABLE_LIBPROXY) michael@0: fi michael@0: fi michael@0: AC_SUBST(MOZ_ENABLE_LIBPROXY) michael@0: AC_SUBST(MOZ_LIBPROXY_CFLAGS) michael@0: AC_SUBST(MOZ_LIBPROXY_LIBS) michael@0: michael@0: dnl ======================================================== michael@0: dnl = GNOME component (mozgnome) michael@0: dnl ======================================================== michael@0: michael@0: if test "$MOZ_ENABLE_GTK" michael@0: then michael@0: MOZ_ENABLE_GNOME_COMPONENT=1 michael@0: fi michael@0: AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT) michael@0: michael@0: dnl ======================================================== michael@0: dnl = libgnomeui support module michael@0: dnl ======================================================== michael@0: michael@0: if test "$MOZ_ENABLE_GTK" michael@0: then michael@0: MOZ_ARG_ENABLE_BOOL(gnomeui, michael@0: [ --enable-gnomeui Enable libgnomeui instead of GIO & GTK for icon theme support ], michael@0: MOZ_ENABLE_GNOMEUI=force, michael@0: MOZ_ENABLE_GNOMEUI=) michael@0: michael@0: if test "$MOZ_ENABLE_GNOMEUI" michael@0: then michael@0: PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION, michael@0: [ michael@0: MOZ_ENABLE_GNOMEUI=1 michael@0: ],[ michael@0: if test "$MOZ_ENABLE_GNOMEUI" = "force" michael@0: then michael@0: AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION]) michael@0: fi michael@0: MOZ_ENABLE_GNOMEUI= michael@0: ]) michael@0: fi michael@0: michael@0: if test "$MOZ_ENABLE_GNOMEUI"; then michael@0: AC_DEFINE(MOZ_ENABLE_GNOMEUI) michael@0: fi michael@0: fi michael@0: michael@0: AC_SUBST(MOZ_ENABLE_GNOMEUI) michael@0: AC_SUBST(MOZ_GNOMEUI_CFLAGS) michael@0: michael@0: dnl ======================================================== michael@0: dnl = dbus support michael@0: dnl ======================================================== michael@0: michael@0: if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT" michael@0: then michael@0: MOZ_ENABLE_DBUS=1 michael@0: michael@0: MOZ_ARG_DISABLE_BOOL(dbus, michael@0: [ --disable-dbus Disable dbus support ], michael@0: MOZ_ENABLE_DBUS=, michael@0: MOZ_ENABLE_DBUS=1) michael@0: michael@0: if test "$MOZ_ENABLE_DBUS" michael@0: then michael@0: PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION) michael@0: PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION) michael@0: AC_DEFINE(MOZ_ENABLE_DBUS) michael@0: fi michael@0: fi michael@0: AC_SUBST(MOZ_ENABLE_DBUS) michael@0: AC_SUBST(MOZ_DBUS_CFLAGS) michael@0: AC_SUBST(MOZ_DBUS_LIBS) michael@0: AC_SUBST(MOZ_DBUS_GLIB_CFLAGS) michael@0: AC_SUBST(MOZ_DBUS_GLIB_LIBS) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable Android History instead of Places michael@0: dnl ======================================================== michael@0: if test -n "$MOZ_ANDROID_HISTORY"; then michael@0: if test -z "$MOZ_PLACES"; then michael@0: AC_DEFINE(MOZ_ANDROID_HISTORY) michael@0: else michael@0: AC_MSG_ERROR([Cannot use MOZ_ANDROID_HISTORY alongside MOZ_PLACES.]) michael@0: fi michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = Build with the Android compositor michael@0: dnl ======================================================== michael@0: if test -n "$MOZ_ANDROID_OMTC"; then michael@0: dnl Do this if defined in confvars.sh michael@0: AC_DEFINE(MOZ_ANDROID_OMTC) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = Disable WebSMS backend michael@0: dnl ======================================================== michael@0: MOZ_ARG_DISABLE_BOOL(websms-backend, michael@0: [ --disable-websms-backend michael@0: Disable WebSMS backend], michael@0: MOZ_WEBSMS_BACKEND=, michael@0: MOZ_WEBSMS_BACKEND=1) michael@0: michael@0: if test -n "$MOZ_WEBSMS_BACKEND"; then michael@0: AC_DEFINE(MOZ_WEBSMS_BACKEND) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable NFC permission on Android michael@0: dnl ======================================================== michael@0: if test -n "$MOZ_ANDROID_BEAM"; then michael@0: AC_DEFINE(MOZ_ANDROID_BEAM) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = Synthesized Webapp APKs on Android michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(android-synthapks, michael@0: [ --enable-android-synthapks Enable synthesized APKs], michael@0: MOZ_ANDROID_SYNTHAPKS=1, michael@0: MOZ_ANDROID_SYNTHAPKS=) michael@0: michael@0: if test -n "$MOZ_ANDROID_SYNTHAPKS"; then michael@0: AC_DEFINE(MOZ_ANDROID_SYNTHAPKS) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = JS Debugger XPCOM component (js/jsd) michael@0: dnl ======================================================== michael@0: MOZ_ARG_DISABLE_BOOL(jsd, michael@0: [ --disable-jsd Disable JavaScript debug library], michael@0: MOZ_JSDEBUGGER=, michael@0: MOZ_JSDEBUGGER=1) michael@0: michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable IPDL's "expensive" unit tests michael@0: dnl ======================================================== michael@0: MOZ_IPDL_TESTS= michael@0: michael@0: MOZ_ARG_ENABLE_BOOL(ipdl-tests, michael@0: [ --enable-ipdl-tests Enable expensive IPDL tests], michael@0: MOZ_IPDL_TESTS=1, michael@0: MOZ_IPDL_TESTS=) michael@0: michael@0: if test -n "$MOZ_IPDL_TESTS"; then michael@0: AC_DEFINE(MOZ_IPDL_TESTS) michael@0: fi michael@0: michael@0: AC_SUBST(MOZ_IPDL_TESTS) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Disable building dbm michael@0: dnl ======================================================== michael@0: MOZ_ARG_DISABLE_BOOL(dbm, michael@0: [ --disable-dbm Disable building dbm], michael@0: NSS_DISABLE_DBM=1, michael@0: NSS_DISABLE_DBM=) michael@0: michael@0: dnl ======================================================== michael@0: dnl accessibility support on by default on all platforms michael@0: dnl ======================================================== michael@0: MOZ_ARG_DISABLE_BOOL(accessibility, michael@0: [ --disable-accessibility Disable accessibility support], michael@0: ACCESSIBILITY=, michael@0: ACCESSIBILITY=1 ) michael@0: if test "$ACCESSIBILITY"; then michael@0: case "$target" in michael@0: *-mingw*) michael@0: if test -z "$MIDL"; then michael@0: if test "$GCC" != "yes"; then michael@0: AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.]) michael@0: else michael@0: AC_MSG_ERROR([You have accessibility enabled, but widl could not be found. Add --disable-accessibility to your mozconfig or install widl. See https://developer.mozilla.org/en-US/docs/Cross_Compile_Mozilla_for_Mingw32 for details.]) michael@0: fi michael@0: fi michael@0: esac michael@0: AC_DEFINE(ACCESSIBILITY) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl Accessibility is required for the linuxgl widget michael@0: dnl backend michael@0: dnl ======================================================== michael@0: if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then michael@0: AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"]) michael@0: fi michael@0: michael@0: dnl Turn off webrtc for OS's we don't handle yet, but allow michael@0: dnl --enable-webrtc to override. Can disable for everything in michael@0: dnl the master list above. michael@0: if test -n "$MOZ_WEBRTC"; then michael@0: case "$target" in michael@0: *-linux*|*-mingw*|*-darwin*|*-android*|*-linuxandroid*|*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*) michael@0: dnl Leave enabled michael@0: ;; michael@0: *) michael@0: dnl default to disabled for all others michael@0: MOZ_WEBRTC= michael@0: ;; michael@0: esac michael@0: fi michael@0: michael@0: AC_TRY_COMPILE([#include ], michael@0: [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ], michael@0: MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1) michael@0: michael@0: AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI) michael@0: michael@0: # target_arch is from {ia32|x64|arm|ppc} michael@0: case "$CPU_ARCH" in michael@0: x86_64 | arm | x86 | ppc* | ia64) michael@0: : michael@0: ;; michael@0: *) michael@0: # unsupported arch for webrtc michael@0: MOZ_WEBRTC= michael@0: ;; michael@0: michael@0: esac michael@0: michael@0: dnl ======================================================== michael@0: dnl = Disable WebRTC code michael@0: dnl ======================================================== michael@0: MOZ_ARG_DISABLE_BOOL(webrtc, michael@0: [ --disable-webrtc Disable support for WebRTC], michael@0: MOZ_WEBRTC=, michael@0: MOZ_WEBRTC=1) michael@0: michael@0: if test -n "$MOZ_WEBRTC"; then michael@0: AC_DEFINE(MOZ_WEBRTC) michael@0: dnl MOZ_WEBRTC_ASSERT_ALWAYS turns on a number of safety asserts in michael@0: dnl opt/production builds (via MOZ_CRASH()) michael@0: AC_DEFINE(MOZ_WEBRTC_ASSERT_ALWAYS) michael@0: MOZ_RAW=1 michael@0: MOZ_VPX=1 michael@0: MOZ_VPX_ERROR_CONCEALMENT=1 michael@0: michael@0: dnl enable once Signaling lands michael@0: MOZ_WEBRTC_SIGNALING=1 michael@0: AC_DEFINE(MOZ_WEBRTC_SIGNALING) michael@0: dnl enable once PeerConnection lands michael@0: MOZ_PEERCONNECTION=1 michael@0: AC_DEFINE(MOZ_PEERCONNECTION) michael@0: MOZ_SCTP=1 michael@0: MOZ_SRTP=1 michael@0: AC_DEFINE(MOZ_SCTP) michael@0: AC_DEFINE(MOZ_SRTP) michael@0: else michael@0: MOZ_SYNTH_PICO= michael@0: fi michael@0: michael@0: AC_SUBST(MOZ_WEBRTC) michael@0: AC_SUBST(MOZ_WEBRTC_LEAKING_TESTS) michael@0: AC_SUBST(MOZ_WEBRTC_SIGNALING) michael@0: AC_SUBST(MOZ_PEERCONNECTION) michael@0: AC_SUBST(MOZ_WEBRTC_ASSERT_ALWAYS) michael@0: AC_SUBST(MOZ_SCTP) michael@0: AC_SUBST(MOZ_SRTP) michael@0: michael@0: dnl Use integers over floats for audio on B2G and Android michael@0: dnl (regarless of the CPU architecture, because audio michael@0: dnl backends for those platforms don't support floats. We also michael@0: dnl use integers on ARM with other OS, because it's more efficient. michael@0: if test "$OS_TARGET" = "Android" -o "$CPU_ARCH" = "arm"; then michael@0: MOZ_SAMPLE_TYPE_S16=1 michael@0: AC_DEFINE(MOZ_SAMPLE_TYPE_S16) michael@0: AC_SUBST(MOZ_SAMPLE_TYPE_S16) michael@0: else michael@0: MOZ_SAMPLE_TYPE_FLOAT32=1 michael@0: AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32) michael@0: AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = Disable Speech API code michael@0: dnl ======================================================== michael@0: MOZ_ARG_DISABLE_BOOL(webspeech, michael@0: [ --disable-webspeech Disable support for HTML Speech API], michael@0: MOZ_WEBSPEECH=, michael@0: MOZ_WEBSPEECH=1) michael@0: michael@0: if test -n "$MOZ_WEBSPEECH"; then michael@0: AC_DEFINE(MOZ_WEBSPEECH) michael@0: fi michael@0: michael@0: AC_SUBST(MOZ_WEBSPEECH) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable Raw Codecs michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(raw, michael@0: [ --enable-raw Enable support for RAW media], michael@0: MOZ_RAW=1, michael@0: MOZ_RAW=) michael@0: michael@0: if test -n "$MOZ_RAW"; then michael@0: AC_DEFINE(MOZ_RAW) michael@0: fi michael@0: michael@0: AC_SUBST(MOZ_RAW) michael@0: michael@0: dnl Checks for __attribute__(aligned()) directive need by libogg michael@0: AC_CACHE_CHECK([__attribute__ ((aligned ())) support], michael@0: [ac_cv_c_attribute_aligned], michael@0: [ac_cv_c_attribute_aligned=0 michael@0: CFLAGS_save="${CFLAGS}" michael@0: CFLAGS="${CFLAGS} -Werror" michael@0: for ac_cv_c_attr_align_try in 64 32 16 8; do michael@0: echo "trying $ac_cv_c_attr_align_try" michael@0: AC_TRY_COMPILE([], michael@0: [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;], michael@0: [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"]) michael@0: if test "$ac_cv_c_attribute_aligned" != 0; then michael@0: break; michael@0: fi michael@0: done michael@0: CFLAGS="${CFLAGS_save}"]) michael@0: if test "${ac_cv_c_attribute_aligned}" != "0"; then michael@0: AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX], michael@0: [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment]) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = Disable Opus audio codec support michael@0: dnl ======================================================== michael@0: MOZ_ARG_DISABLE_BOOL(opus, michael@0: [ --disable-opus Disable support for Opus audio], michael@0: MOZ_OPUS=, michael@0: MOZ_OPUS=1) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Disable VP8 decoder support michael@0: dnl ======================================================== michael@0: MOZ_ARG_DISABLE_BOOL(webm, michael@0: [ --disable-webm Disable support for WebM media (VP8 video and Vorbis audio)], michael@0: MOZ_WEBM=, michael@0: MOZ_WEBM=1) michael@0: michael@0: if test -n "$MOZ_WEBM"; then michael@0: AC_DEFINE(MOZ_WEBM) michael@0: MOZ_VPX=1 michael@0: fi; michael@0: michael@0: dnl ======================================================== michael@0: dnl = DirectShow support michael@0: dnl ======================================================== michael@0: if test "$OS_ARCH" = "WINNT"; then michael@0: dnl Enable DirectShow support by default. michael@0: MOZ_DIRECTSHOW=1 michael@0: fi michael@0: michael@0: MOZ_ARG_DISABLE_BOOL(directshow, michael@0: [ --disable-directshow Disable support for DirectShow], michael@0: MOZ_DIRECTSHOW=, michael@0: MOZ_DIRECTSHOW=1) michael@0: michael@0: if test -n "$MOZ_DIRECTSHOW"; then michael@0: AC_DEFINE(MOZ_DIRECTSHOW) michael@0: fi; michael@0: michael@0: dnl ======================================================== michael@0: dnl = Windows Media Foundation support michael@0: dnl ======================================================== michael@0: if test "$OS_ARCH" = "WINNT"; then michael@0: dnl Enable Windows Media Foundation support by default. michael@0: dnl Note our minimum SDK version is Windows 7 SDK, so we are (currently) michael@0: dnl guaranteed to have a recent-enough SDK to build WMF. michael@0: MOZ_WMF=1 michael@0: fi michael@0: michael@0: MOZ_ARG_DISABLE_BOOL(wmf, michael@0: [ --disable-wmf Disable support for Windows Media Foundation], michael@0: MOZ_WMF=, michael@0: MOZ_WMF=1) michael@0: michael@0: if test -n "$MOZ_WMF"; then michael@0: AC_DEFINE(MOZ_WMF) michael@0: fi; michael@0: michael@0: dnl ======================================================== michael@0: dnl FFmpeg H264/AAC Decoding Support michael@0: dnl ======================================================== michael@0: case "$OS_TARGET" in michael@0: WINNT|Darwin|Android) michael@0: ;; michael@0: *) michael@0: MOZ_FFMPEG=1 michael@0: ;; michael@0: esac michael@0: michael@0: MOZ_ARG_DISABLE_BOOL(ffmpeg, michael@0: [ --disable-ffmpeg Disable FFmpeg for fragmented H264/AAC decoding], michael@0: MOZ_FFMPEG=, michael@0: MOZ_FFMPEG=1 michael@0: ) michael@0: michael@0: if test -n "$MOZ_FFMPEG"; then michael@0: AC_DEFINE(MOZ_FFMPEG) michael@0: fi; michael@0: michael@0: dnl ======================================================== michael@0: dnl = Built-in fragmented MP4 support. michael@0: dnl ======================================================== michael@0: if test -n "$MOZ_WMF" -o -n "$MOZ_FFMPEG"; then michael@0: dnl Enable fragmented MP4 parser on Windows by default. michael@0: dnl We will also need to enable it on other platforms as we implement michael@0: dnl platform decoder support there too. michael@0: MOZ_FMP4=1 michael@0: fi michael@0: michael@0: MOZ_ARG_DISABLE_BOOL(fmp4, michael@0: [ --disable-fmp4 Disable support for in built Fragmented MP4 parsing], michael@0: MOZ_FMP4=, michael@0: MOZ_FMP4=1) michael@0: michael@0: if test -n "$MOZ_FMP4"; then michael@0: AC_DEFINE(MOZ_FMP4) michael@0: fi; michael@0: michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable media plugin support michael@0: dnl ======================================================== michael@0: if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then michael@0: dnl Enable support on android by default michael@0: MOZ_MEDIA_PLUGINS=1 michael@0: fi michael@0: michael@0: MOZ_ARG_ENABLE_BOOL(media-plugins, michael@0: [ --enable-media-plugins Enable support for media plugins], michael@0: MOZ_MEDIA_PLUGINS=1, michael@0: MOZ_MEDIA_PLUGINS=) michael@0: michael@0: if test -n "$MOZ_MEDIA_PLUGINS"; then michael@0: AC_DEFINE(MOZ_MEDIA_PLUGINS) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = Disable platform MP3 decoder on OSX michael@0: dnl ======================================================== michael@0: if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then michael@0: MOZ_APPLEMEDIA=1 michael@0: fi michael@0: michael@0: MOZ_ARG_DISABLE_BOOL(apple-media, michael@0: [ --disable-apple-media Disable support for Apple AudioToolbox/VideoToolbox], michael@0: MOZ_APPLEMEDIA=, michael@0: MOZ_APPLEMEDIA=1) michael@0: michael@0: if test -n "$MOZ_APPLEMEDIA"; then michael@0: AC_DEFINE(MOZ_APPLEMEDIA) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable getUserMedia support michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(media-navigator, michael@0: [ --enable-media-navigator Enable support for getUserMedia], michael@0: MOZ_MEDIA_NAVIGATOR=1, michael@0: MOZ_MEDIA_NAVIGATOR=) michael@0: michael@0: if test -n "$MOZ_MEDIA_NAVIGATOR"; then michael@0: AC_DEFINE(MOZ_MEDIA_NAVIGATOR) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable building OMX media plugin (B2G or Android) michael@0: dnl ======================================================== michael@0: if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then michael@0: dnl Enable support on android by default michael@0: MOZ_OMX_PLUGIN=1 michael@0: fi michael@0: michael@0: MOZ_ARG_ENABLE_BOOL(omx-plugin, michael@0: [ --enable-omx-plugin Enable building OMX plugin (B2G)], michael@0: MOZ_OMX_PLUGIN=1, michael@0: MOZ_OMX_PLUGIN=) michael@0: michael@0: if test -n "$MOZ_OMX_PLUGIN"; then michael@0: if test "$OS_TARGET" = "Android"; then michael@0: dnl Only allow building OMX plugin on Gonk (B2G) or Android michael@0: AC_DEFINE(MOZ_OMX_PLUGIN) michael@0: else michael@0: dnl fail if we're not building on Gonk or Android michael@0: AC_MSG_ERROR([OMX media plugin can only be built on B2G or Android]) michael@0: fi michael@0: fi michael@0: michael@0: dnl system libvpx Support michael@0: dnl ======================================================== michael@0: MOZ_ARG_WITH_BOOL(system-libvpx, michael@0: [ --with-system-libvpx Use system libvpx (located with pkgconfig)], michael@0: MOZ_NATIVE_LIBVPX=1) michael@0: michael@0: MOZ_LIBVPX_CFLAGS= michael@0: MOZ_LIBVPX_LIBS= michael@0: michael@0: if test -n "$MOZ_VPX"; then michael@0: AC_DEFINE(MOZ_VPX) michael@0: if test -n "$MOZ_VPX_ERROR_CONCEALMENT" ; then michael@0: AC_DEFINE(MOZ_VPX_ERROR_CONCEALMENT) michael@0: fi michael@0: michael@0: _SAVE_CFLAGS=$CFLAGS michael@0: _SAVE_LIBS=$LIBS michael@0: if test -n "$MOZ_NATIVE_LIBVPX"; then michael@0: dnl ============================ michael@0: dnl === libvpx Version check === michael@0: dnl ============================ michael@0: dnl Check to see if we have a system libvpx package. michael@0: PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.3.0) michael@0: michael@0: CFLAGS="$CFLAGS $MOZ_LIBVPX_CFLAGS" michael@0: LIBS="$LIBS $MOZ_LIBVPX_LIBS" michael@0: michael@0: MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [], michael@0: [AC_MSG_ERROR([Couldn't find vpx/vpx_decoder.h which is required for build with system libvpx. Use --without-system-libvpx to build with in-tree libvpx.])]) michael@0: michael@0: AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [], michael@0: [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])]) michael@0: michael@0: MOZ_CHECK_HEADER([vpx_mem/vpx_mem.h], michael@0: [AC_CHECK_FUNC(vpx_mem_set_functions)]) michael@0: if test "$ac_cv_header_vpx_mem_vpx_mem_h" = no -o \ michael@0: "$ac_cv_func_vpx_mem_set_functions" = no; then michael@0: AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING) michael@0: fi michael@0: fi michael@0: CFLAGS=$_SAVE_CFLAGS michael@0: LIBS=$_SAVE_LIBS michael@0: fi michael@0: michael@0: AC_SUBST(MOZ_NATIVE_LIBVPX) michael@0: AC_SUBST(MOZ_LIBVPX_CFLAGS) michael@0: AC_SUBST(MOZ_LIBVPX_LIBS) michael@0: michael@0: if test "$MOZ_WEBM"; then michael@0: if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then michael@0: MOZ_VORBIS=1 michael@0: else michael@0: MOZ_TREMOR=1 michael@0: fi michael@0: fi michael@0: michael@0: if test -n "$MOZ_VPX" -a -z "$MOZ_NATIVE_LIBVPX"; then michael@0: michael@0: dnl Detect if we can use an assembler to compile optimized assembly for libvpx. michael@0: dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32. michael@0: dnl We currently require gcc on all arm platforms. michael@0: VPX_AS=$YASM michael@0: VPX_ASM_SUFFIX=asm michael@0: VPX_NEED_OBJ_INT_EXTRACT= michael@0: michael@0: dnl See if we have assembly on this platform. michael@0: case "$OS_ARCH:$CPU_ARCH" in michael@0: Darwin:x86) michael@0: VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC" michael@0: VPX_X86_ASM=1 michael@0: ;; michael@0: Darwin:x86_64) michael@0: VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC" michael@0: VPX_X86_ASM=1 michael@0: ;; michael@0: WINNT:x86_64) michael@0: VPX_ASFLAGS="-f x64 -rnasm -pnasm" michael@0: VPX_X86_ASM=1 michael@0: ;; michael@0: WINNT:x86) michael@0: dnl Check for yasm 1.1 or greater. michael@0: if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then michael@0: AC_MSG_ERROR([yasm 1.1 or greater is required to build libvpx on Win32, but it appears not to be installed. Install it (included in MozillaBuild 1.5.1 and newer) or configure with --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.]) michael@0: elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then michael@0: AC_MSG_ERROR([yasm 1.1 or greater is required to build libvpx on Win32, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION. Upgrade to the newest version (included in MozillaBuild 1.5.1 and newer) or configure with --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.]) michael@0: else michael@0: VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC" michael@0: VPX_X86_ASM=1 michael@0: dnl The encoder needs obj_int_extract to get asm offsets. michael@0: fi michael@0: ;; michael@0: *:arm*) michael@0: if test -n "$GNU_AS" ; then michael@0: VPX_AS=$AS michael@0: dnl These flags are a lie; they're just used to enable the requisite michael@0: dnl opcodes; actual arch detection is done at runtime. michael@0: VPX_ASFLAGS="-march=armv7-a -mfpu=neon" michael@0: VPX_DASH_C_FLAG="-c" michael@0: VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl' michael@0: VPX_ASM_SUFFIX="$ASM_SUFFIX" michael@0: VPX_ARM_ASM=1 michael@0: fi michael@0: ;; michael@0: *:x86) michael@0: if $CC -E -dM -= $GST_VERSION michael@0: gstreamer-app-$GST_API_VERSION michael@0: gstreamer-plugins-base-$GST_API_VERSION, michael@0: [_HAVE_GSTREAMER=1], michael@0: [_HAVE_GSTREAMER=]) michael@0: if test -z "$_HAVE_GSTREAMER"; then michael@0: AC_MSG_ERROR([gstreamer and gstreamer-plugins-base development packages are needed to build gstreamer backend. Install them or disable gstreamer support with --disable-gstreamer]) michael@0: fi michael@0: michael@0: _SAVE_LDFLAGS=$LDFLAGS michael@0: LDFLAGS="$LDFLAGS $GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION" michael@0: AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=) michael@0: if test -n "$_HAVE_LIBGSTVIDEO" ; then michael@0: GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION" michael@0: else michael@0: AC_MSG_ERROR([gstreamer-plugins-base found, but no libgstvideo. Something has gone terribly wrong. Try reinstalling gstreamer-plugins-base; failing that, disable the gstreamer backend with --disable-gstreamer.]) michael@0: fi michael@0: LDFLAGS=$_SAVE_LDFLAGS michael@0: michael@0: AC_SUBST(GSTREAMER_CFLAGS) michael@0: AC_SUBST(GSTREAMER_LIBS) michael@0: fi michael@0: michael@0: AC_SUBST(MOZ_GSTREAMER) michael@0: AC_SUBST(GST_API_VERSION) michael@0: michael@0: if test -n "$MOZ_GSTREAMER"; then michael@0: AC_DEFINE(MOZ_GSTREAMER) michael@0: AC_DEFINE_UNQUOTED(GST_API_VERSION, "$GST_API_VERSION") michael@0: fi michael@0: michael@0: michael@0: dnl ======================================================== michael@0: dnl Permissions System michael@0: dnl ======================================================== michael@0: MOZ_ARG_DISABLE_BOOL(permissions, michael@0: [ --disable-permissions Disable permissions (popup and cookie blocking)], michael@0: MOZ_PERMISSIONS=, michael@0: MOZ_PERMISSIONS=1 michael@0: ) michael@0: michael@0: dnl ======================================================== michael@0: dnl Child permissions, currently only used for b2g michael@0: dnl ======================================================== michael@0: if test -n "$MOZ_B2G"; then michael@0: if test -n "$MOZ_PERMISSIONS"; then michael@0: MOZ_CHILD_PERMISSIONS=1 michael@0: else michael@0: AC_MSG_ERROR([You need to enable MOZ_PERMISSIONS for MOZ_CHILD_PERMISSIONS]) michael@0: fi michael@0: fi michael@0: AC_SUBST(MOZ_CHILD_PERMISSIONS) michael@0: michael@0: dnl ======================================================== michael@0: dnl NegotiateAuth michael@0: dnl ======================================================== michael@0: MOZ_ARG_DISABLE_BOOL(negotiateauth, michael@0: [ --disable-negotiateauth Disable GSS-API negotiation ], michael@0: MOZ_AUTH_EXTENSION=, michael@0: MOZ_AUTH_EXTENSION=1 ) michael@0: michael@0: dnl ======================================================== michael@0: dnl Pref extensions (autoconfig) michael@0: dnl ======================================================== michael@0: MOZ_ARG_DISABLE_BOOL(pref-extensions, michael@0: [ --disable-pref-extensions michael@0: Disable pref extensions such as autoconfig], michael@0: MOZ_PREF_EXTENSIONS=, michael@0: MOZ_PREF_EXTENSIONS=1 ) michael@0: michael@0: dnl ======================================================== michael@0: dnl Searching of system directories for extensions. michael@0: dnl Note: this switch is meant to be used for test builds michael@0: dnl whose behavior should not depend on what happens to be michael@0: dnl installed on the local machine. michael@0: dnl ======================================================== michael@0: MOZ_ARG_DISABLE_BOOL(system-extension-dirs, michael@0: [ --disable-system-extension-dirs michael@0: Disable searching system- and account-global michael@0: directories for extensions of any kind; use michael@0: only profile-specific extension directories], michael@0: ENABLE_SYSTEM_EXTENSION_DIRS=, michael@0: ENABLE_SYSTEM_EXTENSION_DIRS=1 ) michael@0: if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then michael@0: AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = Universalchardet michael@0: dnl ======================================================== michael@0: MOZ_ARG_DISABLE_BOOL(universalchardet, michael@0: [ --disable-universalchardet michael@0: Disable universal encoding detection], michael@0: MOZ_UNIVERSALCHARDET=, michael@0: MOZ_UNIVERSALCHARDET=1 ) michael@0: michael@0: if test -n "${JAVA_BIN_PATH}"; then michael@0: dnl Look for javac and jar in the specified path. michael@0: JAVA_PATH="$JAVA_BIN_PATH" michael@0: else michael@0: dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH. michael@0: JAVA_PATH="$JAVA_HOME/bin:$PATH" michael@0: fi michael@0: michael@0: MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH]) michael@0: MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH]) michael@0: MOZ_PATH_PROG(JAVAH, javah, :, [$JAVA_PATH]) michael@0: MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH]) michael@0: MOZ_PATH_PROG(JARSIGNER, jarsigner, :, [$JAVA_PATH]) michael@0: MOZ_PATH_PROG(KEYTOOL, keytool, :, [$JAVA_PATH]) michael@0: michael@0: if test -n "${JAVA_BIN_PATH}" -o \ michael@0: \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then michael@0: if test -z "$JAVA" -o "$JAVA" = ":"; then michael@0: AC_MSG_ERROR([The program java was not found. Set \$JAVA_HOME to your Java SDK directory or use --with-java-bin-path={java-bin-dir}]) michael@0: fi michael@0: if test -z "$JAVAC" -o "$JAVAC" = ":"; then michael@0: AC_MSG_ERROR([The program javac was not found. Set \$JAVA_HOME to your Java SDK directory or use --with-java-bin-path={java-bin-dir}]) michael@0: fi michael@0: if test -z "$JAVAH" -o "$JAVAH" = ":"; then michael@0: AC_MSG_ERROR([The program javah was not found. Set \$JAVA_HOME to your Java SDK directory or use --with-java-bin-path={java-bin-dir}]) michael@0: fi michael@0: if test -z "$JAR" -o "$JAR" = ":"; then michael@0: AC_MSG_ERROR([The program jar was not found. Set \$JAVA_HOME to your Java SDK directory or use --with-java-bin-path={java-bin-dir}]) michael@0: fi michael@0: if test -z "$JARSIGNER" -o "$JARSIGNER" = ":"; then michael@0: AC_MSG_ERROR([The program jarsigner was not found. Set \$JAVA_HOME to your Java SDK directory or use --with-java-bin-path={java-bin-dir}]) michael@0: fi michael@0: if test -z "$KEYTOOL" -o "$KEYTOOL" = ":"; then michael@0: AC_MSG_ERROR([The program keytool was not found. Set \$JAVA_HOME to your Java SDK directory or use --with-java-bin-path={java-bin-dir}]) michael@0: fi michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = ANGLE OpenGL->D3D translator for WebGL michael@0: dnl = * only applies to win32 michael@0: dnl = * enabled by default (shipping build); requires explicit --disable to disable michael@0: dnl ======================================================== michael@0: MOZ_ANGLE_RENDERER= michael@0: MOZ_DIRECTX_SDK_CPU_SUFFIX= michael@0: MOZ_DIRECTX_SDK_PATH= michael@0: MOZ_D3DCOMPILER_DLL= michael@0: MOZ_HAS_WINSDK_WITH_D3D= michael@0: MOZ_D3DCOMPILER_DLL_PATH= michael@0: MOZ_D3DCOMPILER_CAB= michael@0: case "$target_os" in michael@0: *mingw*) michael@0: MOZ_ANGLE_RENDERER=1 michael@0: ;; michael@0: esac michael@0: michael@0: # The DirectX SDK libraries are split into x86 and x64 sub-directories michael@0: case "${target_cpu}" in michael@0: i*86) michael@0: MOZ_DIRECTX_SDK_CPU_SUFFIX=x86 michael@0: ;; michael@0: x86_64) michael@0: MOZ_DIRECTX_SDK_CPU_SUFFIX=x64 michael@0: ;; michael@0: esac michael@0: michael@0: MOZ_ARG_DISABLE_BOOL(webgl, michael@0: [ --disable-webgl Disable building of the WebGL implementation], michael@0: MOZ_WEBGL_DISABLED=1, michael@0: MOZ_WEBGL_DISABLED=) michael@0: michael@0: MOZ_ARG_ENABLE_BOOL(winsdk-directx, michael@0: [ --enable-winsdk-directx use DirectX SDK in Windows SDK], michael@0: MOZ_WINSDK_DIRECTX=1, michael@0: MOZ_WINSDK_DIRECTX=) michael@0: michael@0: if test -n "$MOZ_WEBGL_DISABLED"; then michael@0: MOZ_WEBGL= michael@0: MOZ_ANGLE_RENDERER= michael@0: fi michael@0: michael@0: if test -n "$MOZ_WEBGL"; then michael@0: AC_DEFINE(MOZ_WEBGL) michael@0: fi michael@0: michael@0: if test -n "$MOZ_WEBGL_CONFORMANT"; then michael@0: AC_DEFINE(MOZ_WEBGL_CONFORMANT) michael@0: fi michael@0: michael@0: michael@0: # Locate a DirectX SDK here so we can use it for both ANGLE and michael@0: # Joystick support. michael@0: if test "$OS_TARGET" = "WINNT" -a -z "$CROSS_COMPILE"; then michael@0: # Get the SDK path from the registry. michael@0: # First try to get the June 2010 SDK michael@0: MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1` michael@0: if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then michael@0: # Otherwise just take whatever comes first michael@0: MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1` michael@0: fi michael@0: MOZ_DIRECTX_SDK_PATH=`reg query "$MOZ_DIRECTX_SDK_REG_KEY" //v InstallPath | grep REG_SZ | sed 's/.*\([[a-zA-Z]]\)\\:\\\\/\\1\\:\\\\/' | sed 's,\\\\,/,g'` michael@0: michael@0: if test -n "$MOZ_DIRECTX_SDK_PATH" && michael@0: test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then michael@0: AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH]) michael@0: else michael@0: AC_MSG_RESULT([Couldn't find the DirectX SDK.]) michael@0: fi michael@0: fi michael@0: michael@0: # On mingw, check if headers are provided by toolchain. michael@0: if test "$OS_TARGET" = "WINNT" -a -n "$GNU_CC"; then michael@0: MOZ_CHECK_HEADER(d3d10.h, MOZ_HAS_WINSDK_WITH_D3D=1) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl D3D compiler DLL michael@0: dnl ======================================================== michael@0: michael@0: if test -n "$MOZ_ANGLE_RENDERER"; then michael@0: # Check that our DirectX SDK is acceptable. michael@0: if test -n "$MOZ_DIRECTX_SDK_PATH"; then michael@0: if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then michael@0: AC_MSG_RESULT([Found the February 2010 DirectX SDK, which is unacceptable to ANGLE.]) michael@0: MOZ_DIRECTX_SDK_PATH_BAD=1 michael@0: fi michael@0: michael@0: if test -n "$MOZ_DIRECTX_SDK_PATH" && michael@0: test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h && michael@0: test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then michael@0: AC_MSG_RESULT([Found acceptable DirectX SDK for ANGLE.]) michael@0: else michael@0: AC_MSG_RESULT([Found DirectX SDK is unacceptable for ANGLE.]) michael@0: MOZ_DIRECTX_SDK_PATH_BAD=1 michael@0: fi michael@0: fi michael@0: michael@0: if test -n "$MOZ_DIRECTX_SDK_PATH_BAD"; then michael@0: AC_MSG_ERROR([Couldn't find an acceptable DirectX SDK for ANGLE. Either install DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.]) michael@0: fi michael@0: michael@0: # Find a D3D compiler DLL in a Windows SDK. michael@0: MOZ_D3DCOMPILER_DLL= michael@0: if test -n "$MOZ_WINSDK_DIRECTX"; then michael@0: case "$MOZ_WINSDK_MAXVER" in michael@0: 0x0603*) michael@0: MOZ_D3DCOMPILER_DLL=d3dcompiler_47.dll michael@0: AC_MSG_RESULT([Found D3D compiler in Windows SDK 8.1.]) michael@0: ;; michael@0: 0x0602*) michael@0: MOZ_D3DCOMPILER_DLL=d3dcompiler_46.dll michael@0: AC_MSG_RESULT([Found D3D compiler in Windows SDK 8.0.]) michael@0: ;; michael@0: esac michael@0: fi michael@0: michael@0: if test -n "$MOZ_D3DCOMPILER_DLL"; then michael@0: # We have a name, now track down the path. michael@0: if test -n "$WINDOWSSDKDIR"; then michael@0: MOZ_D3DCOMPILER_DLL_PATH="$WINDOWSSDKDIR/Redist/D3D/$MOZ_DIRECTX_SDK_CPU_SUFFIX/$MOZ_D3DCOMPILER_DLL" michael@0: if test -f "$MOZ_D3DCOMPILER_DLL_PATH"; then michael@0: MOZ_HAS_WINSDK_WITH_D3D=1 michael@0: AC_MSG_RESULT([Found MOZ_D3DCOMPILER_DLL_PATH: $MOZ_D3DCOMPILER_DLL_PATH]) michael@0: else michael@0: AC_MSG_RESULT([MOZ_D3DCOMPILER_DLL_PATH doesn't exist: $MOZ_D3DCOMPILER_DLL_PATH]) michael@0: fi michael@0: else michael@0: AC_MSG_RESULT([WINDOWSSDKDIR is missing.]) michael@0: fi michael@0: fi michael@0: michael@0: # Find a D3D compiler DLL in the DirectX SDK, if we didn't find one already. michael@0: # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib michael@0: if test -z "$MOZ_HAS_WINSDK_WITH_D3D"; then michael@0: MOZ_D3DX9_VERSION=`dumpbin //headers "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/d3dx9.lib | egrep d3dx9_[[0-9]][[0-9]]\.dll | head -n1 | sed 's/.*\([[0-9]][[0-9]]\).*/\\1/g'` michael@0: michael@0: if test -n "$MOZ_D3DX9_VERSION" ; then michael@0: MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1` michael@0: MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll michael@0: else michael@0: AC_MSG_RESULT([Couldn't determine the D3DX9 version for the DirectX SDK.]) michael@0: fi michael@0: michael@0: if test -z "$MOZ_D3DCOMPILER_CAB"; then michael@0: AC_MSG_RESULT([Couldn't find a CAB containing the D3D compiler DLL.]) michael@0: fi michael@0: fi michael@0: michael@0: if test -z "$MOZ_D3DCOMPILER_DLL_PATH" -a -z "$MOZ_D3DCOMPILER_CAB" -a -z "$CROSS_COMPILE"; then michael@0: AC_MSG_ERROR([Couldn't find an acceptable D3D compiler DLL. Either install Windows SDK 8.0+ and reconfigure with --enable-winsdk-directx, install DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.]) michael@0: fi michael@0: fi michael@0: michael@0: michael@0: dnl ======================================================== michael@0: dnl Gamepad support michael@0: dnl ======================================================== michael@0: MOZ_GAMEPAD= michael@0: MOZ_GAMEPAD_BACKEND=stub michael@0: michael@0: # Gamepad DOM is built on supported platforms by default. michael@0: case "$OS_TARGET" in michael@0: Darwin|WINNT|Linux) michael@0: MOZ_GAMEPAD=1 michael@0: ;; michael@0: *) michael@0: ;; michael@0: esac michael@0: michael@0: MOZ_ARG_DISABLE_BOOL(gamepad, michael@0: [ --disable-gamepad Disable gamepad support], michael@0: MOZ_GAMEPAD=, michael@0: MOZ_GAMEPAD=1) michael@0: michael@0: if test "$MOZ_GAMEPAD"; then michael@0: case "$OS_TARGET" in michael@0: Darwin) michael@0: MOZ_GAMEPAD_BACKEND=cocoa michael@0: ;; michael@0: WINNT) michael@0: if test -z "$MOZ_HAS_WINSDK_WITH_D3D"; then michael@0: if test -n "$MOZ_DIRECTX_SDK_PATH" ; then michael@0: if ! test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then michael@0: MOZ_GAMEPAD= michael@0: fi michael@0: elif test "$GCC" != "yes"; then michael@0: MOZ_GAMEPAD= michael@0: fi michael@0: fi michael@0: if test -z "$MOZ_GAMEPAD"; then michael@0: AC_MSG_ERROR([Couldn't find the DirectX SDK, needed for gamepad support. Please install it or, reconfigure with --disable-gamepad to disable gamepad support.]) michael@0: fi michael@0: MOZ_GAMEPAD_BACKEND=windows michael@0: ;; michael@0: Linux) michael@0: MOZ_CHECK_HEADER([linux/joystick.h]) michael@0: if test "$ac_cv_header_linux_joystick_h" != "yes"; then michael@0: AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers or reconfigure with --disable-gamepad to disable gamepad support.]) michael@0: fi michael@0: MOZ_GAMEPAD_BACKEND=linux michael@0: ;; michael@0: *) michael@0: ;; michael@0: esac michael@0: michael@0: AC_DEFINE(MOZ_GAMEPAD) michael@0: fi michael@0: AC_SUBST(MOZ_GAMEPAD) michael@0: AC_SUBST(MOZ_GAMEPAD_BACKEND) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Breakpad crash reporting (on by default on supported platforms) michael@0: dnl ======================================================== michael@0: michael@0: case $target in michael@0: i?86-*-mingw*|x86_64-*-mingw*) michael@0: MOZ_CRASHREPORTER=1 michael@0: ;; michael@0: i?86-apple-darwin*|x86_64-apple-darwin*) michael@0: MOZ_CRASHREPORTER=1 michael@0: ;; michael@0: i?86-*-linux*|x86_64-*-linux*|arm-*-linux*) michael@0: if test "$MOZ_ENABLE_GTK"; then michael@0: MOZ_CRASHREPORTER=1 michael@0: fi michael@0: ;; michael@0: *-android*|*-linuxandroid*) michael@0: MOZ_CRASHREPORTER=1 michael@0: ;; michael@0: *solaris*) michael@0: MOZ_CRASHREPORTER=1 michael@0: ;; michael@0: esac michael@0: michael@0: MOZ_ARG_DISABLE_BOOL(crashreporter, michael@0: [ --disable-crashreporter Disable breakpad crash reporting], michael@0: [MOZ_CRASHREPORTER=], michael@0: [MOZ_CRASHREPORTER=F # Force enable breakpad]) michael@0: michael@0: if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT"; then michael@0: if test "$MOZ_CRASHREPORTER" = F; then michael@0: AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.]) michael@0: fi michael@0: MOZ_CRASHREPORTER= michael@0: fi michael@0: michael@0: if test -n "$MOZ_CRASHREPORTER"; then michael@0: AC_DEFINE(MOZ_CRASHREPORTER) michael@0: michael@0: if test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS" && \ michael@0: test -z "$SKIP_LIBRARY_CHECKS"; then michael@0: PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0) michael@0: AC_SUBST(MOZ_GTHREAD_CFLAGS) michael@0: AC_SUBST(MOZ_GTHREAD_LIBS) michael@0: fi michael@0: michael@0: if test "$OS_ARCH" = "WINNT"; then michael@0: if test -z "$HAVE_64BIT_OS"; then michael@0: MOZ_CRASHREPORTER_INJECTOR=1 michael@0: AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR) michael@0: fi michael@0: fi michael@0: fi michael@0: michael@0: MOZ_ARG_WITH_STRING(crashreporter-enable-percent, michael@0: [ --with-crashreporter-enable-percent=NN michael@0: Enable sending crash reports by default on NN% of users. (default=100)], michael@0: [ val=`echo $withval | sed 's/[^0-9]//g'` michael@0: MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"]) michael@0: michael@0: if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then michael@0: MOZ_CRASHREPORTER_ENABLE_PERCENT=100 michael@0: fi michael@0: AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT) michael@0: michael@0: dnl ======================================================== michael@0: dnl = libjpeg-turbo configuration michael@0: dnl ======================================================== michael@0: MOZ_LIBJPEG_TURBO= michael@0: if test -z "$MOZ_NATIVE_JPEG"; then michael@0: MOZ_LIBJPEG_TURBO=1 michael@0: fi michael@0: michael@0: MOZ_ARG_DISABLE_BOOL(libjpeg_turbo, michael@0: [ --disable-libjpeg-turbo Disable optimized jpeg decoding routines], michael@0: MOZ_LIBJPEG_TURBO=, michael@0: MOZ_LIBJPEG_TURBO=1) michael@0: michael@0: if test "$MOZ_NATIVE_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then michael@0: AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.]) michael@0: fi michael@0: michael@0: dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly michael@0: dnl files. michael@0: michael@0: if test -n "$MOZ_LIBJPEG_TURBO"; then michael@0: michael@0: dnl Do we support libjpeg-turbo on this platform? michael@0: case "$OS_ARCH:$OS_TEST" in michael@0: Darwin:i?86) michael@0: LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO" michael@0: LIBJPEG_TURBO_X86_ASM=1 michael@0: ;; michael@0: Darwin:x86_64) michael@0: LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO" michael@0: LIBJPEG_TURBO_X64_ASM=1 michael@0: ;; michael@0: WINNT:x86|WINNT:i?86) michael@0: LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32" michael@0: LIBJPEG_TURBO_X86_ASM=1 michael@0: ;; michael@0: WINNT:x86_64) michael@0: LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC" michael@0: LIBJPEG_TURBO_X64_ASM=1 michael@0: ;; michael@0: *:arm*) michael@0: LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon" michael@0: LIBJPEG_TURBO_ARM_ASM=1 michael@0: ;; michael@0: *:x86|*:i?86) michael@0: if $CC -E -dM -/dev/null` michael@0: changequote(,) michael@0: MAKENSISU_PARSED_VER=`echo "$MAKENSISU_VER" | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\).*\-Unicode$/\1/g'` michael@0: changequote([,]) michael@0: if test "$MAKENSISU_PARSED_VER" = ""; then michael@0: changequote(,) michael@0: MAKENSISU_PARSED_VER=`echo "$MAKENSISU_VER" | sed -e 's/^v\([0-9]\+\.[0-9]\+\).*$/\1/g'` michael@0: changequote([,]) michael@0: fi michael@0: MAKENSISU_MAJOR_VER=0 michael@0: MAKENSISU_MINOR_VER=0 michael@0: if test ! "$MAKENSISU_PARSED_VER" = ""; then michael@0: MAKENSISU_MAJOR_VER=`echo $MAKENSISU_PARSED_VER | $AWK -F\. '{ print $1 }'` michael@0: MAKENSISU_MINOR_VER=`echo $MAKENSISU_PARSED_VER | $AWK -F\. '{ print $2 }'` michael@0: fi michael@0: AC_MSG_CHECKING([for Unicode NSIS version $MIN_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER or greater]) michael@0: if test "$MAKENSISU_MAJOR_VER" -eq $MIN_NSIS_MAJOR_VER -a \ michael@0: "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER || michael@0: test "$MAKENSISU_MAJOR_VER" -gt $MIN_NSIS_MAJOR_VER; then michael@0: AC_MSG_RESULT([yes]) michael@0: else michael@0: AC_MSG_RESULT([no]) michael@0: if test -z "$CROSS_COMPILE"; then michael@0: AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or Unicode NSIS version $REQ_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER or greater in your path.]) michael@0: else michael@0: MAKENSISU= michael@0: fi michael@0: fi michael@0: elif test -z "$CROSS_COMPILE"; then michael@0: AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or Unicode NSIS version $REQ_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER or greater in your path.]) michael@0: else michael@0: MAKENSISU= michael@0: fi michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl Web App Runtime michael@0: dnl ======================================================== michael@0: MOZ_ARG_DISABLE_BOOL(webapp-runtime, michael@0: [ --disable-webapp-runtime Disable Web App Runtime], michael@0: MOZ_WEBAPP_RUNTIME=, michael@0: MOZ_WEBAPP_RUNTIME=1) michael@0: if test "$MOZ_WIDGET_TOOLKIT" != "windows" -a "$MOZ_WIDGET_TOOLKIT" != "cocoa" -a "$MOZ_WIDGET_TOOLKIT" != "gtk2"; then michael@0: MOZ_WEBAPP_RUNTIME= michael@0: fi michael@0: if test "$OS_ARCH" = "WINNT" -a -z "$MAKENSISU" -a -n "$CROSS_COMPILE"; then michael@0: MOZ_WEBAPP_RUNTIME= michael@0: fi michael@0: AC_SUBST(MOZ_WEBAPP_RUNTIME) michael@0: if test "$MOZ_WEBAPP_RUNTIME"; then michael@0: AC_DEFINE(MOZ_WEBAPP_RUNTIME) michael@0: fi 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_ERROR([no tar archiver found in \$PATH]) michael@0: fi michael@0: AC_MSG_RESULT([$TAR]) michael@0: AC_SUBST(TAR) michael@0: michael@0: AC_MSG_CHECKING([for wget]) michael@0: AC_CHECK_PROGS(WGET, wget, "") michael@0: AC_MSG_RESULT([$WGET]) michael@0: AC_SUBST(WGET) michael@0: michael@0: dnl ======================================================== michael@0: dnl Signing michael@0: dnl ======================================================== michael@0: michael@0: if test -n "$MOZ_SIGN_CMD"; then michael@0: AC_DEFINE(MOZ_SIGNING) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl Maintenance Service michael@0: dnl ======================================================== michael@0: michael@0: MOZ_ARG_ENABLE_BOOL(maintenance-service, michael@0: [ --enable-maintenance-service Enable building of maintenanceservice], michael@0: MOZ_MAINTENANCE_SERVICE=1, michael@0: MOZ_MAINTENANCE_SERVICE= ) michael@0: michael@0: if test -n "$MOZ_MAINTENANCE_SERVICE"; then michael@0: if test "$OS_ARCH" = "WINNT"; then michael@0: AC_DEFINE(MOZ_MAINTENANCE_SERVICE) michael@0: else michael@0: AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target]) michael@0: fi michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl Verify MAR signatures michael@0: dnl ======================================================== michael@0: michael@0: MOZ_ARG_ENABLE_BOOL(verify-mar, michael@0: [ --enable-verify-mar Enable verifying MAR signatures], michael@0: MOZ_VERIFY_MAR_SIGNATURE=1, michael@0: MOZ_VERIFY_MAR_SIGNATURE= ) michael@0: michael@0: if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then michael@0: if test "$OS_ARCH" = "WINNT"; then michael@0: AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE) michael@0: else michael@0: AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target]) michael@0: fi michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl Enable building the signmar program. michael@0: dnl This option is much different than the --enable-verify-mar option. michael@0: dnl --enable-verify-mar is for enabling the verification check on MAR michael@0: dnl files in the updater. The --enable-signmar option is for building michael@0: dnl the signmar program. michael@0: dnl ======================================================== michael@0: michael@0: MOZ_ARG_ENABLE_BOOL(signmar, michael@0: [ --enable-signmar Enable building the signmar program], michael@0: MOZ_ENABLE_SIGNMAR=1, michael@0: MOZ_ENABLE_SIGNMAR= ) michael@0: michael@0: if test -n "$MOZ_ENABLE_SIGNMAR"; then michael@0: AC_DEFINE(MOZ_ENABLE_SIGNMAR) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl Updater michael@0: dnl ======================================================== michael@0: michael@0: MOZ_ARG_DISABLE_BOOL(updater, michael@0: [ --disable-updater Disable building of updater], michael@0: MOZ_UPDATER=, michael@0: MOZ_UPDATER=1 ) michael@0: michael@0: if test -n "$MOZ_UPDATER"; then michael@0: AC_DEFINE(MOZ_UPDATER) michael@0: fi michael@0: michael@0: # tools/update-packaging is not checked out by default. michael@0: MOZ_ARG_ENABLE_BOOL(update-packaging, michael@0: [ --enable-update-packaging michael@0: Enable tools/update-packaging], michael@0: MOZ_UPDATE_PACKAGING=1, michael@0: MOZ_UPDATE_PACKAGING= ) michael@0: AC_SUBST(MOZ_UPDATE_PACKAGING) michael@0: michael@0: dnl ======================================================== michael@0: dnl Tor Additions michael@0: dnl ======================================================== michael@0: MOZ_ARG_WITH_STRING(tor-browser-version, michael@0: [ --with-tor-browser-version=VERSION michael@0: Set Tor Browser version, e.g., 4.0b1], michael@0: TOR_BROWSER_VERSION="$withval") michael@0: michael@0: MOZ_ARG_ENABLE_BOOL(tor-browser-update, michael@0: [ --enable-tor-browser-update michael@0: Enable Tor Browser update], michael@0: TOR_BROWSER_UPDATE=1, michael@0: TOR_BROWSER_UPDATE= ) michael@0: michael@0: if test -n "$TOR_BROWSER_UPDATE"; then michael@0: if test -z "$TOR_BROWSER_VERSION"; then michael@0: AC_MSG_ERROR([--enable-tor-browser-update requires --with-tor-browser-version.]) michael@0: fi michael@0: AC_DEFINE(TOR_BROWSER_UPDATE) michael@0: fi michael@0: michael@0: AC_DEFINE_UNQUOTED(TOR_BROWSER_VERSION,"$TOR_BROWSER_VERSION") michael@0: AC_SUBST(TOR_BROWSER_VERSION) michael@0: AC_SUBST(TOR_BROWSER_UPDATE) 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: if test -n "$ENABLE_TESTS"; then michael@0: GTEST_HAS_RTTI=0 michael@0: AC_DEFINE_UNQUOTED(GTEST_HAS_RTTI, 0) michael@0: AC_SUBST(GTEST_HAS_RTTI) michael@0: if test -n "$_WIN32_MSVC"; then michael@0: AC_DEFINE_UNQUOTED(_VARIADIC_MAX, 10) michael@0: fi michael@0: if test "${OS_TARGET}" = "Android"; then michael@0: AC_DEFINE(GTEST_OS_LINUX_ANDROID) michael@0: AC_DEFINE(GTEST_USE_OWN_TR1_TUPLE) michael@0: AC_DEFINE_UNQUOTED(GTEST_HAS_CLONE, 0) michael@0: AC_SUBST(GTEST_OS_LINUX_ANDROID) michael@0: AC_SUBST(GTEST_USE_OWN_TR1_TUPLE) michael@0: AC_SUBST(GTEST_HAS_CLONE) michael@0: fi michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl parental controls (for Windows Vista) michael@0: dnl ======================================================== michael@0: MOZ_ARG_DISABLE_BOOL(parental-controls, michael@0: [ --disable-parental-controls michael@0: Do not build parental controls], michael@0: MOZ_DISABLE_PARENTAL_CONTROLS=1, michael@0: MOZ_DISABLE_PARENTAL_CONTROLS=) michael@0: if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then michael@0: AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS) michael@0: fi michael@0: michael@0: AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Disable DOMCrypto michael@0: dnl ======================================================== michael@0: if test -n "$MOZ_DISABLE_CRYPTOLEGACY"; then michael@0: AC_DEFINE(MOZ_DISABLE_CRYPTOLEGACY) michael@0: fi michael@0: AC_SUBST(MOZ_DISABLE_CRYPTOLEGACY) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Disable EV certificate verification michael@0: dnl ======================================================== michael@0: if test -n "$MOZ_NO_EV_CERTS"; then michael@0: AC_DEFINE(MOZ_NO_EV_CERTS) michael@0: fi michael@0: AC_SUBST(MOZ_NO_EV_CERTS) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Disable libpkix michael@0: dnl ======================================================== michael@0: if test -n "$NSS_NO_LIBPKIX"; then michael@0: AC_DEFINE(NSS_NO_LIBPKIX) michael@0: fi michael@0: AC_SUBST(NSS_NO_LIBPKIX) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Content process sandboxing michael@0: dnl ======================================================== michael@0: if test -n "$gonkdir"; then michael@0: MOZ_CONTENT_SANDBOX=1 michael@0: fi michael@0: michael@0: MOZ_ARG_ENABLE_BOOL(content-sandbox, michael@0: [ --enable-content-sandbox Enable sandboxing support for content-processes], michael@0: MOZ_CONTENT_SANDBOX=1, michael@0: MOZ_CONTENT_SANDBOX=) michael@0: michael@0: if test -n "$MOZ_CONTENT_SANDBOX"; then michael@0: AC_DEFINE(MOZ_CONTENT_SANDBOX) michael@0: fi michael@0: michael@0: AC_SUBST(MOZ_CONTENT_SANDBOX) michael@0: michael@0: MOZ_ARG_ENABLE_BOOL(content-sandbox-reporter, michael@0: [ --enable-content-sandbox-reporter Enable syscall reporter to troubleshoot syscalls denied by the content-processes sandbox], michael@0: MOZ_CONTENT_SANDBOX_REPORTER=1, michael@0: MOZ_CONTENT_SANDBOX_REPORTER=) michael@0: michael@0: if test -n "$MOZ_CONTENT_SANDBOX_REPORTER"; then michael@0: AC_DEFINE(MOZ_CONTENT_SANDBOX_REPORTER) michael@0: fi michael@0: michael@0: AC_SUBST(MOZ_CONTENT_SANDBOX_REPORTER) 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 = Disable feed handling components michael@0: dnl ======================================================== michael@0: MOZ_ARG_DISABLE_BOOL(feeds, michael@0: [ --disable-feeds Disable feed handling and processing components], michael@0: MOZ_FEEDS=, michael@0: MOZ_FEEDS=1 ) michael@0: if test -n "$MOZ_FEEDS"; then michael@0: AC_DEFINE(MOZ_FEEDS) michael@0: else michael@0: if test "$MOZ_BUILD_APP" = "browser"; then michael@0: AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.]) michael@0: fi michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl Check for sqlite michael@0: dnl ======================================================== michael@0: michael@0: MOZ_NATIVE_SQLITE= michael@0: MOZ_ARG_ENABLE_BOOL(system-sqlite, michael@0: [ --enable-system-sqlite Use system sqlite (located with pkgconfig)], michael@0: MOZ_NATIVE_SQLITE=1, michael@0: MOZ_NATIVE_SQLITE= ) michael@0: michael@0: if test -z "$MOZ_NATIVE_SQLITE" michael@0: then michael@0: SQLITE_CFLAGS= michael@0: SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)' michael@0: else michael@0: dnl ============================ michael@0: dnl === SQLite Version check === michael@0: dnl ============================ michael@0: dnl Check to see if the system SQLite package is new enough. michael@0: PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION) michael@0: michael@0: dnl ================================== michael@0: dnl === SQLITE_SECURE_DELETE check === michael@0: dnl ================================== michael@0: dnl Check to see if the system SQLite package is compiled with michael@0: dnl SQLITE_SECURE_DELETE enabled. michael@0: AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite) michael@0: _SAVE_CFLAGS="$CFLAGS" michael@0: CFLAGS="$CFLAGS $SQLITE_CFLAGS" michael@0: _SAVE_LIBS="$LIBS" michael@0: LIBS="$LIBS $SQLITE_LIBS" michael@0: AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[ michael@0: AC_TRY_RUN([ michael@0: #include "sqlite3.h" michael@0: michael@0: int main(int argc, char **argv){ michael@0: return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE"); michael@0: }], michael@0: ac_cv_sqlite_secure_delete=yes, michael@0: ac_cv_sqlite_secure_delete=no, michael@0: ac_cv_sqlite_secure_delete=no michael@0: ) michael@0: ]) michael@0: AC_MSG_RESULT($ac_cv_sqlite_secure_delete) michael@0: CFLAGS="$_SAVE_CFLAGS" michael@0: LIBS="$_SAVE_LIBS" michael@0: if test "x$ac_cv_sqlite_secure_delete" = "xno"; then michael@0: AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.]) michael@0: fi michael@0: michael@0: dnl =============================== michael@0: dnl === SQLITE_THREADSAFE check === michael@0: dnl =============================== michael@0: dnl Check to see if the system SQLite package is compiled with michael@0: dnl SQLITE_THREADSAFE enabled. michael@0: AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite) michael@0: _SAVE_CFLAGS="$CFLAGS" michael@0: CFLAGS="$CFLAGS $SQLITE_CFLAGS" michael@0: _SAVE_LIBS="$LIBS" michael@0: LIBS="$LIBS $SQLITE_LIBS" michael@0: AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[ michael@0: AC_TRY_RUN([ michael@0: #include "sqlite3.h" michael@0: michael@0: int main(int argc, char **argv){ michael@0: return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1"); michael@0: }], michael@0: ac_cv_sqlite_threadsafe=yes, michael@0: ac_cv_sqlite_threadsafe=no, michael@0: ac_cv_sqlite_threadsafe=no michael@0: ) michael@0: ]) michael@0: AC_MSG_RESULT($ac_cv_sqlite_threadsafe) michael@0: CFLAGS="$_SAVE_CFLAGS" michael@0: LIBS="$_SAVE_LIBS" michael@0: if test "x$ac_cv_sqlite_threadsafe" = "xno"; then michael@0: AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.]) michael@0: fi michael@0: michael@0: dnl ================================ michael@0: dnl === SQLITE_ENABLE_FTS3 check === michael@0: dnl ================================ michael@0: dnl check to see if the system SQLite package is compiled with michael@0: dnl SQLITE_ENABLE_FTS3 enabled. michael@0: AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite) michael@0: _SAVE_CFLAGS="$CFLAGS" michael@0: CFLAGS="$CFLAGS $SQLITE_CFLAGS" michael@0: _SAVE_LIBS="$LIBS" michael@0: LIBS="$LIBS $SQLITE_LIBS" michael@0: AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[ michael@0: AC_TRY_RUN([ michael@0: #include "sqlite3.h" michael@0: michael@0: int main(int argc, char **argv){ michael@0: return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3"); michael@0: }], michael@0: ac_cv_sqlite_enable_fts3=yes, michael@0: ac_cv_sqlite_enable_fts3=no, michael@0: ac_cv_sqlite_enable_fts3=no michael@0: ) michael@0: ]) michael@0: AC_MSG_RESULT($ac_cv_sqlite_enable_fts3) michael@0: CFLAGS="$_SAVE_CFLAGS" michael@0: LIBS="$_SAVE_LIBS" michael@0: if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then michael@0: AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.]) michael@0: fi michael@0: michael@0: dnl ========================================= michael@0: dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check === michael@0: dnl ========================================= michael@0: dnl check to see if the system SQLite package is compiled with michael@0: dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled. michael@0: AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite) michael@0: _SAVE_CFLAGS="$CFLAGS" michael@0: CFLAGS="$CFLAGS $SQLITE_CFLAGS" michael@0: _SAVE_LIBS="$LIBS" michael@0: LIBS="$LIBS $SQLITE_LIBS" michael@0: AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[ michael@0: AC_TRY_RUN([ michael@0: #include "sqlite3.h" michael@0: michael@0: int main(int argc, char **argv){ michael@0: return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY"); michael@0: }], michael@0: ac_cv_sqlite_enable_unlock_notify=yes, michael@0: ac_cv_sqlite_enable_unlock_notify=no, michael@0: ac_cv_sqlite_enable_unlock_notify=no michael@0: ) michael@0: ]) michael@0: AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify) michael@0: CFLAGS="$_SAVE_CFLAGS" michael@0: LIBS="$_SAVE_LIBS" michael@0: if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then michael@0: AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.]) michael@0: fi michael@0: fi michael@0: michael@0: if test -n "$MOZ_NATIVE_SQLITE"; then michael@0: AC_DEFINE(MOZ_NATIVE_SQLITE) michael@0: fi michael@0: AC_SUBST(MOZ_NATIVE_SQLITE) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable help viewer (off by default) michael@0: dnl ======================================================== michael@0: if test -n "$MOZ_HELP_VIEWER"; then michael@0: dnl Do this if defined in confvars.sh michael@0: AC_DEFINE(MOZ_HELP_VIEWER) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable safe browsing (anti-phishing) michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(safe-browsing, michael@0: [ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation], michael@0: MOZ_SAFE_BROWSING=1, michael@0: MOZ_SAFE_BROWSING= ) michael@0: if test -n "$MOZ_SAFE_BROWSING"; then michael@0: AC_DEFINE(MOZ_SAFE_BROWSING) michael@0: fi michael@0: AC_SUBST(MOZ_SAFE_BROWSING) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable url-classifier michael@0: dnl ======================================================== michael@0: dnl Implicitly enabled by default if building with safe-browsing michael@0: if test -n "$MOZ_SAFE_BROWSING"; then michael@0: MOZ_URL_CLASSIFIER=1 michael@0: fi michael@0: MOZ_ARG_ENABLE_BOOL(url-classifier, michael@0: [ --enable-url-classifier Enable url classifier module], michael@0: MOZ_URL_CLASSIFIER=1, michael@0: MOZ_URL_CLASSIFIER= ) michael@0: if test -n "$MOZ_URL_CLASSIFIER"; then michael@0: AC_DEFINE(MOZ_URL_CLASSIFIER) michael@0: fi michael@0: AC_SUBST(MOZ_URL_CLASSIFIER) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Disable zipwriter michael@0: dnl ======================================================== michael@0: MOZ_ARG_DISABLE_BOOL(zipwriter, michael@0: [ --disable-zipwriter Disable zipwriter component], michael@0: MOZ_ZIPWRITER=, michael@0: MOZ_ZIPWRITER=1 ) michael@0: AC_SUBST(MOZ_ZIPWRITER) michael@0: michael@0: dnl ======================================================== michael@0: dnl GL provider michael@0: dnl ======================================================== michael@0: MOZ_GL_PROVIDER= michael@0: MOZ_ARG_WITH_STRING(gl-provider, michael@0: [ --with-gl-provider=ID michael@0: Set GL provider backend type], michael@0: [ val=`echo $withval` michael@0: MOZ_GL_PROVIDER="$val"]) michael@0: michael@0: if test -n "$MOZ_GL_PROVIDER"; then michael@0: MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER michael@0: AC_SUBST(MOZ_GL_PROVIDER) michael@0: AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER) michael@0: fi michael@0: AC_SUBST(MOZ_GL_DEFAULT_PROVIDER) michael@0: AC_DEFINE_UNQUOTED(GL_PROVIDER_$MOZ_GL_DEFAULT_PROVIDER) michael@0: michael@0: dnl ======================================================== michael@0: dnl = faststripe theme michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(faststripe, michael@0: [ --enable-faststripe Use faststripe theme], michael@0: MOZ_THEME_FASTSTRIPE=1, michael@0: MOZ_THEME_FASTSTRIPE= ) michael@0: AC_SUBST(MOZ_THEME_FASTSTRIPE) michael@0: michael@0: dnl ======================================================== michael@0: dnl = michael@0: dnl = Feature options that require extra sources to be pulled michael@0: dnl = michael@0: dnl ======================================================== michael@0: dnl MOZ_ARG_HEADER(Features that require extra sources) michael@0: michael@0: dnl ======================================================== michael@0: dnl = michael@0: dnl = Runtime debugging and Optimization Options michael@0: dnl = michael@0: dnl ======================================================== michael@0: MOZ_ARG_HEADER(Runtime debugging and Optimizations) michael@0: michael@0: dnl ======================================================== michael@0: dnl enable mobile optimizations michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(mobile-optimize, michael@0: [ --enable-mobile-optimize michael@0: Enable mobile optimizations], michael@0: MOZ_GFX_OPTIMIZE_MOBILE=1) michael@0: michael@0: AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE) michael@0: michael@0: if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then michael@0: AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE) 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_ALLOW_HEAP_EXECUTE_FLAGS) michael@0: AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK) michael@0: AC_SUBST(MOZ_PGO) michael@0: AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable any treating of compile warnings as errors michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_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 = Disable runtime logging checks michael@0: dnl ======================================================== michael@0: MOZ_ARG_DISABLE_BOOL(logging, michael@0: [ --disable-logging Disable logging facilities], michael@0: NS_DISABLE_LOGGING=1, michael@0: NS_DISABLE_LOGGING= ) michael@0: if test "$NS_DISABLE_LOGGING"; then michael@0: AC_DEFINE(NS_DISABLE_LOGGING) michael@0: else michael@0: AC_DEFINE(MOZ_LOGGING) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = This will enable logging of addref, release, ctor, dtor. michael@0: dnl ======================================================== michael@0: _ENABLE_LOGREFCNT=42 michael@0: MOZ_ARG_ENABLE_BOOL(logrefcnt, michael@0: [ --enable-logrefcnt Enable logging of refcounts (default=debug) ], michael@0: _ENABLE_LOGREFCNT=1, michael@0: _ENABLE_LOGREFCNT= ) michael@0: if test "$_ENABLE_LOGREFCNT" = "1"; then michael@0: AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING) michael@0: elif test -z "$_ENABLE_LOGREFCNT"; then michael@0: AC_DEFINE(NO_BUILD_REFCNT_LOGGING) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl moz_dump_painting michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(dump-painting, michael@0: [ --enable-dump-painting Enable paint debugging.], michael@0: MOZ_DUMP_PAINTING=1, michael@0: MOZ_DUMP_PAINTING= ) michael@0: if test -n "$MOZ_DUMP_PAINTING"; then michael@0: AC_DEFINE(MOZ_DUMP_PAINTING) michael@0: AC_DEFINE(MOZ_LAYERS_HAVE_LOG) michael@0: fi michael@0: if test -n "$MOZ_DEBUG"; then michael@0: AC_DEFINE(MOZ_DUMP_PAINTING) michael@0: fi 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; also disables DMD and jemalloc], 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: dnl The two options are conflicting. Fails the configure to alert the user. michael@0: if test "$NS_TRACE_MALLOC" -a "$MOZ_DMD"; then michael@0: AC_MSG_ERROR([--enable-trace-malloc and --enable-dmd are conflicting options]) michael@0: fi michael@0: 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: michael@0: MOZ_MEMORY=1 # DMD enables jemalloc michael@0: MOZ_REPLACE_MALLOC=1 # DMD enables replace-malloc michael@0: fi michael@0: AC_SUBST(MOZ_DMD) 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 "${OS_TARGET}" = "Android"; then michael@0: dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue michael@0: : michael@0: elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin"; then michael@0: dnl On Windows and OSX, we want to link all our binaries against mozglue michael@0: if test -z "$GNU_CC"; then michael@0: MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)' michael@0: else michael@0: MOZ_GLUE_LDFLAGS='-L$(LIBXUL_DIST)/lib $(call EXPAND_LIBNAME,mozglue)' michael@0: fi michael@0: else michael@0: dnl On other Unix systems, we only want to link executables against mozglue michael@0: MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)' michael@0: dnl On other Unix systems, where mozglue is a static library, jemalloc is michael@0: dnl separated for the SDK, so we need to add it here. michael@0: if test "$MOZ_MEMORY" = 1 -o \( "$LIBXUL_SDK" -a -f "$LIBXUL_SDK/lib/${LIB_PREFIX}memory.${LIB_SUFFIX}" \); then michael@0: MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(call EXPAND_LIBNAME_PATH,memory,$(LIBXUL_DIST)/lib)' michael@0: fi michael@0: MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(MKSHLIB_UNFORCE_ALL)' michael@0: if test -n "$GNU_CC"; then michael@0: dnl And we need mozglue symbols to be exported. michael@0: MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS -rdynamic" michael@0: fi michael@0: if test "$MOZ_LINKER" = 1; then michael@0: MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS $MOZ_ZLIB_LIBS" michael@0: fi michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable dynamic replacement of malloc implementation michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(replace-malloc, michael@0: [ --enable-replace-malloc Enable ability to dynamically replace the malloc implementation], michael@0: MOZ_REPLACE_MALLOC=1, michael@0: MOZ_REPLACE_MALLOC= ) michael@0: michael@0: dnl The two options are conflicting. Fails the configure to alert the user. michael@0: if test "$NS_TRACE_MALLOC" -a "$MOZ_REPLACE_MALLOC"; then michael@0: AC_MSG_ERROR([--enable-trace-malloc and --enable-replace-malloc are conflicting options]) michael@0: fi michael@0: michael@0: if test -n "$MOZ_REPLACE_MALLOC" -a -z "$MOZ_MEMORY"; then michael@0: dnl We don't want to enable jemalloc unconditionally because it may be a michael@0: dnl deliberate choice not to enable it (bug 702250, for instance) michael@0: AC_MSG_ERROR([--enable-replace-malloc requires --enable-jemalloc]) michael@0: elif test -n "$MOZ_REPLACE_MALLOC"; then michael@0: MOZ_NATIVE_JEMALLOC= michael@0: michael@0: dnl Replace-malloc Mac linkage quirks michael@0: if test -n "$MACOSX_DEPLOYMENT_TARGET"; then michael@0: AC_CACHE_CHECK([how to do weak dynamic linking], michael@0: ac_cv_weak_dynamic_linking, michael@0: [echo 'extern void foo() __attribute__((weak_import));int bar() { if (foo) foo(); return 0; }' > conftest.c michael@0: if AC_TRY_COMMAND([${CC-cc} -o conftest${DLL_SUFFIX} $CFLAGS -dynamiclib $LDFLAGS -Wl,-U,_foo conftest.c $LIBS 1>&5]) && michael@0: test -s conftest${DLL_SUFFIX}; then michael@0: dnl There are several ways the linker can put link edit rules in a binary: michael@0: dnl - classic info only (for OSX < 10.6) michael@0: dnl - dyld info only michael@0: dnl - both michael@0: if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO_ONLY" > /dev/null; then michael@0: _CLASSIC_INFO= michael@0: else michael@0: _CLASSIC_INFO=1 michael@0: fi michael@0: if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO" > /dev/null; then michael@0: _DYLD_INFO=1 michael@0: else michael@0: _DYLD_INFO= michael@0: fi michael@0: dnl With classic info, we need to build with -flat_namespace. michael@0: dnl With dyld info, Xcode 4.5 does the right thing without additional flags, michael@0: dnl but Xcode < 4.5 requires a dummy library and -flat_namespace because it michael@0: dnl forgets to set the weak flag in the dyld info. michael@0: dnl See http://glandium.org/blog/?p=2764 for more details. michael@0: dnl michael@0: dnl Values for ac_cv_weak_dynamic_linking, and subsequently michael@0: dnl MOZ_REPLACE_MALLOC_LINKAGE are thus: michael@0: dnl - "flat namespace" when -flat_namespace alone is needed michael@0: dnl - "dummy library" when a dummy library and -flat_namespace are needed michael@0: dnl - "compiler support" when nothing is needed michael@0: if test -n "$_DYLD_INFO" && dyldinfo -bind conftest${DLL_SUFFIX} 2> /dev/null | grep "_foo (weak import)" > /dev/null; then michael@0: if test -n "$_CLASSIC_INFO"; then michael@0: ac_cv_weak_dynamic_linking="flat namespace" michael@0: else michael@0: ac_cv_weak_dynamic_linking="compiler support" michael@0: fi michael@0: else michael@0: if test -n "$_DYLD_INFO"; then michael@0: ac_cv_weak_dynamic_linking="dummy library" michael@0: else michael@0: ac_cv_weak_dynamic_linking="flat namespace" michael@0: fi michael@0: fi michael@0: else michael@0: AC_ERROR([couldn't compile a simple C file]) michael@0: fi michael@0: rm -rf conftest*]) michael@0: MOZ_REPLACE_MALLOC_LINKAGE="$ac_cv_weak_dynamic_linking" michael@0: fi michael@0: fi michael@0: AC_SUBST(MOZ_REPLACE_MALLOC) michael@0: AC_SUBST(MOZ_REPLACE_MALLOC_LINKAGE) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Jemalloc build setup michael@0: dnl ======================================================== michael@0: if test -z "$MOZ_MEMORY"; then michael@0: if test -n "$MOZ_JEMALLOC3" -a -z "$MOZ_REPLACE_MALLOC"; then michael@0: MOZ_NATIVE_JEMALLOC=1 michael@0: AC_CHECK_FUNCS(mallctl nallocm,, michael@0: [MOZ_NATIVE_JEMALLOC= michael@0: break]) michael@0: if test -n "$MOZ_NATIVE_JEMALLOC"; then michael@0: MOZ_MEMORY=1 michael@0: AC_DEFINE(MOZ_MEMORY) michael@0: AC_DEFINE(MOZ_JEMALLOC3) michael@0: AC_DEFINE(MOZ_NATIVE_JEMALLOC) michael@0: fi michael@0: fi michael@0: case "${target}" in michael@0: *-mingw*) michael@0: if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then michael@0: AC_MSG_WARN([When not building jemalloc, you need to set WIN32_REDIST_DIR to the path to the Visual C++ Redist (usually VCINSTALLDIR\redist\x86\Microsoft.VC80.CRT, for VC++ v8) if you intend to distribute your build.]) michael@0: fi michael@0: ;; michael@0: esac michael@0: else michael@0: AC_DEFINE(MOZ_MEMORY) michael@0: if test -n "$MOZ_JEMALLOC3"; then michael@0: AC_DEFINE(MOZ_JEMALLOC3) michael@0: fi 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: if test -z "$gonkdir"; then michael@0: _WRAP_MALLOC=1 michael@0: else michael@0: AC_DEFINE(MOZ_MEMORY_GONK) michael@0: fi michael@0: MOZ_GLUE_LDFLAGS= 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: if test -z "$MOZ_DEBUG"; then michael@0: WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib" michael@0: else michael@0: WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib" michael@0: fi michael@0: dnl Look for a broken crtdll.obj michael@0: WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj` michael@0: lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH michael@0: if grep -q '__imp__\{0,1\}free' crtdll.obj; then michael@0: MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt' michael@0: dnl Also pass this to NSPR/NSS michael@0: DLLFLAGS="$DLLFLAGS $MOZ_GLUE_LDFLAGS" michael@0: else michael@0: DLLFLAGS="$DLLFLAGS -LIBPATH:\$(DIST)/lib -DEFAULTLIB:mozglue" michael@0: fi michael@0: rm crtdll.obj michael@0: michael@0: export DLLFLAGS michael@0: ;; michael@0: *) michael@0: AC_MSG_ERROR([--enable-jemalloc not supported on ${target}]) michael@0: ;; michael@0: esac michael@0: fi # MOZ_MEMORY michael@0: AC_SUBST(MOZ_MEMORY) michael@0: AC_SUBST(MOZ_JEMALLOC3) michael@0: AC_SUBST(MOZ_NATIVE_JEMALLOC) michael@0: AC_SUBST(MOZ_GLUE_LDFLAGS) michael@0: AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS) michael@0: AC_SUBST(WIN32_CRT_LIBS) michael@0: dnl Need to set this for make because NSS doesn't have configure michael@0: AC_SUBST(DLLFLAGS) michael@0: michael@0: dnl We need to wrap dlopen and related functions on Android because we use michael@0: dnl our own linker. michael@0: if test "$OS_TARGET" = Android; then michael@0: WRAP_LDFLAGS="${WRAP_LDFLAGS} -L$_objdir/dist/lib -lmozglue" michael@0: WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=PR_GetEnv,--wrap=PR_SetEnv" michael@0: if test "$MOZ_WIDGET_TOOLKIT" = android; then michael@0: WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror" michael@0: fi michael@0: if test -z "$gonkdir"; then michael@0: WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork,--wrap=raise" michael@0: WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=memccpy,--wrap=memchr,--wrap=memrchr,--wrap=memcmp,--wrap=memcpy,--wrap=memmove,--wrap=memset,--wrap=memmem,--wrap=memswap,--wrap=index,--wrap=strchr,--wrap=strrchr,--wrap=strlen,--wrap=strcmp,--wrap=strcpy,--wrap=strcat,--wrap=strcasecmp,--wrap=strncasecmp,--wrap=strstr,--wrap=strcasestr,--wrap=strtok,--wrap=strtok_r,--wrap=strerror,--wrap=strerror_r,--wrap=strnlen,--wrap=strncat,--wrap=strncmp,--wrap=strncpy,--wrap=strlcat,--wrap=strlcpy,--wrap=strcspn,--wrap=strpbrk,--wrap=strsep,--wrap=strspn,--wrap=strcoll,--wrap=strxfrm" michael@0: fi michael@0: if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then michael@0: WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=pthread_create,--wrap=epoll_wait,--wrap=poll,--wrap=pthread_cond_timedwait,--wrap=__pthread_cond_timedwait,--wrap=pthread_cond_wait,--wrap=epoll_create,--wrap=epoll_ctl,--wrap=close,--wrap=pthread_key_create,--wrap=pthread_key_delete,--wrap=socketpair,--wrap=pthread_self,--wrap=pthread_mutex_lock,--wrap=pthread_join,--wrap=pipe,--wrap=pipe2,--wrap=tgkill" michael@0: fi michael@0: fi 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 -n "$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=vasprintf,--wrap=asprintf" 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: dnl Wrap the nothrow variants too. michael@0: WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_ZnwjRKSt9nothrow_t,--wrap=_ZnajRKSt9nothrow_t,--wrap=_ZdlPvRKSt9nothrow_t,--wrap=_ZdaPvRKSt9nothrow_t" 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 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: 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 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 = --disable-elf-hack michael@0: dnl ======================================================== michael@0: michael@0: USE_ELF_HACK=1 michael@0: MOZ_ARG_DISABLE_BOOL(elf-hack, michael@0: [ --disable-elf-hack Disable elf hacks], michael@0: [USE_ELF_HACK=], michael@0: [USE_ELF_HACK=F # Force enable elf-hack]) michael@0: michael@0: # Disable elf hack for profiling because the built in profiler michael@0: # doesn't read the segments properly with elf hack. This is michael@0: # temporary and should be fixed soon in the profiler. michael@0: if test "$MOZ_PROFILING" = 1; then michael@0: if test "$USE_ELF_HACK" = F; then michael@0: AC_ERROR([--enable-elf-hack is not compatible with --enable-profiling]) michael@0: fi michael@0: USE_ELF_HACK= michael@0: fi michael@0: michael@0: # Only enable elfhack where supported michael@0: if test "$USE_ELF_HACK" = 1; then michael@0: case "${HOST_OS_ARCH},${OS_ARCH}" in michael@0: Linux,Linux) michael@0: case "${CPU_ARCH}" in michael@0: arm | x86 | x86_64) michael@0: USE_ELF_HACK=1 michael@0: ;; michael@0: *) michael@0: USE_ELF_HACK= michael@0: ;; michael@0: esac michael@0: ;; michael@0: *) michael@0: USE_ELF_HACK= michael@0: ;; michael@0: esac michael@0: fi michael@0: michael@0: if test -n "$COMPILE_ENVIRONMENT" -a -n "$USE_ELF_HACK"; then michael@0: dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on michael@0: dnl memory addresses it maps to. The result is that by the time elfhack michael@0: dnl kicks in, it is not possible to apply relocations because of that, michael@0: dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO michael@0: dnl segment. It makes elfhack mostly useless, so considering the problems michael@0: dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal michael@0: dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when michael@0: dnl the linker creates PT_GNU_RELRO segments. However, when we do want michael@0: dnl elfhack enabled, disable PT_GNU_RELRO instead. michael@0: AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments], michael@0: LINK_WITH_PT_GNU_RELRO, michael@0: [echo "int main() {return 0;}" > conftest.${ac_ext} michael@0: if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) && michael@0: test -s conftest${ac_exeext}; then michael@0: if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then michael@0: LINK_WITH_PT_GNU_RELRO=yes michael@0: else michael@0: LINK_WITH_PT_GNU_RELRO=no michael@0: fi michael@0: else michael@0: dnl We really don't expect to get here, but just in case michael@0: AC_ERROR([couldn't compile a simple C file]) michael@0: fi michael@0: rm -rf conftest*]) michael@0: if test "$LINK_WITH_PT_GNU_RELRO" = yes; then michael@0: if test "$USE_ELF_HACK" = F; then michael@0: AC_MSG_CHECKING([for -z norelro option to ld]) michael@0: _SAVE_LDFLAGS=$LDFLAGS michael@0: LDFLAGS="$LDFLAGS -Wl,-z,norelro" michael@0: AC_TRY_LINK(,,AC_MSG_RESULT([yes]) michael@0: [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,norelro"], michael@0: AC_ERROR([--enable-elf-hack is not compatible with a linker creating a PT_GNU_RELRO segment and that doesn't support the "-z norelro" option.])) michael@0: USE_ELF_HACK=1 michael@0: else michael@0: AC_MSG_WARN([Disabling elfhack]) michael@0: USE_ELF_HACK= michael@0: fi michael@0: fi michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = libstdc++ compatibility hacks michael@0: dnl ======================================================== michael@0: michael@0: STDCXX_COMPAT= michael@0: MOZ_ARG_ENABLE_BOOL(stdcxx-compat, michael@0: [ --enable-stdcxx-compat Enable compatibility with older libstdc++], michael@0: STDCXX_COMPAT=1) michael@0: michael@0: if test -n "$STDCXX_COMPAT"; then michael@0: eval $(CXX="$CXX" HOST_CXX="$HOST_CXX" $PYTHON -m mozbuild.configure.libstdcxx) michael@0: AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION) michael@0: AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION) michael@0: fi 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 = Enable runtime visual profiling logger michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(visual-event-tracer, michael@0: [ --enable-visual-event-tracer Enable visual event tracer instrumentation], michael@0: MOZ_VISUAL_EVENT_TRACER=1, michael@0: MOZ_VISUAL_EVENT_TRACER=) michael@0: if test -n "$MOZ_VISUAL_EVENT_TRACER"; then michael@0: AC_DEFINE(MOZ_VISUAL_EVENT_TRACER) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable TaskTracer michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(tasktracer, michael@0: [ --enable-tasktracer Set compile flags necessary for using TaskTracer], michael@0: MOZ_TASK_TRACER=1, michael@0: MOZ_TASK_TRACER= ) michael@0: if test "$MOZ_WIDGET_TOOLKIT" = "gonk" -a -n "$MOZ_TASK_TRACER"; then michael@0: AC_DEFINE(MOZ_TASK_TRACER) michael@0: AC_SUBST(MOZ_TASK_TRACER) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl Turn on reflow counting michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(reflow-perf, michael@0: [ --enable-reflow-perf Enable reflow performance tracing], michael@0: MOZ_REFLOW_PERF=1, michael@0: MOZ_REFLOW_PERF= ) michael@0: if test -n "$MOZ_REFLOW_PERF"; then michael@0: AC_DEFINE(MOZ_REFLOW_PERF) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable Radio Interface for B2G (Gonk usually) michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(b2g-ril, michael@0: [ --enable-b2g-ril Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ], michael@0: MOZ_B2G_RIL=1, michael@0: MOZ_B2G_RIL=, michael@0: MOZ_B2G_RIL=$_PLATFORM_HAVE_RIL ) michael@0: if test -n "$MOZ_B2G_RIL"; then michael@0: if test -n "$_PLATFORM_HAVE_RIL"; then michael@0: AC_DEFINE(MOZ_B2G_RIL) michael@0: else michael@0: AC_MSG_ERROR([b2g-ril cannot be enabled because target platform doesn't support it.]) michael@0: fi michael@0: fi michael@0: AC_SUBST(MOZ_B2G_RIL) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable Radio FM for B2G (Gonk usually) michael@0: dnl ======================================================== michael@0: if test -n "$MOZ_B2G_FM"; then michael@0: AC_DEFINE(MOZ_B2G_FM) michael@0: fi michael@0: AC_SUBST(MOZ_B2G_FM) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable Bluetooth Interface for B2G (Gonk usually) michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(b2g-bt, michael@0: [ --enable-b2g-bt Set compile flags necessary for compiling Bluetooth API for B2G ], michael@0: MOZ_B2G_BT=1, michael@0: MOZ_B2G_BT= ) michael@0: if test -n "$MOZ_B2G_BT"; then michael@0: AC_DEFINE(MOZ_B2G_BT) michael@0: fi michael@0: AC_SUBST(MOZ_B2G_BT) michael@0: AC_SUBST(MOZ_B2G_BT_BLUEZ) michael@0: AC_SUBST(MOZ_B2G_BT_BLUEDROID) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable NFC Interface for B2G (Gonk usually) michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(nfc, michael@0: [ --enable-nfc Set compile flags necessary for compiling NFC API ], michael@0: MOZ_NFC=1, michael@0: MOZ_NFC= ) michael@0: if test -n "$MOZ_NFC"; then michael@0: AC_DEFINE(MOZ_NFC) michael@0: fi michael@0: AC_SUBST(MOZ_NFC) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable Pico Speech Synthesis (Gonk usually) michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(synth-pico, michael@0: [ --enable-synth-pico Set compile flags necessary for compiling Pico Web Speech API ], michael@0: MOZ_SYNTH_PICO=1, michael@0: MOZ_SYNTH_PICO= ) michael@0: if test -n "$MOZ_SYNTH_PICO"; then michael@0: AC_DEFINE(MOZ_SYNTH_PICO) michael@0: fi michael@0: AC_SUBST(MOZ_SYNTH_PICO) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable Support for Time Manager API michael@0: dnl ======================================================== michael@0: if test -n "$MOZ_TIME_MANAGER"; then michael@0: AC_DEFINE(MOZ_TIME_MANAGER) michael@0: fi michael@0: AC_SUBST(MOZ_TIME_MANAGER) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable Camera Interface for B2G (Gonk usually) michael@0: dnl ======================================================== michael@0: MOZ_ARG_ENABLE_BOOL(b2g-camera, michael@0: [ --enable-b2g-camera Set compile flags necessary for compiling camera API for B2G ], michael@0: MOZ_B2G_CAMERA=1, michael@0: MOZ_B2G_CAMERA= ) michael@0: if test -n "$MOZ_B2G_CAMERA"; then michael@0: AC_DEFINE(MOZ_B2G_CAMERA) michael@0: fi michael@0: AC_SUBST(MOZ_B2G_CAMERA) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable Support B2G-specific changes to the NSS michael@0: dnl = certificate trust database. michael@0: dnl ======================================================== michael@0: if test -n "$MOZ_B2G_CERTDATA"; then michael@0: AC_DEFINE(MOZ_B2G_CERTDATA) michael@0: fi michael@0: AC_SUBST(MOZ_B2G_CERTDATA) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable Support for Payment API michael@0: dnl ======================================================== michael@0: if test -n "$MOZ_PAY"; then michael@0: AC_DEFINE(MOZ_PAY) michael@0: fi michael@0: AC_SUBST(MOZ_PAY) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable Browser Support for Activities michael@0: dnl ======================================================== michael@0: if test -n "$MOZ_ACTIVITIES"; then michael@0: AC_DEFINE(MOZ_ACTIVITIES) michael@0: fi michael@0: AC_SUBST(MOZ_ACTIVITIES) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable Support for AudioChannelManager API michael@0: dnl ======================================================== michael@0: if test -n "$MOZ_AUDIO_CHANNEL_MANAGER"; then michael@0: AC_DEFINE(MOZ_AUDIO_CHANNEL_MANAGER) michael@0: fi michael@0: AC_SUBST(MOZ_AUDIO_CHANNEL_MANAGER) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Enable Support for Firefox Accounts (services/fxaccounts) michael@0: dnl ======================================================== michael@0: if test -n "$MOZ_SERVICES_FXACCOUNTS"; then michael@0: AC_DEFINE(MOZ_SERVICES_FXACCOUNTS) michael@0: fi michael@0: AC_SUBST(MOZ_SERVICES_FXACCOUNTS) 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 = Support for gcc stack unwinding (from gcc 3.3) michael@0: dnl ======================================================== michael@0: if test -z "$SKIP_LIBRARY_CHECKS"; then michael@0: AC_LANG_SAVE michael@0: AC_LANG_CPLUSPLUS michael@0: MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace)) michael@0: AC_LANG_RESTORE michael@0: fi 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: dnl ========================================================= michael@0: dnl = Chrome format michael@0: dnl ========================================================= michael@0: MOZ_ARG_ENABLE_STRING([chrome-format], michael@0: [ --enable-chrome-format=jar|flat|omni michael@0: Select FORMAT of chrome files during packaging], michael@0: MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`) michael@0: michael@0: if test -z "$MOZ_CHROME_FILE_FORMAT"; then michael@0: MOZ_CHROME_FILE_FORMAT=jar michael@0: fi michael@0: michael@0: if test "$MOZ_CHROME_FILE_FORMAT" = "symlink"; then michael@0: AC_MSG_ERROR([--enable-chrome-format=symlink has been deprecated. It is now used by default in $DIST/bin on platforms that support it]) michael@0: fi michael@0: michael@0: if test "$MOZ_CHROME_FILE_FORMAT" != "jar" && michael@0: test "$MOZ_CHROME_FILE_FORMAT" != "flat" && michael@0: test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then michael@0: AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, or omni]) michael@0: fi michael@0: michael@0: dnl ========================================================= michael@0: dnl Omnijar packaging (bug 552121) michael@0: dnl ========================================================= michael@0: dnl Omnijar packaging is compatible with flat packaging. michael@0: dnl In unpackaged builds, omnijar looks for files as if michael@0: dnl things were flat packaged. After packaging, all files michael@0: dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT michael@0: dnl is set to flat since putting files into jars is only michael@0: dnl done during packaging with omnijar. michael@0: if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then michael@0: MOZ_OMNIJAR=1 michael@0: AC_DEFINE(MOZ_OMNIJAR) michael@0: fi michael@0: MOZ_PACKAGER_FORMAT="$MOZ_CHROME_FILE_FORMAT" michael@0: if test "$OS_ARCH" = "WINNT" -o "$MOZ_WIDGET_TOOLKIT" = "android"; then michael@0: MOZ_CHROME_FILE_FORMAT=flat michael@0: else michael@0: MOZ_CHROME_FILE_FORMAT=symlink michael@0: fi michael@0: michael@0: if test "$MOZ_WIDGET_TOOLKIT" = "android"; then michael@0: dnl Fennec's static resources live in the assets/ folder of the michael@0: dnl APK. Adding a path to the name here works because we only michael@0: dnl have one omnijar file in the final package (which is not the michael@0: dnl case on desktop), and necessitates some contortions during michael@0: dnl packaging so that the resources in the omnijar are considered michael@0: dnl as rooted at / and not as rooted at assets/ (which again is michael@0: dnl not the case on desktop: there are omnijars rooted at webrtc/, michael@0: dnl etc). packager.mk handles changing the rooting of the single michael@0: dnl omnijar. michael@0: OMNIJAR_NAME=assets/omni.ja michael@0: else michael@0: OMNIJAR_NAME=omni.ja michael@0: fi michael@0: michael@0: AC_SUBST(OMNIJAR_NAME) michael@0: AC_SUBST(MOZ_OMNIJAR) michael@0: AC_SUBST(MOZ_PACKAGER_FORMAT) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Define default location for MOZILLA_FIVE_HOME michael@0: dnl ======================================================== michael@0: MOZ_ARG_WITH_STRING(default-mozilla-five-home, michael@0: [ --with-default-mozilla-five-home michael@0: Set the default value for MOZILLA_FIVE_HOME], michael@0: [ val=`echo $withval` michael@0: AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ]) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Location of the mozilla user directory (default is ~/.mozilla).], michael@0: dnl ======================================================== michael@0: MOZ_ARG_WITH_STRING(user-appdir, michael@0: [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)], michael@0: [ val=`echo $withval` michael@0: if echo "$val" | grep "\/" >/dev/null; then michael@0: AC_MSG_ERROR("Homedir must be single relative path.") michael@0: else michael@0: MOZ_USER_DIR="$val" michael@0: fi]) michael@0: michael@0: AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR") michael@0: michael@0: dnl ======================================================== michael@0: dnl = Doxygen configuration michael@0: dnl ======================================================== michael@0: dnl Use commas to specify multiple dirs to this arg michael@0: MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl' michael@0: MOZ_ARG_WITH_STRING(doc-input-dirs, michael@0: [ --with-doc-input-dirs=DIRS michael@0: Header/idl dirs to create docs from], michael@0: [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] ) michael@0: AC_SUBST(MOZ_DOC_INPUT_DIRS) michael@0: michael@0: dnl Use commas to specify multiple dirs to this arg michael@0: MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr' michael@0: MOZ_ARG_WITH_STRING(doc-include-dirs, michael@0: [ --with-doc-include-dirs=DIRS michael@0: Include dirs to preprocess doc headers], michael@0: [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] ) michael@0: AC_SUBST(MOZ_DOC_INCLUDE_DIRS) michael@0: michael@0: MOZ_DOC_OUTPUT_DIR='./dist/docs' michael@0: MOZ_ARG_WITH_STRING(doc-output-dir, michael@0: [ --with-doc-output-dir=DIR michael@0: Dir to generate docs into], michael@0: [ MOZ_DOC_OUTPUT_DIR=$withval ] ) michael@0: AC_SUBST(MOZ_DOC_OUTPUT_DIR) 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: fi # ! SKIP_COMPILER_CHECKS michael@0: michael@0: AC_DEFINE(CPP_THROW_NEW, [throw()]) michael@0: AC_LANG_C michael@0: michael@0: if test "$COMPILE_ENVIRONMENT"; then michael@0: MOZ_EXPAND_LIBS michael@0: fi # COMPILE_ENVIRONMENT 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_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT' michael@0: _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_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 = michael@0: dnl = Static Build Options michael@0: dnl = michael@0: dnl ======================================================== michael@0: MOZ_ARG_HEADER(Static build options) michael@0: michael@0: AC_SUBST(LIBXUL_LIBS) michael@0: XPCOM_LIBS="$LIBXUL_LIBS" michael@0: michael@0: if test "$OS_ARCH" = "WINNT"; then michael@0: GKMEDIAS_SHARED_LIBRARY=1 michael@0: AC_DEFINE(GKMEDIAS_SHARED_LIBRARY) michael@0: fi michael@0: AC_SUBST(GKMEDIAS_SHARED_LIBRARY) michael@0: michael@0: if test -z "$MOZ_NATIVE_ZLIB"; then michael@0: if test -n "$JS_SHARED_LIBRARY" -o "$GKMEDIAS_SHARED_LIBRARY"; then michael@0: ZLIB_IN_MOZGLUE=1 michael@0: AC_DEFINE(ZLIB_IN_MOZGLUE) michael@0: fi michael@0: fi michael@0: michael@0: AC_SUBST(ZLIB_IN_MOZGLUE) 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 Check for GLib. michael@0: dnl ======================================================== michael@0: michael@0: if test -z "$SKIP_PATH_CHECKS"; then michael@0: if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then michael@0: if test "$MOZ_ENABLE_GTK" ; then michael@0: PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0) michael@0: fi michael@0: fi michael@0: fi michael@0: michael@0: if test -z "${GLIB_GMODULE_LIBS}" \ michael@0: -a -n "${GLIB_CONFIG}"\ michael@0: -a "${GLIB_CONFIG}" != no\ michael@0: ; then michael@0: GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs` michael@0: fi michael@0: michael@0: AC_SUBST(GLIB_CFLAGS) michael@0: AC_SUBST(GLIB_LIBS) michael@0: AC_SUBST(GLIB_GMODULE_LIBS) michael@0: michael@0: dnl ======================================================== michael@0: dnl Graphics checks. michael@0: dnl ======================================================== michael@0: michael@0: if test "${OS_TARGET}" = "WINNT"; then michael@0: if $PERL -e "exit($MOZ_WINSDK_MAXVER < 0x06020000)"; then michael@0: MOZ_ENABLE_DIRECT2D1_1=1 michael@0: AC_SUBST(MOZ_ENABLE_DIRECT2D1_1) michael@0: fi michael@0: fi michael@0: michael@0: if test "${OS_TARGET}" = "WINNT" -o \ michael@0: "${OS_ARCH}" = "Darwin" -o \ michael@0: "${MOZ_WIDGET_TOOLKIT}" = "android" -o \ michael@0: "${MOZ_WIDGET_TOOLKIT}" = "gonk" -o \ michael@0: "${MOZ_WIDGET_TOOLKIT}" = "gtk2" -o \ michael@0: "${MOZ_WIDGET_TOOLKIT}" = "gtk3"; then michael@0: case "${target_cpu}" in michael@0: i*86*|x86_64|arm) michael@0: MOZ_ENABLE_SKIA=1 michael@0: ;; michael@0: *) michael@0: MOZ_ENABLE_SKIA= michael@0: ;; michael@0: esac michael@0: else michael@0: MOZ_ENABLE_SKIA= michael@0: fi michael@0: michael@0: MOZ_ARG_ENABLE_BOOL(skia, michael@0: [ --enable-skia Enable use of Skia], michael@0: MOZ_ENABLE_SKIA=1, michael@0: MOZ_ENABLE_SKIA=) michael@0: michael@0: if test "$USE_FC_FREETYPE"; then michael@0: if test "$COMPILE_ENVIRONMENT"; then michael@0: dnl ======================================================== michael@0: dnl = Check for freetype2 and its functionality michael@0: dnl ======================================================== michael@0: PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=) michael@0: michael@0: if test "$_HAVE_FREETYPE2"; then michael@0: _SAVE_LIBS="$LIBS" michael@0: _SAVE_CFLAGS="$CFLAGS" michael@0: LIBS="$LIBS $FT2_LIBS" michael@0: CFLAGS="$CFLAGS $FT2_CFLAGS" michael@0: michael@0: AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem, michael@0: ac_cv_member_FT_Bitmap_Size_y_ppem, michael@0: [AC_TRY_COMPILE([#include michael@0: #include FT_FREETYPE_H], michael@0: [FT_Bitmap_Size s; michael@0: if (sizeof s.y_ppem) return 0; michael@0: return 1], michael@0: ac_cv_member_FT_Bitmap_Size_y_ppem=yes, michael@0: ac_cv_member_FT_Bitmap_Size_y_ppem=no)]) michael@0: if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then michael@0: HAVE_FT_BITMAP_SIZE_Y_PPEM=1 michael@0: else michael@0: HAVE_FT_BITMAP_SIZE_Y_PPEM=0 michael@0: fi michael@0: AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM, michael@0: $HAVE_FT_BITMAP_SIZE_Y_PPEM, michael@0: [FT_Bitmap_Size structure includes y_ppem field]) michael@0: michael@0: AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table) michael@0: michael@0: LIBS="$_SAVE_LIBS" michael@0: CFLAGS="$_SAVE_CFLAGS" michael@0: fi michael@0: michael@0: _SAVE_CPPFLAGS="$CPPFLAGS" michael@0: CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS" michael@0: MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], , michael@0: [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include ]) michael@0: CPPFLAGS="$_SAVE_CPPFLAGS" michael@0: else michael@0: AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H) michael@0: fi michael@0: michael@0: PKG_CHECK_MODULES(_FONTCONFIG, fontconfig, michael@0: [ michael@0: if test "$MOZ_PANGO"; then michael@0: MOZ_PANGO_CFLAGS="$MOZ_PANGO_CFLAGS $_FONTCONFIG_CFLAGS" michael@0: MOZ_PANGO_LIBS="$MOZ_PANGO_LIBS $_FONTCONFIG_LIBS" michael@0: else michael@0: FT2_CFLAGS="$FT2_CFLAGS $_FONTCONFIG_CFLAGS" michael@0: FT2_LIBS="$FT2_LIBS $_FONTCONFIG_LIBS" michael@0: fi michael@0: ]) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl Check for pixman and cairo michael@0: dnl ======================================================== michael@0: michael@0: if test "$MOZ_WIDGET_TOOLKIT" = "gtk3" ; then michael@0: # cairo-gtk3 can be build with system-cairo only michael@0: MOZ_TREE_CAIRO= michael@0: else michael@0: MOZ_TREE_CAIRO=1 michael@0: fi michael@0: michael@0: MOZ_ARG_ENABLE_BOOL(system-cairo, michael@0: [ --enable-system-cairo Use system cairo (located with pkgconfig)], michael@0: MOZ_TREE_CAIRO=, michael@0: MOZ_TREE_CAIRO=1 ) michael@0: michael@0: MOZ_TREE_PIXMAN=1 michael@0: MOZ_ARG_ENABLE_BOOL(system-pixman, michael@0: [ --enable-system-pixman Use system pixman (located with pkgconfig)], michael@0: MOZ_TREE_PIXMAN=, michael@0: MOZ_TREE_PIXMAN=force, michael@0: MOZ_TREE_PIXMAN=1 ) michael@0: michael@0: # System cairo depends on system pixman michael@0: if test "$MOZ_TREE_PIXMAN" = "force"; then michael@0: if test -z "$MOZ_TREE_CAIRO"; then michael@0: AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.]) michael@0: else michael@0: MOZ_TREE_PIXMAN=1 michael@0: fi michael@0: elif test -z "$MOZ_TREE_CAIRO"; then michael@0: MOZ_TREE_PIXMAN= michael@0: fi michael@0: michael@0: if test "$MOZ_TREE_PIXMAN"; then michael@0: AC_DEFINE(MOZ_TREE_PIXMAN) michael@0: MOZ_PIXMAN_CFLAGS="" michael@0: MOZ_PIXMAN_LIBS='$(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)' michael@0: else michael@0: PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2) michael@0: MOZ_PIXMAN_CFLAGS="$PIXMAN_CFLAGS" michael@0: MOZ_PIXMAN_LIBS="$PIXMAN_LIBS" michael@0: fi michael@0: AC_SUBST(MOZ_PIXMAN_CFLAGS) michael@0: AC_SUBST(MOZ_PIXMAN_LIBS) michael@0: michael@0: # Check for headers defining standard int types. michael@0: if test -n "$COMPILE_ENVIRONMENT"; then michael@0: MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h) michael@0: fi michael@0: michael@0: if test "$MOZ_TREE_CAIRO"; then michael@0: MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo' michael@0: AC_DEFINE(MOZ_TREE_CAIRO) michael@0: michael@0: if test "$OS_ARCH" = "WINNT"; then michael@0: # For now we assume that we will have a uint64_t available through michael@0: # one of the above headers or mozstdint.h. michael@0: AC_DEFINE(HAVE_UINT64_T) michael@0: fi michael@0: michael@0: # Define macros for cairo-features.h michael@0: TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1" michael@0: if test "$MOZ_X11"; then michael@0: XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1" michael@0: XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1" michael@0: PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1" michael@0: FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1" michael@0: MOZ_ENABLE_CAIRO_FT=1 michael@0: CAIRO_FT_CFLAGS="$FT2_CFLAGS" michael@0: fi michael@0: case "$MOZ_WIDGET_TOOLKIT" in michael@0: qt) michael@0: QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1" michael@0: ;; michael@0: cocoa | uikit) michael@0: QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1" michael@0: QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1" michael@0: QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1" michael@0: ;; michael@0: windows) michael@0: WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1" michael@0: WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1" michael@0: if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then michael@0: WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1" michael@0: WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1" michael@0: MOZ_ENABLE_D2D_SURFACE=1 michael@0: MOZ_ENABLE_DWRITE_FONT=1 michael@0: else michael@0: WIN32_DWRITE_FONT_FEATURE= michael@0: WIN32_D2D_SURFACE_FEATURE= michael@0: fi michael@0: michael@0: MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1) michael@0: michael@0: dnl D3D10 Layers depend on D2D Surfaces. michael@0: if test -n "$WIN32_D2D_SURFACE_FEATURE"; then michael@0: MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1) michael@0: fi michael@0: ;; michael@0: gtk3) michael@0: AC_MSG_ERROR([cairo-gtk3 toolkit is incompatible with in-tree cairo. Please add --enable-system-cairo to your build config.]) michael@0: ;; michael@0: esac michael@0: if test "$USE_FC_FREETYPE"; then michael@0: FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1" michael@0: fi michael@0: AC_SUBST(MOZ_ENABLE_CAIRO_FT) michael@0: AC_SUBST(MOZ_ENABLE_DWRITE_FONT) michael@0: AC_SUBST(MOZ_ENABLE_D2D_SURFACE) michael@0: AC_SUBST(MOZ_ENABLE_D3D9_LAYER) michael@0: AC_SUBST(MOZ_ENABLE_D3D10_LAYER) michael@0: AC_SUBST(CAIRO_FT_CFLAGS) michael@0: michael@0: AC_SUBST(PS_SURFACE_FEATURE) michael@0: AC_SUBST(PDF_SURFACE_FEATURE) michael@0: AC_SUBST(SVG_SURFACE_FEATURE) michael@0: AC_SUBST(XLIB_SURFACE_FEATURE) michael@0: AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE) michael@0: AC_SUBST(QUARTZ_SURFACE_FEATURE) michael@0: AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE) michael@0: AC_SUBST(WIN32_SURFACE_FEATURE) michael@0: AC_SUBST(OS2_SURFACE_FEATURE) michael@0: AC_SUBST(DIRECTFB_SURFACE_FEATURE) michael@0: AC_SUBST(FT_FONT_FEATURE) michael@0: AC_SUBST(FC_FONT_FEATURE) michael@0: AC_SUBST(WIN32_FONT_FEATURE) michael@0: AC_SUBST(WIN32_DWRITE_FONT_FEATURE) michael@0: AC_SUBST(WIN32_D2D_SURFACE_FEATURE) michael@0: AC_SUBST(QUARTZ_FONT_FEATURE) michael@0: AC_SUBST(PNG_FUNCTIONS_FEATURE) michael@0: AC_SUBST(QT_SURFACE_FEATURE) michael@0: AC_SUBST(TEE_SURFACE_FEATURE) michael@0: michael@0: MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}' michael@0: michael@0: if test "$MOZ_X11"; then michael@0: MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender" michael@0: fi michael@0: michael@0: CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h michael@0: else michael@0: PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION) michael@0: MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS" michael@0: MOZ_CAIRO_LIBS="$CAIRO_LIBS" michael@0: PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION) michael@0: if test "$MOZ_X11"; then michael@0: PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION) michael@0: MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS" michael@0: MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS" michael@0: MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS" michael@0: fi michael@0: fi michael@0: michael@0: AC_SUBST(MOZ_TREE_CAIRO) michael@0: AC_SUBST(MOZ_CAIRO_CFLAGS) michael@0: AC_SUBST(MOZ_CAIRO_LIBS) michael@0: AC_SUBST(MOZ_CAIRO_OSLIBS) michael@0: AC_SUBST(MOZ_TREE_PIXMAN) michael@0: michael@0: dnl ======================================================== michael@0: dnl Skia michael@0: dnl ======================================================== michael@0: if test "$MOZ_ENABLE_SKIA"; then michael@0: AC_DEFINE(MOZ_ENABLE_SKIA) michael@0: AC_DEFINE(USE_SKIA) michael@0: if test "${MOZ_WIDGET_TOOLKIT}" = "android" -o x"$MOZ_WIDGET_TOOLKIT" = x"gonk"; then michael@0: AC_DEFINE(SK_BUILD_FOR_ANDROID_NDK) michael@0: fi michael@0: michael@0: if test "${CPU_ARCH}" != "ppc" -a "${CPU_ARCH}" != "ppc64" -a "${CPU_ARCH}" != "sparc" ; then michael@0: MOZ_ENABLE_SKIA_GPU=1 michael@0: AC_DEFINE(USE_SKIA_GPU) michael@0: AC_SUBST(MOZ_ENABLE_SKIA_GPU) michael@0: fi michael@0: fi michael@0: AC_SUBST(MOZ_ENABLE_SKIA) michael@0: michael@0: dnl ======================================================== michael@0: dnl disable xul michael@0: dnl ======================================================== michael@0: MOZ_ARG_DISABLE_BOOL(xul, michael@0: [ --disable-xul Disable XUL], michael@0: MOZ_XUL= ) michael@0: if test "$MOZ_XUL"; then michael@0: AC_DEFINE(MOZ_XUL) michael@0: else michael@0: dnl remove extensions that require XUL michael@0: MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'` michael@0: fi michael@0: michael@0: AC_SUBST(MOZ_XUL) michael@0: michael@0: dnl ======================================================== michael@0: dnl disable profile locking michael@0: dnl do no use this in applications that can have more than michael@0: dnl one process accessing the profile directory. michael@0: dnl ======================================================== michael@0: MOZ_ARG_DISABLE_BOOL(profilelocking, michael@0: [ --disable-profilelocking michael@0: Disable profile locking], michael@0: MOZ_PROFILELOCKING=, michael@0: MOZ_PROFILELOCKING=1 ) michael@0: if test "$MOZ_PROFILELOCKING"; then michael@0: AC_DEFINE(MOZ_PROFILELOCKING) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl necko configuration options michael@0: dnl ======================================================== michael@0: michael@0: dnl michael@0: dnl option to disable various necko protocols michael@0: dnl michael@0: MOZ_ARG_ENABLE_STRING(necko-protocols, michael@0: [ --enable-necko-protocols[={http,ftp,default,all,none}] michael@0: Enable/disable specific protocol handlers], michael@0: [ for option in `echo $enableval | sed 's/,/ /g'`; do michael@0: if test "$option" = "yes" -o "$option" = "all"; then michael@0: NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT" michael@0: elif test "$option" = "no" -o "$option" = "none"; then michael@0: NECKO_PROTOCOLS="" michael@0: elif test "$option" = "default"; then michael@0: NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT" michael@0: elif test `echo "$option" | grep -c \^-` != 0; then michael@0: option=`echo $option | sed 's/^-//'` michael@0: NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"` michael@0: else michael@0: NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option" michael@0: fi michael@0: done], michael@0: NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT") michael@0: dnl Remove dupes michael@0: NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}` michael@0: AC_SUBST_SET(NECKO_PROTOCOLS) michael@0: for p in $NECKO_PROTOCOLS; do michael@0: AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p) michael@0: _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_PROTOCOL_$p" michael@0: done michael@0: michael@0: dnl michael@0: dnl option to disable necko's wifi scanner michael@0: dnl michael@0: michael@0: case "$OS_TARGET" in michael@0: Android) michael@0: if test -n "$gonkdir"; then michael@0: NECKO_WIFI=1 michael@0: fi michael@0: ;; michael@0: Darwin|FreeBSD|SunOS|WINNT) michael@0: NECKO_WIFI=1 michael@0: ;; michael@0: Linux) michael@0: NECKO_WIFI=1 michael@0: NECKO_WIFI_DBUS=1 michael@0: ;; michael@0: esac michael@0: michael@0: MOZ_ARG_DISABLE_BOOL(necko-wifi, michael@0: [ --disable-necko-wifi Disable necko wifi scanner], michael@0: NECKO_WIFI=, michael@0: NECKO_WIFI=1) michael@0: michael@0: if test "$NECKO_WIFI"; then michael@0: if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then michael@0: AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi]) michael@0: fi michael@0: AC_DEFINE(NECKO_WIFI) michael@0: _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI" michael@0: fi michael@0: AC_SUBST(NECKO_WIFI) michael@0: AC_SUBST(NECKO_WIFI_DBUS) michael@0: michael@0: dnl michael@0: dnl option to disable cookies michael@0: dnl michael@0: MOZ_ARG_DISABLE_BOOL(cookies, michael@0: [ --disable-cookies Disable cookie support], michael@0: NECKO_COOKIES=, michael@0: NECKO_COOKIES=1) michael@0: AC_SUBST(NECKO_COOKIES) michael@0: if test "$NECKO_COOKIES"; then michael@0: AC_DEFINE(NECKO_COOKIES) michael@0: _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES" michael@0: fi michael@0: michael@0: dnl michael@0: dnl Always build Marionette if not Android or B2G michael@0: dnl michael@0: if test "$OS_TARGET" != Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then michael@0: AC_DEFINE(ENABLE_MARIONETTE) michael@0: fi michael@0: AC_SUBST(ENABLE_MARIONETTE) michael@0: if test "$ENABLE_MARIONETTE"; then michael@0: AC_DEFINE(ENABLE_MARIONETTE) michael@0: fi michael@0: michael@0: dnl michael@0: dnl Build jsctypes on the platforms we can, unless it's explicitly disabled. michael@0: dnl michael@0: MOZ_ARG_DISABLE_BOOL(ctypes, michael@0: [ --disable-ctypes Disable js-ctypes], michael@0: BUILD_CTYPES=, michael@0: BUILD_CTYPES=1) michael@0: AC_SUBST(BUILD_CTYPES) michael@0: if test "$BUILD_CTYPES"; then michael@0: AC_DEFINE(BUILD_CTYPES) michael@0: fi michael@0: michael@0: dnl Build Places if required michael@0: if test "$MOZ_PLACES"; then michael@0: AC_DEFINE(MOZ_PLACES) michael@0: fi michael@0: michael@0: dnl Build SocialAPI if required michael@0: if test "$MOZ_SOCIAL"; then michael@0: AC_DEFINE(MOZ_SOCIAL) michael@0: fi michael@0: michael@0: dnl Build Common JS modules provided by services. michael@0: AC_SUBST(MOZ_SERVICES_COMMON) michael@0: if test -n "$MOZ_SERVICES_COMMON"; then michael@0: AC_DEFINE(MOZ_SERVICES_COMMON) michael@0: fi michael@0: michael@0: dnl Build Services crypto component (used by Sync) michael@0: AC_SUBST(MOZ_SERVICES_CRYPTO) michael@0: if test -n "$MOZ_SERVICES_CRYPTO"; then michael@0: AC_DEFINE(MOZ_SERVICES_CRYPTO) michael@0: fi michael@0: michael@0: dnl Build Firefox Health Reporter Service michael@0: AC_SUBST(MOZ_SERVICES_HEALTHREPORT) michael@0: if test -n "$MOZ_SERVICES_HEALTHREPORT"; then michael@0: AC_DEFINE(MOZ_SERVICES_HEALTHREPORT) michael@0: fi michael@0: michael@0: dnl Build Services metrics component michael@0: AC_SUBST(MOZ_SERVICES_METRICS) michael@0: if test -n "$MOZ_SERVICES_METRICS"; then michael@0: AC_DEFINE(MOZ_SERVICES_METRICS) michael@0: fi michael@0: michael@0: dnl Build Notifications if required michael@0: AC_SUBST(MOZ_SERVICES_NOTIFICATIONS) michael@0: if test -n "$MOZ_SERVICES_NOTIFICATIONS"; then michael@0: AC_DEFINE(MOZ_SERVICES_NOTIFICATIONS) michael@0: fi michael@0: michael@0: dnl Build Sync Services if required michael@0: AC_SUBST(MOZ_SERVICES_SYNC) michael@0: if test -n "$MOZ_SERVICES_SYNC"; then michael@0: AC_DEFINE(MOZ_SERVICES_SYNC) michael@0: fi michael@0: michael@0: dnl Build Captive Portal Detector if required michael@0: AC_SUBST(MOZ_CAPTIVEDETECT) michael@0: if test -n "$MOZ_CAPTIVEDETECT"; then michael@0: AC_DEFINE(MOZ_CAPTIVEDETECT) michael@0: fi michael@0: michael@0: dnl ======================================================== 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: if test "$MOZ_APP_COMPONENT_INCLUDE"; then michael@0: AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE") michael@0: fi michael@0: michael@0: if test "$MOZ_APP_COMPONENT_MODULES"; then michael@0: AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_MODULES, $MOZ_APP_COMPONENT_MODULES) michael@0: fi michael@0: 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_WIDGET_TOOLKIT) michael@0: AC_SUBST(MOZ_UPDATE_XTERM) michael@0: AC_SUBST(MOZ_AUTH_EXTENSION) michael@0: AC_SUBST(MOZ_PERMISSIONS) michael@0: AC_SUBST(MOZ_PREF_EXTENSIONS) michael@0: AC_SUBST(MOZ_JS_LIBS) 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_EXTENSIONS) michael@0: AC_SUBST(MOZ_JSDEBUGGER) michael@0: AC_SUBST(MOZ_ENABLE_PROFILER_SPS) 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: AC_SUBST(MOZ_PLACES) michael@0: AC_SUBST(MOZ_SOCIAL) michael@0: AC_SUBST(MOZ_TOOLKIT_SEARCH) michael@0: AC_SUBST(MOZ_FEEDS) michael@0: AC_SUBST(NS_PRINTING) michael@0: AC_SUBST(MOZ_WEBGL) michael@0: AC_SUBST(MOZ_HELP_VIEWER) michael@0: AC_SUBST(TOOLCHAIN_PREFIX) michael@0: michael@0: AC_SUBST(JAVA) michael@0: AC_SUBST(JAVAC) michael@0: AC_SUBST(JAVAH) michael@0: AC_SUBST(JAR) michael@0: AC_SUBST(JARSIGNER) michael@0: AC_SUBST(KEYTOOL) michael@0: michael@0: AC_SUBST(MOZ_PROFILELOCKING) michael@0: michael@0: AC_SUBST(ENABLE_TESTS) michael@0: AC_SUBST(MOZ_UNIVERSALCHARDET) michael@0: AC_SUBST(ACCESSIBILITY) michael@0: AC_SUBST(MOZ_SPELLCHECK) michael@0: AC_SUBST(MOZ_ANDROID_OMTC) michael@0: AC_SUBST(MOZ_ANDROID_ANR_REPORTER) michael@0: AC_SUBST(MOZ_CRASHREPORTER) michael@0: AC_SUBST(MOZ_CRASHREPORTER_INJECTOR) michael@0: AC_SUBST(MOZ_CRASHREPORTER_UPLOAD_FULL_SYMBOLS) michael@0: AC_SUBST(MOZ_MAINTENANCE_SERVICE) michael@0: AC_SUBST(MOZ_STUB_INSTALLER) michael@0: AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE) michael@0: AC_SUBST(MOZ_ENABLE_SIGNMAR) michael@0: AC_SUBST(MOZ_UPDATER) michael@0: michael@0: AC_SUBST(MOZ_ANGLE_RENDERER) michael@0: AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX) michael@0: AC_SUBST(MOZ_DIRECTX_SDK_PATH) michael@0: AC_SUBST(MOZ_D3DCOMPILER_DLL) michael@0: AC_SUBST(MOZ_HAS_WINSDK_WITH_D3D) michael@0: AC_SUBST(MOZ_D3DCOMPILER_DLL_PATH) michael@0: AC_SUBST(MOZ_D3DCOMPILER_CAB) michael@0: michael@0: AC_SUBST(MOZ_METRO) michael@0: michael@0: AC_SUBST(MOZ_ANDROID_HISTORY) michael@0: AC_SUBST(MOZ_WEBSMS_BACKEND) michael@0: AC_SUBST(MOZ_ANDROID_BEAM) michael@0: AC_SUBST(MOZ_ANDROID_SYNTHAPKS) michael@0: AC_SUBST(MOZ_DISABLE_GECKOVIEW) michael@0: AC_SUBST(ENABLE_STRIP) michael@0: AC_SUBST(PKG_SKIP_STRIP) michael@0: AC_SUBST(STRIP_FLAGS) michael@0: AC_SUBST(USE_ELF_HACK) 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: AC_SUBST(XPCOM_LIBS) michael@0: AC_SUBST(XPCOM_FROZEN_LDOPTS) michael@0: AC_SUBST(XPCOM_GLUE_LDOPTS) michael@0: AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS) michael@0: AC_SUBST(XPCOM_STATICRUNTIME_GLUE_LDOPTS) michael@0: AC_SUBST(XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS) 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: AC_SUBST(MOZ_LINKER_EXTRACT) michael@0: michael@0: AC_SUBST(MOZ_JSDOWNLOADS) michael@0: if test -n "$MOZ_JSDOWNLOADS"; then michael@0: AC_DEFINE(MOZ_JSDOWNLOADS) michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = Mac bundle name prefix michael@0: dnl ======================================================== michael@0: MOZ_ARG_WITH_STRING(macbundlename-prefix, michael@0: [ --with-macbundlename-prefix=prefix michael@0: Prefix for MOZ_MACBUNDLE_NAME], michael@0: [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"]) michael@0: michael@0: MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '` michael@0: if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then michael@0: MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}" michael@0: fi michael@0: michael@0: if test "$MOZ_DEBUG"; then michael@0: MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app michael@0: else michael@0: MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app michael@0: fi michael@0: AC_SUBST(MOZ_MACBUNDLE_NAME) michael@0: michael@0: dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME) michael@0: MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'` michael@0: MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID} michael@0: if test "$MOZ_DEBUG"; then michael@0: MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug michael@0: fi michael@0: michael@0: AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID) michael@0: AC_SUBST(MOZ_MACBUNDLE_ID) michael@0: michael@0: dnl ======================================================== michael@0: dnl = Child Process Name for IPC michael@0: dnl ======================================================== michael@0: if test "$MOZ_WIDGET_TOOLKIT" != "android"; then michael@0: MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}" michael@0: else michael@0: # We want to let Android unpack the file at install time, but it only does michael@0: # so if the file is named libsomething.so. The lib/ path is also required michael@0: # because the unpacked file will be under the lib/ subdirectory and will michael@0: # need to be executed from that path. michael@0: MOZ_CHILD_PROCESS_NAME="lib/libplugin-container.so" michael@0: fi michael@0: MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/" michael@0: michael@0: AC_SUBST(MOZ_CHILD_PROCESS_NAME) michael@0: AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE) michael@0: michael@0: # The following variables are available to branding and application michael@0: # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh): michael@0: # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also michael@0: # impacts profile location and user-visible fields. michael@0: # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded michael@0: # versions of a given application (e.g. Aurora and Firefox both use michael@0: # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used michael@0: # for application.ini's "Name" field, which controls profile location in michael@0: # the absence of a "Profile" field (see below), and various system michael@0: # integration hooks (Unix remoting, Windows MessageWindow name, etc.) michael@0: # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties, michael@0: # Mac Bundle name, Updater, Installer), it is typically used for nightly michael@0: # builds (e.g. Aurora for Firefox). michael@0: # - MOZ_APP_VERSION: Defines the application version number. michael@0: # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set, michael@0: # defaults to a lowercase form of MOZ_APP_BASENAME. michael@0: # - MOZ_APP_PROFILE: When set, used for application.ini's michael@0: # "Profile" field, which controls profile location. michael@0: # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and michael@0: # crash reporter server url. michael@0: # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator. michael@0: # - MOZ_EXTENSION_MANAGER: When set, enabled extension manager. michael@0: michael@0: if test -z "$MOZ_APP_NAME"; then michael@0: MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z` michael@0: fi michael@0: michael@0: # For extensions and langpacks, we require a max version that is compatible michael@0: # across security releases. MOZ_APP_MAXVERSION is our method for doing that. michael@0: # 24.0a1 and 24.0a2 aren't affected michael@0: # 24.0 becomes 24.* michael@0: # 24.1.1 becomes 24.* michael@0: IS_ALPHA=`echo $MOZ_APP_VERSION | grep a` michael@0: if test -z "$IS_ALPHA"; then michael@0: changequote(,) michael@0: MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.* michael@0: changequote([,]) michael@0: else michael@0: MOZ_APP_MAXVERSION=$MOZ_APP_VERSION michael@0: fi michael@0: michael@0: MOZ_B2G_VERSION=${MOZ_B2G_VERSION:-"1.0.0"} michael@0: AC_DEFINE_UNQUOTED(MOZ_B2G_VERSION,"$MOZ_B2G_VERSION") michael@0: AC_DEFINE_UNQUOTED(MOZ_B2G_OS_NAME,"$MOZ_B2G_OS_NAME") michael@0: michael@0: AC_SUBST(MOZ_APP_NAME) michael@0: AC_SUBST(MOZ_APP_DISPLAYNAME) michael@0: AC_SUBST(MOZ_APP_BASENAME) michael@0: AC_SUBST(MOZ_APP_VENDOR) michael@0: AC_SUBST(MOZ_APP_PROFILE) michael@0: AC_SUBST(MOZ_APP_ID) michael@0: AC_SUBST(MAR_CHANNEL_ID) michael@0: AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS) michael@0: AC_SUBST(MOZ_PROFILE_MIGRATOR) michael@0: AC_SUBST(MOZ_EXTENSION_MANAGER) michael@0: AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME") michael@0: AC_SUBST(MOZ_APP_UA_NAME) michael@0: AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION") michael@0: AC_SUBST(MOZ_APP_VERSION) michael@0: AC_SUBST(MOZ_APP_MAXVERSION) michael@0: AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION) michael@0: AC_SUBST(FIREFOX_VERSION) michael@0: AC_SUBST(MOZ_UA_OS_AGNOSTIC) michael@0: if test -n "$MOZ_UA_OS_AGNOSTIC"; then michael@0: AC_DEFINE(MOZ_UA_OS_AGNOSTIC) michael@0: fi michael@0: michael@0: AC_SUBST(MOZ_APP_STATIC_INI) michael@0: michael@0: AC_SUBST(MOZ_PKG_SPECIAL) michael@0: michael@0: AC_SUBST(MOZILLA_OFFICIAL) michael@0: michael@0: AC_DEFINE_UNQUOTED(MOZ_TELEMETRY_DISPLAY_REV, 2) michael@0: AC_SUBST(MOZ_TELEMETRY_DISPLAY_REV) michael@0: michael@0: if test "$MOZ_TELEMETRY_REPORTING"; then michael@0: AC_DEFINE(MOZ_TELEMETRY_REPORTING) michael@0: michael@0: # Enable Telemetry by default for nightly and aurora channels michael@0: if test -z "$RELEASE_BUILD"; then michael@0: AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT) michael@0: fi michael@0: fi michael@0: michael@0: dnl If we have any service that uploads data (and requires data submission michael@0: dnl policy alert), set MOZ_DATA_REPORTING. michael@0: dnl We need SUBST for build system and DEFINE for xul preprocessor. michael@0: if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then michael@0: MOZ_DATA_REPORTING=1 michael@0: AC_DEFINE(MOZ_DATA_REPORTING) michael@0: AC_SUBST(MOZ_DATA_REPORTING) michael@0: fi michael@0: michael@0: dnl win32 options michael@0: AC_SUBST(MOZ_BROWSE_INFO) michael@0: AC_SUBST(MOZ_TOOLS_DIR) michael@0: AC_SUBST(WIN32_REDIST_DIR) michael@0: AC_SUBST(MAKENSISU) 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(SYSTEM_LIBXUL) michael@0: AC_SUBST(MOZ_NATIVE_JPEG) michael@0: AC_SUBST(MOZ_NATIVE_PNG) michael@0: AC_SUBST(MOZ_NATIVE_BZ2) michael@0: michael@0: AC_SUBST(MOZ_JPEG_CFLAGS) michael@0: AC_SUBST(MOZ_JPEG_LIBS) michael@0: AC_SUBST(MOZ_BZ2_CFLAGS) michael@0: AC_SUBST(MOZ_BZ2_LIBS) michael@0: AC_SUBST(MOZ_PNG_CFLAGS) michael@0: AC_SUBST(MOZ_PNG_LIBS) michael@0: michael@0: if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then michael@0: export MOZ_NUWA_PROCESS michael@0: AC_DEFINE(MOZ_NUWA_PROCESS) michael@0: fi michael@0: AC_SUBST(MOZ_NUWA_PROCESS) 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: AC_SUBST(NSS_CFLAGS) michael@0: AC_SUBST(NSS_LIBS) michael@0: AC_SUBST(MOZ_NATIVE_NSS) michael@0: AC_SUBST(NSS_DISABLE_DBM) 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(WCHAR_CFLAGS) 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: AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3) michael@0: AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1) michael@0: michael@0: AC_SUBST(MOZ_CHROME_FILE_FORMAT) 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(NS_ENABLE_TSF) michael@0: AC_SUBST(MOZ_NSS_PATCH) michael@0: AC_SUBST(MOZ_APP_COMPONENT_LIBS) michael@0: AC_SUBST(MOZ_APP_EXTRA_LIBS) michael@0: michael@0: AC_SUBST(MOZ_WAVE) michael@0: AC_SUBST(MOZ_VORBIS) michael@0: AC_SUBST(MOZ_TREMOR) michael@0: AC_SUBST(MOZ_OPUS) michael@0: AC_SUBST(MOZ_WEBM) michael@0: AC_SUBST(MOZ_WMF) michael@0: AC_SUBST(MOZ_FFMPEG) michael@0: AC_SUBST(MOZ_FMP4) michael@0: AC_SUBST(MOZ_DIRECTSHOW) michael@0: AC_SUBST(MOZ_MEDIA_PLUGINS) michael@0: AC_SUBST(MOZ_APPLEMEDIA) michael@0: AC_SUBST(MOZ_OMX_PLUGIN) michael@0: AC_SUBST(MOZ_VPX_ERROR_CONCEALMENT) michael@0: AC_SUBST(MOZ_VPX) michael@0: AC_SUBST(VPX_AS) michael@0: AC_SUBST(VPX_ASFLAGS) michael@0: AC_SUBST(VPX_DASH_C_FLAG) michael@0: AC_SUBST(VPX_AS_CONVERSION) michael@0: AC_SUBST(VPX_ASM_SUFFIX) michael@0: AC_SUBST(VPX_X86_ASM) michael@0: AC_SUBST(VPX_ARM_ASM) michael@0: AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT) michael@0: AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP) michael@0: AC_SUBST(LIBJPEG_TURBO_AS) michael@0: AC_SUBST(LIBJPEG_TURBO_ASFLAGS) michael@0: AC_SUBST(LIBJPEG_TURBO_X86_ASM) michael@0: AC_SUBST(LIBJPEG_TURBO_X64_ASM) michael@0: AC_SUBST(LIBJPEG_TURBO_ARM_ASM) michael@0: michael@0: AC_SUBST(MOZ_PACKAGE_JSSHELL) michael@0: AC_SUBST(MOZ_FOLD_LIBS) michael@0: michael@0: AC_SUBST(MOZ_ENABLE_SZIP) michael@0: AC_SUBST(MOZ_SZIP_FLAGS) michael@0: michael@0: if test "$MOZ_DEBUG"; then michael@0: MOZ_EM_DEBUG=1 michael@0: fi michael@0: AC_SUBST(MOZ_EM_DEBUG) michael@0: michael@0: if test -n "$COMPILE_ENVIRONMENT"; then michael@0: AC_CHECK_FUNCS(posix_fadvise posix_fallocate) michael@0: michael@0: dnl Check for missing components michael@0: if test "$MOZ_X11"; then michael@0: if test "$WITHOUT_X11"; then michael@0: AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined]) michael@0: fi 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: #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: 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" != "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: if test "$MOZ_DEBUG"; then michael@0: A11Y_LOG=1 michael@0: fi michael@0: case "$MOZ_UPDATE_CHANNEL" in michael@0: aurora|beta|release|esr) michael@0: ;; michael@0: *) michael@0: A11Y_LOG=1 michael@0: ;; michael@0: esac michael@0: AC_SUBST(A11Y_LOG) michael@0: if test -n "$A11Y_LOG"; then michael@0: AC_DEFINE(A11Y_LOG) michael@0: fi michael@0: michael@0: AC_SUBST(MOZILLA_VERSION) michael@0: michael@0: AC_SUBST(ac_configure_args) michael@0: michael@0: dnl Spit out some output michael@0: dnl ======================================================== michael@0: michael@0: dnl The following defines are used by xpcom michael@0: _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES michael@0: CPP_THROW_NEW michael@0: HAVE_CPP_AMBIGUITY_RESOLVING_USING michael@0: HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR michael@0: HAVE_CPP_PARTIAL_SPECIALIZATION michael@0: HAVE_CPP_TROUBLE_COMPARING_TO_ZERO michael@0: NEED_CPP_UNUSED_IMPLEMENTATIONS michael@0: HAVE_GETPAGESIZE michael@0: HAVE_ICONV michael@0: HAVE_ICONV_WITH_CONST_INPUT michael@0: HAVE_MBRTOWC michael@0: HAVE_WCRTOMB michael@0: HAVE_STATVFS64 michael@0: HAVE_STATVFS michael@0: HAVE_STATFS64 michael@0: HAVE_STATFS michael@0: HAVE_SYS_STATVFS_H michael@0: HAVE_SYS_STATFS_H michael@0: HAVE_SYS_VFS_H michael@0: HAVE_SYS_MOUNT_H michael@0: " michael@0: michael@0: AC_SUBST(STLPORT_LIBS) michael@0: michael@0: dnl ======================================================== michael@0: dnl ICU Support michael@0: dnl ======================================================== michael@0: michael@0: if test "$MOZ_BUILD_APP" = "browser"; then michael@0: _INTL_API=yes michael@0: else michael@0: # Internationalization isn't built or exposed by default in non-desktop michael@0: # builds. Bugs to enable: michael@0: # michael@0: # Android: bug 864843 michael@0: # B2G: bug 866301 michael@0: _INTL_API=no michael@0: fi michael@0: michael@0: MOZ_CONFIG_ICU() michael@0: michael@0: if test -n "$MOZ_NATIVE_ICU"; then michael@0: MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_ICU_LIBS" michael@0: fi michael@0: michael@0: if test -n "$JS_SHARED_LIBRARY"; then michael@0: MOZ_JS_LIBS="$MOZ_JS_SHARED_LIBS" michael@0: else michael@0: MOZ_JS_LIBS="$MOZ_JS_STATIC_LIBS" michael@0: AC_DEFINE(MOZ_STATIC_JS) michael@0: fi michael@0: AC_SUBST(JS_SHARED_LIBRARY) michael@0: michael@0: MOZ_CREATE_CONFIG_STATUS() michael@0: michael@0: # No need to run subconfigures when building with LIBXUL_SDK_DIR michael@0: if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then michael@0: MOZ_SUBCONFIGURE_ICU() michael@0: MOZ_SUBCONFIGURE_FFI() michael@0: fi michael@0: michael@0: # Hack around an Apple bug that affects the egrep that comes with OS X 10.7. michael@0: # "env ARCHPREFERENCE=i386,x86_64 arch egrep" first tries to use the 32-bit michael@0: # Intel part of the egrep fat binary, even on 64-bit systems, and falls back on michael@0: # the 64-bit part if it's not a fat binary, as can happen with MacPorts. We michael@0: # (apparently) only need this hack when egrep's "pattern" is particularly long michael@0: # (as in the following code) and the first egrep on our $PATH is Apple's. See michael@0: # bug 655339. michael@0: case "$host" in michael@0: *-apple-darwin11*) michael@0: FIXED_EGREP="env ARCHPREFERENCE=i386,x86_64 arch egrep" michael@0: ;; michael@0: *) michael@0: FIXED_EGREP="egrep" michael@0: ;; michael@0: esac michael@0: michael@0: # Run jemalloc configure script michael@0: michael@0: if test -z "$MOZ_NATIVE_JEMALLOC" -a "$MOZ_MEMORY" && test -n "$MOZ_JEMALLOC3" -o -n "$MOZ_REPLACE_MALLOC"; then michael@0: ac_configure_args="--build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_" michael@0: if test -n "$MOZ_REPLACE_MALLOC"; then michael@0: # When using replace_malloc, we always want memalign and valloc exported from jemalloc. michael@0: ac_configure_args="$ac_configure_args ac_cv_func_memalign=yes" michael@0: ac_configure_args="$ac_configure_args ac_cv_func_valloc=yes" michael@0: fi michael@0: if test -n "$MOZ_JEMALLOC3"; then michael@0: case "${OS_ARCH}" in michael@0: WINNT|Darwin) michael@0: # We want jemalloc functions to be kept hidden on both Mac and Windows michael@0: # See memory/build/mozmemory_wrap.h for details. michael@0: ac_configure_args="$ac_configure_args --without-export" michael@0: ;; michael@0: esac michael@0: elif test "${OS_ARCH}" = Darwin; then michael@0: # When building as a replace-malloc lib, disabling the zone allocator michael@0: # forces to use pthread_atfork. michael@0: ac_configure_args="$ac_configure_args --disable-zone-allocator" michael@0: fi michael@0: _MANGLE="malloc posix_memalign aligned_alloc calloc realloc free memalign valloc malloc_usable_size" michael@0: JEMALLOC_WRAPPER= michael@0: if test -z "$MOZ_REPLACE_MALLOC"; then michael@0: case "$OS_ARCH" in michael@0: Linux|DragonFly|FreeBSD|NetBSD|OpenBSD) michael@0: MANGLE=$_MANGLE michael@0: ;; michael@0: esac michael@0: elif test -z "$MOZ_JEMALLOC3"; then michael@0: MANGLE=$_MANGLE michael@0: JEMALLOC_WRAPPER=replace_ michael@0: fi michael@0: if test -n "$MANGLE"; then michael@0: MANGLED= michael@0: if test -n "$_WRAP_MALLOC" -a -z "$JEMALLOC_WRAPPER"; then michael@0: JEMALLOC_WRAPPER=__wrap_ michael@0: fi michael@0: for mangle in ${MANGLE}; do michael@0: if test -n "$MANGLED"; then michael@0: MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED" michael@0: else michael@0: MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle" michael@0: fi michael@0: done michael@0: ac_configure_args="$ac_configure_args --with-mangling=$MANGLED" michael@0: fi michael@0: unset CONFIG_FILES michael@0: if test -z "$MOZ_TLS"; then michael@0: ac_configure_args="$ac_configure_args --disable-tls" michael@0: fi michael@0: EXTRA_CFLAGS="$CFLAGS" michael@0: for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do michael@0: ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'" michael@0: done michael@0: if test "$CROSS_COMPILE"; then michael@0: ac_configure_args="$ac_configure_args je_cv_static_page_shift=12" michael@0: fi michael@0: _save_cache_file="$cache_file" michael@0: cache_file=$_objdir/memory/jemalloc/src/config.cache michael@0: michael@0: if ! test -e memory/jemalloc; then michael@0: mkdir -p memory/jemalloc michael@0: fi michael@0: michael@0: AC_OUTPUT_SUBDIRS(memory/jemalloc/src) michael@0: cache_file="$_save_cache_file" michael@0: ac_configure_args="$_SUBDIR_CONFIG_ARGS" michael@0: fi michael@0: michael@0: # Run freetype configure script michael@0: michael@0: if test "$MOZ_TREE_FREETYPE"; then michael@0: export CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS -std=c99" michael@0: export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS" michael@0: export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS" michael@0: export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS" michael@0: # Spaces in the *_CFLAGS and *_LIBS variables are intentionally placed michael@0: # to force freetype to use our settings rather than autodetecting michael@0: export LIBPNG_CFLAGS="$MOZ_PNG_CFLAGS " michael@0: export LIBPNG_LIBS="$MOZ_PNG_LIBS " michael@0: export ZLIB_CFLAGS="$MOZ_ZLIB_CFLAGS " michael@0: export ZLIB_LIBS="$MOZ_ZLIB_LIBS " michael@0: export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in" michael@0: ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes --with-zlib=yes --without-bzip2 --with-png=yes --without-harfbuzz" michael@0: michael@0: if ! test -e modules; then michael@0: mkdir modules michael@0: fi michael@0: # Only export CC, CXX and RANLIB for the subconfigure, and avoid spilling michael@0: # that further down the road. michael@0: (export CC CXX RANLIB; michael@0: AC_OUTPUT_SUBDIRS(modules/freetype2) michael@0: ) || exit 1 michael@0: fi michael@0: michael@0: if test -z "$direct_nspr_config"; then michael@0: dnl ======================================================== michael@0: dnl = Setup a nice relatively clean build environment for michael@0: dnl = sub-configures. michael@0: dnl ======================================================== michael@0: CC="$_SUBDIR_CC" michael@0: CXX="$_SUBDIR_CXX" michael@0: CFLAGS="$_SUBDIR_CFLAGS" michael@0: CPPFLAGS="$_SUBDIR_CPPFLAGS" michael@0: CXXFLAGS="$_SUBDIR_CXXFLAGS" michael@0: LDFLAGS="$_SUBDIR_LDFLAGS" michael@0: HOST_CC="$_SUBDIR_HOST_CC" michael@0: HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS" michael@0: HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS" michael@0: RC= michael@0: fi michael@0: michael@0: unset MAKEFILES michael@0: unset CONFIG_FILES michael@0: michael@0: # Run all configure scripts specified by a subconfigure michael@0: if test -n "$_subconfigure_subdir"; then michael@0: _save_ac_configure_args="$ac_configure_args" michael@0: ac_configure_args="$_subconfigure_config_args" michael@0: AC_OUTPUT_SUBDIRS("$_subconfigure_subdir") michael@0: ac_configure_args="$_save_ac_configure_args" michael@0: fi michael@0: michael@0: # No need to run subconfigures when building with LIBXUL_SDK_DIR michael@0: if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then michael@0: michael@0: export WRAP_LDFLAGS michael@0: michael@0: if test -n "$_WRAP_MALLOC"; then michael@0: # Avoid doubling wrap malloc arguments michael@0: _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--enable-wrap-malloc *//'`" michael@0: fi michael@0: michael@0: if test -z "$MOZ_NATIVE_NSPR"; then michael@0: ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla" michael@0: if test -z "$MOZ_DEBUG"; then michael@0: ac_configure_args="$ac_configure_args --disable-debug" michael@0: else michael@0: ac_configure_args="$ac_configure_args --enable-debug" michael@0: fi michael@0: if test "$MOZ_OPTIMIZE" = "1"; then michael@0: ac_configure_args="$ac_configure_args --enable-optimize" michael@0: elif test -z "$MOZ_OPTIMIZE"; then michael@0: ac_configure_args="$ac_configure_args --disable-optimize" michael@0: fi michael@0: if test -n "$HAVE_64BIT_OS"; then michael@0: ac_configure_args="$ac_configure_args --enable-64bit" michael@0: fi michael@0: if test -n "$USE_ARM_KUSER"; then michael@0: ac_configure_args="$ac_configure_args --with-arm-kuser" michael@0: fi michael@0: # A configure script generated by autoconf 2.68 does not allow the cached michael@0: # values of "precious" variables such as CFLAGS and LDFLAGS to differ from michael@0: # the values passed to the configure script. Since we modify CFLAGS and michael@0: # LDFLAGS before passing them to NSPR's configure script, we cannot share michael@0: # config.cache with NSPR. As a result, we cannot pass AS, CC, CXX, etc. to michael@0: # NSPR via a shared config.cache file and must pass them to NSPR on the michael@0: # configure command line. michael@0: for var in AS CC CXX CPP LD AR RANLIB STRIP; do michael@0: ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'" michael@0: done michael@0: # A configure script generated by autoconf 2.68 warns if --host is michael@0: # specified but --build isn't. So we always pass --build to NSPR's michael@0: # configure script. michael@0: ac_configure_args="$ac_configure_args --build=$build" michael@0: ac_configure_args="$ac_configure_args $NSPR_CONFIGURE_ARGS" michael@0: michael@0: # Save these, so we can mess with them for the subconfigure .. michael@0: _SAVE_CFLAGS="$CFLAGS" michael@0: _SAVE_CPPFLAGS="$CPPFLAGS" michael@0: _SAVE_LDFLAGS="$LDFLAGS" michael@0: michael@0: if test -n "$MOZ_LINKER" -a "$ac_cv_func_dladdr" = no ; then michael@0: # dladdr is supported by the new linker, even when the system linker doesn't michael@0: # support it. Trick nspr into using dladdr when it's not supported. michael@0: export CPPFLAGS="-include $_topsrcdir/mozglue/linker/dladdr.h $CPPFLAGS" michael@0: fi michael@0: export LDFLAGS="$LDFLAGS $NSPR_LDFLAGS" michael@0: export CFLAGS="$CFLAGS $MOZ_FRAMEPTR_FLAGS" michael@0: michael@0: # Use a separate cache file for NSPR since it uses autoconf 2.68. michael@0: _save_cache_file="$cache_file" michael@0: cache_file=$_objdir/nsprpub/config.cache michael@0: michael@0: AC_OUTPUT_SUBDIRS(nsprpub) michael@0: michael@0: # .. and restore them michael@0: cache_file="$_save_cache_file" michael@0: CFLAGS="$_SAVE_CFLAGS" michael@0: CPPFLAGS="$_SAVE_CPPFLAGS" michael@0: LDFLAGS="$_SAVE_LDFLAGS" michael@0: michael@0: ac_configure_args="$_SUBDIR_CONFIG_ARGS" michael@0: fi michael@0: michael@0: dnl ======================================================== michael@0: dnl = Setup a nice relatively clean build environment for michael@0: dnl = sub-configures. michael@0: dnl ======================================================== michael@0: CC="$_SUBDIR_CC" michael@0: CXX="$_SUBDIR_CXX" michael@0: CFLAGS="$_SUBDIR_CFLAGS" michael@0: CPPFLAGS="$_SUBDIR_CPPFLAGS" michael@0: CXXFLAGS="$_SUBDIR_CXXFLAGS" michael@0: LDFLAGS="$_SUBDIR_LDFLAGS" michael@0: HOST_CC="$_SUBDIR_HOST_CC" michael@0: HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS" michael@0: HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS" michael@0: RC= michael@0: michael@0: if test -n "$ENABLE_CLANG_PLUGIN"; then michael@0: ac_configure_args="$_SUBDIR_CONFIG_ARGS" michael@0: AC_OUTPUT_SUBDIRS(build/clang-plugin) michael@0: fi michael@0: michael@0: michael@0: # Run the SpiderMonkey 'configure' script. michael@0: dist=$MOZ_BUILD_ROOT/dist michael@0: ac_configure_args="$_SUBDIR_CONFIG_ARGS" michael@0: ac_configure_args="$ac_configure_args --enable-threadsafe" michael@0: michael@0: if test "$_INTL_API" = no; then michael@0: ac_configure_args="$ac_configure_args --without-intl-api" michael@0: fi michael@0: michael@0: if test "$BUILD_CTYPES"; then michael@0: # Build js-ctypes on the platforms we can. michael@0: ac_configure_args="$ac_configure_args --enable-ctypes" michael@0: fi michael@0: if test -z "$JS_SHARED_LIBRARY" ; then michael@0: ac_configure_args="$ac_configure_args --disable-shared-js" michael@0: if test -n "$MOZ_DISABLE_EXPORT_JS"; then michael@0: ac_configure_args="$ac_configure_args --disable-export-js" michael@0: fi michael@0: fi michael@0: if test -z "$MOZ_NATIVE_NSPR"; then michael@0: ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'" michael@0: ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'" michael@0: fi michael@0: ac_configure_args="$ac_configure_args --prefix=$dist" michael@0: if test "$MOZ_MEMORY"; then michael@0: ac_configure_args="$ac_configure_args --enable-jemalloc" michael@0: fi michael@0: if test -n "$MOZ_GLUE_LDFLAGS"; then michael@0: export MOZ_GLUE_LDFLAGS michael@0: fi michael@0: if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then michael@0: export MOZ_GLUE_PROGRAM_LDFLAGS michael@0: fi michael@0: if test -n "$ZLIB_IN_MOZGLUE"; then michael@0: MOZ_ZLIB_LIBS= michael@0: fi michael@0: export MOZ_NATIVE_ZLIB michael@0: export MOZ_ZLIB_CFLAGS michael@0: export MOZ_ZLIB_LIBS michael@0: export MOZ_APP_NAME michael@0: export DONT_POPULATE_VIRTUALENV=1 michael@0: export PYTHON michael@0: export MOZILLA_CENTRAL_PATH=$_topsrcdir michael@0: export STLPORT_CPPFLAGS michael@0: export STLPORT_LDFLAGS michael@0: export STLPORT_LIBS michael@0: export JS_STANDALONE=no michael@0: export MOZ_LINKER michael@0: export ZLIB_IN_MOZGLUE michael@0: michael@0: if ! test -e js; then michael@0: mkdir js michael@0: fi michael@0: michael@0: AC_OUTPUT_SUBDIRS(js/src) michael@0: ac_configure_args="$_SUBDIR_CONFIG_ARGS" michael@0: michael@0: fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR michael@0: michael@0: export WRITE_MOZINFO=1 michael@0: dnl we need to run config.status after js/src subconfigure because we're michael@0: dnl traversing its moz.build and we need its config.status for that. michael@0: dnl However, writing our own config.status needs to happen before michael@0: dnl subconfigures because the setup surrounding subconfigures alters michael@0: dnl many AC_SUBSTed variables. michael@0: MOZ_RUN_CONFIG_STATUS() michael@0: unset WRITE_MOZINFO