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 ========================================================
66 AC_INIT(config/config.mk)
67 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
69 TARGET_CPU="${target_cpu}"
70 TARGET_VENDOR="${target_vendor}"
71 TARGET_OS="${target_os}"
73 MOZ_DEB_TIMESTAMP=`date +"%a, %d %b %Y %T %z" 2>&1`
74 AC_SUBST(MOZ_DEB_TIMESTAMP)
76 dnl ========================================================
78 dnl = Don't change the following two lines. Doing so breaks:
80 dnl = CFLAGS="-foo" ./configure
82 dnl ========================================================
84 CPPFLAGS="${CPPFLAGS=}"
85 CXXFLAGS="${CXXFLAGS=}"
87 HOST_CFLAGS="${HOST_CFLAGS=}"
88 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
89 HOST_LDFLAGS="${HOST_LDFLAGS=}"
91 dnl ========================================================
92 dnl = Preserve certain environment flags passed to configure
93 dnl = We want sub projects to receive the same flags
94 dnl = untainted by this configure script
95 dnl ========================================================
98 _SUBDIR_CFLAGS="$CFLAGS"
99 _SUBDIR_CPPFLAGS="$CPPFLAGS"
100 _SUBDIR_CXXFLAGS="$CXXFLAGS"
101 _SUBDIR_LDFLAGS="$LDFLAGS"
102 _SUBDIR_HOST_CC="$HOST_CC"
103 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
104 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
105 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
106 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
108 dnl Set the version number of the libs included with mozilla
109 dnl ========================================================
116 dnl Set the minimum version of toolkit libs used by mozilla
117 dnl ========================================================
125 WINDRES_VERSION=2.14.90
128 GNOMEUI_VERSION=2.2.0
131 STARTUP_NOTIFICATION_VERSION=0.8
134 LIBNOTIFY_VERSION=0.4
138 dnl Set various checks
139 dnl ========================================================
143 dnl Initialize the Pthread test variables early so they can be
144 dnl overridden by each platform.
145 dnl ========================================================
149 dnl Do not allow a separate objdir build if a srcdir build exists.
150 dnl ==============================================================
151 _topsrcdir=`cd \`dirname $0\`; pwd`
154 if test "$_topsrcdir" != "$_objdir"
156 # Check for a couple representative files in the source tree
158 for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
159 if test -f $file; then
160 _conflict_files="$_conflict_files $file"
163 if test "$_conflict_files"; then
165 echo "* Your source tree contains these files:"
166 for file in $_conflict_files; do
170 * This indicates that you previously built in the source tree.
171 * A source tree build can confuse the separate objdir build.
173 * To clean up the source tree:
184 dnl Default to MSVC for win32 and gcc-4.2 for darwin
185 dnl ==============================================================
186 if test -z "$CROSS_COMPILE"; then
188 *-cygwin*|*-mingw*|*-msvc*|*-mks*)
189 if test -z "$CC"; then CC=cl; fi
190 if test -z "$CXX"; then CXX=cl; fi
191 if test -z "$CPP"; then CPP="cl -E -nologo"; fi
192 if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
193 if test -z "$LD"; then LD=link; fi
194 if test -z "$AS"; then
195 case "${target_cpu}" in
204 if test -z "$MIDL"; then MIDL=midl; fi
207 if test -z "$CC"; then CC=gcc-4.2; fi
208 if test -z "$CXX"; then CXX=g++-4.2; fi
213 COMPILE_ENVIRONMENT=1
214 MOZ_ARG_DISABLE_BOOL(compile-environment,
215 [ --disable-compile-environment
216 Disable compiler/library checks.],
217 COMPILE_ENVIRONMENT= )
218 AC_SUBST(COMPILE_ENVIRONMENT)
220 MOZ_ARG_WITH_STRING(l10n-base,
221 [ --with-l10n-base=DIR path to l10n repositories],
222 L10NBASEDIR=$withval)
223 if test ! -z "$L10NBASEDIR"; then
224 if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
225 AC_MSG_ERROR([--with-l10n-base must specify a path])
226 elif test -d "$L10NBASEDIR"; then
227 L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
229 AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
232 AC_SUBST(L10NBASEDIR)
234 dnl Check for Perl first -- needed for win32 SDK checks
235 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
236 if test -z "$PERL" -o "$PERL" = ":"; then
237 AC_MSG_ERROR([perl not found in \$PATH])
240 dnl ========================================================
241 dnl = Android uses a very custom (hacky) toolchain; we need to do this
242 dnl = here, so that the compiler checks can succeed
243 dnl ========================================================
245 MOZ_ARG_WITH_STRING(android-ndk,
246 [ --with-android-ndk=DIR
247 location where the Android NDK can be found],
248 android_ndk=$withval)
250 MOZ_ARG_WITH_STRING(android-toolchain,
251 [ --with-android-toolchain=DIR
252 location of the android toolchain, default NDK/build/prebuilt/HOST/arm-eabi-4.4.0],
253 android_toolchain=$withval)
256 MOZ_ARG_WITH_STRING(android-version,
257 [ --with-android-version=VER
258 android platform version, default 5],
259 android_version=$withval,
262 MOZ_ARG_WITH_STRING(android-sdk,
263 [ --with-android-sdk=DIR
264 location where the Android SDK can be found (base directory, e.g. .../android/platforms/android-6)],
265 android_sdk=$withval)
267 MOZ_ARG_WITH_STRING(android-tools,
268 [ --with-android-tools=DIR
269 location where the Android Tools can be found (base directory, e.g. .../android/tools)],
270 android_tools=$withval)
272 if test "$target" = "arm-android-eabi" ; then
273 if test -z "$android_ndk" ; then
274 AC_MSG_ERROR([You must specify --with-android-ndk=/path/to/ndk when targeting Android.])
277 if test -z "$android_sdk" ; then
278 AC_MSG_ERROR([You must specify --with-android-sdk=/path/to/sdk when targeting Android.])
281 if test -z "$android_tools" ; then
282 AC_MSG_ERROR([You must specify --with-android-tools=/path/to/sdk/tools when targeting Android.])
285 if test -z "$android_toolchain" ; then
286 android_toolchain="$android_ndk"/build/prebuilt/`uname -s | tr "[[:upper:]]" "[[:lower:]]"`-x86/arm-eabi-4.4.0
289 if test -z "$android_platform" ; then
290 android_platform="$android_ndk"/build/platforms/android-"$android_version"/arch-"$target_cpu"
294 AS="$android_toolchain"/bin/arm-eabi-as
295 CC="$android_toolchain"/bin/arm-eabi-gcc
296 CXX="$android_toolchain"/bin/arm-eabi-g++
297 CPP="$android_toolchain"/bin/arm-eabi-cpp
298 LD="$android_toolchain"/bin/arm-eabi-ld
299 AR="$android_toolchain"/bin/arm-eabi-ar
300 RANLIB="$android_toolchain"/bin/arm-eabi-ranlib
301 STRIP="$android_toolchain"/bin/arm-eabi-strip
303 CPPFLAGS="-I$android_platform/usr/include $CPPFLAGS"
304 CFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions $CFLAGS"
305 CXXFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions $CXXFLAGS"
307 dnl Add -llog by default, since we use it all over the place.
308 dnl Add --allow-shlib-undefined, because libGLESv2 links to an
309 dnl undefined symbol (present on the hardware, just not in the
311 LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform -llog -Wl,--allow-shlib-undefined $LDFLAGS"
313 dnl prevent cross compile section from using these flags as host flags
314 if test -z "$HOST_CPPFLAGS" ; then
317 if test -z "$HOST_CFLAGS" ; then
320 if test -z "$HOST_CXXFLAGS" ; then
323 if test -z "$HOST_LDFLAGS" ; then
327 ANDROID_NDK="${android_ndk}"
328 ANDROID_TOOLCHAIN="{android_toolchain}"
329 ANDROID_PLATFORM="{android_platform}"
330 ANDROID_SDK="${android_sdk}"
331 ANDROID_TOOLS="${android_tools}"
332 ANDROID_VERSION="${android_version}"
335 AC_DEFINE_UNQUOTED(ANDROID_VERSION, $android_version)
336 AC_SUBST(ANDROID_VERSION)
338 MOZ_CHROME_FILE_FORMAT=omni
342 AC_SUBST(ANDROID_NDK)
343 AC_SUBST(ANDROID_TOOLCHAIN)
344 AC_SUBST(ANDROID_PLATFORM)
345 AC_SUBST(ANDROID_SDK)
346 AC_SUBST(ANDROID_TOOLS)
348 dnl ========================================================
349 dnl Checks for compilers.
350 dnl ========================================================
351 dnl Set CROSS_COMPILE in the environment when running configure
352 dnl to use the cross-compile setup for now
353 dnl ========================================================
355 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
358 if test "$COMPILE_ENVIRONMENT"; then
360 dnl Do some special WinCE toolchain stuff
364 MOZ_ARG_WITH_STRING(wince-sdk,
365 [ --with-wince-sdk=WINCE_SDK_DIR
366 The path to the Windows CE SDK],
367 WINCE_SDK_DIR=$withval)
369 MOZ_ARG_WITH_STRING(ogles-sdk,
370 [ --with-ogles-sdk=OGLES_SDK_DIR
371 The path to the OGLES SDK],
372 OGLES_SDK_DIR=$withval)
378 echo -----------------------------------------------------------------------------
379 echo Building Windows CE Shunt Library and Tool Chain
386 _topsrcdirwin=`cd \`dirname $0\`; pwd -W`
387 make OGLES_SDK_DIR="$OGLES_SDK_DIR" WINCE_SDK_DIR="$WINCE_SDK_DIR" \
388 TOPSRCDIR="$_topsrcdirwin" OBJDIR="$_pwd" target="$target" \
389 -C $srcdir/build/wince/tools
391 CC="$_pwd/dist/sdk/bin/$target-gcc.exe"
392 CXX="$_pwd/dist/sdk/bin/$target-gcc.exe"
393 CPP="$_pwd/dist/sdk/bin/$target-gcc.exe -E -nologo"
394 CXXCPP="$_pwd/dist/sdk/bin/$target-gcc.exe -TP -E -nologo"
395 LD="$_pwd/dist/sdk/bin/$target-link.exe"
396 AR="$_pwd/dist/sdk/bin/$target-lib.exe"
397 AS="$_pwd/dist/sdk/bin/$target-as.exe"
398 RC="$_pwd/dist/sdk/bin/$target-res.exe"
401 echo -----------------------------------------------------------------------------
406 if test -n "$CROSS_COMPILE" -a "$target" != "$host"; then
407 echo "cross compiling from $host to $target"
411 _SAVE_CFLAGS="$CFLAGS"
412 _SAVE_LDFLAGS="$LDFLAGS"
414 AC_MSG_CHECKING([for host c compiler])
415 AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
416 if test -z "$HOST_CC"; then
417 AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
419 AC_MSG_RESULT([$HOST_CC])
420 AC_MSG_CHECKING([for host c++ compiler])
421 AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
422 if test -z "$HOST_CXX"; then
423 AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
425 AC_MSG_RESULT([$HOST_CXX])
427 if test -z "$HOST_CFLAGS"; then
428 HOST_CFLAGS="$CFLAGS"
430 if test -z "$HOST_CXXFLAGS"; then
431 HOST_CXXFLAGS="$CXXFLAGS"
433 if test -z "$HOST_LDFLAGS"; then
434 HOST_LDFLAGS="$LDFLAGS"
436 if test -z "$HOST_AR_FLAGS"; then
437 HOST_AR_FLAGS="$AR_FLAGS"
439 AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
440 AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
442 CFLAGS="$HOST_CFLAGS"
443 LDFLAGS="$HOST_LDFLAGS"
445 AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
446 AC_TRY_COMPILE([], [return(0);],
447 [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
448 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
451 CFLAGS="$HOST_CXXFLAGS"
453 AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
454 AC_TRY_COMPILE([], [return(0);],
455 [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
456 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
460 LDFLAGS=$_SAVE_LDFLAGS
462 case "$build:$target" in
463 powerpc-apple-darwin8*:i?86-apple-darwin*)
464 dnl The Darwin cross compiler doesn't necessarily point itself at a
465 dnl root that has libraries for the proper architecture, it defaults
466 dnl to the system root. The libraries in the system root on current
467 dnl versions of PPC OS X 10.4 aren't fat, so these target compiler
468 dnl checks will fail. Fake a working SDK in that case.
470 _SAVE_CXXFLAGS=$CXXLAGS
471 CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CFLAGS"
472 CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk $CXXFLAGS"
476 AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
479 AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
483 case "$build:$target" in
484 powerpc-apple-darwin8*:i?86-apple-darwin*)
485 dnl Revert the changes made above. From this point on, the target
486 dnl compiler will never be used without applying the SDK to CFLAGS
487 dnl (see --with-macos-sdk below).
489 CXXFLAGS=$_SAVE_CXXFLAGS
493 AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
494 AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
495 MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
496 AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
497 AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
498 AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
499 AC_DEFINE(CROSS_COMPILE)
504 MOZ_PATH_PROGS(AS, $AS as, $CC)
505 AC_CHECK_PROGS(AR, ar, :)
506 AC_CHECK_PROGS(LD, ld, :)
507 AC_CHECK_PROGS(STRIP, strip, :)
508 AC_CHECK_PROGS(WINDRES, windres, :)
509 if test -z "$HOST_CC"; then
512 if test -z "$HOST_CFLAGS"; then
513 HOST_CFLAGS='$(CFLAGS)'
515 if test -z "$HOST_CXX"; then
518 if test -z "$HOST_CXXFLAGS"; then
519 HOST_CXXFLAGS='$(CXXFLAGS)'
521 if test -z "$HOST_LDFLAGS"; then
522 HOST_LDFLAGS='$(LDFLAGS)'
524 if test -z "$HOST_RANLIB"; then
525 HOST_RANLIB='$(RANLIB)'
527 if test -z "$HOST_AR"; then
530 if test -z "$HOST_AR_FLAGS"; then
531 HOST_AR_FLAGS='$(AR_FLAGS)'
541 if test "$GCC" = "yes"; then
543 CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
545 if test "$GXX" = "yes"; then
547 CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
549 if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
552 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
555 if test "$GNU_CC"; then
556 if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
563 if test "$GCC" = yes; then
564 if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
569 if test "$GXX" = yes; then
570 if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
575 dnl Special win32 checks
576 dnl ========================================================
584 dnl Target the Windows 7 SDK by default
589 MOZ_ARG_WITH_STRING(windows-version,
590 [ --with-windows-version=WINSDK_TARGETVER
591 Highest Windows version to target using this SDK
592 502: Windows Server 2003
595 WINSDK_TARGETVER=$withval)
597 case "$WINSDK_TARGETVER" in
599 MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
603 AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER), must be 502, 600 or 601]);
608 if test -n "$COMPILE_ENVIRONMENT"; then
609 if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
610 # We can't build parental controls either
611 MOZ_DISABLE_PARENTAL_CONTROLS=1
616 *-cygwin*|*-mingw*|*-msvc*|*-mks*|*-wince|*-winmo)
617 if test "$GCC" != "yes"; then
618 # Check to see if we are really running in a msvc environemnt
620 AC_CHECK_PROGS(MIDL, midl)
622 # Make sure compilers are valid
623 CFLAGS="$CFLAGS -TC -nologo"
624 CXXFLAGS="$CXXFLAGS -TP -nologo"
627 AC_TRY_COMPILE([#include <stdio.h>],
628 [ printf("Hello World\n"); ],,
629 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
632 AC_TRY_COMPILE([#include <new.h>],
633 [ unsigned *test = new unsigned(42); ],,
634 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
638 _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
641 # Determine compiler version
642 CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
643 _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
644 _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
645 _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
646 _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
647 _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
649 CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
650 _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
652 if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
653 AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
655 if test "$_CC_MAJOR_VERSION" = "13"; then
657 elif test "$_CC_MAJOR_VERSION" = "14"; then
659 CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
660 dnl -DYNAMICBASE is only supported on VC8SP1 or newer,
661 dnl so be very specific here!
662 dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762
663 if test $_CC_RELEASE -gt 50727; then
665 elif test $_CC_BUILD -ge 762; then
668 AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
669 AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
670 elif test "$_CC_MAJOR_VERSION" = "15"; then
672 CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
674 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
675 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
676 elif test "$_CC_MAJOR_VERSION" = "16"; then
678 CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
680 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
681 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
683 AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
686 _MOZ_RTTI_FLAGS_ON='-GR'
687 _MOZ_RTTI_FLAGS_OFF='-GR-'
688 _MOZ_EXCEPTIONS_FLAGS_ON='-EHsc'
689 _MOZ_EXCEPTIONS_FLAGS_OFF=''
691 if test -n "$WIN32_REDIST_DIR"; then
692 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
696 # ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
697 if test "$_CC_SUITE" -ge "8"; then
699 _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
702 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
703 if test -n "$MSMT_TOOL"; then
704 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
705 if test -z "$MSMANIFEST_TOOL_VERSION"; then
706 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
711 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
715 # Check linker version
716 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
717 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
718 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
719 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
724 _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
725 _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
726 _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
727 _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
728 # Add flags if necessary
729 AC_MSG_CHECKING([for midl flags])
732 if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
733 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
734 # MIDL version 7.00.0500 or later has no problem.
735 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
736 AC_MSG_RESULT([need -env win32])
738 AC_MSG_RESULT([none needed])
742 MIDL_FLAGS="${MIDL_FLAGS} -env x64"
745 AC_MSG_RESULT([none needed])
749 # Identify which version of the SDK we're building with
750 # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
752 AC_CHECK_HEADERS([winsdkver.h])
753 if test "$ac_cv_header_winsdkver_h" = "yes"; then
754 # Get the highest _WIN32_WINNT and NTDDI versions supported
755 # Take the higher of the two
756 # This is done because the Windows 7 beta SDK reports its
757 # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
758 AC_CACHE_CHECK(for highest Windows version supported by this SDK,
760 [cat > conftest.h <<EOF
761 #include <winsdkver.h>
762 #include <sdkddkver.h>
764 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
765 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
767 #define WINSDK_MAXVER NTDDI_MAXVER
772 ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
775 MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
777 # The Vista SDK is the only one to have sdkddkver.h but not
779 AC_CHECK_HEADERS([sdkddkver.h])
780 if test "$ac_cv_header_sdkddkver_h" = "yes"; then
781 MOZ_WINSDK_MAXVER=0x06000000
783 # Assume the Server 2003 Platform SDK
784 MOZ_WINSDK_MAXVER=0x05020000
788 unset _MSVC_VER_FILTER
790 AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
794 _SAVE_CXXFLAGS="$CXXFLAGS"
795 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
796 AC_TRY_COMPILE([#include <exception>],
797 [std::_Throw(std::exception()); return 0;],
798 ac_cv_have_std__Throw="yes",
799 ac_cv_have_std__Throw="no")
800 CXXFLAGS="$_SAVE_CXXFLAGS"
804 if test "$ac_cv_have_std__Throw" == "yes"; then
805 AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
806 ac_cv_have_dllimport_exception_bug,
810 _SAVE_CXXFLAGS="$CXXFLAGS"
811 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
812 AC_TRY_LINK([#include <vector>],
813 [std::vector<int> v; return v.at(1);],
814 ac_cv_have_dllimport_exception_bug="no",
815 ac_cv_have_dllimport_exception_bug="yes")
816 CXXFLAGS="$_SAVE_CXXFLAGS"
819 if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
821 MOZ_MSVC_STL_WRAP__Throw=1
822 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
825 AC_CACHE_CHECK(for overridable _RAISE,
830 _SAVE_CXXFLAGS="$CXXFLAGS"
831 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
832 AC_TRY_COMPILE([#include <xstddef>
834 #define _RAISE(x) externallyDefinedFunction((x).what())
837 [std::vector<int> v; return v.at(1);],
838 ac_cv_have__RAISE="no",
839 ac_cv_have__RAISE="yes")
840 CXXFLAGS="$_SAVE_CXXFLAGS"
843 if test "$ac_cv_have__RAISE" = "yes"; then
845 MOZ_MSVC_STL_WRAP__RAISE=1
846 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
848 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.])
852 if test "$WRAP_STL_INCLUDES" = "1"; then
853 STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
856 # Check w32api version
857 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
858 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
859 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
860 AC_TRY_COMPILE([#include <w32api.h>],
861 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
862 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
863 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
864 #error "test failed."
866 , [ res=yes ], [ res=no ])
867 AC_MSG_RESULT([$res])
868 if test "$res" != "yes"; then
869 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
871 # Check windres version
872 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
873 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
874 AC_MSG_RESULT([$_WINDRES_VERSION])
875 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
876 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
877 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
878 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
879 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
880 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
881 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
882 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
883 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
884 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
885 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
886 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
888 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
891 # Server 2003 is the highest version supported
892 MOZ_WINSDK_MAXVER=0x05020000
895 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
896 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
897 # Require OS features provided by IE 5.0
898 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
900 # If the maximum version supported by this SDK is lower than the target
902 AC_MSG_CHECKING([for Windows SDK being recent enough])
903 if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
907 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.])
910 AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
911 # Definitions matching sdkddkver.h
912 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WS03, 0x05020000)
913 AC_DEFINE_UNQUOTED(MOZ_NTDDI_LONGHORN, 0x06000000)
914 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
918 dnl Test breaks icc on OS/2 && MSVC
919 if test "$CC" != "icc" -a -z "$_WIN32_MSVC"; then
921 if grep "NO_MINUS_C_MINUS_O 1" ./confdefs.h >/dev/null; then
925 CC="${srcdir}/build/hcc '$CC'"
926 CXX="${srcdir}/build/hcpp '$CXX'"
933 if test -n "$_WIN32_MSVC"; then
935 SKIP_COMPILER_CHECKS=1
936 SKIP_LIBRARY_CHECKS=1
938 # Since we're skipping compiler and library checks, hard-code
945 AC_DEFINE(HAVE_SETBUF)
946 AC_DEFINE(HAVE_ISATTY)
951 fi # COMPILE_ENVIRONMENT
964 AC_SUBST(WRAP_STL_INCLUDES)
965 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
966 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
968 dnl ========================================================
969 dnl Checks for programs.
970 dnl ========================================================
974 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
975 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
976 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
978 AC_MSG_RESULT([$_perl_version])
980 if test "$_perl_res" != 0; then
981 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
985 AC_MSG_CHECKING([for full perl installation])
986 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
988 if test "$_perl_res" != 0; then
990 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
995 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.7 python2.6 python2.5 python)
996 if test -z "$PYTHON"; then
997 AC_MSG_ERROR([python was not found in \$PATH])
1000 if test -z "$COMPILE_ENVIRONMENT"; then
1001 NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
1003 AC_SUBST(NSINSTALL_BIN)
1005 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
1006 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
1007 MOZ_PATH_PROG(UNZIP, unzip, :)
1008 MOZ_PATH_PROGS(ZIP, zip)
1009 if test -z "$ZIP" -o "$ZIP" = ":"; then
1010 AC_MSG_ERROR([zip not found in \$PATH])
1012 MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
1013 MOZ_PATH_PROG(XARGS, xargs)
1014 if test -z "$XARGS" -o "$XARGS" = ":"; then
1015 AC_MSG_ERROR([xargs not found in \$PATH .])
1018 if test "$COMPILE_ENVIRONMENT"; then
1020 dnl ========================================================
1021 dnl = Mac OS X toolchain support
1022 dnl ========================================================
1024 case "$target_os" in
1026 dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
1027 dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
1028 dnl the environment and includedir purposes (when using an SDK, below),
1029 dnl but remember the full version number for the libdir (SDK).
1031 GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
1032 GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
1034 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1035 dnl Bug 280479, but this keeps popping up in bug 292530 too because
1036 dnl 4.0.0/4061 is the default compiler in Tiger.
1038 GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
1040 if test "$GCC_BUILD" = "4061" ; then
1041 AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
1042 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
1043 from building Mozilla. Upgrade to Xcode 2.1 or later.])
1047 dnl xcodebuild needs GCC_VERSION defined in the environment, since it
1048 dnl doesn't respect the CC/CXX setting. With GCC_VERSION set, it will use
1049 dnl /usr/bin/g(cc|++)-$GCC_VERSION.
1050 MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
1055 XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
1057 if test -n "$XCODEBUILD_VERSION" -a "$XCODEBUILD_VERSION" -ge 620 ; then
1063 dnl sdp was formerly in /Developer/Tools. As of Mac OS X 10.4 (Darwin 8),
1064 dnl it has moved into /usr/bin.
1065 MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
1069 AC_SUBST(GCC_VERSION)
1070 AC_SUBST(XCODEBUILD_VERSION)
1071 AC_SUBST(HAS_XCODE_2_1)
1073 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
1074 dnl that a universal binary is being produced.
1075 AC_SUBST(UNIVERSAL_BINARY)
1077 dnl ========================================================
1078 dnl Check for MacOS deployment target version
1079 dnl ========================================================
1081 MOZ_ARG_ENABLE_STRING(macos-target,
1082 [ --enable-macos-target=VER (default=10.5)
1083 Set the minimum MacOS version needed at runtime],
1084 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
1088 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
1089 dnl Use the specified value
1090 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
1091 AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
1093 dnl No value specified on the command line or in the environment,
1094 dnl use architecture minimum.
1095 case "${target_cpu}" in
1097 export MACOSX_DEPLOYMENT_TARGET=10.5
1100 export MACOSX_DEPLOYMENT_TARGET=10.5
1103 export MACOSX_DEPLOYMENT_TARGET=10.6
1110 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
1112 dnl ========================================================
1113 dnl = Mac OS X SDK support
1114 dnl ========================================================
1117 MOZ_ARG_WITH_STRING(macos-sdk,
1118 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
1119 MACOS_SDK_DIR=$withval)
1121 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
1122 dnl NEXT_ROOT will be set and exported only if it's needed.
1123 AC_SUBST(MACOS_SDK_DIR)
1126 if test "$MACOS_SDK_DIR"; then
1127 dnl Sync this section with the ones in NSPR and NSS.
1128 dnl Changes to the cross environment here need to be accounted for in
1129 dnl the libIDL checks (below) and xpidl build.
1131 if test ! -d "$MACOS_SDK_DIR"; then
1132 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
1133 specify a valid SDK. SDKs are installed when the optional cross-development
1134 tools are selected during the Xcode/Developer Tools installation.])
1137 GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
1138 if test "$GCC_VERSION_MAJOR" -lt "4" ; then
1139 AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
1141 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
1142 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
1144 dnl CPP/CXXCPP needs to be set for AC_CHECK_HEADER.
1145 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
1146 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
1148 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1149 dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
1150 dnl that supports -syslibroot. Don't set NEXT_ROOT because it will
1151 dnl be ignored and cause warnings when -syslibroot is specified.
1152 dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
1153 dnl the -isysroot it receives, so this is only needed with 4.0.0.
1154 LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
1159 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
1161 AC_TRY_COMPILE([#include <new>
1162 int main() { return 0; }],
1166 AC_MSG_RESULT($result)
1168 if test "$result" = "no" ; then
1169 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
1173 fi # COMPILE_ENVIRONMENT
1175 if test -n "$MAKE"; then
1176 if test `echo $MAKE | grep -c make.py` != 1; then
1182 cygwin*|mingw*|mks*|msvc*)
1183 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
1186 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
1189 if test "$GMAKE" = ":"; then
1190 AC_MSG_ERROR([GNU make not found])
1194 if test "$COMPILE_ENVIRONMENT"; then
1200 fi # COMPILE_ENVIRONMENT
1202 dnl ========================================================
1203 dnl set the defaults first
1204 dnl ========================================================
1207 AR_EXTRACT='$(AR) x'
1222 MOZ_USER_DIR=".mozilla"
1225 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)'
1227 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
1229 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1231 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/modules/libimg/png)'
1233 MOZ_JS_STATIC_LIBS='-L$(LIBXUL_DIST)/bin -ljs_static'
1234 MOZ_JS_SHARED_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
1235 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
1236 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1237 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
1238 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1239 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1240 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1244 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1246 USE_DEPENDENT_LIBS=1
1248 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1250 if test -n "$CROSS_COMPILE"; then
1251 OS_TARGET="${target_os}"
1252 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1254 case "${target_os}" in
1255 linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
1256 kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1257 gnu*) OS_ARCH=GNU ;;
1258 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
1259 mingw*) OS_ARCH=WINNT ;;
1260 wince*) OS_ARCH=WINCE ;;
1261 winmo*) OS_ARCH=WINCE ;;
1262 darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
1265 arm-android-eabi) OS_ARCH=Linux OS_TARGET=Android ;;
1268 OS_TARGET=`uname -s`
1269 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1270 OS_RELEASE=`uname -r`
1273 # Before this used `uname -m` when not cross compiling
1274 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1275 OS_TEST="${target_cpu}"
1279 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1281 #######################################################################
1282 # Master "Core Components" macros for getting the OS target #
1283 #######################################################################
1286 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1287 # cross-compilation.
1291 # Define and override various archtecture-specific variables, including
1300 case "$HOST_OS_ARCH" in
1301 cygwin*|mingw*|mks*|msvc*)
1314 if test -z "$GNU_CC"; then
1315 if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1320 if test -z "$GNU_CXX"; then
1321 if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1322 SOLARIS_SUNPRO_CXX=1
1325 AC_SUBST(SOLARIS_SUNPRO_CC)
1326 AC_SUBST(SOLARIS_SUNPRO_CXX)
1338 if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1341 HOST_OS_ARCH=UNIXWARE
1353 HOST_OS_ARCH=OpenVMS
1363 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1367 HOST_OS_ARCH=UNIXWARE
1373 if test -z "$CROSS_COMPILE" ; then
1379 # If uname -s returns "Windows_NT", we assume that we are using
1380 # the uname.exe in MKS toolkit.
1382 # The -r option of MKS uname only returns the major version number.
1383 # So we need to use its -v option to get the minor version number.
1384 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1388 OS_MINOR_RELEASE=`uname -v`
1389 if test "$OS_MINOR_RELEASE" = "00"; then
1392 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1394 CYGWIN32_NT|CYGWIN_NT*|MINGW*_NT*)
1396 # If uname -s returns "CYGWIN_NT-4.0", we assume that we are using
1397 # the uname.exe in the Cygwin tools.
1398 # Prior to the Beta 20 release, Cygwin was called GNU-Win32.
1399 # If uname -s returns "CYGWIN32/NT", we assume that we are using
1400 # the uname.exe in the GNU-Win32 tools.
1401 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1402 # the uname.exe in the MSYS tools.
1404 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1409 OS_RELEASE=`uname -v`.`uname -r`
1410 OS_TEST=${target_cpu}
1422 if "`cat /etc/bcheckrc | grep -c NCR 2>/dev/null`" != "0"; then
1426 OS_RELEASE=`uname -v`
1450 OS_RELEASE=`uname -v`
1456 OS_RELEASE=`uname -v`
1459 if test "$OS_TARGET" != "NTO"; then
1461 OS_RELEASE=`uname -v | sed 's/^\([0-9]\)\([0-9]*\)$/\1.\2/'`
1470 SINIX-N | SINIX-Y | SINIX-Z |ReliantUNIX-M)
1476 OS_RELEASE=`uname -v`
1480 case "${target_os}" in
1483 WINCE_WINDOWS_MOBILE=1
1484 AC_DEFINE(WINCE_WINDOWS_MOBILE)
1492 case "${target_cpu}" in
1503 if test -z "$CROSS_COMPILE" ; then
1511 if test "$OS_ARCH" = "NCR"; then
1513 OS_RELEASE=`awk '{print $3}' /etc/.relid | sed 's/^\([0-9]\)\(.\)\(..\)\(.*\)$/\2.\3/'`
1517 # Only set CPU_ARCH if we recognize the value of OS_TEST
1528 powerpc | ppc | rs6000)
1532 Alpha | alpha | ALPHA)
1561 if test -z "$OS_TARGET"; then
1564 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1566 dnl ========================================================
1567 dnl GNU specific defaults
1568 dnl ========================================================
1569 if test "$GNU_CC"; then
1570 # FIXME: Let us build with strict aliasing. bug 414641.
1571 CFLAGS="$CFLAGS -fno-strict-aliasing"
1572 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1573 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1574 DSO_LDOPTS='-shared'
1575 if test "$GCC_USE_GNU_LD"; then
1576 # Don't allow undefined symbols in libraries
1577 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1579 WARNINGS_AS_ERRORS='-Werror'
1581 DSO_PIC_CFLAGS='-fPIC'
1582 ASFLAGS="$ASFLAGS -fPIC"
1583 _MOZ_RTTI_FLAGS_ON=${_COMPILER_PREFIX}-frtti
1584 _MOZ_RTTI_FLAGS_OFF=${_COMPILER_PREFIX}-fno-rtti
1585 _MOZ_EXCEPTIONS_FLAGS_ON='-fexceptions'
1586 _MOZ_EXCEPTIONS_FLAGS_OFF='-fno-exceptions'
1588 # Turn on GNU specific features
1589 # -Wall - turn on all warnings
1590 # -pedantic - make compiler warn about non-ANSI stuff, and
1591 # be a little bit stricter
1592 # Warnings slamm took out for now (these were giving more noise than help):
1593 # -Wbad-function-cast - warns when casting a function to a new return type
1594 # -Wshadow - removed because it generates more noise than help --pete
1595 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith"
1596 if test -z "$INTEL_CC"; then
1597 # Don't use -Wcast-align with ICC
1599 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1600 hppa | ia64 | sparc | arm)
1603 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1608 dnl Turn pedantic on but disable the warnings for long long
1611 if test -z "$INTEL_CC"; then
1612 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1615 _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1616 _USE_CPP_INCLUDE_FLAG=1
1617 elif test "$SOLARIS_SUNPRO_CC"; then
1619 if test "$CPU_ARCH" = "sparc"; then
1620 # for Sun Studio on Solaris/SPARC
1621 DSO_PIC_CFLAGS='-xcode=pic32'
1623 DSO_PIC_CFLAGS='-KPIC'
1625 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1627 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1628 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1630 DSO_LDOPTS='-shared'
1631 if test "$GNU_LD"; then
1632 # Don't allow undefined symbols in libraries
1633 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1637 DSO_PIC_CFLAGS='-KPIC'
1638 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1641 if test "$GNU_CXX"; then
1642 # FIXME: Let us build with strict aliasing. bug 414641.
1643 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
1644 # Turn on GNU specific features
1645 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1646 if test -z "$INTEL_CC"; then
1647 # Don't use -Wcast-align with ICC
1649 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1650 hppa | ia64 | sparc | arm)
1653 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1658 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1659 _USE_CPP_INCLUDE_FLAG=1
1661 AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1662 ac_has_wno_invalid_offsetof,
1666 _SAVE_CXXFLAGS="$CXXFLAGS"
1667 CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1670 ac_has_wno_invalid_offsetof="yes",
1671 ac_has_wno_invalid_offsetof="no")
1672 CXXFLAGS="$_SAVE_CXXFLAGS"
1675 if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1676 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-invalid-offsetof"
1679 AC_CACHE_CHECK(whether the compiler supports -Wno-variadic-macros,
1680 ac_has_wno_variadic_macros,
1684 _SAVE_CXXFLAGS="$CXXFLAGS"
1685 CXXFLAGS="$CXXFLAGS ${_COMPILER_PREFIX}-Wno-variadic-macros"
1688 ac_has_wno_variadic_macros="yes",
1689 ac_has_wno_variadic_macros="no")
1690 CXXFLAGS="$_SAVE_CXXFLAGS"
1693 if test "$ac_has_wno_variadic_macros" = "yes"; then
1694 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-Wno-variadic-macros"
1697 AC_CACHE_CHECK(whether the compiler supports -Werror=return-type,
1698 ac_has_werror_return_type,
1702 _SAVE_CXXFLAGS="$CXXFLAGS"
1703 CXXFLAGS="$CXXFLAGS -Werror=return-type"
1706 ac_has_werror_return_type="yes",
1707 ac_has_werror_return_type="no")
1708 CXXFLAGS="$_SAVE_CXXFLAGS"
1711 if test "$ac_has_werror_return_type" = "yes"; then
1712 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=return-type"
1716 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1719 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1720 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1721 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1722 dnl normal behavior.
1723 dnl ========================================================
1725 MKSHLIB_UNFORCE_ALL=
1727 if test "$COMPILE_ENVIRONMENT"; then
1728 if test "$GNU_CC"; then
1729 AC_MSG_CHECKING(whether ld has archive extraction flags)
1730 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1731 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1732 ac_cv_mkshlib_force_and_unforce="no"
1733 exec 3<&0 <<LOOP_INPUT
1734 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
1735 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1736 force="-Wl,-all"; unforce="-Wl,-none"
1743 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1746 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1748 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1752 eval $ac_cv_mkshlib_force_and_unforce
1753 MKSHLIB_FORCE_ALL=$force
1754 MKSHLIB_UNFORCE_ALL=$unforce
1757 fi # COMPILE_ENVIRONMENT
1759 dnl =================================================================
1760 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1761 dnl which is bad when cross compiling.
1762 dnl =================================================================
1763 if test "$COMPILE_ENVIRONMENT"; then
1764 configure_static_assert_macros='
1765 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1766 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1767 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1770 dnl test that the macros actually work:
1771 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1772 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1775 ac_cv_static_assertion_macros_work="yes"
1776 AC_TRY_COMPILE([$configure_static_assert_macros],
1777 [CONFIGURE_STATIC_ASSERT(1)],
1779 ac_cv_static_assertion_macros_work="no")
1780 AC_TRY_COMPILE([$configure_static_assert_macros],
1781 [CONFIGURE_STATIC_ASSERT(0)],
1782 ac_cv_static_assertion_macros_work="no",
1785 AC_TRY_COMPILE([$configure_static_assert_macros],
1786 [CONFIGURE_STATIC_ASSERT(1)],
1788 ac_cv_static_assertion_macros_work="no")
1789 AC_TRY_COMPILE([$configure_static_assert_macros],
1790 [CONFIGURE_STATIC_ASSERT(0)],
1791 ac_cv_static_assertion_macros_work="no",
1795 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1796 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1797 AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1799 fi # COMPILE_ENVIRONMENT
1801 dnl ========================================================
1802 dnl Checking for 64-bit OS
1803 dnl ========================================================
1804 if test "$COMPILE_ENVIRONMENT"; then
1807 AC_MSG_CHECKING(for 64-bit OS)
1808 AC_TRY_COMPILE([$configure_static_assert_macros],
1809 [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1810 result="yes", result="no")
1811 AC_MSG_RESULT("$result")
1812 if test "$result" = "yes"; then
1813 AC_DEFINE(HAVE_64BIT_OS)
1816 AC_SUBST(HAVE_64BIT_OS)
1818 fi # COMPILE_ENVIRONMENT
1820 dnl ========================================================
1821 dnl Enable high-memory support on OS/2 by default.
1822 dnl ========================================================
1823 MOZ_OS2_HIGH_MEMORY=1
1824 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
1825 [ --disable-os2-high-mem Disable high-memory support on OS/2],
1826 MOZ_OS2_HIGH_MEMORY=,
1827 MOZ_OS2_HIGH_MEMORY=1 )
1828 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
1830 dnl ========================================================
1831 dnl = Use profiling compile flags
1832 dnl ========================================================
1833 MOZ_ARG_ENABLE_BOOL(profiling,
1834 [ --enable-profiling Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1838 dnl ========================================================
1839 dnl System overrides of the defaults for host
1840 dnl ========================================================
1843 HOST_CFLAGS="$HOST_CFLAGS -DXP_BEOS -DBeOS -DBEOS -D_POSIX_SOURCE -DNO_X11"
1844 HOST_NSPR_MDCPUCFG='\"md/_beos.cfg\"'
1845 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1848 *cygwin*|*mingw*|*mks*|*msvc*|*wince|*winmo)
1849 if test -n "$_WIN32_MSVC"; then
1851 HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1852 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1853 HOST_RANLIB='echo ranlib'
1855 HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1857 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1858 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1859 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1860 HOST_BIN_SUFFIX=.exe
1863 dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1864 PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1867 CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1868 if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1870 CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1872 if test "`${PERL} -v | grep -c cygwin 2>/dev/null`" = 0; then
1874 PERL="${CYGWIN_WRAPPER} $PERL"
1877 if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1878 PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1883 case "${host_cpu}" in
1885 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1891 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1892 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1893 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1896 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1897 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1898 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1899 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1903 HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1904 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1905 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1906 HOST_BIN_SUFFIX=.exe
1911 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1912 HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1913 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1917 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1918 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1922 dnl We require version 2.5 or newer of Python to build.
1923 AC_MSG_CHECKING([for minimum required Python version >= $PYTHON_VERSION])
1925 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1])" $PYTHON_VERSION
1928 if test "$_python_res" != 0; then
1929 AC_MSG_ERROR([Python $PYTHON_VERSION or higher is required.])
1931 AC_MSG_RESULT([yes])
1933 dnl Get mozilla version from central milestone file
1934 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1936 dnl Get version of various core apps from the version files.
1937 FIREFOX_VERSION=`cat $topsrcdir/browser/config/version.txt`
1939 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1940 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1942 dnl ========================================================
1943 dnl System overrides of the defaults for target
1944 dnl ========================================================
1949 if test ! "$GNU_CC"; then
1950 if test ! "$HAVE_64BIT_OS"; then
1951 # Compiling with Visual Age C++ object model compat is the
1952 # default. To compile with object model ibm, add
1953 # AIX_OBJMODEL=ibm to .mozconfig.
1954 if test "$AIX_OBJMODEL" = "ibm"; then
1955 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1962 AC_SUBST(AIX_OBJMODEL)
1963 DSO_LDOPTS='-qmkshrobj=1'
1964 DSO_CFLAGS='-qflag=w:w'
1966 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1967 AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1969 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1970 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1971 if test "$COMPILE_ENVIRONMENT"; then
1974 AC_MSG_CHECKING([for VisualAge C++ compiler version >= 6.0.0.3])
1976 [#if (__IBMCPP__ < 600)
1977 #error "Bad compiler"
1979 _BAD_COMPILER=,_BAD_COMPILER=1)
1980 if test -n "$_BAD_COMPILER"; then
1982 AC_MSG_ERROR([VisualAge C++ version 6.0.0.3 or higher is required to build.])
1984 AC_MSG_RESULT([yes])
1987 TARGET_COMPILER_ABI="ibmc"
1988 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1989 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1992 case "${target_os}" in
1997 if test "$COMPILE_ENVIRONMENT"; then
1998 AC_CHECK_HEADERS(sys/inttypes.h)
2000 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2005 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
2006 _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
2007 DSO_LDOPTS='-nostart'
2008 TK_LIBS='-lbe -lroot'
2010 if test "$COMPILE_ENVIRONMENT"; then
2011 AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
2012 AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
2014 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
2015 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
2018 MOZ_USER_DIR="Mozilla"
2022 dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
2031 _WARNINGS_CFLAGS="-Wall"
2032 _WARNINGS_CXXFLAGS="-Wall"
2033 # The test above doesn't work properly, at least on 3.1.
2034 MKSHLIB_FORCE_ALL=''
2035 MKSHLIB_UNFORCE_ALL=''
2041 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2042 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2043 # If we're building with --enable-profiling, we need a frame pointer.
2044 if test -z "$MOZ_PROFILING"; then
2045 MOZ_OPTIMIZE_FLAGS="-O3 -fomit-frame-pointer"
2047 MOZ_OPTIMIZE_FLAGS="-O3 -fno-omit-frame-pointer"
2050 CFLAGS="$CFLAGS -fpascal-strings -fno-common"
2051 CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
2054 STRIP="$STRIP -x -S"
2055 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
2056 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
2057 # The ExceptionHandling framework is needed for Objective-C exception
2058 # logging code in nsObjCExceptions.h. Currently we only use that in debug
2060 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
2062 dnl DTrace and -dead_strip don't interact well. See bug 403132.
2063 dnl ===================================================================
2064 if test "x$enable_dtrace" = "xyes"; then
2065 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
2067 dnl check for the presence of the -dead_strip linker flag
2068 AC_MSG_CHECKING([for -dead_strip option to ld])
2069 _SAVE_LDFLAGS=$LDFLAGS
2070 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
2071 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
2072 if test -n "$_HAVE_DEAD_STRIP" ; then
2073 AC_MSG_RESULT([yes])
2074 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
2079 LDFLAGS=$_SAVE_LDFLAGS
2081 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
2085 if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
2086 DLL_SUFFIX=".so.1.0"
2087 DSO_LDOPTS="-shared"
2089 if test ! "$GNU_CC"; then
2090 DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
2096 if test ! "$GNU_CC"; then
2100 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2101 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2102 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2105 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2106 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2110 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2111 AC_DEFINE(_LARGEFILE64_SOURCE)
2116 if test ! "$GNU_CC"; then
2117 DSO_LDOPTS='-b -Wl,+s'
2120 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2121 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2122 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2124 DSO_LDOPTS='-b -E +s'
2125 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2126 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2128 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2129 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2134 DSO_LDOPTS='-elf -shared'
2136 if test "$GNU_CC"; then
2137 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2138 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2139 MKSHLIB_FORCE_ALL='-Wl,-all'
2140 MKSHLIB_UNFORCE_ALL='-Wl,-none'
2141 CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2143 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2144 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2145 MKSHLIB_FORCE_ALL='-all'
2146 MKSHLIB_UNFORCE_ALL='-none'
2152 dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must*
2153 dnl compile and link using -n32
2155 TARGET_COMPILER_ABI=n32
2156 DSO_LDOPTS='-elf -shared'
2157 MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2158 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2159 _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
2160 _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
2161 if test "$GNU_CC"; then
2162 MKSHLIB_FORCE_ALL='-Wl,-all'
2163 MKSHLIB_UNFORCE_ALL='-Wl,-none'
2164 _WARNINGS_CFLAGS="-Wall"
2165 _WARNINGS_CXXFLAGS="-Wall"
2166 CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2168 MKSHLIB_FORCE_ALL='-all'
2169 MKSHLIB_UNFORCE_ALL='-none'
2175 CFLAGS="$CFLAGS -woff 3262 -G 4"
2176 CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
2177 if test -n "$USE_N32"; then
2178 ASFLAGS="$ASFLAGS -n32"
2179 CFLAGS="$CFLAGS -n32"
2180 CXXFLAGS="$CXXFLAGS -n32"
2181 LDFLAGS="$LDFLAGS -n32"
2183 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2184 AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
2187 if test -z "$GNU_CXX"; then
2193 # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2194 # Similarly for GNU_CXX and INTEL_CXX.
2195 if test "$INTEL_CC" -o "$INTEL_CXX"; then
2196 # -Os has been broken on Intel's C/C++ compilers for quite a
2197 # while; Intel recommends against using it.
2198 MOZ_OPTIMIZE_FLAGS="-O2"
2199 MOZ_DEBUG_FLAGS="-g"
2200 elif test "$GNU_CC" -o "$GNU_CXX"; then
2201 GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2202 case $GCC_VERSION in
2204 # -Os is broken on gcc 4.1.x 4.2.x, 4.5.x we need to tweak it to get good results.
2205 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2207 # If we're building with --enable-profiling, we need a frame pointer.
2208 if test -z "$MOZ_PROFILING"; then
2209 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fomit-frame-pointer $MOZ_OPTIMIZE_SIZE_TWEAK"
2211 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-omit-frame-pointer $MOZ_OPTIMIZE_SIZE_TWEAK"
2213 MOZ_DEBUG_FLAGS="-g"
2216 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2220 case "${target_cpu}" in
2222 CFLAGS="$CFLAGS -mieee"
2223 CXXFLAGS="$CXXFLAGS -mieee"
2229 MOZ_DEBUG_FLAGS="-g" # We want inlining
2235 TARGET_COMPILER_ABI=msvc
2236 _PLATFORM_DEFAULT_TOOLKIT=cairo-windows
2237 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2238 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2240 AR_EXTRACT="$AR -extract"
2242 AR_FLAGS='-OUT:"$@"'
2246 ac_configure_args="$ac_configure_args --enable-win32-target=WINCE"
2248 if test "$AS_BIN"; then
2255 if test -z "$RC"; then
2258 # certain versions of cygwin's makedepend barf on the
2259 # #include <string> vs -I./dist/include/string issue so don't use it
2265 HOST_AR='lib -OUT:$@'
2266 HOST_RANLIB='echo ranlib'
2267 HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
2270 WARNINGS_AS_ERRORS='-WX'
2271 MOZ_OPTIMIZE_FLAGS='-Ox'
2272 AR_FLAGS='-NOLOGO -OUT:"$@"'
2274 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2275 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2278 DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
2279 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2281 IMPORT_LIB_SUFFIX=lib
2282 dnl Need to force-link against mozalloc because it's used in the shunt
2283 LIBS="$LIBS \$(LIBXUL_DIST)/lib/mozalloc.lib"
2284 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2287 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2288 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2290 MKSHLIB_UNFORCE_ALL=
2291 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2292 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2293 MOZ_DEBUG_FLAGS='-Zi'
2294 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2296 MOZ_JS_STATIC_LIBS='$(LIBXUL_DIST)/lib/js_static.lib'
2297 MOZ_JS_SHARED_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2299 RANLIB='echo not_ranlib'
2300 STRIP='echo not_strip'
2301 TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
2304 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2308 AC_DEFINE(HAVE_SNPRINTF)
2313 AC_DEFINE(HW_THREADS)
2314 AC_DEFINE(STDC_HEADERS)
2315 AC_DEFINE(NEW_H, <new>)
2316 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2317 AC_DEFINE(HAVE_LOCALTIME_R)
2319 TARGET_MD_ARCH=win32
2320 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2322 MOZ_USER_DIR="Mozilla"
2324 MOZ_GFX_OPTIMIZE_MOBILE=1
2326 # Sanity check for WINCE_WINDOWS_MOBILE
2327 # XXX disabled until we can fix the mobile tinderbox
2328 ##if test "$WINCE_WINDOWS_MOBILE"; then
2329 ## AC_CHECK_HEADER(tpcshell.h, [],
2330 ## AC_MSG_ERROR([Can't find tpcshell.h in your SDK; are you sure you don't need --disable-windows-mobile-components?]))
2335 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2340 # certain versions of cygwin's makedepend barf on the
2341 # #include <string> vs -I./dist/include/string issue so don't use it
2343 if test -n "$GNU_CC"; then
2344 CC="$CC -mno-cygwin"
2345 CXX="$CXX -mno-cygwin"
2346 CPP="$CPP -mno-cygwin"
2347 CFLAGS="$CFLAGS -mms-bitfields"
2348 CXXFLAGS="$CXXFLAGS -mms-bitfields"
2349 DSO_LDOPTS='-shared'
2350 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2351 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2353 # Use temp file for windres (bug 213281)
2354 RCFLAGS='-O coff --use-temp-file'
2355 # mingw doesn't require kernel32, user32, and advapi32 explicitly
2356 LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32"
2357 MOZ_JS_STATIC_LIBS='-L$(LIBXUL_DIST)/bin -ljs_static'
2358 MOZ_JS_SHARED_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
2360 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2361 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2363 IMPORT_LIB_SUFFIX=dll.a
2364 GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2366 TARGET_COMPILER_ABI=msvc
2370 if test "$AS_BIN"; then
2371 AS="$(basename "$AS_BIN")"
2373 AR='lib -NOLOGO -OUT:"$@"'
2375 RANLIB='echo not_ranlib'
2376 STRIP='echo not_strip'
2382 GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2388 IMPORT_LIB_SUFFIX=lib
2389 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2390 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2392 MKSHLIB_UNFORCE_ALL=
2393 DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2394 _USE_CPP_INCLUDE_FLAG=1
2395 _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2396 _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2397 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2398 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2399 CXXFLAGS="$CXXFLAGS -wd4800" # disable warning "forcing value to bool"
2400 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2401 MOZ_DEBUG_FLAGS='-Zi'
2402 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2403 WARNINGS_AS_ERRORS='-WX'
2404 # If we're building with --enable-profiling, we need -Oy-, which forces a frame pointer.
2405 if test -z "$MOZ_PROFILING"; then
2406 MOZ_OPTIMIZE_FLAGS='-O1'
2408 MOZ_OPTIMIZE_FLAGS='-O1 -Oy-'
2410 MOZ_JS_STATIC_LIBS='$(LIBXUL_DIST)/lib/js_static.lib'
2411 MOZ_JS_SHARED_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2413 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2414 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2415 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2416 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2417 if test $_MSC_VER -ge 1400; then
2418 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2419 dnl For profile-guided optimization
2420 PROFILE_GEN_CFLAGS="-GL"
2421 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2422 dnl XXX: PGO builds can fail with warnings treated as errors,
2423 dnl specifically "no profile data available" appears to be
2424 dnl treated as an error sometimes. This might be a consequence
2425 dnl of using WARNINGS_AS_ERRORS in some modules, combined
2426 dnl with the linker doing most of the work in the whole-program
2427 dnl optimization/PGO case. I think it's probably a compiler bug,
2428 dnl but we work around it here.
2429 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2430 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2431 dnl Probably also a compiler bug, but what can you do?
2432 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2433 if test -n "$_USE_DYNAMICBASE"; then
2434 LDFLAGS="$LDFLAGS -DYNAMICBASE"
2438 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg32$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2439 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2440 AC_DEFINE(HAVE_SNPRINTF)
2445 AC_DEFINE(HW_THREADS)
2446 AC_DEFINE(STDC_HEADERS)
2447 AC_DEFINE(NEW_H, <new>)
2448 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2449 TARGET_MD_ARCH=win32
2450 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2452 MOZ_USER_DIR="Mozilla"
2454 dnl Hardcode to win95 for now - cls
2455 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2457 dnl set NO_X11 defines here as the general check is skipped on win32
2461 dnl MinGW/MSYS doesn't provide or need cygpath
2466 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2468 *-cygwin*|*-msvc*|*-mks*)
2469 CYGPATH_W="cygpath -a -w"
2470 CYGPATH_S="sed -e s|\\\\|/|g"
2471 MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2475 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2477 if test -z "$MOZ_TOOLS"; then
2478 AC_MSG_ERROR([MOZ_TOOLS is not set])
2481 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2482 if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2483 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2485 MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2486 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2487 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2489 MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2496 AC_MSG_WARN([Using a cygwin build environment is unsupported. Configure cannot check for the presence of necessary headers. Please upgrade to MozillaBuild; see http://developer.mozilla.org/en/docs/Windows_Build_Prerequisites])
2500 AC_CHECK_HEADERS(oleacc.idl)
2504 AC_CHECK_HEADERS(atlbase.h)
2511 if test "$HAVE_64BIT_OS"; then
2512 AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2515 if test $_MSC_VER -ge 1400; then
2516 LDFLAGS="$LDFLAGS -SAFESEH"
2518 AC_CHECK_HEADERS(mmintrin.h)
2531 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2535 if test "$HAVE_64BIT_OS"; then
2542 CFLAGS="$CFLAGS -Dunix"
2543 CXXFLAGS="$CXXFLAGS -Dunix"
2544 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2546 DSO_PIC_CFLAGS='-fPIC -DPIC'
2547 DSO_LDOPTS='-shared'
2548 BIN_FLAGS='-Wl,--export-dynamic'
2550 DSO_PIC_CFLAGS='-fPIC -DPIC'
2551 DLL_SUFFIX=".so.1.0"
2552 DSO_LDOPTS='-shared'
2554 # This will fail on a.out systems prior to 1.5.1_ALPHA.
2555 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2556 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2557 if test "$LIBRUNPATH"; then
2558 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2560 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2561 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2566 AC_DEFINE(_QNX_SOURCE)
2569 WARNINGS_AS_ERRORS=''
2570 MOZ_OPTIMIZE_FLAGS="-O"
2571 MOZ_DEBUG_FLAGS="-gstabs"
2574 LIBS="$LIBS -lsocket -lstdc++"
2575 _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2576 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2577 if test "$with_x" != "yes"
2579 _PLATFORM_DEFAULT_TOOLKIT="photon"
2580 TK_CFLAGS='-I/usr/include/photon'
2583 case "${target_cpu}" in
2585 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
2588 case "${host_cpu}" in
2596 DLL_SUFFIX=".so.1.0"
2598 DSO_PIC_CFLAGS='-fPIC'
2599 DSO_LDOPTS='-shared -fPIC'
2600 if test "$LIBRUNPATH"; then
2601 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2606 AC_DEFINE(NO_PW_GECOS)
2607 AC_DEFINE(NO_UDSOCK)
2608 AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2610 MKSHLIB_FORCE_ALL='-all'
2611 MKSHLIB_UNFORCE_ALL='-none'
2613 AS_DASH_C_FLAG='-Wc/names=as_is'
2615 DSO_LDOPTS='-shared -auto_symvec'
2617 MOZ_DEBUG_LDFLAGS='-g'
2619 CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2620 CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2625 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2626 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2629 AC_DEFINE(OS2EMX_PLAIN_CHAR)
2630 AC_DEFINE(TCPV40HDRS)
2636 IMPORT_LIB_SUFFIX=lib
2640 CFLAGS="$CFLAGS -Zomf"
2641 CXXFLAGS="$CXXFLAGS -Zomf"
2643 BIN_FLAGS='-Zlinker /ST:0x100000'
2647 WARNINGS_AS_ERRORS='-Werror'
2648 MOZ_DEBUG_FLAGS="-g -fno-inline"
2649 MOZ_OPTIMIZE_FLAGS="-O2"
2650 MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2651 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2652 LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2654 _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2657 MOZ_USER_DIR="Mozilla"
2659 if test "$MOZTOOLS"; then
2660 MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2662 AC_MSG_ERROR([MOZTOOLS is not set])
2664 if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2665 DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2666 LDFLAGS="$LDFLAGS -Zhigh-mem"
2667 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2668 AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2671 # GCC for OS/2 currently predefines these, but we don't want them
2672 _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2673 _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2675 AC_CACHE_CHECK(for __declspec(dllexport),
2677 [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2679 ac_os2_declspec="yes",
2680 ac_os2_declspec="no")])
2681 if test "$ac_os2_declspec" != "yes"; then
2682 AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
2687 if test "$GNU_CC"; then
2688 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2689 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2692 MOZ_DEBUG_FLAGS='-g'
2693 ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2694 CFLAGS="$CFLAGS -ieee"
2695 CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee -ptr $(DIST)/cxx_repository'
2696 DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2699 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2700 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2701 MKSHLIB_FORCE_ALL='-all'
2702 MKSHLIB_UNFORCE_ALL='-none'
2703 dnl Might fix the libxpcom.so breakage on this platform as well....
2704 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2705 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2707 if test -z "$GNU_CXX"; then
2710 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2714 DIRENT_INO=d_stat.st_ino
2715 dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2716 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2717 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2718 dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2719 AC_DEFINE(STDC_HEADERS)
2720 if test "$no_x" = "yes"; then
2721 _PLATFORM_DEFAULT_TOOLKIT='photon'
2722 TK_CFLAGS='-I/usr/nto/include/photon'
2723 TK_LIBS='-lphoton -lphrender'
2728 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2729 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2730 CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2731 if test ! "$GNU_CC"; then
2738 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2741 # $ORIGIN/.. is for shared libraries under components/ to locate shared
2742 # libraries one level up (e.g. libnspr4.so)
2743 if test "$SOLARIS_SUNPRO_CC"; then
2744 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2745 LIBS="-lCrun -lCstd -lc $LIBS"
2747 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2748 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2749 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2750 _MOZ_EXCEPTIONS_FLAGS_ON='-features=except'
2751 _MOZ_EXCEPTIONS_FLAGS_OFF='-features=no%except'
2752 LDFLAGS="-xildoff $LDFLAGS"
2753 if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2754 _SAVE_LDFLAGS=$LDFLAGS
2755 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2756 AC_TRY_LINK([#include <stdio.h>],
2757 [printf("Hello World\n");],
2759 [LDFLAGS=$_SAVE_LDFLAGS])
2761 WARNINGS_AS_ERRORS='-Werror'
2762 MOZ_OPTIMIZE_FLAGS="-xO4"
2763 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2764 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2765 MKSHLIB_FORCE_ALL='-z allextract'
2766 MKSHLIB_UNFORCE_ALL='-z defaultextract'
2773 AS='/usr/ccs/bin/as'
2774 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2776 TARGET_COMPILER_ABI="sunc"
2777 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2778 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2779 AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2783 [#if (__SUNPRO_CC < 0x590)
2786 _BAD_COMPILER=,_BAD_COMPILER=1)
2787 if test -n "$_BAD_COMPILER"; then
2789 AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2794 [#if (__SUNPRO_CC >= 0x5100)
2795 #error "Sun C++ 5.10 or above"
2797 _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2798 if test "$_ABOVE_SS12U1"; then
2800 CXXFLAGS="$CXXFLAGS -xannotate=no"
2802 AC_MSG_RESULT([$_res])
2805 LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2807 MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2808 MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2809 ASFLAGS="$ASFLAGS -fPIC"
2810 DSO_LDOPTS='-shared'
2812 _WARNINGS_CXXFLAGS=''
2813 if test "$OS_RELEASE" = "5.3"; then
2814 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2817 if test "$OS_RELEASE" = "5.5.1"; then
2818 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2823 DSO_LDOPTS='-Bdynamic'
2824 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2825 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2827 AC_DEFINE(SPRINTF_RETURNS_STRING)
2828 case "$(target_os)" in
2830 DLL_SUFFIX='.so.1.0'
2836 NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2840 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2844 AC_DEFINE(NO_PW_GECOS)
2846 _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2847 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2849 MOZ_GFX_OPTIMIZE_MOBILE=1
2850 # If we're building with --enable-profiling, we need a frame pointer.
2851 if test -z "$MOZ_PROFILING"; then
2852 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fomit-frame-pointer"
2854 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fno-omit-frame-pointer"
2860 dnl Only one oddball right now (QNX), but this gives us flexibility
2861 dnl if any other platforms need to override this in the future.
2862 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2864 dnl ========================================================
2865 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2866 dnl by now will not have any way to link most binaries (tests
2867 dnl as well as viewer, apprunner, etc.), because some symbols
2868 dnl will be left out of the "composite" .so's by ld as unneeded.
2869 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2870 dnl they can link in the static libs that provide the missing
2872 dnl ========================================================
2873 NO_LD_ARCHIVE_FLAGS=
2874 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2875 NO_LD_ARCHIVE_FLAGS=1
2879 NO_LD_ARCHIVE_FLAGS=
2882 NO_LD_ARCHIVE_FLAGS=
2885 NO_LD_ARCHIVE_FLAGS=
2887 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince|*-winmo)
2888 if test -z "$GNU_CC"; then
2889 NO_LD_ARCHIVE_FLAGS=
2893 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2895 dnl ========================================================
2896 dnl = Flags to strip unused symbols from .so components and
2897 dnl = to export jemalloc symbols when linking a program
2898 dnl ========================================================
2900 *-linux*|*-kfreebsd*-gnu|*-gnu*)
2901 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2902 MOZ_JEMALLOC_STANDALONE_GLUE_LDOPTS='-rdynamic -Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/jemalloc-standalone-linkage-version-script'
2905 if test -z "$GNU_CC"; then
2906 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2908 if test -z "$GCC_USE_GNU_LD"; then
2909 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2911 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2916 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2919 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2921 *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince|*-winmo)
2922 if test -n "$GNU_CC"; then
2923 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2928 if test -z "$COMPILE_ENVIRONMENT"; then
2929 SKIP_COMPILER_CHECKS=1
2930 SKIP_LIBRARY_CHECKS=1
2933 if test -z "$SKIP_COMPILER_CHECKS"; then
2934 dnl Checks for typedefs, structures, and compiler characteristics.
2935 dnl ========================================================
2943 AC_MSG_CHECKING(for __stdcall)
2944 AC_CACHE_VAL(ac_cv___stdcall,
2945 [AC_TRY_COMPILE([template <typename Method> struct foo;
2946 template <> struct foo<void (*)()> {};
2947 template <> struct foo<void (__stdcall*)()> {};],
2949 [ac_cv___stdcall=true],
2950 [ac_cv___stdcall=false])])
2951 if test "$ac_cv___stdcall" = true ; then
2952 AC_DEFINE(HAVE_STDCALL)
2958 AC_MSG_CHECKING(for ssize_t)
2959 AC_CACHE_VAL(ac_cv_type_ssize_t,
2960 [AC_TRY_COMPILE([#include <stdio.h>
2961 #include <sys/types.h>],
2963 [ac_cv_type_ssize_t=true],
2964 [ac_cv_type_ssize_t=false])])
2965 if test "$ac_cv_type_ssize_t" = true ; then
2966 AC_DEFINE(HAVE_SSIZE_T)
2971 AC_STRUCT_ST_BLKSIZE
2972 AC_MSG_CHECKING(for siginfo_t)
2973 AC_CACHE_VAL(ac_cv_siginfo_t,
2974 [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2975 #include <signal.h>],
2977 [ac_cv_siginfo_t=true],
2978 [ac_cv_siginfo_t=false])])
2979 if test "$ac_cv_siginfo_t" = true ; then
2980 AC_DEFINE(HAVE_SIGINFO_T)
2986 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2987 dnl ========================================================
2988 AC_MSG_CHECKING(for int16_t)
2989 AC_CACHE_VAL(ac_cv_int16_t,
2990 [AC_TRY_COMPILE([#include <stdio.h>
2991 #include <sys/types.h>],
2993 [ac_cv_int16_t=true],
2994 [ac_cv_int16_t=false])])
2995 if test "$ac_cv_int16_t" = true ; then
2996 AC_DEFINE(HAVE_INT16_T)
3001 AC_MSG_CHECKING(for int32_t)
3002 AC_CACHE_VAL(ac_cv_int32_t,
3003 [AC_TRY_COMPILE([#include <stdio.h>
3004 #include <sys/types.h>],
3006 [ac_cv_int32_t=true],
3007 [ac_cv_int32_t=false])])
3008 if test "$ac_cv_int32_t" = true ; then
3009 AC_DEFINE(HAVE_INT32_T)
3014 AC_MSG_CHECKING(for int64_t)
3015 AC_CACHE_VAL(ac_cv_int64_t,
3016 [AC_TRY_COMPILE([#include <stdio.h>
3017 #include <sys/types.h>],
3019 [ac_cv_int64_t=true],
3020 [ac_cv_int64_t=false])])
3021 if test "$ac_cv_int64_t" = true ; then
3022 AC_DEFINE(HAVE_INT64_T)
3027 AC_MSG_CHECKING(for int64)
3028 AC_CACHE_VAL(ac_cv_int64,
3029 [AC_TRY_COMPILE([#include <stdio.h>
3030 #include <sys/types.h>],
3033 [ac_cv_int64=false])])
3034 if test "$ac_cv_int64" = true ; then
3035 AC_DEFINE(HAVE_INT64)
3040 AC_MSG_CHECKING(for uint)
3041 AC_CACHE_VAL(ac_cv_uint,
3042 [AC_TRY_COMPILE([#include <stdio.h>
3043 #include <sys/types.h>],
3046 [ac_cv_uint=false])])
3047 if test "$ac_cv_uint" = true ; then
3048 AC_DEFINE(HAVE_UINT)
3053 AC_MSG_CHECKING(for uint_t)
3054 AC_CACHE_VAL(ac_cv_uint_t,
3055 [AC_TRY_COMPILE([#include <stdio.h>
3056 #include <sys/types.h>],
3058 [ac_cv_uint_t=true],
3059 [ac_cv_uint_t=false])])
3060 if test "$ac_cv_uint_t" = true ; then
3061 AC_DEFINE(HAVE_UINT_T)
3066 AC_MSG_CHECKING(for uint16_t)
3067 AC_CACHE_VAL(ac_cv_uint16_t,
3068 [AC_TRY_COMPILE([#include <stdio.h>
3069 #include <sys/types.h>],
3070 [uint16_t foo = 0;],
3071 [ac_cv_uint16_t=true],
3072 [ac_cv_uint16_t=false])])
3073 if test "$ac_cv_uint16_t" = true ; then
3074 AC_DEFINE(HAVE_UINT16_T)
3080 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
3081 dnl are defined when compiling C++ but not C. Since the result of this
3082 dnl test is used only in C++, do it in C++.
3085 AC_MSG_CHECKING(for uname.domainname)
3086 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
3087 [AC_TRY_COMPILE([#include <sys/utsname.h>],
3088 [ struct utsname *res; char *domain;
3089 (void)uname(res); if (res != 0) { domain = res->domainname; } ],
3090 [ac_cv_have_uname_domainname_field=true],
3091 [ac_cv_have_uname_domainname_field=false])])
3093 if test "$ac_cv_have_uname_domainname_field" = "true"; then
3094 AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
3100 AC_MSG_CHECKING(for uname.__domainname)
3101 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
3102 [AC_TRY_COMPILE([#include <sys/utsname.h>],
3103 [ struct utsname *res; char *domain;
3104 (void)uname(res); if (res != 0) { domain = res->__domainname; } ],
3105 [ac_cv_have_uname_us_domainname_field=true],
3106 [ac_cv_have_uname_us_domainname_field=false])])
3108 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
3109 AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
3117 dnl Check for usable char16_t (2 bytes, unsigned)
3118 dnl (we might not need the unsignedness check anymore)
3119 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
3120 ac_cv_have_usable_char16_t,
3121 [AC_TRY_COMPILE([$configure_static_assert_macros],
3122 [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
3123 CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
3124 CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
3125 CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
3126 CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
3127 ac_cv_have_usable_char16_t="yes",
3128 ac_cv_have_usable_char16_t="no")])
3129 if test "$ac_cv_have_usable_char16_t" = "yes"; then
3130 AC_DEFINE(HAVE_CPP_CHAR16_T)
3134 dnl Check for usable wchar_t (2 bytes, unsigned)
3135 dnl (we really don't need the unsignedness check anymore)
3136 dnl ========================================================
3138 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
3139 ac_cv_have_usable_wchar_v2,
3140 [AC_TRY_COMPILE([#include <stddef.h>
3141 $configure_static_assert_macros],
3142 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3143 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3144 ac_cv_have_usable_wchar_v2="yes",
3145 ac_cv_have_usable_wchar_v2="no")])
3146 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
3147 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3148 HAVE_CPP_2BYTE_WCHAR_T=1
3149 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
3150 dnl This is really gcc-only
3151 dnl Do this test using CXX only since some versions of gcc
3152 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
3153 dnl only have short-wchar support for c++.
3154 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
3156 _SAVE_CXXFLAGS=$CXXFLAGS
3157 CXXFLAGS="$CXXFLAGS -fshort-wchar"
3159 AC_CACHE_CHECK(for compiler -fshort-wchar option,
3160 ac_cv_have_usable_wchar_option_v2,
3161 [AC_TRY_LINK([#include <stddef.h>
3162 $configure_static_assert_macros],
3163 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3164 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3165 ac_cv_have_usable_wchar_option_v2="yes",
3166 ac_cv_have_usable_wchar_option_v2="no")])
3168 if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
3169 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3170 HAVE_CPP_2BYTE_WCHAR_T=1
3171 if test "$OS_TARGET" = Android; then
3172 WCHAR_CFLAGS="-fshort-wchar -Wl,--no-wchar-size-warning"
3173 CXXFLAGS="$CXXFLAGS -Wl,--no-wchar-size-warning"
3174 CFLAGS="$CFLAGS -Wl,--no-wchar-size-warning"
3175 DSO_LDOPTS="$DSO_LDOPTS -Wl,--no-wchar-size-warning"
3177 WCHAR_CFLAGS="-fshort-wchar"
3180 CXXFLAGS=$_SAVE_CXXFLAGS
3186 dnl Check for .hidden assembler directive and visibility attribute.
3187 dnl Borrowed from glibc configure.in
3188 dnl ===============================================================
3189 if test "$GNU_CC"; then
3190 AC_CACHE_CHECK(for visibility(hidden) attribute,
3191 ac_cv_visibility_hidden,
3192 [cat > conftest.c <<EOF
3193 int foo __attribute__ ((visibility ("hidden"))) = 1;
3195 ac_cv_visibility_hidden=no
3196 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3197 if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3198 ac_cv_visibility_hidden=yes
3203 if test "$ac_cv_visibility_hidden" = "yes"; then
3204 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
3206 AC_CACHE_CHECK(for visibility(default) attribute,
3207 ac_cv_visibility_default,
3208 [cat > conftest.c <<EOF
3209 int foo __attribute__ ((visibility ("default"))) = 1;
3211 ac_cv_visibility_default=no
3212 if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3213 if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3214 ac_cv_visibility_default=yes
3219 if test "$ac_cv_visibility_default" = "yes"; then
3220 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
3222 AC_CACHE_CHECK(for visibility pragma support,
3223 ac_cv_visibility_pragma,
3224 [cat > conftest.c <<EOF
3225 #pragma GCC visibility push(hidden)
3227 #pragma GCC visibility push(default)
3228 int foo_default = 1;
3230 ac_cv_visibility_pragma=no
3231 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3232 if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
3233 if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
3234 ac_cv_visibility_pragma=yes
3240 if test "$ac_cv_visibility_pragma" = "yes"; then
3241 AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
3242 ac_cv_have_visibility_class_bug,
3243 [cat > conftest.c <<EOF
3244 #pragma GCC visibility push(hidden)
3245 struct __attribute__ ((visibility ("default"))) TestStruct {
3248 __attribute__ ((visibility ("default"))) void TestFunc() {
3252 ac_cv_have_visibility_class_bug=no
3253 if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3254 ac_cv_have_visibility_class_bug=yes
3256 if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
3257 ac_cv_have_visibility_class_bug=yes
3260 rm -rf conftest.{c,S}
3263 AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
3264 ac_cv_have_visibility_builtin_bug,
3265 [cat > conftest.c <<EOF
3266 #pragma GCC visibility push(hidden)
3267 #pragma GCC visibility push(default)
3269 #pragma GCC visibility pop
3271 __attribute__ ((visibility ("default"))) void Func() {
3273 memset(c, 0, sizeof(c));
3276 ac_cv_have_visibility_builtin_bug=no
3277 if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3278 ac_cv_have_visibility_builtin_bug=yes
3280 if test `grep -c "@PLT" conftest.S` = 0; then
3281 ac_cv_visibility_builtin_bug=yes
3284 rm -f conftest.{c,S}
3286 if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
3287 "$ac_cv_have_visibility_class_bug" = "no"; then
3288 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
3289 WRAP_SYSTEM_INCLUDES=1
3290 STL_FLAGS='-I$(DIST)/stl_wrappers'
3293 VISIBILITY_FLAGS='-fvisibility=hidden'
3294 fi # have visibility pragma bug
3295 fi # have visibility pragma
3296 fi # have visibility(default) attribute
3297 fi # have visibility(hidden) attribute
3300 # visibility hidden flag for Sun Studio on Solaris
3301 if test "$SOLARIS_SUNPRO_CC"; then
3302 VISIBILITY_FLAGS='-xldscope=hidden'
3303 fi # Sun Studio on Solaris
3305 AC_SUBST(WRAP_SYSTEM_INCLUDES)
3306 AC_SUBST(VISIBILITY_FLAGS)
3308 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
3309 dnl ========================================================
3310 if test "$GNU_CC"; then
3311 CFLAGS_save="${CFLAGS}"
3312 CFLAGS="${CFLAGS} -Werror"
3313 AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
3314 ac_cv_force_align_arg_pointer,
3315 [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
3317 ac_cv_force_align_arg_pointer="yes",
3318 ac_cv_force_align_arg_pointer="no")])
3319 CFLAGS="${CFLAGS_save}"
3320 if test "$ac_cv_force_align_arg_pointer" = "yes"; then
3321 HAVE_GCC_ALIGN_ARG_POINTER=1
3323 HAVE_GCC_ALIGN_ARG_POINTER=
3326 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
3328 dnl Checks for header files.
3329 dnl ========================================================
3331 case "$target_os" in
3333 # for stuff like -lXshm
3334 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3337 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
3338 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
3339 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
3340 AC_CHECK_HEADERS(malloc.h)
3341 AC_CHECK_HEADERS(X11/XKBlib.h)
3342 AC_CHECK_HEADERS(io.h)
3344 dnl These are all the places some variant of statfs can be hiding.
3345 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3348 AC_CHECK_HEADERS(sys/quota.h)
3349 AC_CHECK_HEADERS(linux/quota.h)
3351 dnl Try for MMX support
3352 dnl NB - later gcc versions require -mmmx for this header to be successfully
3353 dnl included (or another option which implies it, such as -march=pentium-mmx)
3354 AC_CHECK_HEADERS(mmintrin.h)
3356 dnl Check whether the compiler supports the new-style C++ standard
3357 dnl library headers (i.e. <new>) or needs the old "new.h"
3360 AC_CHECK_HEADER(new, [NEW_H=new])
3361 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3364 AC_ARG_ENABLE(dtrace,
3365 [ --enable-dtrace build with dtrace support if available (default=no)],
3366 [enable_dtrace="yes"],)
3367 if test "x$enable_dtrace" = "xyes"; then
3368 AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3369 if test -n "$HAVE_DTRACE"; then
3370 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3372 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3375 AC_SUBST(HAVE_DTRACE)
3381 AC_CHECK_HEADERS(sys/cdefs.h)
3385 dnl Checks for libraries.
3386 dnl ========================================================
3391 AC_CHECK_LIB(c_r, gethostbyname_r)
3395 dnl We don't want to link with libdl even if it's present on OS X, since
3396 dnl it's not used and not part of the default installation.
3397 dnl The same goes for BeOS. OS/2 has dlfcn in libc.
3398 dnl We don't want to link against libm or libpthread on Darwin since
3399 dnl they both are just symlinks to libSystem and explicitly linking
3400 dnl against libSystem causes issues when debugging (see bug 299601).
3409 AC_SEARCH_LIBS(dlopen, dl,
3410 AC_CHECK_HEADER(dlfcn.h,
3411 AC_DEFINE(HAVE_DLOPEN)))
3415 _SAVE_CFLAGS="$CFLAGS"
3416 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3417 AC_CHECK_FUNCS(dladdr)
3418 CFLAGS="$_SAVE_CFLAGS"
3420 if test ! "$GNU_CXX"; then
3424 AC_CHECK_LIB(C_r, demangle)
3427 AC_CHECK_LIB(C, demangle)
3432 dnl OS/2 has socket in libc.
3437 AC_CHECK_LIB(socket, socket)
3440 dnl ========================================================
3441 dnl Check whether we can compile code for Core Text
3442 dnl (available on Mac OS X 10.5 or later)
3443 dnl ========================================================
3446 AC_MSG_CHECKING([for Core Text])
3447 AC_TRY_COMPILE([#include <ApplicationServices/ApplicationServices.h>],
3448 [CTLineRef lineRef;],
3449 ac_cv_have_core_text="yes",
3450 ac_cv_have_core_text="no")
3451 AC_MSG_RESULT([$ac_cv_have_core_text])
3453 if test "$ac_cv_have_core_text" = "no"; then
3454 AC_MSG_ERROR([Core Text is required (available on Mac OS X 10.5 or later).])
3460 XLIBS="$X_EXTRA_LIBS"
3462 dnl ========================================================
3463 dnl Checks for X libraries.
3464 dnl Ordering is important.
3465 dnl Xt is dependent upon SM as of X11R6
3466 dnl ========================================================
3467 if test "$no_x" = "yes"; then
3470 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3471 XLIBS="-lX11 $XLIBS"
3472 _SAVE_LDFLAGS="$LDFLAGS"
3473 LDFLAGS="$XLDFLAGS $LDFLAGS"
3474 AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3475 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3476 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3477 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3479 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3480 unset ac_cv_lib_Xt_XtFree
3481 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3482 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
3483 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3484 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3487 # AIX needs the motif library linked before libXt to prevent
3488 # crashes in plugins linked against Motif - Bug #98892
3489 case "${target_os}" in
3491 XT_LIBS="-lXm $XT_LIBS"
3495 dnl ========================================================
3496 dnl = Check for XShm
3497 dnl ========================================================
3498 AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3500 AC_CHECK_HEADER(X11/extensions/XShm.h)
3501 if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3502 test -n "$_HAVE_XSHM_XEXT"; then
3503 AC_DEFINE(HAVE_XSHM)
3506 dnl ========================================================
3508 dnl ========================================================
3509 AC_CHECK_HEADER(X11/extensions/scrnsaver.h,
3510 AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
3511 [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
3512 AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
3514 dnl ========================================================
3516 dnl ========================================================
3517 AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3519 AC_CHECK_HEADER(X11/extensions/XIElib.h)
3521 if test "$MOZ_XIE_LIBS"; then
3522 dnl ====================================================
3523 dnl = If XIE is present and is desired, turn it on
3524 dnl ====================================================
3534 LDFLAGS="$_SAVE_LDFLAGS"
3536 dnl ========================================================
3537 dnl = Check for freetype2 and its functionality
3538 dnl ========================================================
3539 AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3541 if test "$_HAVE_FREETYPE2"; then
3543 _SAVE_CFLAGS="$CFLAGS"
3544 LIBS="$LIBS $FT2_LIBS"
3545 CFLAGS="$CFLAGS $FT2_CFLAGS"
3547 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3548 ac_cv_member_FT_Bitmap_Size_y_ppem,
3549 [AC_TRY_COMPILE([#include <ft2build.h>
3550 #include FT_FREETYPE_H],
3552 if (sizeof s.y_ppem) return 0;
3554 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3555 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3556 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3557 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3559 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3561 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3562 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3563 [FT_Bitmap_Size structure includes y_ppem field])
3565 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3568 CFLAGS="$_SAVE_CFLAGS"
3580 AC_MSG_CHECKING(for ARM SIMD support in compiler)
3582 [asm("uqadd8 r1, r1, r2");],
3583 result="yes", result="no")
3584 AC_MSG_RESULT("$result")
3585 if test "$result" = "yes"; then
3586 AC_DEFINE(HAVE_ARM_SIMD)
3589 AC_SUBST(HAVE_ARM_SIMD)
3591 AC_MSG_CHECKING(for ARM NEON support in compiler)
3592 _SAVE_CFLAGS="$CFLAGS"
3593 if test "$GNU_CC"; then
3594 # gcc needs -mfpu=neon to recognize NEON instructions
3595 CFLAGS="$CFLAGS -mfpu=neon -mfloat-abi=softfp"
3598 [asm("vadd.i8 d0, d0, d0");],
3599 result="yes", result="no")
3600 AC_MSG_RESULT("$result")
3601 if test "$result" = "yes"; then
3602 AC_DEFINE(HAVE_ARM_NEON)
3605 CFLAGS="$_SAVE_CFLAGS"
3606 AC_SUBST(HAVE_ARM_NEON)
3608 dnl ========================================================
3609 dnl = pthread support
3610 dnl = Start by checking whether the system support pthreads
3611 dnl ========================================================
3612 case "$target_os" in
3617 MOZ_CHECK_PTHREADS(pthreads,
3618 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3619 MOZ_CHECK_PTHREADS(pthread,
3620 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3621 MOZ_CHECK_PTHREADS(c_r,
3622 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3623 MOZ_CHECK_PTHREADS(c,
3632 dnl ========================================================
3633 dnl Check the command line for --with-pthreads
3634 dnl ========================================================
3635 MOZ_ARG_WITH_BOOL(pthreads,
3636 [ --with-pthreads Force use of system pthread library with NSPR ],
3637 [ if test "$USE_PTHREADS"x = x; then
3638 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3644 dnl ========================================================
3645 dnl Do the platform specific pthread hackery
3646 dnl ========================================================
3647 if test "$USE_PTHREADS"x != x
3650 dnl See if -pthread is supported.
3653 ac_cv_have_dash_pthread=no
3654 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3655 echo 'int main() { return 0; }' | cat > conftest.c
3656 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3657 if test $? -eq 0; then
3658 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3659 ac_cv_have_dash_pthread=yes
3660 case "$target_os" in
3662 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3665 CFLAGS="$CFLAGS -pthread"
3666 CXXFLAGS="$CXXFLAGS -pthread"
3672 AC_MSG_RESULT($ac_cv_have_dash_pthread)
3675 dnl See if -pthreads is supported.
3677 ac_cv_have_dash_pthreads=no
3678 if test "$ac_cv_have_dash_pthread" = "no"; then
3679 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3680 echo 'int main() { return 0; }' | cat > conftest.c
3681 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3682 if test $? -eq 0; then
3683 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3684 ac_cv_have_dash_pthreads=yes
3685 CFLAGS="$CFLAGS -pthreads"
3686 CXXFLAGS="$CXXFLAGS -pthreads"
3690 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3695 AC_DEFINE(_REENTRANT)
3696 AC_DEFINE(_THREAD_SAFE)
3697 dnl -pthread links in -lc_r, so don't specify it explicitly.
3698 if test "$ac_cv_have_dash_pthread" = "yes"; then
3699 _PTHREAD_LDFLAGS="-pthread"
3701 _PTHREAD_LDFLAGS="-lc_r"
3705 *-*-openbsd*|*-*-bsdi*)
3706 AC_DEFINE(_REENTRANT)
3707 AC_DEFINE(_THREAD_SAFE)
3708 dnl -pthread links in -lc_r, so don't specify it explicitly.
3709 if test "$ac_cv_have_dash_pthread" = "yes"; then
3710 _PTHREAD_LDFLAGS="-pthread"
3714 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3715 AC_DEFINE(_REENTRANT)
3719 AC_DEFINE(_REENTRANT)
3723 AC_DEFINE(_REENTRANT)
3727 AC_DEFINE(_REENTRANT)
3731 AC_DEFINE(_REENTRANT)
3735 AC_DEFINE(_REENTRANT)
3736 if test "$SOLARIS_SUNPRO_CC"; then
3737 CFLAGS="$CFLAGS -mt"
3738 CXXFLAGS="$CXXFLAGS -mt"
3742 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3745 dnl ========================================================
3746 dnl See if mmap sees writes
3747 dnl For cross compiling, just define it as no, which is a safe default
3748 dnl ========================================================
3749 AC_MSG_CHECKING(whether mmap() sees write()s)
3755 #include <sys/mman.h>
3756 #include <sys/types.h>
3757 #include <sys/stat.h>
3760 char fname[] = "conftest.file";
3761 char zbuff[1024]; /* Fractional page is probably worst case */
3768 fd = open(fname, O_RDWR | O_CREAT, 0660);
3771 write(fd, zbuff, sizeof(zbuff));
3772 lseek(fd, 0, SEEK_SET);
3773 map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3774 if(map==(char*)-1) return 2;
3775 for(i=0; fname[i]; i++) {
3776 int rc = write(fd, &fname[i], 1);
3777 if(map[i]!=fname[i]) return 4;
3784 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3786 AC_MSG_RESULT("$result")
3788 if test "$result" = "no"; then
3789 AC_DEFINE(MMAP_MISSES_WRITES)
3793 dnl Checks for library functions.
3794 dnl ========================================================
3795 AC_PROG_GCC_TRADITIONAL
3797 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3798 AC_CHECK_FUNCS(flockfile getpagesize)
3799 AC_CHECK_FUNCS(localtime_r strtok_r)
3801 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock, and -lrt
3802 _SAVE_LDFLAGS=$LDFLAGS
3803 LDFLAGS="$LDFLAGS -lrt"
3804 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC) and -lrt,
3805 ac_cv_have_clock_monotonic,
3806 [AC_TRY_LINK([#include <time.h>],
3807 [ struct timespec ts;
3808 clock_gettime(CLOCK_MONOTONIC, &ts); ],
3809 ac_cv_have_clock_monotonic=yes,
3810 ac_cv_have_clock_monotonic=no)])
3811 LDFLAGS=$_SAVE_LDFLAGS
3812 if test "$ac_cv_have_clock_monotonic" = "yes"; then
3813 HAVE_CLOCK_MONOTONIC=1
3815 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3816 AC_SUBST(HAVE_CLOCK_MONOTONIC)
3817 AC_SUBST(REALTIME_LIBS)
3820 dnl check for wcrtomb/mbrtowc
3821 dnl =======================================================================
3822 if test -z "$MACOS_DEPLOYMENT_TARGET" -o "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3825 AC_CACHE_CHECK(for wcrtomb,
3827 [AC_TRY_LINK([#include <wchar.h>],
3828 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3829 ac_cv_have_wcrtomb="yes",
3830 ac_cv_have_wcrtomb="no")])
3831 if test "$ac_cv_have_wcrtomb" = "yes"; then
3832 AC_DEFINE(HAVE_WCRTOMB)
3834 AC_CACHE_CHECK(for mbrtowc,
3836 [AC_TRY_LINK([#include <wchar.h>],
3837 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3838 ac_cv_have_mbrtowc="yes",
3839 ac_cv_have_mbrtowc="no")])
3840 if test "$ac_cv_have_mbrtowc" = "yes"; then
3841 AC_DEFINE(HAVE_MBRTOWC)
3848 ac_cv_func_res_ninit,
3851 #define _BSD_SOURCE 1
3855 [int foo = res_ninit(&_res);],
3856 [ac_cv_func_res_ninit=yes],
3857 [ac_cv_func_res_ninit=no])
3860 if test "$ac_cv_func_res_ninit" = "yes"; then
3861 AC_DEFINE(HAVE_RES_NINIT)
3862 dnl must add the link line we do something as foolish as this... dougt
3864 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3865 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3870 [for gnu_get_libc_version()],
3871 ac_cv_func_gnu_get_libc_version,
3873 #ifdef HAVE_GNU_LIBC_VERSION_H
3874 #include <gnu/libc-version.h>
3877 [const char *glibc_version = gnu_get_libc_version();],
3878 [ac_cv_func_gnu_get_libc_version=yes],
3879 [ac_cv_func_gnu_get_libc_version=no]
3883 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3884 AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3888 os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|winmo*|beos*)
3892 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3893 AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3894 AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3896 LIBS="$LIBS $_ICONV_LIBS"
3905 iconv_t h = iconv_open("", "");
3906 iconv(h, NULL, NULL, NULL, NULL);
3909 [ac_cv_func_iconv=yes],
3910 [ac_cv_func_iconv=no]
3913 if test "$ac_cv_func_iconv" = "yes"; then
3914 AC_DEFINE(HAVE_ICONV)
3915 DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3916 LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3917 LIBICONV="$_ICONV_LIBS"
3919 [for iconv() with const input],
3920 ac_cv_func_const_iconv,
3926 const char *input = "testing";
3927 iconv_t h = iconv_open("", "");
3928 iconv(h, &input, NULL, NULL, NULL);
3931 [ac_cv_func_const_iconv=yes],
3932 [ac_cv_func_const_iconv=no]
3935 if test "$ac_cv_func_const_iconv" = "yes"; then
3936 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3948 dnl **********************
3949 dnl *** va_copy checks ***
3950 dnl **********************
3951 dnl we currently check for all three va_copy possibilities, so we get
3952 dnl all results in config.log for bug reports.
3953 AC_MSG_CHECKING(for an implementation of va_copy())
3954 AC_CACHE_VAL(ac_cv_va_copy,[
3957 void f (int i, ...) {
3958 va_list args1, args2;
3959 va_start (args1, i);
3960 va_copy (args2, args1);
3961 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3963 va_end (args1); va_end (args2);
3965 int main() { f (0, 42); return 0; }],
3971 AC_MSG_RESULT($ac_cv_va_copy)
3972 AC_MSG_CHECKING(for an implementation of __va_copy())
3973 AC_CACHE_VAL(ac_cv___va_copy,[
3976 void f (int i, ...) {
3977 va_list args1, args2;
3978 va_start (args1, i);
3979 __va_copy (args2, args1);
3980 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3982 va_end (args1); va_end (args2);
3984 int main() { f (0, 42); return 0; }],
3985 ac_cv___va_copy=yes,
3990 AC_MSG_RESULT($ac_cv___va_copy)
3991 AC_MSG_CHECKING(whether va_lists can be copied by value)
3992 AC_CACHE_VAL(ac_cv_va_val_copy,[
3995 void f (int i, ...) {
3996 va_list args1, args2;
3997 va_start (args1, i);
3999 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
4001 va_end (args1); va_end (args2);
4003 int main() { f (0, 42); return 0; }],
4004 ac_cv_va_val_copy=yes,
4005 ac_cv_va_val_copy=no,
4006 ac_cv_va_val_copy=yes
4009 if test "x$ac_cv_va_copy" = "xyes"; then
4010 AC_DEFINE(VA_COPY, va_copy)
4011 AC_DEFINE(HAVE_VA_COPY)
4012 elif test "x$ac_cv___va_copy" = "xyes"; then
4013 AC_DEFINE(VA_COPY, __va_copy)
4014 AC_DEFINE(HAVE_VA_COPY)
4017 if test "x$ac_cv_va_val_copy" = "xno"; then
4018 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
4020 AC_MSG_RESULT($ac_cv_va_val_copy)
4022 dnl Check for dll-challenged libc's.
4023 dnl This check is apparently only needed for Linux.
4026 dnl ===================================================================
4029 rm -rf conftest* _conftest
4031 cat >> conftest.C <<\EOF
4036 void __dump_link_map(void) {
4037 struct link_map *map = _dl_loaded;
4038 while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
4041 dlopen("./conftest1.so",RTLD_LAZY);
4042 dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
4043 dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
4044 dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
4048 /* _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).*/
4049 int main() { printf("./conftest1.so\n"); }
4053 $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
4055 cat >> conftest1.C <<\EOF
4057 void foo(void) {printf("foo in dll called\n");}
4059 ${CXX-g++} -fPIC -c -g conftest1.C
4060 ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
4061 ${CXX-g++} -g conftest.C -o conftest -ldl
4062 cp -f conftest1.so conftest _conftest
4064 if test `./conftest | grep conftest1.so | wc -l` -gt 1
4067 echo "*** Your libc has a bug that can result in loading the same dynamic"
4068 echo "*** library multiple times. This bug is known to be fixed in glibc-2.0.7-32"
4069 echo "*** or later. However, if you choose not to upgrade, the only effect"
4070 echo "*** will be excessive memory usage at runtime."
4074 rm -rf conftest* _conftest
4075 dnl ===================================================================
4079 dnl ===================================================================
4080 dnl ========================================================
4081 dnl Put your C++ language/feature checks below
4082 dnl ========================================================
4087 if test "$GNU_CC"; then
4088 if test "$CPU_ARCH" = "arm" ; then
4089 AC_CACHE_CHECK(for ARM EABI,
4093 #if defined(__ARM_EABI__)
4096 #error Not ARM EABI.
4099 ac_cv_gcc_arm_eabi="yes",
4100 ac_cv_gcc_arm_eabi="no")])
4101 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
4103 ARM_ABI_PREFIX=eabi-
4105 ARM_ABI_PREFIX=oabi-
4109 AC_CACHE_CHECK(for gcc 3.0 ABI,
4110 ac_cv_gcc_three_abi,
4113 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
4119 ac_cv_gcc_three_abi="yes",
4120 ac_cv_gcc_three_abi="no")])
4121 if test "$ac_cv_gcc_three_abi" = "yes"; then
4122 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
4125 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc2}"
4128 AC_SUBST(HAVE_GCC3_ABI)
4131 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
4133 [AC_TRY_COMPILE(class X {
4134 public: explicit X(int i) : i_(i) {}
4138 ac_cv_cpp_explicit=yes,
4139 ac_cv_cpp_explicit=no)])
4140 if test "$ac_cv_cpp_explicit" = yes ; then
4141 AC_DEFINE(HAVE_CPP_EXPLICIT)
4144 AC_CACHE_CHECK(for C++ \"typename\" keyword,
4146 [AC_TRY_COMPILE(class param {
4148 typedef unsigned long num_type;
4151 template <class T> class tplt {
4153 typedef typename T::num_type t_num_type;
4154 t_num_type foo(typename T::num_type num) {
4160 ac_cv_cpp_typename=yes,
4161 ac_cv_cpp_typename=no)])
4162 if test "$ac_cv_cpp_typename" = yes ; then
4163 AC_DEFINE(HAVE_CPP_TYPENAME)
4166 dnl Check for support of modern template specialization syntax
4167 dnl Test code and requirement from scc@netscape.com.
4168 dnl Autoconf cut-and-paste job by waterson@netscape.com
4169 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
4170 ac_cv_cpp_modern_specialize_template_syntax,
4171 [AC_TRY_COMPILE(template <class T> struct X { int a; };
4173 template <> struct X<Y> { double a; };,
4176 ac_cv_cpp_modern_specialize_template_syntax=yes,
4177 ac_cv_cpp_modern_specialize_template_syntax=no)])
4178 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
4179 AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
4183 dnl Some compilers support only full specialization, and some don't.
4184 AC_CACHE_CHECK(whether partial template specialization works,
4185 ac_cv_cpp_partial_specialization,
4186 [AC_TRY_COMPILE(template <class T> class Foo {};
4187 template <class T> class Foo<T*> {};,
4189 ac_cv_cpp_partial_specialization=yes,
4190 ac_cv_cpp_partial_specialization=no)])
4191 if test "$ac_cv_cpp_partial_specialization" = yes ; then
4192 AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
4195 dnl Some compilers have limited support for operators with templates;
4196 dnl specifically, it is necessary to define derived operators when a base
4197 dnl class's operator declaration should suffice.
4198 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
4199 ac_cv_need_derived_template_operators,
4200 [AC_TRY_COMPILE([template <class T> class Base { };
4202 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
4203 template <class T> class Derived : public Base<T> { };],
4204 [Derived<char> a, b;
4205 Base<char> c = a + b;
4207 ac_cv_need_derived_template_operators=no,
4208 ac_cv_need_derived_template_operators=yes)])
4209 if test "$ac_cv_need_derived_template_operators" = yes ; then
4210 AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
4214 dnl Some compilers have trouble detecting that a template class
4215 dnl that derives from another template is actually an instance
4216 dnl of the base class. This test checks for that.
4217 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
4218 ac_cv_need_cpp_template_cast_to_base,
4219 [AC_TRY_COMPILE([template <class T> class Base { };
4220 template <class T> class Derived : public Base<T> { };
4221 template <class T> int foo(const Base<T>&) { return 0; }],
4222 [Derived<char> bar; return foo(bar);],
4223 ac_cv_need_cpp_template_cast_to_base=no,
4224 ac_cv_need_cpp_template_cast_to_base=yes)])
4225 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
4226 AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
4229 dnl Some compilers have trouble resolving the ambiguity between two
4230 dnl functions whose arguments differ only by cv-qualifications.
4231 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
4232 ac_cv_can_resolve_const_ambiguity,
4234 template <class T> class ptrClass {
4238 template <class T> T* a(ptrClass<T> *arg) {
4243 const T* a(const ptrClass<T> *arg) {
4249 ac_cv_can_resolve_const_ambiguity=yes,
4250 ac_cv_can_resolve_const_ambiguity=no)])
4251 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
4252 AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
4256 dnl We don't do exceptions on unix. The only reason this used to be here
4257 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses
4258 dnl exceptions. But, we turn exceptions off by default and this test breaks.
4259 dnl So im commenting this out until someone writes some artificial
4260 dnl intelligence to detect not only if the compiler has exceptions, but if
4261 dnl they are enabled as well.
4263 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
4264 dnl ac_cv_cpp_exceptions,
4265 dnl [AC_TRY_COMPILE(class X { public: X() {} };
4266 dnl static void F() { throw X(); },
4267 dnl try { F(); } catch(X & e) { },
4268 dnl ac_cv_cpp_exceptions=yes,
4269 dnl ac_cv_cpp_exceptions=no)])
4270 dnl if test $ac_cv_cpp_exceptions = yes ; then
4271 dnl AC_DEFINE(HAVE_CPP_EXCEPTIONS)
4274 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
4275 dnl supports it well enough to allow us to use it to change access, but not
4276 dnl to resolve ambiguity. The next two tests determine how well the |using|
4277 dnl keyword is supported.
4279 dnl Check to see if we can change access with |using|. Test both a
4280 dnl legal and an illegal example.
4281 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
4282 ac_cv_cpp_access_changing_using2,
4284 class A { protected: int foo() { return 0; } };
4285 class B : public A { public: using A::foo; };,
4286 B b; return b.foo();,
4288 class A { public: int foo() { return 1; } };
4289 class B : public A { private: using A::foo; };,
4290 B b; return b.foo();,
4291 ac_cv_cpp_access_changing_using2=no,
4292 ac_cv_cpp_access_changing_using2=yes)],
4293 ac_cv_cpp_access_changing_using2=no)])
4294 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
4295 AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
4298 dnl Check to see if we can resolve ambiguity with |using|.
4299 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
4300 ac_cv_cpp_ambiguity_resolving_using,
4301 [AC_TRY_COMPILE(class X {
4302 public: int go(const X&) {return 3;}
4303 int jo(const X&) {return 3;}
4305 class Y : public X {
4306 public: int go(int) {return 2;}
4307 int jo(int) {return 2;}
4309 private: using X::go;
4312 ac_cv_cpp_ambiguity_resolving_using=yes,
4313 ac_cv_cpp_ambiguity_resolving_using=no)])
4314 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
4315 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
4318 dnl Check to see if the |std| namespace is supported. If so, we'll want
4319 dnl to qualify any standard library calls with "std::" to ensure that
4320 dnl those functions can be resolved.
4321 AC_CACHE_CHECK(for \"std::\" namespace,
4322 ac_cv_cpp_namespace_std,
4323 [AC_TRY_COMPILE([#include <algorithm>],
4324 [return std::min(0, 1);],
4325 ac_cv_cpp_namespace_std=yes,
4326 ac_cv_cpp_namespace_std=no)])
4327 if test "$ac_cv_cpp_namespace_std" = yes ; then
4328 AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
4331 dnl Older compilers are overly ambitious with respect to using the standard
4332 dnl template library's |operator!=()| when |operator==()| is defined. In
4333 dnl which case, defining |operator!=()| in addition to |operator==()| causes
4334 dnl ambiguity at compile-time. This test checks for that case.
4335 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
4336 ac_cv_cpp_unambiguous_std_notequal,
4337 [AC_TRY_COMPILE([#include <algorithm>
4339 int operator==(const T1&, const T1&) { return 0; }
4340 int operator!=(const T1&, const T1&) { return 0; }],
4341 [T1 a,b; return a != b;],
4342 ac_cv_cpp_unambiguous_std_notequal=unambiguous,
4343 ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
4344 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
4345 AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
4349 AC_CACHE_CHECK(for C++ reinterpret_cast,
4350 ac_cv_cpp_reinterpret_cast,
4351 [AC_TRY_COMPILE(struct X { int i; };
4352 struct Y { int i; };,
4353 X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
4354 ac_cv_cpp_reinterpret_cast=yes,
4355 ac_cv_cpp_reinterpret_cast=no)])
4356 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
4357 AC_DEFINE(HAVE_CPP_NEW_CASTS)
4360 dnl See if a dynamic_cast to void* gives the most derived object.
4361 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
4362 ac_cv_cpp_dynamic_cast_void_ptr,
4363 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
4364 class Y { int j; public: virtual ~Y() { } };
4365 class Z : public X, public Y { int k; };
4371 return !((((void*)&mdo != (void*)subx) &&
4372 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
4373 (((void*)&mdo != (void*)suby) &&
4374 ((void*)&mdo == dynamic_cast<void*>(suby))));
4376 ac_cv_cpp_dynamic_cast_void_ptr=yes,
4377 ac_cv_cpp_dynamic_cast_void_ptr=no,
4378 ac_cv_cpp_dynamic_cast_void_ptr=no)])
4379 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
4380 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
4384 dnl note that this one is reversed - if the test fails, then
4385 dnl we require implementations of unused virtual methods. Which
4386 dnl really blows because it means we'll have useless vtable
4388 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
4389 ac_cv_cpp_unused_required,
4390 [AC_TRY_LINK(class X {private: virtual void never_called();};,
4392 ac_cv_cpp_unused_required=no,
4393 ac_cv_cpp_unused_required=yes)])
4394 if test "$ac_cv_cpp_unused_required" = yes ; then
4395 AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
4399 dnl Some compilers have trouble comparing a constant reference to a templatized
4400 dnl class to zero, and require an explicit operator==() to be defined that takes
4401 dnl an int. This test separates the strong from the weak.
4403 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
4404 ac_cv_trouble_comparing_to_zero,
4405 [AC_TRY_COMPILE([#include <algorithm>
4406 template <class T> class Foo {};
4408 template <class T> int operator==(const T2*, const T&) { return 0; }
4409 template <class T> int operator!=(const T2*, const T&) { return 0; }],
4410 [Foo<int> f; return (0 != f);],
4411 ac_cv_trouble_comparing_to_zero=no,
4412 ac_cv_trouble_comparing_to_zero=yes)])
4413 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
4414 AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
4417 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
4418 _SAVE_LDFLAGS=$LDFLAGS
4419 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS"
4420 AC_CACHE_CHECK(for __thread keyword for TLS variables,
4421 ac_cv_thread_keyword,
4422 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
4423 [return tlsIsMainThread;],
4424 ac_cv_thread_keyword=yes,
4425 ac_cv_thread_keyword=no)])
4426 LDFLAGS=$_SAVE_LDFLAGS
4427 if test "$ac_cv_thread_keyword" = yes; then
4428 # mips builds fail with TLS variables because of a binutils bug.
4438 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
4443 dnl Check for the existence of various allocation headers/functions
4446 AC_CHECK_HEADER(malloc.h, [MALLOC_H=malloc.h])
4447 if test "$MALLOC_H" = ""; then
4448 AC_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
4449 if test "$MALLOC_H" = ""; then
4450 AC_CHECK_HEADER(sys/malloc.h, [MALLOC_H=sys/malloc.h])
4453 if test "$MALLOC_H" != ""; then
4454 AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
4457 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
4458 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
4460 dnl See if compiler supports some gcc-style attributes
4462 AC_CACHE_CHECK(for __attribute__((always_inline)),
4463 ac_cv_attribute_always_inline,
4465 [inline void f(void) __attribute__((always_inline));],
4466 ac_cv_attribute_always_inline=yes,
4467 ac_cv_attribute_always_inline=no)])
4469 AC_CACHE_CHECK(for __attribute__((malloc)),
4470 ac_cv_attribute_malloc,
4472 [void* f(int) __attribute__((malloc));],
4473 ac_cv_attribute_malloc=yes,
4474 ac_cv_attribute_malloc=no)])
4476 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
4477 ac_cv_attribute_warn_unused,
4479 [int f(void) __attribute__((warn_unused_result));],
4480 ac_cv_attribute_warn_unused=yes,
4481 ac_cv_attribute_warn_unused=no)])
4483 AC_CACHE_CHECK(for __attribute__((noreturn)),
4484 ac_cv_attribute_noreturn,
4486 [void f(void) __attribute__((noreturn));],
4487 ac_cv_attribute_noreturn=yes,
4488 ac_cv_attribute_noreturn=no)])
4490 dnl End of C++ language/feature checks
4493 dnl ========================================================
4494 dnl = Internationalization checks
4495 dnl ========================================================
4497 dnl Internationalization and Locale support is different
4498 dnl on various UNIX platforms. Checks for specific i18n
4499 dnl features go here.
4501 dnl check for LC_MESSAGES
4502 AC_CACHE_CHECK(for LC_MESSAGES,
4503 ac_cv_i18n_lc_messages,
4504 [AC_TRY_COMPILE([#include <locale.h>],
4505 [int category = LC_MESSAGES;],
4506 ac_cv_i18n_lc_messages=yes,
4507 ac_cv_i18n_lc_messages=no)])
4508 if test "$ac_cv_i18n_lc_messages" = yes; then
4509 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4512 AC_HAVE_FUNCS(localeconv)
4514 fi # SKIP_COMPILER_CHECKS
4517 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4518 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4521 dnl Mozilla specific options
4522 dnl ========================================================
4523 dnl The macros used for command line options
4524 dnl are defined in build/autoconf/altoptions.m4.
4526 dnl If the compiler supports these attributes, define them as
4527 dnl convenience macros.
4528 if test "$ac_cv_attribute_always_inline" = yes ; then
4529 AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
4531 AC_DEFINE(NS_ALWAYS_INLINE,)
4534 if test "$ac_cv_attribute_malloc" = yes ; then
4535 AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
4537 AC_DEFINE(NS_ATTR_MALLOC,)
4540 if test "$ac_cv_attribute_warn_unused" = yes ; then
4541 AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
4543 AC_DEFINE(NS_WARN_UNUSED_RESULT,)
4546 if test "$ac_cv_attribute_noreturn" = yes ; then
4547 AC_DEFINE(NS_NORETURN, [__attribute__((noreturn))])
4549 AC_DEFINE(NS_NORETURN,)
4552 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
4553 dnl features that Windows actually does support.
4555 if test -n "$SKIP_COMPILER_CHECKS"; then
4556 dnl Windows has malloc.h
4557 AC_DEFINE(MALLOC_H, [<malloc.h>])
4558 AC_DEFINE(HAVE_FORCEINLINE)
4559 AC_DEFINE(HAVE_LOCALECONV)
4560 fi # SKIP_COMPILER_CHECKS
4562 dnl ========================================================
4564 dnl = Check for external package dependencies
4566 dnl ========================================================
4567 MOZ_ARG_HEADER(External Packages)
4571 MOZ_ARG_WITH_STRING(libxul-sdk,
4572 [ --with-libxul-sdk=PFX Use the libXUL SDK at <PFX>],
4573 LIBXUL_SDK_DIR=$withval)
4575 if test "$LIBXUL_SDK_DIR" = "yes"; then
4576 AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4577 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4578 LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4580 if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
4581 AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
4586 AC_SUBST(LIBXUL_SDK)
4588 if test -n "$LIBXUL_SDK"; then
4589 LIBXUL_DIST="$LIBXUL_SDK"
4591 LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4593 AC_SUBST(LIBXUL_DIST)
4597 MOZ_ARG_WITH_BOOL(system-libxul,
4598 [ --with-system-libxul Use system installed libxul SDK],
4601 if test -n "$SYSTEM_LIBXUL" -a -z "$MOZ_ENABLE_LIBXUL"; then
4602 AC_MSG_ERROR([--with-system-libxul needs --with-libxul-sdk])
4605 dnl ========================================================
4606 dnl = If NSPR was not detected in the system,
4607 dnl = use the one in the source tree (mozilla/nsprpub)
4608 dnl ========================================================
4609 MOZ_ARG_WITH_BOOL(system-nspr,
4610 [ --with-system-nspr Use system installed NSPR],
4611 _USE_SYSTEM_NSPR=1 )
4613 if test -n "$_USE_SYSTEM_NSPR"; then
4614 AM_PATH_NSPR(4.8.6, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
4617 if test -n "$MOZ_NATIVE_NSPR"; then
4618 _SAVE_CFLAGS=$CFLAGS
4619 CFLAGS="$CFLAGS $NSPR_CFLAGS"
4620 AC_TRY_COMPILE([#include "prtypes.h"],
4621 [#ifndef PR_STATIC_ASSERT
4622 #error PR_STATIC_ASSERT not defined or requires including prlog.h
4624 [MOZ_NATIVE_NSPR=1],
4625 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
4626 CFLAGS=$_SAVE_CFLAGS
4628 if test "$OS_ARCH" = "WINCE"; then
4629 NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4630 NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4631 elif test "$OS_ARCH" = "WINNT"; then
4632 NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4633 if test -n "$GNU_CC"; then
4634 NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4636 NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4639 NSPR_CFLAGS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4640 NSPR_LIBS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4644 dnl system libevent Support
4645 dnl ========================================================
4646 MOZ_ARG_WITH_STRING(system-libevent,
4647 [ --with-system-libevent=[PFX]
4648 Use system libevent [installed at prefix PFX]],
4649 LIBEVENT_DIR=$withval)
4651 _SAVE_CFLAGS=$CFLAGS
4652 _SAVE_LDFLAGS=$LDFLAGS
4654 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
4655 MOZ_NATIVE_LIBEVENT=
4657 if test "${LIBEVENT_DIR}" = "yes"; then
4660 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
4661 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
4662 AC_CHECK_HEADER(event.h,
4663 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
4664 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
4666 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
4667 AC_CHECK_LIB(event, event_init,
4668 [MOZ_NATIVE_LIBEVENT=1
4669 MOZ_LIBEVENT_INCLUDES="${LIBEVENT_DIR}/include"
4670 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
4671 [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_INCLUDES= MOZ_LIBEVENT_LIBS=])
4673 CFLAGS=$_SAVE_CFLAGS
4674 LDFLAGS=$_SAVE_LDFLAGS
4677 AC_SUBST(MOZ_NATIVE_LIBEVENT)
4678 AC_SUBST(MOZ_LIBEVENT_INCLUDES)
4679 AC_SUBST(MOZ_LIBEVENT_LIBS)
4681 dnl ========================================================
4682 dnl = If NSS was not detected in the system,
4683 dnl = use the one in the source tree (mozilla/security/nss)
4684 dnl ========================================================
4686 MOZ_ARG_WITH_BOOL(system-nss,
4687 [ --with-system-nss Use system installed NSS],
4690 if test -n "$_USE_SYSTEM_NSS"; then
4691 AM_PATH_NSS(3.12.8, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4694 if test -n "$MOZ_NATIVE_NSS"; then
4695 NSS_LIBS="$NSS_LIBS -lcrmf"
4697 NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4699 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4700 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4701 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4702 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4703 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
4705 if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4707 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4708 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
4709 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
4710 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
4711 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
4713 NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4717 dnl ======================
4719 dnl ======================
4721 AC_MSG_CHECKING([for YASM assembler])
4722 AC_CHECK_PROGS(YASM, yasm, "")
4724 if test -n "$YASM"; then
4725 dnl Pull out yasm's version string
4727 _YASM_VER_FILTER='s|.* \([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\).*|\1|p'
4730 YASM_VERSION=`yasm --version | sed -ne "$_YASM_VER_FILTER"`
4731 _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
4732 _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
4733 _YASM_RELEASE=` echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
4734 _YASM_BUILD=` echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
4737 if test -z "$SKIP_LIBRARY_CHECKS"; then
4738 dnl system JPEG support
4739 dnl ========================================================
4740 MOZ_ARG_WITH_STRING(system-jpeg,
4741 [ --with-system-jpeg[=PFX]
4742 Use system libjpeg [installed at prefix PFX]],
4745 _SAVE_CFLAGS=$CFLAGS
4746 _SAVE_LDFLAGS=$LDFLAGS
4748 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4749 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4750 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4752 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4755 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4758 if test "$SYSTEM_JPEG" = 1; then
4759 LIBS="$JPEG_LIBS $LIBS"
4760 AC_TRY_COMPILE([ #include <stdio.h>
4761 #include <sys/types.h>
4762 #include <jpeglib.h> ],
4763 [ #if JPEG_LIB_VERSION < $MOZJPEG
4764 #error "Insufficient JPEG library version ($MOZJPEG required)."
4767 [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=])
4769 CFLAGS=$_SAVE_CFLAGS
4770 LDFLAGS=$_SAVE_LDFLAGS
4773 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4774 JPEG_CFLAGS="-I${JPEG_DIR}/include"
4775 JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4778 dnl system ZLIB support
4779 dnl ========================================================
4780 MOZ_ARG_WITH_STRING(system-zlib,
4781 [ --with-system-zlib[=PFX]
4782 Use system libz [installed at prefix PFX]],
4785 _SAVE_CFLAGS=$CFLAGS
4786 _SAVE_LDFLAGS=$LDFLAGS
4788 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4789 CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4790 LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4792 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4795 AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"],
4796 [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4798 if test "$SYSTEM_ZLIB" = 1; then
4799 LIBS="$ZLIB_LIBS $LIBS"
4800 AC_TRY_COMPILE([ #include <stdio.h>
4802 #include <zlib.h> ],
4803 [ #if ZLIB_VERNUM < $MOZZLIB
4804 #error "Insufficient zlib version ($MOZZLIB required)."
4807 [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=])
4809 CFLAGS=$_SAVE_CFLAGS
4810 LDFLAGS=$_SAVE_LDFLAGS
4813 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4814 ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4815 ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4818 dnl system BZIP2 Support
4819 dnl ========================================================
4820 MOZ_ARG_WITH_STRING(system-bz2,
4821 [ --with-system-bz2[=PFX]
4822 Use system libbz2 [installed at prefix PFX]],
4825 _SAVE_CFLAGS=$CFLAGS
4826 _SAVE_LDFLAGS=$LDFLAGS
4828 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4829 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4830 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4832 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4835 AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4836 [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=])
4838 CFLAGS=$_SAVE_CFLAGS
4839 LDFLAGS=$_SAVE_LDFLAGS
4842 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4843 BZ2_CFLAGS="-I${BZ2_DIR}/include"
4844 BZ2_LIBS="-L${BZ2_DIR}/lib ${BZ2_LIBS}"
4847 dnl system PNG Support
4848 dnl ========================================================
4849 MOZ_ARG_WITH_STRING(system-png,
4850 [ --with-system-png[=PFX]
4851 Use system libpng [installed at prefix PFX]],
4854 _SAVE_CFLAGS=$CFLAGS
4855 _SAVE_LDFLAGS=$LDFLAGS
4857 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4858 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4859 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4860 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4861 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4863 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4866 _SAVE_PNG_LIBS=$PNG_LIBS
4867 AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4868 AC_MSG_ERROR([--with-system-png requested but no working libpng found]),
4870 AC_CHECK_LIB(png, png_get_acTL, ,
4871 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4874 if test "$SYSTEM_PNG" = 1; then
4875 LIBS="$PNG_LIBS $LIBS"
4876 AC_TRY_COMPILE([ #include <stdio.h>
4877 #include <sys/types.h>
4879 [ #if PNG_LIBPNG_VER < $MOZPNG
4880 #error "Insufficient libpng version ($MOZPNG required)."
4882 #ifndef PNG_UINT_31_MAX
4883 #error "Insufficient libpng version."
4886 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4888 CFLAGS=$_SAVE_CFLAGS
4889 LDFLAGS=$_SAVE_LDFLAGS
4892 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4893 PNG_CFLAGS="-I${PNG_DIR}/include"
4894 PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4897 fi # SKIP_LIBRARY_CHECKS
4899 dnl system HunSpell Support
4900 dnl ========================================================
4901 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4902 [ --enable-system-hunspell
4903 Use system hunspell (located with pkgconfig)],
4906 if test -n "$SYSTEM_HUNSPELL"; then
4907 PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4910 AC_SUBST(SYSTEM_HUNSPELL)
4912 dnl ========================================================
4913 dnl Java SDK support
4914 dnl ========================================================
4916 MOZ_ARG_WITH_STRING(java-include-path,
4917 [ --with-java-include-path=dir
4918 Location of Java SDK headers],
4919 JAVA_INCLUDE_PATH=$withval)
4922 MOZ_ARG_WITH_STRING(java-bin-path,
4923 [ --with-java-bin-path=dir
4924 Location of Java binaries (java, javac, jar)],
4925 JAVA_BIN_PATH=$withval)
4927 dnl ========================================================
4931 dnl ========================================================
4933 MOZ_ARG_HEADER(Application)
4937 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4938 MOZ_BRANDING_DIRECTORY=
4939 MOZ_OFFICIAL_BRANDING=
4949 MOZ_AUTH_EXTENSION=1
4950 MOZ_NO_ACTIVEX_SUPPORT=1
4970 MOZ_PLAINTEXT_EDITOR_ONLY=
4972 MOZ_PREF_EXTENSIONS=1
4973 MOZ_PROFILELOCKING=1
4986 MOZ_TOOLKIT_SEARCH=1
4988 MOZ_UNIVERSALCHARDET=1
4990 MOZ_USE_NATIVE_UCONV=
4992 MOZ_XSLT_STANDALONE=
4998 MOZ_DISABLE_DOMCRYPTO=
5003 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource wyciwyg"
5006 XPC_IDISPATCH_SUPPORT=
5010 *android*|*darwin*|*wince*|*winmo*)
5018 case "$target_os" in
5019 msvc*|mks*|cygwin*|mingw*)
5021 if test -z "$GNU_CC"; then
5022 if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
5026 if test -n "$NS_ENABLE_TSF"; then
5027 AC_DEFINE(NS_ENABLE_TSF)
5039 MOZ_THEME_FASTSTRIPE=1
5045 MOZ_ARG_ENABLE_STRING(application,
5046 [ --enable-application=APP
5050 content/xslt (Standalone Transformiix XSLT)
5051 netwerk (Standalone Necko)
5052 tools/update-packaging (AUS-related packaging tools)
5053 standalone (use this for standalone
5054 xpcom/xpconnect or to manually drive a build)],
5055 [ MOZ_BUILD_APP=$enableval ] )
5057 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
5058 [ --with-xulrunner-stub-name=appname Create the xulrunner stub with the given name],
5059 XULRUNNER_STUB_NAME=$withval)
5061 if test -z "$XULRUNNER_STUB_NAME"; then
5062 case "$target_os" in
5064 XULRUNNER_STUB_NAME=xulrunner
5067 XULRUNNER_STUB_NAME=xulrunner-stub
5070 AC_SUBST(XULRUNNER_STUB_NAME)
5072 if test -z "$MOZ_BUILD_APP"; then
5073 AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
5075 # We have a valid application only if it has a build.mk file in its top
5077 if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
5078 AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
5082 # Allow the application to influence configure with a confvars.sh script.
5084 AC_MSG_CHECKING([if app-specific confvars.sh exists])
5085 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
5086 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
5087 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
5092 # Now is a good time to test for logic errors, define mismatches, etc.
5093 case "$MOZ_BUILD_APP" in
5095 if test "$LIBXUL_SDK"; then
5096 AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
5101 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
5102 # that haven't made a confvars.sh yet. Don't add new stuff here, use
5104 case "$MOZ_BUILD_APP" in
5106 AC_DEFINE(MOZ_PHOENIX)
5110 AC_DEFINE(MOZ_XULRUNNER)
5118 MOZ_APP_NAME=mozilla
5119 MOZ_APP_DISPLAYNAME=Mozilla
5120 MOZ_APP_VERSION=$MOZILLA_VERSION
5125 AC_SUBST(MOZ_BUILD_APP)
5126 AC_SUBST(MOZ_PHOENIX)
5127 AC_SUBST(MOZ_XULRUNNER)
5129 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
5131 dnl ========================================================
5133 dnl = Toolkit Options
5135 dnl ========================================================
5136 MOZ_ARG_HEADER(Toolkit Options)
5138 dnl ========================================================
5139 dnl = Select the default toolkit
5140 dnl ========================================================
5141 MOZ_ARG_ENABLE_STRING(default-toolkit,
5142 [ --enable-default-toolkit=TK
5143 Select default toolkit
5144 Platform specific defaults:
5146 Mac OS X - cairo-cocoa
5147 Neutrino/QNX - photon
5149 Win32/WinCE - cairo-windows
5150 Gtk2 with DirectFB - cairo-gtk2-dfb
5153 [ _DEFAULT_TOOLKIT=$enableval ],
5154 [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
5156 if test "$_DEFAULT_TOOLKIT" = "photon" \
5157 -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
5158 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
5159 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
5160 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
5161 -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
5162 -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
5163 -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
5164 -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
5165 -o "$_DEFAULT_TOOLKIT" = "cairo-android"
5167 dnl nglayout only supports building with one toolkit,
5168 dnl so ignore everything after the first comma (",").
5169 MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
5171 AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
5174 dnl ========================================================
5175 dnl = Enable the toolkit as needed =
5176 dnl ========================================================
5178 case "$MOZ_WIDGET_TOOLKIT" in
5181 AC_DEFINE(MOZ_WIDGET_PHOTON)
5185 MOZ_WIDGET_TOOLKIT=windows
5195 cairo-gtk2|cairo-gtk2-x11)
5196 MOZ_WIDGET_TOOLKIT=gtk2
5198 MOZ_ENABLE_XREMOTE=1
5206 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
5207 TK_LIBS='$(MOZ_GTK2_LIBS)'
5208 AC_DEFINE(MOZ_WIDGET_GTK2)
5213 MOZ_WIDGET_TOOLKIT=gtk2
5220 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
5221 TK_LIBS='$(MOZ_GTK2_LIBS)'
5222 AC_DEFINE(MOZ_WIDGET_GTK2)
5223 if test "$no_x" != "yes"; then
5224 AC_MSG_WARN([Disabling X when DirectFB is specified.])
5231 MOZ_WIDGET_TOOLKIT=qt
5233 MOZ_ENABLE_XREMOTE=1
5242 TK_CFLAGS='$(MOZ_QT_CFLAGS)'
5243 TK_LIBS='$(MOZ_QT_LIBS)'
5244 AC_DEFINE(MOZ_WIDGET_QT)
5249 MOZ_WIDGET_TOOLKIT=beos
5251 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5252 TK_LIBS='$(MOZ_CAIRO_LIBS)'
5256 MOZ_WIDGET_TOOLKIT=os2
5258 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5259 TK_LIBS='$(MOZ_CAIRO_LIBS)'
5264 MOZ_WIDGET_TOOLKIT=cocoa
5265 AC_DEFINE(MOZ_WIDGET_COCOA)
5266 MOZ_USER_DIR="Mozilla"
5267 AC_DEFINE(XP_MACOSX)
5268 TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
5269 TK_CFLAGS="-DNO_X11"
5270 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
5271 CFLAGS="$CFLAGS $TK_CFLAGS"
5272 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
5273 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
5274 MOZ_FS_LAYOUT=bundle
5279 AC_DEFINE(MOZ_WIDGET_ANDROID)
5280 MOZ_WIDGET_TOOLKIT=android
5281 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5282 TK_LIBS='$(MOZ_CAIRO_LIBS)'
5289 AC_SUBST(MOZ_PDF_PRINTING)
5290 if test "$MOZ_PDF_PRINTING"; then
5291 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
5292 AC_DEFINE(MOZ_PDF_PRINTING)
5295 if test "$MOZ_ENABLE_XREMOTE"; then
5296 AC_DEFINE(MOZ_ENABLE_XREMOTE)
5299 if test "$COMPILE_ENVIRONMENT"; then
5300 if test "$MOZ_ENABLE_GTK2"; then
5301 if test "$MOZ_X11"; then
5302 GDK_PACKAGES=gdk-x11-2.0
5303 elif test "$MOZ_DFB"; then
5304 PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
5305 GDK_PACKAGES=directfb
5308 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
5311 fi # COMPILE_ENVIRONMENT
5313 AC_SUBST(MOZ_FS_LAYOUT)
5315 dnl ========================================================
5316 dnl Use ARM userspace kernel helpers; tell NSPR to enable
5317 dnl their usage and use them in spidermonkey.
5318 dnl ========================================================
5319 MOZ_ARG_WITH_BOOL(arm-kuser,
5320 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
5322 if test -n "$USE_ARM_KUSER"; then
5323 AC_DEFINE(USE_ARM_KUSER)
5326 dnl ========================================================
5327 dnl = startup-notification support module
5328 dnl ========================================================
5330 if test "$MOZ_ENABLE_GTK2"
5332 MOZ_ENABLE_STARTUP_NOTIFICATION=
5334 MOZ_ARG_ENABLE_BOOL(startup-notification,
5335 [ --enable-startup-notification
5336 Enable startup-notification support (default: disabled) ],
5337 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
5338 MOZ_ENABLE_STARTUP_NOTIFICATION=)
5339 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
5341 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
5342 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
5343 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
5344 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
5346 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
5348 MOZ_ENABLE_STARTUP_NOTIFICATION=
5352 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
5353 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
5356 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
5358 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
5359 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
5360 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
5362 dnl ========================================================
5364 dnl ========================================================
5365 if test "$MOZ_ENABLE_QT"
5367 MOZ_ARG_WITH_STRING(qtdir,
5368 [ --with-qtdir=\$dir Specify Qt directory ],
5371 if test -z "$QTDIR"; then
5372 PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
5373 AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
5375 MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtDBus -lQtXml -lQtOpenGL"
5377 MOZ_QT_CFLAGS="-DQT_SHARED"
5378 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
5379 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
5380 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
5381 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
5382 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
5383 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDBus"
5384 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
5385 HOST_MOC="$QTDIR/bin/moc"
5387 if test -z "$HOST_MOC"; then
5388 AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
5393 MOZ_ENABLE_QTNETWORK=
5394 PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
5395 MOZ_ENABLE_QTNETWORK=1,
5396 MOZ_ENABLE_QTNETWORK=)
5398 if test "$MOZ_ENABLE_QTNETWORK"; then
5399 MOZ_ENABLE_QTNETWORK=1
5400 AC_DEFINE(MOZ_ENABLE_QTNETWORK)
5404 AC_SUBST(GTK_CONFIG)
5408 AC_SUBST(MOZ_ENABLE_GTK2)
5409 AC_SUBST(MOZ_ENABLE_PHOTON)
5410 AC_SUBST(MOZ_ENABLE_QT)
5411 AC_SUBST(MOZ_ENABLE_QTNETWORK)
5412 AC_SUBST(MOZ_ENABLE_XREMOTE)
5413 AC_SUBST(MOZ_GTK2_CFLAGS)
5414 AC_SUBST(MOZ_GTK2_LIBS)
5415 AC_SUBST(MOZ_QT_CFLAGS)
5416 AC_SUBST(MOZ_QT_LIBS)
5417 AC_SUBST(MOZ_ENABLE_MEEGOTOUCH)
5424 dnl ========================================================
5426 dnl = Components & Features
5428 dnl ========================================================
5429 MOZ_ARG_HEADER(Components and Features)
5431 dnl ========================================================
5433 dnl ========================================================
5434 MOZ_ARG_ENABLE_STRING(ui-locale,
5435 [ --enable-ui-locale=ab-CD
5436 Select the user interface locale (default: en-US)],
5437 MOZ_UI_LOCALE=$enableval )
5438 AC_SUBST(MOZ_UI_LOCALE)
5440 dnl ========================================================
5441 dnl = Trademarked Branding
5442 dnl ========================================================
5443 MOZ_ARG_ENABLE_BOOL(official-branding,
5444 [ --enable-official-branding
5445 Enable Official mozilla.org Branding
5446 Do not distribute builds with
5447 --enable-official-branding unless you have
5448 permission to use trademarks per
5449 http://www.mozilla.org/foundation/trademarks/ .],
5451 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
5452 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
5454 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
5455 MOZ_OFFICIAL_BRANDING=1
5457 ], MOZ_OFFICIAL_BRANDING=)
5459 AC_SUBST(MOZ_OFFICIAL_BRANDING)
5460 if test -n "$MOZ_OFFICIAL_BRANDING"; then
5461 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
5464 MOZ_ARG_WITH_STRING(branding,
5465 [ --with-branding=dir Use branding from the specified directory.],
5466 MOZ_BRANDING_DIRECTORY=$withval)
5468 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
5469 if test -z "$REAL_BRANDING_DIRECTORY"; then
5470 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
5473 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
5474 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
5477 AC_SUBST(MOZ_BRANDING_DIRECTORY)
5479 dnl ========================================================
5480 dnl = Distribution ID
5481 dnl ========================================================
5482 MOZ_ARG_WITH_STRING(distribution-id,
5483 [ --with-distribution-id=ID
5484 Set distribution-specific id (default=org.mozilla)],
5485 [ val=`echo $withval`
5486 MOZ_DISTRIBUTION_ID="$val"])
5488 if test -z "$MOZ_DISTRIBUTION_ID"; then
5489 MOZ_DISTRIBUTION_ID="org.mozilla"
5492 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
5493 AC_SUBST(MOZ_DISTRIBUTION_ID)
5496 dnl ========================================================
5497 dnl complex text support off by default
5498 dnl ========================================================
5499 MOZ_ARG_DISABLE_BOOL(pango,
5500 [ --disable-pango Disable usage of Pango ],
5504 dnl ========================================================
5506 dnl ========================================================
5507 if test "$MOZ_ENABLE_GTK2"
5511 PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5513 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
5514 AC_SUBST(MOZ_PANGO_CFLAGS)
5515 AC_SUBST(MOZ_PANGO_LIBS)
5516 if test "$MOZ_PANGO"
5518 AC_DEFINE(MOZ_PANGO)
5520 PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5521 AC_SUBST(FT2_CFLAGS)
5526 if test "$MOZ_ENABLE_QT"
5528 if test "$MOZ_PANGO"
5530 PKG_CHECK_MODULES(MOZ_PANGO, [pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION],
5532 AC_SUBST(MOZ_PANGO_CFLAGS)
5533 AC_SUBST(MOZ_PANGO_LIBS)
5534 AC_DEFINE(MOZ_PANGO)
5537 echo "Pango library not found, will use FT2 font engine"
5544 dnl ========================================================
5545 dnl = GnomeVFS, GIO and GConf support module
5546 dnl ========================================================
5550 dnl build the gnomevfs extension by default only when the
5551 dnl GTK2 toolkit is in use.
5552 if test "$MOZ_ENABLE_GTK2"
5554 MOZ_ENABLE_GNOMEVFS=1
5558 dnl ========================================================
5559 dnl = GnomeVFS support module
5560 dnl ========================================================
5561 MOZ_ARG_DISABLE_BOOL(gnomevfs,
5562 [ --disable-gnomevfs Disable GnomeVFS support ],
5563 MOZ_ENABLE_GNOMEVFS=,
5564 MOZ_ENABLE_GNOMEVFS=force)
5566 if test "$MOZ_ENABLE_GNOMEVFS"
5568 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5569 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5570 MOZ_ENABLE_GNOMEVFS=1
5571 AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
5573 if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5575 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5577 MOZ_ENABLE_GNOMEVFS=
5580 if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5581 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5582 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5587 AC_SUBST(MOZ_ENABLE_GNOMEVFS)
5588 AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5589 AC_SUBST(MOZ_GNOMEVFS_LIBS)
5591 dnl ========================================================
5592 dnl = GIO support module
5593 dnl ========================================================
5594 MOZ_ARG_ENABLE_BOOL(gio,
5595 [ --enable-gio Enable GIO support (default: disabled)],
5596 MOZ_ENABLE_GIO=force,
5599 if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
5601 PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
5602 MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
5604 AC_DEFINE(MOZ_ENABLE_GIO)
5606 if test "$MOZ_ENABLE_GIO" = "force"
5608 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
5614 AC_SUBST(MOZ_ENABLE_GIO)
5615 AC_SUBST(MOZ_GIO_CFLAGS)
5616 AC_SUBST(MOZ_GIO_LIBS)
5618 dnl ========================================================
5619 dnl = GConf support module
5620 dnl ========================================================
5621 if test "$MOZ_ENABLE_GCONF"
5623 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
5624 MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5627 if test "$MOZ_ENABLE_GCONF" = "force"
5629 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5635 if test "$MOZ_ENABLE_GCONF"; then
5636 AC_DEFINE(MOZ_ENABLE_GCONF)
5639 AC_SUBST(MOZ_ENABLE_GCONF)
5640 AC_SUBST(MOZ_GCONF_CFLAGS)
5641 AC_SUBST(MOZ_GCONF_LIBS)
5644 dnl ========================================================
5645 dnl = libproxy support
5646 dnl ========================================================
5648 if test "$MOZ_ENABLE_GTK2"
5650 MOZ_ENABLE_LIBPROXY=
5652 MOZ_ARG_ENABLE_BOOL(libproxy,
5653 [ --enable-libproxy Enable libproxy support ],
5654 MOZ_ENABLE_LIBPROXY=1,
5655 MOZ_ENABLE_LIBPROXY=)
5657 if test "$MOZ_ENABLE_LIBPROXY"
5659 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
5660 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
5663 AC_SUBST(MOZ_ENABLE_LIBPROXY)
5664 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
5665 AC_SUBST(MOZ_LIBPROXY_LIBS)
5667 dnl ========================================================
5668 dnl = libnotify support
5669 dnl ========================================================
5671 if test "$MOZ_ENABLE_GTK2"
5673 MOZ_ENABLE_LIBNOTIFY=1
5675 MOZ_ARG_DISABLE_BOOL(libnotify,
5676 [ --disable-libnotify Disable libnotify support ],
5677 MOZ_ENABLE_LIBNOTIFY=,
5678 MOZ_ENABLE_LIBNOTIFY=1)
5680 if test "$MOZ_ENABLE_LIBNOTIFY"
5682 AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5686 if test -z "$SKIP_LIBRARY_CHECKS"
5688 if test "$MOZ_ENABLE_GTK2"
5690 if test "$MOZ_ENABLE_LIBNOTIFY"
5692 PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5696 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5697 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5698 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5700 dnl ========================================================
5701 dnl = GNOME component (mozgnome)
5702 dnl ========================================================
5704 # The GNOME component is built if one of
5705 # gnome-vfs, gio, gconf or libnotify is available.
5706 if test "$MOZ_ENABLE_GCONF" -o \
5707 "$MOZ_ENABLE_GNOMEVFS" -o \
5708 "$MOZ_ENABLE_GIO" -o \
5709 "$MOZ_ENABLE_LIBNOTIFY"; then
5710 MOZ_ENABLE_GNOME_COMPONENT=1
5712 MOZ_ENABLE_GNOME_COMPONENT=
5714 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5716 dnl ========================================================
5717 dnl = libgnomeui support module
5718 dnl ========================================================
5720 if test "$MOZ_ENABLE_GTK2"
5722 MOZ_ENABLE_GNOMEUI=1
5724 MOZ_ARG_DISABLE_BOOL(gnomeui,
5725 [ --disable-gnomeui Disable libgnomeui support (default: auto, optional at runtime) ],
5726 MOZ_ENABLE_GNOMEUI=,
5727 MOZ_ENABLE_GNOMEUI=force)
5729 if test "$MOZ_ENABLE_GNOMEUI"
5731 PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5733 MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5734 MOZ_ENABLE_GNOMEUI=1
5736 if test "$MOZ_ENABLE_GNOMEUI" = "force"
5738 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5744 if test "$MOZ_ENABLE_GNOMEUI"; then
5745 AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5749 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5750 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5751 AC_SUBST(MOZ_GNOMEUI_LIBS)
5753 dnl ========================================================
5755 dnl ========================================================
5757 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5761 MOZ_ARG_DISABLE_BOOL(dbus,
5762 [ --disable-dbus Disable dbus support ],
5766 if test "$MOZ_ENABLE_DBUS"
5768 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5769 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5770 AC_DEFINE(MOZ_ENABLE_DBUS)
5773 AC_SUBST(MOZ_ENABLE_DBUS)
5774 AC_SUBST(MOZ_DBUS_CFLAGS)
5775 AC_SUBST(MOZ_DBUS_LIBS)
5776 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5777 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5779 dnl ========================================================
5780 dnl = Build Personal Security Manager
5781 dnl ========================================================
5782 MOZ_ARG_DISABLE_BOOL(crypto,
5783 [ --disable-crypto Disable crypto support (Personal Security Manager)],
5787 dnl ========================================================
5788 dnl = JS Debugger XPCOM component (js/jsd)
5789 dnl ========================================================
5790 MOZ_ARG_DISABLE_BOOL(jsd,
5791 [ --disable-jsd Disable JavaScript debug library],
5796 dnl ========================================================
5797 dnl = Disable IPC support for tabs and plugins
5798 dnl ========================================================
5799 MOZ_ARG_DISABLE_BOOL(ipc,
5800 [ --disable-ipc Disable IPC supports for tabs and plugins],
5804 if test -n "$MOZ_IPC"; then
5810 dnl ========================================================
5811 dnl = Enable IPDL's "expensive" unit tests
5812 dnl ========================================================
5815 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5816 [ --enable-ipdl-tests Enable expensive IPDL tests],
5820 if test -z "$MOZ_IPC" -a -n "$MOZ_IPDL_TESTS"; then
5821 AC_MSG_ERROR([--enable-ipdl-tests requires --enable-ipc])
5824 if test -n "$MOZ_IPDL_TESTS"; then
5825 AC_DEFINE(MOZ_IPDL_TESTS)
5828 AC_SUBST(MOZ_IPDL_TESTS)
5830 dnl ========================================================
5831 dnl = Disable plugin support
5832 dnl ========================================================
5833 MOZ_ARG_DISABLE_BOOL(plugins,
5834 [ --disable-plugins Disable plugins support],
5838 dnl ========================================================
5839 dnl = Disable building dbm
5840 dnl ========================================================
5841 MOZ_ARG_DISABLE_BOOL(dbm,
5842 [ --disable-dbm Disable building dbm],
5846 dnl bi-directional support always on
5850 dnl ========================================================
5851 dnl view source support on by default
5852 dnl ========================================================
5853 if test "$MOZ_VIEW_SOURCE"; then
5854 AC_DEFINE(MOZ_VIEW_SOURCE)
5857 dnl ========================================================
5858 dnl accessibility support on by default on all platforms
5860 dnl ========================================================
5861 MOZ_ARG_DISABLE_BOOL(accessibility,
5862 [ --disable-accessibility Disable accessibility support (off by default on OS X)],
5865 if test "$ACCESSIBILITY"; then
5866 AC_DEFINE(ACCESSIBILITY)
5869 if test -n "$ACCESSIBILITY" -a "$COMPILE_ENVIRONMENT" = "1"; then
5871 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5872 if test "$ac_cv_header_atlbase_h" = "no"; then
5873 AC_MSG_ERROR([System header atlbase.h is not available. See http://developer.mozilla.org/en/docs/atlbase.h for details on fixing this problem.])
5875 if test "$ac_cv_header_oleacc_idl" = "no"; then
5876 AC_MSG_ERROR([System header oleacc.idl is not available. See http://developer.mozilla.org/en/docs/oleacc.idl for details on fixing this problem.])
5882 dnl ========================================================
5883 dnl xpcom js loader support on by default
5884 dnl ========================================================
5885 if test "$MOZ_JSLOADER"; then
5886 AC_DEFINE(MOZ_JSLOADER)
5889 dnl ========================================================
5890 dnl Disable printing
5891 dnl ========================================================
5892 MOZ_ARG_DISABLE_BOOL(printing,
5893 [ --disable-printing Disable printing support],
5897 if test "$NS_PRINTING"; then
5898 AC_DEFINE(NS_PRINTING)
5899 AC_DEFINE(NS_PRINT_PREVIEW)
5901 dnl ========================================================
5902 dnl use native unicode converters
5903 dnl ========================================================
5904 MOZ_ARG_ENABLE_BOOL(native-uconv,
5905 [ --enable-native-uconv Enable iconv support],
5906 MOZ_USE_NATIVE_UCONV=1,
5907 MOZ_USE_NATIVE_UCONV= )
5908 if test "$MOZ_USE_NATIVE_UCONV"; then
5909 AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5911 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5912 AC_MSG_ERROR([iconv() not found. Cannot enable native uconv support.])
5916 dnl ========================================================
5917 dnl Libeditor can be build as plaintext-only,
5918 dnl or as a full html and text editing component.
5919 dnl We build both by default.
5920 dnl ========================================================
5921 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5922 [ --enable-plaintext-editor-only
5923 Allow only plaintext editing],
5924 MOZ_PLAINTEXT_EDITOR_ONLY=1,
5925 MOZ_PLAINTEXT_EDITOR_ONLY= )
5926 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5927 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5929 dnl ========================================================
5930 dnl = Disable Fast Load
5931 dnl ========================================================
5932 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5933 [ --disable-xpcom-fastload
5934 Disable XPCOM fastload support],
5938 AC_SUBST(MOZ_NO_FAST_LOAD)
5940 if test -n "$MOZ_NO_FAST_LOAD"; then
5941 AC_DEFINE(MOZ_NO_FAST_LOAD)
5944 dnl ========================================================
5945 dnl = Enable Raw Codecs
5946 dnl ========================================================
5947 MOZ_ARG_ENABLE_BOOL(raw,
5948 [ --enable-raw Enable support for RAW media],
5952 if test -n "$MOZ_RAW"; then
5959 dnl ========================================================
5960 dnl = Disable Ogg Codecs
5961 dnl ========================================================
5962 MOZ_ARG_DISABLE_BOOL(ogg,
5963 [ --disable-ogg Disable support for OGG media (Theora video and Vorbis audio)],
5967 if test -n "$MOZ_OGG"; then
5971 case "$target_cpu" in
5980 dnl Checks for __attribute__(aligned()) directive
5981 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5982 [ac_cv_c_attribute_aligned],
5983 [ac_cv_c_attribute_aligned=0
5984 CFLAGS_save="${CFLAGS}"
5985 CFLAGS="${CFLAGS} -Werror"
5986 for ac_cv_c_attr_align_try in 64 32 16 8; do
5987 echo "trying $ac_cv_c_attr_align_try"
5989 [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5990 [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5991 if test "$ac_cv_c_attribute_aligned" != 0; then
5995 CFLAGS="${CFLAGS_save}"])
5996 if test "${ac_cv_c_attribute_aligned}" != "0"; then
5997 AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5998 [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
6002 dnl ========================================================
6003 dnl = Disable VP8 decoder support
6004 dnl ========================================================
6005 MOZ_ARG_DISABLE_BOOL(webm,
6006 [ --disable-webm Disable support for WebM media (VP8 video and Vorbis audio)],
6010 dnl system libvpx Support
6011 dnl ========================================================
6012 MOZ_ARG_WITH_STRING(system-libvpx,
6013 [ --with-system-libvpx=[PFX]
6014 Use system libvpx [installed at prefix PFX]],
6015 LIBVPX_DIR=$withval)
6018 MOZ_LIBVPX_INCLUDES=
6021 if test -n "$MOZ_WEBM"; then
6024 if test -n "$LIBVPX_DIR" -a "$LIBVPX_DIR" != no; then
6025 _SAVE_CFLAGS=$CFLAGS
6026 _SAVE_LDFLAGS=$LDFLAGS
6028 if test "${LIBVPX_DIR}" = "yes"; then
6031 CFLAGS="-I${LIBVPX_DIR}/include $CFLAGS"
6032 LDFLAGS="-L${LIBVPX_DIR}/lib $LDFLAGS"
6033 AC_CHECK_HEADER(vpx/vpx_decoder.h,
6034 [if test ! -f "${LIBVPX_DIR}/include/vpx/vpx_decoder.h"; then
6035 AC_MSG_ERROR([vpx/vpx_decoder.h found, but is not in ${LIBVPX_DIR}/include])
6037 AC_MSG_ERROR([--with-system-libvpx requested but vpx/vpx_decoder.h not found]))
6038 AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver,
6039 [MOZ_NATIVE_LIBVPX=1
6040 MOZ_LIBVPX_INCLUDES="-I${LIBVPX_DIR}/include"
6041 MOZ_LIBVPX_LIBS="-L${LIBVPX_DIR}/lib -lvpx"],
6042 ([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found]))
6043 CFLAGS=$_SAVE_CFLAGS
6044 LDFLAGS=$_SAVE_LDFLAGS
6049 AC_SUBST(MOZ_NATIVE_LIBVPX)
6050 AC_SUBST(MOZ_LIBVPX_INCLUDES)
6051 AC_SUBST(MOZ_LIBVPX_LIBS)
6053 if test -n "$MOZ_WEBM" -a -z "$MOZ_NATIVE_LIBVPX"; then
6056 case "$target_cpu" in
6066 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
6067 dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
6068 dnl We currently require gcc on all arm platforms.
6072 dnl See if we have assembly on this platform.
6073 case "$OS_ARCH:$CPU_ARCH" in
6075 VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
6079 VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
6083 VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
6087 VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
6091 VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
6095 VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
6099 if test -z "$GNU_CC"; then
6100 VPX_ASFLAGS="-f x64 -rnasm -pnasm"
6105 if test -z "$GNU_CC"; then
6106 dnl Check for yasm 1.1 or greater.
6107 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
6108 AC_MSG_ERROR([yasm 1.1 or greater is required to build libvpx on Win32, but it appears not to be installed. Install it (included in MozillaBuild 1.5.1 and newer) or configure with --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
6109 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6110 AC_MSG_ERROR([yasm 1.1 or greater is required to build libvpx on Win32, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION. Upgrade to the newest version (included in MozillaBuild 1.5.1 and newer) or configure with --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
6112 VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
6118 if test -n "$GNU_AS" ; then
6120 dnl These flags are a lie; they're just used to enable the requisite
6121 dnl opcodes; actual arch detection is done at runtime.
6122 VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
6123 VPX_DASH_C_FLAG="-c"
6124 VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
6125 VPX_ASM_SUFFIX="$ASM_SUFFIX"
6130 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
6131 AC_MSG_ERROR([yasm is a required build tool for this architecture when webm is enabled. You may either install yasm or --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
6134 if test -n "$VPX_X86_ASM"; then
6135 AC_DEFINE(VPX_X86_ASM)
6136 elif test -n "$VPX_ARM_ASM"; then
6137 AC_DEFINE(VPX_ARM_ASM)
6139 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
6143 dnl ========================================================
6144 dnl = Disable Wave decoder support
6145 dnl ========================================================
6146 MOZ_ARG_DISABLE_BOOL(wave,
6147 [ --disable-wave Disable Wave decoder support],
6151 if test -n "$MOZ_WAVE"; then
6157 dnl ========================================================
6158 dnl = Handle dependent SYDNEYAUDIO and MEDIA defines
6159 dnl ========================================================
6161 if test -n "$MOZ_SYDNEYAUDIO"; then
6162 AC_DEFINE(MOZ_SYDNEYAUDIO)
6165 if test -n "$MOZ_MEDIA"; then
6166 AC_DEFINE(MOZ_MEDIA)
6169 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
6170 AC_MSG_ERROR([MOZ_VORBIS and MOZ_TREMOR are mutually exclusive! The build system should not allow them both to be set, but they are. Please file a bug at https://bugzilla.mozilla.org/])
6173 if test -n "$MOZ_VORBIS"; then
6174 AC_DEFINE(MOZ_VORBIS)
6177 if test -n "$MOZ_TREMOR"; then
6178 AC_DEFINE(MOZ_TREMOR)
6181 dnl ========================================================
6182 dnl = Check alsa availability on Linux if using sydneyaudio
6183 dnl ========================================================
6185 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
6186 if test -n "$MOZ_SYDNEYAUDIO"; then
6187 case "$target_os" in
6189 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
6190 [echo "$MOZ_ALSA_PKG_ERRORS"
6191 AC_MSG_ERROR([Need alsa for Ogg, Wave or WebM decoding on Linux. Disable with --disable-ogg --disable-wave --disable-webm. (On Ubuntu, you might try installing the package libasound2-dev.)])])
6196 dnl ========================================================
6198 dnl ========================================================
6199 AC_ARG_ENABLE(splashscreen,
6200 [ --enable-splashscreen display splashscreen while loading (default=no)],
6201 [enable_splash="yes"],[enable_splash=""])
6202 if test "x$enable_splash" = "xyes"; then
6204 AC_DEFINE(MOZ_SPLASHSCREEN)
6206 AC_SUBST(MOZ_SPLASHSCREEN)
6208 dnl ========================================================
6209 dnl Permissions System
6210 dnl ========================================================
6211 MOZ_ARG_DISABLE_BOOL(permissions,
6212 [ --disable-permissions Disable permissions (popup and cookie blocking)],
6217 dnl ========================================================
6219 dnl ========================================================
6220 MOZ_ARG_DISABLE_BOOL(negotiateauth,
6221 [ --disable-negotiateauth Disable GSS-API negotiation ],
6222 MOZ_AUTH_EXTENSION=,
6223 MOZ_AUTH_EXTENSION=1 )
6225 dnl ========================================================
6227 dnl ========================================================
6228 MOZ_ARG_DISABLE_BOOL(xtf,
6229 [ --disable-xtf Disable XTF (pluggable xml tags) support],
6232 if test "$MOZ_XTF"; then
6236 dnl ========================================================
6237 dnl Pref extensions (autoconfig and system-pref)
6238 dnl ========================================================
6239 MOZ_ARG_DISABLE_BOOL(pref-extensions,
6240 [ --disable-pref-extensions
6241 Disable pref extensions such as autoconfig and
6243 MOZ_PREF_EXTENSIONS=,
6244 MOZ_PREF_EXTENSIONS=1 )
6246 dnl ========================================================
6247 dnl = Universalchardet
6248 dnl ========================================================
6249 MOZ_ARG_DISABLE_BOOL(universalchardet,
6250 [ --disable-universalchardet
6251 Disable universal encoding detection],
6252 MOZ_UNIVERSALCHARDET=,
6253 MOZ_UNIVERSALCHARDET=1 )
6255 dnl ========================================================
6257 dnl ========================================================
6264 MOZ_ARG_ENABLE_BOOL(javaxpcom,
6265 [ --enable-javaxpcom
6266 Enable Java-XPCOM bridge],
6272 if test -n "$JAVA_HOME"; then
6273 JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
6277 if test -n "$JAVA_HOME"; then
6278 JAVA_HOME=`cd "$JAVA_HOME" && pwd`
6283 if test -n "${JAVA_BIN_PATH}"; then
6284 dnl Look for javac and jar in the specified path.
6285 JAVA_PATH="$JAVA_BIN_PATH"
6287 dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
6288 JAVA_PATH="$JAVA_HOME/bin:$PATH"
6291 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
6292 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
6293 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
6295 if test -n "${JAVA_BIN_PATH}" -o "$OS_TARGET" = Android; then
6296 if test -z "$JAVA" -o "$JAVA" = ":" -o -z "$JAVAC" -o "$JAVAC" = ":" -o -z "$JAR" -o "$JAR" = ":"; then
6297 AC_MSG_ERROR([The programs java, javac and jar were not found. Set \$JAVA_HOME to your java sdk directory or use --with-java-bin-path={java-bin-dir}])
6301 if test -n "${MOZ_JAVAXPCOM}"; then
6302 if test -n "${JAVA_INCLUDE_PATH}"; then
6303 dnl Make sure jni.h exists in the given include path.
6304 if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
6305 AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
6308 case "$target_os" in
6310 dnl Default to java system location
6311 JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
6315 JAVA_INCLUDE_PATH="$JAVA_HOME/include"
6318 if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
6319 AC_MSG_ERROR([The header jni.h was not found. Set \$JAVA_HOME to your java sdk directory, use --with-java-bin-path={java-bin-dir}, or reconfigure with --disable-javaxpcom.])
6324 dnl ========================================================
6325 dnl = Breakpad crash reporting (on by default on supported platforms)
6326 dnl ========================================================
6329 i?86-*-mingw*|x86_64-*-mingw*)
6332 i?86-apple-darwin*|powerpc-apple-darwin*|x86_64-apple-darwin*)
6335 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
6346 MOZ_ARG_DISABLE_BOOL(crashreporter,
6347 [ --disable-crashreporter Disable breakpad crash reporting],
6349 MOZ_CRASHREPORTER=1)
6351 if test -n "$MOZ_CRASHREPORTER"; then
6352 AC_DEFINE(MOZ_CRASHREPORTER)
6354 if (test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS") && \
6355 test -z "$SKIP_LIBRARY_CHECKS"; then
6356 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
6357 AC_SUBST(MOZ_GTHREAD_CFLAGS)
6358 AC_SUBST(MOZ_GTHREAD_LIBS)
6360 AC_CHECK_HEADERS([curl/curl.h], [], [AC_MSG_ERROR([Couldn't find curl/curl.h which is required for the crash reporter. Use --disable-crashreporter to disable the crash reporter.])])
6364 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
6365 [ --with-crashreporter-enable-percent=NN
6366 Enable sending crash reports by default on NN% of users. (default=100)],
6367 [ val=`echo $withval | sed 's/[^0-9]//g'`
6368 MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
6370 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
6371 MOZ_CRASHREPORTER_ENABLE_PERCENT=100
6373 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
6375 dnl ========================================================
6376 dnl = Enable compilation of specific extension modules
6377 dnl ========================================================
6379 MOZ_ARG_ENABLE_STRING(extensions,
6380 [ --enable-extensions Enable extensions],
6381 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6382 if test "$option" = "yes" -o "$option" = "all"; then
6383 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6384 elif test "$option" = "no" -o "$option" = "none"; then
6386 elif test "$option" = "default"; then
6387 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6388 elif test `echo "$option" | grep -c \^-` != 0; then
6389 option=`echo $option | sed 's/^-//'`
6390 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6392 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6395 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6397 if test -z "$MOZ_ENABLE_GNOMEVFS" -a -z "$MOZ_GNOMEVFS_LIBS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6398 # Suppress warning on non-X11 platforms
6399 if test -n "$MOZ_X11"; then
6400 AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
6402 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6405 dnl Do not build gnomevfs with libxul based apps
6406 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6407 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6410 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6411 # Suppress warning on non-X11 platforms
6412 if test -n "$MOZ_X11"; then
6413 AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
6415 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6418 dnl Do not build gio with libxul based apps
6419 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6420 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6423 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6424 AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6425 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6428 dnl This might be temporary: build tridentprofile only on Windows
6429 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
6430 AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
6431 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
6434 dnl cookie must be built before tridentprofile. put it at list's end.
6435 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
6436 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
6437 MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
6440 dnl xforms requires xtf
6441 if test -z "$MOZ_XTF" -a `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
6442 AC_MSG_WARN([Cannot build XForms without XTF support. Removing XForms from MOZ_EXTENSIONS.])
6443 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6446 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
6447 AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
6448 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
6451 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
6452 AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
6453 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
6456 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
6457 AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
6458 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
6461 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
6462 AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
6463 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
6466 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
6467 AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
6468 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
6471 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
6472 AC_MSG_WARN([spellcheck is no longer an extension.])
6473 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
6477 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6479 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6480 dnl when trying to build a nonexistent extension.
6481 for extension in $MOZ_EXTENSIONS; do
6482 if test ! -d "${srcdir}/extensions/${extension}"; then
6483 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6487 dnl ========================================================
6488 dnl MathML on by default
6489 dnl ========================================================
6490 MOZ_ARG_DISABLE_BOOL(mathml,
6491 [ --disable-mathml Disable MathML support],
6494 if test "$MOZ_MATHML"; then
6495 AC_DEFINE(MOZ_MATHML)
6498 dnl ========================================================
6500 dnl ========================================================
6501 MOZ_ARG_DISABLE_BOOL(svg,
6502 [ --disable-svg Disable SVG support],
6505 if test -n "$MOZ_SVG"; then
6509 dnl ========================================================
6511 dnl ========================================================
6513 MOZ_ARG_DISABLE_BOOL(smil,
6514 [ --disable-smil Disable SMIL animation support],
6517 # Automatically disable SMIL if SVG is disabled
6518 if test -z "$MOZ_SVG"; then
6521 if test -n "$MOZ_SMIL"; then
6525 dnl ========================================================
6526 dnl Build Freetype in the tree
6527 dnl ========================================================
6528 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6529 [ --enable-tree-freetype Enable Tree FreeType],
6530 MOZ_TREE_FREETYPE=1,
6531 MOZ_TREE_FREETYPE= )
6532 if test -n "$MOZ_TREE_FREETYPE"; then
6533 if test -n "$_WIN32_MSVC"; then
6534 AC_ERROR("building with in-tree freetype is not supported on MSVC")
6536 AC_DEFINE(MOZ_TREE_FREETYPE)
6537 AC_SUBST(MOZ_TREE_FREETYPE)
6538 MOZ_ENABLE_CAIRO_FT=1
6539 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6540 FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6541 CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6542 FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6543 CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6544 AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6545 AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6546 AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6547 AC_SUBST(CAIRO_FT_CFLAGS)
6551 dnl ========================================================
6553 dnl ========================================================
6554 case "$target_os" in
6555 aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*|winmo*)
6560 MOZ_ARG_DISABLE_BOOL(installer,
6561 [ --disable-installer Disable building of installer],
6564 if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then
6565 # Disable installer for Windows builds that use the new toolkit if the
6566 # required major version and minimum minor version of Unicode NSIS isn't in
6568 REQ_NSIS_MAJOR_VER=2
6569 MIN_NSIS_MINOR_VER=33
6570 MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensisu makensis)
6571 if test -z "$MAKENSISU" -o "$MAKENSISU" = ":"; then
6572 AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or Unicode NSIS with a major version of $REQ_NSIS_MAJOR_VER and a minimum minor version of $MIN_NSIS_MINOR_VER in your path. To build without the installer reconfigure using --disable-installer.])
6575 MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\)\-Unicode$/\1/g'`
6577 if test ! "$MAKENSISU_VER" == ""; then
6578 MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6579 MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6581 AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6582 if test "$MAKENSISU_VER" == "" -o \
6583 ! "$MAKENSISU_MAJOR_VER" == "$REQ_NSIS_MAJOR_VER" -o \
6584 ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6586 AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or Unicode NSIS with a major version of $REQ_NSIS_MAJOR_VER and a minimum minor version of $MIN_NSIS_MINOR_VER in your path. To build without the installer reconfigure using --disable-installer.])
6588 AC_MSG_RESULT([yes])
6589 MAKENSISU="${CYGWIN_WRAPPER} $MAKENSISU"
6592 AC_SUBST(MOZ_INSTALLER)
6594 AC_MSG_CHECKING([for tar archiver])
6595 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6596 if test -z "$TAR"; then
6597 AC_MSG_ERROR([no tar archiver found in \$PATH])
6599 AC_MSG_RESULT([$TAR])
6602 AC_MSG_CHECKING([for wget])
6603 AC_CHECK_PROGS(WGET, wget, "")
6604 AC_MSG_RESULT([$WGET])
6607 dnl ========================================================
6609 dnl ========================================================
6611 MOZ_ARG_DISABLE_BOOL(updater,
6612 [ --disable-updater Disable building of updater],
6616 if test -n "$MOZ_UPDATER"; then
6617 AC_DEFINE(MOZ_UPDATER)
6620 # app update channel is 'default' when not supplied.
6621 MOZ_ARG_ENABLE_STRING([update-channel],
6622 [ --enable-update-channel=CHANNEL
6623 Select application update channel (default=default)],
6624 MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6626 if test -z "$MOZ_UPDATE_CHANNEL"; then
6627 MOZ_UPDATE_CHANNEL=default
6629 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6630 AC_SUBST(MOZ_UPDATE_CHANNEL)
6632 # tools/update-packaging is not checked out by default.
6633 MOZ_ARG_ENABLE_BOOL(update-packaging,
6634 [ --enable-update-packaging
6635 Enable tools/update-packaging],
6636 MOZ_UPDATE_PACKAGING=1,
6637 MOZ_UPDATE_PACKAGING= )
6638 AC_SUBST(MOZ_UPDATE_PACKAGING)
6640 dnl ========================================================
6642 dnl ========================================================
6644 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
6645 [ --disable-xpconnect-idispatch
6646 Disable building of xpconnect support for IDispatch
6648 XPC_IDISPATCH_SUPPORT=,
6649 XPC_IDISPATCH_SUPPORT=1)
6650 AC_SUBST(XPC_IDISPATCH_SUPPORT)
6652 MOZ_ARG_DISABLE_BOOL(activex,
6653 [ --disable-activex Disable building of ActiveX control (win32 only)],
6654 MOZ_NO_ACTIVEX_SUPPORT=1,
6655 MOZ_NO_ACTIVEX_SUPPORT= )
6656 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
6658 MOZ_ARG_ENABLE_BOOL(activex-scripting,
6659 [ --enable-activex-scripting
6660 Enable building of ActiveX scripting support (win32)],
6661 MOZ_ACTIVEX_SCRIPTING_SUPPORT=1,
6662 MOZ_ACTIVEX_SCRIPTING_SUPPORT=)
6663 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
6665 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
6667 AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
6670 if test "$COMPILE_ENVIRONMENT" = "1"; then
6671 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
6673 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
6674 if test "$ac_cv_header_atlbase_h" = "no"; then
6675 AC_MSG_ERROR([System header atlbase.h is not available. See http://developer.mozilla.org/en/docs/atlbase.h for details on fixing this problem.])
6682 dnl ========================================================
6684 dnl ========================================================
6685 MOZ_ARG_ENABLE_BOOL(leaky,
6686 [ --enable-leaky Build leaky memory tool],
6691 dnl ========================================================
6692 dnl build the tests by default
6693 dnl ========================================================
6694 MOZ_ARG_DISABLE_BOOL(tests,
6695 [ --disable-tests Do not build test libraries & programs],
6699 dnl ========================================================
6700 dnl parental controls (for Windows Vista)
6701 dnl ========================================================
6702 MOZ_ARG_DISABLE_BOOL(parental-controls,
6703 [ --disable-parental-controls
6704 Do not build parental controls],
6705 MOZ_DISABLE_PARENTAL_CONTROLS=1,
6706 MOZ_DISABLE_PARENTAL_CONTROLS=)
6707 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6708 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6711 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6713 dnl ========================================================
6714 dnl = Disable DOMCrypto
6715 dnl ========================================================
6716 if test -n "$MOZ_DISABLE_DOMCRYPTO"; then
6717 AC_DEFINE(MOZ_DISABLE_DOMCRYPTO)
6720 dnl ========================================================
6722 dnl = Module specific options
6724 dnl ========================================================
6725 MOZ_ARG_HEADER(Individual module options)
6727 dnl ========================================================
6728 dnl = Disable feed handling components
6729 dnl ========================================================
6730 MOZ_ARG_DISABLE_BOOL(feeds,
6731 [ --disable-feeds Disable feed handling and processing components],
6734 if test -n "$MOZ_FEEDS"; then
6735 AC_DEFINE(MOZ_FEEDS)
6737 if test "$MOZ_BUILD_APP" = "browser"; then
6738 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6742 dnl ========================================================
6743 dnl = Enable mozStorage
6744 dnl ========================================================
6745 dnl Implicitly enabled by default if building calendar or places
6746 MOZ_ARG_ENABLE_BOOL(storage,
6747 [ --enable-storage Enable mozStorage module and related components],
6750 if test -n "$MOZ_STORAGE"; then
6751 AC_DEFINE(MOZ_STORAGE)
6754 dnl ========================================================
6755 dnl Check for sqlite
6756 dnl ========================================================
6759 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6760 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
6761 MOZ_NATIVE_SQLITE=1,
6762 MOZ_NATIVE_SQLITE= )
6764 if test -z "$MOZ_NATIVE_SQLITE"
6767 SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6769 dnl ============================
6770 dnl === SQLite Version check ===
6771 dnl ============================
6772 dnl Check to see if the system SQLite package is new enough.
6773 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6775 dnl ==================================
6776 dnl === SQLITE_SECURE_DELETE check ===
6777 dnl ==================================
6778 dnl Check to see if the system SQLite package is compiled with
6779 dnl SQLITE_SECURE_DELETE enabled.
6780 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6781 _SAVE_CFLAGS="$CFLAGS"
6782 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6784 LIBS="$LIBS $SQLITE_LIBS"
6785 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6787 #include "sqlite3.h"
6789 int main(int argc, char **argv){
6790 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6792 ac_cv_sqlite_secure_delete=yes,
6793 ac_cv_sqlite_secure_delete=no,
6794 ac_cv_sqlite_secure_delete=no
6797 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6798 CFLAGS="$_SAVE_CFLAGS"
6800 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6801 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6804 dnl ===============================
6805 dnl === SQLITE_THREADSAFE check ===
6806 dnl ===============================
6807 dnl Check to see if the system SQLite package is compiled with
6808 dnl SQLITE_THREADSAFE enabled.
6809 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6810 _SAVE_CFLAGS="$CFLAGS"
6811 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6813 LIBS="$LIBS $SQLITE_LIBS"
6814 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6816 #include "sqlite3.h"
6818 int main(int argc, char **argv){
6819 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6821 ac_cv_sqlite_threadsafe=yes,
6822 ac_cv_sqlite_threadsafe=no,
6823 ac_cv_sqlite_threadsafe=no
6826 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6827 CFLAGS="$_SAVE_CFLAGS"
6829 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6830 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6833 dnl ================================
6834 dnl === SQLITE_ENABLE_FTS3 check ===
6835 dnl ================================
6836 dnl check to see if the system SQLite package is compiled with
6837 dnl SQLITE_ENABLE_FTS3 enabled.
6838 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6839 _SAVE_CFLAGS="$CFLAGS"
6840 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6842 LIBS="$LIBS $SQLITE_LIBS"
6843 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6845 #include "sqlite3.h"
6847 int main(int argc, char **argv){
6848 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6850 ac_cv_sqlite_enable_fts3=yes,
6851 ac_cv_sqlite_enable_fts3=no,
6852 ac_cv_sqlite_enable_fts3=no
6855 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6856 CFLAGS="$_SAVE_CFLAGS"
6858 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6859 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6862 dnl =========================================
6863 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6864 dnl =========================================
6865 dnl check to see if the system SQLite package is compiled with
6866 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6867 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6868 _SAVE_CFLAGS="$CFLAGS"
6869 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6871 LIBS="$LIBS $SQLITE_LIBS"
6872 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6874 #include "sqlite3.h"
6876 int main(int argc, char **argv){
6877 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6879 ac_cv_sqlite_enable_unlock_notify=yes,
6880 ac_cv_sqlite_enable_unlock_notify=no,
6881 ac_cv_sqlite_enable_unlock_notify=no
6884 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6885 CFLAGS="$_SAVE_CFLAGS"
6887 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6888 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6892 AC_SUBST(MOZ_NATIVE_SQLITE)
6894 dnl ========================================================
6895 dnl = Enable help viewer (off by default)
6896 dnl ========================================================
6897 if test -n "$MOZ_HELP_VIEWER"; then
6898 dnl Do this if defined in confvars.sh
6899 AC_DEFINE(MOZ_HELP_VIEWER)
6902 dnl ========================================================
6903 dnl = Enable safe browsing (anti-phishing)
6904 dnl ========================================================
6905 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6906 [ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation],
6907 MOZ_SAFE_BROWSING=1,
6908 MOZ_SAFE_BROWSING= )
6909 if test -n "$MOZ_SAFE_BROWSING"; then
6910 AC_DEFINE(MOZ_SAFE_BROWSING)
6912 AC_SUBST(MOZ_SAFE_BROWSING)
6914 dnl ========================================================
6915 dnl = Enable faststart component
6916 dnl ========================================================
6917 MOZ_ARG_ENABLE_BOOL(faststart,
6918 [ --enable-faststart Enable the faststart component],
6921 if test -n "$MOZ_FASTSTART"; then
6922 AC_DEFINE(MOZ_FASTSTART)
6924 AC_SUBST(MOZ_FASTSTART)
6926 dnl ========================================================
6927 dnl = Enable url-classifier
6928 dnl ========================================================
6929 dnl Implicitly enabled by default if building with safe-browsing
6930 if test -n "$MOZ_SAFE_BROWSING"; then
6931 MOZ_URL_CLASSIFIER=1
6933 MOZ_ARG_ENABLE_BOOL(url-classifier,
6934 [ --enable-url-classifier Enable url classifier module],
6935 MOZ_URL_CLASSIFIER=1,
6936 MOZ_URL_CLASSIFIER= )
6937 if test -n "$MOZ_URL_CLASSIFIER"; then
6938 AC_DEFINE(MOZ_URL_CLASSIFIER)
6940 AC_SUBST(MOZ_URL_CLASSIFIER)
6942 dnl ========================================================
6943 dnl = Disable zipwriter
6944 dnl ========================================================
6945 MOZ_ARG_DISABLE_BOOL(zipwriter,
6946 [ --disable-zipwriter Disable zipwriter component],
6949 AC_SUBST(MOZ_ZIPWRITER)
6951 dnl ========================================================
6953 dnl ========================================================
6954 dnl superseded by QtNetwork starting from 4.7
6955 MOZ_ENABLE_LIBCONIC=1
6957 if test -n "$MOZ_ENABLE_QT"; then
6958 if test "$MOZ_ENABLE_QTNETWORK"; then
6959 MOZ_ENABLE_LIBCONIC=
6963 MOZ_ARG_DISABLE_BOOL(libconic,
6964 [ --disable-libconic Disable libconic],
6965 MOZ_ENABLE_LIBCONIC=,
6966 MOZ_ENABLE_LIBCONIC=1 )
6968 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6969 PKG_CHECK_MODULES(LIBCONIC, conic,
6970 MOZ_ENABLE_LIBCONIC=1,
6971 MOZ_ENABLE_LIBCONIC=)
6973 if test "$MOZ_ENABLE_LIBCONIC"; then
6974 AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6977 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6978 AC_SUBST(LIBCONIC_CFLAGS)
6979 AC_SUBST(LIBCONIC_LIBS)
6981 dnl ========================================================
6983 dnl ========================================================
6985 MAEMO_SDK_TARGET_VER=-1
6987 MOZ_ARG_WITH_STRING(maemo-version,
6988 [ --with-maemo-version=MAEMO_SDK_TARGET_VER
6990 MAEMO_SDK_TARGET_VER=$withval)
6992 case "$MAEMO_SDK_TARGET_VER" in
6994 MOZ_PLATFORM_MAEMO=5
6998 MOZ_PLATFORM_MAEMO=6
7002 dnl We aren't compiling for Maemo, move on.
7005 AC_MSG_ERROR([Unknown Maemo Version. Try setting --with-maemo-version to 5 or 6.])
7009 if test $MOZ_PLATFORM_MAEMO; then
7010 AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
7012 if test -z "$MOZ_ENABLE_DBUS"; then
7013 AC_MSG_ERROR([DBus is required when building for Maemo])
7016 MOZ_GFX_OPTIMIZE_MOBILE=1
7018 MOZ_MAEMO_LIBLOCATION=
7020 if test $MOZ_PLATFORM_MAEMO = 5; then
7021 dnl if we have Xcomposite we should also have Xdamage and Xfixes
7022 AC_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
7023 [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
7024 AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
7025 [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
7027 AC_SUBST(XCOMPOSITE_LIBS)
7029 PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
7030 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
7031 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
7032 if test -z "$_LIB_FOUND"; then
7033 AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
7037 PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
7038 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
7039 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
7040 if test -z "$_LIB_FOUND"; then
7041 AC_MSG_ERROR([LibOSSO is required when building for Maemo])
7044 PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
7045 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
7046 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
7047 if test -z "$_LIB_FOUND"; then
7048 AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
7052 if test $MOZ_PLATFORM_MAEMO = 6; then
7053 PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
7054 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTACTION_LIBS"
7055 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTACTION_CFLAGS"
7056 if test -z "$_LIB_FOUND"; then
7057 AC_MSG_ERROR([libcontentaction is required when build for Maemo])
7061 PKG_CHECK_MODULES(MOZ_MEEGOTOUCH, meegotouchcore)
7062 MOZ_ENABLE_MEEGOTOUCH=1
7063 AC_DEFINE(MOZ_ENABLE_MEEGOTOUCH)
7064 MOZ_QT_CFLAGS="$MOZ_MEEGOTOUCH_CFLAGS $MOZ_QT_CFLAGS"
7065 MOZ_QT_LIBS="$MOZ_MEEGOTOUCH_LIBS $MOZ_QT_LIBS"
7068 PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
7069 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
7070 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
7071 if test "$_LIB_FOUND"; then
7072 MOZ_MAEMO_LIBLOCATION=1
7073 AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
7075 AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
7077 AC_SUBST(MOZ_MAEMO_LIBLOCATION)
7079 PKG_CHECK_MODULES(LIBMEEGOTOUCHSHARE, ShareUiInterface-maemo-meegotouch >= 0.3.31 mdatauri, _LIB_FOUND=1, _LIB_FOUND=)
7080 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBMEEGOTOUCHSHARE_LIBS"
7081 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBMEEGOTOUCHSHARE_CFLAGS"
7082 if test "$_LIB_FOUND"; then
7083 MOZ_ENABLE_MEEGOTOUCHSHARE=1
7084 AC_DEFINE(MOZ_ENABLE_MEEGOTOUCHSHARE)
7086 AC_MSG_WARN([Cannot find maemo-meegotouch-interfaces-dev or libmdatauri-dev. Disabling meegotouch share ui.])
7088 AC_SUBST(MOZ_ENABLE_MEEGOTOUCHSHARE)
7090 AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
7091 AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
7094 dnl ========================================================
7095 dnl = Enable building the Thumb2 instruction set
7096 dnl ========================================================
7097 MOZ_ARG_ENABLE_BOOL(thumb2,
7098 [ --enable-thumb2 Enable Thumb2 instruction set],
7102 if test -n "$MOZ_THUMB2"; then
7103 case "$target_cpu" in
7105 if test "$GNU_CC"; then
7106 CFLAGS="$CFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
7107 CXXFLAGS="$CXXFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
7108 ASFLAGS="$ASFLAGS -march=armv7-a -mthumb"
7110 AC_MSG_ERROR([--enable-thumb2 is not supported for non-GNU toolchains])
7114 AC_MSG_ERROR([--enable-thumb2 is not supported for non-ARM CPU architectures])
7118 case "$target_cpu" in
7120 if test "$GNU_CC"; then
7121 CFLAGS="$CFLAGS -march=armv5te -mthumb-interwork -Wa, -march=armv5te -Wa, -mthumb-interwork"
7122 CXXFLAGS="$CXXFLAGS -march=armv5te -mthumb-interwork -Wa, -march=armv5te -Wa, -mthumb-interwork"
7123 ASFLAGS="$ASFLAGS -march=armv5te -mthumb-interwork"
7129 AC_SUBST(MOZ_THUMB2)
7131 dnl ========================================================
7132 dnl = faststripe theme
7133 dnl ========================================================
7134 MOZ_ARG_ENABLE_BOOL(faststripe,
7135 [ --enable-faststripe Use faststripe theme],
7136 MOZ_THEME_FASTSTRIPE=1,
7137 MOZ_THEME_FASTSTRIPE= )
7138 AC_SUBST(MOZ_THEME_FASTSTRIPE)
7140 dnl ========================================================
7142 dnl = Feature options that require extra sources to be pulled
7144 dnl ========================================================
7145 dnl MOZ_ARG_HEADER(Features that require extra sources)
7147 dnl ========================================================
7149 dnl = Debugging Options
7151 dnl ========================================================
7152 MOZ_ARG_HEADER(Debugging and Optimizations)
7154 dnl ========================================================
7155 dnl = Disable building with debug info.
7156 dnl = Debugging is OFF by default
7157 dnl ========================================================
7158 if test -z "$MOZ_DEBUG_FLAGS"; then
7159 MOZ_DEBUG_FLAGS="-g"
7162 MOZ_ARG_ENABLE_STRING(debug,
7163 [ --enable-debug[=DBG] Enable building with developer debug info
7164 (using compiler flags DBG)],
7165 [ if test "$enableval" != "no"; then
7167 if test -n "$enableval" -a "$enableval" != "yes"; then
7168 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7169 _MOZ_DEBUG_FLAGS_SET=1
7176 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
7177 MOZ_ARG_WITH_STRING(debug-label,
7178 [ --with-debug-label=LABELS
7179 Define DEBUG_<value> for each comma-separated
7181 [ for option in `echo $withval | sed 's/,/ /g'`; do
7182 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
7185 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
7187 if test -n "$MOZ_DEBUG"; then
7188 AC_MSG_CHECKING([for valid debug flags])
7189 _SAVE_CFLAGS=$CFLAGS
7190 CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
7191 AC_TRY_COMPILE([#include <stdio.h>],
7192 [printf("Hello World\n");],
7195 AC_MSG_RESULT([$_results])
7196 if test "$_results" = "no"; then
7197 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
7199 CFLAGS=$_SAVE_CFLAGS
7202 dnl ========================================================
7203 dnl enable mobile optimizations
7204 dnl ========================================================
7205 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
7206 [ --enable-mobile-optimize
7207 Enable mobile optimizations],
7208 MOZ_GFX_OPTIMIZE_MOBILE=1)
7210 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
7212 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
7213 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
7216 dnl ========================================================
7217 dnl = Enable code optimization. ON by default.
7218 dnl ========================================================
7219 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
7220 MOZ_OPTIMIZE_FLAGS="-O"
7223 MOZ_ARG_ENABLE_STRING(optimize,
7224 [ --disable-optimize Disable compiler optimization
7225 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
7226 [ if test "$enableval" != "no"; then
7228 if test -n "$enableval" -a "$enableval" != "yes"; then
7229 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
7234 fi ], MOZ_OPTIMIZE=1)
7236 if test "$COMPILE_ENVIRONMENT"; then
7237 if test -n "$MOZ_OPTIMIZE"; then
7238 AC_MSG_CHECKING([for valid optimization flags])
7239 _SAVE_CFLAGS=$CFLAGS
7240 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
7241 AC_TRY_COMPILE([#include <stdio.h>],
7242 [printf("Hello World\n");],
7245 AC_MSG_RESULT([$_results])
7246 if test "$_results" = "no"; then
7247 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
7249 CFLAGS=$_SAVE_CFLAGS
7251 fi # COMPILE_ENVIRONMENT
7253 AC_SUBST(MOZ_OPTIMIZE)
7254 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
7255 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
7256 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
7258 dnl ========================================================
7259 dnl = (Deprecated) generation of debugger info for specific modules
7260 dnl ========================================================
7261 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
7262 [ --enable-debugger-info-modules
7263 Enable/disable debugger info for specific modules],
7264 [ if test "$enableval" != "no"; then
7265 AC_MSG_WARN([--enable-debugger-info-modules is deprecated, use --enable-debug-symbols instead])
7269 dnl ========================================================
7270 dnl = Enable generation of debug symbols
7271 dnl ========================================================
7272 MOZ_ARG_ENABLE_STRING(debug-symbols,
7273 [ --enable-debug-symbols[=DBG]
7274 Enable debugging symbols (using compiler flags DBG)],
7275 [ if test "$enableval" != "no"; then
7277 if test -n "$enableval" -a "$enableval" != "yes"; then
7278 if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
7279 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7281 AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
7286 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
7287 AC_DEFINE(MOZ_DEBUG_SYMBOLS)
7288 export MOZ_DEBUG_SYMBOLS
7291 dnl ========================================================
7292 dnl = Disable any treating of compile warnings as errors
7293 dnl ========================================================
7294 MOZ_ARG_DISABLE_BOOL(warnings-as-errors,
7295 [ --disable-warnings-as-errors
7296 Disable treating of warnings as errors],
7297 MOZ_DISABLE_WARNINGS_AS_ERRORS=1,
7298 MOZ_DISABLE_WARNINGS_AS_ERRORS= )
7299 if test "$MOZ_DISABLE_WARNINGS_AS_ERRORS"; then
7300 WARNINGS_AS_ERRORS=''
7303 dnl ========================================================
7304 dnl = Disable runtime logging checks
7305 dnl ========================================================
7306 MOZ_ARG_DISABLE_BOOL(logging,
7307 [ --disable-logging Disable logging facilities],
7308 NS_DISABLE_LOGGING=1,
7309 NS_DISABLE_LOGGING= )
7310 if test "$NS_DISABLE_LOGGING"; then
7311 AC_DEFINE(NS_DISABLE_LOGGING)
7313 AC_DEFINE(MOZ_LOGGING)
7316 dnl ========================================================
7317 dnl = This will enable logging of addref, release, ctor, dtor.
7318 dnl ========================================================
7319 _ENABLE_LOGREFCNT=42
7320 MOZ_ARG_ENABLE_BOOL(logrefcnt,
7321 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
7322 _ENABLE_LOGREFCNT=1,
7323 _ENABLE_LOGREFCNT= )
7324 if test "$_ENABLE_LOGREFCNT" = "1"; then
7325 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
7326 elif test -z "$_ENABLE_LOGREFCNT"; then
7327 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
7330 dnl ========================================================
7331 dnl = Enable trace malloc
7332 dnl ========================================================
7333 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
7334 MOZ_ARG_ENABLE_BOOL(trace-malloc,
7335 [ --enable-trace-malloc Enable malloc tracing],
7338 if test "$NS_TRACE_MALLOC"; then
7339 # Please, Mr. Linker Man, don't take away our symbol names
7340 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7342 AC_DEFINE(NS_TRACE_MALLOC)
7344 AC_SUBST(NS_TRACE_MALLOC)
7346 dnl ========================================================
7347 dnl = Enable jemalloc
7348 dnl ========================================================
7349 MOZ_ARG_ENABLE_BOOL(jemalloc,
7350 [ --enable-jemalloc Replace memory allocator with jemalloc],
7354 if test "$NS_TRACE_MALLOC"; then
7358 if test "$MOZ_MEMORY"; then
7360 dnl Don't try to run compiler tests on Windows
7361 if test "$OS_ARCH" = "WINNT"; then
7362 if test -z "$HAVE_64BIT_OS"; then
7363 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7365 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7368 AC_CHECK_SIZEOF([int *], [4])
7369 case "${ac_cv_sizeof_int_p}" in
7371 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7374 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7377 AC_MSG_ERROR([Unexpected pointer size])
7382 AC_DEFINE(MOZ_MEMORY)
7383 if test "x$MOZ_DEBUG" = "x1"; then
7384 AC_DEFINE(MOZ_MEMORY_DEBUG)
7386 dnl The generic feature tests that determine how to compute ncpus are long and
7387 dnl complicated. Therefore, simply define special cpp variables for the
7388 dnl platforms we have special knowledge of.
7391 AC_DEFINE(MOZ_MEMORY_DARWIN)
7394 AC_DEFINE(MOZ_MEMORY_BSD)
7397 AC_DEFINE(MOZ_MEMORY_LINUX)
7400 AC_DEFINE(MOZ_MEMORY_BSD)
7403 AC_DEFINE(MOZ_MEMORY_SOLARIS)
7405 *-msvc*|*-mks*|*-cygwin*|*-mingw*)
7406 AC_DEFINE(MOZ_MEMORY_WINDOWS)
7407 dnl This is sort of awful. Will revisit if we add support for more versions
7408 if test "$CC_VERSION" != "14.00.50727.762" -a "$CC_VERSION" != "15.00.30729.01"; then
7409 AC_MSG_ERROR([Building jemalloc requires exactly Visual C++ 2005 SP1 or 2008 SP1 currently.])
7411 if test -z "$WIN32_CRT_SRC_DIR"; then
7412 if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
7413 AC_MSG_ERROR([When building jemalloc, set WIN32_CRT_SRC_DIR to the path to the Visual C++ CRT source (usually VCINSTALLDIR\crt\src, but VCINSTALLDIR is not set, so I can't autodetect it for you).])
7415 WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
7419 case "${target_cpu}" in
7421 MOZ_CRT_CPU_ARCH=intel
7424 MOZ_CRT_CPU_ARCH=amd64
7427 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7431 AC_SUBST(MOZ_CRT_CPU_ARCH)
7433 if test ! -d "$WIN32_CRT_SRC_DIR"; then
7434 AC_MSG_ERROR([Invalid Win32 CRT source directory: ${WIN32_CRT_SRC_DIR}])
7436 WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd -W`
7437 _objdir_win=`pwd -W`
7438 WIN32_CUSTOM_CRT_DIR="$_objdir_win/memory/jemalloc/crtsrc/build/$MOZ_CRT_CPU_ARCH"
7439 MOZ_MEMORY_LDFLAGS="-MANIFEST:NO -LIBPATH:\"$WIN32_CUSTOM_CRT_DIR\" -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt19 -DEFAULTLIB:mozcpp19"
7440 dnl Also pass this to NSPR/NSS
7441 DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
7445 AC_DEFINE(MOZ_MEMORY_WINCE)
7446 AC_DEFINE(MOZ_MEMORY_WINDOWS)
7447 if test -z "$WINCE_WINDOWS_MOBILE"; then
7448 AC_DEFINE(MOZ_MEMORY_WINCE6)
7452 AC_DEFINE(MOZ_MEMORY_WINCE)
7453 AC_DEFINE(MOZ_MEMORY_WINDOWS)
7456 AC_DEFINE(MOZ_MEMORY_LINUX)
7457 AC_DEFINE(MOZ_MEMORY_ANDROID)
7459 export WRAP_MALLOC_LIB="-L$_objdir/dist/lib -lmozalloc -lmozutils"
7460 WRAP_MALLOC_CFLAGS="-Wl,--wrap=dlopen -Wl,--wrap=dlclose -Wl,--wrap=dlerror -Wl,--wrap=dlsym -Wl,--wrap=dladdr"
7463 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7467 if test "$OS_ARCH" != "Darwin"; then
7468 dnl NB: this must be kept in sync with jemalloc.h
7469 AC_DEFINE(HAVE_JEMALLOC_VALLOC)
7470 AC_DEFINE(HAVE_JEMALLOC_POSIX_MEMALIGN)
7471 AC_DEFINE(HAVE_JEMALLOC_MEMALIGN)
7474 AC_SUBST(MOZ_MEMORY)
7475 AC_SUBST(MOZ_MEMORY_LDFLAGS)
7476 AC_SUBST(WIN32_CRT_SRC_DIR)
7477 dnl Need to set this for make because NSS doesn't have configure
7480 dnl ========================================================
7481 dnl = Use malloc wrapper lib
7482 dnl ========================================================
7483 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7484 [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)],
7488 if test -n "$_WRAP_MALLOC"; then
7489 if test "$GNU_CC"; then
7490 WRAP_MALLOC_CFLAGS="${LDFLAGS} ${WRAP_MALLOC_CFLAGS} -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"
7491 MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) $(WRAP_MALLOC_LIB) -o $@'
7495 dnl ========================================================
7496 dnl = Location of malloc wrapper lib
7497 dnl ========================================================
7498 MOZ_ARG_WITH_STRING(wrap-malloc,
7499 [ --with-wrap-malloc=DIR Location of malloc wrapper library],
7500 WRAP_MALLOC_LIB=$withval)
7502 dnl ========================================================
7503 dnl = Use JS Call tracing
7504 dnl ========================================================
7505 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7506 [ --enable-trace-jscalls Enable JS call enter/exit callback (default=no)],
7507 MOZ_TRACE_JSCALLS=1,
7508 MOZ_TRACE_JSCALLS= )
7509 if test -n "$MOZ_TRACE_JSCALLS"; then
7510 AC_DEFINE(MOZ_TRACE_JSCALLS)
7513 dnl ========================================================
7515 dnl ========================================================
7516 MOZ_ARG_ENABLE_BOOL(tracevis,
7517 [ --enable-tracevis Enable TraceVis tracing tool (default=no)],
7520 if test -n "$MOZ_TRACEVIS"; then
7521 AC_DEFINE(MOZ_TRACEVIS)
7524 dnl ========================================================
7526 dnl ========================================================
7527 MOZ_ARG_ENABLE_BOOL(gctimer,
7528 [ --enable-gctimer Enable GC timer (default=no)],
7531 if test -n "$MOZ_GCTIMER"; then
7532 AC_DEFINE(MOZ_GCTIMER)
7535 dnl ========================================================
7537 dnl ========================================================
7538 MOZ_ARG_ENABLE_BOOL(valgrind,
7539 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
7542 if test -n "$MOZ_VALGRIND"; then
7543 AC_CHECK_HEADER([valgrind/valgrind.h], [],
7545 [--enable-valgrind specified but Valgrind is not installed]))
7546 AC_DEFINE(MOZ_VALGRIND)
7549 dnl ========================================================
7551 dnl ========================================================
7552 MOZ_ARG_ENABLE_BOOL(jprof,
7553 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
7556 if test -n "$MOZ_JPROF"; then
7558 AC_DEFINE(MOZ_JPROF)
7561 dnl ========================================================
7563 dnl ========================================================
7564 MOZ_ARG_ENABLE_BOOL(shark,
7565 [ --enable-shark Enable shark remote profiling (needs CHUD framework). Implies --enable-profiling.],
7568 if test -n "$MOZ_SHARK"; then
7570 AC_DEFINE(MOZ_SHARK)
7573 dnl ========================================================
7575 dnl ========================================================
7576 MOZ_ARG_ENABLE_BOOL(callgrind,
7577 [ --enable-callgrind Enable callgrind profiling],
7580 if test -n "$MOZ_CALLGRIND"; then
7581 AC_DEFINE(MOZ_CALLGRIND)
7584 dnl ========================================================
7586 dnl ========================================================
7587 MOZ_ARG_ENABLE_BOOL(vtune,
7588 [ --enable-vtune Enable vtune profiling. Implies --enable-profiling.],
7591 if test -n "$MOZ_VTUNE"; then
7593 AC_DEFINE(MOZ_VTUNE)
7596 dnl ========================================================
7597 dnl Zealous JavaScript GC
7598 dnl ========================================================
7599 MOZ_ARG_ENABLE_BOOL(gczeal,
7600 [ --enable-gczeal Enable zealous JavaScript GCing],
7603 if test -n "$JS_GC_ZEAL"; then
7604 AC_DEFINE(JS_GC_ZEAL)
7607 dnl ======================================================
7608 dnl = Enable compiling with ccache
7609 dnl ======================================================
7610 MOZ_ARG_WITH_STRING(ccache,
7611 [ --with-ccache[=path/to/ccache]
7612 Enable compiling with ccache],
7613 CCACHE=$withval, CCACHE="no")
7615 if test "$CCACHE" != "no"; then
7616 if test -z "$CCACHE" -o "$CCACHE" = "yes"; then
7619 if test ! -e "$CCACHE"; then
7620 AC_MSG_ERROR([$CCACHE not found])
7623 MOZ_PATH_PROGS(CCACHE, $CCACHE ccache)
7624 if test -z "$CCACHE" -o "$CCACHE" = ":"; then
7625 AC_MSG_ERROR([ccache not found])
7626 elif test -x "$CCACHE"; then
7630 AC_MSG_ERROR([$CCACHE is not executable])
7634 dnl ========================================================
7635 dnl = Enable static checking using gcc-dehydra
7636 dnl ========================================================
7638 MOZ_ARG_WITH_STRING(static-checking,
7639 [ --with-static-checking=path/to/gcc_dehydra.so
7640 Enable static checking of code using GCC-dehydra],
7641 DEHYDRA_PATH=$withval,
7644 if test -n "$DEHYDRA_PATH"; then
7645 if test ! -f "$DEHYDRA_PATH"; then
7646 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7648 AC_DEFINE(NS_STATIC_CHECKING)
7650 AC_SUBST(DEHYDRA_PATH)
7652 dnl ========================================================
7653 dnl = Enable stripping of libs & executables
7654 dnl ========================================================
7655 MOZ_ARG_ENABLE_BOOL(strip,
7656 [ --enable-strip Enable stripping of libs & executables ],
7660 dnl ========================================================
7661 dnl = Enable stripping of libs & executables when packaging
7662 dnl ========================================================
7663 MOZ_ARG_ENABLE_BOOL(install-strip,
7664 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
7668 dnl ========================================================
7669 dnl = --enable-elf-dynstr-gc
7670 dnl ========================================================
7671 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7672 [ --enable-elf-dynstr-gc Enable elf dynstr garbage collector (opt builds only)],
7673 USE_ELF_DYNSTR_GC=1,
7674 USE_ELF_DYNSTR_GC= )
7676 dnl ========================================================
7678 dnl = Profiling and Instrumenting
7680 dnl ========================================================
7681 MOZ_ARG_HEADER(Profiling and Instrumenting)
7683 dnl ========================================================
7684 dnl = Enable timeline service, which provides lightweight
7685 dnl = instrumentation of mozilla for performance measurement.
7686 dnl = Timeline is off by default.
7687 dnl ========================================================
7688 MOZ_ARG_ENABLE_BOOL(timeline,
7689 [ --enable-timeline Enable timeline services ],
7692 if test -n "$MOZ_TIMELINE"; then
7693 AC_DEFINE(MOZ_TIMELINE)
7696 dnl ========================================================
7697 dnl = Enable NS_FUNCTION_TIMER, which provides Function
7698 dnl = timing for identifying code bottlenecks
7699 dnl = NS_FUNCTION_TIMER is off by default.
7700 dnl ========================================================
7701 MOZ_ARG_ENABLE_BOOL(functiontimer,
7702 [ --enable-functiontimer Enable NS_FUNCTION_TIMER ],
7703 NS_FUNCTION_TIMER=1,
7704 NS_FUNCTION_TIMER= )
7705 if test -n "$NS_FUNCTION_TIMER"; then
7706 AC_DEFINE(NS_FUNCTION_TIMER)
7709 dnl ========================================================
7710 dnl Turn on reflow counting
7711 dnl ========================================================
7712 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7713 [ --enable-reflow-perf Enable reflow performance tracing],
7716 if test -n "$MOZ_REFLOW_PERF"; then
7717 AC_DEFINE(MOZ_REFLOW_PERF)
7720 dnl ========================================================
7721 dnl Enable code size metrics.
7722 dnl ========================================================
7723 MOZ_ARG_ENABLE_BOOL(codesighs,
7724 [ --enable-codesighs Enable code size analysis tools],
7725 _ENABLE_CODESIGHS=1,
7726 _ENABLE_CODESIGHS= )
7727 if test -n "$_ENABLE_CODESIGHS"; then
7728 if test -d $srcdir/tools/codesighs; then
7731 AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7735 dnl ========================================================
7736 dnl = Support for Quantify (Windows)
7737 dnl ========================================================
7738 MOZ_ARG_ENABLE_BOOL(quantify,
7739 [ --enable-quantify Enable Quantify support (Windows only) ],
7743 dnl ========================================================
7744 dnl = Support for demangling undefined symbols
7745 dnl ========================================================
7746 if test -z "$SKIP_LIBRARY_CHECKS"; then
7749 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7753 # Demangle only for debug or trace-malloc builds
7754 MOZ_DEMANGLE_SYMBOLS=
7755 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7756 MOZ_DEMANGLE_SYMBOLS=1
7757 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7759 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7761 dnl ========================================================
7762 dnl = Support for gcc stack unwinding (from gcc 3.3)
7763 dnl ========================================================
7764 if test "$HAVE_GCC3_ABI" -a -z "$SKIP_LIBRARY_CHECKS"; then
7765 AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7768 dnl ========================================================
7772 dnl ========================================================
7773 MOZ_ARG_HEADER(Misc. Options)
7775 dnl ========================================================
7776 dnl update xterm title
7777 dnl ========================================================
7778 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7779 [ --enable-xterm-updates Update XTERM titles with current command.],
7783 dnl =========================================================
7785 dnl =========================================================
7786 MOZ_ARG_ENABLE_STRING([chrome-format],
7787 [ --enable-chrome-format=jar|flat|both|symlink|omni
7788 Select FORMAT of chrome files (default=jar)],
7789 MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7791 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7792 MOZ_CHROME_FILE_FORMAT=jar
7795 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7796 test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7797 test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7798 test "$MOZ_CHROME_FILE_FORMAT" != "both" &&
7799 test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7800 AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, symlink, or omni])
7803 dnl =========================================================
7804 dnl Omnijar packaging (bug 552121)
7805 dnl =========================================================
7806 dnl Omnijar packaging is compatible with flat packaging.
7807 dnl In unpackaged builds, omnijar looks for files as if
7808 dnl things were flat packaged. After packaging, all files
7809 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7810 dnl is set to flat since putting files into jars is only
7811 dnl done during packaging with omnijar.
7812 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7814 AC_DEFINE(MOZ_OMNIJAR)
7815 MOZ_CHROME_FILE_FORMAT=flat
7816 elif test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7817 AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7820 AC_SUBST(MOZ_OMNIJAR)
7822 dnl ========================================================
7823 dnl = Define default location for MOZILLA_FIVE_HOME
7824 dnl ========================================================
7825 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7826 [ --with-default-mozilla-five-home
7827 Set the default value for MOZILLA_FIVE_HOME],
7828 [ val=`echo $withval`
7829 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7831 dnl ========================================================
7832 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7833 dnl ========================================================
7834 MOZ_ARG_WITH_STRING(user-appdir,
7835 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
7836 [ val=`echo $withval`
7837 if echo "$val" | grep "\/" >/dev/null; then
7838 AC_MSG_ERROR("Homedir must be single relative path.")
7843 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7845 dnl ========================================================
7846 dnl = Doxygen configuration
7847 dnl ========================================================
7848 dnl Use commas to specify multiple dirs to this arg
7849 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7850 MOZ_ARG_WITH_STRING(doc-input-dirs,
7851 [ --with-doc-input-dirs=DIRS
7852 Header/idl dirs to create docs from],
7853 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7854 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7856 dnl Use commas to specify multiple dirs to this arg
7857 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7858 MOZ_ARG_WITH_STRING(doc-include-dirs,
7859 [ --with-doc-include-dirs=DIRS
7860 Include dirs to preprocess doc headers],
7861 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7862 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7864 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7865 MOZ_ARG_WITH_STRING(doc-output-dir,
7866 [ --with-doc-output-dir=DIR
7867 Dir to generate docs into],
7868 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7869 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7871 if test -z "$SKIP_COMPILER_CHECKS"; then
7872 dnl ========================================================
7874 dnl = Compiler Options
7876 dnl ========================================================
7877 MOZ_ARG_HEADER(Compiler Options)
7879 dnl ========================================================
7880 dnl Check for gcc -pipe support
7881 dnl ========================================================
7882 AC_MSG_CHECKING([for gcc -pipe support])
7883 if test -n "$GNU_CC" -a -n "$GNU_CXX" -a -n "$GNU_AS"; then
7884 echo '#include <stdio.h>' > dummy-hello.c
7885 echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
7886 ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
7887 cat dummy-hello.s 2> /dev/null | ${AS_BIN} -o dummy-hello.S - 2>&5
7888 if test $? = 0; then
7893 if test "$_res_as_stdin" = "yes"; then
7894 _SAVE_CFLAGS=$CFLAGS
7895 CFLAGS="$CFLAGS -pipe"
7896 AC_TRY_COMPILE( [ #include <stdio.h> ],
7897 [printf("Hello World\n");],
7898 [_res_gcc_pipe="yes"],
7899 [_res_gcc_pipe="no"] )
7900 CFLAGS=$_SAVE_CFLAGS
7902 if test "$_res_as_stdin" = "yes" -a "$_res_gcc_pipe" = "yes"; then
7904 CFLAGS="$CFLAGS -pipe"
7905 CXXFLAGS="$CXXFLAGS -pipe"
7909 rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
7910 AC_MSG_RESULT([$_res])
7915 dnl ========================================================
7916 dnl Profile guided optimization
7917 dnl ========================================================
7918 dnl Test for profiling options
7919 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7921 dnl Provide a switch to disable PGO even when called via profiledbuild.
7922 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
7923 [ --disable-profile-guided-optimization
7924 Don't build with PGO even if called via make profiledbuild],
7925 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
7926 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
7928 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
7930 _SAVE_CFLAGS="$CFLAGS"
7931 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7933 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7934 AC_TRY_COMPILE([], [return 0;],
7935 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7936 result="yes" ], result="no")
7937 AC_MSG_RESULT([$result])
7939 if test $result = "yes"; then
7940 PROFILE_GEN_LDFLAGS="-fprofile-generate"
7941 PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch -freorder-blocks-and-partition"
7942 PROFILE_USE_LDFLAGS="-fprofile-use"
7945 CFLAGS="$_SAVE_CFLAGS"
7947 if test -n "$INTEL_CC"; then
7948 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7949 PROFILE_GEN_LDFLAGS=
7950 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7951 PROFILE_USE_LDFLAGS=
7954 dnl Sun Studio on Solaris
7955 if test "$SOLARIS_SUNPRO_CC"; then
7956 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7957 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7958 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7959 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7962 AC_SUBST(PROFILE_GEN_CFLAGS)
7963 AC_SUBST(PROFILE_GEN_LDFLAGS)
7964 AC_SUBST(PROFILE_USE_CFLAGS)
7965 AC_SUBST(PROFILE_USE_LDFLAGS)
7969 dnl ========================================================
7970 dnl Test for -pedantic bustage
7971 dnl ========================================================
7972 MOZ_ARG_DISABLE_BOOL(pedantic,
7973 [ --disable-pedantic Issue all warnings demanded by strict ANSI C ],
7975 if test "$_PEDANTIC"; then
7976 _SAVE_CXXFLAGS=$CXXFLAGS
7977 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
7978 AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7979 AC_TRY_COMPILE([$configure_static_assert_macros],
7980 [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7981 result="no", result="yes" )
7982 AC_MSG_RESULT([$result])
7983 CXXFLAGS="$_SAVE_CXXFLAGS"
7987 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
7988 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
7991 AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic. Reconfigure using --disable-pedantic. ])
7996 dnl ========================================================
7997 dnl Test for correct temporary object destruction order
7998 dnl ========================================================
7999 dnl We want to make sure the compiler follows the C++ spec here as
8000 dnl xpcom and the string classes depend on it (bug 235381).
8001 AC_MSG_CHECKING([for correct temporary object destruction order])
8002 AC_TRY_RUN([ class A {
8003 public: A(int& x) : mValue(x) {}
8005 operator char**() { return 0; }
8006 private: int& mValue;
8008 void func(char **arg) {}
8019 result="yes", result="no", result="maybe")
8020 AC_MSG_RESULT([$result])
8022 if test "$result" = "no"; then
8023 AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
8026 dnl ========================================================
8027 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
8028 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
8029 dnl raw pointers in nsCOMPtr.h. (VC++ has the same bug.)
8030 dnl ========================================================
8031 _SAVE_CXXFLAGS=$CXXFLAGS
8032 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
8033 AC_CACHE_CHECK(for correct overload resolution with const and templates,
8034 ac_nscap_nonconst_opeq_bug,
8043 template <class T, class U>
8044 int operator==(const Pointer<T>& rhs, U* lhs)
8046 return rhs.myPtr == lhs;
8049 template <class T, class U>
8050 int operator==(const Pointer<T>& rhs, const U* lhs)
8052 return rhs.myPtr == lhs;
8060 ac_nscap_nonconst_opeq_bug="no",
8061 ac_nscap_nonconst_opeq_bug="yes")])
8062 CXXFLAGS="$_SAVE_CXXFLAGS"
8064 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
8065 AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
8067 fi # SKIP_COMPILER_CHECKS
8069 dnl ========================================================
8071 dnl Should be smarter and check that the compiler does indeed have rtti
8072 dnl ========================================================
8074 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
8075 [ --enable-cpp-rtti Enable C++ RTTI ],
8076 [ _MOZ_USE_RTTI=1 ],
8079 if test "$_MOZ_USE_RTTI"; then
8080 _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
8082 _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
8085 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
8087 dnl ========================================================
8088 dnl C++ exceptions (g++/VC/irix6/Sun only - for now)
8089 dnl Should be smarter and check that the compiler does indeed have exceptions
8090 dnl ========================================================
8091 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
8092 [ --enable-cpp-exceptions Enable C++ exceptions ],
8093 [ _MOZ_CPP_EXCEPTIONS=1 ],
8094 [ _MOZ_CPP_EXCEPTIONS= ])
8096 if test "$_MOZ_CPP_EXCEPTIONS"; then
8097 _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
8098 AC_DEFINE(MOZ_CPP_EXCEPTIONS)
8100 _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
8103 AC_SUBST(_MOZ_EXCEPTIONS_FLAGS_ON)
8105 # Irix & OSF native compilers do not like exception declarations
8106 # when exceptions are disabled
8107 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
8108 AC_DEFINE(CPP_THROW_NEW, [])
8110 AC_DEFINE(CPP_THROW_NEW, [throw()])
8114 dnl ========================================================
8116 dnl = Build depencency options
8118 dnl ========================================================
8119 MOZ_ARG_HEADER(Build dependencies)
8121 dnl ========================================================
8122 dnl = Do not auto generate dependency info
8123 dnl ========================================================
8125 MOZ_ARG_DISABLE_BOOL(auto-deps,
8126 [ --disable-auto-deps Do not automatically generate dependency info],
8130 if test -n "$MOZ_AUTO_DEPS"; then
8131 dnl ========================================================
8132 dnl = Use mkdepend instead of $CC -MD for dependency generation
8133 dnl ========================================================
8135 MOZ_ARG_DISABLE_BOOL(md,
8136 [ --disable-md Do not use compiler-based dependencies ],
8139 [dnl Default is to turn on -MD if using GNU-compatible compilers
8140 if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
8143 dnl Default is to use -xM if using Sun Studio on Solaris
8144 if test "$SOLARIS_SUNPRO_CC"; then
8147 if test "$_cpp_md_flag"; then
8149 if test "$OS_ARCH" = "OpenVMS"; then
8150 _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
8152 _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(basename $(@F)).pp)'
8154 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
8155 if test "$SOLARIS_SUNPRO_CC"; then
8160 dnl Don't override this for MSVC
8161 if test -z "$_WIN32_MSVC"; then
8162 _USE_CPP_INCLUDE_FLAG=
8163 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
8164 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
8166 echo '#include <stdio.h>' > dummy-hello.c
8168 CL_INCLUDES_PREFIX=`"${CC}" -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
8170 if test -z "$CL_INCLUDES_PREFIX"; then
8171 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
8173 AC_SUBST(CL_INCLUDES_PREFIX)
8175 _topsrcdirwin=`cd \`dirname $0\`; pwd -W`
8176 dnl cl.py provides dependency generation for MSVC
8177 CC_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"
8178 CXX_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"
8184 AC_SUBST(MOZ_AUTO_DEPS)
8185 AC_SUBST(COMPILER_DEPEND)
8187 AC_SUBST(CC_WRAPPER)
8188 AC_SUBST(CXX_WRAPPER)
8191 dnl ========================================================
8193 dnl = Static Build Options
8195 dnl ========================================================
8196 MOZ_ARG_HEADER(Static build options)
8198 MOZ_ARG_ENABLE_BOOL(static,
8199 [ --enable-static Enable building of internal static libs],
8200 BUILD_STATIC_LIBS=1,
8203 MOZ_ARG_ENABLE_BOOL(libxul,
8204 [ --enable-libxul Enable building of libxul],
8205 MOZ_ENABLE_LIBXUL=1,
8208 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
8209 if test "$OS_ARCH" = "WINNT"; then
8213 MOZ_ARG_ENABLE_BOOL(shared-js,
8214 [ --enable-shared-js
8215 Create a shared JavaScript library.],
8219 if test -z "$MOZ_ENABLE_LIBXUL"; then
8220 dnl --disable-libxul implies shared js
8224 if test -n "$ENABLE_SHARED_JS"; then
8226 MOZ_JS_LIBS=$MOZ_JS_SHARED_LIBS
8228 MOZ_JS_LIBS=$MOZ_JS_STATIC_LIBS
8229 AC_DEFINE(MOZ_STATIC_JS)
8231 AC_SUBST(JS_SHARED_LIBRARY)
8233 if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
8234 AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME. You probably want --enable-libxul.])
8237 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
8238 AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
8241 if test -n "$MOZ_IPC" -a -z "$MOZ_ENABLE_LIBXUL"; then
8242 AC_MSG_ERROR([--enable-ipc requires --enable-libxul])
8245 if test -z "$MOZ_ENABLE_LIBXUL" -a -n "$MOZ_OMNIJAR"; then
8246 AC_MSG_ERROR([Omnijar packaging is incompatible with --disable-libxul. Please either --enable-libxul or --enable-chrome-format=jar|flat|symlink]);
8249 AC_SUBST(LIBXUL_LIBS)
8251 if test -n "$MOZ_ENABLE_LIBXUL"; then
8252 XPCOM_LIBS="$LIBXUL_LIBS"
8253 AC_DEFINE(MOZ_ENABLE_LIBXUL)
8255 if test -n "$BUILD_STATIC_LIBS"; then
8256 AC_DEFINE(MOZ_STATIC_BUILD)
8258 XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
8261 dnl ========================================================
8263 dnl = Standalone module options
8265 dnl ========================================================
8266 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
8268 dnl Check for GLib and libIDL.
8269 dnl ========================================================
8272 if test -z "$COMPILE_ENVIRONMENT"; then
8273 SKIP_IDL_CHECK="yes"
8276 dnl = Allow users to disable libIDL checking for standalone modules
8277 MOZ_ARG_WITHOUT_BOOL(libIDL,
8278 [ --without-libIDL Skip check for libIDL (standalone modules only)],
8279 SKIP_IDL_CHECK="yes")
8281 if test -z "$CROSS_COMPILE"; then
8282 if test -z "$HOST_LIBIDL_CONFIG"; then
8283 HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
8285 if test -z "$HOST_LIBIDL_PREFIX"; then
8286 HOST_LIBIDL_PREFIX="$LIBIDL_PREFIX"
8290 if test "$SKIP_IDL_CHECK" = "no"
8294 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
8295 if test -n "$GLIB_PREFIX"; then
8296 _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd -W`
8297 if test "$?" = "0"; then
8298 if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
8299 AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
8301 _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
8303 AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
8306 _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
8308 if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
8309 AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
8311 GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
8312 if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
8313 GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
8314 elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
8315 GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
8317 AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
8320 if test -n "$HOST_LIBIDL_PREFIX"; then
8321 _LIBIDL_PREFIX_DIR=`cd $HOST_LIBIDL_PREFIX && pwd -W`
8322 if test "$?" = "0"; then
8323 if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
8324 AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
8326 _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
8328 AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
8331 _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
8333 if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
8334 AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
8336 HOST_LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
8337 if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
8338 HOST_LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
8340 elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
8341 HOST_LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
8343 AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
8345 HOST_LIBIDL_LIBS="${HOST_LIBIDL_LIBS} ${GLIB_LIBS}"
8350 if test -z "$_LIBIDL_FOUND"; then
8351 if test "$MACOS_SDK_DIR"; then
8352 dnl xpidl, and therefore libIDL, is only needed on the build host.
8353 dnl Don't build it against the SDK, as that causes problems.
8354 _MACSAVE_CFLAGS="$CFLAGS"
8355 _MACSAVE_LIBS="$LIBS"
8356 _MACSAVE_LDFLAGS="$LDFLAGS"
8357 _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
8359 CFLAGS=`echo $CFLAGS|sed -E -e "s%((-I|-isystem )${MACOS_SDK_DIR}/usr/(include|lib/gcc)[^ ]*)|-F${MACOS_SDK_DIR}(/System)?/Library/Frameworks[^ ]*|-nostdinc[^ ]*|-isysroot ${MACOS_SDK_DIR}%%g"`
8360 LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
8361 LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
8366 PKG_CHECK_MODULES(HOST_LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
8369 dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
8370 dnl to either libIDL1 or libIDL2.
8371 if test -z "$_LIBIDL_FOUND"; then
8372 AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
8373 if test -z "$_LIBIDL_FOUND"; then
8374 PKG_CHECK_MODULES(HOST_LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
8378 dnl If we don't have a libIDL config program & not cross-compiling,
8379 dnl look for orbit-config instead.
8381 if test -z "$_LIBIDL_FOUND" -a -z "$CROSS_COMPILE"; then
8382 MOZ_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
8383 if test -n "$ORBIT_CONFIG"; then
8384 AC_MSG_CHECKING([for ORBit libIDL usability])
8385 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
8386 _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
8387 _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
8388 _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
8389 HOST_LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
8390 HOST_LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
8392 _SAVE_CFLAGS="$CFLAGS"
8394 CFLAGS="$HOST_LIBIDL_CFLAGS $CFLAGS"
8395 LIBS="$HOST_LIBIDL_LIBS $LIBS"
8398 #include <libIDL/IDL.h>
8401 s=strdup(IDL_get_libver_string());
8409 [HOST_LIBIDL_CFLAGS=
8414 AC_MSG_RESULT($result)
8415 CFLAGS="$_SAVE_CFLAGS"
8419 if test -z "$_LIBIDL_FOUND"; then
8420 AC_MSG_ERROR([libIDL not found.
8421 libIDL $LIBIDL_VERSION or higher is required.])
8423 if test "$MACOS_SDK_DIR"; then
8424 CFLAGS="$_MACSAVE_CFLAGS"
8425 LIBS="$_MACSAVE_LIBS"
8426 LDFLAGS="$_MACSAVE_LDFLAGS"
8427 if test -n "$_MACSAVE_NEXT_ROOT" ; then
8428 export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
8433 if test -n "$CROSS_COMPILE"; then
8435 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
8436 if test -n "$GLIB_PREFIX"; then
8437 GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
8438 if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
8439 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
8440 elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
8441 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
8443 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
8447 if test -n "$LIBIDL_PREFIX"; then
8448 LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
8449 if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
8450 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
8452 elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
8453 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
8455 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
8458 LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
8461 if test -n "LIBIDL_CONFIG" -a "LIBIDL_CONFIG" != "no"; then
8462 LIBIDL_CFLAGS=`${LIBIDL_CONFIG} --cflags`
8463 LIBIDL_LIBS=`${LIBIDL_CONFIG} --libs`
8468 LIBIDL_CFLAGS="$HOST_LIBIDL_CFLAGS"
8469 LIBIDL_LIBS="$HOST_LIBIDL_LIBS"
8472 if test -z "$SKIP_PATH_CHECKS"; then
8473 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
8474 if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
8475 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
8477 AM_PATH_GLIB(${GLIB_VERSION})
8482 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
8483 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
8486 AC_SUBST(LIBIDL_CFLAGS)
8487 AC_SUBST(LIBIDL_LIBS)
8488 AC_SUBST(STATIC_LIBIDL)
8489 AC_SUBST(GLIB_CFLAGS)
8491 AC_SUBST(GLIB_GMODULE_LIBS)
8492 AC_SUBST(HOST_LIBIDL_CONFIG)
8493 AC_SUBST(HOST_LIBIDL_CFLAGS)
8494 AC_SUBST(HOST_LIBIDL_LIBS)
8496 dnl ========================================================
8498 dnl ========================================================
8499 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8502 MOZ_ARG_ENABLE_BOOL(system-cairo,
8503 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
8508 MOZ_ARG_ENABLE_BOOL(system-pixman,
8509 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
8513 # Check for headers defining standard int types.
8514 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8516 if test "$MOZ_TREE_CAIRO"; then
8517 AC_DEFINE(MOZ_TREE_CAIRO)
8519 # For now we assume that we will have a uint64_t available through
8520 # one of the above headers or mozstdint.h.
8521 AC_DEFINE(HAVE_UINT64_T)
8523 # Define macros for cairo-features.h
8524 if test "$MOZ_X11"; then
8525 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8526 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8527 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8528 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8529 MOZ_ENABLE_CAIRO_FT=1
8530 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8532 if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
8533 QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8535 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
8536 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8537 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8538 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8540 if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
8541 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8542 if test -z "$WINCE"; then
8543 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8544 if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8545 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8546 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8547 MOZ_ENABLE_D2D_SURFACE=1
8548 MOZ_ENABLE_DWRITE_FONT=1
8550 WIN32_DWRITE_FONT_FEATURE=
8551 WIN32_D2D_SURFACE_FEATURE=
8555 WIN32_DWRITE_FONT_FEATURE=
8556 WIN32_D2D_SURFACE_FEATURE=
8559 AC_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8561 dnl D3D10 Layers depend on D2D Surfaces.
8562 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
8563 AC_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
8567 if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
8568 OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
8569 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8570 MOZ_ENABLE_CAIRO_FT=1
8571 CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8572 CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
8574 if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
8575 PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
8576 BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
8577 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8578 MOZ_ENABLE_CAIRO_FT=1
8580 if test "$USE_FC_FREETYPE"; then
8581 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8583 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8584 AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8585 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8586 AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8587 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8588 AC_SUBST(CAIRO_FT_CFLAGS)
8591 if test "$MOZ_DEBUG"; then
8592 SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
8594 SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
8597 PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
8599 AC_SUBST(PS_SURFACE_FEATURE)
8600 AC_SUBST(PDF_SURFACE_FEATURE)
8601 AC_SUBST(SVG_SURFACE_FEATURE)
8602 AC_SUBST(XLIB_SURFACE_FEATURE)
8603 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8604 AC_SUBST(QUARTZ_SURFACE_FEATURE)
8605 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8606 AC_SUBST(XCB_SURFACE_FEATURE)
8607 AC_SUBST(WIN32_SURFACE_FEATURE)
8608 AC_SUBST(OS2_SURFACE_FEATURE)
8609 AC_SUBST(BEOS_SURFACE_FEATURE)
8610 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8611 AC_SUBST(FT_FONT_FEATURE)
8612 AC_SUBST(FC_FONT_FEATURE)
8613 AC_SUBST(WIN32_FONT_FEATURE)
8614 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8615 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8616 AC_SUBST(QUARTZ_FONT_FEATURE)
8617 AC_SUBST(PNG_FUNCTIONS_FEATURE)
8618 AC_SUBST(QT_SURFACE_FEATURE)
8620 MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
8622 if test "$MOZ_TREE_PIXMAN"; then
8623 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS"' $(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
8625 PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
8626 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $PIXMAN_CFLAGS"
8627 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $PIXMAN_LIBS"
8630 if test "$MOZ_X11"; then
8631 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
8634 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8635 mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
8638 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION pixman-1 freetype2 fontconfig)
8639 MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
8640 MOZ_CAIRO_LIBS=$CAIRO_LIBS
8641 if test "$MOZ_X11"; then
8642 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8643 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8644 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8648 AC_SUBST(MOZ_TREE_CAIRO)
8649 AC_SUBST(MOZ_CAIRO_CFLAGS)
8650 AC_SUBST(MOZ_CAIRO_LIBS)
8651 AC_SUBST(MOZ_TREE_PIXMAN)
8653 dnl ========================================================
8655 dnl ========================================================
8657 QCMS_LIBS='$(call EXPAND_LIBNAME_PATH,mozqcms,$(DEPTH)/gfx/qcms)'
8660 dnl ========================================================
8662 dnl ========================================================
8663 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8664 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8666 dnl ========================================================
8668 dnl ========================================================
8669 MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)'
8670 AC_SUBST(MOZ_OTS_LIBS)
8672 dnl ========================================================
8674 dnl ========================================================
8675 MOZ_ARG_DISABLE_BOOL(xul,
8676 [ --disable-xul Disable XUL],
8678 if test "$MOZ_XUL"; then
8681 dnl remove extensions that require XUL
8682 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8687 dnl ========================================================
8688 dnl disable profile locking
8689 dnl do no use this in applications that can have more than
8690 dnl one process accessing the profile directory.
8691 dnl ========================================================
8692 MOZ_ARG_DISABLE_BOOL(profilelocking,
8693 [ --disable-profilelocking
8694 Disable profile locking],
8695 MOZ_PROFILELOCKING=,
8696 MOZ_PROFILELOCKING=1 )
8697 if test "$MOZ_PROFILELOCKING"; then
8698 AC_DEFINE(MOZ_PROFILELOCKING)
8701 dnl ========================================================
8702 dnl disable rdf services
8703 dnl ========================================================
8704 MOZ_ARG_DISABLE_BOOL(rdf,
8705 [ --disable-rdf Disable RDF],
8707 if test "$MOZ_RDF"; then
8713 dnl ========================================================
8714 dnl necko configuration options
8715 dnl ========================================================
8718 dnl option to disable various necko protocols
8720 MOZ_ARG_ENABLE_STRING(necko-protocols,
8721 [ --enable-necko-protocols[={http,ftp,default,all,none}]
8722 Enable/disable specific protocol handlers],
8723 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8724 if test "$option" = "yes" -o "$option" = "all"; then
8725 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8726 elif test "$option" = "no" -o "$option" = "none"; then
8728 elif test "$option" = "default"; then
8729 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8730 elif test `echo "$option" | grep -c \^-` != 0; then
8731 option=`echo $option | sed 's/^-//'`
8732 NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8734 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8737 NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8739 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8740 AC_SUBST(NECKO_PROTOCOLS)
8741 for p in $NECKO_PROTOCOLS; do
8742 AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8746 dnl option to disable necko's disk cache
8748 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
8749 [ --disable-necko-disk-cache
8750 Disable necko disk cache],
8753 AC_SUBST(NECKO_DISK_CACHE)
8754 if test "$NECKO_DISK_CACHE"; then
8755 AC_DEFINE(NECKO_DISK_CACHE)
8759 dnl option to disable necko's wifi scanner
8761 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8762 [ --disable-necko-wifi Disable necko wifi scanner],
8766 if test "$OS_ARCH" = "OS2"; then
8767 dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8770 if test "$NECKO_WIFI" -a \
8771 "$OS_ARCH" != "Linux" -a \
8772 "$OS_ARCH" != "Darwin" -a \
8773 "$OS_ARCH" != "SunOS" -a \
8774 "$OS_ARCH" != "WINNT" -a \
8775 "$OS_ARCH" != "WINCE"; then
8776 AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8779 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
8781 AC_CHECK_HEADER([iwlib.h])
8782 if test "$ac_cv_header_iwlib_h" != "yes"; then
8783 AC_MSG_ERROR([Can't find header iwlib.h for Necko WiFi scanning (might be in package libiw-dev (Ubuntu) or wireless-tools-devel (Fedora)); use --disable-necko-wifi to disable])
8787 if test "$NECKO_WIFI"; then
8788 AC_DEFINE(NECKO_WIFI)
8790 AC_SUBST(NECKO_WIFI)
8793 dnl option to disable cookies
8795 MOZ_ARG_DISABLE_BOOL(cookies,
8796 [ --disable-cookies Disable cookie support],
8799 AC_SUBST(NECKO_COOKIES)
8800 if test "$NECKO_COOKIES"; then
8801 AC_DEFINE(NECKO_COOKIES)
8805 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8807 MOZ_ARG_DISABLE_BOOL(ctypes,
8808 [ --disable-ctypes Disable js-ctypes],
8811 AC_SUBST(BUILD_CTYPES)
8812 if test "$BUILD_CTYPES"; then
8813 if test "$OS_ARCH" = "WINCE" -a `echo $OS_TEST | grep -ic arm` = 1; then
8814 # Disable ctypes for arm/wince.
8817 AC_DEFINE(BUILD_CTYPES)
8821 dnl NECKO_ configuration options are not global
8822 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
8824 dnl Only build Mork if it's required
8826 if test "$MOZ_MORK"; then
8830 dnl Build the lightweight Mork reader if required
8831 AC_SUBST(MOZ_MORKREADER)
8832 if test "$MOZ_MORKREADER"; then
8833 AC_DEFINE(MOZ_MORKREADER)
8836 dnl Build Places if required
8837 if test "$MOZ_PLACES"; then
8838 AC_DEFINE(MOZ_PLACES)
8841 dnl Build Sync Services if required
8842 AC_SUBST(MOZ_SERVICES_SYNC)
8843 if test -n "$MOZ_SERVICES_SYNC"; then
8844 AC_DEFINE(MOZ_SERVICES_SYNC)
8847 dnl ========================================================
8848 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
8849 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8852 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8853 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8856 dnl ========================================================
8858 dnl = Maintainer debug option (no --enable equivalent)
8860 dnl ========================================================
8865 AC_SUBST(AR_EXTRACT)
8869 AC_SUBST(AS_DASH_C_FLAG)
8877 AC_SUBST(NS_USE_NATIVE)
8878 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8879 AC_SUBST(MOZ_UPDATE_XTERM)
8881 AC_SUBST(MOZ_PLATFORM_MAEMO)
8882 AC_SUBST(MOZ_AUTH_EXTENSION)
8883 AC_SUBST(MOZ_MATHML)
8884 AC_SUBST(MOZ_PERMISSIONS)
8886 AC_SUBST(MOZ_PREF_EXTENSIONS)
8889 AC_SUBST(MOZ_XSLT_STANDALONE)
8890 AC_SUBST(MOZ_JS_LIBS)
8893 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8894 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8895 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8896 AC_SUBST(MOZ_DEBUG_FLAGS)
8897 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8898 AC_SUBST(WARNINGS_AS_ERRORS)
8899 AC_SUBST(MOZ_EXTENSIONS)
8900 AC_SUBST(MOZ_JSDEBUGGER)
8901 AC_SUBST(MOZ_PLUGINS)
8902 AC_SUBST(MOZ_LOG_REFCNT)
8906 AC_SUBST(MOZ_CALLGRIND)
8908 AC_SUBST(MOZ_PROFILING)
8909 AC_SUBST(MOZ_JSLOADER)
8910 AC_SUBST(MOZ_USE_NATIVE_UCONV)
8911 AC_SUBST(MOZ_QUANTIFY)
8913 AC_SUBST(MOZ_PLACES)
8914 AC_SUBST(MOZ_PLACES_BOOKMARKS)
8915 AC_SUBST(MOZ_STORAGE)
8916 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8918 AC_SUBST(NS_PRINTING)
8920 AC_SUBST(MOZ_HELP_VIEWER)
8922 AC_SUBST(MOZ_JAVAXPCOM)
8923 AC_SUBST(JAVA_INCLUDE_PATH)
8928 AC_SUBST(MOZ_PROFILELOCKING)
8931 AC_SUBST(MOZ_XIE_LIBS)
8933 AC_SUBST(BUILD_STATIC_LIBS)
8934 AC_SUBST(MOZ_ENABLE_LIBXUL)
8935 AC_SUBST(ENABLE_TESTS)
8937 AC_SUBST(MOZ_UNIVERSALCHARDET)
8938 AC_SUBST(ACCESSIBILITY)
8939 AC_SUBST(MOZ_VIEW_SOURCE)
8940 AC_SUBST(MOZ_SPELLCHECK)
8941 AC_SUBST(MOZ_USER_DIR)
8942 AC_SUBST(MOZ_CRASHREPORTER)
8943 AC_SUBST(MOZ_UPDATER)
8945 AC_SUBST(ENABLE_STRIP)
8946 AC_SUBST(PKG_SKIP_STRIP)
8947 AC_SUBST(USE_ELF_DYNSTR_GC)
8948 AC_SUBST(INCREMENTAL_LINKER)
8949 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8950 AC_SUBST(MOZ_JEMALLOC_STANDALONE_GLUE_LDOPTS)
8951 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8953 AC_SUBST(MOZ_FIX_LINK_PATHS)
8954 AC_SUBST(XPCOM_LIBS)
8955 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8956 AC_SUBST(XPCOM_GLUE_LDOPTS)
8957 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8959 AC_SUBST(USE_DEPENDENT_LIBS)
8961 AC_SUBST(MOZ_BUILD_ROOT)
8962 AC_SUBST(MOZ_OS2_TOOLS)
8964 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8965 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8966 AC_SUBST(MOZ_TIMELINE)
8967 AC_SUBST(OGLES_SDK_DIR)
8969 AC_SUBST(MOZ_APP_NAME)
8970 AC_SUBST(MOZ_APP_DISPLAYNAME)
8971 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8972 AC_SUBST(MOZ_APP_UA_NAME)
8973 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8974 AC_SUBST(MOZ_APP_VERSION)
8975 AC_DEFINE_UNQUOTED(MOZ_UA_FIREFOX_VERSION, "$FIREFOX_VERSION")
8976 AC_SUBST(MOZ_UA_FIREFOX_VERSION)
8977 AC_SUBST(FIREFOX_VERSION)
8978 AC_DEFINE_UNQUOTED(MOZ_UA_BUILDID, "$MOZ_UA_BUILDID")
8979 AC_SUBST(MOZ_UA_BUILDID)
8981 AC_SUBST(MOZ_PKG_SPECIAL)
8983 AC_SUBST(MOZILLA_OFFICIAL)
8986 AC_SUBST(MOZ_MAPINFO)
8987 AC_SUBST(MOZ_BROWSE_INFO)
8988 AC_SUBST(MOZ_TOOLS_DIR)
8989 AC_SUBST(CYGWIN_WRAPPER)
8991 AC_SUBST(WIN32_REDIST_DIR)
8996 AC_SUBST(WINCE_SDK_DIR)
8997 AC_SUBST(WINCE_WINDOWS_MOBILE)
8999 dnl Echo the CFLAGS to remove extra whitespace.
9006 $_MOZ_EXCEPTIONS_FLAGS \
9007 $_WARNINGS_CXXFLAGS \
9010 COMPILE_CFLAGS=`echo \
9015 COMPILE_CXXFLAGS=`echo \
9016 $_DEFINES_CXXFLAGS \
9020 AC_SUBST(SYSTEM_MAKEDEPEND)
9021 AC_SUBST(SYSTEM_LIBXUL)
9022 AC_SUBST(SYSTEM_JPEG)
9023 AC_SUBST(SYSTEM_PNG)
9024 AC_SUBST(SYSTEM_ZLIB)
9025 AC_SUBST(SYSTEM_BZ2)
9027 AC_SUBST(JPEG_CFLAGS)
9029 AC_SUBST(ZLIB_CFLAGS)
9031 AC_SUBST(BZ2_CFLAGS)
9033 AC_SUBST(PNG_CFLAGS)
9036 AC_SUBST(MOZ_JPEG_CFLAGS)
9037 AC_SUBST(MOZ_JPEG_LIBS)
9038 AC_SUBST(MOZ_ZLIB_CFLAGS)
9039 AC_SUBST(MOZ_ZLIB_LIBS)
9040 AC_SUBST(MOZ_BZ2_CFLAGS)
9041 AC_SUBST(MOZ_BZ2_LIBS)
9042 AC_SUBST(MOZ_PNG_CFLAGS)
9043 AC_SUBST(MOZ_PNG_LIBS)
9045 AC_SUBST(NSPR_CFLAGS)
9047 AC_SUBST(MOZ_NATIVE_NSPR)
9049 AC_SUBST(NSS_CFLAGS)
9051 AC_SUBST(NSS_DEP_LIBS)
9052 AC_SUBST(MOZ_NATIVE_NSS)
9053 AC_SUBST(NSS_DISABLE_DBM)
9058 AC_SUBST(COMPILE_CFLAGS)
9059 AC_SUBST(COMPILE_CXXFLAGS)
9062 AC_SUBST(CROSS_COMPILE)
9063 AC_SUBST(WCHAR_CFLAGS)
9067 AC_SUBST(HOST_CFLAGS)
9068 AC_SUBST(HOST_CXXFLAGS)
9069 AC_SUBST(HOST_OPTIMIZE_FLAGS)
9071 AC_SUBST(HOST_AR_FLAGS)
9073 AC_SUBST(HOST_RANLIB)
9074 AC_SUBST(HOST_NSPR_MDCPUCFG)
9075 AC_SUBST(HOST_BIN_SUFFIX)
9076 AC_SUBST(HOST_OS_ARCH)
9078 AC_SUBST(TARGET_CPU)
9079 AC_SUBST(TARGET_VENDOR)
9081 AC_SUBST(TARGET_NSPR_MDCPUCFG)
9082 AC_SUBST(TARGET_MD_ARCH)
9083 AC_SUBST(TARGET_XPCOM_ABI)
9086 AC_SUBST(OS_RELEASE)
9089 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
9090 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
9092 AC_SUBST(WRAP_MALLOC_CFLAGS)
9093 AC_SUBST(WRAP_MALLOC_LIB)
9096 AC_SUBST(MKSHLIB_FORCE_ALL)
9097 AC_SUBST(MKSHLIB_UNFORCE_ALL)
9098 AC_SUBST(DSO_CFLAGS)
9099 AC_SUBST(DSO_PIC_CFLAGS)
9100 AC_SUBST(DSO_LDOPTS)
9101 AC_SUBST(LIB_PREFIX)
9102 AC_SUBST(DLL_PREFIX)
9103 AC_SUBST(DLL_SUFFIX)
9104 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
9105 AC_SUBST(LIB_SUFFIX)
9106 AC_SUBST(OBJ_SUFFIX)
9107 AC_SUBST(BIN_SUFFIX)
9108 AC_SUBST(ASM_SUFFIX)
9109 AC_SUBST(IMPORT_LIB_SUFFIX)
9111 AC_SUBST(CC_VERSION)
9112 AC_SUBST(CXX_VERSION)
9113 AC_SUBST(MSMANIFEST_TOOL)
9114 AC_SUBST(NS_ENABLE_TSF)
9115 AC_SUBST(MOZ_NSS_PATCH)
9116 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
9117 AC_SUBST(MOZ_APP_EXTRA_LIBS)
9120 AC_SUBST(MOZ_SYDNEYAUDIO)
9122 AC_SUBST(MOZ_VORBIS)
9123 AC_SUBST(MOZ_TREMOR)
9126 AC_SUBST(MOZ_ALSA_LIBS)
9128 AC_SUBST(VPX_ASFLAGS)
9129 AC_SUBST(VPX_DASH_C_FLAG)
9130 AC_SUBST(VPX_AS_CONVERSION)
9131 AC_SUBST(VPX_ASM_SUFFIX)
9132 AC_SUBST(VPX_X86_ASM)
9133 AC_SUBST(VPX_ARM_ASM)
9135 if test "$USING_HCC"; then
9136 CC='${topsrcdir}/build/hcc'
9138 CXX='${topsrcdir}/build/hcpp'
9139 CXX="$CXX '$_OLDCXX'"
9144 AC_MSG_CHECKING([for posix_fallocate])
9145 AC_TRY_LINK([#define _XOPEN_SOURCE 600
9146 #include <fcntl.h>],
9147 [posix_fallocate(0, 0, 0);],
9148 [ac_cv___posix_fallocate=true],
9149 [ac_cv___posix_fallocate=false])
9151 if test "$ac_cv___posix_fallocate" = true ; then
9152 AC_DEFINE(HAVE_POSIX_FALLOCATE)
9158 dnl Check for missing components
9159 if test "$COMPILE_ENVIRONMENT"; then
9160 if test "$MOZ_X11"; then
9161 dnl ====================================================
9162 dnl = Check if X headers exist
9163 dnl ====================================================
9164 _SAVE_CFLAGS=$CFLAGS
9165 CFLAGS="$CFLAGS $XCFLAGS"
9169 #include <X11/Xlib.h>
9170 #include <X11/Intrinsic.h>
9174 if ((dpy = XOpenDisplay(NULL)) == NULL) {
9175 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
9179 [ AC_MSG_ERROR([Could not compile basic X program.]) ])
9180 CFLAGS="$_SAVE_CFLAGS"
9182 if test ! -z "$MISSING_X"; then
9183 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
9188 dnl Check for headers, etc. needed by WebGL.
9189 if test -n "$MOZ_WEBGL_GLX"; then
9190 AC_CHECK_HEADER(GL/glx.h)
9191 if test "$ac_cv_header_GL_glx_h" != "yes"; then
9192 AC_MSG_ERROR([Can't find header GL/glx.h for WebGL (install mesa-common-dev (Ubuntu), mesa-libGL-devel (Fedora), or Mesa (SuSE))])
9195 fi # COMPILE_ENVIRONMENT
9197 if test "$USE_FC_FREETYPE"; then
9198 if test "$COMPILE_ENVIRONMENT"; then
9199 _SAVE_CPPFLAGS="$CPPFLAGS"
9200 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
9201 AC_CHECK_HEADERS(fontconfig/fcfreetype.h, ,
9202 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)])
9203 CPPFLAGS="$_SAVE_CPPFLAGS"
9205 AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
9209 dnl Set various defines and substitutions
9210 dnl ========================================================
9212 if test "$OS_ARCH" = "BeOS"; then
9214 elif test "$OS_ARCH" = "Darwin"; then
9216 AC_DEFINE(UNIX_ASYNC_DNS)
9217 elif test "$OS_ARCH" = "OpenVMS"; then
9219 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
9221 AC_DEFINE(UNIX_ASYNC_DNS)
9224 if test "$MOZ_DEBUG"; then
9225 AC_DEFINE(MOZ_REFLOW_PERF)
9226 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
9229 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
9230 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
9231 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
9232 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
9233 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
9234 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
9235 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
9236 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
9237 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
9240 dnl ========================================================
9241 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
9242 dnl ========================================================
9245 WIN_TOP_SRC=`cd $srcdir; pwd -W`
9248 HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
9249 HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
9250 CC="\$(CYGWIN_WRAPPER) $CC"
9251 CXX="\$(CYGWIN_WRAPPER) $CXX"
9252 CPP="\$(CYGWIN_WRAPPER) $CPP"
9253 LD="\$(CYGWIN_WRAPPER) $LD"
9254 AS="\$(CYGWIN_WRAPPER) $AS"
9255 RC="\$(CYGWIN_WRAPPER) $RC"
9256 MIDL="\$(CYGWIN_WRAPPER) $MIDL"
9257 CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
9258 WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
9262 AC_SUBST(CYGDRIVE_MOUNT)
9263 AC_SUBST(WIN_TOP_SRC)
9265 AC_SUBST(MOZILLA_VERSION)
9267 AC_SUBST(ac_configure_args)
9269 dnl Spit out some output
9270 dnl ========================================================
9272 dnl The following defines are used by xpcom
9273 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
9275 HAVE_CPP_2BYTE_WCHAR_T
9276 HAVE_CPP_ACCESS_CHANGING_USING
9277 HAVE_CPP_AMBIGUITY_RESOLVING_USING
9280 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
9282 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
9283 HAVE_CPP_NAMESPACE_STD
9285 HAVE_CPP_PARTIAL_SPECIALIZATION
9286 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
9288 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
9290 NEED_CPP_UNUSED_IMPLEMENTATIONS
9294 HAVE_ICONV_WITH_CONST_INPUT
9302 netwerk/necko-config.h
9303 xpcom/xpcom-config.h
9304 xpcom/xpcom-private.h
9307 # Save the defines header file before autoconf removes it.
9308 # (Do not add AC_DEFINE calls after this line.)
9309 _CONFIG_TMP=confdefs-tmp.h
9310 _CONFIG_DEFS_H=mozilla-config.h
9312 cat > $_CONFIG_TMP <<\EOF
9313 /* List of defines generated by configure. Included with preprocessor flag,
9314 * -include, to avoid long list of -D defines on the compile command-line.
9318 #ifndef _MOZILLA_CONFIG_H_
9319 #define _MOZILLA_CONFIG_H_
9322 _EGREP_PATTERN='^#define ('
9323 if test -n "$_NON_GLOBAL_ACDEFINES"; then
9324 for f in $_NON_GLOBAL_ACDEFINES; do
9325 _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
9328 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
9330 sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
9332 cat >> $_CONFIG_TMP <<\EOF
9334 #endif /* _MOZILLA_CONFIG_H_ */
9338 # Only write mozilla-config.h when something changes (or it doesn't exist)
9339 if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
9342 AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
9343 mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
9345 echo ==== $_CONFIG_DEFS_H =================================
9349 dnl Probably shouldn't call this manually but we always want the output of DEFS
9350 rm -f confdefs.h.save
9351 mv confdefs.h confdefs.h.save
9352 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
9353 AC_OUTPUT_MAKE_DEFS()
9355 AC_SUBST(MOZ_DEFINES)
9357 mv confdefs.h.save confdefs.h
9359 dnl Load the list of Makefiles to generate.
9360 dnl To add new Makefiles, edit allmakefiles.sh.
9361 dnl allmakefiles.sh sets the variable, MAKEFILES.
9362 . ${srcdir}/allmakefiles.sh
9364 dnl Run a perl script to quickly create the makefiles.
9365 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
9366 dnl for the files it cannot handle correctly. This way, config.status
9367 dnl will handle these files.
9368 dnl If it fails, nothing is set and config.status will run as usual.
9370 dnl This does not change the $MAKEFILES variable.
9372 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
9374 if test -z "${AS_PERL}"; then
9375 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
9377 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
9382 echo $MAKEFILES > unallmakefiles
9384 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
9386 AC_OUTPUT($MAKEFILES)
9388 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
9389 if test "$CAIRO_FEATURES_H"; then
9390 if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
9391 echo "$CAIRO_FEATURES_H is unchanged"
9392 mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
9394 rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
9398 # Run freetype configure script
9400 if test "$MOZ_TREE_FREETYPE"; then
9401 export CFLAGS="$CFLAGS -std=c99"
9402 export CPPFLAGS="$CPPFLAGS"
9403 export CXXFLAGS="$CXXFLAGS"
9404 export LDFLAGS="$LDFLAGS"
9405 export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
9406 ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes"
9407 AC_OUTPUT_SUBDIRS(modules/freetype2)
9410 dnl ========================================================
9411 dnl = Setup a nice relatively clean build environment for
9412 dnl = sub-configures.
9413 dnl ========================================================
9416 CFLAGS="$_SUBDIR_CFLAGS"
9417 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9418 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9419 LDFLAGS="$_SUBDIR_LDFLAGS"
9420 HOST_CC="$_SUBDIR_HOST_CC"
9421 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9422 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9428 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9429 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9431 if test -n "$MOZ_THUMB2"; then
9432 _SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --enable-thumb2"
9434 if test -n "$_WRAP_MALLOC"; then
9435 _SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --enable-wrap-malloc"
9438 if test -z "$MOZ_NATIVE_NSPR"; then
9439 ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9440 if test -z "$MOZ_DEBUG"; then
9441 ac_configure_args="$ac_configure_args --disable-debug"
9443 if test "$MOZ_OPTIMIZE" = "1"; then
9444 ac_configure_args="$ac_configure_args --enable-optimize"
9446 if test "$OS_ARCH" = "WINNT" -a "$NS_TRACE_MALLOC"; then
9447 ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
9449 if test -n "$HAVE_64BIT_OS"; then
9450 ac_configure_args="$ac_configure_args --enable-64bit"
9452 if test -n "$USE_ARM_KUSER"; then
9453 ac_configure_args="$ac_configure_args --with-arm-kuser"
9455 AC_OUTPUT_SUBDIRS(nsprpub)
9456 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9459 if test -z "$MOZ_NATIVE_NSPR"; then
9460 # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
9461 AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
9462 if test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
9463 NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
9464 $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
9465 NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
9466 $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
9468 rm -f config/autoconf.mk.bak
9471 # Run the SpiderMonkey 'configure' script.
9472 dist=$MOZ_BUILD_ROOT/dist
9473 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9474 ac_configure_args="$ac_configure_args --enable-threadsafe"
9475 if test "$BUILD_CTYPES"; then
9476 # Build js-ctypes on the platforms we can.
9477 ac_configure_args="$ac_configure_args --enable-ctypes"
9479 if test -z "$JS_SHARED_LIBRARY" ; then
9480 ac_configure_args="$ac_configure_args --disable-shared-js"
9482 if test -z "$MOZ_NATIVE_NSPR"; then
9483 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9484 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9486 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9487 ac_configure_args="$ac_configure_args --prefix=$dist"
9488 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
9489 if test "$MOZ_MEMORY"; then
9490 ac_configure_args="$ac_configure_args --enable-jemalloc"
9491 if test -n "$MOZ_MEMORY_LDFLAGS"; then
9492 export MOZ_MEMORY_LDFLAGS
9495 AC_OUTPUT_SUBDIRS(js/src)
9496 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9498 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
9500 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
9501 dnl Needs to be at the end to respect possible changes from NSPR configure
9502 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
9503 echo "config/autoconf.mk is unchanged"
9504 mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
9506 rm -f config/autoconf.mk.orig 2> /dev/null