/js/src/configure.in
http://github.com/zpao/v8monkey · Autoconf · 5430 lines · 4042 code · 569 blank · 819 comment · 503 complexity · 6dc810d30993e3187ef7be0a50c2697c MD5 · raw file
Large files are truncated click here to view the full file
- dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
- dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
- dnl ***** BEGIN LICENSE BLOCK *****
- dnl Version: MPL 1.1/GPL 2.0/LGPL 2.1
- dnl
- dnl The contents of this file are subject to the Mozilla Public License Version
- dnl 1.1 (the "License"); you may not use this file except in compliance with
- dnl the License. You may obtain a copy of the License at
- dnl http://www.mozilla.org/MPL/
- dnl
- dnl Software distributed under the License is distributed on an "AS IS" basis,
- dnl WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- dnl for the specific language governing rights and limitations under the
- dnl License.
- dnl
- dnl The Original Code is this file as it was released upon August 6, 1998.
- dnl
- dnl The Initial Developer of the Original Code is
- dnl Christopher Seawood.
- dnl Portions created by the Initial Developer are Copyright (C) 1998-2001
- dnl the Initial Developer. All Rights Reserved.
- dnl
- dnl Contributor(s):
- dnl Jamie Zawinski <jwz@jwz.org>
- dnl gettimeofday args check
- dnl Christopher Blizzard <blizzard@appliedtheory.com>
- dnl gnomefe update & enable-pthreads
- dnl Ramiro Estrugo <ramiro@netscape.com>
- dnl X11 makedepend support
- dnl Insure support.
- dnl Henry Sobotka <sobotka@axess.com>
- dnl OS/2 support
- dnl Dan Mosedale <dmose@mozilla.org>
- dnl LDAP support
- dnl Seth Spitzer <sspitzer@netscape.com>
- dnl xpctools support
- dnl Benjamin Smedberg <benjamin@smedbergs.us>
- dnl Howard Chu <hyc@symas.com>
- dnl MSYS support
- dnl Mark Mentovai <mark@moxienet.com>:
- dnl Mac OS X 10.4 support
- dnl Giorgio Maone <g.maone@informaction.com>
- dnl MSVC l10n compatible version check
- dnl Ben Turner <mozilla@songbirdnest.com>
- dnl Windows x64 support
- dnl Makoto Kato <m_kato@ga2.so-net.ne.jp>
- dnl
- dnl Alternatively, the contents of this file may be used under the terms of
- dnl either the GNU General Public License Version 2 or later (the "GPL"), or
- dnl the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- dnl in which case the provisions of the GPL or the LGPL are applicable instead
- dnl of those above. If you wish to allow use of your version of this file only
- dnl under the terms of either the GPL or the LGPL, and not to allow others to
- dnl use your version of this file under the terms of the MPL, indicate your
- dnl decision by deleting the provisions above and replace them with the notice
- dnl and other provisions required by the GPL or the LGPL. If you do not delete
- dnl the provisions above, a recipient may use your version of this file under
- dnl the terms of any one of the MPL, the GPL or the LGPL.
- dnl
- dnl ***** END LICENSE BLOCK *****
- dnl Process this file with autoconf to produce a configure script.
- dnl ========================================================
- AC_PREREQ(2.13)
- AC_INIT(jsapi.h)
- AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
- AC_CONFIG_HEADER(js-config.h)
- AC_CANONICAL_SYSTEM
- TARGET_CPU="${target_cpu}"
- TARGET_VENDOR="${target_vendor}"
- TARGET_OS="${target_os}"
- dnl ========================================================
- dnl =
- dnl = Don't change the following two lines. Doing so breaks:
- dnl =
- dnl = CFLAGS="-foo" ./configure
- dnl =
- dnl ========================================================
- CFLAGS="${CFLAGS=}"
- CPPFLAGS="${CPPFLAGS=}"
- CXXFLAGS="${CXXFLAGS=}"
- LDFLAGS="${LDFLAGS=}"
- HOST_CFLAGS="${HOST_CFLAGS=}"
- HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
- HOST_LDFLAGS="${HOST_LDFLAGS=}"
- dnl ========================================================
- dnl = Preserve certain environment flags passed to configure
- dnl = We want sub projects to receive the same flags
- dnl = untainted by this configure script
- dnl ========================================================
- _SUBDIR_CC="$CC"
- _SUBDIR_CXX="$CXX"
- _SUBDIR_CFLAGS="$CFLAGS"
- _SUBDIR_CPPFLAGS="$CPPFLAGS"
- _SUBDIR_CXXFLAGS="$CXXFLAGS"
- _SUBDIR_LDFLAGS="$LDFLAGS"
- _SUBDIR_HOST_CC="$HOST_CC"
- _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
- _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
- _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
- _SUBDIR_CONFIG_ARGS="$ac_configure_args"
- dnl Set the version number of the libs included with mozilla
- dnl ========================================================
- NSPR_VERSION=4
- dnl Set the minimum version of toolkit libs used by mozilla
- dnl ========================================================
- PERL_VERSION=5.006
- PYTHON_VERSION=2.5
- WINDRES_VERSION=2.14.90
- W32API_VERSION=3.14
- MSMANIFEST_TOOL=
- dnl Set various checks
- dnl ========================================================
- MISSING_X=
- AC_PROG_AWK
- dnl Initialize the Pthread test variables early so they can be
- dnl overridden by each platform.
- dnl ========================================================
- USE_PTHREADS=
- _PTHREAD_LDFLAGS=""
- dnl Do not allow a separate objdir build if a srcdir build exists.
- dnl ==============================================================
- _topsrcdir=`cd \`dirname $0\`; pwd`
- _objdir=`pwd`
- if test "$_topsrcdir" != "$_objdir"
- then
- # Check for a couple representative files in the source tree
- _conflict_files=
- for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
- if test -f $file; then
- _conflict_files="$_conflict_files $file"
- fi
- done
- if test "$_conflict_files"; then
- echo "***"
- echo "* Your source tree contains these files:"
- for file in $_conflict_files; do
- echo "* $file"
- done
- cat 1>&2 <<-EOF
- * This indicates that you previously built in the source tree.
- * A source tree build can confuse the separate objdir build.
- *
- * To clean up the source tree:
- * 1. cd $_topsrcdir
- * 2. gmake distclean
- ***
- EOF
- exit 1
- break
- fi
- fi
- MOZ_BUILD_ROOT=`pwd`
- dnl Choose where to put the 'dist' directory.
- dnl ==============================================================
- MOZ_ARG_WITH_STRING(dist-dir,
- [ --with-dist-dir=DIR Use DIR as 'dist' staging area. DIR may be
- relative to the top of SpiderMonkey build tree,
- or absolute.],
- TOP_DIST=$withval,
- TOP_DIST=dist)
- AC_SUBST(TOP_DIST)
- dnl Default to MSVC for win32
- dnl ==============================================================
- if test -z "$CROSS_COMPILE"; then
- case "$target" in
- *-mingw*)
- if test -z "$CC"; then CC=cl; fi
- if test -z "$CXX"; then CXX=cl; fi
- if test -z "$CPP"; then CPP="cl -E -nologo"; fi
- if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
- if test -z "$LD"; then LD=link; fi
- if test -z "$AS"; then
- case "${target_cpu}" in
- i*86)
- AS=ml;
- ;;
- x86_64)
- AS=ml64;
- ;;
- esac
- fi
- if test -z "$MIDL"; then MIDL=midl; fi
- ;;
- *-darwin*)
- # prefer gcc-4.2 to default cc on older xcode
- MOZ_PATH_PROGS(CC, $CC gcc-4.2 gcc)
- MOZ_PATH_PROGS(CXX, $CXX g++-4.2 g++)
- ;;
- esac
- fi
- COMPILE_ENVIRONMENT=1
- MOZ_ARG_DISABLE_BOOL(compile-environment,
- [ --disable-compile-environment
- Disable compiler/library checks.],
- COMPILE_ENVIRONMENT= )
- AC_SUBST(COMPILE_ENVIRONMENT)
- dnl Check for Perl first -- needed for win32 SDK checks
- MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
- if test -z "$PERL" -o "$PERL" = ":"; then
- AC_MSG_ERROR([perl not found in \$PATH])
- fi
- MOZ_ARG_ENABLE_BOOL(shared-js,
- [ --disable-shared-js
- Do not create a shared library.],
- DISABLE_SHARED_JS=0,
- DISABLE_SHARED_JS=1)
- if test "$DISABLE_SHARED_JS" = "1" ; then
- AC_DEFINE(STATIC_EXPORTABLE_JS_API)
- else
- JS_SHARED_LIBRARY=1
- fi
- AC_SUBST(JS_SHARED_LIBRARY)
- dnl ========================================================
- dnl = Android uses a very custom (hacky) toolchain; we need to do this
- dnl = here, so that the compiler checks can succeed
- dnl ========================================================
- MOZ_ARG_WITH_STRING(android-ndk,
- [ --with-android-ndk=DIR
- location where the Android NDK can be found],
- android_ndk=$withval)
- MOZ_ARG_WITH_STRING(android-toolchain,
- [ --with-android-toolchain=DIR
- location of the android toolchain, default NDK/build/prebuilt/HOST/arm-eabi-4.4.0],
- android_toolchain=$withval)
- MOZ_ARG_WITH_STRING(android-version,
- [ --with-android-version=VER
- android platform version, default 5],
- android_version=$withval,
- android_version=5)
- MOZ_ARG_WITH_STRING(android-sdk,
- [ --with-android-sdk=DIR
- location where the Android SDK can be found (base directory, e.g. .../android/platforms/android-6)],
- android_sdk=$withval)
- MOZ_ARG_WITH_STRING(android-platform,
- [ --with-android-platform=DIR
- location of platform dir, default NDK/build/platforms/android-5/arch-arm],
- android_platform=$withval)
- MOZ_ARG_ENABLE_BOOL(android-libstdcxx,
- [ --enable-android-libstdcxx
- use GNU libstdc++ instead of STLPort for NDK >= 5],
- MOZ_ANDROID_LIBSTDCXX=1,
- MOZ_ANDROID_LIBSTDCXX= )
- case "$target" in
- arm-linux*-android*|*-linuxandroid*)
- android_tool_prefix="arm-linux-androideabi"
- ;;
- arm-android-eabi)
- android_tool_prefix="arm-eabi"
- ;;
- i?86-*android*)
- android_tool_prefix="i686-android-linux"
- ;;
- *)
- android_tool_prefix="$target_os"
- ;;
- esac
- MOZ_ARG_WITH_STRING(gonk,
- [ --with-gonk=DIR
- location of gonk dir],
- gonkdir=$withval)
- if test -n "$gonkdir" ; then
- kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
- gonk_toolchain="$gonkdir"/prebuilt/$kernel_name-x86/toolchain/arm-eabi-4.4.3
- dnl set up compilers
- AS="$gonk_toolchain"/bin/"$android_tool_prefix"-as
- CC="$gonk_toolchain"/bin/"$android_tool_prefix"-gcc
- CXX="$gonk_toolchain"/bin/"$android_tool_prefix"-g++
- CPP="$gonk_toolchain"/bin/"$android_tool_prefix"-cpp
- LD="$gonk_toolchain"/bin/"$android_tool_prefix"-ld
- AR="$gonk_toolchain"/bin/"$android_tool_prefix"-ar
- RANLIB="$gonk_toolchain"/bin/"$android_tool_prefix"-ranlib
- STRIP="$gonk_toolchain"/bin/"$android_tool_prefix"-strip
- STLPORT_CPPFLAGS="-I$gonkdir/external/stlport/stlport"
- STLPORT_LIBS="-lstlport"
- CPPFLAGS="-DANDROID -I$gonkdir/bionic/libc/include/ -I$gonkdir/bionic/libc/kernel/common -I$gonkdir/bionic/libc/arch-arm/include -I$gonkdir/bionic/libc/kernel/arch-arm -I$gonkdir/bionic/libm/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/system/core/include -I$gonkdir/bionic $STLPORT_CPPFLAGS $CPPFLAGS"
- CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
- CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions $CXXFLAGS"
- LIBS="$LIBS $STLPORT_LIBS"
- dnl Add -llog by default, since we use it all over the place.
- 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"
- dnl prevent cross compile section from using these flags as host flags
- if test -z "$HOST_CPPFLAGS" ; then
- HOST_CPPFLAGS=" "
- fi
- if test -z "$HOST_CFLAGS" ; then
- HOST_CFLAGS=" "
- fi
- if test -z "$HOST_CXXFLAGS" ; then
- HOST_CXXFLAGS=" "
- fi
- if test -z "$HOST_LDFLAGS" ; then
- HOST_LDFLAGS=" "
- fi
- # save these for libffi's subconfigure,
- # which doesn't know how to figure this stuff out on its own
- ANDROID_CFLAGS="$CFLAGS"
- ANDROID_CPPFLAGS="$CPPFLAGS"
- ANDROID_LDFLAGS="$LDFLAGS"
- AC_DEFINE(ANDROID)
- AC_DEFINE(GONK)
- CROSS_COMPILE=1
- else
- case "$target" in
- *-android*|*-linuxandroid*)
- if test -z "$android_ndk" ; then
- AC_MSG_ERROR([You must specify --with-android-ndk=/path/to/ndk when targeting Android.])
- fi
- if test -z "$android_sdk" ; then
- AC_MSG_ERROR([You must specify --with-android-sdk=/path/to/sdk when targeting Android.])
- fi
- android_platform_tools="$android_sdk"/../../platform-tools
- if test ! -d "$android_platform_tools" ; then
- android_platform_tools="$android_sdk"/tools # SDK Tools < r8
- else
- if ! test -e "$android_sdk"/source.properties ; then
- AC_MSG_ERROR([The path in --with-android-sdk isn't valid (source.properties hasn't been found).])
- fi
- # Minimum Android SDK API Level we require.
- android_min_api_level=13
- # Get the api level from "$android_sdk"/source.properties.
- android_api_level=`$AWK -F = '$1 == "AndroidVersion.ApiLevel" {print $2}' "$android_sdk"/source.properties`
- if test -z "$android_api_level" ; then
- AC_MSG_ERROR([Unexpected error: no AndroidVersion.ApiLevel field has been found in source.properties.])
- fi
- if ! test "$android_api_level" -eq "$android_api_level" ; then
- AC_MSG_ERROR([Unexpected error: the found android api value isn't a number! (found $android_api_level)])
- fi
- if test $android_api_level -lt $android_min_api_level ; then
- AC_MSG_ERROR([The given Android SDK provides API level $android_api_level ($android_min_api_level or higher required).])
- fi
- fi
- if test -z "$android_toolchain" ; then
- AC_MSG_CHECKING([for android toolchain directory])
- kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
- android_toolchain="$android_ndk"/build/prebuilt/$kernel_name-x86/arm-eabi-4.4.0
- # With newer NDK, the toolchain path has changed.
- if ! test -d "$android_toolchain" ; then
- android_toolchain="$android_ndk"/toolchains/arm-$kernel_name-androideabi-4.4.3/prebuilt/$kernel_name-x86
- fi
- if test -d "$android_toolchain" ; then
- AC_MSG_RESULT([$android_toolchain])
- else
- AC_MSG_ERROR([not found. You have to specify --with-android-toolchain=/path/to/ndk/toolchain.])
- fi
- fi
- if test -z "$android_platform" ; then
- AC_MSG_CHECKING([for android platform directory])
- android_platform="$android_ndk"/build/platforms/android-"$android_version"/arch-"$target_cpu"
- # With newer NDK, the platform path has changed.
- if ! test -d "$android_platform" ; then
- android_platform="$android_ndk"/platforms/android-"$android_version"/arch-"$target_cpu"
- fi
- if test -d "$android_platform" ; then
- AC_MSG_RESULT([$android_platform])
- else
- AC_MSG_ERROR([not found. You have to specify --with-android-platform=/path/to/ndk/platform.])
- fi
- fi
- dnl set up compilers
- AS="$android_toolchain"/bin/"$android_tool_prefix"-as
- CC="$android_toolchain"/bin/"$android_tool_prefix"-gcc
- CXX="$android_toolchain"/bin/"$android_tool_prefix"-g++
- CPP="$android_toolchain"/bin/"$android_tool_prefix"-cpp
- LD="$android_toolchain"/bin/"$android_tool_prefix"-ld
- AR="$android_toolchain"/bin/"$android_tool_prefix"-ar
- RANLIB="$android_toolchain"/bin/"$android_tool_prefix"-ranlib
- STRIP="$android_toolchain"/bin/"$android_tool_prefix"-strip
- CPPFLAGS="-I$android_platform/usr/include $CPPFLAGS"
- CFLAGS="-mandroid -I$android_platform/usr/include -fno-short-enums -fno-exceptions $CFLAGS"
- CXXFLAGS="-mandroid -I$android_platform/usr/include -fno-short-enums -fno-exceptions $CXXFLAGS"
- dnl Add -llog by default, since we use it all over the place.
- dnl Add --allow-shlib-undefined, because libGLESv2 links to an
- dnl undefined symbol (present on the hardware, just not in the
- dnl NDK.)
- LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform -llog -Wl,--allow-shlib-undefined $LDFLAGS"
- dnl prevent cross compile section from using these flags as host flags
- if test -z "$HOST_CPPFLAGS" ; then
- HOST_CPPFLAGS=" "
- fi
- if test -z "$HOST_CFLAGS" ; then
- HOST_CFLAGS=" "
- fi
- if test -z "$HOST_CXXFLAGS" ; then
- HOST_CXXFLAGS=" "
- fi
- if test -z "$HOST_LDFLAGS" ; then
- HOST_LDFLAGS=" "
- fi
- ANDROID_NDK="${android_ndk}"
- ANDROID_TOOLCHAIN="${android_toolchain}"
- ANDROID_PLATFORM="${android_platform}"
- ANDROID_SDK="${android_sdk}"
- ANDROID_PLATFORM_TOOLS="${android_platform_tools}"
- ANDROID_VERSION="${android_version}"
- AC_DEFINE(ANDROID)
- AC_DEFINE_UNQUOTED(ANDROID_VERSION, $android_version)
- AC_SUBST(ANDROID_VERSION)
- CROSS_COMPILE=1
- MOZ_CHROME_FILE_FORMAT=omni
- ;;
- esac
- fi
- AC_SUBST(ANDROID_NDK)
- AC_SUBST(ANDROID_TOOLCHAIN)
- AC_SUBST(ANDROID_PLATFORM)
- AC_SUBST(ANDROID_SDK)
- AC_SUBST(ANDROID_PLATFORM_TOOLS)
- dnl ========================================================
- dnl Checks for compilers.
- dnl ========================================================
- dnl Set CROSS_COMPILE in the environment when running configure
- dnl to use the cross-compile setup for now
- dnl ========================================================
- dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
- AR_FLAGS='cr $@'
- if test "$COMPILE_ENVIRONMENT"; then
- # Note:
- # In Mozilla, we use the names $target, $host and $build incorrectly, but are
- # too far gone to back out now. See Bug 475488:
- # - When we say $target, we mean $host, that is, the system on which
- # Mozilla will be run.
- # - When we say $host, we mean $build, that is, the system on which Mozilla
- # is built.
- # - $target (in its correct usage) is for compilers who generate code for a
- # different platform than $host, so it would not be used by Mozilla.
- if test "$target" != "$host"; then
- echo "cross compiling from $host to $target"
- _SAVE_CC="$CC"
- _SAVE_CFLAGS="$CFLAGS"
- _SAVE_LDFLAGS="$LDFLAGS"
- AC_MSG_CHECKING([for host c compiler])
- AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
- if test -z "$HOST_CC"; then
- AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
- fi
- AC_MSG_RESULT([$HOST_CC])
- AC_MSG_CHECKING([for host c++ compiler])
- AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
- if test -z "$HOST_CXX"; then
- AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
- fi
- AC_MSG_RESULT([$HOST_CXX])
- if test -z "$HOST_CFLAGS"; then
- HOST_CFLAGS="$CFLAGS"
- fi
- if test -z "$HOST_CXXFLAGS"; then
- HOST_CXXFLAGS="$CXXFLAGS"
- fi
- if test -z "$HOST_LDFLAGS"; then
- HOST_LDFLAGS="$LDFLAGS"
- fi
- if test -z "$HOST_AR_FLAGS"; then
- HOST_AR_FLAGS="$AR_FLAGS"
- fi
- AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
- AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
- CC="$HOST_CC"
- CFLAGS="$HOST_CFLAGS"
- LDFLAGS="$HOST_LDFLAGS"
- AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
- AC_TRY_COMPILE([], [return(0);],
- [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
- AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
- CC="$HOST_CXX"
- CFLAGS="$HOST_CXXFLAGS"
- AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
- AC_TRY_COMPILE([], [return(0);],
- [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
- AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
- CC=$_SAVE_CC
- CFLAGS=$_SAVE_CFLAGS
- LDFLAGS=$_SAVE_LDFLAGS
- AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
- unset ac_cv_prog_CC
- AC_PROG_CC
- AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
- unset ac_cv_prog_CXX
- AC_PROG_CXX
- AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
- AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
- MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
- AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
- AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
- AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
- AC_DEFINE(CROSS_COMPILE)
- dnl If we cross compile for ppc on Mac OS X x86, cross_compiling will
- dnl have erroneously been set to "no", because the x86 build host is
- dnl able to run ppc code in a translated environment, making a cross
- dnl compiler appear native. So we override that here.
- cross_compiling=yes
- else
- AC_PROG_CC
- AC_PROG_CXX
- AC_PROG_RANLIB
- MOZ_PATH_PROGS(AS, $AS as, $CC)
- AC_CHECK_PROGS(AR, ar, :)
- AC_CHECK_PROGS(LD, ld, :)
- AC_CHECK_PROGS(STRIP, strip, :)
- AC_CHECK_PROGS(WINDRES, windres, :)
- if test -z "$HOST_CC"; then
- HOST_CC='$(CC)'
- fi
- if test -z "$HOST_CFLAGS"; then
- HOST_CFLAGS='$(CFLAGS)'
- fi
- if test -z "$HOST_CXX"; then
- HOST_CXX='$(CXX)'
- fi
- if test -z "$HOST_CXXFLAGS"; then
- HOST_CXXFLAGS='$(CXXFLAGS)'
- fi
- if test -z "$HOST_LDFLAGS"; then
- HOST_LDFLAGS='$(LDFLAGS)'
- fi
- if test -z "$HOST_RANLIB"; then
- HOST_RANLIB='$(RANLIB)'
- fi
- if test -z "$HOST_AR"; then
- HOST_AR='$(AR)'
- fi
- if test -z "$HOST_AR_FLAGS"; then
- HOST_AR_FLAGS='$(AR_FLAGS)'
- fi
- fi
- GNU_AS=
- GNU_LD=
- GNU_CC=
- GNU_CXX=
- CC_VERSION='N/A'
- CXX_VERSION='N/A'
- if test "$GCC" = "yes"; then
- GNU_CC=1
- CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
- fi
- if test "$GXX" = "yes"; then
- GNU_CXX=1
- CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
- fi
- if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
- GNU_AS=1
- fi
- if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
- GNU_LD=1
- fi
- if test "$GNU_CC"; then
- if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
- GCC_USE_GNU_LD=1
- fi
- fi
- INTEL_CC=
- INTEL_CXX=
- if test "$GCC" = yes; then
- if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
- INTEL_CC=1
- fi
- fi
- if test "$GXX" = yes; then
- if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
- INTEL_CXX=1
- fi
- fi
- CLANG_CC=
- CLANG_CXX=
- if test "$GCC" = yes; then
- if test "`$CC -v 2>&1 | grep -c 'clang version'`" != "0"; then
- CLANG_CC=1
- fi
- fi
- if test "$GXX" = yes; then
- if test "`$CXX -v 2>&1 | grep -c 'clang version'`" != "0"; then
- CLANG_CXX=1
- fi
- fi
- dnl Special win32 checks
- dnl ========================================================
- WINVER=502
- dnl Target the Windows 7 SDK by default
- WINSDK_TARGETVER=601
- MOZ_ARG_WITH_STRING(windows-version,
- [ --with-windows-version=WINSDK_TARGETVER
- Highest Windows version to target using this SDK
- 601: Windows 7],
- WINSDK_TARGETVER=$withval)
- case "$WINSDK_TARGETVER" in
- 601)
- MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
- ;;
- *)
- AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER), must be 601]);
- ;;
- esac
- case "$target" in
- *-mingw*)
- if test "$GCC" != "yes"; then
- # Check to see if we are really running in a msvc environemnt
- _WIN32_MSVC=1
- # Make sure compilers are valid
- CFLAGS="$CFLAGS -TC -nologo"
- CXXFLAGS="$CXXFLAGS -TP -nologo"
- # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
- # _CRT_SECURE_NO_WARNINGS disables warnings about using MSVC-specific
- # secure CRT functions.
- CXXFLAGS="$CXXFLAGS -wd4345 -D_CRT_SECURE_NO_WARNINGS"
- AC_LANG_SAVE
- AC_LANG_C
- AC_TRY_COMPILE([#include <stdio.h>],
- [ printf("Hello World\n"); ],,
- AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
- AC_LANG_CPLUSPLUS
- AC_TRY_COMPILE([#include <new.h>],
- [ unsigned *test = new unsigned(42); ],,
- AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
- AC_LANG_RESTORE
- changequote(,)
- _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
- changequote([,])
- # Determine compiler version
- CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
- _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
- _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
- _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
- _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
- _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
- CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
- _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
- if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
- AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
- fi
- if test "$_CC_MAJOR_VERSION" = "14"; then
- dnl Require VC8SP1 or newer.
- dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762.
- if test "$_CC_RELEASE" -lt 50727 -o \
- \( "$_CC_RELEASE" -eq 50727 -a "$_CC_BUILD" -lt 762 \); then
- AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. You probably need to install Service Pack 1 of Visual Studio 2005. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
- fi
- _CC_SUITE=8
- AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
- AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
- elif test "$_CC_MAJOR_VERSION" = "15"; then
- _CC_SUITE=9
- AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
- AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
- elif test "$_CC_MAJOR_VERSION" = "16"; then
- _CC_SUITE=10
- AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
- AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
- elif test "$_CC_MAJOR_VERSION" = "17"; then
- _CC_SUITE=11
- AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
- AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
- else
- AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
- fi
- _MOZ_RTTI_FLAGS_ON='-GR'
- _MOZ_RTTI_FLAGS_OFF='-GR-'
- dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
- dnl not something else like "magnetic tape manipulation utility".
- MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
- if test -z "$MSMT_TOOL"; then
- AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
- fi
- changequote(,)
- _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
- changequote([,])
- MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
- if test -z "$MSMANIFEST_TOOL_VERSION"; then
- AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
- fi
- MSMANIFEST_TOOL=1
- unset MSMT_TOOL
- # Check linker version
- _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
- _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
- if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
- AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
- fi
- INCREMENTAL_LINKER=1
- # Identify which version of the SDK we're building with
- # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
- # from there
- MOZ_CHECK_HEADERS([winsdkver.h])
- if test "$ac_cv_header_winsdkver_h" = "yes"; then
- # Get the highest _WIN32_WINNT and NTDDI versions supported
- # Take the higher of the two
- # This is done because the Windows 7 beta SDK reports its
- # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
- AC_CACHE_CHECK(for highest Windows version supported by this SDK,
- ac_cv_winsdk_maxver,
- [cat > conftest.h <<EOF
- #include <winsdkver.h>
- #include <sdkddkver.h>
- #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
- #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
- #else
- #define WINSDK_MAXVER NTDDI_MAXVER
- #endif
- WINSDK_MAXVER
- EOF
- ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
- rm -f conftest.h
- ])
- MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
- else
- # Any SDK which doesn't have WinSDKVer.h is too old.
- AC_MSG_ERROR([Your SDK does not have WinSDKVer.h. It is probably too old. Please upgrade to a newer SDK or 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.])
- fi
- unset _MSVC_VER_FILTER
- AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
- [
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
- _SAVE_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
- AC_TRY_COMPILE([#include <exception>],
- [std::_Throw(std::exception()); return 0;],
- ac_cv_have_std__Throw="yes",
- ac_cv_have_std__Throw="no")
- CXXFLAGS="$_SAVE_CXXFLAGS"
- AC_LANG_RESTORE
- ])
- if test "$ac_cv_have_std__Throw" == "yes"; then
- AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
- ac_cv_have_dllimport_exception_bug,
- [
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
- _SAVE_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
- AC_TRY_LINK([#include <vector>],
- [std::vector<int> v; return v.at(1);],
- ac_cv_have_dllimport_exception_bug="no",
- ac_cv_have_dllimport_exception_bug="yes")
- CXXFLAGS="$_SAVE_CXXFLAGS"
- AC_LANG_RESTORE
- ])
- if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
- WRAP_STL_INCLUDES=1
- MOZ_MSVC_STL_WRAP__Throw=1
- AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
- fi
- else
- AC_CACHE_CHECK(for overridable _RAISE,
- ac_cv_have__RAISE,
- [
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
- _SAVE_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
- AC_TRY_COMPILE([#include <xstddef>
- #undef _RAISE
- #define _RAISE(x) externallyDefinedFunction((x).what())
- #include <vector>
- ],
- [std::vector<int> v; return v.at(1);],
- ac_cv_have__RAISE="no",
- ac_cv_have__RAISE="yes")
- CXXFLAGS="$_SAVE_CXXFLAGS"
- AC_LANG_RESTORE
- ])
- if test "$ac_cv_have__RAISE" = "yes"; then
- WRAP_STL_INCLUDES=1
- MOZ_MSVC_STL_WRAP__RAISE=1
- AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
- else
- AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.])
- fi
- fi
- if test "$WRAP_STL_INCLUDES" = "1"; then
- STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
- fi
- else
- # Check w32api version
- _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
- _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
- AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
- AC_TRY_COMPILE([#include <w32api.h>],
- #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
- (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
- __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
- #error "test failed."
- #endif
- , [ res=yes ], [ res=no ])
- AC_MSG_RESULT([$res])
- if test "$res" != "yes"; then
- AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
- fi
- # Check windres version
- AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
- _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
- AC_MSG_RESULT([$_WINDRES_VERSION])
- _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
- _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
- _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
- WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
- WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
- WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
- if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
- "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
- "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
- "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
- "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
- "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
- then
- AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
- fi
- MOZ_WINSDK_MAXVER=0x06010000
- fi # !GNU_CC
- AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
- AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
- # Require OS features provided by IE 5.0
- AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
- # If the maximum version supported by this SDK is lower than the target
- # version, error out
- AC_MSG_CHECKING([for Windows SDK being recent enough])
- if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
- AC_MSG_RESULT("yes")
- else
- AC_MSG_RESULT("no")
- 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.])
- fi
- AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
- # Definitions matching sdkddkver.h
- AC_DEFINE_UNQUOTED(MOZ_NTDDI_WS03, 0x05020000)
- AC_DEFINE_UNQUOTED(MOZ_NTDDI_LONGHORN, 0x06000000)
- AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
- ;;
- esac
- AC_PROG_CPP
- AC_PROG_CXXCPP
- if test -n "$_WIN32_MSVC"; then
- SKIP_PATH_CHECKS=1
- SKIP_COMPILER_CHECKS=1
- SKIP_LIBRARY_CHECKS=1
- # Since we're skipping compiler and library checks, hard-code
- # some facts here.
- # Common to all MSVC environments:
- # Windows lacks <stdint.h>, but has __int8, and so on.
- AC_DEFINE(JS_HAVE___INTN)
- AC_DEFINE(HAVE_LOCALECONV)
- AC_DEFINE(HAVE_SYSTEMTIMETOFILETIME)
- AC_DEFINE(HAVE_GETSYSTEMTIMEASFILETIME)
- # Windows <stddef.h> defines intptr_t and uintptr_t.
- # VS2005: http://msdn.microsoft.com/en-us/library/323b6b3k(VS.80).aspx
- # VS2008: http://msdn.microsoft.com/en-us/library/323b6b3k.aspx
- AC_DEFINE(JS_STDDEF_H_HAS_INTPTR_T)
- fi
- fi # COMPILE_ENVIRONMENT
- if test "$cross_compiling" = "yes"; then
- CROSS_COMPILE=1
- else
- CROSS_COMPILE=
- fi
- # Check to see if we are running in a broken QEMU scratchbox.
- # We know that anything below 1.0.16 is broken.
- AC_CHECK_PROGS(SBCONF, sb-conf ve, "")
- if test -n "$SBCONF"; then
- _sb_version=`$SBCONF ve`
- _sb_version_major=`echo $_sb_version | cut -f1 -d.`
- _sb_version_minor=`echo $_sb_version | cut -f2 -d.`
- _sb_version_point=`echo $_sb_version | cut -f3 -d.`
- if test $_sb_version_major -eq 1 -a $_sb_version_minor -eq 0 -a $_sb_version_point -le 16; then
- QEMU_CANT_RUN_JS_SHELL=1
- fi
- fi
- AC_SUBST(QEMU_CANT_RUN_JS_SHELL)
- AC_SUBST(_MSC_VER)
- AC_SUBST(GNU_AS)
- AC_SUBST(GNU_LD)
- AC_SUBST(GNU_CC)
- AC_SUBST(GNU_CXX)
- AC_SUBST(INTEL_CC)
- AC_SUBST(INTEL_CXX)
- AC_SUBST(STL_FLAGS)
- AC_SUBST(WRAP_STL_INCLUDES)
- AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
- AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
- dnl ========================================================
- dnl Checks for programs.
- dnl ========================================================
- AC_PROG_INSTALL
- AC_PROG_LN_S
- if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
- AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
- _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
- _perl_res=$?
- AC_MSG_RESULT([$_perl_version])
- if test "$_perl_res" != 0; then
- AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
- fi
- fi
- AC_MSG_CHECKING([for full perl installation])
- _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
- _perl_res=$?
- if test "$_perl_res" != 0; then
- AC_MSG_RESULT([no])
- AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
- else
- AC_MSG_RESULT([yes])
- fi
- MOZ_PATH_PROGS(PYTHON, $PYTHON python2.7 python2.6 python2.5 python)
- if test -z "$PYTHON"; then
- AC_MSG_ERROR([python was not found in \$PATH])
- fi
- if test -z "$COMPILE_ENVIRONMENT"; then
- NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
- fi
- AC_SUBST(NSINSTALL_BIN)
- MOZ_PATH_PROG(DOXYGEN, doxygen, :)
- MOZ_PATH_PROG(AUTOCONF, autoconf, :)
- MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
- MOZ_PATH_PROG(XARGS, xargs)
- if test -z "$XARGS" -o "$XARGS" = ":"; then
- AC_MSG_ERROR([xargs not found in \$PATH .])
- fi
- if test "$COMPILE_ENVIRONMENT"; then
- dnl ========================================================
- dnl = Mac OS X toolchain support
- dnl ========================================================
- case "$target_os" in
- darwin*)
- dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
- dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
- dnl the environment and includedir purposes (when using an SDK, below),
- dnl but remember the full version number for the libdir (SDK).
- changequote(,)
- GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
- GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
- changequote([,])
- if test "$GCC_VERSION_FULL" = "4.0.0" ; then
- dnl Bug 280479, but this keeps popping up in bug 292530 too because
- dnl 4.0.0/4061 is the default compiler in Tiger.
- changequote(,)
- GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
- changequote([,])
- if test "$GCC_BUILD" = "4061" ; then
- AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
- This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
- from building Mozilla. Upgrade to Xcode 2.1 or later.])
- fi
- fi
- dnl xcodebuild needs GCC_VERSION defined in the environment, since it
- dnl doesn't respect the CC/CXX setting. With GCC_VERSION set, it will use
- dnl /usr/bin/g(cc|++)-$GCC_VERSION.
- MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
- dnl sdp was formerly in /Developer/Tools. As of Mac OS X 10.4 (Darwin 8),
- dnl it has moved into /usr/bin.
- MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
- ;;
- esac
- AC_SUBST(GCC_VERSION)
- dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
- dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
- dnl when we can run target binaries.
- AC_SUBST(UNIVERSAL_BINARY)
- AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
- dnl ========================================================
- dnl Check for MacOS deployment target version
- dnl ========================================================
- MOZ_ARG_ENABLE_STRING(macos-target,
- [ --enable-macos-target=VER (default=10.5)
- Set the minimum MacOS version needed at runtime],
- [_MACOSX_DEPLOYMENT_TARGET=$enableval])
- if test "$target_cpu" != "arm"; then
- case "$target" in
- *-darwin*)
- if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
- dnl Use the specified value
- export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
- else
- dnl No value specified on the command line or in the environment,
- dnl use architecture minimum.
- case "${target_cpu}" in
- i*86)
- export MACOSX_DEPLOYMENT_TARGET=10.5
- ;;
- x86_64)
- export MACOSX_DEPLOYMENT_TARGET=10.6
- ;;
- esac
- fi
- ;;
- esac
- fi
- AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
- dnl ========================================================
- dnl = Mac OS X SDK support
- dnl ========================================================
- MACOS_SDK_DIR=
- NEXT_ROOT=
- MOZ_ARG_WITH_STRING(macos-sdk,
- [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
- MACOS_SDK_DIR=$withval)
- dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
- dnl NEXT_ROOT will be set and exported only if it's needed.
- AC_SUBST(MACOS_SDK_DIR)
- AC_SUBST(NEXT_ROOT)
- if test "$MACOS_SDK_DIR"; then
- dnl Sync this section with the ones in NSPR and NSS.
- dnl Changes to the cross environment here need to be accounted for in
- dnl the libIDL checks (below) and xpidl build.
- if test ! -d "$MACOS_SDK_DIR"; then
- AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
- specify a valid SDK. SDKs are installed when the optional cross-development
- tools are selected during the Xcode/Developer Tools installation.])
- fi
- GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
- if test "$GCC_VERSION_MAJOR" -lt "4" ; then
- AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
- else
- CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
- CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
- dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
- CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
- CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
- if test "$GCC_VERSION_FULL" = "4.0.0" ; then
- dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
- dnl that supports -syslibroot. Don't set NEXT_ROOT because it will
- dnl be ignored and cause warnings when -syslibroot is specified.
- dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
- dnl the -isysroot it receives, so this is only needed with 4.0.0.
- LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
- fi
- fi
- AC_LANG_SAVE
- AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
- AC_LANG_CPLUSPLUS
- AC_TRY_COMPILE([#include <new>
- int main() { return 0; }],
- result=yes,
- result=no)
- AC_LANG_RESTORE
- AC_MSG_RESULT($result)
- if test "$result" = "no" ; then
- AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
- fi
- fi
- fi # COMPILE_ENVIRONMENT
- if test -n "$MAKE"; then
- if test `echo $MAKE | grep -c make.py` != 1; then
- NOT_PYMAKE=$MAKE
- fi
- fi
- case "$host_os" in
- mingw*)
- MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
- ;;
- *)
- MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
- ;;
- esac
- if test "$GMAKE" = ":"; then
- AC_MSG_ERROR([GNU make not found])
- fi
- AC_SUBST(GMAKE)
- # MAKE will be set by client.mk, but still need this for standalone js builds
- if test -z "$MAKE"; then
- MAKE=$GMAKE
- fi
- if test "$COMPILE_ENVIRONMENT"; then
- AC_PATH_XTRA
- XCFLAGS="$X_CFLAGS"
- fi # COMPILE_ENVIRONMENT
- dnl ========================================================
- dnl set the defaults first
- dnl ========================================================
- AS_BIN=$AS
- AR_LIST='$(AR) t'
- AR_EXTRACT='$(AR) x'
- AR_DELETE='$(AR) d'
- AS='$(CC)'
- AS_DASH_C_FLAG='-c'
- DLL_PREFIX=lib
- LIB_PREFIX=lib
- DLL_SUFFIX=.so
- OBJ_SUFFIX=o
- LIB_SUFFIX=a
- ASM_SUFFIX=s
- IMPORT_LIB_SUFFIX=
- TARGET_MD_ARCH=unix
- DIRENT_INO=d_ino
- WIN_TOP_SRC=
- MOZ_USER_DIR=".mozilla"
- MOZ_JS_LIBS='-L$(libdir) -lmozjs'
- MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
- MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
- USE_DEPENDENT_LIBS=1
- _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
- if test -n "$CROSS_COMPILE"; then
- OS_TARGET="${target_os}"
- OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
- OS_RELEASE=
- case "${target_os}" in
- linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
- kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
- gnu*) OS_ARCH=GNU ;;
- solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
- mingw*) OS_ARCH=WINNT OS_TARGET=WINNT ;;
- darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
- esac
- case "${target}" in
- *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
- esac
- else
- OS_TARGET=`uname -s`
- OS_ARCH=`uname -s | sed -e 's|/|_|g'`
- OS_RELEASE=`uname -r`
- fi
- # Before this used `uname -m` when not cross compiling
- # but that breaks when you have a 64 bit kernel with a 32 bit userland.
- OS_TEST="${target_cpu}"
- HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
- #######################################################################
- # Master "Core Components" macros for getting the OS target #
- #######################################################################
- #
- # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
- # cross-compilation.
- #
- #
- # Define and override various archtecture-specific variables, including
- # HOST_OS_ARCH
- # OS_ARCH
- # OS_TEST
- # OS_TARGET
- # OS_RELEASE
- # OS_MINOR_RELEASE
- #
- case "$HOST_OS_ARCH" in
- mingw*)
- HOST_OS_ARCH=WINNT
- ;;
- darwin*)
- HOST_OS_ARCH=Darwin
- ;;
- linux*)
- HOST_OS_ARCH=Linux
- ;;
- solaris*)
- HOST_OS_ARCH=SunOS
- SOLARIS_SUNPRO_CC=
- SOLARIS_SUNPRO_CXX=
- if test -z "$GNU_CC"; then
- if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
- SOLARIS_SUNPRO_CC=1
- fi
- fi
- if test -z "$GNU_CXX"; then
- if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
- SOLARIS_SUNPRO_CXX=1
- fi
- fi
- AC_SUBST(SOLARIS_SUNPRO_CC)
- AC_SUBST(SOLARIS_SUNPRO_CXX)
- ;;
- BSD_386)
- HOST_OS_ARCH=BSD
- ;;
- OS_2)
- HOST_OS_ARCH=OS2
- ;;
- esac
- case "$OS_ARCH" in
- WINNT)
- if test -z "$CROSS_COMPILE" ; then
- OS_TEST=`uname -p`
- fi
- ;;
- Windows_NT)
- #
- # If uname -s returns "Windows_NT", we assume that we are using
- # the uname.exe in MKS toolkit.
- #
- # The -r option of MKS uname only returns the major version number.
- # So we need to use its -v option to get the minor version number.
- # Moreover, it doesn't have the -p option, so we need to use uname -m.
- #
- OS_ARCH=WINNT
- OS_TARGET=WINNT
- OS_MINOR_RELEASE=`uname -v`
- if test "$OS_MINOR_RELEASE" = "00"; then
- OS_MINOR_RELEASE=0
- fi
- OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
- ;;
- MINGW*_NT*)
- #
- # If uname -s returns MINGW32_NT-5.1, we assume that we are using
- # the uname.exe in the MSYS tools.
- #
- OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
- OS_ARCH=WINNT
- OS_TARGET=WINNT
- ;;
- AIX)
- OS_RELEASE=`uname -v`.`uname -r`
- OS_TEST=${target_cpu}
- if test -z "$GNU_CC"; then
- if test "`$CC -qversion 2>&1 | egrep -c 'IBM XL'`" != "0"; then
- AIX_IBM_XLC=1
- fi
- fi
- ;;
- BSD_386)
- OS_ARCH=BSD
- ;;
- OS_2)
- OS_ARCH=OS2
- OS_TARGET=OS2
- OS_RELEASE=`uname -v`
- ;;
- Darwin)
- case "${target_cpu}" in
- powerpc*)
- OS_TEST=ppc
- ;;
- i*86*)
- OS_TEST=i386
- ;;
- x86_64)
- OS_TEST=x86_64
- ;;
- *)
- if test -z "$CROSS_COMPILE" ; then
- OS_TEST=`uname -p`
- fi
- ;;
- esac
- ;;
- esac
- # Only set CPU_ARCH if we recognize the value of OS_TEST
- case "$OS_TEST" in
- *86 | i86pc)
- CPU_ARCH=x86
- ;;
- powerpc64 | ppc64)
- CPU_ARCH=ppc64
- ;;
- powerpc | ppc | rs6000)
- CPU_ARCH=ppc
- ;;
- Alpha | alpha | ALPHA)
- CPU_ARCH=Alpha
- ;;
- s390)
- CPU_ARCH=s390
- ;;
- s390x)
- CPU_ARCH=s390x
- ;;
- hppa* | parisc)
- CPU_ARCH=hppa
- ;;
- sun4u | sparc*)
- CPU_ARCH=sparc
- ;;
- x86_64 | ia64)
- CPU_ARCH="$OS_TEST"
- ;;
- arm*)
- CPU_ARCH=arm
- ;;
- mips|mipsel)
- CPU_ARCH="mips"
- ;;
- esac
- if test -z "$OS_TARGET"; then
- OS_TARGET=$OS_ARCH
- fi
- OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
- dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
- dnl ===============================================================
- INTEL_ARCHITECTURE=
- case "$OS_TEST" in
- x86_64|i?86)
- INTEL_ARCHITECTURE=1
- esac
- dnl ========================================================
- dnl = ARM toolchain tweaks
- dnl ========================================================
- dnl Defaults
- case "${CPU_ARCH}-${OS_TARGET}" in
- arm-Android)
- MOZ_THUMB=yes
- MOZ_ARCH=armv7-a
- MOZ_FPU=vfp
- MOZ_FLOAT_ABI=softfp
- ;;
- arm-Darwin)
- MOZ_THUMB=yes
- ;;
- arm-*)
- if test -n "$MOZ_PLATFORM_MAEMO"; then
- MOZ_THUMB=no
- MOZ_ARCH=armv7-a
- MOZ_FLOAT_ABI=softfp
- fi
- if test "$MOZ_PLATFORM_MAEMO" = 6; then
- MOZ_THUMB=yes
- fi
- ;;
- esac
- dnl Kept for compatibility with some buildbot mozconfig
- MOZ_ARG_DISABLE_BOOL(thumb2, [], MOZ_THUMB=no, MOZ_THUMB=yes)
- MOZ_ARG_WITH_STRING(thumb,
- [ --with-thumb[[=yes|no|toolchain-default]]]
- [ Use Thumb instruction set (-mthumb)…