PageRenderTime 85ms CodeModel.GetById 30ms app.highlight 24ms RepoModel.GetById 1ms app.codeStats 6ms

/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 files are truncated, but you can click here to view the full file

   1dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
   2dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
   3dnl ***** BEGIN LICENSE BLOCK *****
   4dnl Version: MPL 1.1/GPL 2.0/LGPL 2.1
   5dnl
   6dnl The contents of this file are subject to the Mozilla Public License Version
   7dnl 1.1 (the "License"); you may not use this file except in compliance with
   8dnl the License. You may obtain a copy of the License at
   9dnl http://www.mozilla.org/MPL/
  10dnl
  11dnl Software distributed under the License is distributed on an "AS IS" basis,
  12dnl WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  13dnl for the specific language governing rights and limitations under the
  14dnl License.
  15dnl
  16dnl The Original Code is this file as it was released upon August 6, 1998.
  17dnl
  18dnl The Initial Developer of the Original Code is
  19dnl Christopher Seawood.
  20dnl Portions created by the Initial Developer are Copyright (C) 1998-2001
  21dnl the Initial Developer. All Rights Reserved.
  22dnl
  23dnl Contributor(s):
  24dnl   Jamie Zawinski <jwz@jwz.org>
  25dnl   gettimeofday args check
  26dnl   Christopher Blizzard <blizzard@appliedtheory.com>
  27dnl   gnomefe update & enable-pthreads
  28dnl   Ramiro Estrugo <ramiro@netscape.com>
  29dnl   X11 makedepend support
  30dnl   Insure support.
  31dnl   Henry Sobotka <sobotka@axess.com>
  32dnl   OS/2 support
  33dnl   Dan Mosedale <dmose@mozilla.org>
  34dnl   LDAP support
  35dnl   Seth Spitzer <sspitzer@netscape.com>
  36dnl   xpctools support
  37dnl   Benjamin Smedberg <benjamin@smedbergs.us>
  38dnl   Howard Chu <hyc@symas.com>
  39dnl   MSYS support
  40dnl   Mark Mentovai <mark@moxienet.com>:
  41dnl   Mac OS X 10.4 support
  42dnl   Giorgio Maone <g.maone@informaction.com>
  43dnl   MSVC l10n compatible version check
  44dnl   Ben Turner <mozilla@songbirdnest.com>
  45dnl   Windows x64 support
  46dnl   Makoto Kato <m_kato@ga2.so-net.ne.jp>
  47dnl
  48dnl Alternatively, the contents of this file may be used under the terms of
  49dnl either the GNU General Public License Version 2 or later (the "GPL"), or
  50dnl the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  51dnl in which case the provisions of the GPL or the LGPL are applicable instead
  52dnl of those above. If you wish to allow use of your version of this file only
  53dnl under the terms of either the GPL or the LGPL, and not to allow others to
  54dnl use your version of this file under the terms of the MPL, indicate your
  55dnl decision by deleting the provisions above and replace them with the notice
  56dnl and other provisions required by the GPL or the LGPL. If you do not delete
  57dnl the provisions above, a recipient may use your version of this file under
  58dnl the terms of any one of the MPL, the GPL or the LGPL.
  59dnl
  60dnl ***** END LICENSE BLOCK *****
  61
  62dnl Process this file with autoconf to produce a configure script.
  63dnl ========================================================
  64
  65AC_PREREQ(2.13)
  66AC_INIT(jsapi.h)
  67AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
  68AC_CONFIG_HEADER(js-config.h)
  69AC_CANONICAL_SYSTEM
  70TARGET_CPU="${target_cpu}"
  71TARGET_VENDOR="${target_vendor}"
  72TARGET_OS="${target_os}"
  73
  74dnl ========================================================
  75dnl =
  76dnl = Don't change the following two lines.  Doing so breaks:
  77dnl =
  78dnl = CFLAGS="-foo" ./configure
  79dnl =
  80dnl ========================================================
  81CFLAGS="${CFLAGS=}"
  82CPPFLAGS="${CPPFLAGS=}"
  83CXXFLAGS="${CXXFLAGS=}"
  84LDFLAGS="${LDFLAGS=}"
  85HOST_CFLAGS="${HOST_CFLAGS=}"
  86HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
  87HOST_LDFLAGS="${HOST_LDFLAGS=}"
  88
  89dnl ========================================================
  90dnl = Preserve certain environment flags passed to configure
  91dnl = We want sub projects to receive the same flags
  92dnl = untainted by this configure script
  93dnl ========================================================
  94_SUBDIR_CC="$CC"
  95_SUBDIR_CXX="$CXX"
  96_SUBDIR_CFLAGS="$CFLAGS"
  97_SUBDIR_CPPFLAGS="$CPPFLAGS"
  98_SUBDIR_CXXFLAGS="$CXXFLAGS"
  99_SUBDIR_LDFLAGS="$LDFLAGS"
 100_SUBDIR_HOST_CC="$HOST_CC"
 101_SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
 102_SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
 103_SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
 104_SUBDIR_CONFIG_ARGS="$ac_configure_args"
 105
 106dnl Set the version number of the libs included with mozilla
 107dnl ========================================================
 108NSPR_VERSION=4
 109
 110dnl Set the minimum version of toolkit libs used by mozilla
 111dnl ========================================================
 112PERL_VERSION=5.006
 113PYTHON_VERSION=2.5
 114WINDRES_VERSION=2.14.90
 115W32API_VERSION=3.14
 116
 117MSMANIFEST_TOOL=
 118
 119dnl Set various checks
 120dnl ========================================================
 121MISSING_X=
 122AC_PROG_AWK
 123
 124dnl Initialize the Pthread test variables early so they can be
 125dnl  overridden by each platform.
 126dnl ========================================================
 127USE_PTHREADS=
 128_PTHREAD_LDFLAGS=""
 129
 130dnl Do not allow a separate objdir build if a srcdir build exists.
 131dnl ==============================================================
 132_topsrcdir=`cd \`dirname $0\`; pwd`
 133_objdir=`pwd`
 134
 135if test "$_topsrcdir" != "$_objdir"
 136then
 137  # Check for a couple representative files in the source tree
 138  _conflict_files=
 139  for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
 140    if test -f $file; then
 141      _conflict_files="$_conflict_files $file"
 142    fi
 143  done
 144  if test "$_conflict_files"; then
 145    echo "***"
 146    echo "*   Your source tree contains these files:"
 147    for file in $_conflict_files; do
 148      echo "*         $file"
 149    done
 150    cat 1>&2 <<-EOF
 151	*   This indicates that you previously built in the source tree.
 152	*   A source tree build can confuse the separate objdir build.
 153	*
 154	*   To clean up the source tree:
 155	*     1. cd $_topsrcdir
 156	*     2. gmake distclean
 157	***
 158	EOF
 159    exit 1
 160    break
 161  fi
 162fi
 163MOZ_BUILD_ROOT=`pwd`
 164
 165dnl Choose where to put the 'dist' directory.
 166dnl ==============================================================
 167
 168MOZ_ARG_WITH_STRING(dist-dir,
 169[  --with-dist-dir=DIR     Use DIR as 'dist' staging area.  DIR may be
 170                          relative to the top of SpiderMonkey build tree,
 171                          or absolute.],
 172    TOP_DIST=$withval,
 173    TOP_DIST=dist)
 174AC_SUBST(TOP_DIST)
 175
 176dnl Default to MSVC for win32
 177dnl ==============================================================
 178if test -z "$CROSS_COMPILE"; then
 179case "$target" in
 180*-mingw*)
 181    if test -z "$CC"; then CC=cl; fi
 182    if test -z "$CXX"; then CXX=cl; fi
 183    if test -z "$CPP"; then CPP="cl -E -nologo"; fi
 184    if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
 185    if test -z "$LD"; then LD=link; fi
 186    if test -z "$AS"; then
 187        case "${target_cpu}" in
 188        i*86)
 189            AS=ml;
 190            ;;
 191        x86_64)
 192            AS=ml64;
 193            ;;
 194        esac
 195    fi
 196    if test -z "$MIDL"; then MIDL=midl; fi
 197    ;;
 198*-darwin*)
 199    # prefer gcc-4.2 to default cc on older xcode
 200    MOZ_PATH_PROGS(CC, $CC gcc-4.2 gcc)
 201    MOZ_PATH_PROGS(CXX, $CXX g++-4.2 g++)
 202    ;;
 203esac
 204fi
 205
 206COMPILE_ENVIRONMENT=1
 207MOZ_ARG_DISABLE_BOOL(compile-environment,
 208[  --disable-compile-environment
 209                          Disable compiler/library checks.],
 210    COMPILE_ENVIRONMENT= )
 211AC_SUBST(COMPILE_ENVIRONMENT)
 212
 213dnl Check for Perl first -- needed for win32 SDK checks
 214MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
 215if test -z "$PERL" -o "$PERL" = ":"; then
 216    AC_MSG_ERROR([perl not found in \$PATH])
 217fi
 218
 219MOZ_ARG_ENABLE_BOOL(shared-js,
 220[  --disable-shared-js
 221                          Do not create a shared library.],
 222    DISABLE_SHARED_JS=0,
 223    DISABLE_SHARED_JS=1)
 224
 225if test "$DISABLE_SHARED_JS" = "1" ; then
 226  AC_DEFINE(STATIC_EXPORTABLE_JS_API)
 227else
 228  JS_SHARED_LIBRARY=1
 229fi
 230AC_SUBST(JS_SHARED_LIBRARY)
 231
 232dnl ========================================================
 233dnl = Android uses a very custom (hacky) toolchain; we need to do this
 234dnl = here, so that the compiler checks can succeed
 235dnl ========================================================
 236
 237MOZ_ARG_WITH_STRING(android-ndk,
 238[  --with-android-ndk=DIR
 239                          location where the Android NDK can be found],
 240    android_ndk=$withval)
 241
 242MOZ_ARG_WITH_STRING(android-toolchain,
 243[  --with-android-toolchain=DIR
 244                          location of the android toolchain, default NDK/build/prebuilt/HOST/arm-eabi-4.4.0],
 245    android_toolchain=$withval)
 246
 247
 248MOZ_ARG_WITH_STRING(android-version,
 249[  --with-android-version=VER
 250                          android platform version, default 5],
 251    android_version=$withval,
 252    android_version=5)
 253
 254MOZ_ARG_WITH_STRING(android-sdk,
 255[  --with-android-sdk=DIR
 256                          location where the Android SDK can be found (base directory, e.g. .../android/platforms/android-6)],
 257    android_sdk=$withval)
 258
 259MOZ_ARG_WITH_STRING(android-platform,
 260[  --with-android-platform=DIR
 261                           location of platform dir, default NDK/build/platforms/android-5/arch-arm],
 262    android_platform=$withval)
 263
 264MOZ_ARG_ENABLE_BOOL(android-libstdcxx,
 265[  --enable-android-libstdcxx
 266                          use GNU libstdc++ instead of STLPort for NDK >= 5],
 267    MOZ_ANDROID_LIBSTDCXX=1,
 268    MOZ_ANDROID_LIBSTDCXX= )
 269
 270case "$target" in
 271arm-linux*-android*|*-linuxandroid*)
 272    android_tool_prefix="arm-linux-androideabi"
 273    ;;
 274arm-android-eabi)
 275    android_tool_prefix="arm-eabi"
 276    ;;
 277i?86-*android*)
 278    android_tool_prefix="i686-android-linux"
 279    ;;
 280*)
 281    android_tool_prefix="$target_os"
 282    ;;
 283esac
 284
 285MOZ_ARG_WITH_STRING(gonk,
 286[  --with-gonk=DIR
 287               location of gonk dir],
 288    gonkdir=$withval)
 289
 290if test -n "$gonkdir" ; then
 291    kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
 292    gonk_toolchain="$gonkdir"/prebuilt/$kernel_name-x86/toolchain/arm-eabi-4.4.3
 293
 294    dnl set up compilers
 295    AS="$gonk_toolchain"/bin/"$android_tool_prefix"-as
 296    CC="$gonk_toolchain"/bin/"$android_tool_prefix"-gcc
 297    CXX="$gonk_toolchain"/bin/"$android_tool_prefix"-g++
 298    CPP="$gonk_toolchain"/bin/"$android_tool_prefix"-cpp
 299    LD="$gonk_toolchain"/bin/"$android_tool_prefix"-ld
 300    AR="$gonk_toolchain"/bin/"$android_tool_prefix"-ar
 301    RANLIB="$gonk_toolchain"/bin/"$android_tool_prefix"-ranlib
 302    STRIP="$gonk_toolchain"/bin/"$android_tool_prefix"-strip
 303
 304    STLPORT_CPPFLAGS="-I$gonkdir/external/stlport/stlport"
 305    STLPORT_LIBS="-lstlport"
 306
 307    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"
 308    CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
 309    CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions $CXXFLAGS"
 310    LIBS="$LIBS $STLPORT_LIBS"
 311
 312    dnl Add -llog by default, since we use it all over the place.
 313    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"
 314
 315    dnl prevent cross compile section from using these flags as host flags
 316    if test -z "$HOST_CPPFLAGS" ; then
 317        HOST_CPPFLAGS=" "
 318    fi
 319    if test -z "$HOST_CFLAGS" ; then
 320        HOST_CFLAGS=" "
 321    fi
 322    if test -z "$HOST_CXXFLAGS" ; then
 323        HOST_CXXFLAGS=" "
 324    fi
 325    if test -z "$HOST_LDFLAGS" ; then
 326        HOST_LDFLAGS=" "
 327    fi
 328
 329    # save these for libffi's subconfigure,
 330    # which doesn't know how to figure this stuff out on its own
 331    ANDROID_CFLAGS="$CFLAGS"
 332    ANDROID_CPPFLAGS="$CPPFLAGS"
 333    ANDROID_LDFLAGS="$LDFLAGS"
 334
 335    AC_DEFINE(ANDROID)
 336    AC_DEFINE(GONK)
 337    CROSS_COMPILE=1
 338else
 339case "$target" in
 340*-android*|*-linuxandroid*)
 341    if test -z "$android_ndk" ; then
 342        AC_MSG_ERROR([You must specify --with-android-ndk=/path/to/ndk when targeting Android.])
 343    fi
 344
 345    if test -z "$android_sdk" ; then
 346        AC_MSG_ERROR([You must specify --with-android-sdk=/path/to/sdk when targeting Android.])
 347    fi
 348
 349    android_platform_tools="$android_sdk"/../../platform-tools
 350    if test ! -d "$android_platform_tools" ; then
 351        android_platform_tools="$android_sdk"/tools # SDK Tools < r8
 352    else
 353        if ! test -e "$android_sdk"/source.properties ; then
 354            AC_MSG_ERROR([The path in --with-android-sdk isn't valid (source.properties hasn't been found).])
 355        fi
 356
 357        # Minimum Android SDK API Level we require.
 358        android_min_api_level=13
 359
 360        # Get the api level from "$android_sdk"/source.properties.
 361        android_api_level=`$AWK -F = '$1 == "AndroidVersion.ApiLevel" {print $2}' "$android_sdk"/source.properties`
 362
 363        if test -z "$android_api_level" ; then
 364            AC_MSG_ERROR([Unexpected error: no AndroidVersion.ApiLevel field has been found in source.properties.])
 365        fi
 366
 367        if ! test "$android_api_level" -eq "$android_api_level" ; then
 368            AC_MSG_ERROR([Unexpected error: the found android api value isn't a number! (found $android_api_level)])
 369        fi
 370
 371        if test $android_api_level -lt $android_min_api_level ; then
 372            AC_MSG_ERROR([The given Android SDK provides API level $android_api_level ($android_min_api_level or higher required).])
 373        fi
 374    fi
 375
 376    if test -z "$android_toolchain" ; then
 377        AC_MSG_CHECKING([for android toolchain directory])
 378
 379        kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
 380
 381        android_toolchain="$android_ndk"/build/prebuilt/$kernel_name-x86/arm-eabi-4.4.0
 382
 383        # With newer NDK, the toolchain path has changed.
 384        if ! test -d "$android_toolchain" ; then
 385            android_toolchain="$android_ndk"/toolchains/arm-$kernel_name-androideabi-4.4.3/prebuilt/$kernel_name-x86
 386        fi
 387
 388        if test -d "$android_toolchain" ; then
 389            AC_MSG_RESULT([$android_toolchain])
 390        else
 391            AC_MSG_ERROR([not found. You have to specify --with-android-toolchain=/path/to/ndk/toolchain.])
 392        fi
 393    fi
 394
 395    if test -z "$android_platform" ; then
 396        AC_MSG_CHECKING([for android platform directory])
 397
 398        android_platform="$android_ndk"/build/platforms/android-"$android_version"/arch-"$target_cpu"
 399
 400        # With newer NDK, the platform path has changed.
 401        if ! test -d "$android_platform" ; then
 402            android_platform="$android_ndk"/platforms/android-"$android_version"/arch-"$target_cpu"
 403        fi
 404
 405        if test -d "$android_platform" ; then
 406            AC_MSG_RESULT([$android_platform])
 407        else
 408            AC_MSG_ERROR([not found. You have to specify --with-android-platform=/path/to/ndk/platform.])
 409        fi
 410    fi
 411
 412    dnl set up compilers
 413    AS="$android_toolchain"/bin/"$android_tool_prefix"-as
 414    CC="$android_toolchain"/bin/"$android_tool_prefix"-gcc
 415    CXX="$android_toolchain"/bin/"$android_tool_prefix"-g++
 416    CPP="$android_toolchain"/bin/"$android_tool_prefix"-cpp
 417    LD="$android_toolchain"/bin/"$android_tool_prefix"-ld
 418    AR="$android_toolchain"/bin/"$android_tool_prefix"-ar
 419    RANLIB="$android_toolchain"/bin/"$android_tool_prefix"-ranlib
 420    STRIP="$android_toolchain"/bin/"$android_tool_prefix"-strip
 421
 422    CPPFLAGS="-I$android_platform/usr/include $CPPFLAGS"
 423    CFLAGS="-mandroid -I$android_platform/usr/include -fno-short-enums -fno-exceptions $CFLAGS"
 424    CXXFLAGS="-mandroid -I$android_platform/usr/include -fno-short-enums -fno-exceptions $CXXFLAGS"
 425
 426    dnl Add -llog by default, since we use it all over the place.
 427    dnl Add --allow-shlib-undefined, because libGLESv2 links to an
 428    dnl undefined symbol (present on the hardware, just not in the
 429    dnl NDK.)
 430    LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform -llog -Wl,--allow-shlib-undefined $LDFLAGS"
 431
 432    dnl prevent cross compile section from using these flags as host flags
 433    if test -z "$HOST_CPPFLAGS" ; then
 434        HOST_CPPFLAGS=" "
 435    fi
 436    if test -z "$HOST_CFLAGS" ; then
 437        HOST_CFLAGS=" "
 438    fi
 439    if test -z "$HOST_CXXFLAGS" ; then
 440        HOST_CXXFLAGS=" "
 441    fi
 442    if test -z "$HOST_LDFLAGS" ; then
 443        HOST_LDFLAGS=" "
 444    fi
 445
 446    ANDROID_NDK="${android_ndk}"
 447    ANDROID_TOOLCHAIN="${android_toolchain}"
 448    ANDROID_PLATFORM="${android_platform}"
 449    ANDROID_SDK="${android_sdk}"
 450    ANDROID_PLATFORM_TOOLS="${android_platform_tools}"
 451    ANDROID_VERSION="${android_version}"
 452
 453    AC_DEFINE(ANDROID)
 454    AC_DEFINE_UNQUOTED(ANDROID_VERSION, $android_version)
 455    AC_SUBST(ANDROID_VERSION)
 456    CROSS_COMPILE=1
 457    MOZ_CHROME_FILE_FORMAT=omni
 458    ;;
 459esac
 460
 461fi
 462
 463AC_SUBST(ANDROID_NDK)
 464AC_SUBST(ANDROID_TOOLCHAIN)
 465AC_SUBST(ANDROID_PLATFORM)
 466AC_SUBST(ANDROID_SDK)
 467AC_SUBST(ANDROID_PLATFORM_TOOLS)
 468
 469dnl ========================================================
 470dnl Checks for compilers.
 471dnl ========================================================
 472dnl Set CROSS_COMPILE in the environment when running configure
 473dnl to use the cross-compile setup for now
 474dnl ========================================================
 475
 476dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
 477AR_FLAGS='cr $@'
 478
 479if test "$COMPILE_ENVIRONMENT"; then
 480
 481# Note:
 482#   In Mozilla, we use the names $target, $host and $build incorrectly, but are
 483#   too far gone to back out now. See Bug 475488:
 484#     - When we say $target, we mean $host, that is, the system on which
 485#       Mozilla will be run.
 486#     - When we say $host, we mean $build, that is, the system on which Mozilla
 487#       is built.
 488#     - $target (in its correct usage) is for compilers who generate code for a
 489#       different platform than $host, so it would not be used by Mozilla.
 490if test "$target" != "$host"; then
 491    echo "cross compiling from $host to $target"
 492
 493    _SAVE_CC="$CC"
 494    _SAVE_CFLAGS="$CFLAGS"
 495    _SAVE_LDFLAGS="$LDFLAGS"
 496
 497    AC_MSG_CHECKING([for host c compiler])
 498    AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
 499    if test -z "$HOST_CC"; then
 500        AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
 501    fi
 502    AC_MSG_RESULT([$HOST_CC])
 503    AC_MSG_CHECKING([for host c++ compiler])
 504    AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
 505    if test -z "$HOST_CXX"; then
 506        AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
 507    fi
 508    AC_MSG_RESULT([$HOST_CXX])
 509
 510    if test -z "$HOST_CFLAGS"; then
 511        HOST_CFLAGS="$CFLAGS"
 512    fi
 513    if test -z "$HOST_CXXFLAGS"; then
 514        HOST_CXXFLAGS="$CXXFLAGS"
 515    fi
 516    if test -z "$HOST_LDFLAGS"; then
 517        HOST_LDFLAGS="$LDFLAGS"
 518    fi
 519    if test -z "$HOST_AR_FLAGS"; then
 520        HOST_AR_FLAGS="$AR_FLAGS"
 521    fi
 522    AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
 523    AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
 524    CC="$HOST_CC"
 525    CFLAGS="$HOST_CFLAGS"
 526    LDFLAGS="$HOST_LDFLAGS"
 527
 528    AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
 529    AC_TRY_COMPILE([], [return(0);],
 530	[ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
 531	AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
 532
 533    CC="$HOST_CXX"
 534    CFLAGS="$HOST_CXXFLAGS"
 535
 536    AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
 537    AC_TRY_COMPILE([], [return(0);],
 538	[ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
 539	AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
 540
 541    CC=$_SAVE_CC
 542    CFLAGS=$_SAVE_CFLAGS
 543    LDFLAGS=$_SAVE_LDFLAGS
 544
 545    AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
 546    unset ac_cv_prog_CC
 547    AC_PROG_CC
 548    AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
 549    unset ac_cv_prog_CXX
 550    AC_PROG_CXX
 551
 552    AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
 553    AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
 554    MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
 555    AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
 556    AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
 557    AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
 558    AC_DEFINE(CROSS_COMPILE)
 559
 560    dnl If we cross compile for ppc on Mac OS X x86, cross_compiling will
 561    dnl have erroneously been set to "no", because the x86 build host is
 562    dnl able to run ppc code in a translated environment, making a cross
 563    dnl compiler appear native.  So we override that here.
 564    cross_compiling=yes
 565else
 566    AC_PROG_CC
 567    AC_PROG_CXX
 568    AC_PROG_RANLIB
 569    MOZ_PATH_PROGS(AS, $AS as, $CC)
 570    AC_CHECK_PROGS(AR, ar, :)
 571    AC_CHECK_PROGS(LD, ld, :)
 572    AC_CHECK_PROGS(STRIP, strip, :)
 573    AC_CHECK_PROGS(WINDRES, windres, :)
 574    if test -z "$HOST_CC"; then
 575        HOST_CC='$(CC)'
 576    fi
 577    if test -z "$HOST_CFLAGS"; then
 578        HOST_CFLAGS='$(CFLAGS)'
 579    fi
 580    if test -z "$HOST_CXX"; then
 581        HOST_CXX='$(CXX)'
 582    fi
 583    if test -z "$HOST_CXXFLAGS"; then
 584        HOST_CXXFLAGS='$(CXXFLAGS)'
 585    fi
 586    if test -z "$HOST_LDFLAGS"; then
 587        HOST_LDFLAGS='$(LDFLAGS)'
 588    fi
 589    if test -z "$HOST_RANLIB"; then
 590        HOST_RANLIB='$(RANLIB)'
 591    fi
 592    if test -z "$HOST_AR"; then
 593        HOST_AR='$(AR)'
 594    fi
 595    if test -z "$HOST_AR_FLAGS"; then
 596        HOST_AR_FLAGS='$(AR_FLAGS)'
 597    fi
 598fi
 599
 600GNU_AS=
 601GNU_LD=
 602GNU_CC=
 603GNU_CXX=
 604CC_VERSION='N/A'
 605CXX_VERSION='N/A'
 606if test "$GCC" = "yes"; then
 607    GNU_CC=1
 608    CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
 609fi
 610if test "$GXX" = "yes"; then
 611    GNU_CXX=1
 612    CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
 613fi
 614if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
 615    GNU_AS=1
 616fi
 617if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
 618    GNU_LD=1
 619fi
 620if test "$GNU_CC"; then
 621    if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
 622        GCC_USE_GNU_LD=1
 623    fi
 624fi
 625
 626INTEL_CC=
 627INTEL_CXX=
 628if test "$GCC" = yes; then
 629   if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
 630     INTEL_CC=1
 631   fi
 632fi
 633
 634if test "$GXX" = yes; then
 635   if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
 636     INTEL_CXX=1
 637   fi
 638fi
 639
 640CLANG_CC=
 641CLANG_CXX=
 642if test "$GCC" = yes; then
 643   if test "`$CC -v 2>&1 | grep -c 'clang version'`" != "0"; then
 644     CLANG_CC=1
 645   fi
 646fi
 647
 648if test "$GXX" = yes; then
 649   if test "`$CXX -v 2>&1 | grep -c 'clang version'`" != "0"; then
 650     CLANG_CXX=1
 651   fi
 652fi
 653
 654dnl Special win32 checks
 655dnl ========================================================
 656WINVER=502
 657dnl Target the Windows 7 SDK by default
 658WINSDK_TARGETVER=601
 659
 660MOZ_ARG_WITH_STRING(windows-version,
 661[  --with-windows-version=WINSDK_TARGETVER
 662                          Highest Windows version to target using this SDK
 663                              601: Windows 7],
 664  WINSDK_TARGETVER=$withval)
 665
 666case "$WINSDK_TARGETVER" in
 667601)
 668    MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
 669    ;;
 670
 671*)
 672    AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER), must be 601]);
 673    ;;
 674
 675esac
 676
 677case "$target" in
 678*-mingw*)
 679    if test "$GCC" != "yes"; then
 680        # Check to see if we are really running in a msvc environemnt
 681        _WIN32_MSVC=1
 682
 683        # Make sure compilers are valid
 684        CFLAGS="$CFLAGS -TC -nologo"
 685        CXXFLAGS="$CXXFLAGS -TP -nologo"
 686        # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
 687        # _CRT_SECURE_NO_WARNINGS disables warnings about using MSVC-specific
 688        # secure CRT functions.
 689        CXXFLAGS="$CXXFLAGS -wd4345 -D_CRT_SECURE_NO_WARNINGS"
 690        AC_LANG_SAVE
 691        AC_LANG_C
 692        AC_TRY_COMPILE([#include <stdio.h>],
 693            [ printf("Hello World\n"); ],,
 694            AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
 695
 696        AC_LANG_CPLUSPLUS
 697        AC_TRY_COMPILE([#include <new.h>],
 698            [ unsigned *test = new unsigned(42); ],,
 699            AC_MSG_ERROR([\$(CXX) test failed.  You must have MS VC++ in your path to build.]) )
 700        AC_LANG_RESTORE
 701
 702        changequote(,)
 703        _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
 704        changequote([,])
 705
 706        # Determine compiler version
 707        CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
 708        _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
 709        _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
 710        _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
 711        _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
 712        _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
 713
 714        CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
 715        _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
 716
 717        if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
 718            AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
 719        fi
 720
 721        if test "$_CC_MAJOR_VERSION" = "14"; then
 722            dnl Require VC8SP1 or newer.
 723            dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762.
 724            if test "$_CC_RELEASE" -lt 50727 -o \
 725                    \( "$_CC_RELEASE" -eq 50727 -a "$_CC_BUILD" -lt 762 \); then
 726              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.])
 727            fi
 728
 729            _CC_SUITE=8
 730            AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
 731            AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
 732        elif test "$_CC_MAJOR_VERSION" = "15"; then
 733            _CC_SUITE=9
 734            AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
 735            AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
 736        elif test "$_CC_MAJOR_VERSION" = "16"; then
 737            _CC_SUITE=10
 738            AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
 739            AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
 740        elif test "$_CC_MAJOR_VERSION" = "17"; then
 741            _CC_SUITE=11
 742            AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
 743            AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
 744        else
 745            AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
 746        fi
 747
 748        _MOZ_RTTI_FLAGS_ON='-GR'
 749        _MOZ_RTTI_FLAGS_OFF='-GR-'
 750
 751        dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
 752        dnl not something else like "magnetic tape manipulation utility".
 753        MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
 754        if test -z "$MSMT_TOOL"; then
 755          AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
 756        fi
 757
 758        changequote(,)
 759        _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
 760        changequote([,])
 761        MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
 762        if test -z "$MSMANIFEST_TOOL_VERSION"; then
 763          AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
 764        fi
 765
 766        MSMANIFEST_TOOL=1
 767        unset MSMT_TOOL
 768
 769        # Check linker version
 770        _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
 771        _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
 772        if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
 773            AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
 774        fi
 775
 776        INCREMENTAL_LINKER=1
 777
 778        # Identify which version of the SDK we're building with
 779        # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
 780        # from there
 781        MOZ_CHECK_HEADERS([winsdkver.h])
 782        if test "$ac_cv_header_winsdkver_h" = "yes"; then
 783            # Get the highest _WIN32_WINNT and NTDDI versions supported
 784            # Take the higher of the two
 785            # This is done because the Windows 7 beta SDK reports its
 786            # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
 787            AC_CACHE_CHECK(for highest Windows version supported by this SDK,
 788                           ac_cv_winsdk_maxver,
 789                           [cat > conftest.h <<EOF
 790#include <winsdkver.h>
 791#include <sdkddkver.h>
 792
 793#if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
 794#define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
 795#else
 796#define WINSDK_MAXVER NTDDI_MAXVER
 797#endif
 798
 799WINSDK_MAXVER
 800EOF
 801                            ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
 802                            rm -f conftest.h
 803                           ])
 804            MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
 805        else
 806            # Any SDK which doesn't have WinSDKVer.h is too old.
 807            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.])
 808        fi
 809
 810        unset _MSVC_VER_FILTER
 811
 812        AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
 813            [
 814                AC_LANG_SAVE
 815                AC_LANG_CPLUSPLUS
 816                _SAVE_CXXFLAGS="$CXXFLAGS"
 817                CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
 818                AC_TRY_COMPILE([#include <exception>],
 819                            [std::_Throw(std::exception()); return 0;],
 820                            ac_cv_have_std__Throw="yes",
 821                            ac_cv_have_std__Throw="no")
 822                CXXFLAGS="$_SAVE_CXXFLAGS"
 823                AC_LANG_RESTORE
 824            ])
 825
 826        if test "$ac_cv_have_std__Throw" == "yes"; then
 827            AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
 828                           ac_cv_have_dllimport_exception_bug,
 829                [
 830                    AC_LANG_SAVE
 831                    AC_LANG_CPLUSPLUS
 832                    _SAVE_CXXFLAGS="$CXXFLAGS"
 833                    CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
 834                    AC_TRY_LINK([#include <vector>],
 835                                [std::vector<int> v; return v.at(1);],
 836                                ac_cv_have_dllimport_exception_bug="no",
 837                                ac_cv_have_dllimport_exception_bug="yes")
 838                    CXXFLAGS="$_SAVE_CXXFLAGS"
 839                    AC_LANG_RESTORE
 840                ])
 841            if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
 842                WRAP_STL_INCLUDES=1
 843                MOZ_MSVC_STL_WRAP__Throw=1
 844                AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
 845            fi
 846        else
 847            AC_CACHE_CHECK(for overridable _RAISE,
 848                           ac_cv_have__RAISE,
 849                [
 850                    AC_LANG_SAVE
 851                    AC_LANG_CPLUSPLUS
 852                    _SAVE_CXXFLAGS="$CXXFLAGS"
 853                    CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
 854                    AC_TRY_COMPILE([#include <xstddef>
 855                                    #undef _RAISE
 856                                    #define _RAISE(x) externallyDefinedFunction((x).what())
 857                                    #include <vector>
 858                                   ],
 859                                   [std::vector<int> v; return v.at(1);],
 860                                   ac_cv_have__RAISE="no",
 861                                   ac_cv_have__RAISE="yes")
 862                    CXXFLAGS="$_SAVE_CXXFLAGS"
 863                    AC_LANG_RESTORE
 864                ])
 865            if test "$ac_cv_have__RAISE" = "yes"; then
 866                WRAP_STL_INCLUDES=1
 867                MOZ_MSVC_STL_WRAP__RAISE=1
 868                AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
 869            else
 870                AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK.  Please file a bug describing this error and your build configuration.])
 871            fi
 872        fi
 873
 874        if test "$WRAP_STL_INCLUDES" = "1"; then
 875            STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
 876        fi
 877    else
 878        # Check w32api version
 879        _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
 880        _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
 881        AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
 882        AC_TRY_COMPILE([#include <w32api.h>],
 883            #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
 884                (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
 885                 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
 886                #error "test failed."
 887            #endif
 888            , [ res=yes ], [ res=no ])
 889        AC_MSG_RESULT([$res])
 890        if test "$res" != "yes"; then
 891            AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
 892        fi
 893        # Check windres version
 894        AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
 895        _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
 896        AC_MSG_RESULT([$_WINDRES_VERSION])
 897        _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
 898        _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
 899        _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
 900        WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
 901        WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
 902        WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
 903        if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
 904                "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
 905                "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
 906                "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
 907                "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
 908                "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
 909        then
 910            AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
 911        fi
 912
 913        MOZ_WINSDK_MAXVER=0x06010000
 914    fi # !GNU_CC
 915
 916    AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
 917    AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
 918    # Require OS features provided by IE 5.0
 919    AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
 920
 921    # If the maximum version supported by this SDK is lower than the target
 922    # version, error out
 923    AC_MSG_CHECKING([for Windows SDK being recent enough])
 924    if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
 925        AC_MSG_RESULT("yes")
 926    else
 927        AC_MSG_RESULT("no")
 928        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.])
 929    fi
 930
 931    AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
 932    # Definitions matching sdkddkver.h
 933    AC_DEFINE_UNQUOTED(MOZ_NTDDI_WS03, 0x05020000)
 934    AC_DEFINE_UNQUOTED(MOZ_NTDDI_LONGHORN, 0x06000000)
 935    AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
 936    ;;
 937esac
 938
 939AC_PROG_CPP
 940AC_PROG_CXXCPP
 941
 942if test -n "$_WIN32_MSVC"; then
 943    SKIP_PATH_CHECKS=1
 944    SKIP_COMPILER_CHECKS=1
 945    SKIP_LIBRARY_CHECKS=1
 946
 947    # Since we're skipping compiler and library checks, hard-code
 948    # some facts here.
 949
 950    # Common to all MSVC environments:
 951
 952    # Windows lacks <stdint.h>, but has __int8, and so on.
 953    AC_DEFINE(JS_HAVE___INTN)
 954    AC_DEFINE(HAVE_LOCALECONV)
 955    AC_DEFINE(HAVE_SYSTEMTIMETOFILETIME)
 956    AC_DEFINE(HAVE_GETSYSTEMTIMEASFILETIME)
 957
 958    # Windows <stddef.h> defines intptr_t and uintptr_t.
 959    # VS2005: http://msdn.microsoft.com/en-us/library/323b6b3k(VS.80).aspx
 960    # VS2008: http://msdn.microsoft.com/en-us/library/323b6b3k.aspx
 961    AC_DEFINE(JS_STDDEF_H_HAS_INTPTR_T)
 962fi
 963
 964fi # COMPILE_ENVIRONMENT
 965
 966if test "$cross_compiling"  = "yes"; then
 967    CROSS_COMPILE=1
 968else
 969    CROSS_COMPILE=
 970fi
 971
 972# Check to see if we are running in a broken QEMU scratchbox.
 973# We know that anything below 1.0.16 is broken.
 974AC_CHECK_PROGS(SBCONF, sb-conf ve, "")
 975if test -n "$SBCONF"; then
 976    _sb_version=`$SBCONF ve`
 977    _sb_version_major=`echo $_sb_version | cut -f1 -d.`
 978    _sb_version_minor=`echo $_sb_version | cut -f2 -d.`
 979    _sb_version_point=`echo $_sb_version | cut -f3 -d.`
 980    if test $_sb_version_major -eq 1 -a $_sb_version_minor -eq 0 -a $_sb_version_point -le 16; then
 981        QEMU_CANT_RUN_JS_SHELL=1
 982    fi
 983fi
 984AC_SUBST(QEMU_CANT_RUN_JS_SHELL)
 985
 986AC_SUBST(_MSC_VER)
 987
 988AC_SUBST(GNU_AS)
 989AC_SUBST(GNU_LD)
 990AC_SUBST(GNU_CC)
 991AC_SUBST(GNU_CXX)
 992AC_SUBST(INTEL_CC)
 993AC_SUBST(INTEL_CXX)
 994
 995AC_SUBST(STL_FLAGS)
 996AC_SUBST(WRAP_STL_INCLUDES)
 997AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
 998AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
 999
