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 -march=armv5te -mthumb-interwork $CFLAGS"
305 CXXFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions -march=armv5te -mthumb-interwork $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.6 python2.5 python2.4 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 # we need Python 2.5 on Windows
1851 if test -n "$_WIN32_MSVC"; then
1853 HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
1854 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
1855 HOST_RANLIB='echo ranlib'
1857 HOST_CFLAGS="$HOST_CFLAGS -mno-cygwin"
1859 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11"
1860 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1861 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1862 HOST_BIN_SUFFIX=.exe
1865 dnl MinGW/MSYS does not need CYGWIN_WRAPPER
1866 PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1869 CYGWIN_WRAPPER="${srcdir}/build/cygwin-wrapper"
1870 if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
1872 CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
1874 if test "`${PERL} -v | grep -c cygwin 2>/dev/null`" = 0; then
1876 PERL="${CYGWIN_WRAPPER} $PERL"
1879 if test "`${PYTHON} -c 'import sys; print sys.platform;'`" != "cygwin"; then
1880 PYTHON="${CYGWIN_WRAPPER} $PYTHON"
1885 case "${host_cpu}" in
1887 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1893 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1894 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1895 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1898 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1899 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1900 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1901 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1905 HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
1906 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
1907 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1908 HOST_BIN_SUFFIX=.exe
1913 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1914 HOST_NSPR_MDCPUCFG='\"md/_osf1.cfg\"'
1915 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1919 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1920 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1924 dnl We require version 2.4 or newer of Python to build,
1925 dnl and 2.5 or newer on Windows.
1926 AC_MSG_CHECKING([for minimum required Python version >= $PYTHON_VERSION])
1928 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1])" $PYTHON_VERSION
1931 if test "$_python_res" != 0; then
1932 AC_MSG_ERROR([Python $PYTHON_VERSION or higher is required.])
1934 AC_MSG_RESULT([yes])
1936 dnl Get mozilla version from central milestone file
1937 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
1939 dnl Get version of various core apps from the version files.
1940 FIREFOX_VERSION=`cat $topsrcdir/browser/config/version.txt`
1942 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1943 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1945 dnl ========================================================
1946 dnl System overrides of the defaults for target
1947 dnl ========================================================
1952 if test ! "$GNU_CC"; then
1953 if test ! "$HAVE_64BIT_OS"; then
1954 # Compiling with Visual Age C++ object model compat is the
1955 # default. To compile with object model ibm, add
1956 # AIX_OBJMODEL=ibm to .mozconfig.
1957 if test "$AIX_OBJMODEL" = "ibm"; then
1958 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1965 AC_SUBST(AIX_OBJMODEL)
1966 DSO_LDOPTS='-qmkshrobj=1'
1967 DSO_CFLAGS='-qflag=w:w'
1969 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1970 AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS till we can fix bug 332075.])
1972 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1973 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1974 if test "$COMPILE_ENVIRONMENT"; then
1977 AC_MSG_CHECKING([for VisualAge C++ compiler version >= 6.0.0.3])
1979 [#if (__IBMCPP__ < 600)
1980 #error "Bad compiler"
1982 _BAD_COMPILER=,_BAD_COMPILER=1)
1983 if test -n "$_BAD_COMPILER"; then
1985 AC_MSG_ERROR([VisualAge C++ version 6.0.0.3 or higher is required to build.])
1987 AC_MSG_RESULT([yes])
1990 TARGET_COMPILER_ABI="ibmc"
1991 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1992 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1995 case "${target_os}" in
2000 if test "$COMPILE_ENVIRONMENT"; then
2001 AC_CHECK_HEADERS(sys/inttypes.h)
2003 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2008 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
2009 _PLATFORM_DEFAULT_TOOLKIT="cairo-beos"
2010 DSO_LDOPTS='-nostart'
2011 TK_LIBS='-lbe -lroot'
2013 if test "$COMPILE_ENVIRONMENT"; then
2014 AC_CHECK_LIB(bind,main,LIBS="$LIBS -lbind")
2015 AC_CHECK_LIB(zeta,main,LIBS="$LIBS -lzeta")
2017 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-multichar"
2018 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-multichar"
2021 MOZ_USER_DIR="Mozilla"
2025 dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
2034 _WARNINGS_CFLAGS="-Wall"
2035 _WARNINGS_CXXFLAGS="-Wall"
2036 # The test above doesn't work properly, at least on 3.1.
2037 MKSHLIB_FORCE_ALL=''
2038 MKSHLIB_UNFORCE_ALL=''
2044 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2045 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2046 # If we're building with --enable-profiling, we need a frame pointer.
2047 if test -z "$MOZ_PROFILING"; then
2048 MOZ_OPTIMIZE_FLAGS="-O3 -fomit-frame-pointer"
2050 MOZ_OPTIMIZE_FLAGS="-O3 -fno-omit-frame-pointer"
2053 CFLAGS="$CFLAGS -fpascal-strings -fno-common"
2054 CXXFLAGS="$CXXFLAGS -fpascal-strings -fno-common"
2057 STRIP="$STRIP -x -S"
2058 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
2059 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
2060 # The ExceptionHandling framework is needed for Objective-C exception
2061 # logging code in nsObjCExceptions.h. Currently we only use that in debug
2063 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling"
2065 dnl DTrace and -dead_strip don't interact well. See bug 403132.
2066 dnl ===================================================================
2067 if test "x$enable_dtrace" = "xyes"; then
2068 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
2070 dnl check for the presence of the -dead_strip linker flag
2071 AC_MSG_CHECKING([for -dead_strip option to ld])
2072 _SAVE_LDFLAGS=$LDFLAGS
2073 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
2074 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
2075 if test -n "$_HAVE_DEAD_STRIP" ; then
2076 AC_MSG_RESULT([yes])
2077 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
2082 LDFLAGS=$_SAVE_LDFLAGS
2084 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
2088 if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
2089 DLL_SUFFIX=".so.1.0"
2090 DSO_LDOPTS="-shared"
2092 if test ! "$GNU_CC"; then
2093 DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
2099 if test ! "$GNU_CC"; then
2103 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2104 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2105 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2108 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2109 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2113 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2114 AC_DEFINE(_LARGEFILE64_SOURCE)
2119 if test ! "$GNU_CC"; then
2120 DSO_LDOPTS='-b -Wl,+s'
2123 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2124 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2125 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2127 DSO_LDOPTS='-b -E +s'
2128 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2129 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2131 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2132 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2137 DSO_LDOPTS='-elf -shared'
2139 if test "$GNU_CC"; then
2140 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2141 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2142 MKSHLIB_FORCE_ALL='-Wl,-all'
2143 MKSHLIB_UNFORCE_ALL='-Wl,-none'
2144 CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2146 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2147 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2148 MKSHLIB_FORCE_ALL='-all'
2149 MKSHLIB_UNFORCE_ALL='-none'
2155 dnl the irix specific xptcinvoke code is written against the n32 ABI so we *must*
2156 dnl compile and link using -n32
2158 TARGET_COMPILER_ABI=n32
2159 DSO_LDOPTS='-elf -shared'
2160 MKSHLIB='$(CCC) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2161 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2162 _MOZ_EXCEPTIONS_FLAGS_OFF="-LANG:exceptions=OFF"
2163 _MOZ_EXCEPTIONS_FLAGS_ON="-LANG:exceptions=ON"
2164 if test "$GNU_CC"; then
2165 MKSHLIB_FORCE_ALL='-Wl,-all'
2166 MKSHLIB_UNFORCE_ALL='-Wl,-none'
2167 _WARNINGS_CFLAGS="-Wall"
2168 _WARNINGS_CXXFLAGS="-Wall"
2169 CXXFLAGS="$CXXFLAGS -D_LANGUAGE_C_PLUS_PLUS"
2171 MKSHLIB_FORCE_ALL='-all'
2172 MKSHLIB_UNFORCE_ALL='-none'
2178 CFLAGS="$CFLAGS -woff 3262 -G 4"
2179 CXXFLAGS="$CXXFLAGS -woff 3262 -G 4"
2180 if test -n "$USE_N32"; then
2181 ASFLAGS="$ASFLAGS -n32"
2182 CFLAGS="$CFLAGS -n32"
2183 CXXFLAGS="$CXXFLAGS -n32"
2184 LDFLAGS="$LDFLAGS -n32"
2186 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2187 AC_MSG_WARN([Clearing MOZ_FIX_LINK_PATHS for OSF/1 as fix for bug 333545 (till the reference bug 332075 is fixed.])
2190 if test -z "$GNU_CXX"; then
2196 # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2197 # Similarly for GNU_CXX and INTEL_CXX.
2198 if test "$INTEL_CC" -o "$INTEL_CXX"; then
2199 # -Os has been broken on Intel's C/C++ compilers for quite a
2200 # while; Intel recommends against using it.
2201 MOZ_OPTIMIZE_FLAGS="-O2"
2202 MOZ_DEBUG_FLAGS="-g"
2203 elif test "$GNU_CC" -o "$GNU_CXX"; then
2204 GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2205 case $GCC_VERSION in
2207 # -Os is broken on gcc 4.1.x 4.2.x, 4.5.x we need to tweak it to get good results.
2208 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2210 # If we're building with --enable-profiling, we need a frame pointer.
2211 if test -z "$MOZ_PROFILING"; then
2212 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fomit-frame-pointer $MOZ_OPTIMIZE_SIZE_TWEAK"
2214 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-omit-frame-pointer $MOZ_OPTIMIZE_SIZE_TWEAK"
2216 MOZ_DEBUG_FLAGS="-g"
2219 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2223 case "${target_cpu}" in
2225 CFLAGS="$CFLAGS -mieee"
2226 CXXFLAGS="$CXXFLAGS -mieee"
2232 MOZ_DEBUG_FLAGS="-g" # We want inlining
2238 TARGET_COMPILER_ABI=msvc
2239 _PLATFORM_DEFAULT_TOOLKIT=cairo-windows
2240 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2241 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2243 AR_EXTRACT="$AR -extract"
2245 AR_FLAGS='-OUT:"$@"'
2249 ac_configure_args="$ac_configure_args --enable-win32-target=WINCE"
2251 if test "$AS_BIN"; then
2258 if test -z "$RC"; then
2261 # certain versions of cygwin's makedepend barf on the
2262 # #include <string> vs -I./dist/include/string issue so don't use it
2268 HOST_AR='lib -OUT:$@'
2269 HOST_RANLIB='echo ranlib'
2270 HOST_CFLAGS="$HOST_CFLAGS -D_X86_"
2273 WARNINGS_AS_ERRORS='-WX'
2274 MOZ_OPTIMIZE_FLAGS='-Ox'
2275 AR_FLAGS='-NOLOGO -OUT:"$@"'
2277 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2278 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2281 DSO_LDOPTS=-SUBSYSTEM:WINDOWSCE
2282 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2284 IMPORT_LIB_SUFFIX=lib
2285 dnl Need to force-link against mozalloc because it's used in the shunt
2286 LIBS="$LIBS \$(LIBXUL_DIST)/lib/mozalloc.lib"
2287 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2290 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2291 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ $(DSO_LDOPTS)'
2293 MKSHLIB_UNFORCE_ALL=
2294 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2295 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2296 MOZ_DEBUG_FLAGS='-Zi'
2297 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2299 MOZ_JS_STATIC_LIBS='$(LIBXUL_DIST)/lib/js_static.lib'
2300 MOZ_JS_SHARED_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2302 RANLIB='echo not_ranlib'
2303 STRIP='echo not_strip'
2304 TARGET_NSPR_MDCPUCFG='\"md/_wince.cfg\"'
2307 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2311 AC_DEFINE(HAVE_SNPRINTF)
2316 AC_DEFINE(HW_THREADS)
2317 AC_DEFINE(STDC_HEADERS)
2318 AC_DEFINE(NEW_H, <new>)
2319 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2320 AC_DEFINE(HAVE_LOCALTIME_R)
2322 TARGET_MD_ARCH=win32
2323 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2325 MOZ_USER_DIR="Mozilla"
2327 MOZ_GFX_OPTIMIZE_MOBILE=1
2329 # Sanity check for WINCE_WINDOWS_MOBILE
2330 # XXX disabled until we can fix the mobile tinderbox
2331 ##if test "$WINCE_WINDOWS_MOBILE"; then
2332 ## AC_CHECK_HEADER(tpcshell.h, [],
2333 ## AC_MSG_ERROR([Can't find tpcshell.h in your SDK; are you sure you don't need --disable-windows-mobile-components?]))
2338 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2343 # certain versions of cygwin's makedepend barf on the
2344 # #include <string> vs -I./dist/include/string issue so don't use it
2346 if test -n "$GNU_CC"; then
2347 CC="$CC -mno-cygwin"
2348 CXX="$CXX -mno-cygwin"
2349 CPP="$CPP -mno-cygwin"
2350 CFLAGS="$CFLAGS -mms-bitfields"
2351 CXXFLAGS="$CXXFLAGS -mms-bitfields"
2352 DSO_LDOPTS='-shared'
2353 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2354 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2356 # Use temp file for windres (bug 213281)
2357 RCFLAGS='-O coff --use-temp-file'
2358 # mingw doesn't require kernel32, user32, and advapi32 explicitly
2359 LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32"
2360 MOZ_JS_STATIC_LIBS='-L$(LIBXUL_DIST)/bin -ljs_static'
2361 MOZ_JS_SHARED_LIBS='-L$(LIBXUL_DIST)/bin -lmozjs'
2363 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2364 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2366 IMPORT_LIB_SUFFIX=dll.a
2367 GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2369 TARGET_COMPILER_ABI=msvc
2373 if test "$AS_BIN"; then
2374 AS="$(basename "$AS_BIN")"
2376 AR='lib -NOLOGO -OUT:"$@"'
2378 RANLIB='echo not_ranlib'
2379 STRIP='echo not_strip'
2385 GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2391 IMPORT_LIB_SUFFIX=lib
2392 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2393 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2395 MKSHLIB_UNFORCE_ALL=
2396 DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2397 _USE_CPP_INCLUDE_FLAG=1
2398 _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2399 _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2400 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2401 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2402 CXXFLAGS="$CXXFLAGS -wd4800" # disable warning "forcing value to bool"
2403 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2404 MOZ_DEBUG_FLAGS='-Zi'
2405 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2406 WARNINGS_AS_ERRORS='-WX'
2407 # If we're building with --enable-profiling, we need -Oy-, which forces a frame pointer.
2408 if test -z "$MOZ_PROFILING"; then
2409 MOZ_OPTIMIZE_FLAGS='-O1'
2411 MOZ_OPTIMIZE_FLAGS='-O1 -Oy-'
2413 MOZ_JS_STATIC_LIBS='$(LIBXUL_DIST)/lib/js_static.lib'
2414 MOZ_JS_SHARED_LIBS='$(LIBXUL_DIST)/lib/mozjs.lib'
2416 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2417 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2418 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2419 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2420 if test $_MSC_VER -ge 1400; then
2421 LDFLAGS="$LDFLAGS -NXCOMPAT"
2422 dnl For profile-guided optimization
2423 PROFILE_GEN_CFLAGS="-GL"
2424 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2425 dnl XXX: PGO builds can fail with warnings treated as errors,
2426 dnl specifically "no profile data available" appears to be
2427 dnl treated as an error sometimes. This might be a consequence
2428 dnl of using WARNINGS_AS_ERRORS in some modules, combined
2429 dnl with the linker doing most of the work in the whole-program
2430 dnl optimization/PGO case. I think it's probably a compiler bug,
2431 dnl but we work around it here.
2432 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2433 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2434 dnl Probably also a compiler bug, but what can you do?
2435 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2436 if test -n "$_USE_DYNAMICBASE"; then
2437 LDFLAGS="$LDFLAGS -DYNAMICBASE"
2441 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg32$(VERSION_NUMBER),$(DEPTH)/jpeg)'
2442 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/modules/libimg/png)'
2443 AC_DEFINE(HAVE_SNPRINTF)
2448 AC_DEFINE(HW_THREADS)
2449 AC_DEFINE(STDC_HEADERS)
2450 AC_DEFINE(NEW_H, <new>)
2451 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2452 TARGET_MD_ARCH=win32
2453 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2455 MOZ_USER_DIR="Mozilla"
2457 dnl Hardcode to win95 for now - cls
2458 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2460 dnl set NO_X11 defines here as the general check is skipped on win32
2464 dnl MinGW/MSYS doesn't provide or need cygpath
2469 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2471 *-cygwin*|*-msvc*|*-mks*)
2472 CYGPATH_W="cygpath -a -w"
2473 CYGPATH_S="sed -e s|\\\\|/|g"
2474 MOZ_BUILD_ROOT=`$CYGPATH_W $MOZ_BUILD_ROOT | $CYGPATH_S`
2478 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
2480 if test -z "$MOZ_TOOLS"; then
2481 AC_MSG_ERROR([MOZ_TOOLS is not set])
2484 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2485 if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2486 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2488 MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2489 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2490 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2492 MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
2499 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])
2503 AC_CHECK_HEADERS(oleacc.idl)
2507 AC_CHECK_HEADERS(atlbase.h)
2514 if test "$HAVE_64BIT_OS"; then
2515 AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2518 if test $_MSC_VER -ge 1400; then
2519 LDFLAGS="$LDFLAGS -SAFESEH"
2521 AC_CHECK_HEADERS(mmintrin.h)
2534 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2538 if test "$HAVE_64BIT_OS"; then
2545 CFLAGS="$CFLAGS -Dunix"
2546 CXXFLAGS="$CXXFLAGS -Dunix"
2547 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2549 DSO_PIC_CFLAGS='-fPIC -DPIC'
2550 DSO_LDOPTS='-shared'
2551 BIN_FLAGS='-Wl,--export-dynamic'
2553 DSO_PIC_CFLAGS='-fPIC -DPIC'
2554 DLL_SUFFIX=".so.1.0"
2555 DSO_LDOPTS='-shared'
2557 # This will fail on a.out systems prior to 1.5.1_ALPHA.
2558 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2559 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2560 if test "$LIBRUNPATH"; then
2561 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2563 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2564 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2569 AC_DEFINE(_QNX_SOURCE)
2572 WARNINGS_AS_ERRORS=''
2573 MOZ_OPTIMIZE_FLAGS="-O"
2574 MOZ_DEBUG_FLAGS="-gstabs"
2577 LIBS="$LIBS -lsocket -lstdc++"
2578 _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT -D_POSIX_C_SOURCE=199506'
2579 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h -D_POSIX_C_SOURCE=199506'
2580 if test "$with_x" != "yes"
2582 _PLATFORM_DEFAULT_TOOLKIT="photon"
2583 TK_CFLAGS='-I/usr/include/photon'
2586 case "${target_cpu}" in
2588 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
2591 case "${host_cpu}" in
2599 DLL_SUFFIX=".so.1.0"
2601 DSO_PIC_CFLAGS='-fPIC'
2602 DSO_LDOPTS='-shared -fPIC'
2603 if test "$LIBRUNPATH"; then
2604 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2609 AC_DEFINE(NO_PW_GECOS)
2610 AC_DEFINE(NO_UDSOCK)
2611 AC_DEFINE(POLL_WITH_XCONNECTIONNUMBER)
2613 MKSHLIB_FORCE_ALL='-all'
2614 MKSHLIB_UNFORCE_ALL='-none'
2616 AS_DASH_C_FLAG='-Wc/names=as_is'
2618 DSO_LDOPTS='-shared -auto_symvec'
2620 MOZ_DEBUG_LDFLAGS='-g'
2622 CC_VERSION=`$CC -V 2>&1 | awk '/ C / { print $3 }'`
2623 CXX_VERSION=`$CXX -V 2>&1 | awk '/ C\+\+ / { print $3 }'`
2628 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2629 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2632 AC_DEFINE(OS2EMX_PLAIN_CHAR)
2633 AC_DEFINE(TCPV40HDRS)
2639 IMPORT_LIB_SUFFIX=lib
2643 CFLAGS="$CFLAGS -Zomf"
2644 CXXFLAGS="$CXXFLAGS -Zomf"
2646 BIN_FLAGS='-Zlinker /ST:0x100000'
2650 WARNINGS_AS_ERRORS='-Werror'
2651 MOZ_DEBUG_FLAGS="-g -fno-inline"
2652 MOZ_OPTIMIZE_FLAGS="-O2"
2653 MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2654 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2655 LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2657 _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2660 MOZ_USER_DIR="Mozilla"
2662 if test "$MOZTOOLS"; then
2663 MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2665 AC_MSG_ERROR([MOZTOOLS is not set])
2667 if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2668 DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2669 LDFLAGS="$LDFLAGS -Zhigh-mem"
2670 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2671 AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2674 # GCC for OS/2 currently predefines these, but we don't want them
2675 _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2676 _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2678 AC_CACHE_CHECK(for __declspec(dllexport),
2680 [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2682 ac_os2_declspec="yes",
2683 ac_os2_declspec="no")])
2684 if test "$ac_os2_declspec" = "yes"; then
2686 MOZ_OS2_USE_DECLSPEC='1'
2691 if test "$GNU_CC"; then
2692 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2693 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$@ -o $@'
2696 MOZ_DEBUG_FLAGS='-g'
2697 ASFLAGS='-I$(topsrcdir)/xpcom/reflect/xptcall/public -g'
2698 CFLAGS="$CFLAGS -ieee"
2699 CXXFLAGS="$CXXFLAGS "'-noexceptions -ieee -ptr $(DIST)/cxx_repository'
2700 DSO_LDOPTS='-shared -msym -expect_unresolved \* -update_registry $(DIST)/so_locations'
2703 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2704 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -soname $@ -o $@'
2705 MKSHLIB_FORCE_ALL='-all'
2706 MKSHLIB_UNFORCE_ALL='-none'
2707 dnl Might fix the libxpcom.so breakage on this platform as well....
2708 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2709 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2711 if test -z "$GNU_CXX"; then
2714 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2718 DIRENT_INO=d_stat.st_ino
2719 dnl Solves the problems the QNX compiler has with nsCOMPtr.h.
2720 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2721 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2722 dnl Explicit set STDC_HEADERS to workaround QNX 6.0's failing of std test
2723 AC_DEFINE(STDC_HEADERS)
2724 if test "$no_x" = "yes"; then
2725 _PLATFORM_DEFAULT_TOOLKIT='photon'
2726 TK_CFLAGS='-I/usr/nto/include/photon'
2727 TK_LIBS='-lphoton -lphrender'
2732 AC_DEFINE(NSCAP_DISABLE_TEST_DONTQUERY_CASES)
2733 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2734 CXXFLAGS="$CXXFLAGS -I/usr/include/CC"
2735 if test ! "$GNU_CC"; then
2742 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2745 # $ORIGIN/.. is for shared libraries under components/ to locate shared
2746 # libraries one level up (e.g. libnspr4.so)
2747 if test "$SOLARIS_SUNPRO_CC"; then
2748 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2749 LIBS="-lCrun -lCstd -lc $LIBS"
2751 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2752 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2753 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2754 _MOZ_EXCEPTIONS_FLAGS_ON='-features=except'
2755 _MOZ_EXCEPTIONS_FLAGS_OFF='-features=no%except'
2756 LDFLAGS="-xildoff $LDFLAGS"
2757 if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2758 _SAVE_LDFLAGS=$LDFLAGS
2759 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2760 AC_TRY_LINK([#include <stdio.h>],
2761 [printf("Hello World\n");],
2763 [LDFLAGS=$_SAVE_LDFLAGS])
2765 WARNINGS_AS_ERRORS='-Werror'
2766 MOZ_OPTIMIZE_FLAGS="-xO4"
2767 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2768 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2769 MKSHLIB_FORCE_ALL='-z allextract'
2770 MKSHLIB_UNFORCE_ALL='-z defaultextract'
2777 AS='/usr/ccs/bin/as'
2778 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2780 TARGET_COMPILER_ABI="sunc"
2781 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2782 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2783 AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2787 [#if (__SUNPRO_CC < 0x590)
2790 _BAD_COMPILER=,_BAD_COMPILER=1)
2791 if test -n "$_BAD_COMPILER"; then
2793 AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2798 [#if (__SUNPRO_CC >= 0x5100)
2799 #error "Sun C++ 5.10 or above"
2801 _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2802 if test "$_ABOVE_SS12U1"; then
2804 CXXFLAGS="$CXXFLAGS -xannotate=no"
2806 AC_MSG_RESULT([$_res])
2809 LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2811 MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2812 MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2813 ASFLAGS="$ASFLAGS -fPIC"
2814 DSO_LDOPTS='-shared'
2816 _WARNINGS_CXXFLAGS=''
2817 if test "$OS_RELEASE" = "5.3"; then
2818 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2821 if test "$OS_RELEASE" = "5.5.1"; then
2822 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2827 DSO_LDOPTS='-Bdynamic'
2828 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2829 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2831 AC_DEFINE(SPRINTF_RETURNS_STRING)
2832 case "$(target_os)" in
2834 DLL_SUFFIX='.so.1.0'
2840 NSPR_LIBS="-lnspr$NSPR_VERSION -lplc$NSPR_VERSION -lplds$NSPR_VERSION -L/usr/ccs/lib -lcrt"
2844 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2848 AC_DEFINE(NO_PW_GECOS)
2850 _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2851 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2853 MOZ_GFX_OPTIMIZE_MOBILE=1
2854 # If we're building with --enable-profiling, we need a frame pointer.
2855 if test -z "$MOZ_PROFILING"; then
2856 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fomit-frame-pointer"
2858 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fno-omit-frame-pointer"
2864 dnl Only one oddball right now (QNX), but this gives us flexibility
2865 dnl if any other platforms need to override this in the future.
2866 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2868 dnl ========================================================
2869 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2870 dnl by now will not have any way to link most binaries (tests
2871 dnl as well as viewer, apprunner, etc.), because some symbols
2872 dnl will be left out of the "composite" .so's by ld as unneeded.
2873 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2874 dnl they can link in the static libs that provide the missing
2876 dnl ========================================================
2877 NO_LD_ARCHIVE_FLAGS=
2878 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2879 NO_LD_ARCHIVE_FLAGS=1
2883 NO_LD_ARCHIVE_FLAGS=
2886 NO_LD_ARCHIVE_FLAGS=
2889 NO_LD_ARCHIVE_FLAGS=
2891 *-msvc*|*-mks*|*-mingw*|*-cygwin*|*-wince|*-winmo)
2892 if test -z "$GNU_CC"; then
2893 NO_LD_ARCHIVE_FLAGS=
2897 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2899 dnl ========================================================
2900 dnl = Flags to strip unused symbols from .so components
2901 dnl ========================================================
2903 *-linux*|*-kfreebsd*-gnu|*-gnu*)
2904 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2907 if test -z "$GNU_CC"; then
2908 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2910 if test -z "$GCC_USE_GNU_LD"; then
2911 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2913 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2918 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2921 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2923 *-cygwin*|*-mingw*|*-mks*|*-msvc|*-wince|*-winmo)
2924 if test -n "$GNU_CC"; then
2925 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2930 if test -z "$COMPILE_ENVIRONMENT"; then
2931 SKIP_COMPILER_CHECKS=1
2932 SKIP_LIBRARY_CHECKS=1
2935 if test -z "$SKIP_COMPILER_CHECKS"; then
2936 dnl Checks for typedefs, structures, and compiler characteristics.
2937 dnl ========================================================
2945 AC_MSG_CHECKING(for __stdcall)
2946 AC_CACHE_VAL(ac_cv___stdcall,
2947 [AC_TRY_COMPILE([template <typename Method> struct foo;
2948 template <> struct foo<void (*)()> {};
2949 template <> struct foo<void (__stdcall*)()> {};],
2951 [ac_cv___stdcall=true],
2952 [ac_cv___stdcall=false])])
2953 if test "$ac_cv___stdcall" = true ; then
2954 AC_DEFINE(HAVE_STDCALL)
2960 AC_MSG_CHECKING(for ssize_t)
2961 AC_CACHE_VAL(ac_cv_type_ssize_t,
2962 [AC_TRY_COMPILE([#include <stdio.h>
2963 #include <sys/types.h>],
2965 [ac_cv_type_ssize_t=true],
2966 [ac_cv_type_ssize_t=false])])
2967 if test "$ac_cv_type_ssize_t" = true ; then
2968 AC_DEFINE(HAVE_SSIZE_T)
2973 AC_STRUCT_ST_BLKSIZE
2974 AC_MSG_CHECKING(for siginfo_t)
2975 AC_CACHE_VAL(ac_cv_siginfo_t,
2976 [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
2977 #include <signal.h>],
2979 [ac_cv_siginfo_t=true],
2980 [ac_cv_siginfo_t=false])])
2981 if test "$ac_cv_siginfo_t" = true ; then
2982 AC_DEFINE(HAVE_SIGINFO_T)
2988 dnl Check for int16_t, int32_t, int64_t, int64, uint, uint_t, and uint16_t.
2989 dnl ========================================================
2990 AC_MSG_CHECKING(for int16_t)
2991 AC_CACHE_VAL(ac_cv_int16_t,
2992 [AC_TRY_COMPILE([#include <stdio.h>
2993 #include <sys/types.h>],
2995 [ac_cv_int16_t=true],
2996 [ac_cv_int16_t=false])])
2997 if test "$ac_cv_int16_t" = true ; then
2998 AC_DEFINE(HAVE_INT16_T)
3003 AC_MSG_CHECKING(for int32_t)
3004 AC_CACHE_VAL(ac_cv_int32_t,
3005 [AC_TRY_COMPILE([#include <stdio.h>
3006 #include <sys/types.h>],
3008 [ac_cv_int32_t=true],
3009 [ac_cv_int32_t=false])])
3010 if test "$ac_cv_int32_t" = true ; then
3011 AC_DEFINE(HAVE_INT32_T)
3016 AC_MSG_CHECKING(for int64_t)
3017 AC_CACHE_VAL(ac_cv_int64_t,
3018 [AC_TRY_COMPILE([#include <stdio.h>
3019 #include <sys/types.h>],
3021 [ac_cv_int64_t=true],
3022 [ac_cv_int64_t=false])])
3023 if test "$ac_cv_int64_t" = true ; then
3024 AC_DEFINE(HAVE_INT64_T)
3029 AC_MSG_CHECKING(for int64)
3030 AC_CACHE_VAL(ac_cv_int64,
3031 [AC_TRY_COMPILE([#include <stdio.h>
3032 #include <sys/types.h>],
3035 [ac_cv_int64=false])])
3036 if test "$ac_cv_int64" = true ; then
3037 AC_DEFINE(HAVE_INT64)
3042 AC_MSG_CHECKING(for uint)
3043 AC_CACHE_VAL(ac_cv_uint,
3044 [AC_TRY_COMPILE([#include <stdio.h>
3045 #include <sys/types.h>],
3048 [ac_cv_uint=false])])
3049 if test "$ac_cv_uint" = true ; then
3050 AC_DEFINE(HAVE_UINT)
3055 AC_MSG_CHECKING(for uint_t)
3056 AC_CACHE_VAL(ac_cv_uint_t,
3057 [AC_TRY_COMPILE([#include <stdio.h>
3058 #include <sys/types.h>],
3060 [ac_cv_uint_t=true],
3061 [ac_cv_uint_t=false])])
3062 if test "$ac_cv_uint_t" = true ; then
3063 AC_DEFINE(HAVE_UINT_T)
3068 AC_MSG_CHECKING(for uint16_t)
3069 AC_CACHE_VAL(ac_cv_uint16_t,
3070 [AC_TRY_COMPILE([#include <stdio.h>
3071 #include <sys/types.h>],
3072 [uint16_t foo = 0;],
3073 [ac_cv_uint16_t=true],
3074 [ac_cv_uint16_t=false])])
3075 if test "$ac_cv_uint16_t" = true ; then
3076 AC_DEFINE(HAVE_UINT16_T)
3082 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
3083 dnl are defined when compiling C++ but not C. Since the result of this
3084 dnl test is used only in C++, do it in C++.
3087 AC_MSG_CHECKING(for uname.domainname)
3088 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
3089 [AC_TRY_COMPILE([#include <sys/utsname.h>],
3090 [ struct utsname *res; char *domain;
3091 (void)uname(res); if (res != 0) { domain = res->domainname; } ],
3092 [ac_cv_have_uname_domainname_field=true],
3093 [ac_cv_have_uname_domainname_field=false])])
3095 if test "$ac_cv_have_uname_domainname_field" = "true"; then
3096 AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
3102 AC_MSG_CHECKING(for uname.__domainname)
3103 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
3104 [AC_TRY_COMPILE([#include <sys/utsname.h>],
3105 [ struct utsname *res; char *domain;
3106 (void)uname(res); if (res != 0) { domain = res->__domainname; } ],
3107 [ac_cv_have_uname_us_domainname_field=true],
3108 [ac_cv_have_uname_us_domainname_field=false])])
3110 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
3111 AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
3119 dnl Check for usable char16_t (2 bytes, unsigned)
3120 dnl (we might not need the unsignedness check anymore)
3121 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
3122 ac_cv_have_usable_char16_t,
3123 [AC_TRY_COMPILE([$configure_static_assert_macros],
3124 [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
3125 CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
3126 CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
3127 CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
3128 CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
3129 ac_cv_have_usable_char16_t="yes",
3130 ac_cv_have_usable_char16_t="no")])
3131 if test "$ac_cv_have_usable_char16_t" = "yes"; then
3132 AC_DEFINE(HAVE_CPP_CHAR16_T)
3136 dnl Check for usable wchar_t (2 bytes, unsigned)
3137 dnl (we really don't need the unsignedness check anymore)
3138 dnl ========================================================
3140 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
3141 ac_cv_have_usable_wchar_v2,
3142 [AC_TRY_COMPILE([#include <stddef.h>
3143 $configure_static_assert_macros],
3144 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3145 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3146 ac_cv_have_usable_wchar_v2="yes",
3147 ac_cv_have_usable_wchar_v2="no")])
3148 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
3149 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3150 HAVE_CPP_2BYTE_WCHAR_T=1
3151 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
3152 dnl This is really gcc-only
3153 dnl Do this test using CXX only since some versions of gcc
3154 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
3155 dnl only have short-wchar support for c++.
3156 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
3158 _SAVE_CXXFLAGS=$CXXFLAGS
3159 CXXFLAGS="$CXXFLAGS -fshort-wchar"
3161 AC_CACHE_CHECK(for compiler -fshort-wchar option,
3162 ac_cv_have_usable_wchar_option_v2,
3163 [AC_TRY_LINK([#include <stddef.h>
3164 $configure_static_assert_macros],
3165 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3166 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3167 ac_cv_have_usable_wchar_option_v2="yes",
3168 ac_cv_have_usable_wchar_option_v2="no")])
3170 if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
3171 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3172 HAVE_CPP_2BYTE_WCHAR_T=1
3173 if test "$OS_TARGET" = Android; then
3174 WCHAR_CFLAGS="-fshort-wchar -Wl,--no-wchar-size-warning"
3175 CXXFLAGS="$CXXFLAGS -Wl,--no-wchar-size-warning"
3176 CFLAGS="$CFLAGS -Wl,--no-wchar-size-warning"
3177 DSO_LDOPTS="$DSO_LDOPTS -Wl,--no-wchar-size-warning"
3179 WCHAR_CFLAGS="-fshort-wchar"
3182 CXXFLAGS=$_SAVE_CXXFLAGS
3188 dnl Check for .hidden assembler directive and visibility attribute.
3189 dnl Borrowed from glibc configure.in
3190 dnl ===============================================================
3191 if test "$GNU_CC"; then
3192 AC_CACHE_CHECK(for visibility(hidden) attribute,
3193 ac_cv_visibility_hidden,
3194 [cat > conftest.c <<EOF
3195 int foo __attribute__ ((visibility ("hidden"))) = 1;
3197 ac_cv_visibility_hidden=no
3198 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3199 if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3200 ac_cv_visibility_hidden=yes
3205 if test "$ac_cv_visibility_hidden" = "yes"; then
3206 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
3208 AC_CACHE_CHECK(for visibility(default) attribute,
3209 ac_cv_visibility_default,
3210 [cat > conftest.c <<EOF
3211 int foo __attribute__ ((visibility ("default"))) = 1;
3213 ac_cv_visibility_default=no
3214 if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3215 if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3216 ac_cv_visibility_default=yes
3221 if test "$ac_cv_visibility_default" = "yes"; then
3222 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
3224 AC_CACHE_CHECK(for visibility pragma support,
3225 ac_cv_visibility_pragma,
3226 [cat > conftest.c <<EOF
3227 #pragma GCC visibility push(hidden)
3229 #pragma GCC visibility push(default)
3230 int foo_default = 1;
3232 ac_cv_visibility_pragma=no
3233 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3234 if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
3235 if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
3236 ac_cv_visibility_pragma=yes
3242 if test "$ac_cv_visibility_pragma" = "yes"; then
3243 AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
3244 ac_cv_have_visibility_class_bug,
3245 [cat > conftest.c <<EOF
3246 #pragma GCC visibility push(hidden)
3247 struct __attribute__ ((visibility ("default"))) TestStruct {
3250 __attribute__ ((visibility ("default"))) void TestFunc() {
3254 ac_cv_have_visibility_class_bug=no
3255 if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3256 ac_cv_have_visibility_class_bug=yes
3258 if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
3259 ac_cv_have_visibility_class_bug=yes
3262 rm -rf conftest.{c,S}
3265 AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
3266 ac_cv_have_visibility_builtin_bug,
3267 [cat > conftest.c <<EOF
3268 #pragma GCC visibility push(hidden)
3269 #pragma GCC visibility push(default)
3271 #pragma GCC visibility pop
3273 __attribute__ ((visibility ("default"))) void Func() {
3275 memset(c, 0, sizeof(c));
3278 ac_cv_have_visibility_builtin_bug=no
3279 if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3280 ac_cv_have_visibility_builtin_bug=yes
3282 if test `grep -c "@PLT" conftest.S` = 0; then
3283 ac_cv_visibility_builtin_bug=yes
3286 rm -f conftest.{c,S}
3288 if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
3289 "$ac_cv_have_visibility_class_bug" = "no"; then
3290 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
3291 WRAP_SYSTEM_INCLUDES=1
3292 STL_FLAGS='-I$(DIST)/stl_wrappers'
3295 VISIBILITY_FLAGS='-fvisibility=hidden'
3296 fi # have visibility pragma bug
3297 fi # have visibility pragma
3298 fi # have visibility(default) attribute
3299 fi # have visibility(hidden) attribute
3302 # visibility hidden flag for Sun Studio on Solaris
3303 if test "$SOLARIS_SUNPRO_CC"; then
3304 VISIBILITY_FLAGS='-xldscope=hidden'
3305 fi # Sun Studio on Solaris
3307 AC_SUBST(WRAP_SYSTEM_INCLUDES)
3308 AC_SUBST(VISIBILITY_FLAGS)
3310 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
3311 dnl ========================================================
3312 if test "$GNU_CC"; then
3313 CFLAGS_save="${CFLAGS}"
3314 CFLAGS="${CFLAGS} -Werror"
3315 AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
3316 ac_cv_force_align_arg_pointer,
3317 [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
3319 ac_cv_force_align_arg_pointer="yes",
3320 ac_cv_force_align_arg_pointer="no")])
3321 CFLAGS="${CFLAGS_save}"
3322 if test "$ac_cv_force_align_arg_pointer" = "yes"; then
3323 HAVE_GCC_ALIGN_ARG_POINTER=1
3325 HAVE_GCC_ALIGN_ARG_POINTER=
3328 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
3330 dnl Checks for header files.
3331 dnl ========================================================
3333 case "$target_os" in
3335 # for stuff like -lXshm
3336 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3339 AC_CHECK_HEADERS(sys/byteorder.h compat.h getopt.h)
3340 AC_CHECK_HEADERS(sys/bitypes.h memory.h unistd.h)
3341 AC_CHECK_HEADERS(gnu/libc-version.h nl_types.h)
3342 AC_CHECK_HEADERS(malloc.h)
3343 AC_CHECK_HEADERS(X11/XKBlib.h)
3344 AC_CHECK_HEADERS(io.h)
3346 dnl These are all the places some variant of statfs can be hiding.
3347 AC_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3350 AC_CHECK_HEADERS(sys/quota.h)
3351 AC_CHECK_HEADERS(linux/quota.h)
3353 dnl Try for MMX support
3354 dnl NB - later gcc versions require -mmmx for this header to be successfully
3355 dnl included (or another option which implies it, such as -march=pentium-mmx)
3356 AC_CHECK_HEADERS(mmintrin.h)
3358 dnl Check whether the compiler supports the new-style C++ standard
3359 dnl library headers (i.e. <new>) or needs the old "new.h"
3362 AC_CHECK_HEADER(new, [NEW_H=new])
3363 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3366 AC_ARG_ENABLE(dtrace,
3367 [ --enable-dtrace build with dtrace support if available (default=no)],
3368 [enable_dtrace="yes"],)
3369 if test "x$enable_dtrace" = "xyes"; then
3370 AC_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3371 if test -n "$HAVE_DTRACE"; then
3372 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3374 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3377 AC_SUBST(HAVE_DTRACE)
3383 AC_CHECK_HEADERS(sys/cdefs.h)
3387 dnl Checks for libraries.
3388 dnl ========================================================
3393 AC_CHECK_LIB(c_r, gethostbyname_r)
3397 dnl We don't want to link with libdl even if it's present on OS X, since
3398 dnl it's not used and not part of the default installation.
3399 dnl The same goes for BeOS. OS/2 has dlfcn in libc.
3400 dnl We don't want to link against libm or libpthread on Darwin since
3401 dnl they both are just symlinks to libSystem and explicitly linking
3402 dnl against libSystem causes issues when debugging (see bug 299601).
3411 AC_CHECK_LIB(m, atan)
3412 AC_CHECK_LIB(dl, dlopen,
3413 AC_CHECK_HEADER(dlfcn.h,
3415 AC_DEFINE(HAVE_LIBDL)))
3419 _SAVE_CFLAGS="$CFLAGS"
3420 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3421 AC_CHECK_FUNCS(dladdr)
3422 CFLAGS="$_SAVE_CFLAGS"
3424 if test ! "$GNU_CXX"; then
3428 AC_CHECK_LIB(C_r, demangle)
3431 AC_CHECK_LIB(C, demangle)
3436 dnl OS/2 has socket in libc.
3441 AC_CHECK_LIB(socket, socket)
3444 dnl ========================================================
3445 dnl Check whether we can compile code for Core Text
3446 dnl (available on Mac OS X 10.5 or later)
3447 dnl ========================================================
3450 AC_MSG_CHECKING([for Core Text])
3451 AC_TRY_COMPILE([#include <ApplicationServices/ApplicationServices.h>],
3452 [CTLineRef lineRef;],
3453 ac_cv_have_core_text="yes",
3454 ac_cv_have_core_text="no")
3455 AC_MSG_RESULT([$ac_cv_have_core_text])
3457 if test "$ac_cv_have_core_text" = "no"; then
3458 AC_MSG_ERROR([Core Text is required (available on Mac OS X 10.5 or later).])
3464 XLIBS="$X_EXTRA_LIBS"
3466 dnl ========================================================
3467 dnl Checks for X libraries.
3468 dnl Ordering is important.
3469 dnl Xt is dependent upon SM as of X11R6
3470 dnl ========================================================
3471 if test "$no_x" = "yes"; then
3474 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3475 XLIBS="-lX11 $XLIBS"
3476 _SAVE_LDFLAGS="$LDFLAGS"
3477 LDFLAGS="$XLDFLAGS $LDFLAGS"
3478 AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3479 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3480 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3481 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3483 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3484 unset ac_cv_lib_Xt_XtFree
3485 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3486 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
3487 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3488 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3491 # AIX needs the motif library linked before libXt to prevent
3492 # crashes in plugins linked against Motif - Bug #98892
3493 case "${target_os}" in
3495 XT_LIBS="-lXm $XT_LIBS"
3499 dnl ========================================================
3500 dnl = Check for XShm
3501 dnl ========================================================
3502 AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3504 AC_CHECK_HEADER(X11/extensions/XShm.h)
3505 if test "$ac_cv_header_X11_extensions_XShm_h" = "yes" &&
3506 test -n "$_HAVE_XSHM_XEXT"; then
3507 AC_DEFINE(HAVE_XSHM)
3510 dnl ========================================================
3512 dnl ========================================================
3513 AC_CHECK_HEADER(X11/extensions/scrnsaver.h,
3514 AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
3515 [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
3516 AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
3518 dnl ========================================================
3520 dnl ========================================================
3521 AC_CHECK_LIB(XIE, XieFloGeometry, [MOZ_XIE_LIBS="-lXIE"],,
3523 AC_CHECK_HEADER(X11/extensions/XIElib.h)
3525 if test "$MOZ_XIE_LIBS"; then
3526 dnl ====================================================
3527 dnl = If XIE is present and is desired, turn it on
3528 dnl ====================================================
3538 LDFLAGS="$_SAVE_LDFLAGS"
3540 dnl ========================================================
3541 dnl = Check for freetype2 and its functionality
3542 dnl ========================================================
3543 AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3545 if test "$_HAVE_FREETYPE2"; then
3547 _SAVE_CFLAGS="$CFLAGS"
3548 LIBS="$LIBS $FT2_LIBS"
3549 CFLAGS="$CFLAGS $FT2_CFLAGS"
3551 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3552 ac_cv_member_FT_Bitmap_Size_y_ppem,
3553 [AC_TRY_COMPILE([#include <ft2build.h>
3554 #include FT_FREETYPE_H],
3556 if (sizeof s.y_ppem) return 0;
3558 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3559 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3560 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3561 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3563 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3565 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3566 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3567 [FT_Bitmap_Size structure includes y_ppem field])
3569 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3572 CFLAGS="$_SAVE_CFLAGS"
3584 AC_MSG_CHECKING(for ARM SIMD support in compiler)
3586 [asm("uqadd8 r1, r1, r2");],
3587 result="yes", result="no")
3588 AC_MSG_RESULT("$result")
3589 if test "$result" = "yes"; then
3590 AC_DEFINE(HAVE_ARM_SIMD)
3593 AC_SUBST(HAVE_ARM_SIMD)
3595 AC_MSG_CHECKING(for ARM NEON support in compiler)
3596 _SAVE_CFLAGS="$CFLAGS"
3597 if test "$GNU_CC"; then
3598 # gcc needs -mfpu=neon to recognize NEON instructions
3599 CFLAGS="$CFLAGS -mfpu=neon -mfloat-abi=softfp"
3602 [asm("vadd.i8 d0, d0, d0");],
3603 result="yes", result="no")
3604 AC_MSG_RESULT("$result")
3605 if test "$result" = "yes"; then
3606 AC_DEFINE(HAVE_ARM_NEON)
3609 CFLAGS="$_SAVE_CFLAGS"
3610 AC_SUBST(HAVE_ARM_NEON)
3612 dnl ========================================================
3613 dnl = pthread support
3614 dnl = Start by checking whether the system support pthreads
3615 dnl ========================================================
3616 case "$target_os" in
3621 MOZ_CHECK_PTHREADS(pthreads,
3622 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3623 MOZ_CHECK_PTHREADS(pthread,
3624 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3625 MOZ_CHECK_PTHREADS(c_r,
3626 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3627 MOZ_CHECK_PTHREADS(c,
3636 dnl ========================================================
3637 dnl Check the command line for --with-pthreads
3638 dnl ========================================================
3639 MOZ_ARG_WITH_BOOL(pthreads,
3640 [ --with-pthreads Force use of system pthread library with NSPR ],
3641 [ if test "$USE_PTHREADS"x = x; then
3642 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3648 dnl ========================================================
3649 dnl Do the platform specific pthread hackery
3650 dnl ========================================================
3651 if test "$USE_PTHREADS"x != x
3654 dnl See if -pthread is supported.
3657 ac_cv_have_dash_pthread=no
3658 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3659 echo 'int main() { return 0; }' | cat > conftest.c
3660 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3661 if test $? -eq 0; then
3662 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3663 ac_cv_have_dash_pthread=yes
3664 case "$target_os" in
3666 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3669 CFLAGS="$CFLAGS -pthread"
3670 CXXFLAGS="$CXXFLAGS -pthread"
3676 AC_MSG_RESULT($ac_cv_have_dash_pthread)
3679 dnl See if -pthreads is supported.
3681 ac_cv_have_dash_pthreads=no
3682 if test "$ac_cv_have_dash_pthread" = "no"; then
3683 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3684 echo 'int main() { return 0; }' | cat > conftest.c
3685 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3686 if test $? -eq 0; then
3687 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3688 ac_cv_have_dash_pthreads=yes
3689 CFLAGS="$CFLAGS -pthreads"
3690 CXXFLAGS="$CXXFLAGS -pthreads"
3694 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3699 AC_DEFINE(_REENTRANT)
3700 AC_DEFINE(_THREAD_SAFE)
3701 dnl -pthread links in -lc_r, so don't specify it explicitly.
3702 if test "$ac_cv_have_dash_pthread" = "yes"; then
3703 _PTHREAD_LDFLAGS="-pthread"
3705 _PTHREAD_LDFLAGS="-lc_r"
3709 *-*-openbsd*|*-*-bsdi*)
3710 AC_DEFINE(_REENTRANT)
3711 AC_DEFINE(_THREAD_SAFE)
3712 dnl -pthread links in -lc_r, so don't specify it explicitly.
3713 if test "$ac_cv_have_dash_pthread" = "yes"; then
3714 _PTHREAD_LDFLAGS="-pthread"
3718 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3719 AC_DEFINE(_REENTRANT)
3723 AC_DEFINE(_REENTRANT)
3727 AC_DEFINE(_REENTRANT)
3731 AC_DEFINE(_REENTRANT)
3735 AC_DEFINE(_REENTRANT)
3739 AC_DEFINE(_REENTRANT)
3740 if test "$SOLARIS_SUNPRO_CC"; then
3741 CFLAGS="$CFLAGS -mt"
3742 CXXFLAGS="$CXXFLAGS -mt"
3746 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3749 dnl ========================================================
3750 dnl See if mmap sees writes
3751 dnl For cross compiling, just define it as no, which is a safe default
3752 dnl ========================================================
3753 AC_MSG_CHECKING(whether mmap() sees write()s)
3759 #include <sys/mman.h>
3760 #include <sys/types.h>
3761 #include <sys/stat.h>
3764 char fname[] = "conftest.file";
3765 char zbuff[1024]; /* Fractional page is probably worst case */
3772 fd = open(fname, O_RDWR | O_CREAT, 0660);
3775 write(fd, zbuff, sizeof(zbuff));
3776 lseek(fd, 0, SEEK_SET);
3777 map = (char*)mmap(0, sizeof(zbuff), PROT_READ, MAP_SHARED, fd, 0);
3778 if(map==(char*)-1) return 2;
3779 for(i=0; fname[i]; i++) {
3780 int rc = write(fd, &fname[i], 1);
3781 if(map[i]!=fname[i]) return 4;
3788 AC_TRY_RUN($mmap_test_prog , result="yes", result="no", result="yes")
3790 AC_MSG_RESULT("$result")
3792 if test "$result" = "no"; then
3793 AC_DEFINE(MMAP_MISSES_WRITES)
3797 dnl Checks for library functions.
3798 dnl ========================================================
3799 AC_PROG_GCC_TRADITIONAL
3801 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3802 AC_CHECK_FUNCS(flockfile getpagesize)
3803 AC_CHECK_FUNCS(localtime_r strtok_r)
3805 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock, and -lrt
3806 _SAVE_LDFLAGS=$LDFLAGS
3807 LDFLAGS="$LDFLAGS -lrt"
3808 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC) and -lrt,
3809 ac_cv_have_clock_monotonic,
3810 [AC_TRY_LINK([#include <time.h>],
3811 [ struct timespec ts;
3812 clock_gettime(CLOCK_MONOTONIC, &ts); ],
3813 ac_cv_have_clock_monotonic=yes,
3814 ac_cv_have_clock_monotonic=no)])
3815 LDFLAGS=$_SAVE_LDFLAGS
3816 if test "$ac_cv_have_clock_monotonic" = "yes"; then
3817 HAVE_CLOCK_MONOTONIC=1
3819 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3820 AC_SUBST(HAVE_CLOCK_MONOTONIC)
3821 AC_SUBST(REALTIME_LIBS)
3824 dnl check for wcrtomb/mbrtowc
3825 dnl =======================================================================
3826 if test -z "$MACOS_DEPLOYMENT_TARGET" -o "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3829 AC_CACHE_CHECK(for wcrtomb,
3831 [AC_TRY_LINK([#include <wchar.h>],
3832 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3833 ac_cv_have_wcrtomb="yes",
3834 ac_cv_have_wcrtomb="no")])
3835 if test "$ac_cv_have_wcrtomb" = "yes"; then
3836 AC_DEFINE(HAVE_WCRTOMB)
3838 AC_CACHE_CHECK(for mbrtowc,
3840 [AC_TRY_LINK([#include <wchar.h>],
3841 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3842 ac_cv_have_mbrtowc="yes",
3843 ac_cv_have_mbrtowc="no")])
3844 if test "$ac_cv_have_mbrtowc" = "yes"; then
3845 AC_DEFINE(HAVE_MBRTOWC)
3852 ac_cv_func_res_ninit,
3855 #define _BSD_SOURCE 1
3859 [int foo = res_ninit(&_res);],
3860 [ac_cv_func_res_ninit=yes],
3861 [ac_cv_func_res_ninit=no])
3864 if test "$ac_cv_func_res_ninit" = "yes"; then
3865 AC_DEFINE(HAVE_RES_NINIT)
3866 dnl must add the link line we do something as foolish as this... dougt
3868 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3869 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3874 [for gnu_get_libc_version()],
3875 ac_cv_func_gnu_get_libc_version,
3877 #ifdef HAVE_GNU_LIBC_VERSION_H
3878 #include <gnu/libc-version.h>
3881 [const char *glibc_version = gnu_get_libc_version();],
3882 [ac_cv_func_gnu_get_libc_version=yes],
3883 [ac_cv_func_gnu_get_libc_version=no]
3887 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3888 AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3892 os2*|msvc*|mks*|cygwin*|mingw*|darwin*|wince*|winmo*|beos*)
3896 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3897 AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3898 AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3900 LIBS="$LIBS $_ICONV_LIBS"
3909 iconv_t h = iconv_open("", "");
3910 iconv(h, NULL, NULL, NULL, NULL);
3913 [ac_cv_func_iconv=yes],
3914 [ac_cv_func_iconv=no]
3917 if test "$ac_cv_func_iconv" = "yes"; then
3918 AC_DEFINE(HAVE_ICONV)
3919 DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3920 LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3921 LIBICONV="$_ICONV_LIBS"
3923 [for iconv() with const input],
3924 ac_cv_func_const_iconv,
3930 const char *input = "testing";
3931 iconv_t h = iconv_open("", "");
3932 iconv(h, &input, NULL, NULL, NULL);
3935 [ac_cv_func_const_iconv=yes],
3936 [ac_cv_func_const_iconv=no]
3939 if test "$ac_cv_func_const_iconv" = "yes"; then
3940 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3952 dnl **********************
3953 dnl *** va_copy checks ***
3954 dnl **********************
3955 dnl we currently check for all three va_copy possibilities, so we get
3956 dnl all results in config.log for bug reports.
3957 AC_MSG_CHECKING(for an implementation of va_copy())
3958 AC_CACHE_VAL(ac_cv_va_copy,[
3961 void f (int i, ...) {
3962 va_list args1, args2;
3963 va_start (args1, i);
3964 va_copy (args2, args1);
3965 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3967 va_end (args1); va_end (args2);
3969 int main() { f (0, 42); return 0; }],
3975 AC_MSG_RESULT($ac_cv_va_copy)
3976 AC_MSG_CHECKING(for an implementation of __va_copy())
3977 AC_CACHE_VAL(ac_cv___va_copy,[
3980 void f (int i, ...) {
3981 va_list args1, args2;
3982 va_start (args1, i);
3983 __va_copy (args2, args1);
3984 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3986 va_end (args1); va_end (args2);
3988 int main() { f (0, 42); return 0; }],
3989 ac_cv___va_copy=yes,
3994 AC_MSG_RESULT($ac_cv___va_copy)
3995 AC_MSG_CHECKING(whether va_lists can be copied by value)
3996 AC_CACHE_VAL(ac_cv_va_val_copy,[
3999 void f (int i, ...) {
4000 va_list args1, args2;
4001 va_start (args1, i);
4003 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
4005 va_end (args1); va_end (args2);
4007 int main() { f (0, 42); return 0; }],
4008 ac_cv_va_val_copy=yes,
4009 ac_cv_va_val_copy=no,
4010 ac_cv_va_val_copy=yes
4013 if test "x$ac_cv_va_copy" = "xyes"; then
4014 AC_DEFINE(VA_COPY, va_copy)
4015 AC_DEFINE(HAVE_VA_COPY)
4016 elif test "x$ac_cv___va_copy" = "xyes"; then
4017 AC_DEFINE(VA_COPY, __va_copy)
4018 AC_DEFINE(HAVE_VA_COPY)
4021 if test "x$ac_cv_va_val_copy" = "xno"; then
4022 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
4024 AC_MSG_RESULT($ac_cv_va_val_copy)
4026 dnl Check for dll-challenged libc's.
4027 dnl This check is apparently only needed for Linux.
4030 dnl ===================================================================
4033 rm -rf conftest* _conftest
4035 cat >> conftest.C <<\EOF
4040 void __dump_link_map(void) {
4041 struct link_map *map = _dl_loaded;
4042 while (NULL != map) {printf("0x%08x %s\n", map->l_addr, map->l_name); map = map->l_next;}
4045 dlopen("./conftest1.so",RTLD_LAZY);
4046 dlopen("./../_conftest/conftest1.so",RTLD_LAZY);
4047 dlopen("CURDIR/_conftest/conftest1.so",RTLD_LAZY);
4048 dlopen("CURDIR/_conftest/../_conftest/conftest1.so",RTLD_LAZY);
4052 /* _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).*/
4053 int main() { printf("./conftest1.so\n"); }
4057 $PERL -p -i -e "s/CURDIR/\$ENV{_curdir}/g;" conftest.C
4059 cat >> conftest1.C <<\EOF
4061 void foo(void) {printf("foo in dll called\n");}
4063 ${CXX-g++} -fPIC -c -g conftest1.C
4064 ${CXX-g++} -shared -Wl,-h -Wl,conftest1.so -o conftest1.so conftest1.o
4065 ${CXX-g++} -g conftest.C -o conftest -ldl
4066 cp -f conftest1.so conftest _conftest
4068 if test `./conftest | grep conftest1.so | wc -l` -gt 1
4071 echo "*** Your libc has a bug that can result in loading the same dynamic"
4072 echo "*** library multiple times. This bug is known to be fixed in glibc-2.0.7-32"
4073 echo "*** or later. However, if you choose not to upgrade, the only effect"
4074 echo "*** will be excessive memory usage at runtime."
4078 rm -rf conftest* _conftest
4079 dnl ===================================================================
4083 dnl ===================================================================
4084 dnl ========================================================
4085 dnl Put your C++ language/feature checks below
4086 dnl ========================================================
4091 if test "$GNU_CC"; then
4092 if test "$CPU_ARCH" = "arm" ; then
4093 AC_CACHE_CHECK(for ARM EABI,
4097 #if defined(__ARM_EABI__)
4100 #error Not ARM EABI.
4103 ac_cv_gcc_arm_eabi="yes",
4104 ac_cv_gcc_arm_eabi="no")])
4105 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
4107 ARM_ABI_PREFIX=eabi-
4109 ARM_ABI_PREFIX=oabi-
4113 AC_CACHE_CHECK(for gcc 3.0 ABI,
4114 ac_cv_gcc_three_abi,
4117 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 /* G++ V3 ABI */
4123 ac_cv_gcc_three_abi="yes",
4124 ac_cv_gcc_three_abi="no")])
4125 if test "$ac_cv_gcc_three_abi" = "yes"; then
4126 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
4129 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc2}"
4132 AC_SUBST(HAVE_GCC3_ABI)
4135 AC_CACHE_CHECK(for C++ \"explicit\" keyword,
4137 [AC_TRY_COMPILE(class X {
4138 public: explicit X(int i) : i_(i) {}
4142 ac_cv_cpp_explicit=yes,
4143 ac_cv_cpp_explicit=no)])
4144 if test "$ac_cv_cpp_explicit" = yes ; then
4145 AC_DEFINE(HAVE_CPP_EXPLICIT)
4148 AC_CACHE_CHECK(for C++ \"typename\" keyword,
4150 [AC_TRY_COMPILE(class param {
4152 typedef unsigned long num_type;
4155 template <class T> class tplt {
4157 typedef typename T::num_type t_num_type;
4158 t_num_type foo(typename T::num_type num) {
4164 ac_cv_cpp_typename=yes,
4165 ac_cv_cpp_typename=no)])
4166 if test "$ac_cv_cpp_typename" = yes ; then
4167 AC_DEFINE(HAVE_CPP_TYPENAME)
4170 dnl Check for support of modern template specialization syntax
4171 dnl Test code and requirement from scc@netscape.com.
4172 dnl Autoconf cut-and-paste job by waterson@netscape.com
4173 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
4174 ac_cv_cpp_modern_specialize_template_syntax,
4175 [AC_TRY_COMPILE(template <class T> struct X { int a; };
4177 template <> struct X<Y> { double a; };,
4180 ac_cv_cpp_modern_specialize_template_syntax=yes,
4181 ac_cv_cpp_modern_specialize_template_syntax=no)])
4182 if test "$ac_cv_cpp_modern_specialize_template_syntax" = yes ; then
4183 AC_DEFINE(HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX)
4187 dnl Some compilers support only full specialization, and some don't.
4188 AC_CACHE_CHECK(whether partial template specialization works,
4189 ac_cv_cpp_partial_specialization,
4190 [AC_TRY_COMPILE(template <class T> class Foo {};
4191 template <class T> class Foo<T*> {};,
4193 ac_cv_cpp_partial_specialization=yes,
4194 ac_cv_cpp_partial_specialization=no)])
4195 if test "$ac_cv_cpp_partial_specialization" = yes ; then
4196 AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
4199 dnl Some compilers have limited support for operators with templates;
4200 dnl specifically, it is necessary to define derived operators when a base
4201 dnl class's operator declaration should suffice.
4202 AC_CACHE_CHECK(whether operators must be re-defined for templates derived from templates,
4203 ac_cv_need_derived_template_operators,
4204 [AC_TRY_COMPILE([template <class T> class Base { };
4206 Base<T> operator+(const Base<T>& lhs, const Base<T>& rhs) { return lhs; }
4207 template <class T> class Derived : public Base<T> { };],
4208 [Derived<char> a, b;
4209 Base<char> c = a + b;
4211 ac_cv_need_derived_template_operators=no,
4212 ac_cv_need_derived_template_operators=yes)])
4213 if test "$ac_cv_need_derived_template_operators" = yes ; then
4214 AC_DEFINE(NEED_CPP_DERIVED_TEMPLATE_OPERATORS)
4218 dnl Some compilers have trouble detecting that a template class
4219 dnl that derives from another template is actually an instance
4220 dnl of the base class. This test checks for that.
4221 AC_CACHE_CHECK(whether we need to cast a derived template to pass as its base class,
4222 ac_cv_need_cpp_template_cast_to_base,
4223 [AC_TRY_COMPILE([template <class T> class Base { };
4224 template <class T> class Derived : public Base<T> { };
4225 template <class T> int foo(const Base<T>&) { return 0; }],
4226 [Derived<char> bar; return foo(bar);],
4227 ac_cv_need_cpp_template_cast_to_base=no,
4228 ac_cv_need_cpp_template_cast_to_base=yes)])
4229 if test "$ac_cv_need_cpp_template_cast_to_base" = yes ; then
4230 AC_DEFINE(NEED_CPP_TEMPLATE_CAST_TO_BASE)
4233 dnl Some compilers have trouble resolving the ambiguity between two
4234 dnl functions whose arguments differ only by cv-qualifications.
4235 AC_CACHE_CHECK(whether the compiler can resolve const ambiguities for templates,
4236 ac_cv_can_resolve_const_ambiguity,
4238 template <class T> class ptrClass {
4242 template <class T> T* a(ptrClass<T> *arg) {
4247 const T* a(const ptrClass<T> *arg) {
4253 ac_cv_can_resolve_const_ambiguity=yes,
4254 ac_cv_can_resolve_const_ambiguity=no)])
4255 if test "$ac_cv_can_resolve_const_ambiguity" = no ; then
4256 AC_DEFINE(CANT_RESOLVE_CPP_CONST_AMBIGUITY)
4260 dnl We don't do exceptions on unix. The only reason this used to be here
4261 dnl is that mozilla/xpcom/tests/TestCOMPtr.cpp has a test which uses
4262 dnl exceptions. But, we turn exceptions off by default and this test breaks.
4263 dnl So im commenting this out until someone writes some artificial
4264 dnl intelligence to detect not only if the compiler has exceptions, but if
4265 dnl they are enabled as well.
4267 dnl AC_CACHE_CHECK(for C++ \"exceptions\",
4268 dnl ac_cv_cpp_exceptions,
4269 dnl [AC_TRY_COMPILE(class X { public: X() {} };
4270 dnl static void F() { throw X(); },
4271 dnl try { F(); } catch(X & e) { },
4272 dnl ac_cv_cpp_exceptions=yes,
4273 dnl ac_cv_cpp_exceptions=no)])
4274 dnl if test $ac_cv_cpp_exceptions = yes ; then
4275 dnl AC_DEFINE(HAVE_CPP_EXCEPTIONS)
4278 dnl Some compilers have marginal |using| support; for example, gcc-2.7.2.3
4279 dnl supports it well enough to allow us to use it to change access, but not
4280 dnl to resolve ambiguity. The next two tests determine how well the |using|
4281 dnl keyword is supported.
4283 dnl Check to see if we can change access with |using|. Test both a
4284 dnl legal and an illegal example.
4285 AC_CACHE_CHECK(whether the C++ \"using\" keyword can change access,
4286 ac_cv_cpp_access_changing_using2,
4288 class A { protected: int foo() { return 0; } };
4289 class B : public A { public: using A::foo; };,
4290 B b; return b.foo();,
4292 class A { public: int foo() { return 1; } };
4293 class B : public A { private: using A::foo; };,
4294 B b; return b.foo();,
4295 ac_cv_cpp_access_changing_using2=no,
4296 ac_cv_cpp_access_changing_using2=yes)],
4297 ac_cv_cpp_access_changing_using2=no)])
4298 if test "$ac_cv_cpp_access_changing_using2" = yes ; then
4299 AC_DEFINE(HAVE_CPP_ACCESS_CHANGING_USING)
4302 dnl Check to see if we can resolve ambiguity with |using|.
4303 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
4304 ac_cv_cpp_ambiguity_resolving_using,
4305 [AC_TRY_COMPILE(class X {
4306 public: int go(const X&) {return 3;}
4307 int jo(const X&) {return 3;}
4309 class Y : public X {
4310 public: int go(int) {return 2;}
4311 int jo(int) {return 2;}
4313 private: using X::go;
4316 ac_cv_cpp_ambiguity_resolving_using=yes,
4317 ac_cv_cpp_ambiguity_resolving_using=no)])
4318 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
4319 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
4322 dnl Check to see if the |std| namespace is supported. If so, we'll want
4323 dnl to qualify any standard library calls with "std::" to ensure that
4324 dnl those functions can be resolved.
4325 AC_CACHE_CHECK(for \"std::\" namespace,
4326 ac_cv_cpp_namespace_std,
4327 [AC_TRY_COMPILE([#include <algorithm>],
4328 [return std::min(0, 1);],
4329 ac_cv_cpp_namespace_std=yes,
4330 ac_cv_cpp_namespace_std=no)])
4331 if test "$ac_cv_cpp_namespace_std" = yes ; then
4332 AC_DEFINE(HAVE_CPP_NAMESPACE_STD)
4335 dnl Older compilers are overly ambitious with respect to using the standard
4336 dnl template library's |operator!=()| when |operator==()| is defined. In
4337 dnl which case, defining |operator!=()| in addition to |operator==()| causes
4338 dnl ambiguity at compile-time. This test checks for that case.
4339 AC_CACHE_CHECK(whether standard template operator!=() is ambiguous,
4340 ac_cv_cpp_unambiguous_std_notequal,
4341 [AC_TRY_COMPILE([#include <algorithm>
4343 int operator==(const T1&, const T1&) { return 0; }
4344 int operator!=(const T1&, const T1&) { return 0; }],
4345 [T1 a,b; return a != b;],
4346 ac_cv_cpp_unambiguous_std_notequal=unambiguous,
4347 ac_cv_cpp_unambiguous_std_notequal=ambiguous)])
4348 if test "$ac_cv_cpp_unambiguous_std_notequal" = unambiguous ; then
4349 AC_DEFINE(HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL)
4353 AC_CACHE_CHECK(for C++ reinterpret_cast,
4354 ac_cv_cpp_reinterpret_cast,
4355 [AC_TRY_COMPILE(struct X { int i; };
4356 struct Y { int i; };,
4357 X x; X*const z = &x;Y*y = reinterpret_cast<Y*>(z);,
4358 ac_cv_cpp_reinterpret_cast=yes,
4359 ac_cv_cpp_reinterpret_cast=no)])
4360 if test "$ac_cv_cpp_reinterpret_cast" = yes ; then
4361 AC_DEFINE(HAVE_CPP_NEW_CASTS)
4364 dnl See if a dynamic_cast to void* gives the most derived object.
4365 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
4366 ac_cv_cpp_dynamic_cast_void_ptr,
4367 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
4368 class Y { int j; public: virtual ~Y() { } };
4369 class Z : public X, public Y { int k; };
4375 return !((((void*)&mdo != (void*)subx) &&
4376 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
4377 (((void*)&mdo != (void*)suby) &&
4378 ((void*)&mdo == dynamic_cast<void*>(suby))));
4380 ac_cv_cpp_dynamic_cast_void_ptr=yes,
4381 ac_cv_cpp_dynamic_cast_void_ptr=no,
4382 ac_cv_cpp_dynamic_cast_void_ptr=no)])
4383 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
4384 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
4388 dnl note that this one is reversed - if the test fails, then
4389 dnl we require implementations of unused virtual methods. Which
4390 dnl really blows because it means we'll have useless vtable
4392 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
4393 ac_cv_cpp_unused_required,
4394 [AC_TRY_LINK(class X {private: virtual void never_called();};,
4396 ac_cv_cpp_unused_required=no,
4397 ac_cv_cpp_unused_required=yes)])
4398 if test "$ac_cv_cpp_unused_required" = yes ; then
4399 AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
4403 dnl Some compilers have trouble comparing a constant reference to a templatized
4404 dnl class to zero, and require an explicit operator==() to be defined that takes
4405 dnl an int. This test separates the strong from the weak.
4407 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
4408 ac_cv_trouble_comparing_to_zero,
4409 [AC_TRY_COMPILE([#include <algorithm>
4410 template <class T> class Foo {};
4412 template <class T> int operator==(const T2*, const T&) { return 0; }
4413 template <class T> int operator!=(const T2*, const T&) { return 0; }],
4414 [Foo<int> f; return (0 != f);],
4415 ac_cv_trouble_comparing_to_zero=no,
4416 ac_cv_trouble_comparing_to_zero=yes)])
4417 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
4418 AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
4421 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
4422 _SAVE_LDFLAGS=$LDFLAGS
4423 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS"
4424 AC_CACHE_CHECK(for __thread keyword for TLS variables,
4425 ac_cv_thread_keyword,
4426 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
4427 [return tlsIsMainThread;],
4428 ac_cv_thread_keyword=yes,
4429 ac_cv_thread_keyword=no)])
4430 LDFLAGS=$_SAVE_LDFLAGS
4431 if test "$ac_cv_thread_keyword" = yes; then
4432 # mips builds fail with TLS variables because of a binutils bug.
4442 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
4447 dnl Check for the existence of various allocation headers/functions
4450 AC_CHECK_HEADER(malloc.h, [MALLOC_H=malloc.h])
4451 if test "$MALLOC_H" = ""; then
4452 AC_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
4453 if test "$MALLOC_H" = ""; then
4454 AC_CHECK_HEADER(sys/malloc.h, [MALLOC_H=sys/malloc.h])
4457 if test "$MALLOC_H" != ""; then
4458 AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
4461 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
4462 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
4464 dnl See if compiler supports some gcc-style attributes
4466 AC_CACHE_CHECK(for __attribute__((always_inline)),
4467 ac_cv_attribute_always_inline,
4469 [inline void f(void) __attribute__((always_inline));],
4470 ac_cv_attribute_always_inline=yes,
4471 ac_cv_attribute_always_inline=no)])
4473 AC_CACHE_CHECK(for __attribute__((malloc)),
4474 ac_cv_attribute_malloc,
4476 [void* f(int) __attribute__((malloc));],
4477 ac_cv_attribute_malloc=yes,
4478 ac_cv_attribute_malloc=no)])
4480 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
4481 ac_cv_attribute_warn_unused,
4483 [int f(void) __attribute__((warn_unused_result));],
4484 ac_cv_attribute_warn_unused=yes,
4485 ac_cv_attribute_warn_unused=no)])
4487 AC_CACHE_CHECK(for __attribute__((noreturn)),
4488 ac_cv_attribute_noreturn,
4490 [void f(void) __attribute__((noreturn));],
4491 ac_cv_attribute_noreturn=yes,
4492 ac_cv_attribute_noreturn=no)])
4494 dnl End of C++ language/feature checks
4497 dnl ========================================================
4498 dnl = Internationalization checks
4499 dnl ========================================================
4501 dnl Internationalization and Locale support is different
4502 dnl on various UNIX platforms. Checks for specific i18n
4503 dnl features go here.
4505 dnl check for LC_MESSAGES
4506 AC_CACHE_CHECK(for LC_MESSAGES,
4507 ac_cv_i18n_lc_messages,
4508 [AC_TRY_COMPILE([#include <locale.h>],
4509 [int category = LC_MESSAGES;],
4510 ac_cv_i18n_lc_messages=yes,
4511 ac_cv_i18n_lc_messages=no)])
4512 if test "$ac_cv_i18n_lc_messages" = yes; then
4513 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4516 AC_HAVE_FUNCS(localeconv)
4518 fi # SKIP_COMPILER_CHECKS
4521 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4522 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4525 dnl Mozilla specific options
4526 dnl ========================================================
4527 dnl The macros used for command line options
4528 dnl are defined in build/autoconf/altoptions.m4.
4530 dnl If the compiler supports these attributes, define them as
4531 dnl convenience macros.
4532 if test "$ac_cv_attribute_always_inline" = yes ; then
4533 AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
4535 AC_DEFINE(NS_ALWAYS_INLINE,)
4538 if test "$ac_cv_attribute_malloc" = yes ; then
4539 AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
4541 AC_DEFINE(NS_ATTR_MALLOC,)
4544 if test "$ac_cv_attribute_warn_unused" = yes ; then
4545 AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
4547 AC_DEFINE(NS_WARN_UNUSED_RESULT,)
4550 if test "$ac_cv_attribute_noreturn" = yes ; then
4551 AC_DEFINE(NS_NORETURN, [__attribute__((noreturn))])
4553 AC_DEFINE(NS_NORETURN,)
4556 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
4557 dnl features that Windows actually does support.
4559 if test -n "$SKIP_COMPILER_CHECKS"; then
4560 dnl Windows has malloc.h
4561 AC_DEFINE(MALLOC_H, [<malloc.h>])
4562 AC_DEFINE(HAVE_FORCEINLINE)
4563 AC_DEFINE(HAVE_LOCALECONV)
4564 fi # SKIP_COMPILER_CHECKS
4566 dnl ========================================================
4568 dnl = Check for external package dependencies
4570 dnl ========================================================
4571 MOZ_ARG_HEADER(External Packages)
4575 MOZ_ARG_WITH_STRING(libxul-sdk,
4576 [ --with-libxul-sdk=PFX Use the libXUL SDK at <PFX>],
4577 LIBXUL_SDK_DIR=$withval)
4579 if test "$LIBXUL_SDK_DIR" = "yes"; then
4580 AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4581 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4582 LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4584 if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
4585 AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
4590 AC_SUBST(LIBXUL_SDK)
4592 if test -n "$LIBXUL_SDK"; then
4593 LIBXUL_DIST="$LIBXUL_SDK"
4595 LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4597 AC_SUBST(LIBXUL_DIST)
4601 MOZ_ARG_WITH_BOOL(system-libxul,
4602 [ --with-system-libxul Use system installed libxul SDK],
4605 if test -n "$SYSTEM_LIBXUL" -a -z "$MOZ_ENABLE_LIBXUL"; then
4606 AC_MSG_ERROR([--with-system-libxul needs --with-libxul-sdk])
4609 dnl ========================================================
4610 dnl = If NSPR was not detected in the system,
4611 dnl = use the one in the source tree (mozilla/nsprpub)
4612 dnl ========================================================
4613 MOZ_ARG_WITH_BOOL(system-nspr,
4614 [ --with-system-nspr Use system installed NSPR],
4615 _USE_SYSTEM_NSPR=1 )
4617 if test -n "$_USE_SYSTEM_NSPR"; then
4618 AM_PATH_NSPR(4.8.6, [MOZ_NATIVE_NSPR=1], [MOZ_NATIVE_NSPR=])
4621 if test -n "$MOZ_NATIVE_NSPR"; then
4622 _SAVE_CFLAGS=$CFLAGS
4623 CFLAGS="$CFLAGS $NSPR_CFLAGS"
4624 AC_TRY_COMPILE([#include "prtypes.h"],
4625 [#ifndef PR_STATIC_ASSERT
4626 #error PR_STATIC_ASSERT not defined or requires including prlog.h
4628 [MOZ_NATIVE_NSPR=1],
4629 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
4630 CFLAGS=$_SAVE_CFLAGS
4632 if test "$OS_ARCH" = "WINCE"; then
4633 NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4634 NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4635 elif test "$OS_ARCH" = "WINNT"; then
4636 NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4637 if test -n "$GNU_CC"; then
4638 NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4640 NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4643 NSPR_CFLAGS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4644 NSPR_LIBS='`$(LIBXUL_DIST)/bin/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4648 dnl system libevent Support
4649 dnl ========================================================
4650 MOZ_ARG_WITH_STRING(system-libevent,
4651 [ --with-system-libevent=[PFX]
4652 Use system libevent [installed at prefix PFX]],
4653 LIBEVENT_DIR=$withval)
4655 _SAVE_CFLAGS=$CFLAGS
4656 _SAVE_LDFLAGS=$LDFLAGS
4658 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
4659 MOZ_NATIVE_LIBEVENT=
4661 if test "${LIBEVENT_DIR}" = "yes"; then
4664 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
4665 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
4666 AC_CHECK_HEADER(event.h,
4667 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
4668 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
4670 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
4671 AC_CHECK_LIB(event, event_init,
4672 [MOZ_NATIVE_LIBEVENT=1
4673 MOZ_LIBEVENT_INCLUDES="${LIBEVENT_DIR}/include"
4674 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
4675 [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_INCLUDES= MOZ_LIBEVENT_LIBS=])
4677 CFLAGS=$_SAVE_CFLAGS
4678 LDFLAGS=$_SAVE_LDFLAGS
4681 AC_SUBST(MOZ_NATIVE_LIBEVENT)
4682 AC_SUBST(MOZ_LIBEVENT_INCLUDES)
4683 AC_SUBST(MOZ_LIBEVENT_LIBS)
4685 dnl ========================================================
4686 dnl = If NSS was not detected in the system,
4687 dnl = use the one in the source tree (mozilla/security/nss)
4688 dnl ========================================================
4690 MOZ_ARG_WITH_BOOL(system-nss,
4691 [ --with-system-nss Use system installed NSS],
4694 if test -n "$_USE_SYSTEM_NSS"; then
4695 AM_PATH_NSS(3.12.8, [MOZ_NATIVE_NSS=1], [MOZ_NATIVE_NSS=])
4698 if test -n "$MOZ_NATIVE_NSS"; then
4699 NSS_LIBS="$NSS_LIBS -lcrmf"
4701 NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4703 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4704 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4705 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4706 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4707 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
4709 if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "WINCE" -o "$OS_ARCH" = "OS2"; then
4711 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4712 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
4713 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
4714 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
4715 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
4717 NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4721 dnl ======================
4723 dnl ======================
4725 AC_MSG_CHECKING([for YASM assembler])
4726 AC_CHECK_PROGS(YASM, yasm, "")
4728 if test -n "$YASM"; then
4729 dnl Pull out yasm's version string
4731 _YASM_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+).*|\1|p'
4734 YASM_VERSION=`yasm --version | sed -nre "$_YASM_VER_FILTER"`
4735 _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
4736 _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
4737 _YASM_RELEASE=` echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
4738 _YASM_BUILD=` echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
4741 if test -z "$SKIP_LIBRARY_CHECKS"; then
4742 dnl system JPEG support
4743 dnl ========================================================
4744 MOZ_ARG_WITH_STRING(system-jpeg,
4745 [ --with-system-jpeg[=PFX]
4746 Use system libjpeg [installed at prefix PFX]],
4749 _SAVE_CFLAGS=$CFLAGS
4750 _SAVE_LDFLAGS=$LDFLAGS
4752 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4753 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4754 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4756 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4759 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4762 if test "$SYSTEM_JPEG" = 1; then
4763 LIBS="$JPEG_LIBS $LIBS"
4764 AC_TRY_COMPILE([ #include <stdio.h>
4765 #include <sys/types.h>
4766 #include <jpeglib.h> ],
4767 [ #if JPEG_LIB_VERSION < $MOZJPEG
4768 #error "Insufficient JPEG library version ($MOZJPEG required)."
4771 [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=])
4773 CFLAGS=$_SAVE_CFLAGS
4774 LDFLAGS=$_SAVE_LDFLAGS
4777 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4778 JPEG_CFLAGS="-I${JPEG_DIR}/include"
4779 JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4782 dnl system ZLIB support
4783 dnl ========================================================
4784 MOZ_ARG_WITH_STRING(system-zlib,
4785 [ --with-system-zlib[=PFX]
4786 Use system libz [installed at prefix PFX]],
4789 _SAVE_CFLAGS=$CFLAGS
4790 _SAVE_LDFLAGS=$LDFLAGS
4792 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4793 CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4794 LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4796 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4799 AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"],
4800 [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4802 if test "$SYSTEM_ZLIB" = 1; then
4803 LIBS="$ZLIB_LIBS $LIBS"
4804 AC_TRY_COMPILE([ #include <stdio.h>
4806 #include <zlib.h> ],
4807 [ #if ZLIB_VERNUM < $MOZZLIB
4808 #error "Insufficient zlib version ($MOZZLIB required)."
4811 [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=])
4813 CFLAGS=$_SAVE_CFLAGS
4814 LDFLAGS=$_SAVE_LDFLAGS
4817 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4818 ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4819 ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4822 dnl system BZIP2 Support
4823 dnl ========================================================
4824 MOZ_ARG_WITH_STRING(system-bz2,
4825 [ --with-system-bz2[=PFX]
4826 Use system libbz2 [installed at prefix PFX]],
4829 _SAVE_CFLAGS=$CFLAGS
4830 _SAVE_LDFLAGS=$LDFLAGS
4832 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4833 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4834 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4836 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4839 AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4840 [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=])
4842 CFLAGS=$_SAVE_CFLAGS
4843 LDFLAGS=$_SAVE_LDFLAGS
4846 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4847 BZ2_CFLAGS="-I${BZ2_DIR}/include"
4848 BZ2_LIBS="-L${BZ2_DIR}/lib ${BZ2_LIBS}"
4851 dnl system PNG Support
4852 dnl ========================================================
4853 MOZ_ARG_WITH_STRING(system-png,
4854 [ --with-system-png[=PFX]
4855 Use system libpng [installed at prefix PFX]],
4858 _SAVE_CFLAGS=$CFLAGS
4859 _SAVE_LDFLAGS=$LDFLAGS
4861 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4862 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4863 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4864 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4865 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4867 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4870 _SAVE_PNG_LIBS=$PNG_LIBS
4871 AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4872 AC_MSG_ERROR([--with-system-png requested but no working libpng found]),
4874 AC_CHECK_LIB(png, png_get_acTL, ,
4875 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4878 if test "$SYSTEM_PNG" = 1; then
4879 LIBS="$PNG_LIBS $LIBS"
4880 AC_TRY_COMPILE([ #include <stdio.h>
4881 #include <sys/types.h>
4883 [ #if PNG_LIBPNG_VER < $MOZPNG
4884 #error "Insufficient libpng version ($MOZPNG required)."
4886 #ifndef PNG_UINT_31_MAX
4887 #error "Insufficient libpng version."
4890 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4892 CFLAGS=$_SAVE_CFLAGS
4893 LDFLAGS=$_SAVE_LDFLAGS
4896 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4897 PNG_CFLAGS="-I${PNG_DIR}/include"
4898 PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4901 fi # SKIP_LIBRARY_CHECKS
4903 dnl system HunSpell Support
4904 dnl ========================================================
4905 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4906 [ --enable-system-hunspell
4907 Use system hunspell (located with pkgconfig)],
4910 if test -n "$SYSTEM_HUNSPELL"; then
4911 PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4914 AC_SUBST(SYSTEM_HUNSPELL)
4916 dnl ========================================================
4917 dnl Java SDK support
4918 dnl ========================================================
4920 MOZ_ARG_WITH_STRING(java-include-path,
4921 [ --with-java-include-path=dir
4922 Location of Java SDK headers],
4923 JAVA_INCLUDE_PATH=$withval)
4926 MOZ_ARG_WITH_STRING(java-bin-path,
4927 [ --with-java-bin-path=dir
4928 Location of Java binaries (java, javac, jar)],
4929 JAVA_BIN_PATH=$withval)
4931 dnl ========================================================
4935 dnl ========================================================
4937 MOZ_ARG_HEADER(Application)
4941 MOZ_ACTIVEX_SCRIPTING_SUPPORT=
4942 MOZ_BRANDING_DIRECTORY=
4943 MOZ_OFFICIAL_BRANDING=
4945 MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
4954 MOZ_AUTH_EXTENSION=1
4955 MOZ_NO_ACTIVEX_SUPPORT=1
4971 MOZ_PLAINTEXT_EDITOR_ONLY=
4973 MOZ_PREF_EXTENSIONS=1
4974 MOZ_PROFILELOCKING=1
4987 MOZ_TOOLKIT_SEARCH=1
4989 MOZ_UNIVERSALCHARDET=1
4991 MOZ_USE_NATIVE_UCONV=
4993 MOZ_XSLT_STANDALONE=
4998 MOZ_DISABLE_DOMCRYPTO=
5003 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource wyciwyg"
5006 XPC_IDISPATCH_SUPPORT=
5009 case "$target_os" in
5010 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)
5040 MOZ_THEME_FASTSTRIPE=1
5046 MOZ_ARG_ENABLE_STRING(application,
5047 [ --enable-application=APP
5051 content/xslt (Standalone Transformiix XSLT)
5052 netwerk (Standalone Necko)
5053 tools/update-packaging (AUS-related packaging tools)
5054 standalone (use this for standalone
5055 xpcom/xpconnect or to manually drive a build)],
5056 [ MOZ_BUILD_APP=$enableval ] )
5058 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
5059 [ --with-xulrunner-stub-name=appname Create the xulrunner stub with the given name],
5060 XULRUNNER_STUB_NAME=$withval)
5062 if test -z "$XULRUNNER_STUB_NAME"; then
5063 case "$target_os" in
5065 XULRUNNER_STUB_NAME=xulrunner
5068 XULRUNNER_STUB_NAME=xulrunner-stub
5071 AC_SUBST(XULRUNNER_STUB_NAME)
5073 if test -z "$MOZ_BUILD_APP"; then
5074 AC_MSG_ERROR([--enable-application=APP was not specified and is required.])
5076 # We have a valid application only if it has a build.mk file in its top
5078 if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
5079 AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
5083 # Allow the application to influence configure with a confvars.sh script.
5085 AC_MSG_CHECKING([if app-specific confvars.sh exists])
5086 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
5087 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
5088 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
5093 # Now is a good time to test for logic errors, define mismatches, etc.
5094 case "$MOZ_BUILD_APP" in
5096 if test "$LIBXUL_SDK"; then
5097 AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
5102 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
5103 # that haven't made a confvars.sh yet. Don't add new stuff here, use
5105 case "$MOZ_BUILD_APP" in
5107 AC_DEFINE(MOZ_PHOENIX)
5111 AC_DEFINE(MOZ_XULRUNNER)
5119 MOZ_APP_NAME=mozilla
5120 MOZ_APP_DISPLAYNAME=Mozilla
5121 MOZ_APP_VERSION=$MOZILLA_VERSION
5126 AC_SUBST(MOZ_BUILD_APP)
5127 AC_SUBST(MOZ_PHOENIX)
5128 AC_SUBST(MOZ_XULRUNNER)
5130 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
5132 dnl ========================================================
5134 dnl = Toolkit Options
5136 dnl ========================================================
5137 MOZ_ARG_HEADER(Toolkit Options)
5139 dnl ========================================================
5140 dnl = Select the default toolkit
5141 dnl ========================================================
5142 MOZ_ARG_ENABLE_STRING(default-toolkit,
5143 [ --enable-default-toolkit=TK
5144 Select default toolkit
5145 Platform specific defaults:
5147 Mac OS X - cairo-cocoa
5148 Neutrino/QNX - photon
5150 Win32/WinCE - cairo-windows
5151 Gtk2 with DirectFB - cairo-gtk2-dfb
5154 [ _DEFAULT_TOOLKIT=$enableval ],
5155 [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
5157 if test "$_DEFAULT_TOOLKIT" = "photon" \
5158 -o "$_DEFAULT_TOOLKIT" = "cairo-windows" \
5159 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
5160 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-dfb" \
5161 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
5162 -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
5163 -o "$_DEFAULT_TOOLKIT" = "cairo-beos" \
5164 -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
5165 -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
5166 -o "$_DEFAULT_TOOLKIT" = "cairo-android"
5168 dnl nglayout only supports building with one toolkit,
5169 dnl so ignore everything after the first comma (",").
5170 MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
5172 AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
5175 dnl ========================================================
5176 dnl = Enable the toolkit as needed =
5177 dnl ========================================================
5179 case "$MOZ_WIDGET_TOOLKIT" in
5182 AC_DEFINE(MOZ_WIDGET_PHOTON)
5186 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)
5212 MOZ_WIDGET_TOOLKIT=gtk2
5219 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
5220 TK_LIBS='$(MOZ_GTK2_LIBS)'
5221 AC_DEFINE(MOZ_WIDGET_GTK2)
5222 if test "$no_x" != "yes"; then
5223 AC_MSG_WARN([Disabling X when DirectFB is specified.])
5229 MOZ_WIDGET_TOOLKIT=qt
5231 MOZ_ENABLE_XREMOTE=1
5240 TK_CFLAGS='$(MOZ_QT_CFLAGS)'
5241 TK_LIBS='$(MOZ_QT_LIBS)'
5242 AC_DEFINE(MOZ_WIDGET_QT)
5246 MOZ_WIDGET_TOOLKIT=beos
5248 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5249 TK_LIBS='$(MOZ_CAIRO_LIBS)'
5253 MOZ_WIDGET_TOOLKIT=os2
5255 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
5256 TK_LIBS='$(MOZ_CAIRO_LIBS)'
5260 MOZ_WIDGET_TOOLKIT=cocoa
5261 AC_DEFINE(MOZ_WIDGET_COCOA)
5262 MOZ_USER_DIR="Mozilla"
5263 AC_DEFINE(XP_MACOSX)
5264 TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
5265 TK_CFLAGS="-DNO_X11"
5266 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
5267 CFLAGS="$CFLAGS $TK_CFLAGS"
5268 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
5269 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
5270 MOZ_FS_LAYOUT=bundle
5275 AC_DEFINE(MOZ_WIDGET_ANDROID)
5276 MOZ_WIDGET_TOOLKIT=android
5282 if test "$MOZ_ENABLE_XREMOTE"; then
5283 AC_DEFINE(MOZ_ENABLE_XREMOTE)
5286 if test "$COMPILE_ENVIRONMENT"; then
5287 if test "$MOZ_ENABLE_GTK2"; then
5288 if test "$MOZ_X11"; then
5289 GDK_PACKAGES=gdk-x11-2.0
5290 elif test "$MOZ_DFB"; then
5291 PKG_CHECK_MODULES(MOZ_DFB, directfb >= 1.1.0)
5292 GDK_PACKAGES=directfb
5295 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
5298 fi # COMPILE_ENVIRONMENT
5300 AC_SUBST(MOZ_FS_LAYOUT)
5302 dnl ========================================================
5303 dnl Use ARM userspace kernel helpers; tell NSPR to enable
5304 dnl their usage and use them in spidermonkey.
5305 dnl ========================================================
5306 MOZ_ARG_WITH_BOOL(arm-kuser,
5307 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
5309 if test -n "$USE_ARM_KUSER"; then
5310 AC_DEFINE(USE_ARM_KUSER)
5313 dnl ========================================================
5314 dnl = startup-notification support module
5315 dnl ========================================================
5317 if test "$MOZ_ENABLE_GTK2"
5319 MOZ_ENABLE_STARTUP_NOTIFICATION=
5321 MOZ_ARG_ENABLE_BOOL(startup-notification,
5322 [ --enable-startup-notification
5323 Enable startup-notification support (default: disabled) ],
5324 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
5325 MOZ_ENABLE_STARTUP_NOTIFICATION=)
5326 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
5328 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
5329 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
5330 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
5331 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
5333 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
5335 MOZ_ENABLE_STARTUP_NOTIFICATION=
5339 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
5340 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
5343 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
5345 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
5346 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
5347 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
5349 dnl ========================================================
5351 dnl ========================================================
5352 if test "$MOZ_ENABLE_QT"
5354 MOZ_ARG_WITH_STRING(qtdir,
5355 [ --with-qtdir=\$dir Specify Qt directory ],
5358 if test -z "$QTDIR"; then
5359 PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
5360 AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
5362 MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtDBus -lQtXml -lQtOpenGL"
5364 MOZ_QT_CFLAGS="-DQT_SHARED"
5365 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
5366 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
5367 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
5368 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
5369 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
5370 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDBus"
5371 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
5372 HOST_MOC="$QTDIR/bin/moc"
5374 if test -z "$HOST_MOC"; then
5375 AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
5380 MOZ_ENABLE_QTNETWORK=
5381 PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
5382 MOZ_ENABLE_QTNETWORK=1,
5383 MOZ_ENABLE_QTNETWORK=)
5385 if test "$MOZ_ENABLE_QTNETWORK"; then
5386 MOZ_ENABLE_QTNETWORK=1
5387 AC_DEFINE(MOZ_ENABLE_QTNETWORK)
5391 AC_SUBST(GTK_CONFIG)
5395 AC_SUBST(MOZ_ENABLE_GTK2)
5396 AC_SUBST(MOZ_ENABLE_PHOTON)
5397 AC_SUBST(MOZ_ENABLE_QT)
5398 AC_SUBST(MOZ_ENABLE_QTNETWORK)
5399 AC_SUBST(MOZ_ENABLE_XREMOTE)
5400 AC_SUBST(MOZ_GTK2_CFLAGS)
5401 AC_SUBST(MOZ_GTK2_LIBS)
5402 AC_SUBST(MOZ_QT_CFLAGS)
5403 AC_SUBST(MOZ_QT_LIBS)
5404 AC_SUBST(MOZ_ENABLE_MEEGOTOUCH)
5411 dnl ========================================================
5413 dnl = Components & Features
5415 dnl ========================================================
5416 MOZ_ARG_HEADER(Components and Features)
5418 dnl ========================================================
5420 dnl ========================================================
5421 MOZ_ARG_ENABLE_STRING(ui-locale,
5422 [ --enable-ui-locale=ab-CD
5423 Select the user interface locale (default: en-US)],
5424 MOZ_UI_LOCALE=$enableval )
5425 AC_SUBST(MOZ_UI_LOCALE)
5427 dnl ========================================================
5428 dnl = Trademarked Branding
5429 dnl ========================================================
5430 MOZ_ARG_ENABLE_BOOL(official-branding,
5431 [ --enable-official-branding
5432 Enable Official mozilla.org Branding
5433 Do not distribute builds with
5434 --enable-official-branding unless you have
5435 permission to use trademarks per
5436 http://www.mozilla.org/foundation/trademarks/ .],
5438 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
5439 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
5441 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
5442 MOZ_OFFICIAL_BRANDING=1
5444 ], MOZ_OFFICIAL_BRANDING=)
5446 AC_SUBST(MOZ_OFFICIAL_BRANDING)
5447 if test -n "$MOZ_OFFICIAL_BRANDING"; then
5448 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
5451 MOZ_ARG_WITH_STRING(branding,
5452 [ --with-branding=dir Use branding from the specified directory.],
5453 MOZ_BRANDING_DIRECTORY=$withval)
5455 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
5456 if test -z "$REAL_BRANDING_DIRECTORY"; then
5457 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
5460 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
5461 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
5464 AC_SUBST(MOZ_BRANDING_DIRECTORY)
5466 dnl ========================================================
5467 dnl = Distribution ID
5468 dnl ========================================================
5469 MOZ_ARG_WITH_STRING(distribution-id,
5470 [ --with-distribution-id=ID
5471 Set distribution-specific id (default=org.mozilla)],
5472 [ val=`echo $withval`
5473 MOZ_DISTRIBUTION_ID="$val"])
5475 if test -z "$MOZ_DISTRIBUTION_ID"; then
5476 MOZ_DISTRIBUTION_ID="org.mozilla"
5479 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
5480 AC_SUBST(MOZ_DISTRIBUTION_ID)
5483 dnl ========================================================
5484 dnl complex text support off by default
5485 dnl ========================================================
5486 MOZ_ARG_DISABLE_BOOL(pango,
5487 [ --disable-pango Disable usage of Pango ],
5491 dnl ========================================================
5493 dnl ========================================================
5494 if test "$MOZ_ENABLE_GTK2"
5498 PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5500 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION)
5501 AC_SUBST(MOZ_PANGO_CFLAGS)
5502 AC_SUBST(MOZ_PANGO_LIBS)
5503 if test "$MOZ_PANGO"
5505 AC_DEFINE(MOZ_PANGO)
5507 PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5508 AC_SUBST(FT2_CFLAGS)
5513 if test "$MOZ_ENABLE_QT"
5515 if test "$MOZ_PANGO"
5517 PKG_CHECK_MODULES(MOZ_PANGO, [pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION],
5519 AC_SUBST(MOZ_PANGO_CFLAGS)
5520 AC_SUBST(MOZ_PANGO_LIBS)
5521 AC_DEFINE(MOZ_PANGO)
5524 echo "Pango library not found, will use FT2 font engine"
5531 dnl ========================================================
5532 dnl = GnomeVFS, GIO and GConf support module
5533 dnl ========================================================
5537 dnl build the gnomevfs extension by default only when the
5538 dnl GTK2 toolkit is in use.
5539 if test "$MOZ_ENABLE_GTK2"
5541 MOZ_ENABLE_GNOMEVFS=1
5545 dnl ========================================================
5546 dnl = GnomeVFS support module
5547 dnl ========================================================
5548 MOZ_ARG_DISABLE_BOOL(gnomevfs,
5549 [ --disable-gnomevfs Disable GnomeVFS support ],
5550 MOZ_ENABLE_GNOMEVFS=,
5551 MOZ_ENABLE_GNOMEVFS=force)
5553 if test "$MOZ_ENABLE_GNOMEVFS"
5555 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5556 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5557 MOZ_ENABLE_GNOMEVFS=1
5558 AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
5560 if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5562 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5564 MOZ_ENABLE_GNOMEVFS=
5567 if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
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\>//'`
5574 AC_SUBST(MOZ_ENABLE_GNOMEVFS)
5575 AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5576 AC_SUBST(MOZ_GNOMEVFS_LIBS)
5578 dnl ========================================================
5579 dnl = GIO support module
5580 dnl ========================================================
5581 MOZ_ARG_ENABLE_BOOL(gio,
5582 [ --enable-gio Enable GIO support (default: disabled)],
5583 MOZ_ENABLE_GIO=force,
5586 if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
5588 PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
5589 MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
5591 AC_DEFINE(MOZ_ENABLE_GIO)
5593 if test "$MOZ_ENABLE_GIO" = "force"
5595 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
5601 AC_SUBST(MOZ_ENABLE_GIO)
5602 AC_SUBST(MOZ_GIO_CFLAGS)
5603 AC_SUBST(MOZ_GIO_LIBS)
5605 dnl ========================================================
5606 dnl = GConf support module
5607 dnl ========================================================
5608 if test "$MOZ_ENABLE_GCONF"
5610 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
5611 MOZ_GCONF_LIBS=`echo $MOZ_GCONF_LIBS | sed 's/-llinc\>//'`
5614 if test "$MOZ_ENABLE_GCONF" = "force"
5616 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5622 if test "$MOZ_ENABLE_GCONF"; then
5623 AC_DEFINE(MOZ_ENABLE_GCONF)
5626 AC_SUBST(MOZ_ENABLE_GCONF)
5627 AC_SUBST(MOZ_GCONF_CFLAGS)
5628 AC_SUBST(MOZ_GCONF_LIBS)
5631 dnl ========================================================
5632 dnl = libproxy support
5633 dnl ========================================================
5635 if test "$MOZ_ENABLE_GTK2"
5637 MOZ_ENABLE_LIBPROXY=
5639 MOZ_ARG_ENABLE_BOOL(libproxy,
5640 [ --enable-libproxy Enable libproxy support ],
5641 MOZ_ENABLE_LIBPROXY=1,
5642 MOZ_ENABLE_LIBPROXY=)
5644 if test "$MOZ_ENABLE_LIBPROXY"
5646 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
5647 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
5650 AC_SUBST(MOZ_ENABLE_LIBPROXY)
5651 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
5652 AC_SUBST(MOZ_LIBPROXY_LIBS)
5654 dnl ========================================================
5655 dnl = libnotify support
5656 dnl ========================================================
5658 if test "$MOZ_ENABLE_GTK2"
5660 MOZ_ENABLE_LIBNOTIFY=1
5662 MOZ_ARG_DISABLE_BOOL(libnotify,
5663 [ --disable-libnotify Disable libnotify support ],
5664 MOZ_ENABLE_LIBNOTIFY=,
5665 MOZ_ENABLE_LIBNOTIFY=1)
5667 if test "$MOZ_ENABLE_LIBNOTIFY"
5669 AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5673 if test -z "$SKIP_LIBRARY_CHECKS"
5675 if test "$MOZ_ENABLE_GTK2"
5677 if test "$MOZ_ENABLE_LIBNOTIFY"
5679 PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5683 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5684 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5685 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5687 dnl ========================================================
5688 dnl = GNOME component (mozgnome)
5689 dnl ========================================================
5691 # The GNOME component is built if one of
5692 # gnome-vfs, gio, gconf or libnotify is available.
5693 if test "$MOZ_ENABLE_GCONF" -o \
5694 "$MOZ_ENABLE_GNOMEVFS" -o \
5695 "$MOZ_ENABLE_GIO" -o \
5696 "$MOZ_ENABLE_LIBNOTIFY"; then
5697 MOZ_ENABLE_GNOME_COMPONENT=1
5699 MOZ_ENABLE_GNOME_COMPONENT=
5701 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5703 dnl ========================================================
5704 dnl = libgnomeui support module
5705 dnl ========================================================
5707 if test "$MOZ_ENABLE_GTK2"
5709 MOZ_ENABLE_GNOMEUI=1
5711 MOZ_ARG_DISABLE_BOOL(gnomeui,
5712 [ --disable-gnomeui Disable libgnomeui support (default: auto, optional at runtime) ],
5713 MOZ_ENABLE_GNOMEUI=,
5714 MOZ_ENABLE_GNOMEUI=force)
5716 if test "$MOZ_ENABLE_GNOMEUI"
5718 PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5720 MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5721 MOZ_ENABLE_GNOMEUI=1
5723 if test "$MOZ_ENABLE_GNOMEUI" = "force"
5725 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5731 if test "$MOZ_ENABLE_GNOMEUI"; then
5732 AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5736 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5737 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5738 AC_SUBST(MOZ_GNOMEUI_LIBS)
5740 dnl ========================================================
5742 dnl ========================================================
5744 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5748 MOZ_ARG_DISABLE_BOOL(dbus,
5749 [ --disable-dbus Disable dbus support ],
5753 if test "$MOZ_ENABLE_DBUS"
5755 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5756 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5757 AC_DEFINE(MOZ_ENABLE_DBUS)
5760 AC_SUBST(MOZ_ENABLE_DBUS)
5761 AC_SUBST(MOZ_DBUS_CFLAGS)
5762 AC_SUBST(MOZ_DBUS_LIBS)
5763 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5764 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5766 dnl ========================================================
5767 dnl = Build Personal Security Manager
5768 dnl ========================================================
5769 MOZ_ARG_DISABLE_BOOL(crypto,
5770 [ --disable-crypto Disable crypto support (Personal Security Manager)],
5774 dnl ========================================================
5775 dnl = JS Debugger XPCOM component (js/jsd)
5776 dnl ========================================================
5777 MOZ_ARG_DISABLE_BOOL(jsd,
5778 [ --disable-jsd Disable JavaScript debug library],
5783 dnl ========================================================
5784 dnl = Disable IPC support for tabs and plugins
5785 dnl ========================================================
5786 MOZ_ARG_DISABLE_BOOL(ipc,
5787 [ --disable-ipc Disable IPC supports for tabs and plugins],
5791 if test -n "$MOZ_IPC"; then
5797 dnl ========================================================
5798 dnl = Enable IPDL's "expensive" unit tests
5799 dnl ========================================================
5802 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5803 [ --enable-ipdl-tests Enable expensive IPDL tests],
5807 if test -z "$MOZ_IPC" -a -n "$MOZ_IPDL_TESTS"; then
5808 AC_MSG_ERROR([--enable-ipdl-tests requires --enable-ipc])
5811 if test -n "$MOZ_IPDL_TESTS"; then
5812 AC_DEFINE(MOZ_IPDL_TESTS)
5815 AC_SUBST(MOZ_IPDL_TESTS)
5817 dnl ========================================================
5818 dnl = Disable plugin support
5819 dnl ========================================================
5820 MOZ_ARG_DISABLE_BOOL(plugins,
5821 [ --disable-plugins Disable plugins support],
5825 dnl ========================================================
5826 dnl = Disable building dbm
5827 dnl ========================================================
5828 MOZ_ARG_DISABLE_BOOL(dbm,
5829 [ --disable-dbm Disable building dbm],
5833 dnl bi-directional support always on
5837 dnl ========================================================
5838 dnl view source support on by default
5839 dnl ========================================================
5840 if test "$MOZ_VIEW_SOURCE"; then
5841 AC_DEFINE(MOZ_VIEW_SOURCE)
5844 dnl ========================================================
5845 dnl accessibility support on by default on all platforms
5847 dnl ========================================================
5848 MOZ_ARG_DISABLE_BOOL(accessibility,
5849 [ --disable-accessibility Disable accessibility support (off by default on OS X)],
5852 if test "$ACCESSIBILITY"; then
5853 AC_DEFINE(ACCESSIBILITY)
5856 if test -n "$ACCESSIBILITY" -a "$COMPILE_ENVIRONMENT" = "1"; then
5858 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
5859 if test "$ac_cv_header_atlbase_h" = "no"; then
5860 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.])
5862 if test "$ac_cv_header_oleacc_idl" = "no"; then
5863 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.])
5869 dnl ========================================================
5870 dnl xpcom js loader support on by default
5871 dnl ========================================================
5872 if test "$MOZ_JSLOADER"; then
5873 AC_DEFINE(MOZ_JSLOADER)
5876 dnl ========================================================
5877 dnl Disable printing
5878 dnl ========================================================
5879 MOZ_ARG_DISABLE_BOOL(printing,
5880 [ --disable-printing Disable printing support],
5884 if test "$NS_PRINTING"; then
5885 AC_DEFINE(NS_PRINTING)
5886 AC_DEFINE(NS_PRINT_PREVIEW)
5888 dnl ========================================================
5889 dnl use native unicode converters
5890 dnl ========================================================
5891 MOZ_ARG_ENABLE_BOOL(native-uconv,
5892 [ --enable-native-uconv Enable iconv support],
5893 MOZ_USE_NATIVE_UCONV=1,
5894 MOZ_USE_NATIVE_UCONV= )
5895 if test "$MOZ_USE_NATIVE_UCONV"; then
5896 AC_DEFINE(MOZ_USE_NATIVE_UCONV)
5898 if test "$OS_ARCH" != "WINCE" -a "$OS_ARCH" != "WINNT" -a "$MOZ_USE_NATIVE_UCONV" -a "$ac_cv_func_iconv" != "yes"; then
5899 AC_MSG_ERROR([iconv() not found. Cannot enable native uconv support.])
5903 dnl ========================================================
5904 dnl Libeditor can be build as plaintext-only,
5905 dnl or as a full html and text editing component.
5906 dnl We build both by default.
5907 dnl ========================================================
5908 MOZ_ARG_ENABLE_BOOL(plaintext-editor-only,
5909 [ --enable-plaintext-editor-only
5910 Allow only plaintext editing],
5911 MOZ_PLAINTEXT_EDITOR_ONLY=1,
5912 MOZ_PLAINTEXT_EDITOR_ONLY= )
5913 dnl Note the #define is MOZILLA, not MOZ, for compat with the Mac build.
5914 AC_SUBST(MOZ_PLAINTEXT_EDITOR_ONLY)
5916 dnl ========================================================
5917 dnl = Disable Fast Load
5918 dnl ========================================================
5919 MOZ_ARG_DISABLE_BOOL(xpcom-fastload,
5920 [ --disable-xpcom-fastload
5921 Disable XPCOM fastload support],
5925 AC_SUBST(MOZ_NO_FAST_LOAD)
5927 if test -n "$MOZ_NO_FAST_LOAD"; then
5928 AC_DEFINE(MOZ_NO_FAST_LOAD)
5931 dnl ========================================================
5932 dnl = Enable Raw Codecs
5933 dnl ========================================================
5934 MOZ_ARG_ENABLE_BOOL(raw,
5935 [ --enable-raw Enable support for RAW media],
5939 if test -n "$MOZ_RAW"; then
5946 dnl ========================================================
5947 dnl = Disable Ogg Codecs
5948 dnl ========================================================
5949 MOZ_ARG_DISABLE_BOOL(ogg,
5950 [ --disable-ogg Disable support for OGG media (Theora video and Vorbis audio)],
5954 if test -n "$MOZ_OGG"; then
5958 case "$target_cpu" in
5967 dnl Checks for __attribute__(aligned()) directive
5968 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5969 [ac_cv_c_attribute_aligned],
5970 [ac_cv_c_attribute_aligned=0
5971 CFLAGS_save="${CFLAGS}"
5972 CFLAGS="${CFLAGS} -Werror"
5973 for ac_cv_c_attr_align_try in 64 32 16 8; do
5974 echo "trying $ac_cv_c_attr_align_try"
5976 [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5977 [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5978 if test "$ac_cv_c_attribute_aligned" != 0; then
5982 CFLAGS="${CFLAGS_save}"])
5983 if test "${ac_cv_c_attribute_aligned}" != "0"; then
5984 AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5985 [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5989 dnl ========================================================
5990 dnl = Disable VP8 decoder support
5991 dnl ========================================================
5992 MOZ_ARG_DISABLE_BOOL(webm,
5993 [ --disable-webm Disable support for WebM media (VP8 video and Vorbis audio)],
5997 if test -n "$MOZ_WEBM"; then
6001 case "$target_cpu" in
6011 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
6012 dnl We currently require yasm on all platforms and require yasm 1.1.0 on Win32.
6015 dnl See if we have assembly on this platform.
6016 case "$OS_ARCH:$CPU_ARCH" in
6018 VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
6022 VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
6026 VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
6030 VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
6034 VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
6038 VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
6042 if test -z "$GNU_CC"; then
6043 VPX_ASFLAGS="-f x64 -rnasm -pnasm"
6048 if test -z "$GNU_CC"; then
6049 dnl Check for yasm 1.1 or greater.
6050 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
6051 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.])
6052 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6053 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.])
6055 VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
6062 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
6063 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.])
6066 if test -n "$VPX_X86_ASM"; then
6067 AC_DEFINE(VPX_X86_ASM)
6069 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
6073 dnl ========================================================
6074 dnl = Disable Wave decoder support
6075 dnl ========================================================
6076 MOZ_ARG_DISABLE_BOOL(wave,
6077 [ --disable-wave Disable Wave decoder support],
6081 if test -n "$MOZ_WAVE"; then
6087 dnl ========================================================
6088 dnl = Handle dependent SYDNEYAUDIO and MEDIA defines
6089 dnl ========================================================
6091 if test -n "$MOZ_SYDNEYAUDIO"; then
6092 AC_DEFINE(MOZ_SYDNEYAUDIO)
6095 if test -n "$MOZ_MEDIA"; then
6096 AC_DEFINE(MOZ_MEDIA)
6099 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
6100 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/])
6103 if test -n "$MOZ_VORBIS"; then
6104 AC_DEFINE(MOZ_VORBIS)
6107 if test -n "$MOZ_TREMOR"; then
6108 AC_DEFINE(MOZ_TREMOR)
6111 dnl ========================================================
6112 dnl = Check alsa availability on Linux if using sydneyaudio
6113 dnl ========================================================
6115 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
6116 if test -n "$MOZ_SYDNEYAUDIO"; then
6117 case "$target_os" in
6119 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
6120 [echo "$MOZ_ALSA_PKG_ERRORS"
6121 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.)])])
6126 dnl ========================================================
6128 dnl ========================================================
6129 AC_ARG_ENABLE(splashscreen,
6130 [ --enable-splashscreen display splashscreen while loading (default=no)],
6131 [enable_splash="yes"],[enable_splash=""])
6132 if test "x$enable_splash" = "xyes"; then
6134 AC_DEFINE(MOZ_SPLASHSCREEN)
6136 AC_SUBST(MOZ_SPLASHSCREEN)
6138 dnl ========================================================
6139 dnl Permissions System
6140 dnl ========================================================
6141 MOZ_ARG_DISABLE_BOOL(permissions,
6142 [ --disable-permissions Disable permissions (popup and cookie blocking)],
6147 dnl ========================================================
6149 dnl ========================================================
6150 MOZ_ARG_DISABLE_BOOL(negotiateauth,
6151 [ --disable-negotiateauth Disable GSS-API negotiation ],
6152 MOZ_AUTH_EXTENSION=,
6153 MOZ_AUTH_EXTENSION=1 )
6155 dnl ========================================================
6157 dnl ========================================================
6158 MOZ_ARG_DISABLE_BOOL(xtf,
6159 [ --disable-xtf Disable XTF (pluggable xml tags) support],
6162 if test "$MOZ_XTF"; then
6166 dnl ========================================================
6167 dnl Pref extensions (autoconfig and system-pref)
6168 dnl ========================================================
6169 MOZ_ARG_DISABLE_BOOL(pref-extensions,
6170 [ --disable-pref-extensions
6171 Disable pref extensions such as autoconfig and
6173 MOZ_PREF_EXTENSIONS=,
6174 MOZ_PREF_EXTENSIONS=1 )
6176 dnl ========================================================
6177 dnl = Universalchardet
6178 dnl ========================================================
6179 MOZ_ARG_DISABLE_BOOL(universalchardet,
6180 [ --disable-universalchardet
6181 Disable universal encoding detection],
6182 MOZ_UNIVERSALCHARDET=,
6183 MOZ_UNIVERSALCHARDET=1 )
6185 dnl ========================================================
6187 dnl ========================================================
6194 MOZ_ARG_ENABLE_BOOL(javaxpcom,
6195 [ --enable-javaxpcom
6196 Enable Java-XPCOM bridge],
6202 if test -n "$JAVA_HOME"; then
6203 JAVA_HOME=`cygpath -u \`cygpath -m -s "$JAVA_HOME"\``
6207 if test -n "$JAVA_HOME"; then
6208 JAVA_HOME=`cd "$JAVA_HOME" && pwd`
6213 if test -n "${JAVA_BIN_PATH}"; then
6214 dnl Look for javac and jar in the specified path.
6215 JAVA_PATH="$JAVA_BIN_PATH"
6217 dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
6218 JAVA_PATH="$JAVA_HOME/bin:$PATH"
6221 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
6222 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
6223 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
6225 if test -n "${JAVA_BIN_PATH}" -o "$OS_TARGET" = Android; then
6226 if test -z "$JAVA" -o "$JAVA" = ":" -o -z "$JAVAC" -o "$JAVAC" = ":" -o -z "$JAR" -o "$JAR" = ":"; then
6227 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}])
6231 if test -n "${MOZ_JAVAXPCOM}"; then
6232 if test -n "${JAVA_INCLUDE_PATH}"; then
6233 dnl Make sure jni.h exists in the given include path.
6234 if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
6235 AC_MSG_ERROR([jni.h was not found in given include path $JAVA_INCLUDE_PATH.])
6238 case "$target_os" in
6240 dnl Default to java system location
6241 JAVA_INCLUDE_PATH=/System/Library/Frameworks/JavaVM.framework/Headers
6245 JAVA_INCLUDE_PATH="$JAVA_HOME/include"
6248 if test ! -f "$JAVA_INCLUDE_PATH/jni.h"; then
6249 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.])
6254 dnl ========================================================
6255 dnl = Breakpad crash reporting (on by default on supported platforms)
6256 dnl ========================================================
6259 i?86-*-mingw*|x86_64-*-mingw*)
6262 i?86-apple-darwin*|powerpc-apple-darwin*|x86_64-apple-darwin*)
6265 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
6276 MOZ_ARG_DISABLE_BOOL(crashreporter,
6277 [ --disable-crashreporter Disable breakpad crash reporting],
6279 MOZ_CRASHREPORTER=1)
6281 if test -n "$MOZ_CRASHREPORTER"; then
6282 AC_DEFINE(MOZ_CRASHREPORTER)
6284 if (test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS") && \
6285 test -z "$SKIP_LIBRARY_CHECKS"; then
6286 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
6287 AC_SUBST(MOZ_GTHREAD_CFLAGS)
6288 AC_SUBST(MOZ_GTHREAD_LIBS)
6290 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.])])
6294 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
6295 [ --with-crashreporter-enable-percent=NN
6296 Enable sending crash reports by default on NN% of users. (default=100)],
6297 [ val=`echo $withval | sed 's/[^0-9]//g'`
6298 MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
6300 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
6301 MOZ_CRASHREPORTER_ENABLE_PERCENT=100
6303 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
6305 dnl ========================================================
6306 dnl = Enable compilation of specific extension modules
6307 dnl ========================================================
6309 MOZ_ARG_ENABLE_STRING(extensions,
6310 [ --enable-extensions Enable extensions],
6311 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6312 if test "$option" = "yes" -o "$option" = "all"; then
6313 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6314 elif test "$option" = "no" -o "$option" = "none"; then
6316 elif test "$option" = "default"; then
6317 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6318 elif test `echo "$option" | grep -c \^-` != 0; then
6319 option=`echo $option | sed 's/^-//'`
6320 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6322 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6325 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6327 if test -z "$MOZ_ENABLE_GNOMEVFS" -a -z "$MOZ_GNOMEVFS_LIBS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6328 # Suppress warning on non-X11 platforms
6329 if test -n "$MOZ_X11"; then
6330 AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
6332 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6335 dnl Do not build gnomevfs with libxul based apps
6336 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6337 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6340 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6341 # Suppress warning on non-X11 platforms
6342 if test -n "$MOZ_X11"; then
6343 AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
6345 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6348 dnl Do not build gio with libxul based apps
6349 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6350 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6353 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6354 AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6355 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6358 dnl This might be temporary: build tridentprofile only on Windows
6359 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0 && test "$OS_ARCH" != "WINNT"; then
6360 AC_MSG_WARN([tridentprofile extension works only on Windows at this time. Removing tridentprofile from MOZ_EXTENSIONS.])
6361 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
6364 dnl cookie must be built before tridentprofile. put it at list's end.
6365 if test `echo "$MOZ_EXTENSIONS" | grep -c tridentprofile` -ne 0; then
6366 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|tridentprofile||'`
6367 MOZ_EXTENSIONS="$MOZ_EXTENSIONS tridentprofile"
6370 dnl xforms requires xtf and schema-validation
6371 if test -z "$MOZ_XTF" -a `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
6372 AC_MSG_WARN([Cannot build XForms without XTF support. Removing XForms from MOZ_EXTENSIONS.])
6373 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6375 if test `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0 && test `echo "$MOZ_EXTENSIONS" | grep -c schema-validation` -eq 0; then
6376 AC_MSG_WARN([Cannot build XForms without schema validation. Removing XForms from MOZ_EXTENSIONS.])
6377 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6380 if test `echo "$MOZ_EXTENSIONS" | grep -c auth` -ne 0; then
6381 AC_MSG_WARN([auth is no longer an extension, use --disable-negotiateauth to disable.])
6382 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|auth||g'`
6385 if test `echo "$MOZ_EXTENSIONS" | grep -c 'cookie\|permissions'` -ne 0; then
6386 AC_MSG_WARN([cookie and permissions are no longer extensions, use --disable-permissions to disable.])
6387 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|cookie||g; s|permissions||g'`
6390 if test `echo "$MOZ_EXTENSIONS" | grep -c pref` -ne 0; then
6391 AC_MSG_WARN([pref is no longer an extension, use --disable-pref-extensions to disable.])
6392 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|pref||g'`
6395 if test `echo "$MOZ_EXTENSIONS" | grep -c universalchardet` -ne 0; then
6396 AC_MSG_WARN([universalchardet is no longer an extension, use --disable-universalchardet to disable.])
6397 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|universalchardet||g'`
6400 if test `echo "$MOZ_EXTENSIONS" | grep -c java` -ne 0; then
6401 AC_MSG_WARN([java is no longer an extension, use --enable-javaxpcom to enable.])
6402 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|java||g'`
6405 if test `echo "$MOZ_EXTENSIONS" | grep -c spellcheck` -ne 0; then
6406 AC_MSG_WARN([spellcheck is no longer an extension.])
6407 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|spellcheck||g'`
6411 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6413 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6414 dnl when trying to build a nonexistent extension.
6415 for extension in $MOZ_EXTENSIONS; do
6416 if test ! -d "${srcdir}/extensions/${extension}"; then
6417 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6421 dnl ========================================================
6423 dnl ========================================================
6424 MOZ_ARG_ENABLE_STRING(image-encoders,
6425 [ --enable-image-encoders[={mod1,mod2,default,all,none}]
6426 Enable specific image encoders],
6427 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6428 if test "$option" = "yes" -o "$option" = "all"; then
6429 addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
6430 elif test "$option" = "no" -o "$option" = "none"; then
6433 elif test "$option" = "default"; then
6434 addencoder="$MOZ_IMG_ENCODERS_DEFAULT"
6435 elif test `echo "$option" | grep -c \^-` != 0; then
6436 option=`echo $option | sed 's/^-//'`
6437 addencoder=`echo "$MOZ_IMG_ENCODERS" | sed "s/ ${option}//"`
6439 addencoder="$option"
6441 MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS $addencoder"
6443 MOZ_IMG_ENCODERS="$MOZ_IMG_ENCODERS_DEFAULT")
6446 MOZ_IMG_ENCODERS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_IMG_ENCODERS}`
6448 dnl ========================================================
6449 dnl MathML on by default
6450 dnl ========================================================
6451 MOZ_ARG_DISABLE_BOOL(mathml,
6452 [ --disable-mathml Disable MathML support],
6455 if test "$MOZ_MATHML"; then
6456 AC_DEFINE(MOZ_MATHML)
6459 dnl ========================================================
6461 dnl ========================================================
6462 MOZ_ARG_DISABLE_BOOL(svg,
6463 [ --disable-svg Disable SVG support],
6466 if test -n "$MOZ_SVG"; then
6470 dnl ========================================================
6472 dnl ========================================================
6474 MOZ_ARG_DISABLE_BOOL(smil,
6475 [ --disable-smil Disable SMIL animation support],
6478 # Automatically disable SMIL if SVG is disabled
6479 if test -z "$MOZ_SVG"; then
6482 if test -n "$MOZ_SMIL"; then
6486 dnl ========================================================
6487 dnl Build Freetype in the tree
6488 dnl ========================================================
6489 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6490 [ --enable-tree-freetype Enable Tree FreeType],
6491 MOZ_TREE_FREETYPE=1,
6492 MOZ_TREE_FREETYPE= )
6493 if test -n "$MOZ_TREE_FREETYPE"; then
6494 AC_DEFINE(MOZ_TREE_FREETYPE)
6495 AC_SUBST(MOZ_TREE_FREETYPE)
6496 MOZ_ENABLE_CAIRO_FT=1
6497 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6498 FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6499 CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6500 FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype2,$(LIBXUL_DIST)/lib)'
6501 CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype2,$(LIBXUL_DIST)/lib)'
6502 AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6503 AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6504 AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6505 AC_SUBST(CAIRO_FT_CFLAGS)
6509 dnl ========================================================
6511 dnl ========================================================
6512 case "$target_os" in
6513 aix*|solaris*|linux*|msvc*|mks*|cygwin*|mingw*|os2*|wince*|winmo*)
6518 MOZ_ARG_DISABLE_BOOL(installer,
6519 [ --disable-installer Disable building of installer],
6522 if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then
6523 # Disable installer for Windows builds that use the new toolkit if the
6524 # required major version and minimum minor version of Unicode NSIS isn't in
6526 REQ_NSIS_MAJOR_VER=2
6527 MIN_NSIS_MINOR_VER=33
6528 MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensisu makensis)
6529 if test -z "$MAKENSISU" -o "$MAKENSISU" = ":"; then
6530 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.])
6533 MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\)\-Unicode$/\1/g'`
6535 if test ! "$MAKENSISU_VER" == ""; then
6536 MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6537 MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6539 AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6540 if test "$MAKENSISU_VER" == "" -o \
6541 ! "$MAKENSISU_MAJOR_VER" == "$REQ_NSIS_MAJOR_VER" -o \
6542 ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6544 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.])
6546 AC_MSG_RESULT([yes])
6547 MAKENSISU="${CYGWIN_WRAPPER} $MAKENSISU"
6550 AC_SUBST(MOZ_INSTALLER)
6552 AC_MSG_CHECKING([for tar archiver])
6553 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6554 if test -z "$TAR"; then
6555 AC_MSG_ERROR([no tar archiver found in \$PATH])
6557 AC_MSG_RESULT([$TAR])
6560 AC_MSG_CHECKING([for wget])
6561 AC_CHECK_PROGS(WGET, wget, "")
6562 AC_MSG_RESULT([$WGET])
6565 dnl ========================================================
6567 dnl ========================================================
6569 MOZ_ARG_DISABLE_BOOL(updater,
6570 [ --disable-updater Disable building of updater],
6574 if test -n "$MOZ_UPDATER"; then
6575 AC_DEFINE(MOZ_UPDATER)
6578 # app update channel is 'default' when not supplied.
6579 MOZ_ARG_ENABLE_STRING([update-channel],
6580 [ --enable-update-channel=CHANNEL
6581 Select application update channel (default=default)],
6582 MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6584 if test -z "$MOZ_UPDATE_CHANNEL"; then
6585 MOZ_UPDATE_CHANNEL=default
6587 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6588 AC_SUBST(MOZ_UPDATE_CHANNEL)
6590 # tools/update-packaging is not checked out by default.
6591 MOZ_ARG_ENABLE_BOOL(update-packaging,
6592 [ --enable-update-packaging
6593 Enable tools/update-packaging],
6594 MOZ_UPDATE_PACKAGING=1,
6595 MOZ_UPDATE_PACKAGING= )
6596 AC_SUBST(MOZ_UPDATE_PACKAGING)
6598 dnl ========================================================
6600 dnl ========================================================
6602 MOZ_ARG_DISABLE_BOOL(xpconnect-idispatch,
6603 [ --disable-xpconnect-idispatch
6604 Disable building of xpconnect support for IDispatch
6606 XPC_IDISPATCH_SUPPORT=,
6607 XPC_IDISPATCH_SUPPORT=1)
6608 AC_SUBST(XPC_IDISPATCH_SUPPORT)
6610 MOZ_ARG_DISABLE_BOOL(activex,
6611 [ --disable-activex Disable building of ActiveX control (win32 only)],
6612 MOZ_NO_ACTIVEX_SUPPORT=1,
6613 MOZ_NO_ACTIVEX_SUPPORT= )
6614 AC_SUBST(MOZ_NO_ACTIVEX_SUPPORT)
6616 MOZ_ARG_ENABLE_BOOL(activex-scripting,
6617 [ --enable-activex-scripting
6618 Enable building of ActiveX scripting support (win32)],
6619 MOZ_ACTIVEX_SCRIPTING_SUPPORT=1,
6620 MOZ_ACTIVEX_SCRIPTING_SUPPORT=)
6621 AC_SUBST(MOZ_ACTIVEX_SCRIPTING_SUPPORT)
6623 if test -n "$MOZ_NO_ACTIVEX_SUPPORT" -a -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT";
6625 AC_MSG_ERROR([Cannot enable ActiveX scripting support when ActiveX support is disabled.])
6628 if test "$COMPILE_ENVIRONMENT" = "1"; then
6629 if test -n "$XPC_IDISPATCH_SUPPORT" -o -n "$MOZ_ACTIVEX_SCRIPTING_SUPPORT" -o -z "$MOZ_NO_ACTIVEX_SUPPORT"; then
6631 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
6632 if test "$ac_cv_header_atlbase_h" = "no"; then
6633 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.])
6640 dnl ========================================================
6642 dnl ========================================================
6643 MOZ_ARG_ENABLE_BOOL(leaky,
6644 [ --enable-leaky Build leaky memory tool],
6649 dnl ========================================================
6650 dnl build the tests by default
6651 dnl ========================================================
6652 MOZ_ARG_DISABLE_BOOL(tests,
6653 [ --disable-tests Do not build test libraries & programs],
6657 dnl ========================================================
6658 dnl parental controls (for Windows Vista)
6659 dnl ========================================================
6660 MOZ_ARG_DISABLE_BOOL(parental-controls,
6661 [ --disable-parental-controls
6662 Do not build parental controls],
6663 MOZ_DISABLE_PARENTAL_CONTROLS=1,
6664 MOZ_DISABLE_PARENTAL_CONTROLS=)
6665 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6666 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6669 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6671 dnl ========================================================
6672 dnl = Disable DOMCrypto
6673 dnl ========================================================
6674 if test -n "$MOZ_DISABLE_DOMCRYPTO"; then
6675 AC_DEFINE(MOZ_DISABLE_DOMCRYPTO)
6678 dnl ========================================================
6680 dnl = Module specific options
6682 dnl ========================================================
6683 MOZ_ARG_HEADER(Individual module options)
6685 dnl ========================================================
6686 dnl = Disable feed handling components
6687 dnl ========================================================
6688 MOZ_ARG_DISABLE_BOOL(feeds,
6689 [ --disable-feeds Disable feed handling and processing components],
6692 if test -n "$MOZ_FEEDS"; then
6693 AC_DEFINE(MOZ_FEEDS)
6695 if test "$MOZ_BUILD_APP" = "browser"; then
6696 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6700 dnl ========================================================
6701 dnl = Enable mozStorage
6702 dnl ========================================================
6703 dnl Implicitly enabled by default if building calendar or places
6704 MOZ_ARG_ENABLE_BOOL(storage,
6705 [ --enable-storage Enable mozStorage module and related components],
6708 if test -n "$MOZ_STORAGE"; then
6709 AC_DEFINE(MOZ_STORAGE)
6712 dnl ========================================================
6713 dnl Check for sqlite
6714 dnl ========================================================
6717 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6718 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
6719 MOZ_NATIVE_SQLITE=1,
6720 MOZ_NATIVE_SQLITE= )
6722 if test -z "$MOZ_NATIVE_SQLITE"
6725 SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6727 dnl ============================
6728 dnl === SQLite Version check ===
6729 dnl ============================
6730 dnl Check to see if the system SQLite package is new enough.
6731 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6733 dnl ==================================
6734 dnl === SQLITE_SECURE_DELETE check ===
6735 dnl ==================================
6736 dnl Check to see if the system SQLite package is compiled with
6737 dnl SQLITE_SECURE_DELETE enabled.
6738 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6739 _SAVE_CFLAGS="$CFLAGS"
6740 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6742 LIBS="$LIBS $SQLITE_LIBS"
6743 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6745 #include "sqlite3.h"
6747 int main(int argc, char **argv){
6748 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6750 ac_cv_sqlite_secure_delete=yes,
6751 ac_cv_sqlite_secure_delete=no,
6752 ac_cv_sqlite_secure_delete=no
6755 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6756 CFLAGS="$_SAVE_CFLAGS"
6758 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6759 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6762 dnl ===============================
6763 dnl === SQLITE_THREADSAFE check ===
6764 dnl ===============================
6765 dnl Check to see if the system SQLite package is compiled with
6766 dnl SQLITE_THREADSAFE enabled.
6767 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6768 _SAVE_CFLAGS="$CFLAGS"
6769 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6771 LIBS="$LIBS $SQLITE_LIBS"
6772 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6774 #include "sqlite3.h"
6776 int main(int argc, char **argv){
6777 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6779 ac_cv_sqlite_threadsafe=yes,
6780 ac_cv_sqlite_threadsafe=no,
6781 ac_cv_sqlite_threadsafe=no
6784 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6785 CFLAGS="$_SAVE_CFLAGS"
6787 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6788 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6791 dnl ================================
6792 dnl === SQLITE_ENABLE_FTS3 check ===
6793 dnl ================================
6794 dnl check to see if the system SQLite package is compiled with
6795 dnl SQLITE_ENABLE_FTS3 enabled.
6796 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6797 _SAVE_CFLAGS="$CFLAGS"
6798 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6800 LIBS="$LIBS $SQLITE_LIBS"
6801 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6803 #include "sqlite3.h"
6805 int main(int argc, char **argv){
6806 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6808 ac_cv_sqlite_enable_fts3=yes,
6809 ac_cv_sqlite_enable_fts3=no,
6810 ac_cv_sqlite_enable_fts3=no
6813 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6814 CFLAGS="$_SAVE_CFLAGS"
6816 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6817 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6820 dnl =========================================
6821 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6822 dnl =========================================
6823 dnl check to see if the system SQLite package is compiled with
6824 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6825 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6826 _SAVE_CFLAGS="$CFLAGS"
6827 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6829 LIBS="$LIBS $SQLITE_LIBS"
6830 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6832 #include "sqlite3.h"
6834 int main(int argc, char **argv){
6835 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6837 ac_cv_sqlite_enable_unlock_notify=yes,
6838 ac_cv_sqlite_enable_unlock_notify=no,
6839 ac_cv_sqlite_enable_unlock_notify=no
6842 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6843 CFLAGS="$_SAVE_CFLAGS"
6845 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6846 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6850 AC_SUBST(MOZ_NATIVE_SQLITE)
6852 dnl ========================================================
6853 dnl = Enable help viewer (off by default)
6854 dnl ========================================================
6855 if test -n "$MOZ_HELP_VIEWER"; then
6856 dnl Do this if defined in confvars.sh
6857 AC_DEFINE(MOZ_HELP_VIEWER)
6860 dnl ========================================================
6861 dnl = Enable safe browsing (anti-phishing)
6862 dnl ========================================================
6863 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6864 [ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation],
6865 MOZ_SAFE_BROWSING=1,
6866 MOZ_SAFE_BROWSING= )
6867 if test -n "$MOZ_SAFE_BROWSING"; then
6868 AC_DEFINE(MOZ_SAFE_BROWSING)
6870 AC_SUBST(MOZ_SAFE_BROWSING)
6872 dnl ========================================================
6873 dnl = Enable faststart component
6874 dnl ========================================================
6875 MOZ_ARG_ENABLE_BOOL(faststart,
6876 [ --enable-faststart Enable the faststart component],
6879 if test -n "$MOZ_FASTSTART"; then
6880 AC_DEFINE(MOZ_FASTSTART)
6882 AC_SUBST(MOZ_FASTSTART)
6884 dnl ========================================================
6885 dnl = Enable url-classifier
6886 dnl ========================================================
6887 dnl Implicitly enabled by default if building with safe-browsing
6888 if test -n "$MOZ_SAFE_BROWSING"; then
6889 MOZ_URL_CLASSIFIER=1
6891 MOZ_ARG_ENABLE_BOOL(url-classifier,
6892 [ --enable-url-classifier Enable url classifier module],
6893 MOZ_URL_CLASSIFIER=1,
6894 MOZ_URL_CLASSIFIER= )
6895 if test -n "$MOZ_URL_CLASSIFIER"; then
6896 AC_DEFINE(MOZ_URL_CLASSIFIER)
6898 AC_SUBST(MOZ_URL_CLASSIFIER)
6900 dnl ========================================================
6901 dnl = Disable zipwriter
6902 dnl ========================================================
6903 MOZ_ARG_DISABLE_BOOL(zipwriter,
6904 [ --disable-zipwriter Disable zipwriter component],
6907 AC_SUBST(MOZ_ZIPWRITER)
6909 dnl ========================================================
6911 dnl ========================================================
6912 dnl superseded by QtNetwork starting from 4.7
6913 MOZ_ENABLE_LIBCONIC=1
6915 if test -n "$MOZ_ENABLE_QT"; then
6916 if test "$MOZ_ENABLE_QTNETWORK"; then
6917 MOZ_ENABLE_LIBCONIC=
6921 MOZ_ARG_DISABLE_BOOL(libconic,
6922 [ --disable-libconic Disable libconic],
6923 MOZ_ENABLE_LIBCONIC=,
6924 MOZ_ENABLE_LIBCONIC=1 )
6926 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6927 PKG_CHECK_MODULES(LIBCONIC, conic,
6928 MOZ_ENABLE_LIBCONIC=1,
6929 MOZ_ENABLE_LIBCONIC=)
6931 if test "$MOZ_ENABLE_LIBCONIC"; then
6932 AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6935 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6936 AC_SUBST(LIBCONIC_CFLAGS)
6937 AC_SUBST(LIBCONIC_LIBS)
6939 dnl ========================================================
6941 dnl ========================================================
6943 MAEMO_SDK_TARGET_VER=-1
6945 MOZ_ARG_WITH_STRING(maemo-version,
6946 [ --with-maemo-version=MAEMO_SDK_TARGET_VER
6948 MAEMO_SDK_TARGET_VER=$withval)
6950 case "$MAEMO_SDK_TARGET_VER" in
6952 MOZ_PLATFORM_MAEMO=5
6956 MOZ_PLATFORM_MAEMO=6
6960 dnl We aren't compiling for Maemo, move on.
6963 AC_MSG_ERROR([Unknown Maemo Version. Try setting --with-maemo-version to 5 or 6.])
6967 if test $MOZ_PLATFORM_MAEMO; then
6968 AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6970 if test -z "$MOZ_ENABLE_DBUS"; then
6971 AC_MSG_ERROR([DBus is required when building for Maemo])
6974 MOZ_GFX_OPTIMIZE_MOBILE=1
6976 MOZ_MAEMO_LIBLOCATION=
6978 if test $MOZ_PLATFORM_MAEMO = 5; then
6979 dnl if we have Xcomposite we should also have Xdamage and Xfixes
6980 AC_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6981 [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6982 AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6983 [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6985 AC_SUBST(XCOMPOSITE_LIBS)
6987 PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6988 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6989 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6990 if test -z "$_LIB_FOUND"; then
6991 AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6995 PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6996 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6997 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6998 if test -z "$_LIB_FOUND"; then
6999 AC_MSG_ERROR([LibOSSO is required when building for Maemo])
7002 PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
7003 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
7004 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
7005 if test -z "$_LIB_FOUND"; then
7006 AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
7010 if test $MOZ_PLATFORM_MAEMO = 6; then
7011 PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
7012 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTACTION_LIBS"
7013 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTACTION_CFLAGS"
7014 if test -z "$_LIB_FOUND"; then
7015 AC_MSG_ERROR([libcontentaction is required when build for Maemo])
7019 PKG_CHECK_MODULES(MOZ_MEEGOTOUCH, meegotouchcore)
7020 MOZ_ENABLE_MEEGOTOUCH=1
7021 AC_DEFINE(MOZ_ENABLE_MEEGOTOUCH)
7022 MOZ_QT_CFLAGS="$MOZ_MEEGOTOUCH_CFLAGS $MOZ_QT_CFLAGS"
7023 MOZ_QT_LIBS="$MOZ_MEEGOTOUCH_LIBS $MOZ_QT_LIBS"
7026 PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
7027 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
7028 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
7029 if test "$_LIB_FOUND"; then
7030 MOZ_MAEMO_LIBLOCATION=1
7031 AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
7033 AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
7035 AC_SUBST(MOZ_MAEMO_LIBLOCATION)
7037 PKG_CHECK_MODULES(LIBMEEGOTOUCHSHARE, ShareUiInterface-maemo-meegotouch >= 0.3.31 mdatauri, _LIB_FOUND=1, _LIB_FOUND=)
7038 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBMEEGOTOUCHSHARE_LIBS"
7039 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBMEEGOTOUCHSHARE_CFLAGS"
7040 if test "$_LIB_FOUND"; then
7041 MOZ_ENABLE_MEEGOTOUCHSHARE=1
7042 AC_DEFINE(MOZ_ENABLE_MEEGOTOUCHSHARE)
7044 AC_MSG_WARN([Cannot find maemo-meegotouch-interfaces-dev or libmdatauri-dev. Disabling meegotouch share ui.])
7046 AC_SUBST(MOZ_ENABLE_MEEGOTOUCHSHARE)
7048 AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
7049 AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
7052 dnl ========================================================
7053 dnl = Enable building the Thumb2 instruction set
7054 dnl ========================================================
7055 MOZ_ARG_ENABLE_BOOL(thumb2,
7056 [ --enable-thumb2 Enable Thumb2 instruction set],
7060 if test -n "$MOZ_THUMB2"; then
7061 case "$target_cpu" in
7063 if test "$GNU_CC"; then
7064 CFLAGS="$CFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
7065 CXXFLAGS="$CXXFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
7066 ASFLAGS="$ASFLAGS -march=armv7-a -mthumb"
7068 AC_MSG_ERROR([--enable-thumb2 is not supported for non-GNU toolchains])
7072 AC_MSG_ERROR([--enable-thumb2 is not supported for non-ARM CPU architectures])
7077 AC_SUBST(MOZ_THUMB2)
7079 dnl ========================================================
7080 dnl = faststripe theme
7081 dnl ========================================================
7082 MOZ_ARG_ENABLE_BOOL(faststripe,
7083 [ --enable-faststripe Use faststripe theme],
7084 MOZ_THEME_FASTSTRIPE=1,
7085 MOZ_THEME_FASTSTRIPE= )
7086 AC_SUBST(MOZ_THEME_FASTSTRIPE)
7088 dnl ========================================================
7090 dnl = Feature options that require extra sources to be pulled
7092 dnl ========================================================
7093 dnl MOZ_ARG_HEADER(Features that require extra sources)
7095 dnl ========================================================
7097 dnl = Debugging Options
7099 dnl ========================================================
7100 MOZ_ARG_HEADER(Debugging and Optimizations)
7102 dnl ========================================================
7103 dnl = Disable building with debug info.
7104 dnl = Debugging is OFF by default
7105 dnl ========================================================
7106 if test -z "$MOZ_DEBUG_FLAGS"; then
7107 MOZ_DEBUG_FLAGS="-g"
7110 MOZ_ARG_ENABLE_STRING(debug,
7111 [ --enable-debug[=DBG] Enable building with developer debug info
7112 (using compiler flags DBG)],
7113 [ if test "$enableval" != "no"; then
7115 if test -n "$enableval" -a "$enableval" != "yes"; then
7116 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7117 _MOZ_DEBUG_FLAGS_SET=1
7124 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
7125 MOZ_ARG_WITH_STRING(debug-label,
7126 [ --with-debug-label=LABELS
7127 Define DEBUG_<value> for each comma-separated
7129 [ for option in `echo $withval | sed 's/,/ /g'`; do
7130 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
7133 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
7135 if test -n "$MOZ_DEBUG"; then
7136 AC_MSG_CHECKING([for valid debug flags])
7137 _SAVE_CFLAGS=$CFLAGS
7138 CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
7139 AC_TRY_COMPILE([#include <stdio.h>],
7140 [printf("Hello World\n");],
7143 AC_MSG_RESULT([$_results])
7144 if test "$_results" = "no"; then
7145 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
7147 CFLAGS=$_SAVE_CFLAGS
7150 dnl ========================================================
7151 dnl enable mobile optimizations
7152 dnl ========================================================
7153 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
7154 [ --enable-mobile-optimize
7155 Enable mobile optimizations],
7156 MOZ_GFX_OPTIMIZE_MOBILE=1)
7158 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
7160 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
7161 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
7164 dnl ========================================================
7165 dnl = Enable code optimization. ON by default.
7166 dnl ========================================================
7167 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
7168 MOZ_OPTIMIZE_FLAGS="-O"
7171 MOZ_ARG_ENABLE_STRING(optimize,
7172 [ --disable-optimize Disable compiler optimization
7173 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
7174 [ if test "$enableval" != "no"; then
7176 if test -n "$enableval" -a "$enableval" != "yes"; then
7177 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
7182 fi ], MOZ_OPTIMIZE=1)
7184 if test "$COMPILE_ENVIRONMENT"; then
7185 if test -n "$MOZ_OPTIMIZE"; then
7186 AC_MSG_CHECKING([for valid optimization flags])
7187 _SAVE_CFLAGS=$CFLAGS
7188 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
7189 AC_TRY_COMPILE([#include <stdio.h>],
7190 [printf("Hello World\n");],
7193 AC_MSG_RESULT([$_results])
7194 if test "$_results" = "no"; then
7195 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
7197 CFLAGS=$_SAVE_CFLAGS
7199 fi # COMPILE_ENVIRONMENT
7201 AC_SUBST(MOZ_OPTIMIZE)
7202 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
7203 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
7204 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
7206 dnl ========================================================
7207 dnl = (Deprecated) generation of debugger info for specific modules
7208 dnl ========================================================
7209 MOZ_ARG_ENABLE_STRING(debugger-info-modules,
7210 [ --enable-debugger-info-modules
7211 Enable/disable debugger info for specific modules],
7212 [ if test "$enableval" != "no"; then
7213 AC_MSG_WARN([--enable-debugger-info-modules is deprecated, use --enable-debug-symbols instead])
7217 dnl ========================================================
7218 dnl = Enable generation of debug symbols
7219 dnl ========================================================
7220 MOZ_ARG_ENABLE_STRING(debug-symbols,
7221 [ --enable-debug-symbols[=DBG]
7222 Enable debugging symbols (using compiler flags DBG)],
7223 [ if test "$enableval" != "no"; then
7225 if test -n "$enableval" -a "$enableval" != "yes"; then
7226 if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
7227 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
7229 AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
7234 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
7235 AC_DEFINE(MOZ_DEBUG_SYMBOLS)
7236 export MOZ_DEBUG_SYMBOLS
7239 dnl ========================================================
7240 dnl = Disable any treating of compile warnings as errors
7241 dnl ========================================================
7242 MOZ_ARG_DISABLE_BOOL(warnings-as-errors,
7243 [ --disable-warnings-as-errors
7244 Disable treating of warnings as errors],
7245 MOZ_DISABLE_WARNINGS_AS_ERRORS=1,
7246 MOZ_DISABLE_WARNINGS_AS_ERRORS= )
7247 if test "$MOZ_DISABLE_WARNINGS_AS_ERRORS"; then
7248 WARNINGS_AS_ERRORS=''
7251 dnl ========================================================
7252 dnl = Disable runtime logging checks
7253 dnl ========================================================
7254 MOZ_ARG_DISABLE_BOOL(logging,
7255 [ --disable-logging Disable logging facilities],
7256 NS_DISABLE_LOGGING=1,
7257 NS_DISABLE_LOGGING= )
7258 if test "$NS_DISABLE_LOGGING"; then
7259 AC_DEFINE(NS_DISABLE_LOGGING)
7261 AC_DEFINE(MOZ_LOGGING)
7264 dnl ========================================================
7265 dnl = This will enable logging of addref, release, ctor, dtor.
7266 dnl ========================================================
7267 _ENABLE_LOGREFCNT=42
7268 MOZ_ARG_ENABLE_BOOL(logrefcnt,
7269 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
7270 _ENABLE_LOGREFCNT=1,
7271 _ENABLE_LOGREFCNT= )
7272 if test "$_ENABLE_LOGREFCNT" = "1"; then
7273 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
7274 elif test -z "$_ENABLE_LOGREFCNT"; then
7275 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
7278 dnl ========================================================
7279 dnl = Enable trace malloc
7280 dnl ========================================================
7281 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
7282 MOZ_ARG_ENABLE_BOOL(trace-malloc,
7283 [ --enable-trace-malloc Enable malloc tracing],
7286 if test "$NS_TRACE_MALLOC"; then
7287 # Please, Mr. Linker Man, don't take away our symbol names
7288 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7290 AC_DEFINE(NS_TRACE_MALLOC)
7292 AC_SUBST(NS_TRACE_MALLOC)
7294 dnl ========================================================
7295 dnl = Enable jemalloc
7296 dnl ========================================================
7297 MOZ_ARG_ENABLE_BOOL(jemalloc,
7298 [ --enable-jemalloc Replace memory allocator with jemalloc],
7302 if test "$NS_TRACE_MALLOC"; then
7306 if test "$MOZ_MEMORY"; then
7308 dnl Don't try to run compiler tests on Windows
7309 if test "$OS_ARCH" = "WINNT"; then
7310 if test -z "$HAVE_64BIT_OS"; then
7311 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7313 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7316 AC_CHECK_SIZEOF([int *], [4])
7317 case "${ac_cv_sizeof_int_p}" in
7319 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7322 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7325 AC_MSG_ERROR([Unexpected pointer size])
7330 AC_DEFINE(MOZ_MEMORY)
7331 if test "x$MOZ_DEBUG" = "x1"; then
7332 AC_DEFINE(MOZ_MEMORY_DEBUG)
7334 dnl The generic feature tests that determine how to compute ncpus are long and
7335 dnl complicated. Therefore, simply define special cpp variables for the
7336 dnl platforms we have special knowledge of.
7339 AC_DEFINE(MOZ_MEMORY_DARWIN)
7342 AC_DEFINE(MOZ_MEMORY_BSD)
7345 AC_DEFINE(MOZ_MEMORY_LINUX)
7348 AC_DEFINE(MOZ_MEMORY_BSD)
7351 AC_DEFINE(MOZ_MEMORY_SOLARIS)
7353 *-msvc*|*-mks*|*-cygwin*|*-mingw*)
7354 AC_DEFINE(MOZ_MEMORY_WINDOWS)
7355 dnl This is sort of awful. Will revisit if we add support for more versions
7356 if test "$CC_VERSION" != "14.00.50727.762" -a "$CC_VERSION" != "15.00.30729.01"; then
7357 AC_MSG_ERROR([Building jemalloc requires exactly Visual C++ 2005 SP1 or 2008 SP1 currently.])
7359 if test -z "$WIN32_CRT_SRC_DIR"; then
7360 if test -z "$VCINSTALLDIR" -o ! -d "$VCINSTALLDIR"; then
7361 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).])
7363 WIN32_CRT_SRC_DIR="$VCINSTALLDIR\crt\src"
7367 case "${target_cpu}" in
7369 MOZ_CRT_CPU_ARCH=intel
7372 MOZ_CRT_CPU_ARCH=amd64
7375 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7379 AC_SUBST(MOZ_CRT_CPU_ARCH)
7381 if test ! -d "$WIN32_CRT_SRC_DIR"; then
7382 AC_MSG_ERROR([Invalid Win32 CRT source directory: ${WIN32_CRT_SRC_DIR}])
7384 WIN32_CRT_SRC_DIR=`cd "$WIN32_CRT_SRC_DIR" && pwd -W`
7385 _objdir_win=`pwd -W`
7386 WIN32_CUSTOM_CRT_DIR="$_objdir_win/memory/jemalloc/crtsrc/build/$MOZ_CRT_CPU_ARCH"
7387 MOZ_MEMORY_LDFLAGS="-MANIFEST:NO -LIBPATH:\"$WIN32_CUSTOM_CRT_DIR\" -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt19 -DEFAULTLIB:mozcpp19"
7388 dnl Also pass this to NSPR/NSS
7389 DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
7393 AC_DEFINE(MOZ_MEMORY_WINCE)
7394 AC_DEFINE(MOZ_MEMORY_WINDOWS)
7395 if test -z "$WINCE_WINDOWS_MOBILE"; then
7396 AC_DEFINE(MOZ_MEMORY_WINCE6)
7400 AC_DEFINE(MOZ_MEMORY_WINCE)
7401 AC_DEFINE(MOZ_MEMORY_WINDOWS)
7404 AC_DEFINE(MOZ_MEMORY_LINUX)
7405 AC_DEFINE(MOZ_MEMORY_ANDROID)
7407 export WRAP_MALLOC_LIB="-L$_objdir/dist/lib -lmozalloc -lmozutils"
7408 WRAP_MALLOC_CFLAGS="-Wl,--wrap=dlopen -Wl,--wrap=dlclose -Wl,--wrap=dlerror -Wl,--wrap=dlsym -Wl,--wrap=dladdr"
7411 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7415 if test "$OS_ARCH" != "Darwin"; then
7416 dnl NB: this must be kept in sync with jemalloc.h
7417 AC_DEFINE(HAVE_JEMALLOC_VALLOC)
7418 AC_DEFINE(HAVE_JEMALLOC_POSIX_MEMALIGN)
7419 AC_DEFINE(HAVE_JEMALLOC_MEMALIGN)
7422 AC_SUBST(MOZ_MEMORY)
7423 AC_SUBST(MOZ_MEMORY_LDFLAGS)
7424 AC_SUBST(WIN32_CRT_SRC_DIR)
7425 dnl Need to set this for make because NSS doesn't have configure
7428 dnl ========================================================
7429 dnl = Use malloc wrapper lib
7430 dnl ========================================================
7431 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7432 [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)],
7436 if test -n "$_WRAP_MALLOC"; then
7437 if test "$GNU_CC"; then
7438 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"
7439 MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) $(WRAP_MALLOC_LIB) -o $@'
7443 dnl ========================================================
7444 dnl = Location of malloc wrapper lib
7445 dnl ========================================================
7446 MOZ_ARG_WITH_STRING(wrap-malloc,
7447 [ --with-wrap-malloc=DIR Location of malloc wrapper library],
7448 WRAP_MALLOC_LIB=$withval)
7450 dnl ========================================================
7451 dnl = Use JS Call tracing
7452 dnl ========================================================
7453 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7454 [ --enable-trace-jscalls Enable JS call enter/exit callback (default=no)],
7455 MOZ_TRACE_JSCALLS=1,
7456 MOZ_TRACE_JSCALLS= )
7457 if test -n "$MOZ_TRACE_JSCALLS"; then
7458 AC_DEFINE(MOZ_TRACE_JSCALLS)
7461 dnl ========================================================
7463 dnl ========================================================
7464 MOZ_ARG_ENABLE_BOOL(tracevis,
7465 [ --enable-tracevis Enable TraceVis tracing tool (default=no)],
7468 if test -n "$MOZ_TRACEVIS"; then
7469 AC_DEFINE(MOZ_TRACEVIS)
7472 dnl ========================================================
7474 dnl ========================================================
7475 MOZ_ARG_ENABLE_BOOL(gctimer,
7476 [ --enable-gctimer Enable GC timer (default=no)],
7479 if test -n "$MOZ_GCTIMER"; then
7480 AC_DEFINE(MOZ_GCTIMER)
7483 dnl ========================================================
7485 dnl ========================================================
7486 MOZ_ARG_ENABLE_BOOL(valgrind,
7487 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
7490 if test -n "$MOZ_VALGRIND"; then
7491 AC_CHECK_HEADER([valgrind/valgrind.h], [],
7493 [--enable-valgrind specified but Valgrind is not installed]))
7494 AC_DEFINE(MOZ_VALGRIND)
7497 dnl ========================================================
7499 dnl ========================================================
7500 MOZ_ARG_ENABLE_BOOL(jprof,
7501 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
7504 if test -n "$MOZ_JPROF"; then
7506 AC_DEFINE(MOZ_JPROF)
7509 dnl ========================================================
7511 dnl ========================================================
7512 MOZ_ARG_ENABLE_BOOL(shark,
7513 [ --enable-shark Enable shark remote profiling (needs CHUD framework). Implies --enable-profiling.],
7516 if test -n "$MOZ_SHARK"; then
7518 AC_DEFINE(MOZ_SHARK)
7521 dnl ========================================================
7523 dnl ========================================================
7524 MOZ_ARG_ENABLE_BOOL(callgrind,
7525 [ --enable-callgrind Enable callgrind profiling],
7528 if test -n "$MOZ_CALLGRIND"; then
7529 AC_DEFINE(MOZ_CALLGRIND)
7532 dnl ========================================================
7534 dnl ========================================================
7535 MOZ_ARG_ENABLE_BOOL(vtune,
7536 [ --enable-vtune Enable vtune profiling. Implies --enable-profiling.],
7539 if test -n "$MOZ_VTUNE"; then
7541 AC_DEFINE(MOZ_VTUNE)
7544 dnl ========================================================
7545 dnl Zealous JavaScript GC
7546 dnl ========================================================
7547 MOZ_ARG_ENABLE_BOOL(gczeal,
7548 [ --enable-gczeal Enable zealous JavaScript GCing],
7551 if test -n "$JS_GC_ZEAL"; then
7552 AC_DEFINE(JS_GC_ZEAL)
7555 dnl ======================================================
7556 dnl = Enable compiling with ccache
7557 dnl ======================================================
7558 MOZ_ARG_WITH_STRING(ccache,
7559 [ --with-ccache[=path/to/ccache]
7560 Enable compiling with ccache],
7561 CCACHE=$withval, CCACHE="no")
7563 if test "$CCACHE" != "no"; then
7564 if test -z "$CCACHE" -o "$CCACHE" = "yes"; then
7567 if test ! -e "$CCACHE"; then
7568 AC_MSG_ERROR([$CCACHE not found])
7571 MOZ_PATH_PROGS(CCACHE, $CCACHE ccache)
7572 if test -z "$CCACHE" -o "$CCACHE" = ":"; then
7573 AC_MSG_ERROR([ccache not found])
7574 elif test -x "$CCACHE"; then
7578 AC_MSG_ERROR([$CCACHE is not executable])
7582 dnl ========================================================
7583 dnl = Enable static checking using gcc-dehydra
7584 dnl ========================================================
7586 MOZ_ARG_WITH_STRING(static-checking,
7587 [ --with-static-checking=path/to/gcc_dehydra.so
7588 Enable static checking of code using GCC-dehydra],
7589 DEHYDRA_PATH=$withval,
7592 if test -n "$DEHYDRA_PATH"; then
7593 if test ! -f "$DEHYDRA_PATH"; then
7594 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7596 AC_DEFINE(NS_STATIC_CHECKING)
7598 AC_SUBST(DEHYDRA_PATH)
7600 dnl ========================================================
7601 dnl = Enable stripping of libs & executables
7602 dnl ========================================================
7603 MOZ_ARG_ENABLE_BOOL(strip,
7604 [ --enable-strip Enable stripping of libs & executables ],
7608 dnl ========================================================
7609 dnl = Enable stripping of libs & executables when packaging
7610 dnl ========================================================
7611 MOZ_ARG_ENABLE_BOOL(install-strip,
7612 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
7616 dnl ========================================================
7617 dnl = --enable-elf-dynstr-gc
7618 dnl ========================================================
7619 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7620 [ --enable-elf-dynstr-gc Enable elf dynstr garbage collector (opt builds only)],
7621 USE_ELF_DYNSTR_GC=1,
7622 USE_ELF_DYNSTR_GC= )
7624 dnl ========================================================
7626 dnl = Profiling and Instrumenting
7628 dnl ========================================================
7629 MOZ_ARG_HEADER(Profiling and Instrumenting)
7631 dnl ========================================================
7632 dnl = Enable timeline service, which provides lightweight
7633 dnl = instrumentation of mozilla for performance measurement.
7634 dnl = Timeline is off by default.
7635 dnl ========================================================
7636 MOZ_ARG_ENABLE_BOOL(timeline,
7637 [ --enable-timeline Enable timeline services ],
7640 if test -n "$MOZ_TIMELINE"; then
7641 AC_DEFINE(MOZ_TIMELINE)
7644 dnl ========================================================
7645 dnl = Enable NS_FUNCTION_TIMER, which provides Function
7646 dnl = timing for identifying code bottlenecks
7647 dnl = NS_FUNCTION_TIMER is off by default.
7648 dnl ========================================================
7649 MOZ_ARG_ENABLE_BOOL(functiontimer,
7650 [ --enable-functiontimer Enable NS_FUNCTION_TIMER ],
7651 NS_FUNCTION_TIMER=1,
7652 NS_FUNCTION_TIMER= )
7653 if test -n "$NS_FUNCTION_TIMER"; then
7654 AC_DEFINE(NS_FUNCTION_TIMER)
7657 dnl ========================================================
7658 dnl Turn on reflow counting
7659 dnl ========================================================
7660 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7661 [ --enable-reflow-perf Enable reflow performance tracing],
7664 if test -n "$MOZ_REFLOW_PERF"; then
7665 AC_DEFINE(MOZ_REFLOW_PERF)
7668 dnl ========================================================
7669 dnl Enable code size metrics.
7670 dnl ========================================================
7671 MOZ_ARG_ENABLE_BOOL(codesighs,
7672 [ --enable-codesighs Enable code size analysis tools],
7673 _ENABLE_CODESIGHS=1,
7674 _ENABLE_CODESIGHS= )
7675 if test -n "$_ENABLE_CODESIGHS"; then
7676 if test -d $srcdir/tools/codesighs; then
7679 AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7683 dnl ========================================================
7684 dnl = Support for Quantify (Windows)
7685 dnl ========================================================
7686 MOZ_ARG_ENABLE_BOOL(quantify,
7687 [ --enable-quantify Enable Quantify support (Windows only) ],
7691 dnl ========================================================
7692 dnl = Support for demangling undefined symbols
7693 dnl ========================================================
7694 if test -z "$SKIP_LIBRARY_CHECKS"; then
7697 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7701 # Demangle only for debug or trace-malloc builds
7702 MOZ_DEMANGLE_SYMBOLS=
7703 if test "$HAVE_DEMANGLE" -a "$HAVE_GCC3_ABI" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7704 MOZ_DEMANGLE_SYMBOLS=1
7705 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7707 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7709 dnl ========================================================
7710 dnl = Support for gcc stack unwinding (from gcc 3.3)
7711 dnl ========================================================
7712 if test "$HAVE_GCC3_ABI" -a -z "$SKIP_LIBRARY_CHECKS"; then
7713 AC_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7716 dnl ========================================================
7720 dnl ========================================================
7721 MOZ_ARG_HEADER(Misc. Options)
7723 dnl ========================================================
7724 dnl update xterm title
7725 dnl ========================================================
7726 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7727 [ --enable-xterm-updates Update XTERM titles with current command.],
7731 dnl =========================================================
7733 dnl =========================================================
7734 MOZ_ARG_ENABLE_STRING([chrome-format],
7735 [ --enable-chrome-format=jar|flat|both|symlink|omni
7736 Select FORMAT of chrome files (default=jar)],
7737 MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7739 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7740 MOZ_CHROME_FILE_FORMAT=jar
7743 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7744 test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7745 test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7746 test "$MOZ_CHROME_FILE_FORMAT" != "both" &&
7747 test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7748 AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, symlink, or omni])
7751 dnl =========================================================
7752 dnl Omnijar packaging (bug 552121)
7753 dnl =========================================================
7754 dnl Omnijar packaging is compatible with flat packaging.
7755 dnl In unpackaged builds, omnijar looks for files as if
7756 dnl things were flat packaged. After packaging, all files
7757 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7758 dnl is set to flat since putting files into jars is only
7759 dnl done during packaging with omnijar.
7760 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7762 AC_DEFINE(MOZ_OMNIJAR)
7763 MOZ_CHROME_FILE_FORMAT=flat
7764 elif test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7765 AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7768 AC_SUBST(MOZ_OMNIJAR)
7770 dnl ========================================================
7771 dnl = Define default location for MOZILLA_FIVE_HOME
7772 dnl ========================================================
7773 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7774 [ --with-default-mozilla-five-home
7775 Set the default value for MOZILLA_FIVE_HOME],
7776 [ val=`echo $withval`
7777 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7779 dnl ========================================================
7780 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7781 dnl ========================================================
7782 MOZ_ARG_WITH_STRING(user-appdir,
7783 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
7784 [ val=`echo $withval`
7785 if echo "$val" | grep "\/" >/dev/null; then
7786 AC_MSG_ERROR("Homedir must be single relative path.")
7791 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7793 dnl ========================================================
7794 dnl = Doxygen configuration
7795 dnl ========================================================
7796 dnl Use commas to specify multiple dirs to this arg
7797 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7798 MOZ_ARG_WITH_STRING(doc-input-dirs,
7799 [ --with-doc-input-dirs=DIRS
7800 Header/idl dirs to create docs from],
7801 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7802 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7804 dnl Use commas to specify multiple dirs to this arg
7805 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7806 MOZ_ARG_WITH_STRING(doc-include-dirs,
7807 [ --with-doc-include-dirs=DIRS
7808 Include dirs to preprocess doc headers],
7809 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7810 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7812 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7813 MOZ_ARG_WITH_STRING(doc-output-dir,
7814 [ --with-doc-output-dir=DIR
7815 Dir to generate docs into],
7816 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7817 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7819 if test -z "$SKIP_COMPILER_CHECKS"; then
7820 dnl ========================================================
7822 dnl = Compiler Options
7824 dnl ========================================================
7825 MOZ_ARG_HEADER(Compiler Options)
7827 dnl ========================================================
7828 dnl Check for gcc -pipe support
7829 dnl ========================================================
7830 AC_MSG_CHECKING([for gcc -pipe support])
7831 if test -n "$GNU_CC" -a -n "$GNU_CXX" -a -n "$GNU_AS"; then
7832 echo '#include <stdio.h>' > dummy-hello.c
7833 echo 'int main() { printf("Hello World\n"); exit(0); }' >> dummy-hello.c
7834 ${CC} -S dummy-hello.c -o dummy-hello.s 2>&5
7835 cat dummy-hello.s 2> /dev/null | ${AS_BIN} -o dummy-hello.S - 2>&5
7836 if test $? = 0; then
7841 if test "$_res_as_stdin" = "yes"; then
7842 _SAVE_CFLAGS=$CFLAGS
7843 CFLAGS="$CFLAGS -pipe"
7844 AC_TRY_COMPILE( [ #include <stdio.h> ],
7845 [printf("Hello World\n");],
7846 [_res_gcc_pipe="yes"],
7847 [_res_gcc_pipe="no"] )
7848 CFLAGS=$_SAVE_CFLAGS
7850 if test "$_res_as_stdin" = "yes" -a "$_res_gcc_pipe" = "yes"; then
7852 CFLAGS="$CFLAGS -pipe"
7853 CXXFLAGS="$CXXFLAGS -pipe"
7857 rm -f dummy-hello.c dummy-hello.s dummy-hello.S dummy-hello a.out
7858 AC_MSG_RESULT([$_res])
7863 dnl ========================================================
7864 dnl Profile guided optimization
7865 dnl ========================================================
7866 dnl Test for profiling options
7867 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7869 dnl Provide a switch to disable PGO even when called via profiledbuild.
7870 MOZ_ARG_DISABLE_BOOL(profile-guided-optimization,
7871 [ --disable-profile-guided-optimization
7872 Don't build with PGO even if called via make profiledbuild],
7873 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=1,
7874 MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE=)
7876 AC_SUBST(MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE)
7878 _SAVE_CFLAGS="$CFLAGS"
7879 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7881 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7882 AC_TRY_COMPILE([], [return 0;],
7883 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7884 result="yes" ], result="no")
7885 AC_MSG_RESULT([$result])
7887 if test $result = "yes"; then
7888 PROFILE_GEN_LDFLAGS="-fprofile-generate"
7889 PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch -freorder-blocks-and-partition"
7890 PROFILE_USE_LDFLAGS="-fprofile-use"
7893 CFLAGS="$_SAVE_CFLAGS"
7895 if test -n "$INTEL_CC"; then
7896 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7897 PROFILE_GEN_LDFLAGS=
7898 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7899 PROFILE_USE_LDFLAGS=
7902 dnl Sun Studio on Solaris
7903 if test "$SOLARIS_SUNPRO_CC"; then
7904 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7905 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7906 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7907 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7910 AC_SUBST(PROFILE_GEN_CFLAGS)
7911 AC_SUBST(PROFILE_GEN_LDFLAGS)
7912 AC_SUBST(PROFILE_USE_CFLAGS)
7913 AC_SUBST(PROFILE_USE_LDFLAGS)
7917 dnl ========================================================
7918 dnl Test for -pedantic bustage
7919 dnl ========================================================
7920 MOZ_ARG_DISABLE_BOOL(pedantic,
7921 [ --disable-pedantic Issue all warnings demanded by strict ANSI C ],
7923 if test "$_PEDANTIC"; then
7924 _SAVE_CXXFLAGS=$CXXFLAGS
7925 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
7926 AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7927 AC_TRY_COMPILE([$configure_static_assert_macros],
7928 [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7929 result="no", result="yes" )
7930 AC_MSG_RESULT([$result])
7931 CXXFLAGS="$_SAVE_CXXFLAGS"
7935 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
7936 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} ${_COMPILER_PREFIX}-pedantic ${_COMPILER_PREFIX}-Wno-long-long"
7939 AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic. Reconfigure using --disable-pedantic. ])
7944 dnl ========================================================
7945 dnl Test for correct temporary object destruction order
7946 dnl ========================================================
7947 dnl We want to make sure the compiler follows the C++ spec here as
7948 dnl xpcom and the string classes depend on it (bug 235381).
7949 AC_MSG_CHECKING([for correct temporary object destruction order])
7950 AC_TRY_RUN([ class A {
7951 public: A(int& x) : mValue(x) {}
7953 operator char**() { return 0; }
7954 private: int& mValue;
7956 void func(char **arg) {}
7967 result="yes", result="no", result="maybe")
7968 AC_MSG_RESULT([$result])
7970 if test "$result" = "no"; then
7971 AC_MSG_ERROR([Your compiler does not follow the C++ specification for temporary object destruction order.])
7974 dnl ========================================================
7975 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7976 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7977 dnl raw pointers in nsCOMPtr.h. (VC++ has the same bug.)
7978 dnl ========================================================
7979 _SAVE_CXXFLAGS=$CXXFLAGS
7980 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7981 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7982 ac_nscap_nonconst_opeq_bug,
7991 template <class T, class U>
7992 int operator==(const Pointer<T>& rhs, U* lhs)
7994 return rhs.myPtr == lhs;
7997 template <class T, class U>
7998 int operator==(const Pointer<T>& rhs, const U* lhs)
8000 return rhs.myPtr == lhs;
8008 ac_nscap_nonconst_opeq_bug="no",
8009 ac_nscap_nonconst_opeq_bug="yes")])
8010 CXXFLAGS="$_SAVE_CXXFLAGS"
8012 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
8013 AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
8015 fi # SKIP_COMPILER_CHECKS
8017 dnl ========================================================
8019 dnl Should be smarter and check that the compiler does indeed have rtti
8020 dnl ========================================================
8022 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
8023 [ --enable-cpp-rtti Enable C++ RTTI ],
8024 [ _MOZ_USE_RTTI=1 ],
8027 if test "$_MOZ_USE_RTTI"; then
8028 _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
8030 _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
8033 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
8035 dnl ========================================================
8036 dnl C++ exceptions (g++/VC/irix6/Sun only - for now)
8037 dnl Should be smarter and check that the compiler does indeed have exceptions
8038 dnl ========================================================
8039 MOZ_ARG_ENABLE_BOOL(cpp-exceptions,
8040 [ --enable-cpp-exceptions Enable C++ exceptions ],
8041 [ _MOZ_CPP_EXCEPTIONS=1 ],
8042 [ _MOZ_CPP_EXCEPTIONS= ])
8044 if test "$_MOZ_CPP_EXCEPTIONS"; then
8045 _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_ON
8046 AC_DEFINE(MOZ_CPP_EXCEPTIONS)
8048 _MOZ_EXCEPTIONS_FLAGS=$_MOZ_EXCEPTIONS_FLAGS_OFF
8051 AC_SUBST(_MOZ_EXCEPTIONS_FLAGS_ON)
8053 # Irix & OSF native compilers do not like exception declarations
8054 # when exceptions are disabled
8055 if test -n "$MIPSPRO_CXX" -o -n "$COMPAQ_CXX" -o -n "$VACPP"; then
8056 AC_DEFINE(CPP_THROW_NEW, [])
8058 AC_DEFINE(CPP_THROW_NEW, [throw()])
8062 dnl ========================================================
8064 dnl = Build depencency options
8066 dnl ========================================================
8067 MOZ_ARG_HEADER(Build dependencies)
8069 dnl ========================================================
8070 dnl = Do not auto generate dependency info
8071 dnl ========================================================
8073 MOZ_ARG_DISABLE_BOOL(auto-deps,
8074 [ --disable-auto-deps Do not automatically generate dependency info],
8078 if test -n "$MOZ_AUTO_DEPS"; then
8079 dnl ========================================================
8080 dnl = Use mkdepend instead of $CC -MD for dependency generation
8081 dnl ========================================================
8083 MOZ_ARG_DISABLE_BOOL(md,
8084 [ --disable-md Do not use compiler-based dependencies ],
8087 [dnl Default is to turn on -MD if using GNU-compatible compilers
8088 if test "$GNU_CC" -a "$GNU_CXX" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
8091 dnl Default is to use -xM if using Sun Studio on Solaris
8092 if test "$SOLARIS_SUNPRO_CC"; then
8095 if test "$_cpp_md_flag"; then
8097 if test "$OS_ARCH" = "OpenVMS"; then
8098 _DEPEND_CFLAGS='$(subst =, ,$(filter-out %/.pp,-MM=-MD=-MF=$(MDDEPDIR)/$(basename $(@F)).pp))'
8100 _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(basename $(@F)).pp)'
8102 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
8103 if test "$SOLARIS_SUNPRO_CC"; then
8108 dnl Don't override this for MSVC
8109 if test -z "$_WIN32_MSVC"; then
8110 _USE_CPP_INCLUDE_FLAG=
8111 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
8112 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
8114 echo '#include <stdio.h>' > dummy-hello.c
8116 CL_INCLUDES_PREFIX=`"${CC}" -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
8118 if test -z "$CL_INCLUDES_PREFIX"; then
8119 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
8121 AC_SUBST(CL_INCLUDES_PREFIX)
8123 _topsrcdirwin=`cd \`dirname $0\`; pwd -W`
8124 dnl cl.py provides dependency generation for MSVC
8125 CC_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"
8126 CXX_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"
8132 AC_SUBST(MOZ_AUTO_DEPS)
8133 AC_SUBST(COMPILER_DEPEND)
8135 AC_SUBST(CC_WRAPPER)
8136 AC_SUBST(CXX_WRAPPER)
8139 dnl ========================================================
8141 dnl = Static Build Options
8143 dnl ========================================================
8144 MOZ_ARG_HEADER(Static build options)
8146 MOZ_ARG_ENABLE_BOOL(static,
8147 [ --enable-static Enable building of internal static libs],
8148 BUILD_STATIC_LIBS=1,
8151 MOZ_ARG_ENABLE_BOOL(libxul,
8152 [ --enable-libxul Enable building of libxul],
8153 MOZ_ENABLE_LIBXUL=1,
8156 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
8157 if test "$OS_ARCH" = "WINNT"; then
8161 MOZ_ARG_ENABLE_BOOL(shared-js,
8162 [ --enable-shared-js
8163 Create a shared JavaScript library.],
8167 if test -z "$MOZ_ENABLE_LIBXUL"; then
8168 dnl --disable-libxul implies shared js
8172 if test -n "$ENABLE_SHARED_JS"; then
8174 MOZ_JS_LIBS=$MOZ_JS_SHARED_LIBS
8176 MOZ_JS_LIBS=$MOZ_JS_STATIC_LIBS
8177 AC_DEFINE(MOZ_STATIC_JS)
8179 AC_SUBST(JS_SHARED_LIBRARY)
8181 if test -n "$MOZ_STATIC_BUILD_UNSUPPORTED" -a -n "$BUILD_STATIC_LIBS"; then
8182 AC_MSG_ERROR([--enable-static is not supported for building $MOZ_APP_NAME. You probably want --enable-libxul.])
8185 if test -n "$MOZ_ENABLE_LIBXUL" -a -n "$BUILD_STATIC_LIBS"; then
8186 AC_MSG_ERROR([--enable-libxul is not compatible with --enable-static])
8189 if test -n "$MOZ_IPC" -a -z "$MOZ_ENABLE_LIBXUL"; then
8190 AC_MSG_ERROR([--enable-ipc requires --enable-libxul])
8193 if test -z "$MOZ_ENABLE_LIBXUL" -a -n "$MOZ_OMNIJAR"; then
8194 AC_MSG_ERROR([Omnijar packaging is incompatible with --disable-libxul. Please either --enable-libxul or --enable-chrome-format=jar|flat|symlink]);
8197 AC_SUBST(LIBXUL_LIBS)
8199 if test -n "$MOZ_ENABLE_LIBXUL"; then
8200 XPCOM_LIBS="$LIBXUL_LIBS"
8201 AC_DEFINE(MOZ_ENABLE_LIBXUL)
8203 if test -n "$BUILD_STATIC_LIBS"; then
8204 AC_DEFINE(MOZ_STATIC_BUILD)
8206 XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS"
8209 dnl ========================================================
8211 dnl = Standalone module options
8213 dnl ========================================================
8214 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
8216 dnl Check for GLib and libIDL.
8217 dnl ========================================================
8220 if test -z "$COMPILE_ENVIRONMENT"; then
8221 SKIP_IDL_CHECK="yes"
8224 dnl = Allow users to disable libIDL checking for standalone modules
8225 MOZ_ARG_WITHOUT_BOOL(libIDL,
8226 [ --without-libIDL Skip check for libIDL (standalone modules only)],
8227 SKIP_IDL_CHECK="yes")
8229 if test -z "$CROSS_COMPILE"; then
8230 if test -z "$HOST_LIBIDL_CONFIG"; then
8231 HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
8233 if test -z "$HOST_LIBIDL_PREFIX"; then
8234 HOST_LIBIDL_PREFIX="$LIBIDL_PREFIX"
8238 if test "$SKIP_IDL_CHECK" = "no"
8242 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
8243 if test -n "$GLIB_PREFIX"; then
8244 _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd -W`
8245 if test "$?" = "0"; then
8246 if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
8247 AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
8249 _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
8251 AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
8254 _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
8256 if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
8257 AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
8259 GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
8260 if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
8261 GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
8262 elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
8263 GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
8265 AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
8268 if test -n "$HOST_LIBIDL_PREFIX"; then
8269 _LIBIDL_PREFIX_DIR=`cd $HOST_LIBIDL_PREFIX && pwd -W`
8270 if test "$?" = "0"; then
8271 if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
8272 AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
8274 _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
8276 AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
8279 _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
8281 if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
8282 AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
8284 HOST_LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
8285 if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
8286 HOST_LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
8288 elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
8289 HOST_LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
8291 AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
8293 HOST_LIBIDL_LIBS="${HOST_LIBIDL_LIBS} ${GLIB_LIBS}"
8298 if test -z "$_LIBIDL_FOUND"; then
8299 if test "$MACOS_SDK_DIR"; then
8300 dnl xpidl, and therefore libIDL, is only needed on the build host.
8301 dnl Don't build it against the SDK, as that causes problems.
8302 _MACSAVE_CFLAGS="$CFLAGS"
8303 _MACSAVE_LIBS="$LIBS"
8304 _MACSAVE_LDFLAGS="$LDFLAGS"
8305 _MACSAVE_NEXT_ROOT="$NEXT_ROOT"
8307 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"`
8308 LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
8309 LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
8314 PKG_CHECK_MODULES(HOST_LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
8317 dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
8318 dnl to either libIDL1 or libIDL2.
8319 if test -z "$_LIBIDL_FOUND"; then
8320 AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
8321 if test -z "$_LIBIDL_FOUND"; then
8322 PKG_CHECK_MODULES(HOST_LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
8326 dnl If we don't have a libIDL config program & not cross-compiling,
8327 dnl look for orbit-config instead.
8329 if test -z "$_LIBIDL_FOUND" -a -z "$CROSS_COMPILE"; then
8330 MOZ_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
8331 if test -n "$ORBIT_CONFIG"; then
8332 AC_MSG_CHECKING([for ORBit libIDL usability])
8333 _ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
8334 _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
8335 _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
8336 _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
8337 HOST_LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
8338 HOST_LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
8340 _SAVE_CFLAGS="$CFLAGS"
8342 CFLAGS="$HOST_LIBIDL_CFLAGS $CFLAGS"
8343 LIBS="$HOST_LIBIDL_LIBS $LIBS"
8346 #include <libIDL/IDL.h>
8349 s=strdup(IDL_get_libver_string());
8357 [HOST_LIBIDL_CFLAGS=
8362 AC_MSG_RESULT($result)
8363 CFLAGS="$_SAVE_CFLAGS"
8367 if test -z "$_LIBIDL_FOUND"; then
8368 AC_MSG_ERROR([libIDL not found.
8369 libIDL $LIBIDL_VERSION or higher is required.])
8371 if test "$MACOS_SDK_DIR"; then
8372 CFLAGS="$_MACSAVE_CFLAGS"
8373 LIBS="$_MACSAVE_LIBS"
8374 LDFLAGS="$_MACSAVE_LDFLAGS"
8375 if test -n "$_MACSAVE_NEXT_ROOT" ; then
8376 export NEXT_ROOT="$_MACSAVE_NEXT_ROOT"
8381 if test -n "$CROSS_COMPILE"; then
8383 *-mingw*|*-cygwin*|*-msvc*|*-mks*)
8384 if test -n "$GLIB_PREFIX"; then
8385 GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
8386 if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
8387 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
8388 elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
8389 GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
8391 AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
8395 if test -n "$LIBIDL_PREFIX"; then
8396 LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
8397 if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
8398 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
8400 elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
8401 LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
8403 AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
8406 LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
8409 if test -n "LIBIDL_CONFIG" -a "LIBIDL_CONFIG" != "no"; then
8410 LIBIDL_CFLAGS=`${LIBIDL_CONFIG} --cflags`
8411 LIBIDL_LIBS=`${LIBIDL_CONFIG} --libs`
8416 LIBIDL_CFLAGS="$HOST_LIBIDL_CFLAGS"
8417 LIBIDL_LIBS="$HOST_LIBIDL_LIBS"
8420 if test -z "$SKIP_PATH_CHECKS"; then
8421 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
8422 if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
8423 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
8425 AM_PATH_GLIB(${GLIB_VERSION})
8430 if test -z "${GLIB_GMODULE_LIBS}" -a -n "${GLIB_CONFIG}"; then
8431 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
8434 AC_SUBST(LIBIDL_CFLAGS)
8435 AC_SUBST(LIBIDL_LIBS)
8436 AC_SUBST(STATIC_LIBIDL)
8437 AC_SUBST(GLIB_CFLAGS)
8439 AC_SUBST(GLIB_GMODULE_LIBS)
8440 AC_SUBST(HOST_LIBIDL_CONFIG)
8441 AC_SUBST(HOST_LIBIDL_CFLAGS)
8442 AC_SUBST(HOST_LIBIDL_LIBS)
8444 dnl ========================================================
8446 dnl ========================================================
8447 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8450 MOZ_ARG_ENABLE_BOOL(system-cairo,
8451 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
8456 MOZ_ARG_ENABLE_BOOL(system-pixman,
8457 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
8461 # Check for headers defining standard int types.
8462 AC_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8464 if test "$MOZ_TREE_CAIRO"; then
8465 AC_DEFINE(MOZ_TREE_CAIRO)
8467 # For now we assume that we will have a uint64_t available through
8468 # one of the above headers or mozstdint.h.
8469 AC_DEFINE(HAVE_UINT64_T)
8471 # Define macros for cairo-features.h
8472 if test "$MOZ_X11"; then
8473 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8474 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8475 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8476 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
8477 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8478 MOZ_ENABLE_CAIRO_FT=1
8479 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8481 if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
8482 QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8484 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
8485 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8486 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8487 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8489 if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
8490 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8491 if test -z "$WINCE"; then
8492 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8493 if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8494 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8495 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8496 MOZ_ENABLE_D2D_SURFACE=1
8497 MOZ_ENABLE_DWRITE_FONT=1
8499 WIN32_DWRITE_FONT_FEATURE=
8500 WIN32_D2D_SURFACE_FEATURE=
8504 WIN32_DWRITE_FONT_FEATURE=
8505 WIN32_D2D_SURFACE_FEATURE=
8508 AC_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8510 dnl D3D10 Layers depend on D2D Surfaces.
8511 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
8512 AC_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
8515 AC_TRY_COMPILE([#include <ddraw.h>], [int foo = DDLOCK_WAITNOTBUSY;], HAS_DDRAW=1, HAS_DDRAW=)
8516 if test -z "$HAS_DDRAW"; then
8517 AC_MSG_WARN([DirectDraw ddraw.h header not found or it's missing DDLOCK_WAITNOTBUSY, disabling DirectDraw surface. If you have an older SDK (such as the CE5 SDK), try copying in ddraw.lib and ddraw.h from the WM6 SDK.])
8518 DDRAW_SURFACE_FEATURE=
8520 DDRAW_SURFACE_FEATURE="#define CAIRO_HAS_DDRAW_SURFACE 1"
8523 if test -z "$OGLES_SDK_DIR"; then
8524 OGLES_SURFACE_FEATURE=
8527 #include <EGL/egl.h>
8528 #include <EGL/eglext.h>
8529 #include <GLES2/gl2.h>
8530 #include <GLES2/gl2ext.h>
8531 ], [ EGLDisplay _cairo_ddraw_egl_dpy = EGL_NO_DISPLAY;], HAS_OGLES=1, HAS_OGLES=)
8532 if test -z "$HAS_OGLES"; then
8533 AC_MSG_WARN([OpenGL ES2 headers not found, disabling OpenGL acceleration surfaces.])
8534 OGLES_SURFACE_FEATURE=
8536 OGLES_SURFACE_FEATURE="#define CAIRO_DDRAW_USE_GL 1"
8540 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
8542 if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
8543 OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
8544 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8545 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
8546 MOZ_ENABLE_CAIRO_FT=1
8547 CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8548 CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
8550 if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
8551 PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
8552 BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
8553 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8554 MOZ_ENABLE_CAIRO_FT=1
8556 if test "$USE_FC_FREETYPE"; then
8557 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8559 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8560 AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8561 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8562 AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8563 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8564 AC_SUBST(CAIRO_FT_CFLAGS)
8567 if test "$MOZ_DEBUG"; then
8568 SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
8570 SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
8573 PNG_FUNCTIONS_FEATURE="#define CAIRO_HAS_PNG_FUNCTIONS 1"
8575 AC_SUBST(PS_SURFACE_FEATURE)
8576 AC_SUBST(PDF_SURFACE_FEATURE)
8577 AC_SUBST(SVG_SURFACE_FEATURE)
8578 AC_SUBST(XLIB_SURFACE_FEATURE)
8579 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8580 AC_SUBST(QUARTZ_SURFACE_FEATURE)
8581 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8582 AC_SUBST(XCB_SURFACE_FEATURE)
8583 AC_SUBST(WIN32_SURFACE_FEATURE)
8584 AC_SUBST(DDRAW_SURFACE_FEATURE)
8585 AC_SUBST(OGLES_SURFACE_FEATURE)
8586 AC_SUBST(OS2_SURFACE_FEATURE)
8587 AC_SUBST(BEOS_SURFACE_FEATURE)
8588 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8589 AC_SUBST(FT_FONT_FEATURE)
8590 AC_SUBST(FC_FONT_FEATURE)
8591 AC_SUBST(WIN32_FONT_FEATURE)
8592 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8593 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8594 AC_SUBST(QUARTZ_FONT_FEATURE)
8595 AC_SUBST(PNG_FUNCTIONS_FEATURE)
8596 AC_SUBST(QT_SURFACE_FEATURE)
8598 MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
8600 if test "$MOZ_TREE_PIXMAN"; then
8601 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS"' $(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
8603 PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.17.3)
8604 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $PIXMAN_CFLAGS"
8605 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $PIXMAN_LIBS"
8608 if test "$MOZ_X11"; then
8609 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
8612 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8613 mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
8616 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION pixman-1 freetype2 fontconfig)
8617 MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
8618 MOZ_CAIRO_LIBS=$CAIRO_LIBS
8619 if test "$MOZ_X11"; then
8620 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8621 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8622 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8626 AC_SUBST(MOZ_TREE_CAIRO)
8627 AC_SUBST(MOZ_CAIRO_CFLAGS)
8628 AC_SUBST(MOZ_CAIRO_LIBS)
8629 AC_SUBST(MOZ_TREE_PIXMAN)
8631 dnl ========================================================
8633 dnl ========================================================
8635 QCMS_LIBS='$(call EXPAND_LIBNAME_PATH,mozqcms,$(DEPTH)/gfx/qcms)'
8638 dnl ========================================================
8640 dnl ========================================================
8641 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8642 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8644 dnl ========================================================
8646 dnl ========================================================
8647 MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)'
8648 AC_SUBST(MOZ_OTS_LIBS)
8650 dnl ========================================================
8652 dnl ========================================================
8653 MOZ_ARG_DISABLE_BOOL(xul,
8654 [ --disable-xul Disable XUL],
8656 if test "$MOZ_XUL"; then
8659 dnl remove extensions that require XUL
8660 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8665 dnl ========================================================
8666 dnl disable profile locking
8667 dnl do no use this in applications that can have more than
8668 dnl one process accessing the profile directory.
8669 dnl ========================================================
8670 MOZ_ARG_DISABLE_BOOL(profilelocking,
8671 [ --disable-profilelocking
8672 Disable profile locking],
8673 MOZ_PROFILELOCKING=,
8674 MOZ_PROFILELOCKING=1 )
8675 if test "$MOZ_PROFILELOCKING"; then
8676 AC_DEFINE(MOZ_PROFILELOCKING)
8679 dnl ========================================================
8680 dnl disable rdf services
8681 dnl ========================================================
8682 MOZ_ARG_DISABLE_BOOL(rdf,
8683 [ --disable-rdf Disable RDF],
8685 if test "$MOZ_RDF"; then
8691 dnl ========================================================
8692 dnl necko configuration options
8693 dnl ========================================================
8696 dnl option to disable various necko protocols
8698 MOZ_ARG_ENABLE_STRING(necko-protocols,
8699 [ --enable-necko-protocols[={http,ftp,default,all,none}]
8700 Enable/disable specific protocol handlers],
8701 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8702 if test "$option" = "yes" -o "$option" = "all"; then
8703 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8704 elif test "$option" = "no" -o "$option" = "none"; then
8706 elif test "$option" = "default"; then
8707 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8708 elif test `echo "$option" | grep -c \^-` != 0; then
8709 option=`echo $option | sed 's/^-//'`
8710 NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8712 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8715 NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8717 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8718 AC_SUBST(NECKO_PROTOCOLS)
8719 for p in $NECKO_PROTOCOLS; do
8720 AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8724 dnl option to disable necko's disk cache
8726 MOZ_ARG_DISABLE_BOOL(necko-disk-cache,
8727 [ --disable-necko-disk-cache
8728 Disable necko disk cache],
8731 AC_SUBST(NECKO_DISK_CACHE)
8732 if test "$NECKO_DISK_CACHE"; then
8733 AC_DEFINE(NECKO_DISK_CACHE)
8737 dnl option to disable necko's wifi scanner
8739 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8740 [ --disable-necko-wifi Disable necko wifi scanner],
8744 if test "$OS_ARCH" = "OS2"; then
8745 dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8748 if test "$NECKO_WIFI" -a \
8749 "$OS_ARCH" != "Linux" -a \
8750 "$OS_ARCH" != "Darwin" -a \
8751 "$OS_ARCH" != "SunOS" -a \
8752 "$OS_ARCH" != "WINNT" -a \
8753 "$OS_ARCH" != "WINCE"; then
8754 AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8757 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
8759 AC_CHECK_HEADER([iwlib.h])
8760 if test "$ac_cv_header_iwlib_h" != "yes"; then
8761 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])
8765 if test "$NECKO_WIFI"; then
8766 AC_DEFINE(NECKO_WIFI)
8768 AC_SUBST(NECKO_WIFI)
8771 dnl option to disable cookies
8773 MOZ_ARG_DISABLE_BOOL(cookies,
8774 [ --disable-cookies Disable cookie support],
8777 AC_SUBST(NECKO_COOKIES)
8778 if test "$NECKO_COOKIES"; then
8779 AC_DEFINE(NECKO_COOKIES)
8783 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8785 MOZ_ARG_DISABLE_BOOL(ctypes,
8786 [ --disable-ctypes Disable js-ctypes],
8789 AC_SUBST(BUILD_CTYPES)
8790 if test "$BUILD_CTYPES"; then
8791 if test "$OS_ARCH" = "WINCE" -a `echo $OS_TEST | grep -ic arm` = 1; then
8792 # Disable ctypes for arm/wince.
8795 AC_DEFINE(BUILD_CTYPES)
8799 dnl NECKO_ configuration options are not global
8800 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
8802 dnl Only build Mork if it's required
8804 if test "$MOZ_MORK"; then
8808 dnl Build the lightweight Mork reader if required
8809 AC_SUBST(MOZ_MORKREADER)
8810 if test "$MOZ_MORKREADER"; then
8811 AC_DEFINE(MOZ_MORKREADER)
8814 dnl Build Places if required
8815 if test "$MOZ_PLACES"; then
8816 AC_DEFINE(MOZ_PLACES)
8819 dnl Build Sync Services if required
8820 AC_SUBST(MOZ_SERVICES_SYNC)
8821 if test -n "$MOZ_SERVICES_SYNC"; then
8822 AC_DEFINE(MOZ_SERVICES_SYNC)
8825 dnl ========================================================
8826 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
8827 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8830 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8831 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8834 dnl ========================================================
8836 dnl = Maintainer debug option (no --enable equivalent)
8838 dnl ========================================================
8843 AC_SUBST(AR_EXTRACT)
8847 AC_SUBST(AS_DASH_C_FLAG)
8855 AC_SUBST(NS_USE_NATIVE)
8856 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8857 AC_SUBST(MOZ_UPDATE_XTERM)
8859 AC_SUBST(MOZ_PLATFORM_MAEMO)
8860 AC_SUBST(MOZ_AUTH_EXTENSION)
8861 AC_SUBST(MOZ_MATHML)
8862 AC_SUBST(MOZ_PERMISSIONS)
8864 AC_SUBST(MOZ_PREF_EXTENSIONS)
8867 AC_SUBST(MOZ_XSLT_STANDALONE)
8868 AC_SUBST(MOZ_JS_LIBS)
8871 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8872 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8873 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8874 AC_SUBST(MOZ_DEBUG_FLAGS)
8875 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8876 AC_SUBST(WARNINGS_AS_ERRORS)
8877 AC_SUBST(MOZ_EXTENSIONS)
8878 AC_SUBST(MOZ_IMG_ENCODERS)
8879 AC_SUBST(MOZ_JSDEBUGGER)
8880 AC_SUBST(MOZ_PLUGINS)
8881 AC_SUBST(MOZ_LOG_REFCNT)
8885 AC_SUBST(MOZ_CALLGRIND)
8887 AC_SUBST(MOZ_PROFILING)
8888 AC_SUBST(MOZ_JSLOADER)
8889 AC_SUBST(MOZ_USE_NATIVE_UCONV)
8890 AC_SUBST(MOZ_QUANTIFY)
8892 AC_SUBST(MOZ_PLACES)
8893 AC_SUBST(MOZ_PLACES_BOOKMARKS)
8894 AC_SUBST(MOZ_STORAGE)
8895 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8897 AC_SUBST(NS_PRINTING)
8899 AC_SUBST(MOZ_HELP_VIEWER)
8901 AC_SUBST(MOZ_JAVAXPCOM)
8902 AC_SUBST(JAVA_INCLUDE_PATH)
8907 AC_SUBST(MOZ_PROFILELOCKING)
8910 AC_SUBST(MOZ_XIE_LIBS)
8912 AC_SUBST(BUILD_STATIC_LIBS)
8913 AC_SUBST(MOZ_ENABLE_LIBXUL)
8914 AC_SUBST(ENABLE_TESTS)
8916 AC_SUBST(MOZ_UNIVERSALCHARDET)
8917 AC_SUBST(ACCESSIBILITY)
8918 AC_SUBST(MOZ_VIEW_SOURCE)
8919 AC_SUBST(MOZ_SPELLCHECK)
8920 AC_SUBST(MOZ_USER_DIR)
8921 AC_SUBST(MOZ_CRASHREPORTER)
8922 AC_SUBST(MOZ_UPDATER)
8924 AC_SUBST(ENABLE_STRIP)
8925 AC_SUBST(PKG_SKIP_STRIP)
8926 AC_SUBST(USE_ELF_DYNSTR_GC)
8927 AC_SUBST(INCREMENTAL_LINKER)
8928 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8929 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8931 AC_SUBST(MOZ_FIX_LINK_PATHS)
8932 AC_SUBST(XPCOM_LIBS)
8933 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8934 AC_SUBST(XPCOM_GLUE_LDOPTS)
8935 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8937 AC_SUBST(USE_DEPENDENT_LIBS)
8939 AC_SUBST(MOZ_BUILD_ROOT)
8940 AC_SUBST(MOZ_OS2_TOOLS)
8941 AC_SUBST(MOZ_OS2_USE_DECLSPEC)
8943 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8944 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8945 AC_SUBST(MOZ_TIMELINE)
8946 AC_SUBST(OGLES_SDK_DIR)
8948 AC_SUBST(MOZ_APP_NAME)
8949 AC_SUBST(MOZ_APP_DISPLAYNAME)
8950 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8951 AC_SUBST(MOZ_APP_UA_NAME)
8952 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8953 AC_SUBST(MOZ_APP_VERSION)
8954 AC_DEFINE_UNQUOTED(MOZ_UA_FIREFOX_VERSION, "$FIREFOX_VERSION")
8955 AC_SUBST(MOZ_UA_FIREFOX_VERSION)
8956 AC_SUBST(FIREFOX_VERSION)
8957 AC_DEFINE_UNQUOTED(MOZ_UA_BUILDID, "$MOZ_UA_BUILDID")
8958 AC_SUBST(MOZ_UA_BUILDID)
8960 AC_SUBST(MOZ_PKG_SPECIAL)
8962 AC_SUBST(MOZILLA_OFFICIAL)
8965 AC_SUBST(MOZ_MAPINFO)
8966 AC_SUBST(MOZ_BROWSE_INFO)
8967 AC_SUBST(MOZ_TOOLS_DIR)
8968 AC_SUBST(CYGWIN_WRAPPER)
8970 AC_SUBST(WIN32_REDIST_DIR)
8975 AC_SUBST(WINCE_SDK_DIR)
8976 AC_SUBST(WINCE_WINDOWS_MOBILE)
8978 dnl Echo the CFLAGS to remove extra whitespace.
8985 $_MOZ_EXCEPTIONS_FLAGS \
8986 $_WARNINGS_CXXFLAGS \
8989 COMPILE_CFLAGS=`echo \
8994 COMPILE_CXXFLAGS=`echo \
8995 $_DEFINES_CXXFLAGS \
8999 AC_SUBST(SYSTEM_MAKEDEPEND)
9000 AC_SUBST(SYSTEM_LIBXUL)
9001 AC_SUBST(SYSTEM_JPEG)
9002 AC_SUBST(SYSTEM_PNG)
9003 AC_SUBST(SYSTEM_ZLIB)
9004 AC_SUBST(SYSTEM_BZ2)
9006 AC_SUBST(JPEG_CFLAGS)
9008 AC_SUBST(ZLIB_CFLAGS)
9010 AC_SUBST(BZ2_CFLAGS)
9012 AC_SUBST(PNG_CFLAGS)
9015 AC_SUBST(MOZ_JPEG_CFLAGS)
9016 AC_SUBST(MOZ_JPEG_LIBS)
9017 AC_SUBST(MOZ_ZLIB_CFLAGS)
9018 AC_SUBST(MOZ_ZLIB_LIBS)
9019 AC_SUBST(MOZ_BZ2_CFLAGS)
9020 AC_SUBST(MOZ_BZ2_LIBS)
9021 AC_SUBST(MOZ_PNG_CFLAGS)
9022 AC_SUBST(MOZ_PNG_LIBS)
9024 AC_SUBST(NSPR_CFLAGS)
9026 AC_SUBST(MOZ_NATIVE_NSPR)
9028 AC_SUBST(NSS_CFLAGS)
9030 AC_SUBST(NSS_DEP_LIBS)
9031 AC_SUBST(MOZ_NATIVE_NSS)
9032 AC_SUBST(NSS_DISABLE_DBM)
9037 AC_SUBST(COMPILE_CFLAGS)
9038 AC_SUBST(COMPILE_CXXFLAGS)
9041 AC_SUBST(CROSS_COMPILE)
9042 AC_SUBST(WCHAR_CFLAGS)
9046 AC_SUBST(HOST_CFLAGS)
9047 AC_SUBST(HOST_CXXFLAGS)
9048 AC_SUBST(HOST_OPTIMIZE_FLAGS)
9050 AC_SUBST(HOST_AR_FLAGS)
9052 AC_SUBST(HOST_RANLIB)
9053 AC_SUBST(HOST_NSPR_MDCPUCFG)
9054 AC_SUBST(HOST_BIN_SUFFIX)
9055 AC_SUBST(HOST_OS_ARCH)
9057 AC_SUBST(TARGET_CPU)
9058 AC_SUBST(TARGET_VENDOR)
9060 AC_SUBST(TARGET_NSPR_MDCPUCFG)
9061 AC_SUBST(TARGET_MD_ARCH)
9062 AC_SUBST(TARGET_XPCOM_ABI)
9065 AC_SUBST(OS_RELEASE)
9068 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
9069 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
9071 AC_SUBST(WRAP_MALLOC_CFLAGS)
9072 AC_SUBST(WRAP_MALLOC_LIB)
9075 AC_SUBST(MKSHLIB_FORCE_ALL)
9076 AC_SUBST(MKSHLIB_UNFORCE_ALL)
9077 AC_SUBST(DSO_CFLAGS)
9078 AC_SUBST(DSO_PIC_CFLAGS)
9079 AC_SUBST(DSO_LDOPTS)
9080 AC_SUBST(LIB_PREFIX)
9081 AC_SUBST(DLL_PREFIX)
9082 AC_SUBST(DLL_SUFFIX)
9083 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
9084 AC_SUBST(LIB_SUFFIX)
9085 AC_SUBST(OBJ_SUFFIX)
9086 AC_SUBST(BIN_SUFFIX)
9087 AC_SUBST(ASM_SUFFIX)
9088 AC_SUBST(IMPORT_LIB_SUFFIX)
9090 AC_SUBST(CC_VERSION)
9091 AC_SUBST(CXX_VERSION)
9092 AC_SUBST(MSMANIFEST_TOOL)
9093 AC_SUBST(NS_ENABLE_TSF)
9094 AC_SUBST(MOZ_NSS_PATCH)
9095 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
9096 AC_SUBST(MOZ_APP_EXTRA_LIBS)
9099 AC_SUBST(MOZ_SYDNEYAUDIO)
9101 AC_SUBST(MOZ_VORBIS)
9102 AC_SUBST(MOZ_TREMOR)
9105 AC_SUBST(MOZ_ALSA_LIBS)
9107 AC_SUBST(VPX_ASFLAGS)
9108 AC_SUBST(VPX_X86_ASM)
9110 if test "$USING_HCC"; then
9111 CC='${topsrcdir}/build/hcc'
9113 CXX='${topsrcdir}/build/hcpp'
9114 CXX="$CXX '$_OLDCXX'"
9119 AC_MSG_CHECKING([for posix_fallocate])
9120 AC_TRY_LINK([#define _XOPEN_SOURCE 600
9121 #include <fcntl.h>],
9122 [posix_fallocate(0, 0, 0);],
9123 [ac_cv___posix_fallocate=true],
9124 [ac_cv___posix_fallocate=false])
9126 if test "$ac_cv___posix_fallocate" = true ; then
9127 AC_DEFINE(HAVE_POSIX_FALLOCATE)
9133 dnl Check for missing components
9134 if test "$COMPILE_ENVIRONMENT"; then
9135 if test "$MOZ_X11"; then
9136 dnl ====================================================
9137 dnl = Check if X headers exist
9138 dnl ====================================================
9139 _SAVE_CFLAGS=$CFLAGS
9140 CFLAGS="$CFLAGS $XCFLAGS"
9144 #include <X11/Xlib.h>
9145 #include <X11/Intrinsic.h>
9149 if ((dpy = XOpenDisplay(NULL)) == NULL) {
9150 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
9154 [ AC_MSG_ERROR([Could not compile basic X program.]) ])
9155 CFLAGS="$_SAVE_CFLAGS"
9157 if test ! -z "$MISSING_X"; then
9158 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
9163 dnl Check for headers, etc. needed by WebGL.
9164 if test -n "$MOZ_WEBGL_GLX"; then
9165 AC_CHECK_HEADER(GL/glx.h)
9166 if test "$ac_cv_header_GL_glx_h" != "yes"; then
9167 AC_MSG_ERROR([Can't find header GL/glx.h for WebGL (install mesa-common-dev (Ubuntu), mesa-libGL-devel (Fedora), or Mesa (SuSE))])
9170 fi # COMPILE_ENVIRONMENT
9172 if test "$USE_FC_FREETYPE"; then
9173 if test "$COMPILE_ENVIRONMENT"; then
9174 _SAVE_CPPFLAGS="$CPPFLAGS"
9175 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
9176 AC_CHECK_HEADERS(fontconfig/fcfreetype.h, ,
9177 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)])
9178 CPPFLAGS="$_SAVE_CPPFLAGS"
9180 AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
9184 dnl Set various defines and substitutions
9185 dnl ========================================================
9187 if test "$OS_ARCH" = "BeOS"; then
9189 elif test "$OS_ARCH" = "Darwin"; then
9191 AC_DEFINE(UNIX_ASYNC_DNS)
9192 elif test "$OS_ARCH" = "OpenVMS"; then
9194 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2" -a "$OS_ARCH" != "WINCE"; then
9196 AC_DEFINE(UNIX_ASYNC_DNS)
9199 if test "$MOZ_DEBUG"; then
9200 AC_DEFINE(MOZ_REFLOW_PERF)
9201 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
9204 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
9205 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
9206 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
9207 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
9208 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
9209 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
9210 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
9211 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
9212 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
9215 dnl ========================================================
9216 dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
9217 dnl ========================================================
9220 WIN_TOP_SRC=`cd $srcdir; pwd -W`
9223 HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
9224 HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
9225 CC="\$(CYGWIN_WRAPPER) $CC"
9226 CXX="\$(CYGWIN_WRAPPER) $CXX"
9227 CPP="\$(CYGWIN_WRAPPER) $CPP"
9228 LD="\$(CYGWIN_WRAPPER) $LD"
9229 AS="\$(CYGWIN_WRAPPER) $AS"
9230 RC="\$(CYGWIN_WRAPPER) $RC"
9231 MIDL="\$(CYGWIN_WRAPPER) $MIDL"
9232 CYGDRIVE_MOUNT=`mount -p | awk '{ if (/^\//) { print $1; exit } }'`
9233 WIN_TOP_SRC=`cygpath -a -w $srcdir | sed -e 's|\\\\|/|g'`
9237 AC_SUBST(CYGDRIVE_MOUNT)
9238 AC_SUBST(WIN_TOP_SRC)
9240 AC_SUBST(MOZILLA_VERSION)
9242 AC_SUBST(ac_configure_args)
9244 dnl Spit out some output
9245 dnl ========================================================
9247 dnl The following defines are used by xpcom
9248 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
9250 HAVE_CPP_2BYTE_WCHAR_T
9251 HAVE_CPP_ACCESS_CHANGING_USING
9252 HAVE_CPP_AMBIGUITY_RESOLVING_USING
9255 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
9257 HAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
9258 HAVE_CPP_NAMESPACE_STD
9260 HAVE_CPP_PARTIAL_SPECIALIZATION
9261 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
9263 HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
9265 NEED_CPP_UNUSED_IMPLEMENTATIONS
9269 HAVE_ICONV_WITH_CONST_INPUT
9277 netwerk/necko-config.h
9278 xpcom/xpcom-config.h
9279 xpcom/xpcom-private.h
9282 # Save the defines header file before autoconf removes it.
9283 # (Do not add AC_DEFINE calls after this line.)
9284 _CONFIG_TMP=confdefs-tmp.h
9285 _CONFIG_DEFS_H=mozilla-config.h
9287 cat > $_CONFIG_TMP <<\EOF
9288 /* List of defines generated by configure. Included with preprocessor flag,
9289 * -include, to avoid long list of -D defines on the compile command-line.
9293 #ifndef _MOZILLA_CONFIG_H_
9294 #define _MOZILLA_CONFIG_H_
9297 _EGREP_PATTERN='^#define ('
9298 if test -n "$_NON_GLOBAL_ACDEFINES"; then
9299 for f in $_NON_GLOBAL_ACDEFINES; do
9300 _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
9303 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
9305 sort confdefs.h | egrep -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
9307 cat >> $_CONFIG_TMP <<\EOF
9309 #endif /* _MOZILLA_CONFIG_H_ */
9313 # Only write mozilla-config.h when something changes (or it doesn't exist)
9314 if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
9317 AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
9318 mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
9320 echo ==== $_CONFIG_DEFS_H =================================
9324 dnl Probably shouldn't call this manually but we always want the output of DEFS
9325 rm -f confdefs.h.save
9326 mv confdefs.h confdefs.h.save
9327 egrep -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
9328 AC_OUTPUT_MAKE_DEFS()
9330 AC_SUBST(MOZ_DEFINES)
9332 mv confdefs.h.save confdefs.h
9334 dnl Load the list of Makefiles to generate.
9335 dnl To add new Makefiles, edit allmakefiles.sh.
9336 dnl allmakefiles.sh sets the variable, MAKEFILES.
9337 . ${srcdir}/allmakefiles.sh
9339 dnl Run a perl script to quickly create the makefiles.
9340 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
9341 dnl for the files it cannot handle correctly. This way, config.status
9342 dnl will handle these files.
9343 dnl If it fails, nothing is set and config.status will run as usual.
9345 dnl This does not change the $MAKEFILES variable.
9347 dnl OpenVMS gets a line overflow on the long eval command, so use a temp file.
9349 if test -z "${AS_PERL}"; then
9350 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
9352 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl -nowrap --cygwin-srcdir=$srcdir > conftest.sh
9357 echo $MAKEFILES > unallmakefiles
9359 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
9361 AC_OUTPUT($MAKEFILES)
9363 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
9364 if test "$CAIRO_FEATURES_H"; then
9365 if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
9366 echo "$CAIRO_FEATURES_H is unchanged"
9367 mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
9369 rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
9373 dnl ========================================================
9374 dnl = Setup a nice relatively clean build environment for
9375 dnl = sub-configures.
9376 dnl ========================================================
9379 CFLAGS="$_SUBDIR_CFLAGS"
9380 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9381 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9382 LDFLAGS="$_SUBDIR_LDFLAGS"
9383 HOST_CC="$_SUBDIR_HOST_CC"
9384 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9385 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9391 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9392 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9394 if test -n "$MOZ_THUMB2"; then
9395 _SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --enable-thumb2"
9397 if test -n "$_WRAP_MALLOC"; then
9398 _SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --enable-wrap-malloc"
9401 if test -z "$MOZ_NATIVE_NSPR"; then
9402 ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9403 if test -z "$MOZ_DEBUG"; then
9404 ac_configure_args="$ac_configure_args --disable-debug"
9406 if test "$MOZ_OPTIMIZE" = "1"; then
9407 ac_configure_args="$ac_configure_args --enable-optimize"
9409 if test "$OS_ARCH" = "WINNT" -a "$NS_TRACE_MALLOC"; then
9410 ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
9412 if test -n "$HAVE_64BIT_OS"; then
9413 ac_configure_args="$ac_configure_args --enable-64bit"
9415 if test -n "$USE_ARM_KUSER"; then
9416 ac_configure_args="$ac_configure_args --with-arm-kuser"
9418 AC_OUTPUT_SUBDIRS(nsprpub)
9419 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9422 if test -z "$MOZ_NATIVE_NSPR"; then
9423 # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
9424 AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
9425 if test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "WINCE"; then
9426 NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
9427 $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
9428 NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
9429 $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
9431 rm -f config/autoconf.mk.bak
9434 # Run the SpiderMonkey 'configure' script.
9435 dist=$MOZ_BUILD_ROOT/dist
9436 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9437 ac_configure_args="$ac_configure_args --enable-threadsafe"
9438 if test "$BUILD_CTYPES"; then
9439 # Build js-ctypes on the platforms we can.
9440 ac_configure_args="$ac_configure_args --enable-ctypes"
9442 if test -z "$JS_SHARED_LIBRARY" ; then
9443 ac_configure_args="$ac_configure_args --disable-shared-js"
9445 if test -z "$MOZ_NATIVE_NSPR"; then
9446 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9447 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9449 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9450 ac_configure_args="$ac_configure_args --prefix=$dist"
9451 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
9452 if test "$MOZ_MEMORY"; then
9453 ac_configure_args="$ac_configure_args --enable-jemalloc"
9454 if test -n "$MOZ_MEMORY_LDFLAGS"; then
9455 export MOZ_MEMORY_LDFLAGS
9458 AC_OUTPUT_SUBDIRS(js/src)
9459 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9461 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
9463 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
9464 dnl Needs to be at the end to respect possible changes from NSPR configure
9465 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
9466 echo "config/autoconf.mk is unchanged"
9467 mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
9469 rm -f config/autoconf.mk.orig 2> /dev/null