1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
2 dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
3 dnl ***** BEGIN LICENSE BLOCK *****
4 dnl Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 dnl The contents of this file are subject to the Mozilla Public License Version
7 dnl 1.1 (the "License"); you may not use this file except in compliance with
8 dnl the License. You may obtain a copy of the License at
9 dnl http://www.mozilla.org/MPL/
11 dnl Software distributed under the License is distributed on an "AS IS" basis,
12 dnl WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 dnl for the specific language governing rights and limitations under the
16 dnl The Original Code is this file as it was released upon August 6, 1998.
18 dnl The Initial Developer of the Original Code is
19 dnl Christopher Seawood.
20 dnl Portions created by the Initial Developer are Copyright (C) 1998-2001
21 dnl the Initial Developer. All Rights Reserved.
24 dnl Jamie Zawinski <jwz@jwz.org>
25 dnl gettimeofday args check
26 dnl Christopher Blizzard <blizzard@appliedtheory.com>
27 dnl gnomefe update & enable-pthreads
28 dnl Ramiro Estrugo <ramiro@netscape.com>
29 dnl X11 makedepend support
31 dnl Henry Sobotka <sobotka@axess.com>
33 dnl Dan Mosedale <dmose@mozilla.org>
35 dnl Seth Spitzer <sspitzer@netscape.com>
37 dnl Benjamin Smedberg <benjamin@smedbergs.us>
38 dnl Howard Chu <hyc@symas.com>
40 dnl Mark Mentovai <mark@moxienet.com>:
41 dnl Mac OS X 10.4 support
42 dnl Giorgio Maone <g.maone@informaction.com>
43 dnl MSVC l10n compatible version check
44 dnl Ben Turner <mozilla@songbirdnest.com>
45 dnl Windows x64 support
46 dnl Makoto Kato <m_kato@ga2.so-net.ne.jp>
48 dnl Alternatively, the contents of this file may be used under the terms of
49 dnl either the GNU General Public License Version 2 or later (the "GPL"), or
50 dnl the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
51 dnl in which case the provisions of the GPL or the LGPL are applicable instead
52 dnl of those above. If you wish to allow use of your version of this file only
53 dnl under the terms of either the GPL or the LGPL, and not to allow others to
54 dnl use your version of this file under the terms of the MPL, indicate your
55 dnl decision by deleting the provisions above and replace them with the notice
56 dnl and other provisions required by the GPL or the LGPL. If you do not delete
57 dnl the provisions above, a recipient may use your version of this file under
58 dnl the terms of any one of the MPL, the GPL or the LGPL.
60 dnl ***** END LICENSE BLOCK *****
62 dnl Process this file with autoconf to produce a configure script.
63 dnl ========================================================
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 ========================================================
124 WINDRES_VERSION=2.14.90
127 GNOMEUI_VERSION=2.2.0
130 STARTUP_NOTIFICATION_VERSION=0.8
132 SQLITE_VERSION=3.7.7.1
133 LIBNOTIFY_VERSION=0.4
137 dnl Set various checks
138 dnl ========================================================
142 dnl Initialize the Pthread test variables early so they can be
143 dnl overridden by each platform.
144 dnl ========================================================
148 dnl Do not allow a separate objdir build if a srcdir build exists.
149 dnl ==============================================================
150 _topsrcdir=`cd \`dirname $0\`; pwd`
153 if test "$_topsrcdir" != "$_objdir"
155 # Check for a couple representative files in the source tree
157 for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
158 if test -f $file; then
159 _conflict_files="$_conflict_files $file"
162 if test "$_conflict_files"; then
164 echo "* Your source tree contains these files:"
165 for file in $_conflict_files; do
169 * This indicates that you previously built in the source tree.
170 * A source tree build can confuse the separate objdir build.
172 * To clean up the source tree:
183 dnl Default to MSVC for win32 and gcc for darwin
184 dnl ==============================================================
185 if test -z "$CROSS_COMPILE"; then
188 if test -z "$CC"; then CC=cl; fi
189 if test -z "$CXX"; then CXX=cl; fi
190 if test -z "$CPP"; then CPP="cl -E -nologo"; fi
191 if test -z "$CXXCPP"; then CXXCPP="cl -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
192 if test -z "$LD"; then LD=link; fi
193 if test -z "$AS"; then
194 case "${target_cpu}" in
203 if test -z "$MIDL"; then MIDL=midl; fi
206 # we prefer gcc-4.2 over gcc on older darwin, so
207 # use that specific version if it's available.
208 MOZ_PATH_PROGS(CC, $CC gcc-4.2 gcc)
209 MOZ_PATH_PROGS(CXX, $CXX g++-4.2 g++)
214 COMPILE_ENVIRONMENT=1
215 MOZ_ARG_DISABLE_BOOL(compile-environment,
216 [ --disable-compile-environment
217 Disable compiler/library checks.],
218 COMPILE_ENVIRONMENT= )
219 AC_SUBST(COMPILE_ENVIRONMENT)
221 MOZ_ARG_WITH_STRING(l10n-base,
222 [ --with-l10n-base=DIR path to l10n repositories],
223 L10NBASEDIR=$withval)
224 if test -n "$L10NBASEDIR"; then
225 if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
226 AC_MSG_ERROR([--with-l10n-base must specify a path])
227 elif test -d "$L10NBASEDIR"; then
228 L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
230 AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
233 AC_SUBST(L10NBASEDIR)
235 dnl Check for Perl first -- needed for win32 SDK checks
236 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
237 if test -z "$PERL" -o "$PERL" = ":"; then
238 AC_MSG_ERROR([perl not found in \$PATH])
241 dnl ========================================================
242 dnl = Android uses a very custom (hacky) toolchain; we need to do this
243 dnl = here, so that the compiler checks can succeed
244 dnl ========================================================
246 MOZ_ARG_WITH_STRING(android-ndk,
247 [ --with-android-ndk=DIR
248 location where the Android NDK can be found],
249 android_ndk=$withval)
251 MOZ_ARG_WITH_STRING(android-toolchain,
252 [ --with-android-toolchain=DIR
253 location of the android toolchain, default NDK/build/prebuilt/HOST/arm-eabi-4.4.0],
254 android_toolchain=$withval)
257 MOZ_ARG_WITH_STRING(android-version,
258 [ --with-android-version=VER
259 android platform version, default 5],
260 android_version=$withval,
263 MOZ_ARG_WITH_STRING(android-sdk,
264 [ --with-android-sdk=DIR
265 location where the Android SDK can be found (base directory, e.g. .../android/platforms/android-6)],
266 android_sdk=$withval)
268 MOZ_ARG_WITH_STRING(android-platform,
269 [ --with-android-platform=DIR
270 location of platform dir, default NDK/build/platforms/android-5/arch-arm],
271 android_platform=$withval)
273 MOZ_ARG_ENABLE_BOOL(android-libstdcxx,
274 [ --enable-android-libstdcxx
275 use GNU libstdc++ instead of STLPort for NDK >= 5],
276 MOZ_ANDROID_LIBSTDCXX=1,
277 MOZ_ANDROID_LIBSTDCXX= )
280 arm-linux*-android*|*-linuxandroid*)
281 android_tool_prefix="arm-linux-androideabi"
284 android_tool_prefix="i686-android-linux"
287 android_tool_prefix="arm-eabi"
290 android_tool_prefix="$target_os"
294 MOZ_ARG_WITH_STRING(gonk,
296 location of gonk dir],
299 if test -n "$gonkdir" ; then
300 kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
301 gonk_toolchain="$gonkdir"/prebuilt/$kernel_name-x86/toolchain/arm-eabi-4.4.3
304 AS="$gonk_toolchain"/bin/"$android_tool_prefix"-as
305 CC="$gonk_toolchain"/bin/"$android_tool_prefix"-gcc
306 CXX="$gonk_toolchain"/bin/"$android_tool_prefix"-g++
307 CPP="$gonk_toolchain"/bin/"$android_tool_prefix"-cpp
308 LD="$gonk_toolchain"/bin/"$android_tool_prefix"-ld
309 AR="$gonk_toolchain"/bin/"$android_tool_prefix"-ar
310 RANLIB="$gonk_toolchain"/bin/"$android_tool_prefix"-ranlib
311 STRIP="$gonk_toolchain"/bin/"$android_tool_prefix"-strip
313 STLPORT_CPPFLAGS="-I$gonkdir/ndk/sources/cxx-stl/stlport/stlport/"
314 STLPORT_LIBS="-lstlport"
316 CPPFLAGS="-DANDROID -I$gonkdir/bionic/libc/include/ -I$gonkdir/bionic/libc/kernel/common -I$gonkdir/bionic/libc/arch-arm/include -I$gonkdir/bionic/libc/kernel/arch-arm -I$gonkdir/bionic/libm/include -I$gonkdir/frameworks/base/opengl/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/hardware/libhardware/include -I$gonkdir/hardware/libhardware_legacy/include -I$gonkdir/system/core/include -I$gonkdir/bionic -I$gonkdir/frameworks/base/include $STLPORT_CPPFLAGS $CPPFLAGS"
317 CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
318 CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions $CXXFLAGS"
319 LIBS="$LIBS $STLPORT_LIBS"
321 dnl Add -llog by default, since we use it all over the place.
322 LDFLAGS="-mandroid -L$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib -Wl,-rpath-link=$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib --sysroot=$gonkdir/out/target/product/$GONK_PRODUCT/obj/ -llog $LDFLAGS"
324 dnl prevent cross compile section from using these flags as host flags
325 if test -z "$HOST_CPPFLAGS" ; then
328 if test -z "$HOST_CFLAGS" ; then
331 if test -z "$HOST_CXXFLAGS" ; then
334 if test -z "$HOST_LDFLAGS" ; then
339 AC_DEFINE(HAVE_SYS_UIO_H)
341 MOZ_CHROME_FILE_FORMAT=omni
346 *-android*|*-linuxandroid*)
347 if test -z "$android_ndk" ; then
348 AC_MSG_ERROR([You must specify --with-android-ndk=/path/to/ndk when targeting Android.])
351 if test -z "$android_sdk" ; then
352 AC_MSG_ERROR([You must specify --with-android-sdk=/path/to/sdk when targeting Android.])
354 if ! test -e "$android_sdk"/source.properties ; then
355 AC_MSG_ERROR([The path in --with-android-sdk isn't valid (source.properties hasn't been found).])
358 # Minimum Android SDK API Level we require.
359 android_min_api_level=13
361 # Get the api level from "$android_sdk"/source.properties.
362 android_api_level=`$AWK -F = '$1 == "AndroidVersion.ApiLevel" {print $2}' "$android_sdk"/source.properties`
364 if test -z "$android_api_level" ; then
365 AC_MSG_ERROR([Unexpected error: no AndroidVersion.ApiLevel field has been found in source.properties.])
368 if ! test "$android_api_level" -eq "$android_api_level" ; then
369 AC_MSG_ERROR([Unexpected error: the found android api value isn't a number! (found $android_api_level)])
372 if test $android_api_level -lt $android_min_api_level ; then
373 AC_MSG_ERROR([The given Android SDK provides API level $android_api_level ($android_min_api_level or higher required).])
377 android_platform_tools="$android_sdk"/../../platform-tools
378 if test ! -d "$android_platform_tools" ; then
379 android_platform_tools="$android_sdk"/tools # SDK Tools < r8
382 if test -z "$android_toolchain" ; then
383 AC_MSG_CHECKING([for android toolchain directory])
385 kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
387 android_toolchain="$android_ndk"/build/prebuilt/$kernel_name-x86/arm-eabi-4.4.0
389 # With newer NDK, the toolchain path has changed.
390 if ! test -d "$android_toolchain" ; then
391 android_toolchain="$android_ndk"/toolchains/arm-$kernel_name-androideabi-4.4.3/prebuilt/$kernel_name-x86
394 if test -d "$android_toolchain" ; then
395 AC_MSG_RESULT([$android_toolchain])
397 AC_MSG_ERROR([not found. You have to specify --with-android-toolchain=/path/to/ndk/toolchain.])
401 if test -z "$android_platform" ; then
402 AC_MSG_CHECKING([for android platform directory])
404 android_platform="$android_ndk"/build/platforms/android-"$android_version"/arch-"$target_cpu"
406 # With newer NDK, the platform path has changed.
407 if ! test -d "$android_platform" ; then
408 android_platform="$android_ndk"/platforms/android-"$android_version"/arch-"$target_cpu"
411 if test -d "$android_platform" ; then
412 AC_MSG_RESULT([$android_platform])
414 AC_MSG_ERROR([not found. You have to specify --with-android-platform=/path/to/ndk/platform.])
419 AS="$android_toolchain"/bin/"$android_tool_prefix"-as
420 CC="$android_toolchain"/bin/"$android_tool_prefix"-gcc
421 CXX="$android_toolchain"/bin/"$android_tool_prefix"-g++
422 CPP="$android_toolchain"/bin/"$android_tool_prefix"-cpp
423 LD="$android_toolchain"/bin/"$android_tool_prefix"-ld
424 AR="$android_toolchain"/bin/"$android_tool_prefix"-ar
425 RANLIB="$android_toolchain"/bin/"$android_tool_prefix"-ranlib
426 STRIP="$android_toolchain"/bin/"$android_tool_prefix"-strip
427 OBJCOPY="$android_toolchain"/bin/"$android_tool_prefix"-objcopy
429 CPPFLAGS="-I$android_platform/usr/include $CPPFLAGS"
430 CFLAGS="-mandroid -I$android_platform/usr/include -fno-short-enums -fno-exceptions $CFLAGS"
431 CXXFLAGS="-mandroid -I$android_platform/usr/include -fno-short-enums -fno-exceptions $CXXFLAGS"
433 dnl Add -llog by default, since we use it all over the place.
434 dnl Add --allow-shlib-undefined, because libGLESv2 links to an
435 dnl undefined symbol (present on the hardware, just not in the
437 LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform -llog -Wl,--allow-shlib-undefined $LDFLAGS"
439 dnl prevent cross compile section from using these flags as host flags
440 if test -z "$HOST_CPPFLAGS" ; then
443 if test -z "$HOST_CFLAGS" ; then
446 if test -z "$HOST_CXXFLAGS" ; then
449 if test -z "$HOST_LDFLAGS" ; then
453 ANDROID_NDK="${android_ndk}"
454 ANDROID_TOOLCHAIN="${android_toolchain}"
455 ANDROID_PLATFORM="${android_platform}"
456 ANDROID_SDK="${android_sdk}"
457 ANDROID_PLATFORM_TOOLS="${android_platform_tools}"
458 ANDROID_VERSION="${android_version}"
459 if test -z "$ANDROID_PACKAGE_NAME" ; then
460 ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
464 AC_DEFINE_UNQUOTED(ANDROID_VERSION, $android_version)
465 AC_SUBST(ANDROID_VERSION)
467 MOZ_CHROME_FILE_FORMAT=omni
471 AC_PATH_PROG(OBJCOPY,objcopy)
477 AC_SUBST(ANDROID_NDK)
478 AC_SUBST(ANDROID_TOOLCHAIN)
479 AC_SUBST(ANDROID_PLATFORM)
480 AC_SUBST(ANDROID_SDK)
481 AC_SUBST(ANDROID_PLATFORM_TOOLS)
482 AC_SUBST(ANDROID_PACKAGE_NAME)
485 dnl ========================================================
486 dnl Checks for compilers.
487 dnl ========================================================
488 dnl Set CROSS_COMPILE in the environment when running configure
489 dnl to use the cross-compile setup for now
490 dnl ========================================================
492 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
495 if test "$COMPILE_ENVIRONMENT"; then
497 if test -n "$CROSS_COMPILE" -a "$target" != "$host"; then
498 echo "cross compiling from $host to $target"
502 _SAVE_CFLAGS="$CFLAGS"
503 _SAVE_LDFLAGS="$LDFLAGS"
505 AC_MSG_CHECKING([for host c compiler])
506 AC_CHECK_PROGS(HOST_CC, $HOST_CC gcc cc /usr/ucb/cc cl icc, "")
507 if test -z "$HOST_CC"; then
508 AC_MSG_ERROR([no acceptable c compiler found in \$PATH])
510 AC_MSG_RESULT([$HOST_CC])
511 AC_MSG_CHECKING([for host c++ compiler])
512 AC_CHECK_PROGS(HOST_CXX, $HOST_CXX $CCC c++ g++ gcc CC cxx cc++ cl icc, "")
513 if test -z "$HOST_CXX"; then
514 AC_MSG_ERROR([no acceptable c++ compiler found in \$PATH])
516 AC_MSG_RESULT([$HOST_CXX])
518 if test -z "$HOST_CFLAGS"; then
519 HOST_CFLAGS="$CFLAGS"
521 if test -z "$HOST_CXXFLAGS"; then
522 HOST_CXXFLAGS="$CXXFLAGS"
524 if test -z "$HOST_LDFLAGS"; then
525 HOST_LDFLAGS="$LDFLAGS"
527 if test -z "$HOST_AR_FLAGS"; then
528 HOST_AR_FLAGS="$AR_FLAGS"
530 AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
531 AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
533 CFLAGS="$HOST_CFLAGS"
534 LDFLAGS="$HOST_LDFLAGS"
536 AC_MSG_CHECKING([whether the host c compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
537 AC_TRY_COMPILE([], [return(0);],
538 [ac_cv_prog_hostcc_works=1 AC_MSG_RESULT([yes])],
539 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CC cannot create executables.]) )
542 CFLAGS="$HOST_CXXFLAGS"
544 AC_MSG_CHECKING([whether the host c++ compiler ($HOST_CXX $HOST_CXXFLAGS $HOST_LDFLAGS) works])
545 AC_TRY_COMPILE([], [return(0);],
546 [ac_cv_prog_hostcxx_works=1 AC_MSG_RESULT([yes])],
547 AC_MSG_ERROR([installation or configuration problem: host compiler $HOST_CXX cannot create executables.]) )
551 LDFLAGS=$_SAVE_LDFLAGS
553 AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", :)
556 AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", :)
560 AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
561 AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
562 MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
563 AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
564 AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
565 AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
566 AC_DEFINE(CROSS_COMPILE)
571 MOZ_PATH_PROGS(AS, $AS as, $CC)
572 AC_CHECK_PROGS(AR, ar, :)
573 AC_CHECK_PROGS(LD, ld, :)
574 AC_CHECK_PROGS(STRIP, strip, :)
575 AC_CHECK_PROGS(WINDRES, windres, :)
576 if test -z "$HOST_CC"; then
579 if test -z "$HOST_CFLAGS"; then
580 HOST_CFLAGS='$(CFLAGS)'
582 if test -z "$HOST_CXX"; then
585 if test -z "$HOST_CXXFLAGS"; then
586 HOST_CXXFLAGS='$(CXXFLAGS)'
588 if test -z "$HOST_LDFLAGS"; then
589 HOST_LDFLAGS='$(LDFLAGS)'
591 if test -z "$HOST_RANLIB"; then
592 HOST_RANLIB='$(RANLIB)'
594 if test -z "$HOST_AR"; then
597 if test -z "$HOST_AR_FLAGS"; then
598 HOST_AR_FLAGS='$(AR_FLAGS)'
608 if test "$GCC" = "yes"; then
610 CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'`
612 if test "$GXX" = "yes"; then
614 CXX_VERSION=`$CXX -v 2>&1 | grep 'gcc version'`
616 if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then
619 if test "`echo | $LD -v 2>&1 | grep -c GNU`" != "0"; then
622 if test "$GNU_CC"; then
623 if `$CC -print-prog-name=ld` -v 2>&1 | grep -c GNU >/dev/null; then
630 if test "$GCC" = yes; then
631 if test "`$CC -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
636 if test "$GXX" = yes; then
637 if test "`$CXX -help 2>&1 | grep -c 'Intel(R) C++ Compiler'`" != "0"; then
644 if test "$GCC" = yes; then
645 if test "`$CC -v 2>&1 | grep -c 'clang version'`" != "0"; then
650 if test "$GXX" = yes; then
651 if test "`$CXX -v 2>&1 | grep -c 'clang version'`" != "0"; then
656 dnl ========================================================
657 dnl Special win32 checks
658 dnl ========================================================
660 dnl Target the Windows 7 SDK by default
663 MOZ_ARG_WITH_STRING(windows-version,
664 [ --with-windows-version=WINSDK_TARGETVER
665 Highest Windows version to target using this SDK
666 502: Windows Server 2003
669 WINSDK_TARGETVER=$withval)
671 case "$WINSDK_TARGETVER" in
673 MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
677 AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER), must be 502, 600 or 601]);
682 if test -n "$COMPILE_ENVIRONMENT"; then
683 if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
684 # We can't build parental controls either
685 MOZ_DISABLE_PARENTAL_CONTROLS=1
691 if test "$GCC" != "yes"; then
692 # Check to see if we are really running in a msvc environemnt
694 AC_CHECK_PROGS(MIDL, midl)
696 # Make sure compilers are valid
697 CFLAGS="$CFLAGS -TC -nologo"
698 CXXFLAGS="$CXXFLAGS -TP -nologo"
701 AC_TRY_COMPILE([#include <stdio.h>],
702 [ printf("Hello World\n"); ],,
703 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
706 AC_TRY_COMPILE([#include <new.h>],
707 [ unsigned *test = new unsigned(42); ],,
708 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
712 _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
715 # Determine compiler version
716 CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
717 _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
718 _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
719 _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
720 _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
721 _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
723 CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
724 _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
726 if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
727 AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
730 if test "$_CC_MAJOR_VERSION" = "14"; then
731 dnl Require VC8SP1 or newer.
732 dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762.
733 if test "$_CC_RELEASE" -lt 50727 -o \
734 \( "$_CC_RELEASE" -eq 50727 -a "$_CC_BUILD" -lt 762 \); then
735 AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. You probably need to install Service Pack 1 of Visual Studio 2005. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
739 AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
740 AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
741 elif test "$_CC_MAJOR_VERSION" = "15"; then
743 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
744 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
745 elif test "$_CC_MAJOR_VERSION" = "16"; then
747 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
748 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
749 elif test "$_CC_MAJOR_VERSION" = "17"; then
751 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
752 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
754 AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
757 _MOZ_RTTI_FLAGS_ON='-GR'
758 _MOZ_RTTI_FLAGS_OFF='-GR-'
759 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
761 if test -n "$WIN32_REDIST_DIR"; then
762 if test ! -d "$WIN32_REDIST_DIR"; then
763 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
765 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
768 dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
769 dnl not something else like "magnetic tape manipulation utility".
770 MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
771 if test -z "$MSMT_TOOL"; then
772 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
776 _MSMT_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
778 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
779 if test -z "$MSMANIFEST_TOOL_VERSION"; then
780 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
786 # Check linker version
787 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
788 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
789 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
790 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
796 _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
797 _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
798 _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
799 _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
800 # Add flags if necessary
801 AC_MSG_CHECKING([for midl flags])
804 if test \( "$_MIDL_MAJOR_VERSION" = "7" -a "$_MIDL_MINOR_VERSION" = "00" -a "$_MIDL_REV_VERSION" = "0499" \); then
805 # MIDL version 7.00.0499 defaults /env win64 on x64 platforms.
806 # MIDL version 7.00.0500 or later has no problem.
807 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
808 AC_MSG_RESULT([need -env win32])
810 AC_MSG_RESULT([none needed])
814 MIDL_FLAGS="${MIDL_FLAGS} -env x64"
817 AC_MSG_RESULT([none needed])
821 # Identify which version of the SDK we're building with
822 # Windows Server 2008 and newer SDKs have WinSDKVer.h, get the version
824 MOZ_CHECK_HEADERS([winsdkver.h])
825 if test "$ac_cv_header_winsdkver_h" = "yes"; then
826 # Get the highest _WIN32_WINNT and NTDDI versions supported
827 # Take the higher of the two
828 # This is done because the Windows 7 beta SDK reports its
829 # NTDDI_MAXVER to be 0x06000100 instead of 0x06010000, as it should
830 AC_CACHE_CHECK(for highest Windows version supported by this SDK,
832 [cat > conftest.h <<EOF
833 #include <winsdkver.h>
834 #include <sdkddkver.h>
836 #if (NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER) > NTDDI_MAXVER)
837 #define WINSDK_MAXVER NTDDI_VERSION_FROM_WIN32_WINNT(_WIN32_WINNT_MAXVER)
839 #define WINSDK_MAXVER NTDDI_MAXVER
844 ac_cv_winsdk_maxver=`$CPP conftest.h 2>/dev/null | tail -n1`
847 MOZ_WINSDK_MAXVER=${ac_cv_winsdk_maxver}
849 # The Vista SDK is the only one to have sdkddkver.h but not
851 MOZ_CHECK_HEADERS([sdkddkver.h])
852 if test "$ac_cv_header_sdkddkver_h" = "yes"; then
853 MOZ_WINSDK_MAXVER=0x06000000
855 # Assume the Server 2003 Platform SDK
856 MOZ_WINSDK_MAXVER=0x05020000
860 unset _MSVC_VER_FILTER
862 AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
866 _SAVE_CXXFLAGS="$CXXFLAGS"
867 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
868 AC_TRY_COMPILE([#include <exception>],
869 [std::_Throw(std::exception()); return 0;],
870 ac_cv_have_std__Throw="yes",
871 ac_cv_have_std__Throw="no")
872 CXXFLAGS="$_SAVE_CXXFLAGS"
876 if test "$ac_cv_have_std__Throw" = "yes"; then
877 AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
878 ac_cv_have_dllimport_exception_bug,
882 _SAVE_CXXFLAGS="$CXXFLAGS"
883 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
884 AC_TRY_LINK([#include <vector>],
885 [std::vector<int> v; return v.at(1);],
886 ac_cv_have_dllimport_exception_bug="no",
887 ac_cv_have_dllimport_exception_bug="yes")
888 CXXFLAGS="$_SAVE_CXXFLAGS"
891 if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
893 MOZ_MSVC_STL_WRAP__Throw=1
894 AC_DEFINE(MOZ_MSVC_STL_WRAP__Throw)
897 AC_CACHE_CHECK(for overridable _RAISE,
902 _SAVE_CXXFLAGS="$CXXFLAGS"
903 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
904 AC_TRY_COMPILE([#include <xstddef>
906 #define _RAISE(x) externallyDefinedFunction((x).what())
909 [std::vector<int> v; return v.at(1);],
910 ac_cv_have__RAISE="no",
911 ac_cv_have__RAISE="yes")
912 CXXFLAGS="$_SAVE_CXXFLAGS"
915 if test "$ac_cv_have__RAISE" = "yes"; then
917 MOZ_MSVC_STL_WRAP__RAISE=1
918 AC_DEFINE(MOZ_MSVC_STL_WRAP__RAISE)
920 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.])
924 if test "$WRAP_STL_INCLUDES" = "1"; then
925 STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
928 # Check w32api version
929 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
930 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
931 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
932 AC_TRY_COMPILE([#include <w32api.h>],
933 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
934 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
935 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
936 #error "test failed."
938 , [ res=yes ], [ res=no ])
939 AC_MSG_RESULT([$res])
940 if test "$res" != "yes"; then
941 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
943 # Check windres version
944 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
945 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
946 AC_MSG_RESULT([$_WINDRES_VERSION])
947 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
948 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
949 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
950 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
951 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
952 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
953 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
954 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
955 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
956 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
957 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
958 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
960 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
963 MOZ_WINSDK_MAXVER=0x06010000
966 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
967 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
968 # Require OS features provided by IE 5.0
969 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0500)
971 # If the maximum version supported by this SDK is lower than the target
973 AC_MSG_CHECKING([for Windows SDK being recent enough])
974 if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
978 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.])
981 AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
982 # Definitions matching sdkddkver.h
983 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WS03, 0x05020000)
984 AC_DEFINE_UNQUOTED(MOZ_NTDDI_LONGHORN, 0x06000000)
985 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
992 if test -n "$_WIN32_MSVC"; then
994 SKIP_COMPILER_CHECKS=1
995 SKIP_LIBRARY_CHECKS=1
997 # Since we're skipping compiler and library checks, hard-code
1000 AC_DEFINE(HAVE_SETBUF)
1001 AC_DEFINE(HAVE_ISATTY)
1004 fi # COMPILE_ENVIRONMENT
1006 AC_SUBST(MIDL_FLAGS)
1019 AC_SUBST(WRAP_STL_INCLUDES)
1020 AC_SUBST(MOZ_MSVC_STL_WRAP__Throw)
1021 AC_SUBST(MOZ_MSVC_STL_WRAP__RAISE)
1023 dnl ========================================================
1024 dnl Checks for programs.
1025 dnl ========================================================
1029 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
1030 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
1031 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
1033 AC_MSG_RESULT([$_perl_version])
1035 if test "$_perl_res" != 0; then
1036 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
1040 AC_MSG_CHECKING([for full perl installation])
1041 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
1043 if test "$_perl_res" != 0; then
1045 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
1047 AC_MSG_RESULT([yes])
1050 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.7 python2.6 python2.5 python)
1051 if test -z "$PYTHON"; then
1052 AC_MSG_ERROR([python was not found in \$PATH])
1055 if test -z "$COMPILE_ENVIRONMENT"; then
1056 NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
1058 AC_SUBST(NSINSTALL_BIN)
1060 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
1061 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
1062 MOZ_PATH_PROGS(UNZIP, unzip)
1063 if test -z "$UNZIP" -o "$UNZIP" = ":"; then
1064 AC_MSG_ERROR([unzip not found in \$PATH])
1066 MOZ_PATH_PROGS(ZIP, zip)
1067 if test -z "$ZIP" -o "$ZIP" = ":"; then
1068 AC_MSG_ERROR([zip not found in \$PATH])
1070 MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
1071 MOZ_PATH_PROG(XARGS, xargs)
1072 if test -z "$XARGS" -o "$XARGS" = ":"; then
1073 AC_MSG_ERROR([xargs not found in \$PATH .])
1076 MOZ_PATH_PROG(RPMBUILD, rpmbuild, :)
1079 if test "$COMPILE_ENVIRONMENT"; then
1081 dnl ========================================================
1082 dnl = Mac OS X toolchain support
1083 dnl ========================================================
1085 case "$target_os" in
1087 dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
1088 dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
1089 dnl the environment and includedir purposes (when using an SDK, below),
1090 dnl but remember the full version number for the libdir (SDK).
1092 GCC_VERSION_FULL=`echo $CXX_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'`
1093 GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'`
1095 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1096 dnl Bug 280479, but this keeps popping up in bug 292530 too because
1097 dnl 4.0.0/4061 is the default compiler in Tiger.
1099 GCC_BUILD=`echo $CXX_VERSION | $PERL -pe 's/^.*build ([^ )]*).*/$1/'`
1101 if test "$GCC_BUILD" = "4061" ; then
1102 AC_MSG_ERROR([You are attempting to use Apple gcc 4.0 build 4061.
1103 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
1104 from building Mozilla. Upgrade to Xcode 2.1 or later.])
1108 dnl xcodebuild needs GCC_VERSION defined in the environment, since it
1109 dnl doesn't respect the CC/CXX setting. With GCC_VERSION set, it will use
1110 dnl /usr/bin/g(cc|++)-$GCC_VERSION.
1111 MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
1113 dnl sdp was formerly in /Developer/Tools. As of Mac OS X 10.4 (Darwin 8),
1114 dnl it has moved into /usr/bin.
1115 MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
1119 AC_SUBST(GCC_VERSION)
1121 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
1122 dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
1123 dnl when we can run target binaries.
1124 AC_SUBST(UNIVERSAL_BINARY)
1125 AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
1127 dnl ========================================================
1128 dnl Check for MacOS deployment target version
1129 dnl ========================================================
1131 MOZ_ARG_ENABLE_STRING(macos-target,
1132 [ --enable-macos-target=VER (default=10.5)
1133 Set the minimum MacOS version needed at runtime],
1134 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
1138 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
1139 dnl Use the specified value
1140 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
1142 dnl No value specified on the command line or in the environment,
1143 dnl use architecture minimum.
1144 case "${target_cpu}" in
1146 export MACOSX_DEPLOYMENT_TARGET=10.5
1149 export MACOSX_DEPLOYMENT_TARGET=10.6
1156 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
1158 dnl ========================================================
1159 dnl = Mac OS X SDK support
1160 dnl ========================================================
1163 MOZ_ARG_WITH_STRING(macos-sdk,
1164 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
1165 MACOS_SDK_DIR=$withval)
1167 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
1168 dnl NEXT_ROOT will be set and exported only if it's needed.
1169 AC_SUBST(MACOS_SDK_DIR)
1172 if test "$MACOS_SDK_DIR"; then
1173 dnl Sync this section with the ones in NSPR and NSS.
1174 dnl Changes to the cross environment here need to be accounted for in
1175 dnl the libIDL checks (below) and xpidl build.
1177 if test ! -d "$MACOS_SDK_DIR"; then
1178 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
1179 specify a valid SDK. SDKs are installed when the optional cross-development
1180 tools are selected during the Xcode/Developer Tools installation.])
1183 GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
1184 if test "$GCC_VERSION_MAJOR" -lt "4" ; then
1185 AC_MSG_ERROR([You need to upgrade the compiler version to 4.x])
1187 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
1188 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
1190 dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
1191 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
1192 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
1194 if test "$GCC_VERSION_FULL" = "4.0.0" ; then
1195 dnl If gcc >= 4.0, we're guaranteed to be on Tiger, which has an ld
1196 dnl that supports -syslibroot. Don't set NEXT_ROOT because it will
1197 dnl be ignored and cause warnings when -syslibroot is specified.
1198 dnl gcc 4.0.1 will pass -syslibroot to ld automatically based on
1199 dnl the -isysroot it receives, so this is only needed with 4.0.0.
1200 LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}"
1205 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
1207 AC_TRY_COMPILE([#include <new>],[],
1211 AC_MSG_RESULT($result)
1213 if test "$result" = "no" ; then
1214 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
1218 fi # COMPILE_ENVIRONMENT
1220 dnl clang prior to 2.9 (including Xcode 4) does not support all the
1221 dnl constructs required by the libtheora inline asm. This is used to
1222 dnl detect and disable it
1223 AC_MSG_CHECKING([whether the C compiler is clang older than version 2.9])
1227 #if defined(__clang__)
1228 # if __clang_major__<2 || (__clang_major__==2 && __clang_minor__<9)
1229 # error "clang older than 2.9 detected"
1237 AC_MSG_RESULT([$result])
1238 if test "$result" = "yes"; then
1241 dnl XCode 4.2 also shipped an llvm-gcc which couldn't compile
1242 dnl the libtheora inline asm.
1243 AC_MSG_CHECKING([bad gcc versions])
1244 if `$CC --version | grep -q "Apple Inc. build 5658"`; then
1245 AC_MSG_RESULT([Apple build 5658])
1248 AC_MSG_RESULT([we're ok])
1251 AC_SUBST(MOZ_NO_THEORA_ASM)
1253 if test "x$MOZ_NO_THEORA_ASM" = x1; then
1254 AC_MSG_WARN([Disabling libtheora inline assembly])
1257 if test -n "$MAKE"; then
1258 if test `echo $MAKE | grep -c make.py` != 1; then
1265 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
1268 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
1271 if test "$GMAKE" = ":"; then
1272 AC_MSG_ERROR([GNU make not found])
1276 if test "$COMPILE_ENVIRONMENT"; then
1282 fi # COMPILE_ENVIRONMENT
1284 dnl ========================================================
1285 dnl set the defaults first
1286 dnl ========================================================
1289 AR_EXTRACT='$(AR) x'
1303 MOZ_USER_DIR=".mozilla"
1306 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/media/libjpeg)'
1308 MOZ_ZLIB_LIBS='$(call EXPAND_LIBNAME_PATH,mozz,$(DEPTH)/modules/zlib/src)'
1310 MOZ_BZ2_LIBS='$(call EXPAND_LIBNAME_PATH,bz2,$(DEPTH)/modules/libbz2/src)'
1312 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/media/libpng)'
1314 MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)'
1315 MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)'
1316 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
1317 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
1318 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
1319 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
1320 XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
1321 XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
1325 MOZ_COMPONENT_NSPR_LIBS='-L$(LIBXUL_DIST)/bin $(NSPR_LIBS)'
1327 USE_DEPENDENT_LIBS=1
1329 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
1331 if test -n "$CROSS_COMPILE"; then
1332 OS_TARGET="${target_os}"
1333 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
1335 case "${target_os}" in
1336 linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
1337 kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
1338 gnu*) OS_ARCH=GNU ;;
1339 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
1340 mingw*) OS_ARCH=WINNT OS_TARGET=WINNT ;;
1341 darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
1344 *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
1347 OS_TARGET=`uname -s`
1348 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1349 OS_RELEASE=`uname -r`
1352 # Before this used `uname -m` when not cross compiling
1353 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1354 OS_TEST="${target_cpu}"
1356 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1358 #######################################################################
1359 # Master "Core Components" macros for getting the OS target #
1360 #######################################################################
1363 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1364 # cross-compilation.
1368 # Define and override various archtecture-specific variables, including
1377 case "$HOST_OS_ARCH" in
1391 if test -z "$GNU_CC"; then
1392 if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1397 if test -z "$GNU_CXX"; then
1398 if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1399 SOLARIS_SUNPRO_CXX=1
1402 AC_SUBST(SOLARIS_SUNPRO_CC)
1403 AC_SUBST(SOLARIS_SUNPRO_CXX)
1415 if test -z "$CROSS_COMPILE" ; then
1421 # If uname -s returns "Windows_NT", we assume that we are using
1422 # the uname.exe in MKS toolkit.
1424 # The -r option of MKS uname only returns the major version number.
1425 # So we need to use its -v option to get the minor version number.
1426 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1430 OS_MINOR_RELEASE=`uname -v`
1431 if test "$OS_MINOR_RELEASE" = "00"; then
1434 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1438 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1439 # the uname.exe in the MSYS tools.
1441 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1446 OS_RELEASE=`uname -v`.`uname -r`
1447 OS_TEST=${target_cpu}
1455 OS_RELEASE=`uname -v`
1458 case "${target_cpu}" in
1469 if test -z "$CROSS_COMPILE" ; then
1477 # Only set CPU_ARCH if we recognize the value of OS_TEST
1488 powerpc | ppc | rs6000)
1492 Alpha | alpha | ALPHA)
1525 if test -z "$OS_TARGET"; then
1528 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1530 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1531 dnl ===============================================================
1535 INTEL_ARCHITECTURE=1
1538 dnl ========================================================
1539 dnl = ARM toolchain tweaks
1540 dnl ========================================================
1543 case "${CPU_ARCH}-${OS_TARGET}" in
1548 MOZ_FLOAT_ABI=softfp
1551 if test -n "$MOZ_PLATFORM_MAEMO"; then
1554 MOZ_FLOAT_ABI=softfp
1556 if test "$MOZ_PLATFORM_MAEMO" = 6; then
1562 dnl Kept for compatibility with some buildbot mozconfig
1563 MOZ_ARG_DISABLE_BOOL(thumb2, [], MOZ_THUMB=no, MOZ_THUMB=yes)
1565 MOZ_ARG_WITH_STRING(thumb,
1566 [ --with-thumb[[=yes|no|toolchain-default]]]
1567 [ Use Thumb instruction set (-mthumb)],
1568 if test -z "$GNU_CC"; then
1569 AC_MSG_ERROR([--with-thumb is not supported on non-GNU toolchains])
1573 MOZ_ARG_WITH_STRING(thumb-interwork,
1574 [ --with-thumb-interwork[[=yes|no|toolchain-default]]
1575 Use Thumb/ARM instuctions interwork (-mthumb-interwork)],
1576 if test -z "$GNU_CC"; then
1577 AC_MSG_ERROR([--with-thumb-interwork is not supported on non-GNU toolchains])
1579 MOZ_THUMB_INTERWORK=$withval)
1581 MOZ_ARG_WITH_STRING(arch,
1582 [ --with-arch=[[type|toolchain-default]]
1583 Use specific CPU features (-march=type)],
1584 if test -z "$GNU_CC"; then
1585 AC_MSG_ERROR([--with-arch is not supported on non-GNU toolchains])
1589 MOZ_ARG_WITH_STRING(fpu,
1590 [ --with-fpu=[[type|toolchain-default]]
1591 Use specific FPU type (-mfpu=type)],
1592 if test -z "$GNU_CC"; then
1593 AC_MSG_ERROR([--with-fpu is not supported on non-GNU toolchains])
1597 MOZ_ARG_WITH_STRING(float-abi,
1598 [ --with-float-abi=[[type|toolchain-default]]
1599 Use specific arm float ABI (-mfloat-abi=type)],
1600 if test -z "$GNU_CC"; then
1601 AC_MSG_ERROR([--with-float-abi is not supported on non-GNU toolchains])
1603 MOZ_FLOAT_ABI=$withval)
1605 MOZ_ARG_WITH_STRING(soft-float,
1606 [ --with-soft-float[[=yes|no|toolchain-default]]
1607 Use soft float library (-msoft-float)],
1608 if test -z "$GNU_CC"; then
1609 AC_MSG_ERROR([--with-soft-float is not supported on non-GNU toolchains])
1611 MOZ_SOFT_FLOAT=$withval)
1614 toolchain-default|"")
1618 arch_flag="-march=$MOZ_ARCH"
1622 case "$MOZ_THUMB" in
1625 thumb_flag="-mthumb"
1632 _SAVE_CFLAGS="$CFLAGS"
1634 AC_TRY_COMPILE([],[return sizeof(__thumb2__);],
1637 CFLAGS="$_SAVE_CFLAGS"
1642 if test "$MOZ_THUMB2" = 1; then
1643 AC_DEFINE(MOZ_THUMB2)
1646 case "$MOZ_THUMB_INTERWORK" in
1648 thumb_interwork_flag="-mthumb-interwork"
1651 thumb_interwork_flag="-mno-thumb-interwork"
1653 *) # toolchain-default
1654 thumb_interwork_flag=""
1659 toolchain-default|"")
1663 fpu_flag="-mfpu=$MOZ_FPU"
1667 case "$MOZ_FLOAT_ABI" in
1668 toolchain-default|"")
1672 float_abi_flag="-mfloat-abi=$MOZ_FLOAT_ABI"
1676 case "$MOZ_SOFT_FLOAT" in
1678 soft_float_flag="-msoft-float"
1681 soft_float_flag="-mno-soft-float"
1683 *) # toolchain-default
1688 dnl Use echo to avoid accumulating space characters
1689 all_flags=`echo $arch_flag $thumb_flag $thumb_interwork_flag $fpu_flag $float_abi_flag $soft_float_flag`
1690 if test -n "$all_flags"; then
1691 _SAVE_CFLAGS="$CFLAGS"
1693 AC_MSG_CHECKING(whether the chosen combination of compiler flags ($all_flags) works)
1694 AC_TRY_COMPILE([],[return 0;],
1695 AC_MSG_RESULT([yes]),
1698 CFLAGS="$_SAVE_CFLAGS $all_flags"
1699 CXXFLAGS="$CXXFLAGS $all_flags"
1700 ASFLAGS="$ASFLAGS $all_flags"
1701 if test -n "$thumb_flag"; then
1702 LDFLAGS="$LDFLAGS $thumb_flag"
1706 AC_SUBST(MOZ_THUMB2)
1708 if test "$CPU_ARCH" = "arm"; then
1709 AC_MSG_CHECKING(for ARM SIMD support in compiler)
1710 # We try to link so that this also fails when
1711 # building with LTO.
1713 [asm("uqadd8 r1, r1, r2");],
1714 result="yes", result="no")
1715 AC_MSG_RESULT("$result")
1716 if test "$result" = "yes"; then
1717 AC_DEFINE(HAVE_ARM_SIMD)
1721 AC_MSG_CHECKING(for ARM NEON support in compiler)
1722 # We try to link so that this also fails when
1723 # building with LTO.
1725 [asm(".fpu neon\n vadd.i8 d0, d0, d0");],
1726 result="yes", result="no")
1727 AC_MSG_RESULT("$result")
1728 if test "$result" = "yes"; then
1729 AC_DEFINE(HAVE_ARM_NEON)
1734 AC_SUBST(HAVE_ARM_SIMD)
1735 AC_SUBST(HAVE_ARM_NEON)
1737 dnl =================================================================
1738 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1739 dnl which is bad when cross compiling.
1740 dnl =================================================================
1741 if test "$COMPILE_ENVIRONMENT"; then
1742 configure_static_assert_macros='
1743 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1744 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1745 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1748 dnl test that the macros actually work:
1749 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1750 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1753 ac_cv_static_assertion_macros_work="yes"
1754 AC_TRY_COMPILE([$configure_static_assert_macros],
1755 [CONFIGURE_STATIC_ASSERT(1)],
1757 ac_cv_static_assertion_macros_work="no")
1758 AC_TRY_COMPILE([$configure_static_assert_macros],
1759 [CONFIGURE_STATIC_ASSERT(0)],
1760 ac_cv_static_assertion_macros_work="no",
1763 AC_TRY_COMPILE([$configure_static_assert_macros],
1764 [CONFIGURE_STATIC_ASSERT(1)],
1766 ac_cv_static_assertion_macros_work="no")
1767 AC_TRY_COMPILE([$configure_static_assert_macros],
1768 [CONFIGURE_STATIC_ASSERT(0)],
1769 ac_cv_static_assertion_macros_work="no",
1773 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1774 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1775 AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1777 fi # COMPILE_ENVIRONMENT
1779 dnl ========================================================
1780 dnl Android libstdc++, placed here so it can use MOZ_ARCH
1782 dnl ========================================================
1784 if test "$OS_TARGET" = "Android"; then
1785 case "${CPU_ARCH}-${MOZ_ARCH}" in
1787 ANDROID_CPU_ARCH=armeabi-v7a
1790 ANDROID_CPU_ARCH=armeabi
1793 ANDROID_CPU_ARCH=x86
1797 if test -n "$MOZ_ANDROID_LIBSTDCXX" ; then
1798 if test ! -e "$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH/libstdc++.a" ; then
1799 AC_MSG_ERROR([Cannot find path to libstdc++ (NDK version >= 5?)])
1801 STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/gnu-libstdc++/include -I$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH/include -D_GLIBCXX_PERMIT_BACKWARD_HASH"
1802 STLPORT_LDFLAGS="-L$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/$ANDROID_CPU_ARCH"
1803 STLPORT_LIBS="-lstdc++"
1804 elif test -e "$android_ndk/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/libstlport_static.a" ; then
1805 STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/stlport/stlport"
1806 STLPORT_LDFLAGS="-L$android_ndk/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/"
1807 STLPORT_LIBS="-lstlport_static"
1808 elif test -e "$android_ndk/tmp/ndk-digit/build/install/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH/libstlport_static.a" ; then
1809 STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/stlport/stlport"
1810 STLPORT_LDFLAGS="-L$android_ndk/tmp/ndk-digit/build/install/sources/cxx-stl/stlport/libs/$ANDROID_CPU_ARCH"
1811 STLPORT_LIBS="-lstlport_static"
1812 elif test "$target" != "arm-android-eabi"; then
1813 dnl fail if we're not building with NDKr4
1814 AC_MSG_ERROR([Couldn't find path to stlport in the android ndk])
1816 CPPFLAGS="$CPPFLAGS $STLPORT_CPPFLAGS"
1817 LDFLAGS="$LDFLAGS $STLPORT_LDFLAGS"
1818 LIBS="$LIBS $STLPORT_LIBS"
1821 dnl ========================================================
1822 dnl GNU specific defaults
1823 dnl ========================================================
1824 if test "$GNU_CC"; then
1825 # FIXME: Let us build with strict aliasing. bug 414641.
1826 CFLAGS="$CFLAGS -fno-strict-aliasing"
1827 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1828 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$@ -o $@'
1829 DSO_LDOPTS='-shared'
1830 if test "$GCC_USE_GNU_LD"; then
1831 # Don't allow undefined symbols in libraries
1832 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1834 WARNINGS_AS_ERRORS='-Werror -Wno-error=uninitialized'
1836 DSO_PIC_CFLAGS='-fPIC'
1837 ASFLAGS="$ASFLAGS -fPIC"
1838 _MOZ_RTTI_FLAGS_ON=-frtti
1839 _MOZ_RTTI_FLAGS_OFF=-fno-rtti
1841 # Turn on GNU specific features
1842 # -Wall - turn on all warnings
1843 # -pedantic - make compiler warn about non-ANSI stuff, and
1844 # be a little bit stricter
1845 # -Wdeclaration-after-statement - MSVC doesn't like these
1846 # Warnings slamm took out for now (these were giving more noise than help):
1847 # -Wbad-function-cast - warns when casting a function to a new return type
1848 # -Wshadow - removed because it generates more noise than help --pete
1849 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall -W -Wno-unused -Wpointer-arith -Wdeclaration-after-statement"
1850 if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1851 # Don't use -Wcast-align with ICC or clang
1853 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1854 hppa | ia64 | sparc | arm)
1857 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1862 dnl Turn pedantic on but disable the warnings for long long
1865 if test -z "$INTEL_CC"; then
1866 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -W"
1869 _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1870 _USE_CPP_INCLUDE_FLAG=1
1871 elif test "$SOLARIS_SUNPRO_CC"; then
1873 if test "$CPU_ARCH" = "sparc"; then
1874 # for Sun Studio on Solaris/SPARC
1875 DSO_PIC_CFLAGS='-xcode=pic32'
1877 DSO_PIC_CFLAGS='-KPIC'
1879 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1881 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1882 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
1884 DSO_LDOPTS='-shared'
1885 if test "$GNU_LD"; then
1886 # Don't allow undefined symbols in libraries
1887 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1891 DSO_PIC_CFLAGS='-KPIC'
1892 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1895 if test "$GNU_CXX"; then
1896 # FIXME: Let us build with strict aliasing. bug 414641.
1897 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
1898 # Turn on GNU specific features
1899 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
1900 if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1901 # Don't use -Wcast-align with ICC or clang
1903 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1904 hppa | ia64 | sparc | arm)
1907 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1912 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1913 _USE_CPP_INCLUDE_FLAG=1
1915 # Recent clang and gcc support C++11 deleted functions without warnings if
1916 # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
1917 # versions). We can't use -std=c++0x yet, so gcc's support must remain
1918 # unused. But clang's warning can be disabled, so when compiling with clang
1919 # we use it to opt out of the warning, enabling (macro-encapsulated) use of
1920 # deleted function syntax.
1921 if test "$CLANG_CXX"; then
1922 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
1925 AC_CACHE_CHECK(whether the compiler supports -Wno-extended-offsetof,
1926 ac_has_wno_extended_offsetof,
1930 _SAVE_CXXFLAGS="$CXXFLAGS"
1931 CXXFLAGS="$CXXFLAGS -Wno-extended-offsetof"
1932 AC_TRY_COMPILE([$configure_static_assert_macros
1933 #ifndef __has_warning
1934 #define __has_warning(x) 0
1936 [CONFIGURE_STATIC_ASSERT(__has_warning("-Wextended-offsetof"))],
1937 ac_has_wno_extended_offsetof="yes",
1938 ac_has_wno_extended_offsetof="no")
1939 CXXFLAGS="$_SAVE_CXXFLAGS"
1942 if test "$ac_has_wno_extended_offsetof" = "yes"; then
1943 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-extended-offsetof"
1946 AC_CACHE_CHECK(whether the compiler supports -Wno-invalid-offsetof,
1947 ac_has_wno_invalid_offsetof,
1951 _SAVE_CXXFLAGS="$CXXFLAGS"
1952 CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
1955 ac_has_wno_invalid_offsetof="yes",
1956 ac_has_wno_invalid_offsetof="no")
1957 CXXFLAGS="$_SAVE_CXXFLAGS"
1960 if test "$ac_has_wno_invalid_offsetof" = "yes"; then
1961 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-invalid-offsetof"
1964 AC_CACHE_CHECK(whether the compiler supports -Wno-variadic-macros,
1965 ac_has_wno_variadic_macros,
1969 _SAVE_CXXFLAGS="$CXXFLAGS"
1970 CXXFLAGS="$CXXFLAGS -Wno-variadic-macros"
1973 ac_has_wno_variadic_macros="yes",
1974 ac_has_wno_variadic_macros="no")
1975 CXXFLAGS="$_SAVE_CXXFLAGS"
1978 if test "$ac_has_wno_variadic_macros" = "yes"; then
1979 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-variadic-macros"
1982 AC_CACHE_CHECK(whether the compiler supports -Werror=return-type,
1983 ac_has_werror_return_type,
1987 _SAVE_CXXFLAGS="$CXXFLAGS"
1988 CXXFLAGS="$CXXFLAGS -Werror=return-type"
1991 ac_has_werror_return_type="yes",
1992 ac_has_werror_return_type="no")
1993 CXXFLAGS="$_SAVE_CXXFLAGS"
1996 if test "$ac_has_werror_return_type" = "yes"; then
1997 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=return-type"
2001 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
2004 dnl gcc can come with its own linker so it is better to use the pass-thru calls
2005 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
2006 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
2007 dnl normal behavior.
2008 dnl ========================================================
2010 MKSHLIB_UNFORCE_ALL=
2012 if test "$COMPILE_ENVIRONMENT"; then
2013 if test "$GNU_CC"; then
2014 AC_MSG_CHECKING(whether ld has archive extraction flags)
2015 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
2016 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
2017 ac_cv_mkshlib_force_and_unforce="no"
2018 exec 3<&0 <<LOOP_INPUT
2019 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
2020 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
2021 force="-Wl,-all"; unforce="-Wl,-none"
2028 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
2031 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
2033 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
2037 eval $ac_cv_mkshlib_force_and_unforce
2038 MKSHLIB_FORCE_ALL=$force
2039 MKSHLIB_UNFORCE_ALL=$unforce
2042 fi # COMPILE_ENVIRONMENT
2044 dnl ========================================================
2045 dnl Checking for 64-bit OS
2046 dnl ========================================================
2047 if test "$COMPILE_ENVIRONMENT"; then
2050 AC_MSG_CHECKING(for 64-bit OS)
2051 AC_TRY_COMPILE([$configure_static_assert_macros],
2052 [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
2053 result="yes", result="no")
2054 AC_MSG_RESULT("$result")
2055 if test "$result" = "yes"; then
2056 AC_DEFINE(HAVE_64BIT_OS)
2059 AC_SUBST(HAVE_64BIT_OS)
2061 fi # COMPILE_ENVIRONMENT
2063 dnl ========================================================
2064 dnl Enable high-memory support on OS/2 by default.
2065 dnl ========================================================
2066 MOZ_OS2_HIGH_MEMORY=1
2067 MOZ_ARG_DISABLE_BOOL(os2-high-mem,
2068 [ --disable-os2-high-mem Disable high-memory support on OS/2],
2069 MOZ_OS2_HIGH_MEMORY=,
2070 MOZ_OS2_HIGH_MEMORY=1 )
2071 AC_SUBST(MOZ_OS2_HIGH_MEMORY)
2073 dnl ========================================================
2074 dnl = Use profiling compile flags
2075 dnl ========================================================
2076 MOZ_ARG_ENABLE_BOOL(profiling,
2077 [ --enable-profiling Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
2081 dnl ========================================================
2083 dnl ========================================================
2084 MOZ_ARG_ENABLE_BOOL(valgrind,
2085 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
2088 if test -n "$MOZ_VALGRIND"; then
2089 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
2091 [--enable-valgrind specified but Valgrind is not installed]))
2092 AC_DEFINE(MOZ_VALGRIND)
2094 AC_SUBST(MOZ_VALGRIND)
2096 dnl ========================================================
2098 dnl ========================================================
2099 MOZ_ARG_ENABLE_BOOL(dmd,
2100 [ --enable-dmd Enable DMD; also disables jemalloc (default=no)],
2103 if test -n "$MOZ_DMD"; then
2104 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
2106 [--enable-dmd specified but Valgrind is not installed]))
2111 dnl ========================================================
2113 dnl ========================================================
2114 MOZ_ARG_ENABLE_BOOL(jprof,
2115 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
2118 if test -n "$MOZ_JPROF"; then
2120 AC_DEFINE(MOZ_JPROF)
2123 dnl ========================================================
2125 dnl ========================================================
2126 MOZ_ARG_ENABLE_BOOL(sps,
2127 [ --enable-sps Enable sps profiling tool.],
2128 MOZ_ENABLE_PROFILER_SPS=1,
2129 MOZ_ENABLE_PROFILER_SPS= )
2130 if test -n "$MOZ_ENABLE_PROFILER_SPS"; then
2131 AC_DEFINE(MOZ_ENABLE_PROFILER_SPS)
2134 dnl ========================================================
2136 dnl ========================================================
2137 MOZ_ARG_ENABLE_BOOL(shark,
2138 [ --enable-shark Enable shark remote profiling. Implies --enable-profiling.],
2141 if test -n "$MOZ_SHARK"; then
2143 AC_DEFINE(MOZ_SHARK)
2146 dnl ========================================================
2148 dnl ========================================================
2149 MOZ_ARG_ENABLE_BOOL(callgrind,
2150 [ --enable-callgrind Enable callgrind profiling. Implies --enable-profiling.],
2153 if test -n "$MOZ_CALLGRIND"; then
2155 AC_DEFINE(MOZ_CALLGRIND)
2158 dnl ========================================================
2160 dnl ========================================================
2161 MOZ_ARG_ENABLE_BOOL(vtune,
2162 [ --enable-vtune Enable vtune profiling. Implies --enable-profiling.],
2165 if test -n "$MOZ_VTUNE"; then
2167 AC_DEFINE(MOZ_VTUNE)
2170 dnl ========================================================
2172 dnl ========================================================
2173 if test -n "$MOZ_PROFILING"; then
2174 AC_DEFINE(MOZ_PROFILING)
2177 dnl ========================================================
2178 dnl System overrides of the defaults for host
2179 dnl ========================================================
2182 if test -n "$_WIN32_MSVC"; then
2184 HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
2185 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
2186 HOST_RANLIB='echo ranlib'
2188 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
2190 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
2191 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
2192 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
2193 HOST_BIN_SUFFIX=.exe
2196 PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
2200 case "${host_cpu}" in
2202 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
2208 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
2209 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
2210 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
2213 *-linux*|*-kfreebsd*-gnu|*-gnu*)
2214 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
2215 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2216 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
2220 HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
2221 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2222 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
2223 HOST_BIN_SUFFIX=.exe
2228 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
2229 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
2233 dnl We require version 2.5 or newer of Python to build.
2234 AC_MSG_CHECKING([for Python version >= $PYTHON_VERSION but not 3.x])
2236 $PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1] or sys.version[:2] != '2.')" $PYTHON_VERSION
2239 if test "$_python_res" != 0; then
2240 AC_MSG_ERROR([Python $PYTHON_VERSION or higher (but not Python 3.x) is required.])
2242 AC_MSG_RESULT([yes])
2244 dnl Check for using a custom <stdint.h> implementation
2245 dnl ========================================================
2246 AC_MSG_CHECKING(for custom <stdint.h> implementation)
2247 if test "$MOZ_CUSTOM_STDINT_H"; then
2248 AC_DEFINE_UNQUOTED(MOZ_CUSTOM_STDINT_H, "$MOZ_CUSTOM_STDINT_H")
2249 AC_SUBST(MOZ_CUSTOM_STDINT_H)
2250 AC_MSG_RESULT(using $MOZ_CUSTOM_STDINT_H)
2252 AC_MSG_RESULT(none specified)
2255 dnl Get mozilla version from central milestone file
2256 MOZILLA_VERSION=`$PERL $srcdir/config/milestone.pl -topsrcdir $srcdir`
2258 dnl Get version of various core apps from the version files.
2259 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
2261 if test -z "$FIREFOX_VERSION"; then
2262 AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
2265 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
2266 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
2268 MOZ_DOING_LTO(lto_is_enabled)
2270 dnl ========================================================
2271 dnl System overrides of the defaults for target
2272 dnl ========================================================
2277 if test ! "$GNU_CC"; then
2278 if test ! "$HAVE_64BIT_OS"; then
2279 # Compiling with Visual Age C++ object model compat is the
2280 # default. To compile with object model ibm, add
2281 # AIX_OBJMODEL=ibm to .mozconfig.
2282 if test "$AIX_OBJMODEL" = "ibm"; then
2283 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
2290 AC_SUBST(AIX_OBJMODEL)
2291 DSO_LDOPTS='-qmkshrobj=1'
2292 DSO_CFLAGS='-qflag=w:w'
2294 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
2296 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2297 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2298 if test "$COMPILE_ENVIRONMENT"; then
2301 AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
2303 [#if (__IBMCPP__ < 900)
2304 #error "Bad compiler"
2306 _BAD_COMPILER=,_BAD_COMPILER=1)
2307 if test -n "$_BAD_COMPILER"; then
2309 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
2311 AC_MSG_RESULT([yes])
2314 TARGET_COMPILER_ABI="ibmc"
2315 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
2316 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
2319 case "${target_os}" in
2324 if test "$COMPILE_ENVIRONMENT"; then
2325 MOZ_CHECK_HEADERS(sys/inttypes.h)
2327 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2331 dnl -pedantic doesn't play well with BSDI's _very_ modified gcc (shlicc2)
2340 _WARNINGS_CFLAGS="-Wall"
2341 _WARNINGS_CXXFLAGS="-Wall"
2342 # The test above doesn't work properly, at least on 3.1.
2343 MKSHLIB_FORCE_ALL=''
2344 MKSHLIB_UNFORCE_ALL=''
2350 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2351 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2352 MOZ_OPTIMIZE_FLAGS="-O3"
2354 # Statically disable jemalloc on 10.5 and 32-bit 10.6. See bug 702250.
2355 if test "$HAVE_64BIT_OS"; then
2358 CFLAGS="$CFLAGS -fno-common"
2359 CXXFLAGS="$CXXFLAGS -fno-common"
2362 STRIP="$STRIP -x -S"
2363 # Check whether we're targeting OS X or iOS
2364 AC_CACHE_CHECK(for iOS target,
2366 [AC_TRY_COMPILE([#include <TargetConditionals.h>
2367 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
2371 ac_cv_ios_target="yes",
2372 ac_cv_ios_target="no")])
2373 if test "$ac_cv_ios_target" = "yes"; then
2375 AC_DEFINE(XP_DARWIN)
2376 _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
2378 AC_DEFINE(XP_MACOSX)
2379 AC_DEFINE(XP_DARWIN)
2380 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
2381 # The ExceptionHandling framework is needed for Objective-C exception
2382 # logging code in nsObjCExceptions.h. Currently we only use that in debug
2384 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
2386 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
2389 if test "x$lto_is_enabled" = "xyes"; then
2390 echo "Skipping -dead_strip because lto is enabled."
2391 dnl DTrace and -dead_strip don't interact well. See bug 403132.
2392 dnl ===================================================================
2393 elif test "x$enable_dtrace" = "xyes"; then
2394 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
2396 dnl check for the presence of the -dead_strip linker flag
2397 AC_MSG_CHECKING([for -dead_strip option to ld])
2398 _SAVE_LDFLAGS=$LDFLAGS
2399 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
2400 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
2401 if test -n "$_HAVE_DEAD_STRIP" ; then
2402 AC_MSG_RESULT([yes])
2403 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
2408 LDFLAGS=$_SAVE_LDFLAGS
2410 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
2414 if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
2415 DLL_SUFFIX=".so.1.0"
2416 DSO_LDOPTS="-shared"
2418 if test ! "$GNU_CC"; then
2419 DSO_LDOPTS="-Bshareable $DSO_LDOPTS"
2425 if test ! "$GNU_CC"; then
2429 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2430 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2431 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2434 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2435 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2439 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2440 AC_DEFINE(_LARGEFILE64_SOURCE)
2445 if test ! "$GNU_CC"; then
2446 DSO_LDOPTS='-b -Wl,+s'
2449 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2450 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2451 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2453 DSO_LDOPTS='-b -E +s'
2454 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2455 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2457 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2458 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2461 *-android*|*-linuxandroid*)
2462 AC_DEFINE(NO_PW_GECOS)
2464 if test -n "$gonkdir"; then
2465 _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
2467 _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2470 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2472 MOZ_GFX_OPTIMIZE_MOBILE=1
2473 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions"
2477 # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2478 # Similarly for GNU_CXX and INTEL_CXX.
2479 if test "$INTEL_CC" -o "$INTEL_CXX"; then
2480 # -Os has been broken on Intel's C/C++ compilers for quite a
2481 # while; Intel recommends against using it.
2482 MOZ_OPTIMIZE_FLAGS="-O2"
2483 MOZ_DEBUG_FLAGS="-g"
2484 elif test "$GNU_CC" -o "$GNU_CXX"; then
2485 GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2486 case $GCC_VERSION in
2488 # -Os is broken on gcc 4.1.x 4.2.x, 4.5.x we need to tweak it to get good results.
2489 MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50"
2491 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
2492 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks $MOZ_OPTIMIZE_SIZE_TWEAK"
2493 MOZ_DEBUG_FLAGS="-g"
2496 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2500 case "${target_cpu}" in
2502 CFLAGS="$CFLAGS -mieee"
2503 CXXFLAGS="$CXXFLAGS -mieee"
2509 MOZ_DEBUG_FLAGS="-g" # We want inlining
2513 if test -z "$MC"; then
2523 # certain versions of cygwin's makedepend barf on the
2524 # #include <string> vs -I./dist/include/string issue so don't use it
2526 if test -n "$GNU_CC"; then
2528 CXX="$CXX -mwindows"
2529 CPP="$CPP -mwindows"
2530 CFLAGS="$CFLAGS -mms-bitfields"
2531 CXXFLAGS="$CXXFLAGS -mms-bitfields"
2532 DSO_LDOPTS='-shared'
2533 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2534 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2536 # Use temp file for windres (bug 213281)
2537 RCFLAGS='-O coff --use-temp-file'
2538 # mingw doesn't require kernel32, user32, and advapi32 explicitly
2539 LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv"
2541 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
2542 XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
2544 IMPORT_LIB_SUFFIX=dll.a
2545 GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'`
2547 TARGET_COMPILER_ABI=msvc
2551 if test "$AS_BIN"; then
2552 AS="$(basename "$AS_BIN")"
2555 AR_FLAGS='-NOLOGO -OUT:"$@"'
2557 RANLIB='echo not_ranlib'
2558 STRIP='echo not_strip'
2564 GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
2570 IMPORT_LIB_SUFFIX=lib
2571 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2572 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2574 MKSHLIB_UNFORCE_ALL=
2575 DSO_LDOPTS=-SUBSYSTEM:WINDOWS
2576 _USE_CPP_INCLUDE_FLAG=1
2577 _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2578 _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2579 CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2580 CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
2581 CXXFLAGS="$CXXFLAGS -wd4800" # disable warning "forcing value to bool"
2582 # make 'foo == bar;' error out
2583 CFLAGS="$CFLAGS -we4553"
2584 CXXFLAGS="$CXXFLAGS -we4553"
2585 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
2586 MOZ_DEBUG_FLAGS='-Zi'
2587 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2588 WARNINGS_AS_ERRORS='-WX'
2589 MOZ_OPTIMIZE_FLAGS='-O1'
2591 DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2592 XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2593 LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2594 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2595 if test $_MSC_VER -ge 1400; then
2596 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
2597 dnl For profile-guided optimization
2598 PROFILE_GEN_CFLAGS="-GL"
2599 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2600 dnl XXX: PGO builds can fail with warnings treated as errors,
2601 dnl specifically "no profile data available" appears to be
2602 dnl treated as an error sometimes. This might be a consequence
2603 dnl of using WARNINGS_AS_ERRORS in some modules, combined
2604 dnl with the linker doing most of the work in the whole-program
2605 dnl optimization/PGO case. I think it's probably a compiler bug,
2606 dnl but we work around it here.
2607 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2608 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2609 dnl Probably also a compiler bug, but what can you do?
2610 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2611 LDFLAGS="$LDFLAGS -DYNAMICBASE"
2614 MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,jpeg32$(VERSION_NUMBER),$(DEPTH)/media/libjpeg)'
2615 MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,png,$(DEPTH)/media/libpng)'
2616 AC_DEFINE(HAVE_SNPRINTF)
2621 AC_DEFINE(HW_THREADS)
2622 AC_DEFINE(STDC_HEADERS)
2623 AC_DEFINE(NEW_H, <new>)
2624 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2625 TARGET_MD_ARCH=win32
2626 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2628 MOZ_USER_DIR="Mozilla"
2630 dnl Hardcode to win95 for now - cls
2631 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2633 dnl set NO_X11 defines here as the general check is skipped on win32
2639 MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
2645 if test -z "$MOZ_TOOLS"; then
2646 AC_MSG_ERROR([MOZ_TOOLS is not set])
2648 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2649 if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2650 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2652 MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2653 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2654 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2661 AC_MSG_ERROR([Using a Cygwin build environment is unsupported. Configure cannot check for presence of necessary headers. Please upgrade to MozillaBuild; see https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
2667 if test "$HAVE_64BIT_OS"; then
2668 AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2671 if test $_MSC_VER -ge 1400; then
2672 LDFLAGS="$LDFLAGS -SAFESEH"
2675 if test -n "$GNU_CC"; then
2676 CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
2677 CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
2679 AC_DEFINE(HAVE_STDCALL)
2682 MOZ_CHECK_HEADERS(mmintrin.h)
2689 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2693 if test "$HAVE_64BIT_OS"; then
2700 CFLAGS="$CFLAGS -Dunix"
2701 CXXFLAGS="$CXXFLAGS -Dunix"
2702 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2704 DSO_PIC_CFLAGS='-fPIC -DPIC'
2705 DSO_LDOPTS='-shared'
2706 BIN_FLAGS='-Wl,--export-dynamic'
2708 DSO_PIC_CFLAGS='-fPIC -DPIC'
2709 DLL_SUFFIX=".so.1.0"
2710 DSO_LDOPTS='-shared'
2712 # This will fail on a.out systems prior to 1.5.1_ALPHA.
2713 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2714 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2715 if test "$LIBRUNPATH"; then
2716 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2718 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2719 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX) -o $@'
2723 if test "$SO_VERSION"; then
2724 DLL_SUFFIX=".so.$SO_VERSION"
2726 DLL_SUFFIX=".so.1.0"
2728 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
2730 DSO_PIC_CFLAGS='-fPIC'
2731 DSO_LDOPTS='-shared -fPIC'
2732 if test "$LIBRUNPATH"; then
2733 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2738 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2739 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
2742 AC_DEFINE(OS2EMX_PLAIN_CHAR)
2743 AC_DEFINE(TCPV40HDRS)
2749 IMPORT_LIB_SUFFIX=lib
2753 CFLAGS="$CFLAGS -Zomf"
2754 CXXFLAGS="$CXXFLAGS -Zomf"
2756 BIN_FLAGS='-Zlinker /ST:0x100000'
2760 WARNINGS_AS_ERRORS='-Werror'
2761 MOZ_DEBUG_FLAGS="-g -fno-inline"
2762 MOZ_OPTIMIZE_FLAGS="-O2"
2763 MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
2764 DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2765 LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
2767 _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
2771 MOZ_USER_DIR="Mozilla"
2774 if test "$MOZTOOLS"; then
2775 MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
2777 AC_MSG_ERROR([MOZTOOLS is not set])
2779 if test -n "$MOZ_OS2_HIGH_MEMORY"; then
2780 DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
2781 LDFLAGS="$LDFLAGS -Zhigh-mem"
2782 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
2783 AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
2786 # GCC for OS/2 currently predefines these, but we don't want them
2787 _DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
2788 _DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
2790 AC_CACHE_CHECK(for __declspec(dllexport),
2792 [AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
2794 ac_os2_declspec="yes",
2795 ac_os2_declspec="no")])
2796 if test "$ac_os2_declspec" != "yes"; then
2797 AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
2803 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2806 # $ORIGIN/.. is for shared libraries under components/ to locate shared
2807 # libraries one level up (e.g. libnspr4.so)
2808 if test "$SOLARIS_SUNPRO_CC"; then
2809 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2810 LIBS="-lCrun -lCstd -lc $LIBS"
2811 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2812 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2813 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2814 LDFLAGS="-xildoff $LDFLAGS"
2815 if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2816 _SAVE_LDFLAGS=$LDFLAGS
2817 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2818 AC_TRY_LINK([#include <stdio.h>],
2819 [printf("Hello World\n");],
2821 [LDFLAGS=$_SAVE_LDFLAGS])
2823 MOZ_OPTIMIZE_FLAGS="-xO4"
2824 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2825 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
2826 MKSHLIB_FORCE_ALL='-z allextract'
2827 MKSHLIB_UNFORCE_ALL='-z defaultextract'
2834 AS='/usr/ccs/bin/as'
2835 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2837 TARGET_COMPILER_ABI="sunc"
2838 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2839 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2840 AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2844 [#if (__SUNPRO_CC < 0x590)
2847 _BAD_COMPILER=,_BAD_COMPILER=1)
2848 if test -n "$_BAD_COMPILER"; then
2850 AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2855 [#if (__SUNPRO_CC >= 0x5100)
2856 #error "Sun C++ 5.10 or above"
2858 _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2859 if test "$_ABOVE_SS12U1"; then
2861 CXXFLAGS="$CXXFLAGS -xannotate=no"
2863 AC_MSG_RESULT([$_res])
2866 LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2868 MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2869 MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2870 ASFLAGS="$ASFLAGS -fPIC"
2871 DSO_LDOPTS='-shared'
2872 WARNINGS_AS_ERRORS='-Werror'
2874 _WARNINGS_CXXFLAGS=''
2875 if test "$OS_RELEASE" = "5.3"; then
2876 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2879 if test "$OS_RELEASE" = "5.5.1"; then
2880 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2885 DSO_LDOPTS='-Bdynamic'
2886 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2887 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2889 AC_DEFINE(SPRINTF_RETURNS_STRING)
2890 case "$(target_os)" in
2892 DLL_SUFFIX='.so.1.0'
2898 HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
2903 AC_SUBST(MOZ_LINKER)
2905 dnl Only one oddball right now (QNX), but this gives us flexibility
2906 dnl if any other platforms need to override this in the future.
2907 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2909 dnl ========================================================
2910 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2911 dnl by now will not have any way to link most binaries (tests
2912 dnl as well as viewer, apprunner, etc.), because some symbols
2913 dnl will be left out of the "composite" .so's by ld as unneeded.
2914 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2915 dnl they can link in the static libs that provide the missing
2917 dnl ========================================================
2918 NO_LD_ARCHIVE_FLAGS=
2919 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2920 NO_LD_ARCHIVE_FLAGS=1
2924 NO_LD_ARCHIVE_FLAGS=
2927 NO_LD_ARCHIVE_FLAGS=
2930 if test -z "$GNU_CC"; then
2931 NO_LD_ARCHIVE_FLAGS=
2935 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2937 dnl ========================================================
2938 dnl = Flags to strip unused symbols from .so components and
2939 dnl = to export jemalloc symbols when linking a program
2940 dnl ========================================================
2942 *-linux*|*-kfreebsd*-gnu|*-gnu*)
2943 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2946 if test -z "$GNU_CC"; then
2947 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2949 if test -z "$GCC_USE_GNU_LD"; then
2950 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2952 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2957 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2960 if test -n "$GNU_CC"; then
2961 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2966 if test -z "$COMPILE_ENVIRONMENT"; then
2967 SKIP_COMPILER_CHECKS=1
2968 SKIP_LIBRARY_CHECKS=1
2971 if test -z "$SKIP_COMPILER_CHECKS"; then
2972 dnl Checks for typedefs, structures, and compiler characteristics.
2973 dnl ========================================================
2981 AC_MSG_CHECKING(for __stdcall)
2982 AC_CACHE_VAL(ac_cv___stdcall,
2983 [AC_TRY_COMPILE([template <typename Method> struct foo;
2984 template <> struct foo<void (*)()> {};
2985 template <> struct foo<void (__stdcall*)()> {};],
2987 [ac_cv___stdcall=true],
2988 [ac_cv___stdcall=false])])
2989 if test "$ac_cv___stdcall" = true ; then
2990 AC_DEFINE(HAVE_STDCALL)
2996 AC_MSG_CHECKING(for ssize_t)
2997 AC_CACHE_VAL(ac_cv_type_ssize_t,
2998 [AC_TRY_COMPILE([#include <stdio.h>
2999 #include <sys/types.h>],
3001 [ac_cv_type_ssize_t=true],
3002 [ac_cv_type_ssize_t=false])])
3003 if test "$ac_cv_type_ssize_t" = true ; then
3004 AC_DEFINE(HAVE_SSIZE_T)
3009 AC_STRUCT_ST_BLKSIZE
3010 AC_MSG_CHECKING(for siginfo_t)
3011 AC_CACHE_VAL(ac_cv_siginfo_t,
3012 [AC_TRY_COMPILE([#define _POSIX_C_SOURCE 199506L
3013 #include <signal.h>],
3015 [ac_cv_siginfo_t=true],
3016 [ac_cv_siginfo_t=false])])
3017 if test "$ac_cv_siginfo_t" = true ; then
3018 AC_DEFINE(HAVE_SIGINFO_T)
3024 dnl Check for int64, uint, and uint_t.
3025 dnl ========================================================
3026 AC_MSG_CHECKING(for int64)
3027 AC_CACHE_VAL(ac_cv_int64,
3028 [AC_TRY_COMPILE([#include <stdio.h>
3029 #include <sys/types.h>],
3032 [ac_cv_int64=false])])
3033 if test "$ac_cv_int64" = true ; then
3034 AC_DEFINE(HAVE_INT64)
3039 AC_MSG_CHECKING(for uint)
3040 AC_CACHE_VAL(ac_cv_uint,
3041 [AC_TRY_COMPILE([#include <stdio.h>
3042 #include <sys/types.h>],
3045 [ac_cv_uint=false])])
3046 if test "$ac_cv_uint" = true ; then
3047 AC_DEFINE(HAVE_UINT)
3052 AC_MSG_CHECKING(for uint_t)
3053 AC_CACHE_VAL(ac_cv_uint_t,
3054 [AC_TRY_COMPILE([#include <stdio.h>
3055 #include <sys/types.h>],
3057 [ac_cv_uint_t=true],
3058 [ac_cv_uint_t=false])])
3059 if test "$ac_cv_uint_t" = true ; then
3060 AC_DEFINE(HAVE_UINT_T)
3066 dnl On the gcc trunk (as of 2001-02-09) _GNU_SOURCE, and thus __USE_GNU,
3067 dnl are defined when compiling C++ but not C. Since the result of this
3068 dnl test is used only in C++, do it in C++.
3071 AC_MSG_CHECKING(for uname.domainname)
3072 AC_CACHE_VAL(ac_cv_have_uname_domainname_field,
3073 [AC_TRY_COMPILE([#include <sys/utsname.h>],
3074 [ struct utsname *res; char *domain;
3075 (void)uname(res); if (res != 0) { domain = res->domainname; } ],
3076 [ac_cv_have_uname_domainname_field=true],
3077 [ac_cv_have_uname_domainname_field=false])])
3079 if test "$ac_cv_have_uname_domainname_field" = "true"; then
3080 AC_DEFINE(HAVE_UNAME_DOMAINNAME_FIELD)
3086 AC_MSG_CHECKING(for uname.__domainname)
3087 AC_CACHE_VAL(ac_cv_have_uname_us_domainname_field,
3088 [AC_TRY_COMPILE([#include <sys/utsname.h>],
3089 [ struct utsname *res; char *domain;
3090 (void)uname(res); if (res != 0) { domain = res->__domainname; } ],
3091 [ac_cv_have_uname_us_domainname_field=true],
3092 [ac_cv_have_uname_us_domainname_field=false])])
3094 if test "$ac_cv_have_uname_us_domainname_field" = "true"; then
3095 AC_DEFINE(HAVE_UNAME_US_DOMAINNAME_FIELD)
3101 dnl ========================================================
3103 dnl Should be smarter and check that the compiler does indeed have rtti
3104 dnl ========================================================
3106 MOZ_ARG_ENABLE_BOOL(cpp-rtti,
3107 [ --enable-cpp-rtti Enable C++ RTTI ],
3108 [ _MOZ_USE_RTTI=1 ],
3111 if test "$_MOZ_USE_RTTI"; then
3112 _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
3114 _MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
3117 AC_SUBST(_MOZ_RTTI_FLAGS_ON)
3119 dnl Check whether we can use gcc's c++0x mode
3122 if test "$GNU_CXX"; then
3123 _SAVE_CXXFLAGS=$CXXFLAGS
3124 CXXFLAGS="$CXXFLAGS -std=gnu++0x"
3126 if test -z "$_MOZ_USE_RTTI"; then
3127 CXXFLAGS="$CXXFLAGS $_MOZ_RTTI_FLAGS"
3128 AC_CACHE_CHECK(for gcc c++0x headers bug without rtti,
3129 ac_cv_cxx0x_headers_bug,
3130 [AC_TRY_COMPILE([#include <memory>], [],
3131 ac_cv_cxx0x_headers_bug="no",
3132 ac_cv_cxx0x_headers_bug="yes")])
3133 CXXFLAGS="$_SAVE_CXXFLAGS"
3134 if test "$ac_cv_cxx0x_headers_bug" = "no"; then
3135 CXXFLAGS="$CXXFLAGS -std=gnu++0x"
3140 dnl Check for usable char16_t (2 bytes, unsigned)
3141 dnl (we might not need the unsignedness check anymore)
3142 AC_CACHE_CHECK(for usable char16_t (2 bytes, unsigned),
3143 ac_cv_have_usable_char16_t,
3144 [AC_TRY_COMPILE([$configure_static_assert_macros],
3145 [CONFIGURE_STATIC_ASSERT(sizeof(char16_t) == 2);
3146 CONFIGURE_STATIC_ASSERT(char16_t(-1) > char16_t(0));
3147 CONFIGURE_STATIC_ASSERT(sizeof((u"hello")[0]) == 2);
3148 CONFIGURE_STATIC_ASSERT(sizeof(u'a') == 2);
3149 CONFIGURE_STATIC_ASSERT(u'\xFFFF' > u'\x0')],
3150 ac_cv_have_usable_char16_t="yes",
3151 ac_cv_have_usable_char16_t="no")])
3152 if test "$ac_cv_have_usable_char16_t" = "yes"; then
3153 AC_DEFINE(HAVE_CPP_CHAR16_T)
3155 elif test "$GNU_CXX"; then
3156 CXXFLAGS="$_SAVE_CXXFLAGS"
3159 dnl Check for usable wchar_t (2 bytes, unsigned)
3160 dnl (we really don't need the unsignedness check anymore)
3161 dnl ========================================================
3163 AC_CACHE_CHECK(for usable wchar_t (2 bytes, unsigned),
3164 ac_cv_have_usable_wchar_v2,
3165 [AC_TRY_COMPILE([#include <stddef.h>
3166 $configure_static_assert_macros],
3167 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3168 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3169 ac_cv_have_usable_wchar_v2="yes",
3170 ac_cv_have_usable_wchar_v2="no")])
3171 if test "$ac_cv_have_usable_wchar_v2" = "yes"; then
3172 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3173 HAVE_CPP_2BYTE_WCHAR_T=1
3174 elif test "$ac_cv_have_usable_char16_t" != "yes"; then
3175 dnl This is really gcc-only
3176 dnl Do this test using CXX only since some versions of gcc
3177 dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions
3178 dnl only have short-wchar support for c++.
3179 dnl Note that we assume that mac & win32 have short wchar (see nscore.h)
3181 _SAVE_CXXFLAGS=$CXXFLAGS
3182 CXXFLAGS="$CXXFLAGS -fshort-wchar"
3184 AC_CACHE_CHECK(for compiler -fshort-wchar option,
3185 ac_cv_have_usable_wchar_option_v2,
3186 [AC_TRY_LINK([#include <stddef.h>
3187 $configure_static_assert_macros],
3188 [CONFIGURE_STATIC_ASSERT(sizeof(wchar_t) == 2);
3189 CONFIGURE_STATIC_ASSERT((wchar_t)-1 > (wchar_t) 0)],
3190 ac_cv_have_usable_wchar_option_v2="yes",
3191 ac_cv_have_usable_wchar_option_v2="no")])
3193 if test "$ac_cv_have_usable_wchar_option_v2" = "yes"; then
3194 AC_DEFINE(HAVE_CPP_2BYTE_WCHAR_T)
3195 HAVE_CPP_2BYTE_WCHAR_T=1
3196 if test "$OS_TARGET" = Android; then
3197 WCHAR_CFLAGS="-fshort-wchar -Wl,--no-wchar-size-warning"
3198 CXXFLAGS="$CXXFLAGS -Wl,--no-wchar-size-warning"
3199 CFLAGS="$CFLAGS -Wl,--no-wchar-size-warning"
3200 DSO_LDOPTS="$DSO_LDOPTS -Wl,--no-wchar-size-warning"
3202 WCHAR_CFLAGS="-fshort-wchar"
3205 CXXFLAGS=$_SAVE_CXXFLAGS
3211 dnl Check for .hidden assembler directive and visibility attribute.
3212 dnl Borrowed from glibc configure.in
3213 dnl ===============================================================
3214 if test "$GNU_CC"; then
3215 AC_CACHE_CHECK(for visibility(hidden) attribute,
3216 ac_cv_visibility_hidden,
3217 [cat > conftest.c <<EOF
3218 int foo __attribute__ ((visibility ("hidden"))) = 1;
3220 ac_cv_visibility_hidden=no
3221 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3222 if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3223 ac_cv_visibility_hidden=yes
3228 if test "$ac_cv_visibility_hidden" = "yes"; then
3229 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
3231 AC_CACHE_CHECK(for visibility(default) attribute,
3232 ac_cv_visibility_default,
3233 [cat > conftest.c <<EOF
3234 int foo __attribute__ ((visibility ("default"))) = 1;
3236 ac_cv_visibility_default=no
3237 if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3238 if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then
3239 ac_cv_visibility_default=yes
3244 if test "$ac_cv_visibility_default" = "yes"; then
3245 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
3247 AC_CACHE_CHECK(for visibility pragma support,
3248 ac_cv_visibility_pragma,
3249 [cat > conftest.c <<EOF
3250 #pragma GCC visibility push(hidden)
3252 #pragma GCC visibility push(default)
3253 int foo_default = 1;
3255 ac_cv_visibility_pragma=no
3256 if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then
3257 if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then
3258 if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then
3259 ac_cv_visibility_pragma=yes
3265 if test "$ac_cv_visibility_pragma" = "yes"; then
3266 AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905),
3267 ac_cv_have_visibility_class_bug,
3268 [cat > conftest.c <<EOF
3269 #pragma GCC visibility push(hidden)
3270 struct __attribute__ ((visibility ("default"))) TestStruct {
3273 __attribute__ ((visibility ("default"))) void TestFunc() {
3277 ac_cv_have_visibility_class_bug=no
3278 if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3279 ac_cv_have_visibility_class_bug=yes
3281 if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then
3282 ac_cv_have_visibility_class_bug=yes
3285 rm -rf conftest.{c,S}
3288 AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297),
3289 ac_cv_have_visibility_builtin_bug,
3290 [cat > conftest.c <<EOF
3291 #pragma GCC visibility push(hidden)
3292 #pragma GCC visibility push(default)
3294 #pragma GCC visibility pop
3296 __attribute__ ((visibility ("default"))) void Func() {
3298 memset(c, 0, sizeof(c));
3301 ac_cv_have_visibility_builtin_bug=no
3302 if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then
3303 ac_cv_have_visibility_builtin_bug=yes
3305 if test `grep -c "@PLT" conftest.S` = 0; then
3306 ac_cv_visibility_builtin_bug=yes
3309 rm -f conftest.{c,S}
3311 if test "$ac_cv_have_visibility_builtin_bug" = "no" -a \
3312 "$ac_cv_have_visibility_class_bug" = "no"; then
3313 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
3314 WRAP_SYSTEM_INCLUDES=1
3315 STL_FLAGS='-I$(DIST)/stl_wrappers'
3318 VISIBILITY_FLAGS='-fvisibility=hidden'
3319 fi # have visibility pragma bug
3320 fi # have visibility pragma
3321 fi # have visibility(default) attribute
3322 fi # have visibility(hidden) attribute
3325 # visibility hidden flag for Sun Studio on Solaris
3326 if test "$SOLARIS_SUNPRO_CC"; then
3327 VISIBILITY_FLAGS='-xldscope=hidden'
3328 fi # Sun Studio on Solaris
3330 AC_SUBST(WRAP_SYSTEM_INCLUDES)
3331 AC_SUBST(VISIBILITY_FLAGS)
3335 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
3336 dnl ========================================================
3337 if test "$GNU_CC"; then
3338 CFLAGS_save="${CFLAGS}"
3339 CFLAGS="${CFLAGS} -Werror"
3340 AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
3341 ac_cv_force_align_arg_pointer,
3342 [AC_TRY_COMPILE([__attribute__ ((__force_align_arg_pointer__)) void test() {}],
3344 ac_cv_force_align_arg_pointer="yes",
3345 ac_cv_force_align_arg_pointer="no")])
3346 CFLAGS="${CFLAGS_save}"
3347 if test "$ac_cv_force_align_arg_pointer" = "yes"; then
3348 HAVE_GCC_ALIGN_ARG_POINTER=1
3350 HAVE_GCC_ALIGN_ARG_POINTER=
3353 AC_SUBST(HAVE_GCC_ALIGN_ARG_POINTER)
3355 dnl Checks for header files.
3356 dnl ========================================================
3358 case "$target_os" in
3360 # for stuff like -lXshm
3361 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
3364 MOZ_CHECK_COMMON_HEADERS
3366 dnl These are all the places some variant of statfs can be hiding.
3367 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
3370 MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
3371 MOZ_CHECK_HEADERS(linux/quota.h)
3373 dnl Try for MMX support
3374 dnl NB - later gcc versions require -mmmx for this header to be successfully
3375 dnl included (or another option which implies it, such as -march=pentium-mmx)
3376 MOZ_CHECK_HEADERS(mmintrin.h)
3378 dnl Check whether the compiler supports the new-style C++ standard
3379 dnl library headers (i.e. <new>) or needs the old "new.h"
3382 MOZ_CHECK_HEADER(new, [NEW_H=new])
3383 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
3386 AC_ARG_ENABLE(dtrace,
3387 [ --enable-dtrace build with dtrace support if available (default=no)],
3388 [enable_dtrace="yes"],)
3389 if test "x$enable_dtrace" = "xyes"; then
3390 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
3391 if test -n "$HAVE_DTRACE"; then
3392 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
3394 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
3397 AC_SUBST(HAVE_DTRACE)
3403 MOZ_CHECK_HEADERS(sys/cdefs.h)
3407 dnl Checks for libraries.
3408 dnl ========================================================
3413 AC_CHECK_LIB(c_r, gethostbyname_r)
3417 dnl We don't want to link with libdl even if it's present on OS X, since
3418 dnl it's not used and not part of the default installation. OS/2 has dlfcn
3420 dnl We don't want to link against libm or libpthread on Darwin since
3421 dnl they both are just symlinks to libSystem and explicitly linking
3422 dnl against libSystem causes issues when debugging (see bug 299601).
3429 AC_SEARCH_LIBS(dlopen, dl,
3430 MOZ_CHECK_HEADER(dlfcn.h,
3431 AC_DEFINE(HAVE_DLOPEN)))
3435 _SAVE_CFLAGS="$CFLAGS"
3436 CFLAGS="$CFLAGS -D_GNU_SOURCE"
3437 AC_CHECK_FUNCS(dladdr memmem)
3438 CFLAGS="$_SAVE_CFLAGS"
3440 if test ! "$GNU_CXX"; then
3444 AC_CHECK_LIB(C_r, demangle)
3447 AC_CHECK_LIB(C, demangle)
3452 dnl OS/2 has socket in libc.
3457 AC_CHECK_LIB(socket, socket)
3461 XLIBS="$X_EXTRA_LIBS"
3463 dnl ========================================================
3464 dnl Checks for X libraries.
3465 dnl Ordering is important.
3466 dnl Xt is dependent upon SM as of X11R6
3467 dnl ========================================================
3468 if test "$no_x" = "yes"; then
3471 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
3472 XLIBS="-lX11 $XLIBS"
3473 _SAVE_LDFLAGS="$LDFLAGS"
3474 LDFLAGS="$XLDFLAGS $LDFLAGS"
3475 AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
3476 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
3477 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
3478 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
3480 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
3481 unset ac_cv_lib_Xt_XtFree
3482 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
3483 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
3484 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
3485 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
3488 # AIX needs the motif library linked before libXt to prevent
3489 # crashes in plugins linked against Motif - Bug #98892
3490 case "${target_os}" in
3492 XT_LIBS="-lXm $XT_LIBS"
3496 dnl ========================================================
3497 dnl = Check for XShm
3498 dnl ========================================================
3499 AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
3502 dnl ========================================================
3504 dnl ========================================================
3505 MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
3506 AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
3507 [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
3508 AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
3510 LDFLAGS="$_SAVE_LDFLAGS"
3512 dnl ========================================================
3513 dnl = Check for freetype2 and its functionality
3514 dnl ========================================================
3515 AC_CHECK_FT2(6.1.0, [_HAVE_FREETYPE2=1], [_HAVE_FREETYPE2=])
3517 if test "$_HAVE_FREETYPE2"; then
3519 _SAVE_CFLAGS="$CFLAGS"
3520 LIBS="$LIBS $FT2_LIBS"
3521 CFLAGS="$CFLAGS $FT2_CFLAGS"
3523 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3524 ac_cv_member_FT_Bitmap_Size_y_ppem,
3525 [AC_TRY_COMPILE([#include <ft2build.h>
3526 #include FT_FREETYPE_H],
3528 if (sizeof s.y_ppem) return 0;
3530 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3531 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3532 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3533 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3535 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3537 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3538 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3539 [FT_Bitmap_Size structure includes y_ppem field])
3541 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Select_Size)
3544 CFLAGS="$_SAVE_CFLAGS"
3556 dnl ========================================================
3557 dnl = pthread support
3558 dnl = Start by checking whether the system support pthreads
3559 dnl ========================================================
3560 case "$target_os" in
3565 MOZ_CHECK_PTHREADS(pthreads,
3566 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
3567 MOZ_CHECK_PTHREADS(pthread,
3568 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
3569 MOZ_CHECK_PTHREADS(c_r,
3570 USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
3571 MOZ_CHECK_PTHREADS(c,
3580 dnl ========================================================
3581 dnl Check the command line for --with-pthreads
3582 dnl ========================================================
3583 MOZ_ARG_WITH_BOOL(pthreads,
3584 [ --with-pthreads Force use of system pthread library with NSPR ],
3585 [ if test "$USE_PTHREADS"x = x; then
3586 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
3592 dnl ========================================================
3593 dnl Do the platform specific pthread hackery
3594 dnl ========================================================
3595 if test "$USE_PTHREADS"x != x
3598 dnl See if -pthread is supported.
3601 ac_cv_have_dash_pthread=no
3602 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
3603 echo 'int main() { return 0; }' | cat > conftest.c
3604 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
3605 if test $? -eq 0; then
3606 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3607 ac_cv_have_dash_pthread=yes
3608 case "$target_os" in
3610 # Freebsd doesn't use -pthread for compiles, it uses them for linking
3613 CFLAGS="$CFLAGS -pthread"
3614 CXXFLAGS="$CXXFLAGS -pthread"
3620 AC_MSG_RESULT($ac_cv_have_dash_pthread)
3623 dnl See if -pthreads is supported.
3625 ac_cv_have_dash_pthreads=no
3626 if test "$ac_cv_have_dash_pthread" = "no"; then
3627 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
3628 echo 'int main() { return 0; }' | cat > conftest.c
3629 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
3630 if test $? -eq 0; then
3631 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
3632 ac_cv_have_dash_pthreads=yes
3633 CFLAGS="$CFLAGS -pthreads"
3634 CXXFLAGS="$CXXFLAGS -pthreads"
3638 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
3643 AC_DEFINE(_REENTRANT)
3644 AC_DEFINE(_THREAD_SAFE)
3645 dnl -pthread links in -lc_r, so don't specify it explicitly.
3646 if test "$ac_cv_have_dash_pthread" = "yes"; then
3647 _PTHREAD_LDFLAGS="-pthread"
3649 _PTHREAD_LDFLAGS="-lc_r"
3653 *-*-openbsd*|*-*-bsdi*)
3654 AC_DEFINE(_REENTRANT)
3655 AC_DEFINE(_THREAD_SAFE)
3656 dnl -pthread links in -lc_r, so don't specify it explicitly.
3657 if test "$ac_cv_have_dash_pthread" = "yes"; then
3658 _PTHREAD_LDFLAGS="-pthread"
3662 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
3663 AC_DEFINE(_REENTRANT)
3667 AC_DEFINE(_REENTRANT)
3671 AC_DEFINE(_REENTRANT)
3675 AC_DEFINE(_REENTRANT)
3676 if test "$SOLARIS_SUNPRO_CC"; then
3677 CFLAGS="$CFLAGS -mt"
3678 CXXFLAGS="$CXXFLAGS -mt"
3682 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
3686 dnl Checks for library functions.
3687 dnl ========================================================
3688 AC_PROG_GCC_TRADITIONAL
3690 AC_CHECK_FUNCS(random strerror lchown fchmod snprintf statvfs memmove rint stat64 lstat64 truncate64 statvfs64 setbuf isatty)
3691 AC_CHECK_FUNCS(flockfile getpagesize)
3692 AC_CHECK_FUNCS(localtime_r strtok_r)
3694 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock, and -lrt
3695 _SAVE_LDFLAGS=$LDFLAGS
3696 LDFLAGS="$LDFLAGS -lrt"
3697 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC) and -lrt,
3698 ac_cv_have_clock_monotonic,
3699 [AC_TRY_LINK([#include <time.h>],
3700 [ struct timespec ts;
3701 clock_gettime(CLOCK_MONOTONIC, &ts); ],
3702 ac_cv_have_clock_monotonic=yes,
3703 ac_cv_have_clock_monotonic=no)])
3704 LDFLAGS=$_SAVE_LDFLAGS
3705 if test "$ac_cv_have_clock_monotonic" = "yes"; then
3706 HAVE_CLOCK_MONOTONIC=1
3708 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
3709 AC_SUBST(HAVE_CLOCK_MONOTONIC)
3710 AC_SUBST(REALTIME_LIBS)
3713 dnl check for wcrtomb/mbrtowc
3714 dnl =======================================================================
3715 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3718 AC_CACHE_CHECK(for wcrtomb,
3720 [AC_TRY_LINK([#include <wchar.h>],
3721 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3722 ac_cv_have_wcrtomb="yes",
3723 ac_cv_have_wcrtomb="no")])
3724 if test "$ac_cv_have_wcrtomb" = "yes"; then
3725 AC_DEFINE(HAVE_WCRTOMB)
3727 AC_CACHE_CHECK(for mbrtowc,
3729 [AC_TRY_LINK([#include <wchar.h>],
3730 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3731 ac_cv_have_mbrtowc="yes",
3732 ac_cv_have_mbrtowc="no")])
3733 if test "$ac_cv_have_mbrtowc" = "yes"; then
3734 AC_DEFINE(HAVE_MBRTOWC)
3741 ac_cv_func_res_ninit,
3744 #define _BSD_SOURCE 1
3748 [int foo = res_ninit(&_res);],
3749 [ac_cv_func_res_ninit=yes],
3750 [ac_cv_func_res_ninit=no])
3753 if test "$ac_cv_func_res_ninit" = "yes"; then
3754 AC_DEFINE(HAVE_RES_NINIT)
3755 dnl must add the link line we do something as foolish as this... dougt
3757 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3758 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3763 [for gnu_get_libc_version()],
3764 ac_cv_func_gnu_get_libc_version,
3766 #ifdef HAVE_GNU_LIBC_VERSION_H
3767 #include <gnu/libc-version.h>
3770 [const char *glibc_version = gnu_get_libc_version();],
3771 [ac_cv_func_gnu_get_libc_version=yes],
3772 [ac_cv_func_gnu_get_libc_version=no]
3776 if test "$ac_cv_func_gnu_get_libc_version" = "yes"; then
3777 AC_DEFINE(HAVE_GNU_GET_LIBC_VERSION)
3781 darwin*|mingw*|os2*)
3785 AC_CHECK_LIB(c, iconv, [_ICONV_LIBS="$_ICONV_LIBS"],
3786 AC_CHECK_LIB(iconv, iconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"],
3787 AC_CHECK_LIB(iconv, libiconv, [_ICONV_LIBS="$_ICONV_LIBS -liconv"])))
3789 LIBS="$LIBS $_ICONV_LIBS"
3798 iconv_t h = iconv_open("", "");
3799 iconv(h, NULL, NULL, NULL, NULL);
3802 [ac_cv_func_iconv=yes],
3803 [ac_cv_func_iconv=no]
3806 if test "$ac_cv_func_iconv" = "yes"; then
3807 AC_DEFINE(HAVE_ICONV)
3808 DYNAMIC_XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS $_ICONV_LIBS"
3809 LIBXUL_LIBS="$LIBXUL_LIBS $_ICONV_LIBS"
3810 LIBICONV="$_ICONV_LIBS"
3812 [for iconv() with const input],
3813 ac_cv_func_const_iconv,
3819 const char *input = "testing";
3820 iconv_t h = iconv_open("", "");
3821 iconv(h, &input, NULL, NULL, NULL);
3824 [ac_cv_func_const_iconv=yes],
3825 [ac_cv_func_const_iconv=no]
3828 if test "$ac_cv_func_const_iconv" = "yes"; then
3829 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3841 dnl **********************
3842 dnl *** va_copy checks ***
3843 dnl **********************
3844 dnl we currently check for all three va_copy possibilities, so we get
3845 dnl all results in config.log for bug reports.
3846 AC_MSG_CHECKING(for an implementation of va_copy())
3847 AC_CACHE_VAL(ac_cv_va_copy,[
3850 void f (int i, ...) {
3851 va_list args1, args2;
3852 va_start (args1, i);
3853 va_copy (args2, args1);
3854 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3856 va_end (args1); va_end (args2);
3858 int main() { f (0, 42); return 0; }],
3864 AC_MSG_RESULT($ac_cv_va_copy)
3865 AC_MSG_CHECKING(for an implementation of __va_copy())
3866 AC_CACHE_VAL(ac_cv___va_copy,[
3869 void f (int i, ...) {
3870 va_list args1, args2;
3871 va_start (args1, i);
3872 __va_copy (args2, args1);
3873 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3875 va_end (args1); va_end (args2);
3877 int main() { f (0, 42); return 0; }],
3878 ac_cv___va_copy=yes,
3883 AC_MSG_RESULT($ac_cv___va_copy)
3884 AC_MSG_CHECKING(whether va_lists can be copied by value)
3885 AC_CACHE_VAL(ac_cv_va_val_copy,[
3888 void f (int i, ...) {
3889 va_list args1, args2;
3890 va_start (args1, i);
3892 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3894 va_end (args1); va_end (args2);
3896 int main() { f (0, 42); return 0; }],
3897 ac_cv_va_val_copy=yes,
3898 ac_cv_va_val_copy=no,
3899 ac_cv_va_val_copy=yes
3902 if test "x$ac_cv_va_copy" = "xyes"; then
3903 AC_DEFINE(VA_COPY, va_copy)
3904 AC_DEFINE(HAVE_VA_COPY)
3905 elif test "x$ac_cv___va_copy" = "xyes"; then
3906 AC_DEFINE(VA_COPY, __va_copy)
3907 AC_DEFINE(HAVE_VA_COPY)
3910 if test "x$ac_cv_va_val_copy" = "xno"; then
3911 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3913 AC_MSG_RESULT($ac_cv_va_val_copy)
3915 dnl ===================================================================
3916 dnl ========================================================
3917 dnl Put your C++ language/feature checks below
3918 dnl ========================================================
3922 if test "$GNU_CC"; then
3923 if test "$CPU_ARCH" = "arm" ; then
3924 AC_CACHE_CHECK(for ARM EABI,
3928 #if defined(__ARM_EABI__)
3931 #error Not ARM EABI.
3934 ac_cv_gcc_arm_eabi="yes",
3935 ac_cv_gcc_arm_eabi="no")])
3936 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
3938 ARM_ABI_PREFIX=eabi-
3940 ARM_ABI_PREFIX=oabi-
3944 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
3947 dnl Check for support of modern template specialization syntax
3948 dnl Test code and requirement from scc@netscape.com.
3949 dnl Autoconf cut-and-paste job by waterson@netscape.com
3950 AC_CACHE_CHECK(for modern C++ template specialization syntax support,
3951 ac_cv_cpp_modern_specialize_template_syntax,
3952 [AC_TRY_COMPILE(template <class T> struct X { int a; };
3954 template <> struct X<Y> { double a; };,
3957 ac_cv_cpp_modern_specialize_template_syntax=yes,
3958 ac_cv_cpp_modern_specialize_template_syntax=no)])
3959 if test "$ac_cv_cpp_modern_specialize_template_syntax" = no ; then
3960 AC_MSG_ERROR([The C++ compiler does not support template specialization])
3963 dnl Some compilers support only full specialization, and some don't.
3964 AC_CACHE_CHECK(whether partial template specialization works,
3965 ac_cv_cpp_partial_specialization,
3966 [AC_TRY_COMPILE(template <class T> class Foo {};
3967 template <class T> class Foo<T*> {};,
3969 ac_cv_cpp_partial_specialization=yes,
3970 ac_cv_cpp_partial_specialization=no)])
3971 if test "$ac_cv_cpp_partial_specialization" = yes ; then
3972 AC_DEFINE(HAVE_CPP_PARTIAL_SPECIALIZATION)
3975 dnl Check to see if we can resolve ambiguity with |using|.
3976 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3977 ac_cv_cpp_ambiguity_resolving_using,
3978 [AC_TRY_COMPILE(class X {
3979 public: int go(const X&) {return 3;}
3980 int jo(const X&) {return 3;}
3982 class Y : public X {
3983 public: int go(int) {return 2;}
3984 int jo(int) {return 2;}
3986 private: using X::go;
3989 ac_cv_cpp_ambiguity_resolving_using=yes,
3990 ac_cv_cpp_ambiguity_resolving_using=no)])
3991 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3992 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3995 dnl See if a dynamic_cast to void* gives the most derived object.
3996 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3997 ac_cv_cpp_dynamic_cast_void_ptr,
3998 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3999 class Y { int j; public: virtual ~Y() { } };
4000 class Z : public X, public Y { int k; };
4006 return !((((void*)&mdo != (void*)subx) &&
4007 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
4008 (((void*)&mdo != (void*)suby) &&
4009 ((void*)&mdo == dynamic_cast<void*>(suby))));
4011 ac_cv_cpp_dynamic_cast_void_ptr=yes,
4012 ac_cv_cpp_dynamic_cast_void_ptr=no,
4013 ac_cv_cpp_dynamic_cast_void_ptr=no)])
4014 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
4015 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
4019 dnl note that this one is reversed - if the test fails, then
4020 dnl we require implementations of unused virtual methods. Which
4021 dnl really blows because it means we'll have useless vtable
4023 AC_CACHE_CHECK(whether C++ requires implementation of unused virtual methods,
4024 ac_cv_cpp_unused_required,
4025 [AC_TRY_LINK(class X {private: virtual void never_called();};,
4027 ac_cv_cpp_unused_required=no,
4028 ac_cv_cpp_unused_required=yes)])
4029 if test "$ac_cv_cpp_unused_required" = yes ; then
4030 AC_DEFINE(NEED_CPP_UNUSED_IMPLEMENTATIONS)
4034 dnl Some compilers have trouble comparing a constant reference to a templatized
4035 dnl class to zero, and require an explicit operator==() to be defined that takes
4036 dnl an int. This test separates the strong from the weak.
4038 AC_CACHE_CHECK(for trouble comparing to zero near std::operator!=(),
4039 ac_cv_trouble_comparing_to_zero,
4040 [AC_TRY_COMPILE([#include <algorithm>
4041 template <class T> class Foo {};
4043 template <class T> int operator==(const T2*, const T&) { return 0; }
4044 template <class T> int operator!=(const T2*, const T&) { return 0; }],
4045 [Foo<int> f; return (0 != f);],
4046 ac_cv_trouble_comparing_to_zero=no,
4047 ac_cv_trouble_comparing_to_zero=yes)])
4048 if test "$ac_cv_trouble_comparing_to_zero" = yes ; then
4049 AC_DEFINE(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
4052 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
4053 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
4054 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
4056 _SAVE_LDFLAGS=$LDFLAGS
4057 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
4058 AC_CACHE_CHECK(for __thread keyword for TLS variables,
4059 ac_cv_thread_keyword,
4060 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
4061 [return tlsIsMainThread;],
4062 ac_cv_thread_keyword=yes,
4063 ac_cv_thread_keyword=no)])
4064 LDFLAGS=$_SAVE_LDFLAGS
4065 # The custom dynamic linker doesn't support TLS variables
4066 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
4067 # mips builds fail with TLS variables because of a binutils bug.
4073 *-android*|*-linuxandroid*)
4077 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
4082 dnl Check for the existence of various allocation headers/functions
4085 MOZ_CHECK_HEADER(malloc.h, [MALLOC_H=malloc.h])
4086 if test "$MALLOC_H" = ""; then
4087 MOZ_CHECK_HEADER(malloc/malloc.h, [MALLOC_H=malloc/malloc.h])
4088 if test "$MALLOC_H" = ""; then
4089 MOZ_CHECK_HEADER(sys/malloc.h, [MALLOC_H=sys/malloc.h])
4092 if test "$MALLOC_H" != ""; then
4093 AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
4096 MOZ_ALLOCATING_FUNCS="strndup posix_memalign memalign valloc"
4097 AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
4099 dnl See if compiler supports some gcc-style attributes
4101 AC_CACHE_CHECK(for __attribute__((always_inline)),
4102 ac_cv_attribute_always_inline,
4103 [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
4105 ac_cv_attribute_always_inline=yes,
4106 ac_cv_attribute_always_inline=no)])
4108 AC_CACHE_CHECK(for __attribute__((malloc)),
4109 ac_cv_attribute_malloc,
4110 [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
4112 ac_cv_attribute_malloc=yes,
4113 ac_cv_attribute_malloc=no)])
4115 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
4116 ac_cv_attribute_warn_unused,
4117 [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
4119 ac_cv_attribute_warn_unused=yes,
4120 ac_cv_attribute_warn_unused=no)])
4122 dnl End of C++ language/feature checks
4125 dnl ========================================================
4126 dnl = Internationalization checks
4127 dnl ========================================================
4129 dnl Internationalization and Locale support is different
4130 dnl on various UNIX platforms. Checks for specific i18n
4131 dnl features go here.
4133 dnl check for LC_MESSAGES
4134 AC_CACHE_CHECK(for LC_MESSAGES,
4135 ac_cv_i18n_lc_messages,
4136 [AC_TRY_COMPILE([#include <locale.h>],
4137 [int category = LC_MESSAGES;],
4138 ac_cv_i18n_lc_messages=yes,
4139 ac_cv_i18n_lc_messages=no)])
4140 if test "$ac_cv_i18n_lc_messages" = yes; then
4141 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
4144 AC_HAVE_FUNCS(localeconv)
4145 fi # ! SKIP_COMPILER_CHECKS
4148 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
4149 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
4152 dnl Mozilla specific options
4153 dnl ========================================================
4154 dnl The macros used for command line options
4155 dnl are defined in build/autoconf/altoptions.m4.
4157 dnl If the compiler supports these attributes, define them as
4158 dnl convenience macros.
4159 if test "$ac_cv_attribute_always_inline" = yes ; then
4160 AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
4162 AC_DEFINE(NS_ALWAYS_INLINE,)
4165 if test "$ac_cv_attribute_malloc" = yes ; then
4166 AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
4168 AC_DEFINE(NS_ATTR_MALLOC,)
4171 if test "$ac_cv_attribute_warn_unused" = yes ; then
4172 AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
4174 AC_DEFINE(NS_WARN_UNUSED_RESULT,)
4177 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
4178 dnl features that Windows actually does support.
4180 if test -n "$SKIP_COMPILER_CHECKS"; then
4181 dnl Windows has malloc.h
4182 AC_DEFINE(MALLOC_H, [<malloc.h>])
4183 AC_DEFINE(HAVE_FORCEINLINE)
4184 AC_DEFINE(HAVE_LOCALECONV)
4185 fi # SKIP_COMPILER_CHECKS
4187 dnl ========================================================
4189 dnl = Check for external package dependencies
4191 dnl ========================================================
4192 MOZ_ARG_HEADER(External Packages)
4194 MOZ_ARG_WITH_STRING(libxul-sdk,
4195 [ --with-libxul-sdk=PFX Use the libXUL SDK at <PFX>],
4196 LIBXUL_SDK_DIR=$withval)
4198 if test "$LIBXUL_SDK_DIR" = "yes"; then
4199 AC_MSG_ERROR([--with-libxul-sdk must specify a path])
4200 elif test -n "$LIBXUL_SDK_DIR" -a "$LIBXUL_SDK_DIR" != "no"; then
4201 LIBXUL_SDK=`cd "$LIBXUL_SDK_DIR" && pwd`
4203 if test ! -f "$LIBXUL_SDK/include/xpcom-config.h"; then
4204 AC_MSG_ERROR([$LIBXUL_SDK/include/xpcom-config.h doesn't exist])
4208 AC_SUBST(LIBXUL_SDK)
4210 if test -n "$LIBXUL_SDK"; then
4211 LIBXUL_DIST="$LIBXUL_SDK"
4213 LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
4215 AC_SUBST(LIBXUL_DIST)
4219 MOZ_ARG_WITH_BOOL(system-libxul,
4220 [ --with-system-libxul Use system installed libxul SDK],
4223 dnl ========================================================
4224 dnl = If NSPR was not detected in the system,
4225 dnl = use the one in the source tree (mozilla/nsprpub)
4226 dnl ========================================================
4227 MOZ_ARG_WITH_BOOL(system-nspr,
4228 [ --with-system-nspr Use system installed NSPR],
4229 _USE_SYSTEM_NSPR=1 )
4231 if test -n "$_USE_SYSTEM_NSPR"; then
4232 AM_PATH_NSPR(4.9.0, [MOZ_NATIVE_NSPR=1], [AC_MSG_ERROR([your don't have NSPR installed or your version is too old])])
4235 if test -n "$MOZ_NATIVE_NSPR"; then
4236 _SAVE_CFLAGS=$CFLAGS
4237 CFLAGS="$CFLAGS $NSPR_CFLAGS"
4238 AC_TRY_COMPILE([#include "prtypes.h"],
4239 [#ifndef PR_STATIC_ASSERT
4240 #error PR_STATIC_ASSERT not defined or requires including prtypes.h
4242 [MOZ_NATIVE_NSPR=1],
4243 AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
4244 AC_TRY_COMPILE([#include "prtypes.h"],
4246 #error PR_UINT64 not defined or requires including prtypes.h
4248 [MOZ_NATIVE_NSPR=1],
4249 AC_MSG_ERROR([system NSPR does not support PR_UINT64 or including prtypes.h does not provide it]))
4250 CFLAGS=$_SAVE_CFLAGS
4252 if test "$OS_ARCH" = "WINNT"; then
4253 NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
4254 if test -n "$GNU_CC"; then
4255 NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
4257 NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
4260 NSPR_CFLAGS='`$(LIBXUL_DIST)/sdk/bin/nspr-config --prefix='${LIBXUL_DIST}' --includedir='${LIBXUL_DIST}'/include/nspr --cflags`'
4261 NSPR_LIBS='`$(LIBXUL_DIST)/sdk/bin/nspr-config --prefix='${LIBXUL_DIST}' --libdir='${LIBXUL_DIST}'/lib --libs`'
4265 dnl system libevent Support
4266 dnl ========================================================
4267 MOZ_ARG_WITH_STRING(system-libevent,
4268 [ --with-system-libevent=[PFX]
4269 Use system libevent [installed at prefix PFX]],
4270 LIBEVENT_DIR=$withval)
4272 _SAVE_CFLAGS=$CFLAGS
4273 _SAVE_LDFLAGS=$LDFLAGS
4275 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
4276 MOZ_NATIVE_LIBEVENT=
4278 if test "${LIBEVENT_DIR}" = "yes"; then
4281 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
4282 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
4283 MOZ_CHECK_HEADER(event.h,
4284 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
4285 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
4287 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
4288 AC_CHECK_LIB(event, event_init,
4289 [MOZ_NATIVE_LIBEVENT=1
4290 MOZ_LIBEVENT_INCLUDES="${LIBEVENT_DIR}/include"
4291 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
4292 [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_INCLUDES= MOZ_LIBEVENT_LIBS=])
4294 CFLAGS=$_SAVE_CFLAGS
4295 LDFLAGS=$_SAVE_LDFLAGS
4298 AC_SUBST(MOZ_NATIVE_LIBEVENT)
4299 AC_SUBST(MOZ_LIBEVENT_INCLUDES)
4300 AC_SUBST(MOZ_LIBEVENT_LIBS)
4302 dnl ========================================================
4303 dnl = If NSS was not detected in the system,
4304 dnl = use the one in the source tree (mozilla/security/nss)
4305 dnl ========================================================
4307 MOZ_ARG_WITH_BOOL(system-nss,
4308 [ --with-system-nss Use system installed NSS],
4311 if test -n "$_USE_SYSTEM_NSS"; then
4312 AM_PATH_NSS(3.13.2, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
4315 if test -n "$MOZ_NATIVE_NSS"; then
4316 NSS_LIBS="$NSS_LIBS -lcrmf"
4318 NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
4320 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4321 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)smime$NSS_VERSION\$(DLL_SUFFIX) \
4322 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)ssl$NSS_VERSION\$(DLL_SUFFIX) \
4323 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nss$NSS_VERSION\$(DLL_SUFFIX) \
4324 \$(LIBXUL_DIST)/lib/\$(DLL_PREFIX)nssutil$NSS_VERSION\$(DLL_SUFFIX)"
4326 if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2"; then
4328 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
4329 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
4330 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
4331 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
4332 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
4334 NSS_LIBS='$(LIBS_DIR)'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
4338 dnl ======================
4340 dnl ======================
4342 AC_MSG_CHECKING([for YASM assembler])
4343 AC_CHECK_PROGS(YASM, yasm, "")
4345 if test -n "$YASM"; then
4346 dnl Pull out yasm's version string
4348 _YASM_VER_FILTER='s|.* \([0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\).*|\1|p'
4351 YASM_VERSION=`yasm --version | sed -ne "$_YASM_VER_FILTER"`
4352 _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
4353 _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
4354 _YASM_RELEASE=` echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
4355 _YASM_BUILD=` echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
4358 if test -z "$SKIP_LIBRARY_CHECKS"; then
4359 dnl system JPEG support
4360 dnl ========================================================
4361 MOZ_ARG_WITH_STRING(system-jpeg,
4362 [ --with-system-jpeg[=PFX]
4363 Use system libjpeg [installed at prefix PFX]],
4366 _SAVE_CFLAGS=$CFLAGS
4367 _SAVE_LDFLAGS=$LDFLAGS
4369 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
4370 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
4371 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
4373 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
4376 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [SYSTEM_JPEG=1 JPEG_LIBS="-ljpeg $JPEG_LIBS"], SYSTEM_JPEG=, $JPEG_LIBS)
4379 if test "$SYSTEM_JPEG" = 1; then
4380 LIBS="$JPEG_LIBS $LIBS"
4381 AC_TRY_COMPILE([ #include <stdio.h>
4382 #include <sys/types.h>
4383 #include <jpeglib.h> ],
4384 [ #if JPEG_LIB_VERSION < $MOZJPEG
4385 #error "Insufficient JPEG library version ($MOZJPEG required)."
4388 [SYSTEM_JPEG= JPEG_CFLAGS= JPEG_LIBS=])
4390 CFLAGS=$_SAVE_CFLAGS
4391 LDFLAGS=$_SAVE_LDFLAGS
4394 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$SYSTEM_JPEG" = 1; then
4395 JPEG_CFLAGS="-I${JPEG_DIR}/include"
4396 JPEG_LIBS="-L${JPEG_DIR}/lib ${JPEG_LIBS}"
4399 dnl system ZLIB support
4400 dnl ========================================================
4401 MOZ_ARG_WITH_STRING(system-zlib,
4402 [ --with-system-zlib[=PFX]
4403 Use system libz [installed at prefix PFX]],
4406 _SAVE_CFLAGS=$CFLAGS
4407 _SAVE_LDFLAGS=$LDFLAGS
4409 if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then
4410 CFLAGS="-I${ZLIB_DIR}/include $CFLAGS"
4411 LDFLAGS="-L${ZLIB_DIR}/lib $LDFLAGS"
4413 if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then
4416 AC_CHECK_LIB(z, gzread, [SYSTEM_ZLIB=1 ZLIB_LIBS="-lz $ZLIB_LIBS"],
4417 [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=], $ZLIB_LIBS)
4419 if test "$SYSTEM_ZLIB" = 1; then
4420 LIBS="$ZLIB_LIBS $LIBS"
4421 AC_TRY_COMPILE([ #include <stdio.h>
4423 #include <zlib.h> ],
4424 [ #if ZLIB_VERNUM < $MOZZLIB
4425 #error "Insufficient zlib version ($MOZZLIB required)."
4428 [SYSTEM_ZLIB= ZLIB_CFLAGS= ZLIB_LIBS=])
4430 CFLAGS=$_SAVE_CFLAGS
4431 LDFLAGS=$_SAVE_LDFLAGS
4434 if test "${ZLIB_DIR}" -a -d "${ZLIB_DIR}" -a "$SYSTEM_ZLIB" = 1; then
4435 ZLIB_CFLAGS="-I${ZLIB_DIR}/include"
4436 ZLIB_LIBS="-L${ZLIB_DIR}/lib ${ZLIB_LIBS}"
4439 if test "$MOZ_LINKER" = 1 -a "$SYSTEM_ZLIB" != 1; then
4440 AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
4443 dnl system BZIP2 Support
4444 dnl ========================================================
4445 MOZ_ARG_WITH_STRING(system-bz2,
4446 [ --with-system-bz2[=PFX]
4447 Use system libbz2 [installed at prefix PFX]],
4450 _SAVE_CFLAGS=$CFLAGS
4451 _SAVE_LDFLAGS=$LDFLAGS
4453 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
4454 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
4455 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
4457 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
4460 AC_CHECK_LIB(bz2, BZ2_bzread, [SYSTEM_BZ2=1 BZ2_LIBS="-lbz2"],
4461 [SYSTEM_BZ2= BZ2_CFLAGS= BZ2_LIBS=])
4463 CFLAGS=$_SAVE_CFLAGS
4464 LDFLAGS=$_SAVE_LDFLAGS
4467 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$SYSTEM_BZ2" = 1; then
4468 BZ2_CFLAGS="-I${BZ2_DIR}/include"
4469 BZ2_LIBS="-L${BZ2_DIR}/lib ${BZ2_LIBS}"
4472 dnl system PNG Support
4473 dnl ========================================================
4474 MOZ_ARG_WITH_STRING(system-png,
4475 [ --with-system-png[=PFX]
4476 Use system libpng [installed at prefix PFX]],
4479 _SAVE_CFLAGS=$CFLAGS
4480 _SAVE_LDFLAGS=$LDFLAGS
4482 CFLAGS="$ZLIB_CFLAGS $CFLAGS"
4483 LDFLAGS="$ZLIB_LIBS -lz $LDFLAGS"
4484 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
4485 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
4486 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
4488 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
4491 _SAVE_PNG_LIBS=$PNG_LIBS
4492 AC_CHECK_LIB(png, png_get_valid, [SYSTEM_PNG=1 PNG_LIBS="-lpng $PNG_LIBS"],
4493 AC_MSG_ERROR([--with-system-png requested but no working libpng found]),
4495 AC_CHECK_LIB(png, png_get_acTL, ,
4496 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]),
4499 if test "$SYSTEM_PNG" = 1; then
4500 LIBS="$PNG_LIBS $LIBS"
4501 AC_TRY_COMPILE([ #include <stdio.h>
4502 #include <sys/types.h>
4504 [ #if PNG_LIBPNG_VER < $MOZPNG
4505 #error "Insufficient libpng version ($MOZPNG required)."
4507 #ifndef PNG_UINT_31_MAX
4508 #error "Insufficient libpng version."
4511 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
4513 CFLAGS=$_SAVE_CFLAGS
4514 LDFLAGS=$_SAVE_LDFLAGS
4517 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$SYSTEM_PNG" = 1; then
4518 PNG_CFLAGS="-I${PNG_DIR}/include"
4519 PNG_LIBS="-L${PNG_DIR}/lib ${PNG_LIBS}"
4522 fi # SKIP_LIBRARY_CHECKS
4524 dnl system HunSpell Support
4525 dnl ========================================================
4526 MOZ_ARG_ENABLE_BOOL(system-hunspell,
4527 [ --enable-system-hunspell
4528 Use system hunspell (located with pkgconfig)],
4531 if test -n "$SYSTEM_HUNSPELL"; then
4532 PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
4535 AC_SUBST(SYSTEM_HUNSPELL)
4537 dnl ========================================================
4538 dnl system libffi Support
4539 dnl ========================================================
4540 MOZ_ARG_ENABLE_BOOL(system-ffi,
4541 [ --enable-system-ffi Use system libffi (located with pkgconfig)],
4544 if test -n "$MOZ_NATIVE_FFI"; then
4545 # Vanilla libffi 3.0.9 needs a few patches from upcoming version 3.0.10
4546 # for non-GCC compilers.
4547 if test -z "$GNU_CC"; then
4548 PKG_CHECK_MODULES(MOZ_FFI, libffi > 3.0.9)
4550 PKG_CHECK_MODULES(MOZ_FFI, libffi >= 3.0.9)
4552 MOZ_JS_STATIC_LIBS="$MOZ_JS_STATIC_LIBS $MOZ_FFI_LIBS"
4555 dnl ========================================================
4556 dnl Java SDK support
4557 dnl ========================================================
4560 MOZ_ARG_WITH_STRING(java-bin-path,
4561 [ --with-java-bin-path=dir
4562 Location of Java binaries (java, javac, jar)],
4563 JAVA_BIN_PATH=$withval)
4565 dnl ========================================================
4569 dnl ========================================================
4571 MOZ_ARG_HEADER(Application)
4574 ENABLE_SYSTEM_EXTENSION_DIRS=1
4575 MOZ_BRANDING_DIRECTORY=
4576 MOZ_OFFICIAL_BRANDING=
4580 MOZ_AUTH_EXTENSION=1
4589 MOZ_VP8_ERROR_CONCEALMENT=
4599 LIBJPEG_TURBO_ASFLAGS=
4600 LIBJPEG_TURBO_X86_ASM=
4601 LIBJPEG_TURBO_X64_ASM=
4605 MOZ_PREF_EXTENSIONS=1
4606 MOZ_PROFILELOCKING=1
4612 MOZ_JAVA_COMPOSITOR=
4614 MOZ_TOOLKIT_SEARCH=1
4616 MOZ_UNIVERSALCHARDET=1
4623 MOZ_DISABLE_DOMCRYPTO=
4627 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource websocket wyciwyg device"
4630 MOZ_USE_NATIVE_POPUP_WINDOWS=
4631 MOZ_ANDROID_HISTORY=
4643 case "$target_os" in
4646 if test -z "$GNU_CC"; then
4647 if test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
4651 if test -n "$NS_ENABLE_TSF"; then
4652 AC_DEFINE(NS_ENABLE_TSF)
4658 *-android*|*-linuxandroid*)
4659 if test "$CPU_ARCH" = "arm" ; then
4666 MOZ_THEME_FASTSTRIPE=1
4673 MOZ_ARG_ENABLE_STRING(application,
4674 [ --enable-application=APP
4678 tools/update-packaging (AUS-related packaging tools)],
4679 [ MOZ_BUILD_APP=$enableval ] )
4681 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
4682 [ --with-xulrunner-stub-name=appname Create the xulrunner stub with the given name],
4683 XULRUNNER_STUB_NAME=$withval)
4685 if test -z "$XULRUNNER_STUB_NAME"; then
4686 case "$target_os" in
4688 XULRUNNER_STUB_NAME=xulrunner
4691 XULRUNNER_STUB_NAME=xulrunner-stub
4694 AC_SUBST(XULRUNNER_STUB_NAME)
4696 AC_MSG_CHECKING([for application to build])
4697 if test -z "$MOZ_BUILD_APP"; then
4698 AC_MSG_RESULT([browser])
4699 MOZ_BUILD_APP=browser
4701 # default mobile to be mobile/xul
4702 if test "$MOZ_BUILD_APP" = "mobile" ; then
4703 MOZ_BUILD_APP=mobile/xul
4705 # We have a valid application only if it has a build.mk file in its top
4707 if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
4708 AC_MSG_RESULT([none])
4709 AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
4711 AC_MSG_RESULT([$MOZ_BUILD_APP])
4715 # Allow the application to influence configure with a confvars.sh script.
4717 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4718 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4719 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4720 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4725 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
4726 MOZ_ARG_WITH_STRING(app-name,
4727 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
4728 WITH_APP_NAME=$withval,
4731 if test -n "$WITH_APP_NAME" ; then
4732 MOZ_APP_NAME="$WITH_APP_NAME"
4735 MOZ_ARG_WITH_STRING(app-basename,
4736 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
4737 WITH_APP_BASENAME=$withval,
4740 if test -n "$WITH_APP_BASENAME" ; then
4741 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
4744 # Now is a good time to test for logic errors, define mismatches, etc.
4745 case "$MOZ_BUILD_APP" in
4747 if test "$LIBXUL_SDK"; then
4748 AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4753 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4754 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4756 case "$MOZ_BUILD_APP" in
4758 AC_DEFINE(MOZ_PHOENIX)
4762 AC_DEFINE(MOZ_XULRUNNER)
4766 AC_SUBST(MOZ_BUILD_APP)
4767 AC_SUBST(MOZ_PHOENIX)
4768 AC_SUBST(MOZ_XULRUNNER)
4770 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4772 dnl ========================================================
4774 dnl = Toolkit Options
4776 dnl ========================================================
4777 MOZ_ARG_HEADER(Toolkit Options)
4779 dnl ========================================================
4780 dnl = Select the default toolkit
4781 dnl ========================================================
4782 MOZ_ARG_ENABLE_STRING(default-toolkit,
4783 [ --enable-default-toolkit=TK
4784 Select default toolkit
4785 Platform specific defaults:
4786 Mac OS X - cairo-cocoa
4788 Win32 - cairo-windows
4791 [ _DEFAULT_TOOLKIT=$enableval ],
4792 [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4794 if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4795 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4796 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4797 -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4798 -o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
4799 -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
4800 -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
4801 -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
4802 -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
4804 dnl nglayout only supports building with one toolkit,
4805 dnl so ignore everything after the first comma (",").
4806 MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4808 AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4811 dnl ========================================================
4812 dnl = Enable the toolkit as needed =
4813 dnl ========================================================
4815 case "$MOZ_WIDGET_TOOLKIT" in
4818 MOZ_WIDGET_TOOLKIT=windows
4821 MOZ_INSTRUMENT_EVENT_LOOP=1
4824 cairo-gtk2|cairo-gtk2-x11)
4825 MOZ_WIDGET_TOOLKIT=gtk2
4827 MOZ_ENABLE_XREMOTE=1
4835 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4836 TK_LIBS='$(MOZ_GTK2_LIBS)'
4837 AC_DEFINE(MOZ_WIDGET_GTK2)
4839 MOZ_INSTRUMENT_EVENT_LOOP=1
4843 MOZ_WIDGET_TOOLKIT=qt
4845 MOZ_ENABLE_XREMOTE=1
4855 TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4856 TK_LIBS='$(MOZ_QT_LIBS)'
4857 AC_DEFINE(MOZ_WIDGET_QT)
4862 MOZ_WIDGET_TOOLKIT=os2
4864 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4865 TK_LIBS='$(MOZ_CAIRO_LIBS)'
4870 MOZ_WIDGET_TOOLKIT=cocoa
4871 AC_DEFINE(MOZ_WIDGET_COCOA)
4872 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
4873 TK_LIBS='-framework QuartzCore -framework Carbon -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework AddressBook -framework OpenGL'
4874 TK_CFLAGS="-DNO_X11"
4875 CFLAGS="$CFLAGS $TK_CFLAGS"
4876 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4877 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
4878 MOZ_USER_DIR="Mozilla"
4879 MOZ_FS_LAYOUT=bundle
4881 MOZ_INSTRUMENT_EVENT_LOOP=1
4885 MOZ_WIDGET_TOOLKIT=uikit
4886 AC_DEFINE(MOZ_WIDGET_UIKIT)
4887 LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
4888 TK_CFLAGS="-DNO_X11"
4889 TK_LIBS='-framework Foundation -framework CoreFoundation -framework CoreGraphics -framework CoreText'
4890 CFLAGS="$CFLAGS $TK_CFLAGS"
4891 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4892 LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
4893 MOZ_USER_DIR="Mozilla"
4894 MOZ_FS_LAYOUT=bundle
4898 AC_DEFINE(MOZ_WIDGET_ANDROID)
4899 MOZ_WIDGET_TOOLKIT=android
4900 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4901 TK_LIBS='$(MOZ_CAIRO_LIBS)'
4904 MOZ_INSTRUMENT_EVENT_LOOP=1
4909 AC_DEFINE(MOZ_WIDGET_GONK)
4910 MOZ_WIDGET_TOOLKIT=gonk
4911 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)'
4912 TK_LIBS='$(MOZ_CAIRO_LIBS)'
4920 AC_SUBST(MOZ_OLD_LINKER)
4921 AC_SUBST(MOZ_PDF_PRINTING)
4922 if test "$MOZ_PDF_PRINTING"; then
4923 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
4924 AC_DEFINE(MOZ_PDF_PRINTING)
4927 if test "$MOZ_ENABLE_XREMOTE"; then
4928 AC_DEFINE(MOZ_ENABLE_XREMOTE)
4931 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
4932 AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
4935 if test "$COMPILE_ENVIRONMENT"; then
4936 if test "$MOZ_ENABLE_GTK2"; then
4937 if test "$MOZ_X11"; then
4938 GDK_PACKAGES=gdk-x11-2.0
4941 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
4944 fi # COMPILE_ENVIRONMENT
4946 AC_SUBST(MOZ_FS_LAYOUT)
4948 dnl ========================================================
4949 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4950 dnl their usage and use them in spidermonkey.
4951 dnl ========================================================
4952 MOZ_ARG_WITH_BOOL(arm-kuser,
4953 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4955 if test -n "$USE_ARM_KUSER"; then
4956 AC_DEFINE(USE_ARM_KUSER)
4959 dnl ========================================================
4960 dnl = startup-notification support module
4961 dnl ========================================================
4963 if test "$MOZ_ENABLE_GTK2"
4965 MOZ_ENABLE_STARTUP_NOTIFICATION=
4967 MOZ_ARG_ENABLE_BOOL(startup-notification,
4968 [ --enable-startup-notification
4969 Enable startup-notification support (default: disabled) ],
4970 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4971 MOZ_ENABLE_STARTUP_NOTIFICATION=)
4972 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4974 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4975 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4976 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4977 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4979 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4981 MOZ_ENABLE_STARTUP_NOTIFICATION=
4985 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4986 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4989 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4991 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4992 AC_SUBST(MOZ_STARTUP_NOTIFICATION_CFLAGS)
4993 AC_SUBST(MOZ_STARTUP_NOTIFICATION_LIBS)
4995 dnl ========================================================
4997 dnl ========================================================
4998 if test "$MOZ_ENABLE_QT"
5000 MOZ_ARG_WITH_STRING(qtdir,
5001 [ --with-qtdir=\$dir Specify Qt directory ],
5004 if test -z "$QTDIR"; then
5005 PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
5006 AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
5007 AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
5009 MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtXml -lQtOpenGL"
5011 MOZ_QT_CFLAGS="-DQT_SHARED"
5012 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
5013 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/Qt"
5014 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
5015 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
5016 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
5017 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
5018 HOST_MOC="$QTDIR/bin/moc"
5019 HOST_RCC="$QTDIR/bin/rcc"
5021 if test -z "$HOST_MOC"; then
5022 AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is
5025 if test -z "$HOST_RCC"; then
5026 AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is
5033 MOZ_ENABLE_QMSYSTEM2=
5034 PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
5035 MOZ_ENABLE_QMSYSTEM2=1,
5036 MOZ_ENABLE_QMSYSTEM2=)
5038 if test "$MOZ_ENABLE_QMSYSTEM2"; then
5039 MOZ_ENABLE_QMSYSTEM2=1
5040 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
5041 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
5042 AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
5045 MOZ_ENABLE_QTNETWORK=
5046 PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
5047 MOZ_ENABLE_QTNETWORK=1,
5048 MOZ_ENABLE_QTNETWORK=)
5050 if test "$MOZ_ENABLE_QTNETWORK"; then
5051 MOZ_ENABLE_QTNETWORK=1
5052 AC_DEFINE(MOZ_ENABLE_QTNETWORK)
5055 MOZ_ENABLE_QTMOBILITY=
5056 PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
5057 MOZ_ENABLE_QTMOBILITY=1,
5058 MOZ_ENABLE_QTMOBILITY=)
5059 if test "$MOZ_ENABLE_QTMOBILITY"; then
5060 MOZ_ENABLE_QTMOBILITY=1
5061 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
5062 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
5064 AC_CHECK_LIB(QtSensors, main, [
5065 MOZ_ENABLE_QTMOBILITY=1
5066 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I/usr/include/qt4/QtMobility"
5067 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I/usr/include/qt4/QtSensors"
5068 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I/usr/include/qt4/QtFeedback"
5069 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I/usr/include/qt4/QtLocation"
5070 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
5073 if test "$MOZ_ENABLE_QTMOBILITY"; then
5074 AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
5078 AC_SUBST(GTK_CONFIG)
5082 AC_SUBST(MOZ_ENABLE_GTK2)
5083 AC_SUBST(MOZ_ENABLE_QT)
5084 AC_SUBST(MOZ_ENABLE_QTNETWORK)
5085 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
5086 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
5087 AC_SUBST(MOZ_ENABLE_XREMOTE)
5088 AC_SUBST(MOZ_GTK2_CFLAGS)
5089 AC_SUBST(MOZ_GTK2_LIBS)
5090 AC_SUBST(MOZ_QT_CFLAGS)
5091 AC_SUBST(MOZ_QT_LIBS)
5098 dnl ========================================================
5100 dnl = Components & Features
5102 dnl ========================================================
5103 MOZ_ARG_HEADER(Components and Features)
5105 dnl ========================================================
5107 dnl ========================================================
5108 MOZ_ARG_ENABLE_STRING(ui-locale,
5109 [ --enable-ui-locale=ab-CD
5110 Select the user interface locale (default: en-US)],
5111 MOZ_UI_LOCALE=$enableval )
5112 AC_SUBST(MOZ_UI_LOCALE)
5114 dnl ========================================================
5115 dnl = Trademarked Branding
5116 dnl ========================================================
5117 MOZ_ARG_ENABLE_BOOL(official-branding,
5118 [ --enable-official-branding
5119 Enable Official mozilla.org Branding
5120 Do not distribute builds with
5121 --enable-official-branding unless you have
5122 permission to use trademarks per
5123 http://www.mozilla.org/foundation/trademarks/ .],
5125 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
5126 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
5128 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
5129 MOZ_OFFICIAL_BRANDING=1
5131 ], MOZ_OFFICIAL_BRANDING=)
5133 AC_SUBST(MOZ_OFFICIAL_BRANDING)
5134 if test -n "$MOZ_OFFICIAL_BRANDING"; then
5135 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
5138 MOZ_ARG_WITH_STRING(branding,
5139 [ --with-branding=dir Use branding from the specified directory.],
5140 MOZ_BRANDING_DIRECTORY=$withval)
5142 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
5143 if test -z "$REAL_BRANDING_DIRECTORY"; then
5144 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
5147 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
5148 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
5151 AC_SUBST(MOZ_BRANDING_DIRECTORY)
5153 dnl ========================================================
5154 dnl = Distribution ID
5155 dnl ========================================================
5156 MOZ_ARG_WITH_STRING(distribution-id,
5157 [ --with-distribution-id=ID
5158 Set distribution-specific id (default=org.mozilla)],
5159 [ val=`echo $withval`
5160 MOZ_DISTRIBUTION_ID="$val"])
5162 if test -z "$MOZ_DISTRIBUTION_ID"; then
5163 MOZ_DISTRIBUTION_ID="org.mozilla"
5166 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
5167 AC_SUBST(MOZ_DISTRIBUTION_ID)
5170 dnl ========================================================
5171 dnl complex text support off by default
5172 dnl ========================================================
5173 MOZ_ARG_DISABLE_BOOL(pango,
5174 [ --disable-pango Disable usage of Pango ],
5178 dnl ========================================================
5180 dnl ========================================================
5181 if test "$MOZ_ENABLE_GTK2"
5185 PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
5187 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
5188 AC_SUBST(MOZ_PANGO_CFLAGS)
5189 AC_SUBST(MOZ_PANGO_LIBS)
5190 if test "$MOZ_PANGO"
5192 AC_DEFINE(MOZ_PANGO)
5194 PKG_CHECK_MODULES(FT2, freetype2 > 6.1.0 fontconfig)
5195 AC_SUBST(FT2_CFLAGS)
5200 if test "$MOZ_ENABLE_QT"
5202 if test "$MOZ_PANGO"
5204 PKG_CHECK_MODULES(MOZ_PANGO, [pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION],
5206 AC_SUBST(MOZ_PANGO_CFLAGS)
5207 AC_SUBST(MOZ_PANGO_LIBS)
5208 AC_DEFINE(MOZ_PANGO)
5211 echo "Pango library not found, will use FT2 font engine"
5218 dnl ========================================================
5219 dnl = GnomeVFS, GIO and GConf support module
5220 dnl ========================================================
5224 dnl build the gnomevfs extension by default only when the
5225 dnl GTK2 toolkit is in use.
5226 if test "$MOZ_ENABLE_GTK2"
5228 MOZ_ENABLE_GNOMEVFS=1
5232 dnl ========================================================
5233 dnl = GnomeVFS support module
5234 dnl ========================================================
5235 MOZ_ARG_DISABLE_BOOL(gnomevfs,
5236 [ --disable-gnomevfs Disable GnomeVFS support ],
5237 MOZ_ENABLE_GNOMEVFS=,
5238 MOZ_ENABLE_GNOMEVFS=force)
5240 if test "$MOZ_ENABLE_GNOMEVFS"
5242 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5243 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5244 MOZ_ENABLE_GNOMEVFS=1
5245 AC_DEFINE(MOZ_ENABLE_GNOMEVFS)
5247 if test "$MOZ_ENABLE_GNOMEVFS" = "force"
5249 AC_MSG_ERROR([* * * Could not find gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION])
5251 MOZ_ENABLE_GNOMEVFS=
5254 if test `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
5255 PKG_CHECK_MODULES(MOZ_GNOMEVFS, gnome-vfs-2.0 >= $GNOMEVFS_VERSION gnome-vfs-module-2.0 >= $GNOMEVFS_VERSION,[
5256 MOZ_GNOMEVFS_LIBS=`echo $MOZ_GNOMEVFS_LIBS | sed 's/-llinc\>//'`
5261 AC_SUBST(MOZ_ENABLE_GNOMEVFS)
5262 AC_SUBST(MOZ_GNOMEVFS_CFLAGS)
5263 AC_SUBST(MOZ_GNOMEVFS_LIBS)
5265 dnl ========================================================
5266 dnl = GIO support module
5267 dnl ========================================================
5268 MOZ_ARG_ENABLE_BOOL(gio,
5269 [ --enable-gio Enable GIO support (default: disabled)],
5270 MOZ_ENABLE_GIO=force,
5273 if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK2"
5275 PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
5276 [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
5277 PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
5278 MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
5280 AC_DEFINE(MOZ_ENABLE_GIO)
5282 if test "$MOZ_ENABLE_GIO" = "force"
5284 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
5290 AC_SUBST(MOZ_ENABLE_GIO)
5291 AC_SUBST(MOZ_GIO_CFLAGS)
5292 AC_SUBST(MOZ_GIO_LIBS)
5294 dnl ========================================================
5295 dnl = GConf support module
5296 dnl ========================================================
5297 MOZ_ARG_DISABLE_BOOL(gconf,
5298 [ --disable-gconf Disable Gconf support ],
5300 MOZ_ENABLE_GCONF=force)
5302 if test "$MOZ_ENABLE_GCONF"
5304 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
5305 MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
5308 if test "$MOZ_ENABLE_GCONF" = "force"
5310 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
5316 if test "$MOZ_ENABLE_GCONF"; then
5317 AC_DEFINE(MOZ_ENABLE_GCONF)
5320 AC_SUBST(MOZ_ENABLE_GCONF)
5321 AC_SUBST(MOZ_GCONF_CFLAGS)
5322 AC_SUBST(MOZ_GCONF_LIBS)
5325 dnl ========================================================
5326 dnl = libproxy support
5327 dnl ========================================================
5329 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5331 MOZ_ENABLE_LIBPROXY=
5333 MOZ_ARG_ENABLE_BOOL(libproxy,
5334 [ --enable-libproxy Enable libproxy support ],
5335 MOZ_ENABLE_LIBPROXY=1,
5336 MOZ_ENABLE_LIBPROXY=)
5338 if test "$MOZ_ENABLE_LIBPROXY"
5340 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
5341 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
5344 AC_SUBST(MOZ_ENABLE_LIBPROXY)
5345 AC_SUBST(MOZ_LIBPROXY_CFLAGS)
5346 AC_SUBST(MOZ_LIBPROXY_LIBS)
5348 dnl ========================================================
5349 dnl = libnotify support
5350 dnl ========================================================
5352 if test "$MOZ_ENABLE_GTK2"
5354 MOZ_ENABLE_LIBNOTIFY=1
5356 MOZ_ARG_DISABLE_BOOL(libnotify,
5357 [ --disable-libnotify Disable libnotify support ],
5358 MOZ_ENABLE_LIBNOTIFY=,
5359 MOZ_ENABLE_LIBNOTIFY=1)
5361 if test "$MOZ_ENABLE_LIBNOTIFY"
5363 AC_DEFINE(MOZ_ENABLE_LIBNOTIFY)
5367 if test -z "$SKIP_LIBRARY_CHECKS"
5369 if test "$MOZ_ENABLE_GTK2"
5371 if test "$MOZ_ENABLE_LIBNOTIFY"
5373 PKG_CHECK_MODULES(MOZ_LIBNOTIFY, libnotify >= $LIBNOTIFY_VERSION)
5377 AC_SUBST(MOZ_ENABLE_LIBNOTIFY)
5378 AC_SUBST(MOZ_LIBNOTIFY_CFLAGS)
5379 AC_SUBST(MOZ_LIBNOTIFY_LIBS)
5381 dnl ========================================================
5382 dnl = GNOME component (mozgnome)
5383 dnl ========================================================
5385 # The GNOME component is built if one of
5386 # gnome-vfs, gio, gconf or libnotify is available.
5387 if test "$MOZ_ENABLE_GCONF" -o \
5388 "$MOZ_ENABLE_GNOMEVFS" -o \
5389 "$MOZ_ENABLE_GIO" -o \
5390 "$MOZ_ENABLE_LIBNOTIFY"; then
5391 MOZ_ENABLE_GNOME_COMPONENT=1
5393 MOZ_ENABLE_GNOME_COMPONENT=
5395 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
5397 dnl ========================================================
5398 dnl = libgnomeui support module
5399 dnl ========================================================
5401 if test "$MOZ_ENABLE_GTK2"
5403 MOZ_ENABLE_GNOMEUI=1
5405 MOZ_ARG_DISABLE_BOOL(gnomeui,
5406 [ --disable-gnomeui Disable libgnomeui support (default: auto, optional at runtime) ],
5407 MOZ_ENABLE_GNOMEUI=,
5408 MOZ_ENABLE_GNOMEUI=force)
5410 if test "$MOZ_ENABLE_GNOMEUI"
5412 PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
5414 MOZ_GNOMEUI_LIBS=`echo $MOZ_GNOMEUI_LIBS | sed 's/-llinc\>//'`
5415 MOZ_ENABLE_GNOMEUI=1
5417 if test "$MOZ_ENABLE_GNOMEUI" = "force"
5419 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
5425 if test "$MOZ_ENABLE_GNOMEUI"; then
5426 AC_DEFINE(MOZ_ENABLE_GNOMEUI)
5430 AC_SUBST(MOZ_ENABLE_GNOMEUI)
5431 AC_SUBST(MOZ_GNOMEUI_CFLAGS)
5432 AC_SUBST(MOZ_GNOMEUI_LIBS)
5434 dnl ========================================================
5436 dnl ========================================================
5438 if test "$MOZ_ENABLE_GTK2" -o "$MOZ_ENABLE_QT"
5442 MOZ_ARG_DISABLE_BOOL(dbus,
5443 [ --disable-dbus Disable dbus support ],
5447 if test "$MOZ_ENABLE_DBUS"
5449 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
5450 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
5451 AC_DEFINE(MOZ_ENABLE_DBUS)
5454 AC_SUBST(MOZ_ENABLE_DBUS)
5455 AC_SUBST(MOZ_DBUS_CFLAGS)
5456 AC_SUBST(MOZ_DBUS_LIBS)
5457 AC_SUBST(MOZ_DBUS_GLIB_CFLAGS)
5458 AC_SUBST(MOZ_DBUS_GLIB_LIBS)
5460 dnl ========================================================
5461 dnl = Enable Android History instead of Places
5462 dnl ========================================================
5463 if test -n "$MOZ_ANDROID_HISTORY"; then
5464 dnl Do this if defined in confvars.sh
5465 AC_DEFINE(MOZ_ANDROID_HISTORY)
5469 dnl ========================================================
5470 dnl = Build Personal Security Manager
5471 dnl ========================================================
5472 MOZ_ARG_DISABLE_BOOL(crypto,
5473 [ --disable-crypto Disable crypto support (Personal Security Manager)],
5477 dnl ========================================================
5478 dnl = JS Debugger XPCOM component (js/jsd)
5479 dnl ========================================================
5480 MOZ_ARG_DISABLE_BOOL(jsd,
5481 [ --disable-jsd Disable JavaScript debug library],
5486 dnl ========================================================
5487 dnl = Enable IPDL's "expensive" unit tests
5488 dnl ========================================================
5491 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
5492 [ --enable-ipdl-tests Enable expensive IPDL tests],
5496 if test -n "$MOZ_IPDL_TESTS"; then
5497 AC_DEFINE(MOZ_IPDL_TESTS)
5500 AC_SUBST(MOZ_IPDL_TESTS)
5502 dnl ========================================================
5503 dnl = Turns off code necessary for e10s compatibility
5504 dnl ========================================================
5505 dnl This is a temporary flag to be removed in bug 662601 when
5506 dnl it's no longer needed
5510 MOZ_ARG_ENABLE_BOOL(e10s-compat,
5511 [ --enable-e10s-compat Turns off code for e10s compat],
5515 if test -n "$MOZ_E10S_COMPAT"; then
5516 AC_DEFINE(MOZ_E10S_COMPAT)
5519 dnl ========================================================
5520 dnl = Disable building dbm
5521 dnl ========================================================
5522 MOZ_ARG_DISABLE_BOOL(dbm,
5523 [ --disable-dbm Disable building dbm],
5527 dnl bi-directional support always on
5531 dnl ========================================================
5532 dnl accessibility support on by default on all platforms
5534 dnl ========================================================
5535 MOZ_ARG_DISABLE_BOOL(accessibility,
5536 [ --disable-accessibility Disable accessibility support (off by default on OS X)],
5539 if test "$ACCESSIBILITY"; then
5540 AC_DEFINE(ACCESSIBILITY)
5543 dnl ========================================================
5544 dnl Disable printing
5545 dnl ========================================================
5546 MOZ_ARG_DISABLE_BOOL(printing,
5547 [ --disable-printing Disable printing support],
5551 if test "$NS_PRINTING"; then
5552 AC_DEFINE(NS_PRINTING)
5553 AC_DEFINE(NS_PRINT_PREVIEW)
5556 dnl ========================================================
5557 dnl = Enable Raw Codecs
5558 dnl ========================================================
5559 MOZ_ARG_ENABLE_BOOL(raw,
5560 [ --enable-raw Enable support for RAW media],
5564 if test -n "$MOZ_RAW"; then
5571 dnl ========================================================
5572 dnl = Disable Ogg Codecs
5573 dnl ========================================================
5574 MOZ_ARG_DISABLE_BOOL(ogg,
5575 [ --disable-ogg Disable support for OGG media (Theora video and Vorbis audio)],
5579 if test -n "$MOZ_OGG"; then
5583 case "$target_cpu" in
5592 dnl Checks for __attribute__(aligned()) directive
5593 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5594 [ac_cv_c_attribute_aligned],
5595 [ac_cv_c_attribute_aligned=0
5596 CFLAGS_save="${CFLAGS}"
5597 CFLAGS="${CFLAGS} -Werror"
5598 for ac_cv_c_attr_align_try in 64 32 16 8; do
5599 echo "trying $ac_cv_c_attr_align_try"
5601 [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5602 [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5603 if test "$ac_cv_c_attribute_aligned" != 0; then
5607 CFLAGS="${CFLAGS_save}"])
5608 if test "${ac_cv_c_attribute_aligned}" != "0"; then
5609 AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5610 [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5614 dnl ========================================================
5615 dnl = Disable VP8 decoder support
5616 dnl ========================================================
5617 MOZ_ARG_DISABLE_BOOL(webm,
5618 [ --disable-webm Disable support for WebM media (VP8 video and Vorbis audio)],
5622 dnl system libvpx Support
5623 dnl ========================================================
5624 MOZ_ARG_WITH_STRING(system-libvpx,
5625 [ --with-system-libvpx=[PFX]
5626 Use system libvpx [installed at prefix PFX]],
5627 LIBVPX_DIR=$withval)
5630 MOZ_LIBVPX_INCLUDES=
5633 if test -n "$MOZ_WEBM"; then
5635 if test -n "$MOZ_VP8_ERROR_CONCEALMENT" ; then
5636 AC_DEFINE(MOZ_VP8_ERROR_CONCEALMENT)
5638 if test -n "$MOZ_VP8_ENCODER" ; then
5639 AC_DEFINE(MOZ_VP8_ENCODER)
5642 if test -n "$LIBVPX_DIR" -a "$LIBVPX_DIR" != no; then
5643 _SAVE_CFLAGS=$CFLAGS
5644 _SAVE_LDFLAGS=$LDFLAGS
5646 if test "${LIBVPX_DIR}" = "yes"; then
5649 CFLAGS="-I${LIBVPX_DIR}/include $CFLAGS"
5650 LDFLAGS="-L${LIBVPX_DIR}/lib $LDFLAGS"
5651 MOZ_NATIVE_LIBVPX_DEC_TEST=
5652 MOZ_CHECK_HEADER(vpx/vpx_decoder.h,
5653 [if test ! -f "${LIBVPX_DIR}/include/vpx/vpx_decoder.h"; then
5654 AC_MSG_ERROR([vpx/vpx_decoder.h found, but is not in ${LIBVPX_DIR}/include])
5656 AC_MSG_ERROR([--with-system-libvpx requested but vpx/vpx_decoder.h not found]))
5657 AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver,
5658 [MOZ_NATIVE_LIBVPX_DEC_TEST=1],
5659 ([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found]))
5660 if test -n "$MOZ_NATIVE_LIBVPX_DEC_TEST" ; then
5661 AC_MSG_CHECKING([for libvpx version >= v0.9.7])
5662 dnl We need at least v0.9.7 to fix several crash bugs (for which we
5663 dnl had local patches prior to v0.9.7).
5665 dnl This is a terrible test for the library version, but we don't
5666 dnl have a good one. There is no version number in a public header,
5667 dnl and testing the headers still doesn't guarantee we link against
5668 dnl the right version. While we could call vpx_codec_version() at
5669 dnl run-time, that would break cross-compiling. There are no
5670 dnl additional exported symbols between the v0.9.7 release and the
5671 dnl v0.9.6 one to check for.
5673 #include <vpx/vpx_decoder.h>
5674 #if !defined(VPX_CODEC_USE_INPUT_PARTITION)
5675 #error "test failed."
5679 [AC_MSG_RESULT([yes])
5681 AC_DEFINE(MOZ_NATIVE_LIBVPX)
5682 MOZ_LIBVPX_INCLUDES="-I${LIBVPX_DIR}/include"
5683 MOZ_LIBVPX_LIBS="-L${LIBVPX_DIR}/lib -lvpx"],
5684 [AC_MSG_RESULT([no])
5685 AC_MSG_ERROR([--with-system-libvpx requested but it is not v0.9.7 or later])])
5687 CFLAGS=$_SAVE_CFLAGS
5688 LDFLAGS=$_SAVE_LDFLAGS
5693 AC_SUBST(MOZ_NATIVE_LIBVPX)
5694 AC_SUBST(MOZ_LIBVPX_INCLUDES)
5695 AC_SUBST(MOZ_LIBVPX_LIBS)
5697 if test -n "$MOZ_WEBM" -a -z "$MOZ_NATIVE_LIBVPX"; then
5700 case "$target_cpu" in
5710 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5711 dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
5712 dnl We currently require gcc on all arm platforms.
5715 VPX_NEED_OBJ_INT_EXTRACT=
5717 dnl See if we have assembly on this platform.
5718 case "$OS_ARCH:$CPU_ARCH" in
5720 VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5724 VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5728 VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
5732 VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5736 VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5740 VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5744 if test -z "$GNU_CC"; then
5745 VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5750 if test -z "$GNU_CC"; then
5751 dnl Check for yasm 1.1 or greater.
5752 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5753 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.])
5754 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5755 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.])
5757 VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5759 dnl The encoder needs obj_int_extract to get asm offsets.
5764 if test -n "$GNU_AS" ; then
5766 dnl These flags are a lie; they're just used to enable the requisite
5767 dnl opcodes; actual arch detection is done at runtime.
5768 VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5769 VPX_DASH_C_FLAG="-c"
5770 VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5771 VPX_ASM_SUFFIX="$ASM_SUFFIX"
5776 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5777 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.])
5780 if test -n "$MOZ_VP8_ENCODER" -a \
5781 -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
5782 dnl We prefer to get asm offsets using inline assembler, which the above
5783 dnl compilers can do. When we're not using one of those, we have to fall
5784 dnl back to obj_int_extract, which reads them from a compiled object
5785 dnl file. Unfortunately, that only works if we're compiling on a system
5786 dnl with the header files for the appropriate object file format.
5787 VPX_NEED_OBJ_INT_EXTRACT=1
5790 if test -n "$VPX_X86_ASM"; then
5791 AC_DEFINE(VPX_X86_ASM)
5792 elif test -n "$VPX_ARM_ASM"; then
5793 AC_DEFINE(VPX_ARM_ASM)
5795 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5799 dnl ========================================================
5800 dnl = Disable Wave decoder support
5801 dnl ========================================================
5802 MOZ_ARG_DISABLE_BOOL(wave,
5803 [ --disable-wave Disable Wave decoder support],
5807 if test -n "$MOZ_WAVE"; then
5813 dnl ========================================================
5814 dnl = Handle dependent SYDNEYAUDIO and MEDIA defines
5815 dnl ========================================================
5817 if test -n "$MOZ_SYDNEYAUDIO"; then
5818 AC_DEFINE(MOZ_SYDNEYAUDIO)
5821 if test -n "$MOZ_MEDIA"; then
5822 AC_DEFINE(MOZ_MEDIA)
5825 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5826 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/])
5829 if test -n "$MOZ_VORBIS"; then
5830 AC_DEFINE(MOZ_VORBIS)
5833 if test -n "$MOZ_TREMOR"; then
5834 AC_DEFINE(MOZ_TREMOR)
5837 dnl ========================================================
5838 dnl = Check alsa availability on Linux if using sydneyaudio
5839 dnl ========================================================
5841 dnl If using sydneyaudio with Linux, ensure that the alsa library is available
5842 if test -n "$MOZ_SYDNEYAUDIO"; then
5843 case "$target_os" in
5845 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5846 [echo "$MOZ_ALSA_PKG_ERRORS"
5847 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.)])])
5852 dnl ========================================================
5853 dnl Permissions System
5854 dnl ========================================================
5855 MOZ_ARG_DISABLE_BOOL(permissions,
5856 [ --disable-permissions Disable permissions (popup and cookie blocking)],
5861 dnl ========================================================
5863 dnl ========================================================
5864 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5865 [ --disable-negotiateauth Disable GSS-API negotiation ],
5866 MOZ_AUTH_EXTENSION=,
5867 MOZ_AUTH_EXTENSION=1 )
5869 dnl ========================================================
5871 dnl ========================================================
5872 MOZ_ARG_DISABLE_BOOL(xtf,
5873 [ --disable-xtf Disable XTF (pluggable xml tags) support],
5876 if test "$MOZ_XTF"; then
5880 dnl ========================================================
5881 dnl Pref extensions (autoconfig)
5882 dnl ========================================================
5883 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5884 [ --disable-pref-extensions
5885 Disable pref extensions such as autoconfig],
5886 MOZ_PREF_EXTENSIONS=,
5887 MOZ_PREF_EXTENSIONS=1 )
5889 dnl ========================================================
5890 dnl Searching of system directories for extensions.
5891 dnl Note: this switch is meant to be used for test builds
5892 dnl whose behavior should not depend on what happens to be
5893 dnl installed on the local machine.
5894 dnl ========================================================
5895 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
5896 [ --disable-system-extension-dirs
5897 Disable searching system- and account-global
5898 directories for extensions of any kind; use
5899 only profile-specific extension directories],
5900 ENABLE_SYSTEM_EXTENSION_DIRS=,
5901 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
5902 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
5903 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
5906 dnl ========================================================
5907 dnl = Universalchardet
5908 dnl ========================================================
5909 MOZ_ARG_DISABLE_BOOL(universalchardet,
5910 [ --disable-universalchardet
5911 Disable universal encoding detection],
5912 MOZ_UNIVERSALCHARDET=,
5913 MOZ_UNIVERSALCHARDET=1 )
5915 if test -n "${JAVA_BIN_PATH}"; then
5916 dnl Look for javac and jar in the specified path.
5917 JAVA_PATH="$JAVA_BIN_PATH"
5919 dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5920 JAVA_PATH="$JAVA_HOME/bin:$PATH"
5923 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5924 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5925 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5927 if test -n "${JAVA_BIN_PATH}" -o "$OS_TARGET" = Android; then
5928 if test -z "$JAVA" -o "$JAVA" = ":" -o -z "$JAVAC" -o "$JAVAC" = ":" -o -z "$JAR" -o "$JAR" = ":"; then
5929 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}])
5933 dnl ========================================================
5934 dnl = ANGLE OpenGL->D3D translator for WebGL
5935 dnl = * only applies to win32
5936 dnl = * enabled by default (shipping build); requires explicit --disable to disable
5937 dnl ========================================================
5939 MOZ_DIRECTX_SDK_PATH=
5940 MOZ_DIRECTX_SDK_CPU_SUFFIX=
5943 MOZ_D3DCOMPILER_CAB=
5945 MOZ_D3DCOMPILER_DLL=
5946 case "$target_os" in
5952 # The DirectX SDK libraries are split into x86 and x64 sub-directories
5953 case "${target_cpu}" in
5955 MOZ_DIRECTX_SDK_CPU_SUFFIX=x86
5958 MOZ_DIRECTX_SDK_CPU_SUFFIX=x64
5962 if test -n "$MOZ_ANGLE"; then
5963 MOZ_ARG_DISABLE_BOOL(angle,
5964 [ --disable-angle Disable building of ANGLE for WebGL->D3D translation],
5968 if test -n "$MOZ_ANGLE"; then
5969 if test -z "$_WIN32_MSVC"; then
5970 AC_MSG_ERROR([Building ANGLE requires MSVC. To build without ANGLE, reconfigure with --disable-angle.])
5973 # Get the SDK path from the registry.
5974 # First try to get the June 2010 SDK
5975 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK (June 2010)' | head -n 1`
5976 if test -z "$MOZ_DIRECTX_SDK_REG_KEY" ; then
5977 # Otherwise just take whatever comes first
5978 MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
5981 if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
5982 AC_MSG_ERROR([Found the February 2010 DirectX SDK. This is too old. We now require the June 2010 DirectX SDK, or newer. Upgrade your SDK or to explicitly build without ANGLE, reconfigure with --disable-angle.])
5984 MOZ_DIRECTX_SDK_PATH=`reg query "$MOZ_DIRECTX_SDK_REG_KEY" //v InstallPath | grep REG_SZ | sed 's/.*\([[a-zA-Z]]\)\\:\\\\/\\1\\:\\\\/'`
5989 if test -n "$MOZ_DIRECTX_SDK_PATH" ; then
5990 if test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h && test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
5991 AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
5996 if test -z "$MOZ_ANGLE" ; then
5997 AC_MSG_ERROR([Couldn't find the DirectX SDK, needed for ANGLE. Please install it (June 2010 or newer). To explicitly build without ANGLE, reconfigure with --disable-angle.])
6000 if test -n "$MOZ_ANGLE" ; then
6001 # Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
6002 MOZ_D3DX9_VERSION=`dumpbin //headers "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/d3dx9.lib | egrep d3dx9_[[0-9]][[0-9]]\.dll | head -n1 | sed 's/.*\([[0-9]][[0-9]]\).*/\\1/g'`
6004 if test -z "$MOZ_D3DX9_VERSION" ; then
6005 AC_MSG_ERROR([Couldn't determine the D3DX9 version, needed for ANGLE. To explicitly build without ANGLE, reconfigure with --disable-angle.])
6008 if test -n "$MOZ_ANGLE" ; then
6009 MOZ_D3DX9_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *d3dx9_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
6010 MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
6012 MOZ_D3DX9_DLL=d3dx9_$MOZ_D3DX9_VERSION.dll
6013 MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
6019 dnl ========================================================
6020 dnl = Breakpad crash reporting (on by default on supported platforms)
6021 dnl ========================================================
6024 i?86-*-mingw*|x86_64-*-mingw*)
6027 i?86-apple-darwin*|powerpc-apple-darwin*|x86_64-apple-darwin*)
6030 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
6031 if test "$MOZ_ENABLE_GTK2"; then
6035 *-android*|*-linuxandroid*)
6043 MOZ_ARG_DISABLE_BOOL(crashreporter,
6044 [ --disable-crashreporter Disable breakpad crash reporting],
6046 MOZ_CRASHREPORTER=1)
6048 if test -n "$MOZ_CRASHREPORTER"; then
6049 AC_DEFINE(MOZ_CRASHREPORTER)
6051 if (test "$OS_TARGET" = "Linux" -o "$OS_ARCH" = "SunOS") && \
6052 test -z "$SKIP_LIBRARY_CHECKS"; then
6053 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
6054 AC_SUBST(MOZ_GTHREAD_CFLAGS)
6055 AC_SUBST(MOZ_GTHREAD_LIBS)
6057 MOZ_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.])])
6060 if (test "$OS_ARCH" != "$HOST_OS_ARCH"); then
6061 AC_MSG_ERROR([Breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH. Use --disable-crashreporter.])
6065 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
6066 [ --with-crashreporter-enable-percent=NN
6067 Enable sending crash reports by default on NN% of users. (default=100)],
6068 [ val=`echo $withval | sed 's/[^0-9]//g'`
6069 MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
6071 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
6072 MOZ_CRASHREPORTER_ENABLE_PERCENT=100
6074 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
6076 dnl ========================================================
6077 dnl = libjpeg-turbo configuration
6078 dnl ========================================================
6080 if test -z "$SYSTEM_JPEG"; then
6084 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
6085 [ --disable-libjpeg-turbo Disable optimized jpeg decoding routines],
6087 MOZ_LIBJPEG_TURBO=1)
6089 if test "$SYSTEM_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
6090 AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
6093 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
6096 if test -n "$MOZ_LIBJPEG_TURBO"; then
6098 dnl Do we support libjpeg-turbo on this platform?
6099 case "$OS_ARCH:$OS_TEST" in
6100 Linux:x86|Linux:i?86)
6101 LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
6102 LIBJPEG_TURBO_X86_ASM=1
6105 LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
6106 LIBJPEG_TURBO_X64_ASM=1
6109 LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
6110 LIBJPEG_TURBO_X86_ASM=1
6113 LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
6114 LIBJPEG_TURBO_X64_ASM=1
6117 LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
6118 LIBJPEG_TURBO_X86_ASM=1
6121 LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
6122 LIBJPEG_TURBO_X64_ASM=1
6124 WINNT:x86|WINNT:i?86)
6125 LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
6126 LIBJPEG_TURBO_X86_ASM=1
6129 LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
6130 LIBJPEG_TURBO_X64_ASM=1
6136 dnl If we're on a system which supports libjpeg-turbo's asm routines and
6137 dnl --disable-libjpeg-turbo wasn't passed, check for yasm, and error out if it
6138 dnl doesn't exist or we have too old of a version.
6139 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
6140 AC_MSG_CHECKING([for YASM assembler])
6141 AC_CHECK_PROGS(LIBJPEG_TURBO_AS, yasm, "")
6143 if test -z "$LIBJPEG_TURBO_AS" ; then
6144 AC_MSG_ERROR([yasm is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you do not appear to have yasm installed. Either install it or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder. See https://developer.mozilla.org/en/YASM for more details.])
6147 dnl Check that we have the right yasm version. We require 1.0.1 or newer
6148 dnl on Linux and 1.1 or newer everywhere else.
6149 if test "$OS_ARCH" = "Linux" ; then
6150 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -eq "0" -a "$_YASM_RELEASE" -lt "1" \) ; then
6151 AC_MSG_ERROR([yasm 1.0.1 or greater is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION.$_YASM_RELEASE. Upgrade to the newest version or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder. See https://developer.mozilla.org/en/YASM for more details.])
6154 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
6155 AC_MSG_ERROR([yasm 1.1 or greater is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION. Upgrade to the newest version or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder. See https://developer.mozilla.org/en/YASM for more details.])
6160 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
6161 AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
6162 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
6163 AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
6164 elif test -n "$MOZ_LIBJPEG_TURBO"; then
6165 dnl Warn if we're not building the optimized routines, even though the user
6166 dnl didn't specify --disable-libjpeg-turbo.
6167 AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo. Using unoptimized C routines.])
6170 dnl ========================================================
6171 dnl = Enable compilation of specific extension modules
6172 dnl ========================================================
6174 MOZ_ARG_ENABLE_STRING(extensions,
6175 [ --enable-extensions Enable extensions],
6176 [ for option in `echo $enableval | sed 's/,/ /g'`; do
6177 if test "$option" = "yes" -o "$option" = "all"; then
6178 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
6179 elif test "$option" = "no" -o "$option" = "none"; then
6181 elif test "$option" = "default"; then
6182 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
6183 elif test `echo "$option" | grep -c \^-` != 0; then
6184 option=`echo $option | sed 's/^-//'`
6185 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
6187 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
6190 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
6192 if test -z "$MOZ_ENABLE_GNOMEVFS" -a -z "$MOZ_GNOMEVFS_LIBS" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6193 # Suppress warning on non-X11 platforms
6194 if test -n "$MOZ_X11"; then
6195 AC_MSG_WARN([Cannot build gnomevfs without required libraries. Removing gnomevfs from MOZ_EXTENSIONS.])
6197 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6200 dnl Do not build gnomevfs with libxul based apps
6201 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gnomevfs` -ne 0; then
6202 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gnomevfs||'`
6205 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6206 # Suppress warning on non-X11 platforms
6207 if test -n "$MOZ_X11"; then
6208 AC_MSG_WARN([Cannot build gio without required libraries. Removing gio from MOZ_EXTENSIONS.])
6210 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6213 dnl Do not build gio with libxul based apps
6214 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
6215 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
6218 if test -z "$MOZ_JSDEBUGGER" -a `echo "$MOZ_EXTENSIONS" | grep -c venkman` -ne 0; then
6219 AC_MSG_WARN([Cannot build venkman without JavaScript debug library. Removing venkman from MOZ_EXTENSIONS.])
6220 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|venkman||'`
6223 dnl xforms requires xtf
6224 if test -z "$MOZ_XTF" -a `echo "$MOZ_EXTENSIONS" | grep -c xforms` -ne 0; then
6225 AC_MSG_WARN([Cannot build XForms without XTF support. Removing XForms from MOZ_EXTENSIONS.])
6226 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|xforms||g'`
6230 MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}`
6232 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
6233 dnl when trying to build a nonexistent extension.
6234 for extension in $MOZ_EXTENSIONS; do
6235 if test ! -d "${srcdir}/extensions/${extension}"; then
6236 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
6240 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
6241 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
6244 dnl ========================================================
6245 dnl SVG Display Lists
6246 dnl ========================================================
6247 if test -n "$MOZ_SVG_DLISTS"; then
6248 AC_DEFINE(MOZ_SVG_DLISTS)
6251 dnl ========================================================
6252 dnl Build Freetype in the tree
6253 dnl ========================================================
6254 MOZ_ARG_ENABLE_BOOL(tree-freetype,
6255 [ --enable-tree-freetype Enable Tree FreeType],
6256 MOZ_TREE_FREETYPE=1,
6257 MOZ_TREE_FREETYPE= )
6258 if test -n "$MOZ_TREE_FREETYPE"; then
6259 if test -n "$_WIN32_MSVC"; then
6260 AC_ERROR("building with in-tree freetype is not supported on MSVC")
6262 AC_DEFINE(MOZ_TREE_FREETYPE)
6263 AC_SUBST(MOZ_TREE_FREETYPE)
6264 MOZ_ENABLE_CAIRO_FT=1
6265 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
6266 FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6267 CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
6268 FT2_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6269 CAIRO_FT_LIBS='$(call EXPAND_LIBNAME_PATH,freetype,$(DEPTH)/modules/freetype2/.libs)'
6270 AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
6271 AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
6272 AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
6273 AC_SUBST(CAIRO_FT_CFLAGS)
6276 dnl ========================================================
6278 dnl ========================================================
6279 MOZ_ARG_DISABLE_BOOL(installer,
6280 [ --disable-installer Disable building of installer],
6283 if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then
6284 # Disable installer for Windows builds that use the new toolkit if the
6285 # required major version and minimum minor version of Unicode NSIS isn't in
6287 REQ_NSIS_MAJOR_VER=2
6288 MIN_NSIS_MINOR_VER=33
6289 MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-2.46 makensisu makensis)
6290 if test -z "$MAKENSISU" -o "$MAKENSISU" = ":"; then
6291 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.])
6294 MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\)\-Unicode$/\1/g'`
6296 if test ! "$MAKENSISU_VER" = ""; then
6297 MAKENSISU_MAJOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $1 }'`
6298 MAKENSISU_MINOR_VER=`echo $MAKENSISU_VER | $AWK -F\. '{ print $2 }'`
6300 AC_MSG_CHECKING([for Unicode NSIS with major version == $REQ_NSIS_MAJOR_VER and minor version >= $MIN_NSIS_MINOR_VER])
6301 if test "$MAKENSISU_VER" = "" ||
6302 test ! "$MAKENSISU_MAJOR_VER" = "$REQ_NSIS_MAJOR_VER" -o \
6303 ! "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER; then
6305 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.])
6307 AC_MSG_RESULT([yes])
6310 AC_SUBST(MOZ_INSTALLER)
6312 AC_MSG_CHECKING([for tar archiver])
6313 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6314 if test -z "$TAR"; then
6315 AC_MSG_ERROR([no tar archiver found in \$PATH])
6317 AC_MSG_RESULT([$TAR])
6320 AC_MSG_CHECKING([for wget])
6321 AC_CHECK_PROGS(WGET, wget, "")
6322 AC_MSG_RESULT([$WGET])
6325 dnl ========================================================
6326 dnl Maintenance Service
6327 dnl ========================================================
6329 MOZ_ARG_ENABLE_BOOL(maintenance-service,
6330 [ --enable-maintenance-service Enable building of maintenanceservice],
6331 MOZ_MAINTENANCE_SERVICE=1,
6332 MOZ_MAINTENANCE_SERVICE= )
6334 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
6335 if test "$OS_ARCH" = "WINNT"; then
6336 AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
6338 AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
6342 dnl ========================================================
6344 dnl ========================================================
6346 MOZ_ARG_DISABLE_BOOL(updater,
6347 [ --disable-updater Disable building of updater],
6351 if test -n "$MOZ_UPDATER"; then
6352 AC_DEFINE(MOZ_UPDATER)
6355 # app update channel is 'default' when not supplied.
6356 MOZ_ARG_ENABLE_STRING([update-channel],
6357 [ --enable-update-channel=CHANNEL
6358 Select application update channel (default=default)],
6359 MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
6361 if test -z "$MOZ_UPDATE_CHANNEL"; then
6362 MOZ_UPDATE_CHANNEL=default
6364 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
6365 AC_SUBST(MOZ_UPDATE_CHANNEL)
6367 # tools/update-packaging is not checked out by default.
6368 MOZ_ARG_ENABLE_BOOL(update-packaging,
6369 [ --enable-update-packaging
6370 Enable tools/update-packaging],
6371 MOZ_UPDATE_PACKAGING=1,
6372 MOZ_UPDATE_PACKAGING= )
6373 AC_SUBST(MOZ_UPDATE_PACKAGING)
6375 dnl ========================================================
6377 dnl ========================================================
6378 MOZ_ARG_ENABLE_BOOL(leaky,
6379 [ --enable-leaky Build leaky memory tool],
6384 dnl ========================================================
6385 dnl build the tests by default
6386 dnl ========================================================
6387 MOZ_ARG_DISABLE_BOOL(tests,
6388 [ --disable-tests Do not build test libraries & programs],
6392 dnl ========================================================
6393 dnl parental controls (for Windows Vista)
6394 dnl ========================================================
6395 MOZ_ARG_DISABLE_BOOL(parental-controls,
6396 [ --disable-parental-controls
6397 Do not build parental controls],
6398 MOZ_DISABLE_PARENTAL_CONTROLS=1,
6399 MOZ_DISABLE_PARENTAL_CONTROLS=)
6400 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6401 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6404 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6406 dnl ========================================================
6407 dnl = Disable DOMCrypto
6408 dnl ========================================================
6409 if test -n "$MOZ_DISABLE_DOMCRYPTO"; then
6410 AC_DEFINE(MOZ_DISABLE_DOMCRYPTO)
6413 dnl ========================================================
6415 dnl = Module specific options
6417 dnl ========================================================
6418 MOZ_ARG_HEADER(Individual module options)
6420 dnl ========================================================
6421 dnl = Disable feed handling components
6422 dnl ========================================================
6423 MOZ_ARG_DISABLE_BOOL(feeds,
6424 [ --disable-feeds Disable feed handling and processing components],
6427 if test -n "$MOZ_FEEDS"; then
6428 AC_DEFINE(MOZ_FEEDS)
6430 if test "$MOZ_BUILD_APP" = "browser"; then
6431 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6435 dnl ========================================================
6436 dnl Check for sqlite
6437 dnl ========================================================
6440 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6441 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
6442 MOZ_NATIVE_SQLITE=1,
6443 MOZ_NATIVE_SQLITE= )
6445 if test -z "$MOZ_NATIVE_SQLITE"
6448 SQLITE_LIBS='$(call EXPAND_LIBNAME_PATH,mozsqlite3,$(DIST)/lib)'
6450 dnl ============================
6451 dnl === SQLite Version check ===
6452 dnl ============================
6453 dnl Check to see if the system SQLite package is new enough.
6454 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6456 dnl ==================================
6457 dnl === SQLITE_SECURE_DELETE check ===
6458 dnl ==================================
6459 dnl Check to see if the system SQLite package is compiled with
6460 dnl SQLITE_SECURE_DELETE enabled.
6461 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6462 _SAVE_CFLAGS="$CFLAGS"
6463 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6465 LIBS="$LIBS $SQLITE_LIBS"
6466 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6468 #include "sqlite3.h"
6470 int main(int argc, char **argv){
6471 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6473 ac_cv_sqlite_secure_delete=yes,
6474 ac_cv_sqlite_secure_delete=no,
6475 ac_cv_sqlite_secure_delete=no
6478 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6479 CFLAGS="$_SAVE_CFLAGS"
6481 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6482 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6485 dnl ===============================
6486 dnl === SQLITE_THREADSAFE check ===
6487 dnl ===============================
6488 dnl Check to see if the system SQLite package is compiled with
6489 dnl SQLITE_THREADSAFE enabled.
6490 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6491 _SAVE_CFLAGS="$CFLAGS"
6492 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6494 LIBS="$LIBS $SQLITE_LIBS"
6495 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6497 #include "sqlite3.h"
6499 int main(int argc, char **argv){
6500 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6502 ac_cv_sqlite_threadsafe=yes,
6503 ac_cv_sqlite_threadsafe=no,
6504 ac_cv_sqlite_threadsafe=no
6507 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6508 CFLAGS="$_SAVE_CFLAGS"
6510 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6511 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6514 dnl ================================
6515 dnl === SQLITE_ENABLE_FTS3 check ===
6516 dnl ================================
6517 dnl check to see if the system SQLite package is compiled with
6518 dnl SQLITE_ENABLE_FTS3 enabled.
6519 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6520 _SAVE_CFLAGS="$CFLAGS"
6521 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6523 LIBS="$LIBS $SQLITE_LIBS"
6524 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6526 #include "sqlite3.h"
6528 int main(int argc, char **argv){
6529 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6531 ac_cv_sqlite_enable_fts3=yes,
6532 ac_cv_sqlite_enable_fts3=no,
6533 ac_cv_sqlite_enable_fts3=no
6536 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6537 CFLAGS="$_SAVE_CFLAGS"
6539 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6540 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6543 dnl =========================================
6544 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6545 dnl =========================================
6546 dnl check to see if the system SQLite package is compiled with
6547 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6548 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6549 _SAVE_CFLAGS="$CFLAGS"
6550 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6552 LIBS="$LIBS $SQLITE_LIBS"
6553 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6555 #include "sqlite3.h"
6557 int main(int argc, char **argv){
6558 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6560 ac_cv_sqlite_enable_unlock_notify=yes,
6561 ac_cv_sqlite_enable_unlock_notify=no,
6562 ac_cv_sqlite_enable_unlock_notify=no
6565 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6566 CFLAGS="$_SAVE_CFLAGS"
6568 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6569 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6573 if test -n "$MOZ_NATIVE_SQLITE"; then
6574 AC_DEFINE(MOZ_NATIVE_SQLITE)
6576 AC_SUBST(MOZ_NATIVE_SQLITE)
6578 dnl ========================================================
6579 dnl = Enable help viewer (off by default)
6580 dnl ========================================================
6581 if test -n "$MOZ_HELP_VIEWER"; then
6582 dnl Do this if defined in confvars.sh
6583 AC_DEFINE(MOZ_HELP_VIEWER)
6586 dnl ========================================================
6587 dnl = Enable safe browsing (anti-phishing)
6588 dnl ========================================================
6589 MOZ_ARG_ENABLE_BOOL(safe-browsing,
6590 [ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation],
6591 MOZ_SAFE_BROWSING=1,
6592 MOZ_SAFE_BROWSING= )
6593 if test -n "$MOZ_SAFE_BROWSING"; then
6594 AC_DEFINE(MOZ_SAFE_BROWSING)
6596 AC_SUBST(MOZ_SAFE_BROWSING)
6598 dnl ========================================================
6599 dnl = Enable url-classifier
6600 dnl ========================================================
6601 dnl Implicitly enabled by default if building with safe-browsing
6602 if test -n "$MOZ_SAFE_BROWSING"; then
6603 MOZ_URL_CLASSIFIER=1
6605 MOZ_ARG_ENABLE_BOOL(url-classifier,
6606 [ --enable-url-classifier Enable url classifier module],
6607 MOZ_URL_CLASSIFIER=1,
6608 MOZ_URL_CLASSIFIER= )
6609 if test -n "$MOZ_URL_CLASSIFIER"; then
6610 AC_DEFINE(MOZ_URL_CLASSIFIER)
6612 AC_SUBST(MOZ_URL_CLASSIFIER)
6614 dnl ========================================================
6615 dnl = Disable zipwriter
6616 dnl ========================================================
6617 MOZ_ARG_DISABLE_BOOL(zipwriter,
6618 [ --disable-zipwriter Disable zipwriter component],
6621 AC_SUBST(MOZ_ZIPWRITER)
6623 dnl ========================================================
6625 dnl ========================================================
6626 dnl superseded by QtNetwork starting from 4.7
6627 MOZ_ENABLE_LIBCONIC=1
6629 if test -n "$MOZ_ENABLE_QT"; then
6630 if test "$MOZ_ENABLE_QTNETWORK"; then
6631 MOZ_ENABLE_LIBCONIC=
6635 MOZ_ARG_DISABLE_BOOL(libconic,
6636 [ --disable-libconic Disable libconic],
6637 MOZ_ENABLE_LIBCONIC=,
6638 MOZ_ENABLE_LIBCONIC=1 )
6640 if test -n "$MOZ_ENABLE_LIBCONIC"; then
6641 PKG_CHECK_MODULES(LIBCONIC, conic,
6642 MOZ_ENABLE_LIBCONIC=1,
6643 MOZ_ENABLE_LIBCONIC=)
6645 if test "$MOZ_ENABLE_LIBCONIC"; then
6646 AC_DEFINE(MOZ_ENABLE_LIBCONIC)
6649 AC_SUBST(MOZ_ENABLE_LIBCONIC)
6650 AC_SUBST(LIBCONIC_CFLAGS)
6651 AC_SUBST(LIBCONIC_LIBS)
6653 dnl ========================================================
6655 dnl ========================================================
6657 MAEMO_SDK_TARGET_VER=-1
6659 MOZ_ARG_WITH_STRING(maemo-version,
6660 [ --with-maemo-version=MAEMO_SDK_TARGET_VER
6662 MAEMO_SDK_TARGET_VER=$withval)
6664 case "$MAEMO_SDK_TARGET_VER" in
6666 MOZ_PLATFORM_MAEMO=5
6670 MOZ_PLATFORM_MAEMO=6
6674 dnl We aren't compiling for Maemo, move on.
6677 AC_MSG_ERROR([Unknown Maemo Version. Try setting --with-maemo-version to 5 or 6.])
6681 if test $MOZ_PLATFORM_MAEMO; then
6682 AC_DEFINE_UNQUOTED([MOZ_PLATFORM_MAEMO], $MOZ_PLATFORM_MAEMO)
6684 if test -z "$MOZ_ENABLE_DBUS"; then
6685 AC_MSG_ERROR([DBus is required when building for Maemo])
6688 MOZ_GFX_OPTIMIZE_MOBILE=1
6690 MOZ_MAEMO_LIBLOCATION=
6692 if test $MOZ_PLATFORM_MAEMO = 5; then
6693 dnl if we have Xcomposite we should also have Xdamage and Xfixes
6694 MOZ_CHECK_HEADERS([X11/extensions/Xdamage.h], [],
6695 [AC_MSG_ERROR([Couldn't find X11/extensions/Xdamage.h which is required for composited plugins.])])
6696 AC_CHECK_LIB(Xcomposite, XCompositeRedirectWindow, [XCOMPOSITE_LIBS="-lXcomposite -lXdamage -lXfixes"],
6697 [MISSING_X="$MISSING_X -lXcomposite"], $XLIBS)
6699 AC_SUBST(XCOMPOSITE_LIBS)
6701 PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime, _LIB_FOUND=1, _LIB_FOUND=)
6702 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONMIME_LIBS"
6703 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONMIME_CFLAGS"
6704 if test -z "$_LIB_FOUND"; then
6705 AC_MSG_ERROR([Hildon Mime is required when building for Maemo])
6709 PKG_CHECK_MODULES(LIBOSSO,libosso, _LIB_FOUND=1, _LIB_FOUND=)
6710 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBOSSO_LIBS"
6711 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBOSSO_CFLAGS"
6712 if test -z "$_LIB_FOUND"; then
6713 AC_MSG_ERROR([LibOSSO is required when building for Maemo])
6716 PKG_CHECK_MODULES(LIBHILDONFM,hildon-fm-2, _LIB_FOUND=1, _LIB_FOUND=)
6717 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBHILDONFM_LIBS"
6718 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBHILDONFM_CFLAGS"
6719 if test -z "$_LIB_FOUND"; then
6720 AC_MSG_ERROR([Hildon FM-2 is required when building for Maemo])
6724 if test $MOZ_PLATFORM_MAEMO = 6; then
6726 PKG_CHECK_MODULES(LIBCONTENTMANAGER, ContentManager QtSparql,
6729 if test "$_LIB_FOUND"; then
6730 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTMANAGER_LIBS"
6731 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTMANAGER_CFLAGS"
6732 MOZ_ENABLE_CONTENTMANAGER=1
6733 AC_DEFINE(MOZ_ENABLE_CONTENTMANAGER)
6735 AC_MSG_WARN([Cannot find libcontentmanager and or QtSparql building for Maemo 6])
6737 AC_SUBST(MOZ_ENABLE_CONTENTMANAGER)
6739 dnl ========================================================
6740 dnl = Enable meego libcontentaction
6741 dnl ========================================================
6742 MOZ_ARG_ENABLE_BOOL(meegocontentaction,
6743 [ --enable-meegocontentaction Enable meegocontentaction support],
6744 MOZ_MEEGOCONTENTACTION=1,
6745 MOZ_MEEGOCONTENTACTION=)
6747 if test -n "$MOZ_MEEGOCONTENTACTION"; then
6749 PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
6750 if test "$_LIB_FOUND"; then
6751 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBCONTENTACTION_LIBS"
6752 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBCONTENTACTION_CFLAGS"
6753 MOZ_ENABLE_CONTENTACTION=1
6754 AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
6755 AC_SUBST(MOZ_ENABLE_CONTENTACTION)
6759 MOZ_ARG_ENABLE_BOOL(meegotouch,
6760 [ --enable-meegotouch Enable meegotouch support],
6761 MOZ_MEEGOTOUCHENABLED=1,
6762 MOZ_MEEGOTOUCHENABLED=)
6764 if test -n "$MOZ_MEEGOTOUCHENABLED"; then
6765 PKG_CHECK_MODULES(MOZ_MEEGOTOUCH, meegotouchcore, _LIB_FOUND=1, _LIB_FOUND=)
6766 if test "$_LIB_FOUND"; then
6767 MOZ_QT_CFLAGS="$MOZ_MEEGOTOUCH_CFLAGS $MOZ_QT_CFLAGS"
6768 MOZ_QT_LIBS="$MOZ_MEEGOTOUCH_LIBS $MOZ_QT_LIBS"
6769 AC_DEFINE(MOZ_ENABLE_MEEGOTOUCH)
6771 AC_MSG_WARN([Cannot meegotouchcore-dev. Disabling Meegotouch support.])
6776 PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
6777 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBLOCATION_LIBS"
6778 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBLOCATION_CFLAGS"
6779 if test "$_LIB_FOUND"; then
6780 MOZ_MAEMO_LIBLOCATION=1
6781 AC_DEFINE(MOZ_MAEMO_LIBLOCATION)
6783 AC_MSG_WARN([Cannot liblocation-dev. Disabling Maemo geolocation.])
6785 AC_SUBST(MOZ_MAEMO_LIBLOCATION)
6787 PKG_CHECK_MODULES(LIBMEEGOTOUCHSHARE, ShareUiInterface-maemo-meegotouch >= 0.3.31 mdatauri, _LIB_FOUND=1, _LIB_FOUND=)
6788 MOZ_PLATFORM_MAEMO_LIBS="$MOZ_PLATFORM_MAEMO_LIBS $LIBMEEGOTOUCHSHARE_LIBS"
6789 MOZ_PLATFORM_MAEMO_CFLAGS="$MOZ_PLATFORM_MAEMO_CFLAGS $LIBMEEGOTOUCHSHARE_CFLAGS"
6790 if test "$_LIB_FOUND"; then
6791 MOZ_ENABLE_MEEGOTOUCHSHARE=1
6792 AC_DEFINE(MOZ_ENABLE_MEEGOTOUCHSHARE)
6794 AC_MSG_WARN([Cannot find maemo-meegotouch-interfaces-dev or libmdatauri-dev. Disabling meegotouch share ui.])
6796 AC_SUBST(MOZ_ENABLE_MEEGOTOUCHSHARE)
6798 AC_SUBST(MOZ_PLATFORM_MAEMO_LIBS)
6799 AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
6802 dnl ========================================================
6803 dnl = XRender Composite
6804 dnl ========================================================
6805 MOZ_ARG_ENABLE_BOOL(egl-xrender-composite,
6806 [ --enable-egl-xrender-composite
6807 Enable EGL xrender composite optimizations],
6808 MOZ_EGL_XRENDER_COMPOSITE=1)
6810 if test -n "$MOZ_EGL_XRENDER_COMPOSITE"; then
6811 AC_DEFINE(MOZ_EGL_XRENDER_COMPOSITE)
6814 AC_SUBST(MOZ_EGL_XRENDER_COMPOSITE)
6816 dnl ========================================================
6817 dnl = faststripe theme
6818 dnl ========================================================
6819 MOZ_ARG_ENABLE_BOOL(faststripe,
6820 [ --enable-faststripe Use faststripe theme],
6821 MOZ_THEME_FASTSTRIPE=1,
6822 MOZ_THEME_FASTSTRIPE= )
6823 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6825 dnl ========================================================
6827 dnl = Feature options that require extra sources to be pulled
6829 dnl ========================================================
6830 dnl MOZ_ARG_HEADER(Features that require extra sources)
6832 dnl ========================================================
6834 dnl = Debugging Options
6836 dnl ========================================================
6837 MOZ_ARG_HEADER(Debugging and Optimizations)
6839 dnl ========================================================
6840 dnl = Disable building with debug info.
6841 dnl = Debugging is OFF by default
6842 dnl ========================================================
6843 if test -z "$MOZ_DEBUG_FLAGS"; then
6844 MOZ_DEBUG_FLAGS="-g"
6847 MOZ_ARG_ENABLE_STRING(debug,
6848 [ --enable-debug[=DBG] Enable building with developer debug info
6849 (using compiler flags DBG)],
6850 [ if test "$enableval" != "no"; then
6852 if test -n "$enableval" -a "$enableval" != "yes"; then
6853 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6854 _MOZ_DEBUG_FLAGS_SET=1
6861 MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
6862 MOZ_ARG_WITH_STRING(debug-label,
6863 [ --with-debug-label=LABELS
6864 Define DEBUG_<value> for each comma-separated
6866 [ for option in `echo $withval | sed 's/,/ /g'`; do
6867 MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
6870 MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
6872 if test -n "$MOZ_DEBUG"; then
6873 AC_MSG_CHECKING([for valid debug flags])
6874 _SAVE_CFLAGS=$CFLAGS
6875 CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS"
6876 AC_TRY_COMPILE([#include <stdio.h>],
6877 [printf("Hello World\n");],
6880 AC_MSG_RESULT([$_results])
6881 if test "$_results" = "no"; then
6882 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_DEBUG_FLAGS])
6884 CFLAGS=$_SAVE_CFLAGS
6887 dnl ========================================================
6888 dnl enable mobile optimizations
6889 dnl ========================================================
6890 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6891 [ --enable-mobile-optimize
6892 Enable mobile optimizations],
6893 MOZ_GFX_OPTIMIZE_MOBILE=1)
6895 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6897 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6898 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6901 dnl ========================================================
6902 dnl = Enable code optimization. ON by default.
6903 dnl ========================================================
6904 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6905 MOZ_OPTIMIZE_FLAGS="-O"
6908 MOZ_ARG_ENABLE_STRING(optimize,
6909 [ --disable-optimize Disable compiler optimization
6910 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6911 [ if test "$enableval" != "no"; then
6913 if test -n "$enableval" -a "$enableval" != "yes"; then
6914 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6919 fi ], MOZ_OPTIMIZE=1)
6921 MOZ_SET_FRAMEPTR_FLAGS
6923 if test "$COMPILE_ENVIRONMENT"; then
6924 if test -n "$MOZ_OPTIMIZE"; then
6925 AC_MSG_CHECKING([for valid optimization flags])
6926 _SAVE_CFLAGS=$CFLAGS
6927 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6928 AC_TRY_COMPILE([#include <stdio.h>],
6929 [printf("Hello World\n");],
6932 AC_MSG_RESULT([$_results])
6933 if test "$_results" = "no"; then
6934 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6936 CFLAGS=$_SAVE_CFLAGS
6938 fi # COMPILE_ENVIRONMENT
6940 AC_SUBST(MOZ_OPTIMIZE)
6941 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
6942 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6943 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6944 AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK)
6945 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
6947 dnl ========================================================
6948 dnl = Enable generation of debug symbols
6949 dnl ========================================================
6950 MOZ_ARG_ENABLE_STRING(debug-symbols,
6951 [ --enable-debug-symbols[=DBG]
6952 Enable debugging symbols (using compiler flags DBG)],
6953 [ if test "$enableval" != "no"; then
6955 if test -n "$enableval" -a "$enableval" != "yes"; then
6956 if test -z "$_MOZ_DEBUG_FLAGS_SET"; then
6957 MOZ_DEBUG_FLAGS=`echo $enableval | sed -e 's|\\\ | |g'`
6959 AC_MSG_ERROR([--enable-debug-symbols flags cannot be used with --enable-debug flags])
6965 MOZ_DEBUG_SYMBOLS=1)
6967 if test -n "$MOZ_DEBUG" -o -n "$MOZ_DEBUG_SYMBOLS"; then
6968 AC_DEFINE(MOZ_DEBUG_SYMBOLS)
6969 export MOZ_DEBUG_SYMBOLS
6972 dnl ========================================================
6973 dnl = Identical Code Folding
6974 dnl ========================================================
6976 MOZ_ARG_DISABLE_BOOL(icf,
6977 [ --disable-icf Disable Identical Code Folding],
6981 if test "$GNU_CC" -a "$GCC_USE_GNU_LD" -a -z "$MOZ_DISABLE_ICF"; then
6982 AC_CACHE_CHECK([whether the linker supports Identical Code Folding],
6984 [echo 'int foo() {return 42;}' \
6985 'int bar() {return 42;}' \
6986 'int main() {return foo() - bar();}' > conftest.${ac_ext}
6987 # If the linker supports ICF, foo and bar symbols will have
6989 if AC_TRY_COMMAND([${CC-cc} -o conftest${ac_exeext} $LDFLAGS -Wl,--icf=safe -ffunction-sections conftest.${ac_ext} $LIBS 1>&2]) &&
6990 test -s conftest${ac_exeext} &&
6991 objdump -t conftest${ac_exeext} | awk '{a[[$6]] = $1} END {if (a[["foo"]] && (a[["foo"]] != a[["bar"]])) { exit 1 }}'; then
6997 if test "$LD_SUPPORTS_ICF" = yes; then
6998 LDFLAGS="$LDFLAGS -Wl,--icf=safe"
6999 CFLAGS="$CFLAGS -ffunction-sections"
7000 CXXFLAGS="$CXXFLAGS -ffunction-sections"
7004 dnl ========================================================
7005 dnl = Automatically remove dead symbols
7006 dnl ========================================================
7008 if test "$GNU_CC" -a "$GCC_USE_GNU_LD" -a -n "$MOZ_DEBUG_FLAGS"; then
7010 AC_CACHE_CHECK([whether removing dead symbols breaks debugging],
7011 GC_SECTIONS_BREAKS_DEBUG_RANGES,
7012 [echo 'int foo() {return 42;}' \
7013 'int bar() {return 1;}' \
7014 'int main() {return foo();}' > conftest.${ac_ext}
7015 if AC_TRY_COMMAND([${CC-cc} -o conftest.${ac_objext} $CFLAGS $MOZ_DEBUG_FLAGS -ffunction-sections -c conftest.${ac_ext} 1>&2]) &&
7016 AC_TRY_COMMAND([${CC-cc} -o conftest${ac_exeext} $LDFLAGS $MOZ_DEBUG_FLAGS -Wl,--gc-sections conftest.${ac_objext} $LIBS 1>&2]) &&
7017 test -s conftest${ac_exeext} -a -s conftest.${ac_objext}; then
7018 if test "`$PYTHON "$_topsrcdir"/build/unix/check_debug_ranges.py conftest.${ac_objext} conftest.${ac_ext}`" = \
7019 "`$PYTHON "$_topsrcdir"/build/unix/check_debug_ranges.py conftest${ac_exeext} conftest.${ac_ext}`"; then
7020 GC_SECTIONS_BREAKS_DEBUG_RANGES=no
7022 GC_SECTIONS_BREAKS_DEBUG_RANGES=yes
7025 dnl We really don't expect to get here, but just in case
7026 GC_SECTIONS_BREAKS_DEBUG_RANGES="no, but it's broken in some other way"
7029 if test "$GC_SECTIONS_BREAKS_DEBUG_RANGES" = no; then
7030 DSO_LDOPTS="$DSO_LDOPTS -Wl,--gc-sections"
7032 *-ffunction-sections*)
7033 CFLAGS="$CFLAGS -fdata-sections"
7034 CXXFLAGS="$CXXFLAGS -fdata-sections"
7037 CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
7038 CXXFLAGS="$CXXFLAGS -ffunction-sections -fdata-sections"
7044 dnl ========================================================
7045 dnl = Enable any treating of compile warnings as errors
7046 dnl ========================================================
7047 MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
7048 [ --enable-warnings-as-errors
7049 Enable treating of warnings as errors],
7050 MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
7051 MOZ_ENABLE_WARNINGS_AS_ERRORS=)
7052 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
7053 WARNINGS_AS_ERRORS=''
7056 dnl ========================================================
7057 dnl = Disable runtime logging checks
7058 dnl ========================================================
7059 MOZ_ARG_DISABLE_BOOL(logging,
7060 [ --disable-logging Disable logging facilities],
7061 NS_DISABLE_LOGGING=1,
7062 NS_DISABLE_LOGGING= )
7063 if test "$NS_DISABLE_LOGGING"; then
7064 AC_DEFINE(NS_DISABLE_LOGGING)
7066 AC_DEFINE(MOZ_LOGGING)
7069 dnl ========================================================
7070 dnl = This will enable logging of addref, release, ctor, dtor.
7071 dnl ========================================================
7072 _ENABLE_LOGREFCNT=42
7073 MOZ_ARG_ENABLE_BOOL(logrefcnt,
7074 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
7075 _ENABLE_LOGREFCNT=1,
7076 _ENABLE_LOGREFCNT= )
7077 if test "$_ENABLE_LOGREFCNT" = "1"; then
7078 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
7079 elif test -z "$_ENABLE_LOGREFCNT"; then
7080 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
7083 dnl ========================================================
7084 dnl moz_dump_painting
7085 dnl ========================================================
7086 MOZ_ARG_ENABLE_BOOL(dump-painting,
7087 [ --enable-dump-painting Enable paint debugging.],
7088 MOZ_DUMP_PAINTING=1,
7089 MOZ_DUMP_PAINTING= )
7090 if test -n "$MOZ_DUMP_PAINTING"; then
7091 AC_DEFINE(MOZ_DUMP_PAINTING)
7092 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
7094 if test -n "$MOZ_DEBUG"; then
7095 AC_DEFINE(MOZ_DUMP_PAINTING)
7098 dnl ========================================================
7099 dnl = Enable trace malloc
7100 dnl ========================================================
7101 NS_TRACE_MALLOC=${MOZ_TRACE_MALLOC}
7102 MOZ_ARG_ENABLE_BOOL(trace-malloc,
7103 [ --enable-trace-malloc Enable malloc tracing; also disables jemalloc],
7106 if test "$NS_TRACE_MALLOC"; then
7107 # Please, Mr. Linker Man, don't take away our symbol names
7108 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
7110 AC_DEFINE(NS_TRACE_MALLOC)
7112 AC_SUBST(NS_TRACE_MALLOC)
7114 dnl ========================================================
7115 dnl = Enable jemalloc
7116 dnl ========================================================
7117 MOZ_ARG_ENABLE_BOOL(jemalloc,
7118 [ --enable-jemalloc Replace memory allocator with jemalloc],
7122 if test "$NS_TRACE_MALLOC"; then
7125 if test "$MOZ_DMD"; then
7129 if test "${OS_TARGET}" = "Android"; then
7130 dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue
7132 elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin" -o "${OS_TARGET}" = "OS2"; then
7133 dnl On Windows, OSX and OS2, we want to link all our binaries against mozglue
7134 MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
7136 dnl On other Unix systems, we only want to link executables against mozglue
7137 MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib) $(MKSHLIB_UNFORCE_ALL)'
7138 if test -n "$GNU_CC"; then
7139 dnl And we need mozglue symbols to be exported.
7140 MOZ_GLUE_PROGRAM_LDFLAGS="$MOZ_GLUE_PROGRAM_LDFLAGS -rdynamic"
7144 if test -z "$MOZ_MEMORY"; then
7147 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
7148 AC_MSG_WARN([When not building jemalloc, you need to set WIN32_REDIST_DIR to the path to the Visual C++ Redist (usually VCINSTALLDIR\redist\x86\Microsoft.VC80.CRT, for VC++ v8) if you intend to distribute your build.])
7153 dnl Don't try to run compiler tests on Windows
7154 if test "$OS_ARCH" = "WINNT"; then
7155 if test -z "$HAVE_64BIT_OS"; then
7156 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7158 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7161 AC_CHECK_SIZEOF([int *], [4])
7162 case "${ac_cv_sizeof_int_p}" in
7164 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 2)
7167 AC_DEFINE_UNQUOTED([MOZ_MEMORY_SIZEOF_PTR_2POW], 3)
7170 AC_MSG_ERROR([Unexpected pointer size])
7175 AC_DEFINE(MOZ_MEMORY)
7176 if test "x$MOZ_DEBUG" = "x1"; then
7177 AC_DEFINE(MOZ_MEMORY_DEBUG)
7179 dnl The generic feature tests that determine how to compute ncpus are long and
7180 dnl complicated. Therefore, simply define special cpp variables for the
7181 dnl platforms we have special knowledge of.
7184 AC_DEFINE(MOZ_MEMORY_DARWIN)
7187 AC_DEFINE(MOZ_MEMORY_BSD)
7189 *-android*|*-linuxandroid*)
7190 AC_DEFINE(MOZ_MEMORY_LINUX)
7191 AC_DEFINE(MOZ_MEMORY_ANDROID)
7196 AC_DEFINE(MOZ_MEMORY_LINUX)
7199 AC_DEFINE(MOZ_MEMORY_BSD)
7202 AC_DEFINE(MOZ_MEMORY_SOLARIS)
7205 AC_DEFINE(MOZ_MEMORY_WINDOWS)
7206 if test -z "$MOZ_DEBUG"; then
7207 WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
7209 WIN32_CRT_LIBS="msvcrtd.lib msvcprtd.lib"
7211 dnl Look for a broken crtdll.obj
7212 WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
7213 lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
7214 if grep -q '__imp__\{0,1\}free' crtdll.obj; then
7215 MOZ_GLUE_LDFLAGS='-LIBPATH:$(DIST)/lib -NODEFAULTLIB:msvcrt -NODEFAULTLIB:msvcrtd -NODEFAULTLIB:msvcprt -NODEFAULTLIB:msvcprtd -DEFAULTLIB:mozcrt'
7216 dnl Also pass this to NSPR/NSS
7217 DLLFLAGS="$DLLFLAGS $MOZ_GLUE_LDFLAGS"
7219 DLLFLAGS="$DLLFLAGS -LIBPATH:\$(DIST)/lib -DEFAULTLIB:mozglue"
7226 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
7230 if test "$OS_ARCH" != "WINNT"; then
7231 dnl NB: this must be kept in sync with jemalloc.h
7232 AC_DEFINE(HAVE_JEMALLOC_VALLOC)
7234 AC_DEFINE(HAVE_JEMALLOC_POSIX_MEMALIGN)
7235 AC_DEFINE(HAVE_JEMALLOC_MEMALIGN)
7237 AC_SUBST(MOZ_MEMORY)
7238 AC_SUBST(MOZ_GLUE_LDFLAGS)
7239 AC_SUBST(MOZ_GLUE_PROGRAM_LDFLAGS)
7240 AC_SUBST(WIN32_CRT_LIBS)
7241 dnl Need to set this for make because NSS doesn't have configure
7244 dnl We need to wrap dlopen and related functions on Android because we use
7246 if test "$OS_TARGET" = Android; then
7247 WRAP_LDFLAGS="${WRAP_LDFLAGS} -L$_objdir/dist/lib -lmozglue"
7248 if test "$MOZ_WIDGET_TOOLKIT" = android; then
7249 if test -n "$MOZ_OLD_LINKER"; then
7250 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=dlopen,--wrap=dlclose,--wrap=dlerror,--wrap=dlsym,--wrap=dladdr"
7252 WRAP_LDFLAGS="${WRAP_LDFLAGS} --wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
7256 dnl ========================================================
7257 dnl = Use malloc wrapper lib
7258 dnl ========================================================
7259 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
7260 [ --enable-wrap-malloc Wrap malloc calls (gnu linker only)],
7264 if test -n "$_WRAP_MALLOC"; then
7265 if test -n "$GNU_CC"; then
7266 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=malloc,--wrap=calloc,--wrap=valloc,--wrap=free,--wrap=realloc,--wrap=memalign"
7267 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=__builtin_new,--wrap=__builtin_vec_new,--wrap=__builtin_delete,--wrap=__builtin_vec_delete"
7268 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=PR_Free,--wrap=PR_Malloc,--wrap=PR_Calloc,--wrap=PR_Realloc"
7269 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=strdup,--wrap=strndup"
7270 WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=posix_memalign,--wrap=malloc_usable_size"
7272 AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains])
7276 dnl ========================================================
7277 dnl = Location of malloc wrapper lib
7278 dnl ========================================================
7279 MOZ_ARG_WITH_STRING(wrap-malloc,
7280 [ --with-wrap-malloc=DIR Location of malloc wrapper library],
7281 WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
7283 dnl ========================================================
7284 dnl = Use JS Call tracing
7285 dnl ========================================================
7286 MOZ_ARG_ENABLE_BOOL(trace-jscalls,
7287 [ --enable-trace-jscalls Enable JS call enter/exit callback (default=no)],
7288 MOZ_TRACE_JSCALLS=1,
7289 MOZ_TRACE_JSCALLS= )
7290 if test -n "$MOZ_TRACE_JSCALLS"; then
7291 AC_DEFINE(MOZ_TRACE_JSCALLS)
7294 dnl ========================================================
7295 dnl = Use incremental GC
7296 dnl ========================================================
7298 MOZ_ARG_DISABLE_BOOL(gcincremental,
7299 [ --disable-gcincremental Disable incremental GC],
7301 if test -n "$JSGC_INCREMENTAL"; then
7302 AC_DEFINE(JSGC_INCREMENTAL)
7305 dnl ========================================================
7306 dnl ETW - Event Tracing for Windows
7307 dnl ========================================================
7308 MOZ_ARG_ENABLE_BOOL(ETW,
7309 [ --enable-ETW Enable ETW (Event Tracing for Windows) event reporting
7310 (needs Windows Vista+ SDK)],
7313 if test -n "$MOZ_ETW"; then
7317 if test -n "$MOZ_ETW"; then
7318 if test -z "$MOZ_WINSDK_TARGETVER"; then
7319 AC_MSG_ERROR([--enable-ETW is only valid on Windows])
7320 elif test "$MOZ_WINSDK_TARGETVER" -lt "06000000"; then
7321 AC_MSG_ERROR([--enable-ETW requires the Windows Vista SDK or newer])
7325 dnl ========================================================
7326 dnl Zealous JavaScript GC
7327 dnl ========================================================
7328 MOZ_ARG_ENABLE_BOOL(gczeal,
7329 [ --enable-gczeal Enable zealous JavaScript GCing],
7332 if test -n "$JS_GC_ZEAL"; then
7333 AC_DEFINE(JS_GC_ZEAL)
7336 dnl ========================================================
7337 dnl JS opt-mode assertions and minidump instrumentation
7338 dnl ========================================================
7339 MOZ_ARG_ENABLE_BOOL(js-diagnostics,
7340 [ --enable-js-diagnostics
7341 Enable JS diagnostic assertions and breakpad data],
7342 JS_CRASH_DIAGNOSTICS=1,
7343 JS_CRASH_DIAGNOSTICS= )
7344 if test -n "$JS_CRASH_DIAGNOSTICS"; then
7345 AC_DEFINE(JS_CRASH_DIAGNOSTICS)
7348 dnl ======================================================
7349 dnl = Enable compiling with ccache
7350 dnl ======================================================
7351 MOZ_ARG_WITH_STRING(ccache,
7352 [ --with-ccache[=path/to/ccache]
7353 Enable compiling with ccache],
7354 CCACHE=$withval, CCACHE="no")
7356 if test "$CCACHE" != "no"; then
7357 if test -z "$CCACHE" -o "$CCACHE" = "yes"; then
7360 if test ! -e "$CCACHE"; then
7361 AC_MSG_ERROR([$CCACHE not found])
7364 MOZ_PATH_PROGS(CCACHE, $CCACHE ccache)
7365 if test -z "$CCACHE" -o "$CCACHE" = ":"; then
7366 AC_MSG_ERROR([ccache not found])
7367 elif test -x "$CCACHE"; then
7371 AC_MSG_ERROR([$CCACHE is not executable])
7375 dnl ========================================================
7376 dnl = Enable static checking using gcc-dehydra
7377 dnl ========================================================
7379 MOZ_ARG_WITH_STRING(static-checking,
7380 [ --with-static-checking=path/to/gcc_dehydra.so
7381 Enable static checking of code using GCC-dehydra],
7382 DEHYDRA_PATH=$withval,
7385 if test -n "$DEHYDRA_PATH"; then
7386 if test ! -f "$DEHYDRA_PATH"; then
7387 AC_MSG_ERROR([The dehydra plugin is not at the specified path.])
7389 AC_DEFINE(NS_STATIC_CHECKING)
7391 AC_SUBST(DEHYDRA_PATH)
7393 dnl ========================================================
7394 dnl = Enable stripping of libs & executables
7395 dnl ========================================================
7396 MOZ_ARG_ENABLE_BOOL(strip,
7397 [ --enable-strip Enable stripping of libs & executables ],
7401 dnl ========================================================
7402 dnl = Enable stripping of libs & executables when packaging
7403 dnl ========================================================
7404 MOZ_ARG_ENABLE_BOOL(install-strip,
7405 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
7409 dnl ========================================================
7410 dnl = --enable-elf-dynstr-gc
7411 dnl ========================================================
7412 MOZ_ARG_ENABLE_BOOL(elf-dynstr-gc,
7413 [ --enable-elf-dynstr-gc Enable elf dynstr garbage collector (opt builds only)],
7414 USE_ELF_DYNSTR_GC=1,
7415 USE_ELF_DYNSTR_GC= )
7417 dnl ========================================================
7418 dnl = --disable-elf-hack
7419 dnl ========================================================
7422 MOZ_ARG_DISABLE_BOOL(elf-hack,
7423 [ --disable-elf-hack Disable elf hacks],
7427 # Only enable elfhack where supported
7428 if test "$USE_ELF_HACK" = 1; then
7429 case "${HOST_OS_ARCH},${OS_ARCH}" in
7431 case "${CPU_ARCH}" in
7446 if test "$USE_ELF_HACK" = 1; then
7447 dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
7448 dnl memory addresses it maps to. The result is that by the time elfhack
7449 dnl kicks in, it is not possible to apply relocations because of that,
7450 dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
7451 dnl segment. It makes elfhack mostly useless, so considering the problems
7452 dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
7453 dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
7454 dnl the linker creates PT_GNU_RELRO segments.
7455 AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
7456 LINK_WITH_PT_GNU_RELRO,
7457 [echo "int main() {return 0;}" > conftest.${ac_ext}
7458 if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
7459 test -s conftest${ac_exeext}; then
7460 if readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
7461 LINK_WITH_PT_GNU_RELRO=yes
7463 LINK_WITH_PT_GNU_RELRO=no
7466 dnl We really don't expect to get here, but just in case
7467 AC_ERROR([couldn't compile a simple C file])
7470 if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
7471 AC_MSG_WARN([Disabling elfhack])
7476 dnl ========================================================
7477 dnl = libstdc++ compatibility hacks
7478 dnl ========================================================
7481 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7482 [ --enable-stdcxx-compat Enable compatibility with older libstdc++],
7483 STDCXX_COMPAT=stdc++compat.cpp)
7485 AC_SUBST(STDCXX_COMPAT)
7487 if test -n "$STDCXX_COMPAT"; then
7488 eval $(CXX="$CXX" MACOS_SDK_DIR="$MACOS_SDK_DIR" $PYTHON $_topsrcdir/build/autoconf/libstdcxx.py)
7489 AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7490 AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7493 dnl ========================================================
7495 dnl = Profiling and Instrumenting
7497 dnl ========================================================
7498 MOZ_ARG_HEADER(Profiling and Instrumenting)
7500 dnl ========================================================
7501 dnl = Enable NS_FUNCTION_TIMER, which provides Function
7502 dnl = timing for identifying code bottlenecks
7503 dnl = NS_FUNCTION_TIMER is off by default.
7504 dnl ========================================================
7505 MOZ_ARG_ENABLE_BOOL(functiontimer,
7506 [ --enable-functiontimer Enable NS_FUNCTION_TIMER ],
7507 NS_FUNCTION_TIMER=1,
7508 NS_FUNCTION_TIMER= )
7509 if test -n "$NS_FUNCTION_TIMER"; then
7510 AC_DEFINE(NS_FUNCTION_TIMER)
7513 dnl ========================================================
7514 dnl Turn on reflow counting
7515 dnl ========================================================
7516 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7517 [ --enable-reflow-perf Enable reflow performance tracing],
7520 if test -n "$MOZ_REFLOW_PERF"; then
7521 AC_DEFINE(MOZ_REFLOW_PERF)
7524 dnl ========================================================
7525 dnl Enable code size metrics.
7526 dnl ========================================================
7527 MOZ_ARG_ENABLE_BOOL(codesighs,
7528 [ --enable-codesighs Enable code size analysis tools],
7529 _ENABLE_CODESIGHS=1,
7530 _ENABLE_CODESIGHS= )
7531 if test -n "$_ENABLE_CODESIGHS"; then
7532 if test -d $srcdir/tools/codesighs; then
7535 AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
7539 dnl ========================================================
7540 dnl = Support for Quantify (Windows)
7541 dnl ========================================================
7542 MOZ_ARG_ENABLE_BOOL(quantify,
7543 [ --enable-quantify Enable Quantify support (Windows only) ],
7547 dnl ========================================================
7548 dnl = Enable Radio Interface for B2G (Gonk usually)
7549 dnl ========================================================
7550 MOZ_ARG_ENABLE_BOOL(b2g-ril,
7551 [ --enable-b2g-ril Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
7554 if test -n "$MOZ_B2G_RIL"; then
7555 AC_DEFINE(MOZ_B2G_RIL)
7557 AC_SUBST(MOZ_B2G_RIL)
7559 dnl ========================================================
7560 dnl = Support for demangling undefined symbols
7561 dnl ========================================================
7562 if test -z "$SKIP_LIBRARY_CHECKS"; then
7565 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7569 # Demangle only for debug or trace-malloc builds
7570 MOZ_DEMANGLE_SYMBOLS=
7571 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
7572 MOZ_DEMANGLE_SYMBOLS=1
7573 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7575 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7577 dnl ========================================================
7578 dnl = Support for gcc stack unwinding (from gcc 3.3)
7579 dnl ========================================================
7580 if test -z "$SKIP_LIBRARY_CHECKS"; then
7581 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7584 dnl ========================================================
7586 dnl ========================================================
7588 MOZ_ARG_WITH_STRING(jitreport-granularity,
7589 [ --jitreport-granularity=N
7590 Default granularity at which to report JIT code
7593 1 - code ranges for whole functions only
7594 2 - per-line information
7595 3 - per-op information],
7596 JITREPORT_GRANULARITY=$withval,
7597 JITREPORT_GRANULARITY=3)
7599 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
7601 dnl ========================================================
7605 dnl ========================================================
7606 MOZ_ARG_HEADER(Misc. Options)
7608 dnl ========================================================
7609 dnl update xterm title
7610 dnl ========================================================
7611 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7612 [ --enable-xterm-updates Update XTERM titles with current command.],
7616 dnl =========================================================
7618 dnl =========================================================
7619 MOZ_ARG_ENABLE_STRING([chrome-format],
7620 [ --enable-chrome-format=jar|flat|both|symlink|omni
7621 Select FORMAT of chrome files (default=jar)],
7622 MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7624 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7625 MOZ_CHROME_FILE_FORMAT=jar
7628 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7629 test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7630 test "$MOZ_CHROME_FILE_FORMAT" != "symlink" &&
7631 test "$MOZ_CHROME_FILE_FORMAT" != "both" &&
7632 test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7633 AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, both, symlink, or omni])
7636 dnl =========================================================
7637 dnl Omnijar packaging (bug 552121)
7638 dnl =========================================================
7639 dnl Omnijar packaging is compatible with flat packaging.
7640 dnl In unpackaged builds, omnijar looks for files as if
7641 dnl things were flat packaged. After packaging, all files
7642 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7643 dnl is set to flat since putting files into jars is only
7644 dnl done during packaging with omnijar.
7645 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7647 AC_DEFINE(MOZ_OMNIJAR)
7648 if test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2" -o "$OS_TARGET" = "Android"; then
7649 MOZ_CHROME_FILE_FORMAT=flat
7651 MOZ_CHROME_FILE_FORMAT=symlink
7653 elif test "$MOZ_CHROME_FILE_FORMAT" = "jar"; then
7654 AC_DEFINE(MOZ_CHROME_FILE_FORMAT_JAR)
7657 OMNIJAR_NAME=omni.ja
7658 AC_SUBST(OMNIJAR_NAME)
7659 AC_SUBST(MOZ_OMNIJAR)
7661 dnl ========================================================
7662 dnl = Define default location for MOZILLA_FIVE_HOME
7663 dnl ========================================================
7664 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7665 [ --with-default-mozilla-five-home
7666 Set the default value for MOZILLA_FIVE_HOME],
7667 [ val=`echo $withval`
7668 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7670 dnl ========================================================
7671 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7672 dnl ========================================================
7673 MOZ_ARG_WITH_STRING(user-appdir,
7674 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
7675 [ val=`echo $withval`
7676 if echo "$val" | grep "\/" >/dev/null; then
7677 AC_MSG_ERROR("Homedir must be single relative path.")
7682 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7684 dnl ========================================================
7685 dnl = Doxygen configuration
7686 dnl ========================================================
7687 dnl Use commas to specify multiple dirs to this arg
7688 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7689 MOZ_ARG_WITH_STRING(doc-input-dirs,
7690 [ --with-doc-input-dirs=DIRS
7691 Header/idl dirs to create docs from],
7692 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7693 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7695 dnl Use commas to specify multiple dirs to this arg
7696 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7697 MOZ_ARG_WITH_STRING(doc-include-dirs,
7698 [ --with-doc-include-dirs=DIRS
7699 Include dirs to preprocess doc headers],
7700 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7701 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7703 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7704 MOZ_ARG_WITH_STRING(doc-output-dir,
7705 [ --with-doc-output-dir=DIR
7706 Dir to generate docs into],
7707 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7708 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7710 if test -z "$SKIP_COMPILER_CHECKS"; then
7711 dnl ========================================================
7713 dnl = Compiler Options
7715 dnl ========================================================
7716 MOZ_ARG_HEADER(Compiler Options)
7718 dnl ========================================================
7719 dnl Check for gcc -pipe support
7720 dnl ========================================================
7721 AC_MSG_CHECKING([for -pipe support])
7722 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
7723 dnl Any gcc that supports firefox supports -pipe.
7724 CFLAGS="$CFLAGS -pipe"
7725 CXXFLAGS="$CXXFLAGS -pipe"
7726 AC_MSG_RESULT([yes])
7731 dnl ========================================================
7732 dnl Profile guided optimization (gcc checks)
7733 dnl ========================================================
7734 dnl Test for profiling options
7735 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7737 _SAVE_CFLAGS="$CFLAGS"
7738 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7740 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7741 AC_TRY_COMPILE([], [return 0;],
7742 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7743 result="yes" ], result="no")
7744 AC_MSG_RESULT([$result])
7746 if test $result = "yes"; then
7747 PROFILE_GEN_LDFLAGS="-fprofile-generate"
7748 PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
7749 PROFILE_USE_LDFLAGS="-fprofile-use"
7752 CFLAGS="$_SAVE_CFLAGS"
7754 if test -n "$INTEL_CC"; then
7755 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7756 PROFILE_GEN_LDFLAGS=
7757 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7758 PROFILE_USE_LDFLAGS=
7761 dnl Sun Studio on Solaris
7762 if test "$SOLARIS_SUNPRO_CC"; then
7763 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7764 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7765 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7766 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7769 AC_SUBST(PROFILE_GEN_CFLAGS)
7770 AC_SUBST(PROFILE_GEN_LDFLAGS)
7771 AC_SUBST(PROFILE_USE_CFLAGS)
7772 AC_SUBST(PROFILE_USE_LDFLAGS)
7776 dnl ========================================================
7777 dnl Test for -pedantic bustage
7778 dnl ========================================================
7779 MOZ_ARG_DISABLE_BOOL(pedantic,
7780 [ --disable-pedantic Issue all warnings demanded by strict ANSI C ],
7782 if test "$_PEDANTIC"; then
7783 _SAVE_CXXFLAGS=$CXXFLAGS
7784 CXXFLAGS="$CXXFLAGS -pedantic ${_WARNINGS_CXXFLAGS} -Wno-long-long"
7785 AC_MSG_CHECKING([whether C++ compiler has -pedantic long long bug])
7786 AC_TRY_COMPILE([$configure_static_assert_macros],
7787 [CONFIGURE_STATIC_ASSERT(sizeof(long long) == 8)],
7788 result="no", result="yes" )
7789 AC_MSG_RESULT([$result])
7790 CXXFLAGS="$_SAVE_CXXFLAGS"
7794 _WARNINGS_CFLAGS="-pedantic ${_WARNINGS_CFLAGS} -Wno-long-long"
7795 _WARNINGS_CXXFLAGS="-pedantic ${_WARNINGS_CXXFLAGS} -Wno-long-long"
7798 AC_MSG_ERROR([Your compiler appears to have a known bug where long long is miscompiled when using -pedantic. Reconfigure using --disable-pedantic. ])
7803 dnl ========================================================
7804 dnl Autoconf test for gcc 2.7.2.x (and maybe others?) so that we don't
7805 dnl provide non-const forms of the operator== for comparing nsCOMPtrs to
7806 dnl raw pointers in nsCOMPtr.h. (VC++ has the same bug.)
7807 dnl ========================================================
7808 _SAVE_CXXFLAGS=$CXXFLAGS
7809 CXXFLAGS="$CXXFLAGS ${_WARNINGS_CXXFLAGS}"
7810 AC_CACHE_CHECK(for correct overload resolution with const and templates,
7811 ac_nscap_nonconst_opeq_bug,
7820 template <class T, class U>
7821 int operator==(const Pointer<T>& rhs, U* lhs)
7823 return rhs.myPtr == lhs;
7826 template <class T, class U>
7827 int operator==(const Pointer<T>& rhs, const U* lhs)
7829 return rhs.myPtr == lhs;
7837 ac_nscap_nonconst_opeq_bug="no",
7838 ac_nscap_nonconst_opeq_bug="yes")])
7839 CXXFLAGS="$_SAVE_CXXFLAGS"
7841 if test "$ac_nscap_nonconst_opeq_bug" = "yes" ; then
7842 AC_DEFINE(NSCAP_DONT_PROVIDE_NONCONST_OPEQ)
7844 fi # ! SKIP_COMPILER_CHECKS
7846 AC_DEFINE(CPP_THROW_NEW, [throw()])
7849 dnl ========================================================
7851 dnl = Check what kind of list files are supported by the
7854 dnl ========================================================
7856 AC_CACHE_CHECK(what kind of list files are supported by the linker,
7857 EXPAND_LIBS_LIST_STYLE,
7858 [echo "int main() {return 0;}" > conftest.${ac_ext}
7859 if AC_TRY_COMMAND(${CC-cc} -o conftest.${OBJ_SUFFIX} -c $CFLAGS $CPPFLAGS conftest.${ac_ext} 1>&2) && test -s conftest.${OBJ_SUFFIX}; then
7860 echo "INPUT(conftest.${OBJ_SUFFIX})" > conftest.list
7861 if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.list $LIBS 1>&2) && test -s conftest${ac_exeext}; then
7862 EXPAND_LIBS_LIST_STYLE=linkerscript
7864 echo "conftest.${OBJ_SUFFIX}" > conftest.list
7865 if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS @conftest.list $LIBS 1>&2) && test -s conftest${ac_exeext}; then
7866 EXPAND_LIBS_LIST_STYLE=list
7868 EXPAND_LIBS_LIST_STYLE=none
7872 dnl We really don't expect to get here, but just in case
7873 AC_ERROR([couldn't compile a simple C file])
7877 LIBS_DESC_SUFFIX=desc
7878 AC_SUBST(LIBS_DESC_SUFFIX)
7879 AC_SUBST(EXPAND_LIBS_LIST_STYLE)
7881 dnl ========================================================
7883 dnl = Build depencency options
7885 dnl ========================================================
7886 MOZ_ARG_HEADER(Build dependencies)
7888 dnl ========================================================
7889 dnl = Do not auto generate dependency info
7890 dnl ========================================================
7892 MOZ_ARG_DISABLE_BOOL(auto-deps,
7893 [ --disable-auto-deps Do not automatically generate dependency info],
7897 if test -n "$MOZ_AUTO_DEPS"; then
7898 dnl ========================================================
7899 dnl = Use mkdepend instead of $CC -MD for dependency generation
7900 dnl ========================================================
7902 MOZ_ARG_DISABLE_BOOL(md,
7903 [ --disable-md Do not use compiler-based dependencies ],
7906 [dnl Default is to turn on -MD if using GNU-compatible compilers
7907 if test "$GNU_CC" -a "$GNU_CXX"; then
7910 dnl Default is to use -xM if using Sun Studio on Solaris
7911 if test "$SOLARIS_SUNPRO_CC"; then
7914 if test "$_cpp_md_flag"; then
7916 _DEPEND_CFLAGS='$(filter-out %/.pp,-MD -MF $(MDDEPDIR)/$(basename $(@F)).pp)'
7917 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7918 if test "$SOLARIS_SUNPRO_CC"; then
7923 dnl Don't override this for MSVC
7924 if test -z "$_WIN32_MSVC"; then
7925 _USE_CPP_INCLUDE_FLAG=
7926 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7927 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7929 echo '#include <stdio.h>' > dummy-hello.c
7931 CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/^\([^:]*:[^:]*:\).*stdio.h$/\1/p'`
7933 if test -z "$CL_INCLUDES_PREFIX"; then
7934 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
7936 AC_SUBST(CL_INCLUDES_PREFIX)
7938 _topsrcdirwin=`cd \`dirname $0\`; pwd -W`
7939 dnl cl.py provides dependency generation for MSVC
7940 CC_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"
7941 CXX_WRAPPER="$PYTHON -O $_topsrcdirwin/build/cl.py"
7947 AC_SUBST(MOZ_AUTO_DEPS)
7948 AC_SUBST(COMPILER_DEPEND)
7950 AC_SUBST(CC_WRAPPER)
7951 AC_SUBST(CXX_WRAPPER)
7954 dnl ========================================================
7956 dnl = Static Build Options
7958 dnl ========================================================
7959 MOZ_ARG_HEADER(Static build options)
7961 # split JS out by default to avoid VS2005 PGO crash (bug 591836).
7962 if test "$OS_ARCH" = "WINNT" -a "$CPU_ARCH" != "x86_64" ; then
7966 MOZ_ARG_ENABLE_BOOL(shared-js,
7967 [ --enable-shared-js
7968 Create a shared JavaScript library.],
7972 if test -n "$ENABLE_SHARED_JS"; then
7974 MOZ_JS_LIBS="$MOZ_JS_SHARED_LIBS"
7976 MOZ_JS_LIBS="$MOZ_JS_STATIC_LIBS"
7977 AC_DEFINE(MOZ_STATIC_JS)
7979 AC_SUBST(JS_SHARED_LIBRARY)
7981 AC_SUBST(LIBXUL_LIBS)
7982 XPCOM_LIBS="$LIBXUL_LIBS"
7984 dnl ========================================================
7986 dnl = Standalone module options
7988 dnl ========================================================
7989 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7992 dnl ========================================================
7994 if test -z "$SKIP_PATH_CHECKS"; then
7995 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
7996 if test "$MOZ_ENABLE_GTK2" -o "$USE_ELF_DYNSTR_GC" ; then
7997 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7999 AM_PATH_GLIB(${GLIB_VERSION})
8004 if test -z "${GLIB_GMODULE_LIBS}" \
8005 -a -n "${GLIB_CONFIG}"\
8006 -a "${GLIB_CONFIG}" != no\
8008 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
8011 AC_SUBST(GLIB_CFLAGS)
8013 AC_SUBST(GLIB_GMODULE_LIBS)
8015 dnl ========================================================
8016 dnl Graphics checks.
8017 dnl ========================================================
8019 if test "${OS_ARCH}" = "Darwin" -o "${MOZ_WIDGET_TOOLKIT}" = "android"; then
8025 MOZ_ARG_ENABLE_BOOL(skia,
8026 [ --enable-skia Enable use of Skia],
8030 dnl ========================================================
8032 dnl ========================================================
8033 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
8036 MOZ_ARG_ENABLE_BOOL(system-cairo,
8037 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
8042 MOZ_ARG_ENABLE_BOOL(system-pixman,
8043 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
8047 # Check for headers defining standard int types.
8048 MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
8050 if test "$MOZ_TREE_CAIRO"; then
8051 AC_DEFINE(MOZ_TREE_CAIRO)
8053 # For now we assume that we will have a uint64_t available through
8054 # one of the above headers or mozstdint.h.
8055 AC_DEFINE(HAVE_UINT64_T)
8057 # Define macros for cairo-features.h
8058 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
8059 if test "$MOZ_X11"; then
8060 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
8061 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
8062 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
8063 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8064 MOZ_ENABLE_CAIRO_FT=1
8065 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
8067 case "$MOZ_WIDGET_TOOLKIT" in
8069 QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
8072 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
8073 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
8074 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
8077 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
8078 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
8079 if test "$MOZ_WINSDK_TARGETVER" -ge "06010000"; then
8080 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
8081 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
8082 MOZ_ENABLE_D2D_SURFACE=1
8083 MOZ_ENABLE_DWRITE_FONT=1
8085 WIN32_DWRITE_FONT_FEATURE=
8086 WIN32_D2D_SURFACE_FEATURE=
8089 MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
8091 dnl D3D10 Layers depend on D2D Surfaces.
8092 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
8093 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
8097 OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
8098 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
8099 MOZ_ENABLE_CAIRO_FT=1
8100 CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
8101 CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
8104 if test "$USE_FC_FREETYPE"; then
8105 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
8107 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
8108 AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
8109 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
8110 AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
8111 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
8112 AC_SUBST(CAIRO_FT_CFLAGS)
8114 if test "$MOZ_DEBUG"; then
8115 SANITY_CHECKING_FEATURE="#define CAIRO_DO_SANITY_CHECKING 1"
8117 SANITY_CHECKING_FEATURE="#undef CAIRO_DO_SANITY_CHECKING"
8120 AC_SUBST(PS_SURFACE_FEATURE)
8121 AC_SUBST(PDF_SURFACE_FEATURE)
8122 AC_SUBST(SVG_SURFACE_FEATURE)
8123 AC_SUBST(XLIB_SURFACE_FEATURE)
8124 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
8125 AC_SUBST(QUARTZ_SURFACE_FEATURE)
8126 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
8127 AC_SUBST(XCB_SURFACE_FEATURE)
8128 AC_SUBST(WIN32_SURFACE_FEATURE)
8129 AC_SUBST(OS2_SURFACE_FEATURE)
8130 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
8131 AC_SUBST(FT_FONT_FEATURE)
8132 AC_SUBST(FC_FONT_FEATURE)
8133 AC_SUBST(WIN32_FONT_FEATURE)
8134 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
8135 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
8136 AC_SUBST(QUARTZ_FONT_FEATURE)
8137 AC_SUBST(PNG_FUNCTIONS_FEATURE)
8138 AC_SUBST(QT_SURFACE_FEATURE)
8139 AC_SUBST(TEE_SURFACE_FEATURE)
8141 MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"
8143 if test "$MOZ_TREE_PIXMAN"; then
8144 AC_DEFINE(MOZ_TREE_PIXMAN)
8145 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS"' $(call EXPAND_LIBNAME_PATH,mozlibpixman,$(DEPTH)/gfx/cairo/libpixman/src)'
8147 PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
8148 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $PIXMAN_CFLAGS"
8149 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $PIXMAN_LIBS"
8152 if test "$MOZ_X11"; then
8153 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
8156 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
8157 mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
8160 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION pixman-1 freetype2 fontconfig)
8161 MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
8162 MOZ_CAIRO_LIBS=$CAIRO_LIBS
8163 PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
8164 if test "$MOZ_X11"; then
8165 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
8166 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
8167 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
8171 AC_SUBST(MOZ_TREE_CAIRO)
8172 AC_SUBST(MOZ_CAIRO_CFLAGS)
8173 AC_SUBST(MOZ_CAIRO_LIBS)
8174 AC_SUBST(MOZ_TREE_PIXMAN)
8176 dnl ========================================================
8178 dnl ========================================================
8180 QCMS_LIBS='$(call EXPAND_LIBNAME_PATH,mozqcms,$(DEPTH)/gfx/qcms)'
8183 dnl ========================================================
8185 dnl ========================================================
8186 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
8187 AC_SUBST(MOZ_HARFBUZZ_LIBS)
8189 dnl ========================================================
8191 dnl ========================================================
8192 if test "$MOZ_GRAPHITE"; then
8193 MOZ_GRAPHITE_LIBS='$(DEPTH)/gfx/graphite2/src/$(LIB_PREFIX)mozgraphite2.$(LIB_SUFFIX)'
8194 AC_DEFINE(MOZ_GRAPHITE)
8198 AC_SUBST(MOZ_GRAPHITE)
8199 AC_SUBST(MOZ_GRAPHITE_LIBS)
8201 dnl ========================================================
8203 dnl ========================================================
8204 MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)'
8205 AC_SUBST(MOZ_OTS_LIBS)
8207 dnl ========================================================
8209 dnl ========================================================
8210 if test "$MOZ_ENABLE_SKIA"; then
8211 MOZ_SKIA_LIBS='$(DEPTH)/gfx/skia/$(LIB_PREFIX)skia.$(LIB_SUFFIX)'
8212 AC_DEFINE(MOZ_ENABLE_SKIA)
8216 AC_SUBST(MOZ_ENABLE_SKIA)
8217 AC_SUBST(MOZ_SKIA_LIBS)
8219 dnl ========================================================
8221 dnl ========================================================
8222 MOZ_ARG_DISABLE_BOOL(xul,
8223 [ --disable-xul Disable XUL],
8225 if test "$MOZ_XUL"; then
8228 dnl remove extensions that require XUL
8229 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/venkman//' -e 's/irc//' -e 's/tasks//'`
8234 dnl ========================================================
8235 dnl disable profile locking
8236 dnl do no use this in applications that can have more than
8237 dnl one process accessing the profile directory.
8238 dnl ========================================================
8239 MOZ_ARG_DISABLE_BOOL(profilelocking,
8240 [ --disable-profilelocking
8241 Disable profile locking],
8242 MOZ_PROFILELOCKING=,
8243 MOZ_PROFILELOCKING=1 )
8244 if test "$MOZ_PROFILELOCKING"; then
8245 AC_DEFINE(MOZ_PROFILELOCKING)
8248 dnl ========================================================
8249 dnl necko configuration options
8250 dnl ========================================================
8253 dnl option to disable various necko protocols
8255 MOZ_ARG_ENABLE_STRING(necko-protocols,
8256 [ --enable-necko-protocols[={http,ftp,default,all,none}]
8257 Enable/disable specific protocol handlers],
8258 [ for option in `echo $enableval | sed 's/,/ /g'`; do
8259 if test "$option" = "yes" -o "$option" = "all"; then
8260 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8261 elif test "$option" = "no" -o "$option" = "none"; then
8263 elif test "$option" = "default"; then
8264 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
8265 elif test `echo "$option" | grep -c \^-` != 0; then
8266 option=`echo $option | sed 's/^-//'`
8267 NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
8269 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
8272 NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
8274 NECKO_PROTOCOLS=`${PERL} ${srcdir}/build/unix/uniq.pl ${NECKO_PROTOCOLS}`
8275 AC_SUBST(NECKO_PROTOCOLS)
8276 for p in $NECKO_PROTOCOLS; do
8277 AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
8281 dnl option to disable necko's wifi scanner
8283 MOZ_ARG_DISABLE_BOOL(necko-wifi,
8284 [ --disable-necko-wifi Disable necko wifi scanner],
8288 if test "$OS_ARCH" = "OS2"; then
8289 dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
8292 if test "$NECKO_WIFI" -a \
8293 "$OS_ARCH" != "Linux" -a \
8294 "$OS_ARCH" != "Darwin" -a \
8295 "$OS_ARCH" != "SunOS" -a \
8296 "$OS_ARCH" != "WINNT"; then
8297 AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi])
8300 if test -z "$SKIP_LIBRARY_CHECKS" -a "$NECKO_WIFI" -a "$OS_ARCH" = "Linux"
8302 MOZ_CHECK_HEADER([iwlib.h])
8303 if test "$ac_cv_header_iwlib_h" != "yes"; then
8304 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) or libiw-devel (openSUSE)); use --disable-necko-wifi to disable])
8308 if test "$NECKO_WIFI"; then
8309 AC_DEFINE(NECKO_WIFI)
8311 AC_SUBST(NECKO_WIFI)
8314 dnl option to disable cookies
8316 MOZ_ARG_DISABLE_BOOL(cookies,
8317 [ --disable-cookies Disable cookie support],
8320 AC_SUBST(NECKO_COOKIES)
8321 if test "$NECKO_COOKIES"; then
8322 AC_DEFINE(NECKO_COOKIES)
8326 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
8328 MOZ_ARG_DISABLE_BOOL(ctypes,
8329 [ --disable-ctypes Disable js-ctypes],
8332 AC_SUBST(BUILD_CTYPES)
8333 if test "$BUILD_CTYPES"; then
8334 AC_DEFINE(BUILD_CTYPES)
8337 dnl NECKO_ configuration options are not global
8338 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_"
8340 dnl Build Places if required
8341 if test "$MOZ_PLACES"; then
8342 AC_DEFINE(MOZ_PLACES)
8345 dnl Build Sync Services if required
8346 AC_SUBST(MOZ_SERVICES_SYNC)
8347 if test -n "$MOZ_SERVICES_SYNC"; then
8348 AC_DEFINE(MOZ_SERVICES_SYNC)
8351 dnl ========================================================
8352 if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC"; then
8353 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8356 if test "$MOZ_APP_COMPONENT_INCLUDE"; then
8357 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_INCLUDE, "$MOZ_APP_COMPONENT_INCLUDE")
8360 if test "$MOZ_APP_COMPONENT_MODULES"; then
8361 AC_DEFINE_UNQUOTED(MOZ_APP_COMPONENT_MODULES, $MOZ_APP_COMPONENT_MODULES)
8364 dnl ========================================================
8366 dnl = Maintainer debug option (no --enable equivalent)
8368 dnl ========================================================
8373 AC_SUBST(AR_EXTRACT)
8377 AC_SUBST(AS_DASH_C_FLAG)
8386 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8387 AC_SUBST(MOZ_UPDATE_XTERM)
8388 AC_SUBST(MOZ_PLATFORM_MAEMO)
8389 AC_SUBST(MOZ_AUTH_EXTENSION)
8390 AC_SUBST(MOZ_PERMISSIONS)
8392 AC_SUBST(MOZ_PREF_EXTENSIONS)
8393 AC_SUBST(MOZ_JS_LIBS)
8396 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8397 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8398 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8399 AC_SUBST(MOZ_DEBUG_FLAGS)
8400 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8401 AC_SUBST(WARNINGS_AS_ERRORS)
8402 AC_SUBST(MOZ_EXTENSIONS)
8403 AC_SUBST(MOZ_JSDEBUGGER)
8404 AC_SUBST(MOZ_LOG_REFCNT)
8406 AC_SUBST(MOZ_ENABLE_PROFILER_SPS)
8409 AC_SUBST(MOZ_CALLGRIND)
8412 AC_SUBST(MOZ_PROFILING)
8413 AC_SUBST(MOZ_QUANTIFY)
8415 AC_SUBST(MOZ_PLACES)
8416 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8418 AC_SUBST(NS_PRINTING)
8420 AC_SUBST(MOZ_HELP_VIEWER)
8426 AC_SUBST(MOZ_PROFILELOCKING)
8428 AC_SUBST(ENABLE_TESTS)
8430 AC_SUBST(MOZ_UNIVERSALCHARDET)
8431 AC_SUBST(ACCESSIBILITY)
8432 AC_SUBST(MOZ_SPELLCHECK)
8433 AC_SUBST(MOZ_JAVA_COMPOSITOR)
8434 AC_SUBST(MOZ_USER_DIR)
8435 AC_SUBST(MOZ_CRASHREPORTER)
8436 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
8437 AC_SUBST(MOZ_UPDATER)
8439 AC_SUBST(MOZ_DIRECTX_SDK_PATH)
8440 AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
8441 AC_SUBST(MOZ_D3DX9_VERSION)
8442 AC_SUBST(MOZ_D3DX9_CAB)
8443 AC_SUBST(MOZ_D3DCOMPILER_CAB)
8444 AC_SUBST(MOZ_D3DX9_DLL)
8445 AC_SUBST(MOZ_D3DCOMPILER_DLL)
8447 AC_SUBST(MOZ_ANDROID_HISTORY)
8448 AC_SUBST(ENABLE_STRIP)
8449 AC_SUBST(PKG_SKIP_STRIP)
8450 AC_SUBST(USE_ELF_DYNSTR_GC)
8451 AC_SUBST(USE_ELF_HACK)
8452 AC_SUBST(INCREMENTAL_LINKER)
8453 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8454 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8456 AC_SUBST(MOZ_FIX_LINK_PATHS)
8457 AC_SUBST(XPCOM_LIBS)
8458 AC_SUBST(XPCOM_FROZEN_LDOPTS)
8459 AC_SUBST(XPCOM_GLUE_LDOPTS)
8460 AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
8462 AC_SUBST(USE_DEPENDENT_LIBS)
8464 AC_SUBST(MOZ_BUILD_ROOT)
8465 AC_SUBST(MOZ_OS2_TOOLS)
8467 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8468 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8470 dnl ========================================================
8471 dnl = Mac bundle name prefix
8472 dnl ========================================================
8473 MOZ_ARG_WITH_STRING(macbundlename-prefix,
8474 [ --with-macbundlename-prefix=prefix
8475 Prefix for MOZ_MACBUNDLE_NAME],
8476 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
8478 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
8479 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
8480 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
8483 if test "$MOZ_DEBUG"; then
8484 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
8486 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
8488 AC_SUBST(MOZ_MACBUNDLE_NAME)
8490 # The following variables are available to branding and application
8491 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8492 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8493 # impacts profile location and user-visible fields.
8494 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8495 # versions of a given application (e.g. Aurora and Firefox both use
8496 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8497 # for application.ini's "Name" field, which controls profile location in
8498 # the absence of a "Profile" field (see below), and various system
8499 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8500 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8501 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8502 # builds (e.g. Aurora for Firefox).
8503 # - MOZ_APP_VERSION: Defines the application version number.
8504 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8505 # defaults to a lowercase form of MOZ_APP_BASENAME.
8506 # - MOZ_APP_PROFILE: When set, used for application.ini's
8507 # "Profile" field, which controls profile location.
8508 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
8509 # crash reporter server url.
8510 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
8511 # - MOZ_EXTENSION_MANAGER: When set, enabled extension manager.
8513 if test -z "$MOZ_APP_NAME"; then
8514 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8517 AC_SUBST(MOZ_APP_NAME)
8518 AC_SUBST(MOZ_APP_DISPLAYNAME)
8519 AC_SUBST(MOZ_APP_BASENAME)
8520 AC_SUBST(MOZ_APP_VENDOR)
8521 AC_SUBST(MOZ_APP_PROFILE)
8522 AC_SUBST(MOZ_APP_ID)
8523 AC_SUBST(MOZ_PROFILE_MIGRATOR)
8524 AC_SUBST(MOZ_EXTENSION_MANAGER)
8525 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8526 AC_SUBST(MOZ_APP_UA_NAME)
8527 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8528 AC_SUBST(MOZ_APP_VERSION)
8529 AC_DEFINE_UNQUOTED(MOZ_UA_FIREFOX_VERSION, "$FIREFOX_VERSION")
8530 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
8531 AC_SUBST(FIREFOX_VERSION)
8532 AC_DEFINE_UNQUOTED(MOZ_UA_BUILDID, "$MOZ_UA_BUILDID")
8533 AC_SUBST(MOZ_UA_BUILDID)
8535 # We can't use the static application.ini data when building against
8537 if test -n "$LIBXUL_SDK"; then
8540 AC_SUBST(MOZ_APP_STATIC_INI)
8542 AC_SUBST(MOZ_PKG_SPECIAL)
8544 AC_SUBST(MOZILLA_OFFICIAL)
8546 if test "$MOZ_TELEMETRY_REPORTING"; then
8547 AC_DEFINE(MOZ_TELEMETRY_REPORTING)
8551 AC_SUBST(MOZ_MAPINFO)
8552 AC_SUBST(MOZ_BROWSE_INFO)
8553 AC_SUBST(MOZ_TOOLS_DIR)
8554 AC_SUBST(WIN32_REDIST_DIR)
8558 dnl Echo the CFLAGS to remove extra whitespace.
8565 $_WARNINGS_CXXFLAGS \
8568 COMPILE_CFLAGS=`echo \
8573 COMPILE_CXXFLAGS=`echo \
8574 $_DEFINES_CXXFLAGS \
8578 AC_SUBST(SYSTEM_MAKEDEPEND)
8579 AC_SUBST(SYSTEM_LIBXUL)
8580 AC_SUBST(SYSTEM_JPEG)
8581 AC_SUBST(SYSTEM_PNG)
8582 AC_SUBST(SYSTEM_ZLIB)
8583 AC_SUBST(SYSTEM_BZ2)
8585 AC_SUBST(JPEG_CFLAGS)
8587 AC_SUBST(ZLIB_CFLAGS)
8589 AC_SUBST(BZ2_CFLAGS)
8591 AC_SUBST(PNG_CFLAGS)
8594 AC_SUBST(MOZ_JPEG_CFLAGS)
8595 AC_SUBST(MOZ_JPEG_LIBS)
8596 AC_SUBST(MOZ_ZLIB_CFLAGS)
8597 AC_SUBST(MOZ_ZLIB_LIBS)
8598 AC_SUBST(MOZ_BZ2_CFLAGS)
8599 AC_SUBST(MOZ_BZ2_LIBS)
8600 AC_SUBST(MOZ_PNG_CFLAGS)
8601 AC_SUBST(MOZ_PNG_LIBS)
8603 AC_SUBST(NSPR_CFLAGS)
8605 AC_SUBST(MOZ_NATIVE_NSPR)
8607 AC_SUBST(NSS_CFLAGS)
8609 AC_SUBST(NSS_DEP_LIBS)
8610 AC_SUBST(MOZ_NATIVE_NSS)
8611 AC_SUBST(NSS_DISABLE_DBM)
8616 AC_SUBST(COMPILE_CFLAGS)
8617 AC_SUBST(COMPILE_CXXFLAGS)
8620 AC_SUBST(CROSS_COMPILE)
8621 AC_SUBST(WCHAR_CFLAGS)
8625 AC_SUBST(HOST_CFLAGS)
8626 AC_SUBST(HOST_CXXFLAGS)
8627 AC_SUBST(HOST_LDFLAGS)
8628 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8630 AC_SUBST(HOST_AR_FLAGS)
8632 AC_SUBST(HOST_RANLIB)
8633 AC_SUBST(HOST_NSPR_MDCPUCFG)
8634 AC_SUBST(HOST_BIN_SUFFIX)
8635 AC_SUBST(HOST_OS_ARCH)
8637 AC_SUBST(TARGET_CPU)
8638 AC_SUBST(TARGET_VENDOR)
8640 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8641 AC_SUBST(TARGET_MD_ARCH)
8642 AC_SUBST(TARGET_XPCOM_ABI)
8645 AC_SUBST(OS_RELEASE)
8648 AC_SUBST(INTEL_ARCHITECTURE)
8650 AC_SUBST(MOZ_DISABLE_JAR_PACKAGING)
8651 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8653 AC_SUBST(WRAP_LDFLAGS)
8656 AC_SUBST(MKSHLIB_FORCE_ALL)
8657 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8658 AC_SUBST(DSO_CFLAGS)
8659 AC_SUBST(DSO_PIC_CFLAGS)
8660 AC_SUBST(DSO_LDOPTS)
8661 AC_SUBST(LIB_PREFIX)
8662 AC_SUBST(DLL_PREFIX)
8663 AC_SUBST(DLL_SUFFIX)
8664 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8665 AC_SUBST(LIB_SUFFIX)
8666 AC_SUBST(OBJ_SUFFIX)
8667 AC_SUBST(BIN_SUFFIX)
8668 AC_SUBST(ASM_SUFFIX)
8669 AC_SUBST(IMPORT_LIB_SUFFIX)
8671 AC_SUBST(CC_VERSION)
8672 AC_SUBST(CXX_VERSION)
8673 AC_SUBST(MSMANIFEST_TOOL)
8674 AC_SUBST(NS_ENABLE_TSF)
8675 AC_SUBST(MOZ_NSS_PATCH)
8676 AC_SUBST(MOZ_APP_COMPONENT_LIBS)
8677 AC_SUBST(MOZ_APP_EXTRA_LIBS)
8680 AC_SUBST(MOZ_SYDNEYAUDIO)
8682 AC_SUBST(MOZ_VORBIS)
8683 AC_SUBST(MOZ_TREMOR)
8685 AC_SUBST(MOZ_VP8_ERROR_CONCEALMENT)
8686 AC_SUBST(MOZ_VP8_ENCODER)
8688 AC_SUBST(MOZ_ALSA_LIBS)
8690 AC_SUBST(VPX_ASFLAGS)
8691 AC_SUBST(VPX_DASH_C_FLAG)
8692 AC_SUBST(VPX_AS_CONVERSION)
8693 AC_SUBST(VPX_ASM_SUFFIX)
8694 AC_SUBST(VPX_X86_ASM)
8695 AC_SUBST(VPX_ARM_ASM)
8696 AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
8697 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
8698 AC_SUBST(LIBJPEG_TURBO_AS)
8699 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
8700 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
8701 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
8703 AC_MSG_CHECKING([for posix_fallocate])
8704 AC_TRY_LINK([#define _XOPEN_SOURCE 600
8705 #include <fcntl.h>],
8706 [posix_fallocate(0, 0, 0);],
8707 [ac_cv___posix_fallocate=true],
8708 [ac_cv___posix_fallocate=false])
8710 if test "$ac_cv___posix_fallocate" = true ; then
8711 AC_DEFINE(HAVE_POSIX_FALLOCATE)
8717 dnl Check for missing components
8718 if test "$COMPILE_ENVIRONMENT"; then
8719 if test "$MOZ_X11"; then
8720 dnl ====================================================
8721 dnl = Check if X headers exist
8722 dnl ====================================================
8723 _SAVE_CFLAGS=$CFLAGS
8724 CFLAGS="$CFLAGS $XCFLAGS"
8728 #include <X11/Xlib.h>
8729 #include <X11/Intrinsic.h>
8730 #include <X11/extensions/XShm.h>
8734 if ((dpy = XOpenDisplay(NULL)) == NULL) {
8735 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8739 [ AC_MSG_ERROR([Could not compile basic X program.]) ])
8740 CFLAGS="$_SAVE_CFLAGS"
8742 if test -n "$MISSING_X"; then
8743 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8748 dnl Check for headers, etc. needed by WebGL.
8749 if test -n "$MOZ_WEBGL_GLX"; then
8750 MOZ_CHECK_HEADER(GL/glx.h)
8751 if test "$ac_cv_header_GL_glx_h" != "yes"; then
8752 AC_MSG_ERROR([Can't find header GL/glx.h for WebGL (install mesa-common-dev (Ubuntu), mesa-libGL-devel (Fedora), or Mesa-devel (openSUSE))])
8755 fi # COMPILE_ENVIRONMENT
8757 if test "$USE_FC_FREETYPE"; then
8758 if test "$COMPILE_ENVIRONMENT"; then
8759 _SAVE_CPPFLAGS="$CPPFLAGS"
8760 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
8761 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
8762 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
8763 CPPFLAGS="$_SAVE_CPPFLAGS"
8765 AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
8769 dnl Set various defines and substitutions
8770 dnl ========================================================
8772 if test "$OS_ARCH" = "Darwin"; then
8774 AC_DEFINE(UNIX_ASYNC_DNS)
8775 elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2"; then
8777 AC_DEFINE(UNIX_ASYNC_DNS)
8780 if test "$MOZ_DEBUG"; then
8781 AC_DEFINE(MOZ_REFLOW_PERF)
8782 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8785 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
8786 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8787 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8788 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8789 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8790 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8791 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8792 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8793 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8798 WIN_TOP_SRC=`cd $srcdir; pwd -W`
8802 AC_SUBST(WIN_TOP_SRC)
8804 AC_SUBST(MOZILLA_VERSION)
8806 AC_SUBST(ac_configure_args)
8808 dnl Spit out some output
8809 dnl ========================================================
8811 dnl The following defines are used by xpcom
8812 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8814 HAVE_CPP_2BYTE_WCHAR_T
8815 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8817 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8818 HAVE_CPP_PARTIAL_SPECIALIZATION
8819 HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
8821 NEED_CPP_UNUSED_IMPLEMENTATIONS
8825 HAVE_ICONV_WITH_CONST_INPUT
8833 netwerk/necko-config.h
8834 xpcom/xpcom-config.h
8835 xpcom/xpcom-private.h
8838 # Hack around an Apple bug that effects the egrep that comes with OS X 10.7.
8839 # "arch -arch i386 egrep" always uses the 32-bit Intel part of the egrep fat
8840 # binary, even on 64-bit systems. It should work on OS X 10.4.5 and up. We
8841 # (apparently) only need this hack when egrep's "pattern" is particularly
8842 # long (as in the following code). See bug 655339.
8845 FIXED_EGREP="arch -arch i386 egrep"
8852 # Save the defines header file before autoconf removes it.
8853 # (Do not add AC_DEFINE calls after this line.)
8854 _CONFIG_TMP=confdefs-tmp.h
8855 _CONFIG_DEFS_H=mozilla-config.h
8857 cat > $_CONFIG_TMP <<\EOF
8858 /* List of defines generated by configure. Included with preprocessor flag,
8859 * -include, to avoid long list of -D defines on the compile command-line.
8863 #ifndef _MOZILLA_CONFIG_H_
8864 #define _MOZILLA_CONFIG_H_
8867 _EGREP_PATTERN='^#define ('
8868 if test -n "$_NON_GLOBAL_ACDEFINES"; then
8869 for f in $_NON_GLOBAL_ACDEFINES; do
8870 _EGREP_PATTERN="${_EGREP_PATTERN}$f|"
8873 _EGREP_PATTERN="${_EGREP_PATTERN}dummy_never_defined)"
8875 sort confdefs.h | $FIXED_EGREP -v "$_EGREP_PATTERN" >> $_CONFIG_TMP
8877 if test "$?" != 0; then
8878 AC_MSG_ERROR([Error outputting config definitions])
8881 cat >> $_CONFIG_TMP <<\EOF
8883 /* The c99 defining the limit macros (UINT32_MAX for example), says:
8884 * C++ implementations should define these macros only when __STDC_LIMIT_MACROS
8885 * is defined before <stdint.h> is included. */
8886 #define __STDC_LIMIT_MACROS
8888 /* Force-include hunspell_alloc_hooks.h for hunspell, so that we don't need to
8889 * modify it directly.
8891 * HUNSPELL_STATIC is defined in extensions/spellcheck/hunspell/src/Makefile.in,
8892 * unless --enable-system-hunspell is defined.
8894 #if defined(HUNSPELL_STATIC)
8895 #include "hunspell_alloc_hooks.h"
8898 #endif /* _MOZILLA_CONFIG_H_ */
8902 # Only write mozilla-config.h when something changes (or it doesn't exist)
8903 if cmp -s $_CONFIG_TMP $_CONFIG_DEFS_H; then
8906 AC_MSG_RESULT("creating $_CONFIG_DEFS_H")
8907 mv -f $_CONFIG_TMP $_CONFIG_DEFS_H
8909 echo ==== $_CONFIG_DEFS_H =================================
8913 dnl Probably shouldn't call this manually but we always want the output of DEFS
8914 rm -f confdefs.h.save
8915 mv confdefs.h confdefs.h.save
8916 $FIXED_EGREP -v "$_EGREP_PATTERN" confdefs.h.save > confdefs.h
8917 if test "$?" != 0; then
8918 AC_MSG_ERROR([Error outputting confdefs.h])
8920 AC_OUTPUT_MAKE_DEFS()
8922 AC_SUBST(MOZ_DEFINES)
8924 mv confdefs.h.save confdefs.h
8926 dnl Load the list of Makefiles to generate.
8927 dnl To add new Makefiles, edit allmakefiles.sh.
8928 dnl allmakefiles.sh sets the variable, MAKEFILES.
8929 . ${srcdir}/allmakefiles.sh
8931 dnl Run a perl script to quickly create the makefiles.
8932 dnl If it succeeds, it outputs a shell command to set CONFIG_FILES
8933 dnl for the files it cannot handle correctly. This way, config.status
8934 dnl will handle these files.
8935 dnl If it fails, nothing is set and config.status will run as usual.
8937 dnl This does not change the $MAKEFILES variable.
8939 echo $MAKEFILES | ${PERL} $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh
8943 echo $MAKEFILES > unallmakefiles
8945 mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
8947 AC_OUTPUT($MAKEFILES)
8949 # Generate a JSON config file for unittest harnesses etc to read
8950 # build configuration details from in a standardized way.
8951 OS_TARGET=${OS_TARGET} TARGET_CPU=${TARGET_CPU} MOZ_DEBUG=${MOZ_DEBUG} \
8952 MOZ_WIDGET_TOOLKIT=${MOZ_WIDGET_TOOLKIT} UNIVERSAL_BINARY=${UNIVERSAL_BINARY} \
8953 $PYTHON ${_topsrcdir}/config/writemozinfo.py ./mozinfo.json.tmp
8954 if cmp -s ./mozinfo.json.tmp ./mozinfo.json; then
8955 rm ./mozinfo.json.tmp
8957 mv -f ./mozinfo.json.tmp ./mozinfo.json
8960 dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
8961 if test "$CAIRO_FEATURES_H"; then
8962 if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
8963 echo "$CAIRO_FEATURES_H is unchanged"
8964 mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
8966 rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
8970 # Run freetype configure script
8972 if test "$MOZ_TREE_FREETYPE"; then
8973 export CFLAGS="$CFLAGS -std=c99"
8974 export CPPFLAGS="$CPPFLAGS"
8975 export CXXFLAGS="$CXXFLAGS"
8976 export LDFLAGS="$LDFLAGS"
8977 export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
8978 ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes"
8979 AC_OUTPUT_SUBDIRS(modules/freetype2)
8982 if test -z "$direct_nspr_config"; then
8983 dnl ========================================================
8984 dnl = Setup a nice relatively clean build environment for
8985 dnl = sub-configures.
8986 dnl ========================================================
8989 CFLAGS="$_SUBDIR_CFLAGS"
8990 CPPFLAGS="$_SUBDIR_CPPFLAGS"
8991 CXXFLAGS="$_SUBDIR_CXXFLAGS"
8992 LDFLAGS="$_SUBDIR_LDFLAGS"
8993 HOST_CC="$_SUBDIR_HOST_CC"
8994 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8995 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9002 # No need to run subconfigures when building with LIBXUL_SDK_DIR
9003 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
9007 if test -n "$_WRAP_MALLOC"; then
9008 # Avoid doubling wrap malloc arguments
9009 _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--enable-wrap-malloc *//'`"
9012 if test -z "$MOZ_NATIVE_NSPR"; then
9013 ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
9014 if test -z "$MOZ_DEBUG"; then
9015 ac_configure_args="$ac_configure_args --disable-debug"
9017 ac_configure_args="$ac_configure_args --enable-debug"
9019 if test "$MOZ_OPTIMIZE" = "1"; then
9020 ac_configure_args="$ac_configure_args --enable-optimize"
9022 ac_configure_args="$ac_configure_args --disable-optimize"
9024 if test -n "$HAVE_64BIT_OS"; then
9025 ac_configure_args="$ac_configure_args --enable-64bit"
9027 if test -n "$USE_ARM_KUSER"; then
9028 ac_configure_args="$ac_configure_args --with-arm-kuser"
9030 AC_OUTPUT_SUBDIRS(nsprpub)
9031 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9034 if test -z "$MOZ_NATIVE_NSPR"; then
9035 # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
9036 AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
9037 if test "$OS_ARCH" != "WINNT"; then
9038 NSPR_LIBS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --libdir=$LIBXUL_DIST/lib --libs`
9039 $PERL -pi.bak -e "s '^NSPR_LIBS\\s*=.*'NSPR_LIBS = $NSPR_LIBS'" config/autoconf.mk
9040 NSPR_CFLAGS=`./nsprpub/config/nspr-config --prefix=$LIBXUL_DIST --exec-prefix=$MOZ_BUILD_ROOT/dist --includedir=$LIBXUL_DIST/include/nspr --cflags`
9041 $PERL -pi.bak -e "s '^NSPR_CFLAGS\\s*=.*'NSPR_CFLAGS = $NSPR_CFLAGS'" config/autoconf.mk
9043 rm -f config/autoconf.mk.bak
9046 if test -n "$direct_nspr_config"; then
9047 dnl ========================================================
9048 dnl = Setup a nice relatively clean build environment for
9049 dnl = sub-configures.
9050 dnl ========================================================
9053 CFLAGS="$_SUBDIR_CFLAGS"
9054 CPPFLAGS="$_SUBDIR_CPPFLAGS"
9055 CXXFLAGS="$_SUBDIR_CXXFLAGS"
9056 LDFLAGS="$_SUBDIR_LDFLAGS"
9057 HOST_CC="$_SUBDIR_HOST_CC"
9058 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
9059 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
9063 # Run the SpiderMonkey 'configure' script.
9064 dist=$MOZ_BUILD_ROOT/dist
9065 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9066 ac_configure_args="$ac_configure_args --enable-threadsafe"
9067 if test "$BUILD_CTYPES"; then
9068 # Build js-ctypes on the platforms we can.
9069 ac_configure_args="$ac_configure_args --enable-ctypes"
9071 if test -z "$JS_SHARED_LIBRARY" ; then
9072 ac_configure_args="$ac_configure_args --disable-shared-js"
9074 if test -z "$MOZ_NATIVE_NSPR"; then
9075 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
9076 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
9078 ac_configure_args="$ac_configure_args --with-dist-dir=../../dist"
9079 ac_configure_args="$ac_configure_args --prefix=$dist"
9080 ac_configure_args="$ac_configure_args --with-sync-build-files=$_topsrcdir"
9081 if test "$MOZ_MEMORY"; then
9082 ac_configure_args="$ac_configure_args --enable-jemalloc"
9083 if test -n "$MOZ_GLUE_LDFLAGS"; then
9084 export MOZ_GLUE_LDFLAGS
9086 if test -n "$MOZ_GLUE_PROGRAM_LDFLAGS"; then
9087 export MOZ_GLUE_PROGRAM_LDFLAGS
9091 AC_OUTPUT_SUBDIRS(js/src)
9092 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
9094 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
9096 dnl Prevent the regeneration of autoconf.mk forcing rebuilds of the world
9097 dnl Needs to be at the end to respect possible changes from NSPR configure
9098 if cmp -s config/autoconf.mk config/autoconf.mk.orig; then
9099 echo "config/autoconf.mk is unchanged"
9100 mv -f config/autoconf.mk.orig config/autoconf.mk 2> /dev/null
9102 rm -f config/autoconf.mk.orig 2> /dev/null