js/src/configure.in

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
michael@0 2 dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
michael@0 3 dnl This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
michael@0 6
michael@0 7 dnl Process this file with autoconf to produce a configure script.
michael@0 8 dnl ========================================================
michael@0 9
michael@0 10 AC_PREREQ(2.13)
michael@0 11 AC_INIT(js/src/jsapi.h)
michael@0 12 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
michael@0 13 AC_CANONICAL_SYSTEM
michael@0 14 TARGET_CPU="${target_cpu}"
michael@0 15 TARGET_VENDOR="${target_vendor}"
michael@0 16 TARGET_OS="${target_os}"
michael@0 17
michael@0 18 dnl ========================================================
michael@0 19 dnl =
michael@0 20 dnl = Don't change the following two lines. Doing so breaks:
michael@0 21 dnl =
michael@0 22 dnl = CFLAGS="-foo" ./configure
michael@0 23 dnl =
michael@0 24 dnl ========================================================
michael@0 25 CFLAGS="${CFLAGS=}"
michael@0 26 CPPFLAGS="${CPPFLAGS=}"
michael@0 27 CXXFLAGS="${CXXFLAGS=}"
michael@0 28 LDFLAGS="${LDFLAGS=}"
michael@0 29 HOST_CFLAGS="${HOST_CFLAGS=}"
michael@0 30 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
michael@0 31 HOST_LDFLAGS="${HOST_LDFLAGS=}"
michael@0 32
michael@0 33 dnl ========================================================
michael@0 34 dnl = Preserve certain environment flags passed to configure
michael@0 35 dnl = We want sub projects to receive the same flags
michael@0 36 dnl = untainted by this configure script
michael@0 37 dnl ========================================================
michael@0 38 _SUBDIR_CC="$CC"
michael@0 39 _SUBDIR_CXX="$CXX"
michael@0 40 _SUBDIR_CFLAGS="$CFLAGS"
michael@0 41 _SUBDIR_CPPFLAGS="$CPPFLAGS"
michael@0 42 _SUBDIR_CXXFLAGS="$CXXFLAGS"
michael@0 43 _SUBDIR_LDFLAGS="$LDFLAGS"
michael@0 44 _SUBDIR_HOST_CC="$HOST_CC"
michael@0 45 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
michael@0 46 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
michael@0 47 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
michael@0 48 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
michael@0 49
michael@0 50 dnl Set the version number of the libs included with mozilla
michael@0 51 dnl ========================================================
michael@0 52 NSPR_VERSION=4
michael@0 53 NSPR_MINVER=4.9.2
michael@0 54
michael@0 55 dnl Set the minimum version of toolkit libs used by mozilla
michael@0 56 dnl ========================================================
michael@0 57 PERL_VERSION=5.006
michael@0 58 WINDRES_VERSION=2.14.90
michael@0 59 W32API_VERSION=3.14
michael@0 60
michael@0 61 MSMANIFEST_TOOL=
michael@0 62
michael@0 63 dnl Set various checks
michael@0 64 dnl ========================================================
michael@0 65 MISSING_X=
michael@0 66 AC_PROG_AWK
michael@0 67
michael@0 68 dnl Initialize the Pthread test variables early so they can be
michael@0 69 dnl overridden by each platform.
michael@0 70 dnl ========================================================
michael@0 71 USE_PTHREADS=
michael@0 72 _PTHREAD_LDFLAGS=""
michael@0 73
michael@0 74 dnl Do not allow a separate objdir build if a srcdir build exists.
michael@0 75 dnl ==============================================================
michael@0 76 _topsrcdir=`cd $srcdir; pwd`
michael@0 77 _objdir=`pwd`
michael@0 78
michael@0 79 if test "$_topsrcdir" != "$_objdir"
michael@0 80 then
michael@0 81 # Check for a couple representative files in the source tree
michael@0 82 _conflict_files=
michael@0 83 for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
michael@0 84 if test -f $file; then
michael@0 85 _conflict_files="$_conflict_files $file"
michael@0 86 fi
michael@0 87 done
michael@0 88 if test "$_conflict_files"; then
michael@0 89 echo "***"
michael@0 90 echo "* Your source tree contains these files:"
michael@0 91 for file in $_conflict_files; do
michael@0 92 echo "* $file"
michael@0 93 done
michael@0 94 cat 1>&2 <<-EOF
michael@0 95 * This indicates that you previously built in the source tree.
michael@0 96 * A source tree build can confuse the separate objdir build.
michael@0 97 *
michael@0 98 * To clean up the source tree:
michael@0 99 * 1. cd $_topsrcdir
michael@0 100 * 2. gmake distclean
michael@0 101 ***
michael@0 102 EOF
michael@0 103 exit 1
michael@0 104 break
michael@0 105 fi
michael@0 106 fi
michael@0 107 MOZ_BUILD_ROOT=`pwd`
michael@0 108
michael@0 109 dnl Choose where to put the 'dist' directory.
michael@0 110 dnl ==============================================================
michael@0 111
michael@0 112 MOZ_ARG_WITH_STRING(dist-dir,
michael@0 113 [ --with-dist-dir=DIR Use DIR as 'dist' staging area. DIR may be
michael@0 114 relative to the top of SpiderMonkey build tree,
michael@0 115 or absolute.],
michael@0 116 TOP_DIST=$withval,
michael@0 117 TOP_DIST=dist)
michael@0 118 AC_SUBST(TOP_DIST)
michael@0 119
michael@0 120 MOZ_DEFAULT_COMPILER
michael@0 121
michael@0 122 COMPILE_ENVIRONMENT=1
michael@0 123 MOZ_ARG_DISABLE_BOOL(compile-environment,
michael@0 124 [ --disable-compile-environment
michael@0 125 Disable compiler/library checks.],
michael@0 126 COMPILE_ENVIRONMENT= )
michael@0 127 AC_SUBST(COMPILE_ENVIRONMENT)
michael@0 128
michael@0 129 dnl Check for Perl first -- needed for win32 SDK checks
michael@0 130 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
michael@0 131 if test -z "$PERL" -o "$PERL" = ":"; then
michael@0 132 AC_MSG_ERROR([perl not found in \$PATH])
michael@0 133 fi
michael@0 134
michael@0 135 MOZ_ARG_ENABLE_BOOL(shared-js,
michael@0 136 [ --disable-shared-js
michael@0 137 Do not create a shared library.],
michael@0 138 DISABLE_SHARED_JS=0,
michael@0 139 DISABLE_SHARED_JS=1)
michael@0 140
michael@0 141 MOZ_ARG_DISABLE_BOOL(export-js,
michael@0 142 [ --disable-export-js
michael@0 143 Do not mark JS symbols as DLL exported/visible.],
michael@0 144 DISABLE_EXPORT_JS=1,
michael@0 145 DISABLE_SHARED_JS=)
michael@0 146
michael@0 147 if test "$DISABLE_SHARED_JS" = "1" ; then
michael@0 148 if test "$DISABLE_EXPORT_JS" = "1"; then
michael@0 149 AC_DEFINE(STATIC_JS_API)
michael@0 150 else
michael@0 151 AC_DEFINE(STATIC_EXPORTABLE_JS_API)
michael@0 152 fi
michael@0 153 else
michael@0 154 if test "$DISABLE_EXPORT_JS" = "1"; then
michael@0 155 AC_MSG_ERROR([Must export JS symbols when building a shared library.])
michael@0 156 fi
michael@0 157 JS_SHARED_LIBRARY=1
michael@0 158 fi
michael@0 159 AC_SUBST(JS_SHARED_LIBRARY)
michael@0 160
michael@0 161 if test "$JS_STANDALONE" = no; then
michael@0 162 autoconfmk=autoconf-js.mk
michael@0 163 JS_STANDALONE=
michael@0 164 else
michael@0 165 JS_STANDALONE=1
michael@0 166 AC_DEFINE(JS_STANDALONE)
michael@0 167 fi
michael@0 168 AC_SUBST(JS_STANDALONE)
michael@0 169 BUILDING_JS=1
michael@0 170 AC_SUBST(autoconfmk)
michael@0 171
michael@0 172 MOZ_ARG_WITH_STRING(gonk,
michael@0 173 [ --with-gonk=DIR
michael@0 174 location of gonk dir],
michael@0 175 gonkdir=$withval)
michael@0 176
michael@0 177 MOZ_ARG_WITH_STRING(gonk-toolchain-prefix,
michael@0 178 [ --with-gonk-toolchain-prefix=DIR
michael@0 179 prefix to gonk toolchain commands],
michael@0 180 gonk_toolchain_prefix=$withval)
michael@0 181
michael@0 182 if test -n "$gonkdir" ; then
michael@0 183 kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
michael@0 184
michael@0 185 dnl set up compilers
michael@0 186 AS="$gonk_toolchain_prefix"as
michael@0 187 CC="$gonk_toolchain_prefix"gcc
michael@0 188 CXX="$gonk_toolchain_prefix"g++
michael@0 189 CPP="$gonk_toolchain_prefix"cpp
michael@0 190 LD="$gonk_toolchain_prefix"ld
michael@0 191 AR="$gonk_toolchain_prefix"ar
michael@0 192 RANLIB="$gonk_toolchain_prefix"ranlib
michael@0 193 STRIP="$gonk_toolchain_prefix"strip
michael@0 194 OBJCOPY="$gonk_toolchain_prefix"objcopy
michael@0 195
michael@0 196 STLPORT_CPPFLAGS="-I$gonkdir/external/stlport/stlport"
michael@0 197 STLPORT_LIBS="-lstlport"
michael@0 198
michael@0 199 case "$target_cpu" in
michael@0 200 arm)
michael@0 201 ARCH_DIR=arch-arm
michael@0 202 ;;
michael@0 203 i?86)
michael@0 204 ARCH_DIR=arch-x86
michael@0 205 ;;
michael@0 206 esac
michael@0 207
michael@0 208 CPPFLAGS="-DANDROID -isystem $gonkdir/bionic/libc/$ARCH_DIR/include -isystem $gonkdir/bionic/libc/include/ -isystem $gonkdir/bionic/libc/kernel/common -isystem $gonkdir/bionic/libc/kernel/$ARCH_DIR -isystem $gonkdir/bionic/libm/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/system/core/include -isystem $gonkdir/bionic $CPPFLAGS -I$gonkdir/external/valgrind/fxos-include"
michael@0 209 CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
michael@0 210 CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS $STLPORT_CPPFLAGS"
michael@0 211 LIBS="$LIBS $STLPORT_LIBS"
michael@0 212
michael@0 213 dnl Add -llog by default, since we use it all over the place.
michael@0 214 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"
michael@0 215
michael@0 216 dnl prevent cross compile section from using these flags as host flags
michael@0 217 if test -z "$HOST_CPPFLAGS" ; then
michael@0 218 HOST_CPPFLAGS=" "
michael@0 219 fi
michael@0 220 if test -z "$HOST_CFLAGS" ; then
michael@0 221 HOST_CFLAGS=" "
michael@0 222 fi
michael@0 223 if test -z "$HOST_CXXFLAGS" ; then
michael@0 224 HOST_CXXFLAGS=" "
michael@0 225 fi
michael@0 226 if test -z "$HOST_LDFLAGS" ; then
michael@0 227 HOST_LDFLAGS=" "
michael@0 228 fi
michael@0 229
michael@0 230 AC_DEFINE(ANDROID)
michael@0 231 AC_DEFINE(GONK)
michael@0 232 else
michael@0 233 MOZ_ANDROID_NDK
michael@0 234 fi
michael@0 235
michael@0 236 dnl ==============================================================
michael@0 237 dnl Get mozilla version from central milestone file
michael@0 238 dnl ==============================================================
michael@0 239 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
michael@0 240 MOZILLA_UAVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -uaversion`
michael@0 241 MOZILLA_SYMBOLVERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir -symbolversion`
michael@0 242
michael@0 243 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
michael@0 244 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
michael@0 245 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
michael@0 246 AC_SUBST(MOZILLA_SYMBOLVERSION)
michael@0 247
michael@0 248 # Separate version into components for use in shared object naming etc
michael@0 249 changequote(,)
michael@0 250 MOZJS_MAJOR_VERSION=`echo $MOZILLA_VERSION | sed "s|\(^[0-9]*\)\.[0-9]*.*|\1|"`
michael@0 251 MOZJS_MINOR_VERSION=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.\([0-9]*\).*|\1|"`
michael@0 252 MOZJS_PATCH_VERSION=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.[0-9]*[^0-9]*||"`
michael@0 253 IS_ALPHA=`echo $MOZILLA_VERSION | grep '[ab]'`
michael@0 254
michael@0 255 dnl XXX in a temporary bid to avoid developer anger at renaming files
michael@0 256 dnl XXX before "js" symlinks exist, don't change names.
michael@0 257 dnl
michael@0 258 dnl if test -n "$JS_STANDALONE"; then
michael@0 259 dnl JS_SHELL_NAME=js$MOZJS_MAJOR_VERSION
michael@0 260 dnl JS_CONFIG_NAME=js$MOZJS_MAJOR_VERSION-config
michael@0 261 dnl else
michael@0 262 JS_SHELL_NAME=js
michael@0 263 JS_CONFIG_NAME=js-config
michael@0 264 dnl fi
michael@0 265
michael@0 266 changequote([,])
michael@0 267 if test -n "$IS_ALPHA"; then
michael@0 268 changequote(,)
michael@0 269 MOZJS_ALPHA=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.[0-9\.]*\([^0-9]\).*|\1|"`
michael@0 270 changequote([,])
michael@0 271 fi
michael@0 272 AC_DEFINE_UNQUOTED(MOZJS_MAJOR_VERSION,$MOZJS_MAJOR_VERSION)
michael@0 273 AC_DEFINE_UNQUOTED(MOZJS_MINOR_VERSION,$MOZJS_MINOR_VERSION)
michael@0 274 AC_SUBST(JS_SHELL_NAME)
michael@0 275 AC_SUBST(JS_CONFIG_NAME)
michael@0 276 AC_SUBST(MOZJS_MAJOR_VERSION)
michael@0 277 AC_SUBST(MOZJS_MINOR_VERSION)
michael@0 278 AC_SUBST(MOZJS_PATCH_VERSION)
michael@0 279 AC_SUBST(MOZJS_ALPHA)
michael@0 280
michael@0 281 dnl ========================================================
michael@0 282 dnl Checks for compilers.
michael@0 283 dnl ========================================================
michael@0 284
michael@0 285 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
michael@0 286 AR_FLAGS='crs $@'
michael@0 287
michael@0 288 if test "$COMPILE_ENVIRONMENT"; then
michael@0 289
michael@0 290 # Note:
michael@0 291 # In Mozilla, we use the names $target, $host and $build incorrectly, but are
michael@0 292 # too far gone to back out now. See Bug 475488:
michael@0 293 # - When we say $target, we mean $host, that is, the system on which
michael@0 294 # Mozilla will be run.
michael@0 295 # - When we say $host, we mean $build, that is, the system on which Mozilla
michael@0 296 # is built.
michael@0 297 # - $target (in its correct usage) is for compilers who generate code for a
michael@0 298 # different platform than $host, so it would not be used by Mozilla.
michael@0 299 if test "$target" != "$host"; then
michael@0 300 MOZ_CROSS_COMPILER
michael@0 301 else
michael@0 302 AC_PROG_CC
michael@0 303 AC_PROG_CXX
michael@0 304 AC_PROG_RANLIB
michael@0 305 MOZ_PATH_PROGS(AS, $AS as, $CC)
michael@0 306 AC_CHECK_PROGS(AR, ar, :)
michael@0 307 AC_CHECK_PROGS(LD, ld, :)
michael@0 308 AC_CHECK_PROGS(STRIP, strip, :)
michael@0 309 AC_CHECK_PROGS(WINDRES, windres, :)
michael@0 310 if test -z "$HOST_CC"; then
michael@0 311 HOST_CC='$(CC)'
michael@0 312 fi
michael@0 313 if test -z "$HOST_CFLAGS"; then
michael@0 314 HOST_CFLAGS='$(CFLAGS)'
michael@0 315 fi
michael@0 316 if test -z "$HOST_CXX"; then
michael@0 317 HOST_CXX='$(CXX)'
michael@0 318 fi
michael@0 319 if test -z "$HOST_CXXFLAGS"; then
michael@0 320 HOST_CXXFLAGS='$(CXXFLAGS)'
michael@0 321 fi
michael@0 322 if test -z "$HOST_LDFLAGS"; then
michael@0 323 HOST_LDFLAGS='$(LDFLAGS)'
michael@0 324 fi
michael@0 325 if test -z "$HOST_RANLIB"; then
michael@0 326 HOST_RANLIB='$(RANLIB)'
michael@0 327 fi
michael@0 328 if test -z "$HOST_AR"; then
michael@0 329 HOST_AR='$(AR)'
michael@0 330 fi
michael@0 331 if test -z "$HOST_AR_FLAGS"; then
michael@0 332 HOST_AR_FLAGS='$(AR_FLAGS)'
michael@0 333 fi
michael@0 334 fi
michael@0 335
michael@0 336 MOZ_TOOL_VARIABLES
michael@0 337
michael@0 338 MOZ_CHECK_COMPILER_WRAPPER
michael@0 339
michael@0 340 if test -n "$GNU_CC" -a -z "$CLANG_CC" ; then
michael@0 341 if test "$GCC_MAJOR_VERSION" -eq 4 -a "$GCC_MINOR_VERSION" -lt 4 ||
michael@0 342 test "$GCC_MAJOR_VERSION" -lt 4; then
michael@0 343 AC_MSG_ERROR([Only GCC 4.4 or newer supported])
michael@0 344 fi
michael@0 345 fi
michael@0 346
michael@0 347 dnl Special win32 checks
michael@0 348 dnl ========================================================
michael@0 349
michael@0 350 MOZ_ARG_ENABLE_BOOL(metro,
michael@0 351 [ --enable-metro Enable Windows Metro build targets],
michael@0 352 MOZ_METRO=1,
michael@0 353 MOZ_METRO=)
michael@0 354 if test -n "$MOZ_METRO"; then
michael@0 355 AC_DEFINE(MOZ_METRO)
michael@0 356 # Target the Windows 8 Kit
michael@0 357 WINSDK_TARGETVER=602
michael@0 358 WINVER=502
michael@0 359 else
michael@0 360 # Target the Windows 7 SDK by default
michael@0 361 WINSDK_TARGETVER=601
michael@0 362 WINVER=502
michael@0 363 fi
michael@0 364
michael@0 365 MOZ_ARG_WITH_STRING(windows-version,
michael@0 366 [ --with-windows-version=WINSDK_TARGETVER
michael@0 367 Windows SDK version to target. Lowest version
michael@0 368 currently allowed is 601, highest is 602],
michael@0 369 WINSDK_TARGETVER=$withval)
michael@0 370
michael@0 371 # Currently only two sdk versions allowed, 601 and 602
michael@0 372 case "$WINSDK_TARGETVER" in
michael@0 373 601|602)
michael@0 374 MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
michael@0 375 ;;
michael@0 376
michael@0 377 *)
michael@0 378 AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
michael@0 379 ;;
michael@0 380 esac
michael@0 381
michael@0 382 case "$target" in
michael@0 383 *-mingw*)
michael@0 384 if test "$GCC" != "yes" -a -z "$CLANG_CC"; then
michael@0 385 # Check to see if we are really running in a msvc environemnt
michael@0 386 _WIN32_MSVC=1
michael@0 387
michael@0 388 # Make sure compilers are valid
michael@0 389 CFLAGS="$CFLAGS -TC -nologo"
michael@0 390 CXXFLAGS="$CXXFLAGS -TP -nologo"
michael@0 391 # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
michael@0 392 # MSVC warning C4351 warns of newly conformant behavior as of VS2005.
michael@0 393 # MSVC warning C4800 warns when a value is implicitly cast to bool,
michael@0 394 # because this also forces narrowing to a single byte, which can be a
michael@0 395 # perf hit. But this matters so little in practice (and often we want
michael@0 396 # that behavior) that it's better to turn it off.
michael@0 397 # _CRT_SECURE_NO_WARNINGS disables warnings about using MSVC-specific
michael@0 398 # secure CRT functions.
michael@0 399 CXXFLAGS="$CXXFLAGS -wd4345 -wd4351 -wd4800 -D_CRT_SECURE_NO_WARNINGS"
michael@0 400 AC_LANG_SAVE
michael@0 401 AC_LANG_C
michael@0 402 AC_TRY_COMPILE([#include <stdio.h>],
michael@0 403 [ printf("Hello World\n"); ],,
michael@0 404 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
michael@0 405
michael@0 406 AC_LANG_CPLUSPLUS
michael@0 407 AC_TRY_COMPILE([#include <new.h>],
michael@0 408 [ unsigned *test = new unsigned(42); ],,
michael@0 409 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
michael@0 410 AC_LANG_RESTORE
michael@0 411
michael@0 412 changequote(,)
michael@0 413 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
michael@0 414 changequote([,])
michael@0 415
michael@0 416 # Determine compiler version
michael@0 417 CC_VERSION=`${CC} -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
michael@0 418 _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
michael@0 419 _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
michael@0 420 _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
michael@0 421 _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
michael@0 422 _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
michael@0 423
michael@0 424 CXX_VERSION=`${CXX} -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
michael@0 425 _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
michael@0 426
michael@0 427 if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
michael@0 428 AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
michael@0 429 fi
michael@0 430
michael@0 431 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
michael@0 432 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
michael@0 433
michael@0 434 if test "$_CC_MAJOR_VERSION" = "16"; then
michael@0 435 _CC_SUITE=10
michael@0 436 elif test "$_CC_MAJOR_VERSION" = "17"; then
michael@0 437 _CC_SUITE=11
michael@0 438 elif test "$_CC_MAJOR_VERSION" = "18"; then
michael@0 439 _CC_SUITE=12
michael@0 440 else
michael@0 441 AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
michael@0 442 fi
michael@0 443
michael@0 444 dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
michael@0 445 dnl not something else like "magnetic tape manipulation utility".
michael@0 446 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
michael@0 447 if test -z "$MSMT_TOOL"; then
michael@0 448 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
michael@0 449 fi
michael@0 450
michael@0 451 changequote(,)
michael@0 452 _MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
michael@0 453 changequote([,])
michael@0 454 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
michael@0 455 if test -z "$MSMANIFEST_TOOL_VERSION"; then
michael@0 456 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
michael@0 457 fi
michael@0 458
michael@0 459 MSMANIFEST_TOOL=1
michael@0 460 unset MSMT_TOOL
michael@0 461
michael@0 462 # Check linker version
michael@0 463 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
michael@0 464 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
michael@0 465 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
michael@0 466 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
michael@0 467 fi
michael@0 468
michael@0 469 INCREMENTAL_LINKER=1
michael@0 470
michael@0 471 unset _MSVC_VER_FILTER
michael@0 472 elif test -z "$CLANG_CC"; then
michael@0 473 # Check w32api version
michael@0 474 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
michael@0 475 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
michael@0 476 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
michael@0 477 AC_TRY_COMPILE([#include <w32api.h>],
michael@0 478 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
michael@0 479 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
michael@0 480 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
michael@0 481 #error "test failed."
michael@0 482 #endif
michael@0 483 , [ res=yes ], [ res=no ])
michael@0 484 AC_MSG_RESULT([$res])
michael@0 485 if test "$res" != "yes"; then
michael@0 486 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
michael@0 487 fi
michael@0 488 # Check windres version
michael@0 489 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
michael@0 490 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
michael@0 491 AC_MSG_RESULT([$_WINDRES_VERSION])
michael@0 492 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
michael@0 493 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
michael@0 494 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
michael@0 495 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
michael@0 496 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
michael@0 497 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
michael@0 498 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
michael@0 499 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
michael@0 500 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
michael@0 501 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
michael@0 502 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
michael@0 503 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
michael@0 504 then
michael@0 505 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
michael@0 506 fi
michael@0 507
michael@0 508 MOZ_WINSDK_MAXVER=0x06010000
michael@0 509 fi # !GNU_CC
michael@0 510
michael@0 511 # If MSVC or clang
michael@0 512 if test "$GCC" != "yes" -o -n "$CLANG_CC" ; then
michael@0 513 MOZ_FIND_WINSDK_VERSION
michael@0 514 fi
michael@0 515
michael@0 516 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
michael@0 517 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
michael@0 518 # Require OS features provided by IE 6.0 SP2 (XP SP2)
michael@0 519 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
michael@0 520
michael@0 521 # If the maximum version supported by this SDK is lower than the target
michael@0 522 # version, error out
michael@0 523 AC_MSG_CHECKING([for Windows SDK being recent enough])
michael@0 524 if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
michael@0 525 AC_MSG_RESULT("yes")
michael@0 526 else
michael@0 527 AC_MSG_RESULT("no")
michael@0 528 AC_MSG_ERROR([You are targeting Windows version 0x$MOZ_WINSDK_TARGETVER, but your SDK only supports up to version $MOZ_WINSDK_MAXVER. Install and use an updated SDK, or target a lower version using --with-windows-version. Alternatively, try running the Windows SDK Configuration Tool and selecting a newer SDK. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
michael@0 529 fi
michael@0 530
michael@0 531 AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
michael@0 532 # Definitions matching sdkddkver.h
michael@0 533 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
michael@0 534 ;;
michael@0 535 esac
michael@0 536
michael@0 537 AC_PROG_CPP
michael@0 538 AC_PROG_CXXCPP
michael@0 539
michael@0 540 if test -n "$_WIN32_MSVC"; then
michael@0 541 SKIP_PATH_CHECKS=1
michael@0 542 SKIP_COMPILER_CHECKS=1
michael@0 543 SKIP_LIBRARY_CHECKS=1
michael@0 544
michael@0 545 # Since we're skipping compiler and library checks, hard-code
michael@0 546 # some facts here.
michael@0 547
michael@0 548 # Common to all MSVC environments:
michael@0 549
michael@0 550 AC_DEFINE(HAVE_LOCALECONV)
michael@0 551 AC_DEFINE(HAVE_HYPOT)
michael@0 552 fi
michael@0 553
michael@0 554 fi # COMPILE_ENVIRONMENT
michael@0 555
michael@0 556 # Check to see if we are running in a broken QEMU scratchbox.
michael@0 557 # We know that anything below 1.0.16 is broken.
michael@0 558 AC_CHECK_PROGS(SBCONF, sb-conf ve, "")
michael@0 559 if test -n "$SBCONF"; then
michael@0 560 _sb_version=`$SBCONF ve`
michael@0 561 _sb_version_major=`echo $_sb_version | cut -f1 -d.`
michael@0 562 _sb_version_minor=`echo $_sb_version | cut -f2 -d.`
michael@0 563 _sb_version_point=`echo $_sb_version | cut -f3 -d.`
michael@0 564 if test $_sb_version_major -eq 1 -a $_sb_version_minor -eq 0 -a $_sb_version_point -le 16; then
michael@0 565 QEMU_CANT_RUN_JS_SHELL=1
michael@0 566 fi
michael@0 567 fi
michael@0 568 AC_SUBST(QEMU_CANT_RUN_JS_SHELL)
michael@0 569
michael@0 570 AC_SUBST(_MSC_VER)
michael@0 571
michael@0 572 AC_SUBST(GNU_AS)
michael@0 573 AC_SUBST(GNU_LD)
michael@0 574 AC_SUBST(GNU_CC)
michael@0 575 AC_SUBST(GNU_CXX)
michael@0 576 AC_SUBST(INTEL_CC)
michael@0 577 AC_SUBST(INTEL_CXX)
michael@0 578
michael@0 579 dnl ========================================================
michael@0 580 dnl Checks for programs.
michael@0 581 dnl ========================================================
michael@0 582 AC_PROG_INSTALL
michael@0 583 AC_PROG_LN_S
michael@0 584
michael@0 585 AC_MSG_CHECKING([for tar archiver])
michael@0 586 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
michael@0 587 if test -z "$TAR"; then
michael@0 588 AC_MSG_WARN([no tar archiver found in \$PATH])
michael@0 589 fi
michael@0 590 AC_MSG_RESULT([$TAR])
michael@0 591 AC_SUBST(TAR)
michael@0 592
michael@0 593 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
michael@0 594 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
michael@0 595 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
michael@0 596 _perl_res=$?
michael@0 597 AC_MSG_RESULT([$_perl_version])
michael@0 598
michael@0 599 if test "$_perl_res" != 0; then
michael@0 600 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
michael@0 601 fi
michael@0 602 fi
michael@0 603
michael@0 604 AC_MSG_CHECKING([for full perl installation])
michael@0 605 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
michael@0 606 _perl_res=$?
michael@0 607 if test "$_perl_res" != 0; then
michael@0 608 AC_MSG_RESULT([no])
michael@0 609 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
michael@0 610 else
michael@0 611 AC_MSG_RESULT([yes])
michael@0 612 fi
michael@0 613
michael@0 614 MOZ_PYTHON
michael@0 615
michael@0 616 if test -z "$COMPILE_ENVIRONMENT"; then
michael@0 617 NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
michael@0 618 fi
michael@0 619 AC_SUBST(NSINSTALL_BIN)
michael@0 620
michael@0 621 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
michael@0 622 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
michael@0 623 MOZ_PATH_PROG(XARGS, xargs)
michael@0 624 if test -z "$XARGS" -o "$XARGS" = ":"; then
michael@0 625 AC_MSG_ERROR([xargs not found in \$PATH .])
michael@0 626 fi
michael@0 627
michael@0 628 if test "$COMPILE_ENVIRONMENT"; then
michael@0 629
michael@0 630 dnl ========================================================
michael@0 631 dnl = Mac OS X toolchain support
michael@0 632 dnl ========================================================
michael@0 633
michael@0 634 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
michael@0 635 dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
michael@0 636 dnl when we can run target binaries.
michael@0 637 AC_SUBST(UNIVERSAL_BINARY)
michael@0 638 AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
michael@0 639
michael@0 640 dnl ========================================================
michael@0 641 dnl Check for MacOS deployment target version
michael@0 642 dnl ========================================================
michael@0 643
michael@0 644 MOZ_ARG_ENABLE_STRING(macos-target,
michael@0 645 [ --enable-macos-target=VER (default=10.6)
michael@0 646 Set the minimum MacOS version needed at runtime],
michael@0 647 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
michael@0 648
michael@0 649 if test "$target_cpu" != "arm"; then
michael@0 650 case "$target" in
michael@0 651 *-darwin*)
michael@0 652 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
michael@0 653 dnl Use the specified value
michael@0 654 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
michael@0 655 else
michael@0 656 dnl No value specified on the command line or in the environment,
michael@0 657 dnl use architecture minimum.
michael@0 658 export MACOSX_DEPLOYMENT_TARGET=10.6
michael@0 659 fi
michael@0 660 ;;
michael@0 661 esac
michael@0 662 fi
michael@0 663
michael@0 664 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
michael@0 665
michael@0 666 dnl ========================================================
michael@0 667 dnl = Mac OS X SDK support
michael@0 668 dnl ========================================================
michael@0 669 MACOS_SDK_DIR=
michael@0 670 MOZ_ARG_WITH_STRING(macos-sdk,
michael@0 671 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
michael@0 672 MACOS_SDK_DIR=$withval)
michael@0 673
michael@0 674 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
michael@0 675 AC_SUBST(MACOS_SDK_DIR)
michael@0 676
michael@0 677 if test "$MACOS_SDK_DIR"; then
michael@0 678 dnl Sync this section with the ones in NSPR and NSS.
michael@0 679 dnl Changes to the cross environment here need to be accounted for in
michael@0 680 dnl the libIDL checks (below) and xpidl build.
michael@0 681
michael@0 682 if test ! -d "$MACOS_SDK_DIR"; then
michael@0 683 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
michael@0 684 specify a valid SDK. SDKs are installed when the optional cross-development
michael@0 685 tools are selected during the Xcode/Developer Tools installation.])
michael@0 686 fi
michael@0 687
michael@0 688 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
michael@0 689 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
michael@0 690
michael@0 691 dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
michael@0 692 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
michael@0 693 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
michael@0 694
michael@0 695 AC_LANG_SAVE
michael@0 696 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
michael@0 697 AC_LANG_CPLUSPLUS
michael@0 698 AC_TRY_COMPILE([#include <new>
michael@0 699 int main() { return 0; }],
michael@0 700 result=yes,
michael@0 701 result=no)
michael@0 702 AC_LANG_RESTORE
michael@0 703 AC_MSG_RESULT($result)
michael@0 704
michael@0 705 if test "$result" = "no" ; then
michael@0 706 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
michael@0 707 fi
michael@0 708 fi
michael@0 709
michael@0 710 fi # COMPILE_ENVIRONMENT
michael@0 711
michael@0 712 if test -n "$MAKE"; then
michael@0 713 if test `echo $MAKE | grep -c make.py` != 1; then
michael@0 714 NOT_PYMAKE=$MAKE
michael@0 715 fi
michael@0 716 fi
michael@0 717
michael@0 718 case "$host_os" in
michael@0 719 mingw*)
michael@0 720 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
michael@0 721 ;;
michael@0 722 *)
michael@0 723 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
michael@0 724 ;;
michael@0 725 esac
michael@0 726 if test "$GMAKE" = ":"; then
michael@0 727 AC_MSG_ERROR([GNU make not found])
michael@0 728 fi
michael@0 729
michael@0 730 # MAKE will be set by client.mk, but still need this for standalone js builds
michael@0 731 if test -z "$MAKE"; then
michael@0 732 MAKE=$GMAKE
michael@0 733 fi
michael@0 734
michael@0 735 if test "$COMPILE_ENVIRONMENT"; then
michael@0 736
michael@0 737 AC_PATH_XTRA
michael@0 738
michael@0 739 XCFLAGS="$X_CFLAGS"
michael@0 740
michael@0 741 fi # COMPILE_ENVIRONMENT
michael@0 742
michael@0 743 dnl ========================================================
michael@0 744 dnl set the defaults first
michael@0 745 dnl ========================================================
michael@0 746 AS_BIN=$AS
michael@0 747 AR_LIST='$(AR) t'
michael@0 748 AR_EXTRACT='$(AR) x'
michael@0 749 AR_DELETE='$(AR) d'
michael@0 750 AS='$(CC)'
michael@0 751 AS_DASH_C_FLAG='-c'
michael@0 752 DLL_PREFIX=lib
michael@0 753 LIB_PREFIX=lib
michael@0 754 DLL_SUFFIX=.so
michael@0 755 OBJ_SUFFIX=o
michael@0 756 LIB_SUFFIX=a
michael@0 757 ASM_SUFFIX=s
michael@0 758 IMPORT_LIB_SUFFIX=
michael@0 759 TARGET_MD_ARCH=unix
michael@0 760 DIRENT_INO=d_ino
michael@0 761 MOZ_USER_DIR=".mozilla"
michael@0 762
michael@0 763 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
michael@0 764
michael@0 765 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
michael@0 766
michael@0 767 USE_DEPENDENT_LIBS=1
michael@0 768
michael@0 769 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
michael@0 770
michael@0 771 if test -n "$CROSS_COMPILE"; then
michael@0 772 OS_TARGET="${target_os}"
michael@0 773 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
michael@0 774 OS_RELEASE=
michael@0 775 case "${target_os}" in
michael@0 776 linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
michael@0 777 kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU/kFreeBSD ;;
michael@0 778 gnu*) OS_ARCH=GNU ;;
michael@0 779 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
michael@0 780 mingw*) OS_ARCH=WINNT OS_TARGET=WINNT ;;
michael@0 781 darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
michael@0 782 dragonfly*) OS_ARCH=DragonFly OS_TARGET=DragonFly ;;
michael@0 783 freebsd*) OS_ARCH=FreeBSD OS_TARGET=FreeBSD ;;
michael@0 784 netbsd*) OS_ARCH=NetBSD OS_TARGET=NetBSD ;;
michael@0 785 openbsd*) OS_ARCH=OpenBSD OS_TARGET=OpenBSD ;;
michael@0 786 esac
michael@0 787 case "${target}" in
michael@0 788 *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
michael@0 789 esac
michael@0 790 else
michael@0 791 OS_TARGET=`uname -s`
michael@0 792 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
michael@0 793 OS_RELEASE=`uname -r`
michael@0 794 fi
michael@0 795
michael@0 796 # Before this used `uname -m` when not cross compiling
michael@0 797 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
michael@0 798 OS_TEST="${target_cpu}"
michael@0 799
michael@0 800 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
michael@0 801
michael@0 802 #######################################################################
michael@0 803 # Master "Core Components" macros for getting the OS target #
michael@0 804 #######################################################################
michael@0 805
michael@0 806 #
michael@0 807 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
michael@0 808 # cross-compilation.
michael@0 809 #
michael@0 810
michael@0 811 #
michael@0 812 # Define and override various archtecture-specific variables, including
michael@0 813 # HOST_OS_ARCH
michael@0 814 # OS_ARCH
michael@0 815 # OS_TEST
michael@0 816 # OS_TARGET
michael@0 817 # OS_RELEASE
michael@0 818 # OS_MINOR_RELEASE
michael@0 819 #
michael@0 820
michael@0 821 case "$HOST_OS_ARCH" in
michael@0 822 mingw*)
michael@0 823 HOST_OS_ARCH=WINNT
michael@0 824 ;;
michael@0 825 darwin*)
michael@0 826 HOST_OS_ARCH=Darwin
michael@0 827 ;;
michael@0 828 linux*)
michael@0 829 HOST_OS_ARCH=Linux
michael@0 830 ;;
michael@0 831 kfreebsd*-gnu)
michael@0 832 HOST_OS_ARCH=GNU_kFreeBSD
michael@0 833 ;;
michael@0 834 gnu*)
michael@0 835 HOST_OS_ARCH=GNU
michael@0 836 ;;
michael@0 837 dragonfly*)
michael@0 838 HOST_OS_ARCH=DragonFly
michael@0 839 ;;
michael@0 840 freebsd*)
michael@0 841 HOST_OS_ARCH=FreeBSD
michael@0 842 ;;
michael@0 843 netbsd*)
michael@0 844 HOST_OS_ARCH=NetBSD
michael@0 845 ;;
michael@0 846 openbsd*)
michael@0 847 HOST_OS_ARCH=OpenBSD
michael@0 848 ;;
michael@0 849 solaris*)
michael@0 850 HOST_OS_ARCH=SunOS
michael@0 851 SOLARIS_SUNPRO_CC=
michael@0 852 SOLARIS_SUNPRO_CXX=
michael@0 853 if test -z "$GNU_CC"; then
michael@0 854 if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
michael@0 855 SOLARIS_SUNPRO_CC=1
michael@0 856 fi
michael@0 857 fi
michael@0 858
michael@0 859 if test -z "$GNU_CXX"; then
michael@0 860 if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
michael@0 861 SOLARIS_SUNPRO_CXX=1
michael@0 862 fi
michael@0 863 fi
michael@0 864 AC_SUBST(SOLARIS_SUNPRO_CC)
michael@0 865 AC_SUBST(SOLARIS_SUNPRO_CXX)
michael@0 866 ;;
michael@0 867 esac
michael@0 868
michael@0 869 case "$OS_ARCH" in
michael@0 870 WINNT)
michael@0 871 if test -z "$CROSS_COMPILE" ; then
michael@0 872 OS_TEST=`uname -p`
michael@0 873 fi
michael@0 874 ;;
michael@0 875 Windows_NT)
michael@0 876 #
michael@0 877 # If uname -s returns "Windows_NT", we assume that we are using
michael@0 878 # the uname.exe in MKS toolkit.
michael@0 879 #
michael@0 880 # The -r option of MKS uname only returns the major version number.
michael@0 881 # So we need to use its -v option to get the minor version number.
michael@0 882 # Moreover, it doesn't have the -p option, so we need to use uname -m.
michael@0 883 #
michael@0 884 OS_ARCH=WINNT
michael@0 885 OS_TARGET=WINNT
michael@0 886 OS_MINOR_RELEASE=`uname -v`
michael@0 887 if test "$OS_MINOR_RELEASE" = "00"; then
michael@0 888 OS_MINOR_RELEASE=0
michael@0 889 fi
michael@0 890 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
michael@0 891 ;;
michael@0 892 MINGW*_NT*)
michael@0 893 #
michael@0 894 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
michael@0 895 # the uname.exe in the MSYS tools.
michael@0 896 #
michael@0 897 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
michael@0 898 OS_ARCH=WINNT
michael@0 899 OS_TARGET=WINNT
michael@0 900 ;;
michael@0 901 AIX)
michael@0 902 OS_RELEASE=`uname -v`.`uname -r`
michael@0 903 OS_TEST=${target_cpu}
michael@0 904 if test -z "$GNU_CC"; then
michael@0 905 if test "`$CC -qversion 2>&1 | egrep -c 'IBM XL'`" != "0"; then
michael@0 906 AIX_IBM_XLC=1
michael@0 907 fi
michael@0 908 fi
michael@0 909 ;;
michael@0 910 Darwin)
michael@0 911 case "${target_cpu}" in
michael@0 912 powerpc*)
michael@0 913 OS_TEST=ppc
michael@0 914 ;;
michael@0 915 i*86*)
michael@0 916 OS_TEST=i386
michael@0 917 ;;
michael@0 918 x86_64)
michael@0 919 OS_TEST=x86_64
michael@0 920 ;;
michael@0 921 *)
michael@0 922 if test -z "$CROSS_COMPILE" ; then
michael@0 923 OS_TEST=`uname -p`
michael@0 924 fi
michael@0 925 ;;
michael@0 926 esac
michael@0 927 ;;
michael@0 928 esac
michael@0 929
michael@0 930 # Only set CPU_ARCH if we recognize the value of OS_TEST
michael@0 931
michael@0 932 case "$OS_TEST" in
michael@0 933 *86 | i86pc)
michael@0 934 CPU_ARCH=x86
michael@0 935 ;;
michael@0 936
michael@0 937 powerpc64 | ppc64 | powerpc64le | ppc64le)
michael@0 938 CPU_ARCH=ppc64
michael@0 939 ;;
michael@0 940
michael@0 941 powerpc | ppc | rs6000)
michael@0 942 CPU_ARCH=ppc
michael@0 943 ;;
michael@0 944
michael@0 945 Alpha | alpha | ALPHA)
michael@0 946 CPU_ARCH=Alpha
michael@0 947 ;;
michael@0 948
michael@0 949 s390)
michael@0 950 CPU_ARCH=s390
michael@0 951 ;;
michael@0 952
michael@0 953 s390x)
michael@0 954 CPU_ARCH=s390x
michael@0 955 ;;
michael@0 956
michael@0 957 hppa* | parisc)
michael@0 958 CPU_ARCH=hppa
michael@0 959 ;;
michael@0 960
michael@0 961 sun4u | sparc*)
michael@0 962 CPU_ARCH=sparc
michael@0 963 ;;
michael@0 964
michael@0 965 x86_64 | ia64)
michael@0 966 CPU_ARCH="$OS_TEST"
michael@0 967 ;;
michael@0 968
michael@0 969 arm*)
michael@0 970 CPU_ARCH=arm
michael@0 971 ;;
michael@0 972
michael@0 973 mips|mipsel)
michael@0 974 CPU_ARCH="mips"
michael@0 975 ;;
michael@0 976
michael@0 977 aarch64*)
michael@0 978 CPU_ARCH=aarch64
michael@0 979 ;;
michael@0 980
michael@0 981 esac
michael@0 982
michael@0 983 if test -z "$OS_TARGET"; then
michael@0 984 OS_TARGET=$OS_ARCH
michael@0 985 fi
michael@0 986 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
michael@0 987
michael@0 988 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
michael@0 989 dnl ===============================================================
michael@0 990 INTEL_ARCHITECTURE=
michael@0 991 case "$OS_TEST" in
michael@0 992 x86_64|i?86)
michael@0 993 INTEL_ARCHITECTURE=1
michael@0 994 esac
michael@0 995
michael@0 996 dnl Configure platform-specific CPU architecture compiler options.
michael@0 997 dnl ==============================================================
michael@0 998 MOZ_ARCH_OPTS
michael@0 999
michael@0 1000 dnl =================================================================
michael@0 1001 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
michael@0 1002 dnl which is bad when cross compiling.
michael@0 1003 dnl =================================================================
michael@0 1004 if test "$COMPILE_ENVIRONMENT"; then
michael@0 1005 configure_static_assert_macros='
michael@0 1006 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
michael@0 1007 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
michael@0 1008 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
michael@0 1009 '
michael@0 1010
michael@0 1011 dnl test that the macros actually work:
michael@0 1012 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
michael@0 1013 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
michael@0 1014 [AC_LANG_SAVE
michael@0 1015 AC_LANG_C
michael@0 1016 ac_cv_static_assertion_macros_work="yes"
michael@0 1017 AC_TRY_COMPILE([$configure_static_assert_macros],
michael@0 1018 [CONFIGURE_STATIC_ASSERT(1)],
michael@0 1019 ,
michael@0 1020 ac_cv_static_assertion_macros_work="no")
michael@0 1021 AC_TRY_COMPILE([$configure_static_assert_macros],
michael@0 1022 [CONFIGURE_STATIC_ASSERT(0)],
michael@0 1023 ac_cv_static_assertion_macros_work="no",
michael@0 1024 )
michael@0 1025 AC_LANG_CPLUSPLUS
michael@0 1026 AC_TRY_COMPILE([$configure_static_assert_macros],
michael@0 1027 [CONFIGURE_STATIC_ASSERT(1)],
michael@0 1028 ,
michael@0 1029 ac_cv_static_assertion_macros_work="no")
michael@0 1030 AC_TRY_COMPILE([$configure_static_assert_macros],
michael@0 1031 [CONFIGURE_STATIC_ASSERT(0)],
michael@0 1032 ac_cv_static_assertion_macros_work="no",
michael@0 1033 )
michael@0 1034 AC_LANG_RESTORE
michael@0 1035 ])
michael@0 1036 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
michael@0 1037 if test "$ac_cv_static_assertion_macros_work" = "no"; then
michael@0 1038 AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
michael@0 1039 fi
michael@0 1040 fi # COMPILE_ENVIRONMENT
michael@0 1041
michael@0 1042 dnl ========================================================
michael@0 1043 dnl Android libstdc++, placed here so it can use MOZ_ARCH
michael@0 1044 dnl computed above.
michael@0 1045 dnl ========================================================
michael@0 1046
michael@0 1047 MOZ_ANDROID_STLPORT
michael@0 1048
michael@0 1049 dnl ========================================================
michael@0 1050 dnl Suppress Clang Argument Warnings
michael@0 1051 dnl ========================================================
michael@0 1052 if test -n "$CLANG_CC"; then
michael@0 1053 _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
michael@0 1054 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
michael@0 1055 fi
michael@0 1056 if test -n "$CLANG_CXX"; then
michael@0 1057 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
michael@0 1058 fi
michael@0 1059
michael@0 1060 dnl ========================================================
michael@0 1061 dnl = Use Address Sanitizer
michael@0 1062 dnl ========================================================
michael@0 1063 MOZ_ARG_ENABLE_BOOL(address-sanitizer,
michael@0 1064 [ --enable-address-sanitizer Enable Address Sanitizer (default=no)],
michael@0 1065 MOZ_ASAN=1,
michael@0 1066 MOZ_ASAN= )
michael@0 1067 if test -n "$MOZ_ASAN"; then
michael@0 1068 MOZ_LLVM_HACKS=1
michael@0 1069 AC_DEFINE(MOZ_ASAN)
michael@0 1070 MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
michael@0 1071 fi
michael@0 1072 AC_SUBST(MOZ_ASAN)
michael@0 1073 AC_SUBST(LLVM_SYMBOLIZER)
michael@0 1074
michael@0 1075 dnl ========================================================
michael@0 1076 dnl = Enable hacks required for LLVM instrumentations
michael@0 1077 dnl ========================================================
michael@0 1078 MOZ_ARG_ENABLE_BOOL(llvm-hacks,
michael@0 1079 [ --enable-llvm-hacks Enable workarounds required for several LLVM instrumentations (default=no)],
michael@0 1080 MOZ_LLVM_HACKS=1,
michael@0 1081 MOZ_LLVM_HACKS= )
michael@0 1082 if test -n "$MOZ_LLVM_HACKS"; then
michael@0 1083 MOZ_NO_WLZDEFS=1
michael@0 1084 fi
michael@0 1085
michael@0 1086 dnl ========================================================
michael@0 1087 dnl GNU specific defaults
michael@0 1088 dnl ========================================================
michael@0 1089 if test "$GNU_CC"; then
michael@0 1090 # Per bug 719659 comment 2, some of the headers on ancient build machines
michael@0 1091 # may require gnu89 inline semantics. But otherwise, we use C99.
michael@0 1092 # But on OS X we just use C99 plus GNU extensions, in order to fix
michael@0 1093 # bug 917526.
michael@0 1094 CFLAGS="$CFLAGS -std=gnu99"
michael@0 1095 if test "${OS_ARCH}" != Darwin; then
michael@0 1096 CFLAGS="$CFLAGS -fgnu89-inline"
michael@0 1097 fi
michael@0 1098 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(notdir $@) -o $@'
michael@0 1099 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(notdir $@) -o $@'
michael@0 1100 DSO_LDOPTS='-shared'
michael@0 1101 if test "$GCC_USE_GNU_LD"; then
michael@0 1102 # Some tools like ASan use a runtime library that is only
michael@0 1103 # linked against executables, so we must allow undefined
michael@0 1104 # symbols for shared objects in some cases.
michael@0 1105 if test -z "$MOZ_NO_WLZDEFS"; then
michael@0 1106 # Don't allow undefined symbols in libraries
michael@0 1107 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
michael@0 1108 fi
michael@0 1109 fi
michael@0 1110 WARNINGS_AS_ERRORS='-Werror'
michael@0 1111 DSO_CFLAGS=''
michael@0 1112 DSO_PIC_CFLAGS='-fPIC'
michael@0 1113 ASFLAGS="$ASFLAGS -fPIC"
michael@0 1114 AC_MSG_CHECKING([for --noexecstack option to as])
michael@0 1115 _SAVE_CFLAGS=$CFLAGS
michael@0 1116 CFLAGS="$CFLAGS -Wa,--noexecstack"
michael@0 1117 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
michael@0 1118 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
michael@0 1119 AC_MSG_RESULT([no]))
michael@0 1120 CFLAGS=$_SAVE_CFLAGS
michael@0 1121 AC_MSG_CHECKING([for -z noexecstack option to ld])
michael@0 1122 _SAVE_LDFLAGS=$LDFLAGS
michael@0 1123 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
michael@0 1124 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
michael@0 1125 AC_MSG_RESULT([no])
michael@0 1126 LDFLAGS=$_SAVE_LDFLAGS)
michael@0 1127
michael@0 1128 AC_MSG_CHECKING([for -z text option to ld])
michael@0 1129 _SAVE_LDFLAGS=$LDFLAGS
michael@0 1130 LDFLAGS="$LDFLAGS -Wl,-z,text"
michael@0 1131 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
michael@0 1132 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,text"],
michael@0 1133 AC_MSG_RESULT([no])
michael@0 1134 LDFLAGS=$_SAVE_LDFLAGS)
michael@0 1135
michael@0 1136 AC_MSG_CHECKING([for --build-id option to ld])
michael@0 1137 _SAVE_LDFLAGS=$LDFLAGS
michael@0 1138 LDFLAGS="$LDFLAGS -Wl,--build-id"
michael@0 1139 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
michael@0 1140 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,--build-id"],
michael@0 1141 AC_MSG_RESULT([no])
michael@0 1142 LDFLAGS=$_SAVE_LDFLAGS)
michael@0 1143
michael@0 1144 # Turn on GNU-specific warnings:
michael@0 1145 # -Wall - turn on a lot of warnings
michael@0 1146 # -Wpointer-arith - good to have
michael@0 1147 # -Wdeclaration-after-statement - MSVC doesn't like these
michael@0 1148 # -Werror=return-type - catches missing returns, zero false positives
michael@0 1149 # -Werror=int-to-pointer-cast - catches cast to pointer from integer of different size
michael@0 1150 # -Wtype-limits - catches overflow bugs, few false positives
michael@0 1151 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
michael@0 1152 # -Wsign-compare - catches comparison of signed and unsigned types
michael@0 1153 #
michael@0 1154 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
michael@0 1155 MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
michael@0 1156 MOZ_C_SUPPORTS_WARNING(-W, error=int-to-pointer-cast, ac_c_has_werror_int_to_pointer_cast)
michael@0 1157 MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
michael@0 1158 MOZ_C_SUPPORTS_WARNING(-W, sign-compare, ac_c_has_sign_compare)
michael@0 1159
michael@0 1160 # Turn off the following warnings that -Wall turns on:
michael@0 1161 # -Wno-unused - lots of violations in third-party code
michael@0 1162 #
michael@0 1163 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
michael@0 1164
michael@0 1165 if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
michael@0 1166 # Don't use -Wcast-align with ICC or clang
michael@0 1167 case "$CPU_ARCH" in
michael@0 1168 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
michael@0 1169 hppa | ia64 | sparc | arm)
michael@0 1170 ;;
michael@0 1171 *)
michael@0 1172 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
michael@0 1173 ;;
michael@0 1174 esac
michael@0 1175 fi
michael@0 1176
michael@0 1177 _DEFINES_CFLAGS='-include $(DEPTH)/js/src/js-confdefs.h -DMOZILLA_CLIENT'
michael@0 1178 _USE_CPP_INCLUDE_FLAG=1
michael@0 1179
michael@0 1180 elif test "$SOLARIS_SUNPRO_CC"; then
michael@0 1181 DSO_CFLAGS=''
michael@0 1182 if test "$CPU_ARCH" = "sparc"; then
michael@0 1183 # for Sun Studio on Solaris/SPARC
michael@0 1184 DSO_PIC_CFLAGS='-xcode=pic32'
michael@0 1185 else
michael@0 1186 DSO_PIC_CFLAGS='-KPIC'
michael@0 1187 fi
michael@0 1188 _DEFINES_CFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
michael@0 1189 else
michael@0 1190 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
michael@0 1191 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
michael@0 1192
michael@0 1193 DSO_LDOPTS='-shared'
michael@0 1194 if test "$GNU_LD"; then
michael@0 1195 # Don't allow undefined symbols in libraries
michael@0 1196 DSO_LDOPTS="$DSO_LDOPTS -z defs"
michael@0 1197 fi
michael@0 1198
michael@0 1199 DSO_CFLAGS=''
michael@0 1200 DSO_PIC_CFLAGS='-KPIC'
michael@0 1201 _DEFINES_CFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
michael@0 1202 fi
michael@0 1203
michael@0 1204 if test "$GNU_CXX"; then
michael@0 1205 # Turn on GNU-specific warnings:
michael@0 1206 # -Wall - turn on a lot of warnings
michael@0 1207 # -Wpointer-arith - good to have
michael@0 1208 # -Woverloaded-virtual - ???
michael@0 1209 # -Werror=return-type - catches missing returns, zero false positives
michael@0 1210 # -Werror=int-to-pointer-cast - catches cast to pointer from integer of different size
michael@0 1211 # -Wtype-limits - catches overflow bugs, few false positives
michael@0 1212 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
michael@0 1213 # -Werror=conversion-null - catches conversions between NULL and non-pointer types
michael@0 1214 # -Wsign-compare - catches comparison of signed and unsigned types
michael@0 1215 #
michael@0 1216 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
michael@0 1217 MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
michael@0 1218 MOZ_CXX_SUPPORTS_WARNING(-W, error=int-to-pointer-cast, ac_cxx_has_werror_int_to_pointer_cast)
michael@0 1219 MOZ_CXX_SUPPORTS_WARNING(-W, type-limits, ac_cxx_has_wtype_limits)
michael@0 1220 MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
michael@0 1221 MOZ_CXX_SUPPORTS_WARNING(-W, error=conversion-null, ac_cxx_has_werror_conversion_null)
michael@0 1222 MOZ_CXX_SUPPORTS_WARNING(-W, sign-compare, ac_cxx_has_sign_compare)
michael@0 1223
michael@0 1224 # Turn off the following warnings that -Wall turns on:
michael@0 1225 # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
michael@0 1226 #
michael@0 1227 MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
michael@0 1228
michael@0 1229 if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
michael@0 1230 # Don't use -Wcast-align with ICC or clang
michael@0 1231 case "$CPU_ARCH" in
michael@0 1232 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
michael@0 1233 hppa | ia64 | sparc | arm)
michael@0 1234 ;;
michael@0 1235 *)
michael@0 1236 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
michael@0 1237 ;;
michael@0 1238 esac
michael@0 1239 fi
michael@0 1240
michael@0 1241 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/js/src/js-confdefs.h'
michael@0 1242 _USE_CPP_INCLUDE_FLAG=1
michael@0 1243
michael@0 1244 # Recent clang and gcc support C++11 deleted functions without warnings if
michael@0 1245 # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
michael@0 1246 # versions). We can't use -std=c++0x yet, so gcc's support must remain
michael@0 1247 # unused. But clang's warning can be disabled, so when compiling with clang
michael@0 1248 # we use it to opt out of the warning, enabling (macro-encapsulated) use of
michael@0 1249 # deleted function syntax.
michael@0 1250 if test "$CLANG_CXX"; then
michael@0 1251 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
michael@0 1252 MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
michael@0 1253 fi
michael@0 1254
michael@0 1255 else
michael@0 1256 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_JS_CONFDEFS_H_ $(ACDEFINES)'
michael@0 1257 fi
michael@0 1258
michael@0 1259 dnl gcc can come with its own linker so it is better to use the pass-thru calls
michael@0 1260 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
michael@0 1261 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
michael@0 1262 dnl normal behavior.
michael@0 1263 dnl ========================================================
michael@0 1264 MKSHLIB_FORCE_ALL=
michael@0 1265 MKSHLIB_UNFORCE_ALL=
michael@0 1266
michael@0 1267 if test "$COMPILE_ENVIRONMENT"; then
michael@0 1268 if test "$GNU_CC"; then
michael@0 1269 AC_MSG_CHECKING(whether ld has archive extraction flags)
michael@0 1270 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
michael@0 1271 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
michael@0 1272 ac_cv_mkshlib_force_and_unforce="no"
michael@0 1273 exec 3<&0 <<LOOP_INPUT
michael@0 1274 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
michael@0 1275 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
michael@0 1276 force="-Wl,-all"; unforce="-Wl,-none"
michael@0 1277 LOOP_INPUT
michael@0 1278 while read line
michael@0 1279 do
michael@0 1280 eval $line
michael@0 1281 LDFLAGS=$force
michael@0 1282 LIBS=$unforce
michael@0 1283 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
michael@0 1284 done
michael@0 1285 exec 0<&3 3<&-
michael@0 1286 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
michael@0 1287 ])
michael@0 1288 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
michael@0 1289 AC_MSG_RESULT(no)
michael@0 1290 else
michael@0 1291 AC_MSG_RESULT(yes)
michael@0 1292 eval $ac_cv_mkshlib_force_and_unforce
michael@0 1293 MKSHLIB_FORCE_ALL=$force
michael@0 1294 MKSHLIB_UNFORCE_ALL=$unforce
michael@0 1295 fi
michael@0 1296 fi # GNU_CC
michael@0 1297 fi # COMPILE_ENVIRONMENT
michael@0 1298
michael@0 1299 dnl ========================================================
michael@0 1300 dnl Checking for 64-bit OS
michael@0 1301 dnl ========================================================
michael@0 1302 if test "$COMPILE_ENVIRONMENT"; then
michael@0 1303 AC_LANG_SAVE
michael@0 1304 AC_LANG_C
michael@0 1305 AC_MSG_CHECKING(for 64-bit OS)
michael@0 1306 AC_TRY_COMPILE([$configure_static_assert_macros],
michael@0 1307 [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
michael@0 1308 result="yes", result="no")
michael@0 1309 AC_MSG_RESULT("$result")
michael@0 1310 if test "$result" = "yes"; then
michael@0 1311 AC_DEFINE(HAVE_64BIT_OS)
michael@0 1312 HAVE_64BIT_OS=1
michael@0 1313 fi
michael@0 1314 AC_SUBST(HAVE_64BIT_OS)
michael@0 1315 AC_LANG_RESTORE
michael@0 1316 fi # COMPILE_ENVIRONMENT
michael@0 1317
michael@0 1318 dnl ========================================================
michael@0 1319 dnl = Use profiling compile flags
michael@0 1320 dnl ========================================================
michael@0 1321 MOZ_ARG_ENABLE_BOOL(profiling,
michael@0 1322 [ --enable-profiling Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
michael@0 1323 MOZ_PROFILING=1,
michael@0 1324 MOZ_PROFILING= )
michael@0 1325
michael@0 1326 dnl ========================================================
michael@0 1327 dnl System overrides of the defaults for host
michael@0 1328 dnl ========================================================
michael@0 1329 case "$host" in
michael@0 1330 *mingw*)
michael@0 1331 if test -n "$_WIN32_MSVC"; then
michael@0 1332 HOST_AR=lib
michael@0 1333 HOST_AR_FLAGS='-NOLOGO -OUT:$@'
michael@0 1334 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo"
michael@0 1335 HOST_RANLIB='echo ranlib'
michael@0 1336 else
michael@0 1337 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
michael@0 1338 fi
michael@0 1339 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
michael@0 1340 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
michael@0 1341 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
michael@0 1342 HOST_BIN_SUFFIX=.exe
michael@0 1343 case "$host" in
michael@0 1344 *mingw*)
michael@0 1345 PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
michael@0 1346 ;;
michael@0 1347 esac
michael@0 1348
michael@0 1349 case "${host_cpu}" in
michael@0 1350 i*86)
michael@0 1351 if test -n "$_WIN32_MSVC"; then
michael@0 1352 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
michael@0 1353 fi
michael@0 1354 ;;
michael@0 1355 x86_64)
michael@0 1356 if test -n "$_WIN32_MSVC"; then
michael@0 1357 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
michael@0 1358 fi
michael@0 1359 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
michael@0 1360 ;;
michael@0 1361 esac
michael@0 1362 ;;
michael@0 1363
michael@0 1364 *-darwin*)
michael@0 1365 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
michael@0 1366 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
michael@0 1367 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
michael@0 1368 ;;
michael@0 1369
michael@0 1370 *-linux*|*-kfreebsd*-gnu|*-gnu*)
michael@0 1371 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
michael@0 1372 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
michael@0 1373 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
michael@0 1374 ;;
michael@0 1375
michael@0 1376 *)
michael@0 1377 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
michael@0 1378 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
michael@0 1379 ;;
michael@0 1380 esac
michael@0 1381
michael@0 1382 dnl Check for using a custom <inttypes.h> implementation
michael@0 1383 dnl ========================================================
michael@0 1384 AC_MSG_CHECKING(for custom <inttypes.h> implementation)
michael@0 1385 if test "$MOZ_CUSTOM_INTTYPES_H"; then
michael@0 1386 AC_DEFINE_UNQUOTED(MOZ_CUSTOM_INTTYPES_H, "$MOZ_CUSTOM_INTTYPES_H")
michael@0 1387 AC_MSG_RESULT(using $MOZ_CUSTOM_INTTYPES_H)
michael@0 1388 else
michael@0 1389 AC_MSG_RESULT(none specified)
michael@0 1390 fi
michael@0 1391
michael@0 1392 MOZ_DOING_LTO(lto_is_enabled)
michael@0 1393
michael@0 1394 dnl ========================================================
michael@0 1395 dnl System overrides of the defaults for target
michael@0 1396 dnl ========================================================
michael@0 1397
michael@0 1398 case "$target" in
michael@0 1399 *-aix*)
michael@0 1400 AC_DEFINE(AIX)
michael@0 1401 if test ! "$GNU_CC"; then
michael@0 1402 if test ! "$HAVE_64BIT_OS"; then
michael@0 1403 # Compiling with Visual Age C++ object model compat is the
michael@0 1404 # default. To compile with object model ibm, add
michael@0 1405 # AIX_OBJMODEL=ibm to .mozconfig.
michael@0 1406 if test "$AIX_OBJMODEL" = "ibm"; then
michael@0 1407 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
michael@0 1408 else
michael@0 1409 AIX_OBJMODEL=compat
michael@0 1410 fi
michael@0 1411 else
michael@0 1412 AIX_OBJMODEL=compat
michael@0 1413 fi
michael@0 1414 AC_SUBST(AIX_OBJMODEL)
michael@0 1415 DSO_LDOPTS='-qmkshrobj=1'
michael@0 1416 DSO_CFLAGS='-qflag=w:w'
michael@0 1417 DSO_PIC_CFLAGS=
michael@0 1418 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
michael@0 1419 MOZ_FIX_LINK_PATHS=
michael@0 1420 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
michael@0 1421 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
michael@0 1422 if test "$COMPILE_ENVIRONMENT"; then
michael@0 1423 AC_LANG_SAVE
michael@0 1424 AC_LANG_CPLUSPLUS
michael@0 1425 AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
michael@0 1426 AC_TRY_COMPILE([],
michael@0 1427 [#if (__IBMCPP__ < 900)
michael@0 1428 #error "Bad compiler"
michael@0 1429 #endif],
michael@0 1430 _BAD_COMPILER=,_BAD_COMPILER=1)
michael@0 1431 if test -n "$_BAD_COMPILER"; then
michael@0 1432 AC_MSG_RESULT([no])
michael@0 1433 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
michael@0 1434 else
michael@0 1435 AC_MSG_RESULT([yes])
michael@0 1436 fi
michael@0 1437 AC_LANG_RESTORE
michael@0 1438 TARGET_COMPILER_ABI="ibmc"
michael@0 1439 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
michael@0 1440 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
michael@0 1441 fi
michael@0 1442 fi
michael@0 1443 case "${target_os}" in
michael@0 1444 aix4.1*)
michael@0 1445 DLL_SUFFIX='_shr.a'
michael@0 1446 ;;
michael@0 1447 esac
michael@0 1448 if test "$COMPILE_ENVIRONMENT"; then
michael@0 1449 MOZ_CHECK_HEADERS(sys/inttypes.h)
michael@0 1450 fi
michael@0 1451 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
michael@0 1452 ;;
michael@0 1453
michael@0 1454 *-darwin*)
michael@0 1455 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
michael@0 1456 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
michael@0 1457 MOZ_OPTIMIZE_FLAGS="-O3 -fno-stack-protector"
michael@0 1458 CFLAGS="$CFLAGS -fno-common"
michael@0 1459 CXXFLAGS="$CXXFLAGS -fno-common"
michael@0 1460 DLL_SUFFIX=".dylib"
michael@0 1461 DSO_LDOPTS=''
michael@0 1462 STRIP="$STRIP -x -S"
michael@0 1463 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
michael@0 1464 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
michael@0 1465 LDFLAGS="$LDFLAGS -lobjc"
michael@0 1466 # The ExceptionHandling framework is needed for Objective-C exception
michael@0 1467 # logging code in nsObjCExceptions.h. Currently we only use that in debug
michael@0 1468 # builds.
michael@0 1469 _SAVE_LDFLAGS=$LDFLAGS
michael@0 1470 AC_MSG_CHECKING([for -framework ExceptionHandling])
michael@0 1471 LDFLAGS="$LDFLAGS -framework ExceptionHandling"
michael@0 1472 AC_TRY_LINK(,[return 0;],
michael@0 1473 ac_cv_have_framework_exceptionhandling="yes",
michael@0 1474 ac_cv_have_framework_exceptionhandling="no")
michael@0 1475 AC_MSG_RESULT([$ac_cv_have_framework_exceptionhandling])
michael@0 1476 if test "$ac_cv_have_framework_exceptionhandling" = "yes"; then
michael@0 1477 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
michael@0 1478 fi
michael@0 1479 LDFLAGS=$_SAVE_LDFLAGS
michael@0 1480
michael@0 1481 if test "x$lto_is_enabled" = "xyes"; then
michael@0 1482 echo "Skipping -dead_strip because lto is enabled."
michael@0 1483 dnl DTrace and -dead_strip don't interact well. See bug 403132.
michael@0 1484 dnl ===================================================================
michael@0 1485 elif test "x$enable_dtrace" = "xyes"; then
michael@0 1486 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
michael@0 1487 else
michael@0 1488 dnl check for the presence of the -dead_strip linker flag
michael@0 1489 AC_MSG_CHECKING([for -dead_strip option to ld])
michael@0 1490 _SAVE_LDFLAGS=$LDFLAGS
michael@0 1491 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
michael@0 1492 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
michael@0 1493 if test -n "$_HAVE_DEAD_STRIP" ; then
michael@0 1494 AC_MSG_RESULT([yes])
michael@0 1495 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
michael@0 1496 else
michael@0 1497 AC_MSG_RESULT([no])
michael@0 1498 fi
michael@0 1499
michael@0 1500 LDFLAGS=$_SAVE_LDFLAGS
michael@0 1501 fi
michael@0 1502 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
michael@0 1503 ;;
michael@0 1504
michael@0 1505 ia64*-hpux*)
michael@0 1506 DLL_SUFFIX=".so"
michael@0 1507 if test ! "$GNU_CC"; then
michael@0 1508 DSO_LDOPTS='-b'
michael@0 1509 DSO_CFLAGS=""
michael@0 1510 DSO_PIC_CFLAGS=
michael@0 1511 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
michael@0 1512 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
michael@0 1513 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
michael@0 1514 else
michael@0 1515 DSO_LDOPTS='-b -E'
michael@0 1516 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
michael@0 1517 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
michael@0 1518 fi
michael@0 1519 MOZ_FIX_LINK_PATHS=
michael@0 1520 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
michael@0 1521 AC_DEFINE(_LARGEFILE64_SOURCE)
michael@0 1522 ;;
michael@0 1523
michael@0 1524 *-hpux*)
michael@0 1525 DLL_SUFFIX=".sl"
michael@0 1526 if test ! "$GNU_CC"; then
michael@0 1527 DSO_LDOPTS='-b -Wl,+s'
michael@0 1528 DSO_CFLAGS=""
michael@0 1529 DSO_PIC_CFLAGS="+Z"
michael@0 1530 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
michael@0 1531 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
michael@0 1532 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
michael@0 1533 else
michael@0 1534 DSO_LDOPTS='-b -E +s'
michael@0 1535 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
michael@0 1536 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
michael@0 1537 fi
michael@0 1538 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
michael@0 1539 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
michael@0 1540 ;;
michael@0 1541
michael@0 1542 *-android*|*-linuxandroid*)
michael@0 1543 AC_DEFINE(NO_PW_GECOS)
michael@0 1544 no_x=yes
michael@0 1545 _PLATFORM_DEFAULT_TOOLKIT=cairo-android
michael@0 1546 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
michael@0 1547
michael@0 1548 MOZ_GFX_OPTIMIZE_MOBILE=1
michael@0 1549 MOZ_OPTIMIZE_FLAGS="-O3 -freorder-blocks -fno-reorder-functions"
michael@0 1550 # The Maemo builders don't know about this flag
michael@0 1551 MOZ_ARM_VFP_FLAGS="-mfpu=vfp"
michael@0 1552 ;;
michael@0 1553
michael@0 1554 *-*linux*)
michael@0 1555 # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
michael@0 1556 # Similarly for GNU_CXX and INTEL_CXX.
michael@0 1557 if test "$INTEL_CC" -o "$INTEL_CXX"; then
michael@0 1558 # -Os has been broken on Intel's C/C++ compilers for quite a
michael@0 1559 # while; Intel recommends against using it.
michael@0 1560 MOZ_OPTIMIZE_FLAGS="-O2"
michael@0 1561 elif test "$GNU_CC" -o "$GNU_CXX"; then
michael@0 1562 case $GCC_VERSION in
michael@0 1563 4.5.*)
michael@0 1564 # -Os is broken on gcc 4.5.x we need to tweak it to get good results.
michael@0 1565 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
michael@0 1566 esac
michael@0 1567 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
michael@0 1568 MOZ_OPTIMIZE_FLAGS="-O3 -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
michael@0 1569 fi
michael@0 1570
michael@0 1571 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
michael@0 1572
michael@0 1573 case "${target_cpu}" in
michael@0 1574 alpha*)
michael@0 1575 CFLAGS="$CFLAGS -mieee"
michael@0 1576 CXXFLAGS="$CXXFLAGS -mieee"
michael@0 1577 ;;
michael@0 1578 esac
michael@0 1579
michael@0 1580 if test -z "$MC"; then
michael@0 1581 MC=mc.exe
michael@0 1582 fi
michael@0 1583 ;;
michael@0 1584
michael@0 1585 *-mingw*)
michael@0 1586 DSO_CFLAGS=
michael@0 1587 DSO_PIC_CFLAGS=
michael@0 1588 DLL_SUFFIX=.dll
michael@0 1589 RC=rc.exe
michael@0 1590 MC=mc.exe
michael@0 1591 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
michael@0 1592 CC="$CC -mwindows"
michael@0 1593 CXX="$CXX -mwindows"
michael@0 1594 CPP="$CPP -mwindows"
michael@0 1595 CFLAGS="$CFLAGS -mms-bitfields"
michael@0 1596 CXXFLAGS="$CXXFLAGS -mms-bitfields"
michael@0 1597 DSO_LDOPTS='-shared'
michael@0 1598 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
michael@0 1599 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
michael@0 1600 RC='$(WINDRES)'
michael@0 1601 # Use static libgcc and libstdc++
michael@0 1602 LDFLAGS="$LDFLAGS -static-libgcc -static-libstdc++"
michael@0 1603 # Use temp file for windres (bug 213281)
michael@0 1604 RCFLAGS='-O coff --use-temp-file'
michael@0 1605 # mingw doesn't require kernel32, user32, and advapi32 explicitly
michael@0 1606 LIBS="$LIBS -lgdi32 -lwinmm -lwsock32 -lpsapi"
michael@0 1607 MOZ_FIX_LINK_PATHS=
michael@0 1608 DLL_PREFIX=
michael@0 1609 IMPORT_LIB_SUFFIX=dll.a
michael@0 1610
michael@0 1611 # We use mix of both POSIX and Win32 printf format across the tree, so format
michael@0 1612 # warnings are useless on mingw.
michael@0 1613 MOZ_C_SUPPORTS_WARNING(-Wno-, format, ac_c_has_wno_format)
michael@0 1614 MOZ_CXX_SUPPORTS_WARNING(-Wno-, format, ac_cxx_has_wno_format)
michael@0 1615 else
michael@0 1616 TARGET_COMPILER_ABI=msvc
michael@0 1617 HOST_CC='$(CC)'
michael@0 1618 HOST_CXX='$(CXX)'
michael@0 1619 HOST_LD='$(LD)'
michael@0 1620 if test "$AS_BIN"; then
michael@0 1621 AS="$(basename "$AS_BIN")"
michael@0 1622 fi
michael@0 1623 AR='lib'
michael@0 1624 AR_FLAGS='-NOLOGO -OUT:$@'
michael@0 1625 AR_EXTRACT=
michael@0 1626 RANLIB='echo not_ranlib'
michael@0 1627 STRIP='echo not_strip'
michael@0 1628 PKG_SKIP_STRIP=1
michael@0 1629 XARGS=xargs
michael@0 1630 DOXYGEN=:
michael@0 1631 ASM_SUFFIX=asm
michael@0 1632 OBJ_SUFFIX=obj
michael@0 1633 LIB_SUFFIX=lib
michael@0 1634 DLL_PREFIX=
michael@0 1635 LIB_PREFIX=
michael@0 1636 IMPORT_LIB_SUFFIX=lib
michael@0 1637 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
michael@0 1638 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
michael@0 1639 MKSHLIB_FORCE_ALL=
michael@0 1640 MKSHLIB_UNFORCE_ALL=
michael@0 1641 DSO_LDOPTS=-SUBSYSTEM:WINDOWS
michael@0 1642 _USE_CPP_INCLUDE_FLAG=1
michael@0 1643 _DEFINES_CFLAGS='-FI $(DEPTH)/js/src/js-confdefs.h -DMOZILLA_CLIENT'
michael@0 1644 _DEFINES_CXXFLAGS='-FI $(DEPTH)/js/src/js-confdefs.h -DMOZILLA_CLIENT'
michael@0 1645 CFLAGS="$CFLAGS -W3 -Gy"
michael@0 1646 CXXFLAGS="$CXXFLAGS -W3 -Gy"
michael@0 1647 if test "$_CC_SUITE" -ge "12"; then
michael@0 1648 dnl VS2013+ requires -FS when parallel building by make -jN.
michael@0 1649 dnl If nothing, compiler sometimes causes C1041 error.
michael@0 1650 dnl
michael@0 1651 dnl Visual Studio 2013 supports -Gw flags
michael@0 1652 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
michael@0 1653 CFLAGS="$CFLAGS -FS -Gw"
michael@0 1654 CXXFLAGS="$CXXFLAGS -FS -Gw"
michael@0 1655 fi
michael@0 1656 # khuey says we can safely ignore MSVC warning C4251
michael@0 1657 # MSVC warning C4244 (implicit type conversion may lose data) warns
michael@0 1658 # and requires workarounds for perfectly valid code. Also, GCC/clang
michael@0 1659 # don't warn about it by default. So for consistency/sanity, we turn
michael@0 1660 # it off on MSVC, too.
michael@0 1661 CFLAGS="$CFLAGS -wd4244"
michael@0 1662 CXXFLAGS="$CXXFLAGS -wd4244 -wd4251"
michael@0 1663 # make 'foo == bar;' error out
michael@0 1664 CFLAGS="$CFLAGS -we4553"
michael@0 1665 CXXFLAGS="$CXXFLAGS -we4553"
michael@0 1666 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib psapi.lib"
michael@0 1667 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
michael@0 1668 WARNINGS_AS_ERRORS='-WX'
michael@0 1669 MOZ_OPTIMIZE_FLAGS="-O2"
michael@0 1670 MOZ_FIX_LINK_PATHS=
michael@0 1671 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
michael@0 1672 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
michael@0 1673 if test -z "$DEVELOPER_OPTIONS"; then
michael@0 1674 LDFLAGS="$LDFLAGS -RELEASE"
michael@0 1675 fi
michael@0 1676 dnl For profile-guided optimization
michael@0 1677 PROFILE_GEN_CFLAGS="-GL"
michael@0 1678 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
michael@0 1679 dnl XXX: PGO builds can fail with warnings treated as errors,
michael@0 1680 dnl specifically "no profile data available" appears to be
michael@0 1681 dnl treated as an error sometimes. This might be a consequence
michael@0 1682 dnl of using WARNINGS_AS_ERRORS in some modules, combined
michael@0 1683 dnl with the linker doing most of the work in the whole-program
michael@0 1684 dnl optimization/PGO case. I think it's probably a compiler bug,
michael@0 1685 dnl but we work around it here.
michael@0 1686 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
michael@0 1687 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
michael@0 1688 dnl Probably also a compiler bug, but what can you do?
michael@0 1689 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
michael@0 1690 LDFLAGS="$LDFLAGS -DYNAMICBASE"
michael@0 1691 fi
michael@0 1692 AC_DEFINE(HAVE_SNPRINTF)
michael@0 1693 AC_DEFINE(_WINDOWS)
michael@0 1694 AC_DEFINE(WIN32)
michael@0 1695 AC_DEFINE(XP_WIN)
michael@0 1696 AC_DEFINE(XP_WIN32)
michael@0 1697 AC_DEFINE(HW_THREADS)
michael@0 1698 AC_DEFINE(STDC_HEADERS)
michael@0 1699 AC_DEFINE(WIN32_LEAN_AND_MEAN)
michael@0 1700 TARGET_MD_ARCH=win32
michael@0 1701 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
michael@0 1702 BIN_SUFFIX='.exe'
michael@0 1703 MOZ_USER_DIR="Mozilla"
michael@0 1704
michael@0 1705 dnl Hardcode to win95 for now - cls
michael@0 1706 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
michael@0 1707
michael@0 1708 dnl set NO_X11 defines here as the general check is skipped on win32
michael@0 1709 no_x=yes
michael@0 1710 AC_DEFINE(NO_X11)
michael@0 1711
michael@0 1712 case "$host" in
michael@0 1713 *-mingw*)
michael@0 1714 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
michael@0 1715 ;;
michael@0 1716 esac
michael@0 1717
michael@0 1718 case "$host" in
michael@0 1719 *-mingw*)
michael@0 1720 if test -z "$MOZ_TOOLS"; then
michael@0 1721 AC_MSG_ERROR([MOZ_TOOLS is not set])
michael@0 1722 fi
michael@0 1723 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
michael@0 1724 if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
michael@0 1725 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
michael@0 1726 fi
michael@0 1727 MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
michael@0 1728 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
michael@0 1729 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
michael@0 1730 fi
michael@0 1731 ;;
michael@0 1732 esac
michael@0 1733
michael@0 1734 case "$host_os" in
michael@0 1735 cygwin*|msvc*|mks*)
michael@0 1736 AC_MSG_ERROR([Using a Cygwin build environment is unsupported. Configure cannot check for presence of necessary headers. Please upgrade to MozillaBuild; see https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
michael@0 1737 ;;
michael@0 1738 esac
michael@0 1739
michael@0 1740 case "$target" in
michael@0 1741 i*86-*)
michael@0 1742 if test "$HAVE_64BIT_OS"; then
michael@0 1743 AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
michael@0 1744 fi
michael@0 1745
michael@0 1746 if test -n "$GNU_CC"; then
michael@0 1747 CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
michael@0 1748 CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
michael@0 1749 LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
michael@0 1750 else
michael@0 1751 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
michael@0 1752 LDFLAGS="$LDFLAGS -SAFESEH"
michael@0 1753 fi
michael@0 1754
michael@0 1755 AC_DEFINE(_X86_)
michael@0 1756 ;;
michael@0 1757 x86_64-*)
michael@0 1758 if test -n "$_WIN32_MSVC"; then
michael@0 1759 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
michael@0 1760 fi
michael@0 1761 AC_DEFINE(_AMD64_)
michael@0 1762 ;;
michael@0 1763 *)
michael@0 1764 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
michael@0 1765 ;;
michael@0 1766 esac
michael@0 1767 ;;
michael@0 1768
michael@0 1769 *-netbsd*)
michael@0 1770 DSO_CFLAGS=''
michael@0 1771 CFLAGS="$CFLAGS -Dunix"
michael@0 1772 CXXFLAGS="$CXXFLAGS -Dunix"
michael@0 1773 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
michael@0 1774 DLL_SUFFIX=".so"
michael@0 1775 DSO_PIC_CFLAGS='-fPIC -DPIC'
michael@0 1776 DSO_LDOPTS='-shared'
michael@0 1777 BIN_FLAGS='-Wl,--export-dynamic'
michael@0 1778 else
michael@0 1779 DSO_PIC_CFLAGS='-fPIC -DPIC'
michael@0 1780 DLL_SUFFIX=".so.1.0"
michael@0 1781 DSO_LDOPTS='-shared'
michael@0 1782 fi
michael@0 1783 # This will fail on a.out systems prior to 1.5.1_ALPHA.
michael@0 1784 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
michael@0 1785 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
michael@0 1786 if test "$LIBRUNPATH"; then
michael@0 1787 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
michael@0 1788 fi
michael@0 1789 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(notdir $@) -o $@'
michael@0 1790 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(notdir $@) -o $@'
michael@0 1791 ;;
michael@0 1792
michael@0 1793 *-openbsd*)
michael@0 1794 DLL_SUFFIX=".so.1.0"
michael@0 1795 DSO_CFLAGS=''
michael@0 1796 DSO_PIC_CFLAGS='-fPIC'
michael@0 1797 DSO_LDOPTS='-shared -fPIC'
michael@0 1798 if test "$LIBRUNPATH"; then
michael@0 1799 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
michael@0 1800 fi
michael@0 1801 ;;
michael@0 1802
michael@0 1803 *-solaris*)
michael@0 1804 AC_DEFINE(SOLARIS)
michael@0 1805 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
michael@0 1806 if test -z "$CROSS_COMPILE" && pkginfo -q SUNWpr && pkginfo -q SUNWprd; then
michael@0 1807 NO_NSPR_CONFIG_SYSTEM_LDFLAGS="-L/usr/lib/mps -R/usr/lib/mps -lnspr4"
michael@0 1808 NO_NSPR_CONFIG_SYSTEM_CFLAGS="-I/usr/include/mps"
michael@0 1809 NO_NSPR_CONFIG_SYSTEM_VERSION=["`pkgparam SUNWpr SUNW_PRODVERS | sed -e 's/^[1-9][0-9]*\.[0-9][0-9]*$/&.0/'`"]
michael@0 1810 fi
michael@0 1811 MOZ_FIX_LINK_PATHS=
michael@0 1812 # $ORIGIN/.. is for shared libraries under components/ to locate shared
michael@0 1813 # libraries one level up (e.g. libnspr4.so)
michael@0 1814 if test "$SOLARIS_SUNPRO_CC"; then
michael@0 1815 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
michael@0 1816 LIBS="-lCrun -lCstd -lc $LIBS"
michael@0 1817 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
michael@0 1818 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
michael@0 1819 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
michael@0 1820 LDFLAGS="-xildoff $LDFLAGS"
michael@0 1821 if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
michael@0 1822 _SAVE_LDFLAGS=$LDFLAGS
michael@0 1823 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
michael@0 1824 AC_TRY_LINK([#include <stdio.h>],
michael@0 1825 [printf("Hello World\n");],
michael@0 1826 ,
michael@0 1827 [LDFLAGS=$_SAVE_LDFLAGS])
michael@0 1828 fi
michael@0 1829 MOZ_OPTIMIZE_FLAGS="-xO4"
michael@0 1830 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
michael@0 1831 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(notdir $@) -o $@'
michael@0 1832 MKSHLIB_FORCE_ALL='-z allextract'
michael@0 1833 MKSHLIB_UNFORCE_ALL='-z defaultextract'
michael@0 1834 DSO_LDOPTS='-G'
michael@0 1835 AR_LIST="$AR t"
michael@0 1836 AR_EXTRACT="$AR x"
michael@0 1837 AR_DELETE="$AR d"
michael@0 1838 AR='$(CXX) -xar'
michael@0 1839 AR_FLAGS='-o $@'
michael@0 1840 AS='/usr/ccs/bin/as'
michael@0 1841 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
michael@0 1842 AS_DASH_C_FLAG=''
michael@0 1843 TARGET_COMPILER_ABI="sunc"
michael@0 1844 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
michael@0 1845 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
michael@0 1846 AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
michael@0 1847 AC_LANG_SAVE
michael@0 1848 AC_LANG_CPLUSPLUS
michael@0 1849 AC_TRY_COMPILE([],
michael@0 1850 [#if (__SUNPRO_CC < 0x590)
michael@0 1851 #error "Denied"
michael@0 1852 #endif],
michael@0 1853 _BAD_COMPILER=,_BAD_COMPILER=1)
michael@0 1854 if test -n "$_BAD_COMPILER"; then
michael@0 1855 _res="no"
michael@0 1856 AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
michael@0 1857 else
michael@0 1858 _res="yes"
michael@0 1859 fi
michael@0 1860 AC_TRY_COMPILE([],
michael@0 1861 [#if (__SUNPRO_CC >= 0x5100)
michael@0 1862 #error "Sun C++ 5.10 or above"
michael@0 1863 #endif],
michael@0 1864 _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
michael@0 1865 if test "$_ABOVE_SS12U1"; then
michael@0 1866 # disable xannotate
michael@0 1867 CXXFLAGS="$CXXFLAGS -xannotate=no"
michael@0 1868 fi
michael@0 1869 AC_MSG_RESULT([$_res])
michael@0 1870 AC_LANG_RESTORE
michael@0 1871 else
michael@0 1872 LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
michael@0 1873 LIBS="-lc $LIBS"
michael@0 1874 MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
michael@0 1875 MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
michael@0 1876 ASFLAGS="$ASFLAGS -fPIC"
michael@0 1877 DSO_LDOPTS='-shared'
michael@0 1878 WARNINGS_AS_ERRORS='-Werror'
michael@0 1879 _WARNINGS_CFLAGS=''
michael@0 1880 _WARNINGS_CXXFLAGS=''
michael@0 1881 if test "$OS_RELEASE" = "5.3"; then
michael@0 1882 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
michael@0 1883 fi
michael@0 1884 fi
michael@0 1885 if test "$OS_RELEASE" = "5.5.1"; then
michael@0 1886 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
michael@0 1887 fi
michael@0 1888 ;;
michael@0 1889
michael@0 1890 *-sunos*)
michael@0 1891 DSO_LDOPTS='-Bdynamic'
michael@0 1892 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
michael@0 1893 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
michael@0 1894 AC_DEFINE(SUNOS4)
michael@0 1895 AC_DEFINE(SPRINTF_RETURNS_STRING)
michael@0 1896 case "$(target_os)" in
michael@0 1897 sunos4.1*)
michael@0 1898 DLL_SUFFIX='.so.1.0'
michael@0 1899 ;;
michael@0 1900 esac
michael@0 1901 ;;
michael@0 1902
michael@0 1903 esac
michael@0 1904
michael@0 1905 dnl Only one oddball right now (QNX), but this gives us flexibility
michael@0 1906 dnl if any other platforms need to override this in the future.
michael@0 1907 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
michael@0 1908
michael@0 1909 dnl ========================================================
michael@0 1910 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
michael@0 1911 dnl by now will not have any way to link most binaries (tests
michael@0 1912 dnl as well as viewer, apprunner, etc.), because some symbols
michael@0 1913 dnl will be left out of the "composite" .so's by ld as unneeded.
michael@0 1914 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
michael@0 1915 dnl they can link in the static libs that provide the missing
michael@0 1916 dnl symbols.
michael@0 1917 dnl ========================================================
michael@0 1918 NO_LD_ARCHIVE_FLAGS=
michael@0 1919 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
michael@0 1920 NO_LD_ARCHIVE_FLAGS=1
michael@0 1921 fi
michael@0 1922 case "$target" in
michael@0 1923 *-aix4.3*|*-aix5*)
michael@0 1924 NO_LD_ARCHIVE_FLAGS=
michael@0 1925 ;;
michael@0 1926 *-mingw*)
michael@0 1927 if test -z "$GNU_CC"; then
michael@0 1928 NO_LD_ARCHIVE_FLAGS=
michael@0 1929 fi
michael@0 1930 ;;
michael@0 1931 esac
michael@0 1932 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
michael@0 1933
michael@0 1934 dnl ========================================================
michael@0 1935 dnl = Flags to strip unused symbols from .so components
michael@0 1936 dnl ========================================================
michael@0 1937 case "$target" in
michael@0 1938 *-linux*|*-kfreebsd*-gnu|*-gnu*)
michael@0 1939 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
michael@0 1940 ;;
michael@0 1941 *-solaris*)
michael@0 1942 if test -z "$GNU_CC"; then
michael@0 1943 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
michael@0 1944 else
michael@0 1945 if test -z "$GCC_USE_GNU_LD"; then
michael@0 1946 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
michael@0 1947 else
michael@0 1948 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
michael@0 1949 fi
michael@0 1950 fi
michael@0 1951 ;;
michael@0 1952 *-darwin*)
michael@0 1953 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
michael@0 1954 ;;
michael@0 1955 *-mingw*)
michael@0 1956 if test -n "$GNU_CC"; then
michael@0 1957 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
michael@0 1958 fi
michael@0 1959 ;;
michael@0 1960 esac
michael@0 1961
michael@0 1962 if test -z "$COMPILE_ENVIRONMENT"; then
michael@0 1963 SKIP_COMPILER_CHECKS=1
michael@0 1964 SKIP_LIBRARY_CHECKS=1
michael@0 1965 fi
michael@0 1966
michael@0 1967 dnl Configure JIT support
michael@0 1968
michael@0 1969 case "$target" in
michael@0 1970 i?86-*)
michael@0 1971 ENABLE_ION=1
michael@0 1972 ENABLE_YARR_JIT=1
michael@0 1973 AC_DEFINE(JS_CPU_X86)
michael@0 1974 AC_DEFINE(JS_NUNBOX32)
michael@0 1975 ;;
michael@0 1976 x86_64*-*)
michael@0 1977 ENABLE_ION=1
michael@0 1978 ENABLE_YARR_JIT=1
michael@0 1979 AC_DEFINE(JS_CPU_X64)
michael@0 1980 AC_DEFINE(JS_PUNBOX64)
michael@0 1981 ;;
michael@0 1982 arm*-*)
michael@0 1983 ENABLE_ION=1
michael@0 1984 ENABLE_YARR_JIT=1
michael@0 1985 AC_DEFINE(JS_CPU_ARM)
michael@0 1986 AC_DEFINE(JS_NUNBOX32)
michael@0 1987 ;;
michael@0 1988 sparc*-*)
michael@0 1989 if test ! "$HAVE_64BIT_OS" ; then
michael@0 1990 dnl ENABLE_ION=0
michael@0 1991 AC_DEFINE(JS_CPU_SPARC)
michael@0 1992 AC_DEFINE(JS_NUNBOX32)
michael@0 1993 fi
michael@0 1994 ;;
michael@0 1995 mips*-*)
michael@0 1996 AC_DEFINE(JS_CPU_MIPS)
michael@0 1997 AC_DEFINE(JS_NUNBOX32)
michael@0 1998 ;;
michael@0 1999 esac
michael@0 2000
michael@0 2001 MOZ_ARG_DISABLE_BOOL(ion,
michael@0 2002 [ --disable-ion Disable use of the IonMonkey JIT],
michael@0 2003 ENABLE_ION= )
michael@0 2004
michael@0 2005 MOZ_ARG_DISABLE_BOOL(yarr-jit,
michael@0 2006 [ --disable-yarr-jit Disable YARR JIT support],
michael@0 2007 ENABLE_YARR_JIT= )
michael@0 2008
michael@0 2009 AC_SUBST(ENABLE_METHODJIT_SPEW)
michael@0 2010
michael@0 2011 AC_SUBST(ENABLE_ION)
michael@0 2012
michael@0 2013 if test "$ENABLE_ION"; then
michael@0 2014 AC_DEFINE(JS_ION)
michael@0 2015 fi
michael@0 2016
michael@0 2017 AC_SUBST(ENABLE_YARR_JIT)
michael@0 2018
michael@0 2019 if test "$ENABLE_YARR_JIT"; then
michael@0 2020 AC_DEFINE(ENABLE_YARR_JIT)
michael@0 2021 fi
michael@0 2022
michael@0 2023 if test -n "$COMPILE_ENVIRONMENT"; then
michael@0 2024 MOZ_COMPILER_OPTS
michael@0 2025 fi
michael@0 2026
michael@0 2027 if test -z "$SKIP_COMPILER_CHECKS"; then
michael@0 2028 dnl Checks for typedefs, structures, and compiler characteristics.
michael@0 2029 dnl ========================================================
michael@0 2030 AC_HEADER_STDC
michael@0 2031 AC_C_CONST
michael@0 2032 AC_TYPE_MODE_T
michael@0 2033 AC_TYPE_OFF_T
michael@0 2034 AC_TYPE_PID_T
michael@0 2035 AC_TYPE_SIZE_T
michael@0 2036 AC_LANG_CPLUSPLUS
michael@0 2037 AC_LANG_C
michael@0 2038 AC_MSG_CHECKING(for ssize_t)
michael@0 2039 AC_CACHE_VAL(ac_cv_type_ssize_t,
michael@0 2040 [AC_TRY_COMPILE([#include <stdio.h>
michael@0 2041 #include <sys/types.h>],
michael@0 2042 [ssize_t foo = 0;],
michael@0 2043 [ac_cv_type_ssize_t=true],
michael@0 2044 [ac_cv_type_ssize_t=false])])
michael@0 2045 if test "$ac_cv_type_ssize_t" = true ; then
michael@0 2046 AC_DEFINE(HAVE_SSIZE_T)
michael@0 2047 AC_MSG_RESULT(yes)
michael@0 2048 else
michael@0 2049 AC_MSG_RESULT(no)
michael@0 2050 fi
michael@0 2051 AC_STRUCT_ST_BLKSIZE
michael@0 2052 AC_MSG_CHECKING(for siginfo_t)
michael@0 2053 AC_CACHE_VAL(ac_cv_siginfo_t,
michael@0 2054 [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
michael@0 2055 #include <signal.h>],
michael@0 2056 [siginfo_t* info;],
michael@0 2057 [ac_cv_siginfo_t=true],
michael@0 2058 [ac_cv_siginfo_t=false])])
michael@0 2059 if test "$ac_cv_siginfo_t" = true ; then
michael@0 2060 AC_DEFINE(HAVE_SIGINFO_T)
michael@0 2061 AC_MSG_RESULT(yes)
michael@0 2062 else
michael@0 2063 AC_MSG_RESULT(no)
michael@0 2064 fi
michael@0 2065
michael@0 2066 MOZ_CHECK_HEADERS(endian.h)
michael@0 2067 if test "$ac_cv_header_endian_h" = yes; then
michael@0 2068 AC_DEFINE(JS_HAVE_ENDIAN_H)
michael@0 2069 fi
michael@0 2070
michael@0 2071 MOZ_CHECK_HEADERS([machine/endian.h],[],[],[#include <sys/types.h>])
michael@0 2072 if test "$ac_cv_header_machine_endian_h" = yes; then
michael@0 2073 AC_DEFINE(JS_HAVE_MACHINE_ENDIAN_H)
michael@0 2074 fi
michael@0 2075
michael@0 2076 MOZ_CHECK_HEADERS(sys/isa_defs.h)
michael@0 2077 if test "$ac_cv_header_sys_isa_defs_h" = yes; then
michael@0 2078 AC_DEFINE(JS_HAVE_SYS_ISA_DEFS_H)
michael@0 2079 fi
michael@0 2080
michael@0 2081 AC_LANG_CPLUSPLUS
michael@0 2082
michael@0 2083 MOZ_CXX11
michael@0 2084
michael@0 2085 dnl Check for .hidden assembler directive and visibility attribute.
michael@0 2086 dnl Borrowed from glibc configure.in
michael@0 2087 dnl ===============================================================
michael@0 2088 if test "$GNU_CC"; then
michael@0 2089 AC_CACHE_CHECK(for visibility(hidden) attribute,
michael@0 2090 ac_cv_visibility_hidden,
michael@0 2091 [cat > conftest.c <<EOF
michael@0 2092 int foo __attribute__ ((visibility ("hidden"))) = 1;
michael@0 2093 EOF
michael@0 2094 ac_cv_visibility_hidden=no
michael@0 2095 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
michael@0 2096 if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
michael@0 2097 ac_cv_visibility_hidden=yes
michael@0 2098 fi
michael@0 2099 fi
michael@0 2100 rm -f conftest.[cs]
michael@0 2101 ])
michael@0 2102 if test "$ac_cv_visibility_hidden" = "yes"; then
michael@0 2103 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
michael@0 2104
michael@0 2105 AC_CACHE_CHECK(for visibility(default) attribute,
michael@0 2106 ac_cv_visibility_default,
michael@0 2107 [cat > conftest.c <<EOF
michael@0 2108 int foo __attribute__ ((visibility ("default"))) = 1;
michael@0 2109 EOF
michael@0 2110 ac_cv_visibility_default=no
michael@0 2111 if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
michael@0 2112 if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
michael@0 2113 ac_cv_visibility_default=yes
michael@0 2114 fi
michael@0 2115 fi
michael@0 2116 rm -f conftest.[cs]
michael@0 2117 ])
michael@0 2118 if test "$ac_cv_visibility_default" = "yes"; then
michael@0 2119 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
michael@0 2120
michael@0 2121 AC_CACHE_CHECK(for visibility pragma support,
michael@0 2122 ac_cv_visibility_pragma,
michael@0 2123 [cat > conftest.c <<EOF
michael@0 2124 #pragma GCC visibility push(hidden)
michael@0 2125 int foo_hidden = 1;
michael@0 2126 #pragma GCC visibility push(default)
michael@0 2127 int foo_default = 1;
michael@0 2128 EOF
michael@0 2129 ac_cv_visibility_pragma=no
michael@0 2130 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
michael@0 2131 if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
michael@0 2132 if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
michael@0 2133 ac_cv_visibility_pragma=yes
michael@0 2134 fi
michael@0 2135 fi
michael@0 2136 fi
michael@0 2137 rm -f conftest.[cs]
michael@0 2138 ])
michael@0 2139 if test "$ac_cv_visibility_pragma" = "yes"; then
michael@0 2140 AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
michael@0 2141 ac_cv_have_visibility_class_bug,
michael@0 2142 [cat > conftest.c <<EOF
michael@0 2143 #pragma GCC visibility push(hidden)
michael@0 2144 struct __attribute__ ((visibility ("default"))) TestStruct {
michael@0 2145 static void Init();
michael@0 2146 };
michael@0 2147 __attribute__ ((visibility ("default"))) void TestFunc() {
michael@0 2148 TestStruct::Init();
michael@0 2149 }
michael@0 2150 EOF
michael@0 2151 ac_cv_have_visibility_class_bug=no
michael@0 2152 if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
michael@0 2153 ac_cv_have_visibility_class_bug=yes
michael@0 2154 else
michael@0 2155 if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
michael@0 2156 ac_cv_have_visibility_class_bug=yes
michael@0 2157 fi
michael@0 2158 fi
michael@0 2159 rm -rf conftest.{c,S}
michael@0 2160 ])
michael@0 2161
michael@0 2162 AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
michael@0 2163 ac_cv_have_visibility_builtin_bug,
michael@0 2164 [cat > conftest.c <<EOF
michael@0 2165 #pragma GCC visibility push(hidden)
michael@0 2166 #pragma GCC visibility push(default)
michael@0 2167 #include <string.h>
michael@0 2168 #pragma GCC visibility pop
michael@0 2169
michael@0 2170 __attribute__ ((visibility ("default"))) void Func() {
michael@0 2171 char c[[100]];
michael@0 2172 memset(c, 0, sizeof(c));
michael@0 2173 }
michael@0 2174 EOF
michael@0 2175 ac_cv_have_visibility_builtin_bug=no
michael@0 2176 if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
michael@0 2177 ac_cv_have_visibility_builtin_bug=yes
michael@0 2178 else
michael@0 2179 if test `grep -c "@PLT" conftest.S` = 0; then
michael@0 2180 ac_cv_visibility_builtin_bug=yes
michael@0 2181 fi
michael@0 2182 fi
michael@0 2183 rm -f conftest.{c,S}
michael@0 2184 ])
michael@0 2185 if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
michael@0 2186 "$ac_cv_have_visibility_class_bug" = "no"; then
michael@0 2187 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
michael@0 2188 WRAP_SYSTEM_INCLUDES=1
michael@0 2189 else
michael@0 2190 VISIBILITY_FLAGS='-fvisibility=hidden'
michael@0 2191 fi # have visibility pragma bug
michael@0 2192 fi # have visibility pragma
michael@0 2193 fi # have visibility(default) attribute
michael@0 2194 fi # have visibility(hidden) attribute
michael@0 2195 fi # GNU_CC
michael@0 2196
michael@0 2197 # visibility hidden flag for Sun Studio on Solaris
michael@0 2198 if test "$SOLARIS_SUNPRO_CC"; then
michael@0 2199 VISIBILITY_FLAGS='-xldscope=hidden'
michael@0 2200 fi # Sun Studio on Solaris
michael@0 2201
michael@0 2202 AC_SUBST(WRAP_SYSTEM_INCLUDES)
michael@0 2203 AC_SUBST(VISIBILITY_FLAGS)
michael@0 2204
michael@0 2205 MOZ_GCC_PR49911
michael@0 2206 MOZ_GCC_PR39608
michael@0 2207 if test "$OS_TARGET" != WINNT; then
michael@0 2208 # Only run this test with clang on non-Windows platforms, because clang
michael@0 2209 # cannot do enough code gen for now to make this test work correctly.
michael@0 2210 MOZ_LLVM_PR8927
michael@0 2211 fi
michael@0 2212
michael@0 2213 dnl Checks for header files.
michael@0 2214 dnl ========================================================
michael@0 2215 AC_HEADER_DIRENT
michael@0 2216 case "$target_os" in
michael@0 2217 freebsd*)
michael@0 2218 # for stuff like -lXshm
michael@0 2219 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
michael@0 2220 ;;
michael@0 2221 esac
michael@0 2222 MOZ_CHECK_COMMON_HEADERS
michael@0 2223
michael@0 2224 dnl These are all the places some variant of statfs can be hiding.
michael@0 2225 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
michael@0 2226
michael@0 2227 dnl Quota support
michael@0 2228 MOZ_CHECK_HEADERS(sys/quota.h)
michael@0 2229 MOZ_CHECK_HEADERS(linux/quota.h)
michael@0 2230
michael@0 2231 AC_ARG_ENABLE(dtrace,
michael@0 2232 [ --enable-dtrace build with dtrace support if available (default=no)],
michael@0 2233 [enable_dtrace="yes"],)
michael@0 2234 if test "x$enable_dtrace" = "xyes"; then
michael@0 2235 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
michael@0 2236 if test -n "$HAVE_DTRACE"; then
michael@0 2237 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
michael@0 2238 else
michael@0 2239 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
michael@0 2240 fi
michael@0 2241 fi
michael@0 2242 AC_SUBST(HAVE_DTRACE)
michael@0 2243
michael@0 2244 case $target in
michael@0 2245 *-aix4.3*|*-aix5*)
michael@0 2246 ;;
michael@0 2247 *)
michael@0 2248 MOZ_CHECK_HEADERS(sys/cdefs.h)
michael@0 2249 ;;
michael@0 2250 esac
michael@0 2251
michael@0 2252 MOZ_LINUX_PERF_EVENT
michael@0 2253
michael@0 2254 dnl Checks for libraries.
michael@0 2255 dnl ========================================================
michael@0 2256 case $target in
michael@0 2257 *-hpux11.*)
michael@0 2258 ;;
michael@0 2259 *)
michael@0 2260 AC_CHECK_LIB(c_r, gethostbyname_r)
michael@0 2261 ;;
michael@0 2262 esac
michael@0 2263
michael@0 2264 dnl We don't want to link with libdl even if it's present on OS X, since
michael@0 2265 dnl it's not used and not part of the default installation. OS/2 has dlfcn
michael@0 2266 dnl in libc.
michael@0 2267 dnl We don't want to link against libm or libpthread on Darwin since
michael@0 2268 dnl they both are just symlinks to libSystem and explicitly linking
michael@0 2269 dnl against libSystem causes issues when debugging (see bug 299601).
michael@0 2270 case $target in
michael@0 2271 *-darwin*)
michael@0 2272 ;;
michael@0 2273 *)
michael@0 2274 AC_SEARCH_LIBS(dlopen, dl,
michael@0 2275 MOZ_CHECK_HEADER(dlfcn.h,
michael@0 2276 AC_DEFINE(HAVE_DLOPEN)))
michael@0 2277 ;;
michael@0 2278 esac
michael@0 2279
michael@0 2280 if test ! "$GNU_CXX"; then
michael@0 2281
michael@0 2282 case $target in
michael@0 2283 *-aix*)
michael@0 2284 AC_CHECK_LIB(C_r, demangle)
michael@0 2285 ;;
michael@0 2286 *)
michael@0 2287 AC_CHECK_LIB(C, demangle)
michael@0 2288 ;;
michael@0 2289 esac
michael@0 2290 fi
michael@0 2291
michael@0 2292 AC_CHECK_LIB(socket, socket)
michael@0 2293
michael@0 2294 dnl ========================================================
michael@0 2295 dnl = pthread support
michael@0 2296 dnl = Start by checking whether the system support pthreads
michael@0 2297 dnl ========================================================
michael@0 2298 case "$target_os" in
michael@0 2299 darwin*)
michael@0 2300 USE_PTHREADS=1
michael@0 2301 ;;
michael@0 2302 *)
michael@0 2303 MOZ_CHECK_PTHREADS(pthreads,
michael@0 2304 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
michael@0 2305 MOZ_CHECK_PTHREADS(pthread,
michael@0 2306 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
michael@0 2307 MOZ_CHECK_PTHREADS(c_r,
michael@0 2308 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
michael@0 2309 MOZ_CHECK_PTHREADS(c,
michael@0 2310 USE_PTHREADS=1
michael@0 2311 )
michael@0 2312 )
michael@0 2313 )
michael@0 2314 )
michael@0 2315 ;;
michael@0 2316 esac
michael@0 2317
michael@0 2318 dnl ========================================================
michael@0 2319 dnl Check the command line for --with-pthreads
michael@0 2320 dnl ========================================================
michael@0 2321 MOZ_ARG_WITH_BOOL(pthreads,
michael@0 2322 [ --with-pthreads Force use of system pthread library with NSPR ],
michael@0 2323 [ if test "$USE_PTHREADS"x = x; then
michael@0 2324 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
michael@0 2325 fi],
michael@0 2326 USE_PTHREADS=
michael@0 2327 _PTHREAD_LDFLAGS=
michael@0 2328 )
michael@0 2329
michael@0 2330 dnl ========================================================
michael@0 2331 dnl Do the platform specific pthread hackery
michael@0 2332 dnl ========================================================
michael@0 2333 if test "$USE_PTHREADS"x != x
michael@0 2334 then
michael@0 2335 dnl
michael@0 2336 dnl See if -pthread is supported.
michael@0 2337 dnl
michael@0 2338 rm -f conftest*
michael@0 2339 ac_cv_have_dash_pthread=no
michael@0 2340 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
michael@0 2341 echo 'int main() { return 0; }' | cat > conftest.c
michael@0 2342 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
michael@0 2343 if test $? -eq 0; then
michael@0 2344 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
michael@0 2345 ac_cv_have_dash_pthread=yes
michael@0 2346 case "$target_os" in
michael@0 2347 freebsd*)
michael@0 2348 # Freebsd doesn't use -pthread for compiles, it uses them for linking
michael@0 2349 ;;
michael@0 2350 *)
michael@0 2351 CFLAGS="$CFLAGS -pthread"
michael@0 2352 CXXFLAGS="$CXXFLAGS -pthread"
michael@0 2353 ;;
michael@0 2354 esac
michael@0 2355 fi
michael@0 2356 fi
michael@0 2357 rm -f conftest*
michael@0 2358 AC_MSG_RESULT($ac_cv_have_dash_pthread)
michael@0 2359
michael@0 2360 dnl
michael@0 2361 dnl See if -pthreads is supported.
michael@0 2362 dnl
michael@0 2363 ac_cv_have_dash_pthreads=no
michael@0 2364 if test "$ac_cv_have_dash_pthread" = "no"; then
michael@0 2365 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
michael@0 2366 echo 'int main() { return 0; }' | cat > conftest.c
michael@0 2367 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
michael@0 2368 if test $? -eq 0; then
michael@0 2369 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
michael@0 2370 ac_cv_have_dash_pthreads=yes
michael@0 2371 CFLAGS="$CFLAGS -pthreads"
michael@0 2372 CXXFLAGS="$CXXFLAGS -pthreads"
michael@0 2373 fi
michael@0 2374 fi
michael@0 2375 rm -f conftest*
michael@0 2376 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
michael@0 2377 fi
michael@0 2378
michael@0 2379 case "$target" in
michael@0 2380 *-*-freebsd*)
michael@0 2381 AC_DEFINE(_REENTRANT)
michael@0 2382 AC_DEFINE(_THREAD_SAFE)
michael@0 2383 dnl -pthread links in -lpthread, so don't specify it explicitly.
michael@0 2384 if test "$ac_cv_have_dash_pthread" = "yes"; then
michael@0 2385 _PTHREAD_LDFLAGS="-pthread"
michael@0 2386 fi
michael@0 2387 ;;
michael@0 2388
michael@0 2389 *-*-openbsd*|*-*-bsdi*)
michael@0 2390 AC_DEFINE(_REENTRANT)
michael@0 2391 AC_DEFINE(_THREAD_SAFE)
michael@0 2392 dnl -pthread links in -lc_r, so don't specify it explicitly.
michael@0 2393 if test "$ac_cv_have_dash_pthread" = "yes"; then
michael@0 2394 _PTHREAD_LDFLAGS="-pthread"
michael@0 2395 fi
michael@0 2396 ;;
michael@0 2397
michael@0 2398 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
michael@0 2399 AC_DEFINE(_REENTRANT)
michael@0 2400 ;;
michael@0 2401
michael@0 2402 *-aix4.3*|*-aix5*)
michael@0 2403 AC_DEFINE(_REENTRANT)
michael@0 2404 ;;
michael@0 2405
michael@0 2406 *-hpux11.*)
michael@0 2407 AC_DEFINE(_REENTRANT)
michael@0 2408 ;;
michael@0 2409
michael@0 2410 *-*-solaris*)
michael@0 2411 AC_DEFINE(_REENTRANT)
michael@0 2412 if test "$SOLARIS_SUNPRO_CC"; then
michael@0 2413 CFLAGS="$CFLAGS -mt"
michael@0 2414 CXXFLAGS="$CXXFLAGS -mt"
michael@0 2415 fi
michael@0 2416 ;;
michael@0 2417 esac
michael@0 2418 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
michael@0 2419 fi
michael@0 2420
michael@0 2421
michael@0 2422 dnl Checks for library functions.
michael@0 2423 dnl ========================================================
michael@0 2424 AC_PROG_GCC_TRADITIONAL
michael@0 2425 AC_FUNC_MEMCMP
michael@0 2426 AC_CHECK_FUNCS([getc_unlocked _getc_nolock localtime_r])
michael@0 2427
michael@0 2428
michael@0 2429 dnl Checks for math functions.
michael@0 2430 dnl ========================================================
michael@0 2431 AC_CHECK_LIB(m, sin)
michael@0 2432 AC_CHECK_FUNCS([log2 log1p expm1 sqrt1pm1 acosh asinh atanh trunc cbrt])
michael@0 2433
michael@0 2434
michael@0 2435 dnl check for wcrtomb/mbrtowc
michael@0 2436 dnl =======================================================================
michael@0 2437 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
michael@0 2438 AC_LANG_SAVE
michael@0 2439 AC_LANG_CPLUSPLUS
michael@0 2440 AC_CACHE_CHECK(for wcrtomb,
michael@0 2441 ac_cv_have_wcrtomb,
michael@0 2442 [AC_TRY_LINK([#include <wchar.h>],
michael@0 2443 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
michael@0 2444 ac_cv_have_wcrtomb="yes",
michael@0 2445 ac_cv_have_wcrtomb="no")])
michael@0 2446 if test "$ac_cv_have_wcrtomb" = "yes"; then
michael@0 2447 AC_DEFINE(HAVE_WCRTOMB)
michael@0 2448 fi
michael@0 2449 AC_CACHE_CHECK(for mbrtowc,
michael@0 2450 ac_cv_have_mbrtowc,
michael@0 2451 [AC_TRY_LINK([#include <wchar.h>],
michael@0 2452 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
michael@0 2453 ac_cv_have_mbrtowc="yes",
michael@0 2454 ac_cv_have_mbrtowc="no")])
michael@0 2455 if test "$ac_cv_have_mbrtowc" = "yes"; then
michael@0 2456 AC_DEFINE(HAVE_MBRTOWC)
michael@0 2457 fi
michael@0 2458 AC_LANG_RESTORE
michael@0 2459 fi
michael@0 2460
michael@0 2461 AC_CACHE_CHECK(
michael@0 2462 [for res_ninit()],
michael@0 2463 ac_cv_func_res_ninit,
michael@0 2464 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
michael@0 2465 dnl no need for res_ninit() on NetBSD and OpenBSD
michael@0 2466 ac_cv_func_res_ninit=no
michael@0 2467 else
michael@0 2468 AC_TRY_LINK([
michael@0 2469 #ifdef linux
michael@0 2470 #define _BSD_SOURCE 1
michael@0 2471 #endif
michael@0 2472 #include <sys/types.h>
michael@0 2473 #include <netinet/in.h>
michael@0 2474 #include <arpa/nameser.h>
michael@0 2475 #include <resolv.h>
michael@0 2476 ],
michael@0 2477 [int foo = res_ninit(&_res);],
michael@0 2478 [ac_cv_func_res_ninit=yes],
michael@0 2479 [ac_cv_func_res_ninit=no])
michael@0 2480 fi
michael@0 2481 ])
michael@0 2482
michael@0 2483 if test "$ac_cv_func_res_ninit" = "yes"; then
michael@0 2484 AC_DEFINE(HAVE_RES_NINIT)
michael@0 2485 dnl must add the link line we do something as foolish as this... dougt
michael@0 2486 dnl else
michael@0 2487 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
michael@0 2488 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
michael@0 2489 fi
michael@0 2490
michael@0 2491 AM_LANGINFO_CODESET
michael@0 2492
michael@0 2493 AC_LANG_C
michael@0 2494
michael@0 2495 dnl **********************
michael@0 2496 dnl *** va_copy checks ***
michael@0 2497 dnl **********************
michael@0 2498 AC_CACHE_CHECK([for an implementation of va_copy()],
michael@0 2499 ac_cv_va_copy,
michael@0 2500 [AC_TRY_COMPILE([#include <stdarg.h>
michael@0 2501 #include <stdlib.h>
michael@0 2502 void f (int i, ...) {
michael@0 2503 va_list args1, args2;
michael@0 2504 va_start (args1, i);
michael@0 2505 va_copy (args2, args1);
michael@0 2506 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
michael@0 2507 exit (1);
michael@0 2508 va_end (args1); va_end (args2);
michael@0 2509 }],
michael@0 2510 [f(0, 42); return 0],
michael@0 2511 [ac_cv_va_copy=yes],
michael@0 2512 [ac_cv_va_copy=no]
michael@0 2513 )]
michael@0 2514 )
michael@0 2515 AC_CACHE_CHECK([whether va_list can be copied by value],
michael@0 2516 ac_cv_va_val_copy,
michael@0 2517 [AC_TRY_COMPILE([#include <stdarg.h>
michael@0 2518 #include <stdlib.h>
michael@0 2519 void f (int i, ...) {
michael@0 2520 va_list args1, args2;
michael@0 2521 va_start (args1, i);
michael@0 2522 args2 = args1;
michael@0 2523 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
michael@0 2524 exit (1);
michael@0 2525 va_end (args1); va_end (args2);
michael@0 2526 }],
michael@0 2527 [f(0, 42); return 0],
michael@0 2528 [ac_cv_va_val_copy=yes],
michael@0 2529 [ac_cv_va_val_copy=no],
michael@0 2530 )]
michael@0 2531 )
michael@0 2532 if test "x$ac_cv_va_copy" = "xyes"; then
michael@0 2533 AC_DEFINE(VA_COPY, va_copy)
michael@0 2534 AC_DEFINE(HAVE_VA_COPY)
michael@0 2535 fi
michael@0 2536
michael@0 2537 if test "x$ac_cv_va_val_copy" = "xno"; then
michael@0 2538 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
michael@0 2539 fi
michael@0 2540
michael@0 2541 dnl ===================================================================
michael@0 2542 dnl ========================================================
michael@0 2543 dnl Put your C++ language/feature checks below
michael@0 2544 dnl ========================================================
michael@0 2545 AC_LANG_CPLUSPLUS
michael@0 2546
michael@0 2547 ARM_ABI_PREFIX=
michael@0 2548 if test "$GNU_CC"; then
michael@0 2549 if test "$CPU_ARCH" = "arm" ; then
michael@0 2550 AC_CACHE_CHECK(for ARM EABI,
michael@0 2551 ac_cv_gcc_arm_eabi,
michael@0 2552 [AC_TRY_COMPILE([],
michael@0 2553 [
michael@0 2554 #if defined(__ARM_EABI__)
michael@0 2555 return 0;
michael@0 2556 #else
michael@0 2557 #error Not ARM EABI.
michael@0 2558 #endif
michael@0 2559 ],
michael@0 2560 ac_cv_gcc_arm_eabi="yes",
michael@0 2561 ac_cv_gcc_arm_eabi="no")])
michael@0 2562 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
michael@0 2563 HAVE_ARM_EABI=1
michael@0 2564 ARM_ABI_PREFIX=eabi-
michael@0 2565 else
michael@0 2566 ARM_ABI_PREFIX=oabi-
michael@0 2567 fi
michael@0 2568 fi
michael@0 2569
michael@0 2570 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
michael@0 2571 fi
michael@0 2572
michael@0 2573 dnl Check to see if we can resolve ambiguity with |using|.
michael@0 2574 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
michael@0 2575 ac_cv_cpp_ambiguity_resolving_using,
michael@0 2576 [AC_TRY_COMPILE(class X {
michael@0 2577 public: int go(const X&) {return 3;}
michael@0 2578 int jo(const X&) {return 3;}
michael@0 2579 };
michael@0 2580 class Y : public X {
michael@0 2581 public: int go(int) {return 2;}
michael@0 2582 int jo(int) {return 2;}
michael@0 2583 using X::jo;
michael@0 2584 private: using X::go;
michael@0 2585 };,
michael@0 2586 X x; Y y; y.jo(x);,
michael@0 2587 ac_cv_cpp_ambiguity_resolving_using=yes,
michael@0 2588 ac_cv_cpp_ambiguity_resolving_using=no)])
michael@0 2589 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
michael@0 2590 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
michael@0 2591 fi
michael@0 2592
michael@0 2593 dnl See if a dynamic_cast to void* gives the most derived object.
michael@0 2594 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
michael@0 2595 ac_cv_cpp_dynamic_cast_void_ptr,
michael@0 2596 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
michael@0 2597 class Y { int j; public: virtual ~Y() { } };
michael@0 2598 class Z : public X, public Y { int k; };
michael@0 2599
michael@0 2600 int main() {
michael@0 2601 Z mdo;
michael@0 2602 X *subx = (X*)&mdo;
michael@0 2603 Y *suby = (Y*)&mdo;
michael@0 2604 return !((((void*)&mdo != (void*)subx) &&
michael@0 2605 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
michael@0 2606 (((void*)&mdo != (void*)suby) &&
michael@0 2607 ((void*)&mdo == dynamic_cast<void*>(suby))));
michael@0 2608 }],
michael@0 2609 ac_cv_cpp_dynamic_cast_void_ptr=yes,
michael@0 2610 ac_cv_cpp_dynamic_cast_void_ptr=no,
michael@0 2611 ac_cv_cpp_dynamic_cast_void_ptr=no)])
michael@0 2612 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
michael@0 2613 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
michael@0 2614 fi
michael@0 2615
michael@0 2616
michael@0 2617 dnl note that this one is reversed - if the test fails, then
michael@0 2618 dnl we require implementations of unused virtual methods. Which
michael@0 2619 dnl really blows because it means we'll have useless vtable
michael@0 2620 dnl bloat.
michael@0 2621 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
michael@0 2622 ac_cv_cpp_unused_required,
michael@0 2623 [AC_TRY_LINK(class X {private: virtual void never_called();};,
michael@0 2624 X x;,
michael@0 2625 ac_cv_cpp_unused_required=no,
michael@0 2626 ac_cv_cpp_unused_required=yes)])
michael@0 2627 if test "$ac_cv_cpp_unused_required" = yes ; then
michael@0 2628 AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
michael@0 2629 fi
michael@0 2630
michael@0 2631
michael@0 2632 dnl Some compilers have trouble comparing a constant reference to a templatized
michael@0 2633 dnl class to zero, and require an explicit operator==() to be defined that takes
michael@0 2634 dnl an int. This test separates the strong from the weak.
michael@0 2635
michael@0 2636 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
michael@0 2637 ac_cv_trouble_comparing_to_zero,
michael@0 2638 [AC_TRY_COMPILE([#include <algorithm>
michael@0 2639 template <class T> class Foo {};
michael@0 2640 class T2;
michael@0 2641 template <class T> int operator==(const T2*, const T&) { return 0; }
michael@0 2642 template <class T> int operator!=(const T2*, const T&) { return 0; }],
michael@0 2643 [Foo<int> f; return (0 != f);],
michael@0 2644 ac_cv_trouble_comparing_to_zero=no,
michael@0 2645 ac_cv_trouble_comparing_to_zero=yes)])
michael@0 2646 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
michael@0 2647 AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
michael@0 2648 fi
michael@0 2649
michael@0 2650 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
michael@0 2651 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
michael@0 2652 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
michael@0 2653 # linking XUL.
michael@0 2654 _SAVE_LDFLAGS=$LDFLAGS
michael@0 2655 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
michael@0 2656 AC_CACHE_CHECK(for __thread keyword for TLS variables,
michael@0 2657 ac_cv_thread_keyword,
michael@0 2658 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
michael@0 2659 [return tlsIsMainThread;],
michael@0 2660 ac_cv_thread_keyword=yes,
michael@0 2661 ac_cv_thread_keyword=no)])
michael@0 2662 LDFLAGS=$_SAVE_LDFLAGS
michael@0 2663 if test "$ac_cv_thread_keyword" = yes; then
michael@0 2664 # mips builds fail with TLS variables because of a binutils bug.
michael@0 2665 # See bug 528687
michael@0 2666 case "${target}" in
michael@0 2667 mips*-*)
michael@0 2668 :
michael@0 2669 ;;
michael@0 2670 *-android*|*-linuxandroid*)
michael@0 2671 :
michael@0 2672 ;;
michael@0 2673 *)
michael@0 2674 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
michael@0 2675 ;;
michael@0 2676 esac
michael@0 2677 fi
michael@0 2678
michael@0 2679 dnl See if compiler supports some gcc-style attributes
michael@0 2680
michael@0 2681 AC_CACHE_CHECK(for __attribute__((always_inline)),
michael@0 2682 ac_cv_attribute_always_inline,
michael@0 2683 [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
michael@0 2684 [],
michael@0 2685 ac_cv_attribute_always_inline=yes,
michael@0 2686 ac_cv_attribute_always_inline=no)])
michael@0 2687
michael@0 2688 AC_CACHE_CHECK(for __attribute__((malloc)),
michael@0 2689 ac_cv_attribute_malloc,
michael@0 2690 [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
michael@0 2691 [],
michael@0 2692 ac_cv_attribute_malloc=yes,
michael@0 2693 ac_cv_attribute_malloc=no)])
michael@0 2694
michael@0 2695 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
michael@0 2696 ac_cv_attribute_warn_unused,
michael@0 2697 [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
michael@0 2698 [],
michael@0 2699 ac_cv_attribute_warn_unused=yes,
michael@0 2700 ac_cv_attribute_warn_unused=no)])
michael@0 2701
michael@0 2702 dnl End of C++ language/feature checks
michael@0 2703 AC_LANG_C
michael@0 2704
michael@0 2705 dnl ========================================================
michael@0 2706 dnl = Internationalization checks
michael@0 2707 dnl ========================================================
michael@0 2708 dnl
michael@0 2709 dnl Internationalization and Locale support is different
michael@0 2710 dnl on various UNIX platforms. Checks for specific i18n
michael@0 2711 dnl features go here.
michael@0 2712
michael@0 2713 dnl check for LC_MESSAGES
michael@0 2714 AC_CACHE_CHECK(for LC_MESSAGES,
michael@0 2715 ac_cv_i18n_lc_messages,
michael@0 2716 [AC_TRY_COMPILE([#include <locale.h>],
michael@0 2717 [int category = LC_MESSAGES;],
michael@0 2718 ac_cv_i18n_lc_messages=yes,
michael@0 2719 ac_cv_i18n_lc_messages=no)])
michael@0 2720 if test "$ac_cv_i18n_lc_messages" = yes; then
michael@0 2721 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
michael@0 2722 fi
michael@0 2723
michael@0 2724 AC_HAVE_FUNCS(localeconv)
michael@0 2725 fi # ! SKIP_COMPILER_CHECKS
michael@0 2726
michael@0 2727 TARGET_XPCOM_ABI=
michael@0 2728 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
michael@0 2729 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
michael@0 2730 fi
michael@0 2731
michael@0 2732 dnl Mozilla specific options
michael@0 2733 dnl ========================================================
michael@0 2734 dnl The macros used for command line options
michael@0 2735 dnl are defined in build/autoconf/altoptions.m4.
michael@0 2736
michael@0 2737 dnl If the compiler supports these attributes, define them as
michael@0 2738 dnl convenience macros.
michael@0 2739 if test "$ac_cv_attribute_malloc" = yes ; then
michael@0 2740 AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
michael@0 2741 else
michael@0 2742 AC_DEFINE(NS_ATTR_MALLOC,)
michael@0 2743 fi
michael@0 2744
michael@0 2745 if test "$ac_cv_attribute_warn_unused" = yes ; then
michael@0 2746 AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
michael@0 2747 else
michael@0 2748 AC_DEFINE(NS_WARN_UNUSED_RESULT,)
michael@0 2749 fi
michael@0 2750
michael@0 2751 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
michael@0 2752 dnl features that Windows actually does support.
michael@0 2753
michael@0 2754 if test -n "$SKIP_COMPILER_CHECKS"; then
michael@0 2755 dnl Windows has malloc.h
michael@0 2756 AC_DEFINE(MALLOC_H, [<malloc.h>])
michael@0 2757 AC_DEFINE(HAVE_FORCEINLINE)
michael@0 2758 AC_DEFINE(HAVE_LOCALECONV)
michael@0 2759 fi # SKIP_COMPILER_CHECKS
michael@0 2760
michael@0 2761 dnl ========================================================
michael@0 2762 dnl = Mozilla update channel, used for disabling features
michael@0 2763 dnl = not wanted for release.
michael@0 2764 dnl ========================================================
michael@0 2765
michael@0 2766 # app update channel is 'default' when not supplied.
michael@0 2767 MOZ_ARG_ENABLE_STRING([update-channel],
michael@0 2768 [ --enable-update-channel=CHANNEL
michael@0 2769 Select application update channel (default=default)],
michael@0 2770 MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
michael@0 2771
michael@0 2772 if test -z "$MOZ_UPDATE_CHANNEL"; then
michael@0 2773 MOZ_UPDATE_CHANNEL=default
michael@0 2774 fi
michael@0 2775 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
michael@0 2776 AC_SUBST(MOZ_UPDATE_CHANNEL)
michael@0 2777
michael@0 2778
michael@0 2779 dnl set GRE_MILESTONE
michael@0 2780 dnl ========================================================
michael@0 2781 GRE_MILESTONE=`tail -n 1 "$_topsrcdir"/config/milestone.txt 2>/dev/null || tail -1 "$_topsrcdir"/config/milestone.txt`
michael@0 2782 AC_SUBST(GRE_MILESTONE)
michael@0 2783
michael@0 2784 dnl set RELEASE_BUILD and NIGHTLY_BUILD variables depending on the cycle we're in
michael@0 2785 dnl The logic works like this:
michael@0 2786 dnl - if we have "a1" in GRE_MILESTONE, we're building Nightly (define NIGHTLY_BUILD)
michael@0 2787 dnl - otherwise, we're building Release/Beta (define RELEASE_BUILD)
michael@0 2788 case "$GRE_MILESTONE" in
michael@0 2789 *a1*)
michael@0 2790 NIGHTLY_BUILD=1
michael@0 2791 AC_DEFINE(NIGHTLY_BUILD)
michael@0 2792 ;;
michael@0 2793 *)
michael@0 2794 RELEASE_BUILD=1
michael@0 2795 AC_DEFINE(RELEASE_BUILD)
michael@0 2796 ;;
michael@0 2797 esac
michael@0 2798 AC_SUBST(NIGHTLY_BUILD)
michael@0 2799 AC_SUBST(RELEASE_BUILD)
michael@0 2800
michael@0 2801 dnl ========================================================
michael@0 2802 dnl Disable compiling sources in unified mode.
michael@0 2803 dnl ========================================================
michael@0 2804
michael@0 2805 if test -z "$NIGHTLY_BUILD"; then
michael@0 2806 MOZ_DISABLE_UNIFIED_COMPILATION=1
michael@0 2807 fi
michael@0 2808
michael@0 2809 MOZ_ARG_DISABLE_BOOL(unified-compilation,
michael@0 2810 [ --disable-unified-compilation
michael@0 2811 Disable unified compilation of some C/C++ sources],
michael@0 2812 MOZ_DISABLE_UNIFIED_COMPILATION=1,
michael@0 2813 MOZ_DISABLE_UNIFIED_COMPILATION=)
michael@0 2814 AC_SUBST(MOZ_DISABLE_UNIFIED_COMPILATION)
michael@0 2815
michael@0 2816 dnl ========================================================
michael@0 2817 dnl =
michael@0 2818 dnl = Check for external package dependencies
michael@0 2819 dnl =
michael@0 2820 dnl ========================================================
michael@0 2821 MOZ_ARG_HEADER(External Packages)
michael@0 2822
michael@0 2823 dnl ========================================================
michael@0 2824 dnl = Find the right NSPR to use.
michael@0 2825 dnl ========================================================
michael@0 2826 MOZ_ARG_WITH_BOOL(system-nspr,
michael@0 2827 [ --with-system-nspr Use an NSPR that is already built and installed.
michael@0 2828 Use the 'nspr-config' script in the current path,
michael@0 2829 or look for the script in the directories given with
michael@0 2830 --with-nspr-exec-prefix or --with-nspr-prefix.
michael@0 2831 (Those flags are only checked if you specify
michael@0 2832 --with-system-nspr.)],
michael@0 2833 _USE_SYSTEM_NSPR=1 )
michael@0 2834
michael@0 2835 MOZ_ARG_WITH_STRING(nspr-cflags,
michael@0 2836 [ --with-nspr-cflags=FLAGS
michael@0 2837 Pass FLAGS to CC when building code that uses NSPR.
michael@0 2838 Use this when there's no accurate nspr-config
michael@0 2839 script available. This is the case when building
michael@0 2840 SpiderMonkey as part of the Mozilla tree: the
michael@0 2841 top-level configure script computes NSPR flags
michael@0 2842 that accomodate the quirks of that environment.],
michael@0 2843 NSPR_CFLAGS=$withval)
michael@0 2844 MOZ_ARG_WITH_STRING(nspr-libs,
michael@0 2845 [ --with-nspr-libs=LIBS Pass LIBS to LD when linking code that uses NSPR.
michael@0 2846 See --with-nspr-cflags for more details.],
michael@0 2847 NSPR_LIBS=$withval)
michael@0 2848 AC_SUBST(NSPR_CFLAGS)
michael@0 2849 AC_SUBST(NSPR_LIBS)
michael@0 2850
michael@0 2851 JS_THREADSAFE=1
michael@0 2852 MOZ_ARG_DISABLE_BOOL(threadsafe,
michael@0 2853 [ --disable-threadsafe Disable support for multiple threads.],
michael@0 2854 JS_THREADSAFE= ,
michael@0 2855 JS_THREADSAFE=1 )
michael@0 2856 if test -n "$JS_THREADSAFE"; then
michael@0 2857 AC_DEFINE(JS_THREADSAFE)
michael@0 2858 fi
michael@0 2859
michael@0 2860 if test "$_USE_SYSTEM_NSPR" || (test "$NSPR_CFLAGS" -o "$NSPR_LIBS"); then
michael@0 2861 _HAS_NSPR=1
michael@0 2862 fi
michael@0 2863
michael@0 2864 case "$target" in
michael@0 2865 *linux*|*darwin*|*dragonfly*|*freebsd*|*netbsd*|*openbsd*)
michael@0 2866 if test -z "$_HAS_NSPR" && test "$JS_THREADSAFE"; then
michael@0 2867 JS_POSIX_NSPR_DEFAULT=1
michael@0 2868 fi
michael@0 2869 ;;
michael@0 2870 esac
michael@0 2871
michael@0 2872 MOZ_ARG_ENABLE_BOOL(posix-nspr-emulation,
michael@0 2873 [ --enable-posix-nspr-emulation
michael@0 2874 Enable emulation of NSPR for POSIX systems],
michael@0 2875 JS_POSIX_NSPR=1,
michael@0 2876 JS_POSIX_NSPR=,
michael@0 2877 JS_POSIX_NSPR="$JS_POSIX_NSPR_DEFAULT" )
michael@0 2878 if test -n "$JS_POSIX_NSPR"; then
michael@0 2879 AC_DEFINE(JS_POSIX_NSPR)
michael@0 2880 fi
michael@0 2881
michael@0 2882 AC_SUBST(JS_POSIX_NSPR)
michael@0 2883
michael@0 2884 dnl Pass either --with-system-nspr or (--with-nspr-cflags and
michael@0 2885 dnl --with-nspr-libs), but not both.
michael@0 2886 if test "$_USE_SYSTEM_NSPR" && (test "$NSPR_CFLAGS" -o "$NSPR_LIBS"); then
michael@0 2887 AC_MSG_ERROR([--with-system-nspr and --with-nspr-libs/cflags are mutually exclusive.
michael@0 2888 See 'configure --help'.])
michael@0 2889 fi
michael@0 2890
michael@0 2891 dnl Can't use --enable-posix-nspr-emulation if compiling with NSPR.
michael@0 2892 if test "$_HAS_NSPR" && test "$JS_POSIX_NSPR"; then
michael@0 2893 AC_MSG_ERROR([--enable-posix-nspr-emulation is mututally exclusive with --with-system-nspr
michael@0 2894 and --with-nspr-libs/cflags. See 'configure --help'.])
michael@0 2895 fi
michael@0 2896
michael@0 2897 if test -n "$_USE_SYSTEM_NSPR"; then
michael@0 2898 MOZ_NATIVE_NSPR=
michael@0 2899 AM_PATH_NSPR($NSPR_MINVER, [MOZ_NATIVE_NSPR=1], [AC_MSG_ERROR([your don't have NSPR installed or your version is too old])])
michael@0 2900 fi
michael@0 2901
michael@0 2902 NSPR_PKGCONF_CHECK="nspr"
michael@0 2903 if test -n "$MOZ_NATIVE_NSPR"; then
michael@0 2904 # piggy back on $MOZ_NATIVE_NSPR to set a variable for the nspr check for js.pc
michael@0 2905 NSPR_PKGCONF_CHECK="nspr >= $NSPR_MINVER"
michael@0 2906
michael@0 2907 _SAVE_CFLAGS=$CFLAGS
michael@0 2908 CFLAGS="$CFLAGS $NSPR_CFLAGS"
michael@0 2909 AC_TRY_COMPILE([#include "prlog.h"],
michael@0 2910 [#ifndef PR_STATIC_ASSERT
michael@0 2911 #error PR_STATIC_ASSERT not defined
michael@0 2912 #endif],
michael@0 2913 [MOZ_NATIVE_NSPR=1],
michael@0 2914 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
michael@0 2915 CFLAGS=$_SAVE_CFLAGS
michael@0 2916 fi
michael@0 2917 AC_SUBST(NSPR_PKGCONF_CHECK)
michael@0 2918
michael@0 2919 dnl ========================================================
michael@0 2920 dnl system zlib Support
michael@0 2921 dnl ========================================================
michael@0 2922 dnl Standalone js defaults to system zlib
michael@0 2923 ZLIB_DIR=yes
michael@0 2924
michael@0 2925 MOZ_ZLIB_CHECK([1.2.3])
michael@0 2926
michael@0 2927 if test -n "$ZLIB_IN_MOZGLUE"; then
michael@0 2928 AC_DEFINE(ZLIB_IN_MOZGLUE)
michael@0 2929 fi
michael@0 2930
michael@0 2931 dnl ========================================================
michael@0 2932 dnl system libffi Support
michael@0 2933 dnl ========================================================
michael@0 2934 MOZ_CONFIG_FFI()
michael@0 2935
michael@0 2936 dnl ========================================================
michael@0 2937 dnl =
michael@0 2938 dnl = Application
michael@0 2939 dnl =
michael@0 2940 dnl ========================================================
michael@0 2941
michael@0 2942 MOZ_ARG_HEADER(Application)
michael@0 2943
michael@0 2944 ENABLE_TESTS=1
michael@0 2945
michael@0 2946 USE_ARM_KUSER=
michael@0 2947
michael@0 2948 case "${target}" in
michael@0 2949 arm*-android*|arm*-linuxandroid*)
michael@0 2950 USE_ARM_KUSER=1
michael@0 2951 ;;
michael@0 2952 esac
michael@0 2953
michael@0 2954 dnl ========================================================
michael@0 2955 dnl Use ARM userspace kernel helpers; tell NSPR to enable
michael@0 2956 dnl their usage and use them in spidermonkey.
michael@0 2957 dnl ========================================================
michael@0 2958 MOZ_ARG_WITH_BOOL(arm-kuser,
michael@0 2959 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
michael@0 2960 USE_ARM_KUSER=1,)
michael@0 2961 if test -n "$USE_ARM_KUSER"; then
michael@0 2962 AC_DEFINE(USE_ARM_KUSER)
michael@0 2963 fi
michael@0 2964
michael@0 2965 dnl ========================================================
michael@0 2966 dnl =
michael@0 2967 dnl = Components & Features
michael@0 2968 dnl =
michael@0 2969 dnl ========================================================
michael@0 2970 MOZ_ARG_HEADER(Components and Features)
michael@0 2971
michael@0 2972 dnl ========================================================
michael@0 2973 dnl = Localization
michael@0 2974 dnl ========================================================
michael@0 2975 MOZ_ARG_ENABLE_STRING(ui-locale,
michael@0 2976 [ --enable-ui-locale=ab-CD
michael@0 2977 Select the user interface locale (default: en-US)],
michael@0 2978 MOZ_UI_LOCALE=$enableval )
michael@0 2979 AC_SUBST(MOZ_UI_LOCALE)
michael@0 2980
michael@0 2981 dnl ========================================================
michael@0 2982 dnl build the tests by default
michael@0 2983 dnl ========================================================
michael@0 2984 MOZ_ARG_DISABLE_BOOL(tests,
michael@0 2985 [ --disable-tests Do not build test libraries & programs],
michael@0 2986 ENABLE_TESTS=,
michael@0 2987 ENABLE_TESTS=1 )
michael@0 2988
michael@0 2989 dnl ========================================================
michael@0 2990 dnl =
michael@0 2991 dnl = Module specific options
michael@0 2992 dnl =
michael@0 2993 dnl ========================================================
michael@0 2994 MOZ_ARG_HEADER(Individual module options)
michael@0 2995
michael@0 2996 dnl ========================================================
michael@0 2997 dnl =
michael@0 2998 dnl = Debugging Options
michael@0 2999 dnl =
michael@0 3000 dnl ========================================================
michael@0 3001 MOZ_ARG_HEADER(Debugging and Optimizations)
michael@0 3002
michael@0 3003 if test "$ENABLE_METHODJIT_SPEW"; then
michael@0 3004 AC_DEFINE(JS_METHODJIT_SPEW)
michael@0 3005 fi
michael@0 3006
michael@0 3007 dnl ========================================================
michael@0 3008 dnl = Enable code optimization. ON by default.
michael@0 3009 dnl ========================================================
michael@0 3010 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
michael@0 3011 MOZ_OPTIMIZE_FLAGS="-O"
michael@0 3012 fi
michael@0 3013
michael@0 3014 MOZ_ARG_ENABLE_STRING(optimize,
michael@0 3015 [ --disable-optimize Disable compiler optimization
michael@0 3016 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
michael@0 3017 [ if test "$enableval" != "no"; then
michael@0 3018 MOZ_OPTIMIZE=1
michael@0 3019 if test -n "$enableval" -a "$enableval" != "yes"; then
michael@0 3020 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
michael@0 3021 MOZ_OPTIMIZE=2
michael@0 3022 fi
michael@0 3023 else
michael@0 3024 MOZ_OPTIMIZE=
michael@0 3025 fi ], MOZ_OPTIMIZE=1)
michael@0 3026
michael@0 3027 MOZ_SET_FRAMEPTR_FLAGS
michael@0 3028
michael@0 3029 if test "$COMPILE_ENVIRONMENT"; then
michael@0 3030 if test -n "$MOZ_OPTIMIZE"; then
michael@0 3031 AC_MSG_CHECKING([for valid optimization flags])
michael@0 3032 _SAVE_CFLAGS=$CFLAGS
michael@0 3033 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
michael@0 3034 AC_TRY_COMPILE([#include <stdio.h>],
michael@0 3035 [printf("Hello World\n");],
michael@0 3036 _results=yes,
michael@0 3037 _results=no)
michael@0 3038 AC_MSG_RESULT([$_results])
michael@0 3039 if test "$_results" = "no"; then
michael@0 3040 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
michael@0 3041 fi
michael@0 3042 CFLAGS=$_SAVE_CFLAGS
michael@0 3043 fi
michael@0 3044 fi # COMPILE_ENVIRONMENT
michael@0 3045
michael@0 3046 AC_SUBST(MOZ_OPTIMIZE)
michael@0 3047 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
michael@0 3048 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
michael@0 3049 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
michael@0 3050 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
michael@0 3051 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
michael@0 3052
michael@0 3053 dnl ========================================================
michael@0 3054 dnl = Enable trace logging
michael@0 3055 dnl ========================================================
michael@0 3056 MOZ_ARG_ENABLE_BOOL(trace-logging,
michael@0 3057 [ --enable-trace-logging Enable trace logging],
michael@0 3058 ENABLE_TRACE_LOGGING=1,
michael@0 3059 ENABLE_TRACE_LOGGING= )
michael@0 3060
michael@0 3061 AC_SUBST(ENABLE_TRACE_LOGGING)
michael@0 3062
michael@0 3063 if test "$ENABLE_TRACE_LOGGING"; then
michael@0 3064 AC_DEFINE(JS_TRACE_LOGGING)
michael@0 3065 fi
michael@0 3066
michael@0 3067 dnl ========================================================
michael@0 3068 dnl = Enable any treating of compile warnings as errors
michael@0 3069 dnl ========================================================
michael@0 3070 MOZ_ARG_DISABLE_BOOL(warnings-as-errors,
michael@0 3071 [ --enable-warnings-as-errors
michael@0 3072 Enable treating of warnings as errors],
michael@0 3073 MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
michael@0 3074 MOZ_ENABLE_WARNINGS_AS_ERRORS=)
michael@0 3075 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
michael@0 3076 WARNINGS_AS_ERRORS=''
michael@0 3077 elif test "$GNU_CC"; then
michael@0 3078 # Prevent the following GCC warnings from being treated as errors:
michael@0 3079 # -Wuninitialized - too many false positives
michael@0 3080 # -Wmaybe-uninitialized - too many false positives
michael@0 3081 # -Wdeprecated-declarations - we don't want our builds held hostage when a
michael@0 3082 # platform-specific API becomes deprecated.
michael@0 3083 MOZ_C_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_c_has_noerror_uninitialized)
michael@0 3084 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_cxx_has_noerror_uninitialized)
michael@0 3085 MOZ_C_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_c_has_noerror_maybe_uninitialized)
michael@0 3086 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_cxx_has_noerror_maybe_uninitialized)
michael@0 3087 MOZ_C_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_c_has_noerror_deprecated_declarations)
michael@0 3088 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_cxx_has_noerror_deprecated_declarations)
michael@0 3089 fi
michael@0 3090
michael@0 3091 dnl ========================================================
michael@0 3092 dnl = Enable treating compile warnings as errors
michael@0 3093 dnl ========================================================
michael@0 3094 MOZ_ARG_ENABLE_BOOL(sm-fail-on-warnings,
michael@0 3095 [ --enable-sm-fail-on-warnings
michael@0 3096 Enable warnings as errors],
michael@0 3097 FAIL_ON_WARNINGS=1,
michael@0 3098 FAIL_ON_WARNINGS= )
michael@0 3099
michael@0 3100 AC_SUBST(FAIL_ON_WARNINGS)
michael@0 3101
michael@0 3102 dnl ========================================================
michael@0 3103 dnl = Enable trace malloc
michael@0 3104 dnl ========================================================
michael@0 3105 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
michael@0 3106 MOZ_ARG_ENABLE_BOOL(trace-malloc,
michael@0 3107 [ --enable-trace-malloc Enable malloc tracing],
michael@0 3108 NS_TRACE_MALLOC=1,
michael@0 3109 NS_TRACE_MALLOC= )
michael@0 3110 if test "$NS_TRACE_MALLOC"; then
michael@0 3111 # Please, Mr. Linker Man, don't take away our symbol names
michael@0 3112 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
michael@0 3113 AC_DEFINE(NS_TRACE_MALLOC)
michael@0 3114 fi
michael@0 3115 AC_SUBST(NS_TRACE_MALLOC)
michael@0 3116
michael@0 3117 dnl ========================================================
michael@0 3118 dnl = Enable DMD
michael@0 3119 dnl ========================================================
michael@0 3120
michael@0 3121 MOZ_ARG_ENABLE_BOOL(dmd,
michael@0 3122 [ --enable-dmd Enable DMD; also enables jemalloc and replace-malloc],
michael@0 3123 MOZ_DMD=1,
michael@0 3124 MOZ_DMD= )
michael@0 3125
michael@0 3126 if test "$NS_TRACE_MALLOC"; then # trace-malloc disables DMD
michael@0 3127 MOZ_DMD=
michael@0 3128 fi
michael@0 3129 if test "$MOZ_DMD"; then
michael@0 3130 AC_DEFINE(MOZ_DMD)
michael@0 3131
michael@0 3132 if test "${CPU_ARCH}" = "arm"; then
michael@0 3133 CFLAGS="$CFLAGS -funwind-tables"
michael@0 3134 CXXFLAGS="$CXXFLAGS -funwind-tables"
michael@0 3135 fi
michael@0 3136 fi
michael@0 3137
michael@0 3138 dnl ========================================================
michael@0 3139 dnl = Enable jemalloc
michael@0 3140 dnl ========================================================
michael@0 3141 MOZ_ARG_ENABLE_BOOL(jemalloc,
michael@0 3142 [ --enable-jemalloc Replace memory allocator with jemalloc],
michael@0 3143 MOZ_MEMORY=1,
michael@0 3144 MOZ_MEMORY=)
michael@0 3145
michael@0 3146 if test "$NS_TRACE_MALLOC"; then
michael@0 3147 MOZ_MEMORY=
michael@0 3148 fi
michael@0 3149
michael@0 3150 if test "$MOZ_MEMORY"; then
michael@0 3151 AC_DEFINE(MOZ_MEMORY)
michael@0 3152 if test "x$MOZ_DEBUG" = "x1"; then
michael@0 3153 AC_DEFINE(MOZ_MEMORY_DEBUG)
michael@0 3154 fi
michael@0 3155 dnl The generic feature tests that determine how to compute ncpus are long and
michael@0 3156 dnl complicated. Therefore, simply define special cpp variables for the
michael@0 3157 dnl platforms we have special knowledge of.
michael@0 3158 case "${target}" in
michael@0 3159 *-darwin*)
michael@0 3160 AC_DEFINE(MOZ_MEMORY_DARWIN)
michael@0 3161 ;;
michael@0 3162 *-*freebsd*)
michael@0 3163 AC_DEFINE(MOZ_MEMORY_BSD)
michael@0 3164 ;;
michael@0 3165 *-android*|*-linuxandroid*)
michael@0 3166 AC_DEFINE(MOZ_MEMORY_LINUX)
michael@0 3167 AC_DEFINE(MOZ_MEMORY_ANDROID)
michael@0 3168 ;;
michael@0 3169 *-*linux*)
michael@0 3170 AC_DEFINE(MOZ_MEMORY_LINUX)
michael@0 3171 ;;
michael@0 3172 *-netbsd*)
michael@0 3173 AC_DEFINE(MOZ_MEMORY_BSD)
michael@0 3174 ;;
michael@0 3175 *-solaris*)
michael@0 3176 AC_DEFINE(MOZ_MEMORY_SOLARIS)
michael@0 3177 ;;
michael@0 3178 *-mingw*)
michael@0 3179 AC_DEFINE(MOZ_MEMORY_WINDOWS)
michael@0 3180 # the interesting bits will get passed down in MOZ_GLUE_LDFLAGS
michael@0 3181 ;;
michael@0 3182 *)
michael@0 3183 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
michael@0 3184 ;;
michael@0 3185 esac
michael@0 3186 fi
michael@0 3187 AC_SUBST(MOZ_MEMORY)
michael@0 3188 AC_SUBST(MOZ_GLUE_LDFLAGS)
michael@0 3189 AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
michael@0 3190
michael@0 3191 dnl ========================================================
michael@0 3192 dnl = Use malloc wrapper lib
michael@0 3193 dnl ========================================================
michael@0 3194 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
michael@0 3195 [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)],
michael@0 3196 _WRAP_MALLOC=1,
michael@0 3197 _WRAP_MALLOC= )
michael@0 3198
michael@0 3199 if test -n "$_WRAP_MALLOC"; then
michael@0 3200 if test "$GNU_CC"; then
michael@0 3201 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
michael@0 3202 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
michael@0 3203 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
michael@0 3204 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
michael@0 3205 dnl Wrap operator new and operator delete on Android.
michael@0 3206 if test "$OS_TARGET" = "Android"; then
michael@0 3207 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=_Znwj,--wrap=_Znaj,--wrap=_ZdlPv,--wrap=_ZdaPv"
michael@0 3208 fi
michael@0 3209 else
michael@0 3210 AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
michael@0 3211 fi
michael@0 3212 fi
michael@0 3213
michael@0 3214 dnl ========================================================
michael@0 3215 dnl = Location of malloc wrapper lib
michael@0 3216 dnl ========================================================
michael@0 3217 MOZ_ARG_WITH_STRING(wrap-malloc,
michael@0 3218 [ --with-wrap-malloc=DIR Location of malloc wrapper library],
michael@0 3219 WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
michael@0 3220
michael@0 3221 dnl ========================================================
michael@0 3222 dnl = Use JS Call tracing
michael@0 3223 dnl ========================================================
michael@0 3224 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
michael@0 3225 [ --enable-trace-jscalls Enable JS call enter/exit callback (default=no)],
michael@0 3226 MOZ_TRACE_JSCALLS=1,
michael@0 3227 MOZ_TRACE_JSCALLS= )
michael@0 3228 if test -n "$MOZ_TRACE_JSCALLS"; then
michael@0 3229 AC_DEFINE(MOZ_TRACE_JSCALLS)
michael@0 3230 fi
michael@0 3231
michael@0 3232 dnl ========================================================
michael@0 3233 dnl = Use incremental GC
michael@0 3234 dnl ========================================================
michael@0 3235 JSGC_INCREMENTAL=1
michael@0 3236 MOZ_ARG_DISABLE_BOOL(gcincremental,
michael@0 3237 [ --disable-gcincremental Disable incremental GC],
michael@0 3238 JSGC_INCREMENTAL= )
michael@0 3239 if test -n "$JSGC_INCREMENTAL"; then
michael@0 3240 AC_DEFINE(JSGC_INCREMENTAL)
michael@0 3241 fi
michael@0 3242
michael@0 3243 dnl ========================================================
michael@0 3244 dnl = Use generational GC
michael@0 3245 dnl ========================================================
michael@0 3246 MOZ_ARG_ENABLE_BOOL(gcgenerational,
michael@0 3247 [ --enable-gcgenerational Enable generational GC],
michael@0 3248 JSGC_GENERATIONAL=1,
michael@0 3249 JSGC_GENERATIONAL= )
michael@0 3250 if test -n "$JSGC_GENERATIONAL"; then
michael@0 3251 AC_DEFINE(JSGC_GENERATIONAL)
michael@0 3252 fi
michael@0 3253
michael@0 3254 dnl ========================================================
michael@0 3255 dnl = Use exact stack rooting for GC
michael@0 3256 dnl ========================================================
michael@0 3257 MOZ_ARG_DISABLE_BOOL(exact-rooting,
michael@0 3258 [ --enable-exact-rooting Enable use of conservative stack scanning for GC],
michael@0 3259 JSGC_USE_EXACT_ROOTING=1 ,
michael@0 3260 JSGC_USE_EXACT_ROOTING= )
michael@0 3261 if test -n "$JSGC_USE_EXACT_ROOTING"; then
michael@0 3262 AC_DEFINE(JSGC_USE_EXACT_ROOTING)
michael@0 3263 fi
michael@0 3264
michael@0 3265 dnl ========================================================
michael@0 3266 dnl = Use Valgrind
michael@0 3267 dnl ========================================================
michael@0 3268 MOZ_ARG_ENABLE_BOOL(valgrind,
michael@0 3269 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
michael@0 3270 MOZ_VALGRIND=1,
michael@0 3271 MOZ_VALGRIND= )
michael@0 3272 if test -n "$MOZ_VALGRIND"; then
michael@0 3273 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
michael@0 3274 AC_MSG_ERROR(
michael@0 3275 [--enable-valgrind specified but Valgrind is not installed]))
michael@0 3276 AC_DEFINE(MOZ_VALGRIND)
michael@0 3277 MOZ_VALGRIND=1
michael@0 3278 fi
michael@0 3279 AC_SUBST(MOZ_VALGRIND)
michael@0 3280
michael@0 3281 dnl ========================================================
michael@0 3282 dnl = Use ARM JIT code simulator. Requires an x86 build.
michael@0 3283 dnl ========================================================
michael@0 3284 dnl Also define JS_CODEGEN_ARM in this case. If the simulator is not used,
michael@0 3285 dnl JS_CODEGEN_foo is defined if JS_CPU_foo is defined.
michael@0 3286 MOZ_ARG_ENABLE_BOOL(arm-simulator,
michael@0 3287 [ --enable-arm-simulator Enable ARM simulator for JIT code],
michael@0 3288 JS_ARM_SIMULATOR=1,
michael@0 3289 JS_ARM_SIMULATOR= )
michael@0 3290 if test -n "$JS_ARM_SIMULATOR"; then
michael@0 3291 if test "$CPU_ARCH" != "x86"; then
michael@0 3292 AC_MSG_ERROR([The ARM simulator only works on x86.])
michael@0 3293 fi
michael@0 3294 AC_DEFINE(JS_ARM_SIMULATOR)
michael@0 3295 AC_DEFINE(JS_CODEGEN_ARM)
michael@0 3296 JS_CODEGEN_ARM=1
michael@0 3297 elif test "$CPU_ARCH" = "x86"; then
michael@0 3298 AC_DEFINE(JS_CODEGEN_X86)
michael@0 3299 JS_CODEGEN_X86=1
michael@0 3300 elif test "$CPU_ARCH" = "x86_64"; then
michael@0 3301 AC_DEFINE(JS_CODEGEN_X64)
michael@0 3302 JS_CODEGEN_X64=1
michael@0 3303 elif test "$CPU_ARCH" = "arm"; then
michael@0 3304 AC_DEFINE(JS_CODEGEN_ARM)
michael@0 3305 JS_CODEGEN_ARM=1
michael@0 3306 fi
michael@0 3307
michael@0 3308 AC_SUBST(JS_ARM_SIMULATOR)
michael@0 3309 AC_SUBST(JS_CODEGEN_ARM)
michael@0 3310 AC_SUBST(JS_CODEGEN_X86)
michael@0 3311 AC_SUBST(JS_CODEGEN_X64)
michael@0 3312
michael@0 3313 dnl ========================================================
michael@0 3314 dnl jprof
michael@0 3315 dnl ========================================================
michael@0 3316 MOZ_ARG_ENABLE_BOOL(jprof,
michael@0 3317 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
michael@0 3318 MOZ_JPROF=1,
michael@0 3319 MOZ_JPROF= )
michael@0 3320 if test -n "$MOZ_JPROF"; then
michael@0 3321 MOZ_PROFILING=1
michael@0 3322 AC_DEFINE(MOZ_JPROF)
michael@0 3323 fi
michael@0 3324
michael@0 3325 dnl ========================================================
michael@0 3326 dnl shark
michael@0 3327 dnl ========================================================
michael@0 3328 MOZ_ARG_ENABLE_BOOL(shark,
michael@0 3329 [ --enable-shark Enable shark remote profiling. Implies --enable-profiling.],
michael@0 3330 MOZ_SHARK=1,
michael@0 3331 MOZ_SHARK= )
michael@0 3332 if test -n "$MOZ_SHARK"; then
michael@0 3333 MOZ_PROFILING=1
michael@0 3334 AC_DEFINE(MOZ_SHARK)
michael@0 3335 fi
michael@0 3336
michael@0 3337 dnl ========================================================
michael@0 3338 dnl instruments
michael@0 3339 dnl ========================================================
michael@0 3340 MOZ_ARG_ENABLE_BOOL(instruments,
michael@0 3341 [ --enable-instruments Enable instruments remote profiling. Implies --enable-profiling.],
michael@0 3342 MOZ_INSTRUMENTS=1,
michael@0 3343 MOZ_INSTRUMENTS= )
michael@0 3344 if test -n "$MOZ_INSTRUMENTS"; then
michael@0 3345 MOZ_PROFILING=1
michael@0 3346 AC_DEFINE(MOZ_INSTRUMENTS)
michael@0 3347 LIBS="$LIBS -framework CoreFoundation"
michael@0 3348 fi
michael@0 3349
michael@0 3350 dnl ========================================================
michael@0 3351 dnl callgrind
michael@0 3352 dnl ========================================================
michael@0 3353 MOZ_ARG_ENABLE_BOOL(callgrind,
michael@0 3354 [ --enable-callgrind Enable callgrind profiling. Implies --enable-profiling.],
michael@0 3355 MOZ_CALLGRIND=1,
michael@0 3356 MOZ_CALLGRIND= )
michael@0 3357 if test -n "$MOZ_CALLGRIND"; then
michael@0 3358 MOZ_PROFILING=1
michael@0 3359 AC_DEFINE(MOZ_CALLGRIND)
michael@0 3360 fi
michael@0 3361
michael@0 3362 dnl ========================================================
michael@0 3363 dnl vtune
michael@0 3364 dnl ========================================================
michael@0 3365 MOZ_ARG_ENABLE_BOOL(vtune,
michael@0 3366 [ --enable-vtune Enable vtune profiling. Implies --enable-profiling.],
michael@0 3367 MOZ_VTUNE=1,
michael@0 3368 MOZ_VTUNE= )
michael@0 3369
michael@0 3370 dnl ========================================================
michael@0 3371 dnl Debug (see Bug 939505)
michael@0 3372 dnl ========================================================
michael@0 3373 if test -n "$MOZ_DEBUG"; then
michael@0 3374 AC_DEFINE(JS_DEBUG)
michael@0 3375 fi
michael@0 3376
michael@0 3377 dnl ========================================================
michael@0 3378 dnl Profiling
michael@0 3379 dnl ========================================================
michael@0 3380 if test -n "$MOZ_PROFILING"; then
michael@0 3381 AC_DEFINE(MOZ_PROFILING)
michael@0 3382
michael@0 3383 case "$OS_TARGET" in
michael@0 3384 Linux) MOZ_VTUNE=1 ;;
michael@0 3385 WINNT) MOZ_VTUNE=1 ;;
michael@0 3386 esac
michael@0 3387 fi
michael@0 3388
michael@0 3389 if test -n "$MOZ_VTUNE"; then
michael@0 3390 AC_DEFINE(MOZ_VTUNE)
michael@0 3391 fi
michael@0 3392
michael@0 3393 dnl ========================================================
michael@0 3394 dnl Zealous JavaScript GC
michael@0 3395 dnl ========================================================
michael@0 3396 MOZ_ARG_ENABLE_BOOL(gczeal,
michael@0 3397 [ --enable-gczeal Enable zealous GCing],
michael@0 3398 JS_GC_ZEAL=1,
michael@0 3399 JS_GC_ZEAL= )
michael@0 3400 if test -n "$JS_GC_ZEAL" -o -n "$MOZ_DEBUG"; then
michael@0 3401 AC_DEFINE(JS_GC_ZEAL)
michael@0 3402 fi
michael@0 3403
michael@0 3404 dnl ========================================================
michael@0 3405 dnl = Enable perf logging for ion.
michael@0 3406 dnl = Perf logging is OFF by default
michael@0 3407 dnl ========================================================
michael@0 3408 MOZ_ARG_ENABLE_BOOL(perf,
michael@0 3409 [ --enable-perf Enable Linux perf integration],
michael@0 3410 JS_ION_PERF=1,
michael@0 3411 JS_ION_PERF= )
michael@0 3412 if test -n "$JS_ION_PERF"; then
michael@0 3413 AC_DEFINE(JS_ION_PERF)
michael@0 3414 fi
michael@0 3415
michael@0 3416 dnl ========================================================
michael@0 3417 dnl JS opt-mode assertions and minidump instrumentation
michael@0 3418 dnl ========================================================
michael@0 3419 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
michael@0 3420 [ --enable-js-diagnostics
michael@0 3421 Enable JS diagnostic assertions and breakpad data],
michael@0 3422 JS_CRASH_DIAGNOSTICS=1,
michael@0 3423 JS_CRASH_DIAGNOSTICS= )
michael@0 3424 if test -n "$JS_CRASH_DIAGNOSTICS"; then
michael@0 3425 AC_DEFINE(JS_CRASH_DIAGNOSTICS)
michael@0 3426 fi
michael@0 3427
michael@0 3428 dnl ========================================================
michael@0 3429 dnl Enable changes that make the shell more deterministic
michael@0 3430 dnl ========================================================
michael@0 3431 MOZ_ARG_ENABLE_BOOL(more-deterministic,
michael@0 3432 [ --enable-more-deterministic
michael@0 3433 Enable changes that make the shell more deterministic],
michael@0 3434 JS_MORE_DETERMINISTIC=1,
michael@0 3435 JS_MORE_DETERMINISTIC= )
michael@0 3436 if test -n "$JS_MORE_DETERMINISTIC"; then
michael@0 3437 AC_DEFINE(JS_MORE_DETERMINISTIC)
michael@0 3438 fi
michael@0 3439
michael@0 3440 dnl ========================================================
michael@0 3441 dnl Enable breakpoint for artificial OOMs
michael@0 3442 dnl ========================================================
michael@0 3443 MOZ_ARG_ENABLE_BOOL(oom-breakpoint,
michael@0 3444 [ --enable-oom-breakpoint
michael@0 3445 Enable a breakpoint function for artificial OOMs],
michael@0 3446 JS_OOM_BREAKPOINT=1,
michael@0 3447 JS_OOM_BREAKPOINT= )
michael@0 3448 if test -n "$JS_OOM_BREAKPOINT"; then
michael@0 3449 AC_DEFINE(JS_OOM_BREAKPOINT)
michael@0 3450 fi
michael@0 3451
michael@0 3452 MOZ_CHECK_CCACHE
michael@0 3453
michael@0 3454 dnl ========================================================
michael@0 3455 dnl = Enable static checking using gcc-dehydra
michael@0 3456 dnl ========================================================
michael@0 3457
michael@0 3458 MOZ_ARG_WITH_STRING(static-checking,
michael@0 3459 [ --with-static-checking=path/to/gcc_dehydra.so
michael@0 3460 Enable static checking of code using GCC-dehydra],
michael@0 3461 DEHYDRA_PATH=$withval,
michael@0 3462 DEHYDRA_PATH= )
michael@0 3463
michael@0 3464 if test -n "$DEHYDRA_PATH"; then
michael@0 3465 if test ! -f "$DEHYDRA_PATH"; then
michael@0 3466 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
michael@0 3467 fi
michael@0 3468 AC_DEFINE(NS_STATIC_CHECKING)
michael@0 3469 fi
michael@0 3470 AC_SUBST(DEHYDRA_PATH)
michael@0 3471
michael@0 3472 dnl ========================================================
michael@0 3473 dnl = Enable using the clang plugin to build
michael@0 3474 dnl ========================================================
michael@0 3475
michael@0 3476 MOZ_ARG_ENABLE_BOOL(clang-plugin,
michael@0 3477 [ --enable-clang-plugin Enable building with the mozilla clang plugin ],
michael@0 3478 ENABLE_CLANG_PLUGIN=1,
michael@0 3479 ENABLE_CLANG_PLUGIN= )
michael@0 3480 if test -n "$ENABLE_CLANG_PLUGIN"; then
michael@0 3481 if test -z "$CLANG_CC"; then
michael@0 3482 AC_MSG_ERROR([Can't use clang plugin without clang.])
michael@0 3483 fi
michael@0 3484 AC_DEFINE(MOZ_CLANG_PLUGIN)
michael@0 3485 fi
michael@0 3486
michael@0 3487 AC_SUBST(ENABLE_CLANG_PLUGIN)
michael@0 3488
michael@0 3489 dnl ========================================================
michael@0 3490 dnl = Enable static checking using sixgill
michael@0 3491 dnl ========================================================
michael@0 3492
michael@0 3493 MOZ_ARG_WITH_STRING(sixgill,
michael@0 3494 [ --with-sixgill=path/to/sixgill
michael@0 3495 Enable static checking of code using sixgill],
michael@0 3496 SIXGILL_PATH=$withval,
michael@0 3497 SIXGILL_PATH= )
michael@0 3498
michael@0 3499 if test -n "$SIXGILL_PATH"; then
michael@0 3500 if test ! -x "$SIXGILL_PATH/bin/xdbfind" || test ! -f "$SIXGILL_PATH/gcc/xgill.so" || test ! -x "$SIXGILL_PATH/scripts/wrap_gcc/g++"; then
michael@0 3501 AC_MSG_ERROR([The sixgill plugin and binaries are not at the specified path.])
michael@0 3502 fi
michael@0 3503 fi
michael@0 3504 AC_SUBST(SIXGILL_PATH)
michael@0 3505
michael@0 3506 dnl ========================================================
michael@0 3507 dnl = Enable stripping of libs & executables
michael@0 3508 dnl ========================================================
michael@0 3509 MOZ_ARG_ENABLE_BOOL(strip,
michael@0 3510 [ --enable-strip Enable stripping of libs & executables ],
michael@0 3511 ENABLE_STRIP=1,
michael@0 3512 ENABLE_STRIP= )
michael@0 3513
michael@0 3514 dnl ========================================================
michael@0 3515 dnl = Enable stripping of libs & executables when packaging
michael@0 3516 dnl ========================================================
michael@0 3517 MOZ_ARG_ENABLE_BOOL(install-strip,
michael@0 3518 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
michael@0 3519 PKG_SKIP_STRIP= ,
michael@0 3520 PKG_SKIP_STRIP=1)
michael@0 3521
michael@0 3522 dnl ========================================================
michael@0 3523 dnl =
michael@0 3524 dnl = Profiling and Instrumenting
michael@0 3525 dnl =
michael@0 3526 dnl ========================================================
michael@0 3527 MOZ_ARG_HEADER(Profiling and Instrumenting)
michael@0 3528
michael@0 3529 dnl ========================================================
michael@0 3530 dnl = Support for demangling undefined symbols
michael@0 3531 dnl ========================================================
michael@0 3532 if test -z "$SKIP_LIBRARY_CHECKS"; then
michael@0 3533 AC_LANG_SAVE
michael@0 3534 AC_LANG_CPLUSPLUS
michael@0 3535 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
michael@0 3536 AC_LANG_RESTORE
michael@0 3537 fi
michael@0 3538
michael@0 3539 # Demangle only for debug or trace-malloc or DMD builds
michael@0 3540 MOZ_DEMANGLE_SYMBOLS=
michael@0 3541 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
michael@0 3542 MOZ_DEMANGLE_SYMBOLS=1
michael@0 3543 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
michael@0 3544 fi
michael@0 3545 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
michael@0 3546
michael@0 3547 dnl ========================================================
michael@0 3548 dnl JIT observers
michael@0 3549 dnl ========================================================
michael@0 3550
michael@0 3551 MOZ_ARG_WITH_STRING(jitreport-granularity,
michael@0 3552 [ --jitreport-granularity=N
michael@0 3553 Default granularity at which to report JIT code
michael@0 3554 to external tools
michael@0 3555 0 - no info
michael@0 3556 1 - code ranges for whole functions only
michael@0 3557 2 - per-line information
michael@0 3558 3 - per-op information],
michael@0 3559 JITREPORT_GRANULARITY=$withval,
michael@0 3560 JITREPORT_GRANULARITY=3)
michael@0 3561
michael@0 3562 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
michael@0 3563
michael@0 3564 dnl ========================================================
michael@0 3565 dnl =
michael@0 3566 dnl = Misc. Options
michael@0 3567 dnl =
michael@0 3568 dnl ========================================================
michael@0 3569 MOZ_ARG_HEADER(Misc. Options)
michael@0 3570
michael@0 3571 dnl ========================================================
michael@0 3572 dnl update xterm title
michael@0 3573 dnl ========================================================
michael@0 3574 MOZ_ARG_ENABLE_BOOL(xterm-updates,
michael@0 3575 [ --enable-xterm-updates Update XTERM titles with current command.],
michael@0 3576 MOZ_UPDATE_XTERM=1,
michael@0 3577 MOZ_UPDATE_XTERM= )
michael@0 3578
michael@0 3579 if test -z "$SKIP_COMPILER_CHECKS"; then
michael@0 3580 dnl ========================================================
michael@0 3581 dnl =
michael@0 3582 dnl = Compiler Options
michael@0 3583 dnl =
michael@0 3584 dnl ========================================================
michael@0 3585 MOZ_ARG_HEADER(Compiler Options)
michael@0 3586
michael@0 3587 dnl ========================================================
michael@0 3588 dnl Check for gcc -pipe support
michael@0 3589 dnl ========================================================
michael@0 3590 AC_MSG_CHECKING([for -pipe support])
michael@0 3591 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
michael@0 3592 dnl Any gcc that supports firefox supports -pipe.
michael@0 3593 CFLAGS="$CFLAGS -pipe"
michael@0 3594 CXXFLAGS="$CXXFLAGS -pipe"
michael@0 3595 AC_MSG_RESULT([yes])
michael@0 3596 else
michael@0 3597 AC_MSG_RESULT([no])
michael@0 3598 fi
michael@0 3599
michael@0 3600 dnl ========================================================
michael@0 3601 dnl Profile guided optimization (gcc checks)
michael@0 3602 dnl ========================================================
michael@0 3603 dnl Test for profiling options
michael@0 3604 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
michael@0 3605
michael@0 3606 _SAVE_CFLAGS="$CFLAGS"
michael@0 3607 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
michael@0 3608
michael@0 3609 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
michael@0 3610 AC_TRY_COMPILE([], [return 0;],
michael@0 3611 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
michael@0 3612 result="yes" ], result="no")
michael@0 3613 AC_MSG_RESULT([$result])
michael@0 3614
michael@0 3615 if test $result = "yes"; then
michael@0 3616 PROFILE_GEN_LDFLAGS="-fprofile-generate"
michael@0 3617 PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
michael@0 3618 PROFILE_USE_LDFLAGS="-fprofile-use"
michael@0 3619 fi
michael@0 3620
michael@0 3621 CFLAGS="$_SAVE_CFLAGS"
michael@0 3622
michael@0 3623 if test -n "$INTEL_CC"; then
michael@0 3624 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
michael@0 3625 PROFILE_GEN_LDFLAGS=
michael@0 3626 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
michael@0 3627 PROFILE_USE_LDFLAGS=
michael@0 3628 fi
michael@0 3629
michael@0 3630 dnl Sun Studio on Solaris
michael@0 3631 if test "$SOLARIS_SUNPRO_CC"; then
michael@0 3632 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
michael@0 3633 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
michael@0 3634 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
michael@0 3635 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
michael@0 3636 fi
michael@0 3637
michael@0 3638 AC_SUBST(PROFILE_GEN_CFLAGS)
michael@0 3639 AC_SUBST(PROFILE_GEN_LDFLAGS)
michael@0 3640 AC_SUBST(PROFILE_USE_CFLAGS)
michael@0 3641 AC_SUBST(PROFILE_USE_LDFLAGS)
michael@0 3642
michael@0 3643 AC_LANG_CPLUSPLUS
michael@0 3644
michael@0 3645 dnl ========================================================
michael@0 3646 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
michael@0 3647 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
michael@0 3648 dnl raw pointers in nsCOMPtr.h. (VC++ has the same bug.)
michael@0 3649 dnl ========================================================
michael@0 3650 _SAVE_CXXFLAGS=$CXXFLAGS
michael@0 3651 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
michael@0 3652 AC_CACHE_CHECK(for correct overload resolution with const and templates,
michael@0 3653 ac_nscap_nonconst_opeq_bug,
michael@0 3654 [AC_TRY_COMPILE([
michael@0 3655 template <class T>
michael@0 3656 class Pointer
michael@0 3657 {
michael@0 3658 public:
michael@0 3659 T* myPtr;
michael@0 3660 };
michael@0 3661
michael@0 3662 template <class T, class U>
michael@0 3663 int operator==(const Pointer<T>& rhs, U* lhs)
michael@0 3664 {
michael@0 3665 return rhs.myPtr == lhs;
michael@0 3666 }
michael@0 3667
michael@0 3668 template <class T, class U>
michael@0 3669 int operator==(const Pointer<T>& rhs, const U* lhs)
michael@0 3670 {
michael@0 3671 return rhs.myPtr == lhs;
michael@0 3672 }
michael@0 3673 ],
michael@0 3674 [
michael@0 3675 Pointer<int> foo;
michael@0 3676 const int* bar;
michael@0 3677 return foo == bar;
michael@0 3678 ],
michael@0 3679 ac_nscap_nonconst_opeq_bug="no",
michael@0 3680 ac_nscap_nonconst_opeq_bug="yes")])
michael@0 3681 CXXFLAGS="$_SAVE_CXXFLAGS"
michael@0 3682
michael@0 3683 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
michael@0 3684 AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
michael@0 3685 fi
michael@0 3686
michael@0 3687 dnl ========================================================
michael@0 3688 dnl Check for tm_zone, tm_gmtoff in struct tm
michael@0 3689 dnl ========================================================
michael@0 3690 AC_CACHE_CHECK(for tm_zone tm_gmtoff in struct tm,
michael@0 3691 ac_cv_struct_tm_zone_tm_gmtoff,
michael@0 3692 [AC_TRY_COMPILE([#include <time.h>],
michael@0 3693 [struct tm tm; tm.tm_zone = 0; tm.tm_gmtoff = 1;],
michael@0 3694 [ac_cv_struct_tm_zone_tm_gmtoff="yes"],
michael@0 3695 [ac_cv_struct_tm_zone_tm_gmtoff="no"])])
michael@0 3696 if test "$ac_cv_struct_tm_zone_tm_gmtoff" = "yes" ; then
michael@0 3697 AC_DEFINE(HAVE_TM_ZONE_TM_GMTOFF)
michael@0 3698 fi
michael@0 3699 fi # ! SKIP_COMPILER_CHECKS
michael@0 3700
michael@0 3701 AC_DEFINE(CPP_THROW_NEW, [throw()])
michael@0 3702 AC_LANG_C
michael@0 3703
michael@0 3704 MOZ_EXPAND_LIBS
michael@0 3705
michael@0 3706 dnl ========================================================
michael@0 3707 dnl =
michael@0 3708 dnl = Build depencency options
michael@0 3709 dnl =
michael@0 3710 dnl ========================================================
michael@0 3711 MOZ_ARG_HEADER(Build dependencies)
michael@0 3712
michael@0 3713 if test "$GNU_CC" -a "$GNU_CXX"; then
michael@0 3714 _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
michael@0 3715 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
michael@0 3716 elif test "$SOLARIS_SUNPRO_CC"; then
michael@0 3717 _DEPEND_CFLAGS=
michael@0 3718 else
michael@0 3719 dnl Don't override this for MSVC
michael@0 3720 if test -z "$_WIN32_MSVC"; then
michael@0 3721 _USE_CPP_INCLUDE_FLAG=
michael@0 3722 _DEFINES_CFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
michael@0 3723 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
michael@0 3724 else
michael@0 3725 echo '#include <stdio.h>' > dummy-hello.c
michael@0 3726 changequote(,)
michael@0 3727 dnl This output is localized, split at the first double space or colon and space.
michael@0 3728 _CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*stdio.h\)$"
michael@0 3729 CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'`
michael@0 3730 _CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'`
michael@0 3731 changequote([,])
michael@0 3732 if ! test -e "$_CL_STDIO_PATH"; then
michael@0 3733 AC_MSG_ERROR([Unable to parse cl -showIncludes prefix. This compiler's locale has an unsupported formatting.])
michael@0 3734 fi
michael@0 3735 if test -z "$CL_INCLUDES_PREFIX"; then
michael@0 3736 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
michael@0 3737 fi
michael@0 3738 AC_SUBST(CL_INCLUDES_PREFIX)
michael@0 3739 rm -f dummy-hello.c
michael@0 3740
michael@0 3741 dnl Make sure that the build system can handle non-ASCII characters
michael@0 3742 dnl in environment variables to prevent it from breaking silently on
michael@0 3743 dnl non-English systems.
michael@0 3744 NONASCII=$'\241\241'
michael@0 3745 AC_SUBST(NONASCII)
michael@0 3746 fi
michael@0 3747 fi
michael@0 3748
michael@0 3749 dnl ========================================================
michael@0 3750 dnl = Disable -fstrict-aliasing with GCC 4.4 and earlier.
michael@0 3751 dnl = See bugs 821502 and 832623.
michael@0 3752 dnl ========================================================
michael@0 3753 if test -n "$GNU_CC" -a -z "$CLANG_CC"; then
michael@0 3754 dnl GCC 3.x isn't supported, so we don't need to check for that.
michael@0 3755 if test "$GCC_MAJOR_VERSION" -eq "4" -a "$GCC_MINOR_VERSION" -lt "5" ; then
michael@0 3756 CFLAGS="$CFLAGS -fno-strict-aliasing"
michael@0 3757 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
michael@0 3758 fi
michael@0 3759 fi
michael@0 3760
michael@0 3761 dnl ========================================================
michael@0 3762 dnl = Link js shell to system readline
michael@0 3763 dnl ========================================================
michael@0 3764 MOZ_ARG_ENABLE_BOOL(readline,
michael@0 3765 [ --enable-readline Link js shell to system readline library],
michael@0 3766 JS_WANT_READLINE=1,
michael@0 3767 JS_WANT_READLINE= )
michael@0 3768
michael@0 3769 JS_NATIVE_EDITLINE=
michael@0 3770 EDITLINE_LIBS=
michael@0 3771 JS_DISABLE_SHELL=
michael@0 3772
michael@0 3773 case "$target" in
michael@0 3774 *-mingw*)
michael@0 3775 NO_EDITLINE=1
michael@0 3776 ;;
michael@0 3777 *)
michael@0 3778 ;;
michael@0 3779 esac
michael@0 3780
michael@0 3781 if test -z "$SKIP_LIBRARY_CHECKS" -a -z "$NO_EDITLINE"; then
michael@0 3782 if test -n "$JS_WANT_READLINE"; then
michael@0 3783 AC_CHECK_LIB(readline, readline,
michael@0 3784 EDITLINE_LIBS="-lreadline",
michael@0 3785 AC_MSG_ERROR([No system readline library found.]))
michael@0 3786 else
michael@0 3787 dnl By default, we use editline
michael@0 3788 JS_NATIVE_EDITLINE=1
michael@0 3789 EDITLINE_LIBS='$(DEPTH)/js/src/editline/$(LIB_PREFIX)editline.$(LIB_SUFFIX)'
michael@0 3790 fi
michael@0 3791
michael@0 3792 dnl Either way, we want to build with line editing support.
michael@0 3793 AC_DEFINE(EDITLINE)
michael@0 3794 fi
michael@0 3795 AC_SUBST(JS_NATIVE_EDITLINE)
michael@0 3796 AC_SUBST(JS_DISABLE_SHELL)
michael@0 3797 AC_SUBST(EDITLINE_LIBS)
michael@0 3798
michael@0 3799 dnl ========================================================
michael@0 3800 dnl =
michael@0 3801 dnl = Standalone module options
michael@0 3802 dnl =
michael@0 3803 dnl ========================================================
michael@0 3804 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
michael@0 3805
michael@0 3806 dnl ========================================================
michael@0 3807 dnl = Build jsctypes if it's enabled
michael@0 3808 dnl ========================================================
michael@0 3809 MOZ_ARG_ENABLE_BOOL(ctypes,
michael@0 3810 [ --enable-ctypes Enable js-ctypes (default=no)],
michael@0 3811 BUILD_CTYPES=1,
michael@0 3812 BUILD_CTYPES= )
michael@0 3813 JS_HAS_CTYPES=$BUILD_CTYPES
michael@0 3814 AC_SUBST(JS_HAS_CTYPES)
michael@0 3815 AC_SUBST(BUILD_CTYPES)
michael@0 3816 if test "$JS_HAS_CTYPES"; then
michael@0 3817 dnl Error out if we're on MSVC and MASM is unavailable.
michael@0 3818 if test -n "$_MSC_VER" -a \( "$AS" != "ml.exe" -a "$AS" != "ml64.exe" \); then
michael@0 3819 AC_MSG_ERROR([\"$AS\" is not a suitable assembler to build js-ctypes. If you are building with MS Visual Studio 8 Express, you may download the MASM 8.0 package, upgrade to Visual Studio 9 Express, or install the Vista SDK. Or do not use --enable-ctypes.])
michael@0 3820 fi
michael@0 3821 AC_DEFINE(JS_HAS_CTYPES)
michael@0 3822 fi
michael@0 3823
michael@0 3824 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
michael@0 3825 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
michael@0 3826 fi
michael@0 3827
michael@0 3828 dnl ========================================================
michael@0 3829 dnl =
michael@0 3830 dnl = Options for generating the shell as a script
michael@0 3831 dnl =
michael@0 3832 dnl ========================================================
michael@0 3833
michael@0 3834 MOZ_ARG_WITH_STRING(qemu-exe,
michael@0 3835 [ --with-qemu-exe=path Use path as an arm emulator on host platforms],
michael@0 3836 QEMU_EXE=$withval)
michael@0 3837 AC_SUBST(QEMU_EXE)
michael@0 3838 MOZ_ARG_WITH_STRING(cross-lib,
michael@0 3839 [ --with-cross-lib=dir Use dir as the location for arm libraries],
michael@0 3840 CROSS_LIB=$withval,
michael@0 3841 CROSS_LIB=/usr/$target)
michael@0 3842 AC_SUBST(CROSS_LIB)
michael@0 3843 dnl ========================================================
michael@0 3844 dnl =
michael@0 3845 dnl = Maintainer debug option (no --enable equivalent)
michael@0 3846 dnl =
michael@0 3847 dnl ========================================================
michael@0 3848
michael@0 3849 AC_SUBST(AR)
michael@0 3850 AC_SUBST(AR_FLAGS)
michael@0 3851 AC_SUBST(AR_LIST)
michael@0 3852 AC_SUBST(AR_EXTRACT)
michael@0 3853 AC_SUBST(AR_DELETE)
michael@0 3854 AC_SUBST(AS)
michael@0 3855 AC_SUBST(ASFLAGS)
michael@0 3856 AC_SUBST(AS_DASH_C_FLAG)
michael@0 3857 AC_SUBST(LD)
michael@0 3858 AC_SUBST(RC)
michael@0 3859 AC_SUBST(RCFLAGS)
michael@0 3860 AC_SUBST(MC)
michael@0 3861 AC_SUBST(WINDRES)
michael@0 3862 AC_SUBST(IMPLIB)
michael@0 3863 AC_SUBST(FILTER)
michael@0 3864 AC_SUBST(BIN_FLAGS)
michael@0 3865 AC_SUBST(MOZ_DEBUG)
michael@0 3866 AC_SUBST(MOZ_DEBUG_SYMBOLS)
michael@0 3867 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
michael@0 3868 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
michael@0 3869 AC_SUBST(MOZ_DEBUG_LDFLAGS)
michael@0 3870 AC_SUBST(WARNINGS_AS_ERRORS)
michael@0 3871 AC_SUBST(MOZ_JPROF)
michael@0 3872 AC_SUBST(MOZ_SHARK)
michael@0 3873 AC_SUBST(MOZ_INSTRUMENTS)
michael@0 3874 AC_SUBST(MOZ_CALLGRIND)
michael@0 3875 AC_SUBST(MOZ_VTUNE)
michael@0 3876 AC_SUBST(MOZ_PROFILING)
michael@0 3877 AC_SUBST(LIBICONV)
michael@0 3878
michael@0 3879 AC_SUBST(ENABLE_TESTS)
michael@0 3880
michael@0 3881 AC_SUBST(ENABLE_STRIP)
michael@0 3882 AC_SUBST(PKG_SKIP_STRIP)
michael@0 3883 AC_SUBST(INCREMENTAL_LINKER)
michael@0 3884 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
michael@0 3885 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
michael@0 3886
michael@0 3887 AC_SUBST(MOZ_FIX_LINK_PATHS)
michael@0 3888
michael@0 3889 AC_SUBST(USE_DEPENDENT_LIBS)
michael@0 3890
michael@0 3891 AC_SUBST(MOZ_BUILD_ROOT)
michael@0 3892
michael@0 3893 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
michael@0 3894 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
michael@0 3895
michael@0 3896 AC_SUBST(MOZ_APP_NAME)
michael@0 3897 AC_SUBST(MOZ_APP_DISPLAYNAME)
michael@0 3898 AC_SUBST(MOZ_APP_VERSION)
michael@0 3899
michael@0 3900 AC_SUBST(MOZ_PKG_SPECIAL)
michael@0 3901
michael@0 3902 AC_SUBST(MOZILLA_OFFICIAL)
michael@0 3903
michael@0 3904 dnl win32 options
michael@0 3905 AC_SUBST(MOZ_BROWSE_INFO)
michael@0 3906 AC_SUBST(MOZ_TOOLS_DIR)
michael@0 3907
michael@0 3908 dnl Echo the CFLAGS to remove extra whitespace.
michael@0 3909 CFLAGS=`echo \
michael@0 3910 $_WARNINGS_CFLAGS \
michael@0 3911 $CFLAGS`
michael@0 3912
michael@0 3913 CXXFLAGS=`echo \
michael@0 3914 $_WARNINGS_CXXFLAGS \
michael@0 3915 $CXXFLAGS`
michael@0 3916
michael@0 3917 COMPILE_CFLAGS=`echo \
michael@0 3918 $_DEFINES_CFLAGS \
michael@0 3919 $_DEPEND_CFLAGS \
michael@0 3920 $COMPILE_CFLAGS`
michael@0 3921
michael@0 3922 COMPILE_CXXFLAGS=`echo \
michael@0 3923 $_DEFINES_CXXFLAGS \
michael@0 3924 $_DEPEND_CFLAGS \
michael@0 3925 $COMPILE_CXXFLAGS`
michael@0 3926
michael@0 3927 HOST_CFLAGS=`echo \
michael@0 3928 $HOST_CFLAGS \
michael@0 3929 $_DEPEND_CFLAGS`
michael@0 3930
michael@0 3931 HOST_CXXFLAGS=`echo \
michael@0 3932 $HOST_CXXFLAGS \
michael@0 3933 $_DEPEND_CFLAGS`
michael@0 3934
michael@0 3935 AC_SUBST(NSPR_CFLAGS)
michael@0 3936 AC_SUBST(NSPR_LIBS)
michael@0 3937 AC_SUBST(MOZ_NATIVE_NSPR)
michael@0 3938
michael@0 3939 if test -n "$MOZ_NUWA_PROCESS"; then
michael@0 3940 AC_DEFINE(MOZ_NUWA_PROCESS)
michael@0 3941 fi
michael@0 3942
michael@0 3943 OS_CFLAGS="$CFLAGS"
michael@0 3944 OS_CXXFLAGS="$CXXFLAGS"
michael@0 3945 OS_CPPFLAGS="$CPPFLAGS"
michael@0 3946 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
michael@0 3947 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
michael@0 3948 OS_LDFLAGS="$LDFLAGS"
michael@0 3949 OS_LIBS="$LIBS"
michael@0 3950 AC_SUBST(OS_CFLAGS)
michael@0 3951 AC_SUBST(OS_CXXFLAGS)
michael@0 3952 AC_SUBST(OS_CPPFLAGS)
michael@0 3953 AC_SUBST(OS_COMPILE_CFLAGS)
michael@0 3954 AC_SUBST(OS_COMPILE_CXXFLAGS)
michael@0 3955 AC_SUBST(OS_LDFLAGS)
michael@0 3956 AC_SUBST(OS_LIBS)
michael@0 3957 AC_SUBST(CROSS_COMPILE)
michael@0 3958 AC_SUBST(MOZ_METRO)
michael@0 3959
michael@0 3960 AC_SUBST(HOST_CC)
michael@0 3961 AC_SUBST(HOST_CXX)
michael@0 3962 AC_SUBST(HOST_CFLAGS)
michael@0 3963 AC_SUBST(HOST_CXXFLAGS)
michael@0 3964 AC_SUBST(HOST_LDFLAGS)
michael@0 3965 AC_SUBST(HOST_OPTIMIZE_FLAGS)
michael@0 3966 AC_SUBST(HOST_AR)
michael@0 3967 AC_SUBST(HOST_AR_FLAGS)
michael@0 3968 AC_SUBST(HOST_LD)
michael@0 3969 AC_SUBST(HOST_RANLIB)
michael@0 3970 AC_SUBST(HOST_NSPR_MDCPUCFG)
michael@0 3971 AC_SUBST(HOST_BIN_SUFFIX)
michael@0 3972 AC_SUBST(HOST_OS_ARCH)
michael@0 3973
michael@0 3974 AC_SUBST(TARGET_CPU)
michael@0 3975 AC_SUBST(TARGET_VENDOR)
michael@0 3976 AC_SUBST(TARGET_OS)
michael@0 3977 AC_SUBST(TARGET_NSPR_MDCPUCFG)
michael@0 3978 AC_SUBST(TARGET_MD_ARCH)
michael@0 3979 AC_SUBST(TARGET_XPCOM_ABI)
michael@0 3980 AC_SUBST(OS_TARGET)
michael@0 3981 AC_SUBST(OS_ARCH)
michael@0 3982 AC_SUBST(OS_RELEASE)
michael@0 3983 AC_SUBST(OS_TEST)
michael@0 3984 AC_SUBST(CPU_ARCH)
michael@0 3985 AC_SUBST(INTEL_ARCHITECTURE)
michael@0 3986
michael@0 3987 AC_SUBST(WRAP_LDFLAGS)
michael@0 3988 AC_SUBST(MKSHLIB)
michael@0 3989 AC_SUBST(MKCSHLIB)
michael@0 3990 AC_SUBST(MKSHLIB_FORCE_ALL)
michael@0 3991 AC_SUBST(MKSHLIB_UNFORCE_ALL)
michael@0 3992 AC_SUBST(DSO_CFLAGS)
michael@0 3993 AC_SUBST(DSO_PIC_CFLAGS)
michael@0 3994 AC_SUBST(DSO_LDOPTS)
michael@0 3995 AC_SUBST(LIB_PREFIX)
michael@0 3996 AC_SUBST(DLL_PREFIX)
michael@0 3997 AC_SUBST(DLL_SUFFIX)
michael@0 3998 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
michael@0 3999 AC_SUBST(LIB_SUFFIX)
michael@0 4000 AC_SUBST(OBJ_SUFFIX)
michael@0 4001 AC_SUBST(BIN_SUFFIX)
michael@0 4002 AC_SUBST(ASM_SUFFIX)
michael@0 4003 AC_SUBST(IMPORT_LIB_SUFFIX)
michael@0 4004 AC_SUBST(USE_N32)
michael@0 4005 AC_SUBST(CC_VERSION)
michael@0 4006 AC_SUBST(CXX_VERSION)
michael@0 4007 AC_SUBST(MSMANIFEST_TOOL)
michael@0 4008 AC_SUBST(MOZ_LINKER)
michael@0 4009
michael@0 4010 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
michael@0 4011
michael@0 4012 dnl Check for missing components
michael@0 4013 if test "$COMPILE_ENVIRONMENT"; then
michael@0 4014 if test "$MOZ_X11"; then
michael@0 4015 dnl ====================================================
michael@0 4016 dnl = Check if X headers exist
michael@0 4017 dnl ====================================================
michael@0 4018 _SAVE_CFLAGS=$CFLAGS
michael@0 4019 CFLAGS="$CFLAGS $XCFLAGS"
michael@0 4020 AC_TRY_COMPILE([
michael@0 4021 #include <stdio.h>
michael@0 4022 #include <stdlib.h>
michael@0 4023 #include <X11/Xlib.h>
michael@0 4024 #include <X11/Intrinsic.h>
michael@0 4025 ],
michael@0 4026 [
michael@0 4027 Display *dpy = 0;
michael@0 4028 if ((dpy = XOpenDisplay(NULL)) == NULL) {
michael@0 4029 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
michael@0 4030 exit(1);
michael@0 4031 }
michael@0 4032 ], [],
michael@0 4033 [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
michael@0 4034 CFLAGS="$_SAVE_CFLAGS"
michael@0 4035
michael@0 4036 if test -n "$MISSING_X"; then
michael@0 4037 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
michael@0 4038 fi
michael@0 4039
michael@0 4040 fi # MOZ_X11
michael@0 4041 fi # COMPILE_ENVIRONMENT
michael@0 4042
michael@0 4043 dnl Set various defines and substitutions
michael@0 4044 dnl ========================================================
michael@0 4045
michael@0 4046 if test "$OS_ARCH" = "Darwin"; then
michael@0 4047 AC_DEFINE(XP_MACOSX)
michael@0 4048 AC_DEFINE(XP_UNIX)
michael@0 4049 elif test "$OS_ARCH" != "WINNT"; then
michael@0 4050 AC_DEFINE(XP_UNIX)
michael@0 4051 fi
michael@0 4052
michael@0 4053 if test "$MOZ_DEBUG"; then
michael@0 4054 AC_DEFINE(MOZ_REFLOW_PERF)
michael@0 4055 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
michael@0 4056 fi
michael@0 4057
michael@0 4058 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
michael@0 4059 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
michael@0 4060 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
michael@0 4061 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
michael@0 4062 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
michael@0 4063 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
michael@0 4064 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
michael@0 4065 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
michael@0 4066 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
michael@0 4067 fi
michael@0 4068
michael@0 4069
michael@0 4070 dnl ========================================================
michael@0 4071 dnl ECMAScript Internationalization API Support (uses ICU)
michael@0 4072 dnl ========================================================
michael@0 4073
michael@0 4074 dnl top-level configure may override this with --without-intl-api
michael@0 4075 _INTL_API=yes
michael@0 4076
michael@0 4077 MOZ_CONFIG_ICU()
michael@0 4078
michael@0 4079 MOZ_SUBCONFIGURE_ICU()
michael@0 4080
michael@0 4081 dnl ========================================================
michael@0 4082 dnl JavaScript shell
michael@0 4083 dnl ========================================================
michael@0 4084
michael@0 4085 AC_HAVE_FUNCS(setlocale)
michael@0 4086 AC_HAVE_FUNCS(localeconv)
michael@0 4087
michael@0 4088 AC_SUBST(MOZILLA_VERSION)
michael@0 4089
michael@0 4090 AC_SUBST(ac_configure_args)
michael@0 4091
michael@0 4092 AC_SUBST(TOOLCHAIN_PREFIX)
michael@0 4093
michael@0 4094
michael@0 4095 if test -n "$JS_STANDALONE"; then
michael@0 4096 MOZ_APP_NAME="mozjs"
michael@0 4097 MOZ_APP_VERSION="$MOZILLA_SYMBOLVERSION"
michael@0 4098 JS_LIBRARY_NAME="mozjs-$MOZILLA_SYMBOLVERSION"
michael@0 4099 else
michael@0 4100 JS_LIBRARY_NAME="mozjs"
michael@0 4101 fi
michael@0 4102 JS_CONFIG_LIBS="$NSPR_LIBS $LIBS"
michael@0 4103 if test -n "$GNU_CC"; then
michael@0 4104 JS_CONFIG_MOZ_JS_LIBS='-L${libdir} -l${JS_LIBRARY_NAME}'
michael@0 4105 else
michael@0 4106 JS_CONFIG_MOZ_JS_LIBS='${libdir}/${JS_LIBRARY_NAME}.lib'
michael@0 4107 fi
michael@0 4108 AC_SUBST(JS_LIBRARY_NAME)
michael@0 4109 AC_SUBST(JS_CONFIG_MOZ_JS_LIBS)
michael@0 4110 AC_SUBST(JS_CONFIG_LIBS)
michael@0 4111
michael@0 4112 MOZ_SUBCONFIGURE_FFI()
michael@0 4113
michael@0 4114 dnl Spit out some output
michael@0 4115 dnl ========================================================
michael@0 4116 MOZ_CREATE_CONFIG_STATUS()
michael@0 4117
michael@0 4118 if test "$JS_STANDALONE"; then
michael@0 4119 MOZ_RUN_CONFIG_STATUS()
michael@0 4120 fi

mercurial