1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
2 dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
3 dnl ***** BEGIN LICENSE BLOCK *****
4 dnl Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 dnl The contents of this file are subject to the Mozilla Public License Version
7 dnl 1.1 (the "License"); you may not use this file except in compliance with
8 dnl the License. You may obtain a copy of the License at
9 dnl http://www.mozilla.org/MPL/
11 dnl Software distributed under the License is distributed on an "AS IS" basis,
12 dnl WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 dnl for the specific language governing rights and limitations under the
16 dnl The Original Code is this file as it was released upon August 6, 1998.
18 dnl The Initial Developer of the Original Code is
19 dnl Christopher Seawood.
20 dnl Portions created by the Initial Developer are Copyright (C) 1998-2001
21 dnl the Initial Developer. All Rights Reserved.
24 dnl Jamie Zawinski <jwz@jwz.org>
25 dnl gettimeofday args check
26 dnl Christopher Blizzard <blizzard@appliedtheory.com>
27 dnl gnomefe update & enable-pthreads
28 dnl Ramiro Estrugo <ramiro@netscape.com>
29 dnl X11 makedepend support
31 dnl Henry Sobotka <sobotka@axess.com>
33 dnl Dan Mosedale <dmose@mozilla.org>
35 dnl Seth Spitzer <sspitzer@netscape.com>
37 dnl Benjamin Smedberg <benjamin@smedbergs.us>
38 dnl Howard Chu <hyc@symas.com>
40 dnl Mark Mentovai <mark@moxienet.com>:
41 dnl Mac OS X 10.4 support
42 dnl Giorgio Maone <g.maone@informaction.com>
43 dnl MSVC l10n compatible version check
44 dnl Ben Turner <mozilla@songbirdnest.com>
45 dnl Windows x64 support
46 dnl Makoto Kato <m_kato@ga2.so-net.ne.jp>
48 dnl Alternatively, the contents of this file may be used under the terms of
49 dnl either the GNU General Public License Version 2 or later (the "GPL"), or
50 dnl the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
51 dnl in which case the provisions of the GPL or the LGPL are applicable instead
52 dnl of those above. If you wish to allow use of your version of this file only
53 dnl under the terms of either the GPL or the LGPL, and not to allow others to
54 dnl use your version of this file under the terms of the MPL, indicate your
55 dnl decision by deleting the provisions above and replace them with the notice
56 dnl and other provisions required by the GPL or the LGPL. If you do not delete
57 dnl the provisions above, a recipient may use your version of this file under
58 dnl the terms of any one of the MPL, the GPL or the LGPL.
60 dnl ***** END LICENSE BLOCK *****
62 dnl Process this file with autoconf to produce a configure script.
63 dnl ========================================================
67 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
68 AC_CONFIG_HEADER(js-config.h)
70 TARGET_CPU="${target_cpu}"
71 TARGET_VENDOR="${target_vendor}"
72 TARGET_OS="${target_os}"
74 dnl ========================================================
76 dnl = Don't change the following two lines. Doing so breaks:
78 dnl = CFLAGS="-foo" ./configure
80 dnl ========================================================
82 CPPFLAGS="${CPPFLAGS=}"
83 CXXFLAGS="${CXXFLAGS=}"
85 HOST_CFLAGS="${HOST_CFLAGS=}"
86 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
87 HOST_LDFLAGS="${HOST_LDFLAGS=}"
89 dnl ========================================================
90 dnl = Preserve certain environment flags passed to configure
91 dnl = We want sub projects to receive the same flags
92 dnl = untainted by this configure script
93 dnl ========================================================
96 _SUBDIR_CFLAGS="$CFLAGS"
97 _SUBDIR_CPPFLAGS="$CPPFLAGS"
98 _SUBDIR_CXXFLAGS="$CXXFLAGS"
99 _SUBDIR_LDFLAGS="$LDFLAGS"
100 _SUBDIR_HOST_CC="$HOST_CC"
101 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
102 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
103 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
104 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
106 dnl Set the version number of the libs included with mozilla
107 dnl ========================================================
110 dnl Set the minimum version of toolkit libs used by mozilla
111 dnl ========================================================
114 WINDRES_VERSION=2.14.90
119 dnl Set various checks
120 dnl ========================================================
124 dnl Initialize the Pthread test variables early so they can be
125 dnl overridden by each platform.
126 dnl ========================================================
130 dnl Do not allow a separate objdir build if a srcdir build exists.
131 dnl ==============================================================
132 _topsrcdir=`cd \`dirname $0\`; pwd`
135 if test "$_topsrcdir" != "$_objdir"
137 # Check for a couple representative files in the source tree
139 for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
140 if test -f $file; then
141 _conflict_files="$_conflict_files $file"
144 if test "$_conflict_files"; then
146 echo "* Your source tree contains these files:"
147 for file in $_conflict_files; do
151 * This indicates that you previously built in the source tree.
152 * A source tree build can confuse the separate objdir build.
154 * To clean up the source tree:
165 dnl Choose where to put the 'dist' directory.
166 dnl ==============================================================
168 MOZ_ARG_WITH_STRING(dist-dir,
169 [ --with-dist-dir=DIR Use DIR as 'dist' staging area. DIR may be
170 relative to the top of SpiderMonkey build tree,
178 COMPILE_ENVIRONMENT=1
179 MOZ_ARG_DISABLE_BOOL(compile-environment,
180 [ --disable-compile-environment
181 Disable compiler/library checks.],
182 COMPILE_ENVIRONMENT= )
183 AC_SUBST(COMPILE_ENVIRONMENT)
185 dnl Check for Perl first -- needed for win32 SDK checks
186 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
187 if test -z "$PERL" -o "$PERL" = ":"; then
188 AC_MSG_ERROR([perl not found in \$PATH])
191 MOZ_ARG_ENABLE_BOOL(shared-js,
192 [ --disable-shared-js
193 Do not create a shared library.],
197 if test "$DISABLE_SHARED_JS" = "1" ; then
198 AC_DEFINE(STATIC_EXPORTABLE_JS_API)
202 AC_SUBST(JS_SHARED_LIBRARY)
204 dnl ========================================================
205 dnl = Android uses a very custom (hacky) toolchain; we need to do this
206 dnl = here, so that the compiler checks can succeed
207 dnl ========================================================
209 MOZ_ARG_WITH_STRING(android-ndk,
210 [ --with-android-ndk=DIR
211 location where the Android NDK can be found],
212 android_ndk=$withval)
214 MOZ_ARG_WITH_STRING(android-toolchain,
215 [ --with-android-toolchain=DIR
216 location of the android toolchain, default NDK/build/prebuilt/HOST/arm-eabi-4.4.0],
217 android_toolchain=$withval)
220 MOZ_ARG_WITH_STRING(android-version,
221 [ --with-android-version=VER
222 android platform version, default 5],
223 android_version=$withval,
226 MOZ_ARG_WITH_STRING(android-sdk,
227 [ --with-android-sdk=DIR
228 location where the Android SDK can be found (base directory, e.g. .../android/platforms/android-6)],
229 android_sdk=$withval)
231 MOZ_ARG_WITH_STRING(android-platform,
232 [ --with-android-platform=DIR
233 location of platform dir, default NDK/build/platforms/android-5/arch-arm],
234 android_platform=$withval)
236 MOZ_ARG_ENABLE_BOOL(android-libstdcxx,
237 [ --enable-android-libstdcxx
238 use GNU libstdc++ instead of STLPort for NDK >= 5],
239 MOZ_ANDROID_LIBSTDCXX=1,
240 MOZ_ANDROID_LIBSTDCXX= )
243 arm-linux*-android*|*-linuxandroid*)
244 android_tool_prefix="arm-linux-androideabi"
247 android_tool_prefix="arm-eabi"
250 android_tool_prefix="i686-android-linux"
253 android_tool_prefix="$target_os"
257 MOZ_ARG_WITH_STRING(gonk,
259 location of gonk dir],
262 MOZ_ARG_WITH_STRING(gonk-toolchain-prefix,
263 [ --with-gonk-toolchain-prefix=DIR
264 prefix to gonk toolchain commands],
265 gonk_toolchain_prefix=$withval)
267 if test -n "$gonkdir" ; then
268 kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
271 AS="$gonk_toolchain_prefix"as
272 CC="$gonk_toolchain_prefix"gcc
273 CXX="$gonk_toolchain_prefix"g++
274 CPP="$gonk_toolchain_prefix"cpp
275 LD="$gonk_toolchain_prefix"ld
276 AR="$gonk_toolchain_prefix"ar
277 RANLIB="$gonk_toolchain_prefix"ranlib
278 STRIP="$gonk_toolchain_prefix"strip
280 STLPORT_CPPFLAGS="-I$gonkdir/external/stlport/stlport"
281 STLPORT_LIBS="-lstlport"
283 CPPFLAGS="-DANDROID -isystem $gonkdir/bionic/libc/include/ -isystem $gonkdir/bionic/libc/kernel/common -isystem $gonkdir/bionic/libc/arch-arm/include -isystem $gonkdir/bionic/libc/kernel/arch-arm -isystem $gonkdir/bionic/libm/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/system/core/include -isystem $gonkdir/bionic $CPPFLAGS"
284 CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
285 CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions $CXXFLAGS $STLPORT_CPPFLAGS"
286 LIBS="$LIBS $STLPORT_LIBS"
288 dnl Add -llog by default, since we use it all over the place.
289 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"
291 dnl prevent cross compile section from using these flags as host flags
292 if test -z "$HOST_CPPFLAGS" ; then
295 if test -z "$HOST_CFLAGS" ; then
298 if test -z "$HOST_CXXFLAGS" ; then
301 if test -z "$HOST_LDFLAGS" ; then
305 # save these for libffi's subconfigure,
306 # which doesn't know how to figure this stuff out on its own
307 ANDROID_CFLAGS="$CFLAGS"
308 ANDROID_CPPFLAGS="$CPPFLAGS"
309 ANDROID_LDFLAGS="$LDFLAGS"
316 *-android*|*-linuxandroid*)
317 if test -z "$android_ndk" ; then
318 AC_MSG_ERROR([You must specify --with-android-ndk=/path/to/ndk when targeting Android.])
321 if test -z "$android_sdk" ; then
322 AC_MSG_ERROR([You must specify --with-android-sdk=/path/to/sdk when targeting Android.])
325 android_platform_tools="$android_sdk"/../../platform-tools
326 if test ! -d "$android_platform_tools" ; then
327 android_platform_tools="$android_sdk"/tools # SDK Tools < r8
329 if ! test -e "$android_sdk"/source.properties ; then
330 AC_MSG_ERROR([The path in --with-android-sdk isn't valid (source.properties hasn't been found).])
333 # Minimum Android SDK API Level we require.
334 android_min_api_level=13
336 # Get the api level from "$android_sdk"/source.properties.
337 android_api_level=`$AWK -F = '$1 == "AndroidVersion.ApiLevel" {print $2}' "$android_sdk"/source.properties`
339 if test -z "$android_api_level" ; then
340 AC_MSG_ERROR([Unexpected error: no AndroidVersion.ApiLevel field has been found in source.properties.])
343 if ! test "$android_api_level" -eq "$android_api_level" ; then
344 AC_MSG_ERROR([Unexpected error: the found android api value isn't a number! (found $android_api_level)])
347 if test $android_api_level -lt $android_min_api_level ; then
348 AC_MSG_ERROR([The given Android SDK provides API level $android_api_level ($android_min_api_level or higher required).])
352 if test -z "$android_toolchain" ; then
353 AC_MSG_CHECKING([for android toolchain directory])
355 kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
357 android_toolchain="$android_ndk"/build/prebuilt/$kernel_name-x86/arm-eabi-4.4.0
359 # With newer NDK, the toolchain path has changed.
360 if ! test -d "$android_toolchain" ; then
361 case "$target_cpu" in
363 target_name=arm-linux-androideabi-4.4.3
366 target_name=x86-4.4.3
369 android_toolchain="$android_ndk"/toolchains/$target_name/prebuilt/$kernel_name-x86
372 if test -d "$android_toolchain" ; then
373 AC_MSG_RESULT([$android_toolchain])
375 AC_MSG_ERROR([not found. You have to specify --with-android-toolchain=/path/to/ndk/toolchain.])
379 if test -z "$android_platform" ; then
380 AC_MSG_CHECKING([for android platform directory])
382 android_platform="$android_ndk"/build/platforms/android-"$android_version"/arch-"$target_cpu"
384 # With newer NDK, the platform path has changed.
385 if ! test -d "$android_platform" ; then
386 android_platform="$android_ndk"/platforms/android-"$android_version"/arch-"$target_cpu"
389 if test -d "$android_platform" ; then
390 AC_MSG_RESULT([$android_platform])
392 AC_MSG_ERROR([not found. You have to specify --with-android-platform=/path/to/ndk/platform.])
397 AS="$android_toolchain"/bin/"$android_tool_prefix"-as
398 CC="$android_toolchain"/bin/"$android_tool_prefix"-gcc
399 CXX="$android_toolchain"/bin/"$android_tool_prefix"-g++
400 CPP="$android_toolchain"/bin/"$android_tool_prefix"-cpp
401 LD="$android_toolchain"/bin/"$android_tool_prefix"-ld
402 AR="$android_toolchain"/bin/"$android_tool_prefix"-ar
403 RANLIB="$android_toolchain"/bin/"$android_tool_prefix"-ranlib
404 STRIP="$android_toolchain"/bin/"$android_tool_prefix"-strip
406 CPPFLAGS="-isystem $android_platform/usr/include $CPPFLAGS"
407 CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
408 CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions $CXXFLAGS"
410 dnl Add -llog by default, since we use it all over the place.
411 dnl Add --allow-shlib-undefined, because libGLESv2 links to an
412 dnl undefined symbol (present on the hardware, just not in the
414 LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform -llog -Wl,--allow-shlib-undefined $LDFLAGS"
416 dnl prevent cross compile section from using these flags as host flags
417 if test -z "$HOST_CPPFLAGS" ; then
420 if test -z "$HOST_CFLAGS" ; then
423 if test -z "$HOST_CXXFLAGS" ; then
426 if test -z "$HOST_LDFLAGS" ; then
430 ANDROID_NDK="${android_ndk}"
431 ANDROID_TOOLCHAIN="${android_toolchain}"
432 ANDROID_PLATFORM="${android_platform}"
433 ANDROID_SDK="${android_sdk}"
434 ANDROID_PLATFORM_TOOLS="${android_platform_tools}"
435 ANDROID_VERSION="${android_version}"
438 AC_DEFINE_UNQUOTED(ANDROID_VERSION, $android_version)
439 AC_SUBST(ANDROID_VERSION)
441 MOZ_CHROME_FILE_FORMAT=omni
447 AC_SUBST(ANDROID_NDK)
448 AC_SUBST(ANDROID_TOOLCHAIN)
449 AC_SUBST(ANDROID_PLATFORM)
450 AC_SUBST(ANDROID_SDK)
451 AC_SUBST(ANDROID_PLATFORM_TOOLS)
453 dnl ========================================================
454 dnl Checks for compilers.
455 dnl ========================================================
456 dnl Set CROSS_COMPILE in the environment when running configure
457 dnl to use the cross-compile setup for now
458 dnl ========================================================
460 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
463 if test "$COMPILE_ENVIRONMENT"; then
466 # In Mozilla, we use the names $target, $host and $build incorrectly, but are
467 # too far gone to back out now. See Bug 475488:
468 # - When we say $target, we mean $host, that is, the system on which
469 # Mozilla will be run.
470 # - When we say $host, we mean $build, that is, the system on which Mozilla
472 # - $target (in its correct usage) is for compilers who generate code for a
473 # different platform than $host, so it would not be used by Mozilla.
474 if test "$target" != "$host"; then
475 echo "cross compiling from $host to $target"
478 _SAVE_CFLAGS="$CFLAGS"
479 _SAVE_LDFLAGS="$LDFLAGS"
481 AC_MSG_CHECKING([for host c compiler])
482 AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
483 if test -z "$HOST_CC"; then
484 AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
486 AC_MSG_RESULT([$HOST_CC])
487 AC_MSG_CHECKING([for host c++ compiler])
488 AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
489 if test -z "$HOST_CXX"; then
490 AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
492 AC_MSG_RESULT([$HOST_CXX])
494 if test -z "$HOST_CFLAGS"; then
495 HOST_CFLAGS="$CFLAGS"
497 if test -z "$HOST_CXXFLAGS"; then
498 HOST_CXXFLAGS="$CXXFLAGS"
500 if test -z "$HOST_LDFLAGS"; then
501 HOST_LDFLAGS="$LDFLAGS"
503 if test -z "$HOST_AR_FLAGS"; then
504 HOST_AR_FLAGS="$AR_FLAGS"
506 AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
507 AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
509 CFLAGS="$HOST_CFLAGS"
510 LDFLAGS="$HOST_LDFLAGS"
512 AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
513 AC_TRY_COMPILE([], [return(0);],
514 [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
515 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
518 CFLAGS="$HOST_CXXFLAGS"
520 AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
521 AC_TRY_COMPILE([], [return(0);],
522 [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
523 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
527 LDFLAGS=$_SAVE_LDFLAGS
529 AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
532 AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
536 AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
537 AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
538 MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
539 AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
540 AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
541 AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
542 AC_DEFINE(CROSS_COMPILE)
544 dnl If we cross compile for ppc on Mac OS X x86, cross_compiling will
545 dnl have erroneously been set to "no", because the x86 build host is
546 dnl able to run ppc code in a translated environment, making a cross
547 dnl compiler appear native. So we override that here.
553 MOZ_PATH_PROGS(AS, $AS as, $CC)
554 AC_CHECK_PROGS(AR, ar, :)
555 AC_CHECK_PROGS(LD, ld, :)
556 AC_CHECK_PROGS(STRIP, strip, :)
557 AC_CHECK_PROGS(WINDRES, windres, :)
558 if test -z "$HOST_CC"; then
561 if test -z "$HOST_CFLAGS"; then
562 HOST_CFLAGS='$(CFLAGS)'
564 if test -z "$HOST_CXX"; then
567 if test -z "$HOST_CXXFLAGS"; then
568 HOST_CXXFLAGS='$(CXXFLAGS)'
570 if test -z "$HOST_LDFLAGS"; then
571 HOST_LDFLAGS='$(LDFLAGS)'
573 if test -z "$HOST_RANLIB"; then
574 HOST_RANLIB='$(RANLIB)'
576 if test -z "$HOST_AR"; then
579 if test -z "$HOST_AR_FLAGS"; then
580 HOST_AR_FLAGS='$(AR_FLAGS)'
590 if test "$GCC" = "yes"; then
592 CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
594 if test "$GXX" = "yes"; then
596 CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
598 if test "`echo | $AS -o conftest.out -v 2>&1 | grep -c GNU`" != "0"; then
602 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
605 if test "$GNU_CC"; then
606 if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
613 if test "$GCC" = yes; then
614 if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
619 if test "$GXX" = yes; then
620 if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
627 if test "$GCC" = yes; then
628 if test "`$CC -v 2>&1 | grep -c 'clang version'`" != "0"; then
633 if test "$GXX" = yes; then
634 if test "`$CXX -v 2>&1 | grep -c 'clang version'`" != "0"; then
639 dnl Special win32 checks
640 dnl ========================================================
642 # With win8, sdk target=602, WINVER=602
643 MOZ_ARG_ENABLE_BOOL(metro,
644 [ --enable-metro Enable Windows Metro build targets],
647 if test -n "$MOZ_METRO"; then
649 # Target the Windows 8 Kit
651 # Allow a higher api set
654 # Target the Windows 7 SDK by default
659 if test -n "$MOZ_METRO"; then
664 AC_MSG_ERROR([Metro builds only valid on the windows platform.]);
669 MOZ_ARG_WITH_STRING(windows-version,
670 [ --with-windows-version=WINSDK_TARGETVER
671 Windows SDK version to target. Lowest version
672 currently allowed is 601, highest is 602],
673 WINSDK_TARGETVER=$withval)
675 # Currently only two sdk versions allowed, 601 and 602
676 case "$WINSDK_TARGETVER" in
678 MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
682 AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
688 if test "$GCC" != "yes"; then
689 # Check to see if we are really running in a msvc environemnt
692 # Make sure compilers are valid
693 CFLAGS="$CFLAGS -TC -nologo"
694 CXXFLAGS="$CXXFLAGS -TP -nologo"
695 # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
696 # _CRT_SECURE_NO_WARNINGS disables warnings about using MSVC-specific
697 # secure CRT functions.
698 CXXFLAGS="$CXXFLAGS -wd4345 -D_CRT_SECURE_NO_WARNINGS"
701 AC_TRY_COMPILE([#include <stdio.h>],
702 [ printf("Hello World\n"); ],,
703 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
706 AC_TRY_COMPILE([#include <new.h>],
707 [ unsigned *test = new unsigned(42); ],,
708 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
712 _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
715 # Determine compiler version
716 CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
717 _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
718 _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
719 _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
720 _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
721 _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
723 CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
724 _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
726 if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
727 AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
730 if test "$_CC_MAJOR_VERSION" = "14"; then
731 dnl Require VC8SP1 or newer.
732 dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762.
733 if test "$_CC_RELEASE" -lt 50727 -o \
734 \( "$_CC_RELEASE" -eq 50727 -a "$_CC_BUILD" -lt 762 \); then
735 AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. You probably need to install Service Pack 1 of Visual Studio 2005. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
739 AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
740 AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
741 elif test "$_CC_MAJOR_VERSION" = "15"; then
743 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
744 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
745 elif test "$_CC_MAJOR_VERSION" = "16"; then
747 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
748 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
749 elif test "$_CC_MAJOR_VERSION" = "17"; then
751 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
752 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
754 AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
757 _MOZ_RTTI_FLAGS_ON='-GR'
758 _MOZ_RTTI_FLAGS_OFF='-GR-'
760 dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
761 dnl not something else like "magnetic tape manipulation utility".
762 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
763 if test -z "$MSMT_TOOL"; then
764 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
768 _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
770 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
771 if test -z "$MSMANIFEST_TOOL_VERSION"; then
772 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
778 # Check linker version
779 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
780 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
781 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
782 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
787 # Identify which version of the SDK we're building with
788 # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
790 MOZ_CHECK_HEADERS([winsdkver.h])
791 if test "$ac_cv_header_winsdkver_h" = "yes"; then
792 # Get the highest _WIN32_WINNT and NTDDI versions supported
793 # Take the higher of the two
794 # This is done because the Windows 7 beta SDK reports its
795 # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
796 AC_CACHE_CHECK(for highest Windows version supported by this SDK,
798 [cat > conftest.h <<EOF
799 #include <winsdkver.h>
800 #include <sdkddkver.h>
802 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
803 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
805 #define WINSDK_MAXVER NTDDI_MAXVER
810 ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
813 MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
815 # Any SDK which doesn't have WinSDKVer.h is too old.
816 AC_MSG_ERROR([Your SDK does not have WinSDKVer.h. It is probably too old. Please upgrade to a newer SDK or try running the Windows SDK Configuration Tool and selecting a newer SDK. See https://developer.mozilla.org/En/Windows_SDK_versions for more details on fixing this.])
819 unset _MSVC_VER_FILTER
821 AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
825 _SAVE_CXXFLAGS="$CXXFLAGS"
826 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
827 AC_TRY_COMPILE([#include <exception>],
828 [std::_Throw(std::exception()); return 0;],
829 ac_cv_have_std__Throw="yes",
830 ac_cv_have_std__Throw="no")
831 CXXFLAGS="$_SAVE_CXXFLAGS"
835 if test "$ac_cv_have_std__Throw" == "yes"; then
836 AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
837 ac_cv_have_dllimport_exception_bug,
841 _SAVE_CXXFLAGS="$CXXFLAGS"
842 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
843 AC_TRY_LINK([#include <vector>],
844 [std::vector<int> v; return v.at(1);],
845 ac_cv_have_dllimport_exception_bug="no",
846 ac_cv_have_dllimport_exception_bug="yes")
847 CXXFLAGS="$_SAVE_CXXFLAGS"
850 if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
852 MOZ_MSVC_STL_WRAP__Throw=1
853 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
856 AC_CACHE_CHECK(for overridable _RAISE,
861 _SAVE_CXXFLAGS="$CXXFLAGS"
862 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
863 AC_TRY_COMPILE([#include <xstddef>
865 #define _RAISE(x) externallyDefinedFunction((x).what())
868 [std::vector<int> v; return v.at(1);],
869 ac_cv_have__RAISE="no",
870 ac_cv_have__RAISE="yes")
871 CXXFLAGS="$_SAVE_CXXFLAGS"
874 if test "$ac_cv_have__RAISE" = "yes"; then
876 MOZ_MSVC_STL_WRAP__RAISE=1
877 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
879 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.])
883 if test "$WRAP_STL_INCLUDES" = "1"; then
884 STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
887 # Check w32api version
888 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
889 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
890 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
891 AC_TRY_COMPILE([#include <w32api.h>],
892 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
893 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
894 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
895 #error "test failed."
897 , [ res=yes ], [ res=no ])
898 AC_MSG_RESULT([$res])
899 if test "$res" != "yes"; then
900 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
902 # Check windres version
903 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
904 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
905 AC_MSG_RESULT([$_WINDRES_VERSION])
906 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
907 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
908 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
909 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
910 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
911 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
912 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
913 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
914 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
915 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
916 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
917 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
919 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
922 MOZ_WINSDK_MAXVER=0x06010000
925 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
926 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
927 # Require OS features provided by IE 6.0 SP2 (XP SP2)
928 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
930 # If the maximum version supported by this SDK is lower than the target
932 AC_MSG_CHECKING([for Windows SDK being recent enough])
933 if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
937 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.])
940 AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
941 # Definitions matching sdkddkver.h
942 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
949 if test -n "$_WIN32_MSVC"; then
951 SKIP_COMPILER_CHECKS=1
952 SKIP_LIBRARY_CHECKS=1
954 # Since we're skipping compiler and library checks, hard-code
957 # Common to all MSVC environments:
959 # Windows lacks <stdint.h>, but has __int8, and so on.
960 AC_DEFINE(JS_HAVE___INTN)
961 AC_DEFINE(HAVE_LOCALECONV)
962 AC_DEFINE(HAVE_SYSTEMTIMETOFILETIME)
963 AC_DEFINE(HAVE_GETSYSTEMTIMEASFILETIME)
965 # Windows <stddef.h> defines intptr_t and uintptr_t.
966 # VS2005: http://msdn.microsoft.com/en-us/library/323b6b3k(VS.80).aspx
967 # VS2008: http://msdn.microsoft.com/en-us/library/323b6b3k.aspx
968 AC_DEFINE(JS_STDDEF_H_HAS_INTPTR_T)
971 fi # COMPILE_ENVIRONMENT
973 if test "$cross_compiling" = "yes"; then
979 # Check to see if we are running in a broken QEMU scratchbox.
980 # We know that anything below 1.0.16 is broken.
981 AC_CHECK_PROGS(SBCONF, sb-conf ve, "")
982 if test -n "$SBCONF"; then
983 _sb_version=`$SBCONF ve`
984 _sb_version_major=`echo $_sb_version | cut -f1 -d.`
985 _sb_version_minor=`echo $_sb_version | cut -f2 -d.`
986 _sb_version_point=`echo $_sb_version | cut -f3 -d.`
987 if test $_sb_version_major -eq 1 -a $_sb_version_minor -eq 0 -a $_sb_version_point -le 16; then
988 QEMU_CANT_RUN_JS_SHELL=1
991 AC_SUBST(QEMU_CANT_RUN_JS_SHELL)
1003 AC_SUBST(WRAP_STL_INCLUDES)
1004 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
1005 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
1007 dnl ========================================================
1008 dnl Checks for programs.
1009 dnl ========================================================
1013 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
1014 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
1015 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
1017 AC_MSG_RESULT([$_perl_version])
1019 if test "$_perl_res" != 0; then
1020 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
1024 AC_MSG_CHECKING([for full perl installation])
1025 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
1027 if test "$_perl_res" != 0; then
1029 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
1031 AC_MSG_RESULT([yes])
1034 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.7 python2.6 python2.5 python)
1035 if test -z "$PYTHON"; then
1036 AC_MSG_ERROR([python was not found in \$PATH])
1039 if test -z "$COMPILE_ENVIRONMENT"; then
1040 NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
1042 AC_SUBST(NSINSTALL_BIN)
1044 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
1045 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
1046 MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
1047 MOZ_PATH_PROG(XARGS, xargs)
1048 if test -z "$XARGS" -o "$XARGS" = ":"; then
1049 AC_MSG_ERROR([xargs not found in \$PATH .])
1052 if test "$COMPILE_ENVIRONMENT"; then
1054 dnl ========================================================
1055 dnl = Mac OS X toolchain support
1056 dnl ========================================================
1058 case "$target_os" in
1060 dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
1061 dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
1062 dnl the environment and includedir purposes (when using an SDK, below),
1063 dnl but remember the full version number for the libdir (SDK).
1065 GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
1066 GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
1068 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1069 dnl Bug 280479, but this keeps popping up in bug 292530 too because
1070 dnl 4.0.0/4061 is the default compiler in Tiger.
1072 GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
1074 if test "$GCC_BUILD" = "4061" ; then
1075 AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
1076 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
1077 from building Mozilla. Upgrade to Xcode 2.1 or later.])
1081 dnl xcodebuild needs GCC_VERSION defined in the environment, since it
1082 dnl doesn't respect the CC/CXX setting. With GCC_VERSION set, it will use
1083 dnl /usr/bin/g(cc|++)-$GCC_VERSION.
1084 MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
1086 dnl sdp was formerly in /Developer/Tools. As of Mac OS X 10.4 (Darwin 8),
1087 dnl it has moved into /usr/bin.
1088 MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
1092 AC_SUBST(GCC_VERSION)
1094 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
1095 dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
1096 dnl when we can run target binaries.
1097 AC_SUBST(UNIVERSAL_BINARY)
1098 AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
1100 dnl ========================================================
1101 dnl Check for MacOS deployment target version
1102 dnl ========================================================
1104 MOZ_ARG_ENABLE_STRING(macos-target,
1105 [ --enable-macos-target=VER (default=10.5)
1106 Set the minimum MacOS version needed at runtime],
1107 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
1109 if test "$target_cpu" != "arm"; then
1112 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
1113 dnl Use the specified value
1114 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
1116 dnl No value specified on the command line or in the environment,
1117 dnl use architecture minimum.
1118 case "${target_cpu}" in
1120 export MACOSX_DEPLOYMENT_TARGET=10.5
1123 export MACOSX_DEPLOYMENT_TARGET=10.6
1131 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
1133 dnl ========================================================
1134 dnl = Mac OS X SDK support
1135 dnl ========================================================
1138 MOZ_ARG_WITH_STRING(macos-sdk,
1139 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
1140 MACOS_SDK_DIR=$withval)
1142 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
1143 dnl NEXT_ROOT will be set and exported only if it's needed.
1144 AC_SUBST(MACOS_SDK_DIR)
1147 if test "$MACOS_SDK_DIR"; then
1148 dnl Sync this section with the ones in NSPR and NSS.
1149 dnl Changes to the cross environment here need to be accounted for in
1150 dnl the libIDL checks (below) and xpidl build.
1152 if test ! -d "$MACOS_SDK_DIR"; then
1153 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
1154 specify a valid SDK. SDKs are installed when the optional cross-development
1155 tools are selected during the Xcode/Developer Tools installation.])
1158 GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
1159 if test "$GCC_VERSION_MAJOR" -lt "4" ; then
1160 AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
1162 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
1163 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
1165 dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
1166 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
1167 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
1169 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1170 dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
1171 dnl that supports -syslibroot. Don't set NEXT_ROOT because it will
1172 dnl be ignored and cause warnings when -syslibroot is specified.
1173 dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
1174 dnl the -isysroot it receives, so this is only needed with 4.0.0.
1175 LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
1180 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
1182 AC_TRY_COMPILE([#include <new>
1183 int main() { return 0; }],
1187 AC_MSG_RESULT($result)
1189 if test "$result" = "no" ; then
1190 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
1194 fi # COMPILE_ENVIRONMENT
1196 if test -n "$MAKE"; then
1197 if test `echo $MAKE | grep -c make.py` != 1; then
1204 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
1207 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
1210 if test "$GMAKE" = ":"; then
1211 AC_MSG_ERROR([GNU make not found])
1215 # MAKE will be set by client.mk, but still need this for standalone js builds
1216 if test -z "$MAKE"; then
1220 if test "$COMPILE_ENVIRONMENT"; then
1226 fi # COMPILE_ENVIRONMENT
1228 dnl ========================================================
1229 dnl set the defaults first
1230 dnl ========================================================
1233 AR_EXTRACT='$(AR) x'
1247 MOZ_USER_DIR=".mozilla"
1249 MOZ_JS_LIBS='-L$(libdir) -lmozjs'
1250 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1252 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1254 USE_DEPENDENT_LIBS=1
1256 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1258 if test -n "$CROSS_COMPILE"; then
1259 OS_TARGET="${target_os}"
1260 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1262 case "${target_os}" in
1263 linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
1264 kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1265 gnu*) OS_ARCH=GNU ;;
1266 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
1267 mingw*) OS_ARCH=WINNT OS_TARGET=WINNT ;;
1268 darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
1271 *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
1274 OS_TARGET=`uname -s`
1275 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1276 OS_RELEASE=`uname -r`
1279 # Before this used `uname -m` when not cross compiling
1280 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1281 OS_TEST="${target_cpu}"
1283 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1285 #######################################################################
1286 # Master "Core Components" macros for getting the OS target #
1287 #######################################################################
1290 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1291 # cross-compilation.
1295 # Define and override various archtecture-specific variables, including
1304 case "$HOST_OS_ARCH" in
1318 if test -z "$GNU_CC"; then
1319 if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1324 if test -z "$GNU_CXX"; then
1325 if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1326 SOLARIS_SUNPRO_CXX=1
1329 AC_SUBST(SOLARIS_SUNPRO_CC)
1330 AC_SUBST(SOLARIS_SUNPRO_CXX)
1342 if test -z "$CROSS_COMPILE" ; then
1348 # If uname -s returns "Windows_NT", we assume that we are using
1349 # the uname.exe in MKS toolkit.
1351 # The -r option of MKS uname only returns the major version number.
1352 # So we need to use its -v option to get the minor version number.
1353 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1357 OS_MINOR_RELEASE=`uname -v`
1358 if test "$OS_MINOR_RELEASE" = "00"; then
1361 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1365 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1366 # the uname.exe in the MSYS tools.
1368 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1373 OS_RELEASE=`uname -v`.`uname -r`
1374 OS_TEST=${target_cpu}
1375 if test -z "$GNU_CC"; then
1376 if test "`$CC -qversion 2>&1 | egrep -c 'IBM XL'`" != "0"; then
1387 OS_RELEASE=`uname -v`
1390 case "${target_cpu}" in
1401 if test -z "$CROSS_COMPILE" ; then
1409 # Only set CPU_ARCH if we recognize the value of OS_TEST
1420 powerpc | ppc | rs6000)
1424 Alpha | alpha | ALPHA)
1457 if test -z "$OS_TARGET"; then
1460 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1462 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1463 dnl ===============================================================
1467 INTEL_ARCHITECTURE=1
1470 dnl Configure platform-specific CPU architecture compiler options.
1471 dnl ==============================================================
1474 dnl =================================================================
1475 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1476 dnl which is bad when cross compiling.
1477 dnl =================================================================
1478 if test "$COMPILE_ENVIRONMENT"; then
1479 configure_static_assert_macros='
1480 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1481 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1482 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1485 dnl test that the macros actually work:
1486 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1487 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1490 ac_cv_static_assertion_macros_work="yes"
1491 AC_TRY_COMPILE([$configure_static_assert_macros],
1492 [CONFIGURE_STATIC_ASSERT(1)],
1494 ac_cv_static_assertion_macros_work="no")
1495 AC_TRY_COMPILE([$configure_static_assert_macros],
1496 [CONFIGURE_STATIC_ASSERT(0)],
1497 ac_cv_static_assertion_macros_work="no",
1500 AC_TRY_COMPILE([$configure_static_assert_macros],
1501 [CONFIGURE_STATIC_ASSERT(1)],
1503 ac_cv_static_assertion_macros_work="no")
1504 AC_TRY_COMPILE([$configure_static_assert_macros],
1505 [CONFIGURE_STATIC_ASSERT(0)],
1506 ac_cv_static_assertion_macros_work="no",
1510 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1511 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1512 AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1514 fi # COMPILE_ENVIRONMENT
1516 dnl ========================================================
1517 dnl Android libstdc++, placed here so it can use MOZ_ARCH
1519 dnl ========================================================
1521 if test "$OS_TARGET" = "Android"; then
1522 case "${CPU_ARCH}-${MOZ_ARCH}" in
1524 ANDROID_CPU_ARCH=armeabi-v7a
1527 ANDROID_CPU_ARCH=armeabi
1530 ANDROID_CPU_ARCH=x86
1535 if test "$OS_TARGET" = "Android" -a -z "$gonkdir"; then
1536 if test -z "$STLPORT_CPPFLAGS$STLPORT_LDFLAGS$STLPORT_LIBS"; then
1537 if test -n "$MOZ_ANDROID_LIBSTDCXX" ; then
1538 if test ! -e "$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH/libstdc++.a" ; then
1539 AC_MSG_ERROR([Cannot find path to libstdc++ (NDK version >= 5?)])
1541 STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/gnu-libstdc++/include -I$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH/include -D_GLIBCXX_PERMIT_BACKWARD_HASH"
1542 STLPORT_LDFLAGS="-L$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH"
1543 STLPORT_LIBS="-lstdc++"
1544 elif test -e "$android_ndk/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/libstlport_static.a" ; then
1545 STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/stlport/stlport"
1546 STLPORT_LDFLAGS="-L$android_ndk/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/"
1547 STLPORT_LIBS="-lstlport_static"
1548 elif test -e "$android_ndk/tmp/ndk-digit/build/install/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/libstlport_static.a" ; then
1549 STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/stlport/stlport"
1550 STLPORT_LDFLAGS="-L$android_ndk/tmp/ndk-digit/build/install/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH"
1551 STLPORT_LIBS="-lstlport_static"
1552 elif test "$target" != "arm-android-eabi"; then
1553 dnl fail if we're not building with NDKr4
1554 AC_MSG_ERROR([Couldn't find path to stlport in the android ndk])
1557 CXXFLAGS="$CXXFLAGS $STLPORT_CPPFLAGS"
1558 LDFLAGS="$LDFLAGS $STLPORT_LDFLAGS"
1559 LIBS="$LIBS $STLPORT_LIBS"
1561 # save these for libffi's subconfigure,
1562 # which doesn't know how to figure this stuff out on its own
1563 ANDROID_CFLAGS="$CFLAGS"
1564 ANDROID_CPPFLAGS="$CPPFLAGS"
1565 ANDROID_LDFLAGS="$LDFLAGS"
1568 dnl ========================================================
1569 dnl Suppress Clang Argument Warnings
1570 dnl ========================================================
1571 if test -n "$CLANG_CC"; then
1572 _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
1573 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
1575 if test -n "$CLANG_CXX"; then
1576 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
1579 dnl ========================================================
1580 dnl = Use Address Sanitizer
1581 dnl ========================================================
1582 MOZ_ARG_ENABLE_BOOL(address-sanitizer,
1583 [ --enable-address-sanitizer Enable Address Sanitizer (default=no)],
1586 if test -n "$MOZ_ASAN"; then
1592 dnl ========================================================
1593 dnl = Enable hacks required for LLVM instrumentations
1594 dnl ========================================================
1595 MOZ_ARG_ENABLE_BOOL(llvm-hacks,
1596 [ --enable-llvm-hacks Enable workarounds required for several LLVM instrumentations (default=no)],
1599 if test -n "$MOZ_LLVM_HACKS"; then
1603 AC_SUBST(MOZ_NO_WLZDEFS)
1604 AC_SUBST(MOZ_CFLAGS_NSS)
1606 dnl ========================================================
1607 dnl GNU specific defaults
1608 dnl ========================================================
1609 if test "$GNU_CC"; then
1610 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1611 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1612 DSO_LDOPTS='-shared'
1613 if test "$GCC_USE_GNU_LD"; then
1614 # Some tools like ASan use a runtime library that is only
1615 # linked against executables, so we must allow undefined
1616 # symbols for shared objects in some cases.
1617 if test -z "$MOZ_NO_WLZDEFS"; then
1618 # Don't allow undefined symbols in libraries
1619 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1622 WARNINGS_AS_ERRORS='-Werror -Wno-error=uninitialized'
1624 DSO_PIC_CFLAGS='-fPIC'
1625 ASFLAGS="$ASFLAGS -fPIC"
1626 _MOZ_RTTI_FLAGS_ON=-frtti
1627 _MOZ_RTTI_FLAGS_OFF=-fno-rtti
1629 # Turn on GNU-specific warnings:
1630 # -Wall - turn on a lot of warnings
1631 # -pedantic - this is turned on below
1632 # -Wpointer-arith - enabled with -pedantic, but good to have even if not
1633 # -Wdeclaration-after-statement - MSVC doesn't like these
1634 # -Werror=return-type - catches missing returns, zero false positives
1635 # -Wtype-limits - catches overflow bugs, few false positives
1636 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1638 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -Wpointer-arith -Wdeclaration-after-statement"
1639 MOZ_C_SUPPORTS_WARNING(-W, error=return-type, ac_c_has_werror_return_type)
1640 MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
1641 MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
1643 # Turn off the following warnings that -Wall/-pedantic turn on:
1644 # -Wno-unused - lots of violations in third-party code
1645 # -Wno-overlength-strings - we exceed the minimum maximum length frequently
1647 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
1648 MOZ_C_SUPPORTS_WARNING(-Wno-, overlength-strings, ac_c_has_wno_overlength_strings)
1650 if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1651 # Don't use -Wcast-align with ICC or clang
1653 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1654 hppa | ia64 | sparc | arm)
1657 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1662 dnl Turn pedantic on but disable the warnings for long long
1665 _DEFINES_CFLAGS='-include $(DEPTH)/js-confdefs.h -DMOZILLA_CLIENT'
1666 _USE_CPP_INCLUDE_FLAG=1
1668 elif test "$SOLARIS_SUNPRO_CC"; then
1670 if test "$CPU_ARCH" = "sparc"; then
1671 # for Sun Studio on Solaris/SPARC
1672 DSO_PIC_CFLAGS='-xcode=pic32'
1674 DSO_PIC_CFLAGS='-KPIC'
1676 _DEFINES_CFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
1678 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1679 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1681 DSO_LDOPTS='-shared'
1682 if test "$GNU_LD"; then
1683 # Don't allow undefined symbols in libraries
1684 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1688 DSO_PIC_CFLAGS='-KPIC'
1689 _DEFINES_CFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
1692 if test "$GNU_CXX"; then
1693 # Turn on GNU-specific warnings:
1694 # -Wall - turn on a lot of warnings
1695 # -pedantic - this is turned on below
1696 # -Wpointer-arith - enabled with -pedantic, but good to have even if not
1697 # -Woverloaded-virtual - ???
1698 # -Werror=return-type - catches missing returns, zero false positives
1699 # -Wtype-limits - catches overflow bugs, few false positives
1700 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1702 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual"
1703 MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
1704 MOZ_CXX_SUPPORTS_WARNING(-W, type-limits, ac_cxx_has_wtype_limits)
1705 MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
1707 # Turn off the following warnings that -Wall/-pedantic turn on:
1708 # -Wno-ctor-dtor-privacy - ???
1709 # -Wno-overlength-strings - we exceed the minimum maximum length frequently
1710 # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
1711 # -Wno-variadic-macros - ???
1713 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-ctor-dtor-privacy"
1714 MOZ_CXX_SUPPORTS_WARNING(-Wno-, overlength-strings, ac_cxx_has_wno_overlength_strings)
1715 MOZ_CXX_SUPPORTS_WARNING(-Wno-, invalid-offsetof, ac_cxx_has_wno_invalid_offsetof)
1716 MOZ_CXX_SUPPORTS_WARNING(-Wno-, variadic-macros, ac_cxx_has_wno_variadic_macros)
1718 if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1719 # Don't use -Wcast-align with ICC or clang
1721 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1722 hppa | ia64 | sparc | arm)
1725 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1730 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/js-confdefs.h'
1731 _USE_CPP_INCLUDE_FLAG=1
1733 # Recent clang and gcc support C++11 deleted functions without warnings if
1734 # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
1735 # versions). We can't use -std=c++0x yet, so gcc's support must remain
1736 # unused. But clang's warning can be disabled, so when compiling with clang
1737 # we use it to opt out of the warning, enabling (macro-encapsulated) use of
1738 # deleted function syntax.
1739 if test "$CLANG_CXX"; then
1740 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
1741 MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
1745 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_JS_CONFDEFS_H_ $(ACDEFINES)'
1748 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1749 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1750 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1751 dnl normal behavior.
1752 dnl ========================================================
1754 MKSHLIB_UNFORCE_ALL=
1756 if test "$COMPILE_ENVIRONMENT"; then
1757 if test "$GNU_CC"; then
1758 AC_MSG_CHECKING(whether ld has archive extraction flags)
1759 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1760 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1761 ac_cv_mkshlib_force_and_unforce="no"
1762 exec 3<&0 <<LOOP_INPUT
1763 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
1764 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1765 force="-Wl,-all"; unforce="-Wl,-none"
1772 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1775 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1777 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1781 eval $ac_cv_mkshlib_force_and_unforce
1782 MKSHLIB_FORCE_ALL=$force
1783 MKSHLIB_UNFORCE_ALL=$unforce
1786 fi # COMPILE_ENVIRONMENT
1788 dnl ========================================================
1789 dnl Checking for 64-bit OS
1790 dnl ========================================================
1791 if test "$COMPILE_ENVIRONMENT"; then
1794 AC_MSG_CHECKING(for 64-bit OS)
1795 AC_TRY_COMPILE([$configure_static_assert_macros],
1796 [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1797 result="yes", result="no")
1798 AC_MSG_RESULT("$result")
1799 if test "$result" = "yes"; then
1800 AC_DEFINE(HAVE_64BIT_OS)
1803 AC_SUBST(HAVE_64BIT_OS)
1805 fi # COMPILE_ENVIRONMENT
1807 dnl ========================================================
1808 dnl Enable high-memory support on OS/2 by default.
1809 dnl ========================================================
1810 MOZ_OS2_HIGH_MEMORY=1
1811 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1812 [ --disable-os2-high-mem Disable high-memory support on OS/2],
1813 MOZ_OS2_HIGH_MEMORY=,
1814 MOZ_OS2_HIGH_MEMORY=1 )
1815 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1817 dnl ========================================================
1818 dnl = Use profiling compile flags
1819 dnl ========================================================
1820 MOZ_ARG_ENABLE_BOOL(profiling,
1821 [ --enable-profiling Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1825 dnl ========================================================
1826 dnl System overrides of the defaults for host
1827 dnl ========================================================
1830 # we need Python 2.5 on Windows
1832 if test -n "$_WIN32_MSVC"; then
1834 HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1835 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1836 HOST_RANLIB='echo ranlib'
1838 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
1840 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
1841 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1842 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1843 HOST_BIN_SUFFIX=.exe
1846 PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1850 case "${host_cpu}" in
1852 if test -n "$_WIN32_MSVC"; then
1853 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
1857 if test -n "$_WIN32_MSVC"; then
1858 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
1860 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1866 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1867 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1868 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1871 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1872 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1873 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1874 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1878 HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1879 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1880 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1881 HOST_BIN_SUFFIX=.exe
1886 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1887 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1891 dnl We require version 2.4 or newer of Python to build,
1892 dnl and 2.5 or newer on Windows.
1893 AC_MSG_CHECKING([for Python version >= $PYTHON_VERSION but not 3.x])
1895 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1] or sys.version[:2] != '2.')" $PYTHON_VERSION
1898 if test "$_python_res" != 0; then
1899 AC_MSG_ERROR([Python $PYTHON_VERSION or higher (but not Python 3.x) is required.])
1901 AC_MSG_RESULT([yes])
1903 dnl Check for using a custom <stdint.h> implementation
1904 dnl ========================================================
1905 AC_MSG_CHECKING(for custom <stdint.h> implementation)
1906 if test "$MOZ_CUSTOM_STDINT_H"; then
1907 AC_DEFINE_UNQUOTED(MOZ_CUSTOM_STDINT_H, "$MOZ_CUSTOM_STDINT_H")
1908 AC_SUBST(MOZ_CUSTOM_STDINT_H)
1909 AC_MSG_RESULT(using $MOZ_CUSTOM_STDINT_H)
1911 AC_MSG_RESULT(none specified)
1914 MOZ_DOING_LTO(lto_is_enabled)
1916 dnl ========================================================
1917 dnl System overrides of the defaults for target
1918 dnl ========================================================
1923 if test ! "$GNU_CC"; then
1924 if test ! "$HAVE_64BIT_OS"; then
1925 # Compiling with Visual Age C++ object model compat is the
1926 # default. To compile with object model ibm, add
1927 # AIX_OBJMODEL=ibm to .mozconfig.
1928 if test "$AIX_OBJMODEL" = "ibm"; then
1929 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1936 AC_SUBST(AIX_OBJMODEL)
1937 DSO_LDOPTS='-qmkshrobj=1'
1938 DSO_CFLAGS='-qflag=w:w'
1940 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1942 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1943 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1944 if test "$COMPILE_ENVIRONMENT"; then
1947 AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
1949 [#if (__IBMCPP__ < 900)
1950 #error "Bad compiler"
1952 _BAD_COMPILER=,_BAD_COMPILER=1)
1953 if test -n "$_BAD_COMPILER"; then
1955 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
1957 AC_MSG_RESULT([yes])
1960 TARGET_COMPILER_ABI="ibmc"
1961 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1962 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1965 case "${target_os}" in
1970 if test "$COMPILE_ENVIRONMENT"; then
1971 MOZ_CHECK_HEADERS(sys/inttypes.h)
1973 AC_DEFINE(JS_SYS_TYPES_H_DEFINES_EXACT_SIZE_TYPES)
1974 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1978 dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
1987 _WARNINGS_CFLAGS="-Wall"
1988 _WARNINGS_CXXFLAGS="-Wall"
1989 # The test above doesn't work properly, at least on 3.1.
1990 MKSHLIB_FORCE_ALL=''
1991 MKSHLIB_UNFORCE_ALL=''
1997 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1998 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1999 MOZ_OPTIMIZE_FLAGS="-O3 -fno-stack-protector"
2001 CFLAGS="$CFLAGS -fno-common"
2002 CXXFLAGS="$CXXFLAGS -fno-common"
2005 STRIP="$STRIP -x -S"
2006 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
2007 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
2008 LDFLAGS="$LDFLAGS -lobjc"
2009 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
2010 # The ExceptionHandling framework is needed for Objective-C exception
2011 # logging code in nsObjCExceptions.h. Currently we only use that in debug
2013 _SAVE_LDFLAGS=$LDFLAGS
2014 AC_MSG_CHECKING([for -framework ExceptionHandling])
2015 LDFLAGS="$LDFLAGS -framework ExceptionHandling"
2016 AC_TRY_LINK(,[return 0;],
2017 ac_cv_have_framework_exceptionhandling="yes",
2018 ac_cv_have_framework_exceptionhandling="no")
2019 AC_MSG_RESULT([$ac_cv_have_framework_exceptionhandling])
2020 if test "$ac_cv_have_framework_exceptionhandling" = "yes"; then
2021 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
2023 LDFLAGS=$_SAVE_LDFLAGS
2025 if test "x$lto_is_enabled" = "xyes"; then
2026 echo "Skipping -dead_strip because lto is enabled."
2027 dnl DTrace and -dead_strip don't interact well. See bug 403132.
2028 dnl ===================================================================
2029 elif test "x$enable_dtrace" = "xyes"; then
2030 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
2032 dnl check for the presence of the -dead_strip linker flag
2033 AC_MSG_CHECKING([for -dead_strip option to ld])
2034 _SAVE_LDFLAGS=$LDFLAGS
2035 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
2036 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
2037 if test -n "$_HAVE_DEAD_STRIP" ; then
2038 AC_MSG_RESULT([yes])
2039 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
2044 LDFLAGS=$_SAVE_LDFLAGS
2046 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
2050 if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
2051 DLL_SUFFIX=".so.1.0"
2052 DSO_LDOPTS="-shared"
2054 if test ! "$GNU_CC"; then
2055 DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
2061 if test ! "$GNU_CC"; then
2065 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2066 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2067 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2070 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2071 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2075 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2076 AC_DEFINE(_LARGEFILE64_SOURCE)
2081 if test ! "$GNU_CC"; then
2082 DSO_LDOPTS='-b -Wl,+s'
2085 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2086 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2087 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2089 DSO_LDOPTS='-b -E +s'
2090 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2091 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2093 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2094 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2097 *-android*|*-linuxandroid*)
2098 AC_DEFINE(NO_PW_GECOS)
2100 _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2101 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2103 MOZ_GFX_OPTIMIZE_MOBILE=1
2104 MOZ_OPTIMIZE_FLAGS="-O3 -freorder-blocks -fno-reorder-functions"
2105 # The Maemo builders don't know about this flag
2106 MOZ_ARM_VFP_FLAGS="-mfpu=vfp"
2110 # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2111 # Similarly for GNU_CXX and INTEL_CXX.
2112 if test "$INTEL_CC" -o "$INTEL_CXX"; then
2113 # -Os has been broken on Intel's C/C++ compilers for quite a
2114 # while; Intel recommends against using it.
2115 MOZ_OPTIMIZE_FLAGS="-O2"
2116 MOZ_DEBUG_FLAGS="-g"
2117 elif test "$GNU_CC" -o "$GNU_CXX"; then
2118 GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2119 case $GCC_VERSION in
2121 # -Os is broken on gcc 4.1.x 4.2.x, 4.5.x we need to tweak it to get good results.
2122 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2124 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
2125 MOZ_OPTIMIZE_FLAGS="-O3 -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
2126 MOZ_DEBUG_FLAGS="-g"
2129 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2131 case "${target_cpu}" in
2133 CFLAGS="$CFLAGS -mieee"
2134 CXXFLAGS="$CXXFLAGS -mieee"
2137 MOZ_DEBUG_FLAGS="-g" # We want inlining
2141 if test -z "$MC"; then
2152 # certain versions of cygwin's makedepend barf on the
2153 # #include <string> vs -I./dist/include/string issue so don't use it
2155 if test -n "$GNU_CC"; then
2157 CXX="$CXX -mwindows"
2158 CPP="$CPP -mwindows"
2159 CFLAGS="$CFLAGS -mms-bitfields"
2160 CXXFLAGS="$CXXFLAGS -mms-bitfields"
2161 DSO_LDOPTS='-shared'
2162 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2163 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2165 # Use temp file for windres (bug 213281)
2166 RCFLAGS='-O coff --use-temp-file'
2167 # mingw doesn't require kernel32, user32, and advapi32 explicitly
2168 LIBS="$LIBS -lgdi32 -lwinmm -lwsock32 -lpsapi"
2169 MOZ_JS_LIBS='-L$(libdir) -lmozjs'
2171 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2172 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2174 IMPORT_LIB_SUFFIX=dll.a
2175 GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2177 TARGET_COMPILER_ABI=msvc
2181 if test "$AS_BIN"; then
2182 AS="$(basename "$AS_BIN")"
2185 AR_FLAGS='-NOLOGO -OUT:"$@"'
2187 RANLIB='echo not_ranlib'
2188 STRIP='echo not_strip'
2197 IMPORT_LIB_SUFFIX=lib
2198 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2199 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2201 MKSHLIB_UNFORCE_ALL=
2202 DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2203 _USE_CPP_INCLUDE_FLAG=1
2204 _DEFINES_CFLAGS='-FI $(DEPTH)/js-confdefs.h -DMOZILLA_CLIENT'
2205 _DEFINES_CXXFLAGS='-FI $(DEPTH)/js-confdefs.h -DMOZILLA_CLIENT'
2206 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2207 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2208 # MSVC warnings C4244 and C4800 are ubiquitous, useless, and annoying.
2209 CXXFLAGS="$CXXFLAGS -wd4244 -wd4800"
2210 # make 'foo == bar;' error out
2211 CFLAGS="$CFLAGS -we4553"
2212 CXXFLAGS="$CXXFLAGS -we4553"
2213 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib psapi.lib"
2214 MOZ_DEBUG_FLAGS='-Zi'
2215 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2216 WARNINGS_AS_ERRORS='-WX'
2217 MOZ_OPTIMIZE_FLAGS="-O2"
2218 MOZ_JS_LIBS='$(libdir)/mozjs.lib'
2220 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2221 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2222 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2223 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2224 if test $_MSC_VER -ge 1400; then
2225 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2226 dnl For profile-guided optimization
2227 PROFILE_GEN_CFLAGS="-GL"
2228 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2229 dnl XXX: PGO builds can fail with warnings treated as errors,
2230 dnl specifically "no profile data available" appears to be
2231 dnl treated as an error sometimes. This might be a consequence
2232 dnl of using WARNINGS_AS_ERRORS in some modules, combined
2233 dnl with the linker doing most of the work in the whole-program
2234 dnl optimization/PGO case. I think it's probably a compiler bug,
2235 dnl but we work around it here.
2236 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2237 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2238 dnl Probably also a compiler bug, but what can you do?
2239 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2240 LDFLAGS="$LDFLAGS -DYNAMICBASE"
2243 AC_DEFINE(HAVE_SNPRINTF)
2248 AC_DEFINE(HW_THREADS)
2249 AC_DEFINE(STDC_HEADERS)
2250 AC_DEFINE(NEW_H, <new>)
2251 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2252 TARGET_MD_ARCH=win32
2253 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2255 MOZ_USER_DIR="Mozilla"
2257 dnl Hardcode to win95 for now - cls
2258 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2260 dnl set NO_X11 defines here as the general check is skipped on win32
2266 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2272 if test -z "$MOZ_TOOLS"; then
2273 AC_MSG_ERROR([MOZ_TOOLS is not set])
2275 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2276 if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2277 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2279 MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2280 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2281 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2288 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.])
2294 if test "$HAVE_64BIT_OS"; then
2295 AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2298 if test $_MSC_VER -ge 1400; then
2299 LDFLAGS="$LDFLAGS -SAFESEH"
2302 if test -n "$GNU_CC"; then
2303 CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
2304 CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
2306 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
2309 MOZ_CHECK_HEADERS(mmintrin.h)
2313 if test -n "$_WIN32_MSVC"; then
2314 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
2319 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2323 if test "$HAVE_64BIT_OS"; then
2330 CFLAGS="$CFLAGS -Dunix"
2331 CXXFLAGS="$CXXFLAGS -Dunix"
2332 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2334 DSO_PIC_CFLAGS='-fPIC -DPIC'
2335 DSO_LDOPTS='-shared'
2336 BIN_FLAGS='-Wl,--export-dynamic'
2338 DSO_PIC_CFLAGS='-fPIC -DPIC'
2339 DLL_SUFFIX=".so.1.0"
2340 DSO_LDOPTS='-shared'
2342 # This will fail on a.out systems prior to 1.5.1_ALPHA.
2343 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2344 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2345 if test "$LIBRUNPATH"; then
2346 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2348 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2349 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2353 DLL_SUFFIX=".so.1.0"
2355 DSO_PIC_CFLAGS='-fPIC'
2356 DSO_LDOPTS='-shared -fPIC'
2357 if test "$LIBRUNPATH"; then
2358 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2363 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2364 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2367 AC_DEFINE(OS2EMX_PLAIN_CHAR)
2368 AC_DEFINE(TCPV40HDRS)
2374 IMPORT_LIB_SUFFIX=lib
2378 CFLAGS="$CFLAGS -Zomf"
2379 CXXFLAGS="$CXXFLAGS -Zomf"
2381 BIN_FLAGS='-Zlinker /ST:0x100000'
2385 WARNINGS_AS_ERRORS='-Werror'
2386 MOZ_DEBUG_FLAGS="-g -fno-inline"
2387 MOZ_OPTIMIZE_FLAGS="-O2"
2388 MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2389 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2390 LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2392 _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2396 MOZ_USER_DIR="Mozilla"
2398 if test "$MOZTOOLS"; then
2399 MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2401 AC_MSG_ERROR([MOZTOOLS is not set])
2403 if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2404 DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2405 LDFLAGS="$LDFLAGS -Zhigh-mem"
2406 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2407 AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2410 # GCC for OS/2 currently predefines these, but we don't want them
2411 _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2412 _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2414 AC_CACHE_CHECK(for __declspec(dllexport),
2416 [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2418 ac_os2_declspec="yes",
2419 ac_os2_declspec="no")])
2420 if test "$ac_os2_declspec" != "yes"; then
2421 AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
2427 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2428 if test -z "$CROSS_COMPILE" && pkginfo -q SUNWpr && pkginfo -q SUNWprd; then
2429 NO_NSPR_CONFIG_SYSTEM_LDFLAGS="-L/usr/lib/mps -R/usr/lib/mps -lnspr4"
2430 NO_NSPR_CONFIG_SYSTEM_CFLAGS="-I/usr/include/mps"
2431 NO_NSPR_CONFIG_SYSTEM_VERSION=["`pkgparam SUNWpr SUNW_PRODVERS | sed -e 's/^[1-9][0-9]*\.[0-9][0-9]*$/&.0/'`"]
2435 # $ORIGIN/.. is for shared libraries under components/ to locate shared
2436 # libraries one level up (e.g. libnspr4.so)
2437 if test "$SOLARIS_SUNPRO_CC"; then
2438 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2439 LIBS="-lCrun -lCstd -lc $LIBS"
2440 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2441 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2442 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2443 LDFLAGS="-xildoff $LDFLAGS"
2444 if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2445 _SAVE_LDFLAGS=$LDFLAGS
2446 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2447 AC_TRY_LINK([#include <stdio.h>],
2448 [printf("Hello World\n");],
2450 [LDFLAGS=$_SAVE_LDFLAGS])
2452 MOZ_OPTIMIZE_FLAGS="-xO4"
2453 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2454 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2455 MKSHLIB_FORCE_ALL='-z allextract'
2456 MKSHLIB_UNFORCE_ALL='-z defaultextract'
2463 AS='/usr/ccs/bin/as'
2464 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2466 TARGET_COMPILER_ABI="sunc"
2467 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2468 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2469 AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2473 [#if (__SUNPRO_CC < 0x590)
2476 _BAD_COMPILER=,_BAD_COMPILER=1)
2477 if test -n "$_BAD_COMPILER"; then
2479 AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2484 [#if (__SUNPRO_CC >= 0x5100)
2485 #error "Sun C++ 5.10 or above"
2487 _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2488 if test "$_ABOVE_SS12U1"; then
2490 CXXFLAGS="$CXXFLAGS -xannotate=no"
2492 AC_MSG_RESULT([$_res])
2495 LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2497 MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2498 MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2499 ASFLAGS="$ASFLAGS -fPIC"
2500 DSO_LDOPTS='-shared'
2501 WARNINGS_AS_ERRORS='-Werror'
2503 _WARNINGS_CXXFLAGS=''
2504 if test "$OS_RELEASE" = "5.3"; then
2505 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2508 if test "$OS_RELEASE" = "5.5.1"; then
2509 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2514 DSO_LDOPTS='-Bdynamic'
2515 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2516 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2518 AC_DEFINE(SPRINTF_RETURNS_STRING)
2519 case "$(target_os)" in
2521 DLL_SUFFIX='.so.1.0'
2527 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2532 dnl Only one oddball right now (QNX), but this gives us flexibility
2533 dnl if any other platforms need to override this in the future.
2534 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2536 dnl ========================================================
2537 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2538 dnl by now will not have any way to link most binaries (tests
2539 dnl as well as viewer, apprunner, etc.), because some symbols
2540 dnl will be left out of the "composite" .so's by ld as unneeded.
2541 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2542 dnl they can link in the static libs that provide the missing
2544 dnl ========================================================
2545 NO_LD_ARCHIVE_FLAGS=
2546 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2547 NO_LD_ARCHIVE_FLAGS=1
2551 NO_LD_ARCHIVE_FLAGS=
2554 NO_LD_ARCHIVE_FLAGS=
2557 if test -z "$GNU_CC"; then
2558 NO_LD_ARCHIVE_FLAGS=
2562 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2564 dnl ========================================================
2565 dnl = Flags to strip unused symbols from .so components
2566 dnl ========================================================
2568 *-linux*|*-kfreebsd*-gnu|*-gnu*)
2569 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2572 if test -z "$GNU_CC"; then
2573 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2575 if test -z "$GCC_USE_GNU_LD"; then
2576 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2578 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2583 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2586 if test -n "$GNU_CC"; then
2587 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2592 if test -z "$COMPILE_ENVIRONMENT"; then
2593 SKIP_COMPILER_CHECKS=1
2594 SKIP_LIBRARY_CHECKS=1
2597 dnl Configure JIT support
2604 ENABLE_METHODJIT_TYPED_ARRAY=1
2605 AC_DEFINE(JS_CPU_X86)
2606 AC_DEFINE(JS_NUNBOX32)
2612 ENABLE_METHODJIT_TYPED_ARRAY=1
2613 AC_DEFINE(JS_CPU_X64)
2614 AC_DEFINE(JS_PUNBOX64)
2620 ENABLE_POLYIC_TYPED_ARRAY=1
2621 AC_DEFINE(JS_CPU_ARM)
2622 AC_DEFINE(JS_NUNBOX32)
2625 if test ! "$HAVE_64BIT_OS" ; then
2629 ENABLE_METHODJIT_TYPED_ARRAY=1
2630 AC_DEFINE(JS_CPU_SPARC)
2631 AC_DEFINE(JS_NUNBOX32)
2638 ENABLE_METHODJIT_TYPED_ARRAY=1
2639 AC_DEFINE(JS_CPU_MIPS)
2640 AC_DEFINE(JS_NUNBOX32)
2644 MOZ_ARG_DISABLE_BOOL(methodjit,
2645 [ --disable-methodjit Disable method JIT support],
2648 MOZ_ARG_DISABLE_BOOL(monoic,
2649 [ --disable-monoic Disable use of MICs by JIT compiler],
2652 MOZ_ARG_DISABLE_BOOL(polyic,
2653 [ --disable-polyic Disable use of PICs by JIT compiler],
2656 MOZ_ARG_ENABLE_BOOL(methodjit-spew,
2657 [ --enable-methodjit-spew Enable method JIT spew support],
2658 ENABLE_METHODJIT_SPEW=1,
2659 ENABLE_METHODJIT_SPEW= )
2661 AC_SUBST(ENABLE_METHODJIT)
2663 if test "$ENABLE_METHODJIT"; then
2664 AC_DEFINE(JS_METHODJIT)
2667 if test "$ENABLE_MONOIC"; then
2668 AC_DEFINE(JS_MONOIC)
2671 if test "$ENABLE_POLYIC"; then
2672 AC_DEFINE(JS_POLYIC)
2675 if test "$ENABLE_METHODJIT_TYPED_ARRAY"; then
2676 AC_DEFINE(JS_METHODJIT_TYPED_ARRAY)
2679 if test "$ENABLE_METHODJIT_SPEW"; then
2680 AC_DEFINE(JS_METHODJIT_SPEW)
2683 if test -z "$SKIP_COMPILER_CHECKS"; then
2684 dnl Checks for typedefs, structures, and compiler characteristics.
2685 dnl ========================================================
2693 AC_MSG_CHECKING(for __stdcall)
2694 AC_CACHE_VAL(ac_cv___stdcall,
2695 [AC_TRY_COMPILE([template <typename Method> struct foo;
2696 template <> struct foo<void (*)()> {};
2697 template <> struct foo<void (__stdcall*)()> {};],
2699 [ac_cv___stdcall=true],
2700 [ac_cv___stdcall=false])])
2701 if test "$ac_cv___stdcall" = true ; then
2702 AC_DEFINE(HAVE_STDCALL)
2708 AC_MSG_CHECKING(for ssize_t)
2709 AC_CACHE_VAL(ac_cv_type_ssize_t,
2710 [AC_TRY_COMPILE([#include <stdio.h>
2711 #include <sys/types.h>],
2713 [ac_cv_type_ssize_t=true],
2714 [ac_cv_type_ssize_t=false])])
2715 if test "$ac_cv_type_ssize_t" = true ; then
2716 AC_DEFINE(HAVE_SSIZE_T)
2721 AC_STRUCT_ST_BLKSIZE
2722 AC_MSG_CHECKING(for siginfo_t)
2723 AC_CACHE_VAL(ac_cv_siginfo_t,
2724 [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2725 #include <signal.h>],
2727 [ac_cv_siginfo_t=true],
2728 [ac_cv_siginfo_t=false])])
2729 if test "$ac_cv_siginfo_t" = true ; then
2730 AC_DEFINE(HAVE_SIGINFO_T)
2736 MOZ_SIZE_OF_TYPE(JS_BYTES_PER_WORD, void*, 4 8)
2737 if test "$moz_cv_size_of_JS_BYTES_PER_WORD" -eq "4"; then
2738 AC_DEFINE(JS_BITS_PER_WORD_LOG2, 5)
2739 elif test "$moz_cv_size_of_JS_BYTES_PER_WORD" -eq "8"; then
2740 AC_DEFINE(JS_BITS_PER_WORD_LOG2, 6)
2742 AC_MSG_ERROR([Unexpected JS_BYTES_PER_WORD])
2745 MOZ_ALIGN_OF_TYPE(JS_ALIGN_OF_POINTER, void*, 2 4 8 16)
2746 MOZ_SIZE_OF_TYPE(JS_BYTES_PER_DOUBLE, double, 6 8 10 12 14)
2748 MOZ_CHECK_HEADERS(endian.h)
2749 if test "$ac_cv_header_endian_h" = yes; then
2750 AC_DEFINE(JS_HAVE_ENDIAN_H)
2753 MOZ_CHECK_HEADERS([machine/endian.h],[],[],[#include <sys/types.h>])
2754 if test "$ac_cv_header_machine_endian_h" = yes; then
2755 AC_DEFINE(JS_HAVE_MACHINE_ENDIAN_H)
2758 MOZ_CHECK_HEADERS(sys/isa_defs.h)
2759 if test "$ac_cv_header_sys_isa_defs_h" = yes; then
2760 AC_DEFINE(JS_HAVE_SYS_ISA_DEFS_H)
2763 dnl Check for uint and uint_t.
2764 dnl ========================================================
2765 AC_MSG_CHECKING(for uint)
2766 AC_CACHE_VAL(ac_cv_uint,
2767 [AC_TRY_COMPILE([#include <stdio.h>
2768 #include <sys/types.h>],
2771 [ac_cv_uint=false])])
2772 if test "$ac_cv_uint" = true ; then
2773 AC_DEFINE(HAVE_UINT)
2778 AC_MSG_CHECKING(for uint_t)
2779 AC_CACHE_VAL(ac_cv_uint_t,
2780 [AC_TRY_COMPILE([#include <stdio.h>
2781 #include <sys/types.h>],
2783 [ac_cv_uint_t=true],
2784 [ac_cv_uint_t=false])])
2785 if test "$ac_cv_uint_t" = true ; then
2786 AC_DEFINE(HAVE_UINT_T)
2792 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
2793 dnl are defined when compiling C++ but not C. Since the result of this
2794 dnl test is used only in C++, do it in C++.
2797 AC_MSG_CHECKING(for uname.domainname)
2798 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
2799 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2800 [ struct utsname *res; char *domain;
2801 (void)uname(res); if (res != 0) { domain = res->domainname; } ],
2802 [ac_cv_have_uname_domainname_field=true],
2803 [ac_cv_have_uname_domainname_field=false])])
2805 if test "$ac_cv_have_uname_domainname_field" = "true"; then
2806 AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
2812 AC_MSG_CHECKING(for uname.__domainname)
2813 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
2814 [AC_TRY_COMPILE([#include <sys/utsname.h>],
2815 [ struct utsname *res; char *domain;
2816 (void)uname(res); if (res != 0) { domain = res->__domainname; } ],
2817 [ac_cv_have_uname_us_domainname_field=true],
2818 [ac_cv_have_uname_us_domainname_field=false])])
2820 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
2821 AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
2829 dnl Check for .hidden assembler directive and visibility attribute.
2830 dnl Borrowed from glibc configure.in
2831 dnl ===============================================================
2832 if test "$GNU_CC"; then
2833 AC_CACHE_CHECK(for visibility(hidden) attribute,
2834 ac_cv_visibility_hidden,
2835 [cat > conftest.c <<EOF
2836 int foo __attribute__ ((visibility ("hidden"))) = 1;
2838 ac_cv_visibility_hidden=no
2839 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2840 if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2841 ac_cv_visibility_hidden=yes
2846 if test "$ac_cv_visibility_hidden" = "yes"; then
2847 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2849 AC_CACHE_CHECK(for visibility(default) attribute,
2850 ac_cv_visibility_default,
2851 [cat > conftest.c <<EOF
2852 int foo __attribute__ ((visibility ("default"))) = 1;
2854 ac_cv_visibility_default=no
2855 if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2856 if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
2857 ac_cv_visibility_default=yes
2862 if test "$ac_cv_visibility_default" = "yes"; then
2863 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2865 AC_CACHE_CHECK(for visibility pragma support,
2866 ac_cv_visibility_pragma,
2867 [cat > conftest.c <<EOF
2868 #pragma GCC visibility push(hidden)
2870 #pragma GCC visibility push(default)
2871 int foo_default = 1;
2873 ac_cv_visibility_pragma=no
2874 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
2875 if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
2876 if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
2877 ac_cv_visibility_pragma=yes
2883 if test "$ac_cv_visibility_pragma" = "yes"; then
2884 AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
2885 ac_cv_have_visibility_class_bug,
2886 [cat > conftest.c <<EOF
2887 #pragma GCC visibility push(hidden)
2888 struct __attribute__ ((visibility ("default"))) TestStruct {
2891 __attribute__ ((visibility ("default"))) void TestFunc() {
2895 ac_cv_have_visibility_class_bug=no
2896 if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2897 ac_cv_have_visibility_class_bug=yes
2899 if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
2900 ac_cv_have_visibility_class_bug=yes
2903 rm -rf conftest.{c,S}
2906 AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
2907 ac_cv_have_visibility_builtin_bug,
2908 [cat > conftest.c <<EOF
2909 #pragma GCC visibility push(hidden)
2910 #pragma GCC visibility push(default)
2912 #pragma GCC visibility pop
2914 __attribute__ ((visibility ("default"))) void Func() {
2916 memset(c, 0, sizeof(c));
2919 ac_cv_have_visibility_builtin_bug=no
2920 if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
2921 ac_cv_have_visibility_builtin_bug=yes
2923 if test `grep -c "@PLT" conftest.S` = 0; then
2924 ac_cv_visibility_builtin_bug=yes
2927 rm -f conftest.{c,S}
2929 if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
2930 "$ac_cv_have_visibility_class_bug" = "no"; then
2931 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers_js -include $(topsrcdir)/config/gcc_hidden.h'
2932 WRAP_SYSTEM_INCLUDES=1
2933 STL_FLAGS='-I$(DIST)/stl_wrappers'
2936 VISIBILITY_FLAGS='-fvisibility=hidden'
2937 fi # have visibility pragma bug
2938 fi # have visibility pragma
2939 fi # have visibility(default) attribute
2940 fi # have visibility(hidden) attribute
2943 # visibility hidden flag for Sun Studio on Solaris
2944 if test "$SOLARIS_SUNPRO_CC"; then
2945 VISIBILITY_FLAGS='-xldscope=hidden'
2946 fi # Sun Studio on Solaris
2948 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2949 AC_SUBST(VISIBILITY_FLAGS)
2954 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
2955 dnl ========================================================
2956 if test "$GNU_CC"; then
2957 CFLAGS_save="${CFLAGS}"
2958 CFLAGS="${CFLAGS} -Werror"
2959 AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
2960 ac_cv_force_align_arg_pointer,
2961 [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
2963 ac_cv_force_align_arg_pointer="yes",
2964 ac_cv_force_align_arg_pointer="no")])
2965 CFLAGS="${CFLAGS_save}"
2966 if test "$ac_cv_force_align_arg_pointer" = "yes"; then
2967 HAVE_GCC_ALIGN_ARG_POINTER=1
2969 HAVE_GCC_ALIGN_ARG_POINTER=
2972 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
2974 dnl Checks for header files.
2975 dnl ========================================================
2977 case "$target_os" in
2979 # for stuff like -lXshm
2980 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2983 MOZ_CHECK_COMMON_HEADERS
2985 dnl These are all the places some variant of statfs can be hiding.
2986 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2989 MOZ_CHECK_HEADERS(sys/quota.h)
2990 MOZ_CHECK_HEADERS(linux/quota.h)
2992 dnl Try for MMX support
2993 dnl NB - later gcc versions require -mmmx for this header to be successfully
2994 dnl included (or another option which implies it, such as -march=pentium-mmx)
2995 MOZ_CHECK_HEADERS(mmintrin.h)
2997 dnl Check whether the compiler supports the new-style C++ standard
2998 dnl library headers (i.e. <new>) or needs the old "new.h"
3001 MOZ_CHECK_HEADER(new, [NEW_H=new])
3002 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3005 AC_ARG_ENABLE(dtrace,
3006 [ --enable-dtrace build with dtrace support if available (default=no)],
3007 [enable_dtrace="yes"],)
3008 if test "x$enable_dtrace" = "xyes"; then
3009 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3010 if test -n "$HAVE_DTRACE"; then
3011 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3013 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3016 AC_SUBST(HAVE_DTRACE)
3022 MOZ_CHECK_HEADERS(sys/cdefs.h)
3026 dnl Performance measurement headers.
3027 MOZ_CHECK_HEADER(linux/perf_event.h,
3028 [AC_CACHE_CHECK(for perf_event_open system call,ac_cv_perf_event_open,
3029 [AC_TRY_COMPILE([#include <sys/syscall.h>],[return sizeof(__NR_perf_event_open);],
3030 ac_cv_perf_event_open=yes,
3031 ac_cv_perf_event_open=no)])])
3032 if test "$ac_cv_perf_event_open" = "yes"; then
3033 HAVE_LINUX_PERF_EVENT_H=1
3035 HAVE_LINUX_PERF_EVENT_H=
3037 AC_SUBST(HAVE_LINUX_PERF_EVENT_H)
3039 dnl Checks for libraries.
3040 dnl ========================================================
3045 AC_CHECK_LIB(c_r, gethostbyname_r)
3049 dnl We don't want to link with libdl even if it's present on OS X, since
3050 dnl it's not used and not part of the default installation. OS/2 has dlfcn
3052 dnl We don't want to link against libm or libpthread on Darwin since
3053 dnl they both are just symlinks to libSystem and explicitly linking
3054 dnl against libSystem causes issues when debugging (see bug 299601).
3061 AC_SEARCH_LIBS(dlopen, dl,
3062 MOZ_CHECK_HEADER(dlfcn.h,
3063 AC_DEFINE(HAVE_DLOPEN)))
3067 _SAVE_CFLAGS="$CFLAGS"
3068 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3069 AC_CHECK_FUNCS(dladdr)
3070 CFLAGS="$_SAVE_CFLAGS"
3072 if test ! "$GNU_CXX"; then
3076 AC_CHECK_LIB(C_r, demangle)
3079 AC_CHECK_LIB(C, demangle)
3084 dnl OS/2 has socket in libc.
3089 AC_CHECK_LIB(socket, socket)
3092 dnl ========================================================
3093 dnl = pthread support
3094 dnl = Start by checking whether the system support pthreads
3095 dnl ========================================================
3096 case "$target_os" in
3101 MOZ_CHECK_PTHREADS(pthreads,
3102 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3103 MOZ_CHECK_PTHREADS(pthread,
3104 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3105 MOZ_CHECK_PTHREADS(c_r,
3106 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3107 MOZ_CHECK_PTHREADS(c,
3116 dnl ========================================================
3117 dnl Check the command line for --with-pthreads
3118 dnl ========================================================
3119 MOZ_ARG_WITH_BOOL(pthreads,
3120 [ --with-pthreads Force use of system pthread library with NSPR ],
3121 [ if test "$USE_PTHREADS"x = x; then
3122 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3128 dnl ========================================================
3129 dnl Do the platform specific pthread hackery
3130 dnl ========================================================
3131 if test "$USE_PTHREADS"x != x
3134 dnl See if -pthread is supported.
3137 ac_cv_have_dash_pthread=no
3138 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3139 echo 'int main() { return 0; }' | cat > conftest.c
3140 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3141 if test $? -eq 0; then
3142 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3143 ac_cv_have_dash_pthread=yes
3144 case "$target_os" in
3146 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3149 CFLAGS="$CFLAGS -pthread"
3150 CXXFLAGS="$CXXFLAGS -pthread"
3156 AC_MSG_RESULT($ac_cv_have_dash_pthread)
3159 dnl See if -pthreads is supported.
3161 ac_cv_have_dash_pthreads=no
3162 if test "$ac_cv_have_dash_pthread" = "no"; then
3163 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3164 echo 'int main() { return 0; }' | cat > conftest.c
3165 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3166 if test $? -eq 0; then
3167 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3168 ac_cv_have_dash_pthreads=yes
3169 CFLAGS="$CFLAGS -pthreads"
3170 CXXFLAGS="$CXXFLAGS -pthreads"
3174 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3179 AC_DEFINE(_REENTRANT)
3180 AC_DEFINE(_THREAD_SAFE)
3181 dnl -pthread links in -lc_r, so don't specify it explicitly.
3182 if test "$ac_cv_have_dash_pthread" = "yes"; then
3183 _PTHREAD_LDFLAGS="-pthread"
3185 _PTHREAD_LDFLAGS="-lc_r"
3189 *-*-openbsd*|*-*-bsdi*)
3190 AC_DEFINE(_REENTRANT)
3191 AC_DEFINE(_THREAD_SAFE)
3192 dnl -pthread links in -lc_r, so don't specify it explicitly.
3193 if test "$ac_cv_have_dash_pthread" = "yes"; then
3194 _PTHREAD_LDFLAGS="-pthread"
3198 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3199 AC_DEFINE(_REENTRANT)
3203 AC_DEFINE(_REENTRANT)
3207 AC_DEFINE(_REENTRANT)
3211 AC_DEFINE(_REENTRANT)
3212 if test "$SOLARIS_SUNPRO_CC"; then
3213 CFLAGS="$CFLAGS -mt"
3214 CXXFLAGS="$CXXFLAGS -mt"
3218 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3222 dnl Checks for library functions.
3223 dnl ========================================================
3224 AC_PROG_GCC_TRADITIONAL
3226 AC_CHECK_FUNCS([fchmod flockfile getc_unlocked _getc_nolock getpagesize \
3227 lchown localtime_r lstat64 memmove random rint sbrk snprintf \
3228 stat64 statvfs statvfs64 strerror strtok_r truncate64])
3230 dnl Windows functions, for mingw.
3231 AC_TRY_LINK([#include <windows.h>],
3232 [SYSTEMTIME st;FILETIME ft;SystemTimeToFileTime(&st,&ft);],
3233 ac_cv_have_systemtimetofiletime="yes",
3234 ac_cv_have_systemtimetofiletime="no")
3235 if test "$ac_cv_have_systemtimetofiletime" = "yes"; then
3236 AC_DEFINE(HAVE_SYSTEMTIMETOFILETIME)
3238 AC_TRY_LINK([#include <windows.h>],
3239 [FILETIME ft;GetSystemTimeAsFileTime(&ft);],
3240 ac_cv_have_getsystemtimeasfiletime="yes",
3241 ac_cv_have_getsystemtimeasfiletime="no")
3242 if test "$ac_cv_have_getsystemtimeasfiletime" = "yes"; then
3243 AC_DEFINE(HAVE_GETSYSTEMTIMEASFILETIME)
3246 dnl check for wcrtomb/mbrtowc
3247 dnl =======================================================================
3248 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3251 AC_CACHE_CHECK(for wcrtomb,
3253 [AC_TRY_LINK([#include <wchar.h>],
3254 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3255 ac_cv_have_wcrtomb="yes",
3256 ac_cv_have_wcrtomb="no")])
3257 if test "$ac_cv_have_wcrtomb" = "yes"; then
3258 AC_DEFINE(HAVE_WCRTOMB)
3260 AC_CACHE_CHECK(for mbrtowc,
3262 [AC_TRY_LINK([#include <wchar.h>],
3263 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3264 ac_cv_have_mbrtowc="yes",
3265 ac_cv_have_mbrtowc="no")])
3266 if test "$ac_cv_have_mbrtowc" = "yes"; then
3267 AC_DEFINE(HAVE_MBRTOWC)
3274 ac_cv_func_res_ninit,
3277 #define _BSD_SOURCE 1
3281 [int foo = res_ninit(&_res);],
3282 [ac_cv_func_res_ninit=yes],
3283 [ac_cv_func_res_ninit=no])
3286 if test "$ac_cv_func_res_ninit" = "yes"; then
3287 AC_DEFINE(HAVE_RES_NINIT)
3288 dnl must add the link line we do something as foolish as this... dougt
3290 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3291 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3296 [for gnu_get_libc_version()],
3297 ac_cv_func_gnu_get_libc_version,
3299 #ifdef HAVE_GNU_LIBC_VERSION_H
3300 #include <gnu/libc-version.h>
3303 [const char *glibc_version = gnu_get_libc_version();],
3304 [ac_cv_func_gnu_get_libc_version=yes],
3305 [ac_cv_func_gnu_get_libc_version=no]
3309 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3310 AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3314 darwin*|mingw*|os2*)
3318 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3319 AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3320 AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3322 LIBS="$LIBS $_ICONV_LIBS"
3331 iconv_t h = iconv_open("", "");
3332 iconv(h, NULL, NULL, NULL, NULL);
3335 [ac_cv_func_iconv=yes],
3336 [ac_cv_func_iconv=no]
3339 if test "$ac_cv_func_iconv" = "yes"; then
3340 AC_DEFINE(HAVE_ICONV)
3341 DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3342 LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3343 LIBICONV="$_ICONV_LIBS"
3345 [for iconv() with const input],
3346 ac_cv_func_const_iconv,
3352 const char *input = "testing";
3353 iconv_t h = iconv_open("", "");
3354 iconv(h, &input, NULL, NULL, NULL);
3357 [ac_cv_func_const_iconv=yes],
3358 [ac_cv_func_const_iconv=no]
3361 if test "$ac_cv_func_const_iconv" = "yes"; then
3362 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3372 dnl **********************
3373 dnl *** va_copy checks ***
3374 dnl **********************
3375 dnl we currently check for all three va_copy possibilities, so we get
3376 dnl all results in config.log for bug reports.
3377 AC_MSG_CHECKING(for an implementation of va_copy())
3378 AC_CACHE_VAL(ac_cv_va_copy,[
3381 void f (int i, ...) {
3382 va_list args1, args2;
3383 va_start (args1, i);
3384 va_copy (args2, args1);
3385 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3387 va_end (args1); va_end (args2);
3389 int main() { f (0, 42); return 0; }],
3395 AC_MSG_RESULT($ac_cv_va_copy)
3396 AC_MSG_CHECKING(for an implementation of __va_copy())
3397 AC_CACHE_VAL(ac_cv___va_copy,[
3400 void f (int i, ...) {
3401 va_list args1, args2;
3402 va_start (args1, i);
3403 __va_copy (args2, args1);
3404 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3406 va_end (args1); va_end (args2);
3408 int main() { f (0, 42); return 0; }],
3409 ac_cv___va_copy=yes,
3414 AC_MSG_RESULT($ac_cv___va_copy)
3415 AC_MSG_CHECKING(whether va_lists can be copied by value)
3416 AC_CACHE_VAL(ac_cv_va_val_copy,[
3419 void f (int i, ...) {
3420 va_list args1, args2;
3421 va_start (args1, i);
3423 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3425 va_end (args1); va_end (args2);
3427 int main() { f (0, 42); return 0; }],
3428 ac_cv_va_val_copy=yes,
3429 ac_cv_va_val_copy=no,
3430 ac_cv_va_val_copy=yes
3433 if test "x$ac_cv_va_copy" = "xyes"; then
3434 AC_DEFINE(VA_COPY, va_copy)
3435 AC_DEFINE(HAVE_VA_COPY)
3436 elif test "x$ac_cv___va_copy" = "xyes"; then
3437 AC_DEFINE(VA_COPY, __va_copy)
3438 AC_DEFINE(HAVE_VA_COPY)
3441 if test "x$ac_cv_va_val_copy" = "xno"; then
3442 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3444 AC_MSG_RESULT($ac_cv_va_val_copy)
3446 dnl ===================================================================
3447 dnl ========================================================
3448 dnl Put your C++ language/feature checks below
3449 dnl ========================================================
3453 if test "$GNU_CC"; then
3454 if test "$CPU_ARCH" = "arm" ; then
3455 AC_CACHE_CHECK(for ARM EABI,
3459 #if defined(__ARM_EABI__)
3462 #error Not ARM EABI.
3465 ac_cv_gcc_arm_eabi="yes",
3466 ac_cv_gcc_arm_eabi="no")])
3467 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
3469 ARM_ABI_PREFIX=eabi-
3471 ARM_ABI_PREFIX=oabi-
3475 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
3478 dnl Check for support of modern template specialization syntax
3479 dnl Test code and requirement from scc@netscape.com.
3480 dnl Autoconf cut-and-paste job by waterson@netscape.com
3481 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3482 ac_cv_cpp_modern_specialize_template_syntax,
3483 [AC_TRY_COMPILE(template <class T> struct X { int a; };
3485 template <> struct X<Y> { double a; };,
3488 ac_cv_cpp_modern_specialize_template_syntax=yes,
3489 ac_cv_cpp_modern_specialize_template_syntax=no)])
3490 if test "$ac_cv_cpp_modern_specialize_template_syntax" = no ; then
3491 AC_MSG_ERROR([The C++ compiler does not support template specialization])
3494 dnl Some compilers support only full specialization, and some don't.
3495 AC_CACHE_CHECK(whether partial template specialization works,
3496 ac_cv_cpp_partial_specialization,
3497 [AC_TRY_COMPILE(template <class T> class Foo {};
3498 template <class T> class Foo<T*> {};,
3500 ac_cv_cpp_partial_specialization=yes,
3501 ac_cv_cpp_partial_specialization=no)])
3502 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3503 AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3506 dnl Check to see if we can resolve ambiguity with |using|.
3507 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3508 ac_cv_cpp_ambiguity_resolving_using,
3509 [AC_TRY_COMPILE(class X {
3510 public: int go(const X&) {return 3;}
3511 int jo(const X&) {return 3;}
3513 class Y : public X {
3514 public: int go(int) {return 2;}
3515 int jo(int) {return 2;}
3517 private: using X::go;
3520 ac_cv_cpp_ambiguity_resolving_using=yes,
3521 ac_cv_cpp_ambiguity_resolving_using=no)])
3522 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3523 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3526 dnl See if a dynamic_cast to void* gives the most derived object.
3527 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3528 ac_cv_cpp_dynamic_cast_void_ptr,
3529 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3530 class Y { int j; public: virtual ~Y() { } };
3531 class Z : public X, public Y { int k; };
3537 return !((((void*)&mdo != (void*)subx) &&
3538 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3539 (((void*)&mdo != (void*)suby) &&
3540 ((void*)&mdo == dynamic_cast<void*>(suby))));
3542 ac_cv_cpp_dynamic_cast_void_ptr=yes,
3543 ac_cv_cpp_dynamic_cast_void_ptr=no,
3544 ac_cv_cpp_dynamic_cast_void_ptr=no)])
3545 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3546 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3550 dnl note that this one is reversed - if the test fails, then
3551 dnl we require implementations of unused virtual methods. Which
3552 dnl really blows because it means we'll have useless vtable
3554 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
3555 ac_cv_cpp_unused_required,
3556 [AC_TRY_LINK(class X {private: virtual void never_called();};,
3558 ac_cv_cpp_unused_required=no,
3559 ac_cv_cpp_unused_required=yes)])
3560 if test "$ac_cv_cpp_unused_required" = yes ; then
3561 AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
3565 dnl Some compilers have trouble comparing a constant reference to a templatized
3566 dnl class to zero, and require an explicit operator==() to be defined that takes
3567 dnl an int. This test separates the strong from the weak.
3569 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
3570 ac_cv_trouble_comparing_to_zero,
3571 [AC_TRY_COMPILE([#include <algorithm>
3572 template <class T> class Foo {};
3574 template <class T> int operator==(const T2*, const T&) { return 0; }
3575 template <class T> int operator!=(const T2*, const T&) { return 0; }],
3576 [Foo<int> f; return (0 != f);],
3577 ac_cv_trouble_comparing_to_zero=no,
3578 ac_cv_trouble_comparing_to_zero=yes)])
3579 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
3580 AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
3583 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
3584 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
3585 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
3587 _SAVE_LDFLAGS=$LDFLAGS
3588 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
3589 AC_CACHE_CHECK(for __thread keyword for TLS variables,
3590 ac_cv_thread_keyword,
3591 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
3592 [return tlsIsMainThread;],
3593 ac_cv_thread_keyword=yes,
3594 ac_cv_thread_keyword=no)])
3595 LDFLAGS=$_SAVE_LDFLAGS
3596 if test "$ac_cv_thread_keyword" = yes; then
3597 # mips builds fail with TLS variables because of a binutils bug.
3603 *-android*|*-linuxandroid*)
3607 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
3612 dnl Check for the existence of various allocation headers/functions
3615 MOZ_CHECK_HEADER(malloc.h, [MALLOC_H=malloc.h])
3616 if test "$MALLOC_H" = ""; then
3617 MOZ_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
3618 if test "$MALLOC_H" = ""; then
3619 MOZ_CHECK_HEADER(sys/malloc.h, [MALLOC_H=sys/malloc.h])
3622 if test "$MALLOC_H" != ""; then
3623 AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
3626 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
3627 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
3629 dnl See if compiler supports some gcc-style attributes
3631 AC_CACHE_CHECK(for __attribute__((always_inline)),
3632 ac_cv_attribute_always_inline,
3633 [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
3635 ac_cv_attribute_always_inline=yes,
3636 ac_cv_attribute_always_inline=no)])
3638 AC_CACHE_CHECK(for __attribute__((malloc)),
3639 ac_cv_attribute_malloc,
3640 [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
3642 ac_cv_attribute_malloc=yes,
3643 ac_cv_attribute_malloc=no)])
3645 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
3646 ac_cv_attribute_warn_unused,
3647 [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
3649 ac_cv_attribute_warn_unused=yes,
3650 ac_cv_attribute_warn_unused=no)])
3652 dnl End of C++ language/feature checks
3655 dnl ========================================================
3656 dnl = Internationalization checks
3657 dnl ========================================================
3659 dnl Internationalization and Locale support is different
3660 dnl on various UNIX platforms. Checks for specific i18n
3661 dnl features go here.
3663 dnl check for LC_MESSAGES
3664 AC_CACHE_CHECK(for LC_MESSAGES,
3665 ac_cv_i18n_lc_messages,
3666 [AC_TRY_COMPILE([#include <locale.h>],
3667 [int category = LC_MESSAGES;],
3668 ac_cv_i18n_lc_messages=yes,
3669 ac_cv_i18n_lc_messages=no)])
3670 if test "$ac_cv_i18n_lc_messages" = yes; then
3671 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3674 AC_HAVE_FUNCS(localeconv)
3675 fi # ! SKIP_COMPILER_CHECKS
3678 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3679 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3682 dnl Mozilla specific options
3683 dnl ========================================================
3684 dnl The macros used for command line options
3685 dnl are defined in build/autoconf/altoptions.m4.
3687 dnl If the compiler supports these attributes, define them as
3688 dnl convenience macros.
3689 if test "$ac_cv_attribute_always_inline" = yes ; then
3690 AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
3692 AC_DEFINE(NS_ALWAYS_INLINE,)
3695 if test "$ac_cv_attribute_malloc" = yes ; then
3696 AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
3698 AC_DEFINE(NS_ATTR_MALLOC,)
3701 if test "$ac_cv_attribute_warn_unused" = yes ; then
3702 AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
3704 AC_DEFINE(NS_WARN_UNUSED_RESULT,)
3707 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
3708 dnl features that Windows actually does support.
3710 if test -n "$SKIP_COMPILER_CHECKS"; then
3711 dnl Windows has malloc.h
3712 AC_DEFINE(MALLOC_H, [<malloc.h>])
3713 AC_DEFINE(HAVE_FORCEINLINE)
3714 AC_DEFINE(HAVE_LOCALECONV)
3715 fi # SKIP_COMPILER_CHECKS
3717 dnl ========================================================
3719 dnl = Check for external package dependencies
3721 dnl ========================================================
3722 MOZ_ARG_HEADER(External Packages)
3724 dnl ========================================================
3725 dnl = Find the right NSPR to use.
3726 dnl ========================================================
3727 MOZ_ARG_WITH_BOOL(system-nspr,
3728 [ --with-system-nspr Use an NSPR that is already built and installed.
3729 Use the 'nspr-config' script in the current path,
3730 or look for the script in the directories given with
3731 --with-nspr-exec-prefix or --with-nspr-prefix.
3732 (Those flags are only checked if you specify
3733 --with-system-nspr.)],
3734 _USE_SYSTEM_NSPR=1 )
3736 MOZ_ARG_WITH_STRING(nspr-cflags,
3737 [ --with-nspr-cflags=FLAGS
3738 Pass FLAGS to CC when building code that uses NSPR.
3739 Use this when there's no accurate nspr-config
3740 script available. This is the case when building
3741 SpiderMonkey as part of the Mozilla tree: the
3742 top-level configure script computes NSPR flags
3743 that accomodate the quirks of that environment.],
3744 NSPR_CFLAGS=$withval)
3745 MOZ_ARG_WITH_STRING(nspr-libs,
3746 [ --with-nspr-libs=LIBS Pass LIBS to LD when linking code that uses NSPR.
3747 See --with-nspr-cflags for more details.],
3749 AC_SUBST(NSPR_CFLAGS)
3752 dnl Pass either --with-system-nspr or (--with-nspr-cflags and
3753 dnl --with-nspr-libs), but not both.
3754 if test "$_USE_SYSTEM_NSPR" && (test "$NSPR_CFLAGS" -o "$NSPR_LIBS"); then
3755 AC_MSG_ERROR([--with-system-nspr and --with-nspr-libs/cflags are mutually exclusive.
3756 See 'configure --help'.])
3759 dnl Top-level Mozilla switched to requiring NSPR 4.8.6 (bug 560582), but we don't need it in JS.
3760 if test -n "$_USE_SYSTEM_NSPR"; then
3762 AM_PATH_NSPR(4.7.0, [MOZ_NATIVE_NSPR=1], [AC_MSG_ERROR([your don't have NSPR installed or your version is too old])])
3765 if test -n "$MOZ_NATIVE_NSPR"; then
3766 _SAVE_CFLAGS=$CFLAGS
3767 CFLAGS="$CFLAGS $NSPR_CFLAGS"
3768 AC_TRY_COMPILE([#include "prlog.h"],
3769 [#ifndef PR_STATIC_ASSERT
3770 #error PR_STATIC_ASSERT not defined
3772 [MOZ_NATIVE_NSPR=1],
3773 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
3774 CFLAGS=$_SAVE_CFLAGS
3777 dnl ========================================================
3778 dnl system libffi Support
3779 dnl ========================================================
3780 MOZ_ARG_ENABLE_BOOL(system-ffi,
3781 [ --enable-system-ffi Use system libffi (located with pkgconfig)],
3784 if test -n "$MOZ_NATIVE_FFI"; then
3785 # Vanilla libffi 3.0.9 needs a few patches from upcoming version 3.0.10
3786 # for non-GCC compilers.
3787 if test -z "$GNU_CC"; then
3788 PKG_CHECK_MODULES(MOZ_FFI, libffi > 3.0.9)
3790 PKG_CHECK_MODULES(MOZ_FFI, libffi >= 3.0.9)
3794 AC_SUBST(MOZ_NATIVE_FFI)
3796 dnl ========================================================
3800 dnl ========================================================
3802 MOZ_ARG_HEADER(Application)
3809 arm*-android*|arm*-linuxandroid*)
3814 dnl ========================================================
3815 dnl Use ARM userspace kernel helpers; tell NSPR to enable
3816 dnl their usage and use them in spidermonkey.
3817 dnl ========================================================
3818 MOZ_ARG_WITH_BOOL(arm-kuser,
3819 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
3821 if test -n "$USE_ARM_KUSER"; then
3822 AC_DEFINE(USE_ARM_KUSER)
3825 dnl ========================================================
3827 dnl = Components & Features
3829 dnl ========================================================
3830 MOZ_ARG_HEADER(Components and Features)
3832 dnl ========================================================
3834 dnl ========================================================
3835 MOZ_ARG_ENABLE_STRING(ui-locale,
3836 [ --enable-ui-locale=ab-CD
3837 Select the user interface locale (default: en-US)],
3838 MOZ_UI_LOCALE=$enableval )
3839 AC_SUBST(MOZ_UI_LOCALE)
3841 dnl ========================================================
3842 dnl build the tests by default
3843 dnl ========================================================
3844 MOZ_ARG_DISABLE_BOOL(tests,
3845 [ --disable-tests Do not build test libraries & programs],
3849 dnl ========================================================
3851 dnl = Module specific options
3853 dnl ========================================================
3854 MOZ_ARG_HEADER(Individual module options)
3856 dnl ========================================================
3858 dnl = Debugging Options
3860 dnl ========================================================
3861 MOZ_ARG_HEADER(Debugging and Optimizations)
3863 dnl ========================================================
3864 dnl = Disable building with debug info.
3865 dnl = Debugging is OFF by default
3866 dnl ========================================================
3867 if test -z "$MOZ_DEBUG_FLAGS"; then
3868 MOZ_DEBUG_FLAGS="-g"
3871 MOZ_ARG_ENABLE_STRING(debug,
3872 [ --enable-debug[=DBG] Enable building with developer debug info
3873 (using compiler flags DBG)],
3874 [ if test "$enableval" != "no"; then
3876 if test -n "$enableval" -a "$enableval" != "yes"; then
3877 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
3878 _MOZ_DEBUG_FLAGS_SET=1
3885 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
3886 MOZ_ARG_WITH_STRING(debug-label,
3887 [ --with-debug-label=LABELS
3888 Define DEBUG_<value> for each comma-separated
3890 [ for option in `echo $withval | sed 's/,/ /g'`; do
3891 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
3894 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
3896 if test -n "$MOZ_DEBUG"; then
3897 AC_MSG_CHECKING([for valid debug flags])
3898 _SAVE_CFLAGS=$CFLAGS
3899 CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
3900 AC_TRY_COMPILE([#include <stdio.h>],
3901 [printf("Hello World\n");],
3904 AC_MSG_RESULT([$_results])
3905 if test "$_results" = "no"; then
3906 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
3908 CFLAGS=$_SAVE_CFLAGS
3911 dnl ========================================================
3912 dnl = Enable code optimization. ON by default.
3913 dnl ========================================================
3914 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
3915 MOZ_OPTIMIZE_FLAGS="-O"
3918 MOZ_ARG_ENABLE_STRING(optimize,
3919 [ --disable-optimize Disable compiler optimization
3920 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
3921 [ if test "$enableval" != "no"; then
3923 if test -n "$enableval" -a "$enableval" != "yes"; then
3924 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
3929 fi ], MOZ_OPTIMIZE=1)
3931 MOZ_SET_FRAMEPTR_FLAGS
3933 if test "$COMPILE_ENVIRONMENT"; then
3934 if test -n "$MOZ_OPTIMIZE"; then
3935 AC_MSG_CHECKING([for valid optimization flags])
3936 _SAVE_CFLAGS=$CFLAGS
3937 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
3938 AC_TRY_COMPILE([#include <stdio.h>],
3939 [printf("Hello World\n");],
3942 AC_MSG_RESULT([$_results])
3943 if test "$_results" = "no"; then
3944 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
3946 CFLAGS=$_SAVE_CFLAGS
3948 fi # COMPILE_ENVIRONMENT
3950 AC_SUBST(MOZ_OPTIMIZE)
3951 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
3952 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
3953 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
3954 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
3955 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
3957 dnl ========================================================
3958 dnl = Enable generation of debug symbols
3959 dnl ========================================================
3960 MOZ_ARG_ENABLE_STRING(debug-symbols,
3961 [ --enable-debug-symbols[=DBG]
3962 Enable debugging symbols (using compiler flags DBG)],
3963 [ if test "$enableval" != "no"; then
3965 if test -n "$enableval" -a "$enableval" != "yes"; then
3966 if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
3967 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
3969 AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
3975 MOZ_DEBUG_SYMBOLS=1)
3977 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
3978 AC_DEFINE(MOZ_DEBUG_SYMBOLS)
3979 export MOZ_DEBUG_SYMBOLS
3982 dnl ========================================================
3983 dnl = Enable any treating of compile warnings as errors
3984 dnl ========================================================
3985 MOZ_ARG_DISABLE_BOOL(warnings-as-errors,
3986 [ --enable-warnings-as-errors
3987 Enable treating of warnings as errors],
3988 MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
3989 MOZ_ENABLE_WARNINGS_AS_ERRORS=)
3990 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
3991 WARNINGS_AS_ERRORS=''
3994 dnl ========================================================
3995 dnl = Enable treating compile warnings as errors
3996 dnl ========================================================
3997 MOZ_ARG_ENABLE_BOOL(sm-fail-on-warnings,
3998 [ --enable-sm-fail-on-warnings
3999 Enable warnings as errors],
4003 AC_SUBST(FAIL_ON_WARNINGS)
4005 dnl = Enable trace malloc
4006 dnl ========================================================
4007 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
4008 MOZ_ARG_ENABLE_BOOL(trace-malloc,
4009 [ --enable-trace-malloc Enable malloc tracing],
4012 if test "$NS_TRACE_MALLOC"; then
4013 # Please, Mr. Linker Man, don't take away our symbol names
4014 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
4015 AC_DEFINE(NS_TRACE_MALLOC)
4017 AC_SUBST(NS_TRACE_MALLOC)
4019 dnl ========================================================
4020 dnl = Enable jemalloc
4021 dnl ========================================================
4022 MOZ_ARG_ENABLE_BOOL(jemalloc,
4023 [ --enable-jemalloc Replace memory allocator with jemalloc],
4027 if test "$NS_TRACE_MALLOC"; then
4031 if test "$MOZ_MEMORY"; then
4033 dnl Don't try to run compiler tests on Windows
4034 if test "$OS_ARCH" = "WINNT"; then
4035 if test -z "$HAVE_64BIT_OS"; then
4036 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
4038 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
4041 AC_CHECK_SIZEOF([int *], [4])
4042 case "${ac_cv_sizeof_int_p}" in
4044 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
4047 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
4050 AC_MSG_ERROR([Unexpected pointer size])
4055 AC_DEFINE(MOZ_MEMORY)
4056 if test "x$MOZ_DEBUG" = "x1"; then
4057 AC_DEFINE(MOZ_MEMORY_DEBUG)
4059 dnl The generic feature tests that determine how to compute ncpus are long and
4060 dnl complicated. Therefore, simply define special cpp variables for the
4061 dnl platforms we have special knowledge of.
4064 AC_DEFINE(MOZ_MEMORY_DARWIN)
4067 AC_DEFINE(MOZ_MEMORY_BSD)
4069 *-android*|*-linuxandroid*)
4070 AC_DEFINE(MOZ_MEMORY_LINUX)
4071 AC_DEFINE(MOZ_MEMORY_ANDROID)
4074 AC_DEFINE(MOZ_MEMORY_LINUX)
4077 AC_DEFINE(MOZ_MEMORY_BSD)
4080 AC_DEFINE(MOZ_MEMORY_SOLARIS)
4083 AC_DEFINE(MOZ_MEMORY_WINDOWS)
4084 # the interesting bits will get passed down in MOZ_GLUE_LDFLAGS
4087 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
4091 AC_SUBST(MOZ_MEMORY)
4092 AC_SUBST(MOZ_GLUE_LDFLAGS)
4093 AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
4095 dnl ========================================================
4096 dnl = Use malloc wrapper lib
4097 dnl ========================================================
4098 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
4099 [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)],
4103 if test -n "$_WRAP_MALLOC"; then
4104 if test "$GNU_CC"; then
4105 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
4106 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
4107 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
4108 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
4110 AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
4114 dnl ========================================================
4115 dnl = Location of malloc wrapper lib
4116 dnl ========================================================
4117 MOZ_ARG_WITH_STRING(wrap-malloc,
4118 [ --with-wrap-malloc=DIR Location of malloc wrapper library],
4119 WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
4121 dnl ========================================================
4122 dnl = Use JS Call tracing
4123 dnl ========================================================
4124 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
4125 [ --enable-trace-jscalls Enable JS call enter/exit callback (default=no)],
4126 MOZ_TRACE_JSCALLS=1,
4127 MOZ_TRACE_JSCALLS= )
4128 if test -n "$MOZ_TRACE_JSCALLS"; then
4129 AC_DEFINE(MOZ_TRACE_JSCALLS)
4132 dnl ========================================================
4133 dnl = Use incremental GC
4134 dnl ========================================================
4136 MOZ_ARG_DISABLE_BOOL(gcincremental,
4137 [ --disable-gcincremental Disable incremental GC],
4139 if test -n "$JSGC_INCREMENTAL"; then
4140 AC_DEFINE(JSGC_INCREMENTAL)
4143 dnl ========================================================
4144 dnl = Use generational GC
4145 dnl ========================================================
4146 MOZ_ARG_ENABLE_BOOL(gcgenerational,
4147 [ --enable-gcgenerational Enable generational GC],
4148 JSGC_GENERATIONAL=1,
4149 JSGC_GENERATIONAL= )
4150 if test -n "$JSGC_GENERATIONAL"; then
4151 AC_DEFINE(JSGC_GENERATIONAL)
4154 dnl ========================================================
4155 dnl = Perform moving GC stack rooting analysis
4156 dnl ========================================================
4157 MOZ_ARG_ENABLE_BOOL(root-analysis,
4158 [ --enable-root-analysis Enable moving GC stack root analysis],
4159 JSGC_ROOT_ANALYSIS=1,
4160 JSGC_ROOT_ANALYSIS= )
4161 if test -n "$JSGC_ROOT_ANALYSIS"; then
4162 AC_DEFINE(JSGC_ROOT_ANALYSIS)
4165 dnl ========================================================
4167 dnl ========================================================
4168 MOZ_ARG_ENABLE_BOOL(valgrind,
4169 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
4172 if test -n "$MOZ_VALGRIND"; then
4173 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
4175 [--enable-valgrind specified but Valgrind is not installed]))
4176 AC_DEFINE(MOZ_VALGRIND)
4179 AC_SUBST(MOZ_VALGRIND)
4181 dnl ========================================================
4183 dnl ========================================================
4184 MOZ_ARG_ENABLE_BOOL(jprof,
4185 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
4188 if test -n "$MOZ_JPROF"; then
4190 AC_DEFINE(MOZ_JPROF)
4193 dnl ========================================================
4195 dnl ========================================================
4196 MOZ_ARG_ENABLE_BOOL(shark,
4197 [ --enable-shark Enable shark remote profiling. Implies --enable-profiling.],
4200 if test -n "$MOZ_SHARK"; then
4202 AC_DEFINE(MOZ_SHARK)
4205 dnl ========================================================
4207 dnl ========================================================
4208 MOZ_ARG_ENABLE_BOOL(callgrind,
4209 [ --enable-callgrind Enable callgrind profiling. Implies --enable-profiling.],
4212 if test -n "$MOZ_CALLGRIND"; then
4214 AC_DEFINE(MOZ_CALLGRIND)
4217 dnl ========================================================
4219 dnl ========================================================
4220 MOZ_ARG_ENABLE_BOOL(vtune,
4221 [ --enable-vtune Enable vtune profiling. Implies --enable-profiling.],
4224 if test -n "$MOZ_VTUNE"; then
4226 AC_DEFINE(MOZ_VTUNE)
4229 dnl ========================================================
4230 dnl ETW - Event Tracing for Windows
4231 dnl ========================================================
4232 MOZ_ARG_ENABLE_BOOL(ETW,
4233 [ --enable-ETW Enable ETW (Event Tracing for Windows) event reporting],
4236 if test -n "$MOZ_ETW"; then
4241 if test -n "$MOZ_ETW"; then
4242 if test -z "$MOZ_WINSDK_TARGETVER"; then
4243 AC_MSG_ERROR([--enable-ETW is only valid on Windows])
4247 dnl ========================================================
4249 dnl ========================================================
4250 if test -n "$MOZ_PROFILING"; then
4251 AC_DEFINE(MOZ_PROFILING)
4254 dnl ========================================================
4255 dnl Zealous JavaScript GC
4256 dnl ========================================================
4257 MOZ_ARG_ENABLE_BOOL(gczeal,
4258 [ --enable-gczeal Enable zealous GCing],
4261 if test -n "$JS_GC_ZEAL"; then
4262 AC_DEFINE(JS_GC_ZEAL)
4265 dnl ========================================================
4266 dnl JS opt-mode assertions and minidump instrumentation
4267 dnl ========================================================
4268 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
4269 [ --enable-js-diagnostics
4270 Enable JS diagnostic assertions and breakpad data],
4271 JS_CRASH_DIAGNOSTICS=1,
4272 JS_CRASH_DIAGNOSTICS= )
4273 if test -n "$JS_CRASH_DIAGNOSTICS"; then
4274 AC_DEFINE(JS_CRASH_DIAGNOSTICS)
4277 dnl ========================================================
4278 dnl Enable changes that make the shell more deterministic
4279 dnl ========================================================
4280 MOZ_ARG_ENABLE_BOOL(more-deterministic,
4281 [ --enable-more-deterministic
4282 Enable changes that make the shell more deterministic],
4283 JS_MORE_DETERMINISTIC=1,
4284 JS_MORE_DETERMINISTIC= )
4285 if test -n "$JS_MORE_DETERMINISTIC"; then
4286 AC_DEFINE(JS_MORE_DETERMINISTIC)
4289 dnl ========================================================
4290 dnl Enable output of backtraces on artificial OOMs
4291 dnl ========================================================
4292 MOZ_ARG_ENABLE_BOOL(oom-backtrace,
4293 [ --enable-oom-backtrace
4294 Enable output of backtraces on artificial OOMs (-A)],
4295 JS_OOM_DO_BACKTRACES=1,
4296 JS_OOM_DO_BACKTRACES= )
4297 if test -n "$JS_OOM_DO_BACKTRACES"; then
4298 AC_DEFINE(JS_OOM_DO_BACKTRACES)
4301 dnl ======================================================
4302 dnl = Enable compiling with ccache
4303 dnl ======================================================
4304 MOZ_ARG_WITH_STRING(ccache,
4305 [ --with-ccache[=path/to/ccache]
4306 Enable compiling with ccache],
4307 CCACHE=$withval, CCACHE="no")
4309 if test "$CCACHE" != "no"; then
4310 if test -z "$CCACHE" -o "$CCACHE" = "yes"; then
4313 if test ! -e "$CCACHE"; then
4314 AC_MSG_ERROR([$CCACHE not found])
4317 MOZ_PATH_PROGS(CCACHE, $CCACHE ccache)
4318 if test -z "$CCACHE" -o "$CCACHE" = ":"; then
4319 AC_MSG_ERROR([ccache not found])
4320 elif test -x "$CCACHE"; then
4324 AC_MSG_ERROR([$CCACHE is not executable])
4328 dnl ========================================================
4329 dnl = Enable static checking using gcc-dehydra
4330 dnl ========================================================
4332 MOZ_ARG_WITH_STRING(static-checking,
4333 [ --with-static-checking=path/to/gcc_dehydra.so
4334 Enable static checking of code using GCC-dehydra],
4335 DEHYDRA_PATH=$withval,
4338 if test -n "$DEHYDRA_PATH"; then
4339 if test ! -f "$DEHYDRA_PATH"; then
4340 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
4342 AC_DEFINE(NS_STATIC_CHECKING)
4344 AC_SUBST(DEHYDRA_PATH)
4346 dnl ========================================================
4347 dnl = Enable stripping of libs & executables
4348 dnl ========================================================
4349 MOZ_ARG_ENABLE_BOOL(strip,
4350 [ --enable-strip Enable stripping of libs & executables ],
4354 dnl ========================================================
4355 dnl = Enable stripping of libs & executables when packaging
4356 dnl ========================================================
4357 MOZ_ARG_ENABLE_BOOL(install-strip,
4358 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
4362 dnl ========================================================
4364 dnl = Profiling and Instrumenting
4366 dnl ========================================================
4367 MOZ_ARG_HEADER(Profiling and Instrumenting)
4369 dnl ========================================================
4370 dnl = Support for demangling undefined symbols
4371 dnl ========================================================
4372 if test -z "$SKIP_LIBRARY_CHECKS"; then
4375 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
4379 # Demangle only for debug or trace-malloc builds
4380 MOZ_DEMANGLE_SYMBOLS=
4381 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
4382 MOZ_DEMANGLE_SYMBOLS=1
4383 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
4385 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
4387 dnl ========================================================
4388 dnl = Support for gcc stack unwinding (from gcc 3.3)
4389 dnl ========================================================
4390 if test -z "$SKIP_LIBRARY_CHECKS"; then
4391 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
4394 dnl ========================================================
4396 dnl ========================================================
4398 MOZ_ARG_WITH_STRING(jitreport-granularity,
4399 [ --jitreport-granularity=N
4400 Default granularity at which to report JIT code
4403 1 - code ranges for whole functions only
4404 2 - per-line information
4405 3 - per-op information],
4406 JITREPORT_GRANULARITY=$withval,
4407 JITREPORT_GRANULARITY=3)
4409 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
4411 dnl ========================================================
4415 dnl ========================================================
4416 MOZ_ARG_HEADER(Misc. Options)
4418 dnl ========================================================
4419 dnl update xterm title
4420 dnl ========================================================
4421 MOZ_ARG_ENABLE_BOOL(xterm-updates,
4422 [ --enable-xterm-updates Update XTERM titles with current command.],
4426 if test -z "$SKIP_COMPILER_CHECKS"; then
4427 dnl ========================================================
4429 dnl = Compiler Options
4431 dnl ========================================================
4432 MOZ_ARG_HEADER(Compiler Options)
4434 dnl ========================================================
4435 dnl Check for gcc -pipe support
4436 dnl ========================================================
4437 AC_MSG_CHECKING([for -pipe support])
4438 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
4439 dnl Any gcc that supports firefox supports -pipe.
4440 CFLAGS="$CFLAGS -pipe"
4441 CXXFLAGS="$CXXFLAGS -pipe"
4442 AC_MSG_RESULT([yes])
4447 dnl ========================================================
4448 dnl Profile guided optimization (gcc checks)
4449 dnl ========================================================
4450 dnl Test for profiling options
4451 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
4453 _SAVE_CFLAGS="$CFLAGS"
4454 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
4456 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
4457 AC_TRY_COMPILE([], [return 0;],
4458 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
4459 result="yes" ], result="no")
4460 AC_MSG_RESULT([$result])
4462 if test $result = "yes"; then
4463 PROFILE_GEN_LDFLAGS="-fprofile-generate"
4464 PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
4465 PROFILE_USE_LDFLAGS="-fprofile-use"
4468 CFLAGS="$_SAVE_CFLAGS"
4470 if test -n "$INTEL_CC"; then
4471 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
4472 PROFILE_GEN_LDFLAGS=
4473 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
4474 PROFILE_USE_LDFLAGS=
4477 dnl Sun Studio on Solaris
4478 if test "$SOLARIS_SUNPRO_CC"; then
4479 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
4480 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
4481 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
4482 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
4485 AC_SUBST(PROFILE_GEN_CFLAGS)
4486 AC_SUBST(PROFILE_GEN_LDFLAGS)
4487 AC_SUBST(PROFILE_USE_CFLAGS)
4488 AC_SUBST(PROFILE_USE_LDFLAGS)
4492 dnl ========================================================
4493 dnl Test for -pedantic bustage
4494 dnl ========================================================
4495 MOZ_ARG_DISABLE_BOOL(pedantic,
4496 [ --disable-pedantic Issue all warnings demanded by strict ANSI C ],
4498 if test "$_PEDANTIC"; then
4499 _SAVE_CXXFLAGS=$CXXFLAGS
4500 CXXFLAGS="$CXXFLAGS -pedantic ${_WARNINGS_CXXFLAGS} -Wno-long-long"
4501 AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
4502 AC_TRY_COMPILE([$configure_static_assert_macros],
4503 [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
4504 result="no", result="yes" )
4505 AC_MSG_RESULT([$result])
4506 CXXFLAGS="$_SAVE_CXXFLAGS"
4510 _WARNINGS_CFLAGS="-pedantic ${_WARNINGS_CFLAGS} -Wno-long-long"
4511 _WARNINGS_CXXFLAGS="-pedantic ${_WARNINGS_CXXFLAGS} -Wno-long-long"
4514 AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic. Reconfigure using --disable-pedantic. ])
4519 dnl ========================================================
4520 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
4521 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
4522 dnl raw pointers in nsCOMPtr.h. (VC++ has the same bug.)
4523 dnl ========================================================
4524 _SAVE_CXXFLAGS=$CXXFLAGS
4525 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
4526 AC_CACHE_CHECK(for correct overload resolution with const and templates,
4527 ac_nscap_nonconst_opeq_bug,
4536 template <class T, class U>
4537 int operator==(const Pointer<T>& rhs, U* lhs)
4539 return rhs.myPtr == lhs;
4542 template <class T, class U>
4543 int operator==(const Pointer<T>& rhs, const U* lhs)
4545 return rhs.myPtr == lhs;
4553 ac_nscap_nonconst_opeq_bug="no",
4554 ac_nscap_nonconst_opeq_bug="yes")])
4555 CXXFLAGS="$_SAVE_CXXFLAGS"
4557 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
4558 AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
4561 dnl ========================================================
4562 dnl Check for tm_zone, tm_gmtoff in struct tm
4563 dnl ========================================================
4564 AC_CACHE_CHECK(for tm_zone tm_gmtoff in struct tm,
4565 ac_cv_struct_tm_zone_tm_gmtoff,
4566 [AC_TRY_COMPILE([#include <time.h>],
4567 [struct tm tm; tm.tm_zone = 0; tm.tm_gmtoff = 1;],
4568 [ac_cv_struct_tm_zone_tm_gmtoff="yes"],
4569 [ac_cv_struct_tm_zone_tm_gmtoff="no"])])
4570 if test "$ac_cv_struct_tm_zone_tm_gmtoff" = "yes" ; then
4571 AC_DEFINE(HAVE_TM_ZONE_TM_GMTOFF)
4573 fi # ! SKIP_COMPILER_CHECKS
4575 dnl ========================================================
4577 dnl Should be smarter and check that the compiler does indeed have rtti
4578 dnl ========================================================
4579 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
4580 [ --enable-cpp-rtti Enable C++ RTTI ],
4581 [ _MOZ_USE_RTTI=1 ],
4584 if test "$_MOZ_USE_RTTI"; then
4585 _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
4587 _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
4590 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
4592 AC_DEFINE(CPP_THROW_NEW, [throw()])
4597 dnl ========================================================
4599 dnl = Build depencency options
4601 dnl ========================================================
4602 MOZ_ARG_HEADER(Build dependencies)
4604 dnl ========================================================
4605 dnl = Do not auto generate dependency info
4606 dnl ========================================================
4608 MOZ_ARG_DISABLE_BOOL(auto-deps,
4609 [ --disable-auto-deps Do not automatically generate dependency info],
4613 if test -n "$MOZ_AUTO_DEPS"; then
4614 dnl ========================================================
4615 dnl = Use mkdepend instead of $CC -MD for dependency generation
4616 dnl ========================================================
4618 MOZ_ARG_DISABLE_BOOL(md,
4619 [ --disable-md Do not use compiler-based dependencies ],
4622 [dnl Default is to turn on -MD if using GNU-compatible compilers
4623 if test "$GNU_CC" -a "$GNU_CXX"; then
4626 dnl Default is to use -xM if using Sun Studio on Solaris
4627 if test "$SOLARIS_SUNPRO_CC"; then
4630 if test "$_cpp_md_flag"; then
4632 _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(basename $(@F)).pp)'
4633 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
4634 if test "$SOLARIS_SUNPRO_CC"; then
4639 dnl Don't override this for MSVC
4640 if test -z "$_WIN32_MSVC"; then
4641 _USE_CPP_INCLUDE_FLAG=
4642 _DEFINES_CFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
4643 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
4645 echo '#include <stdio.h>' > dummy-hello.c
4647 CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
4649 if test -z "$CL_INCLUDES_PREFIX"; then
4650 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
4652 AC_SUBST(CL_INCLUDES_PREFIX)
4654 _topsrcdirwin=`cd \`dirname $0\`; pwd -W`
4655 dnl cl.py provides dependency generation for MSVC
4656 CC_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"
4657 CXX_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"
4663 AC_SUBST(MOZ_AUTO_DEPS)
4664 AC_SUBST(COMPILER_DEPEND)
4666 AC_SUBST(CC_WRAPPER)
4667 AC_SUBST(CXX_WRAPPER)
4670 dnl ========================================================
4671 dnl = Link js shell to system readline
4672 dnl ========================================================
4673 MOZ_ARG_ENABLE_BOOL(readline,
4674 [ --enable-readline Link js shell to system readline library],
4690 if test -z "$SKIP_LIBRARY_CHECKS" -a -z "$NO_EDITLINE"; then
4691 if test -n "$JS_WANT_READLINE"; then
4692 AC_CHECK_LIB(readline, readline,
4693 EDITLINE_LIBS="-lreadline",
4694 AC_MSG_ERROR([No system readline library found.]))
4696 dnl By default, we use editline
4697 JS_NATIVE_EDITLINE=1
4698 EDITLINE_LIBS='$(DEPTH)/editline/$(LIB_PREFIX)editline.$(LIB_SUFFIX)'
4701 dnl Either way, we want to build with line editing support.
4704 AC_SUBST(JS_NATIVE_EDITLINE)
4705 AC_SUBST(JS_DISABLE_SHELL)
4706 AC_SUBST(EDITLINE_LIBS)
4708 dnl ========================================================
4710 dnl = Standalone module options
4712 dnl ========================================================
4713 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
4715 dnl ========================================================
4716 dnl = Build jsctypes if it's enabled
4717 dnl ========================================================
4718 MOZ_ARG_ENABLE_BOOL(ctypes,
4719 [ --enable-ctypes Enable js-ctypes (default=no)],
4722 AC_SUBST(JS_HAS_CTYPES)
4723 if test "$JS_HAS_CTYPES"; then
4724 dnl Error out if we're on MSVC and MASM is unavailable.
4725 if test -n "$_MSC_VER" -a \( "$AS" != "ml.exe" -a "$AS" != "ml64.exe" \); then
4726 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.])
4728 AC_DEFINE(JS_HAS_CTYPES)
4731 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
4732 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
4735 MOZ_ARG_WITH_STRING(sync-build-files,
4736 [ --with-sync-build-files=DIR
4737 Check that files in 'config' and 'build' match
4738 their originals in 'DIR/config' and 'DIR/build'.
4739 This helps keep the SpiderMonkey build machinery
4740 in sync with Mozilla's, on which it is based.],
4741 [MOZ_SYNC_BUILD_FILES=$withval ] )
4742 AC_SUBST(MOZ_SYNC_BUILD_FILES)
4744 dnl ========================================================
4746 dnl = Maintainer debug option (no --enable equivalent)
4748 dnl ========================================================
4753 AC_SUBST(AR_EXTRACT)
4757 AC_SUBST(AS_DASH_C_FLAG)
4766 AC_SUBST(MOZ_JS_LIBS)
4769 AC_SUBST(MOZ_DEBUG_SYMBOLS)
4770 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
4771 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
4772 AC_SUBST(MOZ_DEBUG_FLAGS)
4773 AC_SUBST(MOZ_DEBUG_LDFLAGS)
4774 AC_SUBST(WARNINGS_AS_ERRORS)
4777 AC_SUBST(MOZ_CALLGRIND)
4780 AC_SUBST(MOZ_PROFILING)
4781 AC_SUBST(MOZ_QUANTIFY)
4784 AC_SUBST(ENABLE_TESTS)
4786 AC_SUBST(ENABLE_STRIP)
4787 AC_SUBST(PKG_SKIP_STRIP)
4788 AC_SUBST(INCREMENTAL_LINKER)
4789 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
4790 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
4792 AC_SUBST(MOZ_FIX_LINK_PATHS)
4794 AC_SUBST(USE_DEPENDENT_LIBS)
4796 AC_SUBST(MOZ_BUILD_ROOT)
4797 AC_SUBST(MOZ_OS2_TOOLS)
4799 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
4800 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
4802 AC_SUBST(MOZ_APP_NAME)
4803 AC_SUBST(MOZ_APP_DISPLAYNAME)
4804 AC_SUBST(MOZ_APP_UA_NAME)
4805 AC_SUBST(MOZ_APP_VERSION)
4806 AC_SUBST(FIREFOX_VERSION)
4808 AC_SUBST(MOZ_PKG_SPECIAL)
4810 AC_SUBST(MOZILLA_OFFICIAL)
4813 AC_SUBST(MOZ_MAPINFO)
4814 AC_SUBST(MOZ_BROWSE_INFO)
4815 AC_SUBST(MOZ_TOOLS_DIR)
4818 dnl Echo the CFLAGS to remove extra whitespace.
4825 $_WARNINGS_CXXFLAGS \
4828 COMPILE_CFLAGS=`echo \
4833 COMPILE_CXXFLAGS=`echo \
4834 $_DEFINES_CXXFLAGS \
4838 AC_SUBST(SYSTEM_MAKEDEPEND)
4840 AC_SUBST(NSPR_CFLAGS)
4842 AC_SUBST(MOZ_NATIVE_NSPR)
4847 AC_SUBST(COMPILE_CFLAGS)
4848 AC_SUBST(COMPILE_CXXFLAGS)
4851 AC_SUBST(CROSS_COMPILE)
4856 AC_SUBST(HOST_CFLAGS)
4857 AC_SUBST(HOST_CXXFLAGS)
4858 AC_SUBST(HOST_LDFLAGS)
4859 AC_SUBST(HOST_OPTIMIZE_FLAGS)
4861 AC_SUBST(HOST_AR_FLAGS)
4863 AC_SUBST(HOST_RANLIB)
4864 AC_SUBST(HOST_NSPR_MDCPUCFG)
4865 AC_SUBST(HOST_BIN_SUFFIX)
4866 AC_SUBST(HOST_OS_ARCH)
4868 AC_SUBST(TARGET_CPU)
4869 AC_SUBST(TARGET_VENDOR)
4871 AC_SUBST(TARGET_NSPR_MDCPUCFG)
4872 AC_SUBST(TARGET_MD_ARCH)
4873 AC_SUBST(TARGET_XPCOM_ABI)
4876 AC_SUBST(OS_RELEASE)
4879 AC_SUBST(INTEL_ARCHITECTURE)
4881 AC_SUBST(WRAP_LDFLAGS)
4884 AC_SUBST(MKSHLIB_FORCE_ALL)
4885 AC_SUBST(MKSHLIB_UNFORCE_ALL)
4886 AC_SUBST(DSO_CFLAGS)
4887 AC_SUBST(DSO_PIC_CFLAGS)
4888 AC_SUBST(DSO_LDOPTS)
4889 AC_SUBST(LIB_PREFIX)
4890 AC_SUBST(DLL_PREFIX)
4891 AC_SUBST(DLL_SUFFIX)
4892 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
4893 AC_SUBST(LIB_SUFFIX)
4894 AC_SUBST(OBJ_SUFFIX)
4895 AC_SUBST(BIN_SUFFIX)
4896 AC_SUBST(ASM_SUFFIX)
4897 AC_SUBST(IMPORT_LIB_SUFFIX)
4899 AC_SUBST(CC_VERSION)
4900 AC_SUBST(CXX_VERSION)
4901 AC_SUBST(MSMANIFEST_TOOL)
4903 AC_MSG_CHECKING([for posix_fallocate])
4904 AC_TRY_LINK([#define _XOPEN_SOURCE 600
4905 #include <fcntl.h>],
4906 [posix_fallocate(0, 0, 0);],
4907 [ac_cv___posix_fallocate=true],
4908 [ac_cv___posix_fallocate=false])
4910 if test "$ac_cv___posix_fallocate" = true ; then
4911 AC_DEFINE(HAVE_POSIX_FALLOCATE)
4917 dnl Check for missing components
4918 if test "$COMPILE_ENVIRONMENT"; then
4919 if test "$MOZ_X11"; then
4920 dnl ====================================================
4921 dnl = Check if X headers exist
4922 dnl ====================================================
4923 _SAVE_CFLAGS=$CFLAGS
4924 CFLAGS="$CFLAGS $XCFLAGS"
4928 #include <X11/Xlib.h>
4929 #include <X11/Intrinsic.h>
4933 if ((dpy = XOpenDisplay(NULL)) == NULL) {
4934 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
4938 [ AC_MSG_ERROR([Could not compile basic X program.]) ])
4939 CFLAGS="$_SAVE_CFLAGS"
4941 if test -n "$MISSING_X"; then
4942 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
4946 fi # COMPILE_ENVIRONMENT
4948 dnl Set various defines and substitutions
4949 dnl ========================================================
4951 if test "$OS_ARCH" = "Darwin"; then
4952 AC_DEFINE(XP_MACOSX)
4954 AC_DEFINE(UNIX_ASYNC_DNS)
4955 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2"; then
4957 AC_DEFINE(UNIX_ASYNC_DNS)
4960 AC_ARG_ENABLE(threadsafe,
4961 [ --enable-threadsafe Enable support for multiple threads.],
4962 [AC_DEFINE(JS_THREADSAFE)],)
4964 if test "$MOZ_DEBUG"; then
4965 AC_DEFINE(MOZ_REFLOW_PERF)
4966 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
4969 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
4970 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
4971 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
4972 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
4973 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
4974 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
4975 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
4976 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
4977 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
4980 dnl ========================================================
4981 dnl JavaScript shell
4982 dnl ========================================================
4984 AC_HAVE_FUNCS(setlocale)
4985 AC_HAVE_FUNCS(localeconv)
4989 WIN_TOP_SRC=`cd $srcdir; pwd -W`
4993 AC_SUBST(WIN_TOP_SRC)
4995 AC_SUBST(MOZILLA_VERSION)
4997 AC_SUBST(ac_configure_args)
4999 dnl Spit out some output
5000 dnl ========================================================
5002 # Save the defines header file before autoconf removes it.
5003 # (Do not add AC_DEFINE calls after this line.)
5004 _CONFIG_TMP=confdefs-tmp.h
5005 _CONFIG_DEFS_H=js-confdefs.h
5007 cat > $_CONFIG_TMP <<\EOF
5008 /* List of defines generated by configure. Included with preprocessor flag,
5009 * -include, to avoid long list of -D defines on the compile command-line.
5013 #ifndef _JS_CONFDEFS_H_
5014 #define _JS_CONFDEFS_H_
5017 _EGREP_PATTERN='^#define ('
5018 if test -n "$_NON_GLOBAL_ACDEFINES"; then
5019 for f in $_NON_GLOBAL_ACDEFINES; do
5020 _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
5023 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
5025 sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
5027 if test "$?" != 0; then
5028 AC_MSG_ERROR([Error outputting config definitions])
5031 cat >> $_CONFIG_TMP <<\EOF
5033 /* The c99 defining the limit macros (UINT32_MAX for example), says:
5034 * C++ implementations should define these macros only when __STDC_LIMIT_MACROS
5035 * is defined before <stdint.h> is included. */
5036 #define __STDC_LIMIT_MACROS
5038 #endif /* _JS_CONFDEFS_H_ */
5042 # Only write js-confdefs.h when something changes (or it doesn't exist)
5043 if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
5046 AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
5047 mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
5049 echo ==== $_CONFIG_DEFS_H =================================
5053 dnl Probably shouldn't call this manually but we always want the output of DEFS
5054 rm -f confdefs.h.save
5055 mv confdefs.h confdefs.h.save
5056 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
5057 if test "$?" != 0; then
5058 AC_MSG_ERROR([Error outputting confdefs.h])
5060 AC_OUTPUT_MAKE_DEFS()
5062 AC_SUBST(MOZ_DEFINES)
5064 mv confdefs.h.save confdefs.h
5071 config/expandlibs_config.py
5074 if test "$JS_NATIVE_EDITLINE"; then
5075 MAKEFILES="$MAKEFILES
5080 if test ! "$COMPILER_DEPEND" -a ! "$MOZ_NATIVE_MAKEDEPEND"; then
5081 MAKEFILES="$MAKEFILES
5082 config/mkdepend/Makefile
5086 if test "$ENABLE_TESTS"; then
5087 MAKEFILES="$MAKEFILES
5088 jsapi-tests/Makefile
5094 dnl Run a perl script to quickly create the makefiles.
5095 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
5096 dnl for the files it cannot handle correctly. This way, config.status
5097 dnl will handle these files.
5098 dnl If it fails, nothing is set and config.status will run as usual.
5100 dnl This does not change the $MAKEFILES variable.
5102 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
5106 echo $MAKEFILES > unallmakefiles
5108 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
5110 AC_OUTPUT($MAKEFILES)
5112 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
5113 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
5114 echo "config/autoconf.mk is unchanged"
5115 mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
5117 rm -f config/autoconf.mk.orig 2> /dev/null
5120 # Produce the js-config script at configure time; see the comments for
5121 # 'js-config' in Makefile.in.
5122 AC_MSG_RESULT(invoking $MAKE to create js-config script)
5125 # Build jsctypes if it's enabled.
5126 if test "$JS_HAS_CTYPES" -a -z "$MOZ_NATIVE_FFI"; then
5127 # Run the libffi 'configure' script.
5128 ac_configure_args="--disable-shared --enable-static --disable-raw-api"
5129 if test "$MOZ_DEBUG"; then
5130 ac_configure_args="$ac_configure_args --enable-debug"
5132 if test "$DSO_PIC_CFLAGS"; then
5133 ac_configure_args="$ac_configure_args --with-pic"
5135 if test "$CROSS_COMPILE"; then
5137 *-android*|*-linuxandroid*)
5138 export AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS CFLAGS LDFLAGS
5140 ac_configure_args="$ac_configure_args --build=$build --host=$target HOST_CC=\"$HOST_CC\""
5143 ac_configure_args="$ac_configure_args --build=$build --host=$target HOST_CC=\"$HOST_CC\" CC=\"$CC\""
5147 if test "$_MSC_VER"; then
5148 # Use a wrapper script for cl and ml that looks more like gcc.
5149 # autotools can't quite handle an MSVC build environment yet.
5152 ac_configure_args="$ac_configure_args LD=link CPP=\"cl -nologo -EP\" SHELL=sh.exe"
5153 case "${target_cpu}" in
5155 # Need target since MSYS tools into mozilla-build may be 32bit
5156 ac_configure_args="$ac_configure_args CC=\"$_topsrcdir/ctypes/libffi/msvcc.sh -m64\" --build=$build --host=$target"
5159 ac_configure_args="$ac_configure_args CC=$_topsrcdir/ctypes/libffi/msvcc.sh"
5163 if test "$SOLARIS_SUNPRO_CC"; then
5164 # Always use gcc for libffi on Solaris
5165 if test ! "$HAVE_64BIT_OS"; then
5166 ac_configure_args="$ac_configure_args CC=gcc CFLAGS=-m32 LD= LDFLAGS="
5168 ac_configure_args="$ac_configure_args CC=gcc CFLAGS=-m64 LD= LDFLAGS="
5171 if test "$AIX_IBM_XLC"; then
5172 # Always use gcc for libffi on IBM AIX5/AIX6
5173 if test ! "$HAVE_64BIT_OS"; then
5174 ac_configure_args="$ac_configure_args CC=gcc CFLAGS=-maix32"
5176 ac_configure_args="$ac_configure_args CC=gcc CFLAGS=-maix64"
5179 if test "$OS_ARCH" = "OS2"; then
5180 ac_configure_args="$ac_configure_args CFLAGS=-Zomf AR=emxomfar"
5183 # Use a separate cache file for libffi, since it does things differently
5184 # from our configure.
5185 mkdir -p $_objdir/ctypes/libffi
5186 old_cache_file=$cache_file
5187 cache_file=$_objdir/ctypes/libffi/config.cache
5188 old_config_files=$CONFIG_FILES
5190 AC_OUTPUT_SUBDIRS(ctypes/libffi)
5191 cache_file=$old_cache_file
5192 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
5193 CONFIG_FILES=$old_config_files