1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
2 dnl vi: set tabstop=4 shiftwidth=4 expandtab:
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,
176 dnl Default to MSVC for win32 and gcc-4.2 for darwin
177 dnl ==============================================================
178 if test -z "$CROSS_COMPILE"; then
180 *-cygwin*|*-mingw*|*-msvc*|*-mks*)
181 if test -z "$CC"; then CC=cl; fi
182 if test -z "$CXX"; then CXX=cl; fi
183 if test -z "$CPP"; then CPP="cl -E -nologo"; fi
184 if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
185 if test -z "$LD"; then LD=link; fi
186 if test -z "$AS"; then
187 case "${target_cpu}" in
196 if test -z "$MIDL"; then MIDL=midl; fi
199 if test -z "$CC"; then CC=gcc-4.2; fi
200 if test -z "$CXX"; then CXX=g++-4.2; fi
205 COMPILE_ENVIRONMENT=1
206 MOZ_ARG_DISABLE_BOOL(compile-environment,
207 [ --disable-compile-environment
208 Disable compiler/library checks.],
209 COMPILE_ENVIRONMENT= )
210 AC_SUBST(COMPILE_ENVIRONMENT)
212 dnl Check for Perl first -- needed for win32 SDK checks
213 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
214 if test -z "$PERL" -o "$PERL" = ":"; then
215 AC_MSG_ERROR([perl not found in \$PATH])
218 MOZ_ARG_ENABLE_BOOL(shared-js,
219 [ --disable-shared-js
220 Do not create a shared library.],
224 if test "$DISABLE_SHARED_JS" = "1" ; then
225 AC_DEFINE(STATIC_EXPORTABLE_JS_API)
229 AC_SUBST(JS_SHARED_LIBRARY)
231 dnl ========================================================
232 dnl = Android uses a very custom (hacky) toolchain; we need to do this
233 dnl = here, so that the compiler checks can succeed
234 dnl ========================================================
236 MOZ_ARG_WITH_STRING(android-ndk,
237 [ --with-android-ndk=DIR
238 location where the Android NDK can be found],
239 android_ndk=$withval)
241 MOZ_ARG_WITH_STRING(android-toolchain,
242 [ --with-android-toolchain=DIR
243 location of the android toolchain, default NDK/build/prebuilt/HOST/arm-eabi-4.4.0],
244 android_toolchain=$withval)
247 MOZ_ARG_WITH_STRING(android-version,
248 [ --with-android-version=VER
249 android platform version, default 5],
250 android_version=$withval,
253 MOZ_ARG_WITH_STRING(android-sdk,
254 [ --with-android-sdk=DIR
255 location where the Android SDK can be found (base directory, e.g. .../android/platforms/android-6)],
256 android_sdk=$withval)
258 if test "$target" = "arm-android-eabi" ; then
259 if test -z "$android_ndk" ; then
260 AC_MSG_ERROR([You must specify --with-android-ndk=/path/to/ndk when targeting Android.])
263 if test -z "$android_sdk" ; then
264 AC_MSG_ERROR([You must specify --with-android-sdk=/path/to/sdk when targeting Android.])
267 android_platform_tools="$android_sdk"/../../platform-tools
268 if test ! -d "$android_platform_tools" ; then
269 android_platform_tools="$android_sdk"/tools # SDK Tools < r8
272 if test -z "$android_toolchain" ; then
273 android_toolchain="$android_ndk"/build/prebuilt/`uname -s | tr "[[:upper:]]" "[[:lower:]]"`-x86/arm-eabi-4.4.0
276 if test -z "$android_platform" ; then
277 android_platform="$android_ndk"/build/platforms/android-"$android_version"/arch-"$target_cpu"
281 AS="$android_toolchain"/bin/arm-eabi-as
282 CC="$android_toolchain"/bin/arm-eabi-gcc
283 CXX="$android_toolchain"/bin/arm-eabi-g++
284 CPP="$android_toolchain"/bin/arm-eabi-cpp
285 LD="$android_toolchain"/bin/arm-eabi-ld
286 AR="$android_toolchain"/bin/arm-eabi-ar
287 RANLIB="$android_toolchain"/bin/arm-eabi-ranlib
288 STRIP="$android_toolchain"/bin/arm-eabi-strip
290 CPPFLAGS="-I$android_platform/usr/include $CPPFLAGS"
291 CFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions -march=armv5te -mthumb-interwork $CFLAGS"
292 CXXFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions -march=armv5te -mthumb-interwork $CXXFLAGS"
294 dnl Add -llog by default, since we use it all over the place.
295 dnl Add --allow-shlib-undefined, because libGLESv2 links to an
296 dnl undefined symbol (present on the hardware, just not in the
298 LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform -llog -Wl,--allow-shlib-undefined $LDFLAGS"
300 dnl prevent cross compile section from using these flags as host flags
301 if test -z "$HOST_CPPFLAGS" ; then
304 if test -z "$HOST_CFLAGS" ; then
307 if test -z "$HOST_CXXFLAGS" ; then
310 if test -z "$HOST_LDFLAGS" ; then
314 ANDROID_NDK="${android_ndk}"
315 ANDROID_TOOLCHAIN="{android_toolchain}"
316 ANDROID_PLATFORM="{android_platform}"
317 ANDROID_SDK="${android_sdk}"
318 ANDROID_PLATFORM_TOOLS="${android_platform_tools}"
319 ANDROID_VERSION="${android_version}"
321 # save these for libffi's subconfigure,
322 # which doesn't know how to figure this stuff out on its own
323 ANDROID_CFLAGS="$CFLAGS"
324 ANDROID_CPPFLAGS="$CPPFLAGS"
325 ANDROID_LDFLAGS="$LDFLAGS"
328 AC_DEFINE_UNQUOTED(ANDROID_VERSION, $android_version)
329 AC_SUBST(ANDROID_VERSION)
331 MOZ_CHROME_FILE_FORMAT=omni
334 AC_SUBST(ANDROID_NDK)
335 AC_SUBST(ANDROID_TOOLCHAIN)
336 AC_SUBST(ANDROID_PLATFORM)
337 AC_SUBST(ANDROID_SDK)
338 AC_SUBST(ANDROID_PLATFORM_TOOLS)
340 dnl ========================================================
341 dnl Checks for compilers.
342 dnl ========================================================
343 dnl Set CROSS_COMPILE in the environment when running configure
344 dnl to use the cross-compile setup for now
345 dnl ========================================================
347 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
350 if test "$COMPILE_ENVIRONMENT"; then
353 # In Mozilla, we use the names $target, $host and $build incorrectly, but are
354 # too far gone to back out now. See Bug 475488:
355 # - When we say $target, we mean $host, that is, the system on which
356 # Mozilla will be run.
357 # - When we say $host, we mean $build, that is, the system on which Mozilla
359 # - $target (in its correct usage) is for compilers who generate code for a
360 # different platform than $host, so it would not be used by Mozilla.
361 if test "$target" != "$host"; then
362 echo "cross compiling from $host to $target"
365 _SAVE_CFLAGS="$CFLAGS"
366 _SAVE_LDFLAGS="$LDFLAGS"
368 AC_MSG_CHECKING([for host c compiler])
369 AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
370 if test -z "$HOST_CC"; then
371 AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
373 AC_MSG_RESULT([$HOST_CC])
374 AC_MSG_CHECKING([for host c++ compiler])
375 AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
376 if test -z "$HOST_CXX"; then
377 AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
379 AC_MSG_RESULT([$HOST_CXX])
381 if test -z "$HOST_CFLAGS"; then
382 HOST_CFLAGS="$CFLAGS"
384 if test -z "$HOST_CXXFLAGS"; then
385 HOST_CXXFLAGS="$CXXFLAGS"
387 if test -z "$HOST_LDFLAGS"; then
388 HOST_LDFLAGS="$LDFLAGS"
390 if test -z "$HOST_AR_FLAGS"; then
391 HOST_AR_FLAGS="$AR_FLAGS"
393 AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
394 AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
396 CFLAGS="$HOST_CFLAGS"
397 LDFLAGS="$HOST_LDFLAGS"
399 AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
400 AC_TRY_COMPILE([], [return(0);],
401 [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
402 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
405 CFLAGS="$HOST_CXXFLAGS"
407 AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
408 AC_TRY_COMPILE([], [return(0);],
409 [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
410 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
414 LDFLAGS=$_SAVE_LDFLAGS
416 case "$build:$target" in
417 powerpc-apple-darwin8*:i?86-apple-darwin*)
418 dnl The Darwin cross compiler doesn't necessarily point itself at a
419 dnl root that has libraries for the proper architecture, it defaults
420 dnl to the system root. The libraries in the system root on current
421 dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
422 dnl checks will fail. Fake a working SDK in that case.
424 _SAVE_CXXFLAGS=$CXXLAGS
425 CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CFLAGS"
426 CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CXXFLAGS"
432 AC_ARG_WITH(symbian-sdk,
433 [ --with-symbian-sdk=SYMBIAN_SDK_DIR
434 The path to the Symbian SDK],
435 SYMBIAN_SDK_DIR=$withval)
437 OS_EXE_CFLAGS="$OS_EXE_CFLAGS -D__EXE__"
438 CFLAGS="-MD -nostdinc"
439 SYMBIAN_SYS_INCLUDE="-I$SYMBIAN_SDK_DIR/Epoc32/include -I$SYMBIAN_SDK_DIR/Epoc32/include/variant -I$SYMBIAN_SDK_DIR/Epoc32/include/stdapis"
444 CC=arm-none-symbianelf-gcc.exe
445 CXX=arm-none-symbianelf-g++.exe
446 LD=arm-none-symbianelf-ld.exe
447 AR=arm-none-symbianelf-ar.exe
448 CPP=arm-none-symbianelf-cpp.exe
449 CFLAGS="$CFLAGS -c -Wall -Wno-unknown-pragmas -fexceptions -march=armv5t -mapcs -pipe -msoft-float"
450 CXXFLAGS="$CFLAGS -Wno-ctor-dtor-privacy"
451 GCCE_INCLUDE="-include $SYMBIAN_SDK_DIR/EPOC32/INCLUDE/GCCE/GCCE.h -D__PRODUCT_INCLUDE__=$SYMBIAN_SDK_DIR/Epoc32/include/variant/Symbian_OS_v9.2.hrh"
452 CFLAGS="$CFLAGS ${GCCE_INCLUDE} -x c"
453 CXXFLAGS="$CXXFLAGS ${GCCE_INCLUDE} -x c++"
454 CPPFLAGS="$CPPFLAGS ${SYMBIAN_SYS_INCLUDE}"
457 dnl TODO: add emulator build code
464 AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
467 AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
471 case "$build:$target" in
472 powerpc-apple-darwin8*:i?86-apple-darwin*)
473 dnl Revert the changes made above. From this point on, the target
474 dnl compiler will never be used without applying the SDK to CFLAGS
475 dnl (see --with-macos-sdk below).
477 CXXFLAGS=$_SAVE_CXXFLAGS
481 AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
482 AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
483 MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
484 AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
485 AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
486 AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
487 AC_DEFINE(CROSS_COMPILE)
489 dnl If we cross compile for ppc on Mac OS X x86, cross_compiling will
490 dnl have erroneously been set to "no", because the x86 build host is
491 dnl able to run ppc code in a translated environment, making a cross
492 dnl compiler appear native. So we override that here.
498 MOZ_PATH_PROGS(AS, $AS as, $CC)
499 AC_CHECK_PROGS(AR, ar, :)
500 AC_CHECK_PROGS(LD, ld, :)
501 AC_CHECK_PROGS(STRIP, strip, :)
502 AC_CHECK_PROGS(WINDRES, windres, :)
503 if test -z "$HOST_CC"; then
506 if test -z "$HOST_CFLAGS"; then
507 HOST_CFLAGS='$(CFLAGS)'
509 if test -z "$HOST_CXX"; then
512 if test -z "$HOST_CXXFLAGS"; then
513 HOST_CXXFLAGS='$(CXXFLAGS)'
515 if test -z "$HOST_LDFLAGS"; then
516 HOST_LDFLAGS='$(LDFLAGS)'
518 if test -z "$HOST_RANLIB"; then
519 HOST_RANLIB='$(RANLIB)'
521 if test -z "$HOST_AR"; then
524 if test -z "$HOST_AR_FLAGS"; then
525 HOST_AR_FLAGS='$(AR_FLAGS)'
535 if test "$GCC" = "yes"; then
537 CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
539 if test "$GXX" = "yes"; then
541 CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
543 if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
546 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
549 if test "$GNU_CC"; then
550 if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
557 if test "$GCC" = yes; then
558 if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
563 if test "$GXX" = yes; then
564 if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
569 dnl Special win32 checks
570 dnl ========================================================
578 dnl Target the Windows 7 SDK by default
583 MOZ_ARG_WITH_STRING(windows-version,
584 [ --with-windows-version=WINSDK_TARGETVER
585 Highest Windows version to target using this SDK
586 502: Windows Server 2003
589 WINSDK_TARGETVER=$withval)
591 case "$WINSDK_TARGETVER" in
593 MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
597 AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER), must be 502, 600 or 601]);
603 *-cygwin*|*-mingw*|*-msvc*|*-mks*|*-wince|*-winmo)
604 if test "$GCC" != "yes"; then
605 # Check to see if we are really running in a msvc environemnt
608 # Make sure compilers are valid
609 CFLAGS="$CFLAGS -TC -nologo"
610 CXXFLAGS="$CXXFLAGS -TP -nologo"
611 # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
612 # _CRT_SECURE_NO_WARNINGS disables warnings about using MSVC-specific
613 # secure CRT functions.
614 CXXFLAGS="$CXXFLAGS -wd4345 -D_CRT_SECURE_NO_WARNINGS"
617 AC_TRY_COMPILE([#include <stdio.h>],
618 [ printf("Hello World\n"); ],,
619 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
622 AC_TRY_COMPILE([#include <new.h>],
623 [ unsigned *test = new unsigned(42); ],,
624 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
628 _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
631 # Determine compiler version
632 CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
633 _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
634 _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
635 _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
636 _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
637 _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
639 CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
640 _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
642 if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
643 AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
646 if test "$_CC_MAJOR_VERSION" = "14"; then
647 dnl Require VC8SP1 or newer.
648 dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762.
649 if test "$_CC_RELEASE" -lt 50727 -o \
650 \( "$_CC_RELEASE" -eq 50727 -a "$_CC_BUILD" -lt 762 \); then
651 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.])
655 CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
656 AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
657 AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
658 elif test "$_CC_MAJOR_VERSION" = "15"; then
660 CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
661 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
662 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
663 elif test "$_CC_MAJOR_VERSION" = "16"; then
665 CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
666 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
667 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
669 AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
672 _MOZ_RTTI_FLAGS_ON='-GR'
673 _MOZ_RTTI_FLAGS_OFF='-GR-'
674 _MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
675 _MOZ_EXCEPTIONS_FLAGS_OFF=''
677 if test -n "$WIN32_REDIST_DIR"; then
678 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
681 dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
682 dnl not something else like "magnetic tape manipulation utility".
683 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
684 if test -z "$MSMT_TOOL"; then
685 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
689 _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
691 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
692 if test -z "$MSMANIFEST_TOOL_VERSION"; then
693 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
699 # Check linker version
700 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
701 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
702 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
703 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
708 # Identify which version of the SDK we're building with
709 # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
711 AC_CHECK_HEADERS([winsdkver.h])
712 if test "$ac_cv_header_winsdkver_h" = "yes"; then
713 # Get the highest _WIN32_WINNT and NTDDI versions supported
714 # Take the higher of the two
715 # This is done because the Windows 7 beta SDK reports its
716 # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
717 AC_CACHE_CHECK(for highest Windows version supported by this SDK,
719 [cat > conftest.h <<EOF
720 #include <winsdkver.h>
721 #include <sdkddkver.h>
723 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
724 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
726 #define WINSDK_MAXVER NTDDI_MAXVER
731 ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
734 MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
736 # The Vista SDK is the only one to have sdkddkver.h but not
738 AC_CHECK_HEADERS([sdkddkver.h])
739 if test "$ac_cv_header_sdkddkver_h" = "yes"; then
740 MOZ_WINSDK_MAXVER=0x06000000
742 # Assume the Server 2003 Platform SDK
743 MOZ_WINSDK_MAXVER=0x05020000
747 unset _MSVC_VER_FILTER
749 AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
753 _SAVE_CXXFLAGS="$CXXFLAGS"
754 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
755 AC_TRY_COMPILE([#include <exception>],
756 [std::_Throw(std::exception()); return 0;],
757 ac_cv_have_std__Throw="yes",
758 ac_cv_have_std__Throw="no")
759 CXXFLAGS="$_SAVE_CXXFLAGS"
763 if test "$ac_cv_have_std__Throw" == "yes"; then
764 AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
765 ac_cv_have_dllimport_exception_bug,
769 _SAVE_CXXFLAGS="$CXXFLAGS"
770 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
771 AC_TRY_LINK([#include <vector>],
772 [std::vector<int> v; return v.at(1);],
773 ac_cv_have_dllimport_exception_bug="no",
774 ac_cv_have_dllimport_exception_bug="yes")
775 CXXFLAGS="$_SAVE_CXXFLAGS"
778 if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
780 MOZ_MSVC_STL_WRAP__Throw=1
781 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
784 AC_CACHE_CHECK(for overridable _RAISE,
789 _SAVE_CXXFLAGS="$CXXFLAGS"
790 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
791 AC_TRY_COMPILE([#include <xstddef>
793 #define _RAISE(x) externallyDefinedFunction((x).what())
796 [std::vector<int> v; return v.at(1);],
797 ac_cv_have__RAISE="no",
798 ac_cv_have__RAISE="yes")
799 CXXFLAGS="$_SAVE_CXXFLAGS"
802 if test "$ac_cv_have__RAISE" = "yes"; then
804 MOZ_MSVC_STL_WRAP__RAISE=1
805 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
807 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.])
811 if test "$WRAP_STL_INCLUDES" = "1"; then
812 STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
815 # Check w32api version
816 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
817 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
818 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
819 AC_TRY_COMPILE([#include <w32api.h>],
820 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
821 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
822 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
823 #error "test failed."
825 , [ res=yes ], [ res=no ])
826 AC_MSG_RESULT([$res])
827 if test "$res" != "yes"; then
828 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
830 # Check windres version
831 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
832 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
833 AC_MSG_RESULT([$_WINDRES_VERSION])
834 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
835 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
836 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
837 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
838 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
839 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
840 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
841 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
842 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
843 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
844 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
845 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
847 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
850 # Server 2003 is the highest version supported
851 MOZ_WINSDK_MAXVER=0x05020000
854 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
855 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
856 # Require OS features provided by IE 5.0
857 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
859 # If the maximum version supported by this SDK is lower than the target
861 AC_MSG_CHECKING([for Windows SDK being recent enough])
862 if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
866 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.])
869 AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
870 # Definitions matching sdkddkver.h
871 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WS03, 0x05020000)
872 AC_DEFINE_UNQUOTED(MOZ_NTDDI_LONGHORN, 0x06000000)
873 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
877 dnl Test breaks icc on OS/2 && MSVC
878 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
880 if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
884 CC="${srcdir}/build/hcc '$CC'"
885 CXX="${srcdir}/build/hcpp '$CXX'"
892 if test -n "$_WIN32_MSVC"; then
894 SKIP_COMPILER_CHECKS=1
895 SKIP_LIBRARY_CHECKS=1
897 # Since we're skipping compiler and library checks, hard-code
900 # Common to all MSVC environments:
901 # Windows lacks <stdint.h>, but has __int8, and so on.
902 AC_DEFINE(JS_HAVE___INTN)
903 AC_DEFINE(HAVE_LOCALECONV)
907 AC_DEFINE(HAVE_SYSTEMTIMETOFILETIME)
908 AC_DEFINE(JS_CRTDEFS_H_HAS_INTPTR_T)
911 AC_DEFINE(HAVE_SYSTEMTIMETOFILETIME)
912 AC_DEFINE(HAVE_GETSYSTEMTIMEASFILETIME)
913 # Windows <stddef.h> defines intptr_t and uintptr_t.
914 # VS2005: http://msdn.microsoft.com/en-us/library/323b6b3k(VS.80).aspx
915 # VS2008: http://msdn.microsoft.com/en-us/library/323b6b3k.aspx
916 AC_DEFINE(JS_STDDEF_H_HAS_INTPTR_T)
921 fi # COMPILE_ENVIRONMENT
923 if test "$cross_compiling" = "yes"; then
929 # Check to see if we are running in a broken QEMU scratchbox.
930 # We know that anything below 1.0.16 is broken.
931 AC_CHECK_PROGS(SBCONF, sb-conf ve, "")
932 if test -n "$SBCONF"; then
933 _sb_version=`$SBCONF ve`
934 _sb_version_major=`echo $_sb_version | cut -f1 -d.`
935 _sb_version_minor=`echo $_sb_version | cut -f2 -d.`
936 _sb_version_point=`echo $_sb_version | cut -f3 -d.`
937 if test $_sb_version_major -eq 1 -a $_sb_version_minor -eq 0 -a $_sb_version_point -le 16; then
938 QEMU_CANT_RUN_JS_SHELL=1
941 AC_SUBST(QEMU_CANT_RUN_JS_SHELL)
953 AC_SUBST(WRAP_STL_INCLUDES)
954 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
955 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
957 dnl ========================================================
958 dnl Checks for programs.
959 dnl ========================================================
963 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
964 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
965 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
967 AC_MSG_RESULT([$_perl_version])
969 if test "$_perl_res" != 0; then
970 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
974 AC_MSG_CHECKING([for full perl installation])
975 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
977 if test "$_perl_res" != 0; then
979 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
984 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.7 python2.6 python2.5 python)
985 if test -z "$PYTHON"; then
986 AC_MSG_ERROR([python was not found in \$PATH])
989 if test -z "$COMPILE_ENVIRONMENT"; then
990 NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
992 AC_SUBST(NSINSTALL_BIN)
994 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
995 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
996 MOZ_PATH_PROG(UNZIP, unzip, :)
997 MOZ_PATH_PROGS(ZIP, zip)
998 if test -z "$ZIP" -o "$ZIP" = ":"; then
999 AC_MSG_ERROR([zip not found in \$PATH])
1001 MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
1002 MOZ_PATH_PROG(XARGS, xargs)
1003 if test -z "$XARGS" -o "$XARGS" = ":"; then
1004 AC_MSG_ERROR([xargs not found in \$PATH .])
1007 if test "$COMPILE_ENVIRONMENT"; then
1009 dnl ========================================================
1010 dnl = Mac OS X toolchain support
1011 dnl ========================================================
1013 case "$target_os" in
1015 dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
1016 dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
1017 dnl the environment and includedir purposes (when using an SDK, below),
1018 dnl but remember the full version number for the libdir (SDK).
1020 GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
1021 GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
1023 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1024 dnl Bug 280479, but this keeps popping up in bug 292530 too because
1025 dnl 4.0.0/4061 is the default compiler in Tiger.
1027 GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
1029 if test "$GCC_BUILD" = "4061" ; then
1030 AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
1031 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
1032 from building Mozilla. Upgrade to Xcode 2.1 or later.])
1036 dnl xcodebuild needs GCC_VERSION defined in the environment, since it
1037 dnl doesn't respect the CC/CXX setting. With GCC_VERSION set, it will use
1038 dnl /usr/bin/g(cc|++)-$GCC_VERSION.
1039 MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
1044 XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
1046 if test -n "$XCODEBUILD_VERSION" && test "$XCODEBUILD_VERSION" -ge 620 ; then
1052 dnl sdp was formerly in /Developer/Tools. As of Mac OS X 10.4 (Darwin 8),
1053 dnl it has moved into /usr/bin.
1054 MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
1058 AC_SUBST(GCC_VERSION)
1059 AC_SUBST(XCODEBUILD_VERSION)
1060 AC_SUBST(HAS_XCODE_2_1)
1062 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
1063 dnl that a universal binary is being produced.
1064 AC_SUBST(UNIVERSAL_BINARY)
1066 dnl ========================================================
1067 dnl Check for MacOS deployment target version
1068 dnl ========================================================
1070 MOZ_ARG_ENABLE_STRING(macos-target,
1071 [ --enable-macos-target=VER (default=10.5)
1072 Set the minimum MacOS version needed at runtime],
1073 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
1077 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
1078 dnl Use the specified value
1079 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
1080 AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
1082 dnl No value specified on the command line or in the environment,
1083 dnl use architecture minimum.
1084 case "${target_cpu}" in
1086 export MACOSX_DEPLOYMENT_TARGET=10.5
1089 export MACOSX_DEPLOYMENT_TARGET=10.5
1092 export MACOSX_DEPLOYMENT_TARGET=10.6
1099 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
1101 dnl ========================================================
1102 dnl = Mac OS X SDK support
1103 dnl ========================================================
1106 MOZ_ARG_WITH_STRING(macos-sdk,
1107 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
1108 MACOS_SDK_DIR=$withval)
1110 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
1111 dnl NEXT_ROOT will be set and exported only if it's needed.
1112 AC_SUBST(MACOS_SDK_DIR)
1115 if test "$MACOS_SDK_DIR"; then
1116 dnl Sync this section with the ones in NSPR and NSS.
1117 dnl Changes to the cross environment here need to be accounted for in
1118 dnl the libIDL checks (below) and xpidl build.
1120 if test ! -d "$MACOS_SDK_DIR"; then
1121 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
1122 specify a valid SDK. SDKs are installed when the optional cross-development
1123 tools are selected during the Xcode/Developer Tools installation.])
1126 GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
1127 if test "$GCC_VERSION_MAJOR" -lt "4" ; then
1128 AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
1130 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
1131 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
1133 dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
1134 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
1135 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
1137 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1138 dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
1139 dnl that supports -syslibroot. Don't set NEXT_ROOT because it will
1140 dnl be ignored and cause warnings when -syslibroot is specified.
1141 dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
1142 dnl the -isysroot it receives, so this is only needed with 4.0.0.
1143 LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
1148 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
1150 AC_TRY_COMPILE([#include <new>
1151 int main() { return 0; }],
1155 AC_MSG_RESULT($result)
1157 if test "$result" = "no" ; then
1158 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
1162 fi # COMPILE_ENVIRONMENT
1164 if test -n "$MAKE"; then
1165 if test `echo $MAKE | grep -c make.py` != 1; then
1171 cygwin*|mingw*|mks*|msvc*)
1172 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
1175 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
1178 if test "$GMAKE" = ":"; then
1179 AC_MSG_ERROR([GNU make not found])
1183 if test "$COMPILE_ENVIRONMENT"; then
1189 fi # COMPILE_ENVIRONMENT
1191 dnl ========================================================
1192 dnl set the defaults first
1193 dnl ========================================================
1196 AR_EXTRACT='$(AR) x'
1211 MOZ_USER_DIR=".mozilla"
1213 MOZ_JS_LIBS='-L$(libdir) -lmozjs'
1214 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1216 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1218 USE_DEPENDENT_LIBS=1
1220 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1222 if test -n "$CROSS_COMPILE"; then
1223 OS_TARGET="${target_os}"
1224 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1226 case "${target_os}" in
1227 linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
1228 kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1229 gnu*) OS_ARCH=GNU ;;
1230 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
1231 mingw*) OS_ARCH=WINNT ;;
1232 wince*) OS_ARCH=WINCE ;;
1233 winmo*) OS_ARCH=WINCE ;;
1234 darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
1237 arm-android-eabi) OS_ARCH=Linux OS_TARGET=Android ;;
1240 OS_TARGET=`uname -s`
1241 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1242 OS_RELEASE=`uname -r`
1245 # Before this used `uname -m` when not cross compiling
1246 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1247 OS_TEST="${target_cpu}"
1251 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1253 #######################################################################
1254 # Master "Core Components" macros for getting the OS target #
1255 #######################################################################
1258 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1259 # cross-compilation.
1263 # Define and override various archtecture-specific variables, including
1272 case "$HOST_OS_ARCH" in
1273 cygwin*|mingw*|mks*|msvc*)
1286 if test -z "$GNU_CC"; then
1287 if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1292 if test -z "$GNU_CXX"; then
1293 if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1294 SOLARIS_SUNPRO_CXX=1
1297 AC_SUBST(SOLARIS_SUNPRO_CC)
1298 AC_SUBST(SOLARIS_SUNPRO_CXX)
1310 if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1313 HOST_OS_ARCH=UNIXWARE
1325 HOST_OS_ARCH=OpenVMS
1335 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1339 HOST_OS_ARCH=UNIXWARE
1345 if test -z "$CROSS_COMPILE" ; then
1351 # If uname -s returns "Windows_NT", we assume that we are using
1352 # the uname.exe in MKS toolkit.
1354 # The -r option of MKS uname only returns the major version number.
1355 # So we need to use its -v option to get the minor version number.
1356 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1360 OS_MINOR_RELEASE=`uname -v`
1361 if test "$OS_MINOR_RELEASE" = "00"; then
1364 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1366 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1368 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1369 # the uname.exe in the Cygwin tools.
1370 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1371 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1372 # the uname.exe in the GNU-Win32 tools.
1373 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1374 # the uname.exe in the MSYS tools.
1376 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1381 OS_RELEASE=`uname -v`.`uname -r`
1382 OS_TEST=${target_cpu}
1394 if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1398 OS_RELEASE=`uname -v`
1422 OS_RELEASE=`uname -v`
1428 OS_RELEASE=`uname -v`
1431 if test "$OS_TARGET" != "NTO"; then
1433 OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1442 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1448 OS_RELEASE=`uname -v`
1452 case "${target_os}" in
1455 WINCE_WINDOWS_MOBILE=1
1456 AC_DEFINE(WINCE_WINDOWS_MOBILE)
1464 case "${target_cpu}" in
1475 if test -z "$CROSS_COMPILE" ; then
1483 if test "$OS_ARCH" = "NCR"; then
1485 OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1489 # Only set CPU_ARCH if we recognize the value of OS_TEST
1500 powerpc | ppc | rs6000)
1504 Alpha | alpha | ALPHA)
1537 if test -z "$OS_TARGET"; then
1540 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1542 dnl ========================================================
1543 dnl GNU specific defaults
1544 dnl ========================================================
1545 if test "$GNU_CC"; then
1546 # FIXME: Let us build with strict aliasing. bug 414641.
1547 CFLAGS="$CFLAGS -fno-strict-aliasing"
1548 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1549 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1550 DSO_LDOPTS='-shared'
1551 if test "$GCC_USE_GNU_LD"; then
1552 # Don't allow undefined symbols in libraries
1553 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1555 WARNINGS_AS_ERRORS='-Werror'
1557 DSO_PIC_CFLAGS='-fPIC'
1558 ASFLAGS="$ASFLAGS -fPIC"
1559 _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1560 _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1561 _MOZ_EXCEPTIONS_FLAGS_ON='-fexceptions'
1562 _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-exceptions'
1564 # Turn on GNU specific features
1565 # -Wall - turn on all warnings
1566 # -pedantic - make compiler warn about non-ANSI stuff, and
1567 # be a little bit stricter
1568 # Warnings slamm took out for now (these were giving more noise than help):
1569 # -Wbad-function-cast - warns when casting a function to a new return type
1570 # -Wshadow - removed because it generates more noise than help --pete
1571 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1572 if test -z "$INTEL_CC"; then
1573 # Don't use -Wcast-align with ICC
1575 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1576 hppa | ia64 | sparc | arm)
1579 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1584 dnl Turn pedantic on but disable the warnings for long long
1587 if test -z "$INTEL_CC"; then
1588 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1591 _DEFINES_CFLAGS='-include $(DEPTH)/js-confdefs.h -DMOZILLA_CLIENT'
1592 _USE_CPP_INCLUDE_FLAG=1
1593 elif test "$SOLARIS_SUNPRO_CC"; then
1595 if test "$CPU_ARCH" = "sparc"; then
1596 # for Sun Studio on Solaris/SPARC
1597 DSO_PIC_CFLAGS='-xcode=pic32'
1599 DSO_PIC_CFLAGS='-KPIC'
1601 _DEFINES_CFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
1603 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1604 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1606 DSO_LDOPTS='-shared'
1607 if test "$GNU_LD"; then
1608 # Don't allow undefined symbols in libraries
1609 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1613 DSO_PIC_CFLAGS='-KPIC'
1614 _DEFINES_CFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
1617 if test "$GNU_CXX"; then
1618 # FIXME: Let us build with strict aliasing. bug 414641.
1619 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1620 # Turn on GNU specific features
1621 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1622 if test -z "$INTEL_CC"; then
1623 # Don't use -Wcast-align with ICC
1625 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1626 hppa | ia64 | sparc | arm)
1629 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1634 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/js-confdefs.h'
1635 _USE_CPP_INCLUDE_FLAG=1
1637 AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1638 ac_has_wno_invalid_offsetof,
1642 _SAVE_CXXFLAGS="$CXXFLAGS"
1643 CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1646 ac_has_wno_invalid_offsetof="yes",
1647 ac_has_wno_invalid_offsetof="no")
1648 CXXFLAGS="$_SAVE_CXXFLAGS"
1651 if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1652 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1655 AC_CACHE_CHECK(whether the compiler supports -Wno-variadic-macros,
1656 ac_has_wno_variadic_macros,
1660 _SAVE_CXXFLAGS="$CXXFLAGS"
1661 CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-variadic-macros"
1664 ac_has_wno_variadic_macros="yes",
1665 ac_has_wno_variadic_macros="no")
1666 CXXFLAGS="$_SAVE_CXXFLAGS"
1669 if test "$ac_has_wno_variadic_macros" = "yes"; then
1670 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-variadic-macros"
1673 AC_CACHE_CHECK(whether the compiler supports -Werror=return-type,
1674 ac_has_werror_return_type,
1678 _SAVE_CXXFLAGS="$CXXFLAGS"
1679 CXXFLAGS="$CXXFLAGS -Werror=return-type"
1682 ac_has_werror_return_type="yes",
1683 ac_has_werror_return_type="no")
1684 CXXFLAGS="$_SAVE_CXXFLAGS"
1687 if test "$ac_has_werror_return_type" = "yes"; then
1688 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=return-type"
1692 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_JS_CONFDEFS_H_ $(ACDEFINES)'
1695 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1696 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1697 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1698 dnl normal behavior.
1699 dnl ========================================================
1701 MKSHLIB_UNFORCE_ALL=
1703 if test "$COMPILE_ENVIRONMENT"; then
1704 if test "$GNU_CC"; then
1705 AC_MSG_CHECKING(whether ld has archive extraction flags)
1706 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1707 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1708 ac_cv_mkshlib_force_and_unforce="no"
1709 exec 3<&0 <<LOOP_INPUT
1710 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
1711 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1712 force="-Wl,-all"; unforce="-Wl,-none"
1719 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1722 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1724 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1728 eval $ac_cv_mkshlib_force_and_unforce
1729 MKSHLIB_FORCE_ALL=$force
1730 MKSHLIB_UNFORCE_ALL=$unforce
1733 fi # COMPILE_ENVIRONMENT
1735 dnl =================================================================
1736 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1737 dnl which is bad when cross compiling.
1738 dnl =================================================================
1739 if test "$COMPILE_ENVIRONMENT"; then
1740 configure_static_assert_macros='
1741 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1742 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1743 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1746 dnl test that the macros actually work:
1747 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1748 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1751 ac_cv_static_assertion_macros_work="yes"
1752 AC_TRY_COMPILE([$configure_static_assert_macros],
1753 [CONFIGURE_STATIC_ASSERT(1)],
1755 ac_cv_static_assertion_macros_work="no")
1756 AC_TRY_COMPILE([$configure_static_assert_macros],
1757 [CONFIGURE_STATIC_ASSERT(0)],
1758 ac_cv_static_assertion_macros_work="no",
1761 AC_TRY_COMPILE([$configure_static_assert_macros],
1762 [CONFIGURE_STATIC_ASSERT(1)],
1764 ac_cv_static_assertion_macros_work="no")
1765 AC_TRY_COMPILE([$configure_static_assert_macros],
1766 [CONFIGURE_STATIC_ASSERT(0)],
1767 ac_cv_static_assertion_macros_work="no",
1771 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1772 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1773 AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1775 fi # COMPILE_ENVIRONMENT
1777 dnl ========================================================
1778 dnl Checking for 64-bit OS
1779 dnl ========================================================
1780 if test "$COMPILE_ENVIRONMENT"; then
1783 AC_MSG_CHECKING(for 64-bit OS)
1784 AC_TRY_COMPILE([$configure_static_assert_macros],
1785 [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1786 result="yes", result="no")
1787 AC_MSG_RESULT("$result")
1788 if test "$result" = "yes"; then
1789 AC_DEFINE(HAVE_64BIT_OS)
1792 AC_SUBST(HAVE_64BIT_OS)
1794 fi # COMPILE_ENVIRONMENT
1796 dnl ========================================================
1797 dnl Enable high-memory support on OS/2 by default.
1798 dnl ========================================================
1799 MOZ_OS2_HIGH_MEMORY=1
1800 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1801 [ --disable-os2-high-mem Disable high-memory support on OS/2],
1802 MOZ_OS2_HIGH_MEMORY=,
1803 MOZ_OS2_HIGH_MEMORY=1 )
1804 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1806 dnl ========================================================
1807 dnl = Use profiling compile flags
1808 dnl ========================================================
1809 MOZ_ARG_ENABLE_BOOL(profiling,
1810 [ --enable-profiling Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1814 dnl ========================================================
1815 dnl System overrides of the defaults for host
1816 dnl ========================================================
1819 HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1820 HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1821 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1824 *cygwin*|*mingw*|*mks*|*msvc*|*wince|*winmo)
1825 # we need Python 2.5 on Windows
1827 if test -n "$_WIN32_MSVC"; then
1829 HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1830 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1831 HOST_RANLIB='echo ranlib'
1833 HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1835 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1836 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1837 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1838 HOST_BIN_SUFFIX=.exe
1841 dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1842 PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1845 CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1846 if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1848 CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1850 if test "`${PERL} -v | grep -c cygwin 2>/dev/null`" = 0; then
1852 PERL="${CYGWIN_WRAPPER} $PERL"
1855 if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1856 PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1861 case "${host_cpu}" in
1863 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1869 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1870 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1871 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1874 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1875 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1876 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1877 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1881 HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1882 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1883 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1884 HOST_BIN_SUFFIX=.exe
1889 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1890 HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1891 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1895 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1896 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1900 dnl We require version 2.4 or newer of Python to build,
1901 dnl and 2.5 or newer on Windows.
1902 AC_MSG_CHECKING([for Python version >= $PYTHON_VERSION but not 3.x])
1904 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1] or sys.version[:2] != '2.')" $PYTHON_VERSION
1907 if test "$_python_res" != 0; then
1908 AC_MSG_ERROR([Python $PYTHON_VERSION or higher (but not Python 3.x) is required.])
1910 AC_MSG_RESULT([yes])
1912 dnl ========================================================
1913 dnl System overrides of the defaults for target
1914 dnl ========================================================
1919 if test ! "$GNU_CC"; then
1920 if test ! "$HAVE_64BIT_OS"; then
1921 # Compiling with Visual Age C++ object model compat is the
1922 # default. To compile with object model ibm, add
1923 # AIX_OBJMODEL=ibm to .mozconfig.
1924 if test "$AIX_OBJMODEL" = "ibm"; then
1925 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1932 AC_SUBST(AIX_OBJMODEL)
1933 DSO_LDOPTS='-qmkshrobj=1'
1934 DSO_CFLAGS='-qflag=w:w'
1936 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1937 AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1939 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1940 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1941 if test "$COMPILE_ENVIRONMENT"; then
1944 AC_MSG_CHECKING([for VisualAge C++ compiler version >= 6.0.0.3])
1946 [#if (__IBMCPP__ < 600)
1947 #error "Bad compiler"
1949 _BAD_COMPILER=,_BAD_COMPILER=1)
1950 if test -n "$_BAD_COMPILER"; then
1952 AC_MSG_ERROR([VisualAge C++ version 6.0.0.3 or higher is required to build.])
1954 AC_MSG_RESULT([yes])
1957 TARGET_COMPILER_ABI="ibmc"
1958 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1959 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1962 case "${target_os}" in
1967 if test "$COMPILE_ENVIRONMENT"; then
1968 AC_CHECK_HEADERS(sys/inttypes.h)
1970 AC_DEFINE(JS_SYS_TYPES_H_DEFINES_EXACT_SIZE_TYPES)
1971 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1976 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1977 _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
1978 DSO_LDOPTS='-nostart'
1979 TK_LIBS='-lbe -lroot'
1981 if test "$COMPILE_ENVIRONMENT"; then
1982 AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
1983 AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
1985 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
1986 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
1989 MOZ_USER_DIR="Mozilla"
1993 dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
2002 _WARNINGS_CFLAGS="-Wall"
2003 _WARNINGS_CXXFLAGS="-Wall"
2004 # The test above doesn't work properly, at least on 3.1.
2005 MKSHLIB_FORCE_ALL=''
2006 MKSHLIB_UNFORCE_ALL=''
2012 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2013 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2014 # If we're building with --enable-profiling, we need a frame pointer.
2015 if test -z "$MOZ_PROFILING"; then
2016 MOZ_OPTIMIZE_FLAGS="-O3 -fomit-frame-pointer"
2018 MOZ_OPTIMIZE_FLAGS="-O3 -fno-omit-frame-pointer"
2021 CFLAGS="$CFLAGS -fpascal-strings -fno-common"
2022 CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
2025 STRIP="$STRIP -x -S"
2026 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
2027 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
2028 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
2029 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
2030 # The ExceptionHandling framework is needed for Objective-C exception
2031 # logging code in nsObjCExceptions.h. Currently we only use that in debug
2033 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
2035 dnl DTrace and -dead_strip don't interact well. See bug 403132.
2036 dnl ===================================================================
2037 if test "x$enable_dtrace" = "xyes"; then
2038 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
2040 dnl check for the presence of the -dead_strip linker flag
2041 AC_MSG_CHECKING([for -dead_strip option to ld])
2042 _SAVE_LDFLAGS=$LDFLAGS
2043 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
2044 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
2045 if test -n "$_HAVE_DEAD_STRIP" ; then
2046 AC_MSG_RESULT([yes])
2047 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
2052 LDFLAGS=$_SAVE_LDFLAGS
2054 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
2058 if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
2059 DLL_SUFFIX=".so.1.0"
2060 DSO_LDOPTS="-shared"
2062 if test ! "$GNU_CC"; then
2063 DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
2069 if test ! "$GNU_CC"; then
2073 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2074 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2075 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2078 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2079 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2083 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2084 AC_DEFINE(_LARGEFILE64_SOURCE)
2089 if test ! "$GNU_CC"; then
2090 DSO_LDOPTS='-b -Wl,+s'
2093 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2094 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2095 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2097 DSO_LDOPTS='-b -E +s'
2098 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2099 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2101 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2102 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2107 DSO_LDOPTS='-elf -shared'
2109 if test "$GNU_CC"; then
2110 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2111 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2112 MKSHLIB_FORCE_ALL='-Wl,-all'
2113 MKSHLIB_UNFORCE_ALL='-Wl,-none'
2114 CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2116 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2117 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2118 MKSHLIB_FORCE_ALL='-all'
2119 MKSHLIB_UNFORCE_ALL='-none'
2125 dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must*
2126 dnl compile and link using -n32
2128 TARGET_COMPILER_ABI=n32
2129 DSO_LDOPTS='-elf -shared'
2130 MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2131 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2132 _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
2133 _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
2134 if test "$GNU_CC"; then
2135 MKSHLIB_FORCE_ALL='-Wl,-all'
2136 MKSHLIB_UNFORCE_ALL='-Wl,-none'
2137 _WARNINGS_CFLAGS="-Wall"
2138 _WARNINGS_CXXFLAGS="-Wall"
2139 CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2141 MKSHLIB_FORCE_ALL='-all'
2142 MKSHLIB_UNFORCE_ALL='-none'
2148 CFLAGS="$CFLAGS -woff 3262 -G 4"
2149 CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
2150 if test -n "$USE_N32"; then
2151 ASFLAGS="$ASFLAGS -n32"
2152 CFLAGS="$CFLAGS -n32"
2153 CXXFLAGS="$CXXFLAGS -n32"
2154 LDFLAGS="$LDFLAGS -n32"
2156 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2157 AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
2160 if test -z "$GNU_CXX"; then
2166 # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2167 # Similarly for GNU_CXX and INTEL_CXX.
2168 if test "$INTEL_CC" -o "$INTEL_CXX"; then
2169 # -Os has been broken on Intel's C/C++ compilers for quite a
2170 # while; Intel recommends against using it.
2171 MOZ_OPTIMIZE_FLAGS="-O2"
2172 MOZ_DEBUG_FLAGS="-g"
2173 elif test "$GNU_CC" -o "$GNU_CXX"; then
2174 GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2175 case $GCC_VERSION in
2177 # -Os is broken on gcc 4.1.x 4.2.x, 4.5.x we need to tweak it to get good results.
2178 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2180 # If we're building with --enable-profiling, we need a frame pointer.
2181 if test -z "$MOZ_PROFILING"; then
2182 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fomit-frame-pointer $MOZ_OPTIMIZE_SIZE_TWEAK"
2184 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-omit-frame-pointer $MOZ_OPTIMIZE_SIZE_TWEAK"
2186 MOZ_DEBUG_FLAGS="-g"
2189 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2191 case "${target_cpu}" in
2193 CFLAGS="$CFLAGS -mieee"
2194 CXXFLAGS="$CXXFLAGS -mieee"
2197 MOZ_DEBUG_FLAGS="-g" # We want inlining
2203 TARGET_COMPILER_ABI=msvc
2204 MOZ_TOOLS_DIR=`echo $MOZ_TOOLS`
2206 AR_EXTRACT="$AR -extract"
2208 AR_FLAGS='-OUT:"$@"'
2215 if test -z "$RC"; then
2218 # certain versions of cygwin's makedepend barf on the
2219 # #include <string> vs -I./dist/include/string issue so don't use it
2225 HOST_AR='lib -OUT:$@'
2226 HOST_RANLIB='echo ranlib'
2227 HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
2230 WARNINGS_AS_ERRORS='-WX'
2231 MOZ_OPTIMIZE_FLAGS='-Ox'
2232 AR_FLAGS='-NOLOGO -OUT:"$@"'
2234 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2235 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2238 DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
2239 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2241 IMPORT_LIB_SUFFIX=lib
2242 dnl Need to force-link against mozalloc because it's used in the shunt
2243 LIBS="$LIBS \$(LIBXUL_DIST)/lib/mozalloc.lib"
2244 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2247 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2248 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2250 MKSHLIB_UNFORCE_ALL=
2251 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2252 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2253 MOZ_DEBUG_FLAGS='-Zi'
2254 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2256 MOZ_JS_LIBS='$(libdir)/mozjs.lib'
2258 RANLIB='echo not_ranlib'
2259 STRIP='echo not_strip'
2260 TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
2263 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2266 AC_DEFINE(HAVE_SNPRINTF)
2271 AC_DEFINE(HW_THREADS)
2272 AC_DEFINE(STDC_HEADERS)
2273 AC_DEFINE(NEW_H, <new>)
2274 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2275 AC_DEFINE(HAVE_LOCALTIME_R)
2277 TARGET_MD_ARCH=win32
2278 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2280 MOZ_USER_DIR="Mozilla"
2282 dnl Default to Windows Mobile components enabled
2283 WINCE_WINDOWS_MOBILE=1
2285 MOZ_ARG_DISABLE_BOOL(windows-mobile-components,
2286 [ --disable-windows-mobile-components
2287 Disable Windows Mobile specific components from
2289 WINCE_WINDOWS_MOBILE=,
2290 WINCE_WINDOWS_MOBILE=1)
2292 if test "$WINCE_WINDOWS_MOBILE"; then
2293 AC_DEFINE(WINCE_WINDOWS_MOBILE)
2302 AC_DEFINE(__SYMBIAN32__)
2305 AC_DEFINE(__SUPPORT_CPP_EXCEPTIONS__)
2306 AC_DEFINE(MOZ_STDERR_TO_STDOUT)
2307 AC_DEFINE(HAVE_FCNTL_FILE_LOCKING)
2308 AC_DEFINE(HAVE_SOCKLEN_T)
2321 TARGET_NSPR_MDCPUCFG='\"md/_symbian.cfg\"'
2322 RANLIB='echo no ranlib '
2325 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2330 # certain versions of cygwin's makedepend barf on the
2331 # #include <string> vs -I./dist/include/string issue so don't use it
2333 if test -n "$GNU_CC"; then
2334 CC="$CC -mno-cygwin"
2335 CXX="$CXX -mno-cygwin"
2336 CPP="$CPP -mno-cygwin"
2337 CFLAGS="$CFLAGS -mms-bitfields"
2338 CXXFLAGS="$CXXFLAGS -mms-bitfields"
2339 DSO_LDOPTS='-shared'
2340 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2341 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2343 # Use temp file for windres (bug 213281)
2344 RCFLAGS='-O coff --use-temp-file'
2345 # mingw doesn't require kernel32, user32, and advapi32 explicitly
2346 LIBS="$LIBS -lgdi32 -lwinmm -lwsock32"
2347 MOZ_JS_LIBS='-L$(libdir) -lmozjs'
2349 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2350 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2352 IMPORT_LIB_SUFFIX=dll.a
2353 GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2355 TARGET_COMPILER_ABI=msvc
2359 if test "$AS_BIN"; then
2360 AS="$(basename "$AS_BIN")"
2362 AR='lib -NOLOGO -OUT:"$@"'
2364 RANLIB='echo not_ranlib'
2365 STRIP='echo not_strip'
2371 GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2377 IMPORT_LIB_SUFFIX=lib
2378 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2379 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2381 MKSHLIB_UNFORCE_ALL=
2382 DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2383 _USE_CPP_INCLUDE_FLAG=1
2384 _DEFINES_CFLAGS='-FI $(DEPTH)/js-confdefs.h -DMOZILLA_CLIENT'
2385 _DEFINES_CXXFLAGS='-FI $(DEPTH)/js-confdefs.h -DMOZILLA_CLIENT'
2386 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2387 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2388 # MSVC warnings C4244 and C4800 are ubiquitous, useless, and annoying.
2389 CXXFLAGS="$CXXFLAGS -wd4244 -wd4800"
2390 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2391 MOZ_DEBUG_FLAGS='-Zi'
2392 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2393 WARNINGS_AS_ERRORS='-WX'
2394 # If we're building with --enable-profiling, we need -Oy-, which forces a frame pointer.
2395 if test -z "$MOZ_PROFILING"; then
2396 MOZ_OPTIMIZE_FLAGS='-O1'
2398 MOZ_OPTIMIZE_FLAGS='-O1 -Oy-'
2400 MOZ_JS_LIBS='$(libdir)/mozjs.lib'
2402 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2403 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2404 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2405 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2406 if test $_MSC_VER -ge 1400; then
2407 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2408 dnl For profile-guided optimization
2409 PROFILE_GEN_CFLAGS="-GL"
2410 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2411 dnl XXX: PGO builds can fail with warnings treated as errors,
2412 dnl specifically "no profile data available" appears to be
2413 dnl treated as an error sometimes. This might be a consequence
2414 dnl of using WARNINGS_AS_ERRORS in some modules, combined
2415 dnl with the linker doing most of the work in the whole-program
2416 dnl optimization/PGO case. I think it's probably a compiler bug,
2417 dnl but we work around it here.
2418 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2419 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2420 dnl Probably also a compiler bug, but what can you do?
2421 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2422 LDFLAGS="$LDFLAGS -DYNAMICBASE"
2425 AC_DEFINE(HAVE_SNPRINTF)
2430 AC_DEFINE(HW_THREADS)
2431 AC_DEFINE(STDC_HEADERS)
2432 AC_DEFINE(NEW_H, <new>)
2433 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2434 TARGET_MD_ARCH=win32
2435 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2437 MOZ_USER_DIR="Mozilla"
2439 dnl Hardcode to win95 for now - cls
2440 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2442 dnl set NO_X11 defines here as the general check is skipped on win32
2446 dnl MinGW/MSYS doesn't provide or need cygpath
2451 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2453 *-cygwin*|*-msvc*|*-mks*)
2454 CYGPATH_W="cygpath -a -w"
2455 CYGPATH_S="sed -e s|\\\\|/|g"
2456 MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2460 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2462 if test -z "$MOZ_TOOLS"; then
2463 AC_MSG_ERROR([MOZ_TOOLS is not set])
2466 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2467 if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2468 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2470 MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2471 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2472 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2474 MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2481 AC_MSG_WARN([Using a cygwin build environment is unsupported. Configure cannot check for the presence of necessary headers. Please upgrade to MozillaBuild; see https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
2487 if test "$HAVE_64BIT_OS"; then
2488 AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2491 if test $_MSC_VER -ge 1400; then
2492 LDFLAGS="$LDFLAGS -SAFESEH"
2494 AC_CHECK_HEADERS(mmintrin.h)
2507 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2511 if test "$HAVE_64BIT_OS"; then
2518 CFLAGS="$CFLAGS -Dunix"
2519 CXXFLAGS="$CXXFLAGS -Dunix"
2520 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2522 DSO_PIC_CFLAGS='-fPIC -DPIC'
2523 DSO_LDOPTS='-shared'
2524 BIN_FLAGS='-Wl,--export-dynamic'
2526 DSO_PIC_CFLAGS='-fPIC -DPIC'
2527 DLL_SUFFIX=".so.1.0"
2528 DSO_LDOPTS='-shared'
2530 # This will fail on a.out systems prior to 1.5.1_ALPHA.
2531 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2532 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2533 if test "$LIBRUNPATH"; then
2534 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2536 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2537 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2542 AC_DEFINE(_QNX_SOURCE)
2545 WARNINGS_AS_ERRORS=''
2546 MOZ_OPTIMIZE_FLAGS="-O"
2547 MOZ_DEBUG_FLAGS="-gstabs"
2550 LIBS="$LIBS -lsocket -lstdc++"
2551 _DEFINES_CFLAGS='-include $(DEPTH)/js-confdefs.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2552 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/js-confdefs.h -D_POSIX_C_SOURCE=199506'
2553 if test "$with_x" != "yes"
2555 _PLATFORM_DEFAULT_TOOLKIT="photon"
2556 TK_CFLAGS='-I/usr/include/photon'
2559 case "${target_cpu}" in
2561 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
2567 DLL_SUFFIX=".so.1.0"
2569 DSO_PIC_CFLAGS='-fPIC'
2570 DSO_LDOPTS='-shared -fPIC'
2571 if test "$LIBRUNPATH"; then
2572 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2577 AC_DEFINE(NO_PW_GECOS)
2578 AC_DEFINE(NO_UDSOCK)
2579 AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2581 MKSHLIB_FORCE_ALL='-all'
2582 MKSHLIB_UNFORCE_ALL='-none'
2584 AS_DASH_C_FLAG='-Wc/names=as_is'
2586 DSO_LDOPTS='-shared -auto_symvec'
2588 MOZ_DEBUG_LDFLAGS='-g'
2590 CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2591 CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2596 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2597 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2600 AC_DEFINE(OS2EMX_PLAIN_CHAR)
2601 AC_DEFINE(TCPV40HDRS)
2607 IMPORT_LIB_SUFFIX=lib
2611 CFLAGS="$CFLAGS -Zomf"
2612 CXXFLAGS="$CXXFLAGS -Zomf"
2614 BIN_FLAGS='-Zlinker /ST:0x100000'
2618 WARNINGS_AS_ERRORS='-Werror'
2619 MOZ_DEBUG_FLAGS="-g -fno-inline"
2620 MOZ_OPTIMIZE_FLAGS="-O2"
2621 MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2622 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2623 LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2625 _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2628 MOZ_USER_DIR="Mozilla"
2630 if test "$MOZTOOLS"; then
2631 MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2633 AC_MSG_ERROR([MOZTOOLS is not set])
2635 if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2636 DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2637 LDFLAGS="$LDFLAGS -Zhigh-mem"
2638 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2639 AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2642 # GCC for OS/2 currently predefines these, but we don't want them
2643 _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2644 _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2646 AC_CACHE_CHECK(for __declspec(dllexport),
2648 [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2650 ac_os2_declspec="yes",
2651 ac_os2_declspec="no")])
2652 if test "$ac_os2_declspec" != "yes"; then
2653 AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
2658 if test "$GNU_CC"; then
2659 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2660 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2663 MOZ_DEBUG_FLAGS='-g'
2664 ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2665 CFLAGS="$CFLAGS -ieee"
2666 CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee -ptr $(DIST)/cxx_repository'
2667 DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2670 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2671 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2672 MKSHLIB_FORCE_ALL='-all'
2673 MKSHLIB_UNFORCE_ALL='-none'
2674 dnl Might fix the libxpcom.so breakage on this platform as well....
2675 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2676 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2678 if test -z "$GNU_CXX"; then
2681 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2685 DIRENT_INO=d_stat.st_ino
2686 dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2687 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2688 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2689 dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2690 AC_DEFINE(STDC_HEADERS)
2691 if test "$no_x" = "yes"; then
2692 _PLATFORM_DEFAULT_TOOLKIT='photon'
2693 TK_CFLAGS='-I/usr/nto/include/photon'
2694 TK_LIBS='-lphoton -lphrender'
2699 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2700 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2701 CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2702 if test ! "$GNU_CC"; then
2709 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2710 if test -z "$CROSS_COMPILE" && pkginfo -q SUNWpr && pkginfo -q SUNWprd; then
2711 NO_NSPR_CONFIG_SYSTEM_LDFLAGS="-L/usr/lib/mps -R/usr/lib/mps -lnspr4"
2712 NO_NSPR_CONFIG_SYSTEM_CFLAGS="-I/usr/include/mps"
2713 NO_NSPR_CONFIG_SYSTEM_VERSION=["`pkgparam SUNWpr SUNW_PRODVERS | sed -e 's/^[1-9][0-9]*\.[0-9][0-9]*$/&.0/'`"]
2717 # $ORIGIN/.. is for shared libraries under components/ to locate shared
2718 # libraries one level up (e.g. libnspr4.so)
2719 if test "$SOLARIS_SUNPRO_CC"; then
2720 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2721 LIBS="-lCrun -lCstd -lc $LIBS"
2723 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2724 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2725 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2726 _MOZ_EXCEPTIONS_FLAGS_ON='-features=except'
2727 _MOZ_EXCEPTIONS_FLAGS_OFF='-features=no%except'
2728 LDFLAGS="-xildoff $LDFLAGS"
2729 if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2730 _SAVE_LDFLAGS=$LDFLAGS
2731 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2732 AC_TRY_LINK([#include <stdio.h>],
2733 [printf("Hello World\n");],
2735 [LDFLAGS=$_SAVE_LDFLAGS])
2737 WARNINGS_AS_ERRORS='-Werror'
2738 MOZ_OPTIMIZE_FLAGS="-xO4"
2739 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2740 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2741 MKSHLIB_FORCE_ALL='-z allextract'
2742 MKSHLIB_UNFORCE_ALL='-z defaultextract'
2749 AS='/usr/ccs/bin/as'
2750 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2752 TARGET_COMPILER_ABI="sunc"
2753 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2754 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2755 AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2759 [#if (__SUNPRO_CC < 0x590)
2762 _BAD_COMPILER=,_BAD_COMPILER=1)
2763 if test -n "$_BAD_COMPILER"; then
2765 AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2770 [#if (__SUNPRO_CC >= 0x5100)
2771 #error "Sun C++ 5.10 or above"
2773 _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2774 if test "$_ABOVE_SS12U1"; then
2776 CXXFLAGS="$CXXFLAGS -xannotate=no"
2778 AC_MSG_RESULT([$_res])
2781 LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2783 MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2784 MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2785 ASFLAGS="$ASFLAGS -fPIC"
2786 DSO_LDOPTS='-shared'
2788 _WARNINGS_CXXFLAGS=''
2789 if test "$OS_RELEASE" = "5.3"; then
2790 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2793 if test "$OS_RELEASE" = "5.5.1"; then
2794 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2799 DSO_LDOPTS='-Bdynamic'
2800 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2801 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2803 AC_DEFINE(SPRINTF_RETURNS_STRING)
2804 case "$(target_os)" in
2806 DLL_SUFFIX='.so.1.0'
2812 NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2816 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2820 AC_DEFINE(NO_PW_GECOS)
2822 _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2823 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2825 MOZ_GFX_OPTIMIZE_MOBILE=1
2826 # If we're building with --enable-profiling, we need a frame pointer.
2827 if test -z "$MOZ_PROFILING"; then
2828 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fomit-frame-pointer"
2830 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fno-omit-frame-pointer"
2836 dnl Only one oddball right now (QNX), but this gives us flexibility
2837 dnl if any other platforms need to override this in the future.
2838 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2840 dnl ========================================================
2841 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2842 dnl by now will not have any way to link most binaries (tests
2843 dnl as well as viewer, apprunner, etc.), because some symbols
2844 dnl will be left out of the "composite" .so's by ld as unneeded.
2845 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2846 dnl they can link in the static libs that provide the missing
2848 dnl ========================================================
2849 NO_LD_ARCHIVE_FLAGS=
2850 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2851 NO_LD_ARCHIVE_FLAGS=1
2855 NO_LD_ARCHIVE_FLAGS=
2858 NO_LD_ARCHIVE_FLAGS=
2861 NO_LD_ARCHIVE_FLAGS=
2863 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince|*-winmo)
2864 if test -z "$GNU_CC"; then
2865 NO_LD_ARCHIVE_FLAGS=
2869 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2871 dnl ========================================================
2872 dnl = Flags to strip unused symbols from .so components
2873 dnl ========================================================
2875 *-linux*|*-kfreebsd*-gnu|*-gnu*)
2876 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2879 if test -z "$GNU_CC"; then
2880 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2882 if test -z "$GCC_USE_GNU_LD"; then
2883 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2885 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2890 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2893 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2895 *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince|*-winmo)
2896 if test -n "$GNU_CC"; then
2897 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2902 if test -z "$COMPILE_ENVIRONMENT"; then
2903 SKIP_COMPILER_CHECKS=1
2904 SKIP_LIBRARY_CHECKS=1
2907 dnl Configure JIT support
2916 ENABLE_POLYIC_GETPROP=1
2917 AC_DEFINE(JS_CPU_X86)
2918 AC_DEFINE(JS_NUNBOX32)
2926 ENABLE_POLYIC_GETPROP=1
2927 AC_DEFINE(JS_CPU_X64)
2928 AC_DEFINE(JS_PUNBOX64)
2936 ENABLE_POLYIC_GETPROP=1
2937 AC_DEFINE(JS_CPU_ARM)
2938 AC_DEFINE(JS_NUNBOX32)
2943 AC_DEFINE(JS_CPU_SPARC)
2947 MOZ_ARG_DISABLE_BOOL(methodjit,
2948 [ --disable-methodjit Disable method JIT support],
2951 MOZ_ARG_DISABLE_BOOL(monoic,
2952 [ --disable-monoic Disable use of MICs by JIT compiler],
2955 MOZ_ARG_DISABLE_BOOL(polyic,
2956 [ --disable-polyic Disable use of PICs by JIT compiler],
2959 MOZ_ARG_DISABLE_BOOL(tracejit,
2960 [ --disable-tracejit Disable tracing JIT support],
2963 MOZ_ARG_ENABLE_BOOL(methodjit-spew,
2964 [ --enable-methodjit-spew Enable method JIT spew support],
2965 ENABLE_METHODJIT_SPEW=1,
2966 ENABLE_METHODJIT_SPEW= )
2968 AC_SUBST(ENABLE_METHODJIT)
2970 if test "$ENABLE_METHODJIT"; then
2971 AC_DEFINE(JS_METHODJIT)
2974 if test "$ENABLE_MONOIC"; then
2975 AC_DEFINE(JS_MONOIC)
2978 if test "$ENABLE_POLYIC"; then
2979 AC_DEFINE(JS_POLYIC)
2982 if test "$ENABLE_POLYIC_GETPROP"; then
2983 AC_DEFINE(JS_POLYIC_GETPROP)
2986 if test "$ENABLE_POLYIC_SETPROP"; then
2987 AC_DEFINE(JS_POLYIC_SETPROP)
2990 if test "$ENABLE_POLYIC_NAME"; then
2991 AC_DEFINE(JS_POLYIC_SETPROP)
2994 if test "$ENABLE_POLYIC_BIND"; then
2995 AC_DEFINE(JS_POLYIC_SETPROP)
2998 if test "$ENABLE_POLYIC_ELEM"; then
2999 AC_DEFINE(JS_POLYIC_ELEM)
3002 if test "$ENABLE_METHODJIT_SPEW"; then
3003 AC_DEFINE(JS_METHODJIT_SPEW)
3006 if test "$ENABLE_TRACEJIT"; then
3008 AC_DEFINE(FEATURE_NANOJIT)
3009 AC_DEFINE(JS_TRACER)
3013 AC_DEFINE(AVMPLUS_IA32)
3016 AC_DEFINE(AVMPLUS_AMD64)
3017 AC_DEFINE(AVMPLUS_64BIT)
3020 AC_DEFINE(AVMPLUS_ARM)
3023 AC_DEFINE(AVMPLUS_SPARC)
3028 *-linux*|*-android-eabi)
3029 AC_DEFINE(AVMPLUS_UNIX)
3030 AC_DEFINE(AVMPLUS_LINUX)
3033 AC_DEFINE(AVMPLUS_UNIX)
3036 AC_DEFINE(AVMPLUS_UNIX)
3038 *-freebsd*|*-kfreebsd*)
3039 AC_DEFINE(AVMPLUS_UNIX)
3042 AC_DEFINE(AVMPLUS_UNIX)
3044 *-cygwin*|*-mingw*|*-mks*|*-msvc*|*-wince|*-winmo)
3045 AC_DEFINE(AVMPLUS_WIN32)
3048 AC_DEFINE(AVMPLUS_OS2)
3051 AC_MSG_ERROR([Unrecognized nanojit platform. Use --disable-tracejit to build without tracing JIT support.])
3054 fi # ENABLE_TRACEJIT
3056 AC_SUBST(ENABLE_TRACEJIT)
3057 AC_SUBST(NANOJIT_ARCH)
3059 if test -z "$SKIP_COMPILER_CHECKS"; then
3060 dnl Checks for typedefs, structures, and compiler characteristics.
3061 dnl ========================================================
3069 AC_MSG_CHECKING(for __stdcall)
3070 AC_CACHE_VAL(ac_cv___stdcall,
3071 [AC_TRY_COMPILE([template <typename Method> struct foo;
3072 template <> struct foo<void (*)()> {};
3073 template <> struct foo<void (__stdcall*)()> {};],
3075 [ac_cv___stdcall=true],
3076 [ac_cv___stdcall=false])])
3077 if test "$ac_cv___stdcall" = true ; then
3078 AC_DEFINE(HAVE_STDCALL)
3084 AC_MSG_CHECKING(for ssize_t)
3085 AC_CACHE_VAL(ac_cv_type_ssize_t,
3086 [AC_TRY_COMPILE([#include <stdio.h>
3087 #include <sys/types.h>],
3089 [ac_cv_type_ssize_t=true],
3090 [ac_cv_type_ssize_t=false])])
3091 if test "$ac_cv_type_ssize_t" = true ; then
3092 AC_DEFINE(HAVE_SSIZE_T)
3097 AC_STRUCT_ST_BLKSIZE
3098 AC_MSG_CHECKING(for siginfo_t)
3099 AC_CACHE_VAL(ac_cv_siginfo_t,
3100 [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
3101 #include <signal.h>],
3103 [ac_cv_siginfo_t=true],
3104 [ac_cv_siginfo_t=false])])
3105 if test "$ac_cv_siginfo_t" = true ; then
3106 AC_DEFINE(HAVE_SIGINFO_T)
3112 dnl Find exact-width integer types, or figure them out
3114 dnl ========================================================
3115 dnl Once this is working, we can delete the code for int16_t,
3118 AC_CHECK_HEADER(stdint.h)
3119 if test "$ac_cv_header_stdint_h" = yes; then
3120 AC_DEFINE(JS_HAVE_STDINT_H)
3122 dnl We'll figure them out for ourselves. List more likely types
3123 dnl earlier. If we ever really encounter a size for which none of
3124 dnl the listed types are appropriate, we'll get a configure-time
3125 dnl error; just add the right answer.
3126 MOZ_N_BYTE_TYPE(JS_INT8_TYPE, 1, [char])
3127 MOZ_N_BYTE_TYPE(JS_INT16_TYPE, 2, [short int long])
3128 MOZ_N_BYTE_TYPE(JS_INT32_TYPE, 4, [int long 'long long' short])
3129 MOZ_N_BYTE_TYPE(JS_INT64_TYPE, 8, [int long 'long long'])
3130 MOZ_N_BYTE_TYPE(JS_INTPTR_TYPE, sizeof (void *),
3131 [int long 'long long' short])
3134 MOZ_SIZE_OF_TYPE(JS_BYTES_PER_WORD, void*, 4 8)
3135 if test "$moz_cv_size_of_JS_BYTES_PER_WORD" -eq "4"; then
3136 AC_DEFINE(JS_BITS_PER_WORD_LOG2, 5)
3137 elif test "$moz_cv_size_of_JS_BYTES_PER_WORD" -eq "8"; then
3138 AC_DEFINE(JS_BITS_PER_WORD_LOG2, 6)
3140 AC_MSG_ERROR([Unexpected JS_BYTES_PER_WORD])
3143 MOZ_ALIGN_OF_TYPE(JS_ALIGN_OF_POINTER, void*, 2 4 8 16)
3144 MOZ_SIZE_OF_TYPE(JS_BYTES_PER_DOUBLE, double, 6 8 10 12 14)
3146 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
3147 dnl ========================================================
3148 AC_MSG_CHECKING(for int16_t)
3149 AC_CACHE_VAL(ac_cv_int16_t,
3150 [AC_TRY_COMPILE([#include <stdio.h>
3151 #include <sys/types.h>],
3153 [ac_cv_int16_t=true],
3154 [ac_cv_int16_t=false])])
3155 if test "$ac_cv_int16_t" = true ; then
3156 AC_DEFINE(HAVE_INT16_T)
3161 AC_MSG_CHECKING(for int32_t)
3162 AC_CACHE_VAL(ac_cv_int32_t,
3163 [AC_TRY_COMPILE([#include <stdio.h>
3164 #include <sys/types.h>],
3166 [ac_cv_int32_t=true],
3167 [ac_cv_int32_t=false])])
3168 if test "$ac_cv_int32_t" = true ; then
3169 AC_DEFINE(HAVE_INT32_T)
3174 AC_MSG_CHECKING(for int64_t)
3175 AC_CACHE_VAL(ac_cv_int64_t,
3176 [AC_TRY_COMPILE([#include <stdio.h>
3177 #include <sys/types.h>],
3179 [ac_cv_int64_t=true],
3180 [ac_cv_int64_t=false])])
3181 if test "$ac_cv_int64_t" = true ; then
3182 AC_DEFINE(HAVE_INT64_T)
3187 AC_MSG_CHECKING(for int64)
3188 AC_CACHE_VAL(ac_cv_int64,
3189 [AC_TRY_COMPILE([#include <stdio.h>
3190 #include <sys/types.h>],
3193 [ac_cv_int64=false])])
3194 if test "$ac_cv_int64" = true ; then
3195 AC_DEFINE(HAVE_INT64)
3200 AC_MSG_CHECKING(for uint)
3201 AC_CACHE_VAL(ac_cv_uint,
3202 [AC_TRY_COMPILE([#include <stdio.h>
3203 #include <sys/types.h>],
3206 [ac_cv_uint=false])])
3207 if test "$ac_cv_uint" = true ; then
3208 AC_DEFINE(HAVE_UINT)
3213 AC_MSG_CHECKING(for uint_t)
3214 AC_CACHE_VAL(ac_cv_uint_t,
3215 [AC_TRY_COMPILE([#include <stdio.h>
3216 #include <sys/types.h>],
3218 [ac_cv_uint_t=true],
3219 [ac_cv_uint_t=false])])
3220 if test "$ac_cv_uint_t" = true ; then
3221 AC_DEFINE(HAVE_UINT_T)
3226 AC_MSG_CHECKING(for uint16_t)
3227 AC_CACHE_VAL(ac_cv_uint16_t,
3228 [AC_TRY_COMPILE([#include <stdio.h>
3229 #include <sys/types.h>],
3230 [uint16_t foo = 0;],
3231 [ac_cv_uint16_t=true],
3232 [ac_cv_uint16_t=false])])
3233 if test "$ac_cv_uint16_t" = true ; then
3234 AC_DEFINE(HAVE_UINT16_T)
3240 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
3241 dnl are defined when compiling C++ but not C. Since the result of this
3242 dnl test is used only in C++, do it in C++.
3245 AC_MSG_CHECKING(for uname.domainname)
3246 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
3247 [AC_TRY_COMPILE([#include <sys/utsname.h>],
3248 [ struct utsname *res; char *domain;
3249 (void)uname(res); if (res != 0) { domain = res->domainname; } ],
3250 [ac_cv_have_uname_domainname_field=true],
3251 [ac_cv_have_uname_domainname_field=false])])
3253 if test "$ac_cv_have_uname_domainname_field" = "true"; then
3254 AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
3260 AC_MSG_CHECKING(for uname.__domainname)
3261 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
3262 [AC_TRY_COMPILE([#include <sys/utsname.h>],
3263 [ struct utsname *res; char *domain;
3264 (void)uname(res); if (res != 0) { domain = res->__domainname; } ],
3265 [ac_cv_have_uname_us_domainname_field=true],
3266 [ac_cv_have_uname_us_domainname_field=false])])
3268 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
3269 AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
3277 dnl Check for .hidden assembler directive and visibility attribute.
3278 dnl Borrowed from glibc configure.in
3279 dnl ===============================================================
3280 if test "$GNU_CC"; then
3281 AC_CACHE_CHECK(for visibility(hidden) attribute,
3282 ac_cv_visibility_hidden,
3283 [cat > conftest.c <<EOF
3284 int foo __attribute__ ((visibility ("hidden"))) = 1;
3286 ac_cv_visibility_hidden=no
3287 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3288 if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3289 ac_cv_visibility_hidden=yes
3294 if test "$ac_cv_visibility_hidden" = "yes"; then
3295 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
3297 AC_CACHE_CHECK(for visibility(default) attribute,
3298 ac_cv_visibility_default,
3299 [cat > conftest.c <<EOF
3300 int foo __attribute__ ((visibility ("default"))) = 1;
3302 ac_cv_visibility_default=no
3303 if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3304 if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3305 ac_cv_visibility_default=yes
3310 if test "$ac_cv_visibility_default" = "yes"; then
3311 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
3313 AC_CACHE_CHECK(for visibility pragma support,
3314 ac_cv_visibility_pragma,
3315 [cat > conftest.c <<EOF
3316 #pragma GCC visibility push(hidden)
3318 #pragma GCC visibility push(default)
3319 int foo_default = 1;
3321 ac_cv_visibility_pragma=no
3322 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3323 if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
3324 if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
3325 ac_cv_visibility_pragma=yes
3331 if test "$ac_cv_visibility_pragma" = "yes"; then
3332 AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
3333 ac_cv_have_visibility_class_bug,
3334 [cat > conftest.c <<EOF
3335 #pragma GCC visibility push(hidden)
3336 struct __attribute__ ((visibility ("default"))) TestStruct {
3339 __attribute__ ((visibility ("default"))) void TestFunc() {
3343 ac_cv_have_visibility_class_bug=no
3344 if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3345 ac_cv_have_visibility_class_bug=yes
3347 if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
3348 ac_cv_have_visibility_class_bug=yes
3351 rm -rf conftest.{c,S}
3354 AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
3355 ac_cv_have_visibility_builtin_bug,
3356 [cat > conftest.c <<EOF
3357 #pragma GCC visibility push(hidden)
3358 #pragma GCC visibility push(default)
3360 #pragma GCC visibility pop
3362 __attribute__ ((visibility ("default"))) void Func() {
3364 memset(c, 0, sizeof(c));
3367 ac_cv_have_visibility_builtin_bug=no
3368 if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3369 ac_cv_have_visibility_builtin_bug=yes
3371 if test `grep -c "@PLT" conftest.S` = 0; then
3372 ac_cv_visibility_builtin_bug=yes
3375 rm -f conftest.{c,S}
3377 if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
3378 "$ac_cv_have_visibility_class_bug" = "no"; then
3379 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers_js -include $(topsrcdir)/config/gcc_hidden.h'
3380 WRAP_SYSTEM_INCLUDES=1
3381 STL_FLAGS='-I$(DIST)/stl_wrappers'
3384 VISIBILITY_FLAGS='-fvisibility=hidden'
3385 fi # have visibility pragma bug
3386 fi # have visibility pragma
3387 fi # have visibility(default) attribute
3388 fi # have visibility(hidden) attribute
3391 # visibility hidden flag for Sun Studio on Solaris
3392 if test "$SOLARIS_SUNPRO_CC"; then
3393 VISIBILITY_FLAGS='-xldscope=hidden'
3394 fi # Sun Studio on Solaris
3396 AC_SUBST(WRAP_SYSTEM_INCLUDES)
3397 AC_SUBST(VISIBILITY_FLAGS)
3399 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
3400 dnl ========================================================
3401 if test "$GNU_CC"; then
3402 CFLAGS_save="${CFLAGS}"
3403 CFLAGS="${CFLAGS} -Werror"
3404 AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
3405 ac_cv_force_align_arg_pointer,
3406 [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
3408 ac_cv_force_align_arg_pointer="yes",
3409 ac_cv_force_align_arg_pointer="no")])
3410 CFLAGS="${CFLAGS_save}"
3411 if test "$ac_cv_force_align_arg_pointer" = "yes"; then
3412 HAVE_GCC_ALIGN_ARG_POINTER=1
3414 HAVE_GCC_ALIGN_ARG_POINTER=
3417 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
3419 dnl Checks for header files.
3420 dnl ========================================================
3422 case "$target_os" in
3424 # for stuff like -lXshm
3425 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3428 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
3429 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
3430 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
3431 AC_CHECK_HEADERS(malloc.h)
3432 AC_CHECK_HEADERS(X11/XKBlib.h)
3433 AC_CHECK_HEADERS(io.h)
3435 dnl These are all the places some variant of statfs can be hiding.
3436 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3439 AC_CHECK_HEADERS(sys/quota.h)
3440 AC_CHECK_HEADERS(linux/quota.h)
3442 dnl Try for MMX support
3443 dnl NB - later gcc versions require -mmmx for this header to be successfully
3444 dnl included (or another option which implies it, such as -march=pentium-mmx)
3445 AC_CHECK_HEADERS(mmintrin.h)
3447 dnl Check whether the compiler supports the new-style C++ standard
3448 dnl library headers (i.e. <new>) or needs the old "new.h"
3451 AC_CHECK_HEADER(new, [NEW_H=new])
3452 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3455 AC_ARG_ENABLE(dtrace,
3456 [ --enable-dtrace build with dtrace support if available (default=no)],
3457 [enable_dtrace="yes"],)
3458 if test "x$enable_dtrace" = "xyes"; then
3459 AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3460 if test -n "$HAVE_DTRACE"; then
3461 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3463 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3466 AC_SUBST(HAVE_DTRACE)
3472 AC_CHECK_HEADERS(sys/cdefs.h)
3476 dnl Performance measurement headers.
3477 AC_CHECK_HEADER(linux/perf_event.h, HAVE_LINUX_PERF_EVENT_H=1)
3478 AC_SUBST(HAVE_LINUX_PERF_EVENT_H)
3480 dnl Checks for libraries.
3481 dnl ========================================================
3486 AC_CHECK_LIB(c_r, gethostbyname_r)
3490 dnl We don't want to link with libdl even if it's present on OS X, since
3491 dnl it's not used and not part of the default installation.
3492 dnl The same goes for BeOS. OS/2 has dlfcn in libc.
3493 dnl We don't want to link against libm or libpthread on Darwin since
3494 dnl they both are just symlinks to libSystem and explicitly linking
3495 dnl against libSystem causes issues when debugging (see bug 299601).
3504 AC_SEARCH_LIBS(dlopen, dl,
3505 AC_CHECK_HEADER(dlfcn.h,
3506 AC_DEFINE(HAVE_DLOPEN)))
3510 _SAVE_CFLAGS="$CFLAGS"
3511 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3512 AC_CHECK_FUNCS(dladdr)
3513 CFLAGS="$_SAVE_CFLAGS"
3515 if test ! "$GNU_CXX"; then
3519 AC_CHECK_LIB(C_r, demangle)
3522 AC_CHECK_LIB(C, demangle)
3527 dnl OS/2 has socket in libc.
3532 AC_CHECK_LIB(socket, socket)
3535 AC_MSG_CHECKING(for ARM SIMD support in compiler)
3537 [asm("uqadd8 r1, r1, r2");],
3538 result="yes", result="no")
3539 AC_MSG_RESULT("$result")
3540 if test "$result" = "yes"; then
3541 AC_DEFINE(HAVE_ARM_SIMD)
3544 AC_SUBST(HAVE_ARM_SIMD)
3546 AC_MSG_CHECKING(for ARM NEON support in compiler)
3547 _SAVE_CFLAGS="$CFLAGS"
3548 if test "$GNU_CC"; then
3549 # gcc needs -mfpu=neon to recognize NEON instructions
3550 CFLAGS="$CFLAGS -mfpu=neon -mfloat-abi=softfp"
3553 [asm("vadd.i8 d0, d0, d0");],
3554 result="yes", result="no")
3555 AC_MSG_RESULT("$result")
3556 if test "$result" = "yes"; then
3557 AC_DEFINE(HAVE_ARM_NEON)
3560 CFLAGS="$_SAVE_CFLAGS"
3561 AC_SUBST(HAVE_ARM_NEON)
3563 dnl ========================================================
3564 dnl = pthread support
3565 dnl = Start by checking whether the system support pthreads
3566 dnl ========================================================
3567 case "$target_os" in
3572 MOZ_CHECK_PTHREADS(pthreads,
3573 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3574 MOZ_CHECK_PTHREADS(pthread,
3575 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3576 MOZ_CHECK_PTHREADS(c_r,
3577 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3578 MOZ_CHECK_PTHREADS(c,
3587 dnl ========================================================
3588 dnl Check the command line for --with-pthreads
3589 dnl ========================================================
3590 MOZ_ARG_WITH_BOOL(pthreads,
3591 [ --with-pthreads Force use of system pthread library with NSPR ],
3592 [ if test "$USE_PTHREADS"x = x; then
3593 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3599 dnl ========================================================
3600 dnl Do the platform specific pthread hackery
3601 dnl ========================================================
3602 if test "$USE_PTHREADS"x != x
3605 dnl See if -pthread is supported.
3608 ac_cv_have_dash_pthread=no
3609 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3610 echo 'int main() { return 0; }' | cat > conftest.c
3611 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3612 if test $? -eq 0; then
3613 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3614 ac_cv_have_dash_pthread=yes
3615 case "$target_os" in
3617 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3620 CFLAGS="$CFLAGS -pthread"
3621 CXXFLAGS="$CXXFLAGS -pthread"
3627 AC_MSG_RESULT($ac_cv_have_dash_pthread)
3630 dnl See if -pthreads is supported.
3632 ac_cv_have_dash_pthreads=no
3633 if test "$ac_cv_have_dash_pthread" = "no"; then
3634 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3635 echo 'int main() { return 0; }' | cat > conftest.c
3636 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3637 if test $? -eq 0; then
3638 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3639 ac_cv_have_dash_pthreads=yes
3640 CFLAGS="$CFLAGS -pthreads"
3641 CXXFLAGS="$CXXFLAGS -pthreads"
3645 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3650 AC_DEFINE(_REENTRANT)
3651 AC_DEFINE(_THREAD_SAFE)
3652 dnl -pthread links in -lc_r, so don't specify it explicitly.
3653 if test "$ac_cv_have_dash_pthread" = "yes"; then
3654 _PTHREAD_LDFLAGS="-pthread"
3656 _PTHREAD_LDFLAGS="-lc_r"
3660 *-*-openbsd*|*-*-bsdi*)
3661 AC_DEFINE(_REENTRANT)
3662 AC_DEFINE(_THREAD_SAFE)
3663 dnl -pthread links in -lc_r, so don't specify it explicitly.
3664 if test "$ac_cv_have_dash_pthread" = "yes"; then
3665 _PTHREAD_LDFLAGS="-pthread"
3669 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3670 AC_DEFINE(_REENTRANT)
3674 AC_DEFINE(_REENTRANT)
3678 AC_DEFINE(_REENTRANT)
3682 AC_DEFINE(_REENTRANT)
3686 AC_DEFINE(_REENTRANT)
3690 AC_DEFINE(_REENTRANT)
3691 if test "$SOLARIS_SUNPRO_CC"; then
3692 CFLAGS="$CFLAGS -mt"
3693 CXXFLAGS="$CXXFLAGS -mt"
3697 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3700 dnl ========================================================
3701 dnl See if mmap sees writes
3702 dnl For cross compiling, just define it as no, which is a safe default
3703 dnl ========================================================
3704 AC_MSG_CHECKING(whether mmap() sees write()s)
3710 #include <sys/mman.h>
3711 #include <sys/types.h>
3712 #include <sys/stat.h>
3715 char fname[] = "conftest.file";
3716 char zbuff[1024]; /* Fractional page is probably worst case */
3723 fd = open(fname, O_RDWR | O_CREAT, 0660);
3726 write(fd, zbuff, sizeof(zbuff));
3727 lseek(fd, 0, SEEK_SET);
3728 map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3729 if(map==(char*)-1) return 2;
3730 for(i=0; fname[i]; i++) {
3731 int rc = write(fd, &fname[i], 1);
3732 if(map[i]!=fname[i]) return 4;
3739 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3741 AC_MSG_RESULT("$result")
3743 if test "$result" = "no"; then
3744 AC_DEFINE(MMAP_MISSES_WRITES)
3748 dnl Checks for library functions.
3749 dnl ========================================================
3750 AC_PROG_GCC_TRADITIONAL
3752 AC_CHECK_FUNCS([fchmod flockfile getc_unlocked _getc_nolock getpagesize \
3753 lchown localtime_r lstat64 memmove random rint sbrk snprintf \
3754 stat64 statvfs statvfs64 strerror strtok_r truncate64])
3756 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock, and -lrt
3757 _SAVE_LDFLAGS=$LDFLAGS
3758 LDFLAGS="$LDFLAGS -lrt"
3759 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC) and -lrt,
3760 ac_cv_have_clock_monotonic,
3761 [AC_TRY_LINK([#include <time.h>],
3762 [ struct timespec ts;
3763 clock_gettime(CLOCK_MONOTONIC, &ts); ],
3764 ac_cv_have_clock_monotonic=yes,
3765 ac_cv_have_clock_monotonic=no)])
3766 LDFLAGS=$_SAVE_LDFLAGS
3767 if test "$ac_cv_have_clock_monotonic" = "yes"; then
3768 HAVE_CLOCK_MONOTONIC=1
3770 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3771 AC_SUBST(HAVE_CLOCK_MONOTONIC)
3772 AC_SUBST(REALTIME_LIBS)
3775 dnl Windows functions, for mingw.
3776 AC_TRY_LINK([#include <windows.h>],
3777 [SYSTEMTIME st;FILETIME ft;SystemTimeToFileTime(&st,&ft);],
3778 ac_cv_have_systemtimetofiletime="yes",
3779 ac_cv_have_systemtimetofiletime="no")
3780 if test "$ac_cv_have_systemtimetofiletime" = "yes"; then
3781 AC_DEFINE(HAVE_SYSTEMTIMETOFILETIME)
3783 AC_TRY_LINK([#include <windows.h>],
3784 [FILETIME ft;GetSystemTimeAsFileTime(&ft);],
3785 ac_cv_have_getsystemtimeasfiletime="yes",
3786 ac_cv_have_getsystemtimeasfiletime="no")
3787 if test "$ac_cv_have_getsystemtimeasfiletime" = "yes"; then
3788 AC_DEFINE(HAVE_GETSYSTEMTIMEASFILETIME)
3791 dnl check for wcrtomb/mbrtowc
3792 dnl =======================================================================
3793 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3796 AC_CACHE_CHECK(for wcrtomb,
3798 [AC_TRY_LINK([#include <wchar.h>],
3799 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3800 ac_cv_have_wcrtomb="yes",
3801 ac_cv_have_wcrtomb="no")])
3802 if test "$ac_cv_have_wcrtomb" = "yes"; then
3803 AC_DEFINE(HAVE_WCRTOMB)
3805 AC_CACHE_CHECK(for mbrtowc,
3807 [AC_TRY_LINK([#include <wchar.h>],
3808 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3809 ac_cv_have_mbrtowc="yes",
3810 ac_cv_have_mbrtowc="no")])
3811 if test "$ac_cv_have_mbrtowc" = "yes"; then
3812 AC_DEFINE(HAVE_MBRTOWC)
3819 ac_cv_func_res_ninit,
3822 #define _BSD_SOURCE 1
3826 [int foo = res_ninit(&_res);],
3827 [ac_cv_func_res_ninit=yes],
3828 [ac_cv_func_res_ninit=no])
3831 if test "$ac_cv_func_res_ninit" = "yes"; then
3832 AC_DEFINE(HAVE_RES_NINIT)
3833 dnl must add the link line we do something as foolish as this... dougt
3835 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3836 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3841 [for gnu_get_libc_version()],
3842 ac_cv_func_gnu_get_libc_version,
3844 #ifdef HAVE_GNU_LIBC_VERSION_H
3845 #include <gnu/libc-version.h>
3848 [const char *glibc_version = gnu_get_libc_version();],
3849 [ac_cv_func_gnu_get_libc_version=yes],
3850 [ac_cv_func_gnu_get_libc_version=no]
3854 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3855 AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3859 os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|winmo*|beos*)
3863 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3864 AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3865 AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3867 LIBS="$LIBS $_ICONV_LIBS"
3876 iconv_t h = iconv_open("", "");
3877 iconv(h, NULL, NULL, NULL, NULL);
3880 [ac_cv_func_iconv=yes],
3881 [ac_cv_func_iconv=no]
3884 if test "$ac_cv_func_iconv" = "yes"; then
3885 AC_DEFINE(HAVE_ICONV)
3886 DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3887 LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3888 LIBICONV="$_ICONV_LIBS"
3890 [for iconv() with const input],
3891 ac_cv_func_const_iconv,
3897 const char *input = "testing";
3898 iconv_t h = iconv_open("", "");
3899 iconv(h, &input, NULL, NULL, NULL);
3902 [ac_cv_func_const_iconv=yes],
3903 [ac_cv_func_const_iconv=no]
3906 if test "$ac_cv_func_const_iconv" = "yes"; then
3907 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3917 dnl **********************
3918 dnl *** va_copy checks ***
3919 dnl **********************
3920 dnl we currently check for all three va_copy possibilities, so we get
3921 dnl all results in config.log for bug reports.
3922 AC_MSG_CHECKING(for an implementation of va_copy())
3923 AC_CACHE_VAL(ac_cv_va_copy,[
3926 void f (int i, ...) {
3927 va_list args1, args2;
3928 va_start (args1, i);
3929 va_copy (args2, args1);
3930 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3932 va_end (args1); va_end (args2);
3934 int main() { f (0, 42); return 0; }],
3940 AC_MSG_RESULT($ac_cv_va_copy)
3941 AC_MSG_CHECKING(for an implementation of __va_copy())
3942 AC_CACHE_VAL(ac_cv___va_copy,[
3945 void f (int i, ...) {
3946 va_list args1, args2;
3947 va_start (args1, i);
3948 __va_copy (args2, args1);
3949 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3951 va_end (args1); va_end (args2);
3953 int main() { f (0, 42); return 0; }],
3954 ac_cv___va_copy=yes,
3959 AC_MSG_RESULT($ac_cv___va_copy)
3960 AC_MSG_CHECKING(whether va_lists can be copied by value)
3961 AC_CACHE_VAL(ac_cv_va_val_copy,[
3964 void f (int i, ...) {
3965 va_list args1, args2;
3966 va_start (args1, i);
3968 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3970 va_end (args1); va_end (args2);
3972 int main() { f (0, 42); return 0; }],
3973 ac_cv_va_val_copy=yes,
3974 ac_cv_va_val_copy=no,
3975 ac_cv_va_val_copy=yes
3978 if test "x$ac_cv_va_copy" = "xyes"; then
3979 AC_DEFINE(VA_COPY, va_copy)
3980 AC_DEFINE(HAVE_VA_COPY)
3981 elif test "x$ac_cv___va_copy" = "xyes"; then
3982 AC_DEFINE(VA_COPY, __va_copy)
3983 AC_DEFINE(HAVE_VA_COPY)
3986 if test "x$ac_cv_va_val_copy" = "xno"; then
3987 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3989 AC_MSG_RESULT($ac_cv_va_val_copy)
3991 dnl Check for dll-challenged libc's.
3992 dnl This check is apparently only needed for Linux.
3995 dnl ===================================================================
3998 rm -rf conftest* _conftest
4000 cat >> conftest.C <<\EOF
4005 void __dump_link_map(void) {
4006 struct link_map *map = _dl_loaded;
4007 while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
4010 dlopen("./conftest1.so",RTLD_LAZY);
4011 dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
4012 dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
4013 dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
4017 /* _dl_loaded isn't defined, so this should be either a libc5 (glibc1) system, or a glibc2 system that doesn't have the multiple load bug (i.e., RH6.0).*/
4018 int main() { printf("./conftest1.so\n"); }
4022 $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
4024 cat >> conftest1.C <<\EOF
4026 void foo(void) {printf("foo in dll called\n");}
4028 ${CXX-g++} -fPIC -c -g conftest1.C
4029 ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
4030 ${CXX-g++} -g conftest.C -o conftest -ldl
4031 cp -f conftest1.so conftest _conftest
4033 if test `./conftest | grep conftest1.so | wc -l` -gt 1
4036 echo "*** Your libc has a bug that can result in loading the same dynamic"
4037 echo "*** library multiple times. This bug is known to be fixed in glibc-2.0.7-32"
4038 echo "*** or later. However, if you choose not to upgrade, the only effect"
4039 echo "*** will be excessive memory usage at runtime."
4043 rm -rf conftest* _conftest
4044 dnl ===================================================================
4048 dnl ===================================================================
4049 dnl ========================================================
4050 dnl Put your C++ language/feature checks below
4051 dnl ========================================================
4056 if test "$GNU_CC"; then
4057 if test "$CPU_ARCH" = "arm" ; then
4058 AC_CACHE_CHECK(for ARM EABI,
4062 #if defined(__ARM_EABI__)
4065 #error Not ARM EABI.
4068 ac_cv_gcc_arm_eabi="yes",
4069 ac_cv_gcc_arm_eabi="no")])
4070 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
4072 ARM_ABI_PREFIX=eabi-
4074 ARM_ABI_PREFIX=oabi-
4078 AC_CACHE_CHECK(for gcc 3.0 ABI,
4079 ac_cv_gcc_three_abi,
4082 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
4088 ac_cv_gcc_three_abi="yes",
4089 ac_cv_gcc_three_abi="no")])
4090 if test "$ac_cv_gcc_three_abi" = "yes"; then
4091 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
4094 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc2}"
4097 AC_SUBST(HAVE_GCC3_ABI)
4100 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
4102 [AC_TRY_COMPILE(class X {
4103 public: explicit X(int i) : i_(i) {}
4107 ac_cv_cpp_explicit=yes,
4108 ac_cv_cpp_explicit=no)])
4109 if test "$ac_cv_cpp_explicit" = yes ; then
4110 AC_DEFINE(HAVE_CPP_EXPLICIT)
4113 AC_CACHE_CHECK(for C++ \"typename\" keyword,
4115 [AC_TRY_COMPILE(class param {
4117 typedef unsigned long num_type;
4120 template <class T> class tplt {
4122 typedef typename T::num_type t_num_type;
4123 t_num_type foo(typename T::num_type num) {
4129 ac_cv_cpp_typename=yes,
4130 ac_cv_cpp_typename=no)])
4131 if test "$ac_cv_cpp_typename" = yes ; then
4132 AC_DEFINE(HAVE_CPP_TYPENAME)
4135 dnl Check for support of modern template specialization syntax
4136 dnl Test code and requirement from scc@netscape.com.
4137 dnl Autoconf cut-and-paste job by waterson@netscape.com
4138 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
4139 ac_cv_cpp_modern_specialize_template_syntax,
4140 [AC_TRY_COMPILE(template <class T> struct X { int a; };
4142 template <> struct X<Y> { double a; };,
4145 ac_cv_cpp_modern_specialize_template_syntax=yes,
4146 ac_cv_cpp_modern_specialize_template_syntax=no)])
4147 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
4148 AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
4152 dnl Some compilers support only full specialization, and some don't.
4153 AC_CACHE_CHECK(whether partial template specialization works,
4154 ac_cv_cpp_partial_specialization,
4155 [AC_TRY_COMPILE(template <class T> class Foo {};
4156 template <class T> class Foo<T*> {};,
4158 ac_cv_cpp_partial_specialization=yes,
4159 ac_cv_cpp_partial_specialization=no)])
4160 if test "$ac_cv_cpp_partial_specialization" = yes ; then
4161 AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
4164 dnl Some compilers have limited support for operators with templates;
4165 dnl specifically, it is necessary to define derived operators when a base
4166 dnl class's operator declaration should suffice.
4167 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
4168 ac_cv_need_derived_template_operators,
4169 [AC_TRY_COMPILE([template <class T> class Base { };
4171 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
4172 template <class T> class Derived : public Base<T> { };],
4173 [Derived<char> a, b;
4174 Base<char> c = a + b;
4176 ac_cv_need_derived_template_operators=no,
4177 ac_cv_need_derived_template_operators=yes)])
4178 if test "$ac_cv_need_derived_template_operators" = yes ; then
4179 AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
4183 dnl Some compilers have trouble detecting that a template class
4184 dnl that derives from another template is actually an instance
4185 dnl of the base class. This test checks for that.
4186 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
4187 ac_cv_need_cpp_template_cast_to_base,
4188 [AC_TRY_COMPILE([template <class T> class Base { };
4189 template <class T> class Derived : public Base<T> { };
4190 template <class T> int foo(const Base<T>&) { return 0; }],
4191 [Derived<char> bar; return foo(bar);],
4192 ac_cv_need_cpp_template_cast_to_base=no,
4193 ac_cv_need_cpp_template_cast_to_base=yes)])
4194 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
4195 AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
4198 dnl Some compilers have trouble resolving the ambiguity between two
4199 dnl functions whose arguments differ only by cv-qualifications.
4200 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
4201 ac_cv_can_resolve_const_ambiguity,
4203 template <class T> class ptrClass {
4207 template <class T> T* a(ptrClass<T> *arg) {
4212 const T* a(const ptrClass<T> *arg) {
4218 ac_cv_can_resolve_const_ambiguity=yes,
4219 ac_cv_can_resolve_const_ambiguity=no)])
4220 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
4221 AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
4225 dnl We don't do exceptions on unix. The only reason this used to be here
4226 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses
4227 dnl exceptions. But, we turn exceptions off by default and this test breaks.
4228 dnl So im commenting this out until someone writes some artificial
4229 dnl intelligence to detect not only if the compiler has exceptions, but if
4230 dnl they are enabled as well.
4232 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
4233 dnl ac_cv_cpp_exceptions,
4234 dnl [AC_TRY_COMPILE(class X { public: X() {} };
4235 dnl static void F() { throw X(); },
4236 dnl try { F(); } catch(X & e) { },
4237 dnl ac_cv_cpp_exceptions=yes,
4238 dnl ac_cv_cpp_exceptions=no)])
4239 dnl if test $ac_cv_cpp_exceptions = yes ; then
4240 dnl AC_DEFINE(HAVE_CPP_EXCEPTIONS)
4243 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
4244 dnl supports it well enough to allow us to use it to change access, but not
4245 dnl to resolve ambiguity. The next two tests determine how well the |using|
4246 dnl keyword is supported.
4248 dnl Check to see if we can change access with |using|. Test both a
4249 dnl legal and an illegal example.
4250 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
4251 ac_cv_cpp_access_changing_using2,
4253 class A { protected: int foo() { return 0; } };
4254 class B : public A { public: using A::foo; };,
4255 B b; return b.foo();,
4257 class A { public: int foo() { return 1; } };
4258 class B : public A { private: using A::foo; };,
4259 B b; return b.foo();,
4260 ac_cv_cpp_access_changing_using2=no,
4261 ac_cv_cpp_access_changing_using2=yes)],
4262 ac_cv_cpp_access_changing_using2=no)])
4263 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
4264 AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
4267 dnl Check to see if we can resolve ambiguity with |using|.
4268 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
4269 ac_cv_cpp_ambiguity_resolving_using,
4270 [AC_TRY_COMPILE(class X {
4271 public: int go(const X&) {return 3;}
4272 int jo(const X&) {return 3;}
4274 class Y : public X {
4275 public: int go(int) {return 2;}
4276 int jo(int) {return 2;}
4278 private: using X::go;
4281 ac_cv_cpp_ambiguity_resolving_using=yes,
4282 ac_cv_cpp_ambiguity_resolving_using=no)])
4283 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
4284 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
4287 dnl Check to see if the |std| namespace is supported. If so, we'll want
4288 dnl to qualify any standard library calls with "std::" to ensure that
4289 dnl those functions can be resolved.
4290 AC_CACHE_CHECK(for \"std::\" namespace,
4291 ac_cv_cpp_namespace_std,
4292 [AC_TRY_COMPILE([#include <algorithm>],
4293 [return std::min(0, 1);],
4294 ac_cv_cpp_namespace_std=yes,
4295 ac_cv_cpp_namespace_std=no)])
4296 if test "$ac_cv_cpp_namespace_std" = yes ; then
4297 AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
4300 dnl Older compilers are overly ambitious with respect to using the standard
4301 dnl template library's |operator!=()| when |operator==()| is defined. In
4302 dnl which case, defining |operator!=()| in addition to |operator==()| causes
4303 dnl ambiguity at compile-time. This test checks for that case.
4304 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
4305 ac_cv_cpp_unambiguous_std_notequal,
4306 [AC_TRY_COMPILE([#include <algorithm>
4308 int operator==(const T1&, const T1&) { return 0; }
4309 int operator!=(const T1&, const T1&) { return 0; }],
4310 [T1 a,b; return a != b;],
4311 ac_cv_cpp_unambiguous_std_notequal=unambiguous,
4312 ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
4313 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
4314 AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
4318 AC_CACHE_CHECK(for C++ reinterpret_cast,
4319 ac_cv_cpp_reinterpret_cast,
4320 [AC_TRY_COMPILE(struct X { int i; };
4321 struct Y { int i; };,
4322 X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
4323 ac_cv_cpp_reinterpret_cast=yes,
4324 ac_cv_cpp_reinterpret_cast=no)])
4325 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
4326 AC_DEFINE(HAVE_CPP_NEW_CASTS)
4329 dnl See if a dynamic_cast to void* gives the most derived object.
4330 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
4331 ac_cv_cpp_dynamic_cast_void_ptr,
4332 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
4333 class Y { int j; public: virtual ~Y() { } };
4334 class Z : public X, public Y { int k; };
4340 return !((((void*)&mdo != (void*)subx) &&
4341 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
4342 (((void*)&mdo != (void*)suby) &&
4343 ((void*)&mdo == dynamic_cast<void*>(suby))));
4345 ac_cv_cpp_dynamic_cast_void_ptr=yes,
4346 ac_cv_cpp_dynamic_cast_void_ptr=no,
4347 ac_cv_cpp_dynamic_cast_void_ptr=no)])
4348 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
4349 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
4353 dnl note that this one is reversed - if the test fails, then
4354 dnl we require implementations of unused virtual methods. Which
4355 dnl really blows because it means we'll have useless vtable
4357 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
4358 ac_cv_cpp_unused_required,
4359 [AC_TRY_LINK(class X {private: virtual void never_called();};,
4361 ac_cv_cpp_unused_required=no,
4362 ac_cv_cpp_unused_required=yes)])
4363 if test "$ac_cv_cpp_unused_required" = yes ; then
4364 AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
4368 dnl Some compilers have trouble comparing a constant reference to a templatized
4369 dnl class to zero, and require an explicit operator==() to be defined that takes
4370 dnl an int. This test separates the strong from the weak.
4372 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
4373 ac_cv_trouble_comparing_to_zero,
4374 [AC_TRY_COMPILE([#include <algorithm>
4375 template <class T> class Foo {};
4377 template <class T> int operator==(const T2*, const T&) { return 0; }
4378 template <class T> int operator!=(const T2*, const T&) { return 0; }],
4379 [Foo<int> f; return (0 != f);],
4380 ac_cv_trouble_comparing_to_zero=no,
4381 ac_cv_trouble_comparing_to_zero=yes)])
4382 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
4383 AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
4386 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
4387 _SAVE_LDFLAGS=$LDFLAGS
4388 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS"
4389 AC_CACHE_CHECK(for __thread keyword for TLS variables,
4390 ac_cv_thread_keyword,
4391 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
4392 [return tlsIsMainThread;],
4393 ac_cv_thread_keyword=yes,
4394 ac_cv_thread_keyword=no)])
4395 LDFLAGS=$_SAVE_LDFLAGS
4396 if test "$ac_cv_thread_keyword" = yes; then
4397 # mips builds fail with TLS variables because of a binutils bug.
4407 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
4412 dnl Check for the existence of various allocation headers/functions
4415 AC_CHECK_HEADER(malloc.h, [MALLOC_H=malloc.h])
4416 if test "$MALLOC_H" = ""; then
4417 AC_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
4418 if test "$MALLOC_H" = ""; then
4419 AC_CHECK_HEADER(sys/malloc.h, [MALLOC_H=sys/malloc.h])
4422 if test "$MALLOC_H" != ""; then
4423 AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
4426 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
4427 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
4429 dnl See if compiler supports some gcc-style attributes
4431 AC_CACHE_CHECK(for __attribute__((always_inline)),
4432 ac_cv_attribute_always_inline,
4434 [inline void f(void) __attribute__((always_inline));],
4435 ac_cv_attribute_always_inline=yes,
4436 ac_cv_attribute_always_inline=no)])
4438 AC_CACHE_CHECK(for __attribute__((malloc)),
4439 ac_cv_attribute_malloc,
4441 [void* f(int) __attribute__((malloc));],
4442 ac_cv_attribute_malloc=yes,
4443 ac_cv_attribute_malloc=no)])
4445 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
4446 ac_cv_attribute_warn_unused,
4448 [int f(void) __attribute__((warn_unused_result));],
4449 ac_cv_attribute_warn_unused=yes,
4450 ac_cv_attribute_warn_unused=no)])
4452 AC_CACHE_CHECK(for __attribute__((noreturn)),
4453 ac_cv_attribute_noreturn,
4455 [void f(void) __attribute__((noreturn));],
4456 ac_cv_attribute_noreturn=yes,
4457 ac_cv_attribute_noreturn=no)])
4459 dnl End of C++ language/feature checks
4462 dnl ========================================================
4463 dnl = Internationalization checks
4464 dnl ========================================================
4466 dnl Internationalization and Locale support is different
4467 dnl on various UNIX platforms. Checks for specific i18n
4468 dnl features go here.
4470 dnl check for LC_MESSAGES
4471 AC_CACHE_CHECK(for LC_MESSAGES,
4472 ac_cv_i18n_lc_messages,
4473 [AC_TRY_COMPILE([#include <locale.h>],
4474 [int category = LC_MESSAGES;],
4475 ac_cv_i18n_lc_messages=yes,
4476 ac_cv_i18n_lc_messages=no)])
4477 if test "$ac_cv_i18n_lc_messages" = yes; then
4478 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4481 AC_HAVE_FUNCS(localeconv)
4483 fi # SKIP_COMPILER_CHECKS
4486 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4487 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4490 dnl Mozilla specific options
4491 dnl ========================================================
4492 dnl The macros used for command line options
4493 dnl are defined in build/autoconf/altoptions.m4.
4495 dnl If the compiler supports these attributes, define them as
4496 dnl convenience macros.
4497 if test "$ac_cv_attribute_always_inline" = yes ; then
4498 AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
4500 AC_DEFINE(NS_ALWAYS_INLINE,)
4503 if test "$ac_cv_attribute_malloc" = yes ; then
4504 AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
4506 AC_DEFINE(NS_ATTR_MALLOC,)
4509 if test "$ac_cv_attribute_warn_unused" = yes ; then
4510 AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
4512 AC_DEFINE(NS_WARN_UNUSED_RESULT,)
4515 if test "$ac_cv_attribute_noreturn" = yes ; then
4516 AC_DEFINE(NS_NORETURN, [__attribute__((noreturn))])
4518 AC_DEFINE(NS_NORETURN,)
4521 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
4522 dnl features that Windows actually does support.
4524 if test -n "$SKIP_COMPILER_CHECKS"; then
4525 dnl Windows has malloc.h
4526 AC_DEFINE(MALLOC_H, [<malloc.h>])
4527 AC_DEFINE(HAVE_FORCEINLINE)
4528 AC_DEFINE(HAVE_LOCALECONV)
4529 fi # SKIP_COMPILER_CHECKS
4531 dnl ========================================================
4533 dnl = Check for external package dependencies
4535 dnl ========================================================
4536 MOZ_ARG_HEADER(External Packages)
4538 dnl ========================================================
4539 dnl = Find the right NSPR to use.
4540 dnl ========================================================
4541 MOZ_ARG_WITH_BOOL(system-nspr,
4542 [ --with-system-nspr Use an NSPR that is already built and installed.
4543 Use the 'nspr-config' script in the current path,
4544 or look for the script in the directories given with
4545 --with-nspr-exec-prefix or --with-nspr-prefix.
4546 (Those flags are only checked if you specify
4547 --with-system-nspr.)],
4548 _USE_SYSTEM_NSPR=1 )
4550 MOZ_ARG_WITH_STRING(nspr-cflags,
4551 [ --with-nspr-cflags=FLAGS
4552 Pass FLAGS to CC when building code that uses NSPR.
4553 Use this when there's no accurate nspr-config
4554 script available. This is the case when building
4555 SpiderMonkey as part of the Mozilla tree: the
4556 top-level configure script computes NSPR flags
4557 that accomodate the quirks of that environment.],
4558 NSPR_CFLAGS=$withval)
4559 MOZ_ARG_WITH_STRING(nspr-libs,
4560 [ --with-nspr-libs=LIBS Pass LIBS to LD when linking code that uses NSPR.
4561 See --with-nspr-cflags for more details.],
4563 AC_SUBST(NSPR_CFLAGS)
4566 dnl Pass either --with-system-nspr or (--with-nspr-cflags and
4567 dnl --with-nspr-libs), but not both.
4568 if test "$_USE_SYSTEM_NSPR" && (test "$NSPR_CFLAGS" -o "$NSPR_LIBS"); then
4569 AC_MSG_ERROR([--with-system-nspr and --with-nspr-libs/cflags are mutually exclusive.
4570 See 'configure --help'.])
4573 dnl Top-level Mozilla switched to requiring NSPR 4.8.6 (bug 560582), but we don't need it in JS.
4574 if test -n "$_USE_SYSTEM_NSPR"; then
4576 AM_PATH_NSPR(4.7.0, [MOZ_NATIVE_NSPR=1])
4577 if test -z "$MOZ_NATIVE_NSPR"; then
4578 AC_MSG_ERROR([--with-system-nspr given, but configure could not find a suitable NSPR.
4579 Pass --with-nspr-exec-prefix, --with-nspr-prefix, or --with-nspr-cflags/libs.
4580 See 'configure --help'.])
4584 if test -n "$MOZ_NATIVE_NSPR"; then
4585 _SAVE_CFLAGS=$CFLAGS
4586 CFLAGS="$CFLAGS $NSPR_CFLAGS"
4587 AC_TRY_COMPILE([#include "prlog.h"],
4588 [#ifndef PR_STATIC_ASSERT
4589 #error PR_STATIC_ASSERT not defined
4591 [MOZ_NATIVE_NSPR=1],
4592 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
4593 CFLAGS=$_SAVE_CFLAGS
4596 dnl ========================================================
4600 dnl ========================================================
4602 MOZ_ARG_HEADER(Application)
4617 dnl ========================================================
4618 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4619 dnl their usage and use them in spidermonkey.
4620 dnl ========================================================
4621 MOZ_ARG_WITH_BOOL(arm-kuser,
4622 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4624 if test -n "$USE_ARM_KUSER"; then
4625 AC_DEFINE(USE_ARM_KUSER)
4628 dnl ========================================================
4630 dnl = Components & Features
4632 dnl ========================================================
4633 MOZ_ARG_HEADER(Components and Features)
4635 dnl ========================================================
4637 dnl ========================================================
4638 MOZ_ARG_ENABLE_STRING(ui-locale,
4639 [ --enable-ui-locale=ab-CD
4640 Select the user interface locale (default: en-US)],
4641 MOZ_UI_LOCALE=$enableval )
4642 AC_SUBST(MOZ_UI_LOCALE)
4644 dnl ========================================================
4645 dnl build the tests by default
4646 dnl ========================================================
4647 MOZ_ARG_DISABLE_BOOL(tests,
4648 [ --disable-tests Do not build test libraries & programs],
4652 dnl ========================================================
4654 dnl = Module specific options
4656 dnl ========================================================
4657 MOZ_ARG_HEADER(Individual module options)
4659 dnl ========================================================
4660 dnl = Enable building the Thumb2 instruction set
4661 dnl ========================================================
4662 MOZ_ARG_ENABLE_BOOL(thumb2,
4663 [ --enable-thumb2 Enable Thumb2 instruction set],
4667 if test -n "$MOZ_THUMB2"; then
4668 case "$target_cpu" in
4670 if test "$GNU_CC"; then
4671 AC_DEFINE(MOZ_THUMB2)
4672 CFLAGS="$CFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
4673 CXXFLAGS="$CXXFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
4674 ASFLAGS="$ASFLAGS -march=armv7-a -mthumb"
4676 AC_MSG_ERROR([--enable-thumb2 is not supported for non-GNU toolchains])
4680 AC_MSG_ERROR([--enable-thumb2 is not supported for non-ARM CPU architectures])
4684 case "$target_cpu" in
4686 if test "$GNU_CC"; then
4687 CFLAGS="$CFLAGS -march=armv5te -mthumb-interwork -Wa, -march=armv5te -Wa, -mthumb-interwork"
4688 CXXFLAGS="$CXXFLAGS -march=armv5te -mthumb-interwork -Wa, -march=armv5te -Wa, -mthumb-interwork"
4689 ASFLAGS="$ASFLAGS -march=armv5te -mthumb-interwork"
4695 AC_SUBST(MOZ_THUMB2)
4697 dnl ========================================================
4699 dnl = Debugging Options
4701 dnl ========================================================
4702 MOZ_ARG_HEADER(Debugging and Optimizations)
4704 dnl ========================================================
4705 dnl = Disable building with debug info.
4706 dnl = Debugging is OFF by default
4707 dnl ========================================================
4708 if test -z "$MOZ_DEBUG_FLAGS"; then
4709 MOZ_DEBUG_FLAGS="-g"
4712 MOZ_ARG_ENABLE_STRING(debug,
4713 [ --enable-debug[=DBG] Enable building with developer debug info
4714 (using compiler flags DBG)],
4715 [ if test "$enableval" != "no"; then
4717 if test -n "$enableval" -a "$enableval" != "yes"; then
4718 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
4719 _MOZ_DEBUG_FLAGS_SET=1
4726 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
4727 MOZ_ARG_WITH_STRING(debug-label,
4728 [ --with-debug-label=LABELS
4729 Define DEBUG_<value> for each comma-separated
4731 [ for option in `echo $withval | sed 's/,/ /g'`; do
4732 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
4735 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
4737 if test -n "$MOZ_DEBUG"; then
4738 AC_MSG_CHECKING([for valid debug flags])
4739 _SAVE_CFLAGS=$CFLAGS
4740 CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
4741 AC_TRY_COMPILE([#include <stdio.h>],
4742 [printf("Hello World\n");],
4745 AC_MSG_RESULT([$_results])
4746 if test "$_results" = "no"; then
4747 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
4749 CFLAGS=$_SAVE_CFLAGS
4752 dnl ========================================================
4753 dnl = Enable code optimization. ON by default.
4754 dnl ========================================================
4755 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
4756 MOZ_OPTIMIZE_FLAGS="-O"
4759 MOZ_ARG_ENABLE_STRING(optimize,
4760 [ --disable-optimize Disable compiler optimization
4761 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
4762 [ if test "$enableval" != "no"; then
4764 if test -n "$enableval" -a "$enableval" != "yes"; then
4765 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
4770 fi ], MOZ_OPTIMIZE=1)
4772 if test "$COMPILE_ENVIRONMENT"; then
4773 if test -n "$MOZ_OPTIMIZE"; then
4774 AC_MSG_CHECKING([for valid optimization flags])
4775 _SAVE_CFLAGS=$CFLAGS
4776 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
4777 AC_TRY_COMPILE([#include <stdio.h>],
4778 [printf("Hello World\n");],
4781 AC_MSG_RESULT([$_results])
4782 if test "$_results" = "no"; then
4783 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
4785 CFLAGS=$_SAVE_CFLAGS
4787 fi # COMPILE_ENVIRONMENT
4789 AC_SUBST(MOZ_OPTIMIZE)
4790 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
4791 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
4792 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
4794 dnl ========================================================
4795 dnl = (Deprecated) generation of debugger info for specific modules
4796 dnl ========================================================
4797 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
4798 [ --enable-debugger-info-modules
4799 Enable/disable debugger info for specific modules],
4800 [ if test "$enableval" != "no"; then
4801 AC_MSG_WARN([--enable-debugger-info-modules is deprecated, use --enable-debug-symbols instead])
4805 dnl ========================================================
4806 dnl = Enable generation of debug symbols
4807 dnl ========================================================
4808 MOZ_ARG_ENABLE_STRING(debug-symbols,
4809 [ --enable-debug-symbols[=DBG]
4810 Enable debugging symbols (using compiler flags DBG)],
4811 [ if test "$enableval" != "no"; then
4813 if test -n "$enableval" -a "$enableval" != "yes"; then
4814 if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
4815 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
4817 AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
4822 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
4823 AC_DEFINE(MOZ_DEBUG_SYMBOLS)
4824 export MOZ_DEBUG_SYMBOLS
4827 dnl ========================================================
4828 dnl = Disable any treating of compile warnings as errors
4829 dnl ========================================================
4830 MOZ_ARG_DISABLE_BOOL(warnings-as-errors,
4831 [ --disable-warnings-as-errors
4832 Disable treating of warnings as errors],
4833 MOZ_DISABLE_WARNINGS_AS_ERRORS=1,
4834 MOZ_DISABLE_WARNINGS_AS_ERRORS= )
4835 if test "$MOZ_DISABLE_WARNINGS_AS_ERRORS"; then
4836 WARNINGS_AS_ERRORS=''
4839 dnl = Enable trace malloc
4840 dnl ========================================================
4841 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
4842 MOZ_ARG_ENABLE_BOOL(trace-malloc,
4843 [ --enable-trace-malloc Enable malloc tracing],
4846 if test "$NS_TRACE_MALLOC"; then
4847 # Please, Mr. Linker Man, don't take away our symbol names
4848 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
4849 AC_DEFINE(NS_TRACE_MALLOC)
4851 AC_SUBST(NS_TRACE_MALLOC)
4853 dnl ========================================================
4854 dnl = Enable jemalloc
4855 dnl ========================================================
4856 MOZ_ARG_ENABLE_BOOL(jemalloc,
4857 [ --enable-jemalloc Replace memory allocator with jemalloc],
4861 if test "$NS_TRACE_MALLOC"; then
4865 if test "$MOZ_MEMORY"; then
4867 dnl Don't try to run compiler tests on Windows
4868 if test "$OS_ARCH" = "WINNT"; then
4869 if test -z "$HAVE_64BIT_OS"; then
4870 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
4872 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
4875 AC_CHECK_SIZEOF([int *], [4])
4876 case "${ac_cv_sizeof_int_p}" in
4878 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
4881 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
4884 AC_MSG_ERROR([Unexpected pointer size])
4889 AC_DEFINE(MOZ_MEMORY)
4890 if test "x$MOZ_DEBUG" = "x1"; then
4891 AC_DEFINE(MOZ_MEMORY_DEBUG)
4893 dnl The generic feature tests that determine how to compute ncpus are long and
4894 dnl complicated. Therefore, simply define special cpp variables for the
4895 dnl platforms we have special knowledge of.
4898 AC_DEFINE(MOZ_MEMORY_DARWIN)
4901 AC_DEFINE(MOZ_MEMORY_BSD)
4904 AC_DEFINE(MOZ_MEMORY_LINUX)
4907 AC_DEFINE(MOZ_MEMORY_BSD)
4910 AC_DEFINE(MOZ_MEMORY_SOLARIS)
4912 *-msvc*|*-mks*|*-cygwin*|*-mingw*)
4913 AC_DEFINE(MOZ_MEMORY_WINDOWS)
4914 # the interesting bits will get passed down in MOZ_MEMORY_LDFLAGS
4917 AC_DEFINE(MOZ_MEMORY_WINCE)
4918 AC_DEFINE(MOZ_MEMORY_WINDOWS)
4919 if test -z "$WINCE_WINDOWS_MOBILE"; then
4920 AC_DEFINE(MOZ_MEMORY_WINCE6)
4924 AC_DEFINE(MOZ_MEMORY_WINCE)
4925 AC_DEFINE(MOZ_MEMORY_WINDOWS)
4928 AC_DEFINE(MOZ_MEMORY_LINUX)
4929 AC_DEFINE(MOZ_MEMORY_ANDROID)
4932 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
4936 if test "$OS_ARCH" != "Darwin"; then
4937 dnl NB: this must be kept in sync with jemalloc.h
4938 AC_DEFINE(HAVE_JEMALLOC_VALLOC)
4939 AC_DEFINE(HAVE_JEMALLOC_POSIX_MEMALIGN)
4940 AC_DEFINE(HAVE_JEMALLOC_MEMALIGN)
4943 AC_SUBST(MOZ_MEMORY)
4944 AC_SUBST(MOZ_MEMORY_LDFLAGS)
4946 dnl ========================================================
4947 dnl = Use malloc wrapper lib
4948 dnl ========================================================
4949 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
4950 [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)],
4954 if test -n "$_WRAP_MALLOC"; then
4955 if test "$GNU_CC"; then
4956 WRAP_MALLOC_CFLAGS="${LDFLAGS} -Wl,--wrap -Wl,malloc -Wl,--wrap -Wl,calloc -Wl,--wrap -Wl,valloc -Wl,--wrap -Wl,free -Wl,--wrap -Wl,realloc -Wl,--wrap -Wl,memalign -Wl,--wrap -Wl,__builtin_new -Wl,--wrap -Wl,__builtin_vec_new -Wl,--wrap -Wl,__builtin_delete -Wl,--wrap -Wl,__builtin_vec_delete -Wl,--wrap -Wl,PR_Free -Wl,--wrap -Wl,PR_Malloc -Wl,--wrap -Wl,PR_Calloc -Wl,--wrap -Wl,PR_Realloc -Wl,--wrap -Wl,strdup -Wl,--wrap -Wl,strndup -Wl,--wrap -Wl,posix_memalign"
4957 MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) $(WRAP_MALLOC_LIB) -o $@'
4961 dnl ========================================================
4962 dnl = Location of malloc wrapper lib
4963 dnl ========================================================
4964 MOZ_ARG_WITH_STRING(wrap-malloc,
4965 [ --with-wrap-malloc=DIR Location of malloc wrapper library],
4966 WRAP_MALLOC_LIB=$withval)
4968 dnl ========================================================
4969 dnl = Use JS Call tracing
4970 dnl ========================================================
4971 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
4972 [ --enable-trace-jscalls Enable JS call enter/exit callback (default=no)],
4973 MOZ_TRACE_JSCALLS=1,
4974 MOZ_TRACE_JSCALLS= )
4975 if test -n "$MOZ_TRACE_JSCALLS"; then
4976 AC_DEFINE(MOZ_TRACE_JSCALLS)
4979 dnl ========================================================
4981 dnl ========================================================
4982 MOZ_ARG_ENABLE_BOOL(tracevis,
4983 [ --enable-tracevis Enable TraceVis tracing tool (default=no)],
4986 if test -n "$MOZ_TRACEVIS"; then
4987 AC_DEFINE(MOZ_TRACEVIS)
4988 if test -z "$ENABLE_TRACEJIT"; then
4989 AC_MSG_ERROR([--enable-tracevis is incompatible with --disable-tracejit])
4993 dnl ========================================================
4995 dnl ========================================================
4996 MOZ_ARG_ENABLE_BOOL(gctimer,
4997 [ --enable-gctimer Enable GC timer (default=no)],
5000 if test -n "$MOZ_GCTIMER"; then
5001 AC_DEFINE(MOZ_GCTIMER)
5004 dnl ========================================================
5006 dnl ========================================================
5007 MOZ_ARG_ENABLE_BOOL(valgrind,
5008 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
5011 if test -n "$MOZ_VALGRIND"; then
5012 AC_CHECK_HEADER([valgrind/valgrind.h], [],
5014 [--enable-valgrind specified but Valgrind is not installed]))
5015 AC_DEFINE(MOZ_VALGRIND)
5018 dnl ========================================================
5020 dnl ========================================================
5021 MOZ_ARG_ENABLE_BOOL(jprof,
5022 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
5025 if test -n "$MOZ_JPROF"; then
5027 AC_DEFINE(MOZ_JPROF)
5030 dnl ========================================================
5032 dnl ========================================================
5033 MOZ_ARG_ENABLE_BOOL(shark,
5034 [ --enable-shark Enable shark remote profiling (needs CHUD framework). Implies --enable-profiling.],
5037 if test -n "$MOZ_SHARK"; then
5039 AC_DEFINE(MOZ_SHARK)
5042 dnl ========================================================
5044 dnl ========================================================
5045 MOZ_ARG_ENABLE_BOOL(callgrind,
5046 [ --enable-callgrind Enable callgrind profiling],
5049 if test -n "$MOZ_CALLGRIND"; then
5050 AC_DEFINE(MOZ_CALLGRIND)
5053 dnl ========================================================
5055 dnl ========================================================
5056 MOZ_ARG_ENABLE_BOOL(vtune,
5057 [ --enable-vtune Enable vtune profiling. Implies --enable-profiling.],
5060 if test -n "$MOZ_VTUNE"; then
5062 AC_DEFINE(MOZ_VTUNE)
5065 dnl ========================================================
5066 dnl Zealous JavaScript GC
5067 dnl ========================================================
5068 MOZ_ARG_ENABLE_BOOL(gczeal,
5069 [ --enable-gczeal Enable zealous GCing],
5072 if test -n "$JS_GC_ZEAL"; then
5073 AC_DEFINE(JS_GC_ZEAL)
5076 dnl ======================================================
5077 dnl = Enable compiling with ccache
5078 dnl ======================================================
5079 MOZ_ARG_WITH_STRING(ccache,
5080 [ --with-ccache[=path/to/ccache]
5081 Enable compiling with ccache],
5082 CCACHE=$withval, CCACHE="no")
5084 if test "$CCACHE" != "no"; then
5085 if test -z "$CCACHE" -o "$CCACHE" = "yes"; then
5088 if test ! -e "$CCACHE"; then
5089 AC_MSG_ERROR([$CCACHE not found])
5092 MOZ_PATH_PROGS(CCACHE, $CCACHE ccache)
5093 if test -z "$CCACHE" -o "$CCACHE" = ":"; then
5094 AC_MSG_ERROR([ccache not found])
5095 elif test -x "$CCACHE"; then
5099 AC_MSG_ERROR([$CCACHE is not executable])
5103 dnl ========================================================
5104 dnl = Enable static checking using gcc-dehydra
5105 dnl ========================================================
5107 MOZ_ARG_WITH_STRING(static-checking,
5108 [ --with-static-checking=path/to/gcc_dehydra.so
5109 Enable static checking of code using GCC-dehydra],
5110 DEHYDRA_PATH=$withval,
5113 if test -n "$DEHYDRA_PATH"; then
5114 if test ! -f "$DEHYDRA_PATH"; then
5115 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
5117 AC_DEFINE(NS_STATIC_CHECKING)
5119 AC_SUBST(DEHYDRA_PATH)
5121 dnl ========================================================
5122 dnl = Enable stripping of libs & executables
5123 dnl ========================================================
5124 MOZ_ARG_ENABLE_BOOL(strip,
5125 [ --enable-strip Enable stripping of libs & executables ],
5129 dnl ========================================================
5130 dnl = Enable stripping of libs & executables when packaging
5131 dnl ========================================================
5132 MOZ_ARG_ENABLE_BOOL(install-strip,
5133 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
5137 dnl ========================================================
5139 dnl = Profiling and Instrumenting
5141 dnl ========================================================
5142 MOZ_ARG_HEADER(Profiling and Instrumenting)
5144 dnl ========================================================
5145 dnl = Enable timeline service, which provides lightweight
5146 dnl = instrumentation of mozilla for performance measurement.
5147 dnl = Timeline is off by default.
5148 dnl ========================================================
5149 MOZ_ARG_ENABLE_BOOL(timeline,
5150 [ --enable-timeline Enable timeline services ],
5153 if test -n "$MOZ_TIMELINE"; then
5154 AC_DEFINE(MOZ_TIMELINE)
5157 dnl ========================================================
5158 dnl = Support for Quantify (Windows)
5159 dnl ========================================================
5160 MOZ_ARG_ENABLE_BOOL(quantify,
5161 [ --enable-quantify Enable Quantify support (Windows only) ],
5165 dnl ========================================================
5166 dnl = Support for demangling undefined symbols
5167 dnl ========================================================
5168 if test -z "$SKIP_LIBRARY_CHECKS"; then
5171 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
5175 # Demangle only for debug or trace-malloc builds
5176 MOZ_DEMANGLE_SYMBOLS=
5177 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
5178 MOZ_DEMANGLE_SYMBOLS=1
5179 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
5181 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
5183 dnl ========================================================
5184 dnl = Support for gcc stack unwinding (from gcc 3.3)
5185 dnl ========================================================
5186 if test "$HAVE_GCC3_ABI" -a -z "$SKIP_LIBRARY_CHECKS"; then
5187 AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
5190 dnl ========================================================
5194 dnl ========================================================
5195 MOZ_ARG_HEADER(Misc. Options)
5197 dnl ========================================================
5198 dnl update xterm title
5199 dnl ========================================================
5200 MOZ_ARG_ENABLE_BOOL(xterm-updates,
5201 [ --enable-xterm-updates Update XTERM titles with current command.],
5205 if test -z "$SKIP_COMPILER_CHECKS"; then
5206 dnl ========================================================
5208 dnl = Compiler Options
5210 dnl ========================================================
5211 MOZ_ARG_HEADER(Compiler Options)
5213 dnl ========================================================
5214 dnl Check for gcc -pipe support
5215 dnl ========================================================
5216 AC_MSG_CHECKING([for gcc -pipe support])
5217 if test -n "$GNU_CC" -a -n "$GNU_CXX" -a -n "$GNU_AS"; then
5218 echo '#include <stdio.h>' > dummy-hello.c
5219 echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
5220 ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
5221 cat dummy-hello.s 2> /dev/null | ${AS_BIN} -o dummy-hello.S - 2>&5
5222 if test $? = 0; then
5227 if test "$_res_as_stdin" = "yes"; then
5228 _SAVE_CFLAGS=$CFLAGS
5229 CFLAGS="$CFLAGS -pipe"
5230 AC_TRY_COMPILE( [ #include <stdio.h> ],
5231 [printf("Hello World\n");],
5232 [_res_gcc_pipe="yes"],
5233 [_res_gcc_pipe="no"] )
5234 CFLAGS=$_SAVE_CFLAGS
5236 if test "$_res_as_stdin" = "yes" -a "$_res_gcc_pipe" = "yes"; then
5238 CFLAGS="$CFLAGS -pipe"
5239 CXXFLAGS="$CXXFLAGS -pipe"
5243 rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
5244 AC_MSG_RESULT([$_res])
5249 dnl ========================================================
5250 dnl Profile guided optimization
5251 dnl ========================================================
5252 dnl Test for profiling options
5253 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
5255 dnl Provide a switch to disable PGO even when called via profiledbuild.
5256 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
5257 [ --disable-profile-guided-optimization
5258 Don't build with PGO even if called via make profiledbuild],
5259 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
5260 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
5262 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
5264 _SAVE_CFLAGS="$CFLAGS"
5265 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
5267 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
5268 AC_TRY_COMPILE([], [return 0;],
5269 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
5270 result="yes" ], result="no")
5271 AC_MSG_RESULT([$result])
5273 if test $result = "yes"; then
5274 PROFILE_GEN_LDFLAGS="-fprofile-generate"
5275 PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch -freorder-blocks-and-partition"
5276 PROFILE_USE_LDFLAGS="-fprofile-use"
5279 CFLAGS="$_SAVE_CFLAGS"
5281 if test -n "$INTEL_CC"; then
5282 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
5283 PROFILE_GEN_LDFLAGS=
5284 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
5285 PROFILE_USE_LDFLAGS=
5288 dnl Sun Studio on Solaris
5289 if test "$SOLARIS_SUNPRO_CC"; then
5290 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
5291 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
5292 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
5293 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
5296 AC_SUBST(PROFILE_GEN_CFLAGS)
5297 AC_SUBST(PROFILE_GEN_LDFLAGS)
5298 AC_SUBST(PROFILE_USE_CFLAGS)
5299 AC_SUBST(PROFILE_USE_LDFLAGS)
5303 dnl ========================================================
5304 dnl Test for -pedantic bustage
5305 dnl ========================================================
5306 MOZ_ARG_DISABLE_BOOL(pedantic,
5307 [ --disable-pedantic Issue all warnings demanded by strict ANSI C ],
5309 if test "$_PEDANTIC"; then
5310 _SAVE_CXXFLAGS=$CXXFLAGS
5311 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
5312 AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
5313 AC_TRY_COMPILE([$configure_static_assert_macros],
5314 [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
5315 result="no", result="yes" )
5316 AC_MSG_RESULT([$result])
5317 CXXFLAGS="$_SAVE_CXXFLAGS"
5321 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
5322 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
5325 AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic. Reconfigure using --disable-pedantic. ])
5330 dnl ========================================================
5331 dnl Test for correct temporary object destruction order
5332 dnl ========================================================
5333 dnl We want to make sure the compiler follows the C++ spec here as
5334 dnl xpcom and the string classes depend on it (bug 235381).
5335 AC_MSG_CHECKING([for correct temporary object destruction order])
5336 AC_TRY_RUN([ class A {
5337 public: A(int& x) : mValue(x) {}
5339 operator char**() { return 0; }
5340 private: int& mValue;
5342 void func(char **arg) {}
5353 result="yes", result="no", result="maybe")
5354 AC_MSG_RESULT([$result])
5356 if test "$result" = "no"; then
5357 AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
5360 dnl ========================================================
5361 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
5362 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
5363 dnl raw pointers in nsCOMPtr.h. (VC++ has the same bug.)
5364 dnl ========================================================
5365 _SAVE_CXXFLAGS=$CXXFLAGS
5366 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
5367 AC_CACHE_CHECK(for correct overload resolution with const and templates,
5368 ac_nscap_nonconst_opeq_bug,
5377 template <class T, class U>
5378 int operator==(const Pointer<T>& rhs, U* lhs)
5380 return rhs.myPtr == lhs;
5383 template <class T, class U>
5384 int operator==(const Pointer<T>& rhs, const U* lhs)
5386 return rhs.myPtr == lhs;
5394 ac_nscap_nonconst_opeq_bug="no",
5395 ac_nscap_nonconst_opeq_bug="yes")])
5396 CXXFLAGS="$_SAVE_CXXFLAGS"
5398 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
5399 AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
5402 dnl ========================================================
5403 dnl Check for tm_zone, tm_gmtoff in struct tm
5404 dnl ========================================================
5405 AC_CACHE_CHECK(for tm_zone tm_gmtoff in struct tm,
5406 ac_cv_struct_tm_zone_tm_gmtoff,
5407 [AC_TRY_COMPILE([#include <time.h>],
5408 [struct tm tm; tm.tm_zone = 0; tm.tm_gmtoff = 1;],
5409 [ac_cv_struct_tm_zone_tm_gmtoff="yes"],
5410 [ac_cv_struct_tm_zone_tm_gmtoff="no"])])
5411 if test "$ac_cv_struct_tm_zone_tm_gmtoff" = "yes" ; then
5412 AC_DEFINE(HAVE_TM_ZONE_TM_GMTOFF)
5415 fi # SKIP_COMPILER_CHECKS
5417 dnl ========================================================
5419 dnl Should be smarter and check that the compiler does indeed have rtti
5420 dnl ========================================================
5421 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
5422 [ --enable-cpp-rtti Enable C++ RTTI ],
5423 [ _MOZ_USE_RTTI=1 ],
5426 if test "$_MOZ_USE_RTTI"; then
5427 _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
5429 _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
5432 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
5434 dnl ========================================================
5435 dnl C++ exceptions (g++/VC/irix6/Sun only - for now)
5436 dnl Should be smarter and check that the compiler does indeed have exceptions
5437 dnl ========================================================
5438 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
5439 [ --enable-cpp-exceptions Enable C++ exceptions ],
5440 [ _MOZ_CPP_EXCEPTIONS=1 ],
5441 [ _MOZ_CPP_EXCEPTIONS= ])
5443 if test "$_MOZ_CPP_EXCEPTIONS"; then
5444 _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
5445 AC_DEFINE(MOZ_CPP_EXCEPTIONS)
5447 _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
5450 AC_SUBST(_MOZ_EXCEPTIONS_FLAGS_ON)
5452 # Irix & OSF native compilers do not like exception declarations
5453 # when exceptions are disabled
5454 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
5455 AC_DEFINE(CPP_THROW_NEW, [])
5457 AC_DEFINE(CPP_THROW_NEW, [throw()])
5461 dnl ========================================================
5463 dnl = Build depencency options
5465 dnl ========================================================
5466 MOZ_ARG_HEADER(Build dependencies)
5468 dnl ========================================================
5469 dnl = Do not auto generate dependency info
5470 dnl ========================================================
5472 MOZ_ARG_DISABLE_BOOL(auto-deps,
5473 [ --disable-auto-deps Do not automatically generate dependency info],
5477 if test -n "$MOZ_AUTO_DEPS"; then
5478 dnl ========================================================
5479 dnl = Use mkdepend instead of $CC -MD for dependency generation
5480 dnl ========================================================
5482 MOZ_ARG_DISABLE_BOOL(md,
5483 [ --disable-md Do not use compiler-based dependencies ],
5486 [dnl Default is to turn on -MD if using GNU-compatible compilers
5487 if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
5490 dnl Default is to use -xM if using Sun Studio on Solaris
5491 if test "$SOLARIS_SUNPRO_CC"; then
5494 if test "$_cpp_md_flag"; then
5496 if test "$OS_ARCH" = "OpenVMS"; then
5497 _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
5499 _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(basename $(@F)).pp)'
5501 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
5502 if test "$SOLARIS_SUNPRO_CC"; then
5507 dnl Don't override this for MSVC
5508 if test -z "$_WIN32_MSVC"; then
5509 _USE_CPP_INCLUDE_FLAG=
5510 _DEFINES_CFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
5511 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
5513 echo '#include <stdio.h>' > dummy-hello.c
5515 CL_INCLUDES_PREFIX=`"${CC}" -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
5517 if test -z "$CL_INCLUDES_PREFIX"; then
5518 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
5520 AC_SUBST(CL_INCLUDES_PREFIX)
5522 _topsrcdirwin=`cd \`dirname $0\`; pwd -W`
5523 dnl cl.py provides dependency generation for MSVC
5524 CC_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"
5525 CXX_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"
5531 AC_SUBST(MOZ_AUTO_DEPS)
5532 AC_SUBST(COMPILER_DEPEND)
5534 AC_SUBST(CC_WRAPPER)
5535 AC_SUBST(CXX_WRAPPER)
5538 dnl ========================================================
5540 dnl = Static Build Options
5542 dnl ========================================================
5543 MOZ_ARG_HEADER(Static build options)
5545 MOZ_ARG_ENABLE_BOOL(static,
5546 [ --enable-static Enable building of internal static libs],
5547 BUILD_STATIC_LIBS=1,
5550 dnl ========================================================
5551 dnl = Link js shell to system readline
5552 dnl ========================================================
5553 MOZ_ARG_ENABLE_BOOL(readline,
5554 [ --enable-readline Link js shell to system readline library],
5563 *-wince*|*-winmo*|*-mingw*|*-cygwin*|*-msvc*|*-mks*)
5574 if test -z "$SKIP_LIBRARY_CHECKS" -a -z "$NO_EDITLINE"; then
5575 if test -n "$JS_WANT_READLINE"; then
5576 AC_CHECK_LIB(readline, readline,
5577 EDITLINE_LIBS="-lreadline",
5578 AC_MSG_ERROR([No system readline library found.]))
5580 dnl By default, we use editline
5581 JS_NATIVE_EDITLINE=1
5582 EDITLINE_LIBS='$(DEPTH)/editline/$(LIB_PREFIX)editline.$(LIB_SUFFIX)'
5585 dnl Either way, we want to build with line editing support.
5588 AC_SUBST(JS_NATIVE_EDITLINE)
5589 AC_SUBST(JS_DISABLE_SHELL)
5590 AC_SUBST(EDITLINE_LIBS)
5592 dnl ========================================================
5594 dnl = Standalone module options
5596 dnl ========================================================
5597 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
5599 dnl ========================================================
5600 dnl = Build jsctypes if it's enabled
5601 dnl ========================================================
5602 MOZ_ARG_ENABLE_BOOL(ctypes,
5603 [ --enable-ctypes Enable js-ctypes (default=no)],
5606 AC_SUBST(JS_HAS_CTYPES)
5607 if test "$JS_HAS_CTYPES"; then
5608 dnl Error out if we're on MSVC and MASM is unavailable.
5609 if test -n "$_MSC_VER" -a \( "$AS" != "ml.exe" -a "$AS" != "ml64.exe" \); then
5610 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.])
5612 AC_DEFINE(JS_HAS_CTYPES)
5615 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
5616 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
5619 MOZ_ARG_WITH_STRING(sync-build-files,
5620 [ --with-sync-build-files=DIR
5621 Check that files in 'config' and 'build' match
5622 their originals in 'DIR/config' and 'DIR/build'.
5623 This helps keep the SpiderMonkey build machinery
5624 in sync with Mozilla's, on which it is based.],
5625 [MOZ_SYNC_BUILD_FILES=$withval ] )
5626 AC_SUBST(MOZ_SYNC_BUILD_FILES)
5628 dnl ========================================================
5630 dnl = Maintainer debug option (no --enable equivalent)
5632 dnl ========================================================
5637 AC_SUBST(AR_EXTRACT)
5641 AC_SUBST(AS_DASH_C_FLAG)
5649 AC_SUBST(NS_USE_NATIVE)
5650 AC_SUBST(MOZ_JS_LIBS)
5653 AC_SUBST(MOZ_DEBUG_SYMBOLS)
5654 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
5655 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
5656 AC_SUBST(MOZ_DEBUG_FLAGS)
5657 AC_SUBST(MOZ_DEBUG_LDFLAGS)
5658 AC_SUBST(WARNINGS_AS_ERRORS)
5662 AC_SUBST(MOZ_CALLGRIND)
5664 AC_SUBST(MOZ_PROFILING)
5665 AC_SUBST(MOZ_JSLOADER)
5666 AC_SUBST(MOZ_QUANTIFY)
5669 AC_SUBST(BUILD_STATIC_LIBS)
5670 AC_SUBST(ENABLE_TESTS)
5672 AC_SUBST(ENABLE_STRIP)
5673 AC_SUBST(PKG_SKIP_STRIP)
5674 AC_SUBST(INCREMENTAL_LINKER)
5675 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
5676 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
5678 AC_SUBST(MOZ_FIX_LINK_PATHS)
5680 AC_SUBST(USE_DEPENDENT_LIBS)
5682 AC_SUBST(MOZ_BUILD_ROOT)
5683 AC_SUBST(MOZ_OS2_TOOLS)
5685 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
5686 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
5687 AC_SUBST(MOZ_TIMELINE)
5689 AC_SUBST(MOZ_APP_NAME)
5690 AC_SUBST(MOZ_APP_DISPLAYNAME)
5691 AC_SUBST(MOZ_APP_UA_NAME)
5692 AC_SUBST(MOZ_APP_VERSION)
5693 AC_SUBST(MOZ_UA_FIREFOX_VERSION)
5694 AC_SUBST(FIREFOX_VERSION)
5696 AC_SUBST(MOZ_PKG_SPECIAL)
5698 AC_SUBST(MOZILLA_OFFICIAL)
5701 AC_SUBST(MOZ_MAPINFO)
5702 AC_SUBST(MOZ_BROWSE_INFO)
5703 AC_SUBST(MOZ_TOOLS_DIR)
5704 AC_SUBST(CYGWIN_WRAPPER)
5706 AC_SUBST(WIN32_REDIST_DIR)
5710 AC_SUBST(WINCE_SDK_DIR)
5711 AC_SUBST(WINCE_WINDOWS_MOBILE)
5713 dnl Echo the CFLAGS to remove extra whitespace.
5720 $_MOZ_EXCEPTIONS_FLAGS \
5721 $_WARNINGS_CXXFLAGS \
5724 COMPILE_CFLAGS=`echo \
5729 COMPILE_CXXFLAGS=`echo \
5730 $_DEFINES_CXXFLAGS \
5734 AC_SUBST(SYSTEM_MAKEDEPEND)
5736 AC_SUBST(NSPR_CFLAGS)
5738 AC_SUBST(MOZ_NATIVE_NSPR)
5743 AC_SUBST(COMPILE_CFLAGS)
5744 AC_SUBST(COMPILE_CXXFLAGS)
5747 AC_SUBST(CROSS_COMPILE)
5751 AC_SUBST(HOST_CFLAGS)
5752 AC_SUBST(HOST_CXXFLAGS)
5753 AC_SUBST(HOST_OPTIMIZE_FLAGS)
5755 AC_SUBST(HOST_AR_FLAGS)
5757 AC_SUBST(HOST_RANLIB)
5758 AC_SUBST(HOST_NSPR_MDCPUCFG)
5759 AC_SUBST(HOST_BIN_SUFFIX)
5760 AC_SUBST(HOST_OS_ARCH)
5762 AC_SUBST(TARGET_CPU)
5763 AC_SUBST(TARGET_VENDOR)
5765 AC_SUBST(TARGET_NSPR_MDCPUCFG)
5766 AC_SUBST(TARGET_MD_ARCH)
5767 AC_SUBST(TARGET_XPCOM_ABI)
5770 AC_SUBST(OS_RELEASE)
5773 AC_SUBST(WRAP_MALLOC_CFLAGS)
5774 AC_SUBST(WRAP_MALLOC_LIB)
5777 AC_SUBST(MKSHLIB_FORCE_ALL)
5778 AC_SUBST(MKSHLIB_UNFORCE_ALL)
5779 AC_SUBST(DSO_CFLAGS)
5780 AC_SUBST(DSO_PIC_CFLAGS)
5781 AC_SUBST(DSO_LDOPTS)
5782 AC_SUBST(LIB_PREFIX)
5783 AC_SUBST(DLL_PREFIX)
5784 AC_SUBST(DLL_SUFFIX)
5785 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
5786 AC_SUBST(LIB_SUFFIX)
5787 AC_SUBST(OBJ_SUFFIX)
5788 AC_SUBST(BIN_SUFFIX)
5789 AC_SUBST(ASM_SUFFIX)
5790 AC_SUBST(IMPORT_LIB_SUFFIX)
5792 AC_SUBST(CC_VERSION)
5793 AC_SUBST(CXX_VERSION)
5794 AC_SUBST(MSMANIFEST_TOOL)
5796 if test "$USING_HCC"; then
5797 CC='${topsrcdir}/build/hcc'
5799 CXX='${topsrcdir}/build/hcpp'
5800 CXX="$CXX '$_OLDCXX'"
5805 AC_MSG_CHECKING([for posix_fallocate])
5806 AC_TRY_LINK([#define _XOPEN_SOURCE 600
5807 #include <fcntl.h>],
5808 [posix_fallocate(0, 0, 0);],
5809 [ac_cv___posix_fallocate=true],
5810 [ac_cv___posix_fallocate=false])
5812 if test "$ac_cv___posix_fallocate" = true ; then
5813 AC_DEFINE(HAVE_POSIX_FALLOCATE)
5819 dnl Check for missing components
5820 if test "$COMPILE_ENVIRONMENT"; then
5821 if test "$MOZ_X11"; then
5822 dnl ====================================================
5823 dnl = Check if X headers exist
5824 dnl ====================================================
5825 _SAVE_CFLAGS=$CFLAGS
5826 CFLAGS="$CFLAGS $XCFLAGS"
5830 #include <X11/Xlib.h>
5831 #include <X11/Intrinsic.h>
5835 if ((dpy = XOpenDisplay(NULL)) == NULL) {
5836 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
5840 [ AC_MSG_ERROR([Could not compile basic X program.]) ])
5841 CFLAGS="$_SAVE_CFLAGS"
5843 if test ! -z "$MISSING_X"; then
5844 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
5848 fi # COMPILE_ENVIRONMENT
5850 dnl Set various defines and substitutions
5851 dnl ========================================================
5853 if test "$OS_ARCH" = "BeOS"; then
5855 elif test "$OS_ARCH" = "Darwin"; then
5856 AC_DEFINE(XP_MACOSX)
5858 AC_DEFINE(UNIX_ASYNC_DNS)
5859 elif test "$OS_ARCH" = "OpenVMS"; then
5861 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
5863 AC_DEFINE(UNIX_ASYNC_DNS)
5866 AC_ARG_ENABLE(threadsafe,
5867 [ --enable-threadsafe Enable support for multiple threads.],
5868 [AC_DEFINE(JS_THREADSAFE)],)
5870 if test "$MOZ_DEBUG"; then
5871 AC_DEFINE(MOZ_REFLOW_PERF)
5872 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
5875 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
5876 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
5877 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
5878 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
5879 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
5880 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
5881 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
5882 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
5883 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
5886 dnl ========================================================
5887 dnl JavaScript shell
5888 dnl ========================================================
5890 AC_HAVE_FUNCS(setlocale)
5891 AC_HAVE_FUNCS(localeconv)
5893 dnl ========================================================
5894 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
5895 dnl ========================================================
5898 WIN_TOP_SRC=`cd $srcdir; pwd -W`
5901 HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
5902 HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
5903 CC="\$(CYGWIN_WRAPPER) $CC"
5904 CXX="\$(CYGWIN_WRAPPER) $CXX"
5905 CPP="\$(CYGWIN_WRAPPER) $CPP"
5906 LD="\$(CYGWIN_WRAPPER) $LD"
5907 AS="\$(CYGWIN_WRAPPER) $AS"
5908 RC="\$(CYGWIN_WRAPPER) $RC"
5909 CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
5910 WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
5914 AC_SUBST(CYGDRIVE_MOUNT)
5915 AC_SUBST(WIN_TOP_SRC)
5917 AC_SUBST(MOZILLA_VERSION)
5919 AC_SUBST(ac_configure_args)
5921 dnl Spit out some output
5922 dnl ========================================================
5924 # Save the defines header file before autoconf removes it.
5925 # (Do not add AC_DEFINE calls after this line.)
5926 _CONFIG_TMP=confdefs-tmp.h
5927 _CONFIG_DEFS_H=js-confdefs.h
5929 cat > $_CONFIG_TMP <<\EOF
5930 /* List of defines generated by configure. Included with preprocessor flag,
5931 * -include, to avoid long list of -D defines on the compile command-line.
5935 #ifndef _JS_CONFDEFS_H_
5936 #define _JS_CONFDEFS_H_
5939 _EGREP_PATTERN='^#define ('
5940 if test -n "$_NON_GLOBAL_ACDEFINES"; then
5941 for f in $_NON_GLOBAL_ACDEFINES; do
5942 _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
5945 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
5947 sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
5949 cat >> $_CONFIG_TMP <<\EOF
5951 #endif /* _JS_CONFDEFS_H_ */
5955 # Only write js-confdefs.h when something changes (or it doesn't exist)
5956 if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
5959 AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
5960 mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
5962 echo ==== $_CONFIG_DEFS_H =================================
5966 dnl Probably shouldn't call this manually but we always want the output of DEFS
5967 rm -f confdefs.h.save
5968 mv confdefs.h confdefs.h.save
5969 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
5970 AC_OUTPUT_MAKE_DEFS()
5972 AC_SUBST(MOZ_DEFINES)
5974 mv confdefs.h.save confdefs.h
5980 jsapi-tests/Makefile
5984 config/mkdepend/Makefile
5987 if test -n "$JS_NATIVE_EDITLINE"; then
5988 MAKEFILES="$MAKEFILES
5994 dnl Run a perl script to quickly create the makefiles.
5995 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
5996 dnl for the files it cannot handle correctly. This way, config.status
5997 dnl will handle these files.
5998 dnl If it fails, nothing is set and config.status will run as usual.
6000 dnl This does not change the $MAKEFILES variable.
6002 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
6004 if test -z "${AS_PERL}"; then
6005 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
6007 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
6012 echo $MAKEFILES > unallmakefiles
6014 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
6016 AC_OUTPUT($MAKEFILES)
6018 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
6019 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
6020 echo "config/autoconf.mk is unchanged"
6021 mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
6023 rm -f config/autoconf.mk.orig 2> /dev/null
6026 # Produce the js-config script at configure time; see the comments for
6027 # 'js-config' in Makefile.in.
6028 AC_MSG_RESULT(invoking make to create js-config script)
6031 # Build jsctypes if it's enabled.
6032 if test "$JS_HAS_CTYPES"; then
6033 # Run the libffi 'configure' script.
6034 ac_configure_args="--disable-shared --enable-static --disable-raw-api"
6035 if test "$MOZ_DEBUG"; then
6036 ac_configure_args="$ac_configure_args --enable-debug"
6038 if test "$DSO_PIC_CFLAGS"; then
6039 ac_configure_args="$ac_configure_args --with-pic"
6041 if test "$CROSS_COMPILE"; then
6044 ac_configure_args="$ac_configure_args --build=$build --host=${target_cpu}-${target_os} HOST_CC=\"$HOST_CC\" CC=\"$CC\""
6047 CFLAGS="$ANDROID_CFLAGS"
6048 CPPFLAGS="$ANDROID_CPPFLAGS"
6049 LDFLAGS="$ANDROID_LDFLAGS"
6051 export AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS CFLAGS LDFLAGS
6053 ac_configure_args="$ac_configure_args --build=$build --host=${target_cpu}-${target_os} HOST_CC=\"$HOST_CC\""
6056 ac_configure_args="$ac_configure_args --build=$build --host=$target HOST_CC=\"$HOST_CC\" CC=\"$CC\""
6060 if test "$_MSC_VER"; then
6061 # Use a wrapper script for cl and ml that looks more like gcc.
6062 # autotools can't quite handle an MSVC build environment yet.
6063 ac_configure_args="$ac_configure_args LD=link CPP=\"cl -nologo -EP\" SHELL=sh.exe"
6064 case "${target_cpu}" in
6066 # Need target since MSYS tools into mozilla-build may be 32bit
6067 ac_configure_args="$ac_configure_args CC=\"$_topsrcdir/ctypes/libffi/msvcc.sh -m64\" --build=$build --host=$target"
6070 ac_configure_args="$ac_configure_args CC=$_topsrcdir/ctypes/libffi/msvcc.sh"
6074 if test "$SOLARIS_SUNPRO_CC"; then
6075 # Always use gcc for libffi on Solaris
6076 if test ! "$HAVE_64BIT_OS"; then
6077 ac_configure_args="$ac_configure_args CC=gcc CFLAGS=-m32 LD= LDFLAGS="
6079 ac_configure_args="$ac_configure_args CC=gcc CFLAGS=-m64 LD= LDFLAGS="
6082 if test "$OS_ARCH" = "OS2"; then
6083 ac_configure_args="$ac_configure_args CFLAGS=-Zomf AR=emxomfar"
6085 if test -n "$MOZ_THUMB2"; then
6086 ac_configure_args="$ac_configure_args --enable-thumb2"
6089 # Use a separate cache file for libffi, since it does things differently
6090 # from our configure.
6091 mkdir -p $_objdir/ctypes/libffi
6092 old_cache_file=$cache_file
6093 cache_file=$_objdir/ctypes/libffi/config.cache
6094 old_config_files=$CONFIG_FILES
6096 AC_OUTPUT_SUBDIRS(ctypes/libffi)
6097 cache_file=$old_cache_file
6098 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
6099 CONFIG_FILES=$old_config_files