js/src/configure.in

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/configure.in	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,4120 @@
     1.4 +dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
     1.5 +dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
     1.6 +dnl This Source Code Form is subject to the terms of the Mozilla Public
     1.7 +dnl License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 +dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
     1.9 +
    1.10 +dnl Process this file with autoconf to produce a configure script.
    1.11 +dnl ========================================================
    1.12 +
    1.13 +AC_PREREQ(2.13)
    1.14 +AC_INIT(js/src/jsapi.h)
    1.15 +AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
    1.16 +AC_CANONICAL_SYSTEM
    1.17 +TARGET_CPU="${target_cpu}"
    1.18 +TARGET_VENDOR="${target_vendor}"
    1.19 +TARGET_OS="${target_os}"
    1.20 +
    1.21 +dnl ========================================================
    1.22 +dnl =
    1.23 +dnl = Don't change the following two lines.  Doing so breaks:
    1.24 +dnl =
    1.25 +dnl = CFLAGS="-foo" ./configure
    1.26 +dnl =
    1.27 +dnl ========================================================
    1.28 +CFLAGS="${CFLAGS=}"
    1.29 +CPPFLAGS="${CPPFLAGS=}"
    1.30 +CXXFLAGS="${CXXFLAGS=}"
    1.31 +LDFLAGS="${LDFLAGS=}"
    1.32 +HOST_CFLAGS="${HOST_CFLAGS=}"
    1.33 +HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
    1.34 +HOST_LDFLAGS="${HOST_LDFLAGS=}"
    1.35 +
    1.36 +dnl ========================================================
    1.37 +dnl = Preserve certain environment flags passed to configure
    1.38 +dnl = We want sub projects to receive the same flags
    1.39 +dnl = untainted by this configure script
    1.40 +dnl ========================================================
    1.41 +_SUBDIR_CC="$CC"
    1.42 +_SUBDIR_CXX="$CXX"
    1.43 +_SUBDIR_CFLAGS="$CFLAGS"
    1.44 +_SUBDIR_CPPFLAGS="$CPPFLAGS"
    1.45 +_SUBDIR_CXXFLAGS="$CXXFLAGS"
    1.46 +_SUBDIR_LDFLAGS="$LDFLAGS"
    1.47 +_SUBDIR_HOST_CC="$HOST_CC"
    1.48 +_SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
    1.49 +_SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
    1.50 +_SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
    1.51 +_SUBDIR_CONFIG_ARGS="$ac_configure_args"
    1.52 +
    1.53 +dnl Set the version number of the libs included with mozilla
    1.54 +dnl ========================================================
    1.55 +NSPR_VERSION=4
    1.56 +NSPR_MINVER=4.9.2
    1.57 +
    1.58 +dnl Set the minimum version of toolkit libs used by mozilla
    1.59 +dnl ========================================================
    1.60 +PERL_VERSION=5.006
    1.61 +WINDRES_VERSION=2.14.90
    1.62 +W32API_VERSION=3.14
    1.63 +
    1.64 +MSMANIFEST_TOOL=
    1.65 +
    1.66 +dnl Set various checks
    1.67 +dnl ========================================================
    1.68 +MISSING_X=
    1.69 +AC_PROG_AWK
    1.70 +
    1.71 +dnl Initialize the Pthread test variables early so they can be
    1.72 +dnl  overridden by each platform.
    1.73 +dnl ========================================================
    1.74 +USE_PTHREADS=
    1.75 +_PTHREAD_LDFLAGS=""
    1.76 +
    1.77 +dnl Do not allow a separate objdir build if a srcdir build exists.
    1.78 +dnl ==============================================================
    1.79 +_topsrcdir=`cd $srcdir; pwd`
    1.80 +_objdir=`pwd`
    1.81 +
    1.82 +if test "$_topsrcdir" != "$_objdir"
    1.83 +then
    1.84 +  # Check for a couple representative files in the source tree
    1.85 +  _conflict_files=
    1.86 +  for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
    1.87 +    if test -f $file; then
    1.88 +      _conflict_files="$_conflict_files $file"
    1.89 +    fi
    1.90 +  done
    1.91 +  if test "$_conflict_files"; then
    1.92 +    echo "***"
    1.93 +    echo "*   Your source tree contains these files:"
    1.94 +    for file in $_conflict_files; do
    1.95 +      echo "*         $file"
    1.96 +    done
    1.97 +    cat 1>&2 <<-EOF
    1.98 +	*   This indicates that you previously built in the source tree.
    1.99 +	*   A source tree build can confuse the separate objdir build.
   1.100 +	*
   1.101 +	*   To clean up the source tree:
   1.102 +	*     1. cd $_topsrcdir
   1.103 +	*     2. gmake distclean
   1.104 +	***
   1.105 +	EOF
   1.106 +    exit 1
   1.107 +    break
   1.108 +  fi
   1.109 +fi
   1.110 +MOZ_BUILD_ROOT=`pwd`
   1.111 +
   1.112 +dnl Choose where to put the 'dist' directory.
   1.113 +dnl ==============================================================
   1.114 +
   1.115 +MOZ_ARG_WITH_STRING(dist-dir,
   1.116 +[  --with-dist-dir=DIR     Use DIR as 'dist' staging area.  DIR may be
   1.117 +                          relative to the top of SpiderMonkey build tree,
   1.118 +                          or absolute.],
   1.119 +    TOP_DIST=$withval,
   1.120 +    TOP_DIST=dist)
   1.121 +AC_SUBST(TOP_DIST)
   1.122 +
   1.123 +MOZ_DEFAULT_COMPILER
   1.124 +
   1.125 +COMPILE_ENVIRONMENT=1
   1.126 +MOZ_ARG_DISABLE_BOOL(compile-environment,
   1.127 +[  --disable-compile-environment
   1.128 +                          Disable compiler/library checks.],
   1.129 +    COMPILE_ENVIRONMENT= )
   1.130 +AC_SUBST(COMPILE_ENVIRONMENT)
   1.131 +
   1.132 +dnl Check for Perl first -- needed for win32 SDK checks
   1.133 +MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
   1.134 +if test -z "$PERL" -o "$PERL" = ":"; then
   1.135 +    AC_MSG_ERROR([perl not found in \$PATH])
   1.136 +fi
   1.137 +
   1.138 +MOZ_ARG_ENABLE_BOOL(shared-js,
   1.139 +[  --disable-shared-js
   1.140 +                          Do not create a shared library.],
   1.141 +    DISABLE_SHARED_JS=0,
   1.142 +    DISABLE_SHARED_JS=1)
   1.143 +
   1.144 +MOZ_ARG_DISABLE_BOOL(export-js,
   1.145 +[  --disable-export-js
   1.146 +                          Do not mark JS symbols as DLL exported/visible.],
   1.147 +    DISABLE_EXPORT_JS=1,
   1.148 +    DISABLE_SHARED_JS=)
   1.149 +
   1.150 +if test "$DISABLE_SHARED_JS" = "1" ; then
   1.151 +  if test "$DISABLE_EXPORT_JS" = "1"; then
   1.152 +    AC_DEFINE(STATIC_JS_API)
   1.153 +  else
   1.154 +    AC_DEFINE(STATIC_EXPORTABLE_JS_API)
   1.155 +  fi
   1.156 +else
   1.157 +  if test "$DISABLE_EXPORT_JS" = "1"; then
   1.158 +    AC_MSG_ERROR([Must export JS symbols when building a shared library.])
   1.159 +  fi
   1.160 +  JS_SHARED_LIBRARY=1
   1.161 +fi
   1.162 +AC_SUBST(JS_SHARED_LIBRARY)
   1.163 +
   1.164 +if test "$JS_STANDALONE" = no; then
   1.165 +  autoconfmk=autoconf-js.mk
   1.166 +  JS_STANDALONE=
   1.167 +else
   1.168 +  JS_STANDALONE=1
   1.169 +  AC_DEFINE(JS_STANDALONE)
   1.170 +fi
   1.171 +AC_SUBST(JS_STANDALONE)
   1.172 +BUILDING_JS=1
   1.173 +AC_SUBST(autoconfmk)
   1.174 +
   1.175 +MOZ_ARG_WITH_STRING(gonk,
   1.176 +[  --with-gonk=DIR
   1.177 +               location of gonk dir],
   1.178 +    gonkdir=$withval)
   1.179 +
   1.180 +MOZ_ARG_WITH_STRING(gonk-toolchain-prefix,
   1.181 +[  --with-gonk-toolchain-prefix=DIR
   1.182 +                          prefix to gonk toolchain commands],
   1.183 +    gonk_toolchain_prefix=$withval)
   1.184 +
   1.185 +if test -n "$gonkdir" ; then
   1.186 +    kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
   1.187 +
   1.188 +    dnl set up compilers
   1.189 +    AS="$gonk_toolchain_prefix"as
   1.190 +    CC="$gonk_toolchain_prefix"gcc
   1.191 +    CXX="$gonk_toolchain_prefix"g++
   1.192 +    CPP="$gonk_toolchain_prefix"cpp
   1.193 +    LD="$gonk_toolchain_prefix"ld
   1.194 +    AR="$gonk_toolchain_prefix"ar
   1.195 +    RANLIB="$gonk_toolchain_prefix"ranlib
   1.196 +    STRIP="$gonk_toolchain_prefix"strip
   1.197 +    OBJCOPY="$gonk_toolchain_prefix"objcopy
   1.198 +
   1.199 +    STLPORT_CPPFLAGS="-I$gonkdir/external/stlport/stlport"
   1.200 +    STLPORT_LIBS="-lstlport"
   1.201 +
   1.202 +    case "$target_cpu" in
   1.203 +    arm)
   1.204 +        ARCH_DIR=arch-arm
   1.205 +        ;;
   1.206 +    i?86)
   1.207 +        ARCH_DIR=arch-x86
   1.208 +        ;;
   1.209 +    esac
   1.210 +
   1.211 +    CPPFLAGS="-DANDROID -isystem $gonkdir/bionic/libc/$ARCH_DIR/include -isystem $gonkdir/bionic/libc/include/ -isystem $gonkdir/bionic/libc/kernel/common -isystem $gonkdir/bionic/libc/kernel/$ARCH_DIR -isystem $gonkdir/bionic/libm/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/system/core/include -isystem $gonkdir/bionic $CPPFLAGS -I$gonkdir/external/valgrind/fxos-include"
   1.212 +    CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
   1.213 +    CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS $STLPORT_CPPFLAGS"
   1.214 +    LIBS="$LIBS $STLPORT_LIBS"
   1.215 +
   1.216 +    dnl Add -llog by default, since we use it all over the place.
   1.217 +    LDFLAGS="-mandroid -L$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib -Wl,-rpath-link=$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib --sysroot=$gonkdir/out/target/product/$GONK_PRODUCT/obj/ -llog $LDFLAGS"
   1.218 +
   1.219 +    dnl prevent cross compile section from using these flags as host flags
   1.220 +    if test -z "$HOST_CPPFLAGS" ; then
   1.221 +        HOST_CPPFLAGS=" "
   1.222 +    fi
   1.223 +    if test -z "$HOST_CFLAGS" ; then
   1.224 +        HOST_CFLAGS=" "
   1.225 +    fi
   1.226 +    if test -z "$HOST_CXXFLAGS" ; then
   1.227 +        HOST_CXXFLAGS=" "
   1.228 +    fi
   1.229 +    if test -z "$HOST_LDFLAGS" ; then
   1.230 +        HOST_LDFLAGS=" "
   1.231 +    fi
   1.232 +
   1.233 +    AC_DEFINE(ANDROID)
   1.234 +    AC_DEFINE(GONK)
   1.235 +else
   1.236 +    MOZ_ANDROID_NDK
   1.237 +fi
   1.238 +
   1.239 +dnl ==============================================================
   1.240 +dnl Get mozilla version from central milestone file
   1.241 +dnl ==============================================================
   1.242 +MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
   1.243 +MOZILLA_UAVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -uaversion`
   1.244 +MOZILLA_SYMBOLVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -symbolversion`
   1.245 +
   1.246 +AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
   1.247 +AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
   1.248 +AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
   1.249 +AC_SUBST(MOZILLA_SYMBOLVERSION)
   1.250 +
   1.251 +# Separate version into components for use in shared object naming etc
   1.252 +changequote(,)
   1.253 +MOZJS_MAJOR_VERSION=`echo $MOZILLA_VERSION | sed "s|\(^[0-9]*\)\.[0-9]*.*|\1|"`
   1.254 +MOZJS_MINOR_VERSION=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.\([0-9]*\).*|\1|"`
   1.255 +MOZJS_PATCH_VERSION=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.[0-9]*[^0-9]*||"`
   1.256 +IS_ALPHA=`echo $MOZILLA_VERSION | grep '[ab]'`
   1.257 +
   1.258 +dnl XXX in a temporary bid to avoid developer anger at renaming files
   1.259 +dnl XXX before "js" symlinks exist, don't change names.
   1.260 +dnl
   1.261 +dnl if test -n "$JS_STANDALONE"; then
   1.262 +dnl JS_SHELL_NAME=js$MOZJS_MAJOR_VERSION
   1.263 +dnl JS_CONFIG_NAME=js$MOZJS_MAJOR_VERSION-config
   1.264 +dnl else
   1.265 +JS_SHELL_NAME=js
   1.266 +JS_CONFIG_NAME=js-config
   1.267 +dnl fi
   1.268 +
   1.269 +changequote([,])
   1.270 +if test -n "$IS_ALPHA"; then
   1.271 +  changequote(,)
   1.272 +  MOZJS_ALPHA=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.[0-9\.]*\([^0-9]\).*|\1|"`
   1.273 +  changequote([,])
   1.274 +fi
   1.275 +AC_DEFINE_UNQUOTED(MOZJS_MAJOR_VERSION,$MOZJS_MAJOR_VERSION)
   1.276 +AC_DEFINE_UNQUOTED(MOZJS_MINOR_VERSION,$MOZJS_MINOR_VERSION)
   1.277 +AC_SUBST(JS_SHELL_NAME)
   1.278 +AC_SUBST(JS_CONFIG_NAME)
   1.279 +AC_SUBST(MOZJS_MAJOR_VERSION)
   1.280 +AC_SUBST(MOZJS_MINOR_VERSION)
   1.281 +AC_SUBST(MOZJS_PATCH_VERSION)
   1.282 +AC_SUBST(MOZJS_ALPHA)
   1.283 +
   1.284 +dnl ========================================================
   1.285 +dnl Checks for compilers.
   1.286 +dnl ========================================================
   1.287 +
   1.288 +dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
   1.289 +AR_FLAGS='crs $@'
   1.290 +
   1.291 +if test "$COMPILE_ENVIRONMENT"; then
   1.292 +
   1.293 +# Note:
   1.294 +#   In Mozilla, we use the names $target, $host and $build incorrectly, but are
   1.295 +#   too far gone to back out now. See Bug 475488:
   1.296 +#     - When we say $target, we mean $host, that is, the system on which
   1.297 +#       Mozilla will be run.
   1.298 +#     - When we say $host, we mean $build, that is, the system on which Mozilla
   1.299 +#       is built.
   1.300 +#     - $target (in its correct usage) is for compilers who generate code for a
   1.301 +#       different platform than $host, so it would not be used by Mozilla.
   1.302 +if test "$target" != "$host"; then
   1.303 +    MOZ_CROSS_COMPILER
   1.304 +else
   1.305 +    AC_PROG_CC
   1.306 +    AC_PROG_CXX
   1.307 +    AC_PROG_RANLIB
   1.308 +    MOZ_PATH_PROGS(AS, $AS as, $CC)
   1.309 +    AC_CHECK_PROGS(AR, ar, :)
   1.310 +    AC_CHECK_PROGS(LD, ld, :)
   1.311 +    AC_CHECK_PROGS(STRIP, strip, :)
   1.312 +    AC_CHECK_PROGS(WINDRES, windres, :)
   1.313 +    if test -z "$HOST_CC"; then
   1.314 +        HOST_CC='$(CC)'
   1.315 +    fi
   1.316 +    if test -z "$HOST_CFLAGS"; then
   1.317 +        HOST_CFLAGS='$(CFLAGS)'
   1.318 +    fi
   1.319 +    if test -z "$HOST_CXX"; then
   1.320 +        HOST_CXX='$(CXX)'
   1.321 +    fi
   1.322 +    if test -z "$HOST_CXXFLAGS"; then
   1.323 +        HOST_CXXFLAGS='$(CXXFLAGS)'
   1.324 +    fi
   1.325 +    if test -z "$HOST_LDFLAGS"; then
   1.326 +        HOST_LDFLAGS='$(LDFLAGS)'
   1.327 +    fi
   1.328 +    if test -z "$HOST_RANLIB"; then
   1.329 +        HOST_RANLIB='$(RANLIB)'
   1.330 +    fi
   1.331 +    if test -z "$HOST_AR"; then
   1.332 +        HOST_AR='$(AR)'
   1.333 +    fi
   1.334 +    if test -z "$HOST_AR_FLAGS"; then
   1.335 +        HOST_AR_FLAGS='$(AR_FLAGS)'
   1.336 +    fi
   1.337 +fi
   1.338 +
   1.339 +MOZ_TOOL_VARIABLES
   1.340 +
   1.341 +MOZ_CHECK_COMPILER_WRAPPER
   1.342 +
   1.343 +if test -n "$GNU_CC" -a -z "$CLANG_CC" ; then
   1.344 +    if test "$GCC_MAJOR_VERSION" -eq 4 -a "$GCC_MINOR_VERSION" -lt 4 ||
   1.345 +       test "$GCC_MAJOR_VERSION" -lt 4; then
   1.346 +        AC_MSG_ERROR([Only GCC 4.4 or newer supported])
   1.347 +    fi
   1.348 +fi
   1.349 +
   1.350 +dnl Special win32 checks
   1.351 +dnl ========================================================
   1.352 +
   1.353 +MOZ_ARG_ENABLE_BOOL(metro,
   1.354 +[  --enable-metro           Enable Windows Metro build targets],
   1.355 +    MOZ_METRO=1,
   1.356 +    MOZ_METRO=)
   1.357 +if test -n "$MOZ_METRO"; then
   1.358 +    AC_DEFINE(MOZ_METRO)
   1.359 +    # Target the Windows 8 Kit
   1.360 +    WINSDK_TARGETVER=602
   1.361 +    WINVER=502
   1.362 +else
   1.363 +    # Target the Windows 7 SDK by default
   1.364 +    WINSDK_TARGETVER=601
   1.365 +    WINVER=502
   1.366 +fi
   1.367 +
   1.368 +MOZ_ARG_WITH_STRING(windows-version,
   1.369 +[  --with-windows-version=WINSDK_TARGETVER
   1.370 +                          Windows SDK version to target. Lowest version
   1.371 +                          currently allowed is 601, highest is 602],
   1.372 +  WINSDK_TARGETVER=$withval)
   1.373 +
   1.374 +# Currently only two sdk versions allowed, 601 and 602
   1.375 +case "$WINSDK_TARGETVER" in
   1.376 +601|602)
   1.377 +    MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
   1.378 +    ;;
   1.379 +
   1.380 +*)
   1.381 +    AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
   1.382 +    ;;
   1.383 +esac
   1.384 +
   1.385 +case "$target" in
   1.386 +*-mingw*)
   1.387 +    if test "$GCC" != "yes" -a -z "$CLANG_CC"; then
   1.388 +        # Check to see if we are really running in a msvc environemnt
   1.389 +        _WIN32_MSVC=1
   1.390 +
   1.391 +        # Make sure compilers are valid
   1.392 +        CFLAGS="$CFLAGS -TC -nologo"
   1.393 +        CXXFLAGS="$CXXFLAGS -TP -nologo"
   1.394 +        # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
   1.395 +        # MSVC warning C4351 warns of newly conformant behavior as of VS2005.
   1.396 +        # MSVC warning C4800 warns when a value is implicitly cast to bool,
   1.397 +        # because this also forces narrowing to a single byte, which can be a
   1.398 +        # perf hit.  But this matters so little in practice (and often we want
   1.399 +        # that behavior) that it's better to turn it off.
   1.400 +        # _CRT_SECURE_NO_WARNINGS disables warnings about using MSVC-specific
   1.401 +        # secure CRT functions.
   1.402 +        CXXFLAGS="$CXXFLAGS -wd4345 -wd4351 -wd4800 -D_CRT_SECURE_NO_WARNINGS"
   1.403 +        AC_LANG_SAVE
   1.404 +        AC_LANG_C
   1.405 +        AC_TRY_COMPILE([#include <stdio.h>],
   1.406 +            [ printf("Hello World\n"); ],,
   1.407 +            AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
   1.408 +
   1.409 +        AC_LANG_CPLUSPLUS
   1.410 +        AC_TRY_COMPILE([#include <new.h>],
   1.411 +            [ unsigned *test = new unsigned(42); ],,
   1.412 +            AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
   1.413 +        AC_LANG_RESTORE
   1.414 +
   1.415 +        changequote(,)
   1.416 +        _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
   1.417 +        changequote([,])
   1.418 +
   1.419 +        # Determine compiler version
   1.420 +        CC_VERSION=`${CC} -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
   1.421 +        _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
   1.422 +        _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
   1.423 +        _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
   1.424 +        _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
   1.425 +        _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
   1.426 +
   1.427 +        CXX_VERSION=`${CXX} -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
   1.428 +        _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
   1.429 +
   1.430 +        if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
   1.431 +            AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
   1.432 +        fi
   1.433 +
   1.434 +        AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
   1.435 +        AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
   1.436 +
   1.437 +        if test "$_CC_MAJOR_VERSION" = "16"; then
   1.438 +            _CC_SUITE=10
   1.439 +        elif test "$_CC_MAJOR_VERSION" = "17"; then
   1.440 +            _CC_SUITE=11
   1.441 +        elif test "$_CC_MAJOR_VERSION" = "18"; then
   1.442 +            _CC_SUITE=12
   1.443 +        else
   1.444 +            AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
   1.445 +        fi
   1.446 +
   1.447 +        dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
   1.448 +        dnl not something else like "magnetic tape manipulation utility".
   1.449 +        MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
   1.450 +        if test -z "$MSMT_TOOL"; then
   1.451 +          AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
   1.452 +        fi
   1.453 +
   1.454 +        changequote(,)
   1.455 +        _MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
   1.456 +        changequote([,])
   1.457 +        MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
   1.458 +        if test -z "$MSMANIFEST_TOOL_VERSION"; then
   1.459 +          AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
   1.460 +        fi
   1.461 +
   1.462 +        MSMANIFEST_TOOL=1
   1.463 +        unset MSMT_TOOL
   1.464 +
   1.465 +        # Check linker version
   1.466 +        _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
   1.467 +        _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
   1.468 +        if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
   1.469 +            AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
   1.470 +        fi
   1.471 +
   1.472 +        INCREMENTAL_LINKER=1
   1.473 +
   1.474 +        unset _MSVC_VER_FILTER
   1.475 +    elif test -z "$CLANG_CC"; then
   1.476 +        # Check w32api version
   1.477 +        _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
   1.478 +        _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
   1.479 +        AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
   1.480 +        AC_TRY_COMPILE([#include <w32api.h>],
   1.481 +            #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
   1.482 +                (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
   1.483 +                 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
   1.484 +                #error "test failed."
   1.485 +            #endif
   1.486 +            , [ res=yes ], [ res=no ])
   1.487 +        AC_MSG_RESULT([$res])
   1.488 +        if test "$res" != "yes"; then
   1.489 +            AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
   1.490 +        fi
   1.491 +        # Check windres version
   1.492 +        AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
   1.493 +        _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
   1.494 +        AC_MSG_RESULT([$_WINDRES_VERSION])
   1.495 +        _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
   1.496 +        _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
   1.497 +        _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
   1.498 +        WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
   1.499 +        WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
   1.500 +        WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
   1.501 +        if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
   1.502 +                "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
   1.503 +                "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
   1.504 +                "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
   1.505 +                "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
   1.506 +                "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
   1.507 +        then
   1.508 +            AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
   1.509 +        fi
   1.510 +
   1.511 +        MOZ_WINSDK_MAXVER=0x06010000
   1.512 +    fi # !GNU_CC
   1.513 +
   1.514 +    # If MSVC or clang
   1.515 +    if test "$GCC" != "yes" -o -n "$CLANG_CC" ; then
   1.516 +        MOZ_FIND_WINSDK_VERSION
   1.517 +    fi
   1.518 +
   1.519 +    AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
   1.520 +    AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
   1.521 +    # Require OS features provided by IE 6.0 SP2 (XP SP2)
   1.522 +    AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
   1.523 +
   1.524 +    # If the maximum version supported by this SDK is lower than the target
   1.525 +    # version, error out
   1.526 +    AC_MSG_CHECKING([for Windows SDK being recent enough])
   1.527 +    if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
   1.528 +        AC_MSG_RESULT("yes")
   1.529 +    else
   1.530 +        AC_MSG_RESULT("no")
   1.531 +        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.532 +    fi
   1.533 +
   1.534 +    AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
   1.535 +    # Definitions matching sdkddkver.h
   1.536 +    AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
   1.537 +    ;;
   1.538 +esac
   1.539 +
   1.540 +AC_PROG_CPP
   1.541 +AC_PROG_CXXCPP
   1.542 +
   1.543 +if test -n "$_WIN32_MSVC"; then
   1.544 +    SKIP_PATH_CHECKS=1
   1.545 +    SKIP_COMPILER_CHECKS=1
   1.546 +    SKIP_LIBRARY_CHECKS=1
   1.547 +
   1.548 +    # Since we're skipping compiler and library checks, hard-code
   1.549 +    # some facts here.
   1.550 +
   1.551 +    # Common to all MSVC environments:
   1.552 +
   1.553 +    AC_DEFINE(HAVE_LOCALECONV)
   1.554 +    AC_DEFINE(HAVE_HYPOT)
   1.555 +fi
   1.556 +
   1.557 +fi # COMPILE_ENVIRONMENT
   1.558 +
   1.559 +# Check to see if we are running in a broken QEMU scratchbox.
   1.560 +# We know that anything below 1.0.16 is broken.
   1.561 +AC_CHECK_PROGS(SBCONF, sb-conf ve, "")
   1.562 +if test -n "$SBCONF"; then
   1.563 +    _sb_version=`$SBCONF ve`
   1.564 +    _sb_version_major=`echo $_sb_version | cut -f1 -d.`
   1.565 +    _sb_version_minor=`echo $_sb_version | cut -f2 -d.`
   1.566 +    _sb_version_point=`echo $_sb_version | cut -f3 -d.`
   1.567 +    if test $_sb_version_major -eq 1 -a $_sb_version_minor -eq 0 -a $_sb_version_point -le 16; then
   1.568 +        QEMU_CANT_RUN_JS_SHELL=1
   1.569 +    fi
   1.570 +fi
   1.571 +AC_SUBST(QEMU_CANT_RUN_JS_SHELL)
   1.572 +
   1.573 +AC_SUBST(_MSC_VER)
   1.574 +
   1.575 +AC_SUBST(GNU_AS)
   1.576 +AC_SUBST(GNU_LD)
   1.577 +AC_SUBST(GNU_CC)
   1.578 +AC_SUBST(GNU_CXX)
   1.579 +AC_SUBST(INTEL_CC)
   1.580 +AC_SUBST(INTEL_CXX)
   1.581 +
   1.582 +dnl ========================================================
   1.583 +dnl Checks for programs.
   1.584 +dnl ========================================================
   1.585 +AC_PROG_INSTALL
   1.586 +AC_PROG_LN_S
   1.587 +
   1.588 +AC_MSG_CHECKING([for tar archiver])
   1.589 +AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
   1.590 +if test -z "$TAR"; then
   1.591 +    AC_MSG_WARN([no tar archiver found in \$PATH])
   1.592 +fi
   1.593 +AC_MSG_RESULT([$TAR])
   1.594 +AC_SUBST(TAR)
   1.595 +
   1.596 +if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
   1.597 +AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
   1.598 +_perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
   1.599 +_perl_res=$?
   1.600 +AC_MSG_RESULT([$_perl_version])
   1.601 +
   1.602 +if test "$_perl_res" != 0; then
   1.603 +    AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
   1.604 +fi
   1.605 +fi
   1.606 +
   1.607 +AC_MSG_CHECKING([for full perl installation])
   1.608 +_perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
   1.609 +_perl_res=$?
   1.610 +if test "$_perl_res" != 0; then
   1.611 +    AC_MSG_RESULT([no])
   1.612 +    AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
   1.613 +else
   1.614 +    AC_MSG_RESULT([yes])
   1.615 +fi
   1.616 +
   1.617 +MOZ_PYTHON
   1.618 +
   1.619 +if test -z "$COMPILE_ENVIRONMENT"; then
   1.620 +    NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
   1.621 +fi
   1.622 +AC_SUBST(NSINSTALL_BIN)
   1.623 +
   1.624 +MOZ_PATH_PROG(DOXYGEN, doxygen, :)
   1.625 +MOZ_PATH_PROG(AUTOCONF, autoconf, :)
   1.626 +MOZ_PATH_PROG(XARGS, xargs)
   1.627 +if test -z "$XARGS" -o "$XARGS" = ":"; then
   1.628 +    AC_MSG_ERROR([xargs not found in \$PATH .])
   1.629 +fi
   1.630 +
   1.631 +if test "$COMPILE_ENVIRONMENT"; then
   1.632 +
   1.633 +dnl ========================================================
   1.634 +dnl = Mac OS X toolchain support
   1.635 +dnl ========================================================
   1.636 +
   1.637 +dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
   1.638 +dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
   1.639 +dnl when we can run target binaries.
   1.640 +AC_SUBST(UNIVERSAL_BINARY)
   1.641 +AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
   1.642 +
   1.643 +dnl ========================================================
   1.644 +dnl Check for MacOS deployment target version
   1.645 +dnl ========================================================
   1.646 +
   1.647 +MOZ_ARG_ENABLE_STRING(macos-target,
   1.648 +                      [  --enable-macos-target=VER (default=10.6)
   1.649 +                          Set the minimum MacOS version needed at runtime],
   1.650 +                      [_MACOSX_DEPLOYMENT_TARGET=$enableval])
   1.651 +
   1.652 +if test "$target_cpu" != "arm"; then
   1.653 +case "$target" in
   1.654 +*-darwin*)
   1.655 +    if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
   1.656 +        dnl Use the specified value
   1.657 +        export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
   1.658 +    else
   1.659 +        dnl No value specified on the command line or in the environment,
   1.660 +        dnl use architecture minimum.
   1.661 +        export MACOSX_DEPLOYMENT_TARGET=10.6
   1.662 +    fi
   1.663 +    ;;
   1.664 +esac
   1.665 +fi
   1.666 +
   1.667 +AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
   1.668 +
   1.669 +dnl ========================================================
   1.670 +dnl = Mac OS X SDK support
   1.671 +dnl ========================================================
   1.672 +MACOS_SDK_DIR=
   1.673 +MOZ_ARG_WITH_STRING(macos-sdk,
   1.674 +[  --with-macos-sdk=dir    Location of platform SDK to use (Mac OS X only)],
   1.675 +    MACOS_SDK_DIR=$withval)
   1.676 +
   1.677 +dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
   1.678 +AC_SUBST(MACOS_SDK_DIR)
   1.679 +
   1.680 +if test "$MACOS_SDK_DIR"; then
   1.681 +  dnl Sync this section with the ones in NSPR and NSS.
   1.682 +  dnl Changes to the cross environment here need to be accounted for in
   1.683 +  dnl the libIDL checks (below) and xpidl build.
   1.684 +
   1.685 +  if test ! -d "$MACOS_SDK_DIR"; then
   1.686 +    AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
   1.687 +specify a valid SDK.  SDKs are installed when the optional cross-development
   1.688 +tools are selected during the Xcode/Developer Tools installation.])
   1.689 +  fi
   1.690 +
   1.691 +  CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
   1.692 +  CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
   1.693 +
   1.694 +  dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
   1.695 +  CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
   1.696 +  CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
   1.697 +
   1.698 +  AC_LANG_SAVE
   1.699 +  AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
   1.700 +  AC_LANG_CPLUSPLUS
   1.701 +  AC_TRY_COMPILE([#include <new>
   1.702 +                 int main() { return 0; }],
   1.703 +   result=yes,
   1.704 +   result=no)
   1.705 +  AC_LANG_RESTORE
   1.706 +  AC_MSG_RESULT($result)
   1.707 +
   1.708 +  if test "$result" = "no" ; then
   1.709 +    AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
   1.710 +  fi
   1.711 +fi
   1.712 +
   1.713 +fi # COMPILE_ENVIRONMENT
   1.714 +
   1.715 +if test -n "$MAKE"; then
   1.716 +  if test `echo $MAKE | grep -c make.py` != 1; then
   1.717 +     NOT_PYMAKE=$MAKE
   1.718 +  fi
   1.719 +fi
   1.720 +
   1.721 +case "$host_os" in
   1.722 +mingw*)
   1.723 +    MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
   1.724 +    ;;
   1.725 +*)
   1.726 +    MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
   1.727 +    ;;
   1.728 +esac
   1.729 +if test "$GMAKE" = ":"; then
   1.730 +   AC_MSG_ERROR([GNU make not found])
   1.731 +fi
   1.732 +
   1.733 +# MAKE will be set by client.mk, but still need this for standalone js builds
   1.734 +if test -z "$MAKE"; then
   1.735 +  MAKE=$GMAKE
   1.736 +fi
   1.737 +
   1.738 +if test "$COMPILE_ENVIRONMENT"; then
   1.739 +
   1.740 +AC_PATH_XTRA
   1.741 +
   1.742 +XCFLAGS="$X_CFLAGS"
   1.743 +
   1.744 +fi # COMPILE_ENVIRONMENT
   1.745 +
   1.746 +dnl ========================================================
   1.747 +dnl set the defaults first
   1.748 +dnl ========================================================
   1.749 +AS_BIN=$AS
   1.750 +AR_LIST='$(AR) t'
   1.751 +AR_EXTRACT='$(AR) x'
   1.752 +AR_DELETE='$(AR) d'
   1.753 +AS='$(CC)'
   1.754 +AS_DASH_C_FLAG='-c'
   1.755 +DLL_PREFIX=lib
   1.756 +LIB_PREFIX=lib
   1.757 +DLL_SUFFIX=.so
   1.758 +OBJ_SUFFIX=o
   1.759 +LIB_SUFFIX=a
   1.760 +ASM_SUFFIX=s
   1.761 +IMPORT_LIB_SUFFIX=
   1.762 +TARGET_MD_ARCH=unix
   1.763 +DIRENT_INO=d_ino
   1.764 +MOZ_USER_DIR=".mozilla"
   1.765 +
   1.766 +MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
   1.767 +
   1.768 +MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
   1.769 +
   1.770 +USE_DEPENDENT_LIBS=1
   1.771 +
   1.772 +_PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
   1.773 +
   1.774 +if test -n "$CROSS_COMPILE"; then
   1.775 +    OS_TARGET="${target_os}"
   1.776 +    OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
   1.777 +    OS_RELEASE=
   1.778 +    case "${target_os}" in
   1.779 +        linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
   1.780 +        kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU/kFreeBSD ;;
   1.781 +        gnu*)         OS_ARCH=GNU ;;
   1.782 +        solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
   1.783 +        mingw*)       OS_ARCH=WINNT OS_TARGET=WINNT ;;
   1.784 +        darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
   1.785 +        dragonfly*)   OS_ARCH=DragonFly OS_TARGET=DragonFly ;;
   1.786 +        freebsd*)     OS_ARCH=FreeBSD OS_TARGET=FreeBSD ;;
   1.787 +        netbsd*)      OS_ARCH=NetBSD OS_TARGET=NetBSD ;;
   1.788 +        openbsd*)     OS_ARCH=OpenBSD OS_TARGET=OpenBSD ;;
   1.789 +    esac
   1.790 +    case "${target}" in
   1.791 +        *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
   1.792 +    esac
   1.793 +else
   1.794 +    OS_TARGET=`uname -s`
   1.795 +    OS_ARCH=`uname -s | sed -e 's|/|_|g'`
   1.796 +    OS_RELEASE=`uname -r`
   1.797 +fi
   1.798 +
   1.799 +# Before this used `uname -m` when not cross compiling
   1.800 +# but that breaks when you have a 64 bit kernel with a 32 bit userland.
   1.801 +OS_TEST="${target_cpu}"
   1.802 +
   1.803 +HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
   1.804 +
   1.805 +#######################################################################
   1.806 +# Master "Core Components" macros for getting the OS target           #
   1.807 +#######################################################################
   1.808 +
   1.809 +#
   1.810 +# If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
   1.811 +# cross-compilation.
   1.812 +#
   1.813 +
   1.814 +#
   1.815 +# Define and override various archtecture-specific variables, including
   1.816 +# HOST_OS_ARCH
   1.817 +# OS_ARCH
   1.818 +# OS_TEST
   1.819 +# OS_TARGET
   1.820 +# OS_RELEASE
   1.821 +# OS_MINOR_RELEASE
   1.822 +#
   1.823 +
   1.824 +case "$HOST_OS_ARCH" in
   1.825 +mingw*)
   1.826 +    HOST_OS_ARCH=WINNT
   1.827 +    ;;
   1.828 +darwin*)
   1.829 +    HOST_OS_ARCH=Darwin
   1.830 +    ;;
   1.831 +linux*)
   1.832 +    HOST_OS_ARCH=Linux
   1.833 +    ;;
   1.834 +kfreebsd*-gnu)
   1.835 +    HOST_OS_ARCH=GNU_kFreeBSD
   1.836 +    ;;
   1.837 +gnu*)
   1.838 +    HOST_OS_ARCH=GNU
   1.839 +    ;;
   1.840 +dragonfly*)
   1.841 +    HOST_OS_ARCH=DragonFly
   1.842 +    ;;
   1.843 +freebsd*)
   1.844 +    HOST_OS_ARCH=FreeBSD
   1.845 +    ;;
   1.846 +netbsd*)
   1.847 +    HOST_OS_ARCH=NetBSD
   1.848 +    ;;
   1.849 +openbsd*)
   1.850 +    HOST_OS_ARCH=OpenBSD
   1.851 +    ;;
   1.852 +solaris*)
   1.853 +    HOST_OS_ARCH=SunOS
   1.854 +    SOLARIS_SUNPRO_CC=
   1.855 +    SOLARIS_SUNPRO_CXX=
   1.856 +    if test -z "$GNU_CC"; then
   1.857 +        if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
   1.858 +            SOLARIS_SUNPRO_CC=1
   1.859 +       fi
   1.860 +    fi
   1.861 +
   1.862 +    if test -z "$GNU_CXX"; then
   1.863 +       if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
   1.864 +           SOLARIS_SUNPRO_CXX=1
   1.865 +       fi
   1.866 +    fi
   1.867 +    AC_SUBST(SOLARIS_SUNPRO_CC)
   1.868 +    AC_SUBST(SOLARIS_SUNPRO_CXX)
   1.869 +    ;;
   1.870 +esac
   1.871 +
   1.872 +case "$OS_ARCH" in
   1.873 +WINNT)
   1.874 +    if test -z "$CROSS_COMPILE" ; then
   1.875 +        OS_TEST=`uname -p`
   1.876 +    fi
   1.877 +    ;;
   1.878 +Windows_NT)
   1.879 +#
   1.880 +# If uname -s returns "Windows_NT", we assume that we are using
   1.881 +# the uname.exe in MKS toolkit.
   1.882 +#
   1.883 +# The -r option of MKS uname only returns the major version number.
   1.884 +# So we need to use its -v option to get the minor version number.
   1.885 +# Moreover, it doesn't have the -p option, so we need to use uname -m.
   1.886 +#
   1.887 +    OS_ARCH=WINNT
   1.888 +    OS_TARGET=WINNT
   1.889 +    OS_MINOR_RELEASE=`uname -v`
   1.890 +    if test "$OS_MINOR_RELEASE" = "00"; then
   1.891 +        OS_MINOR_RELEASE=0
   1.892 +    fi
   1.893 +    OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
   1.894 +    ;;
   1.895 +MINGW*_NT*)
   1.896 +#
   1.897 +# If uname -s returns MINGW32_NT-5.1, we assume that we are using
   1.898 +# the uname.exe in the MSYS tools.
   1.899 +#
   1.900 +    OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
   1.901 +    OS_ARCH=WINNT
   1.902 +    OS_TARGET=WINNT
   1.903 +    ;;
   1.904 +AIX)
   1.905 +    OS_RELEASE=`uname -v`.`uname -r`
   1.906 +    OS_TEST=${target_cpu}
   1.907 +    if test -z "$GNU_CC"; then
   1.908 +        if test "`$CC -qversion 2>&1 | egrep -c 'IBM XL'`" != "0"; then
   1.909 +            AIX_IBM_XLC=1
   1.910 +        fi
   1.911 +    fi
   1.912 +    ;;
   1.913 +Darwin)
   1.914 +    case "${target_cpu}" in
   1.915 +    powerpc*)
   1.916 +        OS_TEST=ppc
   1.917 +        ;;
   1.918 +    i*86*)
   1.919 +        OS_TEST=i386
   1.920 +        ;;
   1.921 +    x86_64)
   1.922 +        OS_TEST=x86_64
   1.923 +        ;;
   1.924 +    *)
   1.925 +        if test -z "$CROSS_COMPILE" ; then
   1.926 +            OS_TEST=`uname -p`
   1.927 +        fi
   1.928 +        ;;
   1.929 +    esac
   1.930 +    ;;
   1.931 +esac
   1.932 +
   1.933 +# Only set CPU_ARCH if we recognize the value of OS_TEST
   1.934 +
   1.935 +case "$OS_TEST" in
   1.936 +*86 | i86pc)
   1.937 +    CPU_ARCH=x86
   1.938 +    ;;
   1.939 +
   1.940 +powerpc64 | ppc64 | powerpc64le | ppc64le)
   1.941 +    CPU_ARCH=ppc64
   1.942 +    ;;
   1.943 +
   1.944 +powerpc | ppc | rs6000)
   1.945 +    CPU_ARCH=ppc
   1.946 +    ;;
   1.947 +
   1.948 +Alpha | alpha | ALPHA)
   1.949 +    CPU_ARCH=Alpha
   1.950 +    ;;
   1.951 +
   1.952 +s390)
   1.953 +    CPU_ARCH=s390
   1.954 +    ;;
   1.955 +
   1.956 +s390x)
   1.957 +    CPU_ARCH=s390x
   1.958 +    ;;
   1.959 +
   1.960 +hppa* | parisc)
   1.961 +    CPU_ARCH=hppa
   1.962 +    ;;
   1.963 +
   1.964 +sun4u | sparc*)
   1.965 +    CPU_ARCH=sparc
   1.966 +    ;;
   1.967 +
   1.968 +x86_64 | ia64)
   1.969 +    CPU_ARCH="$OS_TEST"
   1.970 +    ;;
   1.971 +
   1.972 +arm*)
   1.973 +    CPU_ARCH=arm
   1.974 +    ;;
   1.975 +
   1.976 +mips|mipsel)
   1.977 +    CPU_ARCH="mips"
   1.978 +    ;;
   1.979 +
   1.980 +aarch64*)
   1.981 +    CPU_ARCH=aarch64
   1.982 +    ;;
   1.983 +
   1.984 +esac
   1.985 +
   1.986 +if test -z "$OS_TARGET"; then
   1.987 +    OS_TARGET=$OS_ARCH
   1.988 +fi
   1.989 +OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
   1.990 +
   1.991 +dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
   1.992 +dnl ===============================================================
   1.993 +INTEL_ARCHITECTURE=
   1.994 +case "$OS_TEST" in
   1.995 +    x86_64|i?86)
   1.996 +      INTEL_ARCHITECTURE=1
   1.997 +esac
   1.998 +
   1.999 +dnl Configure platform-specific CPU architecture compiler options.
  1.1000 +dnl ==============================================================
  1.1001 +MOZ_ARCH_OPTS
  1.1002 +
  1.1003 +dnl =================================================================
  1.1004 +dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
  1.1005 +dnl which is bad when cross compiling.
  1.1006 +dnl =================================================================
  1.1007 +if test "$COMPILE_ENVIRONMENT"; then
  1.1008 +configure_static_assert_macros='
  1.1009 +#define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
  1.1010 +#define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
  1.1011 +#define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
  1.1012 +'
  1.1013 +
  1.1014 +dnl test that the macros actually work:
  1.1015 +AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
  1.1016 +AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
  1.1017 + [AC_LANG_SAVE
  1.1018 +  AC_LANG_C
  1.1019 +  ac_cv_static_assertion_macros_work="yes"
  1.1020 +  AC_TRY_COMPILE([$configure_static_assert_macros],
  1.1021 +                 [CONFIGURE_STATIC_ASSERT(1)],
  1.1022 +                 ,
  1.1023 +                 ac_cv_static_assertion_macros_work="no")
  1.1024 +  AC_TRY_COMPILE([$configure_static_assert_macros],
  1.1025 +                 [CONFIGURE_STATIC_ASSERT(0)],
  1.1026 +                 ac_cv_static_assertion_macros_work="no",
  1.1027 +                 )
  1.1028 +  AC_LANG_CPLUSPLUS
  1.1029 +  AC_TRY_COMPILE([$configure_static_assert_macros],
  1.1030 +                 [CONFIGURE_STATIC_ASSERT(1)],
  1.1031 +                 ,
  1.1032 +                 ac_cv_static_assertion_macros_work="no")
  1.1033 +  AC_TRY_COMPILE([$configure_static_assert_macros],
  1.1034 +                 [CONFIGURE_STATIC_ASSERT(0)],
  1.1035 +                 ac_cv_static_assertion_macros_work="no",
  1.1036 +                 )
  1.1037 +  AC_LANG_RESTORE
  1.1038 + ])
  1.1039 +AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
  1.1040 +if test "$ac_cv_static_assertion_macros_work" = "no"; then
  1.1041 +    AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
  1.1042 +fi
  1.1043 +fi # COMPILE_ENVIRONMENT
  1.1044 +
  1.1045 +dnl ========================================================
  1.1046 +dnl Android libstdc++, placed here so it can use MOZ_ARCH
  1.1047 +dnl computed above.
  1.1048 +dnl ========================================================
  1.1049 +
  1.1050 +MOZ_ANDROID_STLPORT
  1.1051 +
  1.1052 +dnl ========================================================
  1.1053 +dnl Suppress Clang Argument Warnings
  1.1054 +dnl ========================================================
  1.1055 +if test -n "$CLANG_CC"; then
  1.1056 +    _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
  1.1057 +    CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
  1.1058 +fi
  1.1059 +if test -n "$CLANG_CXX"; then
  1.1060 +    _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
  1.1061 +fi
  1.1062 +
  1.1063 +dnl ========================================================
  1.1064 +dnl = Use Address Sanitizer
  1.1065 +dnl ========================================================
  1.1066 +MOZ_ARG_ENABLE_BOOL(address-sanitizer,
  1.1067 +[  --enable-address-sanitizer       Enable Address Sanitizer (default=no)],
  1.1068 +    MOZ_ASAN=1,
  1.1069 +    MOZ_ASAN= )
  1.1070 +if test -n "$MOZ_ASAN"; then
  1.1071 +    MOZ_LLVM_HACKS=1
  1.1072 +    AC_DEFINE(MOZ_ASAN)
  1.1073 +    MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
  1.1074 +fi
  1.1075 +AC_SUBST(MOZ_ASAN)
  1.1076 +AC_SUBST(LLVM_SYMBOLIZER)
  1.1077 +
  1.1078 +dnl ========================================================
  1.1079 +dnl = Enable hacks required for LLVM instrumentations
  1.1080 +dnl ========================================================
  1.1081 +MOZ_ARG_ENABLE_BOOL(llvm-hacks,
  1.1082 +[  --enable-llvm-hacks       Enable workarounds required for several LLVM instrumentations (default=no)],
  1.1083 +    MOZ_LLVM_HACKS=1,
  1.1084 +    MOZ_LLVM_HACKS= )
  1.1085 +if test -n "$MOZ_LLVM_HACKS"; then
  1.1086 +    MOZ_NO_WLZDEFS=1
  1.1087 +fi
  1.1088 +
  1.1089 +dnl ========================================================
  1.1090 +dnl GNU specific defaults
  1.1091 +dnl ========================================================
  1.1092 +if test "$GNU_CC"; then
  1.1093 +    # Per bug 719659 comment 2, some of the headers on ancient build machines
  1.1094 +    # may require gnu89 inline semantics.  But otherwise, we use C99.
  1.1095 +    # But on OS X we just use C99 plus GNU extensions, in order to fix
  1.1096 +    # bug 917526.
  1.1097 +    CFLAGS="$CFLAGS -std=gnu99"
  1.1098 +    if test "${OS_ARCH}" != Darwin; then
  1.1099 +        CFLAGS="$CFLAGS -fgnu89-inline"
  1.1100 +    fi
  1.1101 +    MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(notdir $@) -o $@'
  1.1102 +    MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(notdir $@) -o $@'
  1.1103 +    DSO_LDOPTS='-shared'
  1.1104 +    if test "$GCC_USE_GNU_LD"; then
  1.1105 +        # Some tools like ASan use a runtime library that is only
  1.1106 +        # linked against executables, so we must allow undefined
  1.1107 +        # symbols for shared objects in some cases.
  1.1108 +        if test -z "$MOZ_NO_WLZDEFS"; then
  1.1109 +            # Don't allow undefined symbols in libraries
  1.1110 +            DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
  1.1111 +        fi
  1.1112 +    fi
  1.1113 +    WARNINGS_AS_ERRORS='-Werror'
  1.1114 +    DSO_CFLAGS=''
  1.1115 +    DSO_PIC_CFLAGS='-fPIC'
  1.1116 +    ASFLAGS="$ASFLAGS -fPIC"
  1.1117 +    AC_MSG_CHECKING([for --noexecstack option to as])
  1.1118 +    _SAVE_CFLAGS=$CFLAGS
  1.1119 +    CFLAGS="$CFLAGS -Wa,--noexecstack"
  1.1120 +    AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
  1.1121 +                     [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
  1.1122 +                     AC_MSG_RESULT([no]))
  1.1123 +    CFLAGS=$_SAVE_CFLAGS
  1.1124 +    AC_MSG_CHECKING([for -z noexecstack option to ld])
  1.1125 +    _SAVE_LDFLAGS=$LDFLAGS
  1.1126 +    LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
  1.1127 +    AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
  1.1128 +                  AC_MSG_RESULT([no])
  1.1129 +                  LDFLAGS=$_SAVE_LDFLAGS)
  1.1130 +
  1.1131 +    AC_MSG_CHECKING([for -z text option to ld])
  1.1132 +    _SAVE_LDFLAGS=$LDFLAGS
  1.1133 +    LDFLAGS="$LDFLAGS -Wl,-z,text"
  1.1134 +    AC_TRY_LINK(,,AC_MSG_RESULT([yes])
  1.1135 +                  [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,text"],
  1.1136 +                  AC_MSG_RESULT([no])
  1.1137 +                  LDFLAGS=$_SAVE_LDFLAGS)
  1.1138 +
  1.1139 +    AC_MSG_CHECKING([for --build-id option to ld])
  1.1140 +    _SAVE_LDFLAGS=$LDFLAGS
  1.1141 +    LDFLAGS="$LDFLAGS -Wl,--build-id"
  1.1142 +    AC_TRY_LINK(,,AC_MSG_RESULT([yes])
  1.1143 +                  [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,--build-id"],
  1.1144 +                  AC_MSG_RESULT([no])
  1.1145 +                  LDFLAGS=$_SAVE_LDFLAGS)
  1.1146 +
  1.1147 +    # Turn on GNU-specific warnings:
  1.1148 +    # -Wall - turn on a lot of warnings
  1.1149 +    # -Wpointer-arith - good to have
  1.1150 +    # -Wdeclaration-after-statement - MSVC doesn't like these
  1.1151 +    # -Werror=return-type - catches missing returns, zero false positives
  1.1152 +    # -Werror=int-to-pointer-cast - catches cast to pointer from integer of different size
  1.1153 +    # -Wtype-limits - catches overflow bugs, few false positives
  1.1154 +    # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
  1.1155 +    # -Wsign-compare - catches comparison of signed and unsigned types
  1.1156 +    #
  1.1157 +    _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
  1.1158 +    MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
  1.1159 +    MOZ_C_SUPPORTS_WARNING(-W, error=int-to-pointer-cast, ac_c_has_werror_int_to_pointer_cast)
  1.1160 +    MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
  1.1161 +    MOZ_C_SUPPORTS_WARNING(-W, sign-compare, ac_c_has_sign_compare)
  1.1162 +
  1.1163 +    # Turn off the following warnings that -Wall turns on:
  1.1164 +    # -Wno-unused - lots of violations in third-party code
  1.1165 +    #
  1.1166 +    _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
  1.1167 +
  1.1168 +    if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
  1.1169 +       # Don't use -Wcast-align with ICC or clang
  1.1170 +       case "$CPU_ARCH" in
  1.1171 +           # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
  1.1172 +           hppa | ia64 | sparc | arm)
  1.1173 +           ;;
  1.1174 +           *)
  1.1175 +        _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
  1.1176 +           ;;
  1.1177 +       esac
  1.1178 +    fi
  1.1179 +
  1.1180 +    _DEFINES_CFLAGS='-include $(DEPTH)/js/src/js-confdefs.h -DMOZILLA_CLIENT'
  1.1181 +    _USE_CPP_INCLUDE_FLAG=1
  1.1182 +
  1.1183 +elif test "$SOLARIS_SUNPRO_CC"; then
  1.1184 +    DSO_CFLAGS=''
  1.1185 +    if test "$CPU_ARCH" = "sparc"; then
  1.1186 +        # for Sun Studio on Solaris/SPARC
  1.1187 +        DSO_PIC_CFLAGS='-xcode=pic32'
  1.1188 +    else
  1.1189 +        DSO_PIC_CFLAGS='-KPIC'
  1.1190 +    fi
  1.1191 +    _DEFINES_CFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
  1.1192 +else
  1.1193 +    MKSHLIB='$(LD) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
  1.1194 +    MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
  1.1195 +
  1.1196 +    DSO_LDOPTS='-shared'
  1.1197 +    if test "$GNU_LD"; then
  1.1198 +        # Don't allow undefined symbols in libraries
  1.1199 +        DSO_LDOPTS="$DSO_LDOPTS -z defs"
  1.1200 +    fi
  1.1201 +
  1.1202 +    DSO_CFLAGS=''
  1.1203 +    DSO_PIC_CFLAGS='-KPIC'
  1.1204 +    _DEFINES_CFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
  1.1205 +fi
  1.1206 +
  1.1207 +if test "$GNU_CXX"; then
  1.1208 +    # Turn on GNU-specific warnings:
  1.1209 +    # -Wall - turn on a lot of warnings
  1.1210 +    # -Wpointer-arith - good to have
  1.1211 +    # -Woverloaded-virtual - ???
  1.1212 +    # -Werror=return-type - catches missing returns, zero false positives
  1.1213 +    # -Werror=int-to-pointer-cast - catches cast to pointer from integer of different size
  1.1214 +    # -Wtype-limits - catches overflow bugs, few false positives
  1.1215 +    # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
  1.1216 +    # -Werror=conversion-null - catches conversions between NULL and non-pointer types
  1.1217 +    # -Wsign-compare - catches comparison of signed and unsigned types
  1.1218 +    #
  1.1219 +    _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
  1.1220 +    MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
  1.1221 +    MOZ_CXX_SUPPORTS_WARNING(-W, error=int-to-pointer-cast, ac_cxx_has_werror_int_to_pointer_cast)
  1.1222 +    MOZ_CXX_SUPPORTS_WARNING(-W, type-limits, ac_cxx_has_wtype_limits)
  1.1223 +    MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
  1.1224 +    MOZ_CXX_SUPPORTS_WARNING(-W, error=conversion-null, ac_cxx_has_werror_conversion_null)
  1.1225 +    MOZ_CXX_SUPPORTS_WARNING(-W, sign-compare, ac_cxx_has_sign_compare)
  1.1226 +
  1.1227 +    # Turn off the following warnings that -Wall turns on:
  1.1228 +    # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
  1.1229 +    #
  1.1230 +    MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
  1.1231 +
  1.1232 +    if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
  1.1233 +       # Don't use -Wcast-align with ICC or clang
  1.1234 +       case "$CPU_ARCH" in
  1.1235 +           # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
  1.1236 +           hppa | ia64 | sparc | arm)
  1.1237 +           ;;
  1.1238 +           *)
  1.1239 +        _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
  1.1240 +           ;;
  1.1241 +       esac
  1.1242 +    fi
  1.1243 +
  1.1244 +    _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/js/src/js-confdefs.h'
  1.1245 +    _USE_CPP_INCLUDE_FLAG=1
  1.1246 +
  1.1247 +    # Recent clang and gcc support C++11 deleted functions without warnings if
  1.1248 +    # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
  1.1249 +    # versions).  We can't use -std=c++0x yet, so gcc's support must remain
  1.1250 +    # unused.  But clang's warning can be disabled, so when compiling with clang
  1.1251 +    # we use it to opt out of the warning, enabling (macro-encapsulated) use of
  1.1252 +    # deleted function syntax.
  1.1253 +    if test "$CLANG_CXX"; then
  1.1254 +        _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
  1.1255 +        MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
  1.1256 +    fi
  1.1257 +
  1.1258 +else
  1.1259 +    _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_JS_CONFDEFS_H_ $(ACDEFINES)'
  1.1260 +fi
  1.1261 +
  1.1262 +dnl gcc can come with its own linker so it is better to use the pass-thru calls
  1.1263 +dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
  1.1264 +dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
  1.1265 +dnl normal behavior.
  1.1266 +dnl ========================================================
  1.1267 +MKSHLIB_FORCE_ALL=
  1.1268 +MKSHLIB_UNFORCE_ALL=
  1.1269 +
  1.1270 +if test "$COMPILE_ENVIRONMENT"; then
  1.1271 +if test "$GNU_CC"; then
  1.1272 +  AC_MSG_CHECKING(whether ld has archive extraction flags)
  1.1273 +  AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
  1.1274 +   [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
  1.1275 +    ac_cv_mkshlib_force_and_unforce="no"
  1.1276 +    exec 3<&0 <<LOOP_INPUT
  1.1277 +	force="-Wl,--whole-archive";   unforce="-Wl,--no-whole-archive"
  1.1278 +	force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
  1.1279 +	force="-Wl,-all";              unforce="-Wl,-none"
  1.1280 +LOOP_INPUT
  1.1281 +    while read line
  1.1282 +    do
  1.1283 +      eval $line
  1.1284 +      LDFLAGS=$force
  1.1285 +      LIBS=$unforce
  1.1286 +      AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
  1.1287 +    done
  1.1288 +    exec 0<&3 3<&-
  1.1289 +    LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
  1.1290 +   ])
  1.1291 +  if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
  1.1292 +    AC_MSG_RESULT(no)
  1.1293 +  else
  1.1294 +    AC_MSG_RESULT(yes)
  1.1295 +    eval $ac_cv_mkshlib_force_and_unforce
  1.1296 +    MKSHLIB_FORCE_ALL=$force
  1.1297 +    MKSHLIB_UNFORCE_ALL=$unforce
  1.1298 +  fi
  1.1299 +fi # GNU_CC
  1.1300 +fi # COMPILE_ENVIRONMENT
  1.1301 +
  1.1302 +dnl ========================================================
  1.1303 +dnl Checking for 64-bit OS
  1.1304 +dnl ========================================================
  1.1305 +if test "$COMPILE_ENVIRONMENT"; then
  1.1306 +AC_LANG_SAVE
  1.1307 +AC_LANG_C
  1.1308 +AC_MSG_CHECKING(for 64-bit OS)
  1.1309 +AC_TRY_COMPILE([$configure_static_assert_macros],
  1.1310 +               [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
  1.1311 +               result="yes", result="no")
  1.1312 +AC_MSG_RESULT("$result")
  1.1313 +if test "$result" = "yes"; then
  1.1314 +    AC_DEFINE(HAVE_64BIT_OS)
  1.1315 +    HAVE_64BIT_OS=1
  1.1316 +fi
  1.1317 +AC_SUBST(HAVE_64BIT_OS)
  1.1318 +AC_LANG_RESTORE
  1.1319 +fi # COMPILE_ENVIRONMENT
  1.1320 +
  1.1321 +dnl ========================================================
  1.1322 +dnl = Use profiling compile flags
  1.1323 +dnl ========================================================
  1.1324 +MOZ_ARG_ENABLE_BOOL(profiling,
  1.1325 +[  --enable-profiling      Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
  1.1326 +    MOZ_PROFILING=1,
  1.1327 +    MOZ_PROFILING= )
  1.1328 +
  1.1329 +dnl ========================================================
  1.1330 +dnl System overrides of the defaults for host
  1.1331 +dnl ========================================================
  1.1332 +case "$host" in
  1.1333 +*mingw*)
  1.1334 +    if test -n "$_WIN32_MSVC"; then
  1.1335 +        HOST_AR=lib
  1.1336 +        HOST_AR_FLAGS='-NOLOGO -OUT:$@'
  1.1337 +        HOST_CFLAGS="$HOST_CFLAGS -TC -nologo"
  1.1338 +        HOST_RANLIB='echo ranlib'
  1.1339 +    else
  1.1340 +        HOST_CFLAGS="$HOST_CFLAGS -mwindows"
  1.1341 +    fi
  1.1342 +    HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
  1.1343 +    HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
  1.1344 +    HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
  1.1345 +    HOST_BIN_SUFFIX=.exe
  1.1346 +    case "$host" in
  1.1347 +    *mingw*)
  1.1348 +        PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
  1.1349 +        ;;
  1.1350 +    esac
  1.1351 +
  1.1352 +    case "${host_cpu}" in
  1.1353 +    i*86)
  1.1354 +        if test -n "$_WIN32_MSVC"; then
  1.1355 +            HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
  1.1356 +        fi
  1.1357 +        ;;
  1.1358 +    x86_64)
  1.1359 +        if test -n "$_WIN32_MSVC"; then
  1.1360 +            HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
  1.1361 +        fi
  1.1362 +        HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
  1.1363 +        ;;
  1.1364 +    esac
  1.1365 +    ;;
  1.1366 +
  1.1367 +*-darwin*)
  1.1368 +    HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
  1.1369 +    HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
  1.1370 +    HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
  1.1371 +    ;;
  1.1372 +
  1.1373 +*-linux*|*-kfreebsd*-gnu|*-gnu*)
  1.1374 +    HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
  1.1375 +    HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
  1.1376 +    HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
  1.1377 +    ;;
  1.1378 +
  1.1379 +*)
  1.1380 +    HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
  1.1381 +    HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
  1.1382 +    ;;
  1.1383 +esac
  1.1384 +
  1.1385 +dnl Check for using a custom <inttypes.h> implementation
  1.1386 +dnl ========================================================
  1.1387 +AC_MSG_CHECKING(for custom <inttypes.h> implementation)
  1.1388 +if test "$MOZ_CUSTOM_INTTYPES_H"; then
  1.1389 +  AC_DEFINE_UNQUOTED(MOZ_CUSTOM_INTTYPES_H, "$MOZ_CUSTOM_INTTYPES_H")
  1.1390 +  AC_MSG_RESULT(using $MOZ_CUSTOM_INTTYPES_H)
  1.1391 +else
  1.1392 +  AC_MSG_RESULT(none specified)
  1.1393 +fi
  1.1394 +
  1.1395 +MOZ_DOING_LTO(lto_is_enabled)
  1.1396 +
  1.1397 +dnl ========================================================
  1.1398 +dnl System overrides of the defaults for target
  1.1399 +dnl ========================================================
  1.1400 +
  1.1401 +case "$target" in
  1.1402 +*-aix*)
  1.1403 +    AC_DEFINE(AIX)
  1.1404 +    if test ! "$GNU_CC"; then
  1.1405 +        if test ! "$HAVE_64BIT_OS"; then
  1.1406 +            # Compiling with Visual Age C++ object model compat is the
  1.1407 +            # default. To compile with object model ibm, add
  1.1408 +            # AIX_OBJMODEL=ibm to .mozconfig.
  1.1409 +            if test "$AIX_OBJMODEL" = "ibm"; then
  1.1410 +                CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
  1.1411 +            else
  1.1412 +                AIX_OBJMODEL=compat
  1.1413 +            fi
  1.1414 +        else
  1.1415 +            AIX_OBJMODEL=compat
  1.1416 +        fi
  1.1417 +        AC_SUBST(AIX_OBJMODEL)
  1.1418 +        DSO_LDOPTS='-qmkshrobj=1'
  1.1419 +        DSO_CFLAGS='-qflag=w:w'
  1.1420 +        DSO_PIC_CFLAGS=
  1.1421 +        LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
  1.1422 +        MOZ_FIX_LINK_PATHS=
  1.1423 +        MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
  1.1424 +        MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
  1.1425 +        if test "$COMPILE_ENVIRONMENT"; then
  1.1426 +            AC_LANG_SAVE
  1.1427 +            AC_LANG_CPLUSPLUS
  1.1428 +            AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
  1.1429 +            AC_TRY_COMPILE([],
  1.1430 +                [#if (__IBMCPP__ < 900)
  1.1431 +                 #error "Bad compiler"
  1.1432 +                 #endif],
  1.1433 +                _BAD_COMPILER=,_BAD_COMPILER=1)
  1.1434 +            if test -n "$_BAD_COMPILER"; then
  1.1435 +                AC_MSG_RESULT([no])
  1.1436 +                AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
  1.1437 +            else
  1.1438 +                AC_MSG_RESULT([yes])
  1.1439 +            fi
  1.1440 +            AC_LANG_RESTORE
  1.1441 +            TARGET_COMPILER_ABI="ibmc"
  1.1442 +            CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
  1.1443 +            CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
  1.1444 +        fi
  1.1445 +    fi
  1.1446 +    case "${target_os}" in
  1.1447 +    aix4.1*)
  1.1448 +        DLL_SUFFIX='_shr.a'
  1.1449 +        ;;
  1.1450 +    esac
  1.1451 +    if test "$COMPILE_ENVIRONMENT"; then
  1.1452 +        MOZ_CHECK_HEADERS(sys/inttypes.h)
  1.1453 +    fi
  1.1454 +    AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
  1.1455 +    ;;
  1.1456 +
  1.1457 +*-darwin*)
  1.1458 +    MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
  1.1459 +    MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
  1.1460 +    MOZ_OPTIMIZE_FLAGS="-O3 -fno-stack-protector"
  1.1461 +    CFLAGS="$CFLAGS -fno-common"
  1.1462 +    CXXFLAGS="$CXXFLAGS -fno-common"
  1.1463 +    DLL_SUFFIX=".dylib"
  1.1464 +    DSO_LDOPTS=''
  1.1465 +    STRIP="$STRIP -x -S"
  1.1466 +    _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
  1.1467 +    TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
  1.1468 +    LDFLAGS="$LDFLAGS -lobjc"
  1.1469 +    # The ExceptionHandling framework is needed for Objective-C exception
  1.1470 +    # logging code in nsObjCExceptions.h. Currently we only use that in debug
  1.1471 +    # builds.
  1.1472 +    _SAVE_LDFLAGS=$LDFLAGS
  1.1473 +     AC_MSG_CHECKING([for -framework ExceptionHandling])
  1.1474 +    LDFLAGS="$LDFLAGS -framework ExceptionHandling"
  1.1475 +    AC_TRY_LINK(,[return 0;],
  1.1476 +                ac_cv_have_framework_exceptionhandling="yes",
  1.1477 +                ac_cv_have_framework_exceptionhandling="no")
  1.1478 +    AC_MSG_RESULT([$ac_cv_have_framework_exceptionhandling])
  1.1479 +    if test  "$ac_cv_have_framework_exceptionhandling" = "yes"; then
  1.1480 +      MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
  1.1481 +    fi
  1.1482 +    LDFLAGS=$_SAVE_LDFLAGS
  1.1483 +
  1.1484 +    if test "x$lto_is_enabled" = "xyes"; then
  1.1485 +        echo "Skipping -dead_strip because lto is enabled."
  1.1486 +    dnl DTrace and -dead_strip don't interact well. See bug 403132.
  1.1487 +    dnl ===================================================================
  1.1488 +    elif test "x$enable_dtrace" = "xyes"; then
  1.1489 +        echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
  1.1490 +    else
  1.1491 +        dnl check for the presence of the -dead_strip linker flag
  1.1492 +        AC_MSG_CHECKING([for -dead_strip option to ld])
  1.1493 +        _SAVE_LDFLAGS=$LDFLAGS
  1.1494 +        LDFLAGS="$LDFLAGS -Wl,-dead_strip"
  1.1495 +        AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
  1.1496 +        if test -n "$_HAVE_DEAD_STRIP" ; then
  1.1497 +            AC_MSG_RESULT([yes])
  1.1498 +            MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
  1.1499 +        else
  1.1500 +            AC_MSG_RESULT([no])
  1.1501 +        fi
  1.1502 +
  1.1503 +        LDFLAGS=$_SAVE_LDFLAGS
  1.1504 +    fi
  1.1505 +    MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
  1.1506 +    ;;
  1.1507 +
  1.1508 +ia64*-hpux*)
  1.1509 +    DLL_SUFFIX=".so"
  1.1510 +    if test ! "$GNU_CC"; then
  1.1511 +       DSO_LDOPTS='-b'
  1.1512 +       DSO_CFLAGS=""
  1.1513 +       DSO_PIC_CFLAGS=
  1.1514 +       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
  1.1515 +       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
  1.1516 +       CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
  1.1517 +    else
  1.1518 +       DSO_LDOPTS='-b -E'
  1.1519 +       MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
  1.1520 +       MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
  1.1521 +    fi
  1.1522 +    MOZ_FIX_LINK_PATHS=
  1.1523 +    AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
  1.1524 +    AC_DEFINE(_LARGEFILE64_SOURCE)
  1.1525 +    ;;
  1.1526 +
  1.1527 +*-hpux*)
  1.1528 +    DLL_SUFFIX=".sl"
  1.1529 +    if test ! "$GNU_CC"; then
  1.1530 +    	DSO_LDOPTS='-b -Wl,+s'
  1.1531 +    	DSO_CFLAGS=""
  1.1532 +    	DSO_PIC_CFLAGS="+Z"
  1.1533 +    	MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
  1.1534 +    	MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
  1.1535 +        CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
  1.1536 +    else
  1.1537 +        DSO_LDOPTS='-b -E +s'
  1.1538 +        MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
  1.1539 +        MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
  1.1540 +    fi
  1.1541 +    MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
  1.1542 +    AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
  1.1543 +    ;;
  1.1544 +
  1.1545 +*-android*|*-linuxandroid*)
  1.1546 +    AC_DEFINE(NO_PW_GECOS)
  1.1547 +    no_x=yes
  1.1548 +    _PLATFORM_DEFAULT_TOOLKIT=cairo-android
  1.1549 +    TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
  1.1550 +
  1.1551 +    MOZ_GFX_OPTIMIZE_MOBILE=1
  1.1552 +    MOZ_OPTIMIZE_FLAGS="-O3 -freorder-blocks -fno-reorder-functions"
  1.1553 +    # The Maemo builders don't know about this flag
  1.1554 +    MOZ_ARM_VFP_FLAGS="-mfpu=vfp"
  1.1555 +    ;;
  1.1556 +
  1.1557 +*-*linux*)
  1.1558 +    # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
  1.1559 +    # Similarly for GNU_CXX and INTEL_CXX.
  1.1560 +    if test "$INTEL_CC" -o "$INTEL_CXX"; then
  1.1561 +        # -Os has been broken on Intel's C/C++ compilers for quite a
  1.1562 +        # while; Intel recommends against using it.
  1.1563 +        MOZ_OPTIMIZE_FLAGS="-O2"
  1.1564 +    elif test "$GNU_CC" -o "$GNU_CXX"; then
  1.1565 +        case $GCC_VERSION in
  1.1566 +        4.5.*)
  1.1567 +            # -Os is broken on gcc 4.5.x we need to tweak it to get good results.
  1.1568 +            MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
  1.1569 +        esac
  1.1570 +        MOZ_PGO_OPTIMIZE_FLAGS="-O3"
  1.1571 +        MOZ_OPTIMIZE_FLAGS="-O3 -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
  1.1572 +    fi
  1.1573 +
  1.1574 +    TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
  1.1575 +
  1.1576 +    case "${target_cpu}" in
  1.1577 +    alpha*)
  1.1578 +    	CFLAGS="$CFLAGS -mieee"
  1.1579 +    	CXXFLAGS="$CXXFLAGS -mieee"
  1.1580 +    ;;
  1.1581 +    esac
  1.1582 +
  1.1583 +    if test -z "$MC"; then
  1.1584 +        MC=mc.exe
  1.1585 +    fi
  1.1586 +    ;;
  1.1587 +
  1.1588 +*-mingw*)
  1.1589 +    DSO_CFLAGS=
  1.1590 +    DSO_PIC_CFLAGS=
  1.1591 +    DLL_SUFFIX=.dll
  1.1592 +    RC=rc.exe
  1.1593 +    MC=mc.exe
  1.1594 +    if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
  1.1595 +        CC="$CC -mwindows"
  1.1596 +        CXX="$CXX -mwindows"
  1.1597 +        CPP="$CPP -mwindows"
  1.1598 +        CFLAGS="$CFLAGS -mms-bitfields"
  1.1599 +        CXXFLAGS="$CXXFLAGS -mms-bitfields"
  1.1600 +        DSO_LDOPTS='-shared'
  1.1601 +        MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
  1.1602 +        MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
  1.1603 +        RC='$(WINDRES)'
  1.1604 +        # Use static libgcc and libstdc++
  1.1605 +        LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++"
  1.1606 +        # Use temp file for windres (bug 213281)
  1.1607 +        RCFLAGS='-O coff --use-temp-file'
  1.1608 +        # mingw doesn't require kernel32, user32, and advapi32 explicitly
  1.1609 +        LIBS="$LIBS -lgdi32 -lwinmm -lwsock32 -lpsapi"
  1.1610 +        MOZ_FIX_LINK_PATHS=
  1.1611 +        DLL_PREFIX=
  1.1612 +        IMPORT_LIB_SUFFIX=dll.a
  1.1613 +
  1.1614 +        # We use mix of both POSIX and Win32 printf format across the tree, so format
  1.1615 +        # warnings are useless on mingw.
  1.1616 +        MOZ_C_SUPPORTS_WARNING(-Wno-, format, ac_c_has_wno_format)
  1.1617 +        MOZ_CXX_SUPPORTS_WARNING(-Wno-, format, ac_cxx_has_wno_format)
  1.1618 +    else
  1.1619 +        TARGET_COMPILER_ABI=msvc
  1.1620 +        HOST_CC='$(CC)'
  1.1621 +        HOST_CXX='$(CXX)'
  1.1622 +        HOST_LD='$(LD)'
  1.1623 +        if test "$AS_BIN"; then
  1.1624 +            AS="$(basename "$AS_BIN")"
  1.1625 +        fi
  1.1626 +        AR='lib'
  1.1627 +        AR_FLAGS='-NOLOGO -OUT:$@'
  1.1628 +        AR_EXTRACT=
  1.1629 +        RANLIB='echo not_ranlib'
  1.1630 +        STRIP='echo not_strip'
  1.1631 +        PKG_SKIP_STRIP=1
  1.1632 +        XARGS=xargs
  1.1633 +        DOXYGEN=:
  1.1634 +        ASM_SUFFIX=asm
  1.1635 +        OBJ_SUFFIX=obj
  1.1636 +        LIB_SUFFIX=lib
  1.1637 +        DLL_PREFIX=
  1.1638 +        LIB_PREFIX=
  1.1639 +        IMPORT_LIB_SUFFIX=lib
  1.1640 +        MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
  1.1641 +        MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
  1.1642 +        MKSHLIB_FORCE_ALL=
  1.1643 +        MKSHLIB_UNFORCE_ALL=
  1.1644 +        DSO_LDOPTS=-SUBSYSTEM:WINDOWS
  1.1645 +        _USE_CPP_INCLUDE_FLAG=1
  1.1646 +        _DEFINES_CFLAGS='-FI $(DEPTH)/js/src/js-confdefs.h -DMOZILLA_CLIENT'
  1.1647 +        _DEFINES_CXXFLAGS='-FI $(DEPTH)/js/src/js-confdefs.h -DMOZILLA_CLIENT'
  1.1648 +        CFLAGS="$CFLAGS -W3 -Gy"
  1.1649 +        CXXFLAGS="$CXXFLAGS -W3 -Gy"
  1.1650 +        if test "$_CC_SUITE" -ge "12"; then
  1.1651 +            dnl VS2013+ requires -FS when parallel building by make -jN.
  1.1652 +            dnl If nothing, compiler sometimes causes C1041 error.
  1.1653 +            dnl
  1.1654 +            dnl Visual Studio 2013 supports -Gw flags
  1.1655 +            dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
  1.1656 +            CFLAGS="$CFLAGS -FS -Gw"
  1.1657 +            CXXFLAGS="$CXXFLAGS -FS -Gw"
  1.1658 +        fi
  1.1659 +        # khuey says we can safely ignore MSVC warning C4251
  1.1660 +        # MSVC warning C4244 (implicit type conversion may lose data) warns
  1.1661 +        # and requires workarounds for perfectly valid code.  Also, GCC/clang
  1.1662 +        # don't warn about it by default. So for consistency/sanity, we turn
  1.1663 +        # it off on MSVC, too.
  1.1664 +        CFLAGS="$CFLAGS -wd4244"
  1.1665 +        CXXFLAGS="$CXXFLAGS -wd4244 -wd4251"
  1.1666 +        # make 'foo == bar;' error out
  1.1667 +        CFLAGS="$CFLAGS -we4553"
  1.1668 +        CXXFLAGS="$CXXFLAGS -we4553"
  1.1669 +        LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib psapi.lib"
  1.1670 +        MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
  1.1671 +        WARNINGS_AS_ERRORS='-WX'
  1.1672 +        MOZ_OPTIMIZE_FLAGS="-O2"
  1.1673 +        MOZ_FIX_LINK_PATHS=
  1.1674 +        MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
  1.1675 +        LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
  1.1676 +        if test -z "$DEVELOPER_OPTIONS"; then
  1.1677 +            LDFLAGS="$LDFLAGS -RELEASE"
  1.1678 +        fi
  1.1679 +        dnl For profile-guided optimization
  1.1680 +        PROFILE_GEN_CFLAGS="-GL"
  1.1681 +        PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
  1.1682 +        dnl XXX: PGO builds can fail with warnings treated as errors,
  1.1683 +        dnl specifically "no profile data available" appears to be
  1.1684 +        dnl treated as an error sometimes. This might be a consequence
  1.1685 +        dnl of using WARNINGS_AS_ERRORS in some modules, combined
  1.1686 +        dnl with the linker doing most of the work in the whole-program
  1.1687 +        dnl optimization/PGO case. I think it's probably a compiler bug,
  1.1688 +        dnl but we work around it here.
  1.1689 +        PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
  1.1690 +        dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
  1.1691 +        dnl Probably also a compiler bug, but what can you do?
  1.1692 +        PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
  1.1693 +        LDFLAGS="$LDFLAGS -DYNAMICBASE"
  1.1694 +    fi
  1.1695 +    AC_DEFINE(HAVE_SNPRINTF)
  1.1696 +    AC_DEFINE(_WINDOWS)
  1.1697 +    AC_DEFINE(WIN32)
  1.1698 +    AC_DEFINE(XP_WIN)
  1.1699 +    AC_DEFINE(XP_WIN32)
  1.1700 +    AC_DEFINE(HW_THREADS)
  1.1701 +    AC_DEFINE(STDC_HEADERS)
  1.1702 +    AC_DEFINE(WIN32_LEAN_AND_MEAN)
  1.1703 +    TARGET_MD_ARCH=win32
  1.1704 +    _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
  1.1705 +    BIN_SUFFIX='.exe'
  1.1706 +    MOZ_USER_DIR="Mozilla"
  1.1707 +
  1.1708 +    dnl Hardcode to win95 for now - cls
  1.1709 +    TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
  1.1710 +
  1.1711 +    dnl set NO_X11 defines here as the general check is skipped on win32
  1.1712 +    no_x=yes
  1.1713 +    AC_DEFINE(NO_X11)
  1.1714 +
  1.1715 +    case "$host" in
  1.1716 +    *-mingw*)
  1.1717 +        MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
  1.1718 +        ;;
  1.1719 +    esac
  1.1720 +
  1.1721 +    case "$host" in
  1.1722 +    *-mingw*)
  1.1723 +        if test -z "$MOZ_TOOLS"; then
  1.1724 +            AC_MSG_ERROR([MOZ_TOOLS is not set])
  1.1725 +        fi
  1.1726 +        MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
  1.1727 +        if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
  1.1728 +            AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
  1.1729 +        fi
  1.1730 +        MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
  1.1731 +        if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
  1.1732 +            AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
  1.1733 +        fi
  1.1734 +        ;;
  1.1735 +    esac
  1.1736 +
  1.1737 +    case "$host_os" in
  1.1738 +    cygwin*|msvc*|mks*)
  1.1739 +        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.1740 +        ;;
  1.1741 +    esac
  1.1742 +
  1.1743 +    case "$target" in
  1.1744 +    i*86-*)
  1.1745 +        if test "$HAVE_64BIT_OS"; then
  1.1746 +            AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
  1.1747 +        fi
  1.1748 +
  1.1749 +        if test -n "$GNU_CC"; then
  1.1750 +            CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
  1.1751 +            CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
  1.1752 +            LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
  1.1753 +        else
  1.1754 +            DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
  1.1755 +            LDFLAGS="$LDFLAGS -SAFESEH"
  1.1756 +        fi
  1.1757 +
  1.1758 +    	AC_DEFINE(_X86_)
  1.1759 +	;;
  1.1760 +    x86_64-*)
  1.1761 +        if test -n "$_WIN32_MSVC"; then
  1.1762 +            DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
  1.1763 +        fi
  1.1764 +        AC_DEFINE(_AMD64_)
  1.1765 +        ;;
  1.1766 +    *)
  1.1767 +    	AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
  1.1768 +	;;
  1.1769 +    esac
  1.1770 +    ;;
  1.1771 +
  1.1772 +*-netbsd*)
  1.1773 +    DSO_CFLAGS=''
  1.1774 +    CFLAGS="$CFLAGS -Dunix"
  1.1775 +    CXXFLAGS="$CXXFLAGS -Dunix"
  1.1776 +    if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
  1.1777 +        DLL_SUFFIX=".so"
  1.1778 +        DSO_PIC_CFLAGS='-fPIC -DPIC'
  1.1779 +        DSO_LDOPTS='-shared'
  1.1780 +	BIN_FLAGS='-Wl,--export-dynamic'
  1.1781 +    else
  1.1782 +    	DSO_PIC_CFLAGS='-fPIC -DPIC'
  1.1783 +    	DLL_SUFFIX=".so.1.0"
  1.1784 +    	DSO_LDOPTS='-shared'
  1.1785 +    fi
  1.1786 +    # This will fail on a.out systems prior to 1.5.1_ALPHA.
  1.1787 +    MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
  1.1788 +    MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
  1.1789 +    if test "$LIBRUNPATH"; then
  1.1790 +	DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
  1.1791 +    fi
  1.1792 +    MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(notdir $@) -o $@'
  1.1793 +    MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(notdir $@) -o $@'
  1.1794 +    ;;
  1.1795 +
  1.1796 +*-openbsd*)
  1.1797 +    DLL_SUFFIX=".so.1.0"
  1.1798 +    DSO_CFLAGS=''
  1.1799 +    DSO_PIC_CFLAGS='-fPIC'
  1.1800 +    DSO_LDOPTS='-shared -fPIC'
  1.1801 +    if test "$LIBRUNPATH"; then
  1.1802 +	DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
  1.1803 +    fi
  1.1804 +    ;;
  1.1805 +
  1.1806 +*-solaris*)
  1.1807 +    AC_DEFINE(SOLARIS)
  1.1808 +    TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
  1.1809 +    if test -z "$CROSS_COMPILE" && pkginfo -q SUNWpr && pkginfo -q SUNWprd; then
  1.1810 +       NO_NSPR_CONFIG_SYSTEM_LDFLAGS="-L/usr/lib/mps -R/usr/lib/mps -lnspr4"
  1.1811 +       NO_NSPR_CONFIG_SYSTEM_CFLAGS="-I/usr/include/mps"
  1.1812 +       NO_NSPR_CONFIG_SYSTEM_VERSION=["`pkgparam SUNWpr SUNW_PRODVERS | sed -e 's/^[1-9][0-9]*\.[0-9][0-9]*$/&.0/'`"]
  1.1813 +    fi
  1.1814 +    MOZ_FIX_LINK_PATHS=
  1.1815 +    # $ORIGIN/.. is for shared libraries under components/ to locate shared
  1.1816 +    # libraries one level up (e.g. libnspr4.so)
  1.1817 +    if test "$SOLARIS_SUNPRO_CC"; then
  1.1818 +       LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
  1.1819 +       LIBS="-lCrun -lCstd -lc $LIBS"
  1.1820 +       AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
  1.1821 +       CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
  1.1822 +       CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
  1.1823 +       LDFLAGS="-xildoff $LDFLAGS"
  1.1824 +       if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
  1.1825 +           _SAVE_LDFLAGS=$LDFLAGS
  1.1826 +           LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
  1.1827 +           AC_TRY_LINK([#include <stdio.h>],
  1.1828 +                       [printf("Hello World\n");],
  1.1829 +                       ,
  1.1830 +                       [LDFLAGS=$_SAVE_LDFLAGS])
  1.1831 +       fi
  1.1832 +       MOZ_OPTIMIZE_FLAGS="-xO4"
  1.1833 +       MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
  1.1834 +       MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
  1.1835 +       MKSHLIB_FORCE_ALL='-z allextract'
  1.1836 +       MKSHLIB_UNFORCE_ALL='-z defaultextract'
  1.1837 +       DSO_LDOPTS='-G'
  1.1838 +       AR_LIST="$AR t"
  1.1839 +       AR_EXTRACT="$AR x"
  1.1840 +       AR_DELETE="$AR d"
  1.1841 +       AR='$(CXX) -xar'
  1.1842 +       AR_FLAGS='-o $@'
  1.1843 +       AS='/usr/ccs/bin/as'
  1.1844 +       ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
  1.1845 +       AS_DASH_C_FLAG=''
  1.1846 +       TARGET_COMPILER_ABI="sunc"
  1.1847 +       CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
  1.1848 +       CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
  1.1849 +       AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
  1.1850 +       AC_LANG_SAVE
  1.1851 +       AC_LANG_CPLUSPLUS
  1.1852 +       AC_TRY_COMPILE([],
  1.1853 +           [#if (__SUNPRO_CC < 0x590)
  1.1854 +           #error "Denied"
  1.1855 +           #endif],
  1.1856 +           _BAD_COMPILER=,_BAD_COMPILER=1)
  1.1857 +       if test -n "$_BAD_COMPILER"; then
  1.1858 +           _res="no"
  1.1859 +           AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
  1.1860 +       else
  1.1861 +           _res="yes"
  1.1862 +       fi
  1.1863 +       AC_TRY_COMPILE([],
  1.1864 +           [#if (__SUNPRO_CC >= 0x5100)
  1.1865 +           #error "Sun C++ 5.10 or above"
  1.1866 +           #endif],
  1.1867 +           _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
  1.1868 +       if test "$_ABOVE_SS12U1"; then
  1.1869 +           # disable xannotate
  1.1870 +           CXXFLAGS="$CXXFLAGS -xannotate=no"
  1.1871 +       fi
  1.1872 +       AC_MSG_RESULT([$_res])
  1.1873 +       AC_LANG_RESTORE
  1.1874 +    else
  1.1875 +       LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
  1.1876 +       LIBS="-lc $LIBS"
  1.1877 +       MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
  1.1878 +       MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
  1.1879 +       ASFLAGS="$ASFLAGS -fPIC"
  1.1880 +       DSO_LDOPTS='-shared'
  1.1881 +       WARNINGS_AS_ERRORS='-Werror'
  1.1882 +       _WARNINGS_CFLAGS=''
  1.1883 +       _WARNINGS_CXXFLAGS=''
  1.1884 +       if test "$OS_RELEASE" = "5.3"; then
  1.1885 +           AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
  1.1886 +       fi
  1.1887 +    fi
  1.1888 +    if test "$OS_RELEASE" = "5.5.1"; then
  1.1889 +        AC_DEFINE(NEED_USLEEP_PROTOTYPE)
  1.1890 +    fi
  1.1891 +    ;;
  1.1892 +
  1.1893 +*-sunos*)
  1.1894 +    DSO_LDOPTS='-Bdynamic'
  1.1895 +    MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
  1.1896 +    MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
  1.1897 +    AC_DEFINE(SUNOS4)
  1.1898 +    AC_DEFINE(SPRINTF_RETURNS_STRING)
  1.1899 +    case "$(target_os)" in
  1.1900 +    sunos4.1*)
  1.1901 +        DLL_SUFFIX='.so.1.0'
  1.1902 +        ;;
  1.1903 +    esac
  1.1904 +    ;;
  1.1905 +
  1.1906 +esac
  1.1907 +
  1.1908 +dnl Only one oddball right now (QNX), but this gives us flexibility
  1.1909 +dnl if any other platforms need to override this in the future.
  1.1910 +AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
  1.1911 +
  1.1912 +dnl ========================================================
  1.1913 +dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
  1.1914 +dnl by now will not have any way to link most binaries (tests
  1.1915 +dnl as well as viewer, apprunner, etc.), because some symbols
  1.1916 +dnl will be left out of the "composite" .so's by ld as unneeded.
  1.1917 +dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
  1.1918 +dnl they can link in the static libs that provide the missing
  1.1919 +dnl symbols.
  1.1920 +dnl ========================================================
  1.1921 +NO_LD_ARCHIVE_FLAGS=
  1.1922 +if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
  1.1923 +    NO_LD_ARCHIVE_FLAGS=1
  1.1924 +fi
  1.1925 +case "$target" in
  1.1926 +*-aix4.3*|*-aix5*)
  1.1927 +    NO_LD_ARCHIVE_FLAGS=
  1.1928 +    ;;
  1.1929 +*-mingw*)
  1.1930 +    if test -z "$GNU_CC"; then
  1.1931 +        NO_LD_ARCHIVE_FLAGS=
  1.1932 +    fi
  1.1933 +    ;;
  1.1934 +esac
  1.1935 +AC_SUBST(NO_LD_ARCHIVE_FLAGS)
  1.1936 +
  1.1937 +dnl ========================================================
  1.1938 +dnl = Flags to strip unused symbols from .so components
  1.1939 +dnl ========================================================
  1.1940 +case "$target" in
  1.1941 +    *-linux*|*-kfreebsd*-gnu|*-gnu*)
  1.1942 +        MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
  1.1943 +        ;;
  1.1944 +    *-solaris*)
  1.1945 +        if test -z "$GNU_CC"; then
  1.1946 +         MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
  1.1947 +        else
  1.1948 +         if test -z "$GCC_USE_GNU_LD"; then
  1.1949 +          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
  1.1950 +         else
  1.1951 +          MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
  1.1952 +         fi
  1.1953 +        fi
  1.1954 +        ;;
  1.1955 +    *-darwin*)
  1.1956 +        MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
  1.1957 +        ;;
  1.1958 +    *-mingw*)
  1.1959 +        if test -n "$GNU_CC"; then
  1.1960 +           MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
  1.1961 +        fi
  1.1962 +        ;;
  1.1963 +esac
  1.1964 +
  1.1965 +if test -z "$COMPILE_ENVIRONMENT"; then
  1.1966 +    SKIP_COMPILER_CHECKS=1
  1.1967 +    SKIP_LIBRARY_CHECKS=1
  1.1968 +fi
  1.1969 +
  1.1970 +dnl Configure JIT support
  1.1971 +
  1.1972 +case "$target" in
  1.1973 +i?86-*)
  1.1974 +    ENABLE_ION=1
  1.1975 +    ENABLE_YARR_JIT=1
  1.1976 +    AC_DEFINE(JS_CPU_X86)
  1.1977 +    AC_DEFINE(JS_NUNBOX32)
  1.1978 +    ;;
  1.1979 +x86_64*-*)
  1.1980 +    ENABLE_ION=1
  1.1981 +    ENABLE_YARR_JIT=1
  1.1982 +    AC_DEFINE(JS_CPU_X64)
  1.1983 +    AC_DEFINE(JS_PUNBOX64)
  1.1984 +    ;;
  1.1985 +arm*-*)
  1.1986 +    ENABLE_ION=1
  1.1987 +    ENABLE_YARR_JIT=1
  1.1988 +    AC_DEFINE(JS_CPU_ARM)
  1.1989 +    AC_DEFINE(JS_NUNBOX32)
  1.1990 +    ;;
  1.1991 +sparc*-*)
  1.1992 +    if test ! "$HAVE_64BIT_OS" ; then
  1.1993 +dnl ENABLE_ION=0
  1.1994 +    AC_DEFINE(JS_CPU_SPARC)
  1.1995 +    AC_DEFINE(JS_NUNBOX32)
  1.1996 +    fi
  1.1997 +    ;;
  1.1998 +mips*-*)
  1.1999 +    AC_DEFINE(JS_CPU_MIPS)
  1.2000 +    AC_DEFINE(JS_NUNBOX32)
  1.2001 +    ;;
  1.2002 +esac
  1.2003 +
  1.2004 +MOZ_ARG_DISABLE_BOOL(ion,
  1.2005 +[  --disable-ion      Disable use of the IonMonkey JIT],
  1.2006 +  ENABLE_ION= )
  1.2007 +
  1.2008 +MOZ_ARG_DISABLE_BOOL(yarr-jit,
  1.2009 +[  --disable-yarr-jit    Disable YARR JIT support],
  1.2010 +  ENABLE_YARR_JIT= )
  1.2011 +
  1.2012 +AC_SUBST(ENABLE_METHODJIT_SPEW)
  1.2013 +
  1.2014 +AC_SUBST(ENABLE_ION)
  1.2015 +
  1.2016 +if test "$ENABLE_ION"; then
  1.2017 +    AC_DEFINE(JS_ION)
  1.2018 +fi
  1.2019 +
  1.2020 +AC_SUBST(ENABLE_YARR_JIT)
  1.2021 +
  1.2022 +if test "$ENABLE_YARR_JIT"; then
  1.2023 +    AC_DEFINE(ENABLE_YARR_JIT)
  1.2024 +fi
  1.2025 +
  1.2026 +if test -n "$COMPILE_ENVIRONMENT"; then
  1.2027 +    MOZ_COMPILER_OPTS
  1.2028 +fi
  1.2029 +
  1.2030 +if test -z "$SKIP_COMPILER_CHECKS"; then
  1.2031 +dnl Checks for typedefs, structures, and compiler characteristics.
  1.2032 +dnl ========================================================
  1.2033 +AC_HEADER_STDC
  1.2034 +AC_C_CONST
  1.2035 +AC_TYPE_MODE_T
  1.2036 +AC_TYPE_OFF_T
  1.2037 +AC_TYPE_PID_T
  1.2038 +AC_TYPE_SIZE_T
  1.2039 +AC_LANG_CPLUSPLUS
  1.2040 +AC_LANG_C
  1.2041 +AC_MSG_CHECKING(for ssize_t)
  1.2042 +AC_CACHE_VAL(ac_cv_type_ssize_t,
  1.2043 + [AC_TRY_COMPILE([#include <stdio.h>
  1.2044 +                  #include <sys/types.h>],
  1.2045 +                 [ssize_t foo = 0;],
  1.2046 +                 [ac_cv_type_ssize_t=true],
  1.2047 +                 [ac_cv_type_ssize_t=false])])
  1.2048 +if test "$ac_cv_type_ssize_t" = true ; then
  1.2049 +  AC_DEFINE(HAVE_SSIZE_T)
  1.2050 +  AC_MSG_RESULT(yes)
  1.2051 +else
  1.2052 +  AC_MSG_RESULT(no)
  1.2053 +fi
  1.2054 +AC_STRUCT_ST_BLKSIZE
  1.2055 +AC_MSG_CHECKING(for siginfo_t)
  1.2056 +AC_CACHE_VAL(ac_cv_siginfo_t,
  1.2057 + [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
  1.2058 +                  #include <signal.h>],
  1.2059 +                 [siginfo_t* info;],
  1.2060 +                 [ac_cv_siginfo_t=true],
  1.2061 +                 [ac_cv_siginfo_t=false])])
  1.2062 +if test "$ac_cv_siginfo_t" = true ; then
  1.2063 +  AC_DEFINE(HAVE_SIGINFO_T)
  1.2064 +  AC_MSG_RESULT(yes)
  1.2065 +else
  1.2066 +  AC_MSG_RESULT(no)
  1.2067 +fi
  1.2068 +
  1.2069 +MOZ_CHECK_HEADERS(endian.h)
  1.2070 +if test "$ac_cv_header_endian_h" = yes; then
  1.2071 +    AC_DEFINE(JS_HAVE_ENDIAN_H)
  1.2072 +fi
  1.2073 +
  1.2074 +MOZ_CHECK_HEADERS([machine/endian.h],[],[],[#include <sys/types.h>])
  1.2075 +if test "$ac_cv_header_machine_endian_h" = yes; then
  1.2076 +    AC_DEFINE(JS_HAVE_MACHINE_ENDIAN_H)
  1.2077 +fi
  1.2078 +
  1.2079 +MOZ_CHECK_HEADERS(sys/isa_defs.h)
  1.2080 +if test "$ac_cv_header_sys_isa_defs_h" = yes; then
  1.2081 +    AC_DEFINE(JS_HAVE_SYS_ISA_DEFS_H)
  1.2082 +fi
  1.2083 +
  1.2084 +AC_LANG_CPLUSPLUS
  1.2085 +
  1.2086 +MOZ_CXX11
  1.2087 +
  1.2088 +dnl Check for .hidden assembler directive and visibility attribute.
  1.2089 +dnl Borrowed from glibc configure.in
  1.2090 +dnl ===============================================================
  1.2091 +if test "$GNU_CC"; then
  1.2092 +  AC_CACHE_CHECK(for visibility(hidden) attribute,
  1.2093 +                 ac_cv_visibility_hidden,
  1.2094 +                 [cat > conftest.c <<EOF
  1.2095 +                  int foo __attribute__ ((visibility ("hidden"))) = 1;
  1.2096 +EOF
  1.2097 +                  ac_cv_visibility_hidden=no
  1.2098 +                  if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
  1.2099 +                    if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
  1.2100 +                      ac_cv_visibility_hidden=yes
  1.2101 +                    fi
  1.2102 +                  fi
  1.2103 +                  rm -f conftest.[cs]
  1.2104 +                 ])
  1.2105 +  if test "$ac_cv_visibility_hidden" = "yes"; then
  1.2106 +    AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
  1.2107 +
  1.2108 +    AC_CACHE_CHECK(for visibility(default) attribute,
  1.2109 +                   ac_cv_visibility_default,
  1.2110 +                   [cat > conftest.c <<EOF
  1.2111 +                    int foo __attribute__ ((visibility ("default"))) = 1;
  1.2112 +EOF
  1.2113 +                    ac_cv_visibility_default=no
  1.2114 +                    if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
  1.2115 +                      if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
  1.2116 +                        ac_cv_visibility_default=yes
  1.2117 +                      fi
  1.2118 +                    fi
  1.2119 +                    rm -f conftest.[cs]
  1.2120 +                   ])
  1.2121 +    if test "$ac_cv_visibility_default" = "yes"; then
  1.2122 +      AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
  1.2123 +
  1.2124 +      AC_CACHE_CHECK(for visibility pragma support,
  1.2125 +                     ac_cv_visibility_pragma,
  1.2126 +                     [cat > conftest.c <<EOF
  1.2127 +#pragma GCC visibility push(hidden)
  1.2128 +                      int foo_hidden = 1;
  1.2129 +#pragma GCC visibility push(default)
  1.2130 +                      int foo_default = 1;
  1.2131 +EOF
  1.2132 +                      ac_cv_visibility_pragma=no
  1.2133 +                      if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
  1.2134 +                        if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
  1.2135 +                          if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
  1.2136 +                            ac_cv_visibility_pragma=yes
  1.2137 +                          fi
  1.2138 +                        fi
  1.2139 +                      fi
  1.2140 +                      rm -f conftest.[cs]
  1.2141 +                    ])
  1.2142 +      if test "$ac_cv_visibility_pragma" = "yes"; then
  1.2143 +        AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
  1.2144 +                       ac_cv_have_visibility_class_bug,
  1.2145 +                       [cat > conftest.c <<EOF
  1.2146 +#pragma GCC visibility push(hidden)
  1.2147 +struct __attribute__ ((visibility ("default"))) TestStruct {
  1.2148 +  static void Init();
  1.2149 +};
  1.2150 +__attribute__ ((visibility ("default"))) void TestFunc() {
  1.2151 +  TestStruct::Init();
  1.2152 +}
  1.2153 +EOF
  1.2154 +                       ac_cv_have_visibility_class_bug=no
  1.2155 +                       if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
  1.2156 +                         ac_cv_have_visibility_class_bug=yes
  1.2157 +                       else
  1.2158 +                         if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
  1.2159 +                           ac_cv_have_visibility_class_bug=yes
  1.2160 +                         fi
  1.2161 +                       fi
  1.2162 +                       rm -rf conftest.{c,S}
  1.2163 +                       ])
  1.2164 +
  1.2165 +        AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
  1.2166 +                       ac_cv_have_visibility_builtin_bug,
  1.2167 +                       [cat > conftest.c <<EOF
  1.2168 +#pragma GCC visibility push(hidden)
  1.2169 +#pragma GCC visibility push(default)
  1.2170 +#include <string.h>
  1.2171 +#pragma GCC visibility pop
  1.2172 +
  1.2173 +__attribute__ ((visibility ("default"))) void Func() {
  1.2174 +  char c[[100]];
  1.2175 +  memset(c, 0, sizeof(c));
  1.2176 +}
  1.2177 +EOF
  1.2178 +                       ac_cv_have_visibility_builtin_bug=no
  1.2179 +                       if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
  1.2180 +                         ac_cv_have_visibility_builtin_bug=yes
  1.2181 +                       else
  1.2182 +                         if test `grep -c "@PLT" conftest.S` = 0; then
  1.2183 +                           ac_cv_visibility_builtin_bug=yes
  1.2184 +                         fi
  1.2185 +                       fi
  1.2186 +                       rm -f conftest.{c,S}
  1.2187 +                       ])
  1.2188 +        if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
  1.2189 +                "$ac_cv_have_visibility_class_bug" = "no"; then
  1.2190 +          VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
  1.2191 +          WRAP_SYSTEM_INCLUDES=1
  1.2192 +        else
  1.2193 +          VISIBILITY_FLAGS='-fvisibility=hidden'
  1.2194 +        fi # have visibility pragma bug
  1.2195 +      fi   # have visibility pragma
  1.2196 +    fi     # have visibility(default) attribute
  1.2197 +  fi       # have visibility(hidden) attribute
  1.2198 +fi         # GNU_CC
  1.2199 +
  1.2200 +# visibility hidden flag for Sun Studio on Solaris
  1.2201 +if test "$SOLARIS_SUNPRO_CC"; then
  1.2202 +VISIBILITY_FLAGS='-xldscope=hidden'
  1.2203 +fi         # Sun Studio on Solaris
  1.2204 +
  1.2205 +AC_SUBST(WRAP_SYSTEM_INCLUDES)
  1.2206 +AC_SUBST(VISIBILITY_FLAGS)
  1.2207 +
  1.2208 +MOZ_GCC_PR49911
  1.2209 +MOZ_GCC_PR39608
  1.2210 +if test "$OS_TARGET" != WINNT; then
  1.2211 +    # Only run this test with clang on non-Windows platforms, because clang
  1.2212 +    # cannot do enough code gen for now to make this test work correctly.
  1.2213 +    MOZ_LLVM_PR8927
  1.2214 +fi
  1.2215 +
  1.2216 +dnl Checks for header files.
  1.2217 +dnl ========================================================
  1.2218 +AC_HEADER_DIRENT
  1.2219 +case "$target_os" in
  1.2220 +freebsd*)
  1.2221 +# for stuff like -lXshm
  1.2222 +    CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
  1.2223 +    ;;
  1.2224 +esac
  1.2225 +MOZ_CHECK_COMMON_HEADERS
  1.2226 +
  1.2227 +dnl These are all the places some variant of statfs can be hiding.
  1.2228 +MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
  1.2229 +
  1.2230 +dnl Quota support
  1.2231 +MOZ_CHECK_HEADERS(sys/quota.h)
  1.2232 +MOZ_CHECK_HEADERS(linux/quota.h)
  1.2233 +
  1.2234 +AC_ARG_ENABLE(dtrace,
  1.2235 +              [  --enable-dtrace         build with dtrace support if available (default=no)],
  1.2236 +              [enable_dtrace="yes"],)
  1.2237 +if test "x$enable_dtrace" = "xyes"; then
  1.2238 +  MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
  1.2239 +  if test -n "$HAVE_DTRACE"; then
  1.2240 +      AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
  1.2241 +  else
  1.2242 +      AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
  1.2243 +  fi
  1.2244 +fi
  1.2245 +AC_SUBST(HAVE_DTRACE)
  1.2246 +
  1.2247 +case $target in
  1.2248 +*-aix4.3*|*-aix5*)
  1.2249 +	;;
  1.2250 +*)
  1.2251 +    MOZ_CHECK_HEADERS(sys/cdefs.h)
  1.2252 +	;;
  1.2253 +esac
  1.2254 +
  1.2255 +MOZ_LINUX_PERF_EVENT
  1.2256 +
  1.2257 +dnl Checks for libraries.
  1.2258 +dnl ========================================================
  1.2259 +case $target in
  1.2260 +*-hpux11.*)
  1.2261 +	;;
  1.2262 +*)
  1.2263 +	AC_CHECK_LIB(c_r, gethostbyname_r)
  1.2264 +	;;
  1.2265 +esac
  1.2266 +
  1.2267 +dnl We don't want to link with libdl even if it's present on OS X, since
  1.2268 +dnl it's not used and not part of the default installation. OS/2 has dlfcn
  1.2269 +dnl in libc.
  1.2270 +dnl We don't want to link against libm or libpthread on Darwin since
  1.2271 +dnl they both are just symlinks to libSystem and explicitly linking
  1.2272 +dnl against libSystem causes issues when debugging (see bug 299601).
  1.2273 +case $target in
  1.2274 +*-darwin*)
  1.2275 +    ;;
  1.2276 +*)
  1.2277 +    AC_SEARCH_LIBS(dlopen, dl,
  1.2278 +        MOZ_CHECK_HEADER(dlfcn.h,
  1.2279 +        AC_DEFINE(HAVE_DLOPEN)))
  1.2280 +    ;;
  1.2281 +esac
  1.2282 +
  1.2283 +if test ! "$GNU_CXX"; then
  1.2284 +
  1.2285 +    case $target in
  1.2286 +    *-aix*)
  1.2287 +	AC_CHECK_LIB(C_r, demangle)
  1.2288 +	;;
  1.2289 +     *)
  1.2290 +	AC_CHECK_LIB(C, demangle)
  1.2291 +	;;
  1.2292 +     esac
  1.2293 +fi
  1.2294 +
  1.2295 +AC_CHECK_LIB(socket, socket)
  1.2296 +
  1.2297 +dnl ========================================================
  1.2298 +dnl = pthread support
  1.2299 +dnl = Start by checking whether the system support pthreads
  1.2300 +dnl ========================================================
  1.2301 +case "$target_os" in
  1.2302 +darwin*)
  1.2303 +    USE_PTHREADS=1
  1.2304 +    ;;
  1.2305 +*)
  1.2306 +    MOZ_CHECK_PTHREADS(pthreads,
  1.2307 +        USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
  1.2308 +        MOZ_CHECK_PTHREADS(pthread,
  1.2309 +            USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
  1.2310 +            MOZ_CHECK_PTHREADS(c_r,
  1.2311 +                USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
  1.2312 +                MOZ_CHECK_PTHREADS(c,
  1.2313 +                    USE_PTHREADS=1
  1.2314 +                )
  1.2315 +            )
  1.2316 +        )
  1.2317 +    )
  1.2318 +    ;;
  1.2319 +esac
  1.2320 +
  1.2321 +dnl ========================================================
  1.2322 +dnl Check the command line for --with-pthreads
  1.2323 +dnl ========================================================
  1.2324 +MOZ_ARG_WITH_BOOL(pthreads,
  1.2325 +[  --with-pthreads         Force use of system pthread library with NSPR ],
  1.2326 +[ if test "$USE_PTHREADS"x = x; then
  1.2327 +    AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
  1.2328 +fi],
  1.2329 +    USE_PTHREADS=
  1.2330 +    _PTHREAD_LDFLAGS=
  1.2331 +)
  1.2332 +
  1.2333 +dnl ========================================================
  1.2334 +dnl Do the platform specific pthread hackery
  1.2335 +dnl ========================================================
  1.2336 +if test "$USE_PTHREADS"x != x
  1.2337 +then
  1.2338 +	dnl
  1.2339 +	dnl See if -pthread is supported.
  1.2340 +	dnl
  1.2341 +	rm -f conftest*
  1.2342 +	ac_cv_have_dash_pthread=no
  1.2343 +	AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
  1.2344 +	echo 'int main() { return 0; }' | cat > conftest.c
  1.2345 +	${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
  1.2346 +	if test $? -eq 0; then
  1.2347 +		if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
  1.2348 +			ac_cv_have_dash_pthread=yes
  1.2349 +	        case "$target_os" in
  1.2350 +	        freebsd*)
  1.2351 +# Freebsd doesn't use -pthread for compiles, it uses them for linking
  1.2352 +                ;;
  1.2353 +	        *)
  1.2354 +			    CFLAGS="$CFLAGS -pthread"
  1.2355 +			    CXXFLAGS="$CXXFLAGS -pthread"
  1.2356 +                ;;
  1.2357 +	        esac
  1.2358 +		fi
  1.2359 +	fi
  1.2360 +	rm -f conftest*
  1.2361 +    AC_MSG_RESULT($ac_cv_have_dash_pthread)
  1.2362 +
  1.2363 +	dnl
  1.2364 +	dnl See if -pthreads is supported.
  1.2365 +	dnl
  1.2366 +    ac_cv_have_dash_pthreads=no
  1.2367 +    if test "$ac_cv_have_dash_pthread" = "no"; then
  1.2368 +	    AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
  1.2369 +    	echo 'int main() { return 0; }' | cat > conftest.c
  1.2370 +	    ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
  1.2371 +    	if test $? -eq 0; then
  1.2372 +	    	if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
  1.2373 +			    ac_cv_have_dash_pthreads=yes
  1.2374 +			    CFLAGS="$CFLAGS -pthreads"
  1.2375 +			    CXXFLAGS="$CXXFLAGS -pthreads"
  1.2376 +		    fi
  1.2377 +	    fi
  1.2378 +	    rm -f conftest*
  1.2379 +    	AC_MSG_RESULT($ac_cv_have_dash_pthreads)
  1.2380 +    fi
  1.2381 +
  1.2382 +	case "$target" in
  1.2383 +	    *-*-freebsd*)
  1.2384 +			AC_DEFINE(_REENTRANT)
  1.2385 +			AC_DEFINE(_THREAD_SAFE)
  1.2386 +			dnl -pthread links in -lpthread, so don't specify it explicitly.
  1.2387 +			if test "$ac_cv_have_dash_pthread" = "yes"; then
  1.2388 +				_PTHREAD_LDFLAGS="-pthread"
  1.2389 +			fi
  1.2390 +			;;
  1.2391 +
  1.2392 +	    *-*-openbsd*|*-*-bsdi*)
  1.2393 +			AC_DEFINE(_REENTRANT)
  1.2394 +			AC_DEFINE(_THREAD_SAFE)
  1.2395 +			dnl -pthread links in -lc_r, so don't specify it explicitly.
  1.2396 +			if test "$ac_cv_have_dash_pthread" = "yes"; then
  1.2397 +                _PTHREAD_LDFLAGS="-pthread"
  1.2398 +			fi
  1.2399 +			;;
  1.2400 +
  1.2401 +	    *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
  1.2402 +			AC_DEFINE(_REENTRANT)
  1.2403 +			;;
  1.2404 +
  1.2405 +	    *-aix4.3*|*-aix5*)
  1.2406 +			AC_DEFINE(_REENTRANT)
  1.2407 +			;;
  1.2408 +
  1.2409 +	    *-hpux11.*)
  1.2410 +			AC_DEFINE(_REENTRANT)
  1.2411 +			;;
  1.2412 +
  1.2413 +	    *-*-solaris*)
  1.2414 +			AC_DEFINE(_REENTRANT)
  1.2415 +			if test "$SOLARIS_SUNPRO_CC"; then
  1.2416 +				CFLAGS="$CFLAGS -mt"
  1.2417 +				CXXFLAGS="$CXXFLAGS -mt"
  1.2418 +			fi
  1.2419 +			;;
  1.2420 +	esac
  1.2421 +    LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
  1.2422 +fi
  1.2423 +
  1.2424 +
  1.2425 +dnl Checks for library functions.
  1.2426 +dnl ========================================================
  1.2427 +AC_PROG_GCC_TRADITIONAL
  1.2428 +AC_FUNC_MEMCMP
  1.2429 +AC_CHECK_FUNCS([getc_unlocked _getc_nolock localtime_r])
  1.2430 +
  1.2431 +
  1.2432 +dnl Checks for math functions.
  1.2433 +dnl ========================================================
  1.2434 +AC_CHECK_LIB(m, sin)
  1.2435 +AC_CHECK_FUNCS([log2 log1p expm1 sqrt1pm1 acosh asinh atanh trunc cbrt])
  1.2436 +
  1.2437 +
  1.2438 +dnl check for wcrtomb/mbrtowc
  1.2439 +dnl =======================================================================
  1.2440 +if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
  1.2441 +AC_LANG_SAVE
  1.2442 +AC_LANG_CPLUSPLUS
  1.2443 +AC_CACHE_CHECK(for wcrtomb,
  1.2444 +    ac_cv_have_wcrtomb,
  1.2445 +    [AC_TRY_LINK([#include <wchar.h>],
  1.2446 +                 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
  1.2447 +                 ac_cv_have_wcrtomb="yes",
  1.2448 +                 ac_cv_have_wcrtomb="no")])
  1.2449 +if test "$ac_cv_have_wcrtomb" = "yes"; then
  1.2450 +    AC_DEFINE(HAVE_WCRTOMB)
  1.2451 +fi
  1.2452 +AC_CACHE_CHECK(for mbrtowc,
  1.2453 +    ac_cv_have_mbrtowc,
  1.2454 +    [AC_TRY_LINK([#include <wchar.h>],
  1.2455 +                 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
  1.2456 +                 ac_cv_have_mbrtowc="yes",
  1.2457 +                 ac_cv_have_mbrtowc="no")])
  1.2458 +if test "$ac_cv_have_mbrtowc" = "yes"; then
  1.2459 +    AC_DEFINE(HAVE_MBRTOWC)
  1.2460 +fi
  1.2461 +AC_LANG_RESTORE
  1.2462 +fi
  1.2463 +
  1.2464 +AC_CACHE_CHECK(
  1.2465 +    [for res_ninit()],
  1.2466 +    ac_cv_func_res_ninit,
  1.2467 +    [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
  1.2468 +        dnl no need for res_ninit() on NetBSD and OpenBSD
  1.2469 +        ac_cv_func_res_ninit=no
  1.2470 +     else
  1.2471 +       AC_TRY_LINK([
  1.2472 +            #ifdef linux
  1.2473 +            #define _BSD_SOURCE 1
  1.2474 +            #endif
  1.2475 +            #include <sys/types.h>
  1.2476 +            #include <netinet/in.h>
  1.2477 +            #include <arpa/nameser.h>
  1.2478 +            #include <resolv.h>
  1.2479 +            ],
  1.2480 +            [int foo = res_ninit(&_res);],
  1.2481 +            [ac_cv_func_res_ninit=yes],
  1.2482 +            [ac_cv_func_res_ninit=no])
  1.2483 +     fi
  1.2484 +    ])
  1.2485 +
  1.2486 +if test "$ac_cv_func_res_ninit" = "yes"; then
  1.2487 +    AC_DEFINE(HAVE_RES_NINIT)
  1.2488 +dnl must add the link line we do something as foolish as this... dougt
  1.2489 +dnl else
  1.2490 +dnl    AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
  1.2491 +dnl        AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
  1.2492 +fi
  1.2493 +
  1.2494 +AM_LANGINFO_CODESET
  1.2495 +
  1.2496 +AC_LANG_C
  1.2497 +
  1.2498 +dnl **********************
  1.2499 +dnl *** va_copy checks ***
  1.2500 +dnl **********************
  1.2501 +AC_CACHE_CHECK([for an implementation of va_copy()],
  1.2502 +               ac_cv_va_copy,
  1.2503 +    [AC_TRY_COMPILE([#include <stdarg.h>
  1.2504 +                     #include <stdlib.h>
  1.2505 +        void f (int i, ...) {
  1.2506 +            va_list args1, args2;
  1.2507 +            va_start (args1, i);
  1.2508 +            va_copy (args2, args1);
  1.2509 +            if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
  1.2510 +                exit (1);
  1.2511 +            va_end (args1); va_end (args2);
  1.2512 +        }],
  1.2513 +        [f(0, 42); return 0],
  1.2514 +        [ac_cv_va_copy=yes],
  1.2515 +        [ac_cv_va_copy=no]
  1.2516 +    )]
  1.2517 +)
  1.2518 +AC_CACHE_CHECK([whether va_list can be copied by value],
  1.2519 +               ac_cv_va_val_copy,
  1.2520 +    [AC_TRY_COMPILE([#include <stdarg.h>
  1.2521 +                     #include <stdlib.h>
  1.2522 +        void f (int i, ...) {
  1.2523 +            va_list args1, args2;
  1.2524 +            va_start (args1, i);
  1.2525 +            args2 = args1;
  1.2526 +            if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
  1.2527 +                exit (1);
  1.2528 +            va_end (args1); va_end (args2);
  1.2529 +        }],
  1.2530 +        [f(0, 42); return 0],
  1.2531 +        [ac_cv_va_val_copy=yes],
  1.2532 +        [ac_cv_va_val_copy=no],
  1.2533 +    )]
  1.2534 +)
  1.2535 +if test "x$ac_cv_va_copy" = "xyes"; then
  1.2536 +    AC_DEFINE(VA_COPY, va_copy)
  1.2537 +    AC_DEFINE(HAVE_VA_COPY)
  1.2538 +fi
  1.2539 +
  1.2540 +if test "x$ac_cv_va_val_copy" = "xno"; then
  1.2541 +   AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
  1.2542 +fi
  1.2543 +
  1.2544 +dnl ===================================================================
  1.2545 +dnl ========================================================
  1.2546 +dnl Put your C++ language/feature checks below
  1.2547 +dnl ========================================================
  1.2548 +AC_LANG_CPLUSPLUS
  1.2549 +
  1.2550 +ARM_ABI_PREFIX=
  1.2551 +if test "$GNU_CC"; then
  1.2552 +  if test "$CPU_ARCH" = "arm" ; then
  1.2553 +    AC_CACHE_CHECK(for ARM EABI,
  1.2554 +        ac_cv_gcc_arm_eabi,
  1.2555 +        [AC_TRY_COMPILE([],
  1.2556 +                        [
  1.2557 +#if defined(__ARM_EABI__)
  1.2558 +  return 0;
  1.2559 +#else
  1.2560 +#error Not ARM EABI.
  1.2561 +#endif
  1.2562 +                        ],
  1.2563 +                        ac_cv_gcc_arm_eabi="yes",
  1.2564 +                        ac_cv_gcc_arm_eabi="no")])
  1.2565 +    if test "$ac_cv_gcc_arm_eabi" = "yes"; then
  1.2566 +        HAVE_ARM_EABI=1
  1.2567 +        ARM_ABI_PREFIX=eabi-
  1.2568 +    else
  1.2569 +        ARM_ABI_PREFIX=oabi-
  1.2570 +    fi
  1.2571 +  fi
  1.2572 +
  1.2573 +  TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
  1.2574 +fi
  1.2575 +
  1.2576 +dnl Check to see if we can resolve ambiguity with |using|.
  1.2577 +AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
  1.2578 +               ac_cv_cpp_ambiguity_resolving_using,
  1.2579 +               [AC_TRY_COMPILE(class X {
  1.2580 +                                 public: int go(const X&) {return 3;}
  1.2581 +                                         int jo(const X&) {return 3;}
  1.2582 +                               };
  1.2583 +                               class Y : public X {
  1.2584 +                                 public:  int go(int) {return 2;}
  1.2585 +                                          int jo(int) {return 2;}
  1.2586 +                                          using X::jo;
  1.2587 +                                 private: using X::go;
  1.2588 +                               };,
  1.2589 +                               X x; Y y; y.jo(x);,
  1.2590 +                               ac_cv_cpp_ambiguity_resolving_using=yes,
  1.2591 +                               ac_cv_cpp_ambiguity_resolving_using=no)])
  1.2592 +if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
  1.2593 +   AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
  1.2594 +fi
  1.2595 +
  1.2596 +dnl See if a dynamic_cast to void* gives the most derived object.
  1.2597 +AC_CACHE_CHECK(for C++ dynamic_cast to void*,
  1.2598 +               ac_cv_cpp_dynamic_cast_void_ptr,
  1.2599 +               [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
  1.2600 +                            class Y { int j; public: virtual ~Y() { } };
  1.2601 +                            class Z : public X, public Y { int k; };
  1.2602 +
  1.2603 +                            int main() {
  1.2604 +                                 Z mdo;
  1.2605 +                                 X *subx = (X*)&mdo;
  1.2606 +                                 Y *suby = (Y*)&mdo;
  1.2607 +                                 return !((((void*)&mdo != (void*)subx) &&
  1.2608 +                                           ((void*)&mdo == dynamic_cast<void*>(subx))) ||
  1.2609 +                                          (((void*)&mdo != (void*)suby) &&
  1.2610 +                                           ((void*)&mdo == dynamic_cast<void*>(suby))));
  1.2611 +                            }],
  1.2612 +                           ac_cv_cpp_dynamic_cast_void_ptr=yes,
  1.2613 +                           ac_cv_cpp_dynamic_cast_void_ptr=no,
  1.2614 +                           ac_cv_cpp_dynamic_cast_void_ptr=no)])
  1.2615 +if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
  1.2616 +   AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
  1.2617 +fi
  1.2618 +
  1.2619 +
  1.2620 +dnl note that this one is reversed - if the test fails, then
  1.2621 +dnl we require implementations of unused virtual methods. Which
  1.2622 +dnl really blows because it means we'll have useless vtable
  1.2623 +dnl bloat.
  1.2624 +AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
  1.2625 +               ac_cv_cpp_unused_required,
  1.2626 +               [AC_TRY_LINK(class X {private: virtual void never_called();};,
  1.2627 +                               X x;,
  1.2628 +                               ac_cv_cpp_unused_required=no,
  1.2629 +                               ac_cv_cpp_unused_required=yes)])
  1.2630 +if test "$ac_cv_cpp_unused_required" = yes ; then
  1.2631 +   AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
  1.2632 +fi
  1.2633 +
  1.2634 +
  1.2635 +dnl Some compilers have trouble comparing a constant reference to a templatized
  1.2636 +dnl class to zero, and require an explicit operator==() to be defined that takes
  1.2637 +dnl an int. This test separates the strong from the weak.
  1.2638 +
  1.2639 +AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
  1.2640 +               ac_cv_trouble_comparing_to_zero,
  1.2641 +               [AC_TRY_COMPILE([#include <algorithm>
  1.2642 +                                template <class T> class Foo {};
  1.2643 +                                class T2;
  1.2644 +                                template <class T> int operator==(const T2*, const T&) { return 0; }
  1.2645 +                                template <class T> int operator!=(const T2*, const T&) { return 0; }],
  1.2646 +                               [Foo<int> f; return (0 != f);],
  1.2647 +                               ac_cv_trouble_comparing_to_zero=no,
  1.2648 +                               ac_cv_trouble_comparing_to_zero=yes)])
  1.2649 +if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
  1.2650 +  AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
  1.2651 +fi
  1.2652 +
  1.2653 +# try harder, when checking for __thread support, see bug 521750 comment #33 and below
  1.2654 +# We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
  1.2655 +# enabled, the linker in xcode 4.1 will crash. Without this it would crash when
  1.2656 +# linking XUL.
  1.2657 +_SAVE_LDFLAGS=$LDFLAGS
  1.2658 +LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
  1.2659 +AC_CACHE_CHECK(for __thread keyword for TLS variables,
  1.2660 +               ac_cv_thread_keyword,
  1.2661 +               [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
  1.2662 +                            [return tlsIsMainThread;],
  1.2663 +                            ac_cv_thread_keyword=yes,
  1.2664 +                            ac_cv_thread_keyword=no)])
  1.2665 +LDFLAGS=$_SAVE_LDFLAGS
  1.2666 +if test "$ac_cv_thread_keyword" = yes; then
  1.2667 +  # mips builds fail with TLS variables because of a binutils bug.
  1.2668 +  # See bug 528687
  1.2669 +  case "${target}" in
  1.2670 +    mips*-*)
  1.2671 +      :
  1.2672 +      ;;
  1.2673 +    *-android*|*-linuxandroid*)
  1.2674 +      :
  1.2675 +      ;;
  1.2676 +    *)
  1.2677 +      AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
  1.2678 +      ;;
  1.2679 +  esac
  1.2680 +fi
  1.2681 +
  1.2682 +dnl See if compiler supports some gcc-style attributes
  1.2683 +
  1.2684 +AC_CACHE_CHECK(for __attribute__((always_inline)),
  1.2685 +               ac_cv_attribute_always_inline,
  1.2686 +               [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
  1.2687 +                               [],
  1.2688 +                               ac_cv_attribute_always_inline=yes,
  1.2689 +                               ac_cv_attribute_always_inline=no)])
  1.2690 +
  1.2691 +AC_CACHE_CHECK(for __attribute__((malloc)),
  1.2692 +               ac_cv_attribute_malloc,
  1.2693 +               [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
  1.2694 +                               [],
  1.2695 +                               ac_cv_attribute_malloc=yes,
  1.2696 +                               ac_cv_attribute_malloc=no)])
  1.2697 +
  1.2698 +AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
  1.2699 +               ac_cv_attribute_warn_unused,
  1.2700 +               [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
  1.2701 +                               [],
  1.2702 +                               ac_cv_attribute_warn_unused=yes,
  1.2703 +                               ac_cv_attribute_warn_unused=no)])
  1.2704 +
  1.2705 +dnl End of C++ language/feature checks
  1.2706 +AC_LANG_C
  1.2707 +
  1.2708 +dnl ========================================================
  1.2709 +dnl =  Internationalization checks
  1.2710 +dnl ========================================================
  1.2711 +dnl
  1.2712 +dnl Internationalization and Locale support is different
  1.2713 +dnl on various UNIX platforms.  Checks for specific i18n
  1.2714 +dnl features go here.
  1.2715 +
  1.2716 +dnl check for LC_MESSAGES
  1.2717 +AC_CACHE_CHECK(for LC_MESSAGES,
  1.2718 +		ac_cv_i18n_lc_messages,
  1.2719 +		[AC_TRY_COMPILE([#include <locale.h>],
  1.2720 +				[int category = LC_MESSAGES;],
  1.2721 +				ac_cv_i18n_lc_messages=yes,
  1.2722 +				ac_cv_i18n_lc_messages=no)])
  1.2723 +if test "$ac_cv_i18n_lc_messages" = yes; then
  1.2724 +   AC_DEFINE(HAVE_I18N_LC_MESSAGES)
  1.2725 +fi
  1.2726 +
  1.2727 +AC_HAVE_FUNCS(localeconv)
  1.2728 +fi # ! SKIP_COMPILER_CHECKS
  1.2729 +
  1.2730 +TARGET_XPCOM_ABI=
  1.2731 +if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
  1.2732 +    TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
  1.2733 +fi
  1.2734 +
  1.2735 +dnl Mozilla specific options
  1.2736 +dnl ========================================================
  1.2737 +dnl The macros used for command line options
  1.2738 +dnl are defined in build/autoconf/altoptions.m4.
  1.2739 +
  1.2740 +dnl If the compiler supports these attributes, define them as
  1.2741 +dnl convenience macros.
  1.2742 +if test "$ac_cv_attribute_malloc" = yes ; then
  1.2743 +  AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
  1.2744 +else
  1.2745 +  AC_DEFINE(NS_ATTR_MALLOC,)
  1.2746 +fi
  1.2747 +
  1.2748 +if test "$ac_cv_attribute_warn_unused" = yes ; then
  1.2749 +  AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
  1.2750 +else
  1.2751 +  AC_DEFINE(NS_WARN_UNUSED_RESULT,)
  1.2752 +fi
  1.2753 +
  1.2754 +dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
  1.2755 +dnl features that Windows actually does support.
  1.2756 +
  1.2757 +if test -n "$SKIP_COMPILER_CHECKS"; then
  1.2758 +   dnl Windows has malloc.h
  1.2759 +   AC_DEFINE(MALLOC_H, [<malloc.h>])
  1.2760 +   AC_DEFINE(HAVE_FORCEINLINE)
  1.2761 +   AC_DEFINE(HAVE_LOCALECONV)
  1.2762 +fi # SKIP_COMPILER_CHECKS
  1.2763 +
  1.2764 +dnl ========================================================
  1.2765 +dnl = Mozilla update channel, used for disabling features
  1.2766 +dnl = not wanted for release.
  1.2767 +dnl ========================================================
  1.2768 +
  1.2769 +# app update channel is 'default' when not supplied.
  1.2770 +MOZ_ARG_ENABLE_STRING([update-channel],
  1.2771 +[  --enable-update-channel=CHANNEL
  1.2772 +                          Select application update channel (default=default)],
  1.2773 +    MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
  1.2774 +
  1.2775 +if test -z "$MOZ_UPDATE_CHANNEL"; then
  1.2776 +    MOZ_UPDATE_CHANNEL=default
  1.2777 +fi
  1.2778 +AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
  1.2779 +AC_SUBST(MOZ_UPDATE_CHANNEL)
  1.2780 +
  1.2781 +
  1.2782 +dnl set GRE_MILESTONE
  1.2783 +dnl ========================================================
  1.2784 +GRE_MILESTONE=`tail -n 1 "$_topsrcdir"/config/milestone.txt 2>/dev/null || tail -1 "$_topsrcdir"/config/milestone.txt`
  1.2785 +AC_SUBST(GRE_MILESTONE)
  1.2786 +
  1.2787 +dnl set RELEASE_BUILD and NIGHTLY_BUILD variables depending on the cycle we're in
  1.2788 +dnl The logic works like this:
  1.2789 +dnl - if we have "a1" in GRE_MILESTONE, we're building Nightly (define NIGHTLY_BUILD)
  1.2790 +dnl - otherwise, we're building Release/Beta (define RELEASE_BUILD)
  1.2791 +case "$GRE_MILESTONE" in
  1.2792 +  *a1*)
  1.2793 +      NIGHTLY_BUILD=1
  1.2794 +      AC_DEFINE(NIGHTLY_BUILD)
  1.2795 +      ;;
  1.2796 +  *)
  1.2797 +      RELEASE_BUILD=1
  1.2798 +      AC_DEFINE(RELEASE_BUILD)
  1.2799 +      ;;
  1.2800 +esac
  1.2801 +AC_SUBST(NIGHTLY_BUILD)
  1.2802 +AC_SUBST(RELEASE_BUILD)
  1.2803 +
  1.2804 +dnl ========================================================
  1.2805 +dnl Disable compiling sources in unified mode.
  1.2806 +dnl ========================================================
  1.2807 +
  1.2808 +if test -z "$NIGHTLY_BUILD"; then
  1.2809 +    MOZ_DISABLE_UNIFIED_COMPILATION=1
  1.2810 +fi
  1.2811 +
  1.2812 +MOZ_ARG_DISABLE_BOOL(unified-compilation,
  1.2813 +[  --disable-unified-compilation
  1.2814 +                          Disable unified compilation of some C/C++ sources],
  1.2815 +    MOZ_DISABLE_UNIFIED_COMPILATION=1,
  1.2816 +    MOZ_DISABLE_UNIFIED_COMPILATION=)
  1.2817 +AC_SUBST(MOZ_DISABLE_UNIFIED_COMPILATION)
  1.2818 +
  1.2819 +dnl ========================================================
  1.2820 +dnl =
  1.2821 +dnl = Check for external package dependencies
  1.2822 +dnl =
  1.2823 +dnl ========================================================
  1.2824 +MOZ_ARG_HEADER(External Packages)
  1.2825 +
  1.2826 +dnl ========================================================
  1.2827 +dnl = Find the right NSPR to use.
  1.2828 +dnl ========================================================
  1.2829 +MOZ_ARG_WITH_BOOL(system-nspr,
  1.2830 +[  --with-system-nspr      Use an NSPR that is already built and installed.
  1.2831 +                          Use the 'nspr-config' script in the current path,
  1.2832 +                          or look for the script in the directories given with
  1.2833 +                          --with-nspr-exec-prefix or --with-nspr-prefix.
  1.2834 +                          (Those flags are only checked if you specify
  1.2835 +                          --with-system-nspr.)],
  1.2836 +    _USE_SYSTEM_NSPR=1 )
  1.2837 +
  1.2838 +MOZ_ARG_WITH_STRING(nspr-cflags,
  1.2839 +[  --with-nspr-cflags=FLAGS
  1.2840 +                          Pass FLAGS to CC when building code that uses NSPR.
  1.2841 +                          Use this when there's no accurate nspr-config
  1.2842 +                          script available.  This is the case when building
  1.2843 +                          SpiderMonkey as part of the Mozilla tree: the
  1.2844 +                          top-level configure script computes NSPR flags
  1.2845 +                          that accomodate the quirks of that environment.],
  1.2846 +    NSPR_CFLAGS=$withval)
  1.2847 +MOZ_ARG_WITH_STRING(nspr-libs,
  1.2848 +[  --with-nspr-libs=LIBS   Pass LIBS to LD when linking code that uses NSPR.
  1.2849 +                          See --with-nspr-cflags for more details.],
  1.2850 +    NSPR_LIBS=$withval)
  1.2851 +AC_SUBST(NSPR_CFLAGS)
  1.2852 +AC_SUBST(NSPR_LIBS)
  1.2853 +
  1.2854 +JS_THREADSAFE=1
  1.2855 +MOZ_ARG_DISABLE_BOOL(threadsafe,
  1.2856 +[  --disable-threadsafe    Disable support for multiple threads.],
  1.2857 +    JS_THREADSAFE= ,
  1.2858 +    JS_THREADSAFE=1 )
  1.2859 +if test -n "$JS_THREADSAFE"; then
  1.2860 +    AC_DEFINE(JS_THREADSAFE)
  1.2861 +fi
  1.2862 +
  1.2863 +if test "$_USE_SYSTEM_NSPR" || (test "$NSPR_CFLAGS" -o "$NSPR_LIBS"); then
  1.2864 +  _HAS_NSPR=1
  1.2865 +fi
  1.2866 +
  1.2867 +case "$target" in
  1.2868 +  *linux*|*darwin*|*dragonfly*|*freebsd*|*netbsd*|*openbsd*)
  1.2869 +    if test -z "$_HAS_NSPR" && test "$JS_THREADSAFE"; then
  1.2870 +      JS_POSIX_NSPR_DEFAULT=1
  1.2871 +    fi
  1.2872 +    ;;
  1.2873 +esac
  1.2874 +
  1.2875 +MOZ_ARG_ENABLE_BOOL(posix-nspr-emulation,
  1.2876 +[  --enable-posix-nspr-emulation
  1.2877 +                          Enable emulation of NSPR for POSIX systems],
  1.2878 +    JS_POSIX_NSPR=1,
  1.2879 +    JS_POSIX_NSPR=,
  1.2880 +    JS_POSIX_NSPR="$JS_POSIX_NSPR_DEFAULT" )
  1.2881 +if test -n "$JS_POSIX_NSPR"; then
  1.2882 +    AC_DEFINE(JS_POSIX_NSPR)
  1.2883 +fi
  1.2884 +
  1.2885 +AC_SUBST(JS_POSIX_NSPR)
  1.2886 +
  1.2887 +dnl Pass either --with-system-nspr or (--with-nspr-cflags and
  1.2888 +dnl --with-nspr-libs), but not both.
  1.2889 +if test "$_USE_SYSTEM_NSPR" && (test "$NSPR_CFLAGS" -o "$NSPR_LIBS"); then
  1.2890 +    AC_MSG_ERROR([--with-system-nspr and --with-nspr-libs/cflags are mutually exclusive.
  1.2891 +See 'configure --help'.])
  1.2892 +fi
  1.2893 +
  1.2894 +dnl Can't use --enable-posix-nspr-emulation if compiling with NSPR.
  1.2895 +if test "$_HAS_NSPR" && test "$JS_POSIX_NSPR"; then
  1.2896 +    AC_MSG_ERROR([--enable-posix-nspr-emulation is mututally exclusive with --with-system-nspr
  1.2897 +and --with-nspr-libs/cflags. See 'configure --help'.])
  1.2898 +fi
  1.2899 +
  1.2900 +if test -n "$_USE_SYSTEM_NSPR"; then
  1.2901 +    MOZ_NATIVE_NSPR=
  1.2902 +    AM_PATH_NSPR($NSPR_MINVER, [MOZ_NATIVE_NSPR=1], [AC_MSG_ERROR([your don't have NSPR installed or your version is too old])])
  1.2903 +fi
  1.2904 +
  1.2905 +NSPR_PKGCONF_CHECK="nspr"
  1.2906 +if test -n "$MOZ_NATIVE_NSPR"; then
  1.2907 +    # piggy back on $MOZ_NATIVE_NSPR to set a variable for the nspr check for js.pc
  1.2908 +    NSPR_PKGCONF_CHECK="nspr >= $NSPR_MINVER"
  1.2909 +
  1.2910 +    _SAVE_CFLAGS=$CFLAGS
  1.2911 +    CFLAGS="$CFLAGS $NSPR_CFLAGS"
  1.2912 +    AC_TRY_COMPILE([#include "prlog.h"],
  1.2913 +                [#ifndef PR_STATIC_ASSERT
  1.2914 +                 #error PR_STATIC_ASSERT not defined
  1.2915 +                 #endif],
  1.2916 +                [MOZ_NATIVE_NSPR=1],
  1.2917 +                AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
  1.2918 +    CFLAGS=$_SAVE_CFLAGS
  1.2919 +fi
  1.2920 +AC_SUBST(NSPR_PKGCONF_CHECK)
  1.2921 +
  1.2922 +dnl ========================================================
  1.2923 +dnl system zlib Support
  1.2924 +dnl ========================================================
  1.2925 +dnl Standalone js defaults to system zlib
  1.2926 +ZLIB_DIR=yes
  1.2927 +
  1.2928 +MOZ_ZLIB_CHECK([1.2.3])
  1.2929 +
  1.2930 +if test -n "$ZLIB_IN_MOZGLUE"; then
  1.2931 +    AC_DEFINE(ZLIB_IN_MOZGLUE)
  1.2932 +fi
  1.2933 +
  1.2934 +dnl ========================================================
  1.2935 +dnl system libffi Support
  1.2936 +dnl ========================================================
  1.2937 +MOZ_CONFIG_FFI()
  1.2938 +
  1.2939 +dnl ========================================================
  1.2940 +dnl =
  1.2941 +dnl = Application
  1.2942 +dnl =
  1.2943 +dnl ========================================================
  1.2944 +
  1.2945 +MOZ_ARG_HEADER(Application)
  1.2946 +
  1.2947 +ENABLE_TESTS=1
  1.2948 +
  1.2949 +USE_ARM_KUSER=
  1.2950 +
  1.2951 +case "${target}" in
  1.2952 +    arm*-android*|arm*-linuxandroid*)
  1.2953 +        USE_ARM_KUSER=1
  1.2954 +        ;;
  1.2955 +esac
  1.2956 +
  1.2957 +dnl ========================================================
  1.2958 +dnl Use ARM userspace kernel helpers; tell NSPR to enable
  1.2959 +dnl their usage and use them in spidermonkey.
  1.2960 +dnl ========================================================
  1.2961 +MOZ_ARG_WITH_BOOL(arm-kuser,
  1.2962 +[  --with-arm-kuser         Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
  1.2963 +    USE_ARM_KUSER=1,)
  1.2964 +if test -n "$USE_ARM_KUSER"; then
  1.2965 +   AC_DEFINE(USE_ARM_KUSER)
  1.2966 +fi
  1.2967 +
  1.2968 +dnl ========================================================
  1.2969 +dnl =
  1.2970 +dnl = Components & Features
  1.2971 +dnl =
  1.2972 +dnl ========================================================
  1.2973 +MOZ_ARG_HEADER(Components and Features)
  1.2974 +
  1.2975 +dnl ========================================================
  1.2976 +dnl = Localization
  1.2977 +dnl ========================================================
  1.2978 +MOZ_ARG_ENABLE_STRING(ui-locale,
  1.2979 +[  --enable-ui-locale=ab-CD
  1.2980 +                          Select the user interface locale (default: en-US)],
  1.2981 +    MOZ_UI_LOCALE=$enableval )
  1.2982 +AC_SUBST(MOZ_UI_LOCALE)
  1.2983 +
  1.2984 +dnl ========================================================
  1.2985 +dnl build the tests by default
  1.2986 +dnl ========================================================
  1.2987 +MOZ_ARG_DISABLE_BOOL(tests,
  1.2988 +[  --disable-tests         Do not build test libraries & programs],
  1.2989 +    ENABLE_TESTS=,
  1.2990 +    ENABLE_TESTS=1 )
  1.2991 +
  1.2992 +dnl ========================================================
  1.2993 +dnl =
  1.2994 +dnl = Module specific options
  1.2995 +dnl =
  1.2996 +dnl ========================================================
  1.2997 +MOZ_ARG_HEADER(Individual module options)
  1.2998 +
  1.2999 +dnl ========================================================
  1.3000 +dnl =
  1.3001 +dnl = Debugging Options
  1.3002 +dnl =
  1.3003 +dnl ========================================================
  1.3004 +MOZ_ARG_HEADER(Debugging and Optimizations)
  1.3005 +
  1.3006 +if test "$ENABLE_METHODJIT_SPEW"; then
  1.3007 +    AC_DEFINE(JS_METHODJIT_SPEW)
  1.3008 +fi
  1.3009 +
  1.3010 +dnl ========================================================
  1.3011 +dnl = Enable code optimization. ON by default.
  1.3012 +dnl ========================================================
  1.3013 +if test -z "$MOZ_OPTIMIZE_FLAGS"; then
  1.3014 +	MOZ_OPTIMIZE_FLAGS="-O"
  1.3015 +fi
  1.3016 +
  1.3017 +MOZ_ARG_ENABLE_STRING(optimize,
  1.3018 +[  --disable-optimize      Disable compiler optimization
  1.3019 +  --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
  1.3020 +[ if test "$enableval" != "no"; then
  1.3021 +    MOZ_OPTIMIZE=1
  1.3022 +    if test -n "$enableval" -a "$enableval" != "yes"; then
  1.3023 +        MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
  1.3024 +        MOZ_OPTIMIZE=2
  1.3025 +    fi
  1.3026 +else
  1.3027 +    MOZ_OPTIMIZE=
  1.3028 +fi ], MOZ_OPTIMIZE=1)
  1.3029 +
  1.3030 +MOZ_SET_FRAMEPTR_FLAGS
  1.3031 +
  1.3032 +if test "$COMPILE_ENVIRONMENT"; then
  1.3033 +if test -n "$MOZ_OPTIMIZE"; then
  1.3034 +    AC_MSG_CHECKING([for valid optimization flags])
  1.3035 +    _SAVE_CFLAGS=$CFLAGS
  1.3036 +    CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
  1.3037 +    AC_TRY_COMPILE([#include <stdio.h>],
  1.3038 +        [printf("Hello World\n");],
  1.3039 +        _results=yes,
  1.3040 +        _results=no)
  1.3041 +    AC_MSG_RESULT([$_results])
  1.3042 +    if test "$_results" = "no"; then
  1.3043 +        AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
  1.3044 +    fi
  1.3045 +    CFLAGS=$_SAVE_CFLAGS
  1.3046 +fi
  1.3047 +fi # COMPILE_ENVIRONMENT
  1.3048 +
  1.3049 +AC_SUBST(MOZ_OPTIMIZE)
  1.3050 +AC_SUBST(MOZ_FRAMEPTR_FLAGS)
  1.3051 +AC_SUBST(MOZ_OPTIMIZE_FLAGS)
  1.3052 +AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
  1.3053 +AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
  1.3054 +AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
  1.3055 +
  1.3056 +dnl ========================================================
  1.3057 +dnl = Enable trace logging
  1.3058 +dnl ========================================================
  1.3059 +MOZ_ARG_ENABLE_BOOL(trace-logging,
  1.3060 +[  --enable-trace-logging   Enable trace logging],
  1.3061 +    ENABLE_TRACE_LOGGING=1,
  1.3062 +    ENABLE_TRACE_LOGGING= )
  1.3063 +
  1.3064 +AC_SUBST(ENABLE_TRACE_LOGGING)
  1.3065 +
  1.3066 +if test "$ENABLE_TRACE_LOGGING"; then
  1.3067 +    AC_DEFINE(JS_TRACE_LOGGING)
  1.3068 +fi
  1.3069 +
  1.3070 +dnl ========================================================
  1.3071 +dnl = Enable any treating of compile warnings as errors
  1.3072 +dnl ========================================================
  1.3073 +MOZ_ARG_DISABLE_BOOL(warnings-as-errors,
  1.3074 +[  --enable-warnings-as-errors
  1.3075 +                          Enable treating of warnings as errors],
  1.3076 +    MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
  1.3077 +    MOZ_ENABLE_WARNINGS_AS_ERRORS=)
  1.3078 +if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
  1.3079 +   WARNINGS_AS_ERRORS=''
  1.3080 +elif test "$GNU_CC"; then
  1.3081 +    # Prevent the following GCC warnings from being treated as errors:
  1.3082 +    # -Wuninitialized - too many false positives
  1.3083 +    # -Wmaybe-uninitialized - too many false positives
  1.3084 +    # -Wdeprecated-declarations - we don't want our builds held hostage when a
  1.3085 +    #   platform-specific API becomes deprecated.
  1.3086 +    MOZ_C_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_c_has_noerror_uninitialized)
  1.3087 +    MOZ_CXX_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_cxx_has_noerror_uninitialized)
  1.3088 +    MOZ_C_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_c_has_noerror_maybe_uninitialized)
  1.3089 +    MOZ_CXX_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_cxx_has_noerror_maybe_uninitialized)
  1.3090 +    MOZ_C_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_c_has_noerror_deprecated_declarations)
  1.3091 +    MOZ_CXX_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_cxx_has_noerror_deprecated_declarations)
  1.3092 +fi
  1.3093 +
  1.3094 +dnl ========================================================
  1.3095 +dnl = Enable treating compile warnings as errors
  1.3096 +dnl ========================================================
  1.3097 +MOZ_ARG_ENABLE_BOOL(sm-fail-on-warnings,
  1.3098 +[  --enable-sm-fail-on-warnings
  1.3099 +                          Enable warnings as errors],
  1.3100 +    FAIL_ON_WARNINGS=1,
  1.3101 +    FAIL_ON_WARNINGS= )
  1.3102 +
  1.3103 +AC_SUBST(FAIL_ON_WARNINGS)
  1.3104 +
  1.3105 +dnl ========================================================
  1.3106 +dnl = Enable trace malloc
  1.3107 +dnl ========================================================
  1.3108 +NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
  1.3109 +MOZ_ARG_ENABLE_BOOL(trace-malloc,
  1.3110 +[  --enable-trace-malloc   Enable malloc tracing],
  1.3111 +    NS_TRACE_MALLOC=1,
  1.3112 +    NS_TRACE_MALLOC= )
  1.3113 +if test "$NS_TRACE_MALLOC"; then
  1.3114 +  # Please, Mr. Linker Man, don't take away our symbol names
  1.3115 +  MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
  1.3116 +  AC_DEFINE(NS_TRACE_MALLOC)
  1.3117 +fi
  1.3118 +AC_SUBST(NS_TRACE_MALLOC)
  1.3119 +
  1.3120 +dnl ========================================================
  1.3121 +dnl = Enable DMD
  1.3122 +dnl ========================================================
  1.3123 +
  1.3124 +MOZ_ARG_ENABLE_BOOL(dmd,
  1.3125 +[  --enable-dmd            Enable DMD; also enables jemalloc and replace-malloc],
  1.3126 +    MOZ_DMD=1,
  1.3127 +    MOZ_DMD= )
  1.3128 +
  1.3129 +if test "$NS_TRACE_MALLOC"; then        # trace-malloc disables DMD
  1.3130 +    MOZ_DMD=
  1.3131 +fi
  1.3132 +if test "$MOZ_DMD"; then
  1.3133 +    AC_DEFINE(MOZ_DMD)
  1.3134 +
  1.3135 +    if test "${CPU_ARCH}" = "arm"; then
  1.3136 +        CFLAGS="$CFLAGS -funwind-tables"
  1.3137 +        CXXFLAGS="$CXXFLAGS -funwind-tables"
  1.3138 +    fi
  1.3139 +fi
  1.3140 +
  1.3141 +dnl ========================================================
  1.3142 +dnl = Enable jemalloc
  1.3143 +dnl ========================================================
  1.3144 +MOZ_ARG_ENABLE_BOOL(jemalloc,
  1.3145 +[  --enable-jemalloc       Replace memory allocator with jemalloc],
  1.3146 +    MOZ_MEMORY=1,
  1.3147 +    MOZ_MEMORY=)
  1.3148 +
  1.3149 +if test "$NS_TRACE_MALLOC"; then
  1.3150 +    MOZ_MEMORY=
  1.3151 +fi
  1.3152 +
  1.3153 +if test "$MOZ_MEMORY"; then
  1.3154 +  AC_DEFINE(MOZ_MEMORY)
  1.3155 +  if test "x$MOZ_DEBUG" = "x1"; then
  1.3156 +    AC_DEFINE(MOZ_MEMORY_DEBUG)
  1.3157 +  fi
  1.3158 +  dnl The generic feature tests that determine how to compute ncpus are long and
  1.3159 +  dnl complicated.  Therefore, simply define special cpp variables for the
  1.3160 +  dnl platforms we have special knowledge of.
  1.3161 +  case "${target}" in
  1.3162 +  *-darwin*)
  1.3163 +    AC_DEFINE(MOZ_MEMORY_DARWIN)
  1.3164 +    ;;
  1.3165 +  *-*freebsd*)
  1.3166 +    AC_DEFINE(MOZ_MEMORY_BSD)
  1.3167 +    ;;
  1.3168 +  *-android*|*-linuxandroid*)
  1.3169 +    AC_DEFINE(MOZ_MEMORY_LINUX)
  1.3170 +    AC_DEFINE(MOZ_MEMORY_ANDROID)
  1.3171 +    ;;
  1.3172 +  *-*linux*)
  1.3173 +    AC_DEFINE(MOZ_MEMORY_LINUX)
  1.3174 +    ;;
  1.3175 +  *-netbsd*)
  1.3176 +    AC_DEFINE(MOZ_MEMORY_BSD)
  1.3177 +    ;;
  1.3178 +  *-solaris*)
  1.3179 +    AC_DEFINE(MOZ_MEMORY_SOLARIS)
  1.3180 +    ;;
  1.3181 +  *-mingw*)
  1.3182 +    AC_DEFINE(MOZ_MEMORY_WINDOWS)
  1.3183 +    # the interesting bits will get passed down in MOZ_GLUE_LDFLAGS
  1.3184 +    ;;
  1.3185 +  *)
  1.3186 +    AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
  1.3187 +    ;;
  1.3188 +  esac
  1.3189 +fi
  1.3190 +AC_SUBST(MOZ_MEMORY)
  1.3191 +AC_SUBST(MOZ_GLUE_LDFLAGS)
  1.3192 +AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
  1.3193 +
  1.3194 +dnl ========================================================
  1.3195 +dnl = Use malloc wrapper lib
  1.3196 +dnl ========================================================
  1.3197 +MOZ_ARG_ENABLE_BOOL(wrap-malloc,
  1.3198 +[  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
  1.3199 +    _WRAP_MALLOC=1,
  1.3200 +    _WRAP_MALLOC= )
  1.3201 +
  1.3202 +if test -n "$_WRAP_MALLOC"; then
  1.3203 +    if test "$GNU_CC"; then
  1.3204 +        WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
  1.3205 +        WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
  1.3206 +        WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
  1.3207 +        WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
  1.3208 +        dnl Wrap operator new and operator delete on Android.
  1.3209 +        if test "$OS_TARGET" = "Android"; then
  1.3210 +            WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_Znwj,--wrap=_Znaj,--wrap=_ZdlPv,--wrap=_ZdaPv"
  1.3211 +        fi
  1.3212 +    else
  1.3213 +        AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
  1.3214 +    fi
  1.3215 +fi
  1.3216 +
  1.3217 +dnl ========================================================
  1.3218 +dnl = Location of malloc wrapper lib
  1.3219 +dnl ========================================================
  1.3220 +MOZ_ARG_WITH_STRING(wrap-malloc,
  1.3221 +[  --with-wrap-malloc=DIR  Location of malloc wrapper library],
  1.3222 +    WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
  1.3223 +
  1.3224 +dnl ========================================================
  1.3225 +dnl = Use JS Call tracing
  1.3226 +dnl ========================================================
  1.3227 +MOZ_ARG_ENABLE_BOOL(trace-jscalls,
  1.3228 +[  --enable-trace-jscalls  Enable JS call enter/exit callback (default=no)],
  1.3229 +    MOZ_TRACE_JSCALLS=1,
  1.3230 +    MOZ_TRACE_JSCALLS= )
  1.3231 +if test -n "$MOZ_TRACE_JSCALLS"; then
  1.3232 +    AC_DEFINE(MOZ_TRACE_JSCALLS)
  1.3233 +fi
  1.3234 +
  1.3235 +dnl ========================================================
  1.3236 +dnl = Use incremental GC
  1.3237 +dnl ========================================================
  1.3238 +JSGC_INCREMENTAL=1
  1.3239 +MOZ_ARG_DISABLE_BOOL(gcincremental,
  1.3240 +[  --disable-gcincremental Disable incremental GC],
  1.3241 +    JSGC_INCREMENTAL= )
  1.3242 +if test -n "$JSGC_INCREMENTAL"; then
  1.3243 +    AC_DEFINE(JSGC_INCREMENTAL)
  1.3244 +fi
  1.3245 +
  1.3246 +dnl ========================================================
  1.3247 +dnl = Use generational GC
  1.3248 +dnl ========================================================
  1.3249 +MOZ_ARG_ENABLE_BOOL(gcgenerational,
  1.3250 +[  --enable-gcgenerational Enable generational GC],
  1.3251 +    JSGC_GENERATIONAL=1,
  1.3252 +    JSGC_GENERATIONAL= )
  1.3253 +if test -n "$JSGC_GENERATIONAL"; then
  1.3254 +    AC_DEFINE(JSGC_GENERATIONAL)
  1.3255 +fi
  1.3256 +
  1.3257 +dnl ========================================================
  1.3258 +dnl = Use exact stack rooting for GC
  1.3259 +dnl ========================================================
  1.3260 +MOZ_ARG_DISABLE_BOOL(exact-rooting,
  1.3261 +[  --enable-exact-rooting   Enable use of conservative stack scanning for GC],
  1.3262 +    JSGC_USE_EXACT_ROOTING=1 ,
  1.3263 +    JSGC_USE_EXACT_ROOTING= )
  1.3264 +if test -n "$JSGC_USE_EXACT_ROOTING"; then
  1.3265 +    AC_DEFINE(JSGC_USE_EXACT_ROOTING)
  1.3266 +fi
  1.3267 +
  1.3268 +dnl ========================================================
  1.3269 +dnl = Use Valgrind
  1.3270 +dnl ========================================================
  1.3271 +MOZ_ARG_ENABLE_BOOL(valgrind,
  1.3272 +[  --enable-valgrind       Enable Valgrind integration hooks (default=no)],
  1.3273 +    MOZ_VALGRIND=1,
  1.3274 +    MOZ_VALGRIND= )
  1.3275 +if test -n "$MOZ_VALGRIND"; then
  1.3276 +    MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
  1.3277 +        AC_MSG_ERROR(
  1.3278 +            [--enable-valgrind specified but Valgrind is not installed]))
  1.3279 +    AC_DEFINE(MOZ_VALGRIND)
  1.3280 +    MOZ_VALGRIND=1
  1.3281 +fi
  1.3282 +AC_SUBST(MOZ_VALGRIND)
  1.3283 +
  1.3284 +dnl ========================================================
  1.3285 +dnl = Use ARM JIT code simulator. Requires an x86 build.
  1.3286 +dnl ========================================================
  1.3287 +dnl Also define JS_CODEGEN_ARM in this case. If the simulator is not used,
  1.3288 +dnl JS_CODEGEN_foo is defined if JS_CPU_foo is defined.
  1.3289 +MOZ_ARG_ENABLE_BOOL(arm-simulator,
  1.3290 +[  --enable-arm-simulator Enable ARM simulator for JIT code],
  1.3291 +    JS_ARM_SIMULATOR=1,
  1.3292 +    JS_ARM_SIMULATOR= )
  1.3293 +if test -n "$JS_ARM_SIMULATOR"; then
  1.3294 +    if test "$CPU_ARCH" != "x86"; then
  1.3295 +        AC_MSG_ERROR([The ARM simulator only works on x86.])
  1.3296 +    fi
  1.3297 +    AC_DEFINE(JS_ARM_SIMULATOR)
  1.3298 +    AC_DEFINE(JS_CODEGEN_ARM)
  1.3299 +    JS_CODEGEN_ARM=1
  1.3300 +elif test "$CPU_ARCH" = "x86"; then
  1.3301 +    AC_DEFINE(JS_CODEGEN_X86)
  1.3302 +    JS_CODEGEN_X86=1
  1.3303 +elif test "$CPU_ARCH" = "x86_64"; then
  1.3304 +    AC_DEFINE(JS_CODEGEN_X64)
  1.3305 +    JS_CODEGEN_X64=1
  1.3306 +elif test "$CPU_ARCH" = "arm"; then
  1.3307 +    AC_DEFINE(JS_CODEGEN_ARM)
  1.3308 +    JS_CODEGEN_ARM=1
  1.3309 +fi
  1.3310 +
  1.3311 +AC_SUBST(JS_ARM_SIMULATOR)
  1.3312 +AC_SUBST(JS_CODEGEN_ARM)
  1.3313 +AC_SUBST(JS_CODEGEN_X86)
  1.3314 +AC_SUBST(JS_CODEGEN_X64)
  1.3315 +
  1.3316 +dnl ========================================================
  1.3317 +dnl jprof
  1.3318 +dnl ========================================================
  1.3319 +MOZ_ARG_ENABLE_BOOL(jprof,
  1.3320 +[  --enable-jprof          Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
  1.3321 +    MOZ_JPROF=1,
  1.3322 +    MOZ_JPROF= )
  1.3323 +if test -n "$MOZ_JPROF"; then
  1.3324 +    MOZ_PROFILING=1
  1.3325 +    AC_DEFINE(MOZ_JPROF)
  1.3326 +fi
  1.3327 +
  1.3328 +dnl ========================================================
  1.3329 +dnl shark
  1.3330 +dnl ========================================================
  1.3331 +MOZ_ARG_ENABLE_BOOL(shark,
  1.3332 +[  --enable-shark          Enable shark remote profiling. Implies --enable-profiling.],
  1.3333 +    MOZ_SHARK=1,
  1.3334 +    MOZ_SHARK= )
  1.3335 +if test -n "$MOZ_SHARK"; then
  1.3336 +    MOZ_PROFILING=1
  1.3337 +    AC_DEFINE(MOZ_SHARK)
  1.3338 +fi
  1.3339 +
  1.3340 +dnl ========================================================
  1.3341 +dnl instruments
  1.3342 +dnl ========================================================
  1.3343 +MOZ_ARG_ENABLE_BOOL(instruments,
  1.3344 +[  --enable-instruments    Enable instruments remote profiling. Implies --enable-profiling.],
  1.3345 +    MOZ_INSTRUMENTS=1,
  1.3346 +    MOZ_INSTRUMENTS= )
  1.3347 +if test -n "$MOZ_INSTRUMENTS"; then
  1.3348 +    MOZ_PROFILING=1
  1.3349 +    AC_DEFINE(MOZ_INSTRUMENTS)
  1.3350 +    LIBS="$LIBS -framework CoreFoundation"
  1.3351 +fi
  1.3352 +
  1.3353 +dnl ========================================================
  1.3354 +dnl callgrind
  1.3355 +dnl ========================================================
  1.3356 +MOZ_ARG_ENABLE_BOOL(callgrind,
  1.3357 +[  --enable-callgrind      Enable callgrind profiling. Implies --enable-profiling.],
  1.3358 +    MOZ_CALLGRIND=1,
  1.3359 +    MOZ_CALLGRIND= )
  1.3360 +if test -n "$MOZ_CALLGRIND"; then
  1.3361 +    MOZ_PROFILING=1
  1.3362 +    AC_DEFINE(MOZ_CALLGRIND)
  1.3363 +fi
  1.3364 +
  1.3365 +dnl ========================================================
  1.3366 +dnl vtune
  1.3367 +dnl ========================================================
  1.3368 +MOZ_ARG_ENABLE_BOOL(vtune,
  1.3369 +[  --enable-vtune          Enable vtune profiling. Implies --enable-profiling.],
  1.3370 +    MOZ_VTUNE=1,
  1.3371 +    MOZ_VTUNE= )
  1.3372 +
  1.3373 +dnl ========================================================
  1.3374 +dnl Debug (see Bug 939505)
  1.3375 +dnl ========================================================
  1.3376 +if test -n "$MOZ_DEBUG"; then
  1.3377 +    AC_DEFINE(JS_DEBUG)
  1.3378 +fi
  1.3379 +
  1.3380 +dnl ========================================================
  1.3381 +dnl Profiling
  1.3382 +dnl ========================================================
  1.3383 +if test -n "$MOZ_PROFILING"; then
  1.3384 +    AC_DEFINE(MOZ_PROFILING)
  1.3385 +
  1.3386 +    case "$OS_TARGET" in
  1.3387 +        Linux) MOZ_VTUNE=1 ;;
  1.3388 +        WINNT) MOZ_VTUNE=1 ;;
  1.3389 +    esac
  1.3390 +fi
  1.3391 +
  1.3392 +if test -n "$MOZ_VTUNE"; then
  1.3393 +    AC_DEFINE(MOZ_VTUNE)
  1.3394 +fi
  1.3395 +
  1.3396 +dnl ========================================================
  1.3397 +dnl Zealous JavaScript GC
  1.3398 +dnl ========================================================
  1.3399 +MOZ_ARG_ENABLE_BOOL(gczeal,
  1.3400 +[  --enable-gczeal         Enable zealous GCing],
  1.3401 +    JS_GC_ZEAL=1,
  1.3402 +    JS_GC_ZEAL= )
  1.3403 +if test -n "$JS_GC_ZEAL" -o -n "$MOZ_DEBUG"; then
  1.3404 +    AC_DEFINE(JS_GC_ZEAL)
  1.3405 +fi
  1.3406 +
  1.3407 +dnl ========================================================
  1.3408 +dnl = Enable perf logging for ion.
  1.3409 +dnl = Perf logging is OFF by default
  1.3410 +dnl ========================================================
  1.3411 +MOZ_ARG_ENABLE_BOOL(perf,
  1.3412 +[  --enable-perf           Enable Linux perf integration],
  1.3413 +  JS_ION_PERF=1,
  1.3414 +  JS_ION_PERF= )
  1.3415 +if test -n "$JS_ION_PERF"; then
  1.3416 +    AC_DEFINE(JS_ION_PERF)
  1.3417 +fi
  1.3418 +
  1.3419 +dnl ========================================================
  1.3420 +dnl JS opt-mode assertions and minidump instrumentation
  1.3421 +dnl ========================================================
  1.3422 +MOZ_ARG_ENABLE_BOOL(js-diagnostics,
  1.3423 +[  --enable-js-diagnostics
  1.3424 +                          Enable JS diagnostic assertions and breakpad data],
  1.3425 +    JS_CRASH_DIAGNOSTICS=1,
  1.3426 +    JS_CRASH_DIAGNOSTICS= )
  1.3427 +if test -n "$JS_CRASH_DIAGNOSTICS"; then
  1.3428 +    AC_DEFINE(JS_CRASH_DIAGNOSTICS)
  1.3429 +fi
  1.3430 +
  1.3431 +dnl ========================================================
  1.3432 +dnl Enable changes that make the shell more deterministic
  1.3433 +dnl ========================================================
  1.3434 +MOZ_ARG_ENABLE_BOOL(more-deterministic,
  1.3435 +[  --enable-more-deterministic
  1.3436 +                          Enable changes that make the shell more deterministic],
  1.3437 +    JS_MORE_DETERMINISTIC=1,
  1.3438 +    JS_MORE_DETERMINISTIC= )
  1.3439 +if test -n "$JS_MORE_DETERMINISTIC"; then
  1.3440 +    AC_DEFINE(JS_MORE_DETERMINISTIC)
  1.3441 +fi
  1.3442 +
  1.3443 +dnl ========================================================
  1.3444 +dnl Enable breakpoint for artificial OOMs
  1.3445 +dnl ========================================================
  1.3446 +MOZ_ARG_ENABLE_BOOL(oom-breakpoint,
  1.3447 +[  --enable-oom-breakpoint
  1.3448 +                          Enable a breakpoint function for artificial OOMs],
  1.3449 +    JS_OOM_BREAKPOINT=1,
  1.3450 +    JS_OOM_BREAKPOINT= )
  1.3451 +if test -n "$JS_OOM_BREAKPOINT"; then
  1.3452 +    AC_DEFINE(JS_OOM_BREAKPOINT)
  1.3453 +fi
  1.3454 +
  1.3455 +MOZ_CHECK_CCACHE
  1.3456 +
  1.3457 +dnl ========================================================
  1.3458 +dnl = Enable static checking using gcc-dehydra
  1.3459 +dnl ========================================================
  1.3460 +
  1.3461 +MOZ_ARG_WITH_STRING(static-checking,
  1.3462 +[  --with-static-checking=path/to/gcc_dehydra.so
  1.3463 +                          Enable static checking of code using GCC-dehydra],
  1.3464 +    DEHYDRA_PATH=$withval,
  1.3465 +    DEHYDRA_PATH= )
  1.3466 +
  1.3467 +if test -n "$DEHYDRA_PATH"; then
  1.3468 +    if test ! -f "$DEHYDRA_PATH"; then
  1.3469 +        AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
  1.3470 +    fi
  1.3471 +    AC_DEFINE(NS_STATIC_CHECKING)
  1.3472 +fi
  1.3473 +AC_SUBST(DEHYDRA_PATH)
  1.3474 +
  1.3475 +dnl ========================================================
  1.3476 +dnl = Enable using the clang plugin to build
  1.3477 +dnl ========================================================
  1.3478 +
  1.3479 +MOZ_ARG_ENABLE_BOOL(clang-plugin,
  1.3480 +[  --enable-clang-plugin   Enable building with the mozilla clang plugin ],
  1.3481 +   ENABLE_CLANG_PLUGIN=1,
  1.3482 +   ENABLE_CLANG_PLUGIN= )
  1.3483 +if test -n "$ENABLE_CLANG_PLUGIN"; then
  1.3484 +    if test -z "$CLANG_CC"; then
  1.3485 +        AC_MSG_ERROR([Can't use clang plugin without clang.])
  1.3486 +    fi
  1.3487 +    AC_DEFINE(MOZ_CLANG_PLUGIN)
  1.3488 +fi
  1.3489 +
  1.3490 +AC_SUBST(ENABLE_CLANG_PLUGIN)
  1.3491 +
  1.3492 +dnl ========================================================
  1.3493 +dnl = Enable static checking using sixgill
  1.3494 +dnl ========================================================
  1.3495 +
  1.3496 +MOZ_ARG_WITH_STRING(sixgill,
  1.3497 +[  --with-sixgill=path/to/sixgill
  1.3498 +                          Enable static checking of code using sixgill],
  1.3499 +    SIXGILL_PATH=$withval,
  1.3500 +    SIXGILL_PATH= )
  1.3501 +
  1.3502 +if test -n "$SIXGILL_PATH"; then
  1.3503 +    if test ! -x "$SIXGILL_PATH/bin/xdbfind" || test ! -f "$SIXGILL_PATH/gcc/xgill.so" || test ! -x "$SIXGILL_PATH/scripts/wrap_gcc/g++"; then
  1.3504 +        AC_MSG_ERROR([The sixgill plugin and binaries are not at the specified path.])
  1.3505 +    fi
  1.3506 +fi
  1.3507 +AC_SUBST(SIXGILL_PATH)
  1.3508 +
  1.3509 +dnl ========================================================
  1.3510 +dnl = Enable stripping of libs & executables
  1.3511 +dnl ========================================================
  1.3512 +MOZ_ARG_ENABLE_BOOL(strip,
  1.3513 +[  --enable-strip          Enable stripping of libs & executables ],
  1.3514 +    ENABLE_STRIP=1,
  1.3515 +    ENABLE_STRIP= )
  1.3516 +
  1.3517 +dnl ========================================================
  1.3518 +dnl = Enable stripping of libs & executables when packaging
  1.3519 +dnl ========================================================
  1.3520 +MOZ_ARG_ENABLE_BOOL(install-strip,
  1.3521 +[  --enable-install-strip  Enable stripping of libs & executables when packaging ],
  1.3522 +    PKG_SKIP_STRIP= ,
  1.3523 +    PKG_SKIP_STRIP=1)
  1.3524 +
  1.3525 +dnl ========================================================
  1.3526 +dnl =
  1.3527 +dnl = Profiling and Instrumenting
  1.3528 +dnl =
  1.3529 +dnl ========================================================
  1.3530 +MOZ_ARG_HEADER(Profiling and Instrumenting)
  1.3531 +
  1.3532 +dnl ========================================================
  1.3533 +dnl = Support for demangling undefined symbols
  1.3534 +dnl ========================================================
  1.3535 +if test -z "$SKIP_LIBRARY_CHECKS"; then
  1.3536 +    AC_LANG_SAVE
  1.3537 +    AC_LANG_CPLUSPLUS
  1.3538 +    AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
  1.3539 +    AC_LANG_RESTORE
  1.3540 +fi
  1.3541 +
  1.3542 +# Demangle only for debug or trace-malloc or DMD builds
  1.3543 +MOZ_DEMANGLE_SYMBOLS=
  1.3544 +if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
  1.3545 +    MOZ_DEMANGLE_SYMBOLS=1
  1.3546 +    AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
  1.3547 +fi
  1.3548 +AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
  1.3549 +
  1.3550 +dnl ========================================================
  1.3551 +dnl JIT observers
  1.3552 +dnl ========================================================
  1.3553 +
  1.3554 +MOZ_ARG_WITH_STRING(jitreport-granularity,
  1.3555 +[  --jitreport-granularity=N
  1.3556 +                           Default granularity at which to report JIT code
  1.3557 +                           to external tools
  1.3558 +                             0 - no info
  1.3559 +                             1 - code ranges for whole functions only
  1.3560 +                             2 - per-line information
  1.3561 +                             3 - per-op information],
  1.3562 +  JITREPORT_GRANULARITY=$withval,
  1.3563 +  JITREPORT_GRANULARITY=3)
  1.3564 +
  1.3565 +AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
  1.3566 +
  1.3567 +dnl ========================================================
  1.3568 +dnl =
  1.3569 +dnl = Misc. Options
  1.3570 +dnl =
  1.3571 +dnl ========================================================
  1.3572 +MOZ_ARG_HEADER(Misc. Options)
  1.3573 +
  1.3574 +dnl ========================================================
  1.3575 +dnl update xterm title
  1.3576 +dnl ========================================================
  1.3577 +MOZ_ARG_ENABLE_BOOL(xterm-updates,
  1.3578 +[  --enable-xterm-updates  Update XTERM titles with current command.],
  1.3579 +    MOZ_UPDATE_XTERM=1,
  1.3580 +    MOZ_UPDATE_XTERM= )
  1.3581 +
  1.3582 +if test -z "$SKIP_COMPILER_CHECKS"; then
  1.3583 +dnl ========================================================
  1.3584 +dnl =
  1.3585 +dnl = Compiler Options
  1.3586 +dnl =
  1.3587 +dnl ========================================================
  1.3588 +MOZ_ARG_HEADER(Compiler Options)
  1.3589 +
  1.3590 +dnl ========================================================
  1.3591 +dnl Check for gcc -pipe support
  1.3592 +dnl ========================================================
  1.3593 +AC_MSG_CHECKING([for -pipe support])
  1.3594 +if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
  1.3595 +    dnl Any gcc that supports firefox supports -pipe.
  1.3596 +    CFLAGS="$CFLAGS -pipe"
  1.3597 +    CXXFLAGS="$CXXFLAGS -pipe"
  1.3598 +    AC_MSG_RESULT([yes])
  1.3599 +else
  1.3600 +    AC_MSG_RESULT([no])
  1.3601 +fi
  1.3602 +
  1.3603 +dnl ========================================================
  1.3604 +dnl Profile guided optimization (gcc checks)
  1.3605 +dnl ========================================================
  1.3606 +dnl Test for profiling options
  1.3607 +dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
  1.3608 +
  1.3609 +_SAVE_CFLAGS="$CFLAGS"
  1.3610 +CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
  1.3611 +
  1.3612 +AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
  1.3613 +AC_TRY_COMPILE([], [return 0;],
  1.3614 +               [ PROFILE_GEN_CFLAGS="-fprofile-generate"
  1.3615 +                 result="yes" ], result="no")
  1.3616 +AC_MSG_RESULT([$result])
  1.3617 +
  1.3618 +if test $result = "yes"; then
  1.3619 +  PROFILE_GEN_LDFLAGS="-fprofile-generate"
  1.3620 +  PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
  1.3621 +  PROFILE_USE_LDFLAGS="-fprofile-use"
  1.3622 +fi
  1.3623 +
  1.3624 +CFLAGS="$_SAVE_CFLAGS"
  1.3625 +
  1.3626 +if test -n "$INTEL_CC"; then
  1.3627 +  PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
  1.3628 +  PROFILE_GEN_LDFLAGS=
  1.3629 +  PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
  1.3630 +  PROFILE_USE_LDFLAGS=
  1.3631 +fi
  1.3632 +
  1.3633 +dnl Sun Studio on Solaris
  1.3634 +if test "$SOLARIS_SUNPRO_CC"; then
  1.3635 +  PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
  1.3636 +  PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
  1.3637 +  PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
  1.3638 +  PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
  1.3639 +fi
  1.3640 +
  1.3641 +AC_SUBST(PROFILE_GEN_CFLAGS)
  1.3642 +AC_SUBST(PROFILE_GEN_LDFLAGS)
  1.3643 +AC_SUBST(PROFILE_USE_CFLAGS)
  1.3644 +AC_SUBST(PROFILE_USE_LDFLAGS)
  1.3645 +
  1.3646 +AC_LANG_CPLUSPLUS
  1.3647 +
  1.3648 +dnl ========================================================
  1.3649 +dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
  1.3650 +dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
  1.3651 +dnl raw pointers in nsCOMPtr.h.  (VC++ has the same bug.)
  1.3652 +dnl ========================================================
  1.3653 +_SAVE_CXXFLAGS=$CXXFLAGS
  1.3654 +CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
  1.3655 +AC_CACHE_CHECK(for correct overload resolution with const and templates,
  1.3656 +    ac_nscap_nonconst_opeq_bug,
  1.3657 +    [AC_TRY_COMPILE([
  1.3658 +                      template <class T>
  1.3659 +                      class Pointer
  1.3660 +                        {
  1.3661 +                        public:
  1.3662 +                          T* myPtr;
  1.3663 +                        };
  1.3664 +
  1.3665 +                      template <class T, class U>
  1.3666 +                      int operator==(const Pointer<T>& rhs, U* lhs)
  1.3667 +                        {
  1.3668 +                          return rhs.myPtr == lhs;
  1.3669 +                        }
  1.3670 +
  1.3671 +                      template <class T, class U>
  1.3672 +                      int operator==(const Pointer<T>& rhs, const U* lhs)
  1.3673 +                        {
  1.3674 +                          return rhs.myPtr == lhs;
  1.3675 +                        }
  1.3676 +                    ],
  1.3677 +                    [
  1.3678 +                      Pointer<int> foo;
  1.3679 +                      const int* bar;
  1.3680 +                      return foo == bar;
  1.3681 +                    ],
  1.3682 +                    ac_nscap_nonconst_opeq_bug="no",
  1.3683 +                    ac_nscap_nonconst_opeq_bug="yes")])
  1.3684 +CXXFLAGS="$_SAVE_CXXFLAGS"
  1.3685 +
  1.3686 +if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
  1.3687 +    AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
  1.3688 +fi
  1.3689 +
  1.3690 +dnl ========================================================
  1.3691 +dnl Check for tm_zone, tm_gmtoff in struct tm
  1.3692 +dnl ========================================================
  1.3693 +AC_CACHE_CHECK(for tm_zone tm_gmtoff in struct tm,
  1.3694 +    ac_cv_struct_tm_zone_tm_gmtoff,
  1.3695 +    [AC_TRY_COMPILE([#include <time.h>],
  1.3696 +                    [struct tm tm; tm.tm_zone = 0; tm.tm_gmtoff = 1;],
  1.3697 +                    [ac_cv_struct_tm_zone_tm_gmtoff="yes"],
  1.3698 +                    [ac_cv_struct_tm_zone_tm_gmtoff="no"])])
  1.3699 +if test "$ac_cv_struct_tm_zone_tm_gmtoff" = "yes" ; then
  1.3700 +    AC_DEFINE(HAVE_TM_ZONE_TM_GMTOFF)
  1.3701 +fi
  1.3702 +fi # ! SKIP_COMPILER_CHECKS
  1.3703 +
  1.3704 +AC_DEFINE(CPP_THROW_NEW, [throw()])
  1.3705 +AC_LANG_C
  1.3706 +
  1.3707 +MOZ_EXPAND_LIBS
  1.3708 +
  1.3709 +dnl ========================================================
  1.3710 +dnl =
  1.3711 +dnl = Build depencency options
  1.3712 +dnl =
  1.3713 +dnl ========================================================
  1.3714 +MOZ_ARG_HEADER(Build dependencies)
  1.3715 +
  1.3716 +if test "$GNU_CC" -a "$GNU_CXX"; then
  1.3717 +  _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
  1.3718 +dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
  1.3719 +elif test "$SOLARIS_SUNPRO_CC"; then
  1.3720 +  _DEPEND_CFLAGS=
  1.3721 +else
  1.3722 +  dnl Don't override this for MSVC
  1.3723 +  if test -z "$_WIN32_MSVC"; then
  1.3724 +    _USE_CPP_INCLUDE_FLAG=
  1.3725 +    _DEFINES_CFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
  1.3726 +    _DEFINES_CXXFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
  1.3727 +  else
  1.3728 +    echo '#include <stdio.h>' > dummy-hello.c
  1.3729 +    changequote(,)
  1.3730 +    dnl This output is localized, split at the first double space or colon and space.
  1.3731 +    _CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*stdio.h\)$"
  1.3732 +    CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'`
  1.3733 +    _CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'`
  1.3734 +    changequote([,])
  1.3735 +    if ! test -e "$_CL_STDIO_PATH"; then
  1.3736 +        AC_MSG_ERROR([Unable to parse cl -showIncludes prefix. This compiler's locale has an unsupported formatting.])
  1.3737 +    fi
  1.3738 +    if test -z "$CL_INCLUDES_PREFIX"; then
  1.3739 +        AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
  1.3740 +    fi
  1.3741 +    AC_SUBST(CL_INCLUDES_PREFIX)
  1.3742 +    rm -f dummy-hello.c
  1.3743 +
  1.3744 +    dnl Make sure that the build system can handle non-ASCII characters
  1.3745 +    dnl in environment variables to prevent it from breaking silently on
  1.3746 +    dnl non-English systems.
  1.3747 +    NONASCII=$'\241\241'
  1.3748 +    AC_SUBST(NONASCII)
  1.3749 +  fi
  1.3750 +fi
  1.3751 +
  1.3752 +dnl ========================================================
  1.3753 +dnl = Disable -fstrict-aliasing with GCC 4.4 and earlier.
  1.3754 +dnl = See bugs 821502 and 832623.
  1.3755 +dnl ========================================================
  1.3756 +if test -n "$GNU_CC" -a -z "$CLANG_CC"; then
  1.3757 +    dnl GCC 3.x isn't supported, so we don't need to check for that.
  1.3758 +    if test "$GCC_MAJOR_VERSION" -eq "4" -a "$GCC_MINOR_VERSION" -lt "5" ; then
  1.3759 +        CFLAGS="$CFLAGS -fno-strict-aliasing"
  1.3760 +        CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
  1.3761 +    fi
  1.3762 +fi
  1.3763 +
  1.3764 +dnl ========================================================
  1.3765 +dnl = Link js shell to system readline
  1.3766 +dnl ========================================================
  1.3767 +MOZ_ARG_ENABLE_BOOL(readline,
  1.3768 +[  --enable-readline       Link js shell to system readline library],
  1.3769 +    JS_WANT_READLINE=1,
  1.3770 +    JS_WANT_READLINE= )
  1.3771 +
  1.3772 +JS_NATIVE_EDITLINE=
  1.3773 +EDITLINE_LIBS=
  1.3774 +JS_DISABLE_SHELL=
  1.3775 +
  1.3776 +case "$target" in
  1.3777 +*-mingw*)
  1.3778 +    NO_EDITLINE=1
  1.3779 +    ;;
  1.3780 +*)
  1.3781 +    ;;
  1.3782 +esac
  1.3783 +
  1.3784 +if test -z "$SKIP_LIBRARY_CHECKS" -a -z "$NO_EDITLINE"; then
  1.3785 +  if test -n "$JS_WANT_READLINE"; then
  1.3786 +    AC_CHECK_LIB(readline, readline,
  1.3787 +                 EDITLINE_LIBS="-lreadline",
  1.3788 +                 AC_MSG_ERROR([No system readline library found.]))
  1.3789 +  else
  1.3790 +    dnl By default, we use editline
  1.3791 +    JS_NATIVE_EDITLINE=1
  1.3792 +    EDITLINE_LIBS='$(DEPTH)/js/src/editline/$(LIB_PREFIX)editline.$(LIB_SUFFIX)'
  1.3793 +  fi
  1.3794 +
  1.3795 +  dnl Either way, we want to build with line editing support.
  1.3796 +  AC_DEFINE(EDITLINE)
  1.3797 +fi
  1.3798 +AC_SUBST(JS_NATIVE_EDITLINE)
  1.3799 +AC_SUBST(JS_DISABLE_SHELL)
  1.3800 +AC_SUBST(EDITLINE_LIBS)
  1.3801 +
  1.3802 +dnl ========================================================
  1.3803 +dnl =
  1.3804 +dnl = Standalone module options
  1.3805 +dnl =
  1.3806 +dnl ========================================================
  1.3807 +MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
  1.3808 +
  1.3809 +dnl ========================================================
  1.3810 +dnl = Build jsctypes if it's enabled
  1.3811 +dnl ========================================================
  1.3812 +MOZ_ARG_ENABLE_BOOL(ctypes,
  1.3813 +[  --enable-ctypes         Enable js-ctypes (default=no)],
  1.3814 +    BUILD_CTYPES=1,
  1.3815 +    BUILD_CTYPES= )
  1.3816 +JS_HAS_CTYPES=$BUILD_CTYPES
  1.3817 +AC_SUBST(JS_HAS_CTYPES)
  1.3818 +AC_SUBST(BUILD_CTYPES)
  1.3819 +if test "$JS_HAS_CTYPES"; then
  1.3820 +  dnl Error out if we're on MSVC and MASM is unavailable.
  1.3821 +  if test -n "$_MSC_VER" -a \( "$AS" != "ml.exe" -a "$AS" != "ml64.exe" \); then
  1.3822 +    AC_MSG_ERROR([\"$AS\" is not a suitable assembler to build js-ctypes. If you are building with MS Visual Studio 8 Express, you may download the MASM 8.0 package, upgrade to Visual Studio 9 Express, or install the Vista SDK. Or do not use --enable-ctypes.])
  1.3823 +  fi
  1.3824 +  AC_DEFINE(JS_HAS_CTYPES)
  1.3825 +fi
  1.3826 +
  1.3827 +if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
  1.3828 +    MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
  1.3829 +fi
  1.3830 +
  1.3831 +dnl ========================================================
  1.3832 +dnl =
  1.3833 +dnl = Options for generating the shell as a script
  1.3834 +dnl =
  1.3835 +dnl ========================================================
  1.3836 +
  1.3837 +MOZ_ARG_WITH_STRING(qemu-exe,
  1.3838 +[  --with-qemu-exe=path   Use path as an arm emulator on host platforms],
  1.3839 +    QEMU_EXE=$withval)
  1.3840 +AC_SUBST(QEMU_EXE)
  1.3841 +MOZ_ARG_WITH_STRING(cross-lib,
  1.3842 +[  --with-cross-lib=dir   Use dir as the location for arm libraries],
  1.3843 +    CROSS_LIB=$withval,
  1.3844 +    CROSS_LIB=/usr/$target)
  1.3845 +AC_SUBST(CROSS_LIB)
  1.3846 +dnl ========================================================
  1.3847 +dnl =
  1.3848 +dnl = Maintainer debug option (no --enable equivalent)
  1.3849 +dnl =
  1.3850 +dnl ========================================================
  1.3851 +
  1.3852 +AC_SUBST(AR)
  1.3853 +AC_SUBST(AR_FLAGS)
  1.3854 +AC_SUBST(AR_LIST)
  1.3855 +AC_SUBST(AR_EXTRACT)
  1.3856 +AC_SUBST(AR_DELETE)
  1.3857 +AC_SUBST(AS)
  1.3858 +AC_SUBST(ASFLAGS)
  1.3859 +AC_SUBST(AS_DASH_C_FLAG)
  1.3860 +AC_SUBST(LD)
  1.3861 +AC_SUBST(RC)
  1.3862 +AC_SUBST(RCFLAGS)
  1.3863 +AC_SUBST(MC)
  1.3864 +AC_SUBST(WINDRES)
  1.3865 +AC_SUBST(IMPLIB)
  1.3866 +AC_SUBST(FILTER)
  1.3867 +AC_SUBST(BIN_FLAGS)
  1.3868 +AC_SUBST(MOZ_DEBUG)
  1.3869 +AC_SUBST(MOZ_DEBUG_SYMBOLS)
  1.3870 +AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
  1.3871 +AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
  1.3872 +AC_SUBST(MOZ_DEBUG_LDFLAGS)
  1.3873 +AC_SUBST(WARNINGS_AS_ERRORS)
  1.3874 +AC_SUBST(MOZ_JPROF)
  1.3875 +AC_SUBST(MOZ_SHARK)
  1.3876 +AC_SUBST(MOZ_INSTRUMENTS)
  1.3877 +AC_SUBST(MOZ_CALLGRIND)
  1.3878 +AC_SUBST(MOZ_VTUNE)
  1.3879 +AC_SUBST(MOZ_PROFILING)
  1.3880 +AC_SUBST(LIBICONV)
  1.3881 +
  1.3882 +AC_SUBST(ENABLE_TESTS)
  1.3883 +
  1.3884 +AC_SUBST(ENABLE_STRIP)
  1.3885 +AC_SUBST(PKG_SKIP_STRIP)
  1.3886 +AC_SUBST(INCREMENTAL_LINKER)
  1.3887 +AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
  1.3888 +AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
  1.3889 +
  1.3890 +AC_SUBST(MOZ_FIX_LINK_PATHS)
  1.3891 +
  1.3892 +AC_SUBST(USE_DEPENDENT_LIBS)
  1.3893 +
  1.3894 +AC_SUBST(MOZ_BUILD_ROOT)
  1.3895 +
  1.3896 +AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
  1.3897 +AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
  1.3898 +
  1.3899 +AC_SUBST(MOZ_APP_NAME)
  1.3900 +AC_SUBST(MOZ_APP_DISPLAYNAME)
  1.3901 +AC_SUBST(MOZ_APP_VERSION)
  1.3902 +
  1.3903 +AC_SUBST(MOZ_PKG_SPECIAL)
  1.3904 +
  1.3905 +AC_SUBST(MOZILLA_OFFICIAL)
  1.3906 +
  1.3907 +dnl win32 options
  1.3908 +AC_SUBST(MOZ_BROWSE_INFO)
  1.3909 +AC_SUBST(MOZ_TOOLS_DIR)
  1.3910 +
  1.3911 +dnl Echo the CFLAGS to remove extra whitespace.
  1.3912 +CFLAGS=`echo \
  1.3913 +	$_WARNINGS_CFLAGS \
  1.3914 +	$CFLAGS`
  1.3915 +
  1.3916 +CXXFLAGS=`echo \
  1.3917 +	$_WARNINGS_CXXFLAGS \
  1.3918 +	$CXXFLAGS`
  1.3919 +
  1.3920 +COMPILE_CFLAGS=`echo \
  1.3921 +    $_DEFINES_CFLAGS \
  1.3922 +	$_DEPEND_CFLAGS \
  1.3923 +    $COMPILE_CFLAGS`
  1.3924 +
  1.3925 +COMPILE_CXXFLAGS=`echo \
  1.3926 +    $_DEFINES_CXXFLAGS \
  1.3927 +	$_DEPEND_CFLAGS \
  1.3928 +    $COMPILE_CXXFLAGS`
  1.3929 +
  1.3930 +HOST_CFLAGS=`echo \
  1.3931 +    $HOST_CFLAGS \
  1.3932 +    $_DEPEND_CFLAGS`
  1.3933 +
  1.3934 +HOST_CXXFLAGS=`echo \
  1.3935 +    $HOST_CXXFLAGS \
  1.3936 +    $_DEPEND_CFLAGS`
  1.3937 +
  1.3938 +AC_SUBST(NSPR_CFLAGS)
  1.3939 +AC_SUBST(NSPR_LIBS)
  1.3940 +AC_SUBST(MOZ_NATIVE_NSPR)
  1.3941 +
  1.3942 +if test -n "$MOZ_NUWA_PROCESS"; then
  1.3943 +    AC_DEFINE(MOZ_NUWA_PROCESS)
  1.3944 +fi
  1.3945 +
  1.3946 +OS_CFLAGS="$CFLAGS"
  1.3947 +OS_CXXFLAGS="$CXXFLAGS"
  1.3948 +OS_CPPFLAGS="$CPPFLAGS"
  1.3949 +OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
  1.3950 +OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
  1.3951 +OS_LDFLAGS="$LDFLAGS"
  1.3952 +OS_LIBS="$LIBS"
  1.3953 +AC_SUBST(OS_CFLAGS)
  1.3954 +AC_SUBST(OS_CXXFLAGS)
  1.3955 +AC_SUBST(OS_CPPFLAGS)
  1.3956 +AC_SUBST(OS_COMPILE_CFLAGS)
  1.3957 +AC_SUBST(OS_COMPILE_CXXFLAGS)
  1.3958 +AC_SUBST(OS_LDFLAGS)
  1.3959 +AC_SUBST(OS_LIBS)
  1.3960 +AC_SUBST(CROSS_COMPILE)
  1.3961 +AC_SUBST(MOZ_METRO)
  1.3962 +
  1.3963 +AC_SUBST(HOST_CC)
  1.3964 +AC_SUBST(HOST_CXX)
  1.3965 +AC_SUBST(HOST_CFLAGS)
  1.3966 +AC_SUBST(HOST_CXXFLAGS)
  1.3967 +AC_SUBST(HOST_LDFLAGS)
  1.3968 +AC_SUBST(HOST_OPTIMIZE_FLAGS)
  1.3969 +AC_SUBST(HOST_AR)
  1.3970 +AC_SUBST(HOST_AR_FLAGS)
  1.3971 +AC_SUBST(HOST_LD)
  1.3972 +AC_SUBST(HOST_RANLIB)
  1.3973 +AC_SUBST(HOST_NSPR_MDCPUCFG)
  1.3974 +AC_SUBST(HOST_BIN_SUFFIX)
  1.3975 +AC_SUBST(HOST_OS_ARCH)
  1.3976 +
  1.3977 +AC_SUBST(TARGET_CPU)
  1.3978 +AC_SUBST(TARGET_VENDOR)
  1.3979 +AC_SUBST(TARGET_OS)
  1.3980 +AC_SUBST(TARGET_NSPR_MDCPUCFG)
  1.3981 +AC_SUBST(TARGET_MD_ARCH)
  1.3982 +AC_SUBST(TARGET_XPCOM_ABI)
  1.3983 +AC_SUBST(OS_TARGET)
  1.3984 +AC_SUBST(OS_ARCH)
  1.3985 +AC_SUBST(OS_RELEASE)
  1.3986 +AC_SUBST(OS_TEST)
  1.3987 +AC_SUBST(CPU_ARCH)
  1.3988 +AC_SUBST(INTEL_ARCHITECTURE)
  1.3989 +
  1.3990 +AC_SUBST(WRAP_LDFLAGS)
  1.3991 +AC_SUBST(MKSHLIB)
  1.3992 +AC_SUBST(MKCSHLIB)
  1.3993 +AC_SUBST(MKSHLIB_FORCE_ALL)
  1.3994 +AC_SUBST(MKSHLIB_UNFORCE_ALL)
  1.3995 +AC_SUBST(DSO_CFLAGS)
  1.3996 +AC_SUBST(DSO_PIC_CFLAGS)
  1.3997 +AC_SUBST(DSO_LDOPTS)
  1.3998 +AC_SUBST(LIB_PREFIX)
  1.3999 +AC_SUBST(DLL_PREFIX)
  1.4000 +AC_SUBST(DLL_SUFFIX)
  1.4001 +AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
  1.4002 +AC_SUBST(LIB_SUFFIX)
  1.4003 +AC_SUBST(OBJ_SUFFIX)
  1.4004 +AC_SUBST(BIN_SUFFIX)
  1.4005 +AC_SUBST(ASM_SUFFIX)
  1.4006 +AC_SUBST(IMPORT_LIB_SUFFIX)
  1.4007 +AC_SUBST(USE_N32)
  1.4008 +AC_SUBST(CC_VERSION)
  1.4009 +AC_SUBST(CXX_VERSION)
  1.4010 +AC_SUBST(MSMANIFEST_TOOL)
  1.4011 +AC_SUBST(MOZ_LINKER)
  1.4012 +
  1.4013 +AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
  1.4014 +
  1.4015 +dnl Check for missing components
  1.4016 +if test "$COMPILE_ENVIRONMENT"; then
  1.4017 +if test "$MOZ_X11"; then
  1.4018 +    dnl ====================================================
  1.4019 +    dnl = Check if X headers exist
  1.4020 +    dnl ====================================================
  1.4021 +    _SAVE_CFLAGS=$CFLAGS
  1.4022 +    CFLAGS="$CFLAGS $XCFLAGS"
  1.4023 +    AC_TRY_COMPILE([
  1.4024 +        #include <stdio.h>
  1.4025 +        #include <stdlib.h>
  1.4026 +        #include <X11/Xlib.h>
  1.4027 +        #include <X11/Intrinsic.h>
  1.4028 +    ],
  1.4029 +    [
  1.4030 +        Display *dpy = 0;
  1.4031 +        if ((dpy = XOpenDisplay(NULL)) == NULL) {
  1.4032 +            fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
  1.4033 +            exit(1);
  1.4034 +        }
  1.4035 +    ], [],
  1.4036 +    [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
  1.4037 +    CFLAGS="$_SAVE_CFLAGS"
  1.4038 +
  1.4039 +    if test -n "$MISSING_X"; then
  1.4040 +        AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
  1.4041 +    fi
  1.4042 +
  1.4043 +fi # MOZ_X11
  1.4044 +fi # COMPILE_ENVIRONMENT
  1.4045 +
  1.4046 +dnl Set various defines and substitutions
  1.4047 +dnl ========================================================
  1.4048 +
  1.4049 +if test "$OS_ARCH" = "Darwin"; then
  1.4050 +  AC_DEFINE(XP_MACOSX)
  1.4051 +  AC_DEFINE(XP_UNIX)
  1.4052 +elif test "$OS_ARCH" != "WINNT"; then
  1.4053 +  AC_DEFINE(XP_UNIX)
  1.4054 +fi
  1.4055 +
  1.4056 +if test "$MOZ_DEBUG"; then
  1.4057 +    AC_DEFINE(MOZ_REFLOW_PERF)
  1.4058 +    AC_DEFINE(MOZ_REFLOW_PERF_DSP)
  1.4059 +fi
  1.4060 +
  1.4061 +if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
  1.4062 +    AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
  1.4063 +    ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
  1.4064 +    ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
  1.4065 +    ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
  1.4066 +    ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
  1.4067 +    AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
  1.4068 +    AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
  1.4069 +    AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
  1.4070 +fi
  1.4071 +
  1.4072 +
  1.4073 +dnl ========================================================
  1.4074 +dnl ECMAScript Internationalization API Support (uses ICU)
  1.4075 +dnl ========================================================
  1.4076 +
  1.4077 +dnl top-level configure may override this with --without-intl-api
  1.4078 +_INTL_API=yes
  1.4079 +
  1.4080 +MOZ_CONFIG_ICU()
  1.4081 +
  1.4082 +MOZ_SUBCONFIGURE_ICU()
  1.4083 +
  1.4084 +dnl ========================================================
  1.4085 +dnl JavaScript shell
  1.4086 +dnl ========================================================
  1.4087 +
  1.4088 +AC_HAVE_FUNCS(setlocale)
  1.4089 +AC_HAVE_FUNCS(localeconv)
  1.4090 +
  1.4091 +AC_SUBST(MOZILLA_VERSION)
  1.4092 +
  1.4093 +AC_SUBST(ac_configure_args)
  1.4094 +
  1.4095 +AC_SUBST(TOOLCHAIN_PREFIX)
  1.4096 +
  1.4097 +
  1.4098 +if test -n "$JS_STANDALONE"; then
  1.4099 +MOZ_APP_NAME="mozjs"
  1.4100 +MOZ_APP_VERSION="$MOZILLA_SYMBOLVERSION"
  1.4101 +JS_LIBRARY_NAME="mozjs-$MOZILLA_SYMBOLVERSION"
  1.4102 +else
  1.4103 +JS_LIBRARY_NAME="mozjs"
  1.4104 +fi
  1.4105 +JS_CONFIG_LIBS="$NSPR_LIBS $LIBS"
  1.4106 +if test -n "$GNU_CC"; then
  1.4107 +JS_CONFIG_MOZ_JS_LIBS='-L${libdir} -l${JS_LIBRARY_NAME}'
  1.4108 +else
  1.4109 +JS_CONFIG_MOZ_JS_LIBS='${libdir}/${JS_LIBRARY_NAME}.lib'
  1.4110 +fi
  1.4111 +AC_SUBST(JS_LIBRARY_NAME)
  1.4112 +AC_SUBST(JS_CONFIG_MOZ_JS_LIBS)
  1.4113 +AC_SUBST(JS_CONFIG_LIBS)
  1.4114 +
  1.4115 +MOZ_SUBCONFIGURE_FFI()
  1.4116 +
  1.4117 +dnl Spit out some output
  1.4118 +dnl ========================================================
  1.4119 +MOZ_CREATE_CONFIG_STATUS()
  1.4120 +
  1.4121 +if test "$JS_STANDALONE"; then
  1.4122 +  MOZ_RUN_CONFIG_STATUS()
  1.4123 +fi

mercurial