configure.in

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/configure.in	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,9264 @@
     1.4 +
     1.5 +dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
     1.6 +dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
     1.7 +dnl This Source Code Form is subject to the terms of the Mozilla Public
     1.8 +dnl License, v. 2.0. If a copy of the MPL was not distributed with this
     1.9 +dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
    1.10 +
    1.11 +dnl Process this file with autoconf to produce a configure script.
    1.12 +dnl ========================================================
    1.13 +
    1.14 +AC_PREREQ(2.13)
    1.15 +AC_INIT(config/config.mk)
    1.16 +AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
    1.17 +AC_CANONICAL_SYSTEM
    1.18 +TARGET_CPU="${target_cpu}"
    1.19 +TARGET_VENDOR="${target_vendor}"
    1.20 +TARGET_OS="${target_os}"
    1.21 +
    1.22 +dnl ========================================================
    1.23 +dnl =
    1.24 +dnl = Don't change the following two lines.  Doing so breaks:
    1.25 +dnl =
    1.26 +dnl = CFLAGS="-foo" ./configure
    1.27 +dnl =
    1.28 +dnl ========================================================
    1.29 +CFLAGS="${CFLAGS=}"
    1.30 +CPPFLAGS="${CPPFLAGS=}"
    1.31 +CXXFLAGS="${CXXFLAGS=}"
    1.32 +LDFLAGS="${LDFLAGS=}"
    1.33 +HOST_CFLAGS="${HOST_CFLAGS=}"
    1.34 +HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
    1.35 +HOST_LDFLAGS="${HOST_LDFLAGS=}"
    1.36 +
    1.37 +dnl ========================================================
    1.38 +dnl = Preserve certain environment flags passed to configure
    1.39 +dnl = We want sub projects to receive the same flags
    1.40 +dnl = untainted by this configure script
    1.41 +dnl ========================================================
    1.42 +_SUBDIR_CC="$CC"
    1.43 +_SUBDIR_CXX="$CXX"
    1.44 +_SUBDIR_CFLAGS="$CFLAGS"
    1.45 +_SUBDIR_CPPFLAGS="$CPPFLAGS"
    1.46 +_SUBDIR_CXXFLAGS="$CXXFLAGS"
    1.47 +_SUBDIR_LDFLAGS="$LDFLAGS"
    1.48 +_SUBDIR_HOST_CC="$HOST_CC"
    1.49 +_SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
    1.50 +_SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
    1.51 +_SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
    1.52 +_SUBDIR_CONFIG_ARGS="$ac_configure_args"
    1.53 +
    1.54 +dnl Set the version number of the libs included with mozilla
    1.55 +dnl ========================================================
    1.56 +MOZJPEG=62
    1.57 +MOZPNG=10610
    1.58 +NSPR_VERSION=4
    1.59 +NSS_VERSION=3
    1.60 +
    1.61 +dnl Set the minimum version of toolkit libs used by mozilla
    1.62 +dnl ========================================================
    1.63 +GLIB_VERSION=1.2.0
    1.64 +PERL_VERSION=5.006
    1.65 +CAIRO_VERSION=1.10
    1.66 +PANGO_VERSION=1.22.0
    1.67 +GTK2_VERSION=2.10.0
    1.68 +GTK3_VERSION=3.0.0
    1.69 +WINDRES_VERSION=2.14.90
    1.70 +W32API_VERSION=3.14
    1.71 +GNOMEVFS_VERSION=2.0
    1.72 +GNOMEUI_VERSION=2.2.0
    1.73 +GCONF_VERSION=1.2.1
    1.74 +GIO_VERSION=2.20
    1.75 +STARTUP_NOTIFICATION_VERSION=0.8
    1.76 +DBUS_VERSION=0.60
    1.77 +SQLITE_VERSION=3.8.4.2
    1.78 +
    1.79 +MSMANIFEST_TOOL=
    1.80 +
    1.81 +dnl Set various checks
    1.82 +dnl ========================================================
    1.83 +MISSING_X=
    1.84 +AC_PROG_AWK
    1.85 +
    1.86 +dnl Initialize the Pthread test variables early so they can be
    1.87 +dnl  overridden by each platform.
    1.88 +dnl ========================================================
    1.89 +MOZ_USE_PTHREADS=
    1.90 +_PTHREAD_LDFLAGS=""
    1.91 +
    1.92 +dnl Do not allow objdir == srcdir builds.
    1.93 +dnl ==============================================================
    1.94 +_topsrcdir=`cd \`dirname $0\`; pwd`
    1.95 +_objdir=`pwd`
    1.96 +
    1.97 +
    1.98 +dnl TODO Don't exempt L10N builds once bug 842760 is resolved.
    1.99 +if test "$_topsrcdir" = "$_objdir" -a "${with_l10n_base+set}" != set; then
   1.100 +  echo "  ***"
   1.101 +  echo "  * Building directly in the main source directory is not allowed."
   1.102 +  echo "  *"
   1.103 +  echo "  * To build, you must run configure from a separate directory"
   1.104 +  echo "  * (referred to as an object directory)."
   1.105 +  echo "  *"
   1.106 +  echo "  * If you are building with a mozconfig, you will need to change your"
   1.107 +  echo "  * mozconfig to point to a different object directory."
   1.108 +  echo "  ***"
   1.109 +  exit 1
   1.110 +fi
   1.111 +
   1.112 +# Check for a couple representative files in the source tree
   1.113 +_conflict_files=
   1.114 +for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
   1.115 +  if test -f $file; then
   1.116 +    _conflict_files="$_conflict_files $file"
   1.117 +  fi
   1.118 +done
   1.119 +if test "$_conflict_files"; then
   1.120 +  echo "***"
   1.121 +  echo "*   Your source tree contains these files:"
   1.122 +  for file in $_conflict_files; do
   1.123 +    echo "*         $file"
   1.124 +  done
   1.125 +  cat 1>&2 <<-EOF
   1.126 +  *   This indicates that you previously built in the source tree.
   1.127 +  *   A source tree build can confuse the separate objdir build.
   1.128 +  *
   1.129 +  *   To clean up the source tree:
   1.130 +  *     1. cd $_topsrcdir
   1.131 +  *     2. gmake distclean
   1.132 +  ***
   1.133 +EOF
   1.134 +  exit 1
   1.135 +  break
   1.136 +fi
   1.137 +MOZ_BUILD_ROOT=`pwd`
   1.138 +
   1.139 +MOZ_PYTHON
   1.140 +
   1.141 +MOZ_DEFAULT_COMPILER
   1.142 +
   1.143 +COMPILE_ENVIRONMENT=1
   1.144 +MOZ_ARG_DISABLE_BOOL(compile-environment,
   1.145 +[  --disable-compile-environment
   1.146 +                          Disable compiler/library checks.],
   1.147 +    COMPILE_ENVIRONMENT= )
   1.148 +AC_SUBST(COMPILE_ENVIRONMENT)
   1.149 +
   1.150 +MOZ_ARG_WITH_STRING(l10n-base,
   1.151 +[  --with-l10n-base=DIR    path to l10n repositories],
   1.152 +    L10NBASEDIR=$withval)
   1.153 +if test -n "$L10NBASEDIR"; then
   1.154 +    if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
   1.155 +        AC_MSG_ERROR([--with-l10n-base must specify a path])
   1.156 +    elif test -d "$L10NBASEDIR"; then
   1.157 +        L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
   1.158 +    else
   1.159 +        AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
   1.160 +    fi
   1.161 +fi
   1.162 +AC_SUBST(L10NBASEDIR)
   1.163 +
   1.164 +dnl Check for Perl first -- needed for win32 SDK checks
   1.165 +MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
   1.166 +if test -z "$PERL" -o "$PERL" = ":"; then
   1.167 +    AC_MSG_ERROR([perl not found in \$PATH])
   1.168 +fi
   1.169 +
   1.170 +if test -n "$GAIADIR" -a ! -d "$GAIADIR" ; then
   1.171 +    AC_MSG_ERROR([GAIADIR '$GAIADIR' isn't a valid directory])
   1.172 +fi
   1.173 +
   1.174 +AC_SUBST(GAIADIR)
   1.175 +if test -n "$GAIADIR" ; then
   1.176 +    AC_DEFINE(PACKAGE_GAIA)
   1.177 +fi
   1.178 +
   1.179 +if test -n "$FXOS_SIMULATOR" -a -z "$GAIADIR" ; then
   1.180 +    AC_MSG_ERROR([FXOS_SIMULATOR=1 requires GAIADIR to be defined])
   1.181 +fi
   1.182 +
   1.183 +if test -n "$FXOS_SIMULATOR" ; then
   1.184 +    AC_DEFINE(FXOS_SIMULATOR)
   1.185 +    AC_SUBST(FXOS_SIMULATOR)
   1.186 +fi
   1.187 +
   1.188 +MOZ_ARG_WITH_STRING(gonk,
   1.189 +[  --with-gonk=DIR
   1.190 +               location of gonk dir],
   1.191 +    gonkdir=$withval)
   1.192 +
   1.193 +MOZ_ARG_WITH_STRING(gonk-toolchain-prefix,
   1.194 +[  --with-gonk-toolchain-prefix=DIR
   1.195 +                          prefix to gonk toolchain commands],
   1.196 +    gonk_toolchain_prefix=$withval)
   1.197 +
   1.198 +if test -n "$gonkdir" ; then
   1.199 +    kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
   1.200 +    android_source="$gonkdir"
   1.201 +    ANDROID_SOURCE="$android_source"
   1.202 +    ANDROID_NDK="${ANDROID_SOURCE}/ndk"
   1.203 +    dnl Default to ICS
   1.204 +    ANDROID_VERSION=15
   1.205 +    if test -n "${PLATFORM_SDK_VERSION}"; then
   1.206 +        ANDROID_VERSION="${PLATFORM_SDK_VERSION}"
   1.207 +    fi
   1.208 +
   1.209 +    dnl set up compilers
   1.210 +    TOOLCHAIN_PREFIX="$gonk_toolchain_prefix"
   1.211 +    AS="$gonk_toolchain_prefix"as
   1.212 +    CC="$gonk_toolchain_prefix"gcc
   1.213 +    CXX="$gonk_toolchain_prefix"g++
   1.214 +    CPP="$gonk_toolchain_prefix"cpp
   1.215 +    LD="$gonk_toolchain_prefix"ld
   1.216 +    AR="$gonk_toolchain_prefix"ar
   1.217 +    RANLIB="$gonk_toolchain_prefix"ranlib
   1.218 +    STRIP="$gonk_toolchain_prefix"strip
   1.219 +    OBJCOPY="$gonk_toolchain_prefix"objcopy
   1.220 +
   1.221 +    if ! test -e "$gonkdir/ndk/sources/cxx-stl/stlport/src/iostream.cpp"; then
   1.222 +        AC_MSG_ERROR([Couldn't find path to stlport sources in the gonk tree])
   1.223 +    fi
   1.224 +    STLPORT_CPPFLAGS="-I$_topsrcdir/build/stlport/stlport -I$gonkdir/ndk/sources/cxx-stl/system/include"
   1.225 +    STLPORT_LIBS="$_objdir/build/stlport/libstlport_static.a"
   1.226 +
   1.227 +    case "$target_cpu" in
   1.228 +    arm)
   1.229 +        ARCH_DIR=arch-arm
   1.230 +        ;;
   1.231 +    i?86)
   1.232 +        ARCH_DIR=arch-x86
   1.233 +        ;;
   1.234 +    esac
   1.235 +
   1.236 +    case "$ANDROID_VERSION" in
   1.237 +    15)
   1.238 +        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"
   1.239 +        MOZ_B2G_BT=1
   1.240 +        MOZ_B2G_BT_BLUEZ=1
   1.241 +        MOZ_NFC=1
   1.242 +        MOZ_B2G_CAMERA=1
   1.243 +        MOZ_OMX_DECODER=1
   1.244 +        AC_SUBST(MOZ_OMX_DECODER)
   1.245 +        MOZ_RTSP=1
   1.246 +        ;;
   1.247 +    17|18)
   1.248 +        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"
   1.249 +        if test -d "$gonkdir/external/bluetooth/bluez"; then
   1.250 +          GONK_INCLUDES="$GONK_INCLUDES -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib"
   1.251 +            MOZ_B2G_BT=1
   1.252 +            MOZ_B2G_BT_BLUEZ=1
   1.253 +        elif test -d "$gonkdir/external/bluetooth/bluedroid"; then
   1.254 +            MOZ_B2G_BT=1
   1.255 +            MOZ_B2G_BT_BLUEDROID=1
   1.256 +        fi
   1.257 +
   1.258 +        MOZ_RTSP=1
   1.259 +        MOZ_NFC=1
   1.260 +        MOZ_B2G_CAMERA=1
   1.261 +        MOZ_OMX_DECODER=1
   1.262 +        AC_SUBST(MOZ_OMX_DECODER)
   1.263 +        MOZ_OMX_ENCODER=1
   1.264 +        AC_SUBST(MOZ_OMX_ENCODER)
   1.265 +        AC_DEFINE(MOZ_OMX_ENCODER)
   1.266 +        ;;
   1.267 +    19)
   1.268 +        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"
   1.269 +        MOZ_B2G_CAMERA=1
   1.270 +        MOZ_B2G_BT=1
   1.271 +        MOZ_B2G_BT_BLUEDROID=1
   1.272 +        MOZ_NFC=1
   1.273 +        MOZ_RTSP=1
   1.274 +        MOZ_OMX_DECODER=1
   1.275 +        MOZ_OMX_ENCODER=1
   1.276 +        AC_DEFINE(MOZ_OMX_ENCODER)
   1.277 +        MOZ_AUDIO_OFFLOAD=1
   1.278 +        AC_SUBST(MOZ_AUDIO_OFFLOAD)
   1.279 +        AC_DEFINE(MOZ_AUDIO_OFFLOAD)
   1.280 +
   1.281 +        ;;
   1.282 +    *)
   1.283 +        AC_MSG_ERROR([Unsupported platform version: $ANDROID_VERSION])
   1.284 +        ;;
   1.285 +    esac
   1.286 +    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"
   1.287 +    CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
   1.288 +    CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS $STLPORT_CPPFLAGS"
   1.289 +    dnl Add -llog by default, since we use it all over the place.
   1.290 +    LIBS="$LIBS -llog"
   1.291 +
   1.292 +    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"
   1.293 +
   1.294 +    dnl prevent cross compile section from using these flags as host flags
   1.295 +    if test -z "$HOST_CPPFLAGS" ; then
   1.296 +        HOST_CPPFLAGS=" "
   1.297 +    fi
   1.298 +    if test -z "$HOST_CFLAGS" ; then
   1.299 +        HOST_CFLAGS=" "
   1.300 +    fi
   1.301 +    if test -z "$HOST_CXXFLAGS" ; then
   1.302 +        HOST_CXXFLAGS=" "
   1.303 +    fi
   1.304 +    if test -z "$HOST_LDFLAGS" ; then
   1.305 +        HOST_LDFLAGS=" "
   1.306 +    fi
   1.307 +
   1.308 +    AC_DEFINE(ANDROID)
   1.309 +    AC_DEFINE_UNQUOTED(ANDROID_VERSION, $ANDROID_VERSION)
   1.310 +    AC_SUBST(ANDROID_VERSION)
   1.311 +    AC_DEFINE(HAVE_SYS_UIO_H)
   1.312 +    AC_DEFINE(HAVE_PTHREADS)
   1.313 +    MOZ_CHROME_FILE_FORMAT=omni
   1.314 +    direct_nspr_config=1
   1.315 +else
   1.316 +    MOZ_ANDROID_NDK
   1.317 +
   1.318 +    case "$target" in
   1.319 +    *-android*|*-linuxandroid*)
   1.320 +        if test -z "$ANDROID_PACKAGE_NAME" ; then
   1.321 +            ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
   1.322 +        fi
   1.323 +        MOZ_CHROME_FILE_FORMAT=omni
   1.324 +        ZLIB_DIR=yes
   1.325 +        ;;
   1.326 +    *-linux*)
   1.327 +        AC_PATH_PROG(OBJCOPY,objcopy)
   1.328 +        ;;
   1.329 +    esac
   1.330 +fi
   1.331 +
   1.332 +AC_SUBST(ANDROID_SOURCE)
   1.333 +AC_SUBST(ANDROID_PACKAGE_NAME)
   1.334 +AC_SUBST(OBJCOPY)
   1.335 +
   1.336 +dnl ========================================================
   1.337 +dnl Checks for compilers.
   1.338 +dnl ========================================================
   1.339 +
   1.340 +dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
   1.341 +AR_FLAGS='crs $@'
   1.342 +
   1.343 +if test "$COMPILE_ENVIRONMENT"; then
   1.344 +
   1.345 +if test "$target" != "$host"; then
   1.346 +    MOZ_CROSS_COMPILER
   1.347 +else
   1.348 +    AC_PROG_CC
   1.349 +    case "$target" in
   1.350 +    *-mingw*)
   1.351 +      # Work around the conftest.exe access problem on Windows
   1.352 +      sleep 2
   1.353 +    esac
   1.354 +    AC_PROG_CXX
   1.355 +    AC_PROG_RANLIB
   1.356 +    MOZ_PATH_PROGS(AS, $AS as, $CC)
   1.357 +    AC_CHECK_PROGS(AR, ar, :)
   1.358 +    AC_CHECK_PROGS(LD, ld, :)
   1.359 +    AC_CHECK_PROGS(STRIP, strip, :)
   1.360 +    AC_CHECK_PROGS(WINDRES, windres, :)
   1.361 +    if test -z "$HOST_CC"; then
   1.362 +        HOST_CC="$CC"
   1.363 +    fi
   1.364 +    if test -z "$HOST_CFLAGS"; then
   1.365 +        HOST_CFLAGS="$CFLAGS"
   1.366 +    fi
   1.367 +    if test -z "$HOST_CXX"; then
   1.368 +        HOST_CXX="$CXX"
   1.369 +    fi
   1.370 +    if test -z "$HOST_CXXFLAGS"; then
   1.371 +        HOST_CXXFLAGS="$CXXFLAGS"
   1.372 +    fi
   1.373 +    if test -z "$HOST_LDFLAGS"; then
   1.374 +        HOST_LDFLAGS="$LDFLAGS"
   1.375 +    fi
   1.376 +    if test -z "$HOST_RANLIB"; then
   1.377 +        HOST_RANLIB="$RANLIB"
   1.378 +    fi
   1.379 +    if test -z "$HOST_AR"; then
   1.380 +        HOST_AR="$AR"
   1.381 +    fi
   1.382 +    if test -z "$HOST_AR_FLAGS"; then
   1.383 +        HOST_AR_FLAGS="$AR_FLAGS"
   1.384 +    fi
   1.385 +fi
   1.386 +
   1.387 +if test -n "$MOZ_WINCONSOLE"; then
   1.388 +    AC_DEFINE(MOZ_WINCONSOLE)
   1.389 +fi
   1.390 +
   1.391 +MOZ_TOOL_VARIABLES
   1.392 +
   1.393 +MOZ_CHECK_COMPILER_WRAPPER
   1.394 +
   1.395 +if test -n "$GNU_CC" -a -z "$CLANG_CC" ; then
   1.396 +    if test "$GCC_MAJOR_VERSION" -eq 4 -a "$GCC_MINOR_VERSION" -lt 4 ||
   1.397 +       test "$GCC_MAJOR_VERSION" -lt 4; then
   1.398 +        AC_MSG_ERROR([Only GCC 4.4 or newer supported])
   1.399 +    fi
   1.400 +fi
   1.401 +
   1.402 +dnl ========================================================
   1.403 +dnl Special win32 checks
   1.404 +dnl ========================================================
   1.405 +
   1.406 +MOZ_ARG_ENABLE_BOOL(metro,
   1.407 +[  --enable-metro           Enable Windows Metro build targets],
   1.408 +    MOZ_METRO=1,
   1.409 +    MOZ_METRO=)
   1.410 +if test -n "$MOZ_METRO"; then
   1.411 +    AC_DEFINE(MOZ_METRO)
   1.412 +    # Target the Windows 8 Kit
   1.413 +    WINSDK_TARGETVER=602
   1.414 +    WINVER=502
   1.415 +    # toolkit/library/makefile.in needs these, see nsDllMain.
   1.416 +    CRTDLLVERSION=110
   1.417 +    CRTEXPDLLVERSION=1-1-0
   1.418 +else
   1.419 +    # Target the Windows 7 SDK by default
   1.420 +    WINSDK_TARGETVER=601
   1.421 +    WINVER=502
   1.422 +fi
   1.423 +
   1.424 +AC_SUBST(CRTDLLVERSION)
   1.425 +AC_SUBST(CRTEXPDLLVERSION)
   1.426 +
   1.427 +MOZ_ARG_WITH_STRING(windows-version,
   1.428 +[  --with-windows-version=WINSDK_TARGETVER
   1.429 +                          Windows SDK version to target. Lowest version
   1.430 +                          currently allowed is 601 (Win7), highest is 602 (Win8)],
   1.431 +  WINSDK_TARGETVER=$withval)
   1.432 +
   1.433 +# Currently only two sdk versions allowed, 601 and 602
   1.434 +case "$WINSDK_TARGETVER" in
   1.435 +601|602)
   1.436 +    MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
   1.437 +    ;;
   1.438 +
   1.439 +*)
   1.440 +    AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
   1.441 +    ;;
   1.442 +esac
   1.443 +
   1.444 +case "$target" in
   1.445 +*-mingw*)
   1.446 +    if test "$GCC" != "yes" -a -z "$CLANG_CC"; then
   1.447 +        # Check to see if we are really running in a msvc environemnt
   1.448 +        _WIN32_MSVC=1
   1.449 +        AC_CHECK_PROGS(MIDL, midl)
   1.450 +
   1.451 +        # Make sure compilers are valid
   1.452 +        CFLAGS="$CFLAGS -TC -nologo"
   1.453 +        CXXFLAGS="$CXXFLAGS -TP -nologo"
   1.454 +        AC_LANG_SAVE
   1.455 +        AC_LANG_C
   1.456 +        AC_TRY_COMPILE([#include <stdio.h>],
   1.457 +            [ printf("Hello World\n"); ],,
   1.458 +            AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
   1.459 +
   1.460 +        AC_LANG_CPLUSPLUS
   1.461 +        AC_TRY_COMPILE([#include <new.h>],
   1.462 +            [ unsigned *test = new unsigned(42); ],,
   1.463 +            AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
   1.464 +        AC_LANG_RESTORE
   1.465 +
   1.466 +        changequote(,)
   1.467 +        _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
   1.468 +        changequote([,])
   1.469 +
   1.470 +        # Determine compiler version
   1.471 +        CC_VERSION=`${CC} -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
   1.472 +        _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
   1.473 +        _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
   1.474 +        _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
   1.475 +        _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
   1.476 +        _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
   1.477 +
   1.478 +        CXX_VERSION=`${CXX} -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
   1.479 +        _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
   1.480 +
   1.481 +        if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
   1.482 +            AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
   1.483 +        fi
   1.484 +
   1.485 +        AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
   1.486 +        AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
   1.487 +
   1.488 +        if test "$_CC_MAJOR_VERSION" = "16"; then
   1.489 +            _CC_SUITE=10
   1.490 +            MSVS_VERSION=2010
   1.491 +        elif test "$_CC_MAJOR_VERSION" = "17"; then
   1.492 +            _CC_SUITE=11
   1.493 +            MSVS_VERSION=2012
   1.494 +        elif test "$_CC_MAJOR_VERSION" = "18"; then
   1.495 +            _CC_SUITE=12
   1.496 +            MSVS_VERSION=2013
   1.497 +        else
   1.498 +            AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
   1.499 +        fi
   1.500 +        AC_SUBST(MSVS_VERSION)
   1.501 +
   1.502 +        AC_DEFINE(HAVE_SEH_EXCEPTIONS)
   1.503 +
   1.504 +        if test -n "$WIN32_REDIST_DIR"; then
   1.505 +          if test ! -d "$WIN32_REDIST_DIR"; then
   1.506 +            AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
   1.507 +          fi
   1.508 +          WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
   1.509 +        fi
   1.510 +
   1.511 +        dnl Confirm we have the pri tools on win8 builds
   1.512 +        if test -n "$MOZ_METRO"; then
   1.513 +          AC_MSG_CHECKING([for makepri])
   1.514 +          AC_CHECK_PROGS(MAKEPRI, makepri, "")
   1.515 +          if test -z "MAKEPRI" ; then
   1.516 +              AC_MSG_ERROR([makepri.exe is required for generating metro browser install components. It should be in the Win8 SDK.])
   1.517 +          fi
   1.518 +          AC_SUBST(MAKEPRI)
   1.519 +        fi
   1.520 +
   1.521 +        dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
   1.522 +        dnl not something else like "magnetic tape manipulation utility".
   1.523 +        MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
   1.524 +        if test -z "$MSMT_TOOL"; then
   1.525 +          AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
   1.526 +        fi
   1.527 +
   1.528 +        changequote(,)
   1.529 +        _MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
   1.530 +        changequote([,])
   1.531 +        MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
   1.532 +        if test -z "$MSMANIFEST_TOOL_VERSION"; then
   1.533 +          AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
   1.534 +        fi
   1.535 +
   1.536 +        MSMANIFEST_TOOL=1
   1.537 +        unset MSMT_TOOL
   1.538 +
   1.539 +        # Check linker version
   1.540 +        _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
   1.541 +        _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
   1.542 +        if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
   1.543 +            AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
   1.544 +        fi
   1.545 +
   1.546 +        INCREMENTAL_LINKER=1
   1.547 +
   1.548 +        # Set midl environment
   1.549 +        case "$target" in
   1.550 +        i*86-*)
   1.551 +            MIDL_FLAGS="${MIDL_FLAGS} -env win32"
   1.552 +            ;;
   1.553 +        x86_64-*)
   1.554 +            MIDL_FLAGS="${MIDL_FLAGS} -env x64"
   1.555 +            ;;
   1.556 +        esac
   1.557 +
   1.558 +        unset _MSVC_VER_FILTER
   1.559 +
   1.560 +        AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
   1.561 +            [
   1.562 +                AC_LANG_SAVE
   1.563 +                AC_LANG_CPLUSPLUS
   1.564 +                _SAVE_CXXFLAGS="$CXXFLAGS"
   1.565 +                CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
   1.566 +                AC_TRY_COMPILE([#include <exception>],
   1.567 +                            [std::_Throw(std::exception()); return 0;],
   1.568 +                            ac_cv_have_std__Throw="yes",
   1.569 +                            ac_cv_have_std__Throw="no")
   1.570 +                CXXFLAGS="$_SAVE_CXXFLAGS"
   1.571 +                AC_LANG_RESTORE
   1.572 +            ])
   1.573 +
   1.574 +        if test "$ac_cv_have_std__Throw" = "yes"; then
   1.575 +            AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
   1.576 +                           ac_cv_have_dllimport_exception_bug,
   1.577 +                [
   1.578 +                    AC_LANG_SAVE
   1.579 +                    AC_LANG_CPLUSPLUS
   1.580 +                    _SAVE_CXXFLAGS="$CXXFLAGS"
   1.581 +                    CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
   1.582 +                    AC_TRY_LINK([#include <vector>],
   1.583 +                                [std::vector<int> v; return v.at(1);],
   1.584 +                                ac_cv_have_dllimport_exception_bug="no",
   1.585 +                                ac_cv_have_dllimport_exception_bug="yes")
   1.586 +                    CXXFLAGS="$_SAVE_CXXFLAGS"
   1.587 +                    AC_LANG_RESTORE
   1.588 +                ])
   1.589 +            if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
   1.590 +                WRAP_STL_INCLUDES=1
   1.591 +                MOZ_MSVC_STL_WRAP__Throw=1
   1.592 +                AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
   1.593 +            fi
   1.594 +        else
   1.595 +            AC_CACHE_CHECK(for overridable _RAISE,
   1.596 +                           ac_cv_have__RAISE,
   1.597 +                [
   1.598 +                    AC_LANG_SAVE
   1.599 +                    AC_LANG_CPLUSPLUS
   1.600 +                    _SAVE_CXXFLAGS="$CXXFLAGS"
   1.601 +                    CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
   1.602 +                    AC_TRY_COMPILE([#include <xstddef>
   1.603 +                                    #undef _RAISE
   1.604 +                                    #define _RAISE(x) externallyDefinedFunction((x).what())
   1.605 +                                    #include <vector>
   1.606 +                                   ],
   1.607 +                                   [std::vector<int> v; return v.at(1);],
   1.608 +                                   ac_cv_have__RAISE="no",
   1.609 +                                   ac_cv_have__RAISE="yes")
   1.610 +                    CXXFLAGS="$_SAVE_CXXFLAGS"
   1.611 +                    AC_LANG_RESTORE
   1.612 +                ])
   1.613 +            if test "$ac_cv_have__RAISE" = "yes"; then
   1.614 +                WRAP_STL_INCLUDES=1
   1.615 +                MOZ_MSVC_STL_WRAP__RAISE=1
   1.616 +                AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
   1.617 +            else
   1.618 +                AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK.  Please file a bug describing this error and your build configuration.])
   1.619 +            fi
   1.620 +        fi
   1.621 +
   1.622 +        if test "$WRAP_STL_INCLUDES" = "1"; then
   1.623 +            STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
   1.624 +        fi
   1.625 +    elif test -z "$CLANG_CC"; then
   1.626 +        # Check w32api version
   1.627 +        _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
   1.628 +        _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
   1.629 +        AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
   1.630 +        AC_TRY_COMPILE([#include <w32api.h>],
   1.631 +            #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
   1.632 +                (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
   1.633 +                 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
   1.634 +                #error "test failed."
   1.635 +            #endif
   1.636 +            , [ res=yes ], [ res=no ])
   1.637 +        AC_MSG_RESULT([$res])
   1.638 +        if test "$res" != "yes"; then
   1.639 +            AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
   1.640 +        fi
   1.641 +        # Check windres version
   1.642 +        AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
   1.643 +        _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
   1.644 +        AC_MSG_RESULT([$_WINDRES_VERSION])
   1.645 +        _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
   1.646 +        _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
   1.647 +        _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
   1.648 +        WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
   1.649 +        WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
   1.650 +        WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
   1.651 +        if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
   1.652 +                "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
   1.653 +                "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
   1.654 +                "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
   1.655 +                "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
   1.656 +                "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
   1.657 +        then
   1.658 +            AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
   1.659 +        fi
   1.660 +
   1.661 +        AC_CHECK_PROGS(MIDL, $target-widl widl)
   1.662 +        if test -n "$MIDL"; then
   1.663 +            case "$target" in
   1.664 +            i*86-*)
   1.665 +                MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
   1.666 +                ;;
   1.667 +            x86_64-*)
   1.668 +                MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
   1.669 +                ;;
   1.670 +            esac
   1.671 +        fi
   1.672 +
   1.673 +        # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
   1.674 +        # causing problems with local implementations with the same name.
   1.675 +        AC_DEFINE(STRSAFE_NO_DEPRECATE)
   1.676 +
   1.677 +        MOZ_WINSDK_MAXVER=0x06020000
   1.678 +    fi # !GNU_CC
   1.679 +
   1.680 +    # If MSVC or clang
   1.681 +    if test "$GCC" != "yes" -o -n "$CLANG_CC" ; then
   1.682 +        MOZ_FIND_WINSDK_VERSION
   1.683 +    fi
   1.684 +
   1.685 +    AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
   1.686 +    AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
   1.687 +    # Require OS features provided by IE 6.0 SP2 (XP SP2)
   1.688 +    AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
   1.689 +
   1.690 +    # If the maximum version supported by this SDK is lower than the target
   1.691 +    # version, error out
   1.692 +    AC_MSG_CHECKING([for Windows SDK being recent enough])
   1.693 +    if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
   1.694 +        AC_MSG_RESULT("yes")
   1.695 +    else
   1.696 +        AC_MSG_RESULT("no")
   1.697 +        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.])
   1.698 +    fi
   1.699 +
   1.700 +    AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
   1.701 +    # Definitions matching sdkddkver.h
   1.702 +    AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
   1.703 +    AC_DEFINE_UNQUOTED(MOZ_WINSDK_MAXVER,$MOZ_WINSDK_MAXVER)
   1.704 +    AC_SUBST(MOZ_WINSDK_MAXVER)
   1.705 +    ;;
   1.706 +esac
   1.707 +
   1.708 +AC_PROG_CPP
   1.709 +AC_PROG_CXXCPP
   1.710 +
   1.711 +if test -n "$_WIN32_MSVC"; then
   1.712 +    SKIP_PATH_CHECKS=1
   1.713 +    SKIP_COMPILER_CHECKS=1
   1.714 +    SKIP_LIBRARY_CHECKS=1
   1.715 +
   1.716 +    # Since we're skipping compiler and library checks, hard-code
   1.717 +    # some facts here.
   1.718 +    AC_DEFINE(HAVE_IO_H)
   1.719 +    AC_DEFINE(HAVE_SETBUF)
   1.720 +    AC_DEFINE(HAVE_ISATTY)
   1.721 +fi
   1.722 +
   1.723 +fi # COMPILE_ENVIRONMENT
   1.724 +
   1.725 +AC_SUBST(MIDL_FLAGS)
   1.726 +AC_SUBST(_MSC_VER)
   1.727 +
   1.728 +AC_SUBST(GNU_AS)
   1.729 +AC_SUBST(GNU_LD)
   1.730 +AC_SUBST(GNU_CC)
   1.731 +AC_SUBST(GNU_CXX)
   1.732 +AC_SUBST(INTEL_CC)
   1.733 +AC_SUBST(INTEL_CXX)
   1.734 +
   1.735 +AC_SUBST(STL_FLAGS)
   1.736 +AC_SUBST(WRAP_STL_INCLUDES)
   1.737 +AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
   1.738 +AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
   1.739 +
   1.740 +dnl ========================================================
   1.741 +dnl Checks for programs.
   1.742 +dnl ========================================================
   1.743 +AC_PROG_INSTALL
   1.744 +AC_PROG_LN_S
   1.745 +
   1.746 +if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
   1.747 +AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
   1.748 +_perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
   1.749 +_perl_res=$?
   1.750 +AC_MSG_RESULT([$_perl_version])
   1.751 +
   1.752 +if test "$_perl_res" != 0; then
   1.753 +    AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
   1.754 +fi
   1.755 +fi
   1.756 +
   1.757 +AC_MSG_CHECKING([for full perl installation])
   1.758 +_perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
   1.759 +_perl_res=$?
   1.760 +if test "$_perl_res" != 0; then
   1.761 +    AC_MSG_RESULT([no])
   1.762 +    AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
   1.763 +else
   1.764 +    AC_MSG_RESULT([yes])
   1.765 +fi
   1.766 +
   1.767 +if test -z "$COMPILE_ENVIRONMENT"; then
   1.768 +    NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
   1.769 +fi
   1.770 +AC_SUBST(NSINSTALL_BIN)
   1.771 +
   1.772 +MOZ_PATH_PROG(DOXYGEN, doxygen, :)
   1.773 +MOZ_PATH_PROG(AUTOCONF, autoconf, :)
   1.774 +MOZ_PATH_PROGS(UNZIP, unzip)
   1.775 +if test -z "$UNZIP" -o "$UNZIP" = ":"; then
   1.776 +    AC_MSG_ERROR([unzip not found in \$PATH])
   1.777 +fi
   1.778 +MOZ_PATH_PROGS(ZIP, zip)
   1.779 +if test -z "$ZIP" -o "$ZIP" = ":"; then
   1.780 +    AC_MSG_ERROR([zip not found in \$PATH])
   1.781 +fi
   1.782 +MOZ_PATH_PROG(XARGS, xargs)
   1.783 +if test -z "$XARGS" -o "$XARGS" = ":"; then
   1.784 +    AC_MSG_ERROR([xargs not found in \$PATH .])
   1.785 +fi
   1.786 +
   1.787 +MOZ_PATH_PROG(RPMBUILD, rpmbuild, :)
   1.788 +AC_SUBST(RPMBUILD)
   1.789 +
   1.790 +if test "$COMPILE_ENVIRONMENT"; then
   1.791 +
   1.792 +dnl ========================================================
   1.793 +dnl = Mac OS X toolchain support
   1.794 +dnl ========================================================
   1.795 +
   1.796 +dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
   1.797 +dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
   1.798 +dnl when we can run target binaries.
   1.799 +AC_SUBST(UNIVERSAL_BINARY)
   1.800 +AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
   1.801 +
   1.802 +MOZ_ARG_WITH_STRING(unify-dist,
   1.803 +[  --with-unify-dist=dir   Location of the dist directory to unify with at packaging time (Mac OS X universal build only)],
   1.804 +    UNIFY_DIST=$withval)
   1.805 +if test -n "$UNIVERSAL_BINARY"; then
   1.806 +    if test -z "$UNIFY_DIST"; then
   1.807 +        AC_MSG_ERROR([You need to provide the --with-unify-dist=dir argument when performing a universal build])
   1.808 +    fi
   1.809 +    case "$UNIFY_DIST" in
   1.810 +    /*)
   1.811 +        ;;
   1.812 +    *)
   1.813 +        UNIFY_DIST="${MOZ_BUILD_ROOT}/${UNIFY_DIST}"
   1.814 +        ;;
   1.815 +    esac
   1.816 +fi
   1.817 +AC_SUBST(UNIFY_DIST)
   1.818 +
   1.819 +dnl ========================================================
   1.820 +dnl Check for MacOS deployment target version
   1.821 +dnl ========================================================
   1.822 +
   1.823 +MOZ_ARG_ENABLE_STRING(macos-target,
   1.824 +                      [  --enable-macos-target=VER (default=10.6)
   1.825 +                          Set the minimum MacOS version needed at runtime],
   1.826 +                      [_MACOSX_DEPLOYMENT_TARGET=$enableval])
   1.827 +
   1.828 +case "$target" in
   1.829 +*-darwin*)
   1.830 +    if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
   1.831 +        dnl Use the specified value
   1.832 +        export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
   1.833 +    else
   1.834 +        dnl No value specified on the command line or in the environment,
   1.835 +        dnl use architecture minimum.
   1.836 +        export MACOSX_DEPLOYMENT_TARGET=10.6
   1.837 +    fi
   1.838 +    ;;
   1.839 +esac
   1.840 +
   1.841 +AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
   1.842 +
   1.843 +dnl ========================================================
   1.844 +dnl = Mac OS X SDK support
   1.845 +dnl ========================================================
   1.846 +MACOS_SDK_DIR=
   1.847 +MOZ_ARG_WITH_STRING(macos-sdk,
   1.848 +[  --with-macos-sdk=dir    Location of platform SDK to use (Mac OS X only)],
   1.849 +    MACOS_SDK_DIR=$withval)
   1.850 +
   1.851 +MACOS_PRIVATE_FRAMEWORKS_DIR_DEFAULTED=
   1.852 +MOZ_ARG_WITH_STRING(macos-private-frameworks,
   1.853 +[  --with-macos-private-frameworks=dir    Location of private frameworks to use (Mac OS X only)],
   1.854 +    MACOS_PRIVATE_FRAMEWORKS_DIR=$withval,
   1.855 +    MACOS_PRIVATE_FRAMEWORKS_DIR=/System/Library/PrivateFrameworks
   1.856 +    MACOS_PRIVATE_FRAMEWORKS_DEFAULTED=1)
   1.857 +
   1.858 +if test -z "${MACOS_PRIVATE_FRAMEWORKS_DEFAULTED}"; then
   1.859 +  if test -z "$CROSS_COMPILE"; then
   1.860 +    AC_MSG_WARN([You should only be using --with-macos-private-frameworks when cross-compiling.])
   1.861 +  fi
   1.862 +  if test ! -d "$MACOS_PRIVATE_FRAMEWORKS_DIR"; then
   1.863 +    AC_MSG_ERROR([PrivateFrameworks directory not found.])
   1.864 +  fi
   1.865 +fi
   1.866 +
   1.867 +dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
   1.868 +AC_SUBST(MACOS_SDK_DIR)
   1.869 +AC_SUBST(MACOS_PRIVATE_FRAMEWORKS_DIR)
   1.870 +
   1.871 +if test "$MACOS_SDK_DIR"; then
   1.872 +  dnl Sync this section with the ones in NSPR and NSS.
   1.873 +  dnl Changes to the cross environment here need to be accounted for in
   1.874 +  dnl the libIDL checks (below) and xpidl build.
   1.875 +
   1.876 +  if test ! -d "$MACOS_SDK_DIR"; then
   1.877 +    AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
   1.878 +specify a valid SDK.  SDKs are installed when the optional cross-development
   1.879 +tools are selected during the Xcode/Developer Tools installation.])
   1.880 +  fi
   1.881 +
   1.882 +  CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
   1.883 +  CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
   1.884 +
   1.885 +  dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
   1.886 +  CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
   1.887 +  CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
   1.888 +
   1.889 +  AC_LANG_SAVE
   1.890 +  AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
   1.891 +  AC_LANG_CPLUSPLUS
   1.892 +  AC_TRY_COMPILE([#include <new>],[],
   1.893 +   result=yes,
   1.894 +   result=no)
   1.895 +  AC_LANG_RESTORE
   1.896 +  AC_MSG_RESULT($result)
   1.897 +
   1.898 +  if test "$result" = "no" ; then
   1.899 +    AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
   1.900 +  fi
   1.901 +fi
   1.902 +
   1.903 +fi # COMPILE_ENVIRONMENT
   1.904 +
   1.905 +AC_MSG_CHECKING([compiler version])
   1.906 +# Just print it so it shows up in the logs.
   1.907 +cc_version=$($CC --version)
   1.908 +AC_MSG_RESULT([$cc_version])
   1.909 +
   1.910 +if test -n "$MAKE"; then
   1.911 +  if test `echo $MAKE | grep -c make.py` != 1; then
   1.912 +     NOT_PYMAKE=$MAKE
   1.913 +  fi
   1.914 +fi
   1.915 +
   1.916 +case "$host_os" in
   1.917 +mingw*)
   1.918 +    MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
   1.919 +    ;;
   1.920 +*)
   1.921 +    MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
   1.922 +    ;;
   1.923 +esac
   1.924 +if test "$GMAKE" = ":"; then
   1.925 +   AC_MSG_ERROR([GNU make not found])
   1.926 +fi
   1.927 +AC_SUBST(GMAKE)
   1.928 +
   1.929 +if test -z "$MAKE"; then
   1.930 +  MAKE=$GMAKE
   1.931 +fi
   1.932 +
   1.933 +if test "$COMPILE_ENVIRONMENT"; then
   1.934 +
   1.935 +AC_PATH_XTRA
   1.936 +
   1.937 +XCFLAGS="$X_CFLAGS"
   1.938 +
   1.939 +fi # COMPILE_ENVIRONMENT
   1.940 +
   1.941 +dnl ========================================================
   1.942 +dnl set the defaults first
   1.943 +dnl ========================================================
   1.944 +AS_BIN=$AS
   1.945 +AR_LIST='$(AR) t'
   1.946 +AR_EXTRACT='$(AR) x'
   1.947 +AR_DELETE='$(AR) d'
   1.948 +AS='$(CC)'
   1.949 +AS_DASH_C_FLAG='-c'
   1.950 +DLL_PREFIX=lib
   1.951 +LIB_PREFIX=lib
   1.952 +DLL_SUFFIX=.so
   1.953 +OBJ_SUFFIX=o
   1.954 +LIB_SUFFIX=a
   1.955 +ASM_SUFFIX=s
   1.956 +IMPORT_LIB_SUFFIX=
   1.957 +TARGET_MD_ARCH=unix
   1.958 +DIRENT_INO=d_ino
   1.959 +MOZ_USER_DIR=".mozilla"
   1.960 +
   1.961 +MOZ_JPEG_CFLAGS=
   1.962 +MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/media/libjpeg)'
   1.963 +MOZ_BZ2_CFLAGS=
   1.964 +MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
   1.965 +MOZ_PNG_CFLAGS="-I$_objdir/dist/include" # needed for freetype compilation
   1.966 +MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/media/libpng)'
   1.967 +
   1.968 +MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)'
   1.969 +MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)'
   1.970 +MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
   1.971 +XPCOM_FROZEN_LDOPTS='$(call EXPAND_LIBNAME_PATH,xul mozalloc,$(LIBXUL_DIST)/bin)'
   1.972 +LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS)'
   1.973 +XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
   1.974 +XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
   1.975 +
   1.976 +# These are specially defined on Windows only
   1.977 +case "$target" in
   1.978 +*-mingw*)
   1.979 +  XPCOM_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
   1.980 +  XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_staticruntime.$(LIB_SUFFIX)'
   1.981 +  ;;
   1.982 +*)
   1.983 +  XPCOM_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_GLUE_LDOPTS
   1.984 +  XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS=$XPCOM_STANDALONE_GLUE_LDOPTS
   1.985 +  ;;
   1.986 +esac
   1.987 +
   1.988 +MOZ_FS_LAYOUT=unix
   1.989 +
   1.990 +MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
   1.991 +
   1.992 +USE_DEPENDENT_LIBS=1
   1.993 +
   1.994 +_PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
   1.995 +
   1.996 +if test -n "$CROSS_COMPILE"; then
   1.997 +    OS_TARGET="${target_os}"
   1.998 +    OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
   1.999 +    OS_RELEASE=
  1.1000 +    case "${target_os}" in
  1.1001 +        linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
  1.1002 +        kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU/kFreeBSD ;;
  1.1003 +        gnu*)         OS_ARCH=GNU ;;
  1.1004 +        solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
  1.1005 +        mingw*)       OS_ARCH=WINNT OS_TARGET=WINNT ;;
  1.1006 +        darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
  1.1007 +        dragonfly*)   OS_ARCH=DragonFly OS_TARGET=DragonFly ;;
  1.1008 +        freebsd*)     OS_ARCH=FreeBSD OS_TARGET=FreeBSD ;;
  1.1009 +        netbsd*)      OS_ARCH=NetBSD OS_TARGET=NetBSD ;;
  1.1010 +        openbsd*)     OS_ARCH=OpenBSD OS_TARGET=OpenBSD ;;
  1.1011 +    esac
  1.1012 +    case "${target}" in
  1.1013 +        *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
  1.1014 +    esac
  1.1015 +else
  1.1016 +    OS_TARGET=`uname -s`
  1.1017 +    OS_ARCH=`uname -s | sed -e 's|/|_|g'`
  1.1018 +    OS_RELEASE=`uname -r`
  1.1019 +fi
  1.1020 +
  1.1021 +# Before this used `uname -m` when not cross compiling
  1.1022 +# but that breaks when you have a 64 bit kernel with a 32 bit userland.
  1.1023 +OS_TEST="${target_cpu}"
  1.1024 +
  1.1025 +HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
  1.1026 +
  1.1027 +#######################################################################
  1.1028 +# Master "Core Components" macros for getting the OS target           #
  1.1029 +#######################################################################
  1.1030 +
  1.1031 +#
  1.1032 +# If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
  1.1033 +# cross-compilation.
  1.1034 +#
  1.1035 +
  1.1036 +#
  1.1037 +# Define and override various archtecture-specific variables, including
  1.1038 +# HOST_OS_ARCH
  1.1039 +# OS_ARCH
  1.1040 +# OS_TEST
  1.1041 +# OS_TARGET
  1.1042 +# OS_RELEASE
  1.1043 +# OS_MINOR_RELEASE
  1.1044 +#
  1.1045 +
  1.1046 +case "$HOST_OS_ARCH" in
  1.1047 +mingw*)
  1.1048 +    HOST_OS_ARCH=WINNT
  1.1049 +    ;;
  1.1050 +darwin*)
  1.1051 +    HOST_OS_ARCH=Darwin
  1.1052 +    ;;
  1.1053 +linux*)
  1.1054 +    HOST_OS_ARCH=Linux
  1.1055 +    ;;
  1.1056 +kfreebsd*-gnu)
  1.1057 +    HOST_OS_ARCH=GNU_kFreeBSD
  1.1058 +    ;;
  1.1059 +gnu*)
  1.1060 +    HOST_OS_ARCH=GNU
  1.1061 +    ;;
  1.1062 +dragonfly*)
  1.1063 +    HOST_OS_ARCH=DragonFly
  1.1064 +    ;;
  1.1065 +freebsd*)
  1.1066 +    HOST_OS_ARCH=FreeBSD
  1.1067 +    ;;
  1.1068 +netbsd*)
  1.1069 +    HOST_OS_ARCH=NetBSD
  1.1070 +    ;;
  1.1071 +openbsd*)
  1.1072 +    HOST_OS_ARCH=OpenBSD
  1.1073 +    ;;
  1.1074 +solaris*)
  1.1075 +    HOST_OS_ARCH=SunOS
  1.1076 +    SOLARIS_SUNPRO_CC=
  1.1077 +    SOLARIS_SUNPRO_CXX=
  1.1078 +    if test -z "$GNU_CC"; then
  1.1079 +        if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
  1.1080 +            SOLARIS_SUNPRO_CC=1
  1.1081 +       fi
  1.1082 +    fi
  1.1083 +
  1.1084 +    if test -z "$GNU_CXX"; then
  1.1085 +       if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
  1.1086 +           SOLARIS_SUNPRO_CXX=1
  1.1087 +       fi
  1.1088 +    fi
  1.1089 +    AC_SUBST(SOLARIS_SUNPRO_CC)
  1.1090 +    AC_SUBST(SOLARIS_SUNPRO_CXX)
  1.1091 +    ;;
  1.1092 +esac
  1.1093 +
  1.1094 +case "$OS_ARCH" in
  1.1095 +WINNT)
  1.1096 +    if test -z "$CROSS_COMPILE" ; then
  1.1097 +        OS_TEST=`uname -p`
  1.1098 +    fi
  1.1099 +    ;;
  1.1100 +Windows_NT)
  1.1101 +#
  1.1102 +# If uname -s returns "Windows_NT", we assume that we are using
  1.1103 +# the uname.exe in MKS toolkit.
  1.1104 +#
  1.1105 +# The -r option of MKS uname only returns the major version number.
  1.1106 +# So we need to use its -v option to get the minor version number.
  1.1107 +# Moreover, it doesn't have the -p option, so we need to use uname -m.
  1.1108 +#
  1.1109 +    OS_ARCH=WINNT
  1.1110 +    OS_TARGET=WINNT
  1.1111 +    OS_MINOR_RELEASE=`uname -v`
  1.1112 +    if test "$OS_MINOR_RELEASE" = "00"; then
  1.1113 +        OS_MINOR_RELEASE=0
  1.1114 +    fi
  1.1115 +    OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
  1.1116 +    ;;
  1.1117 +MINGW*_NT*)
  1.1118 +#
  1.1119 +# If uname -s returns MINGW32_NT-5.1, we assume that we are using
  1.1120 +# the uname.exe in the MSYS tools.
  1.1121 +#
  1.1122 +    OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
  1.1123 +    OS_ARCH=WINNT
  1.1124 +    OS_TARGET=WINNT
  1.1125 +    ;;
  1.1126 +AIX)
  1.1127 +    OS_RELEASE=`uname -v`.`uname -r`
  1.1128 +    OS_TEST=${target_cpu}
  1.1129 +    ;;
  1.1130 +Darwin)
  1.1131 +    case "${target_cpu}" in
  1.1132 +    powerpc*)
  1.1133 +        OS_TEST=ppc
  1.1134 +        ;;
  1.1135 +    i*86*)
  1.1136 +        OS_TEST=i386
  1.1137 +        ;;
  1.1138 +    x86_64)
  1.1139 +        OS_TEST=x86_64
  1.1140 +        ;;
  1.1141 +    *)
  1.1142 +        if test -z "$CROSS_COMPILE" ; then
  1.1143 +            OS_TEST=`uname -p`
  1.1144 +        fi
  1.1145 +        ;;
  1.1146 +    esac
  1.1147 +    ;;
  1.1148 +esac
  1.1149 +
  1.1150 +# Only set CPU_ARCH if we recognize the value of OS_TEST
  1.1151 +
  1.1152 +case "$OS_TEST" in
  1.1153 +*86 | i86pc)
  1.1154 +    CPU_ARCH=x86
  1.1155 +    ;;
  1.1156 +
  1.1157 +powerpc64 | ppc64 | powerpc64le | ppc64le)
  1.1158 +    CPU_ARCH=ppc64
  1.1159 +    ;;
  1.1160 +
  1.1161 +powerpc | ppc | rs6000)
  1.1162 +    CPU_ARCH=ppc
  1.1163 +    ;;
  1.1164 +
  1.1165 +Alpha | alpha | ALPHA)
  1.1166 +    CPU_ARCH=Alpha
  1.1167 +    ;;
  1.1168 +
  1.1169 +s390)
  1.1170 +    CPU_ARCH=s390
  1.1171 +    ;;
  1.1172 +
  1.1173 +s390x)
  1.1174 +    CPU_ARCH=s390x
  1.1175 +    ;;
  1.1176 +
  1.1177 +hppa* | parisc)
  1.1178 +    CPU_ARCH=hppa
  1.1179 +    ;;
  1.1180 +
  1.1181 +sun4u | sparc*)
  1.1182 +    CPU_ARCH=sparc
  1.1183 +    ;;
  1.1184 +
  1.1185 +x86_64 | ia64)
  1.1186 +    CPU_ARCH="$OS_TEST"
  1.1187 +    ;;
  1.1188 +
  1.1189 +arm*)
  1.1190 +    CPU_ARCH=arm
  1.1191 +    ;;
  1.1192 +
  1.1193 +mips|mipsel)
  1.1194 +    CPU_ARCH="mips"
  1.1195 +    ;;
  1.1196 +
  1.1197 +aarch64*)
  1.1198 +    CPU_ARCH=aarch64
  1.1199 +    ;;
  1.1200 +esac
  1.1201 +
  1.1202 +if test -z "$OS_TARGET"; then
  1.1203 +    OS_TARGET=$OS_ARCH
  1.1204 +fi
  1.1205 +OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
  1.1206 +
  1.1207 +dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
  1.1208 +dnl ===============================================================
  1.1209 +INTEL_ARCHITECTURE=
  1.1210 +case "$OS_TEST" in
  1.1211 +    x86_64|i?86)
  1.1212 +      INTEL_ARCHITECTURE=1
  1.1213 +esac
  1.1214 +
  1.1215 +dnl Configure platform-specific CPU architecture compiler options.
  1.1216 +dnl ==============================================================
  1.1217 +MOZ_ARCH_OPTS
  1.1218 +
  1.1219 +dnl =================================================================
  1.1220 +dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
  1.1221 +dnl which is bad when cross compiling.
  1.1222 +dnl =================================================================
  1.1223 +if test "$COMPILE_ENVIRONMENT"; then
  1.1224 +configure_static_assert_macros='
  1.1225 +#define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
  1.1226 +#define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
  1.1227 +#define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
  1.1228 +'
  1.1229 +
  1.1230 +dnl test that the macros actually work:
  1.1231 +AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
  1.1232 +AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
  1.1233 + [AC_LANG_SAVE
  1.1234 +  AC_LANG_C
  1.1235 +  ac_cv_static_assertion_macros_work="yes"
  1.1236 +  AC_TRY_COMPILE([$configure_static_assert_macros],
  1.1237 +                 [CONFIGURE_STATIC_ASSERT(1)],
  1.1238 +                 ,
  1.1239 +                 ac_cv_static_assertion_macros_work="no")
  1.1240 +  AC_TRY_COMPILE([$configure_static_assert_macros],
  1.1241 +                 [CONFIGURE_STATIC_ASSERT(0)],
  1.1242 +                 ac_cv_static_assertion_macros_work="no",
  1.1243 +                 )
  1.1244 +  AC_LANG_CPLUSPLUS
  1.1245 +  AC_TRY_COMPILE([$configure_static_assert_macros],
  1.1246 +                 [CONFIGURE_STATIC_ASSERT(1)],
  1.1247 +                 ,
  1.1248 +                 ac_cv_static_assertion_macros_work="no")
  1.1249 +  AC_TRY_COMPILE([$configure_static_assert_macros],
  1.1250 +                 [CONFIGURE_STATIC_ASSERT(0)],
  1.1251 +                 ac_cv_static_assertion_macros_work="no",
  1.1252 +                 )
  1.1253 +  AC_LANG_RESTORE
  1.1254 + ])
  1.1255 +AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
  1.1256 +if test "$ac_cv_static_assertion_macros_work" = "no"; then
  1.1257 +    AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
  1.1258 +fi
  1.1259 +fi # COMPILE_ENVIRONMENT
  1.1260 +
  1.1261 +dnl ========================================================
  1.1262 +dnl Android libstdc++, placed here so it can use MOZ_ARCH
  1.1263 +dnl computed above.
  1.1264 +dnl ========================================================
  1.1265 +
  1.1266 +MOZ_ANDROID_STLPORT
  1.1267 +
  1.1268 +dnl ========================================================
  1.1269 +dnl Suppress Clang Argument Warnings
  1.1270 +dnl ========================================================
  1.1271 +if test -n "$CLANG_CC"; then
  1.1272 +    _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
  1.1273 +    CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
  1.1274 +fi
  1.1275 +if test -n "$CLANG_CXX"; then
  1.1276 +    _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
  1.1277 +fi
  1.1278 +
  1.1279 +dnl ========================================================
  1.1280 +dnl = Use Address Sanitizer
  1.1281 +dnl ========================================================
  1.1282 +MOZ_ARG_ENABLE_BOOL(address-sanitizer,
  1.1283 +[  --enable-address-sanitizer       Enable Address Sanitizer (default=no)],
  1.1284 +    MOZ_ASAN=1,
  1.1285 +    MOZ_ASAN= )
  1.1286 +if test -n "$MOZ_ASAN"; then
  1.1287 +    MOZ_LLVM_HACKS=1
  1.1288 +    AC_DEFINE(MOZ_ASAN)
  1.1289 +    MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
  1.1290 +fi
  1.1291 +AC_SUBST(MOZ_ASAN)
  1.1292 +AC_SUBST(LLVM_SYMBOLIZER)
  1.1293 +
  1.1294 +dnl ========================================================
  1.1295 +dnl = Enable hacks required for LLVM instrumentations
  1.1296 +dnl ========================================================
  1.1297 +MOZ_ARG_ENABLE_BOOL(llvm-hacks,
  1.1298 +[  --enable-llvm-hacks       Enable workarounds required for several LLVM instrumentations (default=no)],
  1.1299 +    MOZ_LLVM_HACKS=1,
  1.1300 +    MOZ_LLVM_HACKS= )
  1.1301 +if test -n "$MOZ_LLVM_HACKS"; then
  1.1302 +    MOZ_NO_WLZDEFS=1
  1.1303 +    MOZ_CFLAGS_NSS=1
  1.1304 +fi
  1.1305 +AC_SUBST(MOZ_NO_WLZDEFS)
  1.1306 +AC_SUBST(MOZ_CFLAGS_NSS)
  1.1307 +
  1.1308 +dnl ========================================================
  1.1309 +dnl GNU specific defaults
  1.1310 +dnl ========================================================
  1.1311 +if test "$GNU_CC"; then
  1.1312 +    MMX_FLAGS="-mmmx"
  1.1313 +    SSE_FLAGS="-msse"
  1.1314 +    SSE2_FLAGS="-msse2"
  1.1315 +    # Per bug 719659 comment 2, some of the headers on ancient build machines
  1.1316 +    # may require gnu89 inline semantics.  But otherwise, we use C99.
  1.1317 +    # But on OS X we just use C99 plus GNU extensions, in order to fix
  1.1318 +    # bug 917526.
  1.1319 +    CFLAGS="$CFLAGS -std=gnu99"
  1.1320 +    if test "${OS_ARCH}" != Darwin; then
  1.1321 +        CFLAGS="$CFLAGS -fgnu89-inline"
  1.1322 +    fi
  1.1323 +    # FIXME: Let us build with strict aliasing. bug 414641.
  1.1324 +    CFLAGS="$CFLAGS -fno-strict-aliasing"
  1.1325 +    MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(notdir $@) -o $@'
  1.1326 +    MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(notdir $@) -o $@'
  1.1327 +    WARNINGS_AS_ERRORS='-Werror'
  1.1328 +    DSO_CFLAGS=''
  1.1329 +    DSO_PIC_CFLAGS='-fPIC'
  1.1330 +    ASFLAGS="$ASFLAGS -fPIC"
  1.1331 +    AC_MSG_CHECKING([for --noexecstack option to as])
  1.1332 +    _SAVE_CFLAGS=$CFLAGS
  1.1333 +    CFLAGS="$CFLAGS -Wa,--noexecstack"
  1.1334 +    AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
  1.1335 +                     [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
  1.1336 +                     AC_MSG_RESULT([no]))
  1.1337 +    CFLAGS=$_SAVE_CFLAGS
  1.1338 +    AC_MSG_CHECKING([for -z noexecstack option to ld])
  1.1339 +    _SAVE_LDFLAGS=$LDFLAGS
  1.1340 +    LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
  1.1341 +    AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
  1.1342 +                  AC_MSG_RESULT([no])
  1.1343 +                  LDFLAGS=$_SAVE_LDFLAGS)
  1.1344 +
  1.1345 +    AC_MSG_CHECKING([for -z text option to ld])
  1.1346 +    _SAVE_LDFLAGS=$LDFLAGS
  1.1347 +    LDFLAGS="$LDFLAGS -Wl,-z,text"
  1.1348 +    AC_TRY_LINK(,,AC_MSG_RESULT([yes])
  1.1349 +                  [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,text"],
  1.1350 +                  AC_MSG_RESULT([no])
  1.1351 +                  LDFLAGS=$_SAVE_LDFLAGS)
  1.1352 +
  1.1353 +    AC_MSG_CHECKING([for --build-id option to ld])
  1.1354 +    _SAVE_LDFLAGS=$LDFLAGS
  1.1355 +    LDFLAGS="$LDFLAGS -Wl,--build-id"
  1.1356 +    AC_TRY_LINK(,,AC_MSG_RESULT([yes])
  1.1357 +                  [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,--build-id"],
  1.1358 +                  AC_MSG_RESULT([no])
  1.1359 +                  LDFLAGS=$_SAVE_LDFLAGS)
  1.1360 +
  1.1361 +    AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
  1.1362 +    HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
  1.1363 +    _SAVE_LDFLAGS=$LDFLAGS
  1.1364 +    LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
  1.1365 +    AC_TRY_LINK(,,AC_MSG_RESULT([yes])
  1.1366 +                  [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
  1.1367 +                  AC_MSG_RESULT([no]))
  1.1368 +    LDFLAGS=$_SAVE_LDFLAGS
  1.1369 +
  1.1370 +    # Check for -mssse3 on $CC
  1.1371 +    AC_MSG_CHECKING([if toolchain supports -mssse3 option])
  1.1372 +    HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
  1.1373 +    _SAVE_CFLAGS=$CFLAGS
  1.1374 +    CFLAGS="$CFLAGS -mssse3"
  1.1375 +    AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
  1.1376 +                     [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
  1.1377 +                     AC_MSG_RESULT([no]))
  1.1378 +    CFLAGS=$_SAVE_CFLAGS
  1.1379 +
  1.1380 +    # Check for -msse4.1 on $CC
  1.1381 +    AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
  1.1382 +    HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
  1.1383 +    _SAVE_CFLAGS=$CFLAGS
  1.1384 +    CFLAGS="$CFLAGS -msse4.1"
  1.1385 +    AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
  1.1386 +                     [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
  1.1387 +                     AC_MSG_RESULT([no]))
  1.1388 +    CFLAGS=$_SAVE_CFLAGS
  1.1389 +
  1.1390 +    case "${CPU_ARCH}" in
  1.1391 +    x86 | x86_64)
  1.1392 +      AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
  1.1393 +      AC_TRY_COMPILE([],
  1.1394 +                     [asm volatile ("vpermq      \$0xd8,%ymm0,%ymm0 \n");],
  1.1395 +                     result="yes", result="no")
  1.1396 +      AC_MSG_RESULT("$result")
  1.1397 +      if test "$result" = "yes"; then
  1.1398 +          HAVE_X86_AVX2=1
  1.1399 +          AC_DEFINE(HAVE_X86_AVX2)
  1.1400 +          AC_SUBST(HAVE_X86_AVX2)
  1.1401 +      fi
  1.1402 +    esac
  1.1403 +
  1.1404 +    DSO_LDOPTS='-shared'
  1.1405 +    if test "$GCC_USE_GNU_LD"; then
  1.1406 +        # Some tools like ASan use a runtime library that is only
  1.1407 +        # linked against executables, so we must allow undefined
  1.1408 +        # symbols for shared objects in some cases.
  1.1409 +        if test -z "$MOZ_NO_WLZDEFS"; then
  1.1410 +            # Don't allow undefined symbols in libraries
  1.1411 +            DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
  1.1412 +
  1.1413 +            # BSDs need `environ' exposed for posix_spawn (bug 753046)
  1.1414 +            case "$OS_TARGET" in
  1.1415 +            DragonFly|FreeBSD|NetBSD|OpenBSD)
  1.1416 +                if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
  1.1417 +                    DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
  1.1418 +                else
  1.1419 +                    DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
  1.1420 +                fi
  1.1421 +                ;;
  1.1422 +            esac
  1.1423 +        fi
  1.1424 +    fi
  1.1425 +
  1.1426 +    # Turn on GNU-specific warnings:
  1.1427 +    # -Wall - turn on a lot of warnings
  1.1428 +    # -Wpointer-arith - good to have
  1.1429 +    # -Wdeclaration-after-statement - MSVC doesn't like these
  1.1430 +    # -Werror=return-type - catches missing returns, zero false positives
  1.1431 +    # -Werror=int-to-pointer-cast - catches cast to pointer from integer of different size
  1.1432 +    # -Wtype-limits - catches overflow bugs, few false positives
  1.1433 +    # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
  1.1434 +    # -Wsign-compare - catches comparison of signed and unsigned types
  1.1435 +    #
  1.1436 +    _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
  1.1437 +    MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
  1.1438 +    MOZ_C_SUPPORTS_WARNING(-W, error=int-to-pointer-cast, ac_c_has_werror_int_to_pointer_cast)
  1.1439 +    MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
  1.1440 +    MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
  1.1441 +    MOZ_C_SUPPORTS_WARNING(-W, sign-compare, ac_c_has_sign_compare)
  1.1442 +
  1.1443 +    # Turn off the following warnings that -Wall turns on:
  1.1444 +    # -Wno-unused - lots of violations in third-party code
  1.1445 +    #
  1.1446 +    _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
  1.1447 +
  1.1448 +    if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
  1.1449 +       # Don't use -Wcast-align with ICC or clang
  1.1450 +       case "$CPU_ARCH" in
  1.1451 +           # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
  1.1452 +           hppa | ia64 | sparc | arm)
  1.1453 +           ;;
  1.1454 +           *)
  1.1455 +        _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
  1.1456 +           ;;
  1.1457 +       esac
  1.1458 +    fi
  1.1459 +
  1.1460 +    _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
  1.1461 +    _USE_CPP_INCLUDE_FLAG=1
  1.1462 +    ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
  1.1463 +
  1.1464 +elif test "$SOLARIS_SUNPRO_CC"; then
  1.1465 +    DSO_CFLAGS=''
  1.1466 +    if test "$CPU_ARCH" = "sparc"; then
  1.1467 +        # for Sun Studio on Solaris/SPARC
  1.1468 +        DSO_PIC_CFLAGS='-xcode=pic32'
  1.1469 +    else
  1.1470 +        DSO_PIC_CFLAGS='-KPIC'
  1.1471 +    fi
  1.1472 +    _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
  1.1473 +else
  1.1474 +    MKSHLIB='$(LD) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
  1.1475 +    MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
  1.1476 +
  1.1477 +    DSO_LDOPTS='-shared'
  1.1478 +    if test "$GNU_LD"; then
  1.1479 +        # Don't allow undefined symbols in libraries
  1.1480 +        DSO_LDOPTS="$DSO_LDOPTS -z defs"
  1.1481 +    fi
  1.1482 +
  1.1483 +    DSO_CFLAGS=''
  1.1484 +    DSO_PIC_CFLAGS='-KPIC'
  1.1485 +    _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
  1.1486 +fi
  1.1487 +
  1.1488 +if test "$GNU_CXX"; then
  1.1489 +    # FIXME: Let us build with strict aliasing. bug 414641.
  1.1490 +    CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
  1.1491 +
  1.1492 +    # Turn on GNU-specific warnings:
  1.1493 +    # -Wall - turn on a lot of warnings
  1.1494 +    # -Wpointer-arith - good to have
  1.1495 +    # -Woverloaded-virtual - ???
  1.1496 +    # -Werror=return-type - catches missing returns, zero false positives
  1.1497 +    # -Werror=int-to-pointer-cast - catches cast to pointer from integer of different size
  1.1498 +    # -Wtype-limits - catches overflow bugs, few false positives
  1.1499 +    # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
  1.1500 +    # -Wsign-compare - catches comparison of signed and unsigned types
  1.1501 +    #
  1.1502 +    _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
  1.1503 +    MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
  1.1504 +    MOZ_CXX_SUPPORTS_WARNING(-W, error=int-to-pointer-cast, ac_cxx_has_werror_int_to_pointer_cast)
  1.1505 +    MOZ_CXX_SUPPORTS_WARNING(-W, type-limits, ac_cxx_has_wtype_limits)
  1.1506 +    MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
  1.1507 +    MOZ_CXX_SUPPORTS_WARNING(-W, sign-compare, ac_cxx_has_sign_compare)
  1.1508 +
  1.1509 +    # Turn off the following warnings that -Wall turns on:
  1.1510 +    # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
  1.1511 +    # -Wno-inline-new-delete - we inline 'new' and 'delete' in mozalloc
  1.1512 +    #   for performance reasons, and because GCC and clang accept it (though
  1.1513 +    #   clang warns about it).
  1.1514 +    #
  1.1515 +    MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
  1.1516 +    MOZ_CXX_SUPPORTS_WARNING(-Wno-, inline-new-delete, ac_cxx_has_wno_inline_new_delete)
  1.1517 +
  1.1518 +    if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
  1.1519 +       # Don't use -Wcast-align with ICC or clang
  1.1520 +       case "$CPU_ARCH" in
  1.1521 +           # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
  1.1522 +           hppa | ia64 | sparc | arm)
  1.1523 +           ;;
  1.1524 +           *)
  1.1525 +        _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
  1.1526 +           ;;
  1.1527 +       esac
  1.1528 +    fi
  1.1529 +
  1.1530 +    _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
  1.1531 +    _USE_CPP_INCLUDE_FLAG=1
  1.1532 +
  1.1533 +    # Recent clang and gcc support C++11 deleted functions without warnings if
  1.1534 +    # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
  1.1535 +    # versions).  We can't use -std=c++0x yet, so gcc's support must remain
  1.1536 +    # unused.  But clang's warning can be disabled, so when compiling with clang
  1.1537 +    # we use it to opt out of the warning, enabling (macro-encapsulated) use of
  1.1538 +    # deleted function syntax.
  1.1539 +    if test "$CLANG_CXX"; then
  1.1540 +        _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
  1.1541 +        MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
  1.1542 +    fi
  1.1543 +
  1.1544 +else
  1.1545 +    _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
  1.1546 +fi
  1.1547 +
  1.1548 +dnl gcc can come with its own linker so it is better to use the pass-thru calls
  1.1549 +dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
  1.1550 +dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
  1.1551 +dnl normal behavior.
  1.1552 +dnl ========================================================
  1.1553 +MKSHLIB_FORCE_ALL=
  1.1554 +MKSHLIB_UNFORCE_ALL=
  1.1555 +
  1.1556 +if test "$COMPILE_ENVIRONMENT"; then
  1.1557 +if test "$GNU_CC"; then
  1.1558 +  AC_MSG_CHECKING(whether ld has archive extraction flags)
  1.1559 +  AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
  1.1560 +   [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
  1.1561 +    ac_cv_mkshlib_force_and_unforce="no"
  1.1562 +    exec 3<&0 <<LOOP_INPUT
  1.1563 +  force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
  1.1564 +  force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
  1.1565 +  force="-Wl,-all";              unforce="-Wl,-none"
  1.1566 +LOOP_INPUT
  1.1567 +    while read line
  1.1568 +    do
  1.1569 +      eval $line
  1.1570 +      LDFLAGS=$force
  1.1571 +      LIBS=$unforce
  1.1572 +      AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
  1.1573 +    done
  1.1574 +    exec 0<&3 3<&-
  1.1575 +    LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
  1.1576 +   ])
  1.1577 +  if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
  1.1578 +    AC_MSG_RESULT(no)
  1.1579 +  else
  1.1580 +    AC_MSG_RESULT(yes)
  1.1581 +    eval $ac_cv_mkshlib_force_and_unforce
  1.1582 +    MKSHLIB_FORCE_ALL=$force
  1.1583 +    MKSHLIB_UNFORCE_ALL=$unforce
  1.1584 +  fi
  1.1585 +fi # GNU_CC
  1.1586 +fi # COMPILE_ENVIRONMENT
  1.1587 +
  1.1588 +dnl ========================================================
  1.1589 +dnl Checking for 64-bit OS
  1.1590 +dnl ========================================================
  1.1591 +if test "$COMPILE_ENVIRONMENT"; then
  1.1592 +AC_LANG_SAVE
  1.1593 +AC_LANG_C
  1.1594 +AC_MSG_CHECKING(for 64-bit OS)
  1.1595 +AC_TRY_COMPILE([$configure_static_assert_macros],
  1.1596 +               [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
  1.1597 +               result="yes", result="no")
  1.1598 +AC_MSG_RESULT("$result")
  1.1599 +if test "$result" = "yes"; then
  1.1600 +    AC_DEFINE(HAVE_64BIT_OS)
  1.1601 +    HAVE_64BIT_OS=1
  1.1602 +fi
  1.1603 +AC_SUBST(HAVE_64BIT_OS)
  1.1604 +AC_LANG_RESTORE
  1.1605 +fi # COMPILE_ENVIRONMENT
  1.1606 +
  1.1607 +dnl ========================================================
  1.1608 +dnl = Use profiling compile flags
  1.1609 +dnl ========================================================
  1.1610 +MOZ_ARG_ENABLE_BOOL(profiling,
  1.1611 +[  --enable-profiling      Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
  1.1612 +    MOZ_PROFILING=1,
  1.1613 +    MOZ_PROFILING= )
  1.1614 +
  1.1615 +dnl ========================================================
  1.1616 +dnl = Turn on systrace for android/b2g.
  1.1617 +dnl ========================================================
  1.1618 +MOZ_ARG_ENABLE_BOOL(systrace,
  1.1619 +[  --enable-systrace       Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
  1.1620 +    MOZ_USE_SYSTRACE=1,
  1.1621 +    MOZ_USE_SYSTRACE= )
  1.1622 +if test -n "$MOZ_USE_SYSTRACE"; then
  1.1623 +    AC_DEFINE(MOZ_USE_SYSTRACE)
  1.1624 +fi
  1.1625 +
  1.1626 +# For profiling builds keep the symbol information
  1.1627 +if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
  1.1628 +    case "$OS_TARGET" in
  1.1629 +    Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
  1.1630 +        STRIP_FLAGS="--strip-debug"
  1.1631 +        ;;
  1.1632 +    esac
  1.1633 +fi
  1.1634 +
  1.1635 +dnl ========================================================
  1.1636 +dnl = Use Valgrind
  1.1637 +dnl ========================================================
  1.1638 +MOZ_ARG_ENABLE_BOOL(valgrind,
  1.1639 +[  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
  1.1640 +    MOZ_VALGRIND=1,
  1.1641 +    MOZ_VALGRIND= )
  1.1642 +if test -n "$MOZ_VALGRIND"; then
  1.1643 +    MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
  1.1644 +        AC_MSG_ERROR(
  1.1645 +            [--enable-valgrind specified but Valgrind is not installed]))
  1.1646 +    AC_DEFINE(MOZ_VALGRIND)
  1.1647 +fi
  1.1648 +AC_SUBST(MOZ_VALGRIND)
  1.1649 +
  1.1650 +dnl ========================================================
  1.1651 +dnl jprof
  1.1652 +dnl ========================================================
  1.1653 +MOZ_ARG_ENABLE_BOOL(jprof,
  1.1654 +[  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
  1.1655 +    MOZ_JPROF=1,
  1.1656 +    MOZ_JPROF= )
  1.1657 +if test -n "$MOZ_JPROF"; then
  1.1658 +    MOZ_PROFILING=1
  1.1659 +    AC_DEFINE(MOZ_JPROF)
  1.1660 +fi
  1.1661 +
  1.1662 +dnl ========================================================
  1.1663 +dnl SPS Profiler
  1.1664 +dnl ========================================================
  1.1665 +MOZ_ENABLE_PROFILER_SPS=1
  1.1666 +
  1.1667 +case "${OS_TARGET}" in
  1.1668 +Android)
  1.1669 +    case "${CPU_ARCH}" in
  1.1670 +    x86 | arm) ;;
  1.1671 +    *)
  1.1672 +        MOZ_ENABLE_PROFILER_SPS=
  1.1673 +    esac
  1.1674 +    ;;
  1.1675 +Linux)
  1.1676 +    case "${CPU_ARCH}" in
  1.1677 +    x86 | x86_64) ;;
  1.1678 +    *)
  1.1679 +        MOZ_ENABLE_PROFILER_SPS=
  1.1680 +    esac
  1.1681 +    ;;
  1.1682 +WINNT|Darwin) ;;
  1.1683 +*)
  1.1684 +    MOZ_ENABLE_PROFILER_SPS=
  1.1685 +    ;;
  1.1686 +esac
  1.1687 +
  1.1688 +if test -n "$MOZ_ENABLE_PROFILER_SPS"; then
  1.1689 +    AC_DEFINE(MOZ_ENABLE_PROFILER_SPS)
  1.1690 +fi
  1.1691 +
  1.1692 +dnl ========================================================
  1.1693 +dnl shark
  1.1694 +dnl ========================================================
  1.1695 +MOZ_ARG_ENABLE_BOOL(shark,
  1.1696 +[  --enable-shark          Enable shark remote profiling. Implies --enable-profiling.],
  1.1697 +    MOZ_SHARK=1,
  1.1698 +    MOZ_SHARK= )
  1.1699 +if test -n "$MOZ_SHARK"; then
  1.1700 +    MOZ_PROFILING=1
  1.1701 +    AC_DEFINE(MOZ_SHARK)
  1.1702 +fi
  1.1703 +
  1.1704 +dnl ========================================================
  1.1705 +dnl instruments
  1.1706 +dnl ========================================================
  1.1707 +MOZ_ARG_ENABLE_BOOL(instruments,
  1.1708 +[  --enable-instruments    Enable instruments remote profiling. Implies --enable-profiling.],
  1.1709 +    MOZ_INSTRUMENTS=1,
  1.1710 +    MOZ_INSTRUMENTS= )
  1.1711 +if test -n "$MOZ_INSTRUMENTS"; then
  1.1712 +    MOZ_PROFILING=1
  1.1713 +    AC_DEFINE(MOZ_INSTRUMENTS)
  1.1714 +fi
  1.1715 +
  1.1716 +dnl ========================================================
  1.1717 +dnl callgrind
  1.1718 +dnl ========================================================
  1.1719 +MOZ_ARG_ENABLE_BOOL(callgrind,
  1.1720 +[  --enable-callgrind      Enable callgrind profiling. Implies --enable-profiling.],
  1.1721 +    MOZ_CALLGRIND=1,
  1.1722 +    MOZ_CALLGRIND= )
  1.1723 +if test -n "$MOZ_CALLGRIND"; then
  1.1724 +    MOZ_PROFILING=1
  1.1725 +    AC_DEFINE(MOZ_CALLGRIND)
  1.1726 +fi
  1.1727 +
  1.1728 +dnl ========================================================
  1.1729 +dnl vtune
  1.1730 +dnl ========================================================
  1.1731 +MOZ_ARG_ENABLE_BOOL(vtune,
  1.1732 +[  --enable-vtune          Enable vtune profiling. Implies --enable-profiling.],
  1.1733 +    MOZ_VTUNE=1,
  1.1734 +    MOZ_VTUNE= )
  1.1735 +if test -n "$MOZ_VTUNE"; then
  1.1736 +    MOZ_PROFILING=1
  1.1737 +    AC_DEFINE(MOZ_VTUNE)
  1.1738 +fi
  1.1739 +
  1.1740 +dnl ========================================================
  1.1741 +dnl Profiling
  1.1742 +dnl ========================================================
  1.1743 +if test -n "$MOZ_PROFILING"; then
  1.1744 +    AC_DEFINE(MOZ_PROFILING)
  1.1745 +fi
  1.1746 +
  1.1747 +dnl ========================================================
  1.1748 +dnl System overrides of the defaults for host
  1.1749 +dnl ========================================================
  1.1750 +case "$host" in
  1.1751 +*mingw*)
  1.1752 +    if test -n "$_WIN32_MSVC"; then
  1.1753 +        HOST_AR=lib
  1.1754 +        HOST_AR_FLAGS='-NOLOGO -OUT:$@'
  1.1755 +        HOST_CFLAGS="$HOST_CFLAGS -TC -nologo"
  1.1756 +        HOST_RANLIB='echo ranlib'
  1.1757 +    else
  1.1758 +        HOST_CFLAGS="$HOST_CFLAGS -mwindows"
  1.1759 +    fi
  1.1760 +    HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
  1.1761 +    HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
  1.1762 +    HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
  1.1763 +    HOST_BIN_SUFFIX=.exe
  1.1764 +    case "$host" in
  1.1765 +    *mingw*)
  1.1766 +        PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
  1.1767 +        ;;
  1.1768 +    esac
  1.1769 +
  1.1770 +    case "${host_cpu}" in
  1.1771 +    i*86)
  1.1772 +        if test -n "$_WIN32_MSVC"; then
  1.1773 +            HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
  1.1774 +        fi
  1.1775 +        ;;
  1.1776 +    x86_64)
  1.1777 +        if test -n "$_WIN32_MSVC"; then
  1.1778 +            HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
  1.1779 +        fi
  1.1780 +        HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
  1.1781 +        ;;
  1.1782 +    esac
  1.1783 +    ;;
  1.1784 +
  1.1785 +*-darwin*)
  1.1786 +    HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
  1.1787 +    HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
  1.1788 +    HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
  1.1789 +    ;;
  1.1790 +
  1.1791 +*-linux*|*-kfreebsd*-gnu|*-gnu*)
  1.1792 +    HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
  1.1793 +    HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
  1.1794 +    HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
  1.1795 +    ;;
  1.1796 +
  1.1797 +*)
  1.1798 +    HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
  1.1799 +    HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
  1.1800 +    ;;
  1.1801 +esac
  1.1802 +
  1.1803 +dnl Check for using a custom <inttypes.h> implementation
  1.1804 +dnl ========================================================
  1.1805 +AC_MSG_CHECKING(for custom <inttypes.h> implementation)
  1.1806 +if test "$MOZ_CUSTOM_INTTYPES_H"; then
  1.1807 +  AC_DEFINE_UNQUOTED(MOZ_CUSTOM_INTTYPES_H, "$MOZ_CUSTOM_INTTYPES_H")
  1.1808 +  AC_MSG_RESULT(using $MOZ_CUSTOM_INTTYPES_H)
  1.1809 +else
  1.1810 +  AC_MSG_RESULT(none specified)
  1.1811 +fi
  1.1812 +
  1.1813 +dnl Get mozilla version from central milestone file
  1.1814 +MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
  1.1815 +MOZILLA_UAVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -uaversion`
  1.1816 +MOZILLA_SYMBOLVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -symbolversion`
  1.1817 +
  1.1818 +dnl Get version of various core apps from the version files.
  1.1819 +FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
  1.1820 +
  1.1821 +if test -z "$FIREFOX_VERSION"; then
  1.1822 +    AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
  1.1823 +fi
  1.1824 +
  1.1825 +AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
  1.1826 +AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
  1.1827 +AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
  1.1828 +AC_SUBST(MOZILLA_SYMBOLVERSION)
  1.1829 +
  1.1830 +MOZ_DOING_LTO(lto_is_enabled)
  1.1831 +
  1.1832 +dnl ========================================================
  1.1833 +dnl System overrides of the defaults for target
  1.1834 +dnl ========================================================
  1.1835 +
  1.1836 +case "$target" in
  1.1837 +*-aix*)
  1.1838 +    AC_DEFINE(AIX)
  1.1839 +    if test ! "$GNU_CC"; then
  1.1840 +        if test ! "$HAVE_64BIT_OS"; then
  1.1841 +            # Compiling with Visual Age C++ object model compat is the
  1.1842 +            # default. To compile with object model ibm, add
  1.1843 +            # AIX_OBJMODEL=ibm to .mozconfig.
  1.1844 +            if test "$AIX_OBJMODEL" = "ibm"; then
  1.1845 +                CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
  1.1846 +            else
  1.1847 +                AIX_OBJMODEL=compat
  1.1848 +            fi
  1.1849 +        else
  1.1850 +            AIX_OBJMODEL=compat
  1.1851 +        fi
  1.1852 +        AC_SUBST(AIX_OBJMODEL)
  1.1853 +        DSO_LDOPTS='-qmkshrobj=1'
  1.1854 +        DSO_CFLAGS='-qflag=w:w'
  1.1855 +        DSO_PIC_CFLAGS=
  1.1856 +        LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
  1.1857 +        MOZ_FIX_LINK_PATHS=
  1.1858 +        MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
  1.1859 +        MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
  1.1860 +        if test "$COMPILE_ENVIRONMENT"; then
  1.1861 +            AC_LANG_SAVE
  1.1862 +            AC_LANG_CPLUSPLUS
  1.1863 +            AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
  1.1864 +            AC_TRY_COMPILE([],
  1.1865 +                [#if (__IBMCPP__ < 900)
  1.1866 +                 #error "Bad compiler"
  1.1867 +                 #endif],
  1.1868 +                _BAD_COMPILER=,_BAD_COMPILER=1)
  1.1869 +            if test -n "$_BAD_COMPILER"; then
  1.1870 +                AC_MSG_RESULT([no])
  1.1871 +                AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
  1.1872 +            else
  1.1873 +                AC_MSG_RESULT([yes])
  1.1874 +            fi
  1.1875 +            AC_LANG_RESTORE
  1.1876 +            TARGET_COMPILER_ABI="ibmc"
  1.1877 +            CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
  1.1878 +            CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
  1.1879 +        fi
  1.1880 +    fi
  1.1881 +    case "${target_os}" in
  1.1882 +    aix4.1*)
  1.1883 +        DLL_SUFFIX='_shr.a'
  1.1884 +        ;;
  1.1885 +    esac
  1.1886 +    if test "$COMPILE_ENVIRONMENT"; then
  1.1887 +        MOZ_CHECK_HEADERS(sys/inttypes.h)
  1.1888 +    fi
  1.1889 +    AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
  1.1890 +    ;;
  1.1891 +
  1.1892 +*-darwin*)
  1.1893 +    MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
  1.1894 +    MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
  1.1895 +    MOZ_OPTIMIZE_FLAGS="-O3"
  1.1896 +    # Statically disable jemalloc on 10.5 and 32-bit 10.6.  See bug 702250.
  1.1897 +    if test "$HAVE_64BIT_OS"; then
  1.1898 +        MOZ_MEMORY=1
  1.1899 +    fi
  1.1900 +    DLL_SUFFIX=".dylib"
  1.1901 +    DSO_LDOPTS=''
  1.1902 +    STRIP_FLAGS="$STRIP_FLAGS -x -S"
  1.1903 +    # Check whether we're targeting OS X or iOS
  1.1904 +    AC_CACHE_CHECK(for iOS target,
  1.1905 +                   ac_cv_ios_target,
  1.1906 +                   [AC_TRY_COMPILE([#include <TargetConditionals.h>
  1.1907 +#if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
  1.1908 +#error not iOS
  1.1909 +#endif],
  1.1910 +                                   [],
  1.1911 +                                   ac_cv_ios_target="yes",
  1.1912 +                                   ac_cv_ios_target="no")])
  1.1913 +    if test "$ac_cv_ios_target" = "yes"; then
  1.1914 +        AC_DEFINE(XP_IOS)
  1.1915 +        AC_DEFINE(XP_DARWIN)
  1.1916 +        _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
  1.1917 +    else
  1.1918 +        AC_DEFINE(XP_MACOSX)
  1.1919 +        AC_DEFINE(XP_DARWIN)
  1.1920 +        _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
  1.1921 +        # The ExceptionHandling framework is needed for Objective-C exception
  1.1922 +        # logging code in nsObjCExceptions.h. Currently we only use that in debug
  1.1923 +        # builds.
  1.1924 +        MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
  1.1925 +    fi
  1.1926 +    TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
  1.1927 +
  1.1928 +    if test "x$lto_is_enabled" = "xyes"; then
  1.1929 +        echo "Skipping -dead_strip because lto is enabled."
  1.1930 +    dnl DTrace and -dead_strip don't interact well. See bug 403132.
  1.1931 +    dnl ===================================================================
  1.1932 +    elif test "x$enable_dtrace" = "xyes"; then
  1.1933 +        echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
  1.1934 +    else
  1.1935 +        dnl check for the presence of the -dead_strip linker flag
  1.1936 +        AC_MSG_CHECKING([for -dead_strip option to ld])
  1.1937 +        _SAVE_LDFLAGS=$LDFLAGS
  1.1938 +        LDFLAGS="$LDFLAGS -Wl,-dead_strip"
  1.1939 +        AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
  1.1940 +        if test -n "$_HAVE_DEAD_STRIP" ; then
  1.1941 +            AC_MSG_RESULT([yes])
  1.1942 +            MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
  1.1943 +        else
  1.1944 +            AC_MSG_RESULT([no])
  1.1945 +        fi
  1.1946 +
  1.1947 +        LDFLAGS=$_SAVE_LDFLAGS
  1.1948 +    fi
  1.1949 +
  1.1950 +    dnl With newer linkers we need to pass -allow_heap_execute because of
  1.1951 +    dnl Microsoft Silverlight (5.1.10411.0 at least).
  1.1952 +    AC_MSG_CHECKING([for -allow_heap_execute option to ld])
  1.1953 +    _SAVE_LDFLAGS=$LDFLAGS
  1.1954 +    LDFLAGS="$LDFLAGS -Wl,-allow_heap_execute"
  1.1955 +    AC_TRY_LINK(,[return 0;],_HAVE_ALLOW_HEAP_EXECUTE=1,
  1.1956 +                _HAVE_ALLOW_HEAP_EXECUTE=)
  1.1957 +    if test -n "$_HAVE_ALLOW_HEAP_EXECUTE" ; then
  1.1958 +        AC_MSG_RESULT([yes])
  1.1959 +        MOZ_ALLOW_HEAP_EXECUTE_FLAGS="-Wl,-allow_heap_execute"
  1.1960 +    else
  1.1961 +        AC_MSG_RESULT([no])
  1.1962 +    fi
  1.1963 +    LDFLAGS=$_SAVE_LDFLAGS
  1.1964 +
  1.1965 +    MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
  1.1966 +    ;;
  1.1967 +
  1.1968 +ia64*-hpux*)
  1.1969 +    DLL_SUFFIX=".so"
  1.1970 +    if test ! "$GNU_CC"; then
  1.1971 +       DSO_LDOPTS='-b'
  1.1972 +       DSO_CFLAGS=""
  1.1973 +       DSO_PIC_CFLAGS=
  1.1974 +       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
  1.1975 +       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
  1.1976 +       CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
  1.1977 +    else
  1.1978 +       DSO_LDOPTS='-b -E'
  1.1979 +       MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
  1.1980 +       MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
  1.1981 +    fi
  1.1982 +    MOZ_FIX_LINK_PATHS=
  1.1983 +    AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
  1.1984 +    AC_DEFINE(_LARGEFILE64_SOURCE)
  1.1985 +    ;;
  1.1986 +
  1.1987 +*-hpux*)
  1.1988 +    DLL_SUFFIX=".sl"
  1.1989 +    if test ! "$GNU_CC"; then
  1.1990 +        DSO_LDOPTS='-b -Wl,+s'
  1.1991 +        DSO_CFLAGS=""
  1.1992 +        DSO_PIC_CFLAGS="+Z"
  1.1993 +        MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
  1.1994 +        MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
  1.1995 +        CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
  1.1996 +    else
  1.1997 +        DSO_LDOPTS='-b -E +s'
  1.1998 +        MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
  1.1999 +        MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
  1.2000 +    fi
  1.2001 +    MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
  1.2002 +    AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
  1.2003 +    ;;
  1.2004 +
  1.2005 +*-android*|*-linuxandroid*)
  1.2006 +    AC_DEFINE(NO_PW_GECOS)
  1.2007 +    no_x=yes
  1.2008 +    if test -n "$gonkdir"; then
  1.2009 +        _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
  1.2010 +        _PLATFORM_HAVE_RIL=1
  1.2011 +        MOZ_B2G_FM=1
  1.2012 +        MOZ_SYNTH_PICO=1
  1.2013 +    else
  1.2014 +        _PLATFORM_DEFAULT_TOOLKIT=cairo-android
  1.2015 +        MOZ_LINKER=1
  1.2016 +    fi
  1.2017 +    TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
  1.2018 +
  1.2019 +    MOZ_GFX_OPTIMIZE_MOBILE=1
  1.2020 +    MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions"
  1.2021 +    ;;
  1.2022 +
  1.2023 +*-*linux*)
  1.2024 +    # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
  1.2025 +    # Similarly for GNU_CXX and INTEL_CXX.
  1.2026 +    if test "$INTEL_CC" -o "$INTEL_CXX"; then
  1.2027 +        # -Os has been broken on Intel's C/C++ compilers for quite a
  1.2028 +        # while; Intel recommends against using it.
  1.2029 +        MOZ_OPTIMIZE_FLAGS="-O2"
  1.2030 +    elif test "$GNU_CC" -o "$GNU_CXX"; then
  1.2031 +        case $GCC_VERSION in
  1.2032 +        4.5.*)
  1.2033 +            # -Os is broken on gcc 4.5.x we need to tweak it to get good results.
  1.2034 +            MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
  1.2035 +        esac
  1.2036 +        MOZ_PGO_OPTIMIZE_FLAGS="-O3"
  1.2037 +        MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
  1.2038 +    fi
  1.2039 +
  1.2040 +    TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
  1.2041 +
  1.2042 +    MOZ_MEMORY=1
  1.2043 +
  1.2044 +    case "${target_cpu}" in
  1.2045 +    alpha*)
  1.2046 +        CFLAGS="$CFLAGS -mieee"
  1.2047 +        CXXFLAGS="$CXXFLAGS -mieee"
  1.2048 +    ;;
  1.2049 +    esac
  1.2050 +
  1.2051 +    if test -z "$MC"; then
  1.2052 +        MC=mc.exe
  1.2053 +    fi
  1.2054 +    ;;
  1.2055 +*-mingw*)
  1.2056 +    DSO_CFLAGS=
  1.2057 +    DSO_PIC_CFLAGS=
  1.2058 +    DLL_SUFFIX=.dll
  1.2059 +    RC=rc.exe
  1.2060 +    MC=mc.exe
  1.2061 +    # certain versions of cygwin's makedepend barf on the
  1.2062 +    # #include <string> vs -I./dist/include/string issue so don't use it
  1.2063 +    XPCOM_FROZEN_LDOPTS='$(call EXPAND_LIBNAME_PATH,xul mozalloc,$(LIBXUL_DIST)/lib)'
  1.2064 +    if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
  1.2065 +        CC="$CC -mwindows"
  1.2066 +        CXX="$CXX -mwindows"
  1.2067 +        CPP="$CPP -mwindows"
  1.2068 +        CFLAGS="$CFLAGS -mms-bitfields"
  1.2069 +        CXXFLAGS="$CXXFLAGS -mms-bitfields"
  1.2070 +        DSO_LDOPTS='-shared'
  1.2071 +        MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
  1.2072 +        MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
  1.2073 +        RC='$(WINDRES)'
  1.2074 +        # Use static libgcc and libstdc++
  1.2075 +        LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++"
  1.2076 +        NSPR_LDFLAGS="$NSPR_LDFLAGS -static-libgcc"
  1.2077 +        # Use temp file for windres (bug 213281)
  1.2078 +        RCFLAGS='-O coff --use-temp-file'
  1.2079 +        # mingw doesn't require kernel32, user32, and advapi32 explicitly
  1.2080 +        LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32 -lnetapi32"
  1.2081 +        MOZ_FIX_LINK_PATHS=
  1.2082 +        DLL_PREFIX=
  1.2083 +        IMPORT_LIB_SUFFIX=dll.a
  1.2084 +
  1.2085 +        # We use mix of both POSIX and Win32 printf format across the tree, so format
  1.2086 +        # warnings are useless on mingw.
  1.2087 +        MOZ_C_SUPPORTS_WARNING(-Wno-, format, ac_c_has_wno_format)
  1.2088 +        MOZ_CXX_SUPPORTS_WARNING(-Wno-, format, ac_cxx_has_wno_format)
  1.2089 +    else
  1.2090 +        TARGET_COMPILER_ABI=msvc
  1.2091 +        HOST_CC='$(CC)'
  1.2092 +        HOST_CXX='$(CXX)'
  1.2093 +        HOST_LD='$(LD)'
  1.2094 +        if test "$AS_BIN"; then
  1.2095 +            AS="$(basename "$AS_BIN")"
  1.2096 +        fi
  1.2097 +        AR='lib'
  1.2098 +        AR_FLAGS='-NOLOGO -OUT:$@'
  1.2099 +        AR_EXTRACT=
  1.2100 +        RANLIB='echo not_ranlib'
  1.2101 +        STRIP='echo not_strip'
  1.2102 +        PKG_SKIP_STRIP=1
  1.2103 +        XARGS=xargs
  1.2104 +        ZIP=zip
  1.2105 +        UNZIP=unzip
  1.2106 +        DOXYGEN=:
  1.2107 +        ASM_SUFFIX=asm
  1.2108 +        OBJ_SUFFIX=obj
  1.2109 +        LIB_SUFFIX=lib
  1.2110 +        DLL_PREFIX=
  1.2111 +        LIB_PREFIX=
  1.2112 +        IMPORT_LIB_SUFFIX=lib
  1.2113 +        MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
  1.2114 +        MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
  1.2115 +        MKSHLIB_FORCE_ALL=
  1.2116 +        MKSHLIB_UNFORCE_ALL=
  1.2117 +        DSO_LDOPTS=-SUBSYSTEM:WINDOWS
  1.2118 +        _USE_CPP_INCLUDE_FLAG=1
  1.2119 +        _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
  1.2120 +        _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
  1.2121 +        CFLAGS="$CFLAGS -W3 -Gy"
  1.2122 +        CXXFLAGS="$CXXFLAGS -W3 -Gy"
  1.2123 +        if test "$_CC_SUITE" -ge "12"; then
  1.2124 +            dnl VS2013+ requires -FS when parallel building by make -jN.
  1.2125 +            dnl If nothing, compiler sometimes causes C1041 error.
  1.2126 +            dnl
  1.2127 +            dnl Visual Studio 2013 supports -Gw flags
  1.2128 +            dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
  1.2129 +            CFLAGS="$CFLAGS -FS -Gw"
  1.2130 +            CXXFLAGS="$CXXFLAGS -FS -Gw"
  1.2131 +        fi
  1.2132 +        # khuey says we can safely ignore MSVC warning C4251
  1.2133 +        # MSVC warning C4244 (implicit type conversion may lose data) warns
  1.2134 +        # and requires workarounds for perfectly valid code.  Also, GCC/clang
  1.2135 +        # don't warn about it by default. So for consistency/sanity, we turn
  1.2136 +        # it off on MSVC, too.
  1.2137 +        # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
  1.2138 +        # MSVC warning C4351 warns of newly conformant behavior as of VS2005.
  1.2139 +        # MSVC warning C4482 warns when an enum value is refered specifing the
  1.2140 +        # name of the enum itself.  This behavior is allowed in C++11, and the
  1.2141 +        # warning has been removed in VS2012.
  1.2142 +        # MSVC warning C4800 warns when a value is implicitly cast to bool,
  1.2143 +        # because this also forces narrowing to a single byte, which can be a
  1.2144 +        # perf hit.  But this matters so little in practice (and often we want
  1.2145 +        # that behavior) that it's better to turn it off.
  1.2146 +        # MSVC warning C4819 warns some UTF-8 characters (e.g. copyright sign)
  1.2147 +        # on non-Western system locales even if it is in a comment.
  1.2148 +        CFLAGS="$CFLAGS -wd4244 -wd4819"
  1.2149 +        CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4345 -wd4351 -wd4482 -wd4800 -wd4819"
  1.2150 +        # make 'foo == bar;' error out
  1.2151 +        CFLAGS="$CFLAGS -we4553"
  1.2152 +        CXXFLAGS="$CXXFLAGS -we4553"
  1.2153 +        LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib netapi32.lib"
  1.2154 +        MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
  1.2155 +        WARNINGS_AS_ERRORS='-WX'
  1.2156 +        MOZ_OPTIMIZE_FLAGS='-O1'
  1.2157 +        MOZ_FIX_LINK_PATHS=
  1.2158 +        MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
  1.2159 +        LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
  1.2160 +        if test -z "$DEVELOPER_OPTIONS"; then
  1.2161 +            LDFLAGS="$LDFLAGS -RELEASE"
  1.2162 +        fi
  1.2163 +        dnl For profile-guided optimization
  1.2164 +        PROFILE_GEN_CFLAGS="-GL"
  1.2165 +        PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
  1.2166 +        dnl XXX: PGO builds can fail with warnings treated as errors,
  1.2167 +        dnl specifically "no profile data available" appears to be
  1.2168 +        dnl treated as an error sometimes. This might be a consequence
  1.2169 +        dnl of using WARNINGS_AS_ERRORS in some modules, combined
  1.2170 +        dnl with the linker doing most of the work in the whole-program
  1.2171 +        dnl optimization/PGO case. I think it's probably a compiler bug,
  1.2172 +        dnl but we work around it here.
  1.2173 +        PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
  1.2174 +        dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
  1.2175 +        dnl Probably also a compiler bug, but what can you do?
  1.2176 +        PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
  1.2177 +        LDFLAGS="$LDFLAGS -DYNAMICBASE"
  1.2178 +        dnl Minimum reqiurement of Gecko is VS2010 or later which supports
  1.2179 +        dnl both SSSE3 and SSE4.1.
  1.2180 +        HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
  1.2181 +        HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
  1.2182 +    fi
  1.2183 +    AC_DEFINE(HAVE_SNPRINTF)
  1.2184 +    AC_DEFINE(_WINDOWS)
  1.2185 +    AC_DEFINE(WIN32)
  1.2186 +    AC_DEFINE(XP_WIN)
  1.2187 +    AC_DEFINE(XP_WIN32)
  1.2188 +    AC_DEFINE(HW_THREADS)
  1.2189 +    AC_DEFINE(STDC_HEADERS)
  1.2190 +    AC_DEFINE(WIN32_LEAN_AND_MEAN)
  1.2191 +    TARGET_MD_ARCH=win32
  1.2192 +    _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
  1.2193 +    BIN_SUFFIX='.exe'
  1.2194 +    MOZ_USER_DIR="Mozilla"
  1.2195 +
  1.2196 +    dnl Hardcode to win95 for now - cls
  1.2197 +    TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
  1.2198 +
  1.2199 +    dnl set NO_X11 defines here as the general check is skipped on win32
  1.2200 +    no_x=yes
  1.2201 +    AC_DEFINE(NO_X11)
  1.2202 +
  1.2203 +    case "$host" in
  1.2204 +    *-mingw*)
  1.2205 +        MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
  1.2206 +        if test -n "$L10NBASEDIR"; then
  1.2207 +            L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
  1.2208 +        fi
  1.2209 +        ;;
  1.2210 +    esac
  1.2211 +
  1.2212 +    case "$host" in
  1.2213 +    *-mingw*)
  1.2214 +        if test -z "$MOZ_TOOLS"; then
  1.2215 +            AC_MSG_ERROR([MOZ_TOOLS is not set])
  1.2216 +        fi
  1.2217 +        MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
  1.2218 +        if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
  1.2219 +            AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
  1.2220 +        fi
  1.2221 +        MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
  1.2222 +        if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
  1.2223 +            AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
  1.2224 +        fi
  1.2225 +        ;;
  1.2226 +    esac
  1.2227 +
  1.2228 +    case "$host_os" in
  1.2229 +    cygwin*|msvc*|mks*)
  1.2230 +        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.])
  1.2231 +        ;;
  1.2232 +    esac
  1.2233 +
  1.2234 +    case "$target" in
  1.2235 +    i*86-*)
  1.2236 +        if test "$HAVE_64BIT_OS"; then
  1.2237 +            AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
  1.2238 +        fi
  1.2239 +
  1.2240 +        if test -n "$GNU_CC"; then
  1.2241 +            CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
  1.2242 +            CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
  1.2243 +            LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup -Wl,--large-address-aware"
  1.2244 +        else
  1.2245 +            DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
  1.2246 +            LDFLAGS="$LDFLAGS -SAFESEH"
  1.2247 +        fi
  1.2248 +
  1.2249 +        AC_DEFINE(_X86_)
  1.2250 +        ;;
  1.2251 +    x86_64-*)
  1.2252 +        if test -n "$_WIN32_MSVC"; then
  1.2253 +            DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
  1.2254 +        fi
  1.2255 +        AC_DEFINE(_AMD64_)
  1.2256 +        ;;
  1.2257 +    *)
  1.2258 +        AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
  1.2259 +        ;;
  1.2260 +    esac
  1.2261 +    ;;
  1.2262 +
  1.2263 +*-netbsd*)
  1.2264 +    DSO_CFLAGS=''
  1.2265 +    CFLAGS="$CFLAGS -Dunix"
  1.2266 +    CXXFLAGS="$CXXFLAGS -Dunix"
  1.2267 +    if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
  1.2268 +        DLL_SUFFIX=".so"
  1.2269 +        DSO_PIC_CFLAGS='-fPIC -DPIC'
  1.2270 +        DSO_LDOPTS='-shared'
  1.2271 +        BIN_FLAGS='-Wl,--export-dynamic'
  1.2272 +    else
  1.2273 +        DSO_PIC_CFLAGS='-fPIC -DPIC'
  1.2274 +        DLL_SUFFIX=".so.1.0"
  1.2275 +        DSO_LDOPTS='-shared'
  1.2276 +    fi
  1.2277 +    # This will fail on a.out systems prior to 1.5.1_ALPHA.
  1.2278 +    MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
  1.2279 +    MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
  1.2280 +    if test "$LIBRUNPATH"; then
  1.2281 +        DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
  1.2282 +    fi
  1.2283 +    MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(notdir $@) -o $@'
  1.2284 +    MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(notdir $@)) -o $@'
  1.2285 +    ;;
  1.2286 +
  1.2287 +*-openbsd*)
  1.2288 +    if test "$SO_VERSION"; then
  1.2289 +        DLL_SUFFIX=".so.$SO_VERSION"
  1.2290 +    else
  1.2291 +        DLL_SUFFIX=".so.1.0"
  1.2292 +    fi
  1.2293 +    MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
  1.2294 +    DSO_CFLAGS=''
  1.2295 +    DSO_PIC_CFLAGS='-fPIC'
  1.2296 +    DSO_LDOPTS='-shared -fPIC'
  1.2297 +    if test "$LIBRUNPATH"; then
  1.2298 +        DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
  1.2299 +    fi
  1.2300 +    ;;
  1.2301 +
  1.2302 +*-solaris*)
  1.2303 +    AC_DEFINE(SOLARIS)
  1.2304 +    TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
  1.2305 +    MOZ_FIX_LINK_PATHS=
  1.2306 +    # $ORIGIN/.. is for shared libraries under components/ to locate shared
  1.2307 +    # libraries one level up (e.g. libnspr4.so)
  1.2308 +    if test "$SOLARIS_SUNPRO_CC"; then
  1.2309 +       LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
  1.2310 +       LIBS="-lCrun -lCstd -lc $LIBS"
  1.2311 +       AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
  1.2312 +       CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
  1.2313 +       CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
  1.2314 +       LDFLAGS="-xildoff $LDFLAGS"
  1.2315 +       MMX_FLAGS="-xarch=mmx -xO4"
  1.2316 +       SSE_FLAGS="-xarch=sse"
  1.2317 +       SSE2_FLAGS="-xarch=ssei2 -xO4"
  1.2318 +       if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
  1.2319 +           _SAVE_LDFLAGS=$LDFLAGS
  1.2320 +           LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
  1.2321 +           AC_TRY_LINK([#include <stdio.h>],
  1.2322 +                       [printf("Hello World\n");],
  1.2323 +                       ,
  1.2324 +                       [LDFLAGS=$_SAVE_LDFLAGS])
  1.2325 +       fi
  1.2326 +       MOZ_OPTIMIZE_FLAGS="-xO4"
  1.2327 +       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
  1.2328 +       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
  1.2329 +       MKSHLIB_FORCE_ALL='-z allextract'
  1.2330 +       MKSHLIB_UNFORCE_ALL='-z defaultextract'
  1.2331 +       DSO_LDOPTS='-G'
  1.2332 +       AR_LIST="$AR t"
  1.2333 +       AR_EXTRACT="$AR x"
  1.2334 +       AR_DELETE="$AR d"
  1.2335 +       AR='$(CXX) -xar'
  1.2336 +       AR_FLAGS='-o $@'
  1.2337 +       AS='/usr/ccs/bin/as'
  1.2338 +       ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
  1.2339 +       AS_DASH_C_FLAG=''
  1.2340 +       TARGET_COMPILER_ABI="sunc"
  1.2341 +       CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
  1.2342 +       CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
  1.2343 +       AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
  1.2344 +       AC_LANG_SAVE
  1.2345 +       AC_LANG_CPLUSPLUS
  1.2346 +       AC_TRY_COMPILE([],
  1.2347 +           [#if (__SUNPRO_CC < 0x590)
  1.2348 +           #error "Denied"
  1.2349 +           #endif],
  1.2350 +           _BAD_COMPILER=,_BAD_COMPILER=1)
  1.2351 +       if test -n "$_BAD_COMPILER"; then
  1.2352 +           _res="no"
  1.2353 +           AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
  1.2354 +       else
  1.2355 +           _res="yes"
  1.2356 +       fi
  1.2357 +       AC_TRY_COMPILE([],
  1.2358 +           [#if (__SUNPRO_CC >= 0x5100)
  1.2359 +           #error "Sun C++ 5.10 or above"
  1.2360 +           #endif],
  1.2361 +           _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
  1.2362 +       if test "$_ABOVE_SS12U1"; then
  1.2363 +           # disable xannotate
  1.2364 +           CXXFLAGS="$CXXFLAGS -xannotate=no"
  1.2365 +       fi
  1.2366 +       AC_MSG_RESULT([$_res])
  1.2367 +       AC_LANG_RESTORE
  1.2368 +    else
  1.2369 +       LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
  1.2370 +       LIBS="-lc $LIBS"
  1.2371 +       MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
  1.2372 +       MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
  1.2373 +       ASFLAGS="$ASFLAGS -fPIC"
  1.2374 +       DSO_LDOPTS='-shared'
  1.2375 +       WARNINGS_AS_ERRORS='-Werror'
  1.2376 +       _WARNINGS_CFLAGS=''
  1.2377 +       _WARNINGS_CXXFLAGS=''
  1.2378 +       if test "$OS_RELEASE" = "5.3"; then
  1.2379 +           AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
  1.2380 +       fi
  1.2381 +    fi
  1.2382 +    if test "$OS_RELEASE" = "5.5.1"; then
  1.2383 +        AC_DEFINE(NEED_USLEEP_PROTOTYPE)
  1.2384 +    fi
  1.2385 +    ;;
  1.2386 +
  1.2387 +*-sunos*)
  1.2388 +    DSO_LDOPTS='-Bdynamic'
  1.2389 +    MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
  1.2390 +    MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
  1.2391 +    AC_DEFINE(SUNOS4)
  1.2392 +    AC_DEFINE(SPRINTF_RETURNS_STRING)
  1.2393 +    case "$(target_os)" in
  1.2394 +    sunos4.1*)
  1.2395 +        DLL_SUFFIX='.so.1.0'
  1.2396 +        ;;
  1.2397 +    esac
  1.2398 +    ;;
  1.2399 +
  1.2400 +esac
  1.2401 +
  1.2402 +AC_SUBST_LIST(MMX_FLAGS)
  1.2403 +AC_SUBST_LIST(SSE_FLAGS)
  1.2404 +AC_SUBST_LIST(SSE2_FLAGS)
  1.2405 +
  1.2406 +case "$target" in
  1.2407 +*-*linux*)
  1.2408 +    # Includes linux-android
  1.2409 +    AC_DEFINE(XP_LINUX)
  1.2410 +    ;;
  1.2411 +esac
  1.2412 +
  1.2413 +AC_SUBST(MOZ_LINKER)
  1.2414 +if test -n "$MOZ_LINKER"; then
  1.2415 +  AC_DEFINE(MOZ_LINKER)
  1.2416 +fi
  1.2417 +
  1.2418 +dnl Only one oddball right now (QNX), but this gives us flexibility
  1.2419 +dnl if any other platforms need to override this in the future.
  1.2420 +AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
  1.2421 +
  1.2422 +dnl ========================================================
  1.2423 +dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
  1.2424 +dnl by now will not have any way to link most binaries (tests
  1.2425 +dnl as well as viewer, apprunner, etc.), because some symbols
  1.2426 +dnl will be left out of the "composite" .so's by ld as unneeded.
  1.2427 +dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
  1.2428 +dnl they can link in the static libs that provide the missing
  1.2429 +dnl symbols.
  1.2430 +dnl ========================================================
  1.2431 +NO_LD_ARCHIVE_FLAGS=
  1.2432 +if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
  1.2433 +    NO_LD_ARCHIVE_FLAGS=1
  1.2434 +fi
  1.2435 +case "$target" in
  1.2436 +*-aix4.3*|*-aix5*)
  1.2437 +    NO_LD_ARCHIVE_FLAGS=
  1.2438 +    ;;
  1.2439 +*-mingw*)
  1.2440 +    if test -z "$GNU_CC"; then
  1.2441 +        NO_LD_ARCHIVE_FLAGS=
  1.2442 +    fi
  1.2443 +    ;;
  1.2444 +esac
  1.2445 +AC_SUBST(NO_LD_ARCHIVE_FLAGS)
  1.2446 +
  1.2447 +dnl ========================================================
  1.2448 +dnl = Flags to strip unused symbols from .so components and
  1.2449 +dnl = to export jemalloc symbols when linking a program
  1.2450 +dnl ========================================================
  1.2451 +case "$target" in
  1.2452 +    *-linux*|*-kfreebsd*-gnu|*-gnu*)
  1.2453 +        MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
  1.2454 +        ;;
  1.2455 +    *-solaris*)
  1.2456 +        if test -z "$GNU_CC"; then
  1.2457 +         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
  1.2458 +        else
  1.2459 +         if test -z "$GCC_USE_GNU_LD"; then
  1.2460 +          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
  1.2461 +         else
  1.2462 +          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
  1.2463 +         fi
  1.2464 +        fi
  1.2465 +        ;;
  1.2466 +    *-darwin*)
  1.2467 +        MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
  1.2468 +        ;;
  1.2469 +    *-mingw*)
  1.2470 +        if test -n "$GNU_CC"; then
  1.2471 +           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
  1.2472 +        fi
  1.2473 +        ;;
  1.2474 +esac
  1.2475 +
  1.2476 +if test -z "$COMPILE_ENVIRONMENT"; then
  1.2477 +    SKIP_COMPILER_CHECKS=1
  1.2478 +    SKIP_LIBRARY_CHECKS=1
  1.2479 +else
  1.2480 +    MOZ_COMPILER_OPTS
  1.2481 +fi
  1.2482 +
  1.2483 +if test -z "$SKIP_COMPILER_CHECKS"; then
  1.2484 +dnl Checks for typedefs, structures, and compiler characteristics.
  1.2485 +dnl ========================================================
  1.2486 +AC_HEADER_STDC
  1.2487 +AC_C_CONST
  1.2488 +AC_TYPE_MODE_T
  1.2489 +AC_TYPE_OFF_T
  1.2490 +AC_TYPE_PID_T
  1.2491 +AC_TYPE_SIZE_T
  1.2492 +AC_LANG_CPLUSPLUS
  1.2493 +AC_LANG_C
  1.2494 +AC_MSG_CHECKING(for ssize_t)
  1.2495 +AC_CACHE_VAL(ac_cv_type_ssize_t,
  1.2496 + [AC_TRY_COMPILE([#include <stdio.h>
  1.2497 +                  #include <sys/types.h>],
  1.2498 +                 [ssize_t foo = 0;],
  1.2499 +                 [ac_cv_type_ssize_t=true],
  1.2500 +                 [ac_cv_type_ssize_t=false])])
  1.2501 +if test "$ac_cv_type_ssize_t" = true ; then
  1.2502 +  AC_DEFINE(HAVE_SSIZE_T)
  1.2503 +  AC_MSG_RESULT(yes)
  1.2504 +else
  1.2505 +  AC_MSG_RESULT(no)
  1.2506 +fi
  1.2507 +AC_STRUCT_ST_BLKSIZE
  1.2508 +AC_MSG_CHECKING(for siginfo_t)
  1.2509 +AC_CACHE_VAL(ac_cv_siginfo_t,
  1.2510 + [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
  1.2511 +                  #include <signal.h>],
  1.2512 +                 [siginfo_t* info;],
  1.2513 +                 [ac_cv_siginfo_t=true],
  1.2514 +                 [ac_cv_siginfo_t=false])])
  1.2515 +if test "$ac_cv_siginfo_t" = true ; then
  1.2516 +  AC_DEFINE(HAVE_SIGINFO_T)
  1.2517 +  AC_MSG_RESULT(yes)
  1.2518 +else
  1.2519 +  AC_MSG_RESULT(no)
  1.2520 +fi
  1.2521 +
  1.2522 +AC_LANG_CPLUSPLUS
  1.2523 +
  1.2524 +MOZ_CXX11
  1.2525 +
  1.2526 +AC_LANG_C
  1.2527 +
  1.2528 +dnl Check for .hidden assembler directive and visibility attribute.
  1.2529 +dnl Borrowed from glibc configure.in
  1.2530 +dnl ===============================================================
  1.2531 +if test "$GNU_CC"; then
  1.2532 +  AC_CACHE_CHECK(for visibility(hidden) attribute,
  1.2533 +                 ac_cv_visibility_hidden,
  1.2534 +                 [cat > conftest.c <<EOF
  1.2535 +                  int foo __attribute__ ((visibility ("hidden"))) = 1;
  1.2536 +EOF
  1.2537 +                  ac_cv_visibility_hidden=no
  1.2538 +                  if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
  1.2539 +                    if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
  1.2540 +                      ac_cv_visibility_hidden=yes
  1.2541 +                    fi
  1.2542 +                  fi
  1.2543 +                  rm -f conftest.[cs]
  1.2544 +                 ])
  1.2545 +  if test "$ac_cv_visibility_hidden" = "yes"; then
  1.2546 +    AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
  1.2547 +
  1.2548 +    AC_CACHE_CHECK(for visibility(default) attribute,
  1.2549 +                   ac_cv_visibility_default,
  1.2550 +                   [cat > conftest.c <<EOF
  1.2551 +                    int foo __attribute__ ((visibility ("default"))) = 1;
  1.2552 +EOF
  1.2553 +                    ac_cv_visibility_default=no
  1.2554 +                    if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
  1.2555 +                      if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
  1.2556 +                        ac_cv_visibility_default=yes
  1.2557 +                      fi
  1.2558 +                    fi
  1.2559 +                    rm -f conftest.[cs]
  1.2560 +                   ])
  1.2561 +    if test "$ac_cv_visibility_default" = "yes"; then
  1.2562 +      AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
  1.2563 +
  1.2564 +      AC_CACHE_CHECK(for visibility pragma support,
  1.2565 +                     ac_cv_visibility_pragma,
  1.2566 +                     [cat > conftest.c <<EOF
  1.2567 +#pragma GCC visibility push(hidden)
  1.2568 +                      int foo_hidden = 1;
  1.2569 +#pragma GCC visibility push(default)
  1.2570 +                      int foo_default = 1;
  1.2571 +EOF
  1.2572 +                      ac_cv_visibility_pragma=no
  1.2573 +                      if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
  1.2574 +                        if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
  1.2575 +                          if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
  1.2576 +                            ac_cv_visibility_pragma=yes
  1.2577 +                          fi
  1.2578 +                        fi
  1.2579 +                      fi
  1.2580 +                      rm -f conftest.[cs]
  1.2581 +                    ])
  1.2582 +      if test "$ac_cv_visibility_pragma" = "yes"; then
  1.2583 +        AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
  1.2584 +                       ac_cv_have_visibility_class_bug,
  1.2585 +                       [cat > conftest.c <<EOF
  1.2586 +#pragma GCC visibility push(hidden)
  1.2587 +struct __attribute__ ((visibility ("default"))) TestStruct {
  1.2588 +  static void Init();
  1.2589 +};
  1.2590 +__attribute__ ((visibility ("default"))) void TestFunc() {
  1.2591 +  TestStruct::Init();
  1.2592 +}
  1.2593 +EOF
  1.2594 +                       ac_cv_have_visibility_class_bug=no
  1.2595 +                       if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
  1.2596 +                         ac_cv_have_visibility_class_bug=yes
  1.2597 +                       else
  1.2598 +                         if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
  1.2599 +                           ac_cv_have_visibility_class_bug=yes
  1.2600 +                         fi
  1.2601 +                       fi
  1.2602 +                       rm -rf conftest.{c,S}
  1.2603 +                       ])
  1.2604 +
  1.2605 +        AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
  1.2606 +                       ac_cv_have_visibility_builtin_bug,
  1.2607 +                       [cat > conftest.c <<EOF
  1.2608 +#pragma GCC visibility push(hidden)
  1.2609 +#pragma GCC visibility push(default)
  1.2610 +#include <string.h>
  1.2611 +#pragma GCC visibility pop
  1.2612 +
  1.2613 +__attribute__ ((visibility ("default"))) void Func() {
  1.2614 +  char c[[100]];
  1.2615 +  memset(c, 0, sizeof(c));
  1.2616 +}
  1.2617 +EOF
  1.2618 +                       ac_cv_have_visibility_builtin_bug=no
  1.2619 +                       if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
  1.2620 +                         ac_cv_have_visibility_builtin_bug=yes
  1.2621 +                       else
  1.2622 +                         if test `grep -c "@PLT" conftest.S` = 0; then
  1.2623 +                           ac_cv_visibility_builtin_bug=yes
  1.2624 +                         fi
  1.2625 +                       fi
  1.2626 +                       rm -f conftest.{c,S}
  1.2627 +                       ])
  1.2628 +        if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
  1.2629 +                "$ac_cv_have_visibility_class_bug" = "no"; then
  1.2630 +          VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
  1.2631 +          WRAP_SYSTEM_INCLUDES=1
  1.2632 +          STL_FLAGS='-I$(DIST)/stl_wrappers'
  1.2633 +          WRAP_STL_INCLUDES=1
  1.2634 +        else
  1.2635 +          VISIBILITY_FLAGS='-fvisibility=hidden'
  1.2636 +        fi # have visibility pragma bug
  1.2637 +      fi   # have visibility pragma
  1.2638 +    fi     # have visibility(default) attribute
  1.2639 +  fi       # have visibility(hidden) attribute
  1.2640 +fi         # GNU_CC
  1.2641 +
  1.2642 +# visibility hidden flag for Sun Studio on Solaris
  1.2643 +if test "$SOLARIS_SUNPRO_CC"; then
  1.2644 +VISIBILITY_FLAGS='-xldscope=hidden'
  1.2645 +fi         # Sun Studio on Solaris
  1.2646 +
  1.2647 +AC_SUBST(WRAP_SYSTEM_INCLUDES)
  1.2648 +AC_SUBST(VISIBILITY_FLAGS)
  1.2649 +
  1.2650 +MOZ_GCC_PR49911
  1.2651 +MOZ_GCC_PR39608
  1.2652 +if test "$OS_TARGET" != WINNT; then
  1.2653 +    # Only run this test with clang on non-Windows platforms, because clang
  1.2654 +    # cannot do enough code gen for now to make this test work correctly.
  1.2655 +    MOZ_LLVM_PR8927
  1.2656 +fi
  1.2657 +
  1.2658 +dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
  1.2659 +dnl ========================================================
  1.2660 +if test "$GNU_CC"; then
  1.2661 +  CFLAGS_save="${CFLAGS}"
  1.2662 +  CFLAGS="${CFLAGS} -Werror"
  1.2663 +  AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
  1.2664 +                 ac_cv_force_align_arg_pointer,
  1.2665 +                 [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
  1.2666 +                                 [],
  1.2667 +                                 ac_cv_force_align_arg_pointer="yes",
  1.2668 +                                 ac_cv_force_align_arg_pointer="no")])
  1.2669 +  CFLAGS="${CFLAGS_save}"
  1.2670 +  if test "$ac_cv_force_align_arg_pointer" = "yes"; then
  1.2671 +    HAVE_GCC_ALIGN_ARG_POINTER=1
  1.2672 +  else
  1.2673 +    HAVE_GCC_ALIGN_ARG_POINTER=
  1.2674 +  fi
  1.2675 +fi
  1.2676 +AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
  1.2677 +
  1.2678 +dnl Checks for header files.
  1.2679 +dnl ========================================================
  1.2680 +AC_HEADER_DIRENT
  1.2681 +case "$target_os" in
  1.2682 +freebsd*|openbsd*)
  1.2683 +# for stuff like -lXshm
  1.2684 +    CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
  1.2685 +    ;;
  1.2686 +esac
  1.2687 +MOZ_CHECK_COMMON_HEADERS
  1.2688 +
  1.2689 +dnl These are all the places some variant of statfs can be hiding.
  1.2690 +MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
  1.2691 +
  1.2692 +dnl Quota support
  1.2693 +MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
  1.2694 +MOZ_CHECK_HEADERS([linux/quota.h],,,[#include <sys/socket.h>])
  1.2695 +
  1.2696 +dnl SCTP support - needs various network include headers
  1.2697 +MOZ_CHECK_HEADERS([linux/if_addr.h linux/rtnetlink.h],,,[#include <sys/socket.h>])
  1.2698 +
  1.2699 +MOZ_CHECK_HEADERS(sys/types.h netinet/in.h byteswap.h)
  1.2700 +
  1.2701 +dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
  1.2702 +AC_CACHE_CHECK(for sockaddr_in.sin_len,
  1.2703 +                   ac_cv_sockaddr_in_sin_len,
  1.2704 +                   [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
  1.2705 +                                    #include <sys/types.h>
  1.2706 +                                    #endif
  1.2707 +                                    #include <netinet/in.h>
  1.2708 +                                    struct sockaddr_in x;
  1.2709 +                                    void *foo = (void*) &x.sin_len;],
  1.2710 +                                   [],
  1.2711 +                                   [ac_cv_sockaddr_in_sin_len=true],
  1.2712 +                                   [ac_cv_sockaddr_in_sin_len=false])])
  1.2713 +if test "$ac_cv_sockaddr_in_sin_len" = true ; then
  1.2714 +  AC_DEFINE(HAVE_SIN_LEN)
  1.2715 +dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
  1.2716 +  AC_DEFINE(HAVE_SCONN_LEN)
  1.2717 +fi
  1.2718 +
  1.2719 +AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
  1.2720 +               ac_cv_sockaddr_in6_sin6_len,
  1.2721 +               [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
  1.2722 +                                #include <sys/types.h>
  1.2723 +                                #endif
  1.2724 +                                #include <netinet/in.h>
  1.2725 +                                struct sockaddr_in6 x;
  1.2726 +                                void *foo = (void*) &x.sin6_len;],
  1.2727 +                               [],
  1.2728 +                               [ac_cv_sockaddr_in6_sin6_len=true],
  1.2729 +                               [ac_cv_sockaddr_in6_sin6_len=false])])
  1.2730 +if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
  1.2731 +  AC_DEFINE(HAVE_SIN6_LEN)
  1.2732 +fi
  1.2733 +
  1.2734 +AC_CACHE_CHECK(for sockaddr.sa_len,
  1.2735 +               ac_cv_sockaddr_sa_len,
  1.2736 +               [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
  1.2737 +                                #include <sys/types.h>
  1.2738 +                                #endif
  1.2739 +                                #include <sys/socket.h>
  1.2740 +                                struct sockaddr x;
  1.2741 +                                void *foo = (void*) &x.sa_len;],
  1.2742 +                               [],
  1.2743 +                               [ac_cv_sockaddr_sa_len=true],
  1.2744 +                               [ac_cv_sockaddr_sa_len=false])])
  1.2745 +if test "$ac_cv_sockaddr_sa_len" = true ; then
  1.2746 +  AC_DEFINE(HAVE_SA_LEN)
  1.2747 +fi
  1.2748 +
  1.2749 +AC_ARG_ENABLE(dtrace,
  1.2750 +              [  --enable-dtrace         build with dtrace support if available (default=no)],
  1.2751 +              [enable_dtrace="yes"],)
  1.2752 +if test "x$enable_dtrace" = "xyes"; then
  1.2753 +  MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
  1.2754 +  if test -n "$HAVE_DTRACE"; then
  1.2755 +      AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
  1.2756 +  else
  1.2757 +      AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
  1.2758 +  fi
  1.2759 +fi
  1.2760 +AC_SUBST(HAVE_DTRACE)
  1.2761 +
  1.2762 +case $target in
  1.2763 +*-aix4.3*|*-aix5*)
  1.2764 +    ;;
  1.2765 +*)
  1.2766 +    MOZ_CHECK_HEADERS(sys/cdefs.h)
  1.2767 +    ;;
  1.2768 +esac
  1.2769 +
  1.2770 +MOZ_LINUX_PERF_EVENT
  1.2771 +
  1.2772 +dnl Checks for libraries.
  1.2773 +dnl ========================================================
  1.2774 +case $target in
  1.2775 +*-hpux11.*)
  1.2776 +    ;;
  1.2777 +*)
  1.2778 +    AC_CHECK_LIB(c_r, gethostbyname_r)
  1.2779 +    ;;
  1.2780 +esac
  1.2781 +
  1.2782 +dnl We don't want to link with libdl even if it's present on OS X, since
  1.2783 +dnl it's not used and not part of the default installation. OS/2 has dlfcn
  1.2784 +dnl in libc.
  1.2785 +dnl We don't want to link against libm or libpthread on Darwin since
  1.2786 +dnl they both are just symlinks to libSystem and explicitly linking
  1.2787 +dnl against libSystem causes issues when debugging (see bug 299601).
  1.2788 +case $target in
  1.2789 +*-darwin*)
  1.2790 +    ;;
  1.2791 +*)
  1.2792 +    AC_SEARCH_LIBS(dlopen, dl,
  1.2793 +        MOZ_CHECK_HEADER(dlfcn.h,
  1.2794 +        AC_DEFINE(HAVE_DLOPEN)))
  1.2795 +    ;;
  1.2796 +esac
  1.2797 +
  1.2798 +_SAVE_CFLAGS="$CFLAGS"
  1.2799 +CFLAGS="$CFLAGS -D_GNU_SOURCE"
  1.2800 +AC_CHECK_FUNCS(dladdr memmem)
  1.2801 +CFLAGS="$_SAVE_CFLAGS"
  1.2802 +
  1.2803 +if test ! "$GNU_CXX"; then
  1.2804 +
  1.2805 +    case $target in
  1.2806 +    *-aix*)
  1.2807 +        AC_CHECK_LIB(C_r, demangle)
  1.2808 +        ;;
  1.2809 +     *)
  1.2810 +        AC_CHECK_LIB(C, demangle)
  1.2811 +        ;;
  1.2812 +     esac
  1.2813 +fi
  1.2814 +
  1.2815 +AC_CHECK_LIB(socket, socket)
  1.2816 +
  1.2817 +XLDFLAGS="$X_LIBS"
  1.2818 +XLIBS="$X_EXTRA_LIBS"
  1.2819 +
  1.2820 +dnl ========================================================
  1.2821 +dnl Checks for X libraries.
  1.2822 +dnl Ordering is important.
  1.2823 +dnl Xt is dependent upon SM as of X11R6
  1.2824 +dnl ========================================================
  1.2825 +if test "$no_x" = "yes"; then
  1.2826 +    AC_DEFINE(NO_X11)
  1.2827 +else
  1.2828 +    AC_DEFINE_UNQUOTED(FUNCPROTO,15)
  1.2829 +    XLIBS="-lX11 $XLIBS"
  1.2830 +    _SAVE_LDFLAGS="$LDFLAGS"
  1.2831 +    LDFLAGS="$XLDFLAGS $LDFLAGS"
  1.2832 +    AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
  1.2833 +        [MISSING_X="$MISSING_X -lX11"], $XLIBS)
  1.2834 +    AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
  1.2835 +        [MISSING_X="$MISSING_X -lXext"], $XLIBS)
  1.2836 +
  1.2837 +    AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
  1.2838 +        unset ac_cv_lib_Xt_XtFree
  1.2839 +        AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
  1.2840 +        AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
  1.2841 +        AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
  1.2842 +            [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
  1.2843 +        ])
  1.2844 +
  1.2845 +    # AIX needs the motif library linked before libXt to prevent
  1.2846 +    # crashes in plugins linked against Motif - Bug #98892
  1.2847 +    case "${target_os}" in
  1.2848 +    aix*)
  1.2849 +        XT_LIBS="-lXm $XT_LIBS"
  1.2850 +        ;;
  1.2851 +    esac
  1.2852 +
  1.2853 +    dnl ========================================================
  1.2854 +    dnl = Check for XShm
  1.2855 +    dnl ========================================================
  1.2856 +    AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
  1.2857 +        $XLIBS $XEXT_LIBS)
  1.2858 +
  1.2859 +    dnl ========================================================
  1.2860 +    dnl = Check for Xss
  1.2861 +    dnl ========================================================
  1.2862 +    MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
  1.2863 +        AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
  1.2864 +            [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
  1.2865 +             AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
  1.2866 +
  1.2867 +    LDFLAGS="$_SAVE_LDFLAGS"
  1.2868 +fi # $no_x
  1.2869 +
  1.2870 +AC_SUBST(XCFLAGS)
  1.2871 +AC_SUBST(XLDFLAGS)
  1.2872 +AC_SUBST(XLIBS)
  1.2873 +AC_SUBST(XEXT_LIBS)
  1.2874 +AC_SUBST(XT_LIBS)
  1.2875 +AC_SUBST(XSS_LIBS)
  1.2876 +
  1.2877 +dnl ========================================================
  1.2878 +dnl = pthread support
  1.2879 +dnl = Start by checking whether the system support pthreads
  1.2880 +dnl ========================================================
  1.2881 +case "$target_os" in
  1.2882 +darwin*)
  1.2883 +    MOZ_USE_PTHREADS=1
  1.2884 +    ;;
  1.2885 +*)
  1.2886 +    MOZ_CHECK_PTHREADS(pthreads,
  1.2887 +        MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
  1.2888 +        MOZ_CHECK_PTHREADS(pthread,
  1.2889 +            MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
  1.2890 +            MOZ_CHECK_PTHREADS(c_r,
  1.2891 +                MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
  1.2892 +                MOZ_CHECK_PTHREADS(c,
  1.2893 +                    MOZ_USE_PTHREADS=1
  1.2894 +                )
  1.2895 +            )
  1.2896 +        )
  1.2897 +    )
  1.2898 +    ;;
  1.2899 +esac
  1.2900 +
  1.2901 +dnl ========================================================
  1.2902 +dnl Check the command line for --with-pthreads
  1.2903 +dnl ========================================================
  1.2904 +MOZ_ARG_WITH_BOOL(pthreads,
  1.2905 +[  --with-pthreads         Force use of system pthread library with NSPR ],
  1.2906 +[ if test "$MOZ_USE_PTHREADS"x = x; then
  1.2907 +    AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
  1.2908 +fi],
  1.2909 +    MOZ_USE_PTHREADS=
  1.2910 +    _PTHREAD_LDFLAGS=
  1.2911 +)
  1.2912 +
  1.2913 +dnl ========================================================
  1.2914 +dnl Do the platform specific pthread hackery
  1.2915 +dnl ========================================================
  1.2916 +if test "$MOZ_USE_PTHREADS"x != x
  1.2917 +then
  1.2918 +    dnl
  1.2919 +    dnl See if -pthread is supported.
  1.2920 +    dnl
  1.2921 +    rm -f conftest*
  1.2922 +    ac_cv_have_dash_pthread=no
  1.2923 +    AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
  1.2924 +    echo 'int main() { return 0; }' | cat > conftest.c
  1.2925 +    ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
  1.2926 +    if test $? -eq 0; then
  1.2927 +        if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
  1.2928 +            ac_cv_have_dash_pthread=yes
  1.2929 +            case "$target_os" in
  1.2930 +            freebsd*)
  1.2931 +# Freebsd doesn't use -pthread for compiles, it uses them for linking
  1.2932 +                ;;
  1.2933 +            *)
  1.2934 +                CFLAGS="$CFLAGS -pthread"
  1.2935 +                CXXFLAGS="$CXXFLAGS -pthread"
  1.2936 +                ;;
  1.2937 +            esac
  1.2938 +        fi
  1.2939 +    fi
  1.2940 +    rm -f conftest*
  1.2941 +    AC_MSG_RESULT($ac_cv_have_dash_pthread)
  1.2942 +
  1.2943 +    dnl
  1.2944 +    dnl See if -pthreads is supported.
  1.2945 +    dnl
  1.2946 +    ac_cv_have_dash_pthreads=no
  1.2947 +    if test "$ac_cv_have_dash_pthread" = "no"; then
  1.2948 +        AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
  1.2949 +        echo 'int main() { return 0; }' | cat > conftest.c
  1.2950 +        ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
  1.2951 +        if test $? -eq 0; then
  1.2952 +            if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
  1.2953 +                ac_cv_have_dash_pthreads=yes
  1.2954 +                CFLAGS="$CFLAGS -pthreads"
  1.2955 +                CXXFLAGS="$CXXFLAGS -pthreads"
  1.2956 +            fi
  1.2957 +        fi
  1.2958 +        rm -f conftest*
  1.2959 +        AC_MSG_RESULT($ac_cv_have_dash_pthreads)
  1.2960 +    fi
  1.2961 +
  1.2962 +    case "$target" in
  1.2963 +        *-*-freebsd*)
  1.2964 +            AC_DEFINE(_REENTRANT)
  1.2965 +            AC_DEFINE(_THREAD_SAFE)
  1.2966 +            dnl -pthread links in -lpthread, so don't specify it explicitly.
  1.2967 +            if test "$ac_cv_have_dash_pthread" = "yes"; then
  1.2968 +                _PTHREAD_LDFLAGS="-pthread"
  1.2969 +            fi
  1.2970 +            ;;
  1.2971 +
  1.2972 +        *-*-openbsd*|*-*-bsdi*)
  1.2973 +            AC_DEFINE(_REENTRANT)
  1.2974 +            AC_DEFINE(_THREAD_SAFE)
  1.2975 +            dnl -pthread links in -lc_r, so don't specify it explicitly.
  1.2976 +            if test "$ac_cv_have_dash_pthread" = "yes"; then
  1.2977 +                _PTHREAD_LDFLAGS="-pthread"
  1.2978 +            fi
  1.2979 +            ;;
  1.2980 +
  1.2981 +        *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
  1.2982 +            AC_DEFINE(_REENTRANT)
  1.2983 +            ;;
  1.2984 +
  1.2985 +        *-aix4.3*|*-aix5*)
  1.2986 +            AC_DEFINE(_REENTRANT)
  1.2987 +            ;;
  1.2988 +
  1.2989 +        *-hpux11.*)
  1.2990 +            AC_DEFINE(_REENTRANT)
  1.2991 +            ;;
  1.2992 +
  1.2993 +        *-*-solaris*)
  1.2994 +            AC_DEFINE(_REENTRANT)
  1.2995 +            if test "$SOLARIS_SUNPRO_CC"; then
  1.2996 +                CFLAGS="$CFLAGS -mt"
  1.2997 +                CXXFLAGS="$CXXFLAGS -mt"
  1.2998 +            fi
  1.2999 +            ;;
  1.3000 +    esac
  1.3001 +    LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
  1.3002 +    AC_SUBST(MOZ_USE_PTHREADS)
  1.3003 +fi
  1.3004 +
  1.3005 +
  1.3006 +dnl Checks for library functions.
  1.3007 +dnl ========================================================
  1.3008 +AC_PROG_GCC_TRADITIONAL
  1.3009 +AC_FUNC_MEMCMP
  1.3010 +AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize localtime_r)
  1.3011 +
  1.3012 +dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
  1.3013 +AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
  1.3014 +               ac_cv_clock_monotonic,
  1.3015 +               [for libs in "" -lrt; do
  1.3016 +                    _SAVE_LIBS="$LIBS"
  1.3017 +                    LIBS="$LIBS $libs"
  1.3018 +                    AC_TRY_LINK([#include <time.h>],
  1.3019 +                                 [ struct timespec ts;
  1.3020 +                                   clock_gettime(CLOCK_MONOTONIC, &ts); ],
  1.3021 +                                 ac_cv_clock_monotonic=$libs
  1.3022 +                                 LIBS="$_SAVE_LIBS"
  1.3023 +                                 break,
  1.3024 +                                 ac_cv_clock_monotonic=no)
  1.3025 +                    LIBS="$_SAVE_LIBS"
  1.3026 +                done])
  1.3027 +if test "$ac_cv_clock_monotonic" != "no"; then
  1.3028 +    HAVE_CLOCK_MONOTONIC=1
  1.3029 +    REALTIME_LIBS=$ac_cv_clock_monotonic
  1.3030 +    AC_DEFINE(HAVE_CLOCK_MONOTONIC)
  1.3031 +    AC_SUBST(HAVE_CLOCK_MONOTONIC)
  1.3032 +    AC_SUBST(REALTIME_LIBS)
  1.3033 +fi
  1.3034 +
  1.3035 +dnl check for wcrtomb/mbrtowc
  1.3036 +dnl =======================================================================
  1.3037 +if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
  1.3038 +AC_LANG_SAVE
  1.3039 +AC_LANG_CPLUSPLUS
  1.3040 +AC_CACHE_CHECK(for wcrtomb,
  1.3041 +    ac_cv_have_wcrtomb,
  1.3042 +    [AC_TRY_LINK([#include <wchar.h>],
  1.3043 +                 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
  1.3044 +                 ac_cv_have_wcrtomb="yes",
  1.3045 +                 ac_cv_have_wcrtomb="no")])
  1.3046 +if test "$ac_cv_have_wcrtomb" = "yes"; then
  1.3047 +    AC_DEFINE(HAVE_WCRTOMB)
  1.3048 +fi
  1.3049 +AC_CACHE_CHECK(for mbrtowc,
  1.3050 +    ac_cv_have_mbrtowc,
  1.3051 +    [AC_TRY_LINK([#include <wchar.h>],
  1.3052 +                 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
  1.3053 +                 ac_cv_have_mbrtowc="yes",
  1.3054 +                 ac_cv_have_mbrtowc="no")])
  1.3055 +if test "$ac_cv_have_mbrtowc" = "yes"; then
  1.3056 +    AC_DEFINE(HAVE_MBRTOWC)
  1.3057 +fi
  1.3058 +AC_LANG_RESTORE
  1.3059 +fi
  1.3060 +
  1.3061 +AC_CACHE_CHECK(
  1.3062 +    [for res_ninit()],
  1.3063 +    ac_cv_func_res_ninit,
  1.3064 +    [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
  1.3065 +        dnl no need for res_ninit() on NetBSD and OpenBSD
  1.3066 +        ac_cv_func_res_ninit=no
  1.3067 +     else
  1.3068 +        AC_TRY_LINK([
  1.3069 +            #ifdef linux
  1.3070 +            #define _BSD_SOURCE 1
  1.3071 +            #endif
  1.3072 +            #include <sys/types.h>
  1.3073 +            #include <netinet/in.h>
  1.3074 +            #include <arpa/nameser.h>
  1.3075 +            #include <resolv.h>
  1.3076 +            ],
  1.3077 +            [int foo = res_ninit(&_res);],
  1.3078 +            [ac_cv_func_res_ninit=yes],
  1.3079 +            [ac_cv_func_res_ninit=no])
  1.3080 +     fi
  1.3081 +    ])
  1.3082 +
  1.3083 +if test "$ac_cv_func_res_ninit" = "yes"; then
  1.3084 +    AC_DEFINE(HAVE_RES_NINIT)
  1.3085 +dnl must add the link line we do something as foolish as this... dougt
  1.3086 +dnl else
  1.3087 +dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
  1.3088 +dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
  1.3089 +fi
  1.3090 +
  1.3091 +AC_LANG_CPLUSPLUS
  1.3092 +
  1.3093 +case $target_os in
  1.3094 +    darwin*|mingw*)
  1.3095 +        ;;
  1.3096 +    *)
  1.3097 +
  1.3098 +AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
  1.3099 +    AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
  1.3100 +        AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
  1.3101 +_SAVE_LIBS=$LIBS
  1.3102 +LIBS="$LIBS $_ICONV_LIBS"
  1.3103 +AC_CACHE_CHECK(
  1.3104 +    [for iconv()],
  1.3105 +    ac_cv_func_iconv,
  1.3106 +    [AC_TRY_LINK([
  1.3107 +        #include <stdlib.h>
  1.3108 +        #include <iconv.h>
  1.3109 +        ],
  1.3110 +        [
  1.3111 +            iconv_t h = iconv_open("", "");
  1.3112 +            iconv(h, NULL, NULL, NULL, NULL);
  1.3113 +            iconv_close(h);
  1.3114 +        ],
  1.3115 +        [ac_cv_func_iconv=yes],
  1.3116 +        [ac_cv_func_iconv=no]
  1.3117 +        )]
  1.3118 +    )
  1.3119 +if test "$ac_cv_func_iconv" = "yes"; then
  1.3120 +    AC_DEFINE(HAVE_ICONV)
  1.3121 +    LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
  1.3122 +    LIBICONV="$_ICONV_LIBS"
  1.3123 +    AC_CACHE_CHECK(
  1.3124 +        [for iconv() with const input],
  1.3125 +        ac_cv_func_const_iconv,
  1.3126 +        [AC_TRY_COMPILE([
  1.3127 +            #include <stdlib.h>
  1.3128 +            #include <iconv.h>
  1.3129 +            ],
  1.3130 +            [
  1.3131 +                const char *input = "testing";
  1.3132 +                iconv_t h = iconv_open("", "");
  1.3133 +                iconv(h, &input, NULL, NULL, NULL);
  1.3134 +                iconv_close(h);
  1.3135 +            ],
  1.3136 +            [ac_cv_func_const_iconv=yes],
  1.3137 +            [ac_cv_func_const_iconv=no]
  1.3138 +            )]
  1.3139 +        )
  1.3140 +    if test "$ac_cv_func_const_iconv" = "yes"; then
  1.3141 +        AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
  1.3142 +    fi
  1.3143 +fi
  1.3144 +LIBS=$_SAVE_LIBS
  1.3145 +
  1.3146 +    ;;
  1.3147 +esac
  1.3148 +
  1.3149 +AM_LANGINFO_CODESET
  1.3150 +
  1.3151 +AC_LANG_C
  1.3152 +
  1.3153 +dnl **********************
  1.3154 +dnl *** va_copy checks ***
  1.3155 +AC_CACHE_CHECK([for an implementation of va_copy()],
  1.3156 +               ac_cv_va_copy,
  1.3157 +    [AC_TRY_COMPILE([#include <stdarg.h>
  1.3158 +                     #include <stdlib.h>
  1.3159 +        void f (int i, ...) {
  1.3160 +            va_list args1, args2;
  1.3161 +            va_start (args1, i);
  1.3162 +            va_copy (args2, args1);
  1.3163 +            if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
  1.3164 +                exit (1);
  1.3165 +            va_end (args1); va_end (args2);
  1.3166 +        }],
  1.3167 +        [f(0, 42); return 0],
  1.3168 +        [ac_cv_va_copy=yes],
  1.3169 +        [ac_cv_va_copy=no]
  1.3170 +    )]
  1.3171 +)
  1.3172 +AC_CACHE_CHECK([whether va_list can be copied by value],
  1.3173 +               ac_cv_va_val_copy,
  1.3174 +    [AC_TRY_COMPILE([#include <stdarg.h>
  1.3175 +                     #include <stdlib.h>
  1.3176 +        void f (int i, ...) {
  1.3177 +            va_list args1, args2;
  1.3178 +            va_start (args1, i);
  1.3179 +            args2 = args1;
  1.3180 +            if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
  1.3181 +                exit (1);
  1.3182 +            va_end (args1); va_end (args2);
  1.3183 +        }],
  1.3184 +        [f(0, 42); return 0],
  1.3185 +        [ac_cv_va_val_copy=yes],
  1.3186 +        [ac_cv_va_val_copy=no],
  1.3187 +    )]
  1.3188 +)
  1.3189 +if test "x$ac_cv_va_copy" = "xyes"; then
  1.3190 +    AC_DEFINE(VA_COPY, va_copy)
  1.3191 +    AC_DEFINE(HAVE_VA_COPY)
  1.3192 +fi
  1.3193 +
  1.3194 +if test "x$ac_cv_va_val_copy" = "xno"; then
  1.3195 +   AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
  1.3196 +fi
  1.3197 +
  1.3198 +dnl ===================================================================
  1.3199 +dnl ========================================================
  1.3200 +dnl Put your C++ language/feature checks below
  1.3201 +dnl ========================================================
  1.3202 +AC_LANG_CPLUSPLUS
  1.3203 +
  1.3204 +ARM_ABI_PREFIX=
  1.3205 +if test "$GNU_CC"; then
  1.3206 +  if test "$CPU_ARCH" = "arm" ; then
  1.3207 +    AC_CACHE_CHECK(for ARM EABI,
  1.3208 +        ac_cv_gcc_arm_eabi,
  1.3209 +        [AC_TRY_COMPILE([],
  1.3210 +                        [
  1.3211 +#if defined(__ARM_EABI__)
  1.3212 +  return 0;
  1.3213 +#else
  1.3214 +#error Not ARM EABI.
  1.3215 +#endif
  1.3216 +                        ],
  1.3217 +                        ac_cv_gcc_arm_eabi="yes",
  1.3218 +                        ac_cv_gcc_arm_eabi="no")])
  1.3219 +    if test "$ac_cv_gcc_arm_eabi" = "yes"; then
  1.3220 +        HAVE_ARM_EABI=1
  1.3221 +        ARM_ABI_PREFIX=eabi-
  1.3222 +    else
  1.3223 +        ARM_ABI_PREFIX=oabi-
  1.3224 +    fi
  1.3225 +  fi
  1.3226 +
  1.3227 +  TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
  1.3228 +fi
  1.3229 +
  1.3230 +dnl Check to see if we can resolve ambiguity with |using|.
  1.3231 +AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
  1.3232 +               ac_cv_cpp_ambiguity_resolving_using,
  1.3233 +               [AC_TRY_COMPILE(class X {
  1.3234 +                                 public: int go(const X&) {return 3;}
  1.3235 +                                         int jo(const X&) {return 3;}
  1.3236 +                               };
  1.3237 +                               class Y : public X {
  1.3238 +                                 public:  int go(int) {return 2;}
  1.3239 +                                          int jo(int) {return 2;}
  1.3240 +                                          using X::jo;
  1.3241 +                                 private: using X::go;
  1.3242 +                               };,
  1.3243 +                               X x; Y y; y.jo(x);,
  1.3244 +                               ac_cv_cpp_ambiguity_resolving_using=yes,
  1.3245 +                               ac_cv_cpp_ambiguity_resolving_using=no)])
  1.3246 +if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
  1.3247 +   AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
  1.3248 +fi
  1.3249 +
  1.3250 +dnl See if a dynamic_cast to void* gives the most derived object.
  1.3251 +AC_CACHE_CHECK(for C++ dynamic_cast to void*,
  1.3252 +               ac_cv_cpp_dynamic_cast_void_ptr,
  1.3253 +               [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
  1.3254 +                            class Y { int j; public: virtual ~Y() { } };
  1.3255 +                            class Z : public X, public Y { int k; };
  1.3256 +
  1.3257 +                            int main() {
  1.3258 +                                 Z mdo;
  1.3259 +                                 X *subx = (X*)&mdo;
  1.3260 +                                 Y *suby = (Y*)&mdo;
  1.3261 +                                 return !((((void*)&mdo != (void*)subx) &&
  1.3262 +                                           ((void*)&mdo == dynamic_cast<void*>(subx))) ||
  1.3263 +                                          (((void*)&mdo != (void*)suby) &&
  1.3264 +                                           ((void*)&mdo == dynamic_cast<void*>(suby))));
  1.3265 +                            }],
  1.3266 +                           ac_cv_cpp_dynamic_cast_void_ptr=yes,
  1.3267 +                           ac_cv_cpp_dynamic_cast_void_ptr=no,
  1.3268 +                           ac_cv_cpp_dynamic_cast_void_ptr=no)])
  1.3269 +if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
  1.3270 +   AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
  1.3271 +fi
  1.3272 +
  1.3273 +
  1.3274 +dnl note that this one is reversed - if the test fails, then
  1.3275 +dnl we require implementations of unused virtual methods. Which
  1.3276 +dnl really blows because it means we'll have useless vtable
  1.3277 +dnl bloat.
  1.3278 +AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
  1.3279 +               ac_cv_cpp_unused_required,
  1.3280 +               [AC_TRY_LINK(class X {private: virtual void never_called();};,
  1.3281 +                               X x;,
  1.3282 +                               ac_cv_cpp_unused_required=no,
  1.3283 +                               ac_cv_cpp_unused_required=yes)])
  1.3284 +if test "$ac_cv_cpp_unused_required" = yes ; then
  1.3285 +   AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
  1.3286 +fi
  1.3287 +
  1.3288 +
  1.3289 +dnl Some compilers have trouble comparing a constant reference to a templatized
  1.3290 +dnl class to zero, and require an explicit operator==() to be defined that takes
  1.3291 +dnl an int. This test separates the strong from the weak.
  1.3292 +
  1.3293 +AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
  1.3294 +               ac_cv_trouble_comparing_to_zero,
  1.3295 +               [AC_TRY_COMPILE([#include <algorithm>
  1.3296 +                                template <class T> class Foo {};
  1.3297 +                                class T2;
  1.3298 +                                template <class T> int operator==(const T2*, const T&) { return 0; }
  1.3299 +                                template <class T> int operator!=(const T2*, const T&) { return 0; }],
  1.3300 +                               [Foo<int> f; return (0 != f);],
  1.3301 +                               ac_cv_trouble_comparing_to_zero=no,
  1.3302 +                               ac_cv_trouble_comparing_to_zero=yes)])
  1.3303 +if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
  1.3304 +  AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
  1.3305 +fi
  1.3306 +
  1.3307 +# try harder, when checking for __thread support, see bug 521750 comment #33 and below
  1.3308 +# We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
  1.3309 +# enabled, the linker in xcode 4.1 will crash. Without this it would crash when
  1.3310 +# linking XUL.
  1.3311 +_SAVE_LDFLAGS=$LDFLAGS
  1.3312 +LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
  1.3313 +AC_CACHE_CHECK(for __thread keyword for TLS variables,
  1.3314 +               ac_cv_thread_keyword,
  1.3315 +               [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
  1.3316 +                            [return tlsIsMainThread;],
  1.3317 +                            ac_cv_thread_keyword=yes,
  1.3318 +                            ac_cv_thread_keyword=no)])
  1.3319 +LDFLAGS=$_SAVE_LDFLAGS
  1.3320 +# The custom dynamic linker doesn't support TLS variables
  1.3321 +MOZ_TLS=
  1.3322 +if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
  1.3323 +  # mips builds fail with TLS variables because of a binutils bug.
  1.3324 +  # See bug 528687
  1.3325 +  # OpenBSD doesn't have TLS support, and the test succeeds with clang++
  1.3326 +  case "${target}" in
  1.3327 +    mips*-*)
  1.3328 +      :
  1.3329 +      ;;
  1.3330 +    *-android*|*-linuxandroid*)
  1.3331 +      :
  1.3332 +      ;;
  1.3333 +    *-openbsd*)
  1.3334 +      :
  1.3335 +      ;;
  1.3336 +    *)
  1.3337 +      AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
  1.3338 +      MOZ_TLS=1
  1.3339 +      ;;
  1.3340 +  esac
  1.3341 +fi
  1.3342 +
  1.3343 +dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
  1.3344 +if test -n "$MOZ_LINKER"; then
  1.3345 +  if test "$CPU_ARCH" = arm; then
  1.3346 +    dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
  1.3347 +    if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
  1.3348 +      LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
  1.3349 +      _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
  1.3350 +    fi
  1.3351 +  fi
  1.3352 +fi
  1.3353 +
  1.3354 +dnl The custom linker doesn't support text relocations, but NDK >= r6b
  1.3355 +dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
  1.3356 +dnl We however want to avoid these text relocations, and this can be done
  1.3357 +dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
  1.3358 +dnl doesn't contain anything at all, beside placeholders for some sections,
  1.3359 +dnl and crtbegin only contains a finalizer function that calls
  1.3360 +dnl __cxa_finalize. The custom linker actually takes care of calling
  1.3361 +dnl __cxa_finalize when the library doesn't call it itself, which makes it
  1.3362 +dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
  1.3363 +dnl link crtbegin and crtend at all.
  1.3364 +if test -n "$MOZ_LINKER" -a "$OS_TARGET" = "Android"; then
  1.3365 +  AC_CACHE_CHECK([whether the CRT objects have text relocations],
  1.3366 +    ac_cv_crt_has_text_relocations,
  1.3367 +    [echo 'int foo() { return 0; }' > conftest.cpp
  1.3368 +     if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
  1.3369 +        test -s conftest${DLL_SUFFIX}; then
  1.3370 +       if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
  1.3371 +         ac_cv_crt_has_text_relocations=yes
  1.3372 +       else
  1.3373 +         ac_cv_crt_has_text_relocations=no
  1.3374 +       fi
  1.3375 +     else
  1.3376 +       AC_ERROR([couldn't compile a simple C file])
  1.3377 +     fi
  1.3378 +     rm -rf conftest*])
  1.3379 +  if test "$ac_cv_crt_has_text_relocations" = yes; then
  1.3380 +    dnl While we want libraries to skip the CRT files, we don't want
  1.3381 +    dnl executables to be treated the same way. We thus set the flag
  1.3382 +    dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
  1.3383 +    dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
  1.3384 +    dnl Using LDFLAGS in nspr is safe, since we only really build
  1.3385 +    dnl libraries there.
  1.3386 +    DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
  1.3387 +    NSPR_LDFLAGS="$NSPR_LDFLAGS -nostartfiles"
  1.3388 +  fi
  1.3389 +fi
  1.3390 +
  1.3391 +dnl Check for the existence of various allocation headers/functions
  1.3392 +
  1.3393 +MALLOC_HEADERS="malloc.h malloc_np.h malloc/malloc.h sys/malloc.h"
  1.3394 +MALLOC_H=
  1.3395 +
  1.3396 +for file in $MALLOC_HEADERS; do
  1.3397 +  MOZ_CHECK_HEADER($file, [MALLOC_H=$file])
  1.3398 +  if test "$MALLOC_H" != ""; then
  1.3399 +    AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
  1.3400 +    break
  1.3401 +  fi
  1.3402 +done
  1.3403 +
  1.3404 +AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
  1.3405 +
  1.3406 +AC_CHECK_FUNCS(malloc_usable_size)
  1.3407 +
  1.3408 +dnl See if compiler supports some gcc-style attributes
  1.3409 +
  1.3410 +AC_CACHE_CHECK(for __attribute__((always_inline)),
  1.3411 +               ac_cv_attribute_always_inline,
  1.3412 +               [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
  1.3413 +                               [],
  1.3414 +                               ac_cv_attribute_always_inline=yes,
  1.3415 +                               ac_cv_attribute_always_inline=no)])
  1.3416 +
  1.3417 +AC_CACHE_CHECK(for __attribute__((malloc)),
  1.3418 +               ac_cv_attribute_malloc,
  1.3419 +               [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
  1.3420 +                               [],
  1.3421 +                               ac_cv_attribute_malloc=yes,
  1.3422 +                               ac_cv_attribute_malloc=no)])
  1.3423 +
  1.3424 +AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
  1.3425 +               ac_cv_attribute_warn_unused,
  1.3426 +               [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
  1.3427 +                               [],
  1.3428 +                               ac_cv_attribute_warn_unused=yes,
  1.3429 +                               ac_cv_attribute_warn_unused=no)])
  1.3430 +
  1.3431 +dnl End of C++ language/feature checks
  1.3432 +AC_LANG_C
  1.3433 +
  1.3434 +dnl ========================================================
  1.3435 +dnl =  Internationalization checks
  1.3436 +dnl ========================================================
  1.3437 +dnl
  1.3438 +dnl Internationalization and Locale support is different
  1.3439 +dnl on various UNIX platforms.  Checks for specific i18n
  1.3440 +dnl features go here.
  1.3441 +
  1.3442 +dnl check for LC_MESSAGES
  1.3443 +AC_CACHE_CHECK(for LC_MESSAGES,
  1.3444 +               ac_cv_i18n_lc_messages,
  1.3445 +               [AC_TRY_COMPILE([#include <locale.h>],
  1.3446 +                               [int category = LC_MESSAGES;],
  1.3447 +                               ac_cv_i18n_lc_messages=yes,
  1.3448 +                               ac_cv_i18n_lc_messages=no)])
  1.3449 +if test "$ac_cv_i18n_lc_messages" = yes; then
  1.3450 +   AC_DEFINE(HAVE_I18N_LC_MESSAGES)
  1.3451 +fi
  1.3452 +
  1.3453 +AC_HAVE_FUNCS(localeconv)
  1.3454 +fi # ! SKIP_COMPILER_CHECKS
  1.3455 +
  1.3456 +TARGET_XPCOM_ABI=
  1.3457 +if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
  1.3458 +    TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
  1.3459 +fi
  1.3460 +
  1.3461 +dnl Mozilla specific options
  1.3462 +dnl ========================================================
  1.3463 +dnl The macros used for command line options
  1.3464 +dnl are defined in build/autoconf/altoptions.m4.
  1.3465 +
  1.3466 +dnl If the compiler supports these attributes, define them as
  1.3467 +dnl convenience macros.
  1.3468 +if test "$ac_cv_attribute_malloc" = yes ; then
  1.3469 +  AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
  1.3470 +else
  1.3471 +  AC_DEFINE(NS_ATTR_MALLOC,)
  1.3472 +fi
  1.3473 +
  1.3474 +if test "$ac_cv_attribute_warn_unused" = yes ; then
  1.3475 +  AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
  1.3476 +else
  1.3477 +  AC_DEFINE(NS_WARN_UNUSED_RESULT,)
  1.3478 +fi
  1.3479 +
  1.3480 +dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
  1.3481 +dnl features that Windows actually does support.
  1.3482 +
  1.3483 +if test -n "$SKIP_COMPILER_CHECKS"; then
  1.3484 +   dnl Windows has malloc.h
  1.3485 +   AC_DEFINE(MALLOC_H, [<malloc.h>])
  1.3486 +   AC_DEFINE(HAVE_FORCEINLINE)
  1.3487 +   AC_DEFINE(HAVE_LOCALECONV)
  1.3488 +fi # SKIP_COMPILER_CHECKS
  1.3489 +
  1.3490 +dnl ========================================================
  1.3491 +dnl =
  1.3492 +dnl = Check for external package dependencies
  1.3493 +dnl =
  1.3494 +dnl ========================================================
  1.3495 +MOZ_ARG_HEADER(External Packages)
  1.3496 +
  1.3497 +MOZ_ARG_WITH_STRING(libxul-sdk,
  1.3498 +[  --with-libxul-sdk=PFX   Use the libXUL SDK at <PFX>],
  1.3499 +  LIBXUL_SDK_DIR=$withval)
  1.3500 +
  1.3501 +if test "$LIBXUL_SDK_DIR" = "yes"; then
  1.3502 +    AC_MSG_ERROR([--with-libxul-sdk must specify a path])
  1.3503 +elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
  1.3504 +    LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
  1.3505 +
  1.3506 +    if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
  1.3507 +        AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
  1.3508 +    fi
  1.3509 +
  1.3510 +fi
  1.3511 +AC_SUBST(LIBXUL_SDK)
  1.3512 +
  1.3513 +if test -n "$LIBXUL_SDK"; then
  1.3514 +    LIBXUL_DIST="$LIBXUL_SDK"
  1.3515 +else
  1.3516 +    LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
  1.3517 +fi
  1.3518 +AC_SUBST(LIBXUL_DIST)
  1.3519 +
  1.3520 +SYSTEM_LIBXUL=
  1.3521 +
  1.3522 +MOZ_ARG_WITH_BOOL(system-libxul,
  1.3523 +[  --with-system-libxul    Use system installed libxul SDK],
  1.3524 +    SYSTEM_LIBXUL=1)
  1.3525 +
  1.3526 +dnl ========================================================
  1.3527 +dnl = If NSPR was not detected in the system,
  1.3528 +dnl = use the one in the source tree (mozilla/nsprpub)
  1.3529 +dnl ========================================================
  1.3530 +MOZ_ARG_WITH_BOOL(system-nspr,
  1.3531 +[  --with-system-nspr      Use system installed NSPR],
  1.3532 +    _USE_SYSTEM_NSPR=1 )
  1.3533 +
  1.3534 +if test -n "$_USE_SYSTEM_NSPR"; then
  1.3535 +    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])])
  1.3536 +fi
  1.3537 +
  1.3538 +if test -n "$MOZ_NATIVE_NSPR"; then
  1.3539 +    _SAVE_CFLAGS=$CFLAGS
  1.3540 +    CFLAGS="$CFLAGS $NSPR_CFLAGS"
  1.3541 +    AC_TRY_COMPILE([#include "prtypes.h"],
  1.3542 +                [#ifndef PR_STATIC_ASSERT
  1.3543 +                 #error PR_STATIC_ASSERT not defined or requires including prtypes.h
  1.3544 +                 #endif],
  1.3545 +                [MOZ_NATIVE_NSPR=1],
  1.3546 +                AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
  1.3547 +    AC_TRY_COMPILE([#include "prtypes.h"],
  1.3548 +                [#ifndef PR_UINT64
  1.3549 +                 #error PR_UINT64 not defined or requires including prtypes.h
  1.3550 +                 #endif],
  1.3551 +                [MOZ_NATIVE_NSPR=1],
  1.3552 +                AC_MSG_ERROR([system NSPR does not support PR_UINT64 or including prtypes.h does not provide it]))
  1.3553 +    CFLAGS=$_SAVE_CFLAGS
  1.3554 +else
  1.3555 +    if test -z "$LIBXUL_SDK"; then
  1.3556 +        NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
  1.3557 +        if test -n "$GNU_CC"; then
  1.3558 +            NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
  1.3559 +        else
  1.3560 +            NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
  1.3561 +        fi
  1.3562 +    else
  1.3563 +        NSPR_CFLAGS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --includedir="${LIBXUL_DIST}/include/nspr" --cflags`
  1.3564 +        NSPR_LIBS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --libdir="${LIBXUL_DIST}"/lib --libs`
  1.3565 +    fi
  1.3566 +fi
  1.3567 +
  1.3568 +dnl set GRE_MILESTONE
  1.3569 +dnl ========================================================
  1.3570 +if test -n "$LIBXUL_SDK"; then
  1.3571 +    GRE_MILESTONE=`$PYTHON "$_topsrcdir"/config/printconfigsetting.py "$LIBXUL_DIST"/bin/platform.ini Build Milestone`
  1.3572 +else
  1.3573 +    GRE_MILESTONE=`tail -n 1 "$_topsrcdir"/config/milestone.txt 2>/dev/null || tail -1 "$_topsrcdir"/config/milestone.txt`
  1.3574 +fi
  1.3575 +AC_SUBST(GRE_MILESTONE)
  1.3576 +
  1.3577 +# set RELEASE_BUILD and NIGHTLY_BUILD variables depending on the cycle we're in
  1.3578 +# The logic works like this:
  1.3579 +# - if we have "a1" in GRE_MILESTONE, we're building Nightly (define NIGHTLY_BUILD)
  1.3580 +# - otherwise, we're building Release/Beta (define RELEASE_BUILD)
  1.3581 +case "$GRE_MILESTONE" in
  1.3582 +  *a1*)
  1.3583 +      NIGHTLY_BUILD=1
  1.3584 +      AC_DEFINE(NIGHTLY_BUILD)
  1.3585 +      ;;
  1.3586 +  *)
  1.3587 +      RELEASE_BUILD=1
  1.3588 +      AC_DEFINE(RELEASE_BUILD)
  1.3589 +      ;;
  1.3590 +esac
  1.3591 +AC_SUBST(NIGHTLY_BUILD)
  1.3592 +AC_SUBST(RELEASE_BUILD)
  1.3593 +
  1.3594 +dnl ========================================================
  1.3595 +dnl Disable compiling sources in unified mode.
  1.3596 +dnl ========================================================
  1.3597 +
  1.3598 +if test -z "$NIGHTLY_BUILD"; then
  1.3599 +    MOZ_DISABLE_UNIFIED_COMPILATION=1
  1.3600 +fi
  1.3601 +
  1.3602 +MOZ_ARG_DISABLE_BOOL(unified-compilation,
  1.3603 +[  --disable-unified-compilation
  1.3604 +                          Disable unified compilation of some C/C++ sources],
  1.3605 +    MOZ_DISABLE_UNIFIED_COMPILATION=1,
  1.3606 +    MOZ_DISABLE_UNIFIED_COMPILATION=)
  1.3607 +AC_SUBST(MOZ_DISABLE_UNIFIED_COMPILATION)
  1.3608 +
  1.3609 +dnl system libevent Support
  1.3610 +dnl ========================================================
  1.3611 +MOZ_ARG_WITH_STRING(system-libevent,
  1.3612 +[  --with-system-libevent[=PFX]
  1.3613 +                          Use system libevent [installed at prefix PFX]],
  1.3614 +    LIBEVENT_DIR=$withval)
  1.3615 +
  1.3616 +_SAVE_CFLAGS=$CFLAGS
  1.3617 +_SAVE_LDFLAGS=$LDFLAGS
  1.3618 +_SAVE_LIBS=$LIBS
  1.3619 +if test "$LIBEVENT_DIR" = yes; then
  1.3620 +    PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
  1.3621 +        MOZ_NATIVE_LIBEVENT=1,
  1.3622 +        LIBEVENT_DIR=/usr)
  1.3623 +fi
  1.3624 +if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
  1.3625 +    MOZ_NATIVE_LIBEVENT=
  1.3626 +elif test -z "$MOZ_NATIVE_LIBEVENT"; then
  1.3627 +    CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
  1.3628 +    LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
  1.3629 +    MOZ_CHECK_HEADER(event.h,
  1.3630 +        [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
  1.3631 +             AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
  1.3632 +         fi],
  1.3633 +        AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
  1.3634 +    AC_CHECK_LIB(event, event_init,
  1.3635 +                 [MOZ_NATIVE_LIBEVENT=1
  1.3636 +                  MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
  1.3637 +                  MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
  1.3638 +                 [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
  1.3639 +fi
  1.3640 +CFLAGS=$_SAVE_CFLAGS
  1.3641 +LDFLAGS=$_SAVE_LDFLAGS
  1.3642 +LIBS=$_SAVE_LIBS
  1.3643 +
  1.3644 +AC_SUBST(MOZ_NATIVE_LIBEVENT)
  1.3645 +AC_SUBST(MOZ_LIBEVENT_CFLAGS)
  1.3646 +AC_SUBST(MOZ_LIBEVENT_LIBS)
  1.3647 +
  1.3648 +dnl ========================================================
  1.3649 +dnl = If NSS was not detected in the system,
  1.3650 +dnl = use the one in the source tree (mozilla/security/nss)
  1.3651 +dnl ========================================================
  1.3652 +
  1.3653 +MOZ_ARG_WITH_BOOL(system-nss,
  1.3654 +[  --with-system-nss       Use system installed NSS],
  1.3655 +    _USE_SYSTEM_NSS=1 )
  1.3656 +
  1.3657 +if test -n "$_USE_SYSTEM_NSS"; then
  1.3658 +    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])])
  1.3659 +fi
  1.3660 +
  1.3661 +if test -n "$MOZ_NATIVE_NSS"; then
  1.3662 +   NSS_LIBS="$NSS_LIBS -lcrmf"
  1.3663 +else
  1.3664 +   NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
  1.3665 +
  1.3666 +   if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT"; then
  1.3667 +       NSS_LIBS="\
  1.3668 +        \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
  1.3669 +        \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
  1.3670 +        \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
  1.3671 +        \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
  1.3672 +        \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
  1.3673 +   else
  1.3674 +       NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
  1.3675 +   fi
  1.3676 +fi
  1.3677 +
  1.3678 +dnl ======================
  1.3679 +dnl Detect yasm
  1.3680 +dnl ======================
  1.3681 +
  1.3682 +AC_MSG_CHECKING([for YASM assembler])
  1.3683 +AC_CHECK_PROGS(YASM, yasm, "")
  1.3684 +
  1.3685 +if test -n "$YASM"; then
  1.3686 +  dnl Pull out yasm's version string
  1.3687 +  YASM_VERSION=`yasm --version | $AWK '/^yasm/ { print $2 }'`
  1.3688 +  _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
  1.3689 +  _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
  1.3690 +  _YASM_RELEASE=`      echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
  1.3691 +  _YASM_BUILD=`        echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
  1.3692 +fi
  1.3693 +
  1.3694 +if test -z "$SKIP_LIBRARY_CHECKS"; then
  1.3695 +dnl system JPEG support
  1.3696 +dnl ========================================================
  1.3697 +MOZ_ARG_WITH_STRING(system-jpeg,
  1.3698 +[  --with-system-jpeg[=PFX]
  1.3699 +                          Use system libjpeg [installed at prefix PFX]],
  1.3700 +    JPEG_DIR=$withval)
  1.3701 +
  1.3702 +_SAVE_CFLAGS=$CFLAGS
  1.3703 +_SAVE_LDFLAGS=$LDFLAGS
  1.3704 +_SAVE_LIBS=$LIBS
  1.3705 +if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
  1.3706 +    CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
  1.3707 +    LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
  1.3708 +fi
  1.3709 +if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
  1.3710 +    MOZ_NATIVE_JPEG=
  1.3711 +else
  1.3712 +    AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_NATIVE_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_NATIVE_JPEG=)
  1.3713 +fi
  1.3714 +
  1.3715 +if test "$MOZ_NATIVE_JPEG" = 1; then
  1.3716 +    AC_TRY_COMPILE([ #include <stdio.h>
  1.3717 +                     #include <sys/types.h>
  1.3718 +                     #include <jpeglib.h> ],
  1.3719 +                   [ #if JPEG_LIB_VERSION < $MOZJPEG
  1.3720 +                     #error "Insufficient JPEG library version ($MOZJPEG required)."
  1.3721 +                     #endif
  1.3722 +                     #ifndef JCS_EXTENSIONS
  1.3723 +                     #error "libjpeg-turbo JCS_EXTENSIONS required"
  1.3724 +                     #endif
  1.3725 +                     ],
  1.3726 +                   MOZ_NATIVE_JPEG=1,
  1.3727 +                   AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
  1.3728 +fi
  1.3729 +CFLAGS=$_SAVE_CFLAGS
  1.3730 +LDFLAGS=$_SAVE_LDFLAGS
  1.3731 +LIBS=$_SAVE_LIBS
  1.3732 +
  1.3733 +if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_NATIVE_JPEG" = 1; then
  1.3734 +    MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
  1.3735 +    MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
  1.3736 +fi
  1.3737 +fi # SKIP_LIBRARY_CHECKS
  1.3738 +
  1.3739 +dnl system ZLIB support
  1.3740 +dnl ========================================================
  1.3741 +MOZ_ZLIB_CHECK([1.2.3])
  1.3742 +
  1.3743 +if test "$MOZ_NATIVE_ZLIB" != 1; then
  1.3744 +    MOZ_ZLIB_CFLAGS="-I${_topsrcdir}/modules/zlib/src"
  1.3745 +    MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,'"$MOZ_BUILD_ROOT"'/modules/zlib/src)'
  1.3746 +fi
  1.3747 +
  1.3748 +if test "$MOZ_LINKER" = 1 -a "$MOZ_NATIVE_ZLIB" != 1; then
  1.3749 +    AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
  1.3750 +fi
  1.3751 +
  1.3752 +MOZ_PNG_ARM_NEON=
  1.3753 +
  1.3754 +if test -z "$SKIP_LIBRARY_CHECKS"; then
  1.3755 +dnl system BZIP2 Support
  1.3756 +dnl ========================================================
  1.3757 +MOZ_ARG_WITH_STRING(system-bz2,
  1.3758 +[  --with-system-bz2[=PFX]
  1.3759 +                          Use system libbz2 [installed at prefix PFX]],
  1.3760 +    BZ2_DIR=$withval)
  1.3761 +
  1.3762 +_SAVE_CFLAGS=$CFLAGS
  1.3763 +_SAVE_LDFLAGS=$LDFLAGS
  1.3764 +_SAVE_LIBS=$LIBS
  1.3765 +if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
  1.3766 +    CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
  1.3767 +    LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
  1.3768 +fi
  1.3769 +if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
  1.3770 +    MOZ_NATIVE_BZ2=
  1.3771 +else
  1.3772 +    AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_NATIVE_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
  1.3773 +    [MOZ_NATIVE_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
  1.3774 +fi
  1.3775 +CFLAGS=$_SAVE_CFLAGS
  1.3776 +LDFLAGS=$_SAVE_LDFLAGS
  1.3777 +LIBS=$_SAVE_LIBS
  1.3778 +
  1.3779 +if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_NATIVE_BZ2" = 1; then
  1.3780 +    MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
  1.3781 +    MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
  1.3782 +fi
  1.3783 +
  1.3784 +dnl ========================================================
  1.3785 +dnl system PNG Support
  1.3786 +dnl ========================================================
  1.3787 +MOZ_ARG_WITH_STRING(system-png,
  1.3788 +[  --with-system-png[=PFX]
  1.3789 +                          Use system libpng [installed at prefix PFX]],
  1.3790 +    PNG_DIR=$withval)
  1.3791 +
  1.3792 +_SAVE_CFLAGS=$CFLAGS
  1.3793 +_SAVE_LDFLAGS=$LDFLAGS
  1.3794 +_SAVE_LIBS=$LIBS
  1.3795 +if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
  1.3796 +    CFLAGS="-I${PNG_DIR}/include $CFLAGS"
  1.3797 +    LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
  1.3798 +fi
  1.3799 +if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
  1.3800 +    MOZ_NATIVE_PNG=
  1.3801 +else
  1.3802 +    AC_CHECK_LIB(png, png_get_valid, [MOZ_NATIVE_PNG=1 MOZ_PNG_LIBS="-lpng"],
  1.3803 +                 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
  1.3804 +    AC_CHECK_LIB(png, png_get_acTL, ,
  1.3805 +                 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
  1.3806 +fi
  1.3807 +if test "$MOZ_NATIVE_PNG" = 1; then
  1.3808 +    AC_TRY_COMPILE([ #include <stdio.h>
  1.3809 +                     #include <sys/types.h>
  1.3810 +                     #include <png.h> ],
  1.3811 +                   [ #if PNG_LIBPNG_VER < $MOZPNG
  1.3812 +                     #error "Insufficient libpng version ($MOZPNG required)."
  1.3813 +                     #endif
  1.3814 +                     #ifndef PNG_UINT_31_MAX
  1.3815 +                     #error "Insufficient libpng version."
  1.3816 +                     #endif ],
  1.3817 +                   MOZ_NATIVE_PNG=1,
  1.3818 +                   AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
  1.3819 +fi
  1.3820 +CFLAGS=$_SAVE_CFLAGS
  1.3821 +LDFLAGS=$_SAVE_LDFLAGS
  1.3822 +LIBS=$_SAVE_LIBS
  1.3823 +
  1.3824 +if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_NATIVE_PNG" = 1; then
  1.3825 +    MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
  1.3826 +    MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
  1.3827 +fi
  1.3828 +
  1.3829 +MOZ_PNG_ARM_NEON_CHECK=
  1.3830 +if test "$MOZ_NATIVE_PNG" != 1 -a "$CPU_ARCH" = "arm" ; then
  1.3831 +    MOZ_ARG_ENABLE_STRING(png-arm-neon-support,
  1.3832 +        [  --enable-png-arm-neon-support=TYPE
  1.3833 +             Options include:
  1.3834 +                 no
  1.3835 +                 check (default)
  1.3836 +                 nocheck (faster but unsafe)],
  1.3837 +        [MOZ_PNG_ARM_NEON_SUPPORT=$enableval ] )
  1.3838 +    case "$MOZ_PNG_ARM_NEON_SUPPORT" in
  1.3839 +        no)
  1.3840 +            # enable-png-arm-neon-support = no
  1.3841 +            ;;
  1.3842 +        nocheck)
  1.3843 +            # enable-png-arm-neon-support = nocheck
  1.3844 +            MOZ_PNG_ARM_NEON=1
  1.3845 +            ;;
  1.3846 +        *)
  1.3847 +            MOZ_PNG_ARM_NEON=1
  1.3848 +            MOZ_PNG_ARM_NEON_CHECK=1
  1.3849 +            ;;
  1.3850 +    esac
  1.3851 +fi
  1.3852 +
  1.3853 +AC_SUBST(MOZ_PNG_ARM_NEON_CHECK)
  1.3854 +
  1.3855 +fi # SKIP_LIBRARY_CHECKS
  1.3856 +
  1.3857 +AC_SUBST(MOZ_PNG_ARM_NEON)
  1.3858 +
  1.3859 +dnl ========================================================
  1.3860 +dnl system HunSpell Support
  1.3861 +dnl ========================================================
  1.3862 +MOZ_ARG_ENABLE_BOOL(system-hunspell,
  1.3863 +[  --enable-system-hunspell
  1.3864 +                          Use system hunspell (located with pkgconfig)],
  1.3865 +    MOZ_NATIVE_HUNSPELL=1 )
  1.3866 +
  1.3867 +if test -n "$MOZ_NATIVE_HUNSPELL"; then
  1.3868 +    PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
  1.3869 +fi
  1.3870 +
  1.3871 +AC_SUBST(MOZ_NATIVE_HUNSPELL)
  1.3872 +
  1.3873 +dnl ========================================================
  1.3874 +dnl system libffi Support
  1.3875 +dnl ========================================================
  1.3876 +MOZ_CONFIG_FFI()
  1.3877 +
  1.3878 +if test -n "$MOZ_NATIVE_FFI"; then
  1.3879 +    MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_FFI_LIBS"
  1.3880 +fi
  1.3881 +
  1.3882 +# split JS out by default to avoid VS2005 PGO crash (bug 591836).
  1.3883 +if test "$OS_ARCH" = "WINNT"; then
  1.3884 +  JS_SHARED_LIBRARY=1
  1.3885 +fi
  1.3886 +
  1.3887 +MOZ_ARG_ENABLE_BOOL(shared-js,
  1.3888 +[  --enable-shared-js
  1.3889 +                          Create a shared JavaScript library.],
  1.3890 +    JS_SHARED_LIBRARY=1,
  1.3891 +    JS_SHARED_LIBRARY=)
  1.3892 +
  1.3893 +dnl ========================================================
  1.3894 +dnl Java SDK support
  1.3895 +dnl ========================================================
  1.3896 +
  1.3897 +JAVA_BIN_PATH=
  1.3898 +MOZ_ARG_WITH_STRING(java-bin-path,
  1.3899 +[  --with-java-bin-path=dir
  1.3900 +                          Location of Java binaries (java, javac, jar)],
  1.3901 +    JAVA_BIN_PATH=$withval)
  1.3902 +
  1.3903 +dnl ========================================================
  1.3904 +dnl =
  1.3905 +dnl = Application
  1.3906 +dnl =
  1.3907 +dnl ========================================================
  1.3908 +
  1.3909 +MOZ_ARG_HEADER(Application)
  1.3910 +
  1.3911 +ENABLE_TESTS=1
  1.3912 +ENABLE_SYSTEM_EXTENSION_DIRS=1
  1.3913 +MOZ_BRANDING_DIRECTORY=
  1.3914 +MOZ_OFFICIAL_BRANDING=
  1.3915 +MOZ_FEEDS=1
  1.3916 +MOZ_WEBAPP_RUNTIME=
  1.3917 +MOZ_JSDEBUGGER=1
  1.3918 +MOZ_AUTH_EXTENSION=1
  1.3919 +MOZ_RAW=
  1.3920 +MOZ_VORBIS=
  1.3921 +MOZ_TREMOR=
  1.3922 +MOZ_WAVE=1
  1.3923 +MOZ_SAMPLE_TYPE_FLOAT32=
  1.3924 +MOZ_SAMPLE_TYPE_S16=
  1.3925 +MOZ_OPUS=1
  1.3926 +MOZ_WEBM=1
  1.3927 +MOZ_GSTREAMER=
  1.3928 +MOZ_DIRECTSHOW=
  1.3929 +MOZ_WMF=
  1.3930 +MOZ_FMP4=
  1.3931 +MOZ_FFMPEG=
  1.3932 +MOZ_WEBRTC=1
  1.3933 +MOZ_PEERCONNECTION=
  1.3934 +MOZ_SRTP=
  1.3935 +MOZ_WEBRTC_SIGNALING=
  1.3936 +MOZ_WEBRTC_ASSERT_ALWAYS=1
  1.3937 +MOZ_SCTP=
  1.3938 +MOZ_MEDIA_PLUGINS=
  1.3939 +MOZ_MEDIA_NAVIGATOR=
  1.3940 +MOZ_OMX_PLUGIN=
  1.3941 +MOZ_VPX=
  1.3942 +MOZ_VPX_ERROR_CONCEALMENT=
  1.3943 +MOZ_WEBSPEECH=1
  1.3944 +VPX_AS=
  1.3945 +VPX_ASFLAGS=
  1.3946 +VPX_AS_DASH_C_FLAG=
  1.3947 +VPX_AS_CONVERSION=
  1.3948 +VPX_ASM_SUFFIX=
  1.3949 +VPX_X86_ASM=
  1.3950 +VPX_ARM_ASM=
  1.3951 +LIBJPEG_TURBO_AS=
  1.3952 +LIBJPEG_TURBO_ASFLAGS=
  1.3953 +LIBJPEG_TURBO_X86_ASM=
  1.3954 +LIBJPEG_TURBO_X64_ASM=
  1.3955 +LIBJPEG_TURBO_ARM_ASM=
  1.3956 +MOZ_PERMISSIONS=1
  1.3957 +MOZ_PLACES=1
  1.3958 +MOZ_SOCIAL=1
  1.3959 +MOZ_PREF_EXTENSIONS=1
  1.3960 +MOZ_PROFILELOCKING=1
  1.3961 +MOZ_REFLOW_PERF=
  1.3962 +MOZ_SAFE_BROWSING=
  1.3963 +MOZ_HELP_VIEWER=
  1.3964 +MOZ_SPELLCHECK=1
  1.3965 +MOZ_ANDROID_OMTC=
  1.3966 +MOZ_TOOLKIT_SEARCH=1
  1.3967 +MOZ_UI_LOCALE=en-US
  1.3968 +MOZ_UNIVERSALCHARDET=1
  1.3969 +MOZ_URL_CLASSIFIER=
  1.3970 +MOZ_XUL=1
  1.3971 +MOZ_ZIPWRITER=1
  1.3972 +NS_PRINTING=1
  1.3973 +MOZ_PDF_PRINTING=
  1.3974 +MOZ_DISABLE_CRYPTOLEGACY=
  1.3975 +NSS_DISABLE_DBM=
  1.3976 +NECKO_COOKIES=1
  1.3977 +NECKO_PROTOCOLS_DEFAULT="about app data file ftp http res viewsource websocket wyciwyg device"
  1.3978 +if test -n "$MOZ_RTSP"; then
  1.3979 +  NECKO_PROTOCOLS_DEFAULT="$NECKO_PROTOCOLS_DEFAULT rtsp"
  1.3980 +fi
  1.3981 +USE_ARM_KUSER=
  1.3982 +BUILD_CTYPES=1
  1.3983 +MOZ_USE_NATIVE_POPUP_WINDOWS=
  1.3984 +MOZ_ANDROID_HISTORY=
  1.3985 +MOZ_WEBSMS_BACKEND=
  1.3986 +MOZ_ANDROID_BEAM=
  1.3987 +MOZ_ANDROID_SYNTHAPKS=
  1.3988 +ACCESSIBILITY=1
  1.3989 +MOZ_TIME_MANAGER=
  1.3990 +MOZ_PAY=
  1.3991 +MOZ_AUDIO_CHANNEL_MANAGER=
  1.3992 +NSS_NO_LIBPKIX=
  1.3993 +MOZ_CONTENT_SANDBOX=
  1.3994 +MOZ_CONTENT_SANDBOX_REPORTER=1
  1.3995 +
  1.3996 +case "$target_os" in
  1.3997 +    mingw*)
  1.3998 +        NS_ENABLE_TSF=1
  1.3999 +        AC_DEFINE(NS_ENABLE_TSF)
  1.4000 +        ;;
  1.4001 +esac
  1.4002 +
  1.4003 +case "${target}" in
  1.4004 +    *-android*|*-linuxandroid*)
  1.4005 +        if test "$CPU_ARCH" = "arm" ; then
  1.4006 +          USE_ARM_KUSER=1
  1.4007 +        fi
  1.4008 +
  1.4009 +        NSS_DISABLE_DBM=1
  1.4010 +        MOZ_THEME_FASTSTRIPE=1
  1.4011 +        MOZ_TREE_FREETYPE=1
  1.4012 +        MOZ_MEMORY=1
  1.4013 +        MOZ_RAW=1
  1.4014 +        ;;
  1.4015 +
  1.4016 +esac
  1.4017 +
  1.4018 +MOZ_ARG_WITH_STRING(external-source-dir,
  1.4019 +[  --with-external-source-dir=dir
  1.4020 +                          External directory containing additional build files.],
  1.4021 +[ EXTERNAL_SOURCE_DIR=$withval])
  1.4022 +AC_SUBST(EXTERNAL_SOURCE_DIR)
  1.4023 +
  1.4024 +MOZ_ARG_ENABLE_STRING(application,
  1.4025 +[  --enable-application=APP
  1.4026 +                          Options include:
  1.4027 +                            browser (Firefox)
  1.4028 +                            xulrunner
  1.4029 +                            tools/update-packaging (AUS-related packaging tools)],
  1.4030 +[ MOZ_BUILD_APP=$enableval ] )
  1.4031 +
  1.4032 +MOZ_ARG_WITH_STRING(xulrunner-stub-name,
  1.4033 +[  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
  1.4034 +  XULRUNNER_STUB_NAME=$withval)
  1.4035 +
  1.4036 +if test -z "$XULRUNNER_STUB_NAME"; then
  1.4037 +  case "$target_os" in
  1.4038 +  darwin*)
  1.4039 +    XULRUNNER_STUB_NAME=xulrunner
  1.4040 +    ;;
  1.4041 +  *)
  1.4042 +    XULRUNNER_STUB_NAME=xulrunner-stub
  1.4043 +  esac
  1.4044 +fi
  1.4045 +AC_SUBST(XULRUNNER_STUB_NAME)
  1.4046 +
  1.4047 +AC_MSG_CHECKING([for application to build])
  1.4048 +if test -z "$MOZ_BUILD_APP"; then
  1.4049 +  AC_MSG_RESULT([browser])
  1.4050 +  MOZ_BUILD_APP=browser
  1.4051 +else
  1.4052 +  # "mobile" no longer exists.
  1.4053 +  if test "$MOZ_BUILD_APP" = "mobile" ; then
  1.4054 +    AC_MSG_RESULT([none])
  1.4055 +    AC_MSG_ERROR([--enable-application=mobile is no longer supported.])
  1.4056 +  fi
  1.4057 +  # We have a valid application only if it has a build.mk file in its top
  1.4058 +  # directory.
  1.4059 +  if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
  1.4060 +    AC_MSG_RESULT([none])
  1.4061 +    AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
  1.4062 +  else
  1.4063 +    AC_MSG_RESULT([$MOZ_BUILD_APP])
  1.4064 +  fi
  1.4065 +fi
  1.4066 +
  1.4067 +# The app update channel is 'default' when not supplied. The value is used in
  1.4068 +# the application's confvars.sh so it must be set before confvars.sh is called.
  1.4069 +MOZ_ARG_ENABLE_STRING([update-channel],
  1.4070 +[  --enable-update-channel=CHANNEL
  1.4071 +                          Select application update channel (default=default)],
  1.4072 +    MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
  1.4073 +
  1.4074 +if test -z "$MOZ_UPDATE_CHANNEL"; then
  1.4075 +    MOZ_UPDATE_CHANNEL=default
  1.4076 +fi
  1.4077 +AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
  1.4078 +AC_SUBST(MOZ_UPDATE_CHANNEL)
  1.4079 +
  1.4080 +# Allow to specify a Mozilla API key file that contains the secret key to be
  1.4081 +# used for various Mozilla API requests.
  1.4082 +MOZ_ARG_WITH_STRING(mozilla-api-keyfile,
  1.4083 +[  --with-mozilla-api-keyfile=file   Use the secret key contained in the given keyfile for Mozilla API requests],
  1.4084 +  MOZ_MOZILLA_API_KEY=`cat $withval`)
  1.4085 +if test -z "$MOZ_MOZILLA_API_KEY"; then
  1.4086 +    MOZ_MOZILLA_API_KEY=no-mozilla-api-key
  1.4087 +fi
  1.4088 +AC_SUBST(MOZ_MOZILLA_API_KEY)
  1.4089 +
  1.4090 +# Allow to specify a Google API key file that contains the secret key to be
  1.4091 +# used for various Google API requests.
  1.4092 +MOZ_ARG_WITH_STRING(google-api-keyfile,
  1.4093 +[  --with-google-api-keyfile=file   Use the secret key contained in the given keyfile for Google API requests],
  1.4094 +  MOZ_GOOGLE_API_KEY=`cat $withval`)
  1.4095 +if test -z "$MOZ_GOOGLE_API_KEY"; then
  1.4096 +    MOZ_GOOGLE_API_KEY=no-google-api-key
  1.4097 +fi
  1.4098 +AC_SUBST(MOZ_GOOGLE_API_KEY)
  1.4099 +
  1.4100 +# Allow the application to influence configure with a confvars.sh script.
  1.4101 +AC_MSG_CHECKING([if app-specific confvars.sh exists])
  1.4102 +if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
  1.4103 +  AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
  1.4104 +  . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
  1.4105 +else
  1.4106 +  AC_MSG_RESULT([no])
  1.4107 +fi
  1.4108 +
  1.4109 +# Allow influencing configure with a defines.sh script.
  1.4110 +. "${srcdir}/build/defines.sh"
  1.4111 +
  1.4112 +# If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
  1.4113 +# set in defines.sh
  1.4114 +if test "$BUILDING_RELEASE"; then
  1.4115 +  # Override value in defines.sh, if any
  1.4116 +  EARLY_BETA_OR_EARLIER=
  1.4117 +elif test "$EARLY_BETA_OR_EARLIER"; then
  1.4118 +  AC_DEFINE(EARLY_BETA_OR_EARLIER)
  1.4119 +fi
  1.4120 +AC_SUBST(EARLY_BETA_OR_EARLIER)
  1.4121 +
  1.4122 +# Allow the application to provide a subconfigure script
  1.4123 +if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
  1.4124 +  do_output_subdirs() {
  1.4125 +    if test -n "$_subconfigure_subdirs"; then
  1.4126 +      AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
  1.4127 +     fi
  1.4128 +    _subconfigure_subdir="$1"
  1.4129 +    _subconfigure_config_args="$ac_configure_args"
  1.4130 +  }
  1.4131 +  tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
  1.4132 +  m4 "${srcdir}/build/autoconf/subconfigure.m4" \
  1.4133 +     "${srcdir}/build/autoconf/altoptions.m4" \
  1.4134 +     "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
  1.4135 +  . $tmpscript
  1.4136 +  rm -f $tmpscript
  1.4137 +fi
  1.4138 +
  1.4139 +# Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
  1.4140 +MOZ_ARG_WITH_STRING(app-name,
  1.4141 +[--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
  1.4142 +WITH_APP_NAME=$withval,
  1.4143 +)
  1.4144 +
  1.4145 +if test -n "$WITH_APP_NAME" ; then
  1.4146 +    MOZ_APP_NAME="$WITH_APP_NAME"
  1.4147 +fi
  1.4148 +
  1.4149 +MOZ_ARG_WITH_STRING(app-basename,
  1.4150 +[--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
  1.4151 +WITH_APP_BASENAME=$withval,
  1.4152 +)
  1.4153 +
  1.4154 +if test -n "$WITH_APP_BASENAME" ; then
  1.4155 +    MOZ_APP_BASENAME="$WITH_APP_BASENAME"
  1.4156 +fi
  1.4157 +
  1.4158 +# Now is a good time to test for logic errors, define mismatches, etc.
  1.4159 +case "$MOZ_BUILD_APP" in
  1.4160 +xulrunner)
  1.4161 +  if test "$LIBXUL_SDK"; then
  1.4162 +    AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
  1.4163 +  fi
  1.4164 +  ;;
  1.4165 +esac
  1.4166 +
  1.4167 +# Special cases where we need to AC_DEFINE something. Also a holdover for apps
  1.4168 +# that haven't made a confvars.sh yet. Don't add new stuff here, use
  1.4169 +# MOZ_BUILD_APP.
  1.4170 +case "$MOZ_BUILD_APP" in
  1.4171 +browser)
  1.4172 +  AC_DEFINE(MOZ_PHOENIX)
  1.4173 +  ;;
  1.4174 +
  1.4175 +xulrunner)
  1.4176 +  AC_DEFINE(MOZ_XULRUNNER)
  1.4177 +  ;;
  1.4178 +b2g)
  1.4179 +  AC_DEFINE(MOZ_B2G)
  1.4180 +  ;;
  1.4181 +esac
  1.4182 +
  1.4183 +AC_SUBST(MOZ_BUILD_APP)
  1.4184 +AC_SUBST(MOZ_PHOENIX)
  1.4185 +AC_SUBST(MOZ_XULRUNNER)
  1.4186 +AC_SUBST(MOZ_B2G)
  1.4187 +AC_SUBST(MOZ_B2G_VERSION)
  1.4188 +
  1.4189 +AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
  1.4190 +
  1.4191 +dnl ========================================================
  1.4192 +dnl Check android sdk version depending on mobile target
  1.4193 +dnl ========================================================
  1.4194 +
  1.4195 +if test -z "$gonkdir" ; then
  1.4196 +    # Minimum Android SDK API Level we require.
  1.4197 +    case "$MOZ_BUILD_APP" in
  1.4198 +    mobile/android)
  1.4199 +        android_min_api_level=16
  1.4200 +        case "$target" in
  1.4201 +        *-android*|*-linuxandroid*)
  1.4202 +            :
  1.4203 +            ;;
  1.4204 +        *)
  1.4205 +            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])
  1.4206 +            ;;
  1.4207 +        esac
  1.4208 +        ;;
  1.4209 +    esac
  1.4210 +
  1.4211 +    MOZ_ANDROID_SDK($android_min_api_level)
  1.4212 +fi
  1.4213 +
  1.4214 +dnl ========================================================
  1.4215 +dnl =
  1.4216 +dnl = Toolkit Options
  1.4217 +dnl =
  1.4218 +dnl ========================================================
  1.4219 +MOZ_ARG_HEADER(Toolkit Options)
  1.4220 +
  1.4221 +    dnl ========================================================
  1.4222 +    dnl = Select the default toolkit
  1.4223 +    dnl ========================================================
  1.4224 +    MOZ_ARG_ENABLE_STRING(default-toolkit,
  1.4225 +    [  --enable-default-toolkit=TK
  1.4226 +                          Select default toolkit
  1.4227 +                          Platform specific defaults:
  1.4228 +                            Mac OS X - cairo-cocoa
  1.4229 +                            Win32 - cairo-windows
  1.4230 +                            * - cairo-gtk2
  1.4231 +                            * - cairo-gtk3
  1.4232 +                            * - cairo-qt],
  1.4233 +    [ _DEFAULT_TOOLKIT=$enableval ],
  1.4234 +    [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
  1.4235 +
  1.4236 +    if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
  1.4237 +        -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
  1.4238 +        -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
  1.4239 +        -o "$_DEFAULT_TOOLKIT" = "cairo-gtk3" \
  1.4240 +        -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
  1.4241 +        -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
  1.4242 +        -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
  1.4243 +        -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
  1.4244 +        -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
  1.4245 +    then
  1.4246 +        dnl nglayout only supports building with one toolkit,
  1.4247 +        dnl so ignore everything after the first comma (",").
  1.4248 +        MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
  1.4249 +    else
  1.4250 +        AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
  1.4251 +    fi
  1.4252 +
  1.4253 +MOZ_ARG_WITHOUT_BOOL(x,
  1.4254 +[  --without-x              Build without X11],
  1.4255 +    WITHOUT_X11=1)
  1.4256 +
  1.4257 +dnl ========================================================
  1.4258 +dnl = Enable the toolkit as needed                         =
  1.4259 +dnl ========================================================
  1.4260 +
  1.4261 +MOZ_WIDGET_GTK=
  1.4262 +
  1.4263 +case "$MOZ_WIDGET_TOOLKIT" in
  1.4264 +
  1.4265 +cairo-windows)
  1.4266 +    MOZ_WIDGET_TOOLKIT=windows
  1.4267 +    MOZ_WEBGL=1
  1.4268 +    MOZ_PDF_PRINTING=1
  1.4269 +    MOZ_INSTRUMENT_EVENT_LOOP=1
  1.4270 +    if test -n "$GNU_CC"; then
  1.4271 +        MOZ_FOLD_LIBS=
  1.4272 +    fi
  1.4273 +    ;;
  1.4274 +
  1.4275 +cairo-gtk3)
  1.4276 +    MOZ_WIDGET_TOOLKIT=gtk3
  1.4277 +    MOZ_ENABLE_GTK=1
  1.4278 +    MOZ_ENABLE_GTK3=1
  1.4279 +    MOZ_ENABLE_XREMOTE=1
  1.4280 +    MOZ_WEBGL=1
  1.4281 +    MOZ_GL_DEFAULT_PROVIDER=GLX
  1.4282 +
  1.4283 +    AC_DEFINE(MOZ_X11)
  1.4284 +    MOZ_X11=1
  1.4285 +    USE_FC_FREETYPE=1
  1.4286 +
  1.4287 +    TK_CFLAGS='$(MOZ_GTK3_CFLAGS)'
  1.4288 +    TK_LIBS='$(MOZ_GTK3_LIBS)'
  1.4289 +    MOZ_WIDGET_GTK=3
  1.4290 +    AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
  1.4291 +    MOZ_PDF_PRINTING=1
  1.4292 +    MOZ_INSTRUMENT_EVENT_LOOP=1
  1.4293 +    ;;
  1.4294 +
  1.4295 +cairo-gtk2|cairo-gtk2-x11)
  1.4296 +    MOZ_WIDGET_TOOLKIT=gtk2
  1.4297 +    MOZ_ENABLE_GTK=1
  1.4298 +    MOZ_ENABLE_GTK2=1
  1.4299 +    MOZ_ENABLE_XREMOTE=1
  1.4300 +    MOZ_WEBGL=1
  1.4301 +    MOZ_GL_DEFAULT_PROVIDER=GLX
  1.4302 +
  1.4303 +    AC_DEFINE(MOZ_X11)
  1.4304 +    MOZ_X11=1
  1.4305 +    USE_FC_FREETYPE=1
  1.4306 +
  1.4307 +    TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
  1.4308 +    TK_LIBS='$(MOZ_GTK2_LIBS)'
  1.4309 +    AC_DEFINE(MOZ_WIDGET_GTK2)
  1.4310 +    MOZ_WIDGET_GTK=2
  1.4311 +    AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
  1.4312 +    MOZ_PDF_PRINTING=1
  1.4313 +    MOZ_INSTRUMENT_EVENT_LOOP=1
  1.4314 +    ;;
  1.4315 +
  1.4316 +cairo-qt)
  1.4317 +    MOZ_WIDGET_TOOLKIT=qt
  1.4318 +    MOZ_ENABLE_QT=1
  1.4319 +    if test -z "$WITHOUT_X11"; then
  1.4320 +      MOZ_ENABLE_XREMOTE=1
  1.4321 +      MOZ_GL_DEFAULT_PROVIDER=GLX
  1.4322 +      MOZ_X11=1
  1.4323 +      AC_DEFINE(MOZ_X11)
  1.4324 +      XT_LIBS=
  1.4325 +    fi
  1.4326 +
  1.4327 +    MOZ_WEBGL=1
  1.4328 +    USE_FC_FREETYPE=1
  1.4329 +    TK_CFLAGS='$(MOZ_QT_CFLAGS)'
  1.4330 +    TK_LIBS='$(MOZ_QT_LIBS)'
  1.4331 +    AC_DEFINE(MOZ_WIDGET_QT)
  1.4332 +    MOZ_PDF_PRINTING=1
  1.4333 +    AC_DEFINE(QT_NO_KEYWORDS)
  1.4334 +    ;;
  1.4335 +
  1.4336 +cairo-cocoa)
  1.4337 +    MOZ_WIDGET_TOOLKIT=cocoa
  1.4338 +    AC_DEFINE(MOZ_WIDGET_COCOA)
  1.4339 +    LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
  1.4340 +    TK_LIBS='-framework CoreLocation -framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
  1.4341 +    TK_CFLAGS="-DNO_X11"
  1.4342 +    CFLAGS="$CFLAGS $TK_CFLAGS"
  1.4343 +    CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
  1.4344 +    XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/bin/XUL $(call EXPAND_LIBNAME_PATH,mozalloc,$(LIBXUL_DIST)/bin)'
  1.4345 +    MOZ_USER_DIR="Mozilla"
  1.4346 +    MOZ_FS_LAYOUT=bundle
  1.4347 +    MOZ_WEBGL=1
  1.4348 +    MOZ_INSTRUMENT_EVENT_LOOP=1
  1.4349 +    ;;
  1.4350 +
  1.4351 +cairo-uikit)
  1.4352 +    MOZ_WIDGET_TOOLKIT=uikit
  1.4353 +    AC_DEFINE(MOZ_WIDGET_UIKIT)
  1.4354 +    LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
  1.4355 +    TK_CFLAGS="-DNO_X11"
  1.4356 +    TK_LIBS='-framework Foundation -framework CoreFoundation -framework CoreGraphics -framework CoreText'
  1.4357 +    CFLAGS="$CFLAGS $TK_CFLAGS"
  1.4358 +    CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
  1.4359 +    XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/bin/XUL $(call EXPAND_LIBNAME_PATH,mozalloc,$(LIBXUL_DIST)/bin)'
  1.4360 +    MOZ_USER_DIR="Mozilla"
  1.4361 +    MOZ_FS_LAYOUT=bundle
  1.4362 +    ;;
  1.4363 +
  1.4364 +cairo-android)
  1.4365 +    AC_DEFINE(MOZ_WIDGET_ANDROID)
  1.4366 +    MOZ_WIDGET_TOOLKIT=android
  1.4367 +    TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
  1.4368 +    TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
  1.4369 +    MOZ_WEBGL=1
  1.4370 +    MOZ_PDF_PRINTING=1
  1.4371 +    MOZ_INSTRUMENT_EVENT_LOOP=1
  1.4372 +    ;;
  1.4373 +
  1.4374 +cairo-gonk)
  1.4375 +    XPCOM_FROZEN_LDOPTS='$(call EXPAND_LIBNAME_PATH,xul mozalloc,$(LIBXUL_DIST)/lib)'
  1.4376 +    AC_DEFINE(MOZ_WIDGET_GONK)
  1.4377 +    AC_DEFINE(MOZ_TOUCH)
  1.4378 +    MOZ_WIDGET_TOOLKIT=gonk
  1.4379 +    TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
  1.4380 +    TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
  1.4381 +    MOZ_WEBGL=1
  1.4382 +    MOZ_PDF_PRINTING=1
  1.4383 +    MOZ_TOUCH=1
  1.4384 +    MOZ_INSTRUMENT_EVENT_LOOP=1
  1.4385 +    ;;
  1.4386 +
  1.4387 +esac
  1.4388 +
  1.4389 +AC_SUBST(MOZ_PDF_PRINTING)
  1.4390 +if test "$MOZ_PDF_PRINTING"; then
  1.4391 +   PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
  1.4392 +   AC_DEFINE(MOZ_PDF_PRINTING)
  1.4393 +fi
  1.4394 +
  1.4395 +if test "$MOZ_ENABLE_XREMOTE"; then
  1.4396 +    AC_DEFINE(MOZ_ENABLE_XREMOTE)
  1.4397 +fi
  1.4398 +
  1.4399 +if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
  1.4400 +   AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
  1.4401 +fi
  1.4402 +
  1.4403 +if test "$COMPILE_ENVIRONMENT"; then
  1.4404 +  if test "$MOZ_ENABLE_GTK3"; then
  1.4405 +    PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
  1.4406 +  fi
  1.4407 +  if test "$MOZ_ENABLE_GTK2"; then
  1.4408 +    if test "$MOZ_X11"; then
  1.4409 +      GDK_PACKAGES=gdk-x11-2.0
  1.4410 +    fi
  1.4411 +
  1.4412 +    PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
  1.4413 +  fi
  1.4414 +
  1.4415 +fi # COMPILE_ENVIRONMENT
  1.4416 +
  1.4417 +AC_SUBST(MOZ_FS_LAYOUT)
  1.4418 +
  1.4419 +dnl ========================================================
  1.4420 +dnl Use ARM userspace kernel helpers; tell NSPR to enable
  1.4421 +dnl their usage and use them in spidermonkey.
  1.4422 +dnl ========================================================
  1.4423 +MOZ_ARG_WITH_BOOL(arm-kuser,
  1.4424 +[  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
  1.4425 +    USE_ARM_KUSER=1,)
  1.4426 +if test -n "$USE_ARM_KUSER"; then
  1.4427 +   AC_DEFINE(USE_ARM_KUSER)
  1.4428 +fi
  1.4429 +
  1.4430 +dnl ========================================================
  1.4431 +dnl = startup-notification support module
  1.4432 +dnl ========================================================
  1.4433 +
  1.4434 +if test "$MOZ_ENABLE_GTK"
  1.4435 +then
  1.4436 +    MOZ_ENABLE_STARTUP_NOTIFICATION=
  1.4437 +
  1.4438 +    MOZ_ARG_ENABLE_BOOL(startup-notification,
  1.4439 +    [  --enable-startup-notification
  1.4440 +                          Enable startup-notification support (default: disabled) ],
  1.4441 +        MOZ_ENABLE_STARTUP_NOTIFICATION=force,
  1.4442 +        MOZ_ENABLE_STARTUP_NOTIFICATION=)
  1.4443 +    if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
  1.4444 +    then
  1.4445 +        PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
  1.4446 +                          libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
  1.4447 +        [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
  1.4448 +            if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
  1.4449 +            then
  1.4450 +                AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
  1.4451 +            fi
  1.4452 +            MOZ_ENABLE_STARTUP_NOTIFICATION=
  1.4453 +        ])
  1.4454 +    fi
  1.4455 +
  1.4456 +    if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
  1.4457 +        AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
  1.4458 +    fi
  1.4459 +
  1.4460 +    TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
  1.4461 +fi
  1.4462 +AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
  1.4463 +AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
  1.4464 +AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
  1.4465 +
  1.4466 +dnl ========================================================
  1.4467 +dnl Disable printing
  1.4468 +dnl ========================================================
  1.4469 +MOZ_ARG_DISABLE_BOOL(printing,
  1.4470 +[  --disable-printing      Disable printing support],
  1.4471 +    NS_PRINTING=,
  1.4472 +    NS_PRINTING=1)
  1.4473 +
  1.4474 +if test "$NS_PRINTING"; then
  1.4475 +    AC_DEFINE(NS_PRINTING)
  1.4476 +    AC_DEFINE(NS_PRINT_PREVIEW)
  1.4477 +fi
  1.4478 +
  1.4479 +dnl ========================================================
  1.4480 +dnl = QT support
  1.4481 +dnl ========================================================
  1.4482 +if test "$MOZ_ENABLE_QT"
  1.4483 +then
  1.4484 +    MOZ_ARG_WITH_STRING(qtdir,
  1.4485 +    [  --with-qtdir=\$dir       Specify Qt directory ],
  1.4486 +    [ QTDIR=$withval])
  1.4487 +
  1.4488 +    if test -z "$QTDIR"; then
  1.4489 +        AC_CHECK_PROGS(HOST_QMAKE, $HOST_QMAKE qmake, "")
  1.4490 +    else
  1.4491 +        HOST_QMAKE="$QTDIR/bin/qmake"
  1.4492 +    fi
  1.4493 +    QT_VERSION=`$HOST_QMAKE -v | grep 'Using Qt version' | egrep -o '[[0-9]]+\.[[0-9]]+\.[[0-9]]+'`
  1.4494 +
  1.4495 +    if test -z "$QTDIR"; then
  1.4496 +        case $QT_VERSION in
  1.4497 +        5.*)
  1.4498 +            AC_MSG_RESULT("Using qt5: $QT_VERSION")
  1.4499 +            PKG_CHECK_MODULES(MOZ_QT, Qt5Gui Qt5Network Qt5Core Qt5Quick, ,
  1.4500 +            [
  1.4501 +              AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase development packages, (On Ubuntu, you might try installing the packages qtbase5-dev libqt5opengl5-dev.)])
  1.4502 +            ])
  1.4503 +            QT5INCDIR=`pkg-config --variable=includedir Qt5Gui`
  1.4504 +            MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QT5INCDIR/QtGui/$QT_VERSION/QtGui"
  1.4505 +            if test "$NS_PRINTING"; then
  1.4506 +                PKG_CHECK_MODULES(MOZ_QT_WIDGETS, Qt5PrintSupport, ,
  1.4507 +                [
  1.4508 +                  AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase widgets development package])
  1.4509 +                ])
  1.4510 +                MOZ_QT_LIBS="$MOZ_QT_LIBS $MOZ_QT_WIDGETS_LIBS"
  1.4511 +                MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $MOZ_QT_WIDGETS_CFLAGS"
  1.4512 +            fi
  1.4513 +            ;;
  1.4514 +        *)
  1.4515 +            AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
  1.4516 +            ;;
  1.4517 +        esac
  1.4518 +
  1.4519 +        AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
  1.4520 +        AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
  1.4521 +    else
  1.4522 +        MOZ_QT_CFLAGS="-DQT_SHARED"
  1.4523 +        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
  1.4524 +        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
  1.4525 +        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
  1.4526 +        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
  1.4527 +        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
  1.4528 +        MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
  1.4529 +        case $QT_VERSION in
  1.4530 +        5.*)
  1.4531 +            AC_MSG_RESULT("Using qt5: $QT_VERSION")
  1.4532 +            MOZ_QT_LIBS="$MOZ_QT_LIBS -L$QTDIR/lib/ -lQt5Gui -lQt5Network -lQt5Core -lQt5Xml"
  1.4533 +            MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui/$QT_VERSION/QtGui"
  1.4534 +            if test "$NS_PRINTING"; then
  1.4535 +                MOZ_QT_LIBS="$MOZ_QT_LIBS -lQt5Widgets -lQt5PrintSupport"
  1.4536 +                MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
  1.4537 +            fi
  1.4538 +            ;;
  1.4539 +        *)
  1.4540 +            AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
  1.4541 +            ;;
  1.4542 +        esac
  1.4543 +
  1.4544 +        HOST_MOC="$QTDIR/bin/moc"
  1.4545 +        HOST_RCC="$QTDIR/bin/rcc"
  1.4546 +    fi
  1.4547 +    if test -z "$HOST_MOC"; then
  1.4548 +        AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is incorrect])
  1.4549 +    fi
  1.4550 +    if test -z "$HOST_RCC"; then
  1.4551 +        AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is incorrect])
  1.4552 +    fi
  1.4553 +
  1.4554 +    MOC=$HOST_MOC
  1.4555 +    RCC=$HOST_RCC
  1.4556 +
  1.4557 +    MOZ_ENABLE_QMSYSTEM2=
  1.4558 +    PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
  1.4559 +                      MOZ_ENABLE_QMSYSTEM2=1,
  1.4560 +                      MOZ_ENABLE_QMSYSTEM2=)
  1.4561 +
  1.4562 +    if test "$MOZ_ENABLE_QMSYSTEM2"; then
  1.4563 +      MOZ_ENABLE_QMSYSTEM2=1
  1.4564 +      MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
  1.4565 +      MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
  1.4566 +      AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
  1.4567 +    fi
  1.4568 +
  1.4569 +    MOZ_ENABLE_QTNETWORK=
  1.4570 +    PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
  1.4571 +                      MOZ_ENABLE_QTNETWORK=1,
  1.4572 +                      MOZ_ENABLE_QTNETWORK=)
  1.4573 +
  1.4574 +    if test "$MOZ_ENABLE_QTNETWORK"; then
  1.4575 +      MOZ_ENABLE_QTNETWORK=1
  1.4576 +      AC_DEFINE(MOZ_ENABLE_QTNETWORK)
  1.4577 +    fi
  1.4578 +
  1.4579 +    MOZ_ENABLE_QTMOBILITY=
  1.4580 +    PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
  1.4581 +                      MOZ_ENABLE_QTMOBILITY=1,
  1.4582 +                      MOZ_ENABLE_QTMOBILITY=)
  1.4583 +    if test "$MOZ_ENABLE_QTMOBILITY"; then
  1.4584 +       MOZ_ENABLE_QTMOBILITY=1
  1.4585 +       MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
  1.4586 +       MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
  1.4587 +       AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
  1.4588 +       AC_SUBST(MOZ_ENABLE_QTMOBILITY)
  1.4589 +    else
  1.4590 +       AC_CHECK_LIB(QtSensors, main, [
  1.4591 +          MOZ_ENABLE_QTMOBILITY=1
  1.4592 +          MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
  1.4593 +          MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
  1.4594 +          MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
  1.4595 +          MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
  1.4596 +          MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
  1.4597 +       ])
  1.4598 +    fi
  1.4599 +
  1.4600 +    MOZ_ENABLE_QT5FEEDBACK=
  1.4601 +    PKG_CHECK_MODULES(_QT5FEEDBACK, Qt0Feedback,
  1.4602 +                      MOZ_ENABLE_QT5FEEDBACK=1,
  1.4603 +                      MOZ_ENABLE_QT5FEEDBACK=)
  1.4604 +    if test "$MOZ_ENABLE_QT5FEEDBACK"; then
  1.4605 +       MOZ_ENABLE_QT5FEEDBACK=1
  1.4606 +       MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QT5FEEDBACK_CFLAGS"
  1.4607 +       MOZ_QT_LIBS="$MOZ_QT_LIBS $_QT5FEEDBACK_LIBS"
  1.4608 +       AC_DEFINE(MOZ_ENABLE_QT5FEEDBACK)
  1.4609 +       AC_SUBST(MOZ_ENABLE_QT5FEEDBACK)
  1.4610 +    fi
  1.4611 +
  1.4612 +    MOZ_ENABLE_QT5GEOPOSITION=
  1.4613 +    PKG_CHECK_MODULES(_QT5GEOPOSITION, Qt5Positioning,
  1.4614 +                      MOZ_ENABLE_QT5GEOPOSITION=1,
  1.4615 +                      MOZ_ENABLE_QT5GEOPOSITION=)
  1.4616 +    if test "$MOZ_ENABLE_QT5GEOPOSITION"; then
  1.4617 +       MOZ_ENABLE_QT5GEOPOSITION=1
  1.4618 +       MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QT5GEOPOSITION_CFLAGS"
  1.4619 +       MOZ_QT_LIBS="$MOZ_QT_LIBS $_QT5GEOPOSITION_LIBS"
  1.4620 +       AC_DEFINE(MOZ_ENABLE_QT5GEOPOSITION)
  1.4621 +       AC_SUBST(MOZ_ENABLE_QT5GEOPOSITION)
  1.4622 +    fi
  1.4623 +
  1.4624 +    if test "$MOZ_ENABLE_CONTENTACTION"; then
  1.4625 +      MOZ_ENABLE_CONTENTACTION=1
  1.4626 +      AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
  1.4627 +    fi
  1.4628 +
  1.4629 +    MOZ_ENABLE_CONTENTACTION=
  1.4630 +    PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
  1.4631 +    if test "$MOZ_ENABLE_CONTENTACTION"; then
  1.4632 +       MOZ_ENABLE_CONTENTACTION=1
  1.4633 +       MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_CONTENTACTION_CFLAGS"
  1.4634 +       MOZ_QT_LIBS="$MOZ_QT_LIBS $_CONTENTACTION_LIBS"
  1.4635 +       AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
  1.4636 +       AC_SUBST(MOZ_ENABLE_CONTENTACTION)
  1.4637 +    fi
  1.4638 +fi
  1.4639 +
  1.4640 +AC_SUBST(GTK_CONFIG)
  1.4641 +AC_SUBST(TK_CFLAGS)
  1.4642 +AC_SUBST(TK_LIBS)
  1.4643 +
  1.4644 +AC_SUBST(MOZ_ENABLE_GTK2)
  1.4645 +AC_SUBST(MOZ_ENABLE_GTK3)
  1.4646 +AC_SUBST(MOZ_ENABLE_GTK)
  1.4647 +AC_SUBST(MOZ_ENABLE_QT)
  1.4648 +AC_SUBST(MOZ_ENABLE_QTNETWORK)
  1.4649 +AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
  1.4650 +AC_SUBST(MOZ_ENABLE_QTMOBILITY)
  1.4651 +AC_SUBST(MOZ_ENABLE_XREMOTE)
  1.4652 +AC_SUBST(MOZ_GTK2_CFLAGS)
  1.4653 +AC_SUBST(MOZ_GTK2_LIBS)
  1.4654 +AC_SUBST(MOZ_GTK3_CFLAGS)
  1.4655 +AC_SUBST(MOZ_GTK3_LIBS)
  1.4656 +AC_SUBST(MOZ_WIDGET_GTK)
  1.4657 +AC_SUBST(MOZ_QT_CFLAGS)
  1.4658 +AC_SUBST(MOZ_QT_LIBS)
  1.4659 +
  1.4660 +AC_SUBST(MOC)
  1.4661 +AC_SUBST(RCC)
  1.4662 +
  1.4663 +AC_SUBST(MOZ_X11)
  1.4664 +
  1.4665 +dnl ========================================================
  1.4666 +dnl =
  1.4667 +dnl = Components & Features
  1.4668 +dnl =
  1.4669 +dnl ========================================================
  1.4670 +MOZ_ARG_HEADER(Components and Features)
  1.4671 +
  1.4672 +dnl ========================================================
  1.4673 +dnl = Localization
  1.4674 +dnl ========================================================
  1.4675 +MOZ_ARG_ENABLE_STRING(ui-locale,
  1.4676 +[  --enable-ui-locale=ab-CD
  1.4677 +                          Select the user interface locale (default: en-US)],
  1.4678 +    MOZ_UI_LOCALE=$enableval )
  1.4679 +AC_SUBST(MOZ_UI_LOCALE)
  1.4680 +
  1.4681 +dnl ========================================================
  1.4682 +dnl = Trademarked Branding
  1.4683 +dnl ========================================================
  1.4684 +MOZ_ARG_ENABLE_BOOL(official-branding,
  1.4685 +[  --enable-official-branding
  1.4686 +                          Enable Official mozilla.org Branding
  1.4687 +                          Do not distribute builds with
  1.4688 +                          --enable-official-branding unless you have
  1.4689 +                          permission to use trademarks per
  1.4690 +                          http://www.mozilla.org/foundation/trademarks/ .],
  1.4691 +[
  1.4692 +  if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
  1.4693 +    AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
  1.4694 +  else
  1.4695 +    MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
  1.4696 +    MOZ_OFFICIAL_BRANDING=1
  1.4697 +  fi
  1.4698 +], MOZ_OFFICIAL_BRANDING=)
  1.4699 +
  1.4700 +AC_SUBST(MOZ_OFFICIAL_BRANDING)
  1.4701 +if test -n "$MOZ_OFFICIAL_BRANDING"; then
  1.4702 +  AC_DEFINE(MOZ_OFFICIAL_BRANDING)
  1.4703 +fi
  1.4704 +
  1.4705 +MOZ_ARG_WITH_STRING(branding,
  1.4706 +[  --with-branding=dir     Use branding from the specified directory.],
  1.4707 +    MOZ_BRANDING_DIRECTORY=$withval)
  1.4708 +
  1.4709 +REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
  1.4710 +if test -z "$REAL_BRANDING_DIRECTORY"; then
  1.4711 +  REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
  1.4712 +fi
  1.4713 +
  1.4714 +if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
  1.4715 +  . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
  1.4716 +fi
  1.4717 +
  1.4718 +AC_SUBST(MOZ_BRANDING_DIRECTORY)
  1.4719 +
  1.4720 +dnl ========================================================
  1.4721 +dnl = Distribution ID
  1.4722 +dnl ========================================================
  1.4723 +MOZ_ARG_WITH_STRING(distribution-id,
  1.4724 +[  --with-distribution-id=ID
  1.4725 +                          Set distribution-specific id (default=org.mozilla)],
  1.4726 +[ val=`echo $withval`
  1.4727 +    MOZ_DISTRIBUTION_ID="$val"])
  1.4728 +
  1.4729 +if test -z "$MOZ_DISTRIBUTION_ID"; then
  1.4730 +   MOZ_DISTRIBUTION_ID="org.mozilla"
  1.4731 +fi
  1.4732 +
  1.4733 +AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
  1.4734 +AC_SUBST(MOZ_DISTRIBUTION_ID)
  1.4735 +
  1.4736 +
  1.4737 +dnl ========================================================
  1.4738 +dnl = Pango
  1.4739 +dnl ========================================================
  1.4740 +if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
  1.4741 +then
  1.4742 +    PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
  1.4743 +
  1.4744 +    PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
  1.4745 +    AC_SUBST(MOZ_PANGO_CFLAGS)
  1.4746 +    AC_SUBST(MOZ_PANGO_LIBS)
  1.4747 +fi
  1.4748 +
  1.4749 +dnl ========================================================
  1.4750 +dnl = GnomeVFS, GIO and GConf support module
  1.4751 +dnl ========================================================
  1.4752 +
  1.4753 +if test "$MOZ_X11"
  1.4754 +then
  1.4755 +    dnl build the GIO extension by default only when the
  1.4756 +    dnl GTK2 toolkit is in use.
  1.4757 +    if test "$MOZ_ENABLE_GTK"
  1.4758 +    then
  1.4759 +        MOZ_ENABLE_GIO=1
  1.4760 +        MOZ_ENABLE_GCONF=1
  1.4761 +    fi
  1.4762 +
  1.4763 +    dnl ========================================================
  1.4764 +    dnl = GnomeVFS support module
  1.4765 +    dnl ========================================================
  1.4766 +    MOZ_ARG_ENABLE_BOOL(gnomevfs,
  1.4767 +    [  --enable-gnomevfs       Enable GnomeVFS support (default: disabled)],
  1.4768 +        MOZ_ENABLE_GNOMEVFS=force,
  1.4769 +        MOZ_ENABLE_GNOMEVFS=)
  1.4770 +
  1.4771 +    if test "$MOZ_ENABLE_GNOMEVFS"
  1.4772 +    then
  1.4773 +        PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
  1.4774 +            MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
  1.4775 +            MOZ_ENABLE_GNOMEVFS=1
  1.4776 +            AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
  1.4777 +        ],[
  1.4778 +            if test "$MOZ_ENABLE_GNOMEVFS" = "force"
  1.4779 +            then
  1.4780 +                AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
  1.4781 +            fi
  1.4782 +            MOZ_ENABLE_GNOMEVFS=
  1.4783 +        ])
  1.4784 +    fi
  1.4785 +
  1.4786 +    AC_SUBST(MOZ_ENABLE_GNOMEVFS)
  1.4787 +    AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
  1.4788 +    AC_SUBST(MOZ_GNOMEVFS_LIBS)
  1.4789 +
  1.4790 +    dnl ========================================================
  1.4791 +    dnl = GIO support module
  1.4792 +    dnl ========================================================
  1.4793 +    MOZ_ARG_DISABLE_BOOL(gio,
  1.4794 +    [  --disable-gio           Disable GIO support],
  1.4795 +        MOZ_ENABLE_GIO=,
  1.4796 +        MOZ_ENABLE_GIO=force)
  1.4797 +
  1.4798 +    if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK"
  1.4799 +    then
  1.4800 +        if test "$MOZ_ENABLE_GTK2"
  1.4801 +        then
  1.4802 +            PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
  1.4803 +                              [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
  1.4804 +        fi
  1.4805 +        PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
  1.4806 +            MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
  1.4807 +            MOZ_ENABLE_GIO=1
  1.4808 +            AC_DEFINE(MOZ_ENABLE_GIO)
  1.4809 +        ],[
  1.4810 +            if test "$MOZ_ENABLE_GIO" = "force"
  1.4811 +            then
  1.4812 +                AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
  1.4813 +            fi
  1.4814 +            MOZ_ENABLE_GIO=
  1.4815 +        ])
  1.4816 +    fi
  1.4817 +
  1.4818 +    AC_SUBST(MOZ_ENABLE_GIO)
  1.4819 +    AC_SUBST(MOZ_GIO_CFLAGS)
  1.4820 +    AC_SUBST(MOZ_GIO_LIBS)
  1.4821 +
  1.4822 +    dnl ========================================================
  1.4823 +    dnl = GConf support module
  1.4824 +    dnl ========================================================
  1.4825 +    MOZ_ARG_DISABLE_BOOL(gconf,
  1.4826 +    [  --disable-gconf      Disable Gconf support ],
  1.4827 +        MOZ_ENABLE_GCONF=,
  1.4828 +        MOZ_ENABLE_GCONF=force)
  1.4829 +
  1.4830 +    if test "$MOZ_ENABLE_GCONF"
  1.4831 +    then
  1.4832 +        PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
  1.4833 +            MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
  1.4834 +            MOZ_ENABLE_GCONF=1
  1.4835 +        ],[
  1.4836 +            if test "$MOZ_ENABLE_GCONF" = "force"
  1.4837 +            then
  1.4838 +                AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
  1.4839 +            fi
  1.4840 +            MOZ_ENABLE_GCONF=
  1.4841 +        ])
  1.4842 +    fi
  1.4843 +
  1.4844 +    if test "$MOZ_ENABLE_GCONF"; then
  1.4845 +        AC_DEFINE(MOZ_ENABLE_GCONF)
  1.4846 +    fi
  1.4847 +
  1.4848 +    AC_SUBST(MOZ_ENABLE_GCONF)
  1.4849 +    AC_SUBST(MOZ_GCONF_CFLAGS)
  1.4850 +    AC_SUBST(MOZ_GCONF_LIBS)
  1.4851 +fi
  1.4852 +
  1.4853 +dnl ========================================================
  1.4854 +dnl = libproxy support
  1.4855 +dnl ========================================================
  1.4856 +
  1.4857 +if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
  1.4858 +then
  1.4859 +    MOZ_ENABLE_LIBPROXY=
  1.4860 +
  1.4861 +    MOZ_ARG_ENABLE_BOOL(libproxy,
  1.4862 +    [  --enable-libproxy         Enable libproxy support ],
  1.4863 +    MOZ_ENABLE_LIBPROXY=1,
  1.4864 +    MOZ_ENABLE_LIBPROXY=)
  1.4865 +
  1.4866 +    if test "$MOZ_ENABLE_LIBPROXY"
  1.4867 +    then
  1.4868 +        PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
  1.4869 +        AC_DEFINE(MOZ_ENABLE_LIBPROXY)
  1.4870 +    fi
  1.4871 +fi
  1.4872 +AC_SUBST(MOZ_ENABLE_LIBPROXY)
  1.4873 +AC_SUBST(MOZ_LIBPROXY_CFLAGS)
  1.4874 +AC_SUBST(MOZ_LIBPROXY_LIBS)
  1.4875 +
  1.4876 +dnl ========================================================
  1.4877 +dnl = GNOME component (mozgnome)
  1.4878 +dnl ========================================================
  1.4879 +
  1.4880 +if test "$MOZ_ENABLE_GTK"
  1.4881 +then
  1.4882 +    MOZ_ENABLE_GNOME_COMPONENT=1
  1.4883 +fi
  1.4884 +AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
  1.4885 +
  1.4886 +dnl ========================================================
  1.4887 +dnl = libgnomeui support module
  1.4888 +dnl ========================================================
  1.4889 +
  1.4890 +if test "$MOZ_ENABLE_GTK"
  1.4891 +then
  1.4892 +    MOZ_ARG_ENABLE_BOOL(gnomeui,
  1.4893 +    [  --enable-gnomeui        Enable libgnomeui instead of GIO & GTK for icon theme support ],
  1.4894 +        MOZ_ENABLE_GNOMEUI=force,
  1.4895 +        MOZ_ENABLE_GNOMEUI=)
  1.4896 +
  1.4897 +    if test "$MOZ_ENABLE_GNOMEUI"
  1.4898 +    then
  1.4899 +        PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
  1.4900 +        [
  1.4901 +            MOZ_ENABLE_GNOMEUI=1
  1.4902 +        ],[
  1.4903 +            if test "$MOZ_ENABLE_GNOMEUI" = "force"
  1.4904 +            then
  1.4905 +                AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
  1.4906 +            fi
  1.4907 +            MOZ_ENABLE_GNOMEUI=
  1.4908 +        ])
  1.4909 +    fi
  1.4910 +
  1.4911 +    if test "$MOZ_ENABLE_GNOMEUI"; then
  1.4912 +        AC_DEFINE(MOZ_ENABLE_GNOMEUI)
  1.4913 +    fi
  1.4914 +fi
  1.4915 +
  1.4916 +AC_SUBST(MOZ_ENABLE_GNOMEUI)
  1.4917 +AC_SUBST(MOZ_GNOMEUI_CFLAGS)
  1.4918 +
  1.4919 +dnl ========================================================
  1.4920 +dnl = dbus support
  1.4921 +dnl ========================================================
  1.4922 +
  1.4923 +if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
  1.4924 +then
  1.4925 +    MOZ_ENABLE_DBUS=1
  1.4926 +
  1.4927 +    MOZ_ARG_DISABLE_BOOL(dbus,
  1.4928 +    [  --disable-dbus          Disable dbus support ],
  1.4929 +        MOZ_ENABLE_DBUS=,
  1.4930 +        MOZ_ENABLE_DBUS=1)
  1.4931 +
  1.4932 +    if test "$MOZ_ENABLE_DBUS"
  1.4933 +    then
  1.4934 +        PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
  1.4935 +        PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
  1.4936 +        AC_DEFINE(MOZ_ENABLE_DBUS)
  1.4937 +    fi
  1.4938 +fi
  1.4939 +AC_SUBST(MOZ_ENABLE_DBUS)
  1.4940 +AC_SUBST(MOZ_DBUS_CFLAGS)
  1.4941 +AC_SUBST(MOZ_DBUS_LIBS)
  1.4942 +AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
  1.4943 +AC_SUBST(MOZ_DBUS_GLIB_LIBS)
  1.4944 +
  1.4945 +dnl ========================================================
  1.4946 +dnl = Enable Android History instead of Places
  1.4947 +dnl ========================================================
  1.4948 +if test -n "$MOZ_ANDROID_HISTORY"; then
  1.4949 +    if test -z "$MOZ_PLACES"; then
  1.4950 +        AC_DEFINE(MOZ_ANDROID_HISTORY)
  1.4951 +    else
  1.4952 +        AC_MSG_ERROR([Cannot use MOZ_ANDROID_HISTORY alongside MOZ_PLACES.])
  1.4953 +    fi
  1.4954 +fi
  1.4955 +
  1.4956 +dnl ========================================================
  1.4957 +dnl = Build with the Android compositor
  1.4958 +dnl ========================================================
  1.4959 +if test -n "$MOZ_ANDROID_OMTC"; then
  1.4960 +     dnl Do this if defined in confvars.sh
  1.4961 +     AC_DEFINE(MOZ_ANDROID_OMTC)
  1.4962 +fi
  1.4963 +
  1.4964 +dnl ========================================================
  1.4965 +dnl = Disable WebSMS backend
  1.4966 +dnl ========================================================
  1.4967 +MOZ_ARG_DISABLE_BOOL(websms-backend,
  1.4968 +[  --disable-websms-backend
  1.4969 +                           Disable WebSMS backend],
  1.4970 +    MOZ_WEBSMS_BACKEND=,
  1.4971 +    MOZ_WEBSMS_BACKEND=1)
  1.4972 +
  1.4973 +if test -n "$MOZ_WEBSMS_BACKEND"; then
  1.4974 +    AC_DEFINE(MOZ_WEBSMS_BACKEND)
  1.4975 +fi
  1.4976 +
  1.4977 +dnl ========================================================
  1.4978 +dnl = Enable NFC permission on Android
  1.4979 +dnl ========================================================
  1.4980 +if test -n "$MOZ_ANDROID_BEAM"; then
  1.4981 +    AC_DEFINE(MOZ_ANDROID_BEAM)
  1.4982 +fi
  1.4983 +
  1.4984 +dnl ========================================================
  1.4985 +dnl = Synthesized Webapp APKs on Android
  1.4986 +dnl ========================================================
  1.4987 +MOZ_ARG_ENABLE_BOOL(android-synthapks,
  1.4988 +[  --enable-android-synthapks       Enable synthesized APKs],
  1.4989 +    MOZ_ANDROID_SYNTHAPKS=1,
  1.4990 +    MOZ_ANDROID_SYNTHAPKS=)
  1.4991 +
  1.4992 +if test -n "$MOZ_ANDROID_SYNTHAPKS"; then
  1.4993 +    AC_DEFINE(MOZ_ANDROID_SYNTHAPKS)
  1.4994 +fi
  1.4995 +
  1.4996 +dnl ========================================================
  1.4997 +dnl = JS Debugger XPCOM component (js/jsd)
  1.4998 +dnl ========================================================
  1.4999 +MOZ_ARG_DISABLE_BOOL(jsd,
  1.5000 +[  --disable-jsd           Disable JavaScript debug library],
  1.5001 +    MOZ_JSDEBUGGER=,
  1.5002 +    MOZ_JSDEBUGGER=1)
  1.5003 +
  1.5004 +
  1.5005 +dnl ========================================================
  1.5006 +dnl = Enable IPDL's "expensive" unit tests
  1.5007 +dnl ========================================================
  1.5008 +MOZ_IPDL_TESTS=
  1.5009 +
  1.5010 +MOZ_ARG_ENABLE_BOOL(ipdl-tests,
  1.5011 +[  --enable-ipdl-tests     Enable expensive IPDL tests],
  1.5012 +    MOZ_IPDL_TESTS=1,
  1.5013 +    MOZ_IPDL_TESTS=)
  1.5014 +
  1.5015 +if test -n "$MOZ_IPDL_TESTS"; then
  1.5016 +    AC_DEFINE(MOZ_IPDL_TESTS)
  1.5017 +fi
  1.5018 +
  1.5019 +AC_SUBST(MOZ_IPDL_TESTS)
  1.5020 +
  1.5021 +dnl ========================================================
  1.5022 +dnl = Disable building dbm
  1.5023 +dnl ========================================================
  1.5024 +MOZ_ARG_DISABLE_BOOL(dbm,
  1.5025 +[  --disable-dbm           Disable building dbm],
  1.5026 +    NSS_DISABLE_DBM=1,
  1.5027 +    NSS_DISABLE_DBM=)
  1.5028 +
  1.5029 +dnl ========================================================
  1.5030 +dnl accessibility support on by default on all platforms
  1.5031 +dnl ========================================================
  1.5032 +MOZ_ARG_DISABLE_BOOL(accessibility,
  1.5033 +[  --disable-accessibility Disable accessibility support],
  1.5034 +    ACCESSIBILITY=,
  1.5035 +    ACCESSIBILITY=1 )
  1.5036 +if test "$ACCESSIBILITY"; then
  1.5037 +    case "$target" in
  1.5038 +    *-mingw*)
  1.5039 +        if test -z "$MIDL"; then
  1.5040 +            if test "$GCC" != "yes"; then
  1.5041 +                AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
  1.5042 +            else
  1.5043 +                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.])
  1.5044 +            fi
  1.5045 +        fi
  1.5046 +    esac
  1.5047 +    AC_DEFINE(ACCESSIBILITY)
  1.5048 +fi
  1.5049 +
  1.5050 +dnl ========================================================
  1.5051 +dnl Accessibility is required for the linuxgl widget
  1.5052 +dnl backend
  1.5053 +dnl ========================================================
  1.5054 +if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
  1.5055 +    AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
  1.5056 +fi
  1.5057 +
  1.5058 +dnl Turn off webrtc for OS's we don't handle yet, but allow
  1.5059 +dnl --enable-webrtc to override.  Can disable for everything in
  1.5060 +dnl the master list above.
  1.5061 +if test -n "$MOZ_WEBRTC"; then
  1.5062 +    case "$target" in
  1.5063 +    *-linux*|*-mingw*|*-darwin*|*-android*|*-linuxandroid*|*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*)
  1.5064 +        dnl Leave enabled
  1.5065 +        ;;
  1.5066 +    *)
  1.5067 +        dnl default to disabled for all others
  1.5068 +        MOZ_WEBRTC=
  1.5069 +        ;;
  1.5070 +    esac
  1.5071 +fi
  1.5072 +
  1.5073 +AC_TRY_COMPILE([#include <linux/ethtool.h>],
  1.5074 +               [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
  1.5075 +               MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
  1.5076 +
  1.5077 +AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
  1.5078 +
  1.5079 +# target_arch is from {ia32|x64|arm|ppc}
  1.5080 +case "$CPU_ARCH" in
  1.5081 +x86_64 | arm | x86 | ppc* | ia64)
  1.5082 +    :
  1.5083 +    ;;
  1.5084 +*)
  1.5085 +# unsupported arch for webrtc
  1.5086 +    MOZ_WEBRTC=
  1.5087 +    ;;
  1.5088 +
  1.5089 +esac
  1.5090 +
  1.5091 +dnl ========================================================
  1.5092 +dnl = Disable WebRTC code
  1.5093 +dnl ========================================================
  1.5094 +MOZ_ARG_DISABLE_BOOL(webrtc,
  1.5095 +[  --disable-webrtc        Disable support for WebRTC],
  1.5096 +    MOZ_WEBRTC=,
  1.5097 +    MOZ_WEBRTC=1)
  1.5098 +
  1.5099 +if test -n "$MOZ_WEBRTC"; then
  1.5100 +    AC_DEFINE(MOZ_WEBRTC)
  1.5101 +    dnl MOZ_WEBRTC_ASSERT_ALWAYS turns on a number of safety asserts in
  1.5102 +    dnl opt/production builds (via MOZ_CRASH())
  1.5103 +    AC_DEFINE(MOZ_WEBRTC_ASSERT_ALWAYS)
  1.5104 +    MOZ_RAW=1
  1.5105 +    MOZ_VPX=1
  1.5106 +    MOZ_VPX_ERROR_CONCEALMENT=1
  1.5107 +
  1.5108 +dnl enable once Signaling lands
  1.5109 +    MOZ_WEBRTC_SIGNALING=1
  1.5110 +    AC_DEFINE(MOZ_WEBRTC_SIGNALING)
  1.5111 +dnl enable once PeerConnection lands
  1.5112 +    MOZ_PEERCONNECTION=1
  1.5113 +    AC_DEFINE(MOZ_PEERCONNECTION)
  1.5114 +    MOZ_SCTP=1
  1.5115 +    MOZ_SRTP=1
  1.5116 +    AC_DEFINE(MOZ_SCTP)
  1.5117 +    AC_DEFINE(MOZ_SRTP)
  1.5118 +else
  1.5119 +    MOZ_SYNTH_PICO=
  1.5120 +fi
  1.5121 +
  1.5122 +AC_SUBST(MOZ_WEBRTC)
  1.5123 +AC_SUBST(MOZ_WEBRTC_LEAKING_TESTS)
  1.5124 +AC_SUBST(MOZ_WEBRTC_SIGNALING)
  1.5125 +AC_SUBST(MOZ_PEERCONNECTION)
  1.5126 +AC_SUBST(MOZ_WEBRTC_ASSERT_ALWAYS)
  1.5127 +AC_SUBST(MOZ_SCTP)
  1.5128 +AC_SUBST(MOZ_SRTP)
  1.5129 +
  1.5130 +dnl Use integers over floats for audio on B2G and Android
  1.5131 +dnl (regarless of the CPU architecture, because audio
  1.5132 +dnl backends for those platforms don't support floats. We also
  1.5133 +dnl use integers on ARM with other OS, because it's more efficient.
  1.5134 +if test "$OS_TARGET" = "Android" -o "$CPU_ARCH" = "arm"; then
  1.5135 +    MOZ_SAMPLE_TYPE_S16=1
  1.5136 +    AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
  1.5137 +    AC_SUBST(MOZ_SAMPLE_TYPE_S16)
  1.5138 +else
  1.5139 +    MOZ_SAMPLE_TYPE_FLOAT32=1
  1.5140 +    AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
  1.5141 +    AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
  1.5142 +fi
  1.5143 +
  1.5144 +dnl ========================================================
  1.5145 +dnl = Disable Speech API code
  1.5146 +dnl ========================================================
  1.5147 +MOZ_ARG_DISABLE_BOOL(webspeech,
  1.5148 +[  --disable-webspeech        Disable support for HTML Speech API],
  1.5149 +    MOZ_WEBSPEECH=,
  1.5150 +    MOZ_WEBSPEECH=1)
  1.5151 +
  1.5152 +if test -n "$MOZ_WEBSPEECH"; then
  1.5153 +    AC_DEFINE(MOZ_WEBSPEECH)
  1.5154 +fi
  1.5155 +
  1.5156 +AC_SUBST(MOZ_WEBSPEECH)
  1.5157 +
  1.5158 +dnl ========================================================
  1.5159 +dnl = Enable Raw Codecs
  1.5160 +dnl ========================================================
  1.5161 +MOZ_ARG_ENABLE_BOOL(raw,
  1.5162 +[  --enable-raw           Enable support for RAW media],
  1.5163 +    MOZ_RAW=1,
  1.5164 +    MOZ_RAW=)
  1.5165 +
  1.5166 +if test -n "$MOZ_RAW"; then
  1.5167 +    AC_DEFINE(MOZ_RAW)
  1.5168 +fi
  1.5169 +
  1.5170 +AC_SUBST(MOZ_RAW)
  1.5171 +
  1.5172 +dnl Checks for __attribute__(aligned()) directive need by libogg
  1.5173 +AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
  1.5174 +    [ac_cv_c_attribute_aligned],
  1.5175 +    [ac_cv_c_attribute_aligned=0
  1.5176 +     CFLAGS_save="${CFLAGS}"
  1.5177 +     CFLAGS="${CFLAGS} -Werror"
  1.5178 +     for ac_cv_c_attr_align_try in 64 32 16 8; do
  1.5179 +       echo "trying $ac_cv_c_attr_align_try"
  1.5180 +       AC_TRY_COMPILE([],
  1.5181 +                      [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
  1.5182 +                      [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
  1.5183 +       if test "$ac_cv_c_attribute_aligned" != 0; then
  1.5184 +         break;
  1.5185 +       fi
  1.5186 +     done
  1.5187 +       CFLAGS="${CFLAGS_save}"])
  1.5188 +if test "${ac_cv_c_attribute_aligned}" != "0"; then
  1.5189 +  AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
  1.5190 +                     [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
  1.5191 +fi
  1.5192 +
  1.5193 +dnl ========================================================
  1.5194 +dnl = Disable Opus audio codec support
  1.5195 +dnl ========================================================
  1.5196 +MOZ_ARG_DISABLE_BOOL(opus,
  1.5197 +[  --disable-opus          Disable support for Opus audio],
  1.5198 +    MOZ_OPUS=,
  1.5199 +    MOZ_OPUS=1)
  1.5200 +
  1.5201 +dnl ========================================================
  1.5202 +dnl = Disable VP8 decoder support
  1.5203 +dnl ========================================================
  1.5204 +MOZ_ARG_DISABLE_BOOL(webm,
  1.5205 +[  --disable-webm          Disable support for WebM media (VP8 video and Vorbis audio)],
  1.5206 +    MOZ_WEBM=,
  1.5207 +    MOZ_WEBM=1)
  1.5208 +
  1.5209 +if test -n "$MOZ_WEBM"; then
  1.5210 +    AC_DEFINE(MOZ_WEBM)
  1.5211 +    MOZ_VPX=1
  1.5212 +fi;
  1.5213 +
  1.5214 +dnl ========================================================
  1.5215 +dnl = DirectShow support
  1.5216 +dnl ========================================================
  1.5217 +if test "$OS_ARCH" = "WINNT"; then
  1.5218 +    dnl Enable DirectShow support by default.
  1.5219 +    MOZ_DIRECTSHOW=1
  1.5220 +fi
  1.5221 +
  1.5222 +MOZ_ARG_DISABLE_BOOL(directshow,
  1.5223 +[  --disable-directshow  Disable support for DirectShow],
  1.5224 +    MOZ_DIRECTSHOW=,
  1.5225 +    MOZ_DIRECTSHOW=1)
  1.5226 +
  1.5227 +if test -n "$MOZ_DIRECTSHOW"; then
  1.5228 +    AC_DEFINE(MOZ_DIRECTSHOW)
  1.5229 +fi;
  1.5230 +
  1.5231 +dnl ========================================================
  1.5232 +dnl = Windows Media Foundation support
  1.5233 +dnl ========================================================
  1.5234 +if test "$OS_ARCH" = "WINNT"; then
  1.5235 +    dnl Enable Windows Media Foundation support by default.
  1.5236 +    dnl Note our minimum SDK version is Windows 7 SDK, so we are (currently)
  1.5237 +    dnl guaranteed to have a recent-enough SDK to build WMF.
  1.5238 +    MOZ_WMF=1
  1.5239 +fi
  1.5240 +
  1.5241 +MOZ_ARG_DISABLE_BOOL(wmf,
  1.5242 +[  --disable-wmf  Disable support for Windows Media Foundation],
  1.5243 +    MOZ_WMF=,
  1.5244 +    MOZ_WMF=1)
  1.5245 +
  1.5246 +if test -n "$MOZ_WMF"; then
  1.5247 +    AC_DEFINE(MOZ_WMF)
  1.5248 +fi;
  1.5249 +
  1.5250 +dnl ========================================================
  1.5251 +dnl FFmpeg H264/AAC Decoding Support
  1.5252 +dnl ========================================================
  1.5253 +case "$OS_TARGET" in
  1.5254 +WINNT|Darwin|Android)
  1.5255 +    ;;
  1.5256 +*)
  1.5257 +    MOZ_FFMPEG=1
  1.5258 +    ;;
  1.5259 +esac
  1.5260 +
  1.5261 +MOZ_ARG_DISABLE_BOOL(ffmpeg,
  1.5262 +[  --disable-ffmpeg         Disable FFmpeg for fragmented H264/AAC decoding],
  1.5263 +    MOZ_FFMPEG=,
  1.5264 +    MOZ_FFMPEG=1
  1.5265 +)
  1.5266 +
  1.5267 +if test -n "$MOZ_FFMPEG"; then
  1.5268 +    AC_DEFINE(MOZ_FFMPEG)
  1.5269 +fi;
  1.5270 +
  1.5271 +dnl ========================================================
  1.5272 +dnl = Built-in fragmented MP4 support.
  1.5273 +dnl ========================================================
  1.5274 +if test -n "$MOZ_WMF" -o -n "$MOZ_FFMPEG"; then
  1.5275 +    dnl Enable fragmented MP4 parser on Windows by default.
  1.5276 +    dnl We will also need to enable it on other platforms as we implement
  1.5277 +    dnl platform decoder support there too.
  1.5278 +    MOZ_FMP4=1
  1.5279 +fi
  1.5280 +
  1.5281 +MOZ_ARG_DISABLE_BOOL(fmp4,
  1.5282 +[  --disable-fmp4  Disable support for in built Fragmented MP4 parsing],
  1.5283 +    MOZ_FMP4=,
  1.5284 +    MOZ_FMP4=1)
  1.5285 +
  1.5286 +if test -n "$MOZ_FMP4"; then
  1.5287 +    AC_DEFINE(MOZ_FMP4)
  1.5288 +fi;
  1.5289 +
  1.5290 +
  1.5291 +dnl ========================================================
  1.5292 +dnl = Enable media plugin support
  1.5293 +dnl ========================================================
  1.5294 +if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
  1.5295 +  dnl Enable support on android by default
  1.5296 +  MOZ_MEDIA_PLUGINS=1
  1.5297 +fi
  1.5298 +
  1.5299 +MOZ_ARG_ENABLE_BOOL(media-plugins,
  1.5300 +[  --enable-media-plugins  Enable support for media plugins],
  1.5301 +    MOZ_MEDIA_PLUGINS=1,
  1.5302 +    MOZ_MEDIA_PLUGINS=)
  1.5303 +
  1.5304 +if test -n "$MOZ_MEDIA_PLUGINS"; then
  1.5305 +  AC_DEFINE(MOZ_MEDIA_PLUGINS)
  1.5306 +fi
  1.5307 +
  1.5308 +dnl ========================================================
  1.5309 +dnl = Disable platform MP3 decoder on OSX
  1.5310 +dnl ========================================================
  1.5311 +if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
  1.5312 +  MOZ_APPLEMEDIA=1
  1.5313 +fi
  1.5314 +
  1.5315 +MOZ_ARG_DISABLE_BOOL(apple-media,
  1.5316 +[  --disable-apple-media  Disable support for Apple AudioToolbox/VideoToolbox],
  1.5317 +    MOZ_APPLEMEDIA=,
  1.5318 +    MOZ_APPLEMEDIA=1)
  1.5319 +
  1.5320 +if test -n "$MOZ_APPLEMEDIA"; then
  1.5321 +  AC_DEFINE(MOZ_APPLEMEDIA)
  1.5322 +fi
  1.5323 +
  1.5324 +dnl ========================================================
  1.5325 +dnl = Enable getUserMedia support
  1.5326 +dnl ========================================================
  1.5327 +MOZ_ARG_ENABLE_BOOL(media-navigator,
  1.5328 +[  --enable-media-navigator  Enable support for getUserMedia],
  1.5329 +    MOZ_MEDIA_NAVIGATOR=1,
  1.5330 +    MOZ_MEDIA_NAVIGATOR=)
  1.5331 +
  1.5332 +if test -n "$MOZ_MEDIA_NAVIGATOR"; then
  1.5333 +  AC_DEFINE(MOZ_MEDIA_NAVIGATOR)
  1.5334 +fi
  1.5335 +
  1.5336 +dnl ========================================================
  1.5337 +dnl = Enable building OMX media plugin (B2G or Android)
  1.5338 +dnl ========================================================
  1.5339 +if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
  1.5340 +  dnl Enable support on android by default
  1.5341 +  MOZ_OMX_PLUGIN=1
  1.5342 +fi
  1.5343 +
  1.5344 +MOZ_ARG_ENABLE_BOOL(omx-plugin,
  1.5345 +[  --enable-omx-plugin      Enable building OMX plugin (B2G)],
  1.5346 +    MOZ_OMX_PLUGIN=1,
  1.5347 +    MOZ_OMX_PLUGIN=)
  1.5348 +
  1.5349 +if test -n "$MOZ_OMX_PLUGIN"; then
  1.5350 +    if test "$OS_TARGET" = "Android"; then
  1.5351 +        dnl Only allow building OMX plugin on Gonk (B2G) or Android
  1.5352 +        AC_DEFINE(MOZ_OMX_PLUGIN)
  1.5353 +    else
  1.5354 +       dnl fail if we're not building on Gonk or Android
  1.5355 +       AC_MSG_ERROR([OMX media plugin can only be built on B2G or Android])
  1.5356 +    fi
  1.5357 +fi
  1.5358 +
  1.5359 +dnl system libvpx Support
  1.5360 +dnl ========================================================
  1.5361 +MOZ_ARG_WITH_BOOL(system-libvpx,
  1.5362 +[  --with-system-libvpx    Use system libvpx (located with pkgconfig)],
  1.5363 +    MOZ_NATIVE_LIBVPX=1)
  1.5364 +
  1.5365 +MOZ_LIBVPX_CFLAGS=
  1.5366 +MOZ_LIBVPX_LIBS=
  1.5367 +
  1.5368 +if test -n "$MOZ_VPX"; then
  1.5369 +    AC_DEFINE(MOZ_VPX)
  1.5370 +    if test -n "$MOZ_VPX_ERROR_CONCEALMENT" ; then
  1.5371 +        AC_DEFINE(MOZ_VPX_ERROR_CONCEALMENT)
  1.5372 +    fi
  1.5373 +
  1.5374 +    _SAVE_CFLAGS=$CFLAGS
  1.5375 +    _SAVE_LIBS=$LIBS
  1.5376 +    if test -n "$MOZ_NATIVE_LIBVPX"; then
  1.5377 +        dnl ============================
  1.5378 +        dnl === libvpx Version check ===
  1.5379 +        dnl ============================
  1.5380 +        dnl Check to see if we have a system libvpx package.
  1.5381 +        PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.3.0)
  1.5382 +
  1.5383 +        CFLAGS="$CFLAGS $MOZ_LIBVPX_CFLAGS"
  1.5384 +        LIBS="$LIBS $MOZ_LIBVPX_LIBS"
  1.5385 +
  1.5386 +        MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
  1.5387 +         [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.])])
  1.5388 +
  1.5389 +        AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
  1.5390 +         [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
  1.5391 +
  1.5392 +        MOZ_CHECK_HEADER([vpx_mem/vpx_mem.h],
  1.5393 +         [AC_CHECK_FUNC(vpx_mem_set_functions)])
  1.5394 +        if test "$ac_cv_header_vpx_mem_vpx_mem_h" = no -o \
  1.5395 +                "$ac_cv_func_vpx_mem_set_functions" = no; then
  1.5396 +            AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
  1.5397 +        fi
  1.5398 +    fi
  1.5399 +    CFLAGS=$_SAVE_CFLAGS
  1.5400 +    LIBS=$_SAVE_LIBS
  1.5401 +fi
  1.5402 +
  1.5403 +AC_SUBST(MOZ_NATIVE_LIBVPX)
  1.5404 +AC_SUBST(MOZ_LIBVPX_CFLAGS)
  1.5405 +AC_SUBST(MOZ_LIBVPX_LIBS)
  1.5406 +
  1.5407 +if test "$MOZ_WEBM"; then
  1.5408 +    if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
  1.5409 +        MOZ_VORBIS=1
  1.5410 +    else
  1.5411 +        MOZ_TREMOR=1
  1.5412 +    fi
  1.5413 +fi
  1.5414 +
  1.5415 +if test -n "$MOZ_VPX" -a -z "$MOZ_NATIVE_LIBVPX"; then
  1.5416 +
  1.5417 +    dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
  1.5418 +    dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
  1.5419 +    dnl We currently require gcc on all arm platforms.
  1.5420 +    VPX_AS=$YASM
  1.5421 +    VPX_ASM_SUFFIX=asm
  1.5422 +    VPX_NEED_OBJ_INT_EXTRACT=
  1.5423 +
  1.5424 +    dnl See if we have assembly on this platform.
  1.5425 +    case "$OS_ARCH:$CPU_ARCH" in
  1.5426 +    Darwin:x86)
  1.5427 +      VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
  1.5428 +      VPX_X86_ASM=1
  1.5429 +    ;;
  1.5430 +    Darwin:x86_64)
  1.5431 +      VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
  1.5432 +      VPX_X86_ASM=1
  1.5433 +    ;;
  1.5434 +    WINNT:x86_64)
  1.5435 +      VPX_ASFLAGS="-f x64 -rnasm -pnasm"
  1.5436 +      VPX_X86_ASM=1
  1.5437 +    ;;
  1.5438 +    WINNT:x86)
  1.5439 +      dnl Check for yasm 1.1 or greater.
  1.5440 +      if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
  1.5441 +        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.])
  1.5442 +      elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
  1.5443 +        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.])
  1.5444 +      else
  1.5445 +        VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
  1.5446 +        VPX_X86_ASM=1
  1.5447 +        dnl The encoder needs obj_int_extract to get asm offsets.
  1.5448 +      fi
  1.5449 +    ;;
  1.5450 +    *:arm*)
  1.5451 +      if test -n "$GNU_AS" ; then
  1.5452 +        VPX_AS=$AS
  1.5453 +        dnl These flags are a lie; they're just used to enable the requisite
  1.5454 +        dnl opcodes; actual arch detection is done at runtime.
  1.5455 +        VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
  1.5456 +        VPX_DASH_C_FLAG="-c"
  1.5457 +        VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
  1.5458 +        VPX_ASM_SUFFIX="$ASM_SUFFIX"
  1.5459 +        VPX_ARM_ASM=1
  1.5460 +      fi
  1.5461 +    ;;
  1.5462 +    *:x86)
  1.5463 +      if $CC -E -dM -</dev/null | grep -q __ELF__; then
  1.5464 +        VPX_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC"
  1.5465 +        VPX_X86_ASM=1
  1.5466 +      fi
  1.5467 +    ;;
  1.5468 +    *:x86_64)
  1.5469 +      if $CC -E -dM -</dev/null | grep -q __ELF__; then
  1.5470 +        VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
  1.5471 +        VPX_X86_ASM=1
  1.5472 +      fi
  1.5473 +    ;;
  1.5474 +    esac
  1.5475 +
  1.5476 +    if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
  1.5477 +      AC_MSG_ERROR([yasm is a required build tool for this architecture when webm is enabled. You may either install yasm or --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
  1.5478 +    fi
  1.5479 +
  1.5480 +    if test -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
  1.5481 +      dnl We prefer to get asm offsets using inline assembler, which the above
  1.5482 +      dnl compilers can do. When we're not using one of those, we have to fall
  1.5483 +      dnl back to obj_int_extract, which reads them from a compiled object
  1.5484 +      dnl file. Unfortunately, that only works if we're compiling on a system
  1.5485 +      dnl with the header files for the appropriate object file format.
  1.5486 +      VPX_NEED_OBJ_INT_EXTRACT=1
  1.5487 +    fi
  1.5488 +
  1.5489 +    if test -n "$VPX_X86_ASM"; then
  1.5490 +      AC_DEFINE(VPX_X86_ASM)
  1.5491 +    elif test -n "$VPX_ARM_ASM"; then
  1.5492 +      AC_DEFINE(VPX_ARM_ASM)
  1.5493 +    else
  1.5494 +      AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
  1.5495 +    fi
  1.5496 +fi
  1.5497 +
  1.5498 +dnl ========================================================
  1.5499 +dnl = Disable Wave decoder support
  1.5500 +dnl ========================================================
  1.5501 +MOZ_ARG_DISABLE_BOOL(wave,
  1.5502 +[  --disable-wave          Disable Wave decoder support],
  1.5503 +    MOZ_WAVE=,
  1.5504 +    MOZ_WAVE=1)
  1.5505 +
  1.5506 +if test -n "$MOZ_WAVE"; then
  1.5507 +    AC_DEFINE(MOZ_WAVE)
  1.5508 +fi
  1.5509 +
  1.5510 +dnl ========================================================
  1.5511 +dnl = Handle dependent MEDIA defines
  1.5512 +dnl ========================================================
  1.5513 +
  1.5514 +if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
  1.5515 +    AC_MSG_ERROR([MOZ_VORBIS and MOZ_TREMOR are mutually exclusive!  The build system should not allow them both to be set, but they are.  Please file a bug at https://bugzilla.mozilla.org/])
  1.5516 +fi
  1.5517 +
  1.5518 +if test -n "$MOZ_WEBRTC" -a -z "$MOZ_OPUS"; then
  1.5519 +    AC_MSG_ERROR([MOZ_WEBRTC requires MOZ_OPUS which is disabled.])
  1.5520 +fi
  1.5521 +
  1.5522 +if test -n "$MOZ_VORBIS"; then
  1.5523 +    AC_DEFINE(MOZ_VORBIS)
  1.5524 +fi
  1.5525 +
  1.5526 +if test -n "$MOZ_TREMOR"; then
  1.5527 +    AC_DEFINE(MOZ_TREMOR)
  1.5528 +    # Tremor doesn't have an encoder.
  1.5529 +    MOZ_WEBM_ENCODER=
  1.5530 +fi
  1.5531 +
  1.5532 +if test -n "$MOZ_OPUS"; then
  1.5533 +    AC_DEFINE(MOZ_OPUS)
  1.5534 +fi
  1.5535 +
  1.5536 +if test -n "$MOZ_WEBM_ENCODER"; then
  1.5537 +    AC_DEFINE(MOZ_WEBM_ENCODER)
  1.5538 +fi
  1.5539 +AC_SUBST(MOZ_WEBM_ENCODER)
  1.5540 +
  1.5541 +dnl ==================================
  1.5542 +dnl = Check alsa availability on Linux
  1.5543 +dnl ==================================
  1.5544 +
  1.5545 +dnl If using Linux, ensure that the alsa library is available
  1.5546 +if test "$OS_TARGET" = "Linux"; then
  1.5547 +    MOZ_ALSA=1
  1.5548 +fi
  1.5549 +
  1.5550 +MOZ_ARG_ENABLE_BOOL(alsa,
  1.5551 +[  --enable-alsa          Enable Alsa support (default on Linux)],
  1.5552 +   MOZ_ALSA=1,
  1.5553 +   MOZ_ALSA=)
  1.5554 +
  1.5555 +if test -n "$MOZ_ALSA"; then
  1.5556 +    PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
  1.5557 +         [echo "$MOZ_ALSA_PKG_ERRORS"
  1.5558 +          AC_MSG_ERROR([Need alsa for Ogg, Wave or WebM decoding on Linux.  Disable with --disable-ogg --disable-wave --disable-webm.  (On Ubuntu, you might try installing the package libasound2-dev.)])])
  1.5559 +fi
  1.5560 +
  1.5561 +AC_SUBST(MOZ_ALSA)
  1.5562 +AC_SUBST(MOZ_ALSA_CFLAGS)
  1.5563 +AC_SUBST(MOZ_ALSA_LIBS)
  1.5564 +
  1.5565 +dnl ========================================================
  1.5566 +dnl = Disable PulseAudio
  1.5567 +dnl ========================================================
  1.5568 +
  1.5569 +dnl If using Linux, ensure that the PA library is available
  1.5570 +case "$OS_TARGET" in
  1.5571 +WINNT|Darwin|Android|OpenBSD)
  1.5572 +    ;;
  1.5573 +*)
  1.5574 +    if test -z "$MOZ_B2G"; then
  1.5575 +        MOZ_PULSEAUDIO=1
  1.5576 +    fi
  1.5577 +    ;;
  1.5578 +esac
  1.5579 +
  1.5580 +MOZ_ARG_DISABLE_BOOL(pulseaudio,
  1.5581 +[  --disable-pulseaudio          Disable PulseAudio support],
  1.5582 +   MOZ_PULSEAUDIO=,
  1.5583 +   MOZ_PULSEAUDIO=1)
  1.5584 +
  1.5585 +if test -n "$MOZ_PULSEAUDIO"; then
  1.5586 +    if test -z "$gonkdir"; then
  1.5587 +        PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
  1.5588 +             [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
  1.5589 +              AC_MSG_ERROR([pulseaudio audio backend requires libpulse development package])])
  1.5590 +    else
  1.5591 +        MOZ_PULSEAUDIO_CFLAGS="-I$gonkdir/external/pulseaudio/pulseaudio/src"
  1.5592 +    fi
  1.5593 +fi
  1.5594 +
  1.5595 +AC_SUBST(MOZ_PULSEAUDIO)
  1.5596 +AC_SUBST(MOZ_PULSEAUDIO_CFLAGS)
  1.5597 +
  1.5598 +dnl ========================================================
  1.5599 +dnl = Enable GStreamer
  1.5600 +dnl ========================================================
  1.5601 +case "$OS_TARGET" in
  1.5602 +WINNT|Darwin|Android)
  1.5603 +    ;;
  1.5604 +*)
  1.5605 +    MOZ_GSTREAMER=1
  1.5606 +    GST_API_VERSION=0.10
  1.5607 +    ;;
  1.5608 +esac
  1.5609 +
  1.5610 +MOZ_ARG_ENABLE_STRING(gstreamer,
  1.5611 +[  --enable-gstreamer[=0.10]           Enable GStreamer support],
  1.5612 +[ MOZ_GSTREAMER=1
  1.5613 +  # API version, eg 0.10, 1.0 etc
  1.5614 +  if test -z "$enableval" -o "$enableval" = "yes"; then
  1.5615 +    GST_API_VERSION=0.10
  1.5616 +  elif test "$enableval" = "no"; then
  1.5617 +    MOZ_GSTREAMER=
  1.5618 +  else
  1.5619 +    GST_API_VERSION=$enableval
  1.5620 +  fi],
  1.5621 +)
  1.5622 +
  1.5623 +if test -n "$MOZ_GSTREAMER"; then
  1.5624 +    # core/base release number
  1.5625 +    if test "$GST_API_VERSION" = "1.0"; then
  1.5626 +      GST_VERSION=1.0
  1.5627 +    else
  1.5628 +      GST_VERSION=0.10.25
  1.5629 +    fi
  1.5630 +
  1.5631 +    PKG_CHECK_MODULES(GSTREAMER,
  1.5632 +                      gstreamer-$GST_API_VERSION >= $GST_VERSION
  1.5633 +                      gstreamer-app-$GST_API_VERSION
  1.5634 +                      gstreamer-plugins-base-$GST_API_VERSION,
  1.5635 +                      [_HAVE_GSTREAMER=1],
  1.5636 +                      [_HAVE_GSTREAMER=])
  1.5637 +    if test -z "$_HAVE_GSTREAMER"; then
  1.5638 +        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])
  1.5639 +    fi
  1.5640 +
  1.5641 +    _SAVE_LDFLAGS=$LDFLAGS
  1.5642 +    LDFLAGS="$LDFLAGS $GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
  1.5643 +    AC_TRY_LINK(,[return 0;],_HAVE_LIBGSTVIDEO=1,_HAVE_LIBGSTVIDEO=)
  1.5644 +    if test -n "$_HAVE_LIBGSTVIDEO" ; then
  1.5645 +        GSTREAMER_LIBS="$GSTREAMER_LIBS -lgstvideo-$GST_API_VERSION"
  1.5646 +    else
  1.5647 +        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.])
  1.5648 +    fi
  1.5649 +    LDFLAGS=$_SAVE_LDFLAGS
  1.5650 +
  1.5651 +    AC_SUBST(GSTREAMER_CFLAGS)
  1.5652 +    AC_SUBST(GSTREAMER_LIBS)
  1.5653 +fi
  1.5654 +
  1.5655 +AC_SUBST(MOZ_GSTREAMER)
  1.5656 +AC_SUBST(GST_API_VERSION)
  1.5657 +
  1.5658 +if test -n "$MOZ_GSTREAMER"; then
  1.5659 +     AC_DEFINE(MOZ_GSTREAMER)
  1.5660 +     AC_DEFINE_UNQUOTED(GST_API_VERSION, "$GST_API_VERSION")
  1.5661 +fi
  1.5662 +
  1.5663 +
  1.5664 +dnl ========================================================
  1.5665 +dnl Permissions System
  1.5666 +dnl ========================================================
  1.5667 +MOZ_ARG_DISABLE_BOOL(permissions,
  1.5668 +[  --disable-permissions   Disable permissions (popup and cookie blocking)],
  1.5669 +    MOZ_PERMISSIONS=,
  1.5670 +    MOZ_PERMISSIONS=1
  1.5671 +)
  1.5672 +
  1.5673 +dnl ========================================================
  1.5674 +dnl Child permissions, currently only used for b2g
  1.5675 +dnl ========================================================
  1.5676 +if test -n "$MOZ_B2G"; then
  1.5677 +    if test -n "$MOZ_PERMISSIONS"; then
  1.5678 +        MOZ_CHILD_PERMISSIONS=1
  1.5679 +    else
  1.5680 +        AC_MSG_ERROR([You need to enable MOZ_PERMISSIONS for MOZ_CHILD_PERMISSIONS])
  1.5681 +    fi
  1.5682 +fi
  1.5683 +AC_SUBST(MOZ_CHILD_PERMISSIONS)
  1.5684 +
  1.5685 +dnl ========================================================
  1.5686 +dnl NegotiateAuth
  1.5687 +dnl ========================================================
  1.5688 +MOZ_ARG_DISABLE_BOOL(negotiateauth,
  1.5689 +[  --disable-negotiateauth Disable GSS-API negotiation ],
  1.5690 +    MOZ_AUTH_EXTENSION=,
  1.5691 +    MOZ_AUTH_EXTENSION=1 )
  1.5692 +
  1.5693 +dnl ========================================================
  1.5694 +dnl Pref extensions (autoconfig)
  1.5695 +dnl ========================================================
  1.5696 +MOZ_ARG_DISABLE_BOOL(pref-extensions,
  1.5697 +[  --disable-pref-extensions
  1.5698 +                          Disable pref extensions such as autoconfig],
  1.5699 +  MOZ_PREF_EXTENSIONS=,
  1.5700 +  MOZ_PREF_EXTENSIONS=1 )
  1.5701 +
  1.5702 +dnl ========================================================
  1.5703 +dnl Searching of system directories for extensions.
  1.5704 +dnl Note: this switch is meant to be used for test builds
  1.5705 +dnl whose behavior should not depend on what happens to be
  1.5706 +dnl installed on the local machine.
  1.5707 +dnl ========================================================
  1.5708 +MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
  1.5709 +[  --disable-system-extension-dirs
  1.5710 +                          Disable searching system- and account-global
  1.5711 +                          directories for extensions of any kind; use
  1.5712 +                          only profile-specific extension directories],
  1.5713 +  ENABLE_SYSTEM_EXTENSION_DIRS=,
  1.5714 +  ENABLE_SYSTEM_EXTENSION_DIRS=1 )
  1.5715 +if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
  1.5716 +  AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
  1.5717 +fi
  1.5718 +
  1.5719 +dnl ========================================================
  1.5720 +dnl = Universalchardet
  1.5721 +dnl ========================================================
  1.5722 +MOZ_ARG_DISABLE_BOOL(universalchardet,
  1.5723 +[  --disable-universalchardet
  1.5724 +                          Disable universal encoding detection],
  1.5725 +  MOZ_UNIVERSALCHARDET=,
  1.5726 +  MOZ_UNIVERSALCHARDET=1 )
  1.5727 +
  1.5728 +if test -n "${JAVA_BIN_PATH}"; then
  1.5729 +  dnl Look for javac and jar in the specified path.
  1.5730 +  JAVA_PATH="$JAVA_BIN_PATH"
  1.5731 +else
  1.5732 +  dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
  1.5733 +  JAVA_PATH="$JAVA_HOME/bin:$PATH"
  1.5734 +fi
  1.5735 +
  1.5736 +MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
  1.5737 +MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
  1.5738 +MOZ_PATH_PROG(JAVAH, javah, :, [$JAVA_PATH])
  1.5739 +MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
  1.5740 +MOZ_PATH_PROG(JARSIGNER, jarsigner, :, [$JAVA_PATH])
  1.5741 +MOZ_PATH_PROG(KEYTOOL, keytool, :, [$JAVA_PATH])
  1.5742 +
  1.5743 +if test -n "${JAVA_BIN_PATH}" -o \
  1.5744 +  \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
  1.5745 +  if test -z "$JAVA" -o "$JAVA" = ":"; then
  1.5746 +    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}])
  1.5747 +  fi
  1.5748 +  if test -z "$JAVAC" -o "$JAVAC" = ":"; then
  1.5749 +    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}])
  1.5750 +  fi
  1.5751 +  if test -z "$JAVAH" -o "$JAVAH" = ":"; then
  1.5752 +    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}])
  1.5753 +  fi
  1.5754 +  if test -z "$JAR" -o "$JAR" = ":"; then
  1.5755 +    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}])
  1.5756 +  fi
  1.5757 +  if test -z "$JARSIGNER" -o "$JARSIGNER" = ":"; then
  1.5758 +    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}])
  1.5759 +  fi
  1.5760 +  if test -z "$KEYTOOL" -o "$KEYTOOL" = ":"; then
  1.5761 +    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}])
  1.5762 +  fi
  1.5763 +fi
  1.5764 +
  1.5765 +dnl ========================================================
  1.5766 +dnl = ANGLE OpenGL->D3D translator for WebGL
  1.5767 +dnl = * only applies to win32
  1.5768 +dnl = * enabled by default (shipping build); requires explicit --disable to disable
  1.5769 +dnl ========================================================
  1.5770 +MOZ_ANGLE_RENDERER=
  1.5771 +MOZ_DIRECTX_SDK_CPU_SUFFIX=
  1.5772 +MOZ_DIRECTX_SDK_PATH=
  1.5773 +MOZ_D3DCOMPILER_DLL=
  1.5774 +MOZ_HAS_WINSDK_WITH_D3D=
  1.5775 +MOZ_D3DCOMPILER_DLL_PATH=
  1.5776 +MOZ_D3DCOMPILER_CAB=
  1.5777 +case "$target_os" in
  1.5778 +*mingw*)
  1.5779 +    MOZ_ANGLE_RENDERER=1
  1.5780 +    ;;
  1.5781 +esac
  1.5782 +
  1.5783 +# The DirectX SDK libraries are split into x86 and x64 sub-directories
  1.5784 +case "${target_cpu}" in
  1.5785 +i*86)
  1.5786 +  MOZ_DIRECTX_SDK_CPU_SUFFIX=x86
  1.5787 +  ;;
  1.5788 +x86_64)
  1.5789 +  MOZ_DIRECTX_SDK_CPU_SUFFIX=x64
  1.5790 +  ;;
  1.5791 +esac
  1.5792 +
  1.5793 +MOZ_ARG_DISABLE_BOOL(webgl,
  1.5794 +[  --disable-webgl     Disable building of the WebGL implementation],
  1.5795 +    MOZ_WEBGL_DISABLED=1,
  1.5796 +    MOZ_WEBGL_DISABLED=)
  1.5797 +
  1.5798 +MOZ_ARG_ENABLE_BOOL(winsdk-directx,
  1.5799 +[  --enable-winsdk-directx use DirectX SDK in Windows SDK],
  1.5800 +    MOZ_WINSDK_DIRECTX=1,
  1.5801 +    MOZ_WINSDK_DIRECTX=)
  1.5802 +
  1.5803 +if test -n "$MOZ_WEBGL_DISABLED"; then
  1.5804 +  MOZ_WEBGL=
  1.5805 +  MOZ_ANGLE_RENDERER=
  1.5806 +fi
  1.5807 +
  1.5808 +if test -n "$MOZ_WEBGL"; then
  1.5809 +  AC_DEFINE(MOZ_WEBGL)
  1.5810 +fi
  1.5811 +
  1.5812 +if test -n "$MOZ_WEBGL_CONFORMANT"; then
  1.5813 +  AC_DEFINE(MOZ_WEBGL_CONFORMANT)
  1.5814 +fi
  1.5815 +
  1.5816 +
  1.5817 +# Locate a DirectX SDK here so we can use it for both ANGLE and
  1.5818 +# Joystick support.
  1.5819 +if test "$OS_TARGET" = "WINNT" -a -z "$CROSS_COMPILE"; then
  1.5820 +  # Get the SDK path from the registry.
  1.5821 +  # First try to get the June 2010 SDK
  1.5822 +  MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
  1.5823 +  if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
  1.5824 +    # Otherwise just take whatever comes first
  1.5825 +    MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
  1.5826 +  fi
  1.5827 +  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'`
  1.5828 +
  1.5829 +  if test -n "$MOZ_DIRECTX_SDK_PATH" &&
  1.5830 +     test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
  1.5831 +    AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
  1.5832 +  else
  1.5833 +    AC_MSG_RESULT([Couldn't find the DirectX SDK.])
  1.5834 +  fi
  1.5835 +fi
  1.5836 +
  1.5837 +# On mingw, check if headers are provided by toolchain.
  1.5838 +if test "$OS_TARGET" = "WINNT" -a -n "$GNU_CC"; then
  1.5839 +  MOZ_CHECK_HEADER(d3d10.h, MOZ_HAS_WINSDK_WITH_D3D=1)
  1.5840 +fi
  1.5841 +
  1.5842 +dnl ========================================================
  1.5843 +dnl D3D compiler DLL
  1.5844 +dnl ========================================================
  1.5845 +
  1.5846 +if test -n "$MOZ_ANGLE_RENDERER"; then
  1.5847 +  # Check that our DirectX SDK is acceptable.
  1.5848 +  if test -n "$MOZ_DIRECTX_SDK_PATH"; then
  1.5849 +    if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
  1.5850 +      AC_MSG_RESULT([Found the February 2010 DirectX SDK, which is unacceptable to ANGLE.])
  1.5851 +      MOZ_DIRECTX_SDK_PATH_BAD=1
  1.5852 +    fi
  1.5853 +
  1.5854 +    if test -n "$MOZ_DIRECTX_SDK_PATH" &&
  1.5855 +       test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h &&
  1.5856 +       test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
  1.5857 +      AC_MSG_RESULT([Found acceptable DirectX SDK for ANGLE.])
  1.5858 +    else
  1.5859 +      AC_MSG_RESULT([Found DirectX SDK is unacceptable for ANGLE.])
  1.5860 +      MOZ_DIRECTX_SDK_PATH_BAD=1
  1.5861 +    fi
  1.5862 +  fi
  1.5863 +
  1.5864 +  if test -n "$MOZ_DIRECTX_SDK_PATH_BAD"; then
  1.5865 +    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.])
  1.5866 +  fi
  1.5867 +
  1.5868 +  # Find a D3D compiler DLL in a Windows SDK.
  1.5869 +  MOZ_D3DCOMPILER_DLL=
  1.5870 +  if test -n "$MOZ_WINSDK_DIRECTX"; then
  1.5871 +    case "$MOZ_WINSDK_MAXVER" in
  1.5872 +    0x0603*)
  1.5873 +      MOZ_D3DCOMPILER_DLL=d3dcompiler_47.dll
  1.5874 +      AC_MSG_RESULT([Found D3D compiler in Windows SDK 8.1.])
  1.5875 +    ;;
  1.5876 +    0x0602*)
  1.5877 +      MOZ_D3DCOMPILER_DLL=d3dcompiler_46.dll
  1.5878 +      AC_MSG_RESULT([Found D3D compiler in Windows SDK 8.0.])
  1.5879 +    ;;
  1.5880 +    esac
  1.5881 +  fi
  1.5882 +
  1.5883 +  if test -n "$MOZ_D3DCOMPILER_DLL"; then
  1.5884 +    # We have a name, now track down the path.
  1.5885 +    if test -n "$WINDOWSSDKDIR"; then
  1.5886 +      MOZ_D3DCOMPILER_DLL_PATH="$WINDOWSSDKDIR/Redist/D3D/$MOZ_DIRECTX_SDK_CPU_SUFFIX/$MOZ_D3DCOMPILER_DLL"
  1.5887 +      if test -f "$MOZ_D3DCOMPILER_DLL_PATH"; then
  1.5888 +        MOZ_HAS_WINSDK_WITH_D3D=1
  1.5889 +        AC_MSG_RESULT([Found MOZ_D3DCOMPILER_DLL_PATH: $MOZ_D3DCOMPILER_DLL_PATH])
  1.5890 +      else
  1.5891 +        AC_MSG_RESULT([MOZ_D3DCOMPILER_DLL_PATH doesn't exist: $MOZ_D3DCOMPILER_DLL_PATH])
  1.5892 +      fi
  1.5893 +    else
  1.5894 +      AC_MSG_RESULT([WINDOWSSDKDIR is missing.])
  1.5895 +    fi
  1.5896 +  fi
  1.5897 +
  1.5898 +  # Find a D3D compiler DLL in the DirectX SDK, if we didn't find one already.
  1.5899 +  # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
  1.5900 +  if test -z "$MOZ_HAS_WINSDK_WITH_D3D"; then
  1.5901 +    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'`
  1.5902 +
  1.5903 +    if test -n "$MOZ_D3DX9_VERSION" ; then
  1.5904 +      MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
  1.5905 +      MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
  1.5906 +    else
  1.5907 +      AC_MSG_RESULT([Couldn't determine the D3DX9 version for the DirectX SDK.])
  1.5908 +    fi
  1.5909 +
  1.5910 +    if test -z "$MOZ_D3DCOMPILER_CAB"; then
  1.5911 +      AC_MSG_RESULT([Couldn't find a CAB containing the D3D compiler DLL.])
  1.5912 +    fi
  1.5913 +  fi
  1.5914 +
  1.5915 +  if test -z "$MOZ_D3DCOMPILER_DLL_PATH" -a -z "$MOZ_D3DCOMPILER_CAB" -a -z "$CROSS_COMPILE"; then
  1.5916 +    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.])
  1.5917 +  fi
  1.5918 +fi
  1.5919 +
  1.5920 +
  1.5921 +dnl ========================================================
  1.5922 +dnl Gamepad support
  1.5923 +dnl ========================================================
  1.5924 +MOZ_GAMEPAD=
  1.5925 +MOZ_GAMEPAD_BACKEND=stub
  1.5926 +
  1.5927 +# Gamepad DOM is built on supported platforms by default.
  1.5928 +case "$OS_TARGET" in
  1.5929 +     Darwin|WINNT|Linux)
  1.5930 +       MOZ_GAMEPAD=1
  1.5931 +       ;;
  1.5932 +     *)
  1.5933 +       ;;
  1.5934 +esac
  1.5935 +
  1.5936 +MOZ_ARG_DISABLE_BOOL(gamepad,
  1.5937 +[  --disable-gamepad   Disable gamepad support],
  1.5938 +    MOZ_GAMEPAD=,
  1.5939 +    MOZ_GAMEPAD=1)
  1.5940 +
  1.5941 +if test "$MOZ_GAMEPAD"; then
  1.5942 +    case "$OS_TARGET" in
  1.5943 +    Darwin)
  1.5944 +        MOZ_GAMEPAD_BACKEND=cocoa
  1.5945 +        ;;
  1.5946 +    WINNT)
  1.5947 +        if test -z "$MOZ_HAS_WINSDK_WITH_D3D"; then
  1.5948 +            if test -n "$MOZ_DIRECTX_SDK_PATH" ; then
  1.5949 +                if ! test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
  1.5950 +                   MOZ_GAMEPAD=
  1.5951 +                fi
  1.5952 +            elif test "$GCC" != "yes"; then
  1.5953 +                MOZ_GAMEPAD=
  1.5954 +            fi
  1.5955 +        fi
  1.5956 +        if test -z "$MOZ_GAMEPAD"; then
  1.5957 +           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.])
  1.5958 +        fi
  1.5959 +        MOZ_GAMEPAD_BACKEND=windows
  1.5960 +        ;;
  1.5961 +    Linux)
  1.5962 +        MOZ_CHECK_HEADER([linux/joystick.h])
  1.5963 +        if test "$ac_cv_header_linux_joystick_h" != "yes"; then
  1.5964 +          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.])
  1.5965 +        fi
  1.5966 +        MOZ_GAMEPAD_BACKEND=linux
  1.5967 +        ;;
  1.5968 +    *)
  1.5969 +        ;;
  1.5970 +   esac
  1.5971 +
  1.5972 +  AC_DEFINE(MOZ_GAMEPAD)
  1.5973 +fi
  1.5974 +AC_SUBST(MOZ_GAMEPAD)
  1.5975 +AC_SUBST(MOZ_GAMEPAD_BACKEND)
  1.5976 +
  1.5977 +dnl ========================================================
  1.5978 +dnl = Breakpad crash reporting (on by default on supported platforms)
  1.5979 +dnl ========================================================
  1.5980 +
  1.5981 +case $target in
  1.5982 +i?86-*-mingw*|x86_64-*-mingw*)
  1.5983 +  MOZ_CRASHREPORTER=1
  1.5984 +  ;;
  1.5985 +i?86-apple-darwin*|x86_64-apple-darwin*)
  1.5986 +  MOZ_CRASHREPORTER=1
  1.5987 +  ;;
  1.5988 +i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
  1.5989 +  if test "$MOZ_ENABLE_GTK"; then
  1.5990 +    MOZ_CRASHREPORTER=1
  1.5991 +  fi
  1.5992 +  ;;
  1.5993 +*-android*|*-linuxandroid*)
  1.5994 +  MOZ_CRASHREPORTER=1
  1.5995 +  ;;
  1.5996 +*solaris*)
  1.5997 +  MOZ_CRASHREPORTER=1
  1.5998 +  ;;
  1.5999 +esac
  1.6000 +
  1.6001 +MOZ_ARG_DISABLE_BOOL(crashreporter,
  1.6002 +[  --disable-crashreporter Disable breakpad crash reporting],
  1.6003 +    [MOZ_CRASHREPORTER=],
  1.6004 +    [MOZ_CRASHREPORTER=F # Force enable breakpad])
  1.6005 +
  1.6006 +if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT"; then
  1.6007 +  if test "$MOZ_CRASHREPORTER" = F; then
  1.6008 +    AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
  1.6009 +  fi
  1.6010 +  MOZ_CRASHREPORTER=
  1.6011 +fi
  1.6012 +
  1.6013 +if test -n "$MOZ_CRASHREPORTER"; then
  1.6014 +   AC_DEFINE(MOZ_CRASHREPORTER)
  1.6015 +
  1.6016 +  if test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS" && \
  1.6017 +    test -z "$SKIP_LIBRARY_CHECKS"; then
  1.6018 +    PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
  1.6019 +    AC_SUBST(MOZ_GTHREAD_CFLAGS)
  1.6020 +    AC_SUBST(MOZ_GTHREAD_LIBS)
  1.6021 +  fi
  1.6022 +
  1.6023 +  if test "$OS_ARCH" = "WINNT"; then
  1.6024 +    if test -z "$HAVE_64BIT_OS"; then
  1.6025 +      MOZ_CRASHREPORTER_INJECTOR=1
  1.6026 +      AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
  1.6027 +    fi
  1.6028 +  fi
  1.6029 +fi
  1.6030 +
  1.6031 +MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
  1.6032 +[  --with-crashreporter-enable-percent=NN
  1.6033 +                          Enable sending crash reports by default on NN% of users. (default=100)],
  1.6034 +[ val=`echo $withval | sed 's/[^0-9]//g'`
  1.6035 +    MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
  1.6036 +
  1.6037 +if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
  1.6038 +   MOZ_CRASHREPORTER_ENABLE_PERCENT=100
  1.6039 +fi
  1.6040 +AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
  1.6041 +
  1.6042 +dnl ========================================================
  1.6043 +dnl = libjpeg-turbo configuration
  1.6044 +dnl ========================================================
  1.6045 +MOZ_LIBJPEG_TURBO=
  1.6046 +if test -z "$MOZ_NATIVE_JPEG"; then
  1.6047 +    MOZ_LIBJPEG_TURBO=1
  1.6048 +fi
  1.6049 +
  1.6050 +MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
  1.6051 +[ --disable-libjpeg-turbo  Disable optimized jpeg decoding routines],
  1.6052 +    MOZ_LIBJPEG_TURBO=,
  1.6053 +    MOZ_LIBJPEG_TURBO=1)
  1.6054 +
  1.6055 +if test "$MOZ_NATIVE_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
  1.6056 +    AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
  1.6057 +fi
  1.6058 +
  1.6059 +dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
  1.6060 +dnl files.
  1.6061 +
  1.6062 +if test -n "$MOZ_LIBJPEG_TURBO"; then
  1.6063 +
  1.6064 +  dnl Do we support libjpeg-turbo on this platform?
  1.6065 +  case "$OS_ARCH:$OS_TEST" in
  1.6066 +  Darwin:i?86)
  1.6067 +    LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
  1.6068 +    LIBJPEG_TURBO_X86_ASM=1
  1.6069 +  ;;
  1.6070 +  Darwin:x86_64)
  1.6071 +    LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
  1.6072 +    LIBJPEG_TURBO_X64_ASM=1
  1.6073 +  ;;
  1.6074 +  WINNT:x86|WINNT:i?86)
  1.6075 +    LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
  1.6076 +    LIBJPEG_TURBO_X86_ASM=1
  1.6077 +  ;;
  1.6078 +  WINNT:x86_64)
  1.6079 +    LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
  1.6080 +    LIBJPEG_TURBO_X64_ASM=1
  1.6081 +  ;;
  1.6082 +  *:arm*)
  1.6083 +    LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
  1.6084 +    LIBJPEG_TURBO_ARM_ASM=1
  1.6085 +  ;;
  1.6086 +  *:x86|*:i?86)
  1.6087 +    if $CC -E -dM -</dev/null | grep -q __ELF__; then
  1.6088 +      LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
  1.6089 +      LIBJPEG_TURBO_X86_ASM=1
  1.6090 +    fi
  1.6091 +  ;;
  1.6092 +  *:x86_64)
  1.6093 +    if $CC -E -dM -</dev/null | grep -q __ELF__; then
  1.6094 +      LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
  1.6095 +      LIBJPEG_TURBO_X64_ASM=1
  1.6096 +    fi
  1.6097 +  ;;
  1.6098 +  esac
  1.6099 +
  1.6100 +fi
  1.6101 +
  1.6102 +dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
  1.6103 +dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
  1.6104 +dnl it doesn't exist or we have too old of a version.
  1.6105 +if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
  1.6106 +    LIBJPEG_TURBO_AS=$YASM
  1.6107 +
  1.6108 +    if test -z "$LIBJPEG_TURBO_AS" ; then
  1.6109 +        AC_MSG_ERROR([Yasm is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you do not appear to have Yasm installed.  Either install it or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder.  See https://developer.mozilla.org/en/YASM for more details.])
  1.6110 +    fi
  1.6111 +
  1.6112 +    dnl Check that we have the right yasm version.  We require 1.0.1 or newer
  1.6113 +    dnl on Linux and 1.1 or newer everywhere else.
  1.6114 +    if test "$OS_ARCH" = "Linux" ; then
  1.6115 +        if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -eq "0" -a "$_YASM_RELEASE" -lt "1" \) ; then
  1.6116 +            AC_MSG_ERROR([Yasm 1.0.1 or greater is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION.$_YASM_RELEASE.  Upgrade to the newest version or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder.  See https://developer.mozilla.org/en/YASM for more details.])
  1.6117 +        fi
  1.6118 +    else
  1.6119 +        if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
  1.6120 +            AC_MSG_ERROR([Yasm 1.1 or greater is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION.  Upgrade to the newest version or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder.  See https://developer.mozilla.org/en/YASM for more details.])
  1.6121 +        fi
  1.6122 +    fi
  1.6123 +fi
  1.6124 +
  1.6125 +dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
  1.6126 +dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
  1.6127 +if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
  1.6128 +    echo "Using $AS as the assembler for ARM code."
  1.6129 +    LIBJPEG_TURBO_AS=$AS
  1.6130 +fi
  1.6131 +
  1.6132 +if test -n "$LIBJPEG_TURBO_X86_ASM"; then
  1.6133 +    AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
  1.6134 +elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
  1.6135 +    AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
  1.6136 +elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
  1.6137 +    AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
  1.6138 +elif test -n "$MOZ_LIBJPEG_TURBO"; then
  1.6139 +    dnl Warn if we're not building the optimized routines, even though the user
  1.6140 +    dnl didn't specify --disable-libjpeg-turbo.
  1.6141 +    AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo.  Using unoptimized C routines.])
  1.6142 +fi
  1.6143 +
  1.6144 +dnl ========================================================
  1.6145 +dnl = Enable compilation of specific extension modules
  1.6146 +dnl ========================================================
  1.6147 +
  1.6148 +MOZ_ARG_ENABLE_STRING(extensions,
  1.6149 +[  --enable-extensions     Enable extensions],
  1.6150 +[ for option in `echo $enableval | sed 's/,/ /g'`; do
  1.6151 +    if test "$option" = "yes" -o "$option" = "all"; then
  1.6152 +        AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
  1.6153 +    elif test "$option" = "no" -o "$option" = "none"; then
  1.6154 +        MOZ_EXTENSIONS=""
  1.6155 +    elif test "$option" = "default"; then
  1.6156 +        MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
  1.6157 +    elif test `echo "$option" | grep -c \^-` != 0; then
  1.6158 +        option=`echo $option | sed 's/^-//'`
  1.6159 +        MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
  1.6160 +    else
  1.6161 +        MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
  1.6162 +    fi
  1.6163 +done],
  1.6164 +    MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
  1.6165 +
  1.6166 +if test -z "$MOZ_ENABLE_GNOMEVFS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
  1.6167 +    # Suppress warning on non-X11 platforms
  1.6168 +    if test -n "$MOZ_X11"; then
  1.6169 +        AC_MSG_WARN([Removing gnomevfs from MOZ_EXTENSIONS due to no --enable-gnomevfs.])
  1.6170 +    fi
  1.6171 +    MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
  1.6172 +fi
  1.6173 +
  1.6174 +dnl Do not build gnomevfs with libxul based apps
  1.6175 +if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
  1.6176 +    MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
  1.6177 +fi
  1.6178 +
  1.6179 +if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
  1.6180 +    # Suppress warning on non-X11 platforms
  1.6181 +    if test -n "$MOZ_X11"; then
  1.6182 +        AC_MSG_WARN([Removing gio from MOZ_EXTENSIONS due to --disable-gio.])
  1.6183 +    fi
  1.6184 +    MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
  1.6185 +fi
  1.6186 +
  1.6187 +dnl Do not build gio with libxul based apps
  1.6188 +if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
  1.6189 +    MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
  1.6190 +fi
  1.6191 +
  1.6192 +if test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
  1.6193 +    MOZ_GIO_COMPONENT=1
  1.6194 +    MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
  1.6195 +fi
  1.6196 +AC_SUBST(MOZ_GIO_COMPONENT)
  1.6197 +
  1.6198 +if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
  1.6199 +    AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
  1.6200 +    MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
  1.6201 +fi
  1.6202 +
  1.6203 +dnl Remove dupes
  1.6204 +MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
  1.6205 +
  1.6206 +dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
  1.6207 +dnl when trying to build a nonexistent extension.
  1.6208 +for extension in $MOZ_EXTENSIONS; do
  1.6209 +    if test ! -d "${srcdir}/extensions/${extension}"; then
  1.6210 +        AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
  1.6211 +    fi
  1.6212 +done
  1.6213 +
  1.6214 +if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
  1.6215 +  AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
  1.6216 +fi
  1.6217 +
  1.6218 +dnl ========================================================
  1.6219 +dnl Build Freetype in the tree
  1.6220 +dnl ========================================================
  1.6221 +MOZ_ARG_ENABLE_BOOL(tree-freetype,
  1.6222 +[  --enable-tree-freetype  Enable Tree FreeType],
  1.6223 +    MOZ_TREE_FREETYPE=1,
  1.6224 +    MOZ_TREE_FREETYPE= )
  1.6225 +if test -n "$MOZ_TREE_FREETYPE"; then
  1.6226 +   if test -n "$_WIN32_MSVC"; then
  1.6227 +      AC_ERROR("building with in-tree freetype is not supported on MSVC")
  1.6228 +   fi
  1.6229 +   AC_DEFINE(MOZ_TREE_FREETYPE)
  1.6230 +   AC_SUBST(MOZ_TREE_FREETYPE)
  1.6231 +   MOZ_ENABLE_CAIRO_FT=1
  1.6232 +   FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
  1.6233 +   FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
  1.6234 +   CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
  1.6235 +   FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
  1.6236 +   CAIRO_FT_OSLIBS=''
  1.6237 +   AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
  1.6238 +   AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
  1.6239 +   AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
  1.6240 +   AC_SUBST(CAIRO_FT_CFLAGS)
  1.6241 +fi
  1.6242 +
  1.6243 +dnl ========================================================
  1.6244 +dnl Installer
  1.6245 +dnl ========================================================
  1.6246 +dnl Abort Windows build if the required major version and
  1.6247 +dnl minimum minor version of Unicode NSIS isn't in the path
  1.6248 +dnl (unless in case of cross compiling, for which Unicode
  1.6249 +dnl is not yet sufficient).
  1.6250 +if test "$OS_ARCH" = "WINNT"; then
  1.6251 +    MIN_NSIS_MAJOR_VER=2
  1.6252 +    MIN_NSIS_MINOR_VER=46
  1.6253 +    MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-3.0a2.exe makensisu-2.46.exe makensis)
  1.6254 +    if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
  1.6255 +      AC_MSG_RESULT([yes])
  1.6256 +      MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null`
  1.6257 +      changequote(,)
  1.6258 +      MAKENSISU_PARSED_VER=`echo "$MAKENSISU_VER" | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\).*\-Unicode$/\1/g'`
  1.6259 +      changequote([,])
  1.6260 +      if test "$MAKENSISU_PARSED_VER" = ""; then
  1.6261 +          changequote(,)
  1.6262 +          MAKENSISU_PARSED_VER=`echo "$MAKENSISU_VER" | sed -e 's/^v\([0-9]\+\.[0-9]\+\).*$/\1/g'`
  1.6263 +          changequote([,])
  1.6264 +      fi
  1.6265 +      MAKENSISU_MAJOR_VER=0
  1.6266 +      MAKENSISU_MINOR_VER=0
  1.6267 +      if test ! "$MAKENSISU_PARSED_VER" = ""; then
  1.6268 +          MAKENSISU_MAJOR_VER=`echo $MAKENSISU_PARSED_VER | $AWK -F\. '{ print $1 }'`
  1.6269 +          MAKENSISU_MINOR_VER=`echo $MAKENSISU_PARSED_VER | $AWK -F\. '{ print $2 }'`
  1.6270 +      fi
  1.6271 +      AC_MSG_CHECKING([for Unicode NSIS version $MIN_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER or greater])
  1.6272 +      if test "$MAKENSISU_MAJOR_VER" -eq $MIN_NSIS_MAJOR_VER -a \
  1.6273 +              "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER ||
  1.6274 +         test "$MAKENSISU_MAJOR_VER" -gt $MIN_NSIS_MAJOR_VER; then
  1.6275 +          AC_MSG_RESULT([yes])
  1.6276 +      else
  1.6277 +          AC_MSG_RESULT([no])
  1.6278 +          if test -z "$CROSS_COMPILE"; then
  1.6279 +            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.])
  1.6280 +          else
  1.6281 +            MAKENSISU=
  1.6282 +          fi
  1.6283 +      fi
  1.6284 +    elif test -z "$CROSS_COMPILE"; then
  1.6285 +      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.])
  1.6286 +    else
  1.6287 +      MAKENSISU=
  1.6288 +    fi
  1.6289 +fi
  1.6290 +
  1.6291 +dnl ========================================================
  1.6292 +dnl Web App Runtime
  1.6293 +dnl ========================================================
  1.6294 +MOZ_ARG_DISABLE_BOOL(webapp-runtime,
  1.6295 +[  --disable-webapp-runtime  Disable Web App Runtime],
  1.6296 +    MOZ_WEBAPP_RUNTIME=,
  1.6297 +    MOZ_WEBAPP_RUNTIME=1)
  1.6298 +if test "$MOZ_WIDGET_TOOLKIT" != "windows" -a "$MOZ_WIDGET_TOOLKIT" != "cocoa" -a "$MOZ_WIDGET_TOOLKIT" != "gtk2"; then
  1.6299 +    MOZ_WEBAPP_RUNTIME=
  1.6300 +fi
  1.6301 +if test "$OS_ARCH" = "WINNT" -a -z "$MAKENSISU" -a -n "$CROSS_COMPILE"; then
  1.6302 +    MOZ_WEBAPP_RUNTIME=
  1.6303 +fi
  1.6304 +AC_SUBST(MOZ_WEBAPP_RUNTIME)
  1.6305 +if test "$MOZ_WEBAPP_RUNTIME"; then
  1.6306 +    AC_DEFINE(MOZ_WEBAPP_RUNTIME)
  1.6307 +fi
  1.6308 +
  1.6309 +AC_MSG_CHECKING([for tar archiver])
  1.6310 +AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
  1.6311 +if test -z "$TAR"; then
  1.6312 +    AC_MSG_ERROR([no tar archiver found in \$PATH])
  1.6313 +fi
  1.6314 +AC_MSG_RESULT([$TAR])
  1.6315 +AC_SUBST(TAR)
  1.6316 +
  1.6317 +AC_MSG_CHECKING([for wget])
  1.6318 +AC_CHECK_PROGS(WGET, wget, "")
  1.6319 +AC_MSG_RESULT([$WGET])
  1.6320 +AC_SUBST(WGET)
  1.6321 +
  1.6322 +dnl ========================================================
  1.6323 +dnl Signing
  1.6324 +dnl ========================================================
  1.6325 +
  1.6326 +if test -n "$MOZ_SIGN_CMD"; then
  1.6327 +    AC_DEFINE(MOZ_SIGNING)
  1.6328 +fi
  1.6329 +
  1.6330 +dnl ========================================================
  1.6331 +dnl Maintenance Service
  1.6332 +dnl ========================================================
  1.6333 +
  1.6334 +MOZ_ARG_ENABLE_BOOL(maintenance-service,
  1.6335 +[  --enable-maintenance-service       Enable building of maintenanceservice],
  1.6336 +    MOZ_MAINTENANCE_SERVICE=1,
  1.6337 +    MOZ_MAINTENANCE_SERVICE= )
  1.6338 +
  1.6339 +if test -n "$MOZ_MAINTENANCE_SERVICE"; then
  1.6340 +  if test "$OS_ARCH" = "WINNT"; then
  1.6341 +    AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
  1.6342 +  else
  1.6343 +    AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
  1.6344 +  fi
  1.6345 +fi
  1.6346 +
  1.6347 +dnl ========================================================
  1.6348 +dnl Verify MAR signatures
  1.6349 +dnl ========================================================
  1.6350 +
  1.6351 +MOZ_ARG_ENABLE_BOOL(verify-mar,
  1.6352 +[  --enable-verify-mar     Enable verifying MAR signatures],
  1.6353 +    MOZ_VERIFY_MAR_SIGNATURE=1,
  1.6354 +    MOZ_VERIFY_MAR_SIGNATURE= )
  1.6355 +
  1.6356 +if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
  1.6357 +  if test "$OS_ARCH" = "WINNT"; then
  1.6358 +    AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
  1.6359 +  else
  1.6360 +    AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
  1.6361 +  fi
  1.6362 +fi
  1.6363 +
  1.6364 +dnl ========================================================
  1.6365 +dnl Enable building the signmar program.
  1.6366 +dnl This option is much different than the --enable-verify-mar option.
  1.6367 +dnl --enable-verify-mar is for enabling the verification check on MAR
  1.6368 +dnl files in the updater.  The --enable-signmar option is for building
  1.6369 +dnl the signmar program.
  1.6370 +dnl ========================================================
  1.6371 +
  1.6372 +MOZ_ARG_ENABLE_BOOL(signmar,
  1.6373 +[  --enable-signmar     Enable building the signmar program],
  1.6374 +    MOZ_ENABLE_SIGNMAR=1,
  1.6375 +    MOZ_ENABLE_SIGNMAR= )
  1.6376 +
  1.6377 +if test -n "$MOZ_ENABLE_SIGNMAR"; then
  1.6378 +  AC_DEFINE(MOZ_ENABLE_SIGNMAR)
  1.6379 +fi
  1.6380 +
  1.6381 +dnl ========================================================
  1.6382 +dnl Updater
  1.6383 +dnl ========================================================
  1.6384 +
  1.6385 +MOZ_ARG_DISABLE_BOOL(updater,
  1.6386 +[  --disable-updater       Disable building of updater],
  1.6387 +    MOZ_UPDATER=,
  1.6388 +    MOZ_UPDATER=1 )
  1.6389 +
  1.6390 +if test -n "$MOZ_UPDATER"; then
  1.6391 +    AC_DEFINE(MOZ_UPDATER)
  1.6392 +fi
  1.6393 +
  1.6394 +# tools/update-packaging is not checked out by default.
  1.6395 +MOZ_ARG_ENABLE_BOOL(update-packaging,
  1.6396 +[  --enable-update-packaging
  1.6397 +                          Enable tools/update-packaging],
  1.6398 +    MOZ_UPDATE_PACKAGING=1,
  1.6399 +    MOZ_UPDATE_PACKAGING= )
  1.6400 +AC_SUBST(MOZ_UPDATE_PACKAGING)
  1.6401 +
  1.6402 +dnl ========================================================
  1.6403 +dnl Tor Additions
  1.6404 +dnl ========================================================
  1.6405 +MOZ_ARG_WITH_STRING(tor-browser-version,
  1.6406 +[  --with-tor-browser-version=VERSION
  1.6407 +                          Set Tor Browser version, e.g., 4.0b1],
  1.6408 +    TOR_BROWSER_VERSION="$withval")
  1.6409 +
  1.6410 +MOZ_ARG_ENABLE_BOOL(tor-browser-update,
  1.6411 +[  --enable-tor-browser-update
  1.6412 +                          Enable Tor Browser update],
  1.6413 +    TOR_BROWSER_UPDATE=1,
  1.6414 +    TOR_BROWSER_UPDATE= )
  1.6415 +
  1.6416 +if test -n "$TOR_BROWSER_UPDATE"; then
  1.6417 +    if test -z "$TOR_BROWSER_VERSION"; then
  1.6418 +        AC_MSG_ERROR([--enable-tor-browser-update requires --with-tor-browser-version.])
  1.6419 +    fi
  1.6420 +    AC_DEFINE(TOR_BROWSER_UPDATE)
  1.6421 +fi
  1.6422 +
  1.6423 +AC_DEFINE_UNQUOTED(TOR_BROWSER_VERSION,"$TOR_BROWSER_VERSION")
  1.6424 +AC_SUBST(TOR_BROWSER_VERSION)
  1.6425 +AC_SUBST(TOR_BROWSER_UPDATE)
  1.6426 +
  1.6427 +dnl ========================================================
  1.6428 +dnl build the tests by default
  1.6429 +dnl ========================================================
  1.6430 +MOZ_ARG_DISABLE_BOOL(tests,
  1.6431 +[  --disable-tests         Do not build test libraries & programs],
  1.6432 +    ENABLE_TESTS=,
  1.6433 +    ENABLE_TESTS=1 )
  1.6434 +
  1.6435 +if test -n "$ENABLE_TESTS"; then
  1.6436 +    GTEST_HAS_RTTI=0
  1.6437 +    AC_DEFINE_UNQUOTED(GTEST_HAS_RTTI, 0)
  1.6438 +    AC_SUBST(GTEST_HAS_RTTI)
  1.6439 +    if test -n "$_WIN32_MSVC"; then
  1.6440 +          AC_DEFINE_UNQUOTED(_VARIADIC_MAX, 10)
  1.6441 +    fi
  1.6442 +    if test "${OS_TARGET}" = "Android"; then
  1.6443 +        AC_DEFINE(GTEST_OS_LINUX_ANDROID)
  1.6444 +        AC_DEFINE(GTEST_USE_OWN_TR1_TUPLE)
  1.6445 +        AC_DEFINE_UNQUOTED(GTEST_HAS_CLONE, 0)
  1.6446 +        AC_SUBST(GTEST_OS_LINUX_ANDROID)
  1.6447 +        AC_SUBST(GTEST_USE_OWN_TR1_TUPLE)
  1.6448 +        AC_SUBST(GTEST_HAS_CLONE)
  1.6449 +    fi
  1.6450 +fi
  1.6451 +
  1.6452 +dnl ========================================================
  1.6453 +dnl parental controls (for Windows Vista)
  1.6454 +dnl ========================================================
  1.6455 +MOZ_ARG_DISABLE_BOOL(parental-controls,
  1.6456 +[  --disable-parental-controls
  1.6457 +                          Do not build parental controls],
  1.6458 +   MOZ_DISABLE_PARENTAL_CONTROLS=1,
  1.6459 +   MOZ_DISABLE_PARENTAL_CONTROLS=)
  1.6460 +if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
  1.6461 +    AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
  1.6462 +fi
  1.6463 +
  1.6464 +AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
  1.6465 +
  1.6466 +dnl ========================================================
  1.6467 +dnl = Disable DOMCrypto
  1.6468 +dnl ========================================================
  1.6469 +if test -n "$MOZ_DISABLE_CRYPTOLEGACY"; then
  1.6470 +    AC_DEFINE(MOZ_DISABLE_CRYPTOLEGACY)
  1.6471 +fi
  1.6472 +AC_SUBST(MOZ_DISABLE_CRYPTOLEGACY)
  1.6473 +
  1.6474 +dnl ========================================================
  1.6475 +dnl = Disable EV certificate verification
  1.6476 +dnl ========================================================
  1.6477 +if test -n "$MOZ_NO_EV_CERTS"; then
  1.6478 +    AC_DEFINE(MOZ_NO_EV_CERTS)
  1.6479 +fi
  1.6480 +AC_SUBST(MOZ_NO_EV_CERTS)
  1.6481 +
  1.6482 +dnl ========================================================
  1.6483 +dnl = Disable libpkix
  1.6484 +dnl ========================================================
  1.6485 +if test -n "$NSS_NO_LIBPKIX"; then
  1.6486 +    AC_DEFINE(NSS_NO_LIBPKIX)
  1.6487 +fi
  1.6488 +AC_SUBST(NSS_NO_LIBPKIX)
  1.6489 +
  1.6490 +dnl ========================================================
  1.6491 +dnl = Content process sandboxing
  1.6492 +dnl ========================================================
  1.6493 +if test -n "$gonkdir"; then
  1.6494 +    MOZ_CONTENT_SANDBOX=1
  1.6495 +fi
  1.6496 +
  1.6497 +MOZ_ARG_ENABLE_BOOL(content-sandbox,
  1.6498 +[  --enable-content-sandbox        Enable sandboxing support for content-processes],
  1.6499 +    MOZ_CONTENT_SANDBOX=1,
  1.6500 +    MOZ_CONTENT_SANDBOX=)
  1.6501 +
  1.6502 +if test -n "$MOZ_CONTENT_SANDBOX"; then
  1.6503 +    AC_DEFINE(MOZ_CONTENT_SANDBOX)
  1.6504 +fi
  1.6505 +
  1.6506 +AC_SUBST(MOZ_CONTENT_SANDBOX)
  1.6507 +
  1.6508 +MOZ_ARG_ENABLE_BOOL(content-sandbox-reporter,
  1.6509 +[ --enable-content-sandbox-reporter        Enable syscall reporter to troubleshoot syscalls denied by the content-processes sandbox],
  1.6510 +    MOZ_CONTENT_SANDBOX_REPORTER=1,
  1.6511 +    MOZ_CONTENT_SANDBOX_REPORTER=)
  1.6512 +
  1.6513 +if test -n "$MOZ_CONTENT_SANDBOX_REPORTER"; then
  1.6514 +    AC_DEFINE(MOZ_CONTENT_SANDBOX_REPORTER)
  1.6515 +fi
  1.6516 +
  1.6517 +AC_SUBST(MOZ_CONTENT_SANDBOX_REPORTER)
  1.6518 +
  1.6519 +dnl ========================================================
  1.6520 +dnl =
  1.6521 +dnl = Module specific options
  1.6522 +dnl =
  1.6523 +dnl ========================================================
  1.6524 +MOZ_ARG_HEADER(Individual module options)
  1.6525 +
  1.6526 +dnl ========================================================
  1.6527 +dnl = Disable feed handling components
  1.6528 +dnl ========================================================
  1.6529 +MOZ_ARG_DISABLE_BOOL(feeds,
  1.6530 +[  --disable-feeds         Disable feed handling and processing components],
  1.6531 +    MOZ_FEEDS=,
  1.6532 +    MOZ_FEEDS=1 )
  1.6533 +if test -n "$MOZ_FEEDS"; then
  1.6534 +    AC_DEFINE(MOZ_FEEDS)
  1.6535 +else
  1.6536 +    if test "$MOZ_BUILD_APP" = "browser"; then
  1.6537 +        AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
  1.6538 +    fi
  1.6539 +fi
  1.6540 +
  1.6541 +dnl ========================================================
  1.6542 +dnl Check for sqlite
  1.6543 +dnl ========================================================
  1.6544 +
  1.6545 +MOZ_NATIVE_SQLITE=
  1.6546 +MOZ_ARG_ENABLE_BOOL(system-sqlite,
  1.6547 +[  --enable-system-sqlite  Use system sqlite (located with pkgconfig)],
  1.6548 +MOZ_NATIVE_SQLITE=1,
  1.6549 +MOZ_NATIVE_SQLITE= )
  1.6550 +
  1.6551 +if test -z "$MOZ_NATIVE_SQLITE"
  1.6552 +then
  1.6553 +    SQLITE_CFLAGS=
  1.6554 +    SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
  1.6555 +else
  1.6556 +    dnl ============================
  1.6557 +    dnl === SQLite Version check ===
  1.6558 +    dnl ============================
  1.6559 +    dnl Check to see if the system SQLite package is new enough.
  1.6560 +    PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
  1.6561 +
  1.6562 +    dnl ==================================
  1.6563 +    dnl === SQLITE_SECURE_DELETE check ===
  1.6564 +    dnl ==================================
  1.6565 +    dnl Check to see if the system SQLite package is compiled with
  1.6566 +    dnl SQLITE_SECURE_DELETE enabled.
  1.6567 +    AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
  1.6568 +    _SAVE_CFLAGS="$CFLAGS"
  1.6569 +    CFLAGS="$CFLAGS $SQLITE_CFLAGS"
  1.6570 +    _SAVE_LIBS="$LIBS"
  1.6571 +    LIBS="$LIBS $SQLITE_LIBS"
  1.6572 +    AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
  1.6573 +        AC_TRY_RUN([
  1.6574 +            #include "sqlite3.h"
  1.6575 +
  1.6576 +            int main(int argc, char **argv){
  1.6577 +              return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
  1.6578 +            }],
  1.6579 +            ac_cv_sqlite_secure_delete=yes,
  1.6580 +            ac_cv_sqlite_secure_delete=no,
  1.6581 +            ac_cv_sqlite_secure_delete=no
  1.6582 +        )
  1.6583 +    ])
  1.6584 +    AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
  1.6585 +    CFLAGS="$_SAVE_CFLAGS"
  1.6586 +    LIBS="$_SAVE_LIBS"
  1.6587 +    if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
  1.6588 +        AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
  1.6589 +    fi
  1.6590 +
  1.6591 +    dnl ===============================
  1.6592 +    dnl === SQLITE_THREADSAFE check ===
  1.6593 +    dnl ===============================
  1.6594 +    dnl Check to see if the system SQLite package is compiled with
  1.6595 +    dnl SQLITE_THREADSAFE enabled.
  1.6596 +    AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
  1.6597 +    _SAVE_CFLAGS="$CFLAGS"
  1.6598 +    CFLAGS="$CFLAGS $SQLITE_CFLAGS"
  1.6599 +    _SAVE_LIBS="$LIBS"
  1.6600 +    LIBS="$LIBS $SQLITE_LIBS"
  1.6601 +    AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
  1.6602 +        AC_TRY_RUN([
  1.6603 +            #include "sqlite3.h"
  1.6604 +
  1.6605 +            int main(int argc, char **argv){
  1.6606 +              return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
  1.6607 +            }],
  1.6608 +            ac_cv_sqlite_threadsafe=yes,
  1.6609 +            ac_cv_sqlite_threadsafe=no,
  1.6610 +            ac_cv_sqlite_threadsafe=no
  1.6611 +        )
  1.6612 +    ])
  1.6613 +    AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
  1.6614 +    CFLAGS="$_SAVE_CFLAGS"
  1.6615 +    LIBS="$_SAVE_LIBS"
  1.6616 +    if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
  1.6617 +        AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
  1.6618 +    fi
  1.6619 +
  1.6620 +    dnl ================================
  1.6621 +    dnl === SQLITE_ENABLE_FTS3 check ===
  1.6622 +    dnl ================================
  1.6623 +    dnl check to see if the system SQLite package is compiled with
  1.6624 +    dnl SQLITE_ENABLE_FTS3 enabled.
  1.6625 +    AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
  1.6626 +    _SAVE_CFLAGS="$CFLAGS"
  1.6627 +    CFLAGS="$CFLAGS $SQLITE_CFLAGS"
  1.6628 +    _SAVE_LIBS="$LIBS"
  1.6629 +    LIBS="$LIBS $SQLITE_LIBS"
  1.6630 +    AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
  1.6631 +        AC_TRY_RUN([
  1.6632 +            #include "sqlite3.h"
  1.6633 +
  1.6634 +            int main(int argc, char **argv){
  1.6635 +              return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
  1.6636 +            }],
  1.6637 +            ac_cv_sqlite_enable_fts3=yes,
  1.6638 +            ac_cv_sqlite_enable_fts3=no,
  1.6639 +            ac_cv_sqlite_enable_fts3=no
  1.6640 +        )
  1.6641 +    ])
  1.6642 +    AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
  1.6643 +    CFLAGS="$_SAVE_CFLAGS"
  1.6644 +    LIBS="$_SAVE_LIBS"
  1.6645 +    if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
  1.6646 +        AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
  1.6647 +    fi
  1.6648 +
  1.6649 +    dnl =========================================
  1.6650 +    dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
  1.6651 +    dnl =========================================
  1.6652 +    dnl check to see if the system SQLite package is compiled with
  1.6653 +    dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
  1.6654 +    AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
  1.6655 +    _SAVE_CFLAGS="$CFLAGS"
  1.6656 +    CFLAGS="$CFLAGS $SQLITE_CFLAGS"
  1.6657 +    _SAVE_LIBS="$LIBS"
  1.6658 +    LIBS="$LIBS $SQLITE_LIBS"
  1.6659 +    AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
  1.6660 +        AC_TRY_RUN([
  1.6661 +            #include "sqlite3.h"
  1.6662 +
  1.6663 +            int main(int argc, char **argv){
  1.6664 +              return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
  1.6665 +            }],
  1.6666 +            ac_cv_sqlite_enable_unlock_notify=yes,
  1.6667 +            ac_cv_sqlite_enable_unlock_notify=no,
  1.6668 +            ac_cv_sqlite_enable_unlock_notify=no
  1.6669 +        )
  1.6670 +    ])
  1.6671 +    AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
  1.6672 +    CFLAGS="$_SAVE_CFLAGS"
  1.6673 +    LIBS="$_SAVE_LIBS"
  1.6674 +    if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
  1.6675 +        AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
  1.6676 +    fi
  1.6677 +fi
  1.6678 +
  1.6679 +if test -n "$MOZ_NATIVE_SQLITE"; then
  1.6680 +    AC_DEFINE(MOZ_NATIVE_SQLITE)
  1.6681 +fi
  1.6682 +AC_SUBST(MOZ_NATIVE_SQLITE)
  1.6683 +
  1.6684 +dnl ========================================================
  1.6685 +dnl = Enable help viewer (off by default)
  1.6686 +dnl ========================================================
  1.6687 +if test -n "$MOZ_HELP_VIEWER"; then
  1.6688 +     dnl Do this if defined in confvars.sh
  1.6689 +     AC_DEFINE(MOZ_HELP_VIEWER)
  1.6690 +fi
  1.6691 +
  1.6692 +dnl ========================================================
  1.6693 +dnl = Enable safe browsing (anti-phishing)
  1.6694 +dnl ========================================================
  1.6695 +MOZ_ARG_ENABLE_BOOL(safe-browsing,
  1.6696 +[  --enable-safe-browsing  Enable safe browsing (anti-phishing) implementation],
  1.6697 +    MOZ_SAFE_BROWSING=1,
  1.6698 +    MOZ_SAFE_BROWSING= )
  1.6699 +if test -n "$MOZ_SAFE_BROWSING"; then
  1.6700 +    AC_DEFINE(MOZ_SAFE_BROWSING)
  1.6701 +fi
  1.6702 +AC_SUBST(MOZ_SAFE_BROWSING)
  1.6703 +
  1.6704 +dnl ========================================================
  1.6705 +dnl = Enable url-classifier
  1.6706 +dnl ========================================================
  1.6707 +dnl Implicitly enabled by default if building with safe-browsing
  1.6708 +if test -n "$MOZ_SAFE_BROWSING"; then
  1.6709 +    MOZ_URL_CLASSIFIER=1
  1.6710 +fi
  1.6711 +MOZ_ARG_ENABLE_BOOL(url-classifier,
  1.6712 +[  --enable-url-classifier Enable url classifier module],
  1.6713 +    MOZ_URL_CLASSIFIER=1,
  1.6714 +    MOZ_URL_CLASSIFIER= )
  1.6715 +if test -n "$MOZ_URL_CLASSIFIER"; then
  1.6716 +    AC_DEFINE(MOZ_URL_CLASSIFIER)
  1.6717 +fi
  1.6718 +AC_SUBST(MOZ_URL_CLASSIFIER)
  1.6719 +
  1.6720 +dnl ========================================================
  1.6721 +dnl = Disable zipwriter
  1.6722 +dnl ========================================================
  1.6723 +MOZ_ARG_DISABLE_BOOL(zipwriter,
  1.6724 +[  --disable-zipwriter     Disable zipwriter component],
  1.6725 +    MOZ_ZIPWRITER=,
  1.6726 +    MOZ_ZIPWRITER=1 )
  1.6727 +AC_SUBST(MOZ_ZIPWRITER)
  1.6728 +
  1.6729 +dnl ========================================================
  1.6730 +dnl GL provider
  1.6731 +dnl ========================================================
  1.6732 +MOZ_GL_PROVIDER=
  1.6733 +MOZ_ARG_WITH_STRING(gl-provider,
  1.6734 +[  --with-gl-provider=ID
  1.6735 +                          Set GL provider backend type],
  1.6736 +[ val=`echo $withval`
  1.6737 +    MOZ_GL_PROVIDER="$val"])
  1.6738 +
  1.6739 +if test -n "$MOZ_GL_PROVIDER"; then
  1.6740 +MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER
  1.6741 +AC_SUBST(MOZ_GL_PROVIDER)
  1.6742 +AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER)
  1.6743 +fi
  1.6744 +AC_SUBST(MOZ_GL_DEFAULT_PROVIDER)
  1.6745 +AC_DEFINE_UNQUOTED(GL_PROVIDER_$MOZ_GL_DEFAULT_PROVIDER)
  1.6746 +
  1.6747 +dnl ========================================================
  1.6748 +dnl = faststripe theme
  1.6749 +dnl ========================================================
  1.6750 +MOZ_ARG_ENABLE_BOOL(faststripe,
  1.6751 +[  --enable-faststripe     Use faststripe theme],
  1.6752 +    MOZ_THEME_FASTSTRIPE=1,
  1.6753 +    MOZ_THEME_FASTSTRIPE= )
  1.6754 +AC_SUBST(MOZ_THEME_FASTSTRIPE)
  1.6755 +
  1.6756 +dnl ========================================================
  1.6757 +dnl =
  1.6758 +dnl = Feature options that require extra sources to be pulled
  1.6759 +dnl =
  1.6760 +dnl ========================================================
  1.6761 +dnl MOZ_ARG_HEADER(Features that require extra sources)
  1.6762 +
  1.6763 +dnl ========================================================
  1.6764 +dnl =
  1.6765 +dnl = Runtime debugging and Optimization Options
  1.6766 +dnl =
  1.6767 +dnl ========================================================
  1.6768 +MOZ_ARG_HEADER(Runtime debugging and Optimizations)
  1.6769 +
  1.6770 +dnl ========================================================
  1.6771 +dnl enable mobile optimizations
  1.6772 +dnl ========================================================
  1.6773 +MOZ_ARG_ENABLE_BOOL(mobile-optimize,
  1.6774 +[  --enable-mobile-optimize
  1.6775 +                          Enable mobile optimizations],
  1.6776 +    MOZ_GFX_OPTIMIZE_MOBILE=1)
  1.6777 +
  1.6778 +AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
  1.6779 +
  1.6780 +if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
  1.6781 +    AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
  1.6782 +fi
  1.6783 +
  1.6784 +dnl ========================================================
  1.6785 +dnl = Enable code optimization. ON by default.
  1.6786 +dnl ========================================================
  1.6787 +if test -z "$MOZ_OPTIMIZE_FLAGS"; then
  1.6788 +    MOZ_OPTIMIZE_FLAGS="-O"
  1.6789 +fi
  1.6790 +
  1.6791 +MOZ_ARG_ENABLE_STRING(optimize,
  1.6792 +[  --disable-optimize      Disable compiler optimization
  1.6793 +  --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
  1.6794 +[ if test "$enableval" != "no"; then
  1.6795 +    MOZ_OPTIMIZE=1
  1.6796 +    if test -n "$enableval" -a "$enableval" != "yes"; then
  1.6797 +        MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
  1.6798 +        MOZ_OPTIMIZE=2
  1.6799 +    fi
  1.6800 +else
  1.6801 +    MOZ_OPTIMIZE=
  1.6802 +fi ], MOZ_OPTIMIZE=1)
  1.6803 +
  1.6804 +MOZ_SET_FRAMEPTR_FLAGS
  1.6805 +
  1.6806 +if test "$COMPILE_ENVIRONMENT"; then
  1.6807 +if test -n "$MOZ_OPTIMIZE"; then
  1.6808 +    AC_MSG_CHECKING([for valid optimization flags])
  1.6809 +    _SAVE_CFLAGS=$CFLAGS
  1.6810 +    CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
  1.6811 +    AC_TRY_COMPILE([#include <stdio.h>],
  1.6812 +        [printf("Hello World\n");],
  1.6813 +        _results=yes,
  1.6814 +        _results=no)
  1.6815 +    AC_MSG_RESULT([$_results])
  1.6816 +    if test "$_results" = "no"; then
  1.6817 +        AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
  1.6818 +    fi
  1.6819 +    CFLAGS=$_SAVE_CFLAGS
  1.6820 +fi
  1.6821 +fi # COMPILE_ENVIRONMENT
  1.6822 +
  1.6823 +AC_SUBST(MOZ_OPTIMIZE)
  1.6824 +AC_SUBST(MOZ_FRAMEPTR_FLAGS)
  1.6825 +AC_SUBST(MOZ_OPTIMIZE_FLAGS)
  1.6826 +AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
  1.6827 +AC_SUBST(MOZ_ALLOW_HEAP_EXECUTE_FLAGS)
  1.6828 +AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
  1.6829 +AC_SUBST(MOZ_PGO)
  1.6830 +AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
  1.6831 +
  1.6832 +dnl ========================================================
  1.6833 +dnl = Enable any treating of compile warnings as errors
  1.6834 +dnl ========================================================
  1.6835 +MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
  1.6836 +[  --enable-warnings-as-errors
  1.6837 +                          Enable treating of warnings as errors],
  1.6838 +    MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
  1.6839 +    MOZ_ENABLE_WARNINGS_AS_ERRORS=)
  1.6840 +if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
  1.6841 +   WARNINGS_AS_ERRORS=''
  1.6842 +elif test "$GNU_CC"; then
  1.6843 +    # Prevent the following GCC warnings from being treated as errors:
  1.6844 +    # -Wuninitialized - too many false positives
  1.6845 +    # -Wmaybe-uninitialized - too many false positives
  1.6846 +    # -Wdeprecated-declarations - we don't want our builds held hostage when a
  1.6847 +    #   platform-specific API becomes deprecated.
  1.6848 +    MOZ_C_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_c_has_noerror_uninitialized)
  1.6849 +    MOZ_CXX_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_cxx_has_noerror_uninitialized)
  1.6850 +    MOZ_C_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_c_has_noerror_maybe_uninitialized)
  1.6851 +    MOZ_CXX_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_cxx_has_noerror_maybe_uninitialized)
  1.6852 +    MOZ_C_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_c_has_noerror_deprecated_declarations)
  1.6853 +    MOZ_CXX_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_cxx_has_noerror_deprecated_declarations)
  1.6854 +fi
  1.6855 +
  1.6856 +dnl ========================================================
  1.6857 +dnl = Disable runtime logging checks
  1.6858 +dnl ========================================================
  1.6859 +MOZ_ARG_DISABLE_BOOL(logging,
  1.6860 +[  --disable-logging       Disable logging facilities],
  1.6861 +    NS_DISABLE_LOGGING=1,
  1.6862 +    NS_DISABLE_LOGGING= )
  1.6863 +if test "$NS_DISABLE_LOGGING"; then
  1.6864 +    AC_DEFINE(NS_DISABLE_LOGGING)
  1.6865 +else
  1.6866 +    AC_DEFINE(MOZ_LOGGING)
  1.6867 +fi
  1.6868 +
  1.6869 +dnl ========================================================
  1.6870 +dnl = This will enable logging of addref, release, ctor, dtor.
  1.6871 +dnl ========================================================
  1.6872 +_ENABLE_LOGREFCNT=42
  1.6873 +MOZ_ARG_ENABLE_BOOL(logrefcnt,
  1.6874 +[  --enable-logrefcnt      Enable logging of refcounts (default=debug) ],
  1.6875 +    _ENABLE_LOGREFCNT=1,
  1.6876 +    _ENABLE_LOGREFCNT= )
  1.6877 +if test "$_ENABLE_LOGREFCNT" = "1"; then
  1.6878 +    AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
  1.6879 +elif test -z "$_ENABLE_LOGREFCNT"; then
  1.6880 +    AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
  1.6881 +fi
  1.6882 +
  1.6883 +dnl ========================================================
  1.6884 +dnl moz_dump_painting
  1.6885 +dnl ========================================================
  1.6886 +MOZ_ARG_ENABLE_BOOL(dump-painting,
  1.6887 +[  --enable-dump-painting          Enable paint debugging.],
  1.6888 +    MOZ_DUMP_PAINTING=1,
  1.6889 +    MOZ_DUMP_PAINTING= )
  1.6890 +if test -n "$MOZ_DUMP_PAINTING"; then
  1.6891 +    AC_DEFINE(MOZ_DUMP_PAINTING)
  1.6892 +    AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
  1.6893 +fi
  1.6894 +if test -n "$MOZ_DEBUG"; then
  1.6895 +    AC_DEFINE(MOZ_DUMP_PAINTING)
  1.6896 +fi
  1.6897 +
  1.6898 +dnl ========================================================
  1.6899 +dnl = Enable trace malloc
  1.6900 +dnl ========================================================
  1.6901 +NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
  1.6902 +MOZ_ARG_ENABLE_BOOL(trace-malloc,
  1.6903 +[  --enable-trace-malloc   Enable malloc tracing; also disables DMD and jemalloc],
  1.6904 +    NS_TRACE_MALLOC=1,
  1.6905 +    NS_TRACE_MALLOC= )
  1.6906 +if test "$NS_TRACE_MALLOC"; then
  1.6907 +  # Please, Mr. Linker Man, don't take away our symbol names
  1.6908 +  MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
  1.6909 +  AC_DEFINE(NS_TRACE_MALLOC)
  1.6910 +fi
  1.6911 +AC_SUBST(NS_TRACE_MALLOC)
  1.6912 +
  1.6913 +dnl ========================================================
  1.6914 +dnl = Enable DMD
  1.6915 +dnl ========================================================
  1.6916 +
  1.6917 +MOZ_ARG_ENABLE_BOOL(dmd,
  1.6918 +[  --enable-dmd            Enable DMD; also enables jemalloc and replace-malloc],
  1.6919 +    MOZ_DMD=1,
  1.6920 +    MOZ_DMD= )
  1.6921 +
  1.6922 +dnl The two options are conflicting. Fails the configure to alert the user.
  1.6923 +if test "$NS_TRACE_MALLOC" -a "$MOZ_DMD"; then
  1.6924 +    AC_MSG_ERROR([--enable-trace-malloc and --enable-dmd are conflicting options])
  1.6925 +fi
  1.6926 +
  1.6927 +if test "$MOZ_DMD"; then
  1.6928 +    AC_DEFINE(MOZ_DMD)
  1.6929 +
  1.6930 +    if test "${CPU_ARCH}" = "arm"; then
  1.6931 +        CFLAGS="$CFLAGS -funwind-tables"
  1.6932 +        CXXFLAGS="$CXXFLAGS -funwind-tables"
  1.6933 +    fi
  1.6934 +
  1.6935 +    MOZ_MEMORY=1                        # DMD enables jemalloc
  1.6936 +    MOZ_REPLACE_MALLOC=1                # DMD enables replace-malloc
  1.6937 +fi
  1.6938 +AC_SUBST(MOZ_DMD)
  1.6939 +
  1.6940 +dnl ========================================================
  1.6941 +dnl = Enable jemalloc
  1.6942 +dnl ========================================================
  1.6943 +MOZ_ARG_ENABLE_BOOL(jemalloc,
  1.6944 +[  --enable-jemalloc       Replace memory allocator with jemalloc],
  1.6945 +    MOZ_MEMORY=1,
  1.6946 +    MOZ_MEMORY=)
  1.6947 +
  1.6948 +if test "$NS_TRACE_MALLOC"; then
  1.6949 +    MOZ_MEMORY=
  1.6950 +fi
  1.6951 +
  1.6952 +if test "${OS_TARGET}" = "Android"; then
  1.6953 +  dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue
  1.6954 +  :
  1.6955 +elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin"; then
  1.6956 +  dnl On Windows and OSX, we want to link all our binaries against mozglue
  1.6957 +  if test -z "$GNU_CC"; then
  1.6958 +    MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
  1.6959 +  else
  1.6960 +    MOZ_GLUE_LDFLAGS='-L$(LIBXUL_DIST)/lib $(call EXPAND_LIBNAME,mozglue)'
  1.6961 +  fi
  1.6962 +else
  1.6963 +  dnl On other Unix systems, we only want to link executables against mozglue
  1.6964 +  MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
  1.6965 +  dnl On other Unix systems, where mozglue is a static library, jemalloc is
  1.6966 +  dnl separated for the SDK, so we need to add it here.
  1.6967 +  if test "$MOZ_MEMORY" = 1 -o \( "$LIBXUL_SDK" -a -f "$LIBXUL_SDK/lib/${LIB_PREFIX}memory.${LIB_SUFFIX}" \); then
  1.6968 +    MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(call EXPAND_LIBNAME_PATH,memory,$(LIBXUL_DIST)/lib)'
  1.6969 +  fi
  1.6970 +  MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS "'$(MKSHLIB_UNFORCE_ALL)'
  1.6971 +  if test -n "$GNU_CC"; then
  1.6972 +    dnl And we need mozglue symbols to be exported.
  1.6973 +    MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS -rdynamic"
  1.6974 +  fi
  1.6975 +  if test "$MOZ_LINKER" = 1; then
  1.6976 +    MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS $MOZ_ZLIB_LIBS"
  1.6977 +  fi
  1.6978 +fi
  1.6979 +
  1.6980 +dnl ========================================================
  1.6981 +dnl = Enable dynamic replacement of malloc implementation
  1.6982 +dnl ========================================================
  1.6983 +MOZ_ARG_ENABLE_BOOL(replace-malloc,
  1.6984 +[  --enable-replace-malloc   Enable ability to dynamically replace the malloc implementation],
  1.6985 +    MOZ_REPLACE_MALLOC=1,
  1.6986 +    MOZ_REPLACE_MALLOC= )
  1.6987 +
  1.6988 +dnl The two options are conflicting. Fails the configure to alert the user.
  1.6989 +if test "$NS_TRACE_MALLOC" -a "$MOZ_REPLACE_MALLOC"; then
  1.6990 +    AC_MSG_ERROR([--enable-trace-malloc and --enable-replace-malloc are conflicting options])
  1.6991 +fi
  1.6992 +
  1.6993 +if test -n "$MOZ_REPLACE_MALLOC" -a -z "$MOZ_MEMORY"; then
  1.6994 +    dnl We don't want to enable jemalloc unconditionally because it may be a
  1.6995 +    dnl deliberate choice not to enable it (bug 702250, for instance)
  1.6996 +    AC_MSG_ERROR([--enable-replace-malloc requires --enable-jemalloc])
  1.6997 +elif test -n "$MOZ_REPLACE_MALLOC"; then
  1.6998 +    MOZ_NATIVE_JEMALLOC=
  1.6999 +
  1.7000 +    dnl Replace-malloc Mac linkage quirks
  1.7001 +    if test -n "$MACOSX_DEPLOYMENT_TARGET"; then
  1.7002 +        AC_CACHE_CHECK([how to do weak dynamic linking],
  1.7003 +            ac_cv_weak_dynamic_linking,
  1.7004 +            [echo 'extern void foo() __attribute__((weak_import));int bar() { if (foo) foo(); return 0; }' > conftest.c
  1.7005 +             if AC_TRY_COMMAND([${CC-cc} -o conftest${DLL_SUFFIX} $CFLAGS -dynamiclib $LDFLAGS -Wl,-U,_foo conftest.c $LIBS 1>&5]) &&
  1.7006 +                test -s conftest${DLL_SUFFIX}; then
  1.7007 +                 dnl There are several ways the linker can put link edit rules in a binary:
  1.7008 +                 dnl - classic info only (for OSX < 10.6)
  1.7009 +                 dnl - dyld info only
  1.7010 +                 dnl - both
  1.7011 +                 if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO_ONLY" > /dev/null; then
  1.7012 +                     _CLASSIC_INFO=
  1.7013 +                 else
  1.7014 +                     _CLASSIC_INFO=1
  1.7015 +                 fi
  1.7016 +                 if otool -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO" > /dev/null; then
  1.7017 +                     _DYLD_INFO=1
  1.7018 +                 else
  1.7019 +                     _DYLD_INFO=
  1.7020 +                 fi
  1.7021 +                 dnl With classic info, we need to build with -flat_namespace.
  1.7022 +                 dnl With dyld info, Xcode 4.5 does the right thing without additional flags,
  1.7023 +                 dnl but Xcode < 4.5 requires a dummy library and -flat_namespace because it
  1.7024 +                 dnl forgets to set the weak flag in the dyld info.
  1.7025 +                 dnl See http://glandium.org/blog/?p=2764 for more details.
  1.7026 +                 dnl
  1.7027 +                 dnl Values for ac_cv_weak_dynamic_linking, and subsequently
  1.7028 +                 dnl MOZ_REPLACE_MALLOC_LINKAGE are thus:
  1.7029 +                 dnl - "flat namespace" when -flat_namespace alone is needed
  1.7030 +                 dnl - "dummy library" when a dummy library and -flat_namespace are needed
  1.7031 +                 dnl - "compiler support" when nothing is needed
  1.7032 +                 if test -n "$_DYLD_INFO" && dyldinfo -bind conftest${DLL_SUFFIX} 2> /dev/null | grep "_foo (weak import)" > /dev/null; then
  1.7033 +                     if test -n "$_CLASSIC_INFO"; then
  1.7034 +                         ac_cv_weak_dynamic_linking="flat namespace"
  1.7035 +                     else
  1.7036 +                         ac_cv_weak_dynamic_linking="compiler support"
  1.7037 +                     fi
  1.7038 +                 else
  1.7039 +                     if test -n "$_DYLD_INFO"; then
  1.7040 +                         ac_cv_weak_dynamic_linking="dummy library"
  1.7041 +                     else
  1.7042 +                         ac_cv_weak_dynamic_linking="flat namespace"
  1.7043 +                     fi
  1.7044 +                 fi
  1.7045 +             else
  1.7046 +                 AC_ERROR([couldn't compile a simple C file])
  1.7047 +             fi
  1.7048 +             rm -rf conftest*])
  1.7049 +        MOZ_REPLACE_MALLOC_LINKAGE="$ac_cv_weak_dynamic_linking"
  1.7050 +    fi
  1.7051 +fi
  1.7052 +AC_SUBST(MOZ_REPLACE_MALLOC)
  1.7053 +AC_SUBST(MOZ_REPLACE_MALLOC_LINKAGE)
  1.7054 +
  1.7055 +dnl ========================================================
  1.7056 +dnl = Jemalloc build setup
  1.7057 +dnl ========================================================
  1.7058 +if test -z "$MOZ_MEMORY"; then
  1.7059 +  if test -n "$MOZ_JEMALLOC3" -a -z "$MOZ_REPLACE_MALLOC"; then
  1.7060 +    MOZ_NATIVE_JEMALLOC=1
  1.7061 +    AC_CHECK_FUNCS(mallctl nallocm,,
  1.7062 +      [MOZ_NATIVE_JEMALLOC=
  1.7063 +       break])
  1.7064 +    if test -n "$MOZ_NATIVE_JEMALLOC"; then
  1.7065 +      MOZ_MEMORY=1
  1.7066 +      AC_DEFINE(MOZ_MEMORY)
  1.7067 +      AC_DEFINE(MOZ_JEMALLOC3)
  1.7068 +      AC_DEFINE(MOZ_NATIVE_JEMALLOC)
  1.7069 +    fi
  1.7070 +  fi
  1.7071 +  case "${target}" in
  1.7072 +    *-mingw*)
  1.7073 +      if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
  1.7074 +        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.])
  1.7075 +      fi
  1.7076 +      ;;
  1.7077 +  esac
  1.7078 +else
  1.7079 +  AC_DEFINE(MOZ_MEMORY)
  1.7080 +  if test -n "$MOZ_JEMALLOC3"; then
  1.7081 +    AC_DEFINE(MOZ_JEMALLOC3)
  1.7082 +  fi
  1.7083 +  if test "x$MOZ_DEBUG" = "x1"; then
  1.7084 +    AC_DEFINE(MOZ_MEMORY_DEBUG)
  1.7085 +  fi
  1.7086 +  dnl The generic feature tests that determine how to compute ncpus are long and
  1.7087 +  dnl complicated.  Therefore, simply define special cpp variables for the
  1.7088 +  dnl platforms we have special knowledge of.
  1.7089 +  case "${target}" in
  1.7090 +  *-darwin*)
  1.7091 +    AC_DEFINE(MOZ_MEMORY_DARWIN)
  1.7092 +    ;;
  1.7093 +  *-*freebsd*)
  1.7094 +    AC_DEFINE(MOZ_MEMORY_BSD)
  1.7095 +    ;;
  1.7096 +  *-android*|*-linuxandroid*)
  1.7097 +    AC_DEFINE(MOZ_MEMORY_LINUX)
  1.7098 +    AC_DEFINE(MOZ_MEMORY_ANDROID)
  1.7099 +    if test -z "$gonkdir"; then
  1.7100 +      _WRAP_MALLOC=1
  1.7101 +    else
  1.7102 +      AC_DEFINE(MOZ_MEMORY_GONK)
  1.7103 +    fi
  1.7104 +    MOZ_GLUE_LDFLAGS=
  1.7105 +    ;;
  1.7106 +  *-*linux*)
  1.7107 +    AC_DEFINE(MOZ_MEMORY_LINUX)
  1.7108 +    ;;
  1.7109 +  *-netbsd*)
  1.7110 +    AC_DEFINE(MOZ_MEMORY_BSD)
  1.7111 +    ;;
  1.7112 +  *-solaris*)
  1.7113 +    AC_DEFINE(MOZ_MEMORY_SOLARIS)
  1.7114 +    ;;
  1.7115 +  *-mingw*)
  1.7116 +    AC_DEFINE(MOZ_MEMORY_WINDOWS)
  1.7117 +    if test -z "$MOZ_DEBUG"; then
  1.7118 +      WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
  1.7119 +    else
  1.7120 +      WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib"
  1.7121 +    fi
  1.7122 +    dnl Look for a broken crtdll.obj
  1.7123 +    WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
  1.7124 +    lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
  1.7125 +    if grep -q '__imp__\{0,1\}free' crtdll.obj; then
  1.7126 +      MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
  1.7127 +      dnl Also pass this to NSPR/NSS
  1.7128 +      DLLFLAGS="$DLLFLAGS $MOZ_GLUE_LDFLAGS"
  1.7129 +    else
  1.7130 +      DLLFLAGS="$DLLFLAGS -LIBPATH:\$(DIST)/lib -DEFAULTLIB:mozglue"
  1.7131 +    fi
  1.7132 +    rm crtdll.obj
  1.7133 +
  1.7134 +    export DLLFLAGS
  1.7135 +    ;;
  1.7136 +  *)
  1.7137 +    AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
  1.7138 +    ;;
  1.7139 +  esac
  1.7140 +fi # MOZ_MEMORY
  1.7141 +AC_SUBST(MOZ_MEMORY)
  1.7142 +AC_SUBST(MOZ_JEMALLOC3)
  1.7143 +AC_SUBST(MOZ_NATIVE_JEMALLOC)
  1.7144 +AC_SUBST(MOZ_GLUE_LDFLAGS)
  1.7145 +AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
  1.7146 +AC_SUBST(WIN32_CRT_LIBS)
  1.7147 +dnl Need to set this for make because NSS doesn't have configure
  1.7148 +AC_SUBST(DLLFLAGS)
  1.7149 +
  1.7150 +dnl We need to wrap dlopen and related functions on Android because we use
  1.7151 +dnl our own linker.
  1.7152 +if test "$OS_TARGET" = Android; then
  1.7153 +    WRAP_LDFLAGS="${WRAP_LDFLAGS} -L$_objdir/dist/lib -lmozglue"
  1.7154 +    WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=PR_GetEnv,--wrap=PR_SetEnv"
  1.7155 +    if test "$MOZ_WIDGET_TOOLKIT" = android; then
  1.7156 +        WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
  1.7157 +    fi
  1.7158 +    if test -z "$gonkdir"; then
  1.7159 +        WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork,--wrap=raise"
  1.7160 +        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"
  1.7161 +    fi
  1.7162 +    if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then
  1.7163 +        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"
  1.7164 +    fi
  1.7165 +fi
  1.7166 +
  1.7167 +dnl ========================================================
  1.7168 +dnl = Use malloc wrapper lib
  1.7169 +dnl ========================================================
  1.7170 +MOZ_ARG_ENABLE_BOOL(wrap-malloc,
  1.7171 +[  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
  1.7172 +    _WRAP_MALLOC=1,
  1.7173 +    _WRAP_MALLOC= )
  1.7174 +
  1.7175 +if test -n "$_WRAP_MALLOC"; then
  1.7176 +    if test -n "$GNU_CC"; then
  1.7177 +        WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
  1.7178 +        WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
  1.7179 +        WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
  1.7180 +        WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=vasprintf,--wrap=asprintf"
  1.7181 +        WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
  1.7182 +        dnl Wrap operator new and operator delete on Android.
  1.7183 +        if test "$OS_TARGET" = "Android"; then
  1.7184 +            WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_Znwj,--wrap=_Znaj,--wrap=_ZdlPv,--wrap=_ZdaPv"
  1.7185 +            dnl Wrap the nothrow variants too.
  1.7186 +            WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_ZnwjRKSt9nothrow_t,--wrap=_ZnajRKSt9nothrow_t,--wrap=_ZdlPvRKSt9nothrow_t,--wrap=_ZdaPvRKSt9nothrow_t"
  1.7187 +        fi
  1.7188 +    else
  1.7189 +        AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
  1.7190 +    fi
  1.7191 +fi
  1.7192 +
  1.7193 +dnl ========================================================
  1.7194 +dnl = Location of malloc wrapper lib
  1.7195 +dnl ========================================================
  1.7196 +MOZ_ARG_WITH_STRING(wrap-malloc,
  1.7197 +[  --with-wrap-malloc=DIR  Location of malloc wrapper library],
  1.7198 +    WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
  1.7199 +
  1.7200 +dnl ========================================================
  1.7201 +dnl = Use JS Call tracing
  1.7202 +dnl ========================================================
  1.7203 +MOZ_ARG_ENABLE_BOOL(trace-jscalls,
  1.7204 +[  --enable-trace-jscalls  Enable JS call enter/exit callback (default=no)],
  1.7205 +    MOZ_TRACE_JSCALLS=1,
  1.7206 +    MOZ_TRACE_JSCALLS= )
  1.7207 +if test -n "$MOZ_TRACE_JSCALLS"; then
  1.7208 +    AC_DEFINE(MOZ_TRACE_JSCALLS)
  1.7209 +fi
  1.7210 +
  1.7211 +dnl ========================================================
  1.7212 +dnl JS opt-mode assertions and minidump instrumentation
  1.7213 +dnl ========================================================
  1.7214 +MOZ_ARG_ENABLE_BOOL(js-diagnostics,
  1.7215 +[  --enable-js-diagnostics
  1.7216 +                          Enable JS diagnostic assertions and breakpad data],
  1.7217 +    JS_CRASH_DIAGNOSTICS=1,
  1.7218 +    JS_CRASH_DIAGNOSTICS= )
  1.7219 +if test -n "$JS_CRASH_DIAGNOSTICS"; then
  1.7220 +    AC_DEFINE(JS_CRASH_DIAGNOSTICS)
  1.7221 +fi
  1.7222 +
  1.7223 +MOZ_CHECK_CCACHE
  1.7224 +
  1.7225 +dnl ========================================================
  1.7226 +dnl = Enable static checking using gcc-dehydra
  1.7227 +dnl ========================================================
  1.7228 +
  1.7229 +MOZ_ARG_WITH_STRING(static-checking,
  1.7230 +[  --with-static-checking=path/to/gcc_dehydra.so
  1.7231 +                          Enable static checking of code using GCC-dehydra],
  1.7232 +    DEHYDRA_PATH=$withval,
  1.7233 +    DEHYDRA_PATH= )
  1.7234 +
  1.7235 +if test -n "$DEHYDRA_PATH"; then
  1.7236 +    if test ! -f "$DEHYDRA_PATH"; then
  1.7237 +        AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
  1.7238 +    fi
  1.7239 +    AC_DEFINE(NS_STATIC_CHECKING)
  1.7240 +fi
  1.7241 +AC_SUBST(DEHYDRA_PATH)
  1.7242 +
  1.7243 +dnl ========================================================
  1.7244 +dnl = Enable using the clang plugin to build
  1.7245 +dnl ========================================================
  1.7246 +
  1.7247 +MOZ_ARG_ENABLE_BOOL(clang-plugin,
  1.7248 +[  --enable-clang-plugin   Enable building with the mozilla clang plugin ],
  1.7249 +   ENABLE_CLANG_PLUGIN=1,
  1.7250 +   ENABLE_CLANG_PLUGIN= )
  1.7251 +if test -n "$ENABLE_CLANG_PLUGIN"; then
  1.7252 +    if test -z "$CLANG_CC"; then
  1.7253 +        AC_MSG_ERROR([Can't use clang plugin without clang.])
  1.7254 +    fi
  1.7255 +    AC_DEFINE(MOZ_CLANG_PLUGIN)
  1.7256 +fi
  1.7257 +
  1.7258 +AC_SUBST(ENABLE_CLANG_PLUGIN)
  1.7259 +
  1.7260 +dnl ========================================================
  1.7261 +dnl = Enable stripping of libs & executables
  1.7262 +dnl ========================================================
  1.7263 +MOZ_ARG_ENABLE_BOOL(strip,
  1.7264 +[  --enable-strip          Enable stripping of libs & executables ],
  1.7265 +    ENABLE_STRIP=1,
  1.7266 +    ENABLE_STRIP= )
  1.7267 +
  1.7268 +dnl ========================================================
  1.7269 +dnl = Enable stripping of libs & executables when packaging
  1.7270 +dnl ========================================================
  1.7271 +MOZ_ARG_ENABLE_BOOL(install-strip,
  1.7272 +[  --enable-install-strip  Enable stripping of libs & executables when packaging ],
  1.7273 +    PKG_SKIP_STRIP= ,
  1.7274 +    PKG_SKIP_STRIP=1)
  1.7275 +
  1.7276 +dnl ========================================================
  1.7277 +dnl = --disable-elf-hack
  1.7278 +dnl ========================================================
  1.7279 +
  1.7280 +USE_ELF_HACK=1
  1.7281 +MOZ_ARG_DISABLE_BOOL(elf-hack,
  1.7282 +[  --disable-elf-hack      Disable elf hacks],
  1.7283 +    [USE_ELF_HACK=],
  1.7284 +    [USE_ELF_HACK=F # Force enable elf-hack])
  1.7285 +
  1.7286 +# Disable elf hack for profiling because the built in profiler
  1.7287 +# doesn't read the segments properly with elf hack. This is
  1.7288 +# temporary and should be fixed soon in the profiler.
  1.7289 +if test "$MOZ_PROFILING" = 1; then
  1.7290 +  if test "$USE_ELF_HACK" = F; then
  1.7291 +    AC_ERROR([--enable-elf-hack is not compatible with --enable-profiling])
  1.7292 +  fi
  1.7293 +  USE_ELF_HACK=
  1.7294 +fi
  1.7295 +
  1.7296 +# Only enable elfhack where supported
  1.7297 +if test "$USE_ELF_HACK" = 1; then
  1.7298 +    case "${HOST_OS_ARCH},${OS_ARCH}" in
  1.7299 +    Linux,Linux)
  1.7300 +        case "${CPU_ARCH}" in
  1.7301 +        arm | x86 | x86_64)
  1.7302 +            USE_ELF_HACK=1
  1.7303 +            ;;
  1.7304 +        *)
  1.7305 +            USE_ELF_HACK=
  1.7306 +            ;;
  1.7307 +        esac
  1.7308 +        ;;
  1.7309 +    *)
  1.7310 +        USE_ELF_HACK=
  1.7311 +        ;;
  1.7312 +    esac
  1.7313 +fi
  1.7314 +
  1.7315 +if test -n "$COMPILE_ENVIRONMENT" -a -n "$USE_ELF_HACK"; then
  1.7316 +    dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
  1.7317 +    dnl memory addresses it maps to. The result is that by the time elfhack
  1.7318 +    dnl kicks in, it is not possible to apply relocations because of that,
  1.7319 +    dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
  1.7320 +    dnl segment. It makes elfhack mostly useless, so considering the problems
  1.7321 +    dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
  1.7322 +    dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
  1.7323 +    dnl the linker creates PT_GNU_RELRO segments. However, when we do want
  1.7324 +    dnl elfhack enabled, disable PT_GNU_RELRO instead.
  1.7325 +    AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
  1.7326 +        LINK_WITH_PT_GNU_RELRO,
  1.7327 +        [echo "int main() {return 0;}" > conftest.${ac_ext}
  1.7328 +         if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
  1.7329 +            test -s conftest${ac_exeext}; then
  1.7330 +            if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
  1.7331 +                LINK_WITH_PT_GNU_RELRO=yes
  1.7332 +            else
  1.7333 +                LINK_WITH_PT_GNU_RELRO=no
  1.7334 +            fi
  1.7335 +         else
  1.7336 +             dnl We really don't expect to get here, but just in case
  1.7337 +             AC_ERROR([couldn't compile a simple C file])
  1.7338 +         fi
  1.7339 +         rm -rf conftest*])
  1.7340 +    if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
  1.7341 +        if test "$USE_ELF_HACK" = F; then
  1.7342 +            AC_MSG_CHECKING([for -z norelro option to ld])
  1.7343 +            _SAVE_LDFLAGS=$LDFLAGS
  1.7344 +            LDFLAGS="$LDFLAGS -Wl,-z,norelro"
  1.7345 +            AC_TRY_LINK(,,AC_MSG_RESULT([yes])
  1.7346 +                        [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,norelro"],
  1.7347 +                        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.]))
  1.7348 +            USE_ELF_HACK=1
  1.7349 +        else
  1.7350 +            AC_MSG_WARN([Disabling elfhack])
  1.7351 +            USE_ELF_HACK=
  1.7352 +        fi
  1.7353 +    fi
  1.7354 +fi
  1.7355 +
  1.7356 +dnl ========================================================
  1.7357 +dnl = libstdc++ compatibility hacks
  1.7358 +dnl ========================================================
  1.7359 +
  1.7360 +STDCXX_COMPAT=
  1.7361 +MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
  1.7362 +[  --enable-stdcxx-compat  Enable compatibility with older libstdc++],
  1.7363 +    STDCXX_COMPAT=1)
  1.7364 +
  1.7365 +if test -n "$STDCXX_COMPAT"; then
  1.7366 +   eval $(CXX="$CXX" HOST_CXX="$HOST_CXX" $PYTHON -m mozbuild.configure.libstdcxx)
  1.7367 +   AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
  1.7368 +   AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
  1.7369 +fi
  1.7370 +
  1.7371 +dnl ========================================================
  1.7372 +dnl =
  1.7373 +dnl = Profiling and Instrumenting
  1.7374 +dnl =
  1.7375 +dnl ========================================================
  1.7376 +MOZ_ARG_HEADER(Profiling and Instrumenting)
  1.7377 +
  1.7378 +dnl ========================================================
  1.7379 +dnl = Enable runtime visual profiling logger
  1.7380 +dnl ========================================================
  1.7381 +MOZ_ARG_ENABLE_BOOL(visual-event-tracer,
  1.7382 +[  --enable-visual-event-tracer   Enable visual event tracer instrumentation],
  1.7383 +    MOZ_VISUAL_EVENT_TRACER=1,
  1.7384 +    MOZ_VISUAL_EVENT_TRACER=)
  1.7385 +if test -n "$MOZ_VISUAL_EVENT_TRACER"; then
  1.7386 +    AC_DEFINE(MOZ_VISUAL_EVENT_TRACER)
  1.7387 +fi
  1.7388 +
  1.7389 +dnl ========================================================
  1.7390 +dnl = Enable TaskTracer
  1.7391 +dnl ========================================================
  1.7392 +MOZ_ARG_ENABLE_BOOL(tasktracer,
  1.7393 +[  --enable-tasktracer       Set compile flags necessary for using TaskTracer],
  1.7394 +    MOZ_TASK_TRACER=1,
  1.7395 +    MOZ_TASK_TRACER= )
  1.7396 +if test "$MOZ_WIDGET_TOOLKIT" = "gonk" -a -n "$MOZ_TASK_TRACER"; then
  1.7397 +    AC_DEFINE(MOZ_TASK_TRACER)
  1.7398 +    AC_SUBST(MOZ_TASK_TRACER)
  1.7399 +fi
  1.7400 +
  1.7401 +dnl ========================================================
  1.7402 +dnl Turn on reflow counting
  1.7403 +dnl ========================================================
  1.7404 +MOZ_ARG_ENABLE_BOOL(reflow-perf,
  1.7405 +[  --enable-reflow-perf    Enable reflow performance tracing],
  1.7406 +    MOZ_REFLOW_PERF=1,
  1.7407 +    MOZ_REFLOW_PERF= )
  1.7408 +if test -n "$MOZ_REFLOW_PERF"; then
  1.7409 +    AC_DEFINE(MOZ_REFLOW_PERF)
  1.7410 +fi
  1.7411 +
  1.7412 +dnl ========================================================
  1.7413 +dnl = Enable Radio Interface for B2G (Gonk usually)
  1.7414 +dnl ========================================================
  1.7415 +MOZ_ARG_ENABLE_BOOL(b2g-ril,
  1.7416 +[  --enable-b2g-ril      Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
  1.7417 +    MOZ_B2G_RIL=1,
  1.7418 +    MOZ_B2G_RIL=,
  1.7419 +    MOZ_B2G_RIL=$_PLATFORM_HAVE_RIL )
  1.7420 +if test -n "$MOZ_B2G_RIL"; then
  1.7421 +    if test -n "$_PLATFORM_HAVE_RIL"; then
  1.7422 +        AC_DEFINE(MOZ_B2G_RIL)
  1.7423 +    else
  1.7424 +        AC_MSG_ERROR([b2g-ril cannot be enabled because target platform doesn't support it.])
  1.7425 +    fi
  1.7426 +fi
  1.7427 +AC_SUBST(MOZ_B2G_RIL)
  1.7428 +
  1.7429 +dnl ========================================================
  1.7430 +dnl = Enable Radio FM for B2G (Gonk usually)
  1.7431 +dnl ========================================================
  1.7432 +if test -n "$MOZ_B2G_FM"; then
  1.7433 +    AC_DEFINE(MOZ_B2G_FM)
  1.7434 +fi
  1.7435 +AC_SUBST(MOZ_B2G_FM)
  1.7436 +
  1.7437 +dnl ========================================================
  1.7438 +dnl = Enable Bluetooth Interface for B2G (Gonk usually)
  1.7439 +dnl ========================================================
  1.7440 +MOZ_ARG_ENABLE_BOOL(b2g-bt,
  1.7441 +[  --enable-b2g-bt      Set compile flags necessary for compiling Bluetooth API for B2G ],
  1.7442 +    MOZ_B2G_BT=1,
  1.7443 +    MOZ_B2G_BT= )
  1.7444 +if test -n "$MOZ_B2G_BT"; then
  1.7445 +    AC_DEFINE(MOZ_B2G_BT)
  1.7446 +fi
  1.7447 +AC_SUBST(MOZ_B2G_BT)
  1.7448 +AC_SUBST(MOZ_B2G_BT_BLUEZ)
  1.7449 +AC_SUBST(MOZ_B2G_BT_BLUEDROID)
  1.7450 +
  1.7451 +dnl ========================================================
  1.7452 +dnl = Enable NFC Interface for B2G (Gonk usually)
  1.7453 +dnl ========================================================
  1.7454 +MOZ_ARG_ENABLE_BOOL(nfc,
  1.7455 +[  --enable-nfc         Set compile flags necessary for compiling NFC API ],
  1.7456 +    MOZ_NFC=1,
  1.7457 +    MOZ_NFC= )
  1.7458 +if test -n "$MOZ_NFC"; then
  1.7459 +   AC_DEFINE(MOZ_NFC)
  1.7460 +fi
  1.7461 +AC_SUBST(MOZ_NFC)
  1.7462 +
  1.7463 +dnl ========================================================
  1.7464 +dnl = Enable Pico Speech Synthesis (Gonk usually)
  1.7465 +dnl ========================================================
  1.7466 +MOZ_ARG_ENABLE_BOOL(synth-pico,
  1.7467 +[  --enable-synth-pico  Set compile flags necessary for compiling Pico Web Speech API ],
  1.7468 +    MOZ_SYNTH_PICO=1,
  1.7469 +    MOZ_SYNTH_PICO= )
  1.7470 +if test -n "$MOZ_SYNTH_PICO"; then
  1.7471 +    AC_DEFINE(MOZ_SYNTH_PICO)
  1.7472 +fi
  1.7473 +AC_SUBST(MOZ_SYNTH_PICO)
  1.7474 +
  1.7475 +dnl ========================================================
  1.7476 +dnl = Enable Support for Time Manager API
  1.7477 +dnl ========================================================
  1.7478 +if test -n "$MOZ_TIME_MANAGER"; then
  1.7479 +    AC_DEFINE(MOZ_TIME_MANAGER)
  1.7480 +fi
  1.7481 +AC_SUBST(MOZ_TIME_MANAGER)
  1.7482 +
  1.7483 +dnl ========================================================
  1.7484 +dnl = Enable Camera Interface for B2G (Gonk usually)
  1.7485 +dnl ========================================================
  1.7486 +MOZ_ARG_ENABLE_BOOL(b2g-camera,
  1.7487 +[  --enable-b2g-camera      Set compile flags necessary for compiling camera API for B2G ],
  1.7488 +    MOZ_B2G_CAMERA=1,
  1.7489 +    MOZ_B2G_CAMERA= )
  1.7490 +if test -n "$MOZ_B2G_CAMERA"; then
  1.7491 +   AC_DEFINE(MOZ_B2G_CAMERA)
  1.7492 +fi
  1.7493 +AC_SUBST(MOZ_B2G_CAMERA)
  1.7494 +
  1.7495 +dnl ========================================================
  1.7496 +dnl = Enable Support B2G-specific changes to the NSS
  1.7497 +dnl = certificate trust database.
  1.7498 +dnl ========================================================
  1.7499 +if test -n "$MOZ_B2G_CERTDATA"; then
  1.7500 +    AC_DEFINE(MOZ_B2G_CERTDATA)
  1.7501 +fi
  1.7502 +AC_SUBST(MOZ_B2G_CERTDATA)
  1.7503 +
  1.7504 +dnl ========================================================
  1.7505 +dnl = Enable Support for Payment API
  1.7506 +dnl ========================================================
  1.7507 +if test -n "$MOZ_PAY"; then
  1.7508 +    AC_DEFINE(MOZ_PAY)
  1.7509 +fi
  1.7510 +AC_SUBST(MOZ_PAY)
  1.7511 +
  1.7512 +dnl ========================================================
  1.7513 +dnl = Enable Browser Support for Activities
  1.7514 +dnl ========================================================
  1.7515 +if test -n "$MOZ_ACTIVITIES"; then
  1.7516 +    AC_DEFINE(MOZ_ACTIVITIES)
  1.7517 +fi
  1.7518 +AC_SUBST(MOZ_ACTIVITIES)
  1.7519 +
  1.7520 +dnl ========================================================
  1.7521 +dnl = Enable Support for AudioChannelManager API
  1.7522 +dnl ========================================================
  1.7523 +if test -n "$MOZ_AUDIO_CHANNEL_MANAGER"; then
  1.7524 +    AC_DEFINE(MOZ_AUDIO_CHANNEL_MANAGER)
  1.7525 +fi
  1.7526 +AC_SUBST(MOZ_AUDIO_CHANNEL_MANAGER)
  1.7527 +
  1.7528 +dnl ========================================================
  1.7529 +dnl = Enable Support for Firefox Accounts (services/fxaccounts)
  1.7530 +dnl ========================================================
  1.7531 +if test -n "$MOZ_SERVICES_FXACCOUNTS"; then
  1.7532 +    AC_DEFINE(MOZ_SERVICES_FXACCOUNTS)
  1.7533 +fi
  1.7534 +AC_SUBST(MOZ_SERVICES_FXACCOUNTS)
  1.7535 +
  1.7536 +dnl ========================================================
  1.7537 +dnl = Support for demangling undefined symbols
  1.7538 +dnl ========================================================
  1.7539 +if test -z "$SKIP_LIBRARY_CHECKS"; then
  1.7540 +    AC_LANG_SAVE
  1.7541 +    AC_LANG_CPLUSPLUS
  1.7542 +    AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
  1.7543 +    AC_LANG_RESTORE
  1.7544 +fi
  1.7545 +
  1.7546 +# Demangle only for debug or trace-malloc or DMD builds
  1.7547 +MOZ_DEMANGLE_SYMBOLS=
  1.7548 +if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
  1.7549 +    MOZ_DEMANGLE_SYMBOLS=1
  1.7550 +    AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
  1.7551 +fi
  1.7552 +AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
  1.7553 +
  1.7554 +dnl ========================================================
  1.7555 +dnl = Support for gcc stack unwinding (from gcc 3.3)
  1.7556 +dnl ========================================================
  1.7557 +if test -z "$SKIP_LIBRARY_CHECKS"; then
  1.7558 +    AC_LANG_SAVE
  1.7559 +    AC_LANG_CPLUSPLUS
  1.7560 +    MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
  1.7561 +    AC_LANG_RESTORE
  1.7562 +fi
  1.7563 +
  1.7564 +dnl ========================================================
  1.7565 +dnl JIT observers
  1.7566 +dnl ========================================================
  1.7567 +
  1.7568 +MOZ_ARG_WITH_STRING(jitreport-granularity,
  1.7569 +[  --jitreport-granularity=N
  1.7570 +                           Default granularity at which to report JIT code
  1.7571 +                           to external tools
  1.7572 +                             0 - no info
  1.7573 +                             1 - code ranges for whole functions only
  1.7574 +                             2 - per-line information
  1.7575 +                             3 - per-op information],
  1.7576 +  JITREPORT_GRANULARITY=$withval,
  1.7577 +  JITREPORT_GRANULARITY=3)
  1.7578 +
  1.7579 +AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
  1.7580 +
  1.7581 +dnl ========================================================
  1.7582 +dnl =
  1.7583 +dnl = Misc. Options
  1.7584 +dnl =
  1.7585 +dnl ========================================================
  1.7586 +MOZ_ARG_HEADER(Misc. Options)
  1.7587 +
  1.7588 +dnl ========================================================
  1.7589 +dnl update xterm title
  1.7590 +dnl ========================================================
  1.7591 +MOZ_ARG_ENABLE_BOOL(xterm-updates,
  1.7592 +[  --enable-xterm-updates  Update XTERM titles with current command.],
  1.7593 +    MOZ_UPDATE_XTERM=1,
  1.7594 +    MOZ_UPDATE_XTERM= )
  1.7595 +
  1.7596 +dnl =========================================================
  1.7597 +dnl = Chrome format
  1.7598 +dnl =========================================================
  1.7599 +MOZ_ARG_ENABLE_STRING([chrome-format],
  1.7600 +[  --enable-chrome-format=jar|flat|omni
  1.7601 +                          Select FORMAT of chrome files during packaging],
  1.7602 +    MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
  1.7603 +
  1.7604 +if test -z "$MOZ_CHROME_FILE_FORMAT"; then
  1.7605 +    MOZ_CHROME_FILE_FORMAT=jar
  1.7606 +fi
  1.7607 +
  1.7608 +if test "$MOZ_CHROME_FILE_FORMAT" = "symlink"; then
  1.7609 +    AC_MSG_ERROR([--enable-chrome-format=symlink has been deprecated. It is now used by default in $DIST/bin on platforms that support it])
  1.7610 +fi
  1.7611 +
  1.7612 +if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
  1.7613 +    test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
  1.7614 +    test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
  1.7615 +    AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, or omni])
  1.7616 +fi
  1.7617 +
  1.7618 +dnl =========================================================
  1.7619 +dnl Omnijar packaging (bug 552121)
  1.7620 +dnl =========================================================
  1.7621 +dnl Omnijar packaging is compatible with flat packaging.
  1.7622 +dnl In unpackaged builds, omnijar looks for files as if
  1.7623 +dnl things were flat packaged. After packaging, all files
  1.7624 +dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
  1.7625 +dnl is set to flat since putting files into jars is only
  1.7626 +dnl done during packaging with omnijar.
  1.7627 +if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
  1.7628 +    MOZ_OMNIJAR=1
  1.7629 +    AC_DEFINE(MOZ_OMNIJAR)
  1.7630 +fi
  1.7631 +MOZ_PACKAGER_FORMAT="$MOZ_CHROME_FILE_FORMAT"
  1.7632 +if test "$OS_ARCH" = "WINNT" -o "$MOZ_WIDGET_TOOLKIT" = "android"; then
  1.7633 +    MOZ_CHROME_FILE_FORMAT=flat
  1.7634 +else
  1.7635 +    MOZ_CHROME_FILE_FORMAT=symlink
  1.7636 +fi
  1.7637 +
  1.7638 +if test "$MOZ_WIDGET_TOOLKIT" = "android"; then
  1.7639 +    dnl Fennec's static resources live in the assets/ folder of the
  1.7640 +    dnl APK.  Adding a path to the name here works because we only
  1.7641 +    dnl have one omnijar file in the final package (which is not the
  1.7642 +    dnl case on desktop), and necessitates some contortions during
  1.7643 +    dnl packaging so that the resources in the omnijar are considered
  1.7644 +    dnl as rooted at / and not as rooted at assets/ (which again is
  1.7645 +    dnl not the case on desktop: there are omnijars rooted at webrtc/,
  1.7646 +    dnl etc). packager.mk handles changing the rooting of the single
  1.7647 +    dnl omnijar.
  1.7648 +    OMNIJAR_NAME=assets/omni.ja
  1.7649 +else
  1.7650 +    OMNIJAR_NAME=omni.ja
  1.7651 +fi
  1.7652 +
  1.7653 +AC_SUBST(OMNIJAR_NAME)
  1.7654 +AC_SUBST(MOZ_OMNIJAR)
  1.7655 +AC_SUBST(MOZ_PACKAGER_FORMAT)
  1.7656 +
  1.7657 +dnl ========================================================
  1.7658 +dnl = Define default location for MOZILLA_FIVE_HOME
  1.7659 +dnl ========================================================
  1.7660 +MOZ_ARG_WITH_STRING(default-mozilla-five-home,
  1.7661 +[  --with-default-mozilla-five-home
  1.7662 +                          Set the default value for MOZILLA_FIVE_HOME],
  1.7663 +[ val=`echo $withval`
  1.7664 +  AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
  1.7665 +
  1.7666 +dnl ========================================================
  1.7667 +dnl = Location of the mozilla user directory (default is ~/.mozilla).],
  1.7668 +dnl ========================================================
  1.7669 +MOZ_ARG_WITH_STRING(user-appdir,
  1.7670 +[  --with-user-appdir=DIR  Set user-specific appdir (default=.mozilla)],
  1.7671 +[ val=`echo $withval`
  1.7672 +if echo "$val" | grep "\/" >/dev/null; then
  1.7673 +    AC_MSG_ERROR("Homedir must be single relative path.")
  1.7674 +else
  1.7675 +    MOZ_USER_DIR="$val"
  1.7676 +fi])
  1.7677 +
  1.7678 +AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
  1.7679 +
  1.7680 +dnl ========================================================
  1.7681 +dnl = Doxygen configuration
  1.7682 +dnl ========================================================
  1.7683 +dnl Use commas to specify multiple dirs to this arg
  1.7684 +MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
  1.7685 +MOZ_ARG_WITH_STRING(doc-input-dirs,
  1.7686 +[  --with-doc-input-dirs=DIRS
  1.7687 +                          Header/idl dirs to create docs from],
  1.7688 +[ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
  1.7689 +AC_SUBST(MOZ_DOC_INPUT_DIRS)
  1.7690 +
  1.7691 +dnl Use commas to specify multiple dirs to this arg
  1.7692 +MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
  1.7693 +MOZ_ARG_WITH_STRING(doc-include-dirs,
  1.7694 +[  --with-doc-include-dirs=DIRS
  1.7695 +                          Include dirs to preprocess doc headers],
  1.7696 +[ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
  1.7697 +AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
  1.7698 +
  1.7699 +MOZ_DOC_OUTPUT_DIR='./dist/docs'
  1.7700 +MOZ_ARG_WITH_STRING(doc-output-dir,
  1.7701 +[  --with-doc-output-dir=DIR
  1.7702 +                          Dir to generate docs into],
  1.7703 +[ MOZ_DOC_OUTPUT_DIR=$withval ] )
  1.7704 +AC_SUBST(MOZ_DOC_OUTPUT_DIR)
  1.7705 +
  1.7706 +if test -z "$SKIP_COMPILER_CHECKS"; then
  1.7707 +dnl ========================================================
  1.7708 +dnl =
  1.7709 +dnl = Compiler Options
  1.7710 +dnl =
  1.7711 +dnl ========================================================
  1.7712 +MOZ_ARG_HEADER(Compiler Options)
  1.7713 +
  1.7714 +dnl ========================================================
  1.7715 +dnl Check for gcc -pipe support
  1.7716 +dnl ========================================================
  1.7717 +AC_MSG_CHECKING([for -pipe support])
  1.7718 +if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
  1.7719 +    dnl Any gcc that supports firefox supports -pipe.
  1.7720 +    CFLAGS="$CFLAGS -pipe"
  1.7721 +    CXXFLAGS="$CXXFLAGS -pipe"
  1.7722 +    AC_MSG_RESULT([yes])
  1.7723 +else
  1.7724 +    AC_MSG_RESULT([no])
  1.7725 +fi
  1.7726 +
  1.7727 +dnl ========================================================
  1.7728 +dnl Profile guided optimization (gcc checks)
  1.7729 +dnl ========================================================
  1.7730 +dnl Test for profiling options
  1.7731 +dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
  1.7732 +
  1.7733 +_SAVE_CFLAGS="$CFLAGS"
  1.7734 +CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
  1.7735 +
  1.7736 +AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
  1.7737 +AC_TRY_COMPILE([], [return 0;],
  1.7738 +               [ PROFILE_GEN_CFLAGS="-fprofile-generate"
  1.7739 +                 result="yes" ], result="no")
  1.7740 +AC_MSG_RESULT([$result])
  1.7741 +
  1.7742 +if test $result = "yes"; then
  1.7743 +  PROFILE_GEN_LDFLAGS="-fprofile-generate"
  1.7744 +  PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
  1.7745 +  PROFILE_USE_LDFLAGS="-fprofile-use"
  1.7746 +fi
  1.7747 +
  1.7748 +CFLAGS="$_SAVE_CFLAGS"
  1.7749 +
  1.7750 +if test -n "$INTEL_CC"; then
  1.7751 +  PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
  1.7752 +  PROFILE_GEN_LDFLAGS=
  1.7753 +  PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
  1.7754 +  PROFILE_USE_LDFLAGS=
  1.7755 +fi
  1.7756 +
  1.7757 +dnl Sun Studio on Solaris
  1.7758 +if test "$SOLARIS_SUNPRO_CC"; then
  1.7759 +  PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
  1.7760 +  PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
  1.7761 +  PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
  1.7762 +  PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
  1.7763 +fi
  1.7764 +
  1.7765 +AC_SUBST(PROFILE_GEN_CFLAGS)
  1.7766 +AC_SUBST(PROFILE_GEN_LDFLAGS)
  1.7767 +AC_SUBST(PROFILE_USE_CFLAGS)
  1.7768 +AC_SUBST(PROFILE_USE_LDFLAGS)
  1.7769 +
  1.7770 +AC_LANG_CPLUSPLUS
  1.7771 +
  1.7772 +dnl ========================================================
  1.7773 +dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
  1.7774 +dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
  1.7775 +dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
  1.7776 +dnl ========================================================
  1.7777 +_SAVE_CXXFLAGS=$CXXFLAGS
  1.7778 +CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
  1.7779 +AC_CACHE_CHECK(for correct overload resolution with const and templates,
  1.7780 +    ac_nscap_nonconst_opeq_bug,
  1.7781 +    [AC_TRY_COMPILE([
  1.7782 +                      template <class T>
  1.7783 +                      class Pointer
  1.7784 +                        {
  1.7785 +                        public:
  1.7786 +                          T* myPtr;
  1.7787 +                        };
  1.7788 +
  1.7789 +                      template <class T, class U>
  1.7790 +                      int operator==(const Pointer<T>& rhs, U* lhs)
  1.7791 +                        {
  1.7792 +                          return rhs.myPtr == lhs;
  1.7793 +                        }
  1.7794 +
  1.7795 +                      template <class T, class U>
  1.7796 +                      int operator==(const Pointer<T>& rhs, const U* lhs)
  1.7797 +                        {
  1.7798 +                          return rhs.myPtr == lhs;
  1.7799 +                        }
  1.7800 +                    ],
  1.7801 +                    [
  1.7802 +                      Pointer<int> foo;
  1.7803 +                      const int* bar;
  1.7804 +                      return foo == bar;
  1.7805 +                    ],
  1.7806 +                    ac_nscap_nonconst_opeq_bug="no",
  1.7807 +                    ac_nscap_nonconst_opeq_bug="yes")])
  1.7808 +CXXFLAGS="$_SAVE_CXXFLAGS"
  1.7809 +
  1.7810 +if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
  1.7811 +    AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
  1.7812 +fi
  1.7813 +fi # ! SKIP_COMPILER_CHECKS
  1.7814 +
  1.7815 +AC_DEFINE(CPP_THROW_NEW, [throw()])
  1.7816 +AC_LANG_C
  1.7817 +
  1.7818 +if test "$COMPILE_ENVIRONMENT"; then
  1.7819 +MOZ_EXPAND_LIBS
  1.7820 +fi # COMPILE_ENVIRONMENT
  1.7821 +
  1.7822 +dnl ========================================================
  1.7823 +dnl =
  1.7824 +dnl = Build depencency options
  1.7825 +dnl =
  1.7826 +dnl ========================================================
  1.7827 +MOZ_ARG_HEADER(Build dependencies)
  1.7828 +
  1.7829 +if test "$GNU_CC" -a "$GNU_CXX"; then
  1.7830 +  _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
  1.7831 +dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
  1.7832 +elif test "$SOLARIS_SUNPRO_CC"; then
  1.7833 +  _DEPEND_CFLAGS=
  1.7834 +else
  1.7835 +  dnl Don't override this for MSVC
  1.7836 +  if test -z "$_WIN32_MSVC"; then
  1.7837 +    _USE_CPP_INCLUDE_FLAG=
  1.7838 +    _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
  1.7839 +    _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
  1.7840 +  else
  1.7841 +    echo '#include <stdio.h>' > dummy-hello.c
  1.7842 +    changequote(,)
  1.7843 +    dnl This output is localized, split at the first double space or colon and space.
  1.7844 +    _CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*stdio.h\)$"
  1.7845 +    CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'`
  1.7846 +    _CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'`
  1.7847 +    changequote([,])
  1.7848 +    if ! test -e "$_CL_STDIO_PATH"; then
  1.7849 +        AC_MSG_ERROR([Unable to parse cl -showIncludes prefix. This compiler's locale has an unsupported formatting.])
  1.7850 +    fi
  1.7851 +    if test -z "$CL_INCLUDES_PREFIX"; then
  1.7852 +        AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
  1.7853 +    fi
  1.7854 +    AC_SUBST(CL_INCLUDES_PREFIX)
  1.7855 +    rm -f dummy-hello.c
  1.7856 +
  1.7857 +    dnl Make sure that the build system can handle non-ASCII characters
  1.7858 +    dnl in environment variables to prevent it from breaking silently on
  1.7859 +    dnl non-English systems.
  1.7860 +    NONASCII=$'\241\241'
  1.7861 +    AC_SUBST(NONASCII)
  1.7862 +  fi
  1.7863 +fi
  1.7864 +
  1.7865 +dnl ========================================================
  1.7866 +dnl =
  1.7867 +dnl = Static Build Options
  1.7868 +dnl =
  1.7869 +dnl ========================================================
  1.7870 +MOZ_ARG_HEADER(Static build options)
  1.7871 +
  1.7872 +AC_SUBST(LIBXUL_LIBS)
  1.7873 +XPCOM_LIBS="$LIBXUL_LIBS"
  1.7874 +
  1.7875 +if test "$OS_ARCH" = "WINNT"; then
  1.7876 +  GKMEDIAS_SHARED_LIBRARY=1
  1.7877 +  AC_DEFINE(GKMEDIAS_SHARED_LIBRARY)
  1.7878 +fi
  1.7879 +AC_SUBST(GKMEDIAS_SHARED_LIBRARY)
  1.7880 +
  1.7881 +if test -z "$MOZ_NATIVE_ZLIB"; then
  1.7882 +if test -n "$JS_SHARED_LIBRARY" -o "$GKMEDIAS_SHARED_LIBRARY"; then
  1.7883 +  ZLIB_IN_MOZGLUE=1
  1.7884 +  AC_DEFINE(ZLIB_IN_MOZGLUE)
  1.7885 +fi
  1.7886 +fi
  1.7887 +
  1.7888 +AC_SUBST(ZLIB_IN_MOZGLUE)
  1.7889 +
  1.7890 +dnl ========================================================
  1.7891 +dnl =
  1.7892 +dnl = Standalone module options
  1.7893 +dnl =
  1.7894 +dnl ========================================================
  1.7895 +MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
  1.7896 +
  1.7897 +dnl Check for GLib.
  1.7898 +dnl ========================================================
  1.7899 +
  1.7900 +if test -z "$SKIP_PATH_CHECKS"; then
  1.7901 +if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
  1.7902 +    if test "$MOZ_ENABLE_GTK" ; then
  1.7903 +        PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
  1.7904 +    fi
  1.7905 +fi
  1.7906 +fi
  1.7907 +
  1.7908 +if test -z "${GLIB_GMODULE_LIBS}" \
  1.7909 +   -a -n "${GLIB_CONFIG}"\
  1.7910 +    -a "${GLIB_CONFIG}" != no\
  1.7911 +; then
  1.7912 +    GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
  1.7913 +fi
  1.7914 +
  1.7915 +AC_SUBST(GLIB_CFLAGS)
  1.7916 +AC_SUBST(GLIB_LIBS)
  1.7917 +AC_SUBST(GLIB_GMODULE_LIBS)
  1.7918 +
  1.7919 +dnl ========================================================
  1.7920 +dnl Graphics checks.
  1.7921 +dnl ========================================================
  1.7922 +
  1.7923 +if test "${OS_TARGET}" = "WINNT"; then
  1.7924 +  if $PERL -e "exit($MOZ_WINSDK_MAXVER < 0x06020000)"; then
  1.7925 +    MOZ_ENABLE_DIRECT2D1_1=1
  1.7926 +    AC_SUBST(MOZ_ENABLE_DIRECT2D1_1)
  1.7927 +  fi
  1.7928 +fi
  1.7929 +
  1.7930 +if test "${OS_TARGET}" = "WINNT" -o \
  1.7931 +        "${OS_ARCH}" = "Darwin" -o \
  1.7932 +        "${MOZ_WIDGET_TOOLKIT}" = "android" -o \
  1.7933 +        "${MOZ_WIDGET_TOOLKIT}" = "gonk" -o \
  1.7934 +        "${MOZ_WIDGET_TOOLKIT}" = "gtk2" -o \
  1.7935 +        "${MOZ_WIDGET_TOOLKIT}" = "gtk3"; then
  1.7936 +    case "${target_cpu}" in
  1.7937 +    i*86*|x86_64|arm)
  1.7938 +        MOZ_ENABLE_SKIA=1
  1.7939 +        ;;
  1.7940 +    *)
  1.7941 +        MOZ_ENABLE_SKIA=
  1.7942 +        ;;
  1.7943 +    esac
  1.7944 +else
  1.7945 +MOZ_ENABLE_SKIA=
  1.7946 +fi
  1.7947 +
  1.7948 +MOZ_ARG_ENABLE_BOOL(skia,
  1.7949 +[  --enable-skia   Enable use of Skia],
  1.7950 +MOZ_ENABLE_SKIA=1,
  1.7951 +MOZ_ENABLE_SKIA=)
  1.7952 +
  1.7953 +if test "$USE_FC_FREETYPE"; then
  1.7954 +    if test "$COMPILE_ENVIRONMENT"; then
  1.7955 +        dnl ========================================================
  1.7956 +        dnl = Check for freetype2 and its functionality
  1.7957 +        dnl ========================================================
  1.7958 +        PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
  1.7959 +
  1.7960 +        if test "$_HAVE_FREETYPE2"; then
  1.7961 +            _SAVE_LIBS="$LIBS"
  1.7962 +            _SAVE_CFLAGS="$CFLAGS"
  1.7963 +            LIBS="$LIBS $FT2_LIBS"
  1.7964 +            CFLAGS="$CFLAGS $FT2_CFLAGS"
  1.7965 +
  1.7966 +            AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
  1.7967 +                ac_cv_member_FT_Bitmap_Size_y_ppem,
  1.7968 +                [AC_TRY_COMPILE([#include <ft2build.h>
  1.7969 +                                 #include FT_FREETYPE_H],
  1.7970 +                                [FT_Bitmap_Size s;
  1.7971 +                                 if (sizeof s.y_ppem) return 0;
  1.7972 +                                 return 1],
  1.7973 +                                ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
  1.7974 +                                ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
  1.7975 +            if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
  1.7976 +                HAVE_FT_BITMAP_SIZE_Y_PPEM=1
  1.7977 +            else
  1.7978 +                HAVE_FT_BITMAP_SIZE_Y_PPEM=0
  1.7979 +            fi
  1.7980 +            AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
  1.7981 +                               $HAVE_FT_BITMAP_SIZE_Y_PPEM,
  1.7982 +                               [FT_Bitmap_Size structure includes y_ppem field])
  1.7983 +
  1.7984 +            AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
  1.7985 +
  1.7986 +            LIBS="$_SAVE_LIBS"
  1.7987 +            CFLAGS="$_SAVE_CFLAGS"
  1.7988 +        fi
  1.7989 +
  1.7990 +        _SAVE_CPPFLAGS="$CPPFLAGS"
  1.7991 +        CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
  1.7992 +        MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
  1.7993 +            [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
  1.7994 +        CPPFLAGS="$_SAVE_CPPFLAGS"
  1.7995 +    else
  1.7996 +        AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
  1.7997 +    fi
  1.7998 +
  1.7999 +    PKG_CHECK_MODULES(_FONTCONFIG, fontconfig,
  1.8000 +    [
  1.8001 +        if test "$MOZ_PANGO"; then
  1.8002 +            MOZ_PANGO_CFLAGS="$MOZ_PANGO_CFLAGS $_FONTCONFIG_CFLAGS"
  1.8003 +            MOZ_PANGO_LIBS="$MOZ_PANGO_LIBS $_FONTCONFIG_LIBS"
  1.8004 +        else
  1.8005 +            FT2_CFLAGS="$FT2_CFLAGS $_FONTCONFIG_CFLAGS"
  1.8006 +            FT2_LIBS="$FT2_LIBS $_FONTCONFIG_LIBS"
  1.8007 +        fi
  1.8008 +    ])
  1.8009 +fi
  1.8010 +
  1.8011 +dnl ========================================================
  1.8012 +dnl Check for pixman and cairo
  1.8013 +dnl ========================================================
  1.8014 +
  1.8015 +if test "$MOZ_WIDGET_TOOLKIT" = "gtk3" ; then
  1.8016 +  # cairo-gtk3 can be build with system-cairo only
  1.8017 +  MOZ_TREE_CAIRO=
  1.8018 +else
  1.8019 +  MOZ_TREE_CAIRO=1
  1.8020 +fi
  1.8021 +
  1.8022 +MOZ_ARG_ENABLE_BOOL(system-cairo,
  1.8023 +[  --enable-system-cairo   Use system cairo (located with pkgconfig)],
  1.8024 +MOZ_TREE_CAIRO=,
  1.8025 +MOZ_TREE_CAIRO=1 )
  1.8026 +
  1.8027 +MOZ_TREE_PIXMAN=1
  1.8028 +MOZ_ARG_ENABLE_BOOL(system-pixman,
  1.8029 +[ --enable-system-pixman Use system pixman (located with pkgconfig)],
  1.8030 +MOZ_TREE_PIXMAN=,
  1.8031 +MOZ_TREE_PIXMAN=force,
  1.8032 +MOZ_TREE_PIXMAN=1 )
  1.8033 +
  1.8034 +# System cairo depends on system pixman
  1.8035 +if test "$MOZ_TREE_PIXMAN" = "force"; then
  1.8036 +    if test -z "$MOZ_TREE_CAIRO"; then
  1.8037 +        AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
  1.8038 +    else
  1.8039 +        MOZ_TREE_PIXMAN=1
  1.8040 +    fi
  1.8041 +elif test -z "$MOZ_TREE_CAIRO"; then
  1.8042 +    MOZ_TREE_PIXMAN=
  1.8043 +fi
  1.8044 +
  1.8045 +if test "$MOZ_TREE_PIXMAN"; then
  1.8046 +    AC_DEFINE(MOZ_TREE_PIXMAN)
  1.8047 +    MOZ_PIXMAN_CFLAGS=""
  1.8048 +    MOZ_PIXMAN_LIBS='$(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
  1.8049 +else
  1.8050 +    PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
  1.8051 +    MOZ_PIXMAN_CFLAGS="$PIXMAN_CFLAGS"
  1.8052 +    MOZ_PIXMAN_LIBS="$PIXMAN_LIBS"
  1.8053 +fi
  1.8054 +AC_SUBST(MOZ_PIXMAN_CFLAGS)
  1.8055 +AC_SUBST(MOZ_PIXMAN_LIBS)
  1.8056 +
  1.8057 +# Check for headers defining standard int types.
  1.8058 +if test -n "$COMPILE_ENVIRONMENT"; then
  1.8059 +    MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
  1.8060 +fi
  1.8061 +
  1.8062 +if test "$MOZ_TREE_CAIRO"; then
  1.8063 +    MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
  1.8064 +    AC_DEFINE(MOZ_TREE_CAIRO)
  1.8065 +
  1.8066 +    if test "$OS_ARCH" = "WINNT"; then
  1.8067 +        # For now we assume that we will have a uint64_t available through
  1.8068 +        # one of the above headers or mozstdint.h.
  1.8069 +        AC_DEFINE(HAVE_UINT64_T)
  1.8070 +    fi
  1.8071 +
  1.8072 +    # Define macros for cairo-features.h
  1.8073 +    TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
  1.8074 +    if test "$MOZ_X11"; then
  1.8075 +        XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
  1.8076 +        XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
  1.8077 +        PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
  1.8078 +        FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
  1.8079 +        MOZ_ENABLE_CAIRO_FT=1
  1.8080 +        CAIRO_FT_CFLAGS="$FT2_CFLAGS"
  1.8081 +    fi
  1.8082 +    case "$MOZ_WIDGET_TOOLKIT" in
  1.8083 +      qt)
  1.8084 +        QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
  1.8085 +        ;;
  1.8086 +      cocoa | uikit)
  1.8087 +        QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
  1.8088 +        QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
  1.8089 +        QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
  1.8090 +        ;;
  1.8091 +      windows)
  1.8092 +        WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
  1.8093 +        WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
  1.8094 +        if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
  1.8095 +            WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
  1.8096 +            WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
  1.8097 +            MOZ_ENABLE_D2D_SURFACE=1
  1.8098 +            MOZ_ENABLE_DWRITE_FONT=1
  1.8099 +        else
  1.8100 +            WIN32_DWRITE_FONT_FEATURE=
  1.8101 +            WIN32_D2D_SURFACE_FEATURE=
  1.8102 +        fi
  1.8103 +
  1.8104 +        MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
  1.8105 +
  1.8106 +        dnl D3D10 Layers depend on D2D Surfaces.
  1.8107 +        if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
  1.8108 +          MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
  1.8109 +        fi
  1.8110 +        ;;
  1.8111 +      gtk3)
  1.8112 +        AC_MSG_ERROR([cairo-gtk3 toolkit is incompatible with in-tree cairo. Please add --enable-system-cairo to your build config.])
  1.8113 +        ;;
  1.8114 +    esac
  1.8115 +    if test "$USE_FC_FREETYPE"; then
  1.8116 +        FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
  1.8117 +    fi
  1.8118 +    AC_SUBST(MOZ_ENABLE_CAIRO_FT)
  1.8119 +    AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
  1.8120 +    AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
  1.8121 +    AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
  1.8122 +    AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
  1.8123 +    AC_SUBST(CAIRO_FT_CFLAGS)
  1.8124 +
  1.8125 +    AC_SUBST(PS_SURFACE_FEATURE)
  1.8126 +    AC_SUBST(PDF_SURFACE_FEATURE)
  1.8127 +    AC_SUBST(SVG_SURFACE_FEATURE)
  1.8128 +    AC_SUBST(XLIB_SURFACE_FEATURE)
  1.8129 +    AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
  1.8130 +    AC_SUBST(QUARTZ_SURFACE_FEATURE)
  1.8131 +    AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
  1.8132 +    AC_SUBST(WIN32_SURFACE_FEATURE)
  1.8133 +    AC_SUBST(OS2_SURFACE_FEATURE)
  1.8134 +    AC_SUBST(DIRECTFB_SURFACE_FEATURE)
  1.8135 +    AC_SUBST(FT_FONT_FEATURE)
  1.8136 +    AC_SUBST(FC_FONT_FEATURE)
  1.8137 +    AC_SUBST(WIN32_FONT_FEATURE)
  1.8138 +    AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
  1.8139 +    AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
  1.8140 +    AC_SUBST(QUARTZ_FONT_FEATURE)
  1.8141 +    AC_SUBST(PNG_FUNCTIONS_FEATURE)
  1.8142 +    AC_SUBST(QT_SURFACE_FEATURE)
  1.8143 +    AC_SUBST(TEE_SURFACE_FEATURE)
  1.8144 +
  1.8145 +    MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}'
  1.8146 +
  1.8147 +    if test "$MOZ_X11"; then
  1.8148 +        MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
  1.8149 +    fi
  1.8150 +
  1.8151 +    CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
  1.8152 +else
  1.8153 +    PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
  1.8154 +    MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
  1.8155 +    MOZ_CAIRO_LIBS="$CAIRO_LIBS"
  1.8156 +    PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
  1.8157 +    if test "$MOZ_X11"; then
  1.8158 +        PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
  1.8159 +        MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
  1.8160 +        MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
  1.8161 +        MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
  1.8162 +    fi
  1.8163 +fi
  1.8164 +
  1.8165 +AC_SUBST(MOZ_TREE_CAIRO)
  1.8166 +AC_SUBST(MOZ_CAIRO_CFLAGS)
  1.8167 +AC_SUBST(MOZ_CAIRO_LIBS)
  1.8168 +AC_SUBST(MOZ_CAIRO_OSLIBS)
  1.8169 +AC_SUBST(MOZ_TREE_PIXMAN)
  1.8170 +
  1.8171 +dnl ========================================================
  1.8172 +dnl Skia
  1.8173 +dnl ========================================================
  1.8174 +if test "$MOZ_ENABLE_SKIA"; then
  1.8175 +  AC_DEFINE(MOZ_ENABLE_SKIA)
  1.8176 +  AC_DEFINE(USE_SKIA)
  1.8177 +  if test "${MOZ_WIDGET_TOOLKIT}" = "android" -o x"$MOZ_WIDGET_TOOLKIT" = x"gonk"; then
  1.8178 +    AC_DEFINE(SK_BUILD_FOR_ANDROID_NDK)
  1.8179 +  fi
  1.8180 +
  1.8181 +  if test "${CPU_ARCH}" != "ppc" -a "${CPU_ARCH}" != "ppc64" -a "${CPU_ARCH}" != "sparc" ; then
  1.8182 +    MOZ_ENABLE_SKIA_GPU=1
  1.8183 +    AC_DEFINE(USE_SKIA_GPU)
  1.8184 +    AC_SUBST(MOZ_ENABLE_SKIA_GPU)
  1.8185 +  fi
  1.8186 +fi
  1.8187 +AC_SUBST(MOZ_ENABLE_SKIA)
  1.8188 +
  1.8189 +dnl ========================================================
  1.8190 +dnl disable xul
  1.8191 +dnl ========================================================
  1.8192 +MOZ_ARG_DISABLE_BOOL(xul,
  1.8193 +[  --disable-xul           Disable XUL],
  1.8194 +    MOZ_XUL= )
  1.8195 +if test "$MOZ_XUL"; then
  1.8196 +  AC_DEFINE(MOZ_XUL)
  1.8197 +else
  1.8198 +  dnl remove extensions that require XUL
  1.8199 +  MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
  1.8200 +fi
  1.8201 +
  1.8202 +AC_SUBST(MOZ_XUL)
  1.8203 +
  1.8204 +dnl ========================================================
  1.8205 +dnl disable profile locking
  1.8206 +dnl   do no use this in applications that can have more than
  1.8207 +dnl   one process accessing the profile directory.
  1.8208 +dnl ========================================================
  1.8209 +MOZ_ARG_DISABLE_BOOL(profilelocking,
  1.8210 +[  --disable-profilelocking
  1.8211 +                          Disable profile locking],
  1.8212 +    MOZ_PROFILELOCKING=,
  1.8213 +    MOZ_PROFILELOCKING=1 )
  1.8214 +if test "$MOZ_PROFILELOCKING"; then
  1.8215 +  AC_DEFINE(MOZ_PROFILELOCKING)
  1.8216 +fi
  1.8217 +
  1.8218 +dnl ========================================================
  1.8219 +dnl necko configuration options
  1.8220 +dnl ========================================================
  1.8221 +
  1.8222 +dnl
  1.8223 +dnl option to disable various necko protocols
  1.8224 +dnl
  1.8225 +MOZ_ARG_ENABLE_STRING(necko-protocols,
  1.8226 +[  --enable-necko-protocols[={http,ftp,default,all,none}]
  1.8227 +                          Enable/disable specific protocol handlers],
  1.8228 +[ for option in `echo $enableval | sed 's/,/ /g'`; do
  1.8229 +    if test "$option" = "yes" -o "$option" = "all"; then
  1.8230 +        NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
  1.8231 +    elif test "$option" = "no" -o "$option" = "none"; then
  1.8232 +        NECKO_PROTOCOLS=""
  1.8233 +    elif test "$option" = "default"; then
  1.8234 +        NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
  1.8235 +    elif test `echo "$option" | grep -c \^-` != 0; then
  1.8236 +        option=`echo $option | sed 's/^-//'`
  1.8237 +        NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
  1.8238 +    else
  1.8239 +        NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
  1.8240 +    fi
  1.8241 +done],
  1.8242 +    NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
  1.8243 +dnl Remove dupes
  1.8244 +NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
  1.8245 +AC_SUBST_SET(NECKO_PROTOCOLS)
  1.8246 +for p in $NECKO_PROTOCOLS; do
  1.8247 +    AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
  1.8248 +    _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_PROTOCOL_$p"
  1.8249 +done
  1.8250 +
  1.8251 +dnl
  1.8252 +dnl option to disable necko's wifi scanner
  1.8253 +dnl
  1.8254 +
  1.8255 +case "$OS_TARGET" in
  1.8256 +  Android)
  1.8257 +    if test -n "$gonkdir"; then
  1.8258 +      NECKO_WIFI=1
  1.8259 +    fi
  1.8260 +    ;;
  1.8261 +  Darwin|FreeBSD|SunOS|WINNT)
  1.8262 +    NECKO_WIFI=1
  1.8263 +    ;;
  1.8264 +  Linux)
  1.8265 +    NECKO_WIFI=1
  1.8266 +    NECKO_WIFI_DBUS=1
  1.8267 +    ;;
  1.8268 +esac
  1.8269 +
  1.8270 +MOZ_ARG_DISABLE_BOOL(necko-wifi,
  1.8271 +[  --disable-necko-wifi    Disable necko wifi scanner],
  1.8272 +    NECKO_WIFI=,
  1.8273 +    NECKO_WIFI=1)
  1.8274 +
  1.8275 +if test "$NECKO_WIFI"; then
  1.8276 +  if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
  1.8277 +    AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
  1.8278 +  fi
  1.8279 +  AC_DEFINE(NECKO_WIFI)
  1.8280 +  _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
  1.8281 +fi
  1.8282 +AC_SUBST(NECKO_WIFI)
  1.8283 +AC_SUBST(NECKO_WIFI_DBUS)
  1.8284 +
  1.8285 +dnl
  1.8286 +dnl option to disable cookies
  1.8287 +dnl
  1.8288 +MOZ_ARG_DISABLE_BOOL(cookies,
  1.8289 +[  --disable-cookies       Disable cookie support],
  1.8290 +    NECKO_COOKIES=,
  1.8291 +    NECKO_COOKIES=1)
  1.8292 +AC_SUBST(NECKO_COOKIES)
  1.8293 +if test "$NECKO_COOKIES"; then
  1.8294 +    AC_DEFINE(NECKO_COOKIES)
  1.8295 +    _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
  1.8296 +fi
  1.8297 +
  1.8298 +dnl
  1.8299 +dnl Always build Marionette if not Android or B2G
  1.8300 +dnl
  1.8301 +if test "$OS_TARGET" != Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
  1.8302 +    AC_DEFINE(ENABLE_MARIONETTE)
  1.8303 +fi
  1.8304 +AC_SUBST(ENABLE_MARIONETTE)
  1.8305 +if test "$ENABLE_MARIONETTE"; then
  1.8306 +    AC_DEFINE(ENABLE_MARIONETTE)
  1.8307 +fi
  1.8308 +
  1.8309 +dnl
  1.8310 +dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
  1.8311 +dnl
  1.8312 +MOZ_ARG_DISABLE_BOOL(ctypes,
  1.8313 +[  --disable-ctypes        Disable js-ctypes],
  1.8314 +    BUILD_CTYPES=,
  1.8315 +    BUILD_CTYPES=1)
  1.8316 +AC_SUBST(BUILD_CTYPES)
  1.8317 +if test "$BUILD_CTYPES"; then
  1.8318 +    AC_DEFINE(BUILD_CTYPES)
  1.8319 +fi
  1.8320 +
  1.8321 +dnl Build Places if required
  1.8322 +if test "$MOZ_PLACES"; then
  1.8323 +  AC_DEFINE(MOZ_PLACES)
  1.8324 +fi
  1.8325 +
  1.8326 +dnl Build SocialAPI if required
  1.8327 +if test "$MOZ_SOCIAL"; then
  1.8328 +  AC_DEFINE(MOZ_SOCIAL)
  1.8329 +fi
  1.8330 +
  1.8331 +dnl Build Common JS modules provided by services.
  1.8332 +AC_SUBST(MOZ_SERVICES_COMMON)
  1.8333 +if test -n "$MOZ_SERVICES_COMMON"; then
  1.8334 +  AC_DEFINE(MOZ_SERVICES_COMMON)
  1.8335 +fi
  1.8336 +
  1.8337 +dnl Build Services crypto component (used by Sync)
  1.8338 +AC_SUBST(MOZ_SERVICES_CRYPTO)
  1.8339 +if test -n "$MOZ_SERVICES_CRYPTO"; then
  1.8340 +  AC_DEFINE(MOZ_SERVICES_CRYPTO)
  1.8341 +fi
  1.8342 +
  1.8343 +dnl Build Firefox Health Reporter Service
  1.8344 +AC_SUBST(MOZ_SERVICES_HEALTHREPORT)
  1.8345 +if test -n "$MOZ_SERVICES_HEALTHREPORT"; then
  1.8346 +  AC_DEFINE(MOZ_SERVICES_HEALTHREPORT)
  1.8347 +fi
  1.8348 +
  1.8349 +dnl Build Services metrics component
  1.8350 +AC_SUBST(MOZ_SERVICES_METRICS)
  1.8351 +if test -n "$MOZ_SERVICES_METRICS"; then
  1.8352 +  AC_DEFINE(MOZ_SERVICES_METRICS)
  1.8353 +fi
  1.8354 +
  1.8355 +dnl Build Notifications if required
  1.8356 +AC_SUBST(MOZ_SERVICES_NOTIFICATIONS)
  1.8357 +if test -n "$MOZ_SERVICES_NOTIFICATIONS"; then
  1.8358 +  AC_DEFINE(MOZ_SERVICES_NOTIFICATIONS)
  1.8359 +fi
  1.8360 +
  1.8361 +dnl Build Sync Services if required
  1.8362 +AC_SUBST(MOZ_SERVICES_SYNC)
  1.8363 +if test -n "$MOZ_SERVICES_SYNC"; then
  1.8364 +  AC_DEFINE(MOZ_SERVICES_SYNC)
  1.8365 +fi
  1.8366 +
  1.8367 +dnl Build Captive Portal Detector if required
  1.8368 +AC_SUBST(MOZ_CAPTIVEDETECT)
  1.8369 +if test -n "$MOZ_CAPTIVEDETECT"; then
  1.8370 +  AC_DEFINE(MOZ_CAPTIVEDETECT)
  1.8371 +fi
  1.8372 +
  1.8373 +dnl ========================================================
  1.8374 +if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
  1.8375 +    MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
  1.8376 +fi
  1.8377 +
  1.8378 +if test "$MOZ_APP_COMPONENT_INCLUDE"; then
  1.8379 +  AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
  1.8380 +fi
  1.8381 +
  1.8382 +if test "$MOZ_APP_COMPONENT_MODULES"; then
  1.8383 +  AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_MODULES, $MOZ_APP_COMPONENT_MODULES)
  1.8384 +fi
  1.8385 +
  1.8386 +dnl ========================================================
  1.8387 +dnl =
  1.8388 +dnl = Maintainer debug option (no --enable equivalent)
  1.8389 +dnl =
  1.8390 +dnl ========================================================
  1.8391 +
  1.8392 +AC_SUBST(AR)
  1.8393 +AC_SUBST(AR_FLAGS)
  1.8394 +AC_SUBST(AR_LIST)
  1.8395 +AC_SUBST(AR_EXTRACT)
  1.8396 +AC_SUBST(AR_DELETE)
  1.8397 +AC_SUBST(AS)
  1.8398 +AC_SUBST(ASFLAGS)
  1.8399 +AC_SUBST(AS_DASH_C_FLAG)
  1.8400 +AC_SUBST(LD)
  1.8401 +AC_SUBST(RC)
  1.8402 +AC_SUBST(RCFLAGS)
  1.8403 +AC_SUBST(MC)
  1.8404 +AC_SUBST(WINDRES)
  1.8405 +AC_SUBST(IMPLIB)
  1.8406 +AC_SUBST(FILTER)
  1.8407 +AC_SUBST(BIN_FLAGS)
  1.8408 +AC_SUBST(MOZ_WIDGET_TOOLKIT)
  1.8409 +AC_SUBST(MOZ_UPDATE_XTERM)
  1.8410 +AC_SUBST(MOZ_AUTH_EXTENSION)
  1.8411 +AC_SUBST(MOZ_PERMISSIONS)
  1.8412 +AC_SUBST(MOZ_PREF_EXTENSIONS)
  1.8413 +AC_SUBST(MOZ_JS_LIBS)
  1.8414 +AC_SUBST(MOZ_DEBUG)
  1.8415 +AC_SUBST(MOZ_DEBUG_SYMBOLS)
  1.8416 +AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
  1.8417 +AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
  1.8418 +AC_SUBST(MOZ_DEBUG_LDFLAGS)
  1.8419 +AC_SUBST(WARNINGS_AS_ERRORS)
  1.8420 +AC_SUBST(MOZ_EXTENSIONS)
  1.8421 +AC_SUBST(MOZ_JSDEBUGGER)
  1.8422 +AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
  1.8423 +AC_SUBST(MOZ_JPROF)
  1.8424 +AC_SUBST(MOZ_SHARK)
  1.8425 +AC_SUBST(MOZ_INSTRUMENTS)
  1.8426 +AC_SUBST(MOZ_CALLGRIND)
  1.8427 +AC_SUBST(MOZ_VTUNE)
  1.8428 +AC_SUBST(MOZ_PROFILING)
  1.8429 +AC_SUBST(LIBICONV)
  1.8430 +AC_SUBST(MOZ_PLACES)
  1.8431 +AC_SUBST(MOZ_SOCIAL)
  1.8432 +AC_SUBST(MOZ_TOOLKIT_SEARCH)
  1.8433 +AC_SUBST(MOZ_FEEDS)
  1.8434 +AC_SUBST(NS_PRINTING)
  1.8435 +AC_SUBST(MOZ_WEBGL)
  1.8436 +AC_SUBST(MOZ_HELP_VIEWER)
  1.8437 +AC_SUBST(TOOLCHAIN_PREFIX)
  1.8438 +
  1.8439 +AC_SUBST(JAVA)
  1.8440 +AC_SUBST(JAVAC)
  1.8441 +AC_SUBST(JAVAH)
  1.8442 +AC_SUBST(JAR)
  1.8443 +AC_SUBST(JARSIGNER)
  1.8444 +AC_SUBST(KEYTOOL)
  1.8445 +
  1.8446 +AC_SUBST(MOZ_PROFILELOCKING)
  1.8447 +
  1.8448 +AC_SUBST(ENABLE_TESTS)
  1.8449 +AC_SUBST(MOZ_UNIVERSALCHARDET)
  1.8450 +AC_SUBST(ACCESSIBILITY)
  1.8451 +AC_SUBST(MOZ_SPELLCHECK)
  1.8452 +AC_SUBST(MOZ_ANDROID_OMTC)
  1.8453 +AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
  1.8454 +AC_SUBST(MOZ_CRASHREPORTER)
  1.8455 +AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
  1.8456 +AC_SUBST(MOZ_CRASHREPORTER_UPLOAD_FULL_SYMBOLS)
  1.8457 +AC_SUBST(MOZ_MAINTENANCE_SERVICE)
  1.8458 +AC_SUBST(MOZ_STUB_INSTALLER)
  1.8459 +AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
  1.8460 +AC_SUBST(MOZ_ENABLE_SIGNMAR)
  1.8461 +AC_SUBST(MOZ_UPDATER)
  1.8462 +
  1.8463 +AC_SUBST(MOZ_ANGLE_RENDERER)
  1.8464 +AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
  1.8465 +AC_SUBST(MOZ_DIRECTX_SDK_PATH)
  1.8466 +AC_SUBST(MOZ_D3DCOMPILER_DLL)
  1.8467 +AC_SUBST(MOZ_HAS_WINSDK_WITH_D3D)
  1.8468 +AC_SUBST(MOZ_D3DCOMPILER_DLL_PATH)
  1.8469 +AC_SUBST(MOZ_D3DCOMPILER_CAB)
  1.8470 +
  1.8471 +AC_SUBST(MOZ_METRO)
  1.8472 +
  1.8473 +AC_SUBST(MOZ_ANDROID_HISTORY)
  1.8474 +AC_SUBST(MOZ_WEBSMS_BACKEND)
  1.8475 +AC_SUBST(MOZ_ANDROID_BEAM)
  1.8476 +AC_SUBST(MOZ_ANDROID_SYNTHAPKS)
  1.8477 +AC_SUBST(MOZ_DISABLE_GECKOVIEW)
  1.8478 +AC_SUBST(ENABLE_STRIP)
  1.8479 +AC_SUBST(PKG_SKIP_STRIP)
  1.8480 +AC_SUBST(STRIP_FLAGS)
  1.8481 +AC_SUBST(USE_ELF_HACK)
  1.8482 +AC_SUBST(INCREMENTAL_LINKER)
  1.8483 +AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
  1.8484 +AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
  1.8485 +
  1.8486 +AC_SUBST(MOZ_FIX_LINK_PATHS)
  1.8487 +AC_SUBST(XPCOM_LIBS)
  1.8488 +AC_SUBST(XPCOM_FROZEN_LDOPTS)
  1.8489 +AC_SUBST(XPCOM_GLUE_LDOPTS)
  1.8490 +AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
  1.8491 +AC_SUBST(XPCOM_STATICRUNTIME_GLUE_LDOPTS)
  1.8492 +AC_SUBST(XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS)
  1.8493 +
  1.8494 +AC_SUBST(USE_DEPENDENT_LIBS)
  1.8495 +
  1.8496 +AC_SUBST(MOZ_BUILD_ROOT)
  1.8497 +
  1.8498 +AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
  1.8499 +AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
  1.8500 +AC_SUBST(MOZ_LINKER_EXTRACT)
  1.8501 +
  1.8502 +AC_SUBST(MOZ_JSDOWNLOADS)
  1.8503 +if test -n "$MOZ_JSDOWNLOADS"; then
  1.8504 +  AC_DEFINE(MOZ_JSDOWNLOADS)
  1.8505 +fi
  1.8506 +
  1.8507 +dnl ========================================================
  1.8508 +dnl = Mac bundle name prefix
  1.8509 +dnl ========================================================
  1.8510 +MOZ_ARG_WITH_STRING(macbundlename-prefix,
  1.8511 +[  --with-macbundlename-prefix=prefix
  1.8512 +                          Prefix for MOZ_MACBUNDLE_NAME],
  1.8513 +[ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
  1.8514 +
  1.8515 +MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
  1.8516 +if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
  1.8517 +  MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
  1.8518 +fi
  1.8519 +
  1.8520 +if test "$MOZ_DEBUG"; then
  1.8521 +  MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
  1.8522 +else
  1.8523 +  MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
  1.8524 +fi
  1.8525 +AC_SUBST(MOZ_MACBUNDLE_NAME)
  1.8526 +
  1.8527 +dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
  1.8528 +MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
  1.8529 +MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
  1.8530 +if test "$MOZ_DEBUG"; then
  1.8531 +  MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
  1.8532 +fi
  1.8533 +
  1.8534 +AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
  1.8535 +AC_SUBST(MOZ_MACBUNDLE_ID)
  1.8536 +
  1.8537 +dnl ========================================================
  1.8538 +dnl = Child Process Name for IPC
  1.8539 +dnl ========================================================
  1.8540 +if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
  1.8541 +  MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
  1.8542 +else
  1.8543 +  # We want to let Android unpack the file at install time, but it only does
  1.8544 +  # so if the file is named libsomething.so. The lib/ path is also required
  1.8545 +  # because the unpacked file will be under the lib/ subdirectory and will
  1.8546 +  # need to be executed from that path.
  1.8547 +  MOZ_CHILD_PROCESS_NAME="lib/libplugin-container.so"
  1.8548 +fi
  1.8549 +MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
  1.8550 +
  1.8551 +AC_SUBST(MOZ_CHILD_PROCESS_NAME)
  1.8552 +AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
  1.8553 +
  1.8554 +# The following variables are available to branding and application
  1.8555 +# configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
  1.8556 +# - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
  1.8557 +# impacts profile location and user-visible fields.
  1.8558 +# - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
  1.8559 +# versions of a given application (e.g. Aurora and Firefox both use
  1.8560 +# "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
  1.8561 +# for application.ini's "Name" field, which controls profile location in
  1.8562 +# the absence of a "Profile" field (see below), and various system
  1.8563 +# integration hooks (Unix remoting, Windows MessageWindow name, etc.)
  1.8564 +# - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
  1.8565 +# Mac Bundle name, Updater, Installer), it is typically used for nightly
  1.8566 +# builds (e.g. Aurora for Firefox).
  1.8567 +# - MOZ_APP_VERSION: Defines the application version number.
  1.8568 +# - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
  1.8569 +# defaults to a lowercase form of MOZ_APP_BASENAME.
  1.8570 +# - MOZ_APP_PROFILE: When set, used for application.ini's
  1.8571 +# "Profile" field, which controls profile location.
  1.8572 +# - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
  1.8573 +# crash reporter server url.
  1.8574 +# - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
  1.8575 +# - MOZ_EXTENSION_MANAGER: When set, enabled extension manager.
  1.8576 +
  1.8577 +if test -z "$MOZ_APP_NAME"; then
  1.8578 +   MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
  1.8579 +fi
  1.8580 +
  1.8581 +# For extensions and langpacks, we require a max version that is compatible
  1.8582 +# across security releases. MOZ_APP_MAXVERSION is our method for doing that.
  1.8583 +# 24.0a1 and 24.0a2 aren't affected
  1.8584 +# 24.0 becomes 24.*
  1.8585 +# 24.1.1 becomes 24.*
  1.8586 +IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
  1.8587 +if test -z "$IS_ALPHA"; then
  1.8588 +  changequote(,)
  1.8589 +  MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
  1.8590 +  changequote([,])
  1.8591 +else
  1.8592 +  MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
  1.8593 +fi
  1.8594 +
  1.8595 +MOZ_B2G_VERSION=${MOZ_B2G_VERSION:-"1.0.0"}
  1.8596 +AC_DEFINE_UNQUOTED(MOZ_B2G_VERSION,"$MOZ_B2G_VERSION")
  1.8597 +AC_DEFINE_UNQUOTED(MOZ_B2G_OS_NAME,"$MOZ_B2G_OS_NAME")
  1.8598 +
  1.8599 +AC_SUBST(MOZ_APP_NAME)
  1.8600 +AC_SUBST(MOZ_APP_DISPLAYNAME)
  1.8601 +AC_SUBST(MOZ_APP_BASENAME)
  1.8602 +AC_SUBST(MOZ_APP_VENDOR)
  1.8603 +AC_SUBST(MOZ_APP_PROFILE)
  1.8604 +AC_SUBST(MOZ_APP_ID)
  1.8605 +AC_SUBST(MAR_CHANNEL_ID)
  1.8606 +AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
  1.8607 +AC_SUBST(MOZ_PROFILE_MIGRATOR)
  1.8608 +AC_SUBST(MOZ_EXTENSION_MANAGER)
  1.8609 +AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
  1.8610 +AC_SUBST(MOZ_APP_UA_NAME)
  1.8611 +AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
  1.8612 +AC_SUBST(MOZ_APP_VERSION)
  1.8613 +AC_SUBST(MOZ_APP_MAXVERSION)
  1.8614 +AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
  1.8615 +AC_SUBST(FIREFOX_VERSION)
  1.8616 +AC_SUBST(MOZ_UA_OS_AGNOSTIC)
  1.8617 +if test -n "$MOZ_UA_OS_AGNOSTIC"; then
  1.8618 +  AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
  1.8619 +fi
  1.8620 +
  1.8621 +AC_SUBST(MOZ_APP_STATIC_INI)
  1.8622 +
  1.8623 +AC_SUBST(MOZ_PKG_SPECIAL)
  1.8624 +
  1.8625 +AC_SUBST(MOZILLA_OFFICIAL)
  1.8626 +
  1.8627 +AC_DEFINE_UNQUOTED(MOZ_TELEMETRY_DISPLAY_REV, 2)
  1.8628 +AC_SUBST(MOZ_TELEMETRY_DISPLAY_REV)
  1.8629 +
  1.8630 +if test "$MOZ_TELEMETRY_REPORTING"; then
  1.8631 +    AC_DEFINE(MOZ_TELEMETRY_REPORTING)
  1.8632 +
  1.8633 +    # Enable Telemetry by default for nightly and aurora channels
  1.8634 +    if test -z "$RELEASE_BUILD"; then
  1.8635 +      AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
  1.8636 +    fi
  1.8637 +fi
  1.8638 +
  1.8639 +dnl If we have any service that uploads data (and requires data submission
  1.8640 +dnl policy alert), set MOZ_DATA_REPORTING.
  1.8641 +dnl We need SUBST for build system and DEFINE for xul preprocessor.
  1.8642 +if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
  1.8643 +  MOZ_DATA_REPORTING=1
  1.8644 +  AC_DEFINE(MOZ_DATA_REPORTING)
  1.8645 +  AC_SUBST(MOZ_DATA_REPORTING)
  1.8646 +fi
  1.8647 +
  1.8648 +dnl win32 options
  1.8649 +AC_SUBST(MOZ_BROWSE_INFO)
  1.8650 +AC_SUBST(MOZ_TOOLS_DIR)
  1.8651 +AC_SUBST(WIN32_REDIST_DIR)
  1.8652 +AC_SUBST(MAKENSISU)
  1.8653 +
  1.8654 +dnl Echo the CFLAGS to remove extra whitespace.
  1.8655 +CFLAGS=`echo \
  1.8656 +    $_WARNINGS_CFLAGS \
  1.8657 +    $CFLAGS`
  1.8658 +
  1.8659 +CXXFLAGS=`echo \
  1.8660 +    $_WARNINGS_CXXFLAGS \
  1.8661 +    $CXXFLAGS`
  1.8662 +
  1.8663 +COMPILE_CFLAGS=`echo \
  1.8664 +    $_DEFINES_CFLAGS \
  1.8665 +    $_DEPEND_CFLAGS \
  1.8666 +    $COMPILE_CFLAGS`
  1.8667 +
  1.8668 +COMPILE_CXXFLAGS=`echo \
  1.8669 +    $_DEFINES_CXXFLAGS \
  1.8670 +    $_DEPEND_CFLAGS \
  1.8671 +    $COMPILE_CXXFLAGS`
  1.8672 +
  1.8673 +HOST_CFLAGS=`echo \
  1.8674 +    $HOST_CFLAGS \
  1.8675 +    $_DEPEND_CFLAGS`
  1.8676 +
  1.8677 +HOST_CXXFLAGS=`echo \
  1.8678 +    $HOST_CXXFLAGS \
  1.8679 +    $_DEPEND_CFLAGS`
  1.8680 +
  1.8681 +AC_SUBST(SYSTEM_LIBXUL)
  1.8682 +AC_SUBST(MOZ_NATIVE_JPEG)
  1.8683 +AC_SUBST(MOZ_NATIVE_PNG)
  1.8684 +AC_SUBST(MOZ_NATIVE_BZ2)
  1.8685 +
  1.8686 +AC_SUBST(MOZ_JPEG_CFLAGS)
  1.8687 +AC_SUBST(MOZ_JPEG_LIBS)
  1.8688 +AC_SUBST(MOZ_BZ2_CFLAGS)
  1.8689 +AC_SUBST(MOZ_BZ2_LIBS)
  1.8690 +AC_SUBST(MOZ_PNG_CFLAGS)
  1.8691 +AC_SUBST(MOZ_PNG_LIBS)
  1.8692 +
  1.8693 +if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then
  1.8694 +    export MOZ_NUWA_PROCESS
  1.8695 +    AC_DEFINE(MOZ_NUWA_PROCESS)
  1.8696 +fi
  1.8697 +AC_SUBST(MOZ_NUWA_PROCESS)
  1.8698 +
  1.8699 +AC_SUBST(NSPR_CFLAGS)
  1.8700 +AC_SUBST(NSPR_LIBS)
  1.8701 +AC_SUBST(MOZ_NATIVE_NSPR)
  1.8702 +
  1.8703 +AC_SUBST(NSS_CFLAGS)
  1.8704 +AC_SUBST(NSS_LIBS)
  1.8705 +AC_SUBST(MOZ_NATIVE_NSS)
  1.8706 +AC_SUBST(NSS_DISABLE_DBM)
  1.8707 +
  1.8708 +OS_CFLAGS="$CFLAGS"
  1.8709 +OS_CXXFLAGS="$CXXFLAGS"
  1.8710 +OS_CPPFLAGS="$CPPFLAGS"
  1.8711 +OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
  1.8712 +OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
  1.8713 +OS_LDFLAGS="$LDFLAGS"
  1.8714 +OS_LIBS="$LIBS"
  1.8715 +AC_SUBST(OS_CFLAGS)
  1.8716 +AC_SUBST(OS_CXXFLAGS)
  1.8717 +AC_SUBST(OS_CPPFLAGS)
  1.8718 +AC_SUBST(OS_COMPILE_CFLAGS)
  1.8719 +AC_SUBST(OS_COMPILE_CXXFLAGS)
  1.8720 +AC_SUBST(OS_LDFLAGS)
  1.8721 +AC_SUBST(OS_LIBS)
  1.8722 +AC_SUBST(CROSS_COMPILE)
  1.8723 +AC_SUBST(WCHAR_CFLAGS)
  1.8724 +
  1.8725 +AC_SUBST(HOST_CC)
  1.8726 +AC_SUBST(HOST_CXX)
  1.8727 +AC_SUBST(HOST_CFLAGS)
  1.8728 +AC_SUBST(HOST_CXXFLAGS)
  1.8729 +AC_SUBST(HOST_LDFLAGS)
  1.8730 +AC_SUBST(HOST_OPTIMIZE_FLAGS)
  1.8731 +AC_SUBST(HOST_AR)
  1.8732 +AC_SUBST(HOST_AR_FLAGS)
  1.8733 +AC_SUBST(HOST_LD)
  1.8734 +AC_SUBST(HOST_RANLIB)
  1.8735 +AC_SUBST(HOST_NSPR_MDCPUCFG)
  1.8736 +AC_SUBST(HOST_BIN_SUFFIX)
  1.8737 +AC_SUBST(HOST_OS_ARCH)
  1.8738 +
  1.8739 +AC_SUBST(TARGET_CPU)
  1.8740 +AC_SUBST(TARGET_VENDOR)
  1.8741 +AC_SUBST(TARGET_OS)
  1.8742 +AC_SUBST(TARGET_NSPR_MDCPUCFG)
  1.8743 +AC_SUBST(TARGET_MD_ARCH)
  1.8744 +AC_SUBST(TARGET_XPCOM_ABI)
  1.8745 +AC_SUBST(OS_TARGET)
  1.8746 +AC_SUBST(OS_ARCH)
  1.8747 +AC_SUBST(OS_RELEASE)
  1.8748 +AC_SUBST(OS_TEST)
  1.8749 +AC_SUBST(CPU_ARCH)
  1.8750 +AC_SUBST(INTEL_ARCHITECTURE)
  1.8751 +AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
  1.8752 +AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
  1.8753 +
  1.8754 +AC_SUBST(MOZ_CHROME_FILE_FORMAT)
  1.8755 +
  1.8756 +AC_SUBST(WRAP_LDFLAGS)
  1.8757 +AC_SUBST(MKSHLIB)
  1.8758 +AC_SUBST(MKCSHLIB)
  1.8759 +AC_SUBST(MKSHLIB_FORCE_ALL)
  1.8760 +AC_SUBST(MKSHLIB_UNFORCE_ALL)
  1.8761 +AC_SUBST(DSO_CFLAGS)
  1.8762 +AC_SUBST(DSO_PIC_CFLAGS)
  1.8763 +AC_SUBST(DSO_LDOPTS)
  1.8764 +AC_SUBST(LIB_PREFIX)
  1.8765 +AC_SUBST(DLL_PREFIX)
  1.8766 +AC_SUBST(DLL_SUFFIX)
  1.8767 +AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
  1.8768 +AC_SUBST(LIB_SUFFIX)
  1.8769 +AC_SUBST(OBJ_SUFFIX)
  1.8770 +AC_SUBST(BIN_SUFFIX)
  1.8771 +AC_SUBST(ASM_SUFFIX)
  1.8772 +AC_SUBST(IMPORT_LIB_SUFFIX)
  1.8773 +AC_SUBST(USE_N32)
  1.8774 +AC_SUBST(CC_VERSION)
  1.8775 +AC_SUBST(CXX_VERSION)
  1.8776 +AC_SUBST(MSMANIFEST_TOOL)
  1.8777 +AC_SUBST(NS_ENABLE_TSF)
  1.8778 +AC_SUBST(MOZ_NSS_PATCH)
  1.8779 +AC_SUBST(MOZ_APP_COMPONENT_LIBS)
  1.8780 +AC_SUBST(MOZ_APP_EXTRA_LIBS)
  1.8781 +
  1.8782 +AC_SUBST(MOZ_WAVE)
  1.8783 +AC_SUBST(MOZ_VORBIS)
  1.8784 +AC_SUBST(MOZ_TREMOR)
  1.8785 +AC_SUBST(MOZ_OPUS)
  1.8786 +AC_SUBST(MOZ_WEBM)
  1.8787 +AC_SUBST(MOZ_WMF)
  1.8788 +AC_SUBST(MOZ_FFMPEG)
  1.8789 +AC_SUBST(MOZ_FMP4)
  1.8790 +AC_SUBST(MOZ_DIRECTSHOW)
  1.8791 +AC_SUBST(MOZ_MEDIA_PLUGINS)
  1.8792 +AC_SUBST(MOZ_APPLEMEDIA)
  1.8793 +AC_SUBST(MOZ_OMX_PLUGIN)
  1.8794 +AC_SUBST(MOZ_VPX_ERROR_CONCEALMENT)
  1.8795 +AC_SUBST(MOZ_VPX)
  1.8796 +AC_SUBST(VPX_AS)
  1.8797 +AC_SUBST(VPX_ASFLAGS)
  1.8798 +AC_SUBST(VPX_DASH_C_FLAG)
  1.8799 +AC_SUBST(VPX_AS_CONVERSION)
  1.8800 +AC_SUBST(VPX_ASM_SUFFIX)
  1.8801 +AC_SUBST(VPX_X86_ASM)
  1.8802 +AC_SUBST(VPX_ARM_ASM)
  1.8803 +AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
  1.8804 +AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
  1.8805 +AC_SUBST(LIBJPEG_TURBO_AS)
  1.8806 +AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
  1.8807 +AC_SUBST(LIBJPEG_TURBO_X86_ASM)
  1.8808 +AC_SUBST(LIBJPEG_TURBO_X64_ASM)
  1.8809 +AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
  1.8810 +
  1.8811 +AC_SUBST(MOZ_PACKAGE_JSSHELL)
  1.8812 +AC_SUBST(MOZ_FOLD_LIBS)
  1.8813 +
  1.8814 +AC_SUBST(MOZ_ENABLE_SZIP)
  1.8815 +AC_SUBST(MOZ_SZIP_FLAGS)
  1.8816 +
  1.8817 +if test "$MOZ_DEBUG"; then
  1.8818 +    MOZ_EM_DEBUG=1
  1.8819 +fi
  1.8820 +AC_SUBST(MOZ_EM_DEBUG)
  1.8821 +
  1.8822 +if test -n "$COMPILE_ENVIRONMENT"; then
  1.8823 +AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
  1.8824 +
  1.8825 +dnl Check for missing components
  1.8826 +if test "$MOZ_X11"; then
  1.8827 +    if test "$WITHOUT_X11"; then
  1.8828 +        AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
  1.8829 +    fi
  1.8830 +    dnl ====================================================
  1.8831 +    dnl = Check if X headers exist
  1.8832 +    dnl ====================================================
  1.8833 +    _SAVE_CFLAGS=$CFLAGS
  1.8834 +    CFLAGS="$CFLAGS $XCFLAGS"
  1.8835 +    AC_TRY_COMPILE([
  1.8836 +        #include <stdio.h>
  1.8837 +        #include <stdlib.h>
  1.8838 +        #include <X11/Xlib.h>
  1.8839 +        #include <X11/Intrinsic.h>
  1.8840 +        #include <X11/extensions/XShm.h>
  1.8841 +    ],
  1.8842 +    [
  1.8843 +        Display *dpy = 0;
  1.8844 +        if ((dpy = XOpenDisplay(NULL)) == NULL) {
  1.8845 +            fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
  1.8846 +            exit(1);
  1.8847 +        }
  1.8848 +    ], [],
  1.8849 +    [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
  1.8850 +    CFLAGS="$_SAVE_CFLAGS"
  1.8851 +
  1.8852 +    if test -n "$MISSING_X"; then
  1.8853 +        AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
  1.8854 +    fi
  1.8855 +
  1.8856 +fi # MOZ_X11
  1.8857 +
  1.8858 +fi # COMPILE_ENVIRONMENT
  1.8859 +
  1.8860 +dnl Set various defines and substitutions
  1.8861 +dnl ========================================================
  1.8862 +
  1.8863 +if test "$OS_ARCH" != "WINNT"; then
  1.8864 +  AC_DEFINE(XP_UNIX)
  1.8865 +fi
  1.8866 +
  1.8867 +if test "$MOZ_DEBUG"; then
  1.8868 +    AC_DEFINE(MOZ_REFLOW_PERF)
  1.8869 +    AC_DEFINE(MOZ_REFLOW_PERF_DSP)
  1.8870 +fi
  1.8871 +
  1.8872 +if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
  1.8873 +    AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
  1.8874 +    ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
  1.8875 +    ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
  1.8876 +    ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
  1.8877 +    ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
  1.8878 +    AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
  1.8879 +    AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
  1.8880 +    AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
  1.8881 +fi
  1.8882 +
  1.8883 +if test "$MOZ_DEBUG"; then
  1.8884 +    A11Y_LOG=1
  1.8885 +fi
  1.8886 +case "$MOZ_UPDATE_CHANNEL" in
  1.8887 +aurora|beta|release|esr)
  1.8888 +    ;;
  1.8889 +*)
  1.8890 +    A11Y_LOG=1
  1.8891 +    ;;
  1.8892 +esac
  1.8893 +AC_SUBST(A11Y_LOG)
  1.8894 +if test -n "$A11Y_LOG"; then
  1.8895 +    AC_DEFINE(A11Y_LOG)
  1.8896 +fi
  1.8897 +
  1.8898 +AC_SUBST(MOZILLA_VERSION)
  1.8899 +
  1.8900 +AC_SUBST(ac_configure_args)
  1.8901 +
  1.8902 +dnl Spit out some output
  1.8903 +dnl ========================================================
  1.8904 +
  1.8905 +dnl The following defines are used by xpcom
  1.8906 +_NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
  1.8907 +CPP_THROW_NEW
  1.8908 +HAVE_CPP_AMBIGUITY_RESOLVING_USING
  1.8909 +HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
  1.8910 +HAVE_CPP_PARTIAL_SPECIALIZATION
  1.8911 +HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
  1.8912 +NEED_CPP_UNUSED_IMPLEMENTATIONS
  1.8913 +HAVE_GETPAGESIZE
  1.8914 +HAVE_ICONV
  1.8915 +HAVE_ICONV_WITH_CONST_INPUT
  1.8916 +HAVE_MBRTOWC
  1.8917 +HAVE_WCRTOMB
  1.8918 +HAVE_STATVFS64
  1.8919 +HAVE_STATVFS
  1.8920 +HAVE_STATFS64
  1.8921 +HAVE_STATFS
  1.8922 +HAVE_SYS_STATVFS_H
  1.8923 +HAVE_SYS_STATFS_H
  1.8924 +HAVE_SYS_VFS_H
  1.8925 +HAVE_SYS_MOUNT_H
  1.8926 +"
  1.8927 +
  1.8928 +AC_SUBST(STLPORT_LIBS)
  1.8929 +
  1.8930 +dnl ========================================================
  1.8931 +dnl ICU Support
  1.8932 +dnl ========================================================
  1.8933 +
  1.8934 +if test "$MOZ_BUILD_APP" = "browser"; then
  1.8935 +    _INTL_API=yes
  1.8936 +else
  1.8937 +    # Internationalization isn't built or exposed by default in non-desktop
  1.8938 +    # builds.  Bugs to enable:
  1.8939 +    #
  1.8940 +    #   Android:  bug 864843
  1.8941 +    #   B2G:      bug 866301
  1.8942 +    _INTL_API=no
  1.8943 +fi
  1.8944 +
  1.8945 +MOZ_CONFIG_ICU()
  1.8946 +
  1.8947 +if test -n "$MOZ_NATIVE_ICU"; then
  1.8948 +    MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_ICU_LIBS"
  1.8949 +fi
  1.8950 +
  1.8951 +if test -n "$JS_SHARED_LIBRARY"; then
  1.8952 +  MOZ_JS_LIBS="$MOZ_JS_SHARED_LIBS"
  1.8953 +else
  1.8954 +  MOZ_JS_LIBS="$MOZ_JS_STATIC_LIBS"
  1.8955 +  AC_DEFINE(MOZ_STATIC_JS)
  1.8956 +fi
  1.8957 +AC_SUBST(JS_SHARED_LIBRARY)
  1.8958 +
  1.8959 +MOZ_CREATE_CONFIG_STATUS()
  1.8960 +
  1.8961 +# No need to run subconfigures when building with LIBXUL_SDK_DIR
  1.8962 +if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
  1.8963 +  MOZ_SUBCONFIGURE_ICU()
  1.8964 +  MOZ_SUBCONFIGURE_FFI()
  1.8965 +fi
  1.8966 +
  1.8967 +# Hack around an Apple bug that affects the egrep that comes with OS X 10.7.
  1.8968 +# "env ARCHPREFERENCE=i386,x86_64 arch egrep" first tries to use the 32-bit
  1.8969 +# Intel part of the egrep fat binary, even on 64-bit systems, and falls back on
  1.8970 +# the 64-bit part if it's not a fat binary, as can happen with MacPorts. We
  1.8971 +# (apparently) only need this hack when egrep's "pattern" is particularly long
  1.8972 +# (as in the following code) and the first egrep on our $PATH is Apple's.  See
  1.8973 +# bug 655339.
  1.8974 +case "$host" in
  1.8975 +*-apple-darwin11*)
  1.8976 +    FIXED_EGREP="env ARCHPREFERENCE=i386,x86_64 arch egrep"
  1.8977 +    ;;
  1.8978 +*)
  1.8979 +    FIXED_EGREP="egrep"
  1.8980 +    ;;
  1.8981 +esac
  1.8982 +
  1.8983 +# Run jemalloc configure script
  1.8984 +
  1.8985 +if test -z "$MOZ_NATIVE_JEMALLOC" -a "$MOZ_MEMORY" && test -n "$MOZ_JEMALLOC3" -o -n "$MOZ_REPLACE_MALLOC"; then
  1.8986 +  ac_configure_args="--build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_"
  1.8987 +  if test -n "$MOZ_REPLACE_MALLOC"; then
  1.8988 +    # When using replace_malloc, we always want memalign and valloc exported from jemalloc.
  1.8989 +    ac_configure_args="$ac_configure_args ac_cv_func_memalign=yes"
  1.8990 +    ac_configure_args="$ac_configure_args ac_cv_func_valloc=yes"
  1.8991 +  fi
  1.8992 +  if test -n "$MOZ_JEMALLOC3"; then
  1.8993 +    case "${OS_ARCH}" in
  1.8994 +      WINNT|Darwin)
  1.8995 +        # We want jemalloc functions to be kept hidden on both Mac and Windows
  1.8996 +        # See memory/build/mozmemory_wrap.h for details.
  1.8997 +        ac_configure_args="$ac_configure_args --without-export"
  1.8998 +        ;;
  1.8999 +    esac
  1.9000 +  elif test "${OS_ARCH}" = Darwin; then
  1.9001 +    # When building as a replace-malloc lib, disabling the zone allocator
  1.9002 +    # forces to use pthread_atfork.
  1.9003 +    ac_configure_args="$ac_configure_args --disable-zone-allocator"
  1.9004 +  fi
  1.9005 +  _MANGLE="malloc posix_memalign aligned_alloc calloc realloc free memalign valloc malloc_usable_size"
  1.9006 +  JEMALLOC_WRAPPER=
  1.9007 +  if test -z "$MOZ_REPLACE_MALLOC"; then
  1.9008 +    case "$OS_ARCH" in
  1.9009 +      Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
  1.9010 +        MANGLE=$_MANGLE
  1.9011 +        ;;
  1.9012 +    esac
  1.9013 +  elif test -z "$MOZ_JEMALLOC3"; then
  1.9014 +    MANGLE=$_MANGLE
  1.9015 +    JEMALLOC_WRAPPER=replace_
  1.9016 +  fi
  1.9017 +  if test -n "$MANGLE"; then
  1.9018 +    MANGLED=
  1.9019 +    if test -n "$_WRAP_MALLOC" -a -z "$JEMALLOC_WRAPPER"; then
  1.9020 +      JEMALLOC_WRAPPER=__wrap_
  1.9021 +    fi
  1.9022 +    for mangle in ${MANGLE}; do
  1.9023 +      if test -n "$MANGLED"; then
  1.9024 +        MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED"
  1.9025 +      else
  1.9026 +        MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle"
  1.9027 +      fi
  1.9028 +    done
  1.9029 +    ac_configure_args="$ac_configure_args --with-mangling=$MANGLED"
  1.9030 +  fi
  1.9031 +  unset CONFIG_FILES
  1.9032 +  if test -z "$MOZ_TLS"; then
  1.9033 +    ac_configure_args="$ac_configure_args --disable-tls"
  1.9034 +  fi
  1.9035 +  EXTRA_CFLAGS="$CFLAGS"
  1.9036 +  for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do
  1.9037 +    ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
  1.9038 +  done
  1.9039 +  if test "$CROSS_COMPILE"; then
  1.9040 +    ac_configure_args="$ac_configure_args je_cv_static_page_shift=12"
  1.9041 +  fi
  1.9042 +  _save_cache_file="$cache_file"
  1.9043 +  cache_file=$_objdir/memory/jemalloc/src/config.cache
  1.9044 +
  1.9045 +  if ! test -e memory/jemalloc; then
  1.9046 +    mkdir -p memory/jemalloc
  1.9047 +  fi
  1.9048 +
  1.9049 +  AC_OUTPUT_SUBDIRS(memory/jemalloc/src)
  1.9050 +  cache_file="$_save_cache_file"
  1.9051 +  ac_configure_args="$_SUBDIR_CONFIG_ARGS"
  1.9052 +fi
  1.9053 +
  1.9054 +# Run freetype configure script
  1.9055 +
  1.9056 +if test "$MOZ_TREE_FREETYPE"; then
  1.9057 +   export CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS -std=c99"
  1.9058 +   export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS"
  1.9059 +   export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS"
  1.9060 +   export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS"
  1.9061 +   # Spaces in the *_CFLAGS and *_LIBS variables are intentionally placed
  1.9062 +   # to force freetype to use our settings rather than autodetecting
  1.9063 +   export LIBPNG_CFLAGS="$MOZ_PNG_CFLAGS "
  1.9064 +   export LIBPNG_LIBS="$MOZ_PNG_LIBS "
  1.9065 +   export ZLIB_CFLAGS="$MOZ_ZLIB_CFLAGS "
  1.9066 +   export ZLIB_LIBS="$MOZ_ZLIB_LIBS "
  1.9067 +   export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
  1.9068 +   ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes --with-zlib=yes --without-bzip2 --with-png=yes --without-harfbuzz"
  1.9069 +
  1.9070 +   if ! test -e modules; then
  1.9071 +     mkdir modules
  1.9072 +   fi
  1.9073 +   # Only export CC, CXX and RANLIB for the subconfigure, and avoid spilling
  1.9074 +   # that further down the road.
  1.9075 +   (export CC CXX RANLIB;
  1.9076 +    AC_OUTPUT_SUBDIRS(modules/freetype2)
  1.9077 +   ) || exit 1
  1.9078 +fi
  1.9079 +
  1.9080 +if test -z "$direct_nspr_config"; then
  1.9081 +    dnl ========================================================
  1.9082 +    dnl = Setup a nice relatively clean build environment for
  1.9083 +    dnl = sub-configures.
  1.9084 +    dnl ========================================================
  1.9085 +    CC="$_SUBDIR_CC"
  1.9086 +    CXX="$_SUBDIR_CXX"
  1.9087 +    CFLAGS="$_SUBDIR_CFLAGS"
  1.9088 +    CPPFLAGS="$_SUBDIR_CPPFLAGS"
  1.9089 +    CXXFLAGS="$_SUBDIR_CXXFLAGS"
  1.9090 +    LDFLAGS="$_SUBDIR_LDFLAGS"
  1.9091 +    HOST_CC="$_SUBDIR_HOST_CC"
  1.9092 +    HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
  1.9093 +    HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
  1.9094 +    RC=
  1.9095 +fi
  1.9096 +
  1.9097 +unset MAKEFILES
  1.9098 +unset CONFIG_FILES
  1.9099 +
  1.9100 +# Run all configure scripts specified by a subconfigure
  1.9101 +if test -n "$_subconfigure_subdir"; then
  1.9102 +  _save_ac_configure_args="$ac_configure_args"
  1.9103 +  ac_configure_args="$_subconfigure_config_args"
  1.9104 +  AC_OUTPUT_SUBDIRS("$_subconfigure_subdir")
  1.9105 +  ac_configure_args="$_save_ac_configure_args"
  1.9106 +fi
  1.9107 +
  1.9108 +# No need to run subconfigures when building with LIBXUL_SDK_DIR
  1.9109 +if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
  1.9110 +
  1.9111 +export WRAP_LDFLAGS
  1.9112 +
  1.9113 +if test -n "$_WRAP_MALLOC"; then
  1.9114 +    # Avoid doubling wrap malloc arguments
  1.9115 +    _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--enable-wrap-malloc *//'`"
  1.9116 +fi
  1.9117 +
  1.9118 +if test -z "$MOZ_NATIVE_NSPR"; then
  1.9119 +    ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
  1.9120 +    if test -z "$MOZ_DEBUG"; then
  1.9121 +        ac_configure_args="$ac_configure_args --disable-debug"
  1.9122 +    else
  1.9123 +        ac_configure_args="$ac_configure_args --enable-debug"
  1.9124 +    fi
  1.9125 +    if test "$MOZ_OPTIMIZE" = "1"; then
  1.9126 +        ac_configure_args="$ac_configure_args --enable-optimize"
  1.9127 +    elif test -z "$MOZ_OPTIMIZE"; then
  1.9128 +        ac_configure_args="$ac_configure_args --disable-optimize"
  1.9129 +    fi
  1.9130 +    if test -n "$HAVE_64BIT_OS"; then
  1.9131 +        ac_configure_args="$ac_configure_args --enable-64bit"
  1.9132 +    fi
  1.9133 +    if test -n "$USE_ARM_KUSER"; then
  1.9134 +        ac_configure_args="$ac_configure_args --with-arm-kuser"
  1.9135 +    fi
  1.9136 +    # A configure script generated by autoconf 2.68 does not allow the cached
  1.9137 +    # values of "precious" variables such as CFLAGS and LDFLAGS to differ from
  1.9138 +    # the values passed to the configure script. Since we modify CFLAGS and
  1.9139 +    # LDFLAGS before passing them to NSPR's configure script, we cannot share
  1.9140 +    # config.cache with NSPR. As a result, we cannot pass AS, CC, CXX, etc. to
  1.9141 +    # NSPR via a shared config.cache file and must pass them to NSPR on the
  1.9142 +    # configure command line.
  1.9143 +    for var in AS CC CXX CPP LD AR RANLIB STRIP; do
  1.9144 +        ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
  1.9145 +    done
  1.9146 +    # A configure script generated by autoconf 2.68 warns if --host is
  1.9147 +    # specified but --build isn't. So we always pass --build to NSPR's
  1.9148 +    # configure script.
  1.9149 +    ac_configure_args="$ac_configure_args --build=$build"
  1.9150 +    ac_configure_args="$ac_configure_args $NSPR_CONFIGURE_ARGS"
  1.9151 +
  1.9152 +    # Save these, so we can mess with them for the subconfigure ..
  1.9153 +    _SAVE_CFLAGS="$CFLAGS"
  1.9154 +    _SAVE_CPPFLAGS="$CPPFLAGS"
  1.9155 +    _SAVE_LDFLAGS="$LDFLAGS"
  1.9156 +
  1.9157 +    if test -n "$MOZ_LINKER" -a "$ac_cv_func_dladdr" = no ; then
  1.9158 +      # dladdr is supported by the new linker, even when the system linker doesn't
  1.9159 +      # support it. Trick nspr into using dladdr when it's not supported.
  1.9160 +      export CPPFLAGS="-include $_topsrcdir/mozglue/linker/dladdr.h $CPPFLAGS"
  1.9161 +    fi
  1.9162 +    export LDFLAGS="$LDFLAGS $NSPR_LDFLAGS"
  1.9163 +    export CFLAGS="$CFLAGS $MOZ_FRAMEPTR_FLAGS"
  1.9164 +
  1.9165 +    # Use a separate cache file for NSPR since it uses autoconf 2.68.
  1.9166 +    _save_cache_file="$cache_file"
  1.9167 +    cache_file=$_objdir/nsprpub/config.cache
  1.9168 +
  1.9169 +    AC_OUTPUT_SUBDIRS(nsprpub)
  1.9170 +
  1.9171 +    # .. and restore them
  1.9172 +    cache_file="$_save_cache_file"
  1.9173 +    CFLAGS="$_SAVE_CFLAGS"
  1.9174 +    CPPFLAGS="$_SAVE_CPPFLAGS"
  1.9175 +    LDFLAGS="$_SAVE_LDFLAGS"
  1.9176 +
  1.9177 +    ac_configure_args="$_SUBDIR_CONFIG_ARGS"
  1.9178 +fi
  1.9179 +
  1.9180 +dnl ========================================================
  1.9181 +dnl = Setup a nice relatively clean build environment for
  1.9182 +dnl = sub-configures.
  1.9183 +dnl ========================================================
  1.9184 +CC="$_SUBDIR_CC"
  1.9185 +CXX="$_SUBDIR_CXX"
  1.9186 +CFLAGS="$_SUBDIR_CFLAGS"
  1.9187 +CPPFLAGS="$_SUBDIR_CPPFLAGS"
  1.9188 +CXXFLAGS="$_SUBDIR_CXXFLAGS"
  1.9189 +LDFLAGS="$_SUBDIR_LDFLAGS"
  1.9190 +HOST_CC="$_SUBDIR_HOST_CC"
  1.9191 +HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
  1.9192 +HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
  1.9193 +RC=
  1.9194 +
  1.9195 +if test -n "$ENABLE_CLANG_PLUGIN"; then
  1.9196 +    ac_configure_args="$_SUBDIR_CONFIG_ARGS"
  1.9197 +    AC_OUTPUT_SUBDIRS(build/clang-plugin)
  1.9198 +fi
  1.9199 +
  1.9200 +
  1.9201 +# Run the SpiderMonkey 'configure' script.
  1.9202 +dist=$MOZ_BUILD_ROOT/dist
  1.9203 +ac_configure_args="$_SUBDIR_CONFIG_ARGS"
  1.9204 +ac_configure_args="$ac_configure_args --enable-threadsafe"
  1.9205 +
  1.9206 +if test "$_INTL_API" = no; then
  1.9207 +    ac_configure_args="$ac_configure_args --without-intl-api"
  1.9208 +fi
  1.9209 +
  1.9210 +if test "$BUILD_CTYPES"; then
  1.9211 +    # Build js-ctypes on the platforms we can.
  1.9212 +    ac_configure_args="$ac_configure_args --enable-ctypes"
  1.9213 +fi
  1.9214 +if test -z "$JS_SHARED_LIBRARY" ; then
  1.9215 +    ac_configure_args="$ac_configure_args --disable-shared-js"
  1.9216 +    if test -n "$MOZ_DISABLE_EXPORT_JS"; then
  1.9217 +        ac_configure_args="$ac_configure_args --disable-export-js"
  1.9218 +    fi
  1.9219 +fi
  1.9220 +if test -z "$MOZ_NATIVE_NSPR"; then
  1.9221 +    ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
  1.9222 +    ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
  1.9223 +fi
  1.9224 +ac_configure_args="$ac_configure_args --prefix=$dist"
  1.9225 +if test "$MOZ_MEMORY"; then
  1.9226 +   ac_configure_args="$ac_configure_args --enable-jemalloc"
  1.9227 +fi
  1.9228 +if test -n "$MOZ_GLUE_LDFLAGS"; then
  1.9229 +   export MOZ_GLUE_LDFLAGS
  1.9230 +fi
  1.9231 +if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
  1.9232 +   export MOZ_GLUE_PROGRAM_LDFLAGS
  1.9233 +fi
  1.9234 +if test -n "$ZLIB_IN_MOZGLUE"; then
  1.9235 +   MOZ_ZLIB_LIBS=
  1.9236 +fi
  1.9237 +export MOZ_NATIVE_ZLIB
  1.9238 +export MOZ_ZLIB_CFLAGS
  1.9239 +export MOZ_ZLIB_LIBS
  1.9240 +export MOZ_APP_NAME
  1.9241 +export DONT_POPULATE_VIRTUALENV=1
  1.9242 +export PYTHON
  1.9243 +export MOZILLA_CENTRAL_PATH=$_topsrcdir
  1.9244 +export STLPORT_CPPFLAGS
  1.9245 +export STLPORT_LDFLAGS
  1.9246 +export STLPORT_LIBS
  1.9247 +export JS_STANDALONE=no
  1.9248 +export MOZ_LINKER
  1.9249 +export ZLIB_IN_MOZGLUE
  1.9250 +
  1.9251 +if ! test -e js; then
  1.9252 +    mkdir js
  1.9253 +fi
  1.9254 +
  1.9255 +AC_OUTPUT_SUBDIRS(js/src)
  1.9256 +ac_configure_args="$_SUBDIR_CONFIG_ARGS"
  1.9257 +
  1.9258 +fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
  1.9259 +
  1.9260 +export WRITE_MOZINFO=1
  1.9261 +dnl we need to run config.status after js/src subconfigure because we're
  1.9262 +dnl traversing its moz.build and we need its config.status for that.
  1.9263 +dnl However, writing our own config.status needs to happen before
  1.9264 +dnl subconfigures because the setup surrounding subconfigures alters
  1.9265 +dnl many AC_SUBSTed variables.
  1.9266 +MOZ_RUN_CONFIG_STATUS()
  1.9267 +unset WRITE_MOZINFO

mercurial