1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
2 dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
3 dnl This Source Code Form is subject to the terms of the Mozilla Public
4 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
5 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 dnl Process this file with autoconf to produce a configure script.
8 dnl ========================================================
11 AC_INIT(config/config.mk)
12 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
14 TARGET_CPU="${target_cpu}"
15 TARGET_VENDOR="${target_vendor}"
16 TARGET_OS="${target_os}"
18 dnl ========================================================
20 dnl = Don't change the following two lines. Doing so breaks:
22 dnl = CFLAGS="-foo" ./configure
24 dnl ========================================================
26 CPPFLAGS="${CPPFLAGS=}"
27 CXXFLAGS="${CXXFLAGS=}"
29 HOST_CFLAGS="${HOST_CFLAGS=}"
30 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
31 HOST_LDFLAGS="${HOST_LDFLAGS=}"
33 dnl ========================================================
34 dnl = Preserve certain environment flags passed to configure
35 dnl = We want sub projects to receive the same flags
36 dnl = untainted by this configure script
37 dnl ========================================================
40 _SUBDIR_CFLAGS="$CFLAGS"
41 _SUBDIR_CPPFLAGS="$CPPFLAGS"
42 _SUBDIR_CXXFLAGS="$CXXFLAGS"
43 _SUBDIR_LDFLAGS="$LDFLAGS"
44 _SUBDIR_HOST_CC="$HOST_CC"
45 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
46 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
47 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
48 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
50 dnl Set the version number of the libs included in-tree
51 dnl ========================================================
59 dnl Set the minimum version of toolkit libs used by mozilla
60 dnl ========================================================
62 # 2_26 is the earliest version we can set GLIB_VERSION_MIN_REQUIRED.
63 # The macro won't be used when compiling with earlier versions anyway.
64 GLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_26
71 WINDRES_VERSION=2.14.90
75 STARTUP_NOTIFICATION_VERSION=0.8
81 dnl Set various checks
82 dnl ========================================================
86 dnl Initialize the Pthread test variables early so they can be
87 dnl overridden by each platform.
88 dnl ========================================================
92 dnl Do not allow objdir == srcdir builds.
93 dnl ==============================================================
94 _topsrcdir=`cd \`dirname $0\`; pwd`
98 dnl TODO Don't exempt L10N builds once bug 842760 is resolved.
99 if test "$_topsrcdir" = "$_objdir" -a "${with_l10n_base+set}" != set; then
101 echo " * Building directly in the main source directory is not allowed."
103 echo " * To build, you must run configure from a separate directory"
104 echo " * (referred to as an object directory)."
106 echo " * If you are building with a mozconfig, you will need to change your"
107 echo " * mozconfig to point to a different object directory."
112 # Check for a couple representative files in the source tree
114 for file in $_topsrcdir/Makefile $_topsrcdir/config/autoconf.mk; do
115 if test -f $file; then
116 _conflict_files="$_conflict_files $file"
119 if test "$_conflict_files"; then
121 echo "* Your source tree contains these files:"
122 for file in $_conflict_files; do
126 * This indicates that you previously built in the source tree.
127 * A source tree build can confuse the separate objdir build.
129 * To clean up the source tree:
137 MOZ_BUILD_ROOT=`pwd -W 2>/dev/null || pwd`
143 COMPILE_ENVIRONMENT=1
144 MOZ_ARG_DISABLE_BOOL(compile-environment,
145 [ --disable-compile-environment
146 Disable compiler/library checks.],
147 COMPILE_ENVIRONMENT= )
148 AC_SUBST(COMPILE_ENVIRONMENT)
150 MOZ_ARG_WITH_STRING(l10n-base,
151 [ --with-l10n-base=DIR path to l10n repositories],
152 L10NBASEDIR=$withval)
153 if test -n "$L10NBASEDIR"; then
154 if test "$L10NBASEDIR" = "yes" -o "$L10NBASEDIR" = "no"; then
155 AC_MSG_ERROR([--with-l10n-base must specify a path])
156 elif test -d "$L10NBASEDIR"; then
157 L10NBASEDIR=`cd "$L10NBASEDIR" && pwd`
159 AC_MSG_ERROR([Invalid value --with-l10n-base, $L10NBASEDIR doesn't exist])
162 AC_SUBST(L10NBASEDIR)
164 dnl Check for Perl first -- needed for win32 SDK checks
165 MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
166 if test -z "$PERL" -o "$PERL" = ":"; then
167 AC_MSG_ERROR([perl not found in \$PATH])
170 if test -n "$GAIADIR" -a ! -d "$GAIADIR" ; then
171 AC_MSG_ERROR([GAIADIR '$GAIADIR' isn't a valid directory])
175 if test -n "$GAIADIR" ; then
176 AC_DEFINE(PACKAGE_GAIA)
179 if test -n "$FXOS_SIMULATOR" -a -z "$GAIADIR" ; then
180 AC_MSG_ERROR([FXOS_SIMULATOR=1 requires GAIADIR to be defined])
183 if test -n "$FXOS_SIMULATOR" ; then
184 AC_DEFINE(FXOS_SIMULATOR)
185 AC_SUBST(FXOS_SIMULATOR)
188 if test -n "$MOZTTDIR" -a ! -d "$MOZTTDIR" ; then
189 AC_MSG_ERROR([MOZTTDIR '$MOZTTDIR' isn't a valid directory])
193 if test -n "$MOZTTDIR" ; then
194 AC_DEFINE(PACKAGE_MOZTT)
197 MOZ_ARG_WITH_STRING(gonk,
199 location of gonk dir],
202 MOZ_ARG_WITH_STRING(gonk-toolchain-prefix,
203 [ --with-gonk-toolchain-prefix=DIR
204 prefix to gonk toolchain commands],
205 gonk_toolchain_prefix=$withval)
207 if test -n "$gonkdir" ; then
208 kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
209 android_source="$gonkdir"
210 ANDROID_SOURCE="$android_source"
211 ANDROID_NDK="${ANDROID_SOURCE}/ndk"
214 if test -n "${PLATFORM_SDK_VERSION}"; then
215 ANDROID_VERSION="${PLATFORM_SDK_VERSION}"
219 TOOLCHAIN_PREFIX="$gonk_toolchain_prefix"
220 AS="$gonk_toolchain_prefix"as
221 CC="$gonk_toolchain_prefix"gcc
222 CXX="$gonk_toolchain_prefix"g++
223 CPP="$gonk_toolchain_prefix"cpp
224 LD="$gonk_toolchain_prefix"ld
225 AR="$gonk_toolchain_prefix"ar
226 RANLIB="$gonk_toolchain_prefix"ranlib
227 STRIP="$gonk_toolchain_prefix"strip
228 OBJCOPY="$gonk_toolchain_prefix"objcopy
230 if ! test -e "$gonkdir/ndk/sources/cxx-stl/stlport/src/iostream.cpp"; then
231 AC_MSG_ERROR([Couldn't find path to stlport sources in the gonk tree])
233 STLPORT_CPPFLAGS="-I$_topsrcdir/build/stlport/stlport -I$gonkdir/ndk/sources/cxx-stl/system/include"
235 case "$ANDROID_VERSION" in
237 GONK_INCLUDES="-I$gonkdir/frameworks/base/opengl/include -I$gonkdir/frameworks/base/native/include -I$gonkdir/frameworks/base/include -I$gonkdir/frameworks/base/services/camera -I$gonkdir/frameworks/base/include/media/ -I$gonkdir/frameworks/base/include/media/stagefright -I$gonkdir/frameworks/base/include/media/stagefright/openmax -I$gonkdir/frameworks/base/media/libstagefright/rtsp -I$gonkdir/frameworks/base/media/libstagefright/include -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib -I$gonkdir/dalvik/libnativehelper/include/nativehelper"
243 AC_SUBST(MOZ_OMX_DECODER)
249 GONK_INCLUDES="-I$gonkdir/frameworks/native/include -I$gonkdir/frameworks/av/include -I$gonkdir/frameworks/av/include/media -I$gonkdir/frameworks/av/include/camera -I$gonkdir/frameworks/native/include/media/openmax -I$gonkdir/frameworks/av/media/libstagefright/include"
250 if test -d "$gonkdir/external/bluetooth/bluez"; then
251 GONK_INCLUDES="$GONK_INCLUDES -I$gonkdir/external/dbus -I$gonkdir/external/bluetooth/bluez/lib"
254 elif test -d "$gonkdir/external/bluetooth/bluedroid"; then
256 MOZ_B2G_BT_BLUEDROID=1
257 if test -d "$gonkdir/system/bluetoothd"; then
266 AC_SUBST(MOZ_OMX_DECODER)
268 AC_SUBST(MOZ_OMX_ENCODER)
269 AC_DEFINE(MOZ_OMX_ENCODER)
274 GONK_INCLUDES="-I$gonkdir/frameworks/native/include -I$gonkdir/frameworks/av/include -I$gonkdir/frameworks/av/include/media -I$gonkdir/frameworks/av/include/camera -I$gonkdir/frameworks/native/include/media/openmax -I$gonkdir/frameworks/av/media/libstagefright/include"
277 MOZ_B2G_BT_BLUEDROID=1
278 if test -d "$gonkdir/system/bluetoothd"; then
285 AC_DEFINE(MOZ_OMX_ENCODER)
288 AC_SUBST(MOZ_AUDIO_OFFLOAD)
289 AC_DEFINE(MOZ_AUDIO_OFFLOAD)
293 GONK_INCLUDES="-I$gonkdir/frameworks/native/include -I$gonkdir/frameworks/av/include -I$gonkdir/frameworks/av/include/media -I$gonkdir/frameworks/av/include/camera -I$gonkdir/frameworks/native/include/media/openmax -I$gonkdir/frameworks/av/media/libstagefright/include"
296 AC_SUBST(MOZ_AUDIO_OFFLOAD)
297 AC_DEFINE(MOZ_AUDIO_OFFLOAD)
301 MOZ_B2G_BT_BLUEDROID=1
302 if test -d "$gonkdir/system/bluetoothd"; then
308 AC_MSG_ERROR([Unsupported platform version: $ANDROID_VERSION])
311 CPPFLAGS="-DANDROID $TARGET_C_INCLUDES -I$gonkdir/system -I$gonkdir/system/core/include -isystem $gonkdir/bionic -I$gonkdir/hardware/libhardware/include -I$gonkdir/external/valgrind/fxos-include $GONK_INCLUDES $CPPFLAGS"
312 CFLAGS="-mandroid -fno-short-enums -fno-exceptions $CFLAGS"
313 CXXFLAGS="-mandroid -fno-short-enums -fno-exceptions -Wno-psabi $CXXFLAGS $STLPORT_CPPFLAGS"
314 dnl Add -llog by default, since we use it all over the place.
317 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/ $LDFLAGS"
319 dnl prevent cross compile section from using these flags as host flags
320 if test -z "$HOST_CPPFLAGS" ; then
323 if test -z "$HOST_CFLAGS" ; then
326 if test -z "$HOST_CXXFLAGS" ; then
329 if test -z "$HOST_LDFLAGS" ; then
334 AC_DEFINE_UNQUOTED(ANDROID_VERSION, $ANDROID_VERSION)
335 AC_SUBST(ANDROID_VERSION)
336 AC_DEFINE(HAVE_SYS_UIO_H)
337 AC_DEFINE(HAVE_PTHREADS)
338 MOZ_CHROME_FILE_FORMAT=omni
344 *-android*|*-linuxandroid*)
345 if test -z "$ANDROID_PACKAGE_NAME" ; then
346 ANDROID_PACKAGE_NAME='org.mozilla.$(MOZ_APP_NAME)'
348 MOZ_CHROME_FILE_FORMAT=omni
352 AC_PATH_PROG(OBJCOPY,objcopy)
357 AC_SUBST(ANDROID_SOURCE)
358 AC_SUBST(ANDROID_PACKAGE_NAME)
361 dnl ========================================================
362 dnl Checks for compilers.
363 dnl ========================================================
365 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
368 if test "$COMPILE_ENVIRONMENT"; then
370 if test "$target" != "$host"; then
376 # Work around the conftest.exe access problem on Windows
381 MOZ_PATH_PROGS(AS, $AS as, $CC)
382 AC_CHECK_PROGS(AR, ar, :)
383 AC_CHECK_PROGS(LD, ld, :)
384 AC_CHECK_PROGS(STRIP, strip, :)
385 AC_CHECK_PROGS(WINDRES, windres, :)
386 AC_CHECK_PROGS(OTOOL, otool, :)
387 if test -z "$HOST_CC"; then
390 if test -z "$HOST_CFLAGS"; then
391 HOST_CFLAGS="$CFLAGS"
393 if test -z "$HOST_CXX"; then
396 if test -z "$HOST_CXXFLAGS"; then
397 HOST_CXXFLAGS="$CXXFLAGS"
399 if test -z "$HOST_LDFLAGS"; then
400 HOST_LDFLAGS="$LDFLAGS"
402 if test -z "$HOST_RANLIB"; then
403 HOST_RANLIB="$RANLIB"
405 if test -z "$HOST_AR"; then
408 if test -z "$HOST_AR_FLAGS"; then
409 HOST_AR_FLAGS="$AR_FLAGS"
413 if test -n "$MOZ_WINCONSOLE"; then
414 AC_DEFINE(MOZ_WINCONSOLE)
419 MOZ_CHECK_COMPILER_WRAPPER
421 dnl ========================================================
422 dnl Special win32 checks
423 dnl ========================================================
425 # Target the Windows 8.1 SDK by default
429 MOZ_ARG_WITH_STRING(windows-version,
430 [ --with-windows-version=WINSDK_TARGETVER
431 Windows SDK version to target. Win8.1 (603) is
432 currently the minimum supported version.],
433 WINSDK_TARGETVER=$withval)
435 # Currently only version 603 is allowed
436 case "$WINSDK_TARGETVER" in
438 MOZ_WINSDK_TARGETVER=0${WINSDK_TARGETVER}0000
442 AC_MSG_ERROR([Invalid value for --with-windows-version ($WINSDK_TARGETVER)]);
448 if test "$GCC" != "yes"; then
449 # Check to see if we are really running in a msvc environemnt
451 AC_CHECK_PROGS(MIDL, midl)
453 # Make sure compilers are valid
454 CFLAGS="$CFLAGS -TC -nologo"
455 CXXFLAGS="$CXXFLAGS -TP -nologo"
458 AC_TRY_COMPILE([#include <stdio.h>],
459 [ printf("Hello World\n"); ],,
460 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
463 AC_TRY_COMPILE([#include <new.h>],
464 [ unsigned *test = new unsigned(42); ],,
465 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
469 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
472 # Determine compiler version
473 _CC_MAJOR_VERSION=`echo ${MSVC_VERSION_FULL} | cut -c 1-2`
474 _CC_MINOR_VERSION=`echo ${MSVC_VERSION_FULL} | cut -c 3-4`
475 _CC_BUILD_VERSION=`echo ${MSVC_VERSION_FULL} | cut -c 5-`
476 _MSC_VER=${CC_VERSION}
478 _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | cut -c 1-2`
480 if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
481 AC_MSG_ERROR([The major versions of \$CC and \$CXX do not match.])
484 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
485 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
487 if test "$_CC_MAJOR_VERSION" = "18" -a "$_CC_BUILD_VERSION" -ge "30723"; then
490 MSVC_REDIST_CRT_DIR=Microsoft.VC120.CRT
491 MSVC_C_RUNTIME_DLL=msvcr120.dll
492 MSVC_CXX_RUNTIME_DLL=msvcp120.dll
493 MSVC_REDIST_OPENMP_DIR=Microsoft.VC120.OPENMP
494 MSVC_OPENMP_DLL=vcomp120.dll
495 elif test "$_CC_MAJOR_VERSION" = "19"; then
498 MSVC_C_RUNTIME_DLL=vcruntime140.dll
499 MSVC_CXX_RUNTIME_DLL=msvcp140.dll
500 MSVC_APPCRT_DLL=appcrt140.dll
501 MSVC_DESKTOPCRT_DLL=desktopcrt140.dll
503 # -Wv:18 disables all warnings introduced after VS2013
504 # See http://blogs.msdn.com/b/vcblog/archive/2014/11/12/improvements-to-warnings-in-the-c-compiler.aspx
505 CFLAGS="$CFLAGS -Wv:18"
506 CXXFLAGS="$CXXFLAGS -Wv:18"
508 # https://connect.microsoft.com/VisualStudio/feedback/details/888527/warnings-on-dbghelp-h
509 # for dbghelp.h, imagehlp.h, and shobj.h
510 # C4091: 'typedef ': ignored on left of '' when no variable is declared
511 CFLAGS="$CFLAGS -wd4091"
512 CXXFLAGS="$CXXFLAGS -wd4091"
514 AC_MSG_ERROR([This version (${_CC_MAJOR_VERSION}.${_CC_MINOR_VERSION}.${_CC_BUILD_VERSION}) of the MSVC compiler is unsupported.
515 You must install Visual C++ 2013 Update 3 or newer in order to build.
516 See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
518 AC_SUBST(MSVS_VERSION)
519 AC_SUBST(MSVC_REDIST_CRT_DIR)
520 AC_SUBST(MSVC_C_RUNTIME_DLL)
521 AC_SUBST(MSVC_CXX_RUNTIME_DLL)
522 AC_SUBST(MSVC_REDIST_OPENMP_DIR)
523 AC_SUBST(MSVC_OPENMP_DLL)
524 AC_SUBST(MSVC_APPCRT_DLL)
525 AC_SUBST(MSVC_DESKTOPCRT_DLL)
527 # Disable SEH on clang-cl because it doesn't implement them yet.
528 if test -z "$CLANG_CL"; then
529 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
531 # Send our CFLAGS to NSS
533 AC_DEFINE_UNQUOTED(GTEST_HAS_SEH, 0)
536 if test -n "$WIN32_REDIST_DIR"; then
537 if test ! -d "$WIN32_REDIST_DIR"; then
538 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
541 if test -f "$WIN32_REDIST_DIR/$MSVC_C_RUNTIME_DLL"; then
542 AC_MSG_ERROR([The Win32 Redist directory must be set to the directory above Microsoft.VCXX0.CRT])
544 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd`
547 dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
548 dnl not something else like "magnetic tape manipulation utility".
549 MSMT_TOOL=`${MT-mt} 2>&1|grep 'Microsoft (R) Manifest Tool'`
550 if test -z "$MSMT_TOOL"; then
551 AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
555 _MSMT_VER_FILTER='s|.*[^!-~]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*|\1|p'
557 MSMANIFEST_TOOL_VERSION=`echo ${MSMT_TOOL}|sed -ne "$_MSMT_VER_FILTER"`
558 if test -z "$MSMANIFEST_TOOL_VERSION"; then
559 AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
565 # Check linker version
566 _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
567 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
568 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
569 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
574 # Set midl environment
577 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
580 MIDL_FLAGS="${MIDL_FLAGS} -env x64"
584 unset _MSVC_VER_FILTER
586 AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
590 _SAVE_CXXFLAGS="$CXXFLAGS"
591 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
592 AC_TRY_COMPILE([#include <exception>],
593 [std::_Throw(std::exception()); return 0;],
594 ac_cv_have_std__Throw="yes",
595 ac_cv_have_std__Throw="no")
596 CXXFLAGS="$_SAVE_CXXFLAGS"
600 if test "$ac_cv_have_std__Throw" = "yes"; then
601 AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
602 ac_cv_have_dllimport_exception_bug,
606 _SAVE_CXXFLAGS="$CXXFLAGS"
607 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
608 AC_TRY_LINK([#include <vector>],
609 [std::vector<int> v; return v.at(1);],
610 ac_cv_have_dllimport_exception_bug="no",
611 ac_cv_have_dllimport_exception_bug="yes")
612 CXXFLAGS="$_SAVE_CXXFLAGS"
615 if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
617 MOZ_MSVC_STL_WRAP_Throw=1
618 AC_DEFINE(MOZ_MSVC_STL_WRAP_Throw)
621 AC_CACHE_CHECK(for overridable _RAISE,
626 _SAVE_CXXFLAGS="$CXXFLAGS"
627 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
628 AC_TRY_COMPILE([#include <xstddef>
630 #define _RAISE(x) externallyDefinedFunction((x).what())
633 [std::vector<int> v; return v.at(1);],
634 ac_cv_have__RAISE="no",
635 ac_cv_have__RAISE="yes")
636 CXXFLAGS="$_SAVE_CXXFLAGS"
639 if test "$ac_cv_have__RAISE" = "yes"; then
641 MOZ_MSVC_STL_WRAP_RAISE=1
642 AC_DEFINE(MOZ_MSVC_STL_WRAP_RAISE)
644 AC_MSG_ERROR([Goanna exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.])
648 if test "$WRAP_STL_INCLUDES" = "1"; then
649 STL_FLAGS='-I$(DIST)/stl_wrappers'
651 CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
652 CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
654 MOZ_FIND_WINSDK_VERSION
656 # Check w32api version
657 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
658 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
659 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
660 AC_TRY_COMPILE([#include <w32api.h>],
661 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
662 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
663 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
664 #error "test failed."
666 , [ res=yes ], [ res=no ])
667 AC_MSG_RESULT([$res])
668 if test "$res" != "yes"; then
669 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
671 # Check windres version
672 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
673 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
674 AC_MSG_RESULT([$_WINDRES_VERSION])
675 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
676 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
677 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
678 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
679 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
680 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
681 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
682 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
683 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
684 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
685 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
686 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
688 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
691 AC_CHECK_PROGS(MIDL, $target-widl widl)
692 if test -n "$MIDL"; then
695 MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
698 MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
703 # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
704 # causing problems with local implementations with the same name.
705 AC_DEFINE(STRSAFE_NO_DEPRECATE)
707 MOZ_WINSDK_MAXVER=0x06030000
710 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
711 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
712 # Require OS features provided by IE 6.0 SP2 (XP SP2)
713 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
715 # If the maximum version supported by this SDK is lower than the target
717 AC_MSG_CHECKING([for Windows SDK being recent enough])
718 if $PERL -e "exit(0x$MOZ_WINSDK_TARGETVER > $MOZ_WINSDK_MAXVER)"; then
722 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.])
725 AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
726 # Definitions matching sdkddkver.h
727 AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
728 AC_DEFINE_UNQUOTED(MOZ_WINSDK_MAXVER,$MOZ_WINSDK_MAXVER)
729 AC_SUBST(MOZ_WINSDK_MAXVER)
736 if test -n "$_WIN32_MSVC"; then
738 SKIP_COMPILER_CHECKS=1
739 SKIP_LIBRARY_CHECKS=1
741 # Since we're skipping compiler and library checks, hard-code
744 AC_DEFINE(HAVE_SETBUF)
745 AC_DEFINE(HAVE_ISATTY)
748 fi # COMPILE_ENVIRONMENT
761 AC_SUBST(WRAP_STL_INCLUDES)
762 AC_SUBST(MOZ_MSVC_STL_WRAP_Throw)
763 AC_SUBST(MOZ_MSVC_STL_WRAP_RAISE)
765 dnl ========================================================
766 dnl Checks for programs.
767 dnl ========================================================
771 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
772 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
774 AC_MSG_RESULT([$_perl_version])
776 if test "$_perl_res" != 0; then
777 AC_MSG_ERROR([Perl $PERL_VERSION or higher is required.])
780 AC_MSG_CHECKING([for full perl installation])
781 _perl_archlib=`$PERL -e 'use Config; if ( -d $Config{archlib} ) { exit(0); } else { exit(1); }' 2>&5`
783 if test "$_perl_res" != 0; then
785 AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}. A full perl installation is required.])
790 if test -z "$COMPILE_ENVIRONMENT"; then
791 NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
793 AC_SUBST(NSINSTALL_BIN)
795 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
796 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
797 MOZ_PATH_PROGS(UNZIP, unzip)
798 if test -z "$UNZIP" -o "$UNZIP" = ":"; then
799 AC_MSG_ERROR([unzip not found in \$PATH])
801 MOZ_PATH_PROGS(ZIP, zip)
802 if test -z "$ZIP" -o "$ZIP" = ":"; then
803 AC_MSG_ERROR([zip not found in \$PATH])
805 MOZ_PATH_PROG(XARGS, xargs)
806 if test -z "$XARGS" -o "$XARGS" = ":"; then
807 AC_MSG_ERROR([xargs not found in \$PATH .])
810 MOZ_PATH_PROG(RPMBUILD, rpmbuild, :)
813 if test "$COMPILE_ENVIRONMENT"; then
815 dnl ========================================================
816 dnl = Mac OS X toolchain support
817 dnl ========================================================
819 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
820 dnl that a universal binary is being produced and MOZ_CAN_RUN_PROGRAMS
821 dnl when we can run target binaries.
822 AC_SUBST(UNIVERSAL_BINARY)
823 AC_SUBST(MOZ_CAN_RUN_PROGRAMS)
825 MOZ_ARG_WITH_STRING(unify-dist,
826 [ --with-unify-dist=dir Location of the dist directory to unify with at packaging time (Mac OS X universal build only)],
828 if test -n "$UNIVERSAL_BINARY"; then
829 if test -z "$UNIFY_DIST"; then
830 AC_MSG_ERROR([You need to provide the --with-unify-dist=dir argument when performing a universal build])
832 case "$UNIFY_DIST" in
836 UNIFY_DIST="${MOZ_BUILD_ROOT}/${UNIFY_DIST}"
842 dnl ========================================================
843 dnl Check for MacOS deployment target version
844 dnl ========================================================
846 MOZ_ARG_ENABLE_STRING(macos-target,
847 [ --enable-macos-target=VER (default=10.6)
848 Set the minimum MacOS version needed at runtime],
849 [_MACOSX_DEPLOYMENT_TARGET=$enableval])
853 if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
854 dnl Use the specified value
855 export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
857 dnl No value specified on the command line or in the environment,
858 dnl use architecture minimum.
859 export MACOSX_DEPLOYMENT_TARGET=10.6
864 AC_SUBST(MACOSX_DEPLOYMENT_TARGET)
866 dnl ========================================================
867 dnl = Mac OS X SDK support
868 dnl ========================================================
870 MOZ_ARG_WITH_STRING(macos-sdk,
871 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
872 MACOS_SDK_DIR=$withval)
874 MACOS_PRIVATE_FRAMEWORKS_DIR_DEFAULTED=
875 MOZ_ARG_WITH_STRING(macos-private-frameworks,
876 [ --with-macos-private-frameworks=dir Location of private frameworks to use (Mac OS X only)],
877 MACOS_PRIVATE_FRAMEWORKS_DIR=$withval,
878 MACOS_PRIVATE_FRAMEWORKS_DIR=/System/Library/PrivateFrameworks
879 MACOS_PRIVATE_FRAMEWORKS_DEFAULTED=1)
881 if test -z "${MACOS_PRIVATE_FRAMEWORKS_DEFAULTED}"; then
882 if test -z "$CROSS_COMPILE"; then
883 AC_MSG_WARN([You should only be using --with-macos-private-frameworks when cross-compiling.])
885 if test ! -d "$MACOS_PRIVATE_FRAMEWORKS_DIR"; then
886 AC_MSG_ERROR([PrivateFrameworks directory not found.])
890 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
891 AC_SUBST(MACOS_SDK_DIR)
892 AC_SUBST(MACOS_PRIVATE_FRAMEWORKS_DIR)
894 if test "$MACOS_SDK_DIR"; then
895 dnl Sync this section with the ones in NSPR and NSS.
896 dnl Changes to the cross environment here need to be accounted for in
897 dnl the libIDL checks (below) and xpidl build.
899 if test ! -d "$MACOS_SDK_DIR"; then
900 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
901 specify a valid SDK. SDKs are installed when the optional cross-development
902 tools are selected during the Xcode/Developer Tools installation.])
905 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
906 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
908 dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
909 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
910 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
913 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
915 AC_TRY_COMPILE([#include <new>],[],
919 AC_MSG_RESULT($result)
921 if test "$result" = "no" ; then
922 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
926 fi # COMPILE_ENVIRONMENT
928 if test -n "$MAKE"; then
929 if test `echo $MAKE | grep -c make.py` != 1; then
936 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
939 MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
942 if test "$GMAKE" = ":"; then
943 AC_MSG_ERROR([GNU make not found])
947 if test -z "$MAKE"; then
951 if test "$COMPILE_ENVIRONMENT"; then
957 fi # COMPILE_ENVIRONMENT
959 dnl ========================================================
960 dnl set the defaults first
961 dnl ========================================================
977 MOZ_USER_DIR=".mozilla"
979 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
985 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
987 if test -n "$CROSS_COMPILE"; then
988 OS_TARGET="${target_os}"
989 OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
991 case "${target_os}" in
992 linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
993 kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU/kFreeBSD ;;
995 solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
996 mingw*) OS_ARCH=WINNT OS_TARGET=WINNT ;;
997 darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
998 dragonfly*) OS_ARCH=DragonFly OS_TARGET=DragonFly ;;
999 freebsd*) OS_ARCH=FreeBSD OS_TARGET=FreeBSD ;;
1000 netbsd*) OS_ARCH=NetBSD OS_TARGET=NetBSD ;;
1001 openbsd*) OS_ARCH=OpenBSD OS_TARGET=OpenBSD ;;
1004 *-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
1007 OS_TARGET=`uname -s`
1008 OS_ARCH=`uname -s | sed -e 's|/|_|g'`
1009 OS_RELEASE=`uname -r`
1012 # Before this used `uname -m` when not cross compiling
1013 # but that breaks when you have a 64 bit kernel with a 32 bit userland.
1014 OS_TEST="${target_cpu}"
1016 HOST_OS_ARCH=`echo $host_os | sed -e 's|/|_|g'`
1018 #######################################################################
1019 # Master "Core Components" macros for getting the OS target #
1020 #######################################################################
1023 # If OS_TARGET is not specified, it defaults to $(OS_ARCH), i.e., no
1024 # cross-compilation.
1028 # Define and override various archtecture-specific variables, including
1037 case "$HOST_OS_ARCH" in
1048 HOST_OS_ARCH=GNU_kFreeBSD
1054 HOST_OS_ARCH=DragonFly
1057 HOST_OS_ARCH=FreeBSD
1063 HOST_OS_ARCH=OpenBSD
1069 if test -z "$GNU_CC"; then
1070 if test "`$CC -V 2>&1 | egrep -c 'Sun.*C '`" != "0"; then
1075 if test -z "$GNU_CXX"; then
1076 if test "`$CXX -V 2>&1 | egrep -c 'Sun.*C\+\+ '`" != "0"; then
1077 SOLARIS_SUNPRO_CXX=1
1080 AC_SUBST(SOLARIS_SUNPRO_CC)
1081 AC_SUBST(SOLARIS_SUNPRO_CXX)
1087 if test -z "$CROSS_COMPILE" ; then
1093 # If uname -s returns "Windows_NT", we assume that we are using
1094 # the uname.exe in MKS toolkit.
1096 # The -r option of MKS uname only returns the major version number.
1097 # So we need to use its -v option to get the minor version number.
1098 # Moreover, it doesn't have the -p option, so we need to use uname -m.
1102 OS_MINOR_RELEASE=`uname -v`
1103 if test "$OS_MINOR_RELEASE" = "00"; then
1106 OS_RELEASE="${OS_RELEASE}.${OS_MINOR_RELEASE}"
1110 # If uname -s returns MINGW32_NT-5.1, we assume that we are using
1111 # the uname.exe in the MSYS tools.
1113 OS_RELEASE=`expr $OS_ARCH : '.*NT-\(.*\)'`
1118 OS_RELEASE=`uname -v`.`uname -r`
1119 OS_TEST=${target_cpu}
1122 case "${target_cpu}" in
1133 if test -z "$CROSS_COMPILE" ; then
1141 # Only set CPU_ARCH if we recognize the value of OS_TEST
1148 powerpc64 | ppc64 | powerpc64le | ppc64le)
1152 powerpc | ppc | rs6000)
1156 Alpha | alpha | ALPHA)
1193 if test -z "$OS_TARGET"; then
1196 OS_CONFIG="${OS_TARGET}${OS_RELEASE}"
1198 dnl Set INTEL_ARCHITECTURE if we're compiling for x86-32 or x86-64.
1199 dnl ===============================================================
1203 INTEL_ARCHITECTURE=1
1206 dnl Configure platform-specific CPU architecture compiler options.
1207 dnl ==============================================================
1210 dnl =================================================================
1211 dnl Set up and test static assertion macros used to avoid AC_TRY_RUN,
1212 dnl which is bad when cross compiling.
1213 dnl =================================================================
1214 if test "$COMPILE_ENVIRONMENT"; then
1215 configure_static_assert_macros='
1216 #define CONFIGURE_STATIC_ASSERT(condition) CONFIGURE_STATIC_ASSERT_IMPL(condition, __LINE__)
1217 #define CONFIGURE_STATIC_ASSERT_IMPL(condition, line) CONFIGURE_STATIC_ASSERT_IMPL2(condition, line)
1218 #define CONFIGURE_STATIC_ASSERT_IMPL2(condition, line) typedef int static_assert_line_##line[(condition) ? 1 : -1]
1221 dnl test that the macros actually work:
1222 AC_MSG_CHECKING(that static assertion macros used in autoconf tests work)
1223 AC_CACHE_VAL(ac_cv_static_assertion_macros_work,
1226 ac_cv_static_assertion_macros_work="yes"
1227 AC_TRY_COMPILE([$configure_static_assert_macros],
1228 [CONFIGURE_STATIC_ASSERT(1)],
1230 ac_cv_static_assertion_macros_work="no")
1231 AC_TRY_COMPILE([$configure_static_assert_macros],
1232 [CONFIGURE_STATIC_ASSERT(0)],
1233 ac_cv_static_assertion_macros_work="no",
1236 AC_TRY_COMPILE([$configure_static_assert_macros],
1237 [CONFIGURE_STATIC_ASSERT(1)],
1239 ac_cv_static_assertion_macros_work="no")
1240 AC_TRY_COMPILE([$configure_static_assert_macros],
1241 [CONFIGURE_STATIC_ASSERT(0)],
1242 ac_cv_static_assertion_macros_work="no",
1246 AC_MSG_RESULT("$ac_cv_static_assertion_macros_work")
1247 if test "$ac_cv_static_assertion_macros_work" = "no"; then
1248 AC_MSG_ERROR([Compiler cannot compile macros used in autoconf tests.])
1250 fi # COMPILE_ENVIRONMENT
1252 dnl ========================================================
1253 dnl Android libstdc++, placed here so it can use MOZ_ARCH
1255 dnl ========================================================
1259 dnl ========================================================
1260 dnl Suppress Clang Argument Warnings
1261 dnl ========================================================
1262 if test -n "${CLANG_CC}${CLANG_CL}"; then
1263 _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
1264 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
1266 if test -n "${CLANG_CXX}${CLANG_CL}"; then
1267 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
1270 dnl ========================================================
1271 dnl = Use Address Sanitizer
1272 dnl ========================================================
1273 MOZ_ARG_ENABLE_BOOL(address-sanitizer,
1274 [ --enable-address-sanitizer Enable Address Sanitizer (default=no)],
1277 if test -n "$MOZ_ASAN"; then
1279 if test -n "$CLANG_CL"; then
1280 # Look for clang_rt.asan_dynamic-i386.dll
1281 MOZ_CLANG_RT_ASAN_LIB=clang_rt.asan_dynamic-i386.dll
1282 # We use MOZ_PATH_PROG in order to get a Windows style path.
1283 MOZ_PATH_PROG(MOZ_CLANG_RT_ASAN_LIB_PATH, $MOZ_CLANG_RT_ASAN_LIB)
1284 if test -z "$MOZ_CLANG_RT_ASAN_LIB_PATH"; then
1285 AC_MSG_ERROR([Couldn't find $MOZ_CLANG_RT_ASAN_LIB. It should be available in the same location as clang-cl.])
1287 AC_SUBST(MOZ_CLANG_RT_ASAN_LIB_PATH)
1290 MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
1294 dnl ========================================================
1295 dnl = Use Memory Sanitizer
1296 dnl ========================================================
1297 MOZ_ARG_ENABLE_BOOL(memory-sanitizer,
1298 [ --enable-memory-sanitizer Enable Memory Sanitizer (default=no)],
1301 if test -n "$MOZ_MSAN"; then
1304 MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
1308 dnl ========================================================
1309 dnl = Use Thread Sanitizer
1310 dnl ========================================================
1311 MOZ_ARG_ENABLE_BOOL(thread-sanitizer,
1312 [ --enable-thread-sanitizer Enable Thread Sanitizer (default=no)],
1315 if test -n "$MOZ_TSAN"; then
1318 MOZ_PATH_PROG(LLVM_SYMBOLIZER, llvm-symbolizer)
1322 # The LLVM symbolizer is used by all sanitizers
1323 AC_SUBST(LLVM_SYMBOLIZER)
1325 dnl ========================================================
1326 dnl = Enable hacks required for LLVM instrumentations
1327 dnl ========================================================
1328 MOZ_ARG_ENABLE_BOOL(llvm-hacks,
1329 [ --enable-llvm-hacks Enable workarounds required for several LLVM instrumentations (default=no)],
1332 if test -n "$MOZ_LLVM_HACKS"; then
1336 AC_SUBST(MOZ_NO_WLZDEFS)
1337 AC_SUBST(MOZ_CFLAGS_NSS)
1339 dnl ========================================================
1340 dnl = Enable treating compiler warnings as errors
1341 dnl ========================================================
1342 MOZ_ARG_ENABLE_BOOL(warnings-as-errors,
1343 [ --enable-warnings-as-errors
1344 Enable treating warnings as errors],
1345 MOZ_ENABLE_WARNINGS_AS_ERRORS=1,
1346 MOZ_ENABLE_WARNINGS_AS_ERRORS=)
1348 dnl ========================================================
1349 dnl GNU specific defaults
1350 dnl ========================================================
1351 if test "$GNU_CC"; then
1355 # Per bug 719659 comment 2, some of the headers on ancient build machines
1356 # may require gnu89 inline semantics. But otherwise, we use C99.
1357 # But on OS X we just use C99 plus GNU extensions, in order to fix
1359 CFLAGS="$CFLAGS -std=gnu99"
1360 if test "${OS_ARCH}" != Darwin; then
1361 CFLAGS="$CFLAGS -fgnu89-inline"
1363 # FIXME: Let us build with strict aliasing. bug 414641.
1364 CFLAGS="$CFLAGS -fno-strict-aliasing"
1365 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
1366 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
1367 WARNINGS_AS_ERRORS='-Werror'
1369 DSO_PIC_CFLAGS='-fPIC'
1370 ASFLAGS="$ASFLAGS -fPIC"
1371 AC_MSG_CHECKING([for --noexecstack option to as])
1372 _SAVE_CFLAGS=$CFLAGS
1373 CFLAGS="$CFLAGS -Wa,--noexecstack"
1374 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
1375 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
1376 AC_MSG_RESULT([no]))
1377 CFLAGS=$_SAVE_CFLAGS
1378 AC_MSG_CHECKING([for -z noexecstack option to ld])
1379 _SAVE_LDFLAGS=$LDFLAGS
1380 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
1381 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
1383 LDFLAGS=$_SAVE_LDFLAGS)
1385 AC_MSG_CHECKING([for -z text option to ld])
1386 _SAVE_LDFLAGS=$LDFLAGS
1387 LDFLAGS="$LDFLAGS -Wl,-z,text"
1388 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1389 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,text"],
1391 LDFLAGS=$_SAVE_LDFLAGS)
1393 AC_MSG_CHECKING([for --build-id option to ld])
1394 _SAVE_LDFLAGS=$LDFLAGS
1395 LDFLAGS="$LDFLAGS -Wl,--build-id"
1396 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1397 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,--build-id"],
1399 LDFLAGS=$_SAVE_LDFLAGS)
1401 AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
1402 HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
1403 _SAVE_LDFLAGS=$LDFLAGS
1404 LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
1405 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
1406 [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
1407 AC_MSG_RESULT([no]))
1408 LDFLAGS=$_SAVE_LDFLAGS
1410 # Check for -mssse3 on $CC
1411 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
1412 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
1413 _SAVE_CFLAGS=$CFLAGS
1414 CFLAGS="$CFLAGS -mssse3"
1415 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
1416 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
1417 AC_MSG_RESULT([no]))
1418 CFLAGS=$_SAVE_CFLAGS
1420 # Check for -msse4.1 on $CC
1421 AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
1422 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
1423 _SAVE_CFLAGS=$CFLAGS
1424 CFLAGS="$CFLAGS -msse4.1"
1425 AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
1426 [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
1427 AC_MSG_RESULT([no]))
1428 CFLAGS=$_SAVE_CFLAGS
1430 case "${CPU_ARCH}" in
1432 AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
1434 [asm volatile ("vpermq \$0xd8,%ymm0,%ymm0 \n");],
1435 result="yes", result="no")
1436 AC_MSG_RESULT("$result")
1437 if test "$result" = "yes"; then
1442 DSO_LDOPTS='-shared'
1443 if test "$GCC_USE_GNU_LD"; then
1444 # Some tools like ASan use a runtime library that is only
1445 # linked against executables, so we must allow undefined
1446 # symbols for shared objects in some cases.
1447 if test -z "$MOZ_NO_WLZDEFS"; then
1448 # Don't allow undefined symbols in libraries
1449 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
1451 # BSDs need `environ' exposed for posix_spawn (bug 753046)
1452 case "$OS_TARGET" in
1453 DragonFly|FreeBSD|NetBSD|OpenBSD)
1454 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
1455 DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
1457 DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
1464 # Turn on gcc/clang warnings:
1465 # https://gcc.gnu.org/onlinedocs/gcc-4.4.0/gcc/Warning-Options.html
1467 # -Wall - turn on a lot of warnings
1468 # -Wchar-subscripts - catches array index using signed char
1469 # -Wcomment - catches nested comments
1470 # -Wdeclaration-after-statement - MSVC doesn't like these
1471 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1472 # -Wendif-labels - catches `#else FOO` and `#endif FOO` not in comment
1473 # -Wenum-compare - catches comparison of different enum types
1474 # -Wignored-qualifiers - catches returns types with qualifiers like const
1475 # -Wint-to-pointer-cast - catches cast to pointer from integer of different size
1476 # -Wmultichar - catches multicharacter integer constants like 'THIS'
1477 # -Wnon-literal-null-conversion - catches expressions used as a null pointer constant
1478 # -Wnonnull - catches NULL used with functions arguments marked as non-null
1479 # -Wpointer-arith - catches pointer arithmetic using NULL or sizeof(void)
1480 # -Wpointer-sign - catches mixing pointers to signed and unsigned types
1481 # -Wpointer-to-int-cast - catches casts from pointer to different sized int
1482 # -Wreturn-type - catches missing returns, zero false positives
1483 # -Wsequence-point - catches undefined order behavior like `a = a++`
1484 # -Wsign-compare - catches comparison of signed and unsigned types
1485 # -Wtrigraphs - catches unlikely use of trigraphs
1486 # -Wtype-limits - catches overflow bugs, few false positives
1487 # -Wunknown-pragmas - catches unexpected #pragma directives
1489 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wall"
1490 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wdeclaration-after-statement"
1491 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wempty-body"
1492 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wpointer-to-int-cast"
1493 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wsign-compare"
1494 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wtype-limits"
1496 # Treat some warnings as errors if --enable-warnings-as-errors:
1497 if test "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
1498 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=char-subscripts"
1499 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=comment"
1500 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=endif-labels"
1501 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=enum-compare"
1502 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=ignored-qualifiers"
1503 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=int-to-pointer-cast"
1504 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=multichar"
1505 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=nonnull"
1506 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=pointer-arith"
1507 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=pointer-sign"
1508 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=return-type"
1509 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=sequence-point"
1510 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=trigraphs"
1511 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Werror=unknown-pragmas"
1513 MOZ_C_SUPPORTS_WARNING(-Werror=, non-literal-null-conversion, ac_c_has_werror_non_literal_null_conversion)
1516 # Turn off the following warnings that -Wall turns on:
1517 # -Wno-unused - lots of violations in third-party code
1519 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wno-unused"
1521 if test -z "$INTEL_CC" -a -z "$CLANG_CC"; then
1522 # Don't use -Wcast-align with ICC or clang
1524 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1525 hppa | ia64 | sparc | arm)
1528 _WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
1533 _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
1534 _USE_CPP_INCLUDE_FLAG=1
1535 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
1537 elif test "$SOLARIS_SUNPRO_CC"; then
1539 if test "$CPU_ARCH" = "sparc"; then
1540 # for Sun Studio on Solaris/SPARC
1541 DSO_PIC_CFLAGS='-xcode=pic32'
1543 DSO_PIC_CFLAGS='-KPIC'
1545 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1547 MKSHLIB='$(LD) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
1548 MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
1550 DSO_LDOPTS='-shared'
1551 if test "$GNU_LD"; then
1552 # Don't allow undefined symbols in libraries
1553 DSO_LDOPTS="$DSO_LDOPTS -z defs"
1557 DSO_PIC_CFLAGS='-KPIC'
1558 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
1561 if test "$GNU_CXX"; then
1562 # FIXME: Let us build with strict aliasing. bug 414641.
1563 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
1565 # Turn on gcc/clang warnings:
1566 # https://gcc.gnu.org/onlinedocs/gcc-4.4.0/gcc/Warning-Options.html
1568 # -Wall - turn on a lot of warnings
1569 # -Wempty-body - catches bugs, e.g. "if (c); foo();", few false positives
1570 # -Wendif-labels - catches `#else FOO` and `#endif FOO` not in comment
1571 # -Wint-to-pointer-cast - catches cast to pointer from integer of different size
1572 # -Wmissing-braces - catches aggregate initializers missing nested braces
1573 # -Wnon-literal-null-conversion - catches expressions used as a null pointer constant
1574 # -Woverloaded-virtual - function declaration hides virtual function from base class
1575 # -Wparentheses - catches `if (a=b)` and operator precedence bugs
1576 # -Wpointer-arith - catches pointer arithmetic using NULL or sizeof(void)
1577 # -Wreturn-type - catches missing returns, zero false positives
1578 # -Wsequence-point - catches undefined order behavior like `a = a++`
1579 # -Wsign-compare - catches comparison of signed and unsigned types
1580 # -Wswitch - catches switches without all enum cases or default case
1581 # -Wtrigraphs - catches unlikely use of trigraphs
1582 # -Wtype-limits - catches overflow bugs, few false positives
1583 # -Wunused-label - catches unused goto labels
1584 # -Wwrite-strings - catches non-const char* pointers to string literals
1586 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wall"
1587 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wempty-body"
1588 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Woverloaded-virtual"
1589 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wsign-compare"
1590 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wwrite-strings"
1592 # Treat some warnings as errors if --enable-warnings-as-errors:
1593 if test "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
1594 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=endif-labels"
1595 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=int-to-pointer-cast"
1596 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=missing-braces"
1597 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=parentheses"
1598 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=pointer-arith"
1599 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=return-type"
1600 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=sequence-point"
1601 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=switch"
1602 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=trigraphs"
1603 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=type-limits"
1604 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Werror=unused-label"
1606 MOZ_CXX_SUPPORTS_WARNING(-Werror=, non-literal-null-conversion, ac_cxx_has_werror_non_literal_null_conversion)
1609 # Turn off the following warnings that -Wall turns on:
1610 # -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
1611 # -Wno-inline-new-delete - we inline 'new' and 'delete' in mozalloc
1612 # for performance reasons, and because GCC and clang accept it (though
1613 # clang warns about it).
1615 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-invalid-offsetof"
1617 MOZ_CXX_SUPPORTS_WARNING(-Wno-, inline-new-delete, ac_cxx_has_wno_inline_new_delete)
1619 if test -z "$INTEL_CXX" -a -z "$CLANG_CXX"; then
1620 # Don't use -Wcast-align with ICC or clang
1622 # And don't use it on hppa, ia64, sparc, arm, since it's noisy there
1623 hppa | ia64 | sparc | arm)
1626 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
1631 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(DEPTH)/mozilla-config.h'
1632 _USE_CPP_INCLUDE_FLAG=1
1634 # Recent clang and gcc support C++11 deleted functions without warnings if
1635 # compiling with -std=c++0x or -std=gnu++0x (or c++11 or gnu++11 in very new
1636 # versions). We can't use -std=c++0x yet, so gcc's support must remain
1637 # unused. But clang's warning can be disabled, so when compiling with clang
1638 # we use it to opt out of the warning, enabling (macro-encapsulated) use of
1639 # deleted function syntax.
1640 if test "$CLANG_CXX"; then
1641 _WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wno-c++0x-extensions"
1642 MOZ_CXX_SUPPORTS_WARNING(-Wno-, extended-offsetof, ac_cxx_has_wno_extended_offsetof)
1646 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
1649 #FIXME: Work around breaking optimizations performed by GCC 6
1650 if test "$GCC_MAJOR_VERSION" -eq "6" ; then
1651 CFLAGS="$CFLAGS -fno-delete-null-pointer-checks -fno-lifetime-dse -fno-schedule-insns2"
1652 CXXFLAGS="$CXXFLAGS -fno-delete-null-pointer-checks -fno-lifetime-dse -fno-schedule-insns2"
1655 dnl gcc can come with its own linker so it is better to use the pass-thru calls
1656 dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
1657 dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
1658 dnl normal behavior.
1659 dnl ========================================================
1661 MKSHLIB_UNFORCE_ALL=
1663 if test "$COMPILE_ENVIRONMENT"; then
1664 if test "$GNU_CC"; then
1665 AC_MSG_CHECKING(whether ld has archive extraction flags)
1666 AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
1667 [_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
1668 ac_cv_mkshlib_force_and_unforce="no"
1669 exec 3<&0 <<LOOP_INPUT
1670 force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
1671 force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
1672 force="-Wl,-all"; unforce="-Wl,-none"
1679 AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
1682 LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
1684 if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
1688 eval $ac_cv_mkshlib_force_and_unforce
1689 MKSHLIB_FORCE_ALL=$force
1690 MKSHLIB_UNFORCE_ALL=$unforce
1693 fi # COMPILE_ENVIRONMENT
1695 dnl ========================================================
1696 dnl Checking for 64-bit OS
1697 dnl ========================================================
1698 if test "$COMPILE_ENVIRONMENT"; then
1701 AC_MSG_CHECKING(for 64-bit OS)
1702 AC_TRY_COMPILE([$configure_static_assert_macros],
1703 [CONFIGURE_STATIC_ASSERT(sizeof(void*) == 8)],
1704 result="yes", result="no")
1705 AC_MSG_RESULT("$result")
1706 if test "$result" = "yes"; then
1707 AC_DEFINE(HAVE_64BIT_BUILD)
1710 AC_SUBST(HAVE_64BIT_BUILD)
1712 fi # COMPILE_ENVIRONMENT
1714 dnl ========================================================
1715 dnl = Use profiling compile flags
1716 dnl ========================================================
1717 MOZ_ARG_ENABLE_BOOL(profiling,
1718 [ --enable-profiling Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1722 dnl ========================================================
1723 dnl = Turn on systrace for android/b2g.
1724 dnl ========================================================
1725 MOZ_ARG_ENABLE_BOOL(systrace,
1726 [ --enable-systrace Set compile flags necessary for using sampling profilers (e.g. shark, perf)],
1729 if test -n "$MOZ_USE_SYSTRACE"; then
1730 AC_DEFINE(MOZ_USE_SYSTRACE)
1733 # For profiling builds keep the symbol information
1734 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
1735 case "$OS_TARGET" in
1736 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
1737 STRIP_FLAGS="--strip-debug"
1742 dnl ========================================================
1744 dnl ========================================================
1745 MOZ_ARG_ENABLE_BOOL(valgrind,
1746 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
1749 if test -n "$MOZ_VALGRIND"; then
1750 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
1752 [--enable-valgrind specified but Valgrind is not installed]))
1753 AC_DEFINE(MOZ_VALGRIND)
1755 AC_SUBST(MOZ_VALGRIND)
1757 dnl ========================================================
1759 dnl ========================================================
1760 MOZ_ARG_ENABLE_BOOL(jprof,
1761 [ --enable-jprof Enable jprof profiling tool (needs mozilla/tools/jprof). Implies --enable-profiling.],
1764 if test -n "$MOZ_JPROF"; then
1766 AC_DEFINE(MOZ_JPROF)
1769 dnl ========================================================
1771 dnl ========================================================
1772 MOZ_ARG_ENABLE_BOOL(shark,
1773 [ --enable-shark Enable shark remote profiling. Implies --enable-profiling.],
1776 if test -n "$MOZ_SHARK"; then
1778 AC_DEFINE(MOZ_SHARK)
1781 dnl ========================================================
1783 dnl ========================================================
1784 MOZ_ARG_ENABLE_BOOL(instruments,
1785 [ --enable-instruments Enable instruments remote profiling. Implies --enable-profiling.],
1788 if test -n "$MOZ_INSTRUMENTS"; then
1790 AC_DEFINE(MOZ_INSTRUMENTS)
1793 dnl ========================================================
1795 dnl ========================================================
1796 MOZ_ARG_ENABLE_BOOL(callgrind,
1797 [ --enable-callgrind Enable callgrind profiling. Implies --enable-profiling.],
1800 if test -n "$MOZ_CALLGRIND"; then
1802 AC_DEFINE(MOZ_CALLGRIND)
1805 dnl ========================================================
1807 dnl ========================================================
1808 MOZ_ARG_ENABLE_BOOL(vtune,
1809 [ --enable-vtune Enable vtune profiling. Implies --enable-profiling.],
1812 if test -n "$MOZ_VTUNE"; then
1814 AC_DEFINE(MOZ_VTUNE)
1817 dnl ========================================================
1819 dnl ========================================================
1820 if test -n "$MOZ_PROFILING"; then
1821 AC_DEFINE(MOZ_PROFILING)
1824 dnl ========================================================
1825 dnl System overrides of the defaults for host
1826 dnl ========================================================
1829 if test -n "$_WIN32_MSVC"; then
1831 HOST_AR_FLAGS='-NOLOGO -OUT:$@'
1832 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo"
1833 HOST_RANLIB='echo ranlib'
1835 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
1837 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -DNO_X11 -D_CRT_SECURE_NO_WARNINGS"
1838 HOST_NSPR_MDCPUCFG='\"md/_winnt.cfg\"'
1839 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1840 HOST_BIN_SUFFIX=.exe
1843 PERL="/bin/sh ${_topsrcdir}/build/msys-perl-wrapper"
1847 case "${host_cpu}" in
1849 if test -n "$_WIN32_MSVC"; then
1850 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
1854 if test -n "$_WIN32_MSVC"; then
1855 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
1857 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
1863 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX -DNO_X11"
1864 HOST_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
1865 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1868 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1869 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1870 HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
1871 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
1875 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
1876 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
1880 dnl ==============================================================
1881 dnl Get mozilla version from central milestone file
1882 dnl ==============================================================
1883 MOZILLA_VERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir`
1884 MOZILLA_UAVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --uaversion`
1885 MOZILLA_SYMBOLVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --symbolversion`
1887 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
1888 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
1889 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
1890 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION_U,$MOZILLA_UAVERSION)
1891 AC_SUBST(MOZILLA_SYMBOLVERSION)
1892 AC_SUBST(MOZILLA_UAVERSION)
1893 AC_SUBST(MOZILLA_UAVERSION_U)
1895 dnl ========================================================
1896 dnl Get Firefox compatibility version we claim in our UA
1897 dnl ========================================================
1898 MOZILLA_COMPATVERSION=`tail -n 1 "$_topsrcdir"/config/compatversion.txt 2>/dev/null || tail -1 "$_topsrcdir"/config/compatversion.txt`
1899 AC_DEFINE_UNQUOTED(MOZILLA_COMPATVERSION,"$MOZILLA_COMPATVERSION")
1900 AC_DEFINE_UNQUOTED(MOZILLA_COMPATVERSION_U,$MOZILLA_COMPATVERSION)
1901 AC_SUBST(MOZILLA_COMPATVERSION)
1902 AC_SUBST(MOZILLA_COMPATVERSION_U)
1904 MOZ_DOING_LTO(lto_is_enabled)
1906 dnl ========================================================
1907 dnl System overrides of the defaults for target
1908 dnl ========================================================
1913 if test ! "$GNU_CC"; then
1914 if test ! "$HAVE_64BIT_BUILD"; then
1915 # Compiling with Visual Age C++ object model compat is the
1916 # default. To compile with object model ibm, add
1917 # AIX_OBJMODEL=ibm to .mozconfig.
1918 if test "$AIX_OBJMODEL" = "ibm"; then
1919 CXXFLAGS="$CXXFLAGS -qobjmodel=ibm"
1926 AC_SUBST(AIX_OBJMODEL)
1927 DSO_LDOPTS='-qmkshrobj=1'
1928 DSO_CFLAGS='-qflag=w:w'
1930 LDFLAGS="$LDFLAGS -Wl,-brtl -blibpath:/usr/lib:/lib"
1932 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
1933 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
1934 if test "$COMPILE_ENVIRONMENT"; then
1937 AC_MSG_CHECKING([for IBM XLC/C++ compiler version >= 9.0.0.7])
1939 [#if (__IBMCPP__ < 900)
1940 #error "Bad compiler"
1942 _BAD_COMPILER=,_BAD_COMPILER=1)
1943 if test -n "$_BAD_COMPILER"; then
1945 AC_MSG_ERROR([IBM XLC/C++ 9.0.0.7 or higher is required to build.])
1947 AC_MSG_RESULT([yes])
1950 TARGET_COMPILER_ABI="ibmc"
1951 CC_VERSION=`lslpp -Lcq vac.C 2>/dev/null | awk -F: '{ print $3 }'`
1952 CXX_VERSION=`lslpp -Lcq vacpp.cmp.core 2>/dev/null | awk -F: '{ print $3 }'`
1955 case "${target_os}" in
1960 if test "$COMPILE_ENVIRONMENT"; then
1961 MOZ_CHECK_HEADERS(sys/inttypes.h)
1963 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
1967 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1968 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
1969 MOZ_OPTIMIZE_FLAGS="-O3"
1970 # Statically disable jemalloc on 10.5 and 32-bit 10.6. See bug 702250.
1971 if test "$HAVE_64BIT_BUILD"; then
1976 STRIP_FLAGS="$STRIP_FLAGS -x -S"
1977 # Check whether we're targeting OS X or iOS
1978 AC_CACHE_CHECK(for iOS target,
1980 [AC_TRY_COMPILE([#include <TargetConditionals.h>
1981 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
1985 ac_cv_ios_target="yes",
1986 ac_cv_ios_target="no")])
1987 if test "$ac_cv_ios_target" = "yes"; then
1989 AC_DEFINE(XP_DARWIN)
1990 _PLATFORM_DEFAULT_TOOLKIT='cairo-uikit'
1992 AC_DEFINE(XP_MACOSX)
1993 AC_DEFINE(XP_DARWIN)
1994 _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
1995 # The ExceptionHandling framework is needed for Objective-C exception
1996 # logging code in nsObjCExceptions.h. Currently we only use that in debug
1998 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
2000 TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
2002 if test "x$lto_is_enabled" = "xyes"; then
2003 echo "Skipping -dead_strip because lto is enabled."
2004 dnl DTrace and -dead_strip don't interact well. See bug 403132.
2005 dnl ===================================================================
2006 elif test "x$enable_dtrace" = "xyes"; then
2007 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
2009 dnl check for the presence of the -dead_strip linker flag
2010 AC_MSG_CHECKING([for -dead_strip option to ld])
2011 _SAVE_LDFLAGS=$LDFLAGS
2012 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
2013 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
2014 if test -n "$_HAVE_DEAD_STRIP" ; then
2015 AC_MSG_RESULT([yes])
2016 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
2021 LDFLAGS=$_SAVE_LDFLAGS
2024 dnl With newer linkers we need to pass -allow_heap_execute because of
2025 dnl Microsoft Silverlight (5.1.10411.0 at least).
2026 AC_MSG_CHECKING([for -allow_heap_execute option to ld])
2027 _SAVE_LDFLAGS=$LDFLAGS
2028 LDFLAGS="$LDFLAGS -Wl,-allow_heap_execute"
2029 AC_TRY_LINK(,[return 0;],_HAVE_ALLOW_HEAP_EXECUTE=1,
2030 _HAVE_ALLOW_HEAP_EXECUTE=)
2031 if test -n "$_HAVE_ALLOW_HEAP_EXECUTE" ; then
2032 AC_MSG_RESULT([yes])
2033 MOZ_ALLOW_HEAP_EXECUTE_FLAGS="-Wl,-allow_heap_execute"
2037 LDFLAGS=$_SAVE_LDFLAGS
2039 MOZ_FIX_LINK_PATHS='-Wl,-executable_path,$(LIBXUL_DIST)/bin'
2044 if test ! "$GNU_CC"; then
2048 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -o $@'
2049 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_LDOPTS) -o $@'
2050 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2053 MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2054 MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
2057 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2058 AC_DEFINE(_LARGEFILE64_SOURCE)
2063 if test ! "$GNU_CC"; then
2064 DSO_LDOPTS='-b -Wl,+s'
2067 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -o $@'
2068 MKCSHLIB='$(LD) -b +s -L$(LIBXUL_DIST)/bin -o $@'
2069 CXXFLAGS="$CXXFLAGS -Wc,-ansi_for_scope,on"
2071 DSO_LDOPTS='-b -E +s'
2072 MKSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2073 MKCSHLIB='$(LD) $(DSO_LDOPTS) -L$(LIBXUL_DIST)/bin -L$(LIBXUL_DIST)/lib -o $@'
2075 MOZ_POST_PROGRAM_COMMAND='chatr +s enable'
2076 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2079 *-android*|*-linuxandroid*)
2080 AC_DEFINE(NO_PW_GECOS)
2082 if test -n "$gonkdir"; then
2083 _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
2084 _PLATFORM_HAVE_RIL=1
2088 _PLATFORM_DEFAULT_TOOLKIT=cairo-android
2091 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2093 MOZ_GFX_OPTIMIZE_MOBILE=1
2094 MOZ_OPTIMIZE_FLAGS="-O2 -fno-reorder-functions"
2095 if test -z "$CLANG_CC"; then
2096 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
2101 # Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
2102 # Similarly for GNU_CXX and INTEL_CXX.
2103 if test "$INTEL_CC" -o "$INTEL_CXX"; then
2104 # -Os has been broken on Intel's C/C++ compilers for quite a
2105 # while; Intel recommends against using it.
2106 MOZ_OPTIMIZE_FLAGS="-O2"
2107 elif test "$GNU_CC" -o "$GNU_CXX"; then
2108 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
2109 MOZ_OPTIMIZE_FLAGS="-O2"
2110 if test -z "$CLANG_CC"; then
2111 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
2115 TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
2119 case "${target_cpu}" in
2121 CFLAGS="$CFLAGS -mieee"
2122 CXXFLAGS="$CXXFLAGS -mieee"
2126 if test -z "$MC"; then
2136 # certain versions of cygwin's makedepend barf on the
2137 # #include <string> vs -I./dist/include/string issue so don't use it
2138 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
2140 CXX="$CXX -mwindows"
2141 CPP="$CPP -mwindows"
2142 CFLAGS="$CFLAGS -mms-bitfields"
2143 CXXFLAGS="$CXXFLAGS -mms-bitfields"
2144 DSO_LDOPTS='-shared'
2145 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
2146 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
2148 # Use static libgcc and libstdc++
2149 LDFLAGS="$LDFLAGS -static"
2150 NSPR_LDFLAGS="$NSPR_LDFLAGS -static-libgcc"
2151 # Use temp file for windres (bug 213281)
2152 RCFLAGS='-O coff --use-temp-file'
2153 # mingw doesn't require kernel32, user32, and advapi32 explicitly
2154 LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32 -lnetapi32"
2159 WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
2160 WIN32_GUI_EXE_LDFLAGS=-mwindows
2162 # We use mix of both POSIX and Win32 printf format across the tree, so format
2163 # warnings are useless on mingw.
2164 MOZ_C_SUPPORTS_WARNING(-Wno-, format, ac_c_has_wno_format)
2165 MOZ_CXX_SUPPORTS_WARNING(-Wno-, format, ac_cxx_has_wno_format)
2167 TARGET_COMPILER_ABI=msvc
2171 if test "$AS_BIN"; then
2172 AS="$(basename "$AS_BIN")"
2175 AR_FLAGS='-NOLOGO -OUT:$@'
2177 RANLIB='echo not_ranlib'
2178 STRIP='echo not_strip'
2189 IMPORT_LIB_SUFFIX=lib
2190 MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2191 MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
2193 MKSHLIB_UNFORCE_ALL=
2194 dnl Set subsystem version 6.
2195 WIN32_SUBSYSTEM_VERSION=6.00
2196 WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
2197 WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
2198 DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
2199 _USE_CPP_INCLUDE_FLAG=1
2200 _DEFINES_CFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2201 _DEFINES_CXXFLAGS='-FI $(DEPTH)/dist/include/mozilla-config.h -DMOZILLA_CLIENT'
2202 CFLAGS="$CFLAGS -W3 -Gy"
2203 CXXFLAGS="$CXXFLAGS -W3 -Gy"
2204 dnl VS2013+ requires -FS when parallel building by make -jN.
2205 dnl If nothing, compiler sometimes causes C1041 error.
2206 CFLAGS="$CFLAGS -FS"
2207 CXXFLAGS="$CXXFLAGS -FS"
2208 # khuey says we can safely ignore MSVC warning C4251
2209 # MSVC warning C4244 (implicit type conversion may lose data) warns
2210 # and requires workarounds for perfectly valid code. Also, GCC/clang
2211 # don't warn about it by default. So for consistency/sanity, we turn
2212 # it off on MSVC, too.
2213 # MSVC warning C4267 warns for narrowing type conversions from size_t
2214 # to 32-bit integer types on 64-bit platforms. Since this is virtually
2215 # the same thing as C4244, we disable C4267, too.
2216 # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
2217 # MSVC warning C4351 warns of newly conformant behavior as of VS2005.
2218 # MSVC warning C4482 warns when an enum value is refered specifing the
2219 # name of the enum itself. This behavior is allowed in C++11, and the
2220 # warning has been removed in VS2012.
2221 # MSVC warning C4800 warns when a value is implicitly cast to bool,
2222 # because this also forces narrowing to a single byte, which can be a
2223 # perf hit. But this matters so little in practice (and often we want
2224 # that behavior) that it's better to turn it off.
2225 # MSVC warning C4819 warns some UTF-8 characters (e.g. copyright sign)
2226 # on non-Western system locales even if it is in a comment.
2227 CFLAGS="$CFLAGS -wd4244 -wd4267 -wd4819"
2228 CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4267 -wd4345 -wd4351 -wd4482 -wd4800 -wd4819"
2229 if test -n "$CLANG_CL"; then
2230 # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
2231 CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
2233 # make 'foo == bar;' error out
2234 CFLAGS="$CFLAGS -we4553"
2235 CXXFLAGS="$CXXFLAGS -we4553"
2236 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib netapi32.lib"
2237 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
2238 WARNINGS_AS_ERRORS='-WX'
2239 MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
2241 MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
2242 # Don't enable these flags on clang-cl since it doesn't ignore unknown arguments by default, and
2243 # autoconf insists on passing $LDFLAGS to the compiler.
2244 if test -z "$CLANG_CL"; then
2245 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT -OPT:REF -OPT:ICF=15"
2246 if test -z "$DEVELOPER_OPTIONS"; then
2247 LDFLAGS="$LDFLAGS -RELEASE"
2250 dnl For profile-guided optimization
2251 PROFILE_GEN_CFLAGS="-GL"
2252 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
2253 dnl XXX: PGO builds can fail with warnings treated as errors,
2254 dnl specifically "no profile data available" appears to be
2255 dnl treated as an error sometimes. This might be a consequence
2256 dnl of using WARNINGS_AS_ERRORS in some modules, combined
2257 dnl with the linker doing most of the work in the whole-program
2258 dnl optimization/PGO case. I think it's probably a compiler bug,
2259 dnl but we work around it here.
2260 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
2261 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
2262 dnl Probably also a compiler bug, but what can you do?
2263 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
2264 LDFLAGS="$LDFLAGS -DYNAMICBASE"
2265 if test "$_CC_MAJOR_VERSION" = "18" -a "$_CC_BUILD_VERSION" = "31101"; then
2266 dnl Use MaxILKSize as a workaround for LNK1248 in VS2013update4
2267 dnl See https://connect.microsoft.com/VisualStudio/feedback/details/1044914/fatal-error-lnk1248
2268 LDFLAGS="$LDFLAGS -MaxILKSize:0x7FF00000"
2270 dnl Minimum reqiurement of Goanna is VS2010 or later which supports
2271 dnl both SSSE3 and SSE4.1.
2272 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
2273 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
2274 dnl allow AVX2 code from VS2012
2278 AC_DEFINE(HAVE_SNPRINTF)
2283 AC_DEFINE(HW_THREADS)
2284 AC_DEFINE(STDC_HEADERS)
2285 AC_DEFINE(WIN32_LEAN_AND_MEAN)
2286 TARGET_MD_ARCH=win32
2287 _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
2289 MOZ_USER_DIR="Mozilla"
2291 dnl Hardcode to win95 for now - cls
2292 TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
2294 dnl set NO_X11 defines here as the general check is skipped on win32
2300 if test -n "$L10NBASEDIR"; then
2301 L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
2308 if test -z "$MOZ_TOOLS"; then
2309 AC_MSG_ERROR([MOZ_TOOLS is not set])
2311 MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
2312 if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
2313 AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
2315 MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
2316 if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
2317 AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
2324 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.])
2330 if test "$HAVE_64BIT_BUILD"; then
2331 AC_MSG_ERROR([You are targeting i386 but using the 64-bit compiler.])
2334 if test -n "$GNU_CC"; then
2335 CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
2336 CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
2337 LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup -Wl,--large-address-aware"
2339 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
2340 # Disable this flag on clang-cl since it doesn't ignore unknown arguments by default, and
2341 # autoconf insists on passing $LDFLAGS to the compiler.
2342 if test -z "$CLANG_CL"; then
2343 LDFLAGS="$LDFLAGS -SAFESEH"
2350 if test -z "$HAVE_64BIT_BUILD"; then
2351 AC_MSG_ERROR([You are targeting 64-bit but using the 32-bit compiler.])
2353 if test -n "$_WIN32_MSVC"; then
2354 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
2359 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
2366 CFLAGS="$CFLAGS -Dunix"
2367 CXXFLAGS="$CXXFLAGS -Dunix"
2368 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
2370 DSO_PIC_CFLAGS='-fPIC -DPIC'
2371 DSO_LDOPTS='-shared'
2372 BIN_FLAGS='-Wl,--export-dynamic'
2374 DSO_PIC_CFLAGS='-fPIC -DPIC'
2375 DLL_SUFFIX=".so.1.0"
2376 DSO_LDOPTS='-shared'
2378 # This will fail on a.out systems prior to 1.5.1_ALPHA.
2379 MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
2380 MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
2381 if test "$LIBRUNPATH"; then
2382 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
2384 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
2385 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
2389 if test "$SO_VERSION"; then
2390 DLL_SUFFIX=".so.$SO_VERSION"
2392 DLL_SUFFIX=".so.1.0"
2394 MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib -Wl,-rpath-link,$(if $(X11BASE),$(X11BASE),/usr/X11R6)/lib'
2396 DSO_PIC_CFLAGS='-fPIC'
2397 DSO_LDOPTS='-shared -fPIC'
2398 if test "$LIBRUNPATH"; then
2399 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
2405 TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
2407 # $ORIGIN/.. is for shared libraries under components/ to locate shared
2408 # libraries one level up (e.g. libnspr4.so)
2409 if test "$SOLARIS_SUNPRO_CC"; then
2410 LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
2411 LIBS="-lCrun -lCstd -lc $LIBS"
2412 AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
2413 CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
2414 CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions,no%except -norunpath -D__FUNCTION__=__func__ -template=no%extdef"
2415 LDFLAGS="-xildoff $LDFLAGS"
2416 MMX_FLAGS="-xarch=mmx -xO4"
2417 SSE_FLAGS="-xarch=sse"
2418 SSE2_FLAGS="-xarch=ssei2 -xO4"
2419 if test -z "$CROSS_COMPILE" -a -f /usr/lib/ld/map.noexstk; then
2420 _SAVE_LDFLAGS=$LDFLAGS
2421 LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
2422 AC_TRY_LINK([#include <stdio.h>],
2423 [printf("Hello World\n");],
2425 [LDFLAGS=$_SAVE_LDFLAGS])
2427 MOZ_OPTIMIZE_FLAGS="-xO4"
2428 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
2429 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
2430 MKSHLIB_FORCE_ALL='-z allextract'
2431 MKSHLIB_UNFORCE_ALL='-z defaultextract'
2438 AS='/usr/ccs/bin/as'
2439 ASFLAGS="$ASFLAGS -K PIC -L -P -D_ASM -D__STDC__=0"
2441 TARGET_COMPILER_ABI="sunc"
2442 CC_VERSION=`$CC -V 2>&1 | grep '^cc:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2443 CXX_VERSION=`$CXX -V 2>&1 | grep '^CC:' 2>/dev/null | $AWK -F\: '{ print $2 }'`
2444 AC_MSG_CHECKING([for Sun C++ compiler version >= 5.9])
2448 [#if (__SUNPRO_CC < 0x590)
2451 _BAD_COMPILER=,_BAD_COMPILER=1)
2452 if test -n "$_BAD_COMPILER"; then
2454 AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
2459 [#if (__SUNPRO_CC >= 0x5100)
2460 #error "Sun C++ 5.10 or above"
2462 _ABOVE_SS12U1=,_ABOVE_SS12U1=1)
2463 if test "$_ABOVE_SS12U1"; then
2465 CXXFLAGS="$CXXFLAGS -xannotate=no"
2467 AC_MSG_RESULT([$_res])
2470 LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
2472 MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
2473 MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
2474 ASFLAGS="$ASFLAGS -fPIC"
2475 DSO_LDOPTS='-shared'
2476 WARNINGS_AS_ERRORS='-Werror'
2478 _WARNINGS_CXXFLAGS=''
2479 if test "$OS_RELEASE" = "5.3"; then
2480 AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
2483 if test "$OS_RELEASE" = "5.5.1"; then
2484 AC_DEFINE(NEED_USLEEP_PROTOTYPE)
2489 DSO_LDOPTS='-Bdynamic'
2490 MKSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2491 MKCSHLIB='-$(LD) $(DSO_LDOPTS) -o $@'
2493 AC_DEFINE(SPRINTF_RETURNS_STRING)
2494 case "$(target_os)" in
2496 DLL_SUFFIX='.so.1.0'
2503 AC_SUBST_LIST(MMX_FLAGS)
2504 AC_SUBST_LIST(SSE_FLAGS)
2505 AC_SUBST_LIST(SSE2_FLAGS)
2509 # Includes linux-android
2514 AC_SUBST(MOZ_LINKER)
2515 if test -n "$MOZ_LINKER"; then
2516 AC_DEFINE(MOZ_LINKER)
2519 dnl Only one oddball right now (QNX), but this gives us flexibility
2520 dnl if any other platforms need to override this in the future.
2521 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
2523 dnl ========================================================
2524 dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
2525 dnl by now will not have any way to link most binaries (tests
2526 dnl as well as viewer, apprunner, etc.), because some symbols
2527 dnl will be left out of the "composite" .so's by ld as unneeded.
2528 dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
2529 dnl they can link in the static libs that provide the missing
2531 dnl ========================================================
2532 NO_LD_ARCHIVE_FLAGS=
2533 if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
2534 NO_LD_ARCHIVE_FLAGS=1
2538 NO_LD_ARCHIVE_FLAGS=
2541 if test -z "$GNU_CC"; then
2542 NO_LD_ARCHIVE_FLAGS=
2546 AC_SUBST(NO_LD_ARCHIVE_FLAGS)
2548 dnl ========================================================
2549 dnl = Flags to strip unused symbols from .so components and
2550 dnl = to export jemalloc symbols when linking a program
2551 dnl ========================================================
2553 *-linux*|*-kfreebsd*-gnu|*-gnu*)
2554 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2557 if test -z "$GNU_CC"; then
2558 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-M $(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2560 if test -z "$GCC_USE_GNU_LD"; then
2561 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-M -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-mapfile'
2563 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2568 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
2571 if test -n "$GNU_CC"; then
2572 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
2577 if test -z "$COMPILE_ENVIRONMENT"; then
2578 SKIP_COMPILER_CHECKS=1
2579 SKIP_LIBRARY_CHECKS=1
2584 if test -z "$SKIP_COMPILER_CHECKS"; then
2585 dnl Checks for typedefs, structures, and compiler characteristics.
2586 dnl ========================================================
2602 dnl Check for .hidden assembler directive and visibility attribute.
2603 dnl Borrowed from glibc configure.in
2604 dnl ===============================================================
2605 if test "$GNU_CC" -a "$OS_TARGET" != WINNT; then
2606 AC_DEFINE(HAVE_VISIBILITY_HIDDEN_ATTRIBUTE)
2607 AC_DEFINE(HAVE_VISIBILITY_ATTRIBUTE)
2608 case "$OS_TARGET" in
2610 VISIBILITY_FLAGS='-fvisibility=hidden'
2613 VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(MOZILLA_DIR)/config/gcc_hidden.h'
2614 WRAP_SYSTEM_INCLUDES=1
2619 # visibility hidden flag for Sun Studio on Solaris
2620 if test "$SOLARIS_SUNPRO_CC"; then
2621 VISIBILITY_FLAGS='-xldscope=hidden'
2622 fi # Sun Studio on Solaris
2624 case "${OS_TARGET}" in
2625 WINNT|Darwin|Android)
2628 STL_FLAGS='-I$(DIST)/stl_wrappers'
2633 AC_SUBST(WRAP_SYSTEM_INCLUDES)
2634 AC_SUBST(VISIBILITY_FLAGS)
2638 dnl Checks for header files.
2639 dnl ========================================================
2641 case "$target_os" in
2643 # for stuff like -lXshm
2644 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
2647 MOZ_CHECK_COMMON_HEADERS
2649 dnl These are all the places some variant of statfs can be hiding.
2650 MOZ_CHECK_HEADERS(sys/statvfs.h sys/statfs.h sys/vfs.h sys/mount.h)
2653 MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
2654 MOZ_CHECK_HEADERS([linux/quota.h],,,[#include <sys/socket.h>])
2656 dnl SCTP support - needs various network include headers
2657 MOZ_CHECK_HEADERS([linux/if_addr.h linux/rtnetlink.h],,,[#include <sys/socket.h>])
2659 MOZ_CHECK_HEADERS(sys/types.h netinet/in.h byteswap.h)
2661 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
2662 AC_CACHE_CHECK(for sockaddr_in.sin_len,
2663 ac_cv_sockaddr_in_sin_len,
2664 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2665 #include <sys/types.h>
2667 #include <netinet/in.h>
2668 struct sockaddr_in x;
2669 void *foo = (void*) &x.sin_len;],
2671 [ac_cv_sockaddr_in_sin_len=true],
2672 [ac_cv_sockaddr_in_sin_len=false])])
2673 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
2674 AC_DEFINE(HAVE_SIN_LEN)
2675 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
2676 AC_DEFINE(HAVE_SCONN_LEN)
2679 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
2680 ac_cv_sockaddr_in6_sin6_len,
2681 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2682 #include <sys/types.h>
2684 #include <netinet/in.h>
2685 struct sockaddr_in6 x;
2686 void *foo = (void*) &x.sin6_len;],
2688 [ac_cv_sockaddr_in6_sin6_len=true],
2689 [ac_cv_sockaddr_in6_sin6_len=false])])
2690 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
2691 AC_DEFINE(HAVE_SIN6_LEN)
2694 AC_CACHE_CHECK(for sockaddr.sa_len,
2695 ac_cv_sockaddr_sa_len,
2696 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
2697 #include <sys/types.h>
2699 #include <sys/socket.h>
2701 void *foo = (void*) &x.sa_len;],
2703 [ac_cv_sockaddr_sa_len=true],
2704 [ac_cv_sockaddr_sa_len=false])])
2705 if test "$ac_cv_sockaddr_sa_len" = true ; then
2706 AC_DEFINE(HAVE_SA_LEN)
2709 MOZ_ARG_ENABLE_BOOL(dtrace,
2710 [ --enable-dtrace build with dtrace support if available (default=no)],
2711 [enable_dtrace="yes"],)
2712 if test "x$enable_dtrace" = "xyes"; then
2713 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
2714 if test -n "$HAVE_DTRACE"; then
2715 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
2717 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
2720 AC_SUBST(HAVE_DTRACE)
2726 MOZ_CHECK_HEADERS(sys/cdefs.h)
2730 MOZ_LINUX_PERF_EVENT
2732 dnl Checks for libraries.
2733 dnl ========================================================
2738 AC_CHECK_LIB(c_r, gethostbyname_r)
2742 dnl We don't want to link with libdl even if it's present on OS X, since
2743 dnl it's not used and not part of the default installation. OS/2 has dlfcn
2745 dnl We don't want to link against libm or libpthread on Darwin since
2746 dnl they both are just symlinks to libSystem and explicitly linking
2747 dnl against libSystem causes issues when debugging (see bug 299601).
2752 AC_SEARCH_LIBS(dlopen, dl,
2753 MOZ_CHECK_HEADER(dlfcn.h,
2754 AC_DEFINE(HAVE_DLOPEN)))
2758 _SAVE_CFLAGS="$CFLAGS"
2759 CFLAGS="$CFLAGS -D_GNU_SOURCE"
2760 AC_CHECK_FUNCS(dladdr memmem)
2761 CFLAGS="$_SAVE_CFLAGS"
2763 if test ! "$GNU_CXX"; then
2767 AC_CHECK_LIB(C_r, demangle)
2770 AC_CHECK_LIB(C, demangle)
2775 AC_CHECK_LIB(socket, socket)
2778 XLIBS="$X_EXTRA_LIBS"
2780 dnl ========================================================
2781 dnl Checks for X libraries.
2782 dnl Ordering is important.
2783 dnl Xt is dependent upon SM as of X11R6
2784 dnl ========================================================
2785 if test "$no_x" = "yes"; then
2788 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
2789 XLIBS="-lX11 $XLIBS"
2790 _SAVE_LDFLAGS="$LDFLAGS"
2791 LDFLAGS="$XLDFLAGS $LDFLAGS"
2792 AC_CHECK_LIB(X11, XDrawLines, [X11_LIBS="-lX11"],
2793 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
2794 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
2795 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
2797 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
2798 unset ac_cv_lib_Xt_XtFree
2799 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
2800 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
2801 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
2802 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
2805 # AIX needs the motif library linked before libXt to prevent
2806 # crashes in plugins linked against Motif - Bug #98892
2807 case "${target_os}" in
2809 XT_LIBS="-lXm $XT_LIBS"
2813 dnl ========================================================
2814 dnl = Check for XShm
2815 dnl ========================================================
2816 AC_CHECK_LIB(Xext, XShmCreateImage, _HAVE_XSHM_XEXT=1,,
2819 dnl ========================================================
2821 dnl ========================================================
2822 MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
2823 AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
2824 [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
2825 AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
2827 LDFLAGS="$_SAVE_LDFLAGS"
2830 AC_SUBST_LIST(XCFLAGS)
2831 AC_SUBST_LIST(XLDFLAGS)
2832 AC_SUBST_LIST(XLIBS)
2833 AC_SUBST_LIST(XEXT_LIBS)
2834 AC_SUBST_LIST(XT_LIBS)
2835 AC_SUBST_LIST(XSS_LIBS)
2837 dnl ========================================================
2838 dnl = pthread support
2839 dnl = Start by checking whether the system support pthreads
2840 dnl ========================================================
2841 case "$target_os" in
2846 AC_CHECK_LIB(pthreads, pthread_create,
2847 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
2848 AC_CHECK_LIB(pthread, pthread_create,
2849 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
2850 AC_CHECK_LIB(c_r, pthread_create,
2851 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
2852 AC_CHECK_LIB(c, pthread_create,
2861 dnl ========================================================
2862 dnl Check the command line for --with-pthreads
2863 dnl ========================================================
2864 MOZ_ARG_WITH_BOOL(pthreads,
2865 [ --with-pthreads Force use of system pthread library with NSPR ],
2866 [ if test "$MOZ_USE_PTHREADS"x = x; then
2867 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
2873 dnl ========================================================
2874 dnl Do the platform specific pthread hackery
2875 dnl ========================================================
2876 if test "$MOZ_USE_PTHREADS"x != x
2879 dnl See if -pthread is supported.
2882 ac_cv_have_dash_pthread=no
2883 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
2884 echo 'int main() { return 0; }' | cat > conftest.c
2885 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
2886 if test $? -eq 0; then
2887 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2888 ac_cv_have_dash_pthread=yes
2889 case "$target_os" in
2891 # Freebsd doesn't use -pthread for compiles, it uses them for linking
2894 CFLAGS="$CFLAGS -pthread"
2895 CXXFLAGS="$CXXFLAGS -pthread"
2901 AC_MSG_RESULT($ac_cv_have_dash_pthread)
2904 dnl See if -pthreads is supported.
2906 ac_cv_have_dash_pthreads=no
2907 if test "$ac_cv_have_dash_pthread" = "no"; then
2908 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
2909 echo 'int main() { return 0; }' | cat > conftest.c
2910 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
2911 if test $? -eq 0; then
2912 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
2913 ac_cv_have_dash_pthreads=yes
2914 CFLAGS="$CFLAGS -pthreads"
2915 CXXFLAGS="$CXXFLAGS -pthreads"
2919 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
2924 AC_DEFINE(_REENTRANT)
2925 AC_DEFINE(_THREAD_SAFE)
2926 dnl -pthread links in -lpthread, so don't specify it explicitly.
2927 if test "$ac_cv_have_dash_pthread" = "yes"; then
2928 _PTHREAD_LDFLAGS="-pthread"
2932 *-*-openbsd*|*-*-bsdi*)
2933 AC_DEFINE(_REENTRANT)
2934 AC_DEFINE(_THREAD_SAFE)
2935 dnl -pthread links in -lc_r, so don't specify it explicitly.
2936 if test "$ac_cv_have_dash_pthread" = "yes"; then
2937 _PTHREAD_LDFLAGS="-pthread"
2941 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
2942 AC_DEFINE(_REENTRANT)
2946 AC_DEFINE(_REENTRANT)
2950 AC_DEFINE(_REENTRANT)
2954 AC_DEFINE(_REENTRANT)
2955 if test "$SOLARIS_SUNPRO_CC"; then
2956 CFLAGS="$CFLAGS -mt"
2957 CXXFLAGS="$CXXFLAGS -mt"
2961 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
2962 AC_SUBST(MOZ_USE_PTHREADS)
2966 dnl Checks for library functions.
2967 dnl ========================================================
2968 AC_PROG_GCC_TRADITIONAL
2970 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf)
2972 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
2973 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
2974 ac_cv_clock_monotonic,
2975 [for libs in "" -lrt; do
2978 AC_TRY_LINK([#include <time.h>],
2979 [ struct timespec ts;
2980 clock_gettime(CLOCK_MONOTONIC, &ts); ],
2981 ac_cv_clock_monotonic=$libs
2984 ac_cv_clock_monotonic=no)
2987 if test "$ac_cv_clock_monotonic" != "no"; then
2988 HAVE_CLOCK_MONOTONIC=1
2989 REALTIME_LIBS=$ac_cv_clock_monotonic
2990 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
2991 AC_SUBST(HAVE_CLOCK_MONOTONIC)
2992 AC_SUBST_LIST(REALTIME_LIBS)
2995 dnl check for wcrtomb/mbrtowc
2996 dnl =======================================================================
2997 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
3000 AC_CACHE_CHECK(for wcrtomb,
3002 [AC_TRY_LINK([#include <wchar.h>],
3003 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
3004 ac_cv_have_wcrtomb="yes",
3005 ac_cv_have_wcrtomb="no")])
3006 if test "$ac_cv_have_wcrtomb" = "yes"; then
3007 AC_DEFINE(HAVE_WCRTOMB)
3009 AC_CACHE_CHECK(for mbrtowc,
3011 [AC_TRY_LINK([#include <wchar.h>],
3012 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
3013 ac_cv_have_mbrtowc="yes",
3014 ac_cv_have_mbrtowc="no")])
3015 if test "$ac_cv_have_mbrtowc" = "yes"; then
3016 AC_DEFINE(HAVE_MBRTOWC)
3023 ac_cv_func_res_ninit,
3024 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
3025 dnl no need for res_ninit() on NetBSD and OpenBSD
3026 ac_cv_func_res_ninit=no
3030 #define _BSD_SOURCE 1
3032 #include <sys/types.h>
3033 #include <netinet/in.h>
3034 #include <arpa/nameser.h>
3037 [int foo = res_ninit(&_res);],
3038 [ac_cv_func_res_ninit=yes],
3039 [ac_cv_func_res_ninit=no])
3043 if test "$ac_cv_func_res_ninit" = "yes"; then
3044 AC_DEFINE(HAVE_RES_NINIT)
3045 dnl must add the link line we do something as foolish as this... dougt
3047 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
3048 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
3060 AC_CHECK_LIB(c, iconv, [ICONV_LIBS=],
3061 AC_CHECK_LIB(iconv, iconv, [ICONV_LIBS="-liconv"],
3062 AC_CHECK_LIB(iconv, libiconv, [ICONV_LIBS="-liconv"])))
3064 LIBS="$LIBS $ICONV_LIBS"
3073 iconv_t h = iconv_open("", "");
3074 iconv(h, NULL, NULL, NULL, NULL);
3077 [ac_cv_func_iconv=yes],
3078 [ac_cv_func_iconv=no]
3081 if test "$ac_cv_func_iconv" = "yes"; then
3082 AC_DEFINE(HAVE_ICONV)
3083 LIBICONV="$ICONV_LIBS"
3085 [for iconv() with const input],
3086 ac_cv_func_const_iconv,
3092 const char *input = "testing";
3093 iconv_t h = iconv_open("", "");
3094 iconv(h, &input, NULL, NULL, NULL);
3097 [ac_cv_func_const_iconv=yes],
3098 [ac_cv_func_const_iconv=no]
3101 if test "$ac_cv_func_const_iconv" = "yes"; then
3102 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
3110 AC_SUBST_LIST(ICONV_LIBS)
3116 dnl **********************
3117 dnl *** va_copy checks ***
3118 AC_CACHE_CHECK([for an implementation of va_copy()],
3120 [AC_TRY_COMPILE([#include <stdarg.h>
3122 void f (int i, ...) {
3123 va_list args1, args2;
3124 va_start (args1, i);
3125 va_copy (args2, args1);
3126 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3128 va_end (args1); va_end (args2);
3130 [f(0, 42); return 0],
3131 [ac_cv_va_copy=yes],
3135 AC_CACHE_CHECK([whether va_list can be copied by value],
3137 [AC_TRY_COMPILE([#include <stdarg.h>
3139 void f (int i, ...) {
3140 va_list args1, args2;
3141 va_start (args1, i);
3143 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3145 va_end (args1); va_end (args2);
3147 [f(0, 42); return 0],
3148 [ac_cv_va_val_copy=yes],
3149 [ac_cv_va_val_copy=no],
3152 if test "x$ac_cv_va_copy" = "xyes"; then
3153 AC_DEFINE(VA_COPY, va_copy)
3154 AC_DEFINE(HAVE_VA_COPY)
3157 if test "x$ac_cv_va_val_copy" = "xno"; then
3158 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
3161 dnl ===================================================================
3162 dnl ========================================================
3163 dnl Put your C++ language/feature checks below
3164 dnl ========================================================
3168 if test "$GNU_CC"; then
3169 if test "$CPU_ARCH" = "arm" ; then
3170 AC_CACHE_CHECK(for ARM EABI,
3174 #if defined(__ARM_EABI__)
3177 #error Not ARM EABI.
3180 ac_cv_gcc_arm_eabi="yes",
3181 ac_cv_gcc_arm_eabi="no")])
3182 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
3184 ARM_ABI_PREFIX=eabi-
3186 ARM_ABI_PREFIX=oabi-
3190 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
3193 dnl Check to see if we can resolve ambiguity with |using|.
3194 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
3195 ac_cv_cpp_ambiguity_resolving_using,
3196 [AC_TRY_COMPILE(class X {
3197 public: int go(const X&) {return 3;}
3198 int jo(const X&) {return 3;}
3200 class Y : public X {
3201 public: int go(int) {return 2;}
3202 int jo(int) {return 2;}
3204 private: using X::go;
3207 ac_cv_cpp_ambiguity_resolving_using=yes,
3208 ac_cv_cpp_ambiguity_resolving_using=no)])
3209 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
3210 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
3213 dnl See if a dynamic_cast to void* gives the most derived object.
3214 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
3215 ac_cv_cpp_dynamic_cast_void_ptr,
3216 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
3217 class Y { int j; public: virtual ~Y() { } };
3218 class Z : public X, public Y { int k; };
3224 return !((((void*)&mdo != (void*)subx) &&
3225 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
3226 (((void*)&mdo != (void*)suby) &&
3227 ((void*)&mdo == dynamic_cast<void*>(suby))));
3229 ac_cv_cpp_dynamic_cast_void_ptr=yes,
3230 ac_cv_cpp_dynamic_cast_void_ptr=no,
3231 ac_cv_cpp_dynamic_cast_void_ptr=no)])
3232 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
3233 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
3237 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
3238 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
3239 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
3241 _SAVE_LDFLAGS=$LDFLAGS
3242 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
3243 AC_CACHE_CHECK(for __thread keyword for TLS variables,
3244 ac_cv_thread_keyword,
3245 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
3246 [return tlsIsMainThread;],
3247 ac_cv_thread_keyword=yes,
3248 ac_cv_thread_keyword=no)])
3249 LDFLAGS=$_SAVE_LDFLAGS
3250 # The custom dynamic linker doesn't support TLS variables
3252 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
3253 # mips builds fail with TLS variables because of a binutils bug.
3255 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
3260 *-android*|*-linuxandroid*)
3267 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
3273 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
3274 if test -n "$MOZ_LINKER"; then
3275 if test "$CPU_ARCH" = arm; then
3276 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
3277 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
3278 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3279 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
3283 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
3284 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
3285 dnl Since the linker only understands the sysv ones, no need to build the
3286 dnl gnu style tables anyways.
3287 LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
3290 dnl The custom linker doesn't support text relocations, but NDK >= r6b
3291 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
3292 dnl We however want to avoid these text relocations, and this can be done
3293 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
3294 dnl doesn't contain anything at all, beside placeholders for some sections,
3295 dnl and crtbegin only contains a finalizer function that calls
3296 dnl __cxa_finalize. The custom linker actually takes care of calling
3297 dnl __cxa_finalize when the library doesn't call it itself, which makes it
3298 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
3299 dnl link crtbegin and crtend at all.
3300 if test -n "$MOZ_LINKER" -a "$OS_TARGET" = "Android"; then
3301 AC_CACHE_CHECK([whether the CRT objects have text relocations],
3302 ac_cv_crt_has_text_relocations,
3303 [echo 'int foo() { return 0; }' > conftest.cpp
3304 if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
3305 test -s conftest${DLL_SUFFIX}; then
3306 if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
3307 ac_cv_crt_has_text_relocations=yes
3309 ac_cv_crt_has_text_relocations=no
3312 AC_ERROR([couldn't compile a simple C file])
3315 if test "$ac_cv_crt_has_text_relocations" = yes; then
3316 dnl While we want libraries to skip the CRT files, we don't want
3317 dnl executables to be treated the same way. We thus set the flag
3318 dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
3319 dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
3320 dnl Using LDFLAGS in nspr is safe, since we only really build
3321 dnl libraries there.
3322 DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
3323 NSPR_LDFLAGS="$NSPR_LDFLAGS -nostartfiles"
3327 dnl Check for the existence of various allocation headers/functions
3329 MALLOC_HEADERS="malloc.h malloc_np.h malloc/malloc.h sys/malloc.h"
3332 for file in $MALLOC_HEADERS; do
3333 MOZ_CHECK_HEADER($file, [MALLOC_H=$file])
3334 if test "$MALLOC_H" != ""; then
3335 AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
3340 MOZ_CHECK_HEADERS(alloca.h)
3342 AC_CHECK_FUNCS(strndup posix_memalign memalign)
3344 AC_CHECK_FUNCS(malloc_usable_size)
3345 MALLOC_USABLE_SIZE_CONST_PTR=const
3346 MOZ_CHECK_HEADERS([malloc.h], [
3347 AC_MSG_CHECKING([whether malloc_usable_size definition can use const argument])
3348 AC_TRY_COMPILE([#include <malloc.h>
3350 size_t malloc_usable_size(const void *ptr);],
3351 [return malloc_usable_size(0);],
3352 AC_MSG_RESULT([yes]),
3354 MALLOC_USABLE_SIZE_CONST_PTR=)
3356 AC_DEFINE_UNQUOTED([MALLOC_USABLE_SIZE_CONST_PTR],[$MALLOC_USABLE_SIZE_CONST_PTR])
3359 dnl In newer bionic headers, valloc is built but not defined,
3360 dnl so we check more carefully here.
3361 AC_MSG_CHECKING([for valloc in malloc.h])
3362 AC_EGREP_HEADER(valloc, malloc.h,
3363 AC_DEFINE(HAVE_VALLOC)
3364 AC_MSG_RESULT([yes]),
3365 AC_MSG_RESULT([no]))
3367 AC_MSG_CHECKING([for valloc in unistd.h])
3368 AC_EGREP_HEADER(valloc, unistd.h,
3369 AC_DEFINE(HAVE_VALLOC)
3370 AC_MSG_RESULT([yes]),
3371 AC_MSG_RESULT([no]))
3373 dnl See if compiler supports some gcc-style attributes
3375 AC_CACHE_CHECK(for __attribute__((always_inline)),
3376 ac_cv_attribute_always_inline,
3377 [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
3379 ac_cv_attribute_always_inline=yes,
3380 ac_cv_attribute_always_inline=no)])
3382 AC_CACHE_CHECK(for __attribute__((malloc)),
3383 ac_cv_attribute_malloc,
3384 [AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
3386 ac_cv_attribute_malloc=yes,
3387 ac_cv_attribute_malloc=no)])
3389 AC_CACHE_CHECK(for __attribute__((warn_unused_result)),
3390 ac_cv_attribute_warn_unused,
3391 [AC_TRY_COMPILE([int f(void) __attribute__((warn_unused_result));],
3393 ac_cv_attribute_warn_unused=yes,
3394 ac_cv_attribute_warn_unused=no)])
3396 dnl End of C++ language/feature checks
3399 dnl ========================================================
3400 dnl = Internationalization checks
3401 dnl ========================================================
3403 dnl Internationalization and Locale support is different
3404 dnl on various UNIX platforms. Checks for specific i18n
3405 dnl features go here.
3407 dnl check for LC_MESSAGES
3408 AC_CACHE_CHECK(for LC_MESSAGES,
3409 ac_cv_i18n_lc_messages,
3410 [AC_TRY_COMPILE([#include <locale.h>],
3411 [int category = LC_MESSAGES;],
3412 ac_cv_i18n_lc_messages=yes,
3413 ac_cv_i18n_lc_messages=no)])
3414 if test "$ac_cv_i18n_lc_messages" = yes; then
3415 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
3418 AC_HAVE_FUNCS(localeconv)
3419 fi # ! SKIP_COMPILER_CHECKS
3422 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
3423 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
3424 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
3427 dnl Mozilla specific options
3428 dnl ========================================================
3429 dnl The macros used for command line options
3430 dnl are defined in build/autoconf/altoptions.m4.
3432 dnl If the compiler supports these attributes, define them as
3433 dnl convenience macros.
3434 if test "$ac_cv_attribute_malloc" = yes ; then
3435 AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
3437 AC_DEFINE(NS_ATTR_MALLOC,)
3440 if test "$ac_cv_attribute_warn_unused" = yes ; then
3441 AC_DEFINE(NS_WARN_UNUSED_RESULT, [__attribute__((warn_unused_result))])
3443 AC_DEFINE(NS_WARN_UNUSED_RESULT,)
3446 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
3447 dnl features that Windows actually does support.
3449 if test -n "$SKIP_COMPILER_CHECKS"; then
3450 dnl Windows has malloc.h
3451 AC_DEFINE(MALLOC_H, [<malloc.h>])
3452 AC_DEFINE(HAVE_FORCEINLINE)
3453 AC_DEFINE(HAVE_LOCALECONV)
3454 fi # SKIP_COMPILER_CHECKS
3456 dnl ========================================================
3458 dnl = Check for external package dependencies
3460 dnl ========================================================
3461 MOZ_ARG_HEADER(External Packages)
3463 MOZ_ARG_WITH_STRING(libxul-sdk,
3464 [ --with-libxul-sdk=PFX Use the libXUL SDK at <PFX>],
3465 AC_MSG_ERROR([--with-libxul-sdk is not supported anymore.]))
3467 LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
3468 AC_SUBST(LIBXUL_DIST)
3472 dnl set GRE_MILESTONE
3473 dnl ========================================================
3474 if test -n "$LIBXUL_SDK"; then
3475 GRE_MILESTONE=`$PYTHON "$_topsrcdir"/config/printconfigsetting.py "$LIBXUL_DIST"/bin/platform.ini Build Milestone`
3477 GRE_MILESTONE=`tail -n 1 "$_topsrcdir"/config/milestone.txt 2>/dev/null || tail -1 "$_topsrcdir"/config/milestone.txt`
3479 AC_SUBST(GRE_MILESTONE)
3481 # set RELEASE_BUILD and NIGHTLY_BUILD variables depending on the cycle we're in
3482 # The logic works like this:
3483 # - if we have "a1" in GRE_MILESTONE, we're building Nightly (define NIGHTLY_BUILD)
3484 # - otherwise, if we have "a" in GRE_MILESTONE, we're building Nightly or Aurora
3485 # - otherwise, we're building Release/Beta (define RELEASE_BUILD)
3486 case "$GRE_MILESTONE" in
3489 AC_DEFINE(NIGHTLY_BUILD)
3495 AC_DEFINE(RELEASE_BUILD)
3498 AC_SUBST(NIGHTLY_BUILD)
3499 AC_SUBST(RELEASE_BUILD)
3501 dnl ========================================================
3502 dnl system libevent Support
3503 dnl ========================================================
3504 MOZ_ARG_WITH_STRING(system-libevent,
3505 [ --with-system-libevent[=PFX]
3506 Use system libevent [installed at prefix PFX]],
3507 LIBEVENT_DIR=$withval)
3509 _SAVE_CFLAGS=$CFLAGS
3510 _SAVE_LDFLAGS=$LDFLAGS
3512 if test "$LIBEVENT_DIR" = yes; then
3513 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
3514 MOZ_NATIVE_LIBEVENT=1,
3517 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
3518 MOZ_NATIVE_LIBEVENT=
3519 elif test -z "$MOZ_NATIVE_LIBEVENT"; then
3520 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
3521 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
3522 MOZ_CHECK_HEADER(event.h,
3523 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
3524 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
3526 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
3527 AC_CHECK_LIB(event, event_init,
3528 [MOZ_NATIVE_LIBEVENT=1
3529 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
3530 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
3531 [MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
3533 CFLAGS=$_SAVE_CFLAGS
3534 LDFLAGS=$_SAVE_LDFLAGS
3537 AC_SUBST(MOZ_NATIVE_LIBEVENT)
3539 dnl ========================================================
3540 dnl = If NSS was not detected in the system,
3541 dnl = use the one in the source tree (mozilla/security/nss)
3542 dnl ========================================================
3544 MOZ_ARG_WITH_BOOL(system-nss,
3545 [ --with-system-nss Use system installed NSS],
3548 if test -n "$_USE_SYSTEM_NSS"; then
3549 AM_PATH_NSS(3.31.1, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
3552 if test -n "$MOZ_NATIVE_NSS"; then
3553 NSS_LIBS="$NSS_LIBS -lcrmf"
3555 NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
3557 if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT"; then
3559 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
3560 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
3561 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)ssl$NSS_VERSION.\$(LIB_SUFFIX) \
3562 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nss$NSS_VERSION.\$(LIB_SUFFIX) \
3563 \$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)nssutil$NSS_VERSION.\$(LIB_SUFFIX)"
3565 NSS_LIBS='-L$(LIBXUL_DIST)/lib'" -lcrmf -lsmime$NSS_VERSION -lssl$NSS_VERSION -lnss$NSS_VERSION -lnssutil$NSS_VERSION"
3569 dnl ======================
3571 dnl ======================
3573 AC_MSG_CHECKING([for YASM assembler])
3574 AC_CHECK_PROGS(YASM, yasm, "")
3576 if test -n "$YASM"; then
3577 dnl Pull out yasm's version string
3578 YASM_VERSION=`yasm --version | $AWK '/^yasm/ { print $2 }'`
3579 _YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
3580 _YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
3581 _YASM_RELEASE=` echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
3582 _YASM_BUILD=` echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
3585 if test -z "$SKIP_LIBRARY_CHECKS"; then
3586 dnl system JPEG support
3587 dnl ========================================================
3588 MOZ_ARG_WITH_STRING(system-jpeg,
3589 [ --with-system-jpeg[=PFX]
3590 Use system libjpeg [installed at prefix PFX]],
3593 _SAVE_CFLAGS=$CFLAGS
3594 _SAVE_LDFLAGS=$LDFLAGS
3596 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
3597 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
3598 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
3600 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
3603 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_NATIVE_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_NATIVE_JPEG=)
3606 if test "$MOZ_NATIVE_JPEG" = 1; then
3607 AC_TRY_COMPILE([ #include <stdio.h>
3608 #include <sys/types.h>
3609 #include <jpeglib.h> ],
3610 [ #if JPEG_LIB_VERSION < $MOZJPEG
3611 #error "Insufficient JPEG library version ($MOZJPEG required)."
3613 #ifndef JCS_EXTENSIONS
3614 #error "libjpeg-turbo JCS_EXTENSIONS required"
3618 AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
3620 CFLAGS=$_SAVE_CFLAGS
3621 LDFLAGS=$_SAVE_LDFLAGS
3624 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_NATIVE_JPEG" = 1; then
3625 MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
3626 MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
3628 fi # SKIP_LIBRARY_CHECKS
3630 dnl system ZLIB support
3631 dnl ========================================================
3632 MOZ_ZLIB_CHECK([1.2.3])
3634 if test "$MOZ_LINKER" = 1 -a "$MOZ_NATIVE_ZLIB" != 1; then
3635 AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
3640 if test -z "$SKIP_LIBRARY_CHECKS"; then
3641 dnl system BZIP2 Support
3642 dnl ========================================================
3643 MOZ_ARG_WITH_STRING(system-bz2,
3644 [ --with-system-bz2[=PFX]
3645 Use system libbz2 [installed at prefix PFX]],
3648 _SAVE_CFLAGS=$CFLAGS
3649 _SAVE_LDFLAGS=$LDFLAGS
3651 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
3652 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
3653 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
3655 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
3658 AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_NATIVE_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
3659 [MOZ_NATIVE_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
3661 CFLAGS=$_SAVE_CFLAGS
3662 LDFLAGS=$_SAVE_LDFLAGS
3665 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_NATIVE_BZ2" = 1; then
3666 MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
3667 MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
3670 dnl system WEBP Support
3671 dnl ========================================================
3672 MOZ_ARG_WITH_STRING(system-webp,
3673 [ --with-system-webp[=PFX]
3674 Use system libwebp [installed at prefix PFX]],
3677 _SAVE_CFLAGS=$CFLAGS
3678 _SAVE_LDFLAGS=$LDFLAGS
3680 if test -n "${WEBP_DIR}" -a "${WEBP_DIR}" != "yes"; then
3681 CFLAGS="-I${WEBP_DIR}/include $CFLAGS"
3682 LDFLAGS="-L${WEBP_DIR}/lib $LDFLAGS"
3684 if test -z "$WEBP_DIR" -o "$WEBP_DIR" = no; then
3687 AC_CHECK_LIB(webp, WebPGetDecoderVersion, [MOZ_NATIVE_WEBP=1 MOZ_WEBP_LIBS="-lwebp"],
3688 [MOZ_NATIVE_WEBP= MOZ_WEBP_CFLAGS= MOZ_WEBP_LIBS=])
3690 CFLAGS=$_SAVE_CFLAGS
3691 LDFLAGS=$_SAVE_LDFLAGS
3694 if test "${WEBP_DIR}" -a -d "${WEBP_DIR}" -a "$MOZ_NATIVE_WEBP" = 1; then
3695 MOZ_WEBP_CFLAGS="-I${WEBP_DIR}/include"
3696 MOZ_WEBP_LIBS="-L${WEBP_DIR}/lib ${MOZ_WEBP_LIBS}"
3699 dnl ========================================================
3700 dnl system PNG Support
3701 dnl ========================================================
3702 MOZ_ARG_WITH_STRING(system-png,
3703 [ --with-system-png[=PFX]
3704 Use system libpng [installed at prefix PFX]],
3707 _SAVE_CFLAGS=$CFLAGS
3708 _SAVE_LDFLAGS=$LDFLAGS
3710 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
3711 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
3712 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
3714 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
3717 AC_CHECK_LIB(png, png_get_valid, [MOZ_NATIVE_PNG=1 MOZ_PNG_LIBS="-lpng"],
3718 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
3719 AC_CHECK_LIB(png, png_get_acTL, ,
3720 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
3722 if test "$MOZ_NATIVE_PNG" = 1; then
3723 AC_TRY_COMPILE([ #include <stdio.h>
3724 #include <sys/types.h>
3726 [ #if PNG_LIBPNG_VER < $MOZPNG
3727 #error "Insufficient libpng version ($MOZPNG required)."
3729 #ifndef PNG_UINT_31_MAX
3730 #error "Insufficient libpng version."
3733 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
3735 CFLAGS=$_SAVE_CFLAGS
3736 LDFLAGS=$_SAVE_LDFLAGS
3739 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_NATIVE_PNG" = 1; then
3740 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
3741 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
3744 MOZ_PNG_ARM_NEON_CHECK=
3745 if test "$MOZ_NATIVE_PNG" != 1 -a "$CPU_ARCH" = "arm" ; then
3746 MOZ_ARG_ENABLE_STRING(png-arm-neon-support,
3747 [ --enable-png-arm-neon-support=TYPE
3751 nocheck (faster but unsafe)],
3752 [MOZ_PNG_ARM_NEON_SUPPORT=$enableval ] )
3753 case "$MOZ_PNG_ARM_NEON_SUPPORT" in
3755 # enable-png-arm-neon-support = no
3758 # enable-png-arm-neon-support = nocheck
3763 MOZ_PNG_ARM_NEON_CHECK=1
3768 AC_SUBST(MOZ_PNG_ARM_NEON_CHECK)
3770 fi # SKIP_LIBRARY_CHECKS
3772 AC_SUBST(MOZ_PNG_ARM_NEON)
3774 dnl ========================================================
3775 dnl system HunSpell Support
3776 dnl ========================================================
3777 MOZ_ARG_ENABLE_BOOL(system-hunspell,
3778 [ --enable-system-hunspell
3779 Use system hunspell (located with pkgconfig)],
3780 MOZ_NATIVE_HUNSPELL=1 )
3782 if test -n "$MOZ_NATIVE_HUNSPELL"; then
3783 PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
3786 AC_SUBST(MOZ_NATIVE_HUNSPELL)
3788 dnl ========================================================
3789 dnl system libffi Support
3790 dnl ========================================================
3793 MOZ_ARG_ENABLE_BOOL(shared-js,
3794 [ --enable-shared-js
3795 Create a shared JavaScript library.],
3796 JS_SHARED_LIBRARY=1,
3799 dnl ========================================================
3800 dnl Java SDK support
3801 dnl ========================================================
3804 MOZ_ARG_WITH_STRING(java-bin-path,
3805 [ --with-java-bin-path=dir
3806 Location of Java binaries (java, javac, jar)],
3807 JAVA_BIN_PATH=$withval)
3809 dnl ========================================================
3813 dnl ========================================================
3815 MOZ_ARG_HEADER(Application)
3818 MOZ_DISABLE_PARENTAL_CONTROLS=1
3819 ENABLE_SYSTEM_EXTENSION_DIRS=1
3820 MOZ_BRANDING_DIRECTORY=
3821 MOZ_OFFICIAL_BRANDING=
3824 MOZ_AUTH_EXTENSION=1
3829 MOZ_SAMPLE_TYPE_FLOAT32=
3830 MOZ_SAMPLE_TYPE_S16=
3834 if test -n "$MOZ_FMP4"; then
3842 MOZ_MEDIA_NAVIGATOR=
3847 MOZ_VPX_ERROR_CONCEALMENT=
3858 LIBJPEG_TURBO_ASFLAGS=
3859 LIBJPEG_TURBO_X86_ASM=
3860 LIBJPEG_TURBO_X64_ASM=
3861 LIBJPEG_TURBO_ARM_ASM=
3862 LIBJPEG_TURBO_ARM64_ASM=
3863 LIBJPEG_TURBO_MIPS_ASM=
3867 MOZ_PREF_EXTENSIONS=1
3868 MOZ_PROFILELOCKING=1
3873 MOZ_TOOLKIT_SEARCH=1
3875 MOZ_UNIVERSALCHARDET=1
3883 NECKO_PROTOCOLS_DEFAULT="about app data file ftp http res viewsource websocket wyciwyg device"
3884 if test -n "$MOZ_RTSP"; then
3885 NECKO_PROTOCOLS_DEFAULT="$NECKO_PROTOCOLS_DEFAULT rtsp"
3889 MOZ_USE_NATIVE_POPUP_WINDOWS=
3890 MOZ_ANDROID_HISTORY=
3893 MOZ_LOCALE_SWITCHER=
3894 MOZ_ANDROID_READING_LIST_SERVICE=
3895 MOZ_ANDROID_SEARCH_ACTIVITY=
3896 MOZ_ANDROID_DOWNLOADS_INTEGRATION=
3897 MOZ_ANDROID_MLS_STUMBLER=
3898 MOZ_ANDROID_SHARE_OVERLAY=
3902 MOZ_AUDIO_CHANNEL_MANAGER=
3904 MOZ_CONTENT_SANDBOX=
3909 case "$target_os" in
3912 AC_DEFINE(NS_ENABLE_TSF)
3917 *-android*|*-linuxandroid*)
3918 if test "$CPU_ARCH" = "arm" ; then
3923 MOZ_THEME_FASTSTRIPE=1
3931 MOZ_ARG_WITH_STRING(external-source-dir,
3932 [ --with-external-source-dir=dir
3933 External directory containing additional build files.],
3934 [ EXTERNAL_SOURCE_DIR=$withval])
3935 AC_SUBST(EXTERNAL_SOURCE_DIR)
3937 MOZ_ARG_ENABLE_STRING(application,
3938 [ --enable-application=APP
3942 tools/update-packaging (AUS-related packaging tools)],
3943 [ MOZ_BUILD_APP=$enableval ] )
3945 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
3946 [ --with-xulrunner-stub-name=appname Create the xulrunner stub with the given name],
3947 XULRUNNER_STUB_NAME=$withval)
3949 if test -z "$XULRUNNER_STUB_NAME"; then
3950 XULRUNNER_STUB_NAME=xulrunner-stub
3952 AC_SUBST(XULRUNNER_STUB_NAME)
3954 AC_MSG_CHECKING([for application to build])
3955 if test -z "$MOZ_BUILD_APP"; then
3956 AC_MSG_RESULT([browser])
3957 MOZ_BUILD_APP=browser
3959 # "mobile" no longer exists.
3960 if test "$MOZ_BUILD_APP" = "mobile" ; then
3961 AC_MSG_RESULT([none])
3962 AC_MSG_ERROR([--enable-application=mobile is no longer supported.])
3964 # Support comm-central.
3965 if test -n "$EXTERNAL_SOURCE_DIR" ; then
3966 MOZ_BUILD_APP="$EXTERNAL_SOURCE_DIR/$MOZ_BUILD_APP"
3967 MOZ_BUILD_APP=`${PYTHON} -c "import mozpack.path as mozpath; print(mozpath.relpath(\"${MOZ_BUILD_APP}\", \"${srcdir}\"))"`
3969 # We have a valid application only if it has a build.mk file in its top
3971 if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
3972 AC_MSG_RESULT([none])
3973 AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
3975 AC_MSG_RESULT([$MOZ_BUILD_APP])
3979 # The app update channel is 'default' when not supplied. The value is used in
3980 # the application's confvars.sh so it must be set before confvars.sh is called.
3981 MOZ_ARG_ENABLE_STRING([update-channel],
3982 [ --enable-update-channel=CHANNEL
3983 Select application update channel (default=default)],
3984 MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
3986 if test -z "$MOZ_UPDATE_CHANNEL"; then
3987 MOZ_UPDATE_CHANNEL=default
3989 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
3990 AC_SUBST(MOZ_UPDATE_CHANNEL)
3992 # Allow to specify a Mozilla API key file that contains the secret key to be
3993 # used for various Mozilla API requests.
3994 MOZ_ARG_WITH_STRING(mozilla-api-keyfile,
3995 [ --with-mozilla-api-keyfile=file Use the secret key contained in the given keyfile for Mozilla API requests],
3996 MOZ_MOZILLA_API_KEY=`cat $withval`)
3997 if test -z "$MOZ_MOZILLA_API_KEY"; then
3998 MOZ_MOZILLA_API_KEY=no-mozilla-api-key
4000 AC_SUBST(MOZ_MOZILLA_API_KEY)
4002 # Allow to specify a Google API key file that contains the secret key to be
4003 # used for various Google API requests.
4004 MOZ_ARG_WITH_STRING(google-api-keyfile,
4005 [ --with-google-api-keyfile=file Use the secret key contained in the given keyfile for Google API requests],
4006 MOZ_GOOGLE_API_KEY=`cat $withval`)
4007 if test -z "$MOZ_GOOGLE_API_KEY"; then
4008 MOZ_GOOGLE_API_KEY=no-google-api-key
4010 AC_SUBST(MOZ_GOOGLE_API_KEY)
4012 # Allow to specify a Google OAuth API key file that contains the client ID and
4013 # the secret key to be used for various Google OAuth API requests.
4014 MOZ_ARG_WITH_STRING(google-oauth-api-keyfile,
4015 [ --with-google-oauth-api-keyfile=file Use the client id and secret key contained in the given keyfile for Google OAuth API requests],
4016 [MOZ_GOOGLE_OAUTH_API_CLIENTID=`cat $withval | cut -f 1 -d " "`
4017 MOZ_GOOGLE_OAUTH_API_KEY=`cat $withval | cut -f 2 -d " "`])
4018 if test -z "$MOZ_GOOGLE_OAUTH_API_CLIENTID"; then
4019 MOZ_GOOGLE_OAUTH_API_CLIENTID=no-google-oauth-api-clientid
4020 MOZ_GOOGLE_OAUTH_API_KEY=no-google-oauth-api-key
4022 AC_SUBST(MOZ_GOOGLE_OAUTH_API_CLIENTID)
4023 AC_SUBST(MOZ_GOOGLE_OAUTH_API_KEY)
4025 # Allow specifying a Bing API key file that contains the client ID and the
4026 # secret key to be used for the Bing Translation API requests.
4027 MOZ_ARG_WITH_STRING(bing-api-keyfile,
4028 [ --with-bing-api-keyfile=file Use the client id and secret key contained in the given keyfile for Bing API requests],
4029 [MOZ_BING_API_CLIENTID=`cat $withval | cut -f 1 -d " "`
4030 MOZ_BING_API_KEY=`cat $withval | cut -f 2 -d " "`])
4031 if test -z "$MOZ_BING_API_CLIENTID"; then
4032 MOZ_BING_API_CLIENTID=no-bing-api-clientid
4033 MOZ_BING_API_KEY=no-bing-api-key
4035 AC_SUBST(MOZ_BING_API_CLIENTID)
4036 AC_SUBST(MOZ_BING_API_KEY)
4038 # Whether to include optional-but-large font files in the final APK.
4039 # We want this in mobile/android/confvars.sh, so it goes early.
4040 MOZ_ARG_DISABLE_BOOL(android-include-fonts,
4041 [ --disable-android-include-fonts
4042 Disable the inclusion of fonts into the final APK],
4043 MOZ_ANDROID_EXCLUDE_FONTS=1)
4045 if test -n "$MOZ_ANDROID_EXCLUDE_FONTS"; then
4046 AC_DEFINE(MOZ_ANDROID_EXCLUDE_FONTS)
4048 AC_SUBST(MOZ_ANDROID_EXCLUDE_FONTS)
4050 # Whether this APK is destined for resource constrained devices.
4051 # We want this in mobile/android/confvars.sh, so it goes early.
4052 MOZ_ARG_ENABLE_BOOL(android-resource-constrained,
4053 [ --enable-android-resource-constrained
4054 Exclude hi-res images and similar from the final APK],
4055 MOZ_ANDROID_RESOURCE_CONSTRAINED=1)
4057 if test -n "$MOZ_ANDROID_RESOURCE_CONSTRAINED"; then
4058 AC_DEFINE(MOZ_ANDROID_RESOURCE_CONSTRAINED)
4060 AC_SUBST(MOZ_ANDROID_RESOURCE_CONSTRAINED)
4062 # Allow the application to influence configure with a confvars.sh script.
4063 AC_MSG_CHECKING([if app-specific confvars.sh exists])
4064 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
4065 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
4066 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
4071 # Allow influencing configure with a defines.sh script.
4072 . "${srcdir}/build/defines.sh"
4074 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
4076 if test "$BUILDING_RELEASE"; then
4077 # Override value in defines.sh, if any
4078 EARLY_BETA_OR_EARLIER=
4079 elif test "$EARLY_BETA_OR_EARLIER"; then
4080 AC_DEFINE(EARLY_BETA_OR_EARLIER)
4082 AC_SUBST(EARLY_BETA_OR_EARLIER)
4084 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
4085 MOZ_ARG_WITH_STRING(app-name,
4086 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
4087 WITH_APP_NAME=$withval,
4090 if test -n "$WITH_APP_NAME" ; then
4091 MOZ_APP_NAME="$WITH_APP_NAME"
4094 MOZ_ARG_WITH_STRING(app-basename,
4095 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
4096 WITH_APP_BASENAME=$withval,
4099 if test -n "$WITH_APP_BASENAME" ; then
4100 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
4103 # Now is a good time to test for logic errors, define mismatches, etc.
4104 case "$MOZ_BUILD_APP" in
4106 if test "$LIBXUL_SDK"; then
4107 AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
4112 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
4113 # that haven't made a confvars.sh yet. Don't add new stuff here, use
4115 case "$MOZ_BUILD_APP" in
4117 AC_DEFINE(MOZ_PHOENIX)
4121 AC_DEFINE(MOZ_XULRUNNER)
4128 AC_DEFINE(MOZ_MULET)
4132 AC_SUBST(MOZ_BUILD_APP)
4133 AC_SUBST(MOZ_PHOENIX)
4134 AC_SUBST(MOZ_XULRUNNER)
4137 AC_SUBST(MOZ_B2G_VERSION)
4139 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
4141 case "$OS_TARGET" in
4142 WINNT|Darwin|Android)
4150 dnl ========================================================
4151 dnl Check Android SDK version depending on mobile target.
4152 dnl ========================================================
4154 if test -z "$gonkdir" ; then
4155 # Minimum Android SDK API Level we require.
4156 case "$MOZ_BUILD_APP" in
4158 android_min_api_level=20
4160 *-android*|*-linuxandroid*)
4164 AC_MSG_ERROR([You must specify --target=arm-linux-androideabi (or some other valid android target) when building with --enable-application=mobile/android. See https://wiki.mozilla.org/Mobile/Fennec/Android#Setup_Fennec_mozconfig for more information about the necessary options])
4170 MOZ_ANDROID_SDK($android_min_api_level)
4173 dnl ========================================================
4175 dnl = Toolkit Options
4177 dnl ========================================================
4178 MOZ_ARG_HEADER(Toolkit Options)
4180 dnl ========================================================
4181 dnl = Select the default toolkit
4182 dnl ========================================================
4183 MOZ_ARG_ENABLE_STRING(default-toolkit,
4184 [ --enable-default-toolkit=TK
4185 Select default toolkit
4186 Platform specific defaults:
4187 Mac OS X - cairo-cocoa
4188 Win32 - cairo-windows
4192 [ _DEFAULT_TOOLKIT=$enableval ],
4193 [ _DEFAULT_TOOLKIT=$_PLATFORM_DEFAULT_TOOLKIT])
4195 if test "$_DEFAULT_TOOLKIT" = "cairo-windows" \
4196 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2" \
4197 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
4198 -o "$_DEFAULT_TOOLKIT" = "cairo-gtk3" \
4199 -o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
4200 -o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
4201 -o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
4202 -o "$_DEFAULT_TOOLKIT" = "cairo-android" \
4203 -o "$_DEFAULT_TOOLKIT" = "cairo-gonk"
4205 dnl nglayout only supports building with one toolkit,
4206 dnl so ignore everything after the first comma (",").
4207 MOZ_WIDGET_TOOLKIT=`echo "$_DEFAULT_TOOLKIT" | sed -e "s/,.*$//"`
4209 AC_MSG_ERROR([You must specify a default toolkit (perhaps $_PLATFORM_DEFAULT_TOOLKIT).])
4212 MOZ_ARG_WITHOUT_BOOL(x,
4213 [ --without-x Build without X11],
4216 dnl ========================================================
4217 dnl = Enable the toolkit as needed =
4218 dnl ========================================================
4222 case "$MOZ_WIDGET_TOOLKIT" in
4225 MOZ_WIDGET_TOOLKIT=windows
4227 MOZ_INSTRUMENT_EVENT_LOOP=1
4228 if test -n "$GNU_CC"; then
4234 MOZ_WIDGET_TOOLKIT=gtk3
4237 MOZ_ENABLE_XREMOTE=1
4238 MOZ_GL_DEFAULT_PROVIDER=GLX
4244 TK_CFLAGS='$(MOZ_GTK3_CFLAGS)'
4246 AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4248 MOZ_INSTRUMENT_EVENT_LOOP=1
4251 cairo-gtk2|cairo-gtk2-x11)
4252 MOZ_WIDGET_TOOLKIT=gtk2
4255 MOZ_ENABLE_XREMOTE=1
4256 MOZ_GL_DEFAULT_PROVIDER=GLX
4262 TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
4263 TK_LIBS='$(MOZ_GTK2_LIBS)'
4264 AC_DEFINE(MOZ_WIDGET_GTK2)
4266 AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
4268 MOZ_INSTRUMENT_EVENT_LOOP=1
4272 MOZ_WIDGET_TOOLKIT=qt
4274 if test -z "$WITHOUT_X11"; then
4275 MOZ_ENABLE_XREMOTE=1
4276 MOZ_GL_DEFAULT_PROVIDER=GLX
4283 TK_CFLAGS='$(MOZ_QT_CFLAGS)'
4284 TK_LIBS='$(MOZ_QT_LIBS)'
4285 AC_DEFINE(MOZ_WIDGET_QT)
4287 AC_DEFINE(QT_NO_KEYWORDS)
4291 MOZ_WIDGET_TOOLKIT=cocoa
4292 AC_DEFINE(MOZ_WIDGET_COCOA)
4293 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
4294 # Use -Wl as a trick to avoid -framework and framework names from
4295 # being separated by AC_SUBST_LIST.
4296 TK_LIBS='-Wl,-framework,CoreLocation -Wl,-framework,QuartzCore -Wl,-framework,Carbon -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit -Wl,-framework,AddressBook -Wl,-framework,OpenGL'
4297 TK_CFLAGS="-DNO_X11"
4298 CFLAGS="$CFLAGS $TK_CFLAGS"
4299 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4300 MOZ_USER_DIR="Mozilla"
4301 MOZ_FS_LAYOUT=bundle
4302 MOZ_INSTRUMENT_EVENT_LOOP=1
4306 MOZ_WIDGET_TOOLKIT=uikit
4307 AC_DEFINE(MOZ_WIDGET_UIKIT)
4308 LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
4309 TK_CFLAGS="-DNO_X11"
4310 TK_LIBS='-Wl,-framework,Foundation -Wl,-framework,CoreFoundation -Wl,-framework,CoreGraphics -Wl,-framework,CoreText'
4311 CFLAGS="$CFLAGS $TK_CFLAGS"
4312 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
4313 MOZ_USER_DIR="Mozilla"
4314 MOZ_FS_LAYOUT=bundle
4318 AC_DEFINE(MOZ_WIDGET_ANDROID)
4319 MOZ_WIDGET_TOOLKIT=android
4320 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4321 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4323 MOZ_INSTRUMENT_EVENT_LOOP=1
4327 AC_DEFINE(MOZ_WIDGET_GONK)
4328 AC_DEFINE(MOZ_TOUCH)
4329 MOZ_WIDGET_TOOLKIT=gonk
4330 TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
4331 TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
4334 MOZ_INSTRUMENT_EVENT_LOOP=1
4339 AC_SUBST(MOZ_PDF_PRINTING)
4340 if test "$MOZ_PDF_PRINTING"; then
4341 PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
4342 AC_DEFINE(MOZ_PDF_PRINTING)
4345 if test "$MOZ_ENABLE_XREMOTE"; then
4346 AC_DEFINE(MOZ_ENABLE_XREMOTE)
4349 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
4350 AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
4353 if test "$COMPILE_ENVIRONMENT"; then
4354 if test "$MOZ_ENABLE_GTK3"; then
4355 PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 atk-bridge-2.0 $GDK_PACKAGES)
4356 MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
4357 dnl Contrary to MOZ_GTK2_LIBS, MOZ_GTK3_LIBS needs to be literally added to TK_LIBS instead
4358 dnl of a make reference because of how TK_LIBS is mangled in toolkit/library/moz.build
4359 dnl for GTK+3 builds.
4360 TK_LIBS=$MOZ_GTK3_LIBS
4361 GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32
4363 if test "$MOZ_ENABLE_GTK2"; then
4364 GLIB_VERSION_MAX_ALLOWED=$GLIB_VERSION_MIN_REQUIRED
4366 if test "$MOZ_ENABLE_GTK"; then
4367 if test "$MOZ_X11"; then
4368 GDK_PACKAGES=gdk-x11-2.0
4370 AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
4371 AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
4373 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 >= $GLIB_VERSION gobject-2.0 $GDK_PACKAGES)
4374 MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
4377 fi # COMPILE_ENVIRONMENT
4379 AC_SUBST(MOZ_FS_LAYOUT)
4381 dnl ========================================================
4382 dnl Use ARM userspace kernel helpers; tell NSPR to enable
4383 dnl their usage and use them in spidermonkey.
4384 dnl ========================================================
4385 MOZ_ARG_WITH_BOOL(arm-kuser,
4386 [ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
4388 if test -n "$USE_ARM_KUSER"; then
4389 AC_DEFINE(USE_ARM_KUSER)
4392 dnl ========================================================
4393 dnl = startup-notification support module
4394 dnl ========================================================
4396 if test "$MOZ_ENABLE_GTK"
4398 MOZ_ENABLE_STARTUP_NOTIFICATION=
4400 MOZ_ARG_ENABLE_BOOL(startup-notification,
4401 [ --enable-startup-notification
4402 Enable startup-notification support (default: disabled) ],
4403 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
4404 MOZ_ENABLE_STARTUP_NOTIFICATION=)
4405 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
4407 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
4408 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
4409 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
4410 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
4412 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
4414 MOZ_ENABLE_STARTUP_NOTIFICATION=
4418 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
4419 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
4422 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
4424 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
4426 dnl ========================================================
4427 dnl Disable printing
4428 dnl ========================================================
4429 MOZ_ARG_DISABLE_BOOL(printing,
4430 [ --disable-printing Disable printing support],
4434 if test "$NS_PRINTING"; then
4435 AC_DEFINE(NS_PRINTING)
4436 AC_DEFINE(NS_PRINT_PREVIEW)
4439 dnl ========================================================
4441 dnl ========================================================
4442 if test "$MOZ_ENABLE_QT"
4444 MOZ_ARG_WITH_STRING(qtdir,
4445 [ --with-qtdir=\$dir Specify Qt directory ],
4448 if test -z "$QTDIR"; then
4449 AC_CHECK_PROGS(HOST_QMAKE, $HOST_QMAKE qmake, "")
4451 HOST_QMAKE="$QTDIR/bin/qmake"
4453 QT_VERSION=`$HOST_QMAKE -v | grep 'Using Qt version' | egrep -o '[[0-9]]+\.[[0-9]]+\.[[0-9]]+'`
4455 if test -z "$QTDIR"; then
4458 AC_MSG_RESULT("Using qt5: $QT_VERSION")
4459 PKG_CHECK_MODULES(MOZ_QT, Qt5Gui Qt5Network Qt5Core Qt5Quick, ,
4461 AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase development packages, (On Ubuntu, you might try installing the packages qtbase5-dev libqt5opengl5-dev.)])
4463 QT5INCDIR=`pkg-config --variable=includedir Qt5Gui`
4464 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QT5INCDIR/QtGui/$QT_VERSION/QtGui"
4465 if test "$NS_PRINTING"; then
4466 PKG_CHECK_MODULES(MOZ_QT_WIDGETS, Qt5PrintSupport, ,
4468 AC_MSG_ERROR([$MOZ_QT_PKG_ERRORS Need qtbase widgets development package])
4470 MOZ_QT_LIBS="$MOZ_QT_LIBS $MOZ_QT_WIDGETS_LIBS"
4471 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $MOZ_QT_WIDGETS_CFLAGS"
4475 AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
4479 AC_CHECK_PROGS(HOST_MOC, $MOC moc, "")
4480 AC_CHECK_PROGS(HOST_RCC, $RCC rcc, "")
4482 MOZ_QT_CFLAGS="-DQT_SHARED"
4483 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
4484 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui"
4485 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtCore"
4486 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtNetwork"
4487 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtXml"
4488 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtDeclarative"
4491 AC_MSG_RESULT("Using qt5: $QT_VERSION")
4492 MOZ_QT_LIBS="$MOZ_QT_LIBS -L$QTDIR/lib/ -lQt5Gui -lQt5Network -lQt5Core -lQt5Xml"
4493 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtGui/$QT_VERSION/QtGui"
4494 if test "$NS_PRINTING"; then
4495 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQt5Widgets -lQt5PrintSupport"
4496 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtPrintSupport"
4500 AC_MSG_ERROR([* * * Unsupported Qt Version: $QT_VERSION])
4504 HOST_MOC="$QTDIR/bin/moc"
4505 HOST_RCC="$QTDIR/bin/rcc"
4507 if test -z "$HOST_MOC"; then
4508 AC_MSG_ERROR([No acceptable moc preprocessor found. Qt SDK is not installed or --with-qt is incorrect])
4510 if test -z "$HOST_RCC"; then
4511 AC_MSG_ERROR([No acceptable rcc preprocessor found. Qt SDK is not installed or --with-qt is incorrect])
4517 MOZ_ENABLE_QMSYSTEM2=
4518 PKG_CHECK_MODULES(_QMSYSTEM2, qmsystem2,
4519 MOZ_ENABLE_QMSYSTEM2=1,
4520 MOZ_ENABLE_QMSYSTEM2=)
4522 if test "$MOZ_ENABLE_QMSYSTEM2"; then
4523 MOZ_ENABLE_QMSYSTEM2=1
4524 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QMSYSTEM2_CFLAGS"
4525 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QMSYSTEM2_LIBS"
4526 AC_DEFINE(MOZ_ENABLE_QMSYSTEM2)
4529 MOZ_ENABLE_QTNETWORK=
4530 PKG_CHECK_MODULES(_QTNETWORK, QtNetwork >= 4.7,
4531 MOZ_ENABLE_QTNETWORK=1,
4532 MOZ_ENABLE_QTNETWORK=)
4534 if test "$MOZ_ENABLE_QTNETWORK"; then
4535 MOZ_ENABLE_QTNETWORK=1
4536 AC_DEFINE(MOZ_ENABLE_QTNETWORK)
4539 MOZ_ENABLE_QTMOBILITY=
4540 PKG_CHECK_MODULES(_QTMOBILITY, QtSensors QtFeedback QtLocation,
4541 MOZ_ENABLE_QTMOBILITY=1,
4542 MOZ_ENABLE_QTMOBILITY=)
4543 if test "$MOZ_ENABLE_QTMOBILITY"; then
4544 MOZ_ENABLE_QTMOBILITY=1
4545 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QTMOBILITY_CFLAGS"
4546 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QTMOBILITY_LIBS"
4547 AC_DEFINE(MOZ_ENABLE_QTMOBILITY)
4548 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4550 AC_CHECK_LIB(QtSensors, main, [
4551 MOZ_ENABLE_QTMOBILITY=1
4552 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtMobility"
4553 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtSensors"
4554 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtFeedback"
4555 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include/QtLocation"
4556 MOZ_QT_LIBS="$MOZ_QT_LIBS -lQtSensors -lQtFeedback -lQtLocation"
4560 MOZ_ENABLE_QT5FEEDBACK=
4561 PKG_CHECK_MODULES(_QT5FEEDBACK, Qt0Feedback,
4562 MOZ_ENABLE_QT5FEEDBACK=1,
4563 MOZ_ENABLE_QT5FEEDBACK=)
4564 if test "$MOZ_ENABLE_QT5FEEDBACK"; then
4565 MOZ_ENABLE_QT5FEEDBACK=1
4566 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QT5FEEDBACK_CFLAGS"
4567 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QT5FEEDBACK_LIBS"
4568 AC_DEFINE(MOZ_ENABLE_QT5FEEDBACK)
4569 AC_SUBST(MOZ_ENABLE_QT5FEEDBACK)
4572 MOZ_ENABLE_QT5GEOPOSITION=
4573 PKG_CHECK_MODULES(_QT5GEOPOSITION, Qt5Positioning,
4574 MOZ_ENABLE_QT5GEOPOSITION=1,
4575 MOZ_ENABLE_QT5GEOPOSITION=)
4576 if test "$MOZ_ENABLE_QT5GEOPOSITION"; then
4577 MOZ_ENABLE_QT5GEOPOSITION=1
4578 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_QT5GEOPOSITION_CFLAGS"
4579 MOZ_QT_LIBS="$MOZ_QT_LIBS $_QT5GEOPOSITION_LIBS"
4580 AC_DEFINE(MOZ_ENABLE_QT5GEOPOSITION)
4581 AC_SUBST(MOZ_ENABLE_QT5GEOPOSITION)
4584 if test "$MOZ_ENABLE_CONTENTACTION"; then
4585 MOZ_ENABLE_CONTENTACTION=1
4586 AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
4589 MOZ_ENABLE_CONTENTACTION=
4590 PKG_CHECK_MODULES(LIBCONTENTACTION, contentaction-0.1, _LIB_FOUND=1, _LIB_FOUND=)
4591 if test "$MOZ_ENABLE_CONTENTACTION"; then
4592 MOZ_ENABLE_CONTENTACTION=1
4593 MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS $_CONTENTACTION_CFLAGS"
4594 MOZ_QT_LIBS="$MOZ_QT_LIBS $_CONTENTACTION_LIBS"
4595 AC_DEFINE(MOZ_ENABLE_CONTENTACTION)
4596 AC_SUBST(MOZ_ENABLE_CONTENTACTION)
4600 AC_SUBST(GTK_CONFIG)
4601 AC_SUBST_LIST(TK_CFLAGS)
4602 AC_SUBST_LIST(TK_LIBS)
4604 AC_SUBST(MOZ_ENABLE_GTK2)
4605 AC_SUBST(MOZ_ENABLE_GTK3)
4606 AC_SUBST(MOZ_ENABLE_GTK)
4607 AC_SUBST(MOZ_ENABLE_QT)
4608 AC_SUBST(MOZ_ENABLE_QTNETWORK)
4609 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
4610 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
4611 AC_SUBST(MOZ_ENABLE_XREMOTE)
4612 AC_SUBST(MOZ_WIDGET_GTK)
4613 AC_SUBST_LIST(MOZ_QT_CFLAGS)
4614 AC_SUBST_LIST(MOZ_QT_LIBS)
4621 dnl ========================================================
4623 dnl = Components & Features
4625 dnl ========================================================
4626 MOZ_ARG_HEADER(Components and Features)
4628 dnl ========================================================
4630 dnl ========================================================
4631 MOZ_ARG_ENABLE_STRING(ui-locale,
4632 [ --enable-ui-locale=ab-CD
4633 Select the user interface locale (default: en-US)],
4634 MOZ_UI_LOCALE=$enableval )
4635 AC_SUBST(MOZ_UI_LOCALE)
4637 dnl ========================================================
4638 dnl = Vendor override
4639 dnl ========================================================
4640 MOZ_ARG_DISABLE_BOOL(official-vendor,
4641 [ --disable-official-vendor Disable the use of official vendor.],
4645 dnl ========================================================
4646 dnl = Trademarked Branding
4647 dnl ========================================================
4648 MOZ_ARG_ENABLE_BOOL(official-branding,
4649 [ --enable-official-branding
4650 Enable official branding
4651 Do not distribute builds with
4652 --enable-official-branding unless you have
4653 permission to use the name/logo per
4654 http://www.palemoon.org/redist.shtml .],
4656 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
4657 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
4659 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
4660 MOZ_OFFICIAL_BRANDING=1
4663 ], MOZ_OFFICIAL_BRANDING=)
4665 AC_SUBST(MC_OFFICIAL)
4666 if test -n "$MC_OFFICIAL"; then
4667 AC_DEFINE(MC_OFFICIAL)
4670 AC_SUBST(MOZ_OFFICIAL_BRANDING)
4671 if test -n "$MOZ_OFFICIAL_BRANDING"; then
4672 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
4675 MOZ_ARG_WITH_STRING(branding,
4676 [ --with-branding=dir Use branding from the specified directory.],
4677 MOZ_BRANDING_DIRECTORY=$withval)
4679 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
4680 if test -z "$REAL_BRANDING_DIRECTORY"; then
4681 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
4684 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4685 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
4686 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
4687 . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
4690 AC_SUBST(MOZ_BRANDING_DIRECTORY)
4692 dnl ========================================================
4694 dnl ========================================================
4695 MOZ_ARG_ENABLE_BOOL(private-build,
4696 [ --enable-private-build Enable private builds
4697 This allows you to build with official
4698 branding for personal use only using any
4699 build time configuration.],
4703 AC_SUBST(MC_PRIVATE_BUILD)
4704 if test -n "$MC_PRIVATE_BUILD"; then
4705 AC_DEFINE(MC_PRIVATE_BUILD)
4708 dnl ========================================================
4709 dnl = Distribution ID
4710 dnl ========================================================
4711 MOZ_ARG_WITH_STRING(distribution-id,
4712 [ --with-distribution-id=ID
4713 Set distribution-specific id (default=org.mozilla)],
4714 [ val=`echo $withval`
4715 MOZ_DISTRIBUTION_ID="$val"])
4717 if test -z "$MOZ_DISTRIBUTION_ID"; then
4718 MOZ_DISTRIBUTION_ID="org.mozilla"
4721 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
4722 AC_SUBST(MOZ_DISTRIBUTION_ID)
4725 dnl ========================================================
4726 dnl Google Play Services, placed here so it can depend on
4727 dnl values set by configure.sh above.
4728 dnl ========================================================
4730 MOZ_ANDROID_GOOGLE_PLAY_SERVICES
4733 dnl ========================================================
4735 dnl ========================================================
4736 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4738 PKG_CHECK_MODULES(_PANGOCHK, pango >= $PANGO_VERSION)
4740 PKG_CHECK_MODULES(MOZ_PANGO, pango >= $PANGO_VERSION pangoft2 >= $PANGO_VERSION pangocairo >= $PANGO_VERSION)
4743 dnl ========================================================
4744 dnl = GIO and GConf support module
4745 dnl ========================================================
4749 dnl build the GIO extension by default only when the
4750 dnl GTK2 toolkit is in use.
4751 if test "$MOZ_ENABLE_GTK"
4757 dnl ========================================================
4758 dnl = GIO support module
4759 dnl ========================================================
4760 MOZ_ARG_DISABLE_BOOL(gio,
4761 [ --disable-gio Disable GIO support],
4763 MOZ_ENABLE_GIO=force)
4765 if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK"
4767 if test "$MOZ_ENABLE_GTK2"
4769 PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
4770 [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
4772 PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
4773 MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
4775 AC_DEFINE(MOZ_ENABLE_GIO)
4777 if test "$MOZ_ENABLE_GIO" = "force"
4779 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
4785 AC_SUBST(MOZ_ENABLE_GIO)
4787 dnl ========================================================
4788 dnl = GConf support module
4789 dnl ========================================================
4790 MOZ_ARG_DISABLE_BOOL(gconf,
4791 [ --disable-gconf Disable Gconf support ],
4793 MOZ_ENABLE_GCONF=force)
4795 if test "$MOZ_ENABLE_GCONF"
4797 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
4798 MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
4801 if test "$MOZ_ENABLE_GCONF" = "force"
4803 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
4809 if test "$MOZ_ENABLE_GCONF"; then
4810 AC_DEFINE(MOZ_ENABLE_GCONF)
4813 AC_SUBST(MOZ_ENABLE_GCONF)
4816 dnl ========================================================
4817 dnl = libproxy support
4818 dnl ========================================================
4820 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4822 MOZ_ENABLE_LIBPROXY=
4824 MOZ_ARG_ENABLE_BOOL(libproxy,
4825 [ --enable-libproxy Enable libproxy support ],
4826 MOZ_ENABLE_LIBPROXY=1,
4827 MOZ_ENABLE_LIBPROXY=)
4829 if test "$MOZ_ENABLE_LIBPROXY"
4831 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
4832 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
4835 AC_SUBST(MOZ_ENABLE_LIBPROXY)
4837 dnl ========================================================
4838 dnl = GNOME component (mozgnome)
4839 dnl ========================================================
4841 if test "$MOZ_ENABLE_GTK"
4843 MOZ_ENABLE_GNOME_COMPONENT=1
4845 AC_SUBST(MOZ_ENABLE_GNOME_COMPONENT)
4847 dnl ========================================================
4848 dnl = libgnomeui support module
4849 dnl ========================================================
4851 if test "$MOZ_ENABLE_GTK"
4853 MOZ_ARG_ENABLE_BOOL(gnomeui,
4854 [ --enable-gnomeui Enable libgnomeui instead of GIO & GTK for icon theme support ],
4855 MOZ_ENABLE_GNOMEUI=force,
4856 MOZ_ENABLE_GNOMEUI=)
4858 if test "$MOZ_ENABLE_GNOMEUI"
4860 PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
4862 MOZ_ENABLE_GNOMEUI=1
4864 if test "$MOZ_ENABLE_GNOMEUI" = "force"
4866 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
4872 if test "$MOZ_ENABLE_GNOMEUI"; then
4873 AC_DEFINE(MOZ_ENABLE_GNOMEUI)
4877 AC_SUBST(MOZ_ENABLE_GNOMEUI)
4879 dnl ========================================================
4881 dnl ========================================================
4883 if test "$MOZ_ENABLE_GTK" -o "$MOZ_ENABLE_QT"
4887 MOZ_ARG_DISABLE_BOOL(dbus,
4888 [ --disable-dbus Disable dbus support ],
4892 if test "$MOZ_ENABLE_DBUS"
4894 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
4895 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
4896 AC_DEFINE(MOZ_ENABLE_DBUS)
4899 AC_SUBST(MOZ_ENABLE_DBUS)
4901 dnl ========================================================
4902 dnl = Enable Android History instead of Places
4903 dnl ========================================================
4904 if test -n "$MOZ_ANDROID_HISTORY"; then
4905 if test -z "$MOZ_PLACES"; then
4906 AC_DEFINE(MOZ_ANDROID_HISTORY)
4908 AC_MSG_ERROR([Cannot use MOZ_ANDROID_HISTORY alongside MOZ_PLACES.])
4912 dnl ========================================================
4913 dnl = Enable the C++ async pan/zoom code instead of the Java version
4914 dnl ========================================================
4915 MOZ_ARG_ENABLE_BOOL(android-apz,
4916 [ --enable-android-apz Switch to C++ pan/zoom code],
4919 if test -n "$MOZ_ANDROID_APZ"; then
4920 dnl Do this if defined in confvars.sh
4921 AC_DEFINE(MOZ_ANDROID_APZ)
4924 dnl ========================================================
4925 dnl = Disable WebSMS backend
4926 dnl ========================================================
4927 MOZ_ARG_DISABLE_BOOL(websms-backend,
4928 [ --disable-websms-backend
4929 Disable WebSMS backend],
4930 MOZ_WEBSMS_BACKEND=,
4931 MOZ_WEBSMS_BACKEND=1)
4933 if test -n "$MOZ_WEBSMS_BACKEND"; then
4934 AC_DEFINE(MOZ_WEBSMS_BACKEND)
4937 dnl ========================================================
4938 dnl = Enable runtime locale switching on Android
4939 dnl ========================================================
4940 if test -n "$MOZ_LOCALE_SWITCHER"; then
4941 AC_DEFINE(MOZ_LOCALE_SWITCHER)
4944 dnl ========================================================
4945 dnl = Enable system download manager on Android
4946 dnl ========================================================
4947 if test -n "$MOZ_ANDROID_DOWNLOADS_INTEGRATION"; then
4948 AC_DEFINE(MOZ_ANDROID_DOWNLOADS_INTEGRATION)
4951 dnl ========================================================
4952 dnl = Enable NFC permission on Android
4953 dnl ========================================================
4954 if test -n "$MOZ_ANDROID_BEAM"; then
4955 AC_DEFINE(MOZ_ANDROID_BEAM)
4958 dnl ========================================================
4959 dnl = Include Search Activity on Android
4960 dnl ========================================================
4961 if test -n "$MOZ_ANDROID_SEARCH_ACTIVITY"; then
4962 AC_DEFINE(MOZ_ANDROID_SEARCH_ACTIVITY)
4965 dnl ========================================================
4966 dnl = Include Reading List service on Android
4967 dnl ========================================================
4968 if test -n "$MOZ_ANDROID_READING_LIST_SERVICE"; then
4969 AC_DEFINE(MOZ_ANDROID_READING_LIST_SERVICE)
4972 dnl ========================================================
4973 dnl = Include Mozilla Location Service Stumbler on Android
4974 dnl ========================================================
4975 if test -n "$MOZ_ANDROID_MLS_STUMBLER"; then
4976 AC_DEFINE(MOZ_ANDROID_MLS_STUMBLER)
4979 dnl ========================================================
4980 dnl = Include share overlay on Android
4981 dnl ========================================================
4982 if test -n "$MOZ_ANDROID_SHARE_OVERLAY"; then
4983 AC_DEFINE(MOZ_ANDROID_SHARE_OVERLAY)
4986 dnl = Include Tab Queue on Android
4987 dnl = Temporary build flag to allow development in Nightly
4988 dnl ========================================================
4989 if test -n "$MOZ_ANDROID_TAB_QUEUE"; then
4990 AC_DEFINE(MOZ_ANDROID_TAB_QUEUE)
4993 dnl ========================================================
4994 dnl = Enable IPDL's "expensive" unit tests
4995 dnl ========================================================
4998 MOZ_ARG_ENABLE_BOOL(ipdl-tests,
4999 [ --enable-ipdl-tests Enable expensive IPDL tests],
5003 if test -n "$MOZ_IPDL_TESTS"; then
5004 AC_DEFINE(MOZ_IPDL_TESTS)
5007 AC_SUBST(MOZ_IPDL_TESTS)
5009 dnl ========================================================
5010 dnl = Disable building dbm
5011 dnl ========================================================
5012 MOZ_ARG_DISABLE_BOOL(dbm,
5013 [ --disable-dbm Disable building dbm],
5017 dnl ========================================================
5018 dnl accessibility support off by default on all platforms
5019 dnl ========================================================
5020 MOZ_ARG_ENABLE_BOOL(accessibility,
5021 [ --enable-accessibility Enable accessibility support],
5024 if test "$ACCESSIBILITY"; then
5027 if test -z "$MIDL"; then
5028 if test "$GCC" != "yes"; then
5029 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
5031 AC_MSG_ERROR([You have accessibility enabled, but widl could not be found. Add --disable-accessibility to your mozconfig or install widl. See https://developer.mozilla.org/en-US/docs/Cross_Compile_Mozilla_for_Mingw32 for details.])
5035 AC_DEFINE(ACCESSIBILITY)
5038 dnl ========================================================
5039 dnl Accessibility is required for the linuxgl widget
5041 dnl ========================================================
5042 if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
5043 AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
5046 dnl ========================================================
5047 dnl = Enable WebRTC code
5048 dnl ========================================================
5049 MOZ_ARG_ENABLE_BOOL(webrtc,
5050 [ --enable-webrtc Enable support for WebRTC],
5054 if test -n "$MOZ_WEBRTC"; then
5055 AC_ERROR("WebRTC is no longer supported. Please remove --enable-webrtc")
5058 AC_SUBST(MOZ_WEBRTC)
5060 dnl ========================================================
5062 dnl Use integers over floats for audio on B2G and Android
5063 dnl (regarless of the CPU architecture, because audio
5064 dnl backends for those platforms don't support floats. We also
5065 dnl use integers on ARM with other OS, because it's more efficient.
5066 if test "$OS_TARGET" = "Android" -o "$CPU_ARCH" = "arm"; then
5067 MOZ_SAMPLE_TYPE_S16=1
5068 AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
5069 AC_SUBST(MOZ_SAMPLE_TYPE_S16)
5071 MOZ_SAMPLE_TYPE_FLOAT32=1
5072 AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
5073 AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
5076 dnl ========================================================
5077 dnl = Disable Speech API code
5078 dnl ========================================================
5079 MOZ_ARG_DISABLE_BOOL(webspeech,
5080 [ --disable-webspeech Disable support for HTML Speech API],
5084 if test -n "$MOZ_WEBSPEECH"; then
5085 AC_DEFINE(MOZ_WEBSPEECH)
5088 AC_SUBST(MOZ_WEBSPEECH)
5090 dnl ========================================================
5091 dnl = Disable JPEG-XR (JXR) decoder support
5092 dnl ========================================================
5094 MOZ_ARG_DISABLE_BOOL(jxr,
5095 [ --disable-jxr Disable support for JPEG-XR (JXR) image format],
5099 if test -n "$MOZ_JXR"; then
5105 dnl ========================================================
5106 dnl = Enable Raw Codecs
5107 dnl ========================================================
5108 MOZ_ARG_ENABLE_BOOL(raw,
5109 [ --enable-raw Enable support for RAW media],
5113 if test -n "$MOZ_RAW"; then
5119 dnl Checks for __attribute__(aligned()) directive need by libogg
5120 AC_CACHE_CHECK([__attribute__ ((aligned ())) support],
5121 [ac_cv_c_attribute_aligned],
5122 [ac_cv_c_attribute_aligned=0
5123 CFLAGS_save="${CFLAGS}"
5124 CFLAGS="${CFLAGS} -Werror"
5125 for ac_cv_c_attr_align_try in 64 32 16 8; do
5126 echo "trying $ac_cv_c_attr_align_try"
5128 [static char c __attribute__ ((aligned(${ac_cv_c_attr_align_try}))) = 0; return c;],
5129 [ac_cv_c_attribute_aligned="${ac_cv_c_attr_align_try}"])
5130 if test "$ac_cv_c_attribute_aligned" != 0; then
5134 CFLAGS="${CFLAGS_save}"])
5135 if test "${ac_cv_c_attribute_aligned}" != "0"; then
5136 AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX],
5137 [${ac_cv_c_attribute_aligned}],[Maximum supported data alignment])
5140 dnl ========================================================
5141 dnl = Disable VP8 decoder support
5142 dnl ========================================================
5143 MOZ_ARG_DISABLE_BOOL(webm,
5144 [ --disable-webm Disable support for WebM media (VP8 video and Vorbis audio)],
5148 if test -n "$MOZ_WEBM"; then
5153 dnl ========================================================
5154 dnl = Apple platform decoder support
5155 dnl ========================================================
5156 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
5160 if test -n "$MOZ_APPLEMEDIA"; then
5161 AC_DEFINE(MOZ_APPLEMEDIA)
5162 # hack in frameworks for fmp4 - see bug 1029974
5163 # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
5164 LDFLAGS="$LDFLAGS -framework AudioToolbox"
5165 dnl Verify CoreMedia is available.
5166 AC_CHECK_HEADER([CoreMedia/CoreMedia.h], [],
5167 [AC_MSG_ERROR([MacOS X 10.7 SDK or later is required])])
5170 dnl ========================================================
5171 dnl = DirectShow support
5172 dnl ========================================================
5173 if test "$OS_ARCH" = "WINNT"; then
5174 dnl Enable DirectShow support by default.
5178 MOZ_ARG_DISABLE_BOOL(directshow,
5179 [ --disable-directshow Disable support for DirectShow],
5183 if test -n "$MOZ_DIRECTSHOW"; then
5184 AC_DEFINE(MOZ_DIRECTSHOW)
5187 dnl ========================================================
5188 dnl = Windows Media Foundation support
5189 dnl ========================================================
5190 if test "$OS_ARCH" = "WINNT"; then
5191 dnl Enable Windows Media Foundation support by default.
5192 dnl Note our minimum SDK version is Windows 7 SDK, so we are (currently)
5193 dnl guaranteed to have a recent-enough SDK to build WMF.
5197 MOZ_ARG_DISABLE_BOOL(wmf,
5198 [ --disable-wmf Disable support for Windows Media Foundation],
5202 if test -n "$MOZ_WMF"; then
5206 dnl ========================================================
5207 dnl FFmpeg H264/AAC Decoding Support
5208 dnl ========================================================
5209 case "$OS_TARGET" in
5210 WINNT|Darwin|Android)
5217 MOZ_ARG_DISABLE_BOOL(ffmpeg,
5218 [ --disable-ffmpeg Disable FFmpeg for fragmented H264/AAC decoding],
5223 if test -n "$MOZ_FFMPEG"; then
5224 AC_DEFINE(MOZ_FFMPEG)
5227 dnl ========================================================
5228 dnl = Built-in fragmented MP4 support.
5229 dnl ========================================================
5231 if test "$OS_TARGET" = Android -a -z "$gonkdir"; then
5235 if test -n "$MOZ_WMF" -o -n "$MOZ_FFMPEG" -o -n "$MOZ_APPLEMEDIA"; then
5236 dnl Enable fragmented MP4 parser on Windows by default.
5237 dnl We will also need to enable it on other platforms as we implement
5238 dnl platform decoder support there too.
5242 MOZ_ARG_DISABLE_BOOL(fmp4,
5243 [ --disable-fmp4 Disable support for in built Fragmented MP4 parsing],
5247 if test -n "$MOZ_FFMPEG" -a -z "$MOZ_FMP4"; then
5248 AC_MSG_ERROR([Fragmented MP4 support must be enabled if using FFmpeg])
5251 if test -n "$MOZ_FMP4"; then
5255 dnl ========================================================
5256 dnl = Enable media plugin support
5257 dnl ========================================================
5258 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5259 dnl Enable support on android by default
5263 MOZ_ARG_ENABLE_BOOL(android-omx,
5264 [ --enable-android-omx Enable support for Android OMX media backend],
5268 if test -n "$MOZ_ANDROID_OMX"; then
5269 AC_DEFINE(MOZ_ANDROID_OMX)
5272 dnl ========================================================
5273 dnl = Enable getUserMedia support
5274 dnl ========================================================
5275 MOZ_ARG_ENABLE_BOOL(media-navigator,
5276 [ --enable-media-navigator Enable support for getUserMedia],
5277 MOZ_MEDIA_NAVIGATOR=1,
5278 MOZ_MEDIA_NAVIGATOR=)
5280 if test -n "$MOZ_MEDIA_NAVIGATOR"; then
5281 AC_DEFINE(MOZ_MEDIA_NAVIGATOR)
5284 dnl ========================================================
5285 dnl = Enable building OMX media plugin (B2G or Android)
5286 dnl ========================================================
5287 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
5288 dnl Enable support on android by default
5292 MOZ_ARG_ENABLE_BOOL(omx-plugin,
5293 [ --enable-omx-plugin Enable building OMX plugin (B2G)],
5297 if test -n "$MOZ_OMX_PLUGIN"; then
5298 if test "$OS_TARGET" = "Android"; then
5299 dnl Only allow building OMX plugin on Gonk (B2G) or Android
5300 AC_DEFINE(MOZ_OMX_PLUGIN)
5302 dnl fail if we're not building on Gonk or Android
5303 AC_MSG_ERROR([OMX media plugin can only be built on B2G or Android])
5307 dnl system libvpx Support
5308 dnl ========================================================
5309 MOZ_ARG_WITH_BOOL(system-libvpx,
5310 [ --with-system-libvpx Use system libvpx (located with pkgconfig)],
5311 MOZ_NATIVE_LIBVPX=1)
5316 if test -n "$MOZ_VPX"; then
5318 if test -n "$MOZ_VPX_ERROR_CONCEALMENT" ; then
5319 AC_DEFINE(MOZ_VPX_ERROR_CONCEALMENT)
5322 _SAVE_CFLAGS=$CFLAGS
5324 if test -n "$MOZ_NATIVE_LIBVPX"; then
5325 dnl ============================
5326 dnl === libvpx Version check ===
5327 dnl ============================
5328 dnl Check to see if we have a system libvpx package.
5329 PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.4.0)
5331 CFLAGS="$CFLAGS $MOZ_LIBVPX_CFLAGS"
5332 LIBS="$LIBS $MOZ_LIBVPX_LIBS"
5334 MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
5335 [AC_MSG_ERROR([Couldn't find vpx/vpx_decoder.h which is required for build with system libvpx. Use --without-system-libvpx to build with in-tree libvpx.])])
5337 AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
5338 [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
5340 CFLAGS=$_SAVE_CFLAGS
5344 AC_SUBST(MOZ_NATIVE_LIBVPX)
5345 AC_SUBST_LIST(MOZ_LIBVPX_CFLAGS)
5346 AC_SUBST_LIST(MOZ_LIBVPX_LIBS)
5348 if test "$MOZ_WEBP"; then
5352 if test "$MOZ_WEBM"; then
5353 if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
5360 if test -n "$MOZ_VPX" -a -z "$MOZ_NATIVE_LIBVPX"; then
5362 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
5363 dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
5364 dnl We currently require gcc on all arm platforms.
5367 VPX_NEED_OBJ_INT_EXTRACT=
5369 dnl See if we have assembly on this platform.
5370 case "$OS_ARCH:$CPU_ARCH" in
5372 VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
5376 VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
5380 VPX_ASFLAGS="-f x64 -rnasm -pnasm"
5384 dnl Check for yasm 1.1 or greater.
5385 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
5386 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.])
5387 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5388 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.])
5390 VPX_ASFLAGS="-f win32 -rnasm -pnasm -DPIC"
5392 dnl The encoder needs obj_int_extract to get asm offsets.
5396 if test -n "$GNU_AS" ; then
5398 dnl These flags are a lie; they're just used to enable the requisite
5399 dnl opcodes; actual arch detection is done at runtime.
5400 VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
5401 VPX_DASH_C_FLAG="-c"
5402 VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
5403 VPX_ASM_SUFFIX="$ASM_SUFFIX"
5408 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5409 VPX_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC"
5414 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5415 VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
5421 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
5422 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.])
5425 if test -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
5426 dnl We prefer to get asm offsets using inline assembler, which the above
5427 dnl compilers can do. When we're not using one of those, we have to fall
5428 dnl back to obj_int_extract, which reads them from a compiled object
5429 dnl file. Unfortunately, that only works if we're compiling on a system
5430 dnl with the header files for the appropriate object file format.
5431 VPX_NEED_OBJ_INT_EXTRACT=1
5434 if test -n "$VPX_X86_ASM"; then
5435 AC_DEFINE(VPX_X86_ASM)
5436 elif test -n "$VPX_ARM_ASM"; then
5437 AC_DEFINE(VPX_ARM_ASM)
5439 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
5443 dnl ========================================================
5444 dnl = Disable Wave decoder support
5445 dnl ========================================================
5446 MOZ_ARG_DISABLE_BOOL(wave,
5447 [ --disable-wave Disable Wave decoder support],
5451 if test -n "$MOZ_WAVE"; then
5455 dnl ========================================================
5456 dnl = Handle dependent MEDIA defines
5457 dnl ========================================================
5459 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
5460 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/])
5463 if test -n "$MOZ_VORBIS"; then
5464 AC_DEFINE(MOZ_VORBIS)
5467 if test -n "$MOZ_TREMOR"; then
5468 AC_DEFINE(MOZ_TREMOR)
5469 # Tremor doesn't have an encoder.
5473 if test -n "$MOZ_WEBM_ENCODER"; then
5474 AC_DEFINE(MOZ_WEBM_ENCODER)
5476 AC_SUBST(MOZ_WEBM_ENCODER)
5478 dnl ==================================
5479 dnl = Check alsa availability on Linux
5480 dnl ==================================
5482 dnl If using Linux, ensure that the alsa library is available
5483 if test "$OS_TARGET" = "Linux"; then
5487 MOZ_ARG_ENABLE_BOOL(alsa,
5488 [ --enable-alsa Enable Alsa support (default on Linux)],
5492 if test -n "$MOZ_ALSA"; then
5493 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
5494 [echo "$MOZ_ALSA_PKG_ERRORS"
5495 AC_MSG_ERROR([Need alsa for audio output on Linux. (On Ubuntu, you might try installing the package libasound2-dev.)])])
5500 dnl ========================================================
5501 dnl = Disable PulseAudio
5502 dnl ========================================================
5504 dnl If using Linux, ensure that the PA library is available
5505 case "$OS_TARGET" in
5506 WINNT|Darwin|Android|OpenBSD)
5509 if test -z "$MOZ_B2G"; then
5515 MOZ_ARG_DISABLE_BOOL(pulseaudio,
5516 [ --disable-pulseaudio Disable PulseAudio support],
5520 if test -n "$MOZ_PULSEAUDIO"; then
5521 if test -z "$gonkdir"; then
5522 PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
5523 [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
5524 AC_MSG_ERROR([pulseaudio audio backend requires libpulse development package])])
5526 MOZ_PULSEAUDIO_CFLAGS="-I$gonkdir/external/pulseaudio/pulseaudio/src"
5530 AC_SUBST(MOZ_PULSEAUDIO)
5532 dnl ========================================================
5533 dnl Permissions System
5534 dnl ========================================================
5535 MOZ_ARG_DISABLE_BOOL(permissions,
5536 [ --disable-permissions Disable permissions (popup and cookie blocking)],
5541 dnl ========================================================
5542 dnl Child permissions, currently only used for b2g
5543 dnl ========================================================
5544 if test -n "$MOZ_B2G"; then
5545 if test -n "$MOZ_PERMISSIONS"; then
5546 MOZ_CHILD_PERMISSIONS=1
5548 AC_MSG_ERROR([You need to enable MOZ_PERMISSIONS for MOZ_CHILD_PERMISSIONS])
5551 AC_SUBST(MOZ_CHILD_PERMISSIONS)
5553 dnl ========================================================
5555 dnl ========================================================
5556 MOZ_ARG_DISABLE_BOOL(negotiateauth,
5557 [ --disable-negotiateauth Disable GSS-API negotiation ],
5558 MOZ_AUTH_EXTENSION=,
5559 MOZ_AUTH_EXTENSION=1 )
5561 dnl ========================================================
5562 dnl Pref extensions (autoconfig)
5563 dnl ========================================================
5564 MOZ_ARG_DISABLE_BOOL(pref-extensions,
5565 [ --disable-pref-extensions
5566 Disable pref extensions such as autoconfig],
5567 MOZ_PREF_EXTENSIONS=,
5568 MOZ_PREF_EXTENSIONS=1 )
5570 dnl ========================================================
5571 dnl Searching of system directories for extensions.
5572 dnl Note: this switch is meant to be used for test builds
5573 dnl whose behavior should not depend on what happens to be
5574 dnl installed on the local machine.
5575 dnl ========================================================
5576 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
5577 [ --disable-system-extension-dirs
5578 Disable searching system- and account-global
5579 directories for extensions of any kind; use
5580 only profile-specific extension directories],
5581 ENABLE_SYSTEM_EXTENSION_DIRS=,
5582 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
5583 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
5584 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
5587 dnl ========================================================
5588 dnl = Universalchardet
5589 dnl ========================================================
5590 MOZ_ARG_DISABLE_BOOL(universalchardet,
5591 [ --disable-universalchardet
5592 Disable universal encoding detection],
5593 MOZ_UNIVERSALCHARDET=,
5594 MOZ_UNIVERSALCHARDET=1 )
5596 if test -n "${JAVA_BIN_PATH}"; then
5597 dnl Look for javac and jar in the specified path.
5598 JAVA_PATH="$JAVA_BIN_PATH"
5600 dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
5601 JAVA_PATH="$JAVA_HOME/bin:$PATH"
5604 MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
5605 MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
5606 MOZ_PATH_PROG(JAVAH, javah, :, [$JAVA_PATH])
5607 MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
5608 MOZ_PATH_PROG(JARSIGNER, jarsigner, :, [$JAVA_PATH])
5609 MOZ_PATH_PROG(KEYTOOL, keytool, :, [$JAVA_PATH])
5611 if test -n "${JAVA_BIN_PATH}" -o \
5612 \( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
5613 if test -z "$JAVA" -o "$JAVA" = ":"; then
5614 AC_MSG_ERROR([The program java was not found. Set \$JAVA_HOME to your Java SDK directory or use --with-java-bin-path={java-bin-dir}])
5616 if test -z "$JAVAC" -o "$JAVAC" = ":"; then
5617 AC_MSG_ERROR([The program javac was not found. Set \$JAVA_HOME to your Java SDK directory or use --with-java-bin-path={java-bin-dir}])
5619 if test -z "$JAVAH" -o "$JAVAH" = ":"; then
5620 AC_MSG_ERROR([The program javah was not found. Set \$JAVA_HOME to your Java SDK directory or use --with-java-bin-path={java-bin-dir}])
5622 if test -z "$JAR" -o "$JAR" = ":"; then
5623 AC_MSG_ERROR([The program jar was not found. Set \$JAVA_HOME to your Java SDK directory or use --with-java-bin-path={java-bin-dir}])
5625 if test -z "$JARSIGNER" -o "$JARSIGNER" = ":"; then
5626 AC_MSG_ERROR([The program jarsigner was not found. Set \$JAVA_HOME to your Java SDK directory or use --with-java-bin-path={java-bin-dir}])
5628 if test -z "$KEYTOOL" -o "$KEYTOOL" = ":"; then
5629 AC_MSG_ERROR([The program keytool was not found. Set \$JAVA_HOME to your Java SDK directory or use --with-java-bin-path={java-bin-dir}])
5632 AC_MSG_CHECKING([for minimum required javac version >= 1.7])
5634 dnl Javac spits out something like `javac 1.7.0`. This line cuts off the 'javac'
5635 _javac_version=$($JAVAC -version 2>&1 | cut -d ' ' -f 2)
5637 dnl Here, we extract the major (1) and minor (7) version numbers from the
5638 dnl acquired version string.
5639 _javac_major_version=$(echo $_javac_version | cut -d '.' -f 1)
5640 _javac_minor_version=$(echo $_javac_version | cut -d '.' -f 2)
5642 AC_MSG_RESULT([$_javac_version])
5644 dnl Fail if we have a version other than 1.7.X
5645 if test "$_javac_major_version" -ne "1" -o \
5646 \( "$_javac_minor_version" -lt "7" \); then
5647 AC_MSG_ERROR([javac 1.7 or higher is required.])
5651 dnl ========================================================
5652 dnl = ANGLE OpenGL->D3D translator for WebGL
5653 dnl = * only applies to win32
5654 dnl ========================================================
5658 MOZ_HAS_WINSDK_WITH_D3D=
5659 MOZ_D3DCOMPILER_VISTA_DLL=
5660 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
5662 case "$target_os" in
5664 MOZ_ANGLE_RENDERER=1
5668 # The DirectX SDK libraries are split into x86 and x64 sub-directories
5669 case "${target_cpu}" in
5671 MOZ_D3D_CPU_SUFFIX=x86
5674 MOZ_D3D_CPU_SUFFIX=x64
5678 # This is potentially set in external mozconfig files; if it's set,
5679 # then the build exposes the "webgl" context name, which is reserved
5680 # for conformant implementations.
5681 if test -n "$MOZ_WEBGL_CONFORMANT"; then
5682 AC_DEFINE(MOZ_WEBGL_CONFORMANT)
5685 dnl ========================================================
5686 dnl D3D compiler DLL
5687 dnl ========================================================
5688 MOZ_FOUND_D3D_COMPILERS=
5690 if test -n "$MOZ_ANGLE_RENDERER"; then
5691 if test -z "$MOZ_D3D_CPU_SUFFIX"; then
5692 AC_MSG_ERROR([Couldn't determine MOZ_D3D_CPU_SUFFIX.])
5695 ######################################
5696 # Find _46+ for use by Vista+.
5698 # Find a D3D compiler DLL in a Windows SDK.
5699 MOZ_D3DCOMPILER_VISTA_DLL=
5700 case "$MOZ_WINSDK_MAXVER" in
5702 MOZ_D3DCOMPILER_VISTA_DLL=d3dcompiler_47.dll
5703 AC_MSG_RESULT([Found D3D compiler in Windows SDK 8.1.])
5707 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
5708 # We have a name, now track down the path.
5709 if test -n "$WINDOWSSDKDIR"; then
5710 MOZ_D3DCOMPILER_VISTA_DLL_PATH="$WINDOWSSDKDIR/Redist/D3D/$MOZ_D3D_CPU_SUFFIX/$MOZ_D3DCOMPILER_VISTA_DLL"
5711 if test -f "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
5712 AC_MSG_RESULT([Found MOZ_D3DCOMPILER_VISTA_DLL_PATH: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
5713 MOZ_HAS_WINSDK_WITH_D3D=1
5715 AC_MSG_RESULT([MOZ_D3DCOMPILER_VISTA_DLL_PATH doesn't exist: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
5716 AC_MSG_ERROR([Windows SDK at "$WINDOWSSDKDIR" appears broken. Try updating to MozillaBuild 1.9 final or higher.])
5717 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
5720 AC_MSG_RESULT([Windows SDK not found.])
5724 if test -z "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
5725 MOZ_D3DCOMPILER_VISTA_DLL=
5728 # On mingw, check if headers are provided by toolchain.
5729 if test -n "$GNU_CC"; then
5730 MOZ_CHECK_HEADER(d3d10.h, MOZ_HAS_WINSDK_WITH_D3D=1)
5734 ######################################
5735 # Check that we found what we needed.
5736 MOZ_FOUND_A_D3D_COMPILER=
5738 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
5739 MOZ_FOUND_A_D3D_COMPILER=1
5740 AC_MSG_RESULT([Found d3dcompiler DLL for Vista+: $MOZ_D3DCOMPILER_VISTA_DLL])
5743 if test -z "$CROSS_COMPILE"; then
5744 if test -z "MOZ_FOUND_A_D3D_COMPILER"; then
5745 AC_MSG_ERROR([Couldn't find an acceptable D3D compiler DLL.])
5751 dnl ========================================================
5753 dnl ========================================================
5755 MOZ_GAMEPAD_BACKEND=stub
5757 MOZ_ARG_ENABLE_BOOL(gamepad,
5758 [ --enable-gamepad Enable gamepad support],
5762 if test "$MOZ_GAMEPAD"; then
5763 case "$OS_TARGET" in
5765 MOZ_GAMEPAD_BACKEND=cocoa
5768 MOZ_GAMEPAD_BACKEND=windows
5771 MOZ_CHECK_HEADER([linux/joystick.h])
5772 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
5773 AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers or reconfigure with --disable-gamepad to disable gamepad support.])
5775 MOZ_GAMEPAD_BACKEND=linux
5778 MOZ_GAMEPAD_BACKEND=android
5784 AC_DEFINE(MOZ_GAMEPAD)
5786 AC_SUBST(MOZ_GAMEPAD)
5787 AC_SUBST(MOZ_GAMEPAD_BACKEND)
5789 dnl ========================================================
5790 dnl = libjpeg-turbo configuration
5791 dnl ========================================================
5793 if test -z "$MOZ_NATIVE_JPEG"; then
5797 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
5798 [ --disable-libjpeg-turbo Disable optimized jpeg decoding routines],
5800 MOZ_LIBJPEG_TURBO=1)
5802 if test "$MOZ_NATIVE_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
5803 AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
5806 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
5809 if test -n "$MOZ_LIBJPEG_TURBO"; then
5811 dnl Do we support libjpeg-turbo on this platform?
5812 case "$OS_ARCH:$OS_TEST" in
5814 LIBJPEG_TURBO_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC -DMACHO"
5815 LIBJPEG_TURBO_X86_ASM=1
5818 LIBJPEG_TURBO_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
5819 LIBJPEG_TURBO_X64_ASM=1
5821 WINNT:x86|WINNT:i?86)
5822 LIBJPEG_TURBO_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
5823 LIBJPEG_TURBO_X86_ASM=1
5826 LIBJPEG_TURBO_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
5827 LIBJPEG_TURBO_X64_ASM=1
5830 LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
5831 LIBJPEG_TURBO_ARM_ASM=1
5834 LIBJPEG_TURBO_ASFLAGS="-march=armv8-a"
5835 LIBJPEG_TURBO_ARM64_ASM=1
5838 LIBJPEG_TURBO_ASFLAGS="-mdspr2"
5839 LIBJPEG_TURBO_MIPS_ASM=1
5842 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5843 LIBJPEG_TURBO_ASFLAGS="-f elf32 -rnasm -pnasm -DPIC -DELF"
5844 LIBJPEG_TURBO_X86_ASM=1
5848 if $CC -E -dM -</dev/null | grep -q __ELF__; then
5849 LIBJPEG_TURBO_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
5850 LIBJPEG_TURBO_X64_ASM=1
5857 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
5858 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
5859 dnl it doesn't exist or we have too old of a version.
5860 if test -n "$LIBJPEG_TURBO_X86_ASM" -o -n "$LIBJPEG_TURBO_X64_ASM" ; then
5861 LIBJPEG_TURBO_AS=$YASM
5863 if test -z "$LIBJPEG_TURBO_AS" ; then
5864 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.])
5867 dnl Check that we have the right yasm version. We require 1.0.1 or newer
5868 dnl on Linux and 1.1 or newer everywhere else.
5869 if test "$OS_ARCH" = "Linux" ; then
5870 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
5871 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.])
5874 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
5875 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.])
5880 dnl If we're on an ARM system which supports libjpeg-turbo's asm routines and
5881 dnl --disable-libjpeg-turbo wasn't passed, use the C compiler as the assembler.
5882 if test -n "$LIBJPEG_TURBO_ARM_ASM" ; then
5883 echo "Using $AS as the assembler for ARM code."
5884 LIBJPEG_TURBO_AS=$AS
5887 if test -n "$LIBJPEG_TURBO_X86_ASM"; then
5888 AC_DEFINE(LIBJPEG_TURBO_X86_ASM)
5889 elif test -n "$LIBJPEG_TURBO_X64_ASM"; then
5890 AC_DEFINE(LIBJPEG_TURBO_X64_ASM)
5891 elif test -n "$LIBJPEG_TURBO_ARM_ASM"; then
5892 AC_DEFINE(LIBJPEG_TURBO_ARM_ASM)
5893 elif test -n "$MOZ_LIBJPEG_TURBO"; then
5894 dnl Warn if we're not building the optimized routines, even though the user
5895 dnl didn't specify --disable-libjpeg-turbo.
5896 AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo. Using unoptimized C routines.])
5899 dnl ========================================================
5900 dnl = Enable compilation of specific extension modules
5901 dnl ========================================================
5903 MOZ_ARG_ENABLE_STRING(extensions,
5904 [ --enable-extensions Enable extensions],
5905 [ for option in `echo $enableval | sed 's/,/ /g'`; do
5906 if test "$option" = "yes" -o "$option" = "all"; then
5907 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
5908 elif test "$option" = "no" -o "$option" = "none"; then
5910 elif test "$option" = "default"; then
5911 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
5912 elif test `echo "$option" | grep -c \^-` != 0; then
5913 option=`echo $option | sed 's/^-//'`
5914 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
5916 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
5919 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
5921 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
5922 # Suppress warning on non-X11 platforms
5923 if test -n "$MOZ_X11"; then
5924 AC_MSG_WARN([Removing gio from MOZ_EXTENSIONS due to --disable-gio.])
5926 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
5929 dnl Do not build gio with libxul based apps
5930 if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
5931 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
5934 if test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
5936 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
5938 AC_SUBST(MOZ_GIO_COMPONENT)
5941 MOZ_EXTENSIONS=`$PYTHON ${srcdir}/build/unix/uniq.py ${MOZ_EXTENSIONS}`
5943 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
5944 dnl when trying to build a nonexistent extension.
5945 for extension in $MOZ_EXTENSIONS; do
5946 if test ! -d "${srcdir}/extensions/${extension}"; then
5947 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
5951 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
5952 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
5955 dnl ========================================================
5956 dnl Build Freetype in the tree
5957 dnl ========================================================
5958 MOZ_ARG_ENABLE_BOOL(tree-freetype,
5959 [ --enable-tree-freetype Enable Tree FreeType],
5960 MOZ_TREE_FREETYPE=1,
5961 MOZ_TREE_FREETYPE= )
5962 if test -n "$MOZ_TREE_FREETYPE"; then
5963 if test -n "$_WIN32_MSVC"; then
5964 AC_ERROR("building with in-tree freetype is not supported on MSVC")
5966 AC_DEFINE(MOZ_TREE_FREETYPE)
5967 AC_SUBST(MOZ_TREE_FREETYPE)
5968 MOZ_ENABLE_CAIRO_FT=1
5969 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
5970 FT2_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
5971 CAIRO_FT_CFLAGS='-I$(topsrcdir)/modules/freetype2/include'
5973 AC_DEFINE(HAVE_FT_BITMAP_SIZE_Y_PPEM)
5974 AC_DEFINE(HAVE_FT_GLYPHSLOT_EMBOLDEN)
5975 AC_DEFINE(HAVE_FT_LOAD_SFNT_TABLE)
5976 AC_SUBST_LIST(CAIRO_FT_CFLAGS)
5979 dnl ========================================================
5981 dnl ========================================================
5982 dnl Abort Windows build if the required major version and
5983 dnl minimum minor version of Unicode NSIS isn't in the path
5984 dnl (unless in case of cross compiling, for which Unicode
5985 dnl is not yet sufficient).
5986 if test "$OS_ARCH" = "WINNT"; then
5987 MIN_NSIS_MAJOR_VER=2
5988 MIN_NSIS_MINOR_VER=46
5989 MOZ_PATH_PROGS(MAKENSISU, $MAKENSISU makensisu-3.0a2.exe makensisu-2.46.exe makensis)
5990 if test -n "$MAKENSISU" -a "$MAKENSISU" != ":"; then
5991 AC_MSG_RESULT([yes])
5992 MAKENSISU_VER=`"$MAKENSISU" -version 2>/dev/null`
5994 MAKENSISU_PARSED_VER=`echo "$MAKENSISU_VER" | sed -e '/-Unicode/!s/.*//g' -e 's/^v\([0-9]\+\.[0-9]\+\).*\-Unicode$/\1/g'`
5996 if test "$MAKENSISU_PARSED_VER" = ""; then
5998 MAKENSISU_PARSED_VER=`echo "$MAKENSISU_VER" | sed -e 's/^v\([0-9]\+\.[0-9]\+\).*$/\1/g'`
6001 MAKENSISU_MAJOR_VER=0
6002 MAKENSISU_MINOR_VER=0
6003 if test ! "$MAKENSISU_PARSED_VER" = ""; then
6004 MAKENSISU_MAJOR_VER=`echo $MAKENSISU_PARSED_VER | $AWK -F\. '{ print $1 }'`
6005 MAKENSISU_MINOR_VER=`echo $MAKENSISU_PARSED_VER | $AWK -F\. '{ print $2 }'`
6007 AC_MSG_CHECKING([for Unicode NSIS version $MIN_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER or greater])
6008 if test "$MAKENSISU_MAJOR_VER" -eq $MIN_NSIS_MAJOR_VER -a \
6009 "$MAKENSISU_MINOR_VER" -ge $MIN_NSIS_MINOR_VER ||
6010 test "$MAKENSISU_MAJOR_VER" -gt $MIN_NSIS_MAJOR_VER; then
6011 AC_MSG_RESULT([yes])
6014 if test -z "$CROSS_COMPILE"; then
6015 AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or Unicode NSIS version $MIN_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER or greater in your path.])
6020 elif test -z "$CROSS_COMPILE"; then
6021 AC_MSG_ERROR([To build the installer you must have the latest MozillaBuild or Unicode NSIS version $MIN_NSIS_MAJOR_VER.$MIN_NSIS_MINOR_VER or greater in your path.])
6027 dnl ========================================================
6028 dnl GNU tar and wget
6029 dnl ========================================================
6031 AC_CHECK_PROGS(TAR, gnutar gtar tar, "")
6032 if test -z "$TAR"; then
6033 AC_MSG_ERROR([no tar archiver found in \$PATH])
6037 AC_CHECK_PROGS(WGET, wget, "")
6040 dnl ========================================================
6042 dnl ========================================================
6044 if test -n "$MOZ_SIGN_CMD"; then
6045 AC_DEFINE(MOZ_SIGNING)
6048 dnl ========================================================
6049 dnl Bundled fonts on desktop platforms
6050 dnl ========================================================
6052 MOZ_ARG_ENABLE_BOOL(bundled-fonts,
6053 [ --enable-bundled-fonts Enable support for bundled fonts on desktop platforms],
6054 MOZ_BUNDLED_FONTS=1,
6057 if test -n "$MOZ_BUNDLED_FONTS"; then
6058 AC_DEFINE(MOZ_BUNDLED_FONTS)
6061 dnl ========================================================
6062 dnl Verify MAR signatures
6063 dnl ========================================================
6065 MOZ_ARG_ENABLE_BOOL(verify-mar,
6066 [ --enable-verify-mar Enable verifying MAR signatures],
6067 MOZ_VERIFY_MAR_SIGNATURE=1,
6068 MOZ_VERIFY_MAR_SIGNATURE= )
6070 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
6071 if test "$OS_ARCH" = "WINNT"; then
6072 AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
6074 AC_MSG_ERROR([Can only build with --enable-verify-mar with a Windows target])
6078 dnl ========================================================
6079 dnl Enable building the signmar program.
6080 dnl This option is much different than the --enable-verify-mar option.
6081 dnl --enable-verify-mar is for enabling the verification check on MAR
6082 dnl files in the updater. The --enable-signmar option is for building
6083 dnl the signmar program.
6084 dnl ========================================================
6086 MOZ_ARG_ENABLE_BOOL(signmar,
6087 [ --enable-signmar Enable building the signmar program],
6088 MOZ_ENABLE_SIGNMAR=1,
6089 MOZ_ENABLE_SIGNMAR= )
6091 if test -n "$MOZ_ENABLE_SIGNMAR"; then
6092 AC_DEFINE(MOZ_ENABLE_SIGNMAR)
6095 dnl ========================================================
6097 dnl ========================================================
6099 MOZ_ARG_DISABLE_BOOL(updater,
6100 [ --disable-updater Disable building of updater],
6104 if test -n "$MOZ_UPDATER"; then
6105 AC_DEFINE(MOZ_UPDATER)
6108 # tools/update-packaging is not checked out by default.
6109 MOZ_ARG_ENABLE_BOOL(update-packaging,
6110 [ --enable-update-packaging
6111 Enable tools/update-packaging],
6112 MOZ_UPDATE_PACKAGING=1,
6113 MOZ_UPDATE_PACKAGING= )
6114 AC_SUBST(MOZ_UPDATE_PACKAGING)
6116 dnl ========================================================
6117 dnl Do not build the tests by default
6118 dnl ========================================================
6119 MOZ_ARG_ENABLE_BOOL(tests,
6120 [ --enable-tests Build test libraries & programs],
6124 if test -n "$ENABLE_TESTS"; then
6126 AC_DEFINE(ENABLE_TESTS)
6127 AC_DEFINE_UNQUOTED(GTEST_HAS_RTTI, 0)
6128 AC_SUBST(GTEST_HAS_RTTI)
6129 if test -n "$_WIN32_MSVC"; then
6130 AC_DEFINE_UNQUOTED(_VARIADIC_MAX, 10)
6132 if test "${OS_TARGET}" = "Android"; then
6133 AC_DEFINE(GTEST_OS_LINUX_ANDROID)
6134 AC_DEFINE(GTEST_USE_OWN_TR1_TUPLE)
6135 AC_DEFINE_UNQUOTED(GTEST_HAS_CLONE, 0)
6136 AC_SUBST(GTEST_OS_LINUX_ANDROID)
6137 AC_SUBST(GTEST_USE_OWN_TR1_TUPLE)
6138 AC_SUBST(GTEST_HAS_CLONE)
6142 dnl ========================================================
6143 dnl parental controls (for Windows Vista)
6144 dnl ========================================================
6145 MOZ_ARG_ENABLE_BOOL(parental-controls,
6146 [ --enable-parental-controls
6147 Build parental controls],
6148 MOZ_DISABLE_PARENTAL_CONTROLS=,
6149 MOZ_DISABLE_PARENTAL_CONTROLS=1)
6150 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
6151 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
6154 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
6156 dnl ========================================================
6157 dnl = Disable smartcard support
6158 dnl ========================================================
6159 if test -n "$MOZ_NO_SMART_CARDS"; then
6160 AC_DEFINE(MOZ_NO_SMART_CARDS)
6162 AC_SUBST(MOZ_NO_SMART_CARDS)
6164 dnl ========================================================
6165 dnl = Disable EV certificate verification
6166 dnl ========================================================
6167 if test -n "$MOZ_NO_EV_CERTS"; then
6168 AC_DEFINE(MOZ_NO_EV_CERTS)
6170 AC_SUBST(MOZ_NO_EV_CERTS)
6172 dnl ========================================================
6173 dnl = Disable libpkix
6174 dnl ========================================================
6175 if test -n "$NSS_NO_LIBPKIX"; then
6176 AC_DEFINE(NSS_NO_LIBPKIX)
6178 AC_SUBST(NSS_NO_LIBPKIX)
6180 dnl ========================================================
6181 dnl = Sandboxing support
6182 dnl ========================================================
6183 MOZ_ARG_ENABLE_BOOL(sandbox,
6184 [ --enable-sandbox Enable sandboxing support],
6188 dnl ========================================================
6189 dnl = Content process sandboxing
6190 dnl ========================================================
6191 if test -n "$gonkdir"; then
6192 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
6195 case "$OS_TARGET:$NIGHTLY_BUILD" in
6197 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
6200 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
6204 MOZ_ARG_ENABLE_BOOL(content-sandbox,
6205 [ --enable-content-sandbox Enable sandboxing support for content-processes
6206 --disable-content-sandbox Disable sandboxing support for content-processes],
6207 MOZ_CONTENT_SANDBOX=1,
6208 MOZ_CONTENT_SANDBOX=)
6210 if test -n "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_SANDBOX"; then
6211 AC_MSG_ERROR([--enable-content-sandbox and --disable-sandbox are conflicting options])
6214 if test -n "$MOZ_CONTENT_SANDBOX"; then
6215 AC_DEFINE(MOZ_CONTENT_SANDBOX)
6218 AC_SUBST(MOZ_CONTENT_SANDBOX)
6220 dnl ========================================================
6221 dnl = Goanna Media Plugin sandboxing
6222 dnl ========================================================
6225 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
6230 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
6235 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
6239 if test -n "$MOZ_GMP_SANDBOX"; then
6240 AC_DEFINE(MOZ_GMP_SANDBOX)
6243 AC_SUBST(MOZ_GMP_SANDBOX)
6245 if test -z "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_GMP_SANDBOX"; then
6249 if test -n "$MOZ_SANDBOX"; then
6250 AC_DEFINE(MOZ_SANDBOX)
6253 AC_SUBST(MOZ_SANDBOX)
6256 dnl ========================================================
6258 dnl = Module specific options
6260 dnl ========================================================
6261 MOZ_ARG_HEADER(Individual module options)
6263 dnl ========================================================
6264 dnl = Disable feed handling components
6265 dnl ========================================================
6266 MOZ_ARG_DISABLE_BOOL(feeds,
6267 [ --disable-feeds Disable feed handling and processing components],
6270 if test -n "$MOZ_FEEDS"; then
6271 AC_DEFINE(MOZ_FEEDS)
6273 if test "$MOZ_BUILD_APP" = "browser"; then
6274 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
6278 dnl ========================================================
6279 dnl Check for sqlite
6280 dnl ========================================================
6283 MOZ_ARG_ENABLE_BOOL(system-sqlite,
6284 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
6285 MOZ_NATIVE_SQLITE=1,
6286 MOZ_NATIVE_SQLITE= )
6288 if test -n "$MOZ_NATIVE_SQLITE"
6290 dnl ============================
6291 dnl === SQLite Version check ===
6292 dnl ============================
6293 dnl Check to see if the system SQLite package is new enough.
6294 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
6296 dnl ==================================
6297 dnl === SQLITE_SECURE_DELETE check ===
6298 dnl ==================================
6299 dnl Check to see if the system SQLite package is compiled with
6300 dnl SQLITE_SECURE_DELETE enabled.
6301 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
6302 _SAVE_CFLAGS="$CFLAGS"
6303 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6305 LIBS="$LIBS $SQLITE_LIBS"
6306 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
6308 #include "sqlite3.h"
6310 int main(int argc, char **argv){
6311 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
6313 ac_cv_sqlite_secure_delete=yes,
6314 ac_cv_sqlite_secure_delete=no,
6315 ac_cv_sqlite_secure_delete=no
6318 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
6319 CFLAGS="$_SAVE_CFLAGS"
6321 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
6322 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
6325 dnl ===============================
6326 dnl === SQLITE_THREADSAFE check ===
6327 dnl ===============================
6328 dnl Check to see if the system SQLite package is compiled with
6329 dnl SQLITE_THREADSAFE enabled.
6330 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
6331 _SAVE_CFLAGS="$CFLAGS"
6332 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6334 LIBS="$LIBS $SQLITE_LIBS"
6335 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
6337 #include "sqlite3.h"
6339 int main(int argc, char **argv){
6340 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
6342 ac_cv_sqlite_threadsafe=yes,
6343 ac_cv_sqlite_threadsafe=no,
6344 ac_cv_sqlite_threadsafe=no
6347 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
6348 CFLAGS="$_SAVE_CFLAGS"
6350 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
6351 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
6354 dnl ================================
6355 dnl === SQLITE_ENABLE_FTS3 check ===
6356 dnl ================================
6357 dnl check to see if the system SQLite package is compiled with
6358 dnl SQLITE_ENABLE_FTS3 enabled.
6359 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
6360 _SAVE_CFLAGS="$CFLAGS"
6361 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6363 LIBS="$LIBS $SQLITE_LIBS"
6364 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
6366 #include "sqlite3.h"
6368 int main(int argc, char **argv){
6369 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
6371 ac_cv_sqlite_enable_fts3=yes,
6372 ac_cv_sqlite_enable_fts3=no,
6373 ac_cv_sqlite_enable_fts3=no
6376 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
6377 CFLAGS="$_SAVE_CFLAGS"
6379 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
6380 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
6383 dnl =========================================
6384 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
6385 dnl =========================================
6386 dnl check to see if the system SQLite package is compiled with
6387 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
6388 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
6389 _SAVE_CFLAGS="$CFLAGS"
6390 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
6392 LIBS="$LIBS $SQLITE_LIBS"
6393 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
6395 #include "sqlite3.h"
6397 int main(int argc, char **argv){
6398 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
6400 ac_cv_sqlite_enable_unlock_notify=yes,
6401 ac_cv_sqlite_enable_unlock_notify=no,
6402 ac_cv_sqlite_enable_unlock_notify=no
6405 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
6406 CFLAGS="$_SAVE_CFLAGS"
6408 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
6409 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
6413 if test -n "$MOZ_NATIVE_SQLITE"; then
6414 AC_DEFINE(MOZ_NATIVE_SQLITE)
6416 AC_SUBST(MOZ_NATIVE_SQLITE)
6418 dnl ========================================================
6419 dnl = Enable help viewer (off by default)
6420 dnl ========================================================
6421 if test -n "$MOZ_HELP_VIEWER"; then
6422 dnl Do this if defined in confvars.sh
6423 AC_DEFINE(MOZ_HELP_VIEWER)
6426 dnl ========================================================
6427 dnl = Disable zipwriter
6428 dnl ========================================================
6429 MOZ_ARG_DISABLE_BOOL(zipwriter,
6430 [ --disable-zipwriter Disable zipwriter component],
6433 AC_SUBST(MOZ_ZIPWRITER)
6435 dnl ========================================================
6437 dnl ========================================================
6439 MOZ_ARG_WITH_STRING(gl-provider,
6440 [ --with-gl-provider=ID
6441 Set GL provider backend type],
6442 [ val=`echo $withval`
6443 MOZ_GL_PROVIDER="$val"])
6445 if test -n "$MOZ_GL_PROVIDER"; then
6446 MOZ_GL_DEFAULT_PROVIDER=$MOZ_GL_PROVIDER
6447 AC_SUBST(MOZ_GL_PROVIDER)
6448 AC_DEFINE_UNQUOTED(MOZ_GL_PROVIDER, GLContextProvider$MOZ_GL_PROVIDER)
6450 AC_SUBST(MOZ_GL_DEFAULT_PROVIDER)
6451 AC_DEFINE_UNQUOTED(GL_PROVIDER_$MOZ_GL_DEFAULT_PROVIDER)
6453 dnl ========================================================
6454 dnl = faststripe theme
6455 dnl ========================================================
6456 MOZ_ARG_ENABLE_BOOL(faststripe,
6457 [ --enable-faststripe Use faststripe theme],
6458 MOZ_THEME_FASTSTRIPE=1,
6459 MOZ_THEME_FASTSTRIPE= )
6460 AC_SUBST(MOZ_THEME_FASTSTRIPE)
6462 dnl ========================================================
6464 dnl = Feature options that require extra sources to be pulled
6466 dnl ========================================================
6467 dnl MOZ_ARG_HEADER(Features that require extra sources)
6469 dnl ========================================================
6471 dnl = Runtime debugging and Optimization Options
6473 dnl ========================================================
6474 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
6476 dnl ========================================================
6477 dnl enable mobile optimizations
6478 dnl ========================================================
6479 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
6480 [ --enable-mobile-optimize
6481 Enable mobile optimizations],
6482 MOZ_GFX_OPTIMIZE_MOBILE=1)
6484 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
6486 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
6487 # We ignore paint will resample on mobile for performance.
6488 # We may want to revisit this later.
6489 MOZ_IGNORE_PAINT_WILL_RESAMPLE=1
6491 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
6492 AC_DEFINE(MOZ_IGNORE_PAINT_WILL_RESAMPLE)
6495 dnl ========================================================
6496 dnl = Enable code optimization. ON by default.
6497 dnl ========================================================
6498 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
6499 MOZ_OPTIMIZE_FLAGS="-O"
6502 MOZ_ARG_ENABLE_STRING(optimize,
6503 [ --disable-optimize Disable compiler optimization
6504 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
6505 [ if test "$enableval" != "no"; then
6507 if test -n "$enableval" -a "$enableval" != "yes"; then
6508 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
6513 fi ], MOZ_OPTIMIZE=1)
6515 MOZ_SET_FRAMEPTR_FLAGS
6517 if test "$COMPILE_ENVIRONMENT"; then
6518 if test -n "$MOZ_OPTIMIZE"; then
6519 AC_MSG_CHECKING([for valid optimization flags])
6520 _SAVE_CFLAGS=$CFLAGS
6521 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
6522 AC_TRY_COMPILE([#include <stdio.h>],
6523 [printf("Hello World\n");],
6526 AC_MSG_RESULT([$_results])
6527 if test "$_results" = "no"; then
6528 AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
6530 CFLAGS=$_SAVE_CFLAGS
6532 fi # COMPILE_ENVIRONMENT
6534 AC_SUBST(MOZ_OPTIMIZE)
6535 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
6536 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
6537 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
6538 AC_SUBST(MOZ_ALLOW_HEAP_EXECUTE_FLAGS)
6540 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
6542 dnl ========================================================
6543 dnl = Enable NS_StackWalk.
6544 dnl ========================================================
6546 # On Windows, NS_StackWalk will only work correctly if we have frame pointers
6547 # available. That will only be true for non-optimized builds, debug builds or
6548 # builds with --enable-profiling in the .mozconfig (which is turned on in
6549 # Nightly by default.)
6550 case "$OS_TARGET" in
6552 if test -z "$MOZ_OPTIMIZE" -o -n "$MOZ_PROFILING" -o -n "$MOZ_DEBUG"; then
6563 if test -n "$MOZ_STACKWALKING"; then
6564 AC_DEFINE(MOZ_STACKWALKING)
6567 AC_SUBST(MOZ_STACKWALKING)
6569 dnl ========================================================
6570 dnl = Disable treating compiler warnings as errors
6571 dnl ========================================================
6572 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
6573 WARNINGS_AS_ERRORS=''
6574 elif test "$GNU_CC"; then
6575 # Prevent the following GCC warnings from being treated as errors:
6576 # -Wuninitialized - too many false positives
6577 # -Wmaybe-uninitialized - too many false positives
6578 # -Wdeprecated-declarations - we don't want our builds held hostage when a
6579 # platform-specific API becomes deprecated.
6580 # -Warray-bounds - false positives depending on optimization
6581 MOZ_C_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_c_has_noerror_uninitialized)
6582 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=uninitialized, ac_cxx_has_noerror_uninitialized)
6583 MOZ_C_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_c_has_noerror_maybe_uninitialized)
6584 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=maybe-uninitialized, ac_cxx_has_noerror_maybe_uninitialized)
6585 MOZ_C_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_c_has_noerror_deprecated_declarations)
6586 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=deprecated-declarations, ac_cxx_has_noerror_deprecated_declarations)
6587 MOZ_C_SUPPORTS_WARNING(-W, no-error=array-bounds, ac_c_has_noerror_array_bounds)
6588 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=array-bounds, ac_cxx_has_noerror_array_bounds)
6590 if test -n "$MOZ_PGO"; then
6591 MOZ_C_SUPPORTS_WARNING(-W, no-error=coverage-mismatch, ac_c_has_noerror_coverage_mismatch)
6592 MOZ_CXX_SUPPORTS_WARNING(-W, no-error=coverage-mismatch, ac_cxx_has_noerror_coverage_mismatch)
6596 dnl ========================================================
6597 dnl = Disable runtime logging checks
6598 dnl ========================================================
6599 MOZ_ARG_DISABLE_BOOL(logging,
6600 [ --disable-logging Disable logging facilities],
6601 NS_DISABLE_LOGGING=1,
6602 NS_DISABLE_LOGGING= )
6603 if test "$NS_DISABLE_LOGGING"; then
6604 AC_DEFINE(NS_DISABLE_LOGGING)
6606 AC_DEFINE(MOZ_LOGGING)
6607 AC_DEFINE(FORCE_PR_LOG)
6610 dnl ========================================================
6611 dnl = This will enable logging of addref, release, ctor, dtor.
6612 dnl ========================================================
6613 _ENABLE_LOGREFCNT=42
6614 MOZ_ARG_ENABLE_BOOL(logrefcnt,
6615 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
6616 _ENABLE_LOGREFCNT=1,
6617 _ENABLE_LOGREFCNT= )
6618 if test "$_ENABLE_LOGREFCNT" = "1"; then
6619 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
6620 elif test -z "$_ENABLE_LOGREFCNT"; then
6621 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
6624 dnl ========================================================
6625 dnl moz_aproximate_location
6626 dnl ========================================================
6627 MOZ_ARG_ENABLE_BOOL(approximate_location,
6628 [ --enable-approximate-location Enable approximate location ],
6629 MOZ_APPROX_LOCATION=1,
6630 MOZ_APPROX_LOCATION= )
6631 if test -n "$MOZ_APPROX_LOCATION"; then
6632 AC_DEFINE(MOZ_APPROX_LOCATION)
6635 dnl ========================================================
6637 dnl ========================================================
6638 MOZ_ARG_ENABLE_BOOL(gps_debug,
6639 [ --enable-gps-debug Enable gps specific debug messages ],
6642 if test -n "$MOZ_GPS_DEBUG"; then
6643 AC_DEFINE(MOZ_GPS_DEBUG)
6645 if test -n "$MOZ_DEBUG"; then
6646 AC_DEFINE(MOZ_GPS_DEBUG)
6649 dnl ========================================================
6650 dnl moz_dump_painting
6651 dnl ========================================================
6652 MOZ_ARG_ENABLE_BOOL(dump-painting,
6653 [ --enable-dump-painting Enable paint debugging.],
6654 MOZ_DUMP_PAINTING=1,
6655 MOZ_DUMP_PAINTING= )
6656 if test -n "$MOZ_DUMP_PAINTING"; then
6657 AC_DEFINE(MOZ_DUMP_PAINTING)
6658 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
6660 if test -n "$MOZ_DEBUG"; then
6661 AC_DEFINE(MOZ_DUMP_PAINTING)
6664 dnl ========================================================
6666 dnl ========================================================
6668 MOZ_ARG_ENABLE_BOOL(dmd,
6669 [ --enable-dmd Enable DMD; also enables jemalloc and replace-malloc],
6673 if test "$MOZ_DMD"; then
6676 if test "${CPU_ARCH}" = "arm"; then
6677 CFLAGS="$CFLAGS -funwind-tables"
6678 CXXFLAGS="$CXXFLAGS -funwind-tables"
6681 MOZ_MEMORY=1 # DMD enables jemalloc
6682 MOZ_REPLACE_MALLOC=1 # DMD enables replace-malloc
6686 dnl ========================================================
6687 dnl = Enable jemalloc
6688 dnl ========================================================
6689 MOZ_ARG_ENABLE_BOOL(jemalloc,
6690 [ --enable-jemalloc Replace memory allocator with jemalloc],
6694 case "${OS_TARGET}" in
6695 Android|WINNT|Darwin)
6696 MOZ_GLUE_IN_PROGRAM=
6699 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
6700 MOZ_GLUE_IN_PROGRAM=1
6704 dnl ========================================================
6705 dnl = Enable full jemalloc lib
6706 dnl ========================================================
6707 MOZ_ARG_ENABLE_BOOL(jemalloc-lib,
6708 [ --enable-jemalloc-lib Use the full jemalloc lib],
6712 if test -n "$MOZ_JEMALLOC3" -a -z "$MOZ_MEMORY"; then
6713 dnl We need jemalloc enabled to use jemalloc3
6714 AC_MSG_ERROR([--enable-jemalloc-lib requires --enable-jemalloc])
6717 dnl ========================================================
6718 dnl = Enable dynamic replacement of malloc implementation
6719 dnl ========================================================
6720 if test -n "$NIGHTLY_BUILD" -a -n "$MOZ_MEMORY"; then
6721 # Enable on central for the debugging opportunities it adds.
6722 MOZ_REPLACE_MALLOC=1
6724 MOZ_ARG_ENABLE_BOOL(replace-malloc,
6725 [ --enable-replace-malloc Enable ability to dynamically replace the malloc implementation],
6726 MOZ_REPLACE_MALLOC=1,
6727 MOZ_REPLACE_MALLOC= )
6729 if test -n "$MOZ_REPLACE_MALLOC" -a -z "$MOZ_MEMORY"; then
6730 dnl We don't want to enable jemalloc unconditionally because it may be a
6731 dnl deliberate choice not to enable it (bug 702250, for instance)
6732 AC_MSG_ERROR([--enable-replace-malloc requires --enable-jemalloc])
6733 elif test -n "$MOZ_REPLACE_MALLOC"; then
6734 AC_DEFINE(MOZ_REPLACE_MALLOC)
6735 MOZ_NATIVE_JEMALLOC=
6737 dnl Replace-malloc Mac linkage quirks
6738 if test -n "$MACOSX_DEPLOYMENT_TARGET"; then
6739 AC_CACHE_CHECK([how to do weak dynamic linking],
6740 ac_cv_weak_dynamic_linking,
6741 [echo 'extern void foo() __attribute__((weak_import));int bar() { if (foo) foo(); return 0; }' > conftest.c
6742 if AC_TRY_COMMAND([${CC-cc} -o conftest${DLL_SUFFIX} $CFLAGS -dynamiclib $LDFLAGS -Wl,-U,_foo conftest.c $LIBS 1>&5]) &&
6743 test -s conftest${DLL_SUFFIX}; then
6744 dnl There are several ways the linker can put link edit rules in a binary:
6745 dnl - classic info only (for OSX < 10.6)
6746 dnl - dyld info only
6748 if "$OTOOL" -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO_ONLY" > /dev/null; then
6753 if "$OTOOL" -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO" > /dev/null; then
6758 dnl With classic info, we need to build with -flat_namespace.
6759 dnl With dyld info, Xcode 4.5 does the right thing without additional flags,
6760 dnl but Xcode < 4.5 requires a dummy library and -flat_namespace because it
6761 dnl forgets to set the weak flag in the dyld info.
6762 dnl See http://glandium.org/blog/?p=2764 for more details.
6764 dnl Values for ac_cv_weak_dynamic_linking, and subsequently
6765 dnl MOZ_REPLACE_MALLOC_LINKAGE are thus:
6766 dnl - "flat namespace" when -flat_namespace alone is needed
6767 dnl - "dummy library" when a dummy library and -flat_namespace are needed
6768 dnl - "compiler support" when nothing is needed
6769 if test -n "$_DYLD_INFO" && dyldinfo -bind conftest${DLL_SUFFIX} 2> /dev/null | grep "_foo (weak import)" > /dev/null; then
6770 if test -n "$_CLASSIC_INFO"; then
6771 ac_cv_weak_dynamic_linking="flat namespace"
6773 ac_cv_weak_dynamic_linking="compiler support"
6776 if test -n "$_DYLD_INFO"; then
6777 ac_cv_weak_dynamic_linking="dummy library"
6779 ac_cv_weak_dynamic_linking="flat namespace"
6783 AC_ERROR([couldn't compile a simple C file])
6786 MOZ_REPLACE_MALLOC_LINKAGE="$ac_cv_weak_dynamic_linking"
6789 AC_SUBST(MOZ_REPLACE_MALLOC)
6790 AC_SUBST(MOZ_REPLACE_MALLOC_LINKAGE)
6792 dnl ========================================================
6793 dnl = Jemalloc build setup
6794 dnl ========================================================
6795 if test -z "$MOZ_MEMORY"; then
6796 if test -n "$MOZ_JEMALLOC3" -a -z "$MOZ_REPLACE_MALLOC"; then
6797 MOZ_NATIVE_JEMALLOC=1
6798 AC_CHECK_FUNCS(mallctl nallocx,,
6799 [MOZ_NATIVE_JEMALLOC=
6801 if test -n "$MOZ_NATIVE_JEMALLOC"; then
6803 AC_DEFINE(MOZ_MEMORY)
6804 AC_DEFINE(MOZ_JEMALLOC3)
6805 AC_DEFINE(MOZ_NATIVE_JEMALLOC)
6810 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
6811 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.])
6816 AC_DEFINE(MOZ_MEMORY)
6817 if test -n "$MOZ_JEMALLOC3"; then
6818 AC_DEFINE(MOZ_JEMALLOC3)
6820 if test "x$MOZ_DEBUG" = "x1"; then
6821 AC_DEFINE(MOZ_MEMORY_DEBUG)
6823 dnl The generic feature tests that determine how to compute ncpus are long and
6824 dnl complicated. Therefore, simply define special cpp variables for the
6825 dnl platforms we have special knowledge of.
6828 AC_DEFINE(MOZ_MEMORY_DARWIN)
6831 AC_DEFINE(MOZ_MEMORY_BSD)
6833 *-android*|*-linuxandroid*)
6834 AC_DEFINE(MOZ_MEMORY_LINUX)
6835 AC_DEFINE(MOZ_MEMORY_ANDROID)
6836 if test -n "$gonkdir"; then
6837 AC_DEFINE(MOZ_MEMORY_GONK)
6841 AC_DEFINE(MOZ_MEMORY_LINUX)
6844 AC_DEFINE(MOZ_MEMORY_BSD)
6847 AC_DEFINE(MOZ_MEMORY_SOLARIS)
6850 AC_DEFINE(MOZ_MEMORY_WINDOWS)
6851 export MOZ_NO_DEBUG_RTL=1
6852 WIN32_CRT_LIBS="msvcrt.lib msvcprt.lib"
6853 dnl Look for a broken crtdll.obj
6854 WIN32_CRTDLL_FULLPATH=`lib -nologo -list $WIN32_CRT_LIBS | grep crtdll\\.obj`
6855 lib -NOLOGO -OUT:crtdll.obj $WIN32_CRT_LIBS -EXTRACT:$WIN32_CRTDLL_FULLPATH
6856 if grep -q '__imp__\{0,1\}free' crtdll.obj; then
6862 AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
6866 AC_SUBST(MOZ_MEMORY)
6867 AC_SUBST(MOZ_JEMALLOC3)
6868 AC_SUBST(MOZ_NATIVE_JEMALLOC)
6871 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
6872 AC_SUBST_LIST(WIN32_CRT_LIBS)
6874 # Allow the application to provide a subconfigure script.
6875 # This should be after 'export MOZ_NO_DEBUG_RTL=1' since
6876 # ldap/c-sdk/configure refers to the enviroment value.
6877 if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
6878 do_output_subdirs() {
6879 if test -n "$_subconfigure_subdirs"; then
6880 AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
6882 _subconfigure_subdir="$1"
6883 _subconfigure_config_args="$ac_configure_args"
6885 tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
6886 m4 "${srcdir}/build/autoconf/subconfigure.m4" \
6887 "${srcdir}/build/autoconf/altoptions.m4" \
6888 "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
6893 dnl We need to wrap dlopen and related functions on Android because we use
6895 if test "$OS_TARGET" = Android; then
6896 MOZ_GLUE_WRAP_LDFLAGS="${MOZ_GLUE_WRAP_LDFLAGS} -Wl,--wrap=PR_GetEnv,--wrap=PR_SetEnv"
6897 if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then
6898 MOZ_GLUE_WRAP_LDFLAGS="${MOZ_GLUE_WRAP_LDFLAGS} -Wl,--wrap=pthread_create,--wrap=epoll_wait,--wrap=poll,--wrap=pthread_cond_timedwait,--wrap=pthread_cond_wait,--wrap=epoll_create,--wrap=epoll_ctl,--wrap=close,--wrap=pthread_key_create,--wrap=pthread_key_delete,--wrap=socketpair,--wrap=pthread_self,--wrap=pthread_mutex_lock,--wrap=pthread_mutex_trylock,--wrap=pthread_join,--wrap=pipe,--wrap=pipe2"
6900 if test "$MOZ_WIDGET_TOOLKIT" = android; then
6901 MOZ_GLUE_WRAP_LDFLAGS="${MOZ_GLUE_WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
6905 AC_SUBST_LIST(MOZ_GLUE_WRAP_LDFLAGS)
6906 export MOZ_GLUE_WRAP_LDFLAGS
6908 dnl ========================================================
6909 dnl = Enable using the clang plugin to build
6910 dnl ========================================================
6912 MOZ_CONFIG_CLANG_PLUGIN
6914 dnl ========================================================
6915 dnl = Enable stripping of libs & executables
6916 dnl ========================================================
6917 MOZ_ARG_ENABLE_BOOL(strip,
6918 [ --enable-strip Enable stripping of libs & executables ],
6922 dnl ========================================================
6923 dnl = Enable stripping of libs & executables when packaging
6924 dnl ========================================================
6925 MOZ_ARG_ENABLE_BOOL(install-strip,
6926 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
6930 dnl ========================================================
6931 dnl = --disable-elf-hack
6932 dnl ========================================================
6935 MOZ_ARG_DISABLE_BOOL(elf-hack,
6936 [ --disable-elf-hack Disable elf hacks],
6940 # Only enable elfhack where supported
6941 if test "$USE_ELF_HACK" = 1; then
6942 case "${HOST_OS_ARCH},${OS_ARCH}" in
6944 case "${CPU_ARCH}" in
6959 if test -n "$COMPILE_ENVIRONMENT" -a -n "$USE_ELF_HACK"; then
6960 dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
6961 dnl memory addresses it maps to. The result is that by the time elfhack
6962 dnl kicks in, it is not possible to apply relocations because of that,
6963 dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
6964 dnl segment. It makes elfhack mostly useless, so considering the problems
6965 dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
6966 dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
6967 dnl the linker creates PT_GNU_RELRO segments. However, when we do want
6968 dnl elfhack enabled, disable PT_GNU_RELRO instead.
6969 AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
6970 LINK_WITH_PT_GNU_RELRO,
6971 [echo "int main() {return 0;}" > conftest.${ac_ext}
6972 if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
6973 test -s conftest${ac_exeext}; then
6974 if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
6975 LINK_WITH_PT_GNU_RELRO=yes
6977 LINK_WITH_PT_GNU_RELRO=no
6980 dnl We really don't expect to get here, but just in case
6981 AC_ERROR([couldn't compile a simple C file])
6984 if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
6985 if test "$USE_ELF_HACK" = F; then
6986 AC_MSG_CHECKING([for -z norelro option to ld])
6987 _SAVE_LDFLAGS=$LDFLAGS
6988 LDFLAGS="$LDFLAGS -Wl,-z,norelro"
6989 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
6990 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,norelro"],
6991 AC_ERROR([--enable-elf-hack is not compatible with a linker creating a PT_GNU_RELRO segment and that doesn't support the "-z norelro" option.]))
6994 AC_MSG_WARN([Disabling elfhack])
7000 dnl ========================================================
7001 dnl = libstdc++ compatibility hacks
7002 dnl ========================================================
7005 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
7006 [ --enable-stdcxx-compat Enable compatibility with older libstdc++],
7009 if test -n "$STDCXX_COMPAT"; then
7010 eval $(CXX="$CXX" HOST_CXX="$HOST_CXX" $PYTHON -m mozbuild.configure.libstdcxx)
7011 AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
7012 AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
7013 CXXFLAGS="$CXXFLAGS -D_GLIBCXX_USE_CXX11_ABI=0"
7014 HOST_CXXFLAGS="$HOST_CXXFLAGS -D_GLIBCXX_USE_CXX11_ABI=0"
7017 dnl ========================================================
7019 dnl = Profiling and Instrumenting
7021 dnl ========================================================
7022 MOZ_ARG_HEADER(Profiling and Instrumenting)
7024 dnl ========================================================
7025 dnl = Enable runtime visual profiling logger
7026 dnl ========================================================
7027 MOZ_ARG_ENABLE_BOOL(visual-event-tracer,
7028 [ --enable-visual-event-tracer Enable visual event tracer instrumentation],
7029 MOZ_VISUAL_EVENT_TRACER=1,
7030 MOZ_VISUAL_EVENT_TRACER=)
7031 if test -n "$MOZ_VISUAL_EVENT_TRACER"; then
7032 AC_DEFINE(MOZ_VISUAL_EVENT_TRACER)
7035 dnl ========================================================
7036 dnl = Enable TaskTracer
7037 dnl ========================================================
7038 MOZ_ARG_ENABLE_BOOL(tasktracer,
7039 [ --enable-tasktracer Set compile flags necessary for using TaskTracer],
7042 if test "$MOZ_WIDGET_TOOLKIT" = "gonk" -a -n "$MOZ_TASK_TRACER"; then
7043 AC_DEFINE(MOZ_TASK_TRACER)
7044 AC_SUBST(MOZ_TASK_TRACER)
7047 dnl ========================================================
7048 dnl Turn on reflow counting
7049 dnl ========================================================
7050 MOZ_ARG_ENABLE_BOOL(reflow-perf,
7051 [ --enable-reflow-perf Enable reflow performance tracing],
7054 if test -n "$MOZ_REFLOW_PERF"; then
7055 AC_DEFINE(MOZ_REFLOW_PERF)
7058 dnl ========================================================
7059 dnl = Offer a way to disable the startup cache
7060 dnl ========================================================
7062 MOZ_ARG_DISABLE_BOOL(startupcache,
7063 [ --disable-startupcache Disable startup cache ],
7064 MOZ_DISABLE_STARTUPCACHE=1,
7065 MOZ_DISABLE_STARTUPCACHE=)
7067 dnl bug 988880: disable startup cache on b2g
7068 if test -n "$MOZ_B2G"; then
7069 MOZ_DISABLE_STARTUPCACHE=1
7071 if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
7072 AC_DEFINE(MOZ_DISABLE_STARTUPCACHE)
7074 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
7076 dnl ========================================================
7077 dnl = Don't precompile the startup cache
7078 dnl ========================================================
7079 MOZ_DISABLE_PRECOMPILED_STARTUPCACHE=
7081 MOZ_ARG_DISABLE_BOOL(precompiled-startupcache,
7082 [ --disable-precompiled-startupcache Don't precompile the startup cache ],
7083 MOZ_DISABLE_PRECOMPILED_STARTUPCACHE=1,
7084 MOZ_DISABLE_PRECOMPILED_STARTUPCACHE= )
7086 if test -n "$MOZ_DISABLE_PRECOMPILED_STARTUPCACHE"; then
7087 AC_DEFINE(MOZ_DISABLE_PRECOMPILED_STARTUPCACHE)
7090 AC_SUBST(MOZ_DISABLE_PRECOMPILED_STARTUPCACHE)
7092 dnl ========================================================
7093 dnl = Enable Radio Interface for B2G (Gonk usually)
7094 dnl ========================================================
7095 MOZ_ARG_ENABLE_BOOL(b2g-ril,
7096 [ --enable-b2g-ril Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
7099 MOZ_B2G_RIL=$_PLATFORM_HAVE_RIL )
7100 if test -n "$MOZ_B2G_RIL"; then
7101 if test -n "$_PLATFORM_HAVE_RIL"; then
7102 AC_DEFINE(MOZ_B2G_RIL)
7104 AC_MSG_ERROR([b2g-ril cannot be enabled because target platform doesn't support it.])
7107 AC_SUBST(MOZ_B2G_RIL)
7109 dnl ========================================================
7110 dnl = Enable Radio FM for B2G (Gonk usually)
7111 dnl ========================================================
7112 if test -n "$MOZ_B2G_FM"; then
7113 AC_DEFINE(MOZ_B2G_FM)
7115 AC_SUBST(MOZ_B2G_FM)
7117 dnl ========================================================
7118 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
7119 dnl ========================================================
7120 MOZ_ARG_ENABLE_BOOL(b2g-bt,
7121 [ --enable-b2g-bt Set compile flags necessary for compiling Bluetooth API for B2G ],
7124 if test -n "$MOZ_B2G_BT"; then
7125 AC_DEFINE(MOZ_B2G_BT)
7127 AC_SUBST(MOZ_B2G_BT)
7128 AC_SUBST(MOZ_B2G_BT_BLUEZ)
7129 AC_SUBST(MOZ_B2G_BT_BLUEDROID)
7130 AC_SUBST(MOZ_B2G_BT_DAEMON)
7132 dnl ========================================================
7133 dnl = Enable NFC Interface for B2G (Gonk usually)
7134 dnl ========================================================
7135 MOZ_ARG_ENABLE_BOOL(nfc,
7136 [ --enable-nfc Set compile flags necessary for compiling NFC API ],
7139 if test -n "$MOZ_NFC"; then
7144 dnl ========================================================
7145 dnl = Enable Pico Speech Synthesis (Gonk usually)
7146 dnl ========================================================
7147 MOZ_ARG_ENABLE_BOOL(synth-pico,
7148 [ --enable-synth-pico Set compile flags necessary for compiling Pico Web Speech API ],
7151 if test -n "$MOZ_SYNTH_PICO"; then
7152 AC_DEFINE(MOZ_SYNTH_PICO)
7154 AC_SUBST(MOZ_SYNTH_PICO)
7156 dnl ========================================================
7157 dnl = Enable Support for Time Manager API
7158 dnl ========================================================
7159 if test -n "$MOZ_TIME_MANAGER"; then
7160 AC_DEFINE(MOZ_TIME_MANAGER)
7162 AC_SUBST(MOZ_TIME_MANAGER)
7164 dnl ========================================================
7165 dnl = Enable Camera Interface for B2G (Gonk usually)
7166 dnl ========================================================
7167 MOZ_ARG_ENABLE_BOOL(b2g-camera,
7168 [ --enable-b2g-camera Set compile flags necessary for compiling camera API for B2G ],
7171 if test -n "$MOZ_B2G_CAMERA"; then
7172 AC_DEFINE(MOZ_B2G_CAMERA)
7174 AC_SUBST(MOZ_B2G_CAMERA)
7176 dnl ========================================================
7177 dnl = Enable Support for Payment API
7178 dnl ========================================================
7179 if test -n "$MOZ_PAY"; then
7184 dnl ========================================================
7185 dnl = Enable Browser Support for Activities
7186 dnl ========================================================
7187 if test -n "$MOZ_ACTIVITIES"; then
7188 AC_DEFINE(MOZ_ACTIVITIES)
7190 AC_SUBST(MOZ_ACTIVITIES)
7192 dnl ========================================================
7193 dnl = Enable Support for AudioChannelManager API
7194 dnl ========================================================
7195 if test -n "$MOZ_AUDIO_CHANNEL_MANAGER"; then
7196 AC_DEFINE(MOZ_AUDIO_CHANNEL_MANAGER)
7198 AC_SUBST(MOZ_AUDIO_CHANNEL_MANAGER)
7200 dnl ========================================================
7201 dnl = Enable Support for Secure Element API
7202 dnl ========================================================
7203 MOZ_SECUREELEMENT=1,
7204 if test -n "$MOZ_SECUREELEMENT"; then
7205 AC_DEFINE(MOZ_SECUREELEMENT)
7207 AC_SUBST(MOZ_SECUREELEMENT)
7209 dnl ========================================================
7210 dnl = Support for demangling undefined symbols
7211 dnl ========================================================
7212 if test -z "$SKIP_LIBRARY_CHECKS"; then
7215 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
7219 # Demangle only for debug or DMD builds
7220 MOZ_DEMANGLE_SYMBOLS=
7221 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
7222 MOZ_DEMANGLE_SYMBOLS=1
7223 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
7225 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
7227 dnl ========================================================
7228 dnl = Support for gcc stack unwinding (from gcc 3.3)
7229 dnl ========================================================
7230 if test -z "$SKIP_LIBRARY_CHECKS"; then
7233 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
7237 dnl ========================================================
7239 dnl ========================================================
7241 MOZ_ARG_WITH_STRING(jitreport-granularity,
7242 [ --jitreport-granularity=N
7243 Default granularity at which to report JIT code
7246 1 - code ranges for whole functions only
7247 2 - per-line information
7248 3 - per-op information],
7249 JITREPORT_GRANULARITY=$withval,
7250 JITREPORT_GRANULARITY=3)
7252 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
7254 dnl ========================================================
7258 dnl ========================================================
7259 MOZ_ARG_HEADER(Misc. Options)
7261 dnl ========================================================
7262 dnl update xterm title
7263 dnl ========================================================
7264 MOZ_ARG_ENABLE_BOOL(xterm-updates,
7265 [ --enable-xterm-updates Update XTERM titles with current command.],
7269 dnl =========================================================
7271 dnl =========================================================
7272 MOZ_ARG_ENABLE_STRING([chrome-format],
7273 [ --enable-chrome-format=jar|flat|omni
7274 Select FORMAT of chrome files during packaging],
7275 MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
7277 if test -z "$MOZ_CHROME_FILE_FORMAT"; then
7278 MOZ_CHROME_FILE_FORMAT=jar
7281 if test "$MOZ_CHROME_FILE_FORMAT" = "symlink"; then
7282 AC_MSG_ERROR([--enable-chrome-format=symlink has been deprecated. It is now used by default in $DIST/bin on platforms that support it])
7285 if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
7286 test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
7287 test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
7288 AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, or omni])
7291 dnl ========================================================
7292 dnl = Enable Mozilla Developer Tools (frontend)
7293 dnl ========================================================
7294 MOZ_ARG_ENABLE_BOOL(devtools,
7295 [ --enable-devtools Enable Mozilla Developer Tools],
7299 if test -n "$MOZ_DEVTOOLS"; then
7300 AC_DEFINE(MOZ_DEVTOOLS)
7303 AC_SUBST(MOZ_DEVTOOLS)
7305 dnl =========================================================
7306 dnl Enable support for revamped devtools Performance Tools
7307 dnl =========================================================
7309 MOZ_ARG_ENABLE_BOOL(devtools-perf,
7310 [ --enable-devtools-perf Set compile flags necessary for compiling devtools perftools],
7311 MOZ_DEVTOOLS_PERFTOOLS=1,
7312 MOZ_DEVTOOLS_PERFTOOLS= )
7313 if test -n "$MOZ_DEVTOOLS_PERFTOOLS"; then
7314 AC_DEFINE(MOZ_DEVTOOLS_PERFTOOLS)
7316 AC_SUBST(MOZ_DEVTOOLS_PERFTOOLS)
7318 dnl =========================================================
7319 dnl Omnijar packaging (bug 552121)
7320 dnl =========================================================
7321 dnl Omnijar packaging is compatible with flat packaging.
7322 dnl In unpackaged builds, omnijar looks for files as if
7323 dnl things were flat packaged. After packaging, all files
7324 dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
7325 dnl is set to flat since putting files into jars is only
7326 dnl done during packaging with omnijar.
7327 if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
7329 AC_DEFINE(MOZ_OMNIJAR)
7331 MOZ_PACKAGER_FORMAT="$MOZ_CHROME_FILE_FORMAT"
7332 if test "$OS_ARCH" = "WINNT" -o "$MOZ_WIDGET_TOOLKIT" = "android"; then
7333 MOZ_CHROME_FILE_FORMAT=flat
7335 MOZ_CHROME_FILE_FORMAT=symlink
7338 if test "$MOZ_WIDGET_TOOLKIT" = "android"; then
7339 dnl Fennec's static resources live in the assets/ folder of the
7340 dnl APK. Adding a path to the name here works because we only
7341 dnl have one omnijar file in the final package (which is not the
7342 dnl case on desktop), and necessitates some contortions during
7343 dnl packaging so that the resources in the omnijar are considered
7344 dnl as rooted at / and not as rooted at assets/ (which again is
7345 dnl not the case on desktop: there are omnijars rooted at webrtc/,
7346 dnl etc). packager.mk handles changing the rooting of the single
7348 OMNIJAR_NAME=assets/omni.ja
7350 OMNIJAR_NAME=omni.ja
7353 AC_SUBST(OMNIJAR_NAME)
7354 AC_SUBST(MOZ_OMNIJAR)
7355 AC_SUBST(MOZ_PACKAGER_FORMAT)
7357 dnl ========================================================
7358 dnl = Define default location for MOZILLA_FIVE_HOME
7359 dnl ========================================================
7360 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
7361 [ --with-default-mozilla-five-home
7362 Set the default value for MOZILLA_FIVE_HOME],
7363 [ val=`echo $withval`
7364 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
7366 dnl ========================================================
7367 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
7368 dnl ========================================================
7369 MOZ_ARG_WITH_STRING(user-appdir,
7370 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
7371 [ val=`echo $withval`
7372 if echo "$val" | grep "\/" >/dev/null; then
7373 AC_MSG_ERROR("Homedir must be single relative path.")
7378 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
7380 dnl ========================================================
7381 dnl = Doxygen configuration
7382 dnl ========================================================
7383 dnl Use commas to specify multiple dirs to this arg
7384 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
7385 MOZ_ARG_WITH_STRING(doc-input-dirs,
7386 [ --with-doc-input-dirs=DIRS
7387 Header/idl dirs to create docs from],
7388 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7389 AC_SUBST(MOZ_DOC_INPUT_DIRS)
7391 dnl Use commas to specify multiple dirs to this arg
7392 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
7393 MOZ_ARG_WITH_STRING(doc-include-dirs,
7394 [ --with-doc-include-dirs=DIRS
7395 Include dirs to preprocess doc headers],
7396 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
7397 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
7399 MOZ_DOC_OUTPUT_DIR='./dist/docs'
7400 MOZ_ARG_WITH_STRING(doc-output-dir,
7401 [ --with-doc-output-dir=DIR
7402 Dir to generate docs into],
7403 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
7404 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
7406 if test -z "$SKIP_COMPILER_CHECKS"; then
7407 dnl ========================================================
7409 dnl = Compiler Options
7411 dnl ========================================================
7412 MOZ_ARG_HEADER(Compiler Options)
7414 dnl ========================================================
7415 dnl Check for gcc -pipe support
7416 dnl ========================================================
7417 AC_MSG_CHECKING([for -pipe support])
7418 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
7419 dnl Any gcc that supports firefox supports -pipe.
7420 CFLAGS="$CFLAGS -pipe"
7421 CXXFLAGS="$CXXFLAGS -pipe"
7422 AC_MSG_RESULT([yes])
7427 dnl ========================================================
7428 dnl Profile guided optimization (gcc checks)
7429 dnl ========================================================
7430 dnl Test for profiling options
7431 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
7433 _SAVE_CFLAGS="$CFLAGS"
7434 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
7436 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
7437 AC_TRY_COMPILE([], [return 0;],
7438 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
7439 result="yes" ], result="no")
7440 AC_MSG_RESULT([$result])
7442 if test $result = "yes"; then
7443 PROFILE_GEN_LDFLAGS="-fprofile-generate"
7444 PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
7445 PROFILE_USE_LDFLAGS="-fprofile-use"
7448 CFLAGS="$_SAVE_CFLAGS"
7450 if test -n "$INTEL_CC"; then
7451 PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
7452 PROFILE_GEN_LDFLAGS=
7453 PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
7454 PROFILE_USE_LDFLAGS=
7457 dnl Sun Studio on Solaris
7458 if test "$SOLARIS_SUNPRO_CC"; then
7459 PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
7460 PROFILE_GEN_LDFLAGS="-xprofile=collect:$_objdir/$enable_application"
7461 PROFILE_USE_CFLAGS="-xprofile=use:$_objdir/$enable_application"
7462 PROFILE_USE_LDFLAGS="-xprofile=use:$_objdir/$enable_application"
7465 AC_SUBST(PROFILE_GEN_CFLAGS)
7466 AC_SUBST(PROFILE_GEN_LDFLAGS)
7467 AC_SUBST(PROFILE_USE_CFLAGS)
7468 AC_SUBST(PROFILE_USE_LDFLAGS)
7470 dnl =============================================
7471 dnl Support for -fno-integrated-as (recent clang)
7472 dnl =============================================
7473 dnl Under clang 3.4+, use -fno-integrated-as to
7474 dnl build libvpx's vp8_asm_enc_offsets.c
7476 _SAVE_CFLAGS="$CFLAGS"
7477 CFLAGS="$CFLAGS -fno-integrated-as -S"
7479 AC_MSG_CHECKING([whether C compiler supports -fno-integrated-as])
7480 AC_TRY_COMPILE([], [return 0;],
7481 [ NO_INTEGRATED_AS_CFLAGS="-fno-integrated-as"
7482 result="yes" ], result="no")
7483 AC_MSG_RESULT([$result])
7485 CFLAGS="$_SAVE_CFLAGS"
7487 AC_SUBST(NO_INTEGRATED_AS_CFLAGS)
7489 fi # ! SKIP_COMPILER_CHECKS
7491 AC_DEFINE(CPP_THROW_NEW, [throw()])
7494 if test "$COMPILE_ENVIRONMENT"; then
7496 fi # COMPILE_ENVIRONMENT
7498 dnl ========================================================
7500 dnl = Build depencency options
7502 dnl ========================================================
7503 MOZ_ARG_HEADER(Build dependencies)
7505 if test "$GNU_CC" -a "$GNU_CXX"; then
7506 _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
7507 dnl Sun Studio on Solaris use -xM instead of -MD, see config/rules.mk
7508 elif test "$SOLARIS_SUNPRO_CC"; then
7511 dnl Don't override this for MSVC
7512 if test -z "$_WIN32_MSVC"; then
7513 _USE_CPP_INCLUDE_FLAG=
7514 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7515 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
7517 echo '#include <stdio.h>' > dummy-hello.c
7519 dnl This output is localized, split at the first double space or colon and space.
7520 _CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*\\\stdio.h\)$"
7521 CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'`
7522 _CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'`
7524 if ! test -e "$_CL_STDIO_PATH"; then
7525 AC_MSG_ERROR([Unable to parse cl -showIncludes prefix. This compiler's locale has an unsupported formatting.])
7527 if test -z "$CL_INCLUDES_PREFIX"; then
7528 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
7530 AC_SUBST(CL_INCLUDES_PREFIX)
7533 dnl Make sure that the build system can handle non-ASCII characters
7534 dnl in environment variables to prevent it from breaking silently on
7535 dnl non-English systems.
7536 NONASCII=$'\241\241'
7541 dnl ========================================================
7543 dnl = Static Build Options
7545 dnl ========================================================
7546 MOZ_ARG_HEADER(Static build options)
7548 if test "$OS_ARCH" = "WINNT"; then
7549 GKMEDIAS_SHARED_LIBRARY=1
7550 AC_DEFINE(GKMEDIAS_SHARED_LIBRARY)
7552 AC_SUBST(GKMEDIAS_SHARED_LIBRARY)
7554 if test -z "$MOZ_NATIVE_ZLIB"; then
7555 if test -n "$JS_SHARED_LIBRARY" -o "$GKMEDIAS_SHARED_LIBRARY"; then
7557 AC_DEFINE(ZLIB_IN_MOZGLUE)
7561 AC_SUBST(ZLIB_IN_MOZGLUE)
7563 dnl ========================================================
7565 dnl = Standalone module options
7567 dnl ========================================================
7568 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
7571 dnl ========================================================
7573 if test -z "$SKIP_PATH_CHECKS"; then
7574 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
7575 if test "$MOZ_ENABLE_GTK" ; then
7576 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
7581 if test -z "${GLIB_GMODULE_LIBS}" \
7582 -a -n "${GLIB_CONFIG}"\
7583 -a "${GLIB_CONFIG}" != no\
7585 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
7588 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
7590 dnl ========================================================
7591 dnl Graphics checks.
7592 dnl ========================================================
7594 if test "${OS_TARGET}" = "WINNT" -o \
7595 "${OS_ARCH}" = "Darwin" -o \
7596 "${MOZ_WIDGET_TOOLKIT}" = "android" -o \
7597 "${MOZ_WIDGET_TOOLKIT}" = "gonk" -o \
7598 "${MOZ_WIDGET_TOOLKIT}" = "gtk2" -o \
7599 "${MOZ_WIDGET_TOOLKIT}" = "gtk3"; then
7600 case "${CPU_ARCH}" in
7612 MOZ_ARG_ENABLE_BOOL(skia,
7613 [ --enable-skia Enable use of Skia],
7617 MOZ_ARG_DISABLE_BOOL(skia-gpu,
7618 [ --disable-skia-gpu Disable use of Skia-GPU],
7619 MOZ_DISABLE_SKIA_GPU=1,
7620 MOZ_DISABLE_SKIA_GPU=)
7622 if test "$USE_FC_FREETYPE"; then
7623 if test "$COMPILE_ENVIRONMENT"; then
7624 dnl ========================================================
7625 dnl = Check for freetype2 and its functionality
7626 dnl ========================================================
7627 PKG_CHECK_MODULES(FT2, freetype2 >= 6.1.0, _HAVE_FREETYPE2=1, _HAVE_FREETYPE2=)
7629 if test "$_HAVE_FREETYPE2"; then
7631 _SAVE_CFLAGS="$CFLAGS"
7632 LIBS="$LIBS $FT2_LIBS"
7633 CFLAGS="$CFLAGS $FT2_CFLAGS"
7635 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
7636 ac_cv_member_FT_Bitmap_Size_y_ppem,
7637 [AC_TRY_COMPILE([#include <ft2build.h>
7638 #include FT_FREETYPE_H],
7640 if (sizeof s.y_ppem) return 0;
7642 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
7643 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
7644 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
7645 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
7647 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
7649 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
7650 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
7651 [FT_Bitmap_Size structure includes y_ppem field])
7653 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
7656 CFLAGS="$_SAVE_CFLAGS"
7659 _SAVE_CPPFLAGS="$CPPFLAGS"
7660 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
7661 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
7662 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
7663 CPPFLAGS="$_SAVE_CPPFLAGS"
7665 AC_DEFINE(HAVE_FONTCONFIG_FCFREETYPE_H)
7668 PKG_CHECK_MODULES(_FONTCONFIG, fontconfig,
7670 if test "$MOZ_PANGO"; then
7671 MOZ_PANGO_CFLAGS="$MOZ_PANGO_CFLAGS $_FONTCONFIG_CFLAGS"
7672 MOZ_PANGO_LIBS="$MOZ_PANGO_LIBS $_FONTCONFIG_LIBS"
7674 FT2_CFLAGS="$FT2_CFLAGS $_FONTCONFIG_CFLAGS"
7675 FT2_LIBS="$FT2_LIBS $_FONTCONFIG_LIBS"
7680 dnl ========================================================
7681 dnl Check for pixman and cairo
7682 dnl ========================================================
7684 if test "$MOZ_WIDGET_TOOLKIT" = "gtk3" ; then
7685 # cairo-gtk3 can be build with system-cairo only
7691 MOZ_ARG_ENABLE_BOOL(system-cairo,
7692 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
7697 MOZ_ARG_ENABLE_BOOL(system-pixman,
7698 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
7700 MOZ_TREE_PIXMAN=force,
7703 # System cairo depends on system pixman
7704 if test "$MOZ_TREE_PIXMAN" = "force"; then
7705 if test -z "$MOZ_TREE_CAIRO"; then
7706 AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
7710 elif test -z "$MOZ_TREE_CAIRO"; then
7714 if test "$MOZ_TREE_PIXMAN"; then
7715 AC_DEFINE(MOZ_TREE_PIXMAN)
7717 PKG_CHECK_MODULES(PIXMAN, pixman-1 >= 0.19.2)
7718 MOZ_PIXMAN_CFLAGS="$PIXMAN_CFLAGS"
7719 MOZ_PIXMAN_LIBS="$PIXMAN_LIBS"
7721 AC_SUBST(MOZ_PIXMAN_CFLAGS)
7722 AC_SUBST_LIST(MOZ_PIXMAN_LIBS)
7724 # Check for headers defining standard int types.
7725 if test -n "$COMPILE_ENVIRONMENT"; then
7726 MOZ_CHECK_HEADERS(stdint.h inttypes.h sys/int_types.h)
7728 if test "${ac_cv_header_inttypes_h}" = "yes"; then
7733 AC_SUBST(HAVE_INTTYPES_H)
7735 if test "$MOZ_TREE_CAIRO"; then
7736 MOZ_CAIRO_CFLAGS='-I$(LIBXUL_DIST)/include/cairo'
7737 AC_DEFINE(MOZ_TREE_CAIRO)
7739 if test "$OS_ARCH" = "WINNT"; then
7740 # For now we assume that we will have a uint64_t available through
7741 # one of the above headers or mozstdint.h.
7742 AC_DEFINE(HAVE_UINT64_T)
7745 # Define macros for cairo-features.h
7746 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
7747 if test "$MOZ_X11"; then
7748 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
7749 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
7750 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
7752 if test "$_HAVE_FREETYPE2"; then
7753 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
7754 MOZ_ENABLE_CAIRO_FT=1
7755 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
7758 case "$MOZ_WIDGET_TOOLKIT" in
7760 QT_SURFACE_FEATURE="#define CAIRO_HAS_QT_SURFACE 1"
7763 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
7764 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
7765 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
7768 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
7769 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
7770 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
7771 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
7772 MOZ_ENABLE_D2D_SURFACE=1
7773 MOZ_ENABLE_DWRITE_FONT=1
7775 MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
7777 dnl D3D10 Layers depend on D2D Surfaces.
7778 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
7779 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
7783 AC_MSG_ERROR([cairo-gtk3 toolkit is incompatible with in-tree cairo. Please add --enable-system-cairo to your build config.])
7786 if test "$USE_FC_FREETYPE"; then
7787 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
7789 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
7790 AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
7791 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
7792 AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
7793 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
7795 AC_SUBST(PS_SURFACE_FEATURE)
7796 AC_SUBST(PDF_SURFACE_FEATURE)
7797 AC_SUBST(SVG_SURFACE_FEATURE)
7798 AC_SUBST(XLIB_SURFACE_FEATURE)
7799 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
7800 AC_SUBST(QUARTZ_SURFACE_FEATURE)
7801 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
7802 AC_SUBST(WIN32_SURFACE_FEATURE)
7803 AC_SUBST(OS2_SURFACE_FEATURE)
7804 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
7805 AC_SUBST(FT_FONT_FEATURE)
7806 AC_SUBST(FC_FONT_FEATURE)
7807 AC_SUBST(WIN32_FONT_FEATURE)
7808 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
7809 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
7810 AC_SUBST(QUARTZ_FONT_FEATURE)
7811 AC_SUBST(PNG_FUNCTIONS_FEATURE)
7812 AC_SUBST(QT_SURFACE_FEATURE)
7813 AC_SUBST(TEE_SURFACE_FEATURE)
7815 MOZ_CAIRO_OSLIBS='${CAIRO_FT_OSLIBS}'
7817 if test "$MOZ_X11"; then
7818 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
7821 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
7823 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
7824 MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
7825 MOZ_CAIRO_LIBS="$CAIRO_LIBS"
7826 PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
7827 if test "$MOZ_X11"; then
7828 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
7829 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
7830 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
7831 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
7835 AC_SUBST(MOZ_TREE_CAIRO)
7836 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
7837 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
7838 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
7839 AC_SUBST(MOZ_TREE_PIXMAN)
7841 dnl ========================================================
7843 dnl ========================================================
7844 if test "$MOZ_ENABLE_SKIA"; then
7845 AC_DEFINE(MOZ_ENABLE_SKIA)
7847 if test "${MOZ_WIDGET_TOOLKIT}" = "android" -o x"$MOZ_WIDGET_TOOLKIT" = x"gonk"; then
7848 AC_DEFINE(SK_BUILD_FOR_ANDROID_NDK)
7851 if test "${CPU_ARCH}" != "ppc" -a "${CPU_ARCH}" != "ppc64" -a "${CPU_ARCH}" != "sparc" -a -z "$MOZ_DISABLE_SKIA_GPU" ; then
7852 MOZ_ENABLE_SKIA_GPU=1
7853 AC_DEFINE(USE_SKIA_GPU)
7854 AC_SUBST(MOZ_ENABLE_SKIA_GPU)
7857 AC_SUBST(MOZ_ENABLE_SKIA)
7859 dnl ========================================================
7861 dnl ========================================================
7862 MOZ_ARG_DISABLE_BOOL(xul,
7863 [ --disable-xul Disable XUL],
7865 if test "$MOZ_XUL"; then
7868 dnl remove extensions that require XUL
7869 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
7874 dnl ========================================================
7875 dnl disable profile locking
7876 dnl do no use this in applications that can have more than
7877 dnl one process accessing the profile directory.
7878 dnl ========================================================
7879 MOZ_ARG_DISABLE_BOOL(profilelocking,
7880 [ --disable-profilelocking
7881 Disable profile locking],
7882 MOZ_PROFILELOCKING=,
7883 MOZ_PROFILELOCKING=1 )
7884 if test "$MOZ_PROFILELOCKING"; then
7885 AC_DEFINE(MOZ_PROFILELOCKING)
7888 dnl ========================================================
7889 dnl necko configuration options
7890 dnl ========================================================
7893 dnl option to disable various necko protocols
7895 MOZ_ARG_ENABLE_STRING(necko-protocols,
7896 [ --enable-necko-protocols[={http,ftp,default,all,none}]
7897 Enable/disable specific protocol handlers],
7898 [ for option in `echo $enableval | sed 's/,/ /g'`; do
7899 if test "$option" = "yes" -o "$option" = "all"; then
7900 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7901 elif test "$option" = "no" -o "$option" = "none"; then
7903 elif test "$option" = "default"; then
7904 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $NECKO_PROTOCOLS_DEFAULT"
7905 elif test `echo "$option" | grep -c \^-` != 0; then
7906 option=`echo $option | sed 's/^-//'`
7907 NECKO_PROTOCOLS=`echo "$NECKO_PROTOCOLS" | sed "s/ ${option}//"`
7909 NECKO_PROTOCOLS="$NECKO_PROTOCOLS $option"
7912 NECKO_PROTOCOLS="$NECKO_PROTOCOLS_DEFAULT")
7914 NECKO_PROTOCOLS=`$PYTHON ${srcdir}/build/unix/uniq.py ${NECKO_PROTOCOLS}`
7915 AC_SUBST_SET(NECKO_PROTOCOLS)
7916 for p in $NECKO_PROTOCOLS; do
7917 AC_DEFINE_UNQUOTED(NECKO_PROTOCOL_$p)
7918 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_PROTOCOL_$p"
7922 dnl option to disable necko's wifi scanner
7925 case "$OS_TARGET" in
7927 if test -n "$gonkdir"; then
7931 Darwin|DragonFly|FreeBSD|SunOS|WINNT)
7940 MOZ_ARG_DISABLE_BOOL(necko-wifi,
7941 [ --disable-necko-wifi Disable necko wifi scanner],
7945 if test "$NECKO_WIFI"; then
7946 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
7947 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
7949 AC_DEFINE(NECKO_WIFI)
7950 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
7952 AC_SUBST(NECKO_WIFI)
7953 AC_SUBST(NECKO_WIFI_DBUS)
7956 dnl option to disable cookies
7958 MOZ_ARG_DISABLE_BOOL(cookies,
7959 [ --disable-cookies Disable cookie support],
7962 AC_SUBST(NECKO_COOKIES)
7963 if test "$NECKO_COOKIES"; then
7964 AC_DEFINE(NECKO_COOKIES)
7965 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
7969 dnl Always build Marionette if not Android or B2G
7971 if test "$OS_TARGET" != Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
7972 AC_DEFINE(ENABLE_MARIONETTE)
7974 AC_SUBST(ENABLE_MARIONETTE)
7975 if test "$ENABLE_MARIONETTE"; then
7976 AC_DEFINE(ENABLE_MARIONETTE)
7980 dnl Build jsctypes on the platforms we can, unless it's explicitly disabled.
7982 MOZ_ARG_DISABLE_BOOL(ctypes,
7983 [ --disable-ctypes Disable js-ctypes],
7986 AC_SUBST(BUILD_CTYPES)
7987 if test "$BUILD_CTYPES"; then
7988 AC_DEFINE(BUILD_CTYPES)
7991 dnl Build Places if required
7992 if test "$MOZ_PLACES"; then
7993 AC_DEFINE(MOZ_PLACES)
7996 dnl Build SocialAPI if required
7997 if test "$MOZ_SOCIAL"; then
7998 AC_DEFINE(MOZ_SOCIAL)
8001 dnl Build Common JS modules provided by services.
8002 AC_SUBST(MOZ_SERVICES_COMMON)
8003 if test -n "$MOZ_SERVICES_COMMON"; then
8004 AC_DEFINE(MOZ_SERVICES_COMMON)
8007 dnl Build Services crypto component (used by Sync)
8008 AC_SUBST(MOZ_SERVICES_CRYPTO)
8009 if test -n "$MOZ_SERVICES_CRYPTO"; then
8010 AC_DEFINE(MOZ_SERVICES_CRYPTO)
8013 dnl Build Firefox Health Reporter Service
8014 AC_SUBST(MOZ_SERVICES_HEALTHREPORT)
8015 if test -n "$MOZ_SERVICES_HEALTHREPORT"; then
8016 AC_DEFINE(MOZ_SERVICES_HEALTHREPORT)
8019 dnl Build Services metrics component
8020 AC_SUBST(MOZ_SERVICES_METRICS)
8021 if test -n "$MOZ_SERVICES_METRICS"; then
8022 AC_DEFINE(MOZ_SERVICES_METRICS)
8025 dnl Build Notifications if required
8026 AC_SUBST(MOZ_SERVICES_NOTIFICATIONS)
8027 if test -n "$MOZ_SERVICES_NOTIFICATIONS"; then
8028 AC_DEFINE(MOZ_SERVICES_NOTIFICATIONS)
8031 dnl Build Sync Services if required
8032 AC_SUBST(MOZ_SERVICES_SYNC)
8033 if test -n "$MOZ_SERVICES_SYNC"; then
8034 AC_DEFINE(MOZ_SERVICES_SYNC)
8037 dnl Build Services/CloudSync if required
8038 AC_SUBST(MOZ_SERVICES_CLOUDSYNC)
8039 if test -n "$MOZ_SERVICES_CLOUDSYNC"; then
8040 AC_DEFINE(MOZ_SERVICES_CLOUDSYNC)
8043 dnl Build Captive Portal Detector if required
8044 AC_SUBST(MOZ_CAPTIVEDETECT)
8045 if test -n "$MOZ_CAPTIVEDETECT"; then
8046 AC_DEFINE(MOZ_CAPTIVEDETECT)
8049 dnl Build second screen and casting features for external devices if required
8050 AC_SUBST(MOZ_DEVICES)
8051 if test -n "$MOZ_DEVICES"; then
8052 AC_DEFINE(MOZ_DEVICES)
8055 dnl ========================================================
8056 if test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
8057 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
8060 dnl ========================================================
8062 dnl = Maintainer debug option (no --enable equivalent)
8064 dnl ========================================================
8069 AC_SUBST(AR_EXTRACT)
8073 AC_SUBST(AS_DASH_C_FLAG)
8082 AC_SUBST(MOZ_WIDGET_TOOLKIT)
8083 AC_SUBST(MOZ_UPDATE_XTERM)
8084 AC_SUBST(MOZ_AUTH_EXTENSION)
8085 AC_SUBST(MOZ_PERMISSIONS)
8086 AC_SUBST(MOZ_PREF_EXTENSIONS)
8088 AC_SUBST(MOZ_DEBUG_SYMBOLS)
8089 AC_SUBST(MOZ_DEBUG_ENABLE_DEFS)
8090 AC_SUBST(MOZ_DEBUG_DISABLE_DEFS)
8091 AC_SUBST(MOZ_DEBUG_LDFLAGS)
8092 AC_SUBST(WARNINGS_AS_ERRORS)
8093 AC_SUBST(MOZ_EXTENSIONS)
8096 AC_SUBST(MOZ_INSTRUMENTS)
8097 AC_SUBST(MOZ_CALLGRIND)
8099 AC_SUBST(MOZ_PROFILING)
8101 AC_SUBST(MOZ_PLACES)
8102 AC_SUBST(MOZ_SOCIAL)
8103 AC_SUBST(MOZ_TOOLKIT_SEARCH)
8105 AC_SUBST(NS_PRINTING)
8106 AC_SUBST(MOZ_HELP_VIEWER)
8107 AC_SUBST(TOOLCHAIN_PREFIX)
8116 AC_SUBST(MOZ_PROFILELOCKING)
8118 AC_SUBST(ENABLE_TESTS)
8119 AC_SUBST(MOZ_UNIVERSALCHARDET)
8120 AC_SUBST(ACCESSIBILITY)
8121 AC_SUBST(MOZ_SPELLCHECK)
8122 AC_SUBST(MOZ_ANDROID_APZ)
8123 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
8124 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
8125 AC_SUBST(MOZ_ENABLE_SIGNMAR)
8126 AC_SUBST(MOZ_UPDATER)
8128 AC_SUBST(MOZ_ANGLE_RENDERER)
8129 AC_SUBST(MOZ_D3D_CPU_SUFFIX)
8130 AC_SUBST(MOZ_HAS_WINSDK_WITH_D3D)
8131 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL)
8132 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL_PATH)
8134 AC_SUBST(MOZ_ANDROID_HISTORY)
8135 AC_SUBST(MOZ_WEBSMS_BACKEND)
8136 AC_SUBST(MOZ_ANDROID_BEAM)
8137 AC_SUBST(MOZ_LOCALE_SWITCHER)
8138 AC_SUBST(MOZ_DISABLE_GECKOVIEW)
8139 AC_SUBST(MOZ_ANDROID_GECKOLIBS_AAR)
8140 AC_SUBST(MOZ_ANDROID_READING_LIST_SERVICE)
8141 AC_SUBST(MOZ_ANDROID_SEARCH_ACTIVITY)
8142 AC_SUBST(MOZ_ANDROID_SHARE_OVERLAY)
8143 AC_SUBST(MOZ_ANDROID_TAB_QUEUE)
8144 AC_SUBST(MOZ_ANDROID_MLS_STUMBLER)
8145 AC_SUBST(MOZ_ANDROID_DOWNLOADS_INTEGRATION)
8146 AC_SUBST(ENABLE_STRIP)
8147 AC_SUBST(PKG_SKIP_STRIP)
8148 AC_SUBST(STRIP_FLAGS)
8149 AC_SUBST(USE_ELF_HACK)
8150 AC_SUBST(INCREMENTAL_LINKER)
8151 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
8152 AC_SUBST(MOZ_COMPONENT_NSPR_LIBS)
8154 AC_SUBST(MOZ_FIX_LINK_PATHS)
8156 AC_SUBST(USE_DEPENDENT_LIBS)
8158 AC_SUBST(MOZ_BUILD_ROOT)
8160 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
8161 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
8162 AC_SUBST(MOZ_LINKER_EXTRACT)
8164 AC_SUBST(MOZ_JSDOWNLOADS)
8165 if test -n "$MOZ_JSDOWNLOADS"; then
8166 AC_DEFINE(MOZ_JSDOWNLOADS)
8169 dnl ========================================================
8170 dnl = Mac bundle name prefix
8171 dnl ========================================================
8172 MOZ_ARG_WITH_STRING(macbundlename-prefix,
8173 [ --with-macbundlename-prefix=prefix
8174 Prefix for MOZ_MACBUNDLE_NAME],
8175 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
8177 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
8178 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
8179 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
8182 if test "$MOZ_DEBUG"; then
8183 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
8185 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
8187 AC_SUBST(MOZ_MACBUNDLE_NAME)
8189 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
8190 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
8191 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
8192 if test "$MOZ_DEBUG"; then
8193 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
8196 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
8197 AC_SUBST(MOZ_MACBUNDLE_ID)
8199 dnl ========================================================
8200 dnl = Child Process Name for IPC
8201 dnl ========================================================
8202 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
8203 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
8205 # We want to let Android unpack the file at install time, but it only does
8206 # so if the file is named libsomething.so. The lib/ path is also required
8207 # because the unpacked file will be under the lib/ subdirectory and will
8208 # need to be executed from that path.
8209 MOZ_CHILD_PROCESS_NAME="lib/libplugin-container.so"
8211 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
8213 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
8214 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
8216 # The following variables are available to branding and application
8217 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
8218 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
8219 # impacts profile location and user-visible fields.
8220 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
8221 # versions of a given application (e.g. Aurora and Firefox both use
8222 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
8223 # for application.ini's "Name" field, which controls profile location in
8224 # the absence of a "Profile" field (see below), and various system
8225 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
8226 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
8227 # Mac Bundle name, Updater, Installer), it is typically used for nightly
8228 # builds (e.g. Aurora for Firefox).
8229 # - MOZ_APP_VERSION: Defines the application version number.
8230 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
8231 # defaults to a lowercase form of MOZ_APP_BASENAME.
8232 # - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
8233 # profile name and remoting. If not set, defaults to MOZ_APP_NAME.
8234 # - MOZ_APP_PROFILE: When set, used for application.ini's
8235 # "Profile" field, which controls profile location.
8236 # - MOZ_APP_ID: When set, used for application.ini's "ID" field.
8237 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
8239 if test -z "$MOZ_APP_NAME"; then
8240 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
8243 if test -z "$MOZ_APP_REMOTINGNAME"; then
8244 MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
8247 # For extensions and langpacks, we require a max version that is compatible
8248 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
8249 # 24.0a1 and 24.0a2 aren't affected
8251 # 24.1.1 becomes 24.*
8252 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
8253 if test -z "$IS_ALPHA"; then
8255 if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
8256 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
8258 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
8262 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
8265 MOZ_B2G_VERSION=${MOZ_B2G_VERSION:-"1.0.0"}
8266 AC_DEFINE_UNQUOTED(MOZ_B2G_VERSION,"$MOZ_B2G_VERSION")
8267 AC_DEFINE_UNQUOTED(MOZ_B2G_OS_NAME,"$MOZ_B2G_OS_NAME")
8269 AC_SUBST(MOZ_APP_NAME)
8270 AC_SUBST(MOZ_APP_REMOTINGNAME)
8271 AC_SUBST(MOZ_APP_DISPLAYNAME)
8272 AC_SUBST(MOZ_APP_BASENAME)
8273 AC_SUBST(MOZ_APP_VENDOR)
8274 AC_SUBST(MOZ_APP_PROFILE)
8275 AC_SUBST(MOZ_APP_ID)
8276 AC_SUBST(MAR_CHANNEL_ID)
8277 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
8278 AC_SUBST(MOZ_PROFILE_MIGRATOR)
8279 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
8280 AC_SUBST(MOZ_APP_UA_NAME)
8281 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
8282 AC_SUBST(MOZ_APP_VERSION)
8283 AC_SUBST(MOZ_APP_MAXVERSION)
8284 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
8285 AC_SUBST(FIREFOX_VERSION)
8286 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
8287 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
8288 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
8291 AC_DEFINE_UNQUOTED(MOZ_UA_BUILDID, "$MOZ_UA_BUILDID")
8292 AC_SUBST(MOZ_UA_BUILDID)
8294 AC_SUBST(MOZ_APP_STATIC_INI)
8296 AC_SUBST(MOZ_PKG_SPECIAL)
8298 AC_SUBST(MOZILLA_OFFICIAL)
8300 # Build revisions should always be present in official builds
8301 if test "$MOZILLA_OFFICIAL"; then
8302 MOZ_INCLUDE_SOURCE_INFO=1
8305 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
8307 AC_DEFINE_UNQUOTED(MOZ_TELEMETRY_DISPLAY_REV, 2)
8308 AC_SUBST(MOZ_TELEMETRY_DISPLAY_REV)
8310 if test "$MOZ_TELEMETRY_REPORTING"; then
8311 AC_DEFINE(MOZ_TELEMETRY_REPORTING)
8313 # Enable Telemetry by default for nightly and aurora channels
8314 if test -z "$RELEASE_BUILD"; then
8315 AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
8319 dnl If we have any service that uploads data (and requires data submission
8320 dnl policy alert), set MOZ_DATA_REPORTING.
8321 dnl We need SUBST for build system and DEFINE for xul preprocessor.
8322 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT"; then
8323 MOZ_DATA_REPORTING=1
8324 AC_DEFINE(MOZ_DATA_REPORTING)
8325 AC_SUBST(MOZ_DATA_REPORTING)
8329 AC_SUBST(MOZ_BROWSE_INFO)
8330 AC_SUBST(MOZ_TOOLS_DIR)
8331 AC_SUBST(WIN32_REDIST_DIR)
8334 dnl Echo the CFLAGS to remove extra whitespace.
8340 $_WARNINGS_CXXFLAGS \
8343 COMPILE_CFLAGS=`echo \
8348 COMPILE_CXXFLAGS=`echo \
8349 $_DEFINES_CXXFLAGS \
8357 HOST_CXXFLAGS=`echo \
8361 AC_SUBST(MOZ_NATIVE_JPEG)
8362 AC_SUBST(MOZ_NATIVE_PNG)
8363 AC_SUBST(MOZ_NATIVE_BZ2)
8365 AC_SUBST(MOZ_JPEG_CFLAGS)
8366 AC_SUBST_LIST(MOZ_JPEG_LIBS)
8367 AC_SUBST(MOZ_BZ2_CFLAGS)
8368 AC_SUBST_LIST(MOZ_BZ2_LIBS)
8369 AC_SUBST(MOZ_PNG_CFLAGS)
8370 AC_SUBST_LIST(MOZ_PNG_LIBS)
8372 if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_NUWA_PROCESS"; then
8373 export MOZ_NUWA_PROCESS
8374 AC_DEFINE(MOZ_NUWA_PROCESS)
8376 AC_SUBST(MOZ_NUWA_PROCESS)
8377 if test "$MOZ_WIDGET_TOOLKIT" = gonk -a -n "$MOZ_B2G_LOADER"; then
8378 if test -z "$MOZ_NUWA_PROCESS"; then
8379 AC_MSG_ERROR([B2G loader works with Nuwa]);
8381 export MOZ_B2G_LOADER
8382 AC_DEFINE(MOZ_B2G_LOADER)
8384 AC_SUBST(MOZ_B2G_LOADER)
8386 AC_SUBST(NSPR_CFLAGS)
8387 AC_SUBST(MOZ_NATIVE_NSPR)
8389 AC_SUBST(NSS_CFLAGS)
8390 AC_SUBST(MOZ_NATIVE_NSS)
8391 AC_SUBST(NSS_DISABLE_DBM)
8394 OS_CXXFLAGS="$CXXFLAGS"
8395 OS_CPPFLAGS="$CPPFLAGS"
8396 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
8397 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
8398 OS_LDFLAGS="$LDFLAGS"
8401 AC_SUBST(OS_CXXFLAGS)
8402 AC_SUBST(OS_CPPFLAGS)
8403 AC_SUBST(OS_COMPILE_CFLAGS)
8404 AC_SUBST(OS_COMPILE_CXXFLAGS)
8405 AC_SUBST(OS_LDFLAGS)
8407 AC_SUBST(CROSS_COMPILE)
8408 AC_SUBST(WCHAR_CFLAGS)
8412 AC_SUBST(HOST_CFLAGS)
8413 AC_SUBST(HOST_CXXFLAGS)
8414 AC_SUBST(HOST_LDFLAGS)
8415 AC_SUBST(HOST_OPTIMIZE_FLAGS)
8417 AC_SUBST(HOST_AR_FLAGS)
8419 AC_SUBST(HOST_RANLIB)
8420 AC_SUBST(HOST_NSPR_MDCPUCFG)
8421 AC_SUBST(HOST_BIN_SUFFIX)
8422 AC_SUBST(HOST_OS_ARCH)
8424 AC_SUBST(TARGET_CPU)
8425 AC_SUBST(TARGET_VENDOR)
8427 AC_SUBST(TARGET_NSPR_MDCPUCFG)
8428 AC_SUBST(TARGET_MD_ARCH)
8429 AC_SUBST(TARGET_XPCOM_ABI)
8432 AC_SUBST(OS_RELEASE)
8435 AC_SUBST(INTEL_ARCHITECTURE)
8436 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
8437 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
8438 AC_SUBST(HAVE_X86_AVX2)
8439 AC_SUBST(GCC_USE_GNU_LD)
8441 AC_SUBST(MOZ_CHROME_FILE_FORMAT)
8443 AC_SUBST(WRAP_LDFLAGS)
8446 AC_SUBST(MKSHLIB_FORCE_ALL)
8447 AC_SUBST(MKSHLIB_UNFORCE_ALL)
8448 AC_SUBST(DSO_CFLAGS)
8449 AC_SUBST(DSO_PIC_CFLAGS)
8450 AC_SUBST(DSO_LDOPTS)
8451 AC_SUBST(LIB_PREFIX)
8452 AC_SUBST(DLL_PREFIX)
8453 AC_SUBST(DLL_SUFFIX)
8454 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
8455 AC_SUBST(LIB_SUFFIX)
8456 AC_SUBST(OBJ_SUFFIX)
8457 AC_SUBST(BIN_SUFFIX)
8458 AC_SUBST(ASM_SUFFIX)
8459 AC_SUBST(IMPORT_LIB_SUFFIX)
8461 AC_SUBST(CC_VERSION)
8462 AC_SUBST(CXX_VERSION)
8463 AC_SUBST(MSMANIFEST_TOOL)
8464 AC_SUBST(NS_ENABLE_TSF)
8465 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
8466 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
8469 AC_SUBST(MOZ_VORBIS)
8470 AC_SUBST(MOZ_TREMOR)
8473 AC_SUBST(MOZ_FFMPEG)
8475 AC_SUBST(MOZ_DIRECTSHOW)
8476 AC_SUBST(MOZ_ANDROID_OMX)
8477 AC_SUBST(MOZ_APPLEMEDIA)
8478 AC_SUBST(MOZ_OMX_PLUGIN)
8479 AC_SUBST(MOZ_VPX_ERROR_CONCEALMENT)
8482 AC_SUBST(VPX_ASFLAGS)
8483 AC_SUBST(VPX_DASH_C_FLAG)
8484 AC_SUBST(VPX_AS_CONVERSION)
8485 AC_SUBST(VPX_ASM_SUFFIX)
8486 AC_SUBST(VPX_X86_ASM)
8487 AC_SUBST(VPX_ARM_ASM)
8488 AC_SUBST(VPX_NEED_OBJ_INT_EXTRACT)
8489 AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
8490 AC_SUBST(MOZ_CODE_COVERAGE)
8491 AC_SUBST(LIBJPEG_TURBO_AS)
8492 AC_SUBST(LIBJPEG_TURBO_ASFLAGS)
8493 AC_SUBST(LIBJPEG_TURBO_X86_ASM)
8494 AC_SUBST(LIBJPEG_TURBO_X64_ASM)
8495 AC_SUBST(LIBJPEG_TURBO_ARM_ASM)
8496 AC_SUBST(LIBJPEG_TURBO_ARM64_ASM)
8497 AC_SUBST(LIBJPEG_TURBO_MIPS_ASM)
8499 AC_SUBST(MOZ_PACKAGE_JSSHELL)
8500 AC_SUBST(MOZ_FOLD_LIBS)
8501 AC_SUBST(SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE)
8503 AC_SUBST(MOZ_ENABLE_SZIP)
8504 AC_SUBST(MOZ_SZIP_FLAGS)
8506 AC_DEFINE(MOZ_PHOENIX_EXTENSIONS)
8507 AC_SUBST(MOZ_PHOENIX_EXTENSIONS)
8509 dnl Host JavaScript runtime, if any, to use during cross compiles.
8512 if test "$MOZ_DEBUG"; then
8515 AC_SUBST(MOZ_EM_DEBUG)
8517 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
8519 if test -n "$COMPILE_ENVIRONMENT"; then
8520 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
8522 dnl Check for missing components
8523 if test "$MOZ_X11"; then
8524 if test "$WITHOUT_X11"; then
8525 AC_MSG_ERROR([--without-x specified and MOZ_X11 still defined])
8527 dnl ====================================================
8528 dnl = Check if X headers exist
8529 dnl ====================================================
8530 _SAVE_CFLAGS=$CFLAGS
8531 CFLAGS="$CFLAGS $XCFLAGS"
8535 #include <X11/Xlib.h>
8536 #include <X11/Intrinsic.h>
8537 #include <X11/extensions/XShm.h>
8541 if ((dpy = XOpenDisplay(NULL)) == NULL) {
8542 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
8546 [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
8547 CFLAGS="$_SAVE_CFLAGS"
8549 if test -n "$MISSING_X"; then
8550 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
8555 fi # COMPILE_ENVIRONMENT
8557 dnl Set various defines and substitutions
8558 dnl ========================================================
8560 if test "$OS_ARCH" != "WINNT"; then
8564 if test "$MOZ_DEBUG"; then
8565 AC_DEFINE(MOZ_REFLOW_PERF)
8566 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
8569 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
8570 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
8571 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
8572 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
8573 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
8574 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
8575 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
8576 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
8577 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
8580 if test -n "$MOZ_DEV_EDITION"; then
8581 AC_DEFINE(MOZ_DEV_EDITION)
8584 if test "$MOZ_DEBUG"; then
8587 case "$MOZ_UPDATE_CHANNEL" in
8588 aurora|beta|release|esr)
8595 if test -n "$A11Y_LOG"; then
8599 AC_SUBST(MOZILLA_VERSION)
8601 AC_SUBST(ac_configure_args)
8603 dnl ========================================================
8605 dnl ========================================================
8607 DIRECTIVE4_LIST="MOZ_OFFICIAL_BRANDING=$MOZ_OFFICIAL_BRANDING
8608 MOZ_BRANDING_DIRECTORY=$MOZ_BRANDING_DIRECTORY
8609 MOZ_PHOENIX=$MOZ_PHOENIX
8610 MOZ_SANDBOX=$MOZ_SANDBOX
8611 MOZ_NATIVE_LIBEVENT=$MOZ_NATIVE_LIBEVENT
8612 MOZ_NATIVE_NSS=$MOZ_NATIVE_NSS
8613 MOZ_NATIVE_NSPR=$MOZ_NATIVE_NSPR
8614 MOZ_NATIVE_JPEG=$MOZ_NATIVE_JPEG
8615 MOZ_NATIVE_ZLIB=$MOZ_NATIVE_ZLIB
8616 MOZ_NATIVE_BZ2=$MOZ_NATIVE_BZ2
8617 MOZ_NATIVE_PNG=$MOZ_NATIVE_PNG
8618 MOZ_NATIVE_LIBVPX=$MOZ_NATIVE_LIBVPX
8619 MOZ_NATIVE_SQLITE=$MOZ_NATIVE_SQLITE
8620 MOZ_NATIVE_JEMALLOC=$MOZ_NATIVE_JEMALLOC"
8622 DIRECTIVE4=`$PYTHON $_topsrcdir/build/directive4.py $DIRECTIVE4_LIST`
8624 if test -n "$DIRECTIVE4"; then
8625 if test -n "$MC_PRIVATE_BUILD"; then
8626 AC_MSG_WARN([Private Build - The configuration you have chosen to use with official branding deviates from official build configuration. Your build is thus for personal and private use only and must not be (re)distributed - Please see: http://www.palemoon.org/redist.shtml])
8628 AC_MSG_ERROR([Branding Violation - Please see: http://www.palemoon.org/redist.shtml])
8632 AC_SUBST(DIRECTIVE4)
8634 dnl Spit out some output
8635 dnl ========================================================
8637 dnl The following defines are used by xpcom
8638 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
8640 HAVE_CPP_AMBIGUITY_RESOLVING_USING
8641 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
8642 HAVE_CPP_PARTIAL_SPECIALIZATION
8645 HAVE_ICONV_WITH_CONST_INPUT
8658 dnl ========================================================
8660 dnl ========================================================
8662 # Internationalization isn't built or exposed by default in non-desktop
8663 # builds. Bugs to enable:
8665 # Android: bug 864843
8668 if test "$MOZ_WIDGET_TOOLKIT" = "android" ||
8669 test "$MOZ_BUILD_APP" = "b2g" ||
8670 test "$MOZ_BUILD_APP" = "b2g/dev"; then
8676 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
8680 if test "$OS_TARGET" = WINNT; then
8686 if test -z "$JS_SHARED_LIBRARY"; then
8687 AC_DEFINE(MOZ_STATIC_JS)
8689 AC_SUBST(JS_SHARED_LIBRARY)
8691 MOZ_CREATE_CONFIG_STATUS()
8693 # No need to run subconfigures when building with LIBXUL_SDK_DIR
8694 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
8695 MOZ_SUBCONFIGURE_ICU()
8696 MOZ_SUBCONFIGURE_FFI()
8699 # Hack around an Apple bug that affects the egrep that comes with OS X 10.7.
8700 # "env ARCHPREFERENCE=i386,x86_64 arch egrep" first tries to use the 32-bit
8701 # Intel part of the egrep fat binary, even on 64-bit systems, and falls back on
8702 # the 64-bit part if it's not a fat binary, as can happen with MacPorts. We
8703 # (apparently) only need this hack when egrep's "pattern" is particularly long
8704 # (as in the following code) and the first egrep on our $PATH is Apple's. See
8708 FIXED_EGREP="env ARCHPREFERENCE=i386,x86_64 arch egrep"
8715 # Run jemalloc configure script
8717 if test -z "$MOZ_NATIVE_JEMALLOC" -a "$MOZ_MEMORY" && test -n "$MOZ_JEMALLOC3" -o -n "$MOZ_REPLACE_MALLOC"; then
8718 ac_configure_args="--build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_ --disable-valgrind"
8719 if test -n "$MOZ_REPLACE_MALLOC"; then
8720 # When using replace_malloc, we always want memalign and valloc exported from jemalloc.
8721 ac_configure_args="$ac_configure_args ac_cv_func_memalign=yes"
8722 ac_configure_args="$ac_configure_args ac_cv_func_valloc=yes"
8724 if test -n "$MOZ_JEMALLOC3"; then
8725 case "${OS_ARCH}" in
8727 # We want jemalloc functions to be kept hidden on both Mac and Windows
8728 # See memory/build/mozmemory_wrap.h for details.
8729 ac_configure_args="$ac_configure_args --without-export"
8732 elif test "${OS_ARCH}" = Darwin; then
8733 # When building as a replace-malloc lib, disabling the zone allocator
8734 # forces to use pthread_atfork.
8735 ac_configure_args="$ac_configure_args --disable-zone-allocator"
8737 _MANGLE="malloc posix_memalign aligned_alloc calloc realloc free memalign valloc malloc_usable_size"
8739 if test -z "$MOZ_REPLACE_MALLOC"; then
8741 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
8745 elif test -z "$MOZ_JEMALLOC3"; then
8747 JEMALLOC_WRAPPER=replace_
8749 if test -n "$MANGLE"; then
8751 for mangle in ${MANGLE}; do
8752 if test -n "$MANGLED"; then
8753 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED"
8755 MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle"
8758 ac_configure_args="$ac_configure_args --with-mangling=$MANGLED"
8761 if test -z "$MOZ_TLS"; then
8762 ac_configure_args="$ac_configure_args --disable-tls"
8764 EXTRA_CFLAGS="$CFLAGS"
8765 for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do
8766 ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
8768 if test "$CROSS_COMPILE"; then
8769 ac_configure_args="$ac_configure_args je_cv_static_page_shift=12"
8771 # Force disable DSS support in jemalloc.
8772 ac_configure_args="$ac_configure_args ac_cv_func_sbrk=false"
8774 # Make Linux builds munmap freed chunks instead of recycling them.
8775 ac_configure_args="$ac_configure_args --enable-munmap"
8777 if ! test -e memory/jemalloc; then
8778 mkdir -p memory/jemalloc
8781 AC_OUTPUT_SUBDIRS(memory/jemalloc/src)
8782 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8785 # Run freetype configure script
8787 if test "$MOZ_TREE_FREETYPE"; then
8788 export CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS -std=c99"
8789 export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS"
8790 export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS"
8791 export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS"
8792 # Spaces in the *_CFLAGS and *_LIBS variables are intentionally placed
8793 # to force freetype to use our settings rather than autodetecting
8794 if test -n "$MOZ_NATIVE_PNG"; then
8795 export LIBPNG_CFLAGS="$MOZ_PNG_CFLAGS "
8797 export LIBPNG_CFLAGS="-I$_objdir/dist/include"
8799 export LIBPNG_LIBS="$MOZ_PNG_LIBS "
8800 export ZLIB_CFLAGS="$MOZ_ZLIB_CFLAGS "
8801 export ZLIB_LIBS="$MOZ_ZLIB_LIBS "
8802 export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
8803 ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes --with-zlib=yes --without-bzip2 --with-png=yes --without-harfbuzz"
8805 if ! test -e modules; then
8808 # Only export CC, CXX and RANLIB for the subconfigure, and avoid spilling
8809 # that further down the road.
8810 (export CC CXX RANLIB;
8811 AC_OUTPUT_SUBDIRS(modules/freetype2)
8815 if test -z "$direct_nspr_config"; then
8816 dnl ========================================================
8817 dnl = Setup a nice relatively clean build environment for
8818 dnl = sub-configures.
8819 dnl ========================================================
8822 CFLAGS="$_SUBDIR_CFLAGS"
8823 CPPFLAGS="$_SUBDIR_CPPFLAGS"
8824 CXXFLAGS="$_SUBDIR_CXXFLAGS"
8825 LDFLAGS="$_SUBDIR_LDFLAGS"
8826 HOST_CC="$_SUBDIR_HOST_CC"
8827 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8828 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
8829 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
8836 # Run all configure scripts specified by a subconfigure
8837 if test -n "$_subconfigure_subdir"; then
8838 _save_srcdir="$srcdir"
8840 _save_ac_configure_args="$ac_configure_args"
8841 ac_configure_args="$_subconfigure_config_args"
8842 AC_OUTPUT_SUBDIRS_NOW("$_subconfigure_subdir",$cache_file)
8843 ac_configure_args="$_save_ac_configure_args"
8844 srcdir="$_save_srcdir"
8847 # No need to run subconfigures when building with LIBXUL_SDK_DIR
8848 if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
8852 MOZ_SUBCONFIGURE_NSPR()
8854 dnl ========================================================
8855 dnl = Setup a nice relatively clean build environment for
8856 dnl = sub-configures.
8857 dnl ========================================================
8860 CFLAGS="$_SUBDIR_CFLAGS"
8861 CPPFLAGS="$_SUBDIR_CPPFLAGS"
8862 CXXFLAGS="$_SUBDIR_CXXFLAGS"
8863 LDFLAGS="$_SUBDIR_LDFLAGS"
8864 HOST_CC="$_SUBDIR_HOST_CC"
8865 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
8866 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
8867 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
8870 # Run the SpiderMonkey 'configure' script.
8871 dist=$MOZ_BUILD_ROOT/dist
8872 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8874 # --with-system-nspr will have been converted into the relevant $NSPR_CFLAGS
8876 ac_configure_args="`echo $ac_configure_args | sed -e 's/--with-system-nspr\S* *//'`"
8878 ac_configure_args="$ac_configure_args --enable-threadsafe"
8880 if test "$_INTL_API" = no; then
8881 ac_configure_args="$ac_configure_args --without-intl-api"
8884 if test "$BUILD_CTYPES"; then
8885 # Build js-ctypes on the platforms we can.
8886 ac_configure_args="$ac_configure_args --enable-ctypes"
8888 if test -z "$JS_SHARED_LIBRARY" ; then
8889 ac_configure_args="$ac_configure_args --disable-shared-js"
8890 if test -n "$MOZ_DISABLE_EXPORT_JS"; then
8891 ac_configure_args="$ac_configure_args --disable-export-js"
8894 if test -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
8895 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
8896 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
8898 ac_configure_args="$ac_configure_args --prefix=$dist"
8899 if test "$MOZ_MEMORY"; then
8900 ac_configure_args="$ac_configure_args --enable-jemalloc"
8902 if test -n "$MOZ_GLUE_IN_PROGRAM"; then
8903 export MOZ_GLUE_IN_PROGRAM
8905 if test -n "$ZLIB_IN_MOZGLUE"; then
8908 export MOZ_NATIVE_ZLIB
8909 export MOZ_ZLIB_CFLAGS
8910 export MOZ_ZLIB_LIBS
8912 export MOZ_APP_REMOTINGNAME
8913 export DONT_POPULATE_VIRTUALENV=1
8915 export MOZILLA_CENTRAL_PATH=$_topsrcdir
8916 export STLPORT_CPPFLAGS
8918 export JS_STANDALONE=no
8920 export ZLIB_IN_MOZGLUE
8922 if ! test -e js; then
8926 AC_OUTPUT_SUBDIRS(js/src,$cache_file)
8927 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
8929 fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
8931 export WRITE_MOZINFO=1
8932 dnl we need to run config.status after js/src subconfigure because we're
8933 dnl traversing its moz.build and we need its config.status for that.
8934 dnl However, writing our own config.status needs to happen before
8935 dnl subconfigures because the setup surrounding subconfigures alters
8936 dnl many AC_SUBSTed variables.
8937 MOZ_RUN_CONFIG_STATUS()