1000dnl ========================================================
1001dnl Checks for programs.
1002dnl ========================================================
1003AC_PROG_INSTALL
1004AC_PROG_LN_S
1005
1006if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
1007AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
1008_perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
1009_perl_res=$?
1010AC_MSG_RESULT([$_perl_version])
1011
1012if test "$_perl_res" != 0; then
1013    AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
1014fi
1015fi
1016
1017AC_MSG_CHECKING([for full perl installation])
1018_perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
1019_perl_res=$?
1020if test "$_perl_res" != 0; then
1021    AC_MSG_RESULT([no])
1022    AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
1023else
1024    AC_MSG_RESULT([yes])
1025fi
1026
1027MOZ_PATH_PROGS(PYTHON, $PYTHON python2.7 python2.6 python2.5 python)
1028if test -z "$PYTHON"; then
1029    AC_MSG_ERROR([python was not found in \$PATH])
1030fi
1031
1032if test -z "$COMPILE_ENVIRONMENT"; then
1033    NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
1034fi
1035AC_SUBST(NSINSTALL_BIN)
1036
1037MOZ_PATH_PROG(DOXYGEN, doxygen, :)
1038MOZ_PATH_PROG(AUTOCONF, autoconf, :)
1039MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
1040MOZ_PATH_PROG(XARGS, xargs)
1041if test -z "$XARGS" -o "$XARGS" = ":"; then
1042    AC_MSG_ERROR([xargs not found in \$PATH .])
1043fi
1044
1045if test "$COMPILE_ENVIRONMENT"; then
1046
1047dnl ========================================================
1048dnl = Mac OS X toolchain support
1049dnl ========================================================
1050
1051case "$target_os" in
1052darwin*)
1053    dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
1054    dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
1055    dnl the environment and includedir purposes (when using an SDK, below),
1056    dnl but remember the full version number for the libdir (SDK).
1057    changequote(,)
1058    GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
1059    GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
1060    changequote([,])
1061    if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1062        dnl Bug 280479, but this keeps popping up in bug 292530 too because
1063        dnl 4.0.0/4061 is the default compiler in Tiger.
1064        changequote(,)
1065        GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
1066        changequote([,])
1067        if test "$GCC_BUILD" = "4061" ; then
1068            AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
1069This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
1070from building Mozilla. Upgrade to Xcode 2.1 or later.])
1071        fi
1072    fi
1073
1074    dnl xcodebuild needs GCC_VERSION defined in the environment, since it
1075    dnl doesn't respect the CC/CXX setting.  With GCC_VERSION set, it will use
1076    dnl /usr/bin/g(cc|++)-$GCC_VERSION.
1077    MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
1078
1079    dnl sdp was formerly in /Developer/Tools.  As of Mac OS X 10.4 (Darwin 8),
1080    dnl it has moved into /usr/bin.
1081    MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
1082    ;;
1083esac
1084
1085AC_SUBST(GCC_VERSION)
1086
1087dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
1088dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
1089dnl when we can run target binaries.
1090AC_SUBST(UNIVERSAL_BINARY)
1091AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
1092
1093dnl ========================================================
1094dnl Check for MacOS deployment target version
1095dnl ========================================================
1096
1097MOZ_ARG_ENABLE_STRING(macos-target,
1098                      [  --enable-macos-target=VER (default=10.5)
1099                          Set the minimum MacOS version needed at runtime],
1100                      [_MACOSX_DEPLOYMENT_TARGET=$enableval])
1101
1102if test "$target_cpu" != "arm"; then
1103case "$target" in
1104*-darwin*)
1105    if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
1106        dnl Use the specified value
1107        export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
1108    else
1109        dnl No value specified on the command line or in the environment,
1110        dnl use architecture minimum.
1111        case "${target_cpu}" in
1112          i*86)
1113            export MACOSX_DEPLOYMENT_TARGET=10.5
1114            ;;
1115          x86_64)
1116            export MACOSX_DEPLOYMENT_TARGET=10.6
1117            ;;
1118        esac
1119    fi
1120    ;;
1121esac
1122fi
1123
1124AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
1125
1126dnl ========================================================
1127dnl = Mac OS X SDK support
1128dnl ========================================================
1129MACOS_SDK_DIR=
1130NEXT_ROOT=
1131MOZ_ARG_WITH_STRING(macos-sdk,
1132[  --with-macos-sdk=dir    Location of platform SDK to use (Mac OS X only)],
1133    MACOS_SDK_DIR=$withval)
1134
1135dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
1136dnl NEXT_ROOT will be set and exported only if it's needed.
1137AC_SUBST(MACOS_SDK_DIR)
1138AC_SUBST(NEXT_ROOT)
1139
1140if test "$MACOS_SDK_DIR"; then
1141  dnl Sync this section with the ones in NSPR and NSS.
1142  dnl Changes to the cross environment here need to be accounted for in
1143  dnl the libIDL checks (below) and xpidl build.
1144
1145  if test ! -d "$MACOS_SDK_DIR"; then
1146    AC_MSG_ERROR([SDK not found.  When using --with-macos-sdk, you must
1147specify a valid SDK.  SDKs are installed when the optional cross-development
1148tools are selected during the Xcode/Developer Tools installation.])
1149  fi
1150
1151  GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
1152  if test "$GCC_VERSION_MAJOR" -lt "4" ; then
1153    AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
1154  else
1155    CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
1156    CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
1157
1158    dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
1159    CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
1160    CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
1161
1162    if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1163      dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
1164      dnl that supports -syslibroot.  Don't set NEXT_ROOT because it will
1165      dnl be ignored and cause warnings when -syslibroot is specified.
1166      dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
1167      dnl the -isysroot it receives, so this is only needed with 4.0.0.
1168      LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
1169    fi
1170  fi
1171
1172  AC_LANG_SAVE
1173  AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
1174  AC_LANG_CPLUSPLUS
1175  AC_TRY_COMPILE([#include <new>
1176                 int main() { return 0; }],
1177   result=yes,
1178   result=no)
1179  AC_LANG_RESTORE
1180  AC_MSG_RESULT($result)
1181
1182  if test "$result" = "no" ; then
1183    AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
1184  fi
1185fi
1186
1187fi # COMPILE_ENVIRONMENT
1188
1189if test -n "$MAKE"; then
1190  if test `echo $MAKE | grep -c make.py` != 1; then
1191     NOT_PYMAKE=$MAKE
1192  fi
1193fi
1194
1195case "$host_os" in
1196mingw*)
1197    MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
1198    ;;
1199*)
1200    MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
1201    ;;
1202esac
1203if test "$GMAKE" = ":"; then
1204   AC_MSG_ERROR([GNU make not found])
1205fi
1206AC_SUBST(GMAKE)
1207
1208# MAKE will be set by client.mk, but still need this for standalone js builds
1209if test -z "$MAKE"; then
1210  MAKE=$GMAKE
1211fi
1212
1213if test "$COMPILE_ENVIRONMENT"; then
1214
1215AC_PATH_XTRA
1216
1217XCFLAGS="$X_CFLAGS"
1218
1219fi # COMPILE_ENVIRONMENT
1220
1221dnl ========================================================
1222dnl set the defaults first
1223dnl ========================================================
1224AS_BIN=$AS
1225AR_LIST='$(AR) t'
1226AR_EXTRACT='$(AR) x'
1227AR_DELETE='$(AR) d'
1228AS='$(CC)'
1229AS_DASH_C_FLAG='-c'
1230DLL_PREFIX=lib
1231LIB_PREFIX=lib
1232DLL_SUFFIX=.so
1233OBJ_SUFFIX=o
1234LIB_SUFFIX=a
1235ASM_SUFFIX=s
1236IMPORT_LIB_SUFFIX=
1237TARGET_MD_ARCH=unix
1238DIRENT_INO=d_ino
1239WIN_TOP_SRC=
1240MOZ_USER_DIR=".mozilla"
1241
1242MOZ_JS_LIBS='-L$(libdir) -lmozjs'
1243MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1244
1245MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1246
1247USE_DEPENDENT_LIBS=1
1248
1249_PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1250
1251if test -n "$CROSS_COMPILE"; then
1252    OS_TARGET="${target_os}"
1253    OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1254    OS_RELEASE=
1255    case "${target_os}" in
1256        linux*)       OS_ARCH=Linux OS_TARGET=Linux ;;
1257        kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1258        gnu*)         OS_ARCH=GNU ;;
1259        solaris*)     OS_ARCH=SunOS OS_RELEASE=5 ;;
1260        mingw*)       OS_ARCH=WINNT OS_TARGET=WINNT ;;
1261        darwin*)      OS_ARCH=Darwin OS_TARGET=Darwin ;;
1262    esac
1263    case "${target}" in
1264        *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
1265    esac
1266else
1267    OS_TARGET=`uname -s`
1268    OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1269    OS_RELEASE=`uname -r`
1270fi
1271
1272# Before this used `uname -m` when not cross compiling
1273# but that breaks when you have a 64 bit kernel with a 32 bit userland.
1274OS_TEST="${target_cpu}"
1275
1276HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1277
1278#######################################################################
1279# Master "Core Components" macros for getting the OS target           #
1280#######################################################################
1281
1282#
1283# If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1284# cross-compilation.
1285#
1286
1287#
1288# Define and override various archtecture-specific variables, including
1289# HOST_OS_ARCH
1290# OS_ARCH
1291# OS_TEST
1292# OS_TARGET
1293# OS_RELEASE
1294# OS_MINOR_RELEASE
1295#
1296
1297case "$HOST_OS_ARCH" in
1298mingw*)
1299    HOST_OS_ARCH=WINNT
1300    ;;
1301darwin*)
1302    HOST_OS_ARCH=Darwin
1303    ;;
1304linux*)
1305    HOST_OS_ARCH=Linux
1306    ;;
1307solaris*)
1308    HOST_OS_ARCH=SunOS
1309    SOLARIS_SUNPRO_CC=
1310    SOLARIS_SUNPRO_CXX=
1311    if test -z "$GNU_CC"; then
1312        if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1313            SOLARIS_SUNPRO_CC=1
1314       fi
1315    fi
1316
1317    if test -z "$GNU_CXX"; then
1318       if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1319           SOLARIS_SUNPRO_CXX=1
1320       fi
1321    fi
1322    AC_SUBST(SOLARIS_SUNPRO_CC)
1323    AC_SUBST(SOLARIS_SUNPRO_CXX)
1324    ;;
1325BSD_386)
1326    HOST_OS_ARCH=BSD
1327    ;;
1328OS_2)
1329    HOST_OS_ARCH=OS2
1330    ;;
1331esac
1332
1333case "$OS_ARCH" in
1334WINNT)
1335    if test -z "$CROSS_COMPILE" ; then
1336        OS_TEST=`uname -p`
1337    fi
1338    ;;
1339Windows_NT)
1340#
1341# If uname -s returns "Windows_NT", we assume that we are using
1342# the uname.exe in MKS toolkit.
1343#
1344# The -r option of MKS uname only returns the major version number.
1345# So we need to use its -v option to get the minor version number.
1346# Moreover, it doesn't have the -p option, so we need to use uname -m.
1347#
1348    OS_ARCH=WINNT
1349    OS_TARGET=WINNT
1350    OS_MINOR_RELEASE=`uname -v`
1351    if test "$OS_MINOR_RELEASE" = "00"; then
1352        OS_MINOR_RELEASE=0
1353    fi
1354    OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1355    ;;
1356MINGW*_NT*)
1357#
1358# If uname -s returns MINGW32_NT-5.1, we assume that we are using
1359# the uname.exe in the MSYS tools.
1360#
1361    OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1362    OS_ARCH=WINNT
1363    OS_TARGET=WINNT
1364    ;;
1365AIX)
1366    OS_RELEASE=`uname -v`.`uname -r`
1367    OS_TEST=${target_cpu}
1368    if test -z "$GNU_CC"; then
1369        if test "`$CC -qversion 2>&1 | egrep -c 'IBM XL'`" != "0"; then
1370            AIX_IBM_XLC=1
1371        fi
1372    fi
1373    ;;
1374BSD_386)
1375    OS_ARCH=BSD
1376    ;;
1377OS_2)
1378    OS_ARCH=OS2
1379    OS_TARGET=OS2
1380    OS_RELEASE=`uname -v`
1381    ;;
1382Darwin)
1383    case "${target_cpu}" in
1384    powerpc*)
1385        OS_TEST=ppc
1386        ;;
1387    i*86*)
1388        OS_TEST=i386
1389        ;;
1390    x86_64)
1391        OS_TEST=x86_64
1392        ;;
1393    *)
1394        if test -z "$CROSS_COMPILE" ; then
1395            OS_TEST=`uname -p`
1396        fi
1397        ;;
1398    esac
1399    ;;
1400esac
1401
1402# Only set CPU_ARCH if we recognize the value of OS_TEST
1403
1404case "$OS_TEST" in
1405*86 | i86pc)
1406    CPU_ARCH=x86
1407    ;;
1408
1409powerpc64 | ppc64)
1410    CPU_ARCH=ppc64
1411    ;;
1412
1413powerpc | ppc | rs6000)
1414    CPU_ARCH=ppc
1415    ;;
1416
1417Alpha | alpha | ALPHA)
1418    CPU_ARCH=Alpha
1419    ;;
1420
1421s390)
1422    CPU_ARCH=s390
1423    ;;
1424
1425s390x)
1426    CPU_ARCH=s390x
1427    ;;
1428
1429hppa* | parisc)
1430    CPU_ARCH=hppa
1431    ;;
1432
1433sun4u | sparc*)
1434    CPU_ARCH=sparc
1435    ;;
1436
1437x86_64 | ia64)
1438    CPU_ARCH="$OS_TEST"
1439    ;;
1440
1441arm*)
1442    CPU_ARCH=arm
1443    ;;
1444
1445mips|mipsel)
1446    CPU_ARCH="mips"
1447    ;;
1448esac
1449
1450if test -z "$OS_TARGET"; then
1451    OS_TARGET=$OS_ARCH
1452fi
1453OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1454
1455dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1456dnl ===============================================================
1457INTEL_ARCHITECTURE=
1458case "$OS_TEST" in
1459    x86_64|i?86)
1460      INTEL_ARCHITECTURE=1
1461esac
1462
1463dnl ========================================================
1464dnl = ARM toolchain tweaks
1465dnl ========================================================
1466
1467dnl Defaults
1468case "${CPU_ARCH}-${OS_TARGET}" in
1469arm-Android)
1470    MOZ_THUMB=yes
1471    MOZ_ARCH=armv7-a
1472    MOZ_FPU=vfp
1473    MOZ_FLOAT_ABI=softfp
1474    ;;
1475arm-Darwin)
1476    MOZ_THUMB=yes
1477    ;;
1478arm-*)
1479    if test -n "$MOZ_PLATFORM_MAEMO"; then
1480        MOZ_THUMB=no
1481        MOZ_ARCH=armv7-a
1482        MOZ_FLOAT_ABI=softfp
1483    fi
1484    if test "$MOZ_PLATFORM_MAEMO" = 6; then
1485        MOZ_THUMB=yes
1486    fi
1487    ;;
1488esac
1489
1490dnl Kept for compatibility with some buildbot mozconfig
1491MOZ_ARG_DISABLE_BOOL(thumb2, [], MOZ_THUMB=no, MOZ_THUMB=yes)
1492
1493MOZ_ARG_WITH_STRING(thumb,
1494[  --with-thumb[[=yes|no|toolchain-default]]]
1495[                          Use Thumb instruction set (-mthumb)…

Large files files are truncated, but you can click here to view the full file