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 ========================================================
10 AC_INIT(config/config.mk)
11 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
14 dnl ========================================================
16 dnl = Don't change the following two lines. Doing so breaks:
18 dnl = CFLAGS="-foo" ./configure
20 dnl ========================================================
22 CPPFLAGS="${CPPFLAGS=}"
23 CXXFLAGS="${CXXFLAGS=}"
25 HOST_CFLAGS="${HOST_CFLAGS=}"
26 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
27 HOST_LDFLAGS="${HOST_LDFLAGS=}"
29 dnl ========================================================
30 dnl = Preserve certain environment flags passed to configure
31 dnl = We want sub projects to receive the same flags
32 dnl = untainted by this configure script
33 dnl ========================================================
36 _SUBDIR_CFLAGS="$CFLAGS"
37 _SUBDIR_CPPFLAGS="$CPPFLAGS"
38 _SUBDIR_CXXFLAGS="$CXXFLAGS"
39 _SUBDIR_LDFLAGS="$LDFLAGS"
40 _SUBDIR_HOST_CC="$HOST_CC"
41 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
42 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
43 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
44 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
46 dnl Set the version number of the libs included with mozilla
47 dnl ========================================================
54 dnl Set the minimum version of toolkit libs used by mozilla
55 dnl ========================================================
57 # 2_26 is the earliest version we can set GLIB_VERSION_MIN_REQUIRED.
58 # The macro won't be used when compiling with earlier versions anyway.
59 GLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_26
64 GDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_4
65 WINDRES_VERSION=2.14.90
69 STARTUP_NOTIFICATION_VERSION=0.8
73 dnl Set various checks
74 dnl ========================================================
77 dnl Initialize the Pthread test variables early so they can be
78 dnl overridden by each platform.
79 dnl ========================================================
85 if test "$COMPILE_ENVIRONMENT"; then
87 fi # COMPILE_ENVIRONMENT
89 if test -n "$gonkdir"; then
90 dnl export for js/src/configure. We can't pass the option down normally,
91 dnl because it's a `--enable-project=b2g`-only option.
93 kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
94 android_source="$gonkdir"
95 ANDROID_SOURCE="$android_source"
97 case "$android_version" in
99 CPPFLAGS="-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/dalvik/libnativehelper/include/nativehelper $CPPFLAGS"
103 CPPFLAGS="-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 $CPPFLAGS"
107 CPPFLAGS="-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 $CPPFLAGS"
110 AC_SUBST(MOZ_AUDIO_OFFLOAD)
111 AC_DEFINE(MOZ_AUDIO_OFFLOAD)
114 CPPFLAGS="-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 $CPPFLAGS"
116 AC_SUBST(MOZ_AUDIO_OFFLOAD)
117 AC_DEFINE(MOZ_AUDIO_OFFLOAD)
120 AC_MSG_ERROR([Unsupported platform version: $android_version])
124 CPPFLAGS="-I$gonkdir/system -I$gonkdir/system/core/include -I$gonkdir/hardware/libhardware/include -I$gonkdir/external/valgrind/fxos-include $CPPFLAGS"
125 LDFLAGS="-L$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib -Wl,-rpath-link=$gonkdir/out/target/product/$GONK_PRODUCT/obj/lib $LDFLAGS"
128 AC_DEFINE_UNQUOTED(ANDROID_VERSION, $android_version)
129 AC_DEFINE(HAVE_SYS_UIO_H)
130 AC_DEFINE(HAVE_PTHREADS)
132 dnl ANDROID_VERSION is only required for the AC_SUBST below
133 ANDROID_VERSION=$android_version
134 AC_SUBST(ANDROID_VERSION)
140 *-android*|*-linuxandroid*)
145 AC_PATH_PROG(OBJCOPY,objcopy)
156 AC_SUBST(ANDROID_SOURCE)
157 AC_SUBST(ANDROID_PACKAGE_NAME)
160 dnl ========================================================
161 dnl Checks for compilers.
162 dnl ========================================================
164 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
167 if test "$COMPILE_ENVIRONMENT"; then
169 if test "$target" != "$host"; then
175 # Work around the conftest.exe access problem on Windows
180 MOZ_PATH_PROGS(AS, $AS as, $CC)
181 AC_CHECK_PROGS(AR, ar, :)
182 AC_CHECK_PROGS(STRIP, strip, :)
183 AC_CHECK_PROGS(WINDRES, windres, :)
184 AC_CHECK_PROGS(OTOOL, otool, :)
185 if test -z "$HOST_RANLIB"; then
186 HOST_RANLIB="$RANLIB"
188 if test -z "$HOST_AR"; then
191 if test -z "$HOST_AR_FLAGS"; then
192 HOST_AR_FLAGS="$AR_FLAGS"
196 if test -n "$MOZ_WINCONSOLE"; then
197 AC_DEFINE(MOZ_WINCONSOLE)
202 dnl ========================================================
203 dnl Special win32 checks
204 dnl ========================================================
210 if test "$GCC" != "yes"; then
211 # Check to see if we are really running in a msvc environemnt
213 AC_CHECK_PROGS(MIDL, midl)
215 # Make sure compilers are valid
216 CFLAGS="$CFLAGS -TC -nologo"
217 CXXFLAGS="$CXXFLAGS -TP -nologo"
220 AC_TRY_COMPILE([#include <stdio.h>],
221 [ printf("Hello World\n"); ],,
222 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
225 AC_TRY_COMPILE([#include <new.h>],
226 [ unsigned *test = new unsigned(42); ],,
227 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
231 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
234 _MSC_VER=`echo ${CC_VERSION} | cut -c 1-2,4-5`
236 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
237 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
238 AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
240 case "$CC_VERSION" in
244 MSVC_C_RUNTIME_DLL=vcruntime140.dll
245 MSVC_CXX_RUNTIME_DLL=msvcp140.dll
247 MOZ_CHECK_HEADER(dia2.h, MSVC_HAS_DIA_SDK=1)
248 if test -n "$MSVC_HAS_DIA_SDK"; then
249 AC_DEFINE(MSVC_HAS_DIA_SDK)
252 # C5026: move constructor was implicitly defined as deleted
253 CXXFLAGS="$CXXFLAGS -wd5026"
255 # C5027: move assignment operator was implicitly defined as deleted
256 CXXFLAGS="$CXXFLAGS -wd5027"
258 # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
259 CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
261 # https://connect.microsoft.com/VisualStudio/feedback/details/888527/warnings-on-dbghelp-h
262 # for dbghelp.h, imagehlp.h, and shobj.h
263 # C4091: 'typedef ': ignored on left of '' when no variable is declared
264 CFLAGS="$CFLAGS -wd4091"
265 CXXFLAGS="$CXXFLAGS -wd4091"
267 # This is intended as a temporary hack to support building with VS2015.
268 # 'noexcept' used with no exception handling mode specified;
269 # termination on exception is not guaranteed. Specify /EHsc
270 CXXFLAGS="$CXXFLAGS -wd4577"
272 if test -n "$WIN_UCRT_REDIST_DIR"; then
273 if test ! -d "$WIN_UCRT_REDIST_DIR"; then
274 AC_MSG_ERROR([Invalid Windows UCRT Redist directory: ${WIN_UCRT_REDIST_DIR}])
276 WIN_UCRT_REDIST_DIR=`cd "$WIN_UCRT_REDIST_DIR" && pwd -W`
280 AC_SUBST(MSVS_VERSION)
281 AC_SUBST(MSVC_HAS_DIA_SDK)
282 AC_SUBST(MSVC_C_RUNTIME_DLL)
283 AC_SUBST(MSVC_CXX_RUNTIME_DLL)
285 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
287 if test -n "$WIN32_REDIST_DIR"; then
288 if test ! -d "$WIN32_REDIST_DIR"; then
289 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
291 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd -W`
294 # Check linker version
295 _LD_FULL_VERSION=`"${LINK}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
296 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
297 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
298 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
303 # Set midl environment
306 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
309 MIDL_FLAGS="${MIDL_FLAGS} -env x64"
313 unset _MSVC_VER_FILTER
315 AC_CACHE_CHECK(for overridable _RAISE,
320 _SAVE_CXXFLAGS="$CXXFLAGS"
321 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
322 AC_TRY_COMPILE([#include <xstddef>
324 #define _RAISE(x) externallyDefinedFunction((x).what())
327 [std::vector<int> v; return v.at(1);],
328 ac_cv_have__RAISE="no",
329 ac_cv_have__RAISE="yes")
330 CXXFLAGS="$_SAVE_CXXFLAGS"
333 if test "$ac_cv_have__RAISE" = "yes"; then
335 MOZ_MSVC_STL_WRAP_RAISE=1
336 AC_DEFINE(MOZ_MSVC_STL_WRAP_RAISE)
338 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.])
341 if test "$WRAP_STL_INCLUDES" = "1"; then
342 STL_FLAGS="-I${DIST}/stl_wrappers"
344 CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
345 CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
347 # Check w32api version
348 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
349 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
350 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
351 AC_TRY_COMPILE([#include <w32api.h>],
352 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
353 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
354 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
355 #error "test failed."
357 , [ res=yes ], [ res=no ])
358 AC_MSG_RESULT([$res])
359 if test "$res" != "yes"; then
360 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
362 # Check windres version
363 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
364 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
365 AC_MSG_RESULT([$_WINDRES_VERSION])
366 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
367 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
368 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
369 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
370 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
371 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
372 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
373 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
374 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
375 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
376 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
377 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
379 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
382 AC_CHECK_PROGS(MIDL, $target-widl widl)
383 if test -n "$MIDL"; then
386 MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
389 MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
394 # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
395 # causing problems with local implementations with the same name.
396 AC_DEFINE(STRSAFE_NO_DEPRECATE)
399 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
400 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
401 # Require OS features provided by IE 8.0 (Win7)
402 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0800)
407 if test -n "$_WIN32_MSVC"; then
409 SKIP_COMPILER_CHECKS=1
410 SKIP_LIBRARY_CHECKS=1
412 # Since we're skipping compiler and library checks, hard-code
415 AC_DEFINE(HAVE_ISATTY)
418 fi # COMPILE_ENVIRONMENT
428 AC_SUBST(WRAP_STL_INCLUDES)
429 AC_SUBST(MOZ_MSVC_STL_WRAP_RAISE)
431 dnl ========================================================
432 dnl Checks for programs.
433 dnl ========================================================
434 if test "$COMPILE_ENVIRONMENT"; then
436 dnl ========================================================
437 dnl = Mac OS X toolchain support
438 dnl ========================================================
440 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
441 dnl that a universal binary is being produced.
442 AC_SUBST(UNIVERSAL_BINARY)
444 MOZ_ARG_WITH_STRING(unify-dist,
445 [ --with-unify-dist=dir Location of the dist directory to unify with at packaging time (Mac OS X universal build only)],
447 if test -n "$UNIVERSAL_BINARY"; then
448 if test -z "$UNIFY_DIST"; then
449 AC_MSG_ERROR([You need to provide the --with-unify-dist=dir argument when performing a universal build])
451 case "$UNIFY_DIST" in
455 UNIFY_DIST="${MOZ_BUILD_ROOT}/${UNIFY_DIST}"
461 dnl ========================================================
462 dnl = Mac OS X SDK support
463 dnl ========================================================
465 MOZ_ARG_WITH_STRING(macos-sdk,
466 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
467 MACOS_SDK_DIR=$withval)
469 MACOS_PRIVATE_FRAMEWORKS_DIR_DEFAULTED=
470 MOZ_ARG_WITH_STRING(macos-private-frameworks,
471 [ --with-macos-private-frameworks=dir Location of private frameworks to use (Mac OS X only)],
472 MACOS_PRIVATE_FRAMEWORKS_DIR=$withval,
473 MACOS_PRIVATE_FRAMEWORKS_DIR=/System/Library/PrivateFrameworks
474 MACOS_PRIVATE_FRAMEWORKS_DEFAULTED=1)
476 if test -z "${MACOS_PRIVATE_FRAMEWORKS_DEFAULTED}"; then
477 if test -z "$CROSS_COMPILE"; then
478 AC_MSG_WARN([You should only be using --with-macos-private-frameworks when cross-compiling.])
480 if test ! -d "$MACOS_PRIVATE_FRAMEWORKS_DIR"; then
481 AC_MSG_ERROR([PrivateFrameworks directory not found.])
485 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
486 AC_SUBST(MACOS_SDK_DIR)
487 AC_SUBST(MACOS_PRIVATE_FRAMEWORKS_DIR)
489 if test "$MACOS_SDK_DIR"; then
490 dnl Sync this section with the ones in NSPR and NSS.
491 dnl Changes to the cross environment here need to be accounted for in
492 dnl the libIDL checks (below) and xpidl build.
494 if test ! -d "$MACOS_SDK_DIR"; then
495 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
496 specify a valid SDK. SDKs are installed when the optional cross-development
497 tools are selected during the Xcode/Developer Tools installation.])
500 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
501 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
503 dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
504 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
505 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
508 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
510 AC_TRY_COMPILE([#include <new>],[],
514 AC_MSG_RESULT($result)
516 if test "$result" = "no" ; then
517 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
525 fi # COMPILE_ENVIRONMENT
527 dnl ========================================================
528 dnl set the defaults first
529 dnl ========================================================
541 MOZ_USER_DIR=".mozilla"
543 MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
547 dnl Configure platform-specific CPU architecture compiler options.
548 dnl ==============================================================
549 if test "$COMPILE_ENVIRONMENT"; then
552 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
553 dnl Default Android builds to ARMv7.
556 fi # COMPILE_ENVIRONMENT
558 dnl ========================================================
559 dnl Android libstdc++, placed here so it can use MOZ_ARCH
561 dnl ========================================================
564 if test "$COMPILE_ENVIRONMENT"; then
566 fi # COMPILE_ENVIRONMENT
568 dnl ========================================================
569 dnl Suppress Clang Argument Warnings
570 dnl ========================================================
571 if test -n "${CLANG_CC}${CLANG_CL}"; then
572 _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
573 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
575 if test -n "${CLANG_CXX}${CLANG_CL}"; then
576 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
579 if test -n "$COMPILE_ENVIRONMENT"; then
583 dnl ========================================================
584 dnl GNU specific defaults
585 dnl ========================================================
586 if test "$GNU_CC"; then
590 SSSE3_FLAGS="-mssse3"
591 # FIXME: Let us build with strict aliasing. bug 414641.
592 CFLAGS="$CFLAGS -fno-strict-aliasing"
593 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
594 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
595 WARNINGS_AS_ERRORS='-Werror'
597 DSO_PIC_CFLAGS='-fPIC'
598 ASFLAGS="$ASFLAGS -fPIC"
599 AC_MSG_CHECKING([for --noexecstack option to as])
601 CFLAGS="$CFLAGS -Wa,--noexecstack"
602 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
603 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
606 AC_MSG_CHECKING([for -z noexecstack option to ld])
607 _SAVE_LDFLAGS=$LDFLAGS
608 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
609 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
611 LDFLAGS=$_SAVE_LDFLAGS)
613 AC_MSG_CHECKING([for -z text option to ld])
614 _SAVE_LDFLAGS=$LDFLAGS
615 LDFLAGS="$LDFLAGS -Wl,-z,text"
616 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
617 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,text"],
619 LDFLAGS=$_SAVE_LDFLAGS)
621 AC_MSG_CHECKING([for --build-id option to ld])
622 _SAVE_LDFLAGS=$LDFLAGS
623 LDFLAGS="$LDFLAGS -Wl,--build-id"
624 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
625 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,--build-id"],
627 LDFLAGS=$_SAVE_LDFLAGS)
629 AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
630 HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
631 _SAVE_LDFLAGS=$LDFLAGS
632 LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
633 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
634 [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
636 LDFLAGS=$_SAVE_LDFLAGS
638 # Check for -mssse3 on $CC
639 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
640 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
642 CFLAGS="$CFLAGS -mssse3"
643 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
644 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
648 # Check for -msse4.1 on $CC
649 AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
650 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
652 CFLAGS="$CFLAGS -msse4.1"
653 AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
654 [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
658 case "${CPU_ARCH}" in
660 AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
662 [asm volatile ("vpermq \$0xd8,%ymm0,%ymm0 \n");],
663 result="yes", result="no")
664 AC_MSG_RESULT("$result")
665 if test "$result" = "yes"; then
671 AC_MSG_CHECKING([whether we can enable AltiVec support])
674 CFLAGS="$CFLAGS -maltivec"
675 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
683 if test "$GCC_USE_GNU_LD"; then
684 # Some tools like ASan use a runtime library that is only
685 # linked against executables, so we must allow undefined
686 # symbols for shared objects in some cases.
687 if test -z "$MOZ_NO_WLZDEFS"; then
688 # Don't allow undefined symbols in libraries
689 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
691 # BSDs need `environ' exposed for posix_spawn (bug 753046)
693 DragonFly|FreeBSD|NetBSD|OpenBSD)
694 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
695 DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
697 DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
704 _DEFINES_CFLAGS='-include $(topobjdir)/mozilla-config.h -DMOZILLA_CLIENT'
705 _USE_CPP_INCLUDE_FLAG=1
707 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
710 if test "$GNU_CXX"; then
711 # FIXME: Let us build with strict aliasing. bug 414641.
712 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
714 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(topobjdir)/mozilla-config.h'
715 _USE_CPP_INCLUDE_FLAG=1
718 dnl ========================================================
720 dnl ========================================================
721 MOZ_ARG_ENABLE_BOOL(valgrind,
722 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
725 if test -n "$MOZ_VALGRIND"; then
726 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
728 [--enable-valgrind specified but Valgrind is not installed]))
729 AC_DEFINE(MOZ_VALGRIND)
731 AC_SUBST(MOZ_VALGRIND)
733 # For profiling builds keep the symbol information
734 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
736 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
737 STRIP_FLAGS="--strip-debug"
742 dnl ========================================================
744 dnl ========================================================
746 if test "$MOZ_DMD"; then
747 if test "${CPU_ARCH}" = "arm"; then
748 CFLAGS="$CFLAGS -funwind-tables"
749 CXXFLAGS="$CXXFLAGS -funwind-tables"
753 dnl ========================================================
754 dnl System overrides of the defaults for host
755 dnl ========================================================
758 if test -n "$_WIN32_MSVC"; then
760 HOST_AR_FLAGS='-NOLOGO -OUT:$@'
761 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo"
762 HOST_RANLIB='echo ranlib'
764 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
766 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
767 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
770 case "${host_cpu}" in
772 if test -n "$_WIN32_MSVC"; then
773 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
777 if test -n "$_WIN32_MSVC"; then
778 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
780 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
786 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
787 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
790 *-linux*|*-kfreebsd*-gnu|*-gnu*)
791 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
792 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
796 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
797 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
801 dnl ==============================================================
802 dnl Get mozilla version from central milestone file
803 dnl ==============================================================
804 MOZILLA_VERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir`
805 MOZILLA_UAVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --uaversion`
806 MOZILLA_SYMBOLVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --symbolversion`
807 if test -z "$MOZILLA_VERSION"; then
808 AC_MSG_ERROR([failed to read version info from milestone file])
811 dnl Get version of various core apps from the version files.
812 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
813 FIREFOX_VERSION_DISPLAY=`cat $_topsrcdir/browser/config/version_display.txt`
815 if test -z "$FIREFOX_VERSION"; then
816 AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
819 if test -z "$FIREFOX_VERSION_DISPLAY"; then
820 AC_MSG_ERROR([FIREFOX_VERSION_DISPLAY is unexpectedly blank.])
823 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
824 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
825 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
826 AC_SUBST(MOZILLA_SYMBOLVERSION)
828 MOZ_DOING_LTO(lto_is_enabled)
830 dnl ========================================================
831 dnl System overrides of the defaults for target
832 dnl ========================================================
836 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
837 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
838 MOZ_OPTIMIZE_FLAGS="-O3"
839 CXXFLAGS="$CXXFLAGS -stdlib=libc++"
842 STRIP_FLAGS="$STRIP_FLAGS -x -S"
843 # Ensure that if we're targeting iOS an SDK was provided.
844 AC_CACHE_CHECK(for iOS target,
846 [AC_TRY_COMPILE([#include <TargetConditionals.h>
847 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
851 ac_cv_ios_target="yes",
852 ac_cv_ios_target="no")])
853 if test "$ac_cv_ios_target" = "yes" -a -z $MOZ_IOS; then
854 AC_MSG_ERROR([targeting iOS but not using an iOS SDK?])
856 if test -n "$MOZ_IOS"; then
859 # The ExceptionHandling framework is needed for Objective-C exception
860 # logging code in nsObjCExceptions.h. Currently we only use that in debug
862 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
865 if test "x$lto_is_enabled" = "xyes"; then
866 echo "Skipping -dead_strip because lto is enabled."
867 dnl DTrace and -dead_strip don't interact well. See bug 403132.
868 dnl ===================================================================
869 elif test "x$enable_dtrace" = "xyes"; then
870 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
872 dnl check for the presence of the -dead_strip linker flag
873 AC_MSG_CHECKING([for -dead_strip option to ld])
874 _SAVE_LDFLAGS=$LDFLAGS
875 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
876 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
877 if test -n "$_HAVE_DEAD_STRIP" ; then
879 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
884 LDFLAGS=$_SAVE_LDFLAGS
887 MOZ_FIX_LINK_PATHS="-Wl,-executable_path,${DIST}/bin"
890 *-android*|*-linuxandroid*)
891 AC_DEFINE(NO_PW_GECOS)
892 if test -n "$gonkdir"; then
896 if test "$COMPILE_ENVIRONMENT"; then
901 MOZ_GFX_OPTIMIZE_MOBILE=1
902 MOZ_OPTIMIZE_FLAGS="-Os"
903 if test -z "$CLANG_CC"; then
904 MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions $MOZ_OPTIMIZE_FLAGS"
909 if test "$GNU_CC" -o "$GNU_CXX"; then
910 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
911 MOZ_OPTIMIZE_FLAGS="-Os"
912 if test -z "$CLANG_CC"; then
913 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
917 case "${target_cpu}" in
919 CFLAGS="$CFLAGS -mieee"
920 CXXFLAGS="$CXXFLAGS -mieee"
929 # certain versions of cygwin's makedepend barf on the
930 # #include <string> vs -I./dist/include/string issue so don't use it
931 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
935 CFLAGS="$CFLAGS -mms-bitfields"
936 CXXFLAGS="$CXXFLAGS -mms-bitfields"
938 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
939 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
941 # Use static libgcc and libstdc++
942 LDFLAGS="$LDFLAGS -static"
943 NSPR_LDFLAGS="$NSPR_LDFLAGS -static-libgcc"
944 # Use temp file for windres (bug 213281)
945 RCFLAGS='-O coff --use-temp-file'
946 # mingw doesn't require kernel32, user32, and advapi32 explicitly
947 LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
952 WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
953 WIN32_GUI_EXE_LDFLAGS=-mwindows
955 # GCC/binutils can't link to a function if we try to include dllexport function
956 # in the same library as dllimport caller. To work around it, we build NSPR
957 # and NSS with -mnop-fun-dllimport flag. The drawback of this solution is that
958 # function thunks need to be generated for cross-DLL calls.
959 MOZ_FOLD_LIBS_FLAGS=-mnop-fun-dllimport
961 TARGET_COMPILER_ABI=msvc
962 if test "$AS_BIN"; then
963 AS="$(basename "$AS_BIN")"
966 AR_FLAGS='-NOLOGO -OUT:$@'
968 RANLIB='echo not_ranlib'
969 STRIP='echo not_strip'
975 IMPORT_LIB_SUFFIX=lib
976 MKSHLIB='$(LINK) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
977 MKCSHLIB='$(LINK) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
978 WIN32_SUBSYSTEM_VERSION=6.01
979 WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
980 WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
981 DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
982 _USE_CPP_INCLUDE_FLAG=1
983 _DEFINES_CFLAGS='-FI $(topobjdir)/mozilla-config.h -DMOZILLA_CLIENT'
984 _DEFINES_CXXFLAGS='-FI $(topobjdir)/mozilla-config.h -DMOZILLA_CLIENT'
985 CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
986 CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
987 if test -z "$CLANG_CL"; then
988 CFLAGS="$CFLAGS -utf-8"
989 CXXFLAGS="$CXXFLAGS -utf-8"
991 if test "$CPU_ARCH" = "x86"; then
992 dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
993 dnl more recent, so set that explicitly here unless another
994 dnl target arch has already been set.
996 if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
997 CFLAGS="$CFLAGS -arch:SSE2"
999 if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
1000 CXXFLAGS="$CXXFLAGS -arch:SSE2"
1003 SSE_FLAGS="-arch:SSE"
1004 SSE2_FLAGS="-arch:SSE2"
1005 dnl MSVC allows the use of intrinsics without any flags
1006 dnl and doesn't have a separate arch for SSSE3
1007 SSSE3_FLAGS="-arch:SSE2"
1009 dnl clang-cl requires appropriate flags to enable SSSE3 support
1010 dnl on all architectures.
1011 if test -n "$CLANG_CL"; then
1012 SSSE3_FLAGS="-mssse3"
1014 dnl VS2013+ requires -FS when parallel building by make -jN.
1015 dnl If nothing, compiler sometimes causes C1041 error.
1016 CFLAGS="$CFLAGS -FS"
1017 CXXFLAGS="$CXXFLAGS -FS"
1018 dnl VS2013+ supports -Gw for better linker optimizations.
1019 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
1020 dnl Disabled on ASan because it causes false-positive ODR violations.
1021 if test -z "$MOZ_ASAN"; then
1022 CFLAGS="$CFLAGS -Gw"
1023 CXXFLAGS="$CXXFLAGS -Gw"
1025 # khuey says we can safely ignore MSVC warning C4251
1026 # MSVC warning C4244 (implicit type conversion may lose data) warns
1027 # and requires workarounds for perfectly valid code. Also, GCC/clang
1028 # don't warn about it by default. So for consistency/sanity, we turn
1029 # it off on MSVC, too.
1030 # MSVC warning C4267 warns for narrowing type conversions from size_t
1031 # to 32-bit integer types on 64-bit platforms. Since this is virtually
1032 # the same thing as C4244, we disable C4267, too.
1033 # MSVC warning C4800 warns when a value is implicitly cast to bool,
1034 # because this also forces narrowing to a single byte, which can be a
1035 # perf hit. But this matters so little in practice (and often we want
1036 # that behavior) that it's better to turn it off.
1037 # MSVC warning C4595 warns non-member operator new or delete functions
1038 # may not be declared inline, as of VS2015 Update 2.
1039 CFLAGS="$CFLAGS -wd4244 -wd4267"
1040 CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4267 -wd4800 -wd4595"
1041 if test -n "$CLANG_CL"; then
1042 # XXX We should combine some of these with our generic GCC-style
1045 # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
1046 CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
1047 # We use offsetof on non-POD objects all the time.
1048 # We also suppress this warning on other platforms.
1049 CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
1050 # This warns for reasonable things like:
1051 # enum { X = 0xffffffffU };
1052 # which is annoying for IDL headers.
1053 CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
1054 # This warns for cases that would be reached by the Microsoft
1055 # #include rules, but also currently warns on cases that would
1056 # *also* be reached by standard C++ include rules. That
1057 # behavior doesn't seem useful, so we turn it off.
1058 CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
1059 # We normally error out on unknown pragmas, but since clang-cl
1060 # claims to be MSVC, it would be difficult to add
1061 # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
1062 # use such pragmas, so just ignore them.
1063 CFLAGS="$CFLAGS -Wno-unknown-pragmas"
1064 CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
1065 # We get errors about various #pragma intrinsic directives from
1066 # clang-cl, and we don't need to hear about those.
1067 CFLAGS="$CFLAGS -Wno-ignored-pragmas"
1068 CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
1069 # clang-cl's Intrin.h marks things like _ReadWriteBarrier
1070 # as __attribute((__deprecated__)). This is nice to know,
1071 # but since we don't get the equivalent warning from MSVC,
1072 # let's just ignore it.
1073 CFLAGS="$CFLAGS -Wno-deprecated-declarations"
1074 CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
1075 # We use a function like:
1076 # __declspec(noreturn) __inline void f() {}
1077 # which -Winvalid-noreturn complains about. Again, MSVC seems
1078 # OK with it, so let's silence the warning.
1079 CFLAGS="$CFLAGS -Wno-invalid-noreturn"
1080 CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
1081 # Missing |override| on virtual function declarations isn't
1082 # something that MSVC currently warns about.
1083 CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
1084 # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
1085 # declaration on |operator delete(void*)|. However, clang-cl
1086 # must internally declare |operator delete(void*)| differently,
1087 # which causes this warning for virtually every file in the
1088 # tree. clang-cl doesn't support -fno-exceptions or equivalent,
1089 # so there doesn't seem to be any way to convince clang-cl to
1090 # declare |delete| differently. Therefore, suppress this
1092 CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
1093 # At least one MSVC header and several headers in-tree have
1094 # unused typedefs, so turn this on.
1095 CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
1096 # jemalloc uses __declspec(allocator) as a profiler hint,
1097 # which clang-cl doesn't understand.
1098 CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
1100 # make 'foo == bar;' error out
1101 CFLAGS="$CFLAGS -we4553"
1102 CXXFLAGS="$CXXFLAGS -we4553"
1103 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
1104 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1105 WARNINGS_AS_ERRORS='-WX'
1106 MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
1108 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
1109 if test -z "$DEVELOPER_OPTIONS"; then
1110 LDFLAGS="$LDFLAGS -RELEASE"
1112 dnl For profile-guided optimization
1113 PROFILE_GEN_CFLAGS="-GL"
1114 num_cores=$($PYTHON -c 'import multiprocessing; print(min(8,multiprocessing.cpu_count()))')
1115 cgthreads="-CGTHREADS:${num_cores}"
1116 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT -PogoSafeMode $cgthreads"
1117 dnl XXX: PGO builds can fail with warnings treated as errors,
1118 dnl specifically "no profile data available" appears to be
1119 dnl treated as an error sometimes. This might be a consequence
1120 dnl of using WARNINGS_AS_ERRORS in some modules, combined
1121 dnl with the linker doing most of the work in the whole-program
1122 dnl optimization/PGO case. I think it's probably a compiler bug,
1123 dnl but we work around it here.
1124 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
1125 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
1126 dnl Probably also a compiler bug, but what can you do?
1127 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE $cgthreads"
1128 LDFLAGS="$LDFLAGS -DYNAMICBASE"
1130 dnl Minimum reqiurement of Gecko is VS2015 or later which supports
1131 dnl both SSSE3 and SSE4.1.
1132 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
1133 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
1134 dnl allow AVX2 code from VS2015
1137 AC_DEFINE(WIN32_LEAN_AND_MEAN)
1138 dnl See http://support.microsoft.com/kb/143208 to use STL
1141 MOZ_USER_DIR="Mozilla"
1145 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.])
1151 if test -n "$GNU_CC"; then
1152 CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
1153 CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
1154 LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup -Wl,--large-address-aware"
1156 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
1157 LDFLAGS="$LDFLAGS -SAFESEH"
1163 if test -n "$_WIN32_MSVC"; then
1164 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
1169 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
1176 CFLAGS="$CFLAGS -Dunix"
1177 CXXFLAGS="$CXXFLAGS -Dunix"
1178 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
1180 DSO_PIC_CFLAGS='-fPIC -DPIC'
1181 DSO_LDOPTS='-shared'
1182 BIN_FLAGS='-Wl,--export-dynamic'
1184 DSO_PIC_CFLAGS='-fPIC -DPIC'
1185 DLL_SUFFIX=".so.1.0"
1186 DSO_LDOPTS='-shared'
1188 # This will fail on a.out systems prior to 1.5.1_ALPHA.
1189 if test "$LIBRUNPATH"; then
1190 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
1192 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
1193 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
1197 if test "$SO_VERSION"; then
1198 DLL_SUFFIX=".so.$SO_VERSION"
1200 DLL_SUFFIX=".so.1.0"
1202 if test -z "$X11BASE"; then
1205 MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
1207 DSO_PIC_CFLAGS='-fPIC'
1208 DSO_LDOPTS='-shared -fPIC'
1209 if test "$LIBRUNPATH"; then
1210 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
1216 AC_SUBST_LIST(MMX_FLAGS)
1217 AC_SUBST_LIST(SSE_FLAGS)
1218 AC_SUBST_LIST(SSE2_FLAGS)
1219 AC_SUBST_LIST(SSSE3_FLAGS)
1221 AC_SUBST(MOZ_LINKER)
1222 if test -n "$MOZ_LINKER"; then
1223 AC_DEFINE(MOZ_LINKER)
1224 MOZ_LINKER_EXTRACT=1
1225 AC_CHECK_PROGS(XZ, xz)
1228 dnl Only one oddball right now (QNX), but this gives us flexibility
1229 dnl if any other platforms need to override this in the future.
1230 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
1232 dnl ========================================================
1233 dnl = Flags to strip unused symbols from .so components and
1234 dnl = to export jemalloc symbols when linking a program
1235 dnl ========================================================
1237 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1238 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
1241 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
1244 if test -n "$GNU_CC"; then
1245 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
1250 if test -z "$COMPILE_ENVIRONMENT"; then
1251 SKIP_COMPILER_CHECKS=1
1252 SKIP_LIBRARY_CHECKS=1
1257 fi # COMPILE_ENVIRONMENT
1259 if test -z "$SKIP_COMPILER_CHECKS"; then
1260 dnl Checks for typedefs, structures, and compiler characteristics.
1261 dnl ========================================================
1276 case "${OS_TARGET}" in
1280 STL_FLAGS="-I${DIST}/stl_wrappers"
1285 dnl Checks for header files.
1286 dnl ========================================================
1288 case "$target_os" in
1289 bitrig*|dragonfly*|freebsd*|openbsd*)
1290 # for stuff like -lXshm
1291 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
1295 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
1296 AC_CACHE_CHECK(for sockaddr_in.sin_len,
1297 ac_cv_sockaddr_in_sin_len,
1298 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1299 #include <sys/types.h>
1301 #include <netinet/in.h>
1302 struct sockaddr_in x;
1303 void *foo = (void*) &x.sin_len;],
1305 [ac_cv_sockaddr_in_sin_len=true],
1306 [ac_cv_sockaddr_in_sin_len=false])])
1307 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
1308 AC_DEFINE(HAVE_SIN_LEN)
1309 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
1310 AC_DEFINE(HAVE_SCONN_LEN)
1313 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
1314 ac_cv_sockaddr_in6_sin6_len,
1315 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1316 #include <sys/types.h>
1318 #include <netinet/in.h>
1319 struct sockaddr_in6 x;
1320 void *foo = (void*) &x.sin6_len;],
1322 [ac_cv_sockaddr_in6_sin6_len=true],
1323 [ac_cv_sockaddr_in6_sin6_len=false])])
1324 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
1325 AC_DEFINE(HAVE_SIN6_LEN)
1328 AC_CACHE_CHECK(for sockaddr.sa_len,
1329 ac_cv_sockaddr_sa_len,
1330 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1331 #include <sys/types.h>
1333 #include <sys/socket.h>
1335 void *foo = (void*) &x.sa_len;],
1337 [ac_cv_sockaddr_sa_len=true],
1338 [ac_cv_sockaddr_sa_len=false])])
1339 if test "$ac_cv_sockaddr_sa_len" = true ; then
1340 AC_DEFINE(HAVE_SA_LEN)
1343 MOZ_ARG_ENABLE_BOOL(dtrace,
1344 [ --enable-dtrace build with dtrace support if available (default=no)],
1345 [enable_dtrace="yes"],)
1346 if test "x$enable_dtrace" = "xyes"; then
1347 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
1348 if test -n "$HAVE_DTRACE"; then
1349 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
1351 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
1354 AC_SUBST(HAVE_DTRACE)
1356 dnl Checks for libraries.
1357 dnl ========================================================
1358 AC_CHECK_LIB(c_r, gethostbyname_r)
1360 dnl We don't want to link with libdl even if it's present on OS X, since
1361 dnl it's not used and not part of the default installation. OS/2 has dlfcn
1363 dnl We don't want to link against libm or libpthread on Darwin since
1364 dnl they both are just symlinks to libSystem and explicitly linking
1365 dnl against libSystem causes issues when debugging (see bug 299601).
1370 AC_SEARCH_LIBS(dlopen, dl,
1371 MOZ_CHECK_HEADER(dlfcn.h,
1372 AC_DEFINE(HAVE_DLOPEN)))
1376 _SAVE_CFLAGS="$CFLAGS"
1377 CFLAGS="$CFLAGS -D_GNU_SOURCE"
1378 AC_CHECK_FUNCS(dladdr memmem)
1379 CFLAGS="$_SAVE_CFLAGS"
1381 if test ! "$GNU_CXX"; then
1382 AC_CHECK_LIB(C, demangle)
1385 AC_CHECK_LIB(socket, socket)
1388 XLIBS="$X_EXTRA_LIBS"
1390 dnl ========================================================
1391 dnl Checks for X libraries.
1392 dnl Ordering is important.
1393 dnl Xt is dependent upon SM as of X11R6
1394 dnl ========================================================
1395 if test -n "$MOZ_X11"; then
1396 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
1397 _SAVE_LDFLAGS="$LDFLAGS"
1399 LDFLAGS="$XLDFLAGS $LDFLAGS"
1400 AC_CHECK_LIB(X11, XDrawLines, [XLIBS="-lX11 $XLIBS"],
1401 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
1402 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
1403 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
1405 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
1406 unset ac_cv_lib_Xt_XtFree
1407 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
1408 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
1409 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
1410 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
1413 dnl ========================================================
1415 dnl ========================================================
1416 AC_CHECK_LIB(xcb, xcb_connect, [XLIBS="-lxcb $XLIBS"],
1417 [MISSING_X="$MISSING_X -lxcb"], $XLIBS)
1418 AC_CHECK_LIB(xcb-shm, xcb_shm_query_version, [XLIBS="-lxcb-shm $XLIBS"],
1419 [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS)
1420 AC_CHECK_LIB(X11-xcb, XGetXCBConnection, [XLIBS="-lX11-xcb $XLIBS"],
1421 [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS)
1423 dnl ========================================================
1425 dnl ========================================================
1426 MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
1427 AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
1428 [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
1429 AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
1431 LDFLAGS="$_SAVE_LDFLAGS"
1435 AC_SUBST_LIST(XCFLAGS)
1436 AC_SUBST_LIST(XLDFLAGS)
1437 AC_SUBST_LIST(XLIBS)
1438 AC_SUBST_LIST(XEXT_LIBS)
1439 AC_SUBST_LIST(XT_LIBS)
1440 AC_SUBST_LIST(XSS_LIBS)
1442 dnl ========================================================
1443 dnl = pthread support
1444 dnl = Start by checking whether the system support pthreads
1445 dnl ========================================================
1446 case "$target_os" in
1451 AC_CHECK_LIB(pthreads, pthread_create,
1452 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
1453 AC_CHECK_LIB(pthread, pthread_create,
1454 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
1455 AC_CHECK_LIB(c_r, pthread_create,
1456 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
1457 AC_CHECK_LIB(c, pthread_create,
1466 dnl ========================================================
1467 dnl Check the command line for --with-pthreads
1468 dnl ========================================================
1469 MOZ_ARG_WITH_BOOL(pthreads,
1470 [ --with-pthreads Force use of system pthread library with NSPR ],
1471 [ if test "$MOZ_USE_PTHREADS"x = x; then
1472 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
1478 dnl ========================================================
1479 dnl Do the platform specific pthread hackery
1480 dnl ========================================================
1481 if test "$MOZ_USE_PTHREADS"x != x
1484 dnl See if -pthread is supported.
1487 ac_cv_have_dash_pthread=no
1488 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
1489 echo 'int main() { return 0; }' | cat > conftest.c
1490 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
1491 if test $? -eq 0; then
1492 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1493 ac_cv_have_dash_pthread=yes
1494 case "$target_os" in
1496 # Freebsd doesn't use -pthread for compiles, it uses them for linking
1499 CFLAGS="$CFLAGS -pthread"
1500 CXXFLAGS="$CXXFLAGS -pthread"
1506 AC_MSG_RESULT($ac_cv_have_dash_pthread)
1509 dnl See if -pthreads is supported.
1511 ac_cv_have_dash_pthreads=no
1512 if test "$ac_cv_have_dash_pthread" = "no"; then
1513 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
1514 echo 'int main() { return 0; }' | cat > conftest.c
1515 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
1516 if test $? -eq 0; then
1517 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1518 ac_cv_have_dash_pthreads=yes
1519 CFLAGS="$CFLAGS -pthreads"
1520 CXXFLAGS="$CXXFLAGS -pthreads"
1524 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
1529 AC_DEFINE(_REENTRANT)
1530 AC_DEFINE(_THREAD_SAFE)
1531 dnl -pthread links in -lpthread, so don't specify it explicitly.
1532 if test "$ac_cv_have_dash_pthread" = "yes"; then
1533 _PTHREAD_LDFLAGS="-pthread"
1537 *-*-openbsd*|*-*-bsdi*)
1538 AC_DEFINE(_REENTRANT)
1539 AC_DEFINE(_THREAD_SAFE)
1540 dnl -pthread links in -lc_r, so don't specify it explicitly.
1541 if test "$ac_cv_have_dash_pthread" = "yes"; then
1542 _PTHREAD_LDFLAGS="-pthread"
1546 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
1547 AC_DEFINE(_REENTRANT)
1551 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
1552 AC_SUBST(MOZ_USE_PTHREADS)
1553 MOZ_CHECK_HEADERS(pthread.h)
1557 dnl Checks for library functions.
1558 dnl ========================================================
1559 AC_PROG_GCC_TRADITIONAL
1561 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall)
1563 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1564 dnl avoid this on Darwin, since depending on your system config, we may think
1565 dnl it exists but it really doesn't
1566 case "$OS_TARGET" in
1570 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1571 ac_cv_clock_monotonic,
1572 [for libs in "" -lrt; do
1575 AC_TRY_LINK([#include <time.h>],
1576 [ struct timespec ts;
1577 clock_gettime(CLOCK_MONOTONIC, &ts); ],
1578 ac_cv_clock_monotonic=$libs
1581 ac_cv_clock_monotonic=no)
1584 if test "$ac_cv_clock_monotonic" != "no"; then
1585 HAVE_CLOCK_MONOTONIC=1
1586 REALTIME_LIBS=$ac_cv_clock_monotonic
1587 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1588 AC_SUBST(HAVE_CLOCK_MONOTONIC)
1589 AC_SUBST_LIST(REALTIME_LIBS)
1594 AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
1595 ac_cv_pthread_cond_timedwait_monotonic_np,
1596 AC_TRY_LINK([#include <pthread.h>],
1597 [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
1598 ac_cv_pthread_cond_timewait_monotonic_np=yes,
1599 ac_cv_pthread_cond_timewait_monotonic_np=no))
1600 if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
1601 AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
1604 dnl check for wcrtomb/mbrtowc
1605 dnl =======================================================================
1606 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
1609 AC_CACHE_CHECK(for wcrtomb,
1611 [AC_TRY_LINK([#include <wchar.h>],
1612 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
1613 ac_cv_have_wcrtomb="yes",
1614 ac_cv_have_wcrtomb="no")])
1615 if test "$ac_cv_have_wcrtomb" = "yes"; then
1616 AC_DEFINE(HAVE_WCRTOMB)
1618 AC_CACHE_CHECK(for mbrtowc,
1620 [AC_TRY_LINK([#include <wchar.h>],
1621 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
1622 ac_cv_have_mbrtowc="yes",
1623 ac_cv_have_mbrtowc="no")])
1624 if test "$ac_cv_have_mbrtowc" = "yes"; then
1625 AC_DEFINE(HAVE_MBRTOWC)
1632 ac_cv_func_res_ninit,
1633 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
1634 dnl no need for res_ninit() on NetBSD and OpenBSD
1635 ac_cv_func_res_ninit=no
1639 #define _BSD_SOURCE 1
1641 #include <sys/types.h>
1642 #include <netinet/in.h>
1643 #include <arpa/nameser.h>
1646 [int foo = res_ninit(&_res);],
1647 [ac_cv_func_res_ninit=yes],
1648 [ac_cv_func_res_ninit=no])
1652 if test "$ac_cv_func_res_ninit" = "yes"; then
1653 AC_DEFINE(HAVE_RES_NINIT)
1654 dnl must add the link line we do something as foolish as this... dougt
1656 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
1657 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
1669 AC_CHECK_LIB(c, iconv, [ICONV_LIBS=],
1670 AC_CHECK_LIB(iconv, iconv, [ICONV_LIBS="-liconv"],
1671 AC_CHECK_LIB(iconv, libiconv, [ICONV_LIBS="-liconv"])))
1673 LIBS="$LIBS $ICONV_LIBS"
1682 iconv_t h = iconv_open("", "");
1683 iconv(h, NULL, NULL, NULL, NULL);
1686 [ac_cv_func_iconv=yes],
1687 [ac_cv_func_iconv=no]
1690 if test "$ac_cv_func_iconv" = "yes"; then
1691 AC_DEFINE(HAVE_ICONV)
1692 LIBICONV="$ICONV_LIBS"
1694 [for iconv() with const input],
1695 ac_cv_func_const_iconv,
1701 const char *input = "testing";
1702 iconv_t h = iconv_open("", "");
1703 iconv(h, &input, NULL, NULL, NULL);
1706 [ac_cv_func_const_iconv=yes],
1707 [ac_cv_func_const_iconv=no]
1710 if test "$ac_cv_func_const_iconv" = "yes"; then
1711 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
1719 AC_SUBST_LIST(ICONV_LIBS)
1725 dnl **********************
1726 dnl *** va_copy checks ***
1727 AC_CACHE_CHECK([for an implementation of va_copy()],
1729 [AC_TRY_COMPILE([#include <stdarg.h>
1731 void f (int i, ...) {
1732 va_list args1, args2;
1733 va_start (args1, i);
1734 va_copy (args2, args1);
1735 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1737 va_end (args1); va_end (args2);
1739 [f(0, 42); return 0],
1740 [ac_cv_va_copy=yes],
1744 AC_CACHE_CHECK([whether va_list can be copied by value],
1746 [AC_TRY_COMPILE([#include <stdarg.h>
1748 void f (int i, ...) {
1749 va_list args1, args2;
1750 va_start (args1, i);
1752 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1754 va_end (args1); va_end (args2);
1756 [f(0, 42); return 0],
1757 [ac_cv_va_val_copy=yes],
1758 [ac_cv_va_val_copy=no],
1761 if test "x$ac_cv_va_copy" = "xyes"; then
1762 AC_DEFINE(VA_COPY, va_copy)
1763 AC_DEFINE(HAVE_VA_COPY)
1766 if test "x$ac_cv_va_val_copy" = "xno"; then
1767 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
1770 dnl ===================================================================
1771 dnl ========================================================
1772 dnl Put your C++ language/feature checks below
1773 dnl ========================================================
1777 if test "$GNU_CC"; then
1778 if test "$CPU_ARCH" = "arm" ; then
1779 AC_CACHE_CHECK(for ARM EABI,
1783 #if defined(__ARM_EABI__)
1786 #error Not ARM EABI.
1789 ac_cv_gcc_arm_eabi="yes",
1790 ac_cv_gcc_arm_eabi="no")])
1791 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
1793 ARM_ABI_PREFIX=eabi-
1795 ARM_ABI_PREFIX=oabi-
1799 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
1802 dnl See if a dynamic_cast to void* gives the most derived object.
1803 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
1804 ac_cv_cpp_dynamic_cast_void_ptr,
1805 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
1806 class Y { int j; public: virtual ~Y() { } };
1807 class Z : public X, public Y { int k; };
1813 return !((((void*)&mdo != (void*)subx) &&
1814 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
1815 (((void*)&mdo != (void*)suby) &&
1816 ((void*)&mdo == dynamic_cast<void*>(suby))));
1818 ac_cv_cpp_dynamic_cast_void_ptr=yes,
1819 ac_cv_cpp_dynamic_cast_void_ptr=no,
1820 ac_cv_cpp_dynamic_cast_void_ptr=no)])
1821 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
1822 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
1826 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
1827 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
1828 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
1830 _SAVE_LDFLAGS=$LDFLAGS
1831 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
1832 AC_CACHE_CHECK(for __thread keyword for TLS variables,
1833 ac_cv_thread_keyword,
1834 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
1835 [return tlsIsMainThread;],
1836 ac_cv_thread_keyword=yes,
1837 ac_cv_thread_keyword=no)])
1838 LDFLAGS=$_SAVE_LDFLAGS
1839 # The custom dynamic linker doesn't support TLS variables
1841 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
1842 # mips builds fail with TLS variables because of a binutils bug.
1844 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
1849 *-android*|*-linuxandroid*)
1856 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
1862 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
1863 if test -n "$MOZ_LINKER"; then
1864 if test "$CPU_ARCH" = arm; then
1865 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
1866 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
1867 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1868 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1872 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
1873 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
1874 dnl Since the linker only understands the sysv ones, no need to build the
1875 dnl gnu style tables anyways.
1876 LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
1879 dnl The custom linker doesn't support text relocations, but NDK >= r6b
1880 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
1881 dnl We however want to avoid these text relocations, and this can be done
1882 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
1883 dnl doesn't contain anything at all, beside placeholders for some sections,
1884 dnl and crtbegin only contains a finalizer function that calls
1885 dnl __cxa_finalize. The custom linker actually takes care of calling
1886 dnl __cxa_finalize when the library doesn't call it itself, which makes it
1887 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
1888 dnl link crtbegin and crtend at all.
1889 if test -n "$MOZ_LINKER" -a "$OS_TARGET" = "Android"; then
1890 AC_CACHE_CHECK([whether the CRT objects have text relocations],
1891 ac_cv_crt_has_text_relocations,
1892 [echo 'int foo() { return 0; }' > conftest.cpp
1893 if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
1894 test -s conftest${DLL_SUFFIX}; then
1895 if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
1896 ac_cv_crt_has_text_relocations=yes
1898 ac_cv_crt_has_text_relocations=no
1901 AC_ERROR([couldn't compile a simple C file])
1904 if test "$ac_cv_crt_has_text_relocations" = yes; then
1905 dnl While we want libraries to skip the CRT files, we don't want
1906 dnl executables to be treated the same way. We thus set the flag
1907 dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
1908 dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
1909 dnl Using LDFLAGS in nspr is safe, since we only really build
1910 dnl libraries there.
1911 DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
1912 NSPR_LDFLAGS="$NSPR_LDFLAGS -nostartfiles"
1916 dnl End of C++ language/feature checks
1919 dnl ========================================================
1920 dnl = Internationalization checks
1921 dnl ========================================================
1923 dnl Internationalization and Locale support is different
1924 dnl on various UNIX platforms. Checks for specific i18n
1925 dnl features go here.
1927 dnl check for LC_MESSAGES
1928 AC_CACHE_CHECK(for LC_MESSAGES,
1929 ac_cv_i18n_lc_messages,
1930 [AC_TRY_COMPILE([#include <locale.h>],
1931 [int category = LC_MESSAGES;],
1932 ac_cv_i18n_lc_messages=yes,
1933 ac_cv_i18n_lc_messages=no)])
1934 if test "$ac_cv_i18n_lc_messages" = yes; then
1935 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
1938 AC_HAVE_FUNCS(localeconv)
1940 fi # ! SKIP_COMPILER_CHECKS
1942 if test -n "${COMPILE_ENVIRONMENT}"; then
1947 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1948 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1949 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1952 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1953 dnl features that Windows actually does support.
1955 if test -n "$SKIP_COMPILER_CHECKS"; then
1956 dnl Windows has malloc.h
1957 AC_DEFINE(MALLOC_H, [<malloc.h>])
1958 AC_DEFINE(HAVE_FORCEINLINE)
1959 AC_DEFINE(HAVE_LOCALECONV)
1960 fi # SKIP_COMPILER_CHECKS
1962 dnl Mozilla specific options
1963 dnl ========================================================
1964 dnl The macros used for command line options
1965 dnl are defined in build/autoconf/altoptions.m4.
1967 dnl ========================================================
1969 dnl = Check for external package dependencies
1971 dnl ========================================================
1972 MOZ_ARG_HEADER(External Packages)
1974 case "$OS_TARGET" in
1975 WINNT|Darwin|Android)
1985 dnl ========================================================
1986 dnl system libevent Support
1987 dnl ========================================================
1988 MOZ_ARG_WITH_STRING(system-libevent,
1989 [ --with-system-libevent[=PFX]
1990 Use system libevent [installed at prefix PFX]],
1991 LIBEVENT_DIR=$withval)
1993 _SAVE_CFLAGS=$CFLAGS
1994 _SAVE_LDFLAGS=$LDFLAGS
1996 if test "$LIBEVENT_DIR" = yes; then
1997 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
1998 MOZ_SYSTEM_LIBEVENT=1,
2001 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
2002 MOZ_SYSTEM_LIBEVENT=
2003 elif test -z "$MOZ_SYSTEM_LIBEVENT"; then
2004 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
2005 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
2006 MOZ_CHECK_HEADER(event.h,
2007 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
2008 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
2010 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
2011 AC_CHECK_LIB(event, event_init,
2012 [MOZ_SYSTEM_LIBEVENT=1
2013 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
2014 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
2015 [MOZ_SYSTEM_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
2017 CFLAGS=$_SAVE_CFLAGS
2018 LDFLAGS=$_SAVE_LDFLAGS
2021 AC_SUBST(MOZ_SYSTEM_LIBEVENT)
2023 dnl ========================================================
2024 dnl = If NSS was not detected in the system,
2025 dnl = use the one in the source tree (mozilla/security/nss)
2026 dnl ========================================================
2028 MOZ_ARG_WITH_BOOL(system-nss,
2029 [ --with-system-nss Use system installed NSS],
2032 if test -n "$_USE_SYSTEM_NSS"; then
2033 AM_PATH_NSS(3.30, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
2036 if test -n "$MOZ_SYSTEM_NSS"; then
2037 NSS_LIBS="$NSS_LIBS -lcrmf"
2039 NSS_CFLAGS="-I${DIST}/include/nss"
2040 case "${OS_ARCH}" in
2041 # Only few platforms have been tested with GYP
2042 WINNT|Darwin|Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
2045 AC_MSG_ERROR([building in-tree NSS is not supported on this platform. Use --with-system-nss])
2050 if test -z "$SKIP_LIBRARY_CHECKS"; then
2051 dnl system JPEG support
2052 dnl ========================================================
2053 MOZ_ARG_WITH_STRING(system-jpeg,
2054 [ --with-system-jpeg[=PFX]
2055 Use system libjpeg [installed at prefix PFX]],
2058 _SAVE_CFLAGS=$CFLAGS
2059 _SAVE_LDFLAGS=$LDFLAGS
2061 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
2062 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
2063 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
2065 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
2068 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_SYSTEM_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_SYSTEM_JPEG=)
2071 if test "$MOZ_SYSTEM_JPEG" = 1; then
2072 AC_TRY_COMPILE([ #include <stdio.h>
2073 #include <sys/types.h>
2074 #include <jpeglib.h> ],
2075 [ #if JPEG_LIB_VERSION < $MOZJPEG
2076 #error "Insufficient JPEG library version ($MOZJPEG required)."
2078 #ifndef JCS_EXTENSIONS
2079 #error "libjpeg-turbo JCS_EXTENSIONS required"
2083 AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
2085 CFLAGS=$_SAVE_CFLAGS
2086 LDFLAGS=$_SAVE_LDFLAGS
2089 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_SYSTEM_JPEG" = 1; then
2090 MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
2091 MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
2093 fi # SKIP_LIBRARY_CHECKS
2095 dnl system ZLIB support
2096 dnl ========================================================
2097 MOZ_ZLIB_CHECK([1.2.3])
2099 if test "$MOZ_LINKER" = 1 -a "$MOZ_SYSTEM_ZLIB" != 1; then
2100 AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
2103 if test -z "$SKIP_LIBRARY_CHECKS"; then
2104 dnl system BZIP2 Support
2105 dnl ========================================================
2106 MOZ_ARG_WITH_STRING(system-bz2,
2107 [ --with-system-bz2[=PFX]
2108 Use system libbz2 [installed at prefix PFX]],
2111 _SAVE_CFLAGS=$CFLAGS
2112 _SAVE_LDFLAGS=$LDFLAGS
2114 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
2115 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
2116 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
2118 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
2121 AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_SYSTEM_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
2122 [MOZ_SYSTEM_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
2124 CFLAGS=$_SAVE_CFLAGS
2125 LDFLAGS=$_SAVE_LDFLAGS
2128 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_SYSTEM_BZ2" = 1; then
2129 MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
2130 MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
2133 dnl ========================================================
2134 dnl system PNG Support
2135 dnl ========================================================
2136 MOZ_ARG_WITH_STRING(system-png,
2137 [ --with-system-png[=PFX]
2138 Use system libpng [installed at prefix PFX]],
2141 _SAVE_CFLAGS=$CFLAGS
2142 _SAVE_LDFLAGS=$LDFLAGS
2144 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
2145 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
2146 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
2148 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
2151 AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"],
2152 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
2153 AC_CHECK_LIB(png, png_get_acTL, ,
2154 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
2156 if test "$MOZ_SYSTEM_PNG" = 1; then
2157 AC_TRY_COMPILE([ #include <stdio.h>
2158 #include <sys/types.h>
2160 [ #if PNG_LIBPNG_VER < $MOZPNG
2161 #error "Insufficient libpng version ($MOZPNG required)."
2163 #ifndef PNG_UINT_31_MAX
2164 #error "Insufficient libpng version."
2167 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
2169 CFLAGS=$_SAVE_CFLAGS
2170 LDFLAGS=$_SAVE_LDFLAGS
2173 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then
2174 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
2175 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
2178 fi # SKIP_LIBRARY_CHECKS
2180 dnl ========================================================
2184 dnl ========================================================
2186 MOZ_ARG_HEADER(Application)
2188 ENABLE_SYSTEM_EXTENSION_DIRS=1
2189 MOZ_BRANDING_DIRECTORY=
2190 MOZ_OFFICIAL_BRANDING=
2192 MOZ_AUTH_EXTENSION=1
2193 if test "$MOZ_IOS"; then
2199 MOZ_SAMPLE_TYPE_FLOAT32=
2200 MOZ_SAMPLE_TYPE_S16=
2205 MOZ_WEBRTC_SIGNALING=
2206 MOZ_WEBRTC_ASSERT_ALWAYS=1
2207 MOZ_WEBRTC_HARDWARE_AEC_NS=
2217 LIBJPEG_TURBO_ASFLAGS=
2218 MOZ_PREF_EXTENSIONS=1
2221 MOZ_TOOLKIT_SEARCH=1
2223 MOZ_UNIVERSALCHARDET=1
2229 MOZ_USE_NATIVE_POPUP_WINDOWS=
2230 MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
2231 MOZ_INSTALL_TRACKING=
2234 MOZ_AUDIO_CHANNEL_MANAGER=
2235 MOZ_CONTENT_SANDBOX=
2238 MOZ_BINARY_EXTENSIONS=
2241 case "$target_os" in
2244 AC_DEFINE(NS_ENABLE_TSF)
2249 *-android*|*-linuxandroid*)
2250 MOZ_THEME_FASTSTRIPE=1
2256 # Optional Firefox for Android partner distribution directory.
2257 MOZ_ARG_WITH_STRING(android-distribution-directory,
2258 [ --with-android-distribution-directory=dir
2259 Optional Firefox for Android partner distribution directory.],
2260 MOZ_ANDROID_DISTRIBUTION_DIRECTORY=$withval)
2262 if test -n "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY"; then
2263 # A distribution directory must have an assets/distribution directory.
2264 # See https://wiki.mozilla.org/Mobile/Distribution_Files.
2265 if test ! -d "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY/assets/distribution" ; then
2266 AC_MSG_ERROR([--with-android-distribution-directory does not contain assets/distribution;
2267 (looked for ${MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets/distribution).])
2270 AC_SUBST(MOZ_ANDROID_DISTRIBUTION_DIRECTORY)
2272 dnl ========================================================
2273 dnl = Trademarked Branding
2274 dnl ========================================================
2275 MOZ_ARG_ENABLE_BOOL(official-branding,
2276 [ --enable-official-branding
2277 Enable Official mozilla.org Branding
2278 Do not distribute builds with
2279 --enable-official-branding unless you have
2280 permission to use trademarks per
2281 http://www.mozilla.org/foundation/trademarks/ .],
2282 MOZ_OFFICIAL_BRANDING=1,
2283 MOZ_OFFICIAL_BRANDING=)
2285 # Allow the application to influence configure with a confvars.sh script.
2286 AC_MSG_CHECKING([if app-specific confvars.sh exists])
2287 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
2288 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
2289 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
2294 # Allow influencing configure with a defines.sh script.
2295 . "${srcdir}/build/defines.sh"
2297 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
2299 if test "$BUILDING_RELEASE"; then
2300 # Override value in defines.sh, if any
2301 EARLY_BETA_OR_EARLIER=
2302 elif test "$EARLY_BETA_OR_EARLIER"; then
2303 AC_DEFINE(EARLY_BETA_OR_EARLIER)
2305 AC_SUBST(EARLY_BETA_OR_EARLIER)
2307 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
2308 MOZ_ARG_WITH_STRING(app-name,
2309 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
2310 WITH_APP_NAME=$withval,
2313 if test -n "$WITH_APP_NAME" ; then
2314 MOZ_APP_NAME="$WITH_APP_NAME"
2317 MOZ_ARG_WITH_STRING(app-basename,
2318 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
2319 WITH_APP_BASENAME=$withval,
2322 if test -n "$WITH_APP_BASENAME" ; then
2323 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
2326 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
2327 # that haven't made a confvars.sh yet. Don't add new stuff here, use
2329 case "$MOZ_BUILD_APP" in
2331 AC_DEFINE(MOZ_PHOENIX)
2335 AC_DEFINE(MOZ_XULRUNNER)
2339 if test -n "$MOZ_B2G"; then
2343 # Graphene is a desktop runtime for running applications with a HTML UI.
2344 if test -n "$MOZ_GRAPHENE"; then
2345 AC_DEFINE(MOZ_GRAPHENE)
2348 if test -n "$MOZ_MULET"; then
2349 AC_DEFINE(MOZ_MULET)
2352 # Propagate feature switches for code written in rust from confvars.sh
2353 if test -n "$MOZ_RUST"; then
2354 if test -n "$MOZ_RUST_MP4PARSE"; then
2355 AC_DEFINE(MOZ_RUST_MP4PARSE)
2357 if test -n "$MOZ_RUST_URLPARSE"; then
2358 AC_DEFINE(MOZ_RUST_URLPARSE)
2359 AC_SUBST(MOZ_RUST_URLPARSE)
2363 AC_SUBST(MOZ_PHOENIX)
2364 AC_SUBST(MOZ_XULRUNNER)
2367 AC_SUBST(MOZ_B2G_VERSION)
2369 dnl ========================================================
2370 dnl Ensure Android SDK and build-tools versions depending on
2372 dnl ========================================================
2374 if test -z "$gonkdir" ; then
2375 case "$MOZ_BUILD_APP" in
2377 MOZ_ANDROID_SDK(23, 23.0.3 23.0.1)
2382 dnl ========================================================
2384 dnl = Toolkit Options
2386 dnl ========================================================
2387 MOZ_ARG_HEADER(Toolkit Options)
2389 dnl ========================================================
2390 dnl = Enable the toolkit as needed =
2391 dnl ========================================================
2393 case "$MOZ_WIDGET_TOOLKIT" in
2396 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
2397 # Use -Wl as a trick to avoid -framework and framework names from
2398 # being separated by AC_SUBST_LIST.
2399 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 -Wl,-framework,Security -Wl,-framework,ServiceManagement'
2401 CFLAGS="$CFLAGS $TK_CFLAGS"
2402 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
2403 MOZ_USER_DIR="Mozilla"
2404 MOZ_FS_LAYOUT=bundle
2408 LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
2410 TK_LIBS='-Wl,-framework,Foundation -Wl,-framework,CoreFoundation -Wl,-framework,CoreGraphics -Wl,-framework,CoreText -Wl,-framework,AVFoundation -Wl,-framework,AudioToolbox -Wl,-framework,CoreMedia -Wl,-framework,CoreVideo -Wl,-framework,OpenGLES -Wl,-framework,QuartzCore'
2411 CFLAGS="$CFLAGS $TK_CFLAGS"
2412 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
2413 MOZ_USER_DIR="Mozilla"
2414 MOZ_FS_LAYOUT=bundle
2419 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
2420 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
2421 case "$MOZ_WIDGET_TOOLKIT" in
2427 if test "$COMPILE_ENVIRONMENT"; then
2428 if test "$MOZ_WIDGET_TOOLKIT" = gtk3; then
2429 PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
2430 MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
2431 TK_CFLAGS=$MOZ_GTK3_CFLAGS
2432 TK_LIBS=$MOZ_GTK3_LIBS
2433 dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
2434 dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
2435 AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
2436 GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32
2438 if test "$MOZ_WIDGET_TOOLKIT" = gtk2; then
2439 GLIB_VERSION_MAX_ALLOWED=$GLIB_VERSION_MIN_REQUIRED
2441 if test "$MOZ_ENABLE_GTK"; then
2442 if test "$MOZ_X11"; then
2443 GDK_PACKAGES=gdk-x11-2.0
2445 AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
2446 AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
2448 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)
2449 MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
2451 if test "$MOZ_WIDGET_TOOLKIT" = gtk2; then
2452 TK_CFLAGS=$MOZ_GTK2_CFLAGS
2453 TK_LIBS=$MOZ_GTK2_LIBS
2455 fi # COMPILE_ENVIRONMENT
2457 AC_SUBST(MOZ_FS_LAYOUT)
2459 dnl ========================================================
2460 dnl = startup-notification support module
2461 dnl ========================================================
2463 if test "$MOZ_ENABLE_GTK"
2465 MOZ_ENABLE_STARTUP_NOTIFICATION=
2467 MOZ_ARG_ENABLE_BOOL(startup-notification,
2468 [ --enable-startup-notification
2469 Enable startup-notification support (default: disabled) ],
2470 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
2471 MOZ_ENABLE_STARTUP_NOTIFICATION=)
2472 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
2474 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
2475 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
2476 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
2477 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
2479 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
2481 MOZ_ENABLE_STARTUP_NOTIFICATION=
2485 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
2486 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
2489 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
2491 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
2493 AC_SUBST_LIST(TK_CFLAGS)
2494 AC_SUBST_LIST(TK_LIBS)
2499 dnl ========================================================
2501 dnl = Components & Features
2503 dnl ========================================================
2504 MOZ_ARG_HEADER(Components and Features)
2506 dnl ========================================================
2508 dnl ========================================================
2509 MOZ_ARG_ENABLE_STRING(ui-locale,
2510 [ --enable-ui-locale=ab-CD
2511 Select the user interface locale (default: en-US)],
2512 MOZ_UI_LOCALE=$enableval )
2513 AC_SUBST(MOZ_UI_LOCALE)
2515 AC_SUBST(MOZ_OFFICIAL_BRANDING)
2516 if test -n "$MOZ_OFFICIAL_BRANDING"; then
2517 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
2518 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
2520 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
2521 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
2525 MOZ_ARG_WITH_STRING(branding,
2526 [ --with-branding=dir Use branding from the specified directory.],
2527 MOZ_BRANDING_DIRECTORY=$withval)
2529 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
2530 if test -z "$REAL_BRANDING_DIRECTORY"; then
2531 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
2534 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
2535 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
2536 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
2537 . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
2540 AC_SUBST(MOZ_BRANDING_DIRECTORY)
2542 dnl ========================================================
2543 dnl = Distribution ID
2544 dnl ========================================================
2545 MOZ_ARG_WITH_STRING(distribution-id,
2546 [ --with-distribution-id=ID
2547 Set distribution-specific id (default=org.mozilla)],
2548 [ val=`echo $withval`
2549 MOZ_DISTRIBUTION_ID="$val"])
2551 if test -z "$MOZ_DISTRIBUTION_ID"; then
2552 MOZ_DISTRIBUTION_ID="org.mozilla"
2555 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
2556 AC_SUBST(MOZ_DISTRIBUTION_ID)
2559 dnl ========================================================
2560 dnl Google Play Services, placed here so it can depend on
2561 dnl values set by configure.sh above.
2562 dnl ========================================================
2564 MOZ_ANDROID_GOOGLE_PLAY_SERVICES
2565 MOZ_ANDROID_GOOGLE_CLOUD_MESSAGING
2566 MOZ_ANDROID_INSTALL_TRACKING
2569 dnl ========================================================
2570 dnl = GIO and GConf support module
2571 dnl ========================================================
2575 dnl build the GIO extension by default only when the
2576 dnl GTK2 toolkit is in use.
2577 if test "$MOZ_ENABLE_GTK"
2583 dnl ========================================================
2584 dnl = GIO support module
2585 dnl ========================================================
2586 MOZ_ARG_DISABLE_BOOL(gio,
2587 [ --disable-gio Disable GIO support],
2589 MOZ_ENABLE_GIO=force)
2591 if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK"
2593 if test "$MOZ_WIDGET_TOOLKIT" = gtk2
2595 PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
2596 [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
2598 PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
2599 MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
2601 AC_DEFINE(MOZ_ENABLE_GIO)
2603 if test "$MOZ_ENABLE_GIO" = "force"
2605 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
2611 AC_SUBST(MOZ_ENABLE_GIO)
2613 dnl ========================================================
2614 dnl = GConf support module
2615 dnl ========================================================
2616 MOZ_ARG_DISABLE_BOOL(gconf,
2617 [ --disable-gconf Disable Gconf support ],
2621 if test "$MOZ_ENABLE_GCONF"
2623 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
2624 MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
2627 if test -n "$MOZ_ENABLE_GCONF";
2629 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
2631 AC_MSG_WARN([Many automated tests will fail with --disable-gconf. See bug 1167201.])
2636 if test "$MOZ_ENABLE_GCONF"; then
2637 AC_DEFINE(MOZ_ENABLE_GCONF)
2640 AC_SUBST(MOZ_ENABLE_GCONF)
2643 dnl ========================================================
2644 dnl = libproxy support
2645 dnl ========================================================
2647 if test "$MOZ_ENABLE_GTK"
2649 MOZ_ENABLE_LIBPROXY=
2651 MOZ_ARG_ENABLE_BOOL(libproxy,
2652 [ --enable-libproxy Enable libproxy support ],
2653 MOZ_ENABLE_LIBPROXY=1,
2654 MOZ_ENABLE_LIBPROXY=)
2656 if test "$MOZ_ENABLE_LIBPROXY"
2658 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
2659 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
2662 AC_SUBST(MOZ_ENABLE_LIBPROXY)
2664 dnl ========================================================
2665 dnl = libgnomeui support module
2666 dnl ========================================================
2668 if test "$MOZ_ENABLE_GTK"
2670 MOZ_ARG_ENABLE_BOOL(gnomeui,
2671 [ --enable-gnomeui Enable libgnomeui instead of GIO & GTK for icon theme support ],
2672 MOZ_ENABLE_GNOMEUI=force,
2673 MOZ_ENABLE_GNOMEUI=)
2675 if test "$MOZ_ENABLE_GNOMEUI"
2677 PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
2679 MOZ_ENABLE_GNOMEUI=1
2681 if test "$MOZ_ENABLE_GNOMEUI" = "force"
2683 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
2689 if test "$MOZ_ENABLE_GNOMEUI"; then
2690 AC_DEFINE(MOZ_ENABLE_GNOMEUI)
2694 AC_SUBST(MOZ_ENABLE_GNOMEUI)
2696 dnl ========================================================
2698 dnl ========================================================
2700 if test "$MOZ_ENABLE_GTK"
2704 MOZ_ARG_DISABLE_BOOL(dbus,
2705 [ --disable-dbus Disable dbus support ],
2709 if test "$MOZ_ENABLE_DBUS"
2711 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
2712 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
2713 AC_DEFINE(MOZ_ENABLE_DBUS)
2716 AC_SUBST(MOZ_ENABLE_DBUS)
2718 dnl =========================================================
2719 dnl = Whether to exclude hyphenations files in the build
2720 dnl =========================================================
2721 if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
2722 AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
2725 dnl ========================================================
2726 dnl = Include install tracking on Android
2727 dnl ========================================================
2728 if test -n "$MOZ_INSTALL_TRACKING"; then
2729 if test -z "$MOZ_ADJUST_SDK_KEY"; then
2730 AC_MSG_ERROR([Must specify --with-adjust-sdk-keyfile when MOZ_INSTALL_TRACKING is defined!])
2734 dnl ========================================================
2735 dnl accessibility support on by default on all platforms
2736 dnl ========================================================
2737 MOZ_ARG_DISABLE_BOOL(accessibility,
2738 [ --disable-accessibility Disable accessibility support],
2741 if test "$ACCESSIBILITY"; then
2744 if test -z "$MIDL"; then
2745 if test "$GCC" != "yes"; then
2746 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
2748 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.])
2752 AC_DEFINE(ACCESSIBILITY)
2755 dnl ========================================================
2756 dnl Accessibility is required for the linuxgl widget
2758 dnl ========================================================
2759 if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
2760 AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
2763 dnl Turn off webrtc for OS's we don't handle yet, but allow
2764 dnl --enable-webrtc to override. Can disable for everything in
2765 dnl the master list above.
2766 if test -n "$MOZ_WEBRTC"; then
2768 *-linux*|*-mingw*|*-darwin*|*-android*|*-linuxandroid*|*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*)
2772 dnl default to disabled for all others
2778 AC_TRY_COMPILE([#include <linux/ethtool.h>],
2779 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
2780 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
2782 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
2784 # target_arch is from {ia32|x64|arm|ppc}
2786 x86_64 | arm | aarch64 | x86 | ppc* | ia64)
2790 # unsupported arch for webrtc
2796 dnl ========================================================
2797 dnl = Disable WebRTC code
2798 dnl ========================================================
2799 MOZ_ARG_DISABLE_BOOL(webrtc,
2800 [ --disable-webrtc Disable support for WebRTC],
2804 if test -n "$MOZ_WEBRTC"; then
2805 AC_DEFINE(MOZ_WEBRTC)
2806 dnl MOZ_WEBRTC_ASSERT_ALWAYS turns on a number of safety asserts in
2807 dnl opt/production builds (via MOZ_CRASH())
2808 AC_DEFINE(MOZ_WEBRTC_ASSERT_ALWAYS)
2811 dnl enable once Signaling lands
2812 MOZ_WEBRTC_SIGNALING=1
2813 AC_DEFINE(MOZ_WEBRTC_SIGNALING)
2814 dnl enable once PeerConnection lands
2815 MOZ_PEERCONNECTION=1
2816 AC_DEFINE(MOZ_PEERCONNECTION)
2821 if test -n "$MOZ_X11"; then
2822 MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
2828 dnl ========================================================
2829 dnl = Force hardware AEC, disable webrtc.org AEC
2830 dnl ========================================================
2831 MOZ_ARG_ENABLE_BOOL(hardware-aec-ns,
2832 [ --enable-hardware-aec-ns Enable support for hardware AEC and noise suppression],
2833 MOZ_WEBRTC_HARDWARE_AEC_NS=1,
2834 MOZ_WEBRTC_HARDWARE_AEC_NS=)
2836 if test -n "$MOZ_WEBRTC_HARDWARE_AEC_NS"; then
2837 AC_DEFINE(MOZ_WEBRTC_HARDWARE_AEC_NS)
2840 AC_SUBST(MOZ_WEBRTC)
2841 AC_SUBST(MOZ_WEBRTC_SIGNALING)
2842 AC_SUBST(MOZ_PEERCONNECTION)
2843 AC_SUBST(MOZ_WEBRTC_ASSERT_ALWAYS)
2844 AC_SUBST(MOZ_WEBRTC_HARDWARE_AEC_NS)
2847 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
2849 dnl Use integers over floats for audio on B2G and Android
2850 dnl (regarless of the CPU architecture, because audio
2851 dnl backends for those platforms don't support floats. We also
2852 dnl use integers on ARM with other OS, because it's more efficient.
2853 if test "$OS_TARGET" = "Android" -o "$CPU_ARCH" = "arm"; then
2854 MOZ_SAMPLE_TYPE_S16=1
2855 AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
2856 AC_SUBST(MOZ_SAMPLE_TYPE_S16)
2858 MOZ_SAMPLE_TYPE_FLOAT32=1
2859 AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
2860 AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
2863 dnl ========================================================
2864 dnl = Enable Raw Codecs
2865 dnl ========================================================
2866 MOZ_ARG_ENABLE_BOOL(raw,
2867 [ --enable-raw Enable support for RAW media],
2871 if test -n "$MOZ_RAW"; then
2877 dnl ========================================================
2878 dnl = Apple platform decoder support
2879 dnl ========================================================
2880 if test "$COMPILE_ENVIRONMENT"; then
2881 if test -n "$MOZ_APPLEMEDIA"; then
2882 # hack in frameworks for fmp4 - see bug 1029974
2883 # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
2884 LDFLAGS="$LDFLAGS -framework AudioToolbox"
2885 dnl Verify CoreMedia is available.
2886 AC_CHECK_HEADER([CoreMedia/CoreMedia.h], [],
2887 [AC_MSG_ERROR([MacOS X 10.7 SDK or later is required])])
2889 fi # COMPILE_ENVIRONMENT
2891 dnl ========================================================
2892 dnl = DirectShow support
2893 dnl ========================================================
2894 if test "$OS_ARCH" = "WINNT"; then
2895 dnl Enable DirectShow support by default.
2899 MOZ_ARG_DISABLE_BOOL(directshow,
2900 [ --disable-directshow Disable support for DirectShow],
2904 if test -n "$MOZ_DIRECTSHOW"; then
2905 AC_DEFINE(MOZ_DIRECTSHOW)
2908 dnl ========================================================
2909 dnl = Built-in fragmented MP4 support.
2910 dnl ========================================================
2912 if test x"$MOZ_WIDGET_TOOLKIT" = x"gonk" -a -n "$MOZ_FMP4" -a -n "$android_version"; then
2913 # we now know for sure that $android_version is not an empty string!
2914 if test "$android_version" -ge "18"; then
2915 MOZ_GONK_MEDIACODEC=1
2916 AC_SUBST(MOZ_GONK_MEDIACODEC)
2921 dnl ========================================================
2922 dnl = Enable media plugin support
2923 dnl ========================================================
2924 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
2925 dnl Enable support on android by default
2929 MOZ_ARG_ENABLE_BOOL(android-omx,
2930 [ --enable-android-omx Enable support for Android OMX media backend],
2934 if test -n "$MOZ_ANDROID_OMX"; then
2935 AC_DEFINE(MOZ_ANDROID_OMX)
2938 dnl ========================================================
2939 dnl = Enable building OMX media plugin (B2G or Android)
2940 dnl ========================================================
2941 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
2942 dnl Enable support on android by default
2946 MOZ_ARG_ENABLE_BOOL(omx-plugin,
2947 [ --enable-omx-plugin Enable building OMX plugin (B2G)],
2951 if test -n "$MOZ_OMX_PLUGIN"; then
2952 if test "$OS_TARGET" = "Android"; then
2953 dnl Only allow building OMX plugin on Gonk (B2G) or Android
2954 AC_DEFINE(MOZ_OMX_PLUGIN)
2956 dnl fail if we're not building on Gonk or Android
2957 AC_MSG_ERROR([OMX media plugin can only be built on B2G or Android])
2961 dnl system libvpx Support
2962 dnl ========================================================
2963 MOZ_ARG_WITH_BOOL(system-libvpx,
2964 [ --with-system-libvpx Use system libvpx (located with pkgconfig)],
2965 MOZ_SYSTEM_LIBVPX=1)
2970 _SAVE_CFLAGS=$CFLAGS
2972 if test -n "$MOZ_SYSTEM_LIBVPX"; then
2973 dnl ============================
2974 dnl === libvpx Version check ===
2975 dnl ============================
2976 dnl Check to see if we have a system libvpx package.
2977 PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.5.0)
2979 CFLAGS="$CFLAGS $MOZ_LIBVPX_CFLAGS"
2980 LIBS="$LIBS $MOZ_LIBVPX_LIBS"
2982 MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
2983 [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.])])
2985 AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
2986 [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
2988 MOZ_CHECK_HEADER([vpx_mem/vpx_mem.h],
2989 [AC_CHECK_FUNC(vpx_mem_set_functions)])
2990 if test "$ac_cv_header_vpx_mem_vpx_mem_h" = no -o \
2991 "$ac_cv_func_vpx_mem_set_functions" = no; then
2992 AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
2995 CFLAGS=$_SAVE_CFLAGS
2998 AC_SUBST(MOZ_SYSTEM_LIBVPX)
2999 AC_SUBST_LIST(MOZ_LIBVPX_CFLAGS)
3000 AC_SUBST_LIST(MOZ_LIBVPX_LIBS)
3002 if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
3008 if test -z "$MOZ_SYSTEM_LIBVPX"; then
3010 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
3011 dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
3012 dnl We currently require gcc on all arm platforms.
3014 dnl See if we have assembly on this platform.
3015 case "$OS_ARCH:$CPU_ARCH" in
3029 dnl Check for yasm 1.1 or greater.
3030 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
3031 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.])
3032 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
3033 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.])
3037 dnl The encoder needs obj_int_extract to get asm offsets.
3038 fi # COMPILE_ENVIRONMENT and others
3041 if test -n "$GNU_AS" ; then
3042 dnl These flags are a lie; they're just used to enable the requisite
3043 dnl opcodes; actual arch detection is done at runtime.
3044 VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
3045 VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/libvpx/build/make/ads2gas.pl'
3047 dnl Building with -mfpu=neon requires either the "softfp" or the
3048 dnl "hardfp" ABI. Depending on the compiler's default target, and the
3049 dnl CFLAGS, the default ABI might be neither, in which case it is the
3050 dnl "softfloat" ABI.
3051 dnl The "softfloat" ABI is binary-compatible with the "softfp" ABI, so
3052 dnl we can safely mix code built with both ABIs. So, if we detect
3053 dnl that compiling uses the "softfloat" ABI, force the use of the
3054 dnl "softfp" ABI instead.
3055 dnl Confusingly, the __SOFTFP__ preprocessor variable indicates the
3056 dnl "softfloat" ABI, not the "softfp" ABI.
3057 dnl Note: VPX_ASFLAGS is also used in CFLAGS.
3060 #error "compiler target supports -mfpu=neon, so we don't have to add extra flags"
3062 VPX_ASFLAGS="$VPX_ASFLAGS -mfloat-abi=softfp"
3067 if $CC -E -dM -</dev/null | grep -q __ELF__; then
3073 if $CC -E -dM -</dev/null | grep -q __ELF__; then
3080 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_USE_YASM" -a -z "$YASM"; then
3081 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.])
3082 fi # COMPILE_ENVIRONMENT and others
3084 if test -n "$VPX_USE_YASM" && test "$OS_ARCH:$CPU_ARCH" != "WINNT:x86_64"; then
3088 if test -n "$VPX_X86_ASM"; then
3089 AC_DEFINE(VPX_X86_ASM)
3090 elif test -n "$VPX_ARM_ASM"; then
3091 AC_DEFINE(VPX_ARM_ASM)
3093 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
3096 dnl native libvpx no longer has vpx_mem_set_functions
3097 AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
3100 dnl ========================================================
3101 dnl = Handle dependent MEDIA defines
3102 dnl ========================================================
3104 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
3105 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/])
3108 if test -n "$MOZ_VORBIS"; then
3109 AC_DEFINE(MOZ_VORBIS)
3112 if test -n "$MOZ_TREMOR"; then
3113 AC_DEFINE(MOZ_TREMOR)
3117 AC_DEFINE(MOZ_WEBM_ENCODER)
3118 AC_SUBST(MOZ_WEBM_ENCODER)
3120 dnl ==================================
3121 dnl = Check alsa availability on Linux
3122 dnl ==================================
3124 MOZ_ARG_ENABLE_BOOL(alsa,
3125 [ --enable-alsa Enable Alsa support],
3129 if test -n "$MOZ_ALSA"; then
3130 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
3131 [echo "$MOZ_ALSA_PKG_ERRORS"
3132 AC_MSG_ERROR([Need alsa for audio output on Linux. (On Ubuntu, you might try installing the package libasound2-dev.)])])
3137 dnl ========================================================
3138 dnl = Disable PulseAudio
3139 dnl ========================================================
3141 dnl If using Desktop Linux, ensure that the PA library is available
3142 case "$OS_TARGET" in
3143 WINNT|Darwin|Android|OpenBSD)
3150 MOZ_ARG_DISABLE_BOOL(pulseaudio,
3151 [ --disable-pulseaudio Disable PulseAudio support],
3155 if test -n "$MOZ_PULSEAUDIO"; then
3156 AC_DEFINE(MOZ_PULSEAUDIO)
3157 if test -z "$gonkdir"; then
3158 PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
3159 [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
3160 AC_MSG_ERROR([pulseaudio audio backend requires libpulse development package])])
3162 MOZ_PULSEAUDIO_CFLAGS="-I$gonkdir/external/pulseaudio/pulseaudio/src"
3166 AC_SUBST(MOZ_PULSEAUDIO)
3168 dnl ========================================================
3170 dnl ========================================================
3172 MOZ_ARG_DISABLE_BOOL(negotiateauth,
3173 [ --disable-negotiateauth Disable GSS-API negotiation ],
3174 MOZ_AUTH_EXTENSION=,
3175 MOZ_AUTH_EXTENSION=1 )
3177 if test -n "$MOZ_IOS" -a -n "$MOZ_AUTH_EXTENSION"; then
3178 AC_MSG_ERROR([negotiateauth is not supported on iOS.])
3181 dnl ========================================================
3182 dnl Pref extensions (autoconfig)
3183 dnl ========================================================
3184 MOZ_ARG_DISABLE_BOOL(pref-extensions,
3185 [ --disable-pref-extensions
3186 Disable pref extensions such as autoconfig],
3187 MOZ_PREF_EXTENSIONS=,
3188 MOZ_PREF_EXTENSIONS=1 )
3190 dnl ========================================================
3191 dnl Searching of system directories for extensions.
3192 dnl Note: this switch is meant to be used for test builds
3193 dnl whose behavior should not depend on what happens to be
3194 dnl installed on the local machine.
3195 dnl ========================================================
3196 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
3197 [ --disable-system-extension-dirs
3198 Disable searching system- and account-global
3199 directories for extensions of any kind; use
3200 only profile-specific extension directories],
3201 ENABLE_SYSTEM_EXTENSION_DIRS=,
3202 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
3203 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
3204 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
3207 dnl ========================================================
3208 dnl = Universalchardet
3209 dnl ========================================================
3210 MOZ_ARG_DISABLE_BOOL(universalchardet,
3211 [ --disable-universalchardet
3212 Disable universal encoding detection],
3213 MOZ_UNIVERSALCHARDET=,
3214 MOZ_UNIVERSALCHARDET=1 )
3216 dnl ========================================================
3217 dnl = ANGLE OpenGL->D3D translator for WebGL
3218 dnl = * only applies to win32
3219 dnl ========================================================
3223 MOZ_HAS_WINSDK_WITH_D3D=
3224 MOZ_D3DCOMPILER_VISTA_DLL=
3225 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
3227 if test "$COMPILE_ENVIRONMENT" ; then
3228 case "$target_os" in
3230 MOZ_ANGLE_RENDERER=1
3234 # The DirectX SDK libraries are split into x86 and x64 sub-directories
3235 case "${target_cpu}" in
3237 MOZ_D3D_CPU_SUFFIX=x86
3240 MOZ_D3D_CPU_SUFFIX=x64
3244 # This is potentially set in external mozconfig files; if it's set,
3245 # then the build exposes the "webgl" context name, which is reserved
3246 # for conformant implementations.
3247 if test -n "$MOZ_WEBGL_CONFORMANT"; then
3248 AC_DEFINE(MOZ_WEBGL_CONFORMANT)
3251 dnl ========================================================
3252 dnl D3D compiler DLL
3253 dnl ========================================================
3254 MOZ_FOUND_D3D_COMPILERS=
3256 if test -n "$MOZ_ANGLE_RENDERER"; then
3257 if test -z "$MOZ_D3D_CPU_SUFFIX"; then
3258 AC_MSG_ERROR([Couldn't determine MOZ_D3D_CPU_SUFFIX.])
3261 ######################################
3262 # Find _46+ for use by Vista+.
3264 # Find a D3D compiler DLL in a Windows SDK.
3265 MOZ_D3DCOMPILER_VISTA_DLL=
3266 case "$MOZ_WINSDK_MAXVER" in
3268 MOZ_D3DCOMPILER_VISTA_DLL=d3dcompiler_47.dll
3269 AC_MSG_RESULT([Found D3D compiler in Windows SDK.])
3273 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
3274 # We have a name, now track down the path.
3275 if test -n "$WINDOWSSDKDIR"; then
3276 MOZ_D3DCOMPILER_VISTA_DLL_PATH="$WINDOWSSDKDIR/Redist/D3D/$MOZ_D3D_CPU_SUFFIX/$MOZ_D3DCOMPILER_VISTA_DLL"
3277 if test -f "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
3278 AC_MSG_RESULT([Found MOZ_D3DCOMPILER_VISTA_DLL_PATH: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
3279 MOZ_HAS_WINSDK_WITH_D3D=1
3281 AC_MSG_RESULT([MOZ_D3DCOMPILER_VISTA_DLL_PATH doesn't exist: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
3282 AC_MSG_ERROR([Windows SDK at "$WINDOWSSDKDIR" appears broken. Try updating to MozillaBuild 1.9 final or higher.])
3283 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
3286 AC_MSG_RESULT([Windows SDK not found.])
3289 AC_MSG_ERROR([Couldn't find Windows SDK 8.1 or higher needed for ANGLE.])
3292 if test -z "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
3293 MOZ_D3DCOMPILER_VISTA_DLL=
3296 # On mingw, check if headers are provided by toolchain.
3297 if test -n "$GNU_CC"; then
3298 MOZ_CHECK_HEADER(d3d10.h, MOZ_HAS_WINSDK_WITH_D3D=1)
3301 ######################################
3302 # Check that we found what we needed.
3303 MOZ_FOUND_A_D3D_COMPILER=
3305 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
3306 MOZ_FOUND_A_D3D_COMPILER=1
3307 AC_MSG_RESULT([Found d3dcompiler DLL for Vista+: $MOZ_D3DCOMPILER_VISTA_DLL])
3310 if test -z "$CROSS_COMPILE"; then
3311 if test -z "MOZ_FOUND_A_D3D_COMPILER"; then
3312 AC_MSG_ERROR([Couldn't find an acceptable D3D compiler DLL.])
3315 fi # MOZ_ANGLE_RENDERER
3317 fi # COMPILE_ENVIRONMENT
3320 dnl ========================================================
3322 dnl ========================================================
3323 MOZ_GAMEPAD_BACKEND=stub
3325 case "$OS_TARGET" in
3327 if test -z "$MOZ_IOS"; then
3328 MOZ_GAMEPAD_BACKEND=cocoa
3332 MOZ_GAMEPAD_BACKEND=windows
3335 MOZ_CHECK_HEADER([linux/joystick.h])
3336 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
3337 AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
3339 MOZ_GAMEPAD_BACKEND=linux
3342 MOZ_GAMEPAD_BACKEND=android
3348 AC_SUBST(MOZ_GAMEPAD_BACKEND)
3350 dnl ========================================================
3351 dnl = Breakpad crash reporting (on by default on supported platforms)
3352 dnl ========================================================
3355 i?86-*-mingw*|x86_64-*-mingw*)
3358 i?86-apple-darwin*|x86_64-apple-darwin*)
3359 if test -z "$MOZ_IOS"; then
3363 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
3364 if test "$MOZ_ENABLE_GTK"; then
3368 *-android*|*-linuxandroid*)
3373 MOZ_ARG_DISABLE_BOOL(crashreporter,
3374 [ --disable-crashreporter Disable breakpad crash reporting],
3375 [MOZ_CRASHREPORTER=],
3376 [MOZ_CRASHREPORTER=F # Force enable breakpad])
3378 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin"; then
3379 if test "$MOZ_CRASHREPORTER" = F; then
3380 AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
3385 if test -n "$MOZ_CRASHREPORTER"; then
3386 AC_DEFINE(MOZ_CRASHREPORTER)
3388 if test "$OS_TARGET" = "Linux" && \
3389 test -z "$SKIP_LIBRARY_CHECKS"; then
3390 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
3393 if test "$OS_ARCH" = "WINNT"; then
3394 if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
3395 MOZ_CRASHREPORTER_INJECTOR=1
3396 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
3401 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
3402 [ --with-crashreporter-enable-percent=NN
3403 Enable sending crash reports by default on NN% of users. (default=100)],
3404 [ val=`echo $withval | sed 's/[^0-9]//g'`
3405 MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
3407 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
3408 MOZ_CRASHREPORTER_ENABLE_PERCENT=100
3410 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
3412 dnl ========================================================
3413 dnl = libjpeg-turbo configuration
3414 dnl ========================================================
3416 LIBJPEG_TURBO_USE_YASM=
3417 if test -z "$MOZ_SYSTEM_JPEG"; then
3421 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
3422 [ --disable-libjpeg-turbo Disable optimized jpeg decoding routines],
3424 MOZ_LIBJPEG_TURBO=1)
3426 if test "$MOZ_SYSTEM_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
3427 AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
3430 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
3433 if test -n "$MOZ_LIBJPEG_TURBO" -a -n "$COMPILE_ENVIRONMENT"; then
3435 dnl Do we support libjpeg-turbo on this platform?
3436 case "$OS_ARCH:$CPU_ARCH" in
3438 LIBJPEG_TURBO_ASFLAGS="-DPIC -DMACHO"
3441 LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DMACHO"
3446 LIBJPEG_TURBO_ASFLAGS="-DPIC -DWIN32"
3449 LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DWIN64 -DMSVC"
3452 LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
3455 LIBJPEG_TURBO_ASFLAGS="-march=armv8-a"
3458 LIBJPEG_TURBO_ASFLAGS="-mdspr2"
3461 if $CC -E -dM -</dev/null | grep -q __ELF__; then
3462 LIBJPEG_TURBO_ASFLAGS="-DPIC -DELF"
3466 if $CC -E -dM -</dev/null | grep -q __ELF__; then
3467 LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DELF"
3473 if test -n "$LIBJPEG_TURBO_ASFLAGS"; then
3475 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
3476 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
3477 dnl it doesn't exist or we have too old of a version.
3479 LIBJPEG_TURBO_USE_YASM=1
3481 if test -z "$YASM" ; then
3482 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.])
3485 dnl Check that we have the right yasm version. We require 1.0.1 or newer
3486 dnl on Linux and 1.1 or newer everywhere else.
3487 if test "$OS_ARCH" = "Linux" ; then
3488 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
3489 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.])
3492 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
3493 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.])
3500 dnl ========================================================
3501 dnl = libav-fft configuration
3502 dnl ========================================================
3506 dnl Turn on libav-fft for 32-bit windows, and all 64-bit supported platforms.
3507 dnl 32-bit linux/os x have text relocation issues.
3509 case "$OS_ARCH:$CPU_ARCH" in
3518 dnl Detect if we can use yasm to compile libav's assembly
3520 if test -n "$MOZ_LIBAV_FFT" -a -n "$COMPILE_ENVIRONMENT"; then
3521 AC_DEFINE(MOZ_LIBAV_FFT)
3522 dnl Do we support libav-fft on this platform?
3523 case "$OS_ARCH:$CPU_ARCH" in
3525 LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DMACHO"
3528 LIBAV_FFT_ASFLAGS="-DPIC -DWIN32"
3531 LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DWIN64 -DMSVC"
3534 if $CC -E -dM -</dev/null | grep -q __ELF__; then
3535 LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DELF"
3539 AC_MSG_ERROR([libav's FFT routines are only available for 32-bit windows or 64-bit x86 based platforms.])
3544 if test -n "$LIBAV_FFT_ASFLAGS"; then
3545 dnl If we're on an x86 or x64 system which supports libav-fft's asm routines
3546 dnl check for Yasm, and error out if it doesn't exist or we have too old of a
3548 if test -z "$YASM" ; then
3549 AC_MSG_ERROR([Yasm is required to build with libav's optimized FFT routines, but you do not appear to have Yasm installed. See https://developer.mozilla.org/en/YASM for more details.])
3551 dnl Check that we have the right yasm version. We require 1.0.1 or newer
3552 dnl on Linux and 1.1 or newer everywhere else.
3553 if test "$OS_ARCH" = "Linux" ; then
3554 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
3555 AC_MSG_ERROR([Yasm 1.0.1 or greater is required to build with libav's optimized FFT routines, but you do not appear to have Yasm installed. See https://developer.mozilla.org/en/YASM for more details.])
3558 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
3559 AC_MSG_ERROR([Yasm 1.1 or greater is required to build with libav's optimized FFT routines, but you do not appear to have Yasm installed. See https://developer.mozilla.org/en/YASM for more details.])
3562 elif test -n "$MOZ_LIBAV_FFT" -a "${CPU_ARCH}" != "arm"; then
3563 dnl Warn if we're not building either libav or opendl-max optimized routines.
3564 AC_MSG_WARN([No assembler or assembly support for libav-fft. Using unoptimized C routines.])
3567 dnl ========================================================
3568 dnl = FFmpeg's ffvpx configuration
3569 dnl ========================================================
3581 dnl Use same conditional as MOZ_LIBAV_FFT to enable FFmpeg's ffvpx assembly decoder.
3582 if test -n "$MOZ_LIBAV_FFT"; then
3583 FFVPX_ASFLAGS=$LIBAV_FFT_ASFLAGS
3585 if test -n "$MOZ_FFVPX"; then
3586 AC_DEFINE(MOZ_FFVPX)
3589 dnl ========================================================
3590 dnl = Enable compilation of specific extension modules
3591 dnl ========================================================
3593 MOZ_ARG_ENABLE_STRING(extensions,
3594 [ --enable-extensions Enable extensions],
3595 [ for option in `echo $enableval | sed 's/,/ /g'`; do
3596 if test "$option" = "yes" -o "$option" = "all"; then
3597 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
3598 elif test "$option" = "no" -o "$option" = "none"; then
3600 elif test "$option" = "default"; then
3601 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
3602 elif test `echo "$option" | grep -c \^-` != 0; then
3603 option=`echo $option | sed 's/^-//'`
3604 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
3606 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
3609 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
3611 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
3612 # Suppress warning on non-X11 platforms
3613 if test -n "$MOZ_X11"; then
3614 AC_MSG_WARN([Removing gio from MOZ_EXTENSIONS due to --disable-gio.])
3616 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
3619 if test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
3621 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
3623 AC_SUBST(MOZ_GIO_COMPONENT)
3625 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
3626 dnl when trying to build a nonexistent extension.
3627 for extension in $MOZ_EXTENSIONS; do
3628 if test ! -d "${srcdir}/extensions/${extension}"; then
3629 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
3633 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
3634 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
3637 if test -n "$MOZ_TREE_FREETYPE"; then
3638 MOZ_ENABLE_CAIRO_FT=1
3639 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
3640 CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
3641 AC_SUBST_LIST(CAIRO_FT_CFLAGS)
3644 AC_CHECK_PROGS(WGET, wget, "")
3647 dnl ========================================================
3648 dnl Maintenance Service
3649 dnl ========================================================
3651 MOZ_ARG_ENABLE_BOOL(maintenance-service,
3652 [ --enable-maintenance-service Enable building of maintenanceservice],
3653 MOZ_MAINTENANCE_SERVICE=1,
3654 MOZ_MAINTENANCE_SERVICE= )
3656 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
3657 if test "$OS_ARCH" = "WINNT"; then
3658 AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
3660 AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
3664 dnl ========================================================
3665 dnl Bundled fonts on desktop platforms
3666 dnl ========================================================
3668 MOZ_ARG_ENABLE_BOOL(bundled-fonts,
3669 [ --enable-bundled-fonts Enable support for bundled fonts on desktop platforms],
3670 MOZ_BUNDLED_FONTS=1,
3673 if test -n "$MOZ_BUNDLED_FONTS"; then
3674 AC_DEFINE(MOZ_BUNDLED_FONTS)
3677 dnl ========================================================
3678 dnl Verify MAR signatures
3679 dnl ========================================================
3681 MOZ_ARG_ENABLE_BOOL(verify-mar,
3682 [ --enable-verify-mar Enable verifying MAR signatures],
3683 MOZ_VERIFY_MAR_SIGNATURE=1,
3684 MOZ_VERIFY_MAR_SIGNATURE= )
3686 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
3687 AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
3690 dnl ========================================================
3691 dnl Enable building the signmar program.
3692 dnl This option is much different than the --enable-verify-mar option.
3693 dnl --enable-verify-mar is for enabling the verification check on MAR
3694 dnl files in the updater. The --enable-signmar option is for building
3695 dnl the signmar program.
3696 dnl ========================================================
3698 MOZ_ARG_ENABLE_BOOL(signmar,
3699 [ --enable-signmar Enable building the signmar program],
3700 MOZ_ENABLE_SIGNMAR=1,
3701 MOZ_ENABLE_SIGNMAR= )
3703 if test -n "$MOZ_ENABLE_SIGNMAR"; then
3704 if test -z "$COMPILE_ENVIRONMENT" ; then
3705 AC_MSG_WARN([Cannot --enable-signmar with --disable-compile-environment])
3708 AC_DEFINE(MOZ_ENABLE_SIGNMAR)
3712 dnl ========================================================
3714 dnl ========================================================
3716 if test "$MOZ_IOS"; then
3720 MOZ_ARG_DISABLE_BOOL(updater,
3721 [ --disable-updater Disable building of updater],
3725 if test -n "$MOZ_UPDATER"; then
3726 AC_DEFINE(MOZ_UPDATER)
3729 dnl ========================================================
3730 dnl parental controls (for Windows Vista)
3731 dnl ========================================================
3732 MOZ_ARG_DISABLE_BOOL(parental-controls,
3733 [ --disable-parental-controls
3734 Do not build parental controls],
3735 MOZ_DISABLE_PARENTAL_CONTROLS=1,
3736 MOZ_DISABLE_PARENTAL_CONTROLS=)
3737 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
3738 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
3741 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
3743 dnl ========================================================
3744 dnl = Disable smartcard support
3745 dnl ========================================================
3746 if test -n "$MOZ_NO_SMART_CARDS"; then
3747 AC_DEFINE(MOZ_NO_SMART_CARDS)
3749 AC_SUBST(MOZ_NO_SMART_CARDS)
3751 dnl ========================================================
3752 dnl = Sandboxing support
3753 dnl ========================================================
3754 if test -n "$MOZ_TSAN" -o -n "$MOZ_ASAN"; then
3755 # Bug 1182565: TSan conflicts with sandboxing on Linux.
3756 # Bug 1287971: LSan also conflicts with sandboxing on Linux.
3764 MOZ_ARG_DISABLE_BOOL(sandbox,
3765 [ --disable-sandbox Disable sandboxing support],
3769 dnl ========================================================
3770 dnl = Content process sandboxing
3771 dnl ========================================================
3772 if test -n "$gonkdir"; then
3773 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3776 case "$OS_TARGET:$NIGHTLY_BUILD" in
3778 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3781 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3786 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3792 MOZ_ARG_ENABLE_BOOL(content-sandbox,
3793 [ --enable-content-sandbox Enable sandboxing support for content-processes
3794 --disable-content-sandbox Disable sandboxing support for content-processes],
3795 MOZ_CONTENT_SANDBOX=1,
3796 MOZ_CONTENT_SANDBOX=)
3798 if test -n "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_SANDBOX"; then
3799 AC_MSG_ERROR([--enable-content-sandbox and --disable-sandbox are conflicting options])
3802 if test -n "$MOZ_CONTENT_SANDBOX"; then
3803 AC_DEFINE(MOZ_CONTENT_SANDBOX)
3806 AC_SUBST(MOZ_CONTENT_SANDBOX)
3808 dnl ========================================================
3809 dnl = Gecko Media Plugin sandboxing
3810 dnl ========================================================
3813 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3818 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3823 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3827 if test -n "$MOZ_GMP_SANDBOX"; then
3828 AC_DEFINE(MOZ_GMP_SANDBOX)
3831 AC_SUBST(MOZ_GMP_SANDBOX)
3833 if test -z "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_GMP_SANDBOX"; then
3837 if test -n "$MOZ_SANDBOX"; then
3838 AC_DEFINE(MOZ_SANDBOX)
3841 AC_SUBST(MOZ_SANDBOX)
3844 dnl ========================================================
3846 dnl = Module specific options
3848 dnl ========================================================
3849 MOZ_ARG_HEADER(Individual module options)
3851 dnl ========================================================
3852 dnl = Disable feed handling components
3853 dnl ========================================================
3854 MOZ_ARG_DISABLE_BOOL(feeds,
3855 [ --disable-feeds Disable feed handling and processing components],
3858 if test -n "$MOZ_FEEDS"; then
3859 AC_DEFINE(MOZ_FEEDS)
3861 if test "$MOZ_BUILD_APP" = "browser"; then
3862 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
3866 dnl ========================================================
3867 dnl Check for sqlite
3868 dnl ========================================================
3871 MOZ_ARG_ENABLE_BOOL(system-sqlite,
3872 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
3873 MOZ_SYSTEM_SQLITE=1,
3874 MOZ_SYSTEM_SQLITE= )
3876 if test -n "$MOZ_SYSTEM_SQLITE"
3878 dnl ============================
3879 dnl === SQLite Version check ===
3880 dnl ============================
3881 dnl Check to see if the system SQLite package is new enough.
3882 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
3884 dnl ==================================
3885 dnl === SQLITE_SECURE_DELETE check ===
3886 dnl ==================================
3887 dnl Check to see if the system SQLite package is compiled with
3888 dnl SQLITE_SECURE_DELETE enabled.
3889 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
3890 _SAVE_CFLAGS="$CFLAGS"
3891 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3893 LIBS="$LIBS $SQLITE_LIBS"
3894 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
3896 #include "sqlite3.h"
3898 int main(int argc, char **argv){
3899 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
3901 ac_cv_sqlite_secure_delete=yes,
3902 ac_cv_sqlite_secure_delete=no,
3903 ac_cv_sqlite_secure_delete=no
3906 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
3907 CFLAGS="$_SAVE_CFLAGS"
3909 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
3910 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
3913 dnl ===============================
3914 dnl === SQLITE_THREADSAFE check ===
3915 dnl ===============================
3916 dnl Check to see if the system SQLite package is compiled with
3917 dnl SQLITE_THREADSAFE enabled.
3918 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
3919 _SAVE_CFLAGS="$CFLAGS"
3920 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3922 LIBS="$LIBS $SQLITE_LIBS"
3923 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
3925 #include "sqlite3.h"
3927 int main(int argc, char **argv){
3928 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
3930 ac_cv_sqlite_threadsafe=yes,
3931 ac_cv_sqlite_threadsafe=no,
3932 ac_cv_sqlite_threadsafe=no
3935 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
3936 CFLAGS="$_SAVE_CFLAGS"
3938 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
3939 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
3942 dnl ================================
3943 dnl === SQLITE_ENABLE_FTS3 check ===
3944 dnl ================================
3945 dnl check to see if the system SQLite package is compiled with
3946 dnl SQLITE_ENABLE_FTS3 enabled.
3947 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
3948 _SAVE_CFLAGS="$CFLAGS"
3949 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3951 LIBS="$LIBS $SQLITE_LIBS"
3952 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
3954 #include "sqlite3.h"
3956 int main(int argc, char **argv){
3957 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
3959 ac_cv_sqlite_enable_fts3=yes,
3960 ac_cv_sqlite_enable_fts3=no,
3961 ac_cv_sqlite_enable_fts3=no
3964 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
3965 CFLAGS="$_SAVE_CFLAGS"
3967 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
3968 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
3971 dnl =========================================
3972 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
3973 dnl =========================================
3974 dnl check to see if the system SQLite package is compiled with
3975 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
3976 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
3977 _SAVE_CFLAGS="$CFLAGS"
3978 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3980 LIBS="$LIBS $SQLITE_LIBS"
3981 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
3983 #include "sqlite3.h"
3985 int main(int argc, char **argv){
3986 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
3988 ac_cv_sqlite_enable_unlock_notify=yes,
3989 ac_cv_sqlite_enable_unlock_notify=no,
3990 ac_cv_sqlite_enable_unlock_notify=no
3993 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
3994 CFLAGS="$_SAVE_CFLAGS"
3996 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
3997 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
4000 dnl =========================================
4001 dnl === SQLITE_ENABLE_DBSTAT_VTAB check ===
4002 dnl =========================================
4003 dnl check to see if the system SQLite package is compiled with
4004 dnl SQLITE_ENABLE_DBSTAT_VTAB.
4005 AC_MSG_CHECKING(for SQLITE_ENABLE_DBSTAT_VTAB support in system SQLite)
4006 _SAVE_CFLAGS="$CFLAGS"
4007 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
4009 LIBS="$LIBS $SQLITE_LIBS"
4010 AC_CACHE_VAL(ac_cv_sqlite_dbstat_vtab,[
4012 #include "sqlite3.h"
4014 int main(int argc, char **argv){
4015 return !sqlite3_compileoption_used("SQLITE_ENABLE_DBSTAT_VTAB");
4017 ac_cv_sqlite_dbstat_vtab=yes,
4018 ac_cv_sqlite_dbstat_vtab=no,
4019 ac_cv_sqlite_dbstat_vtab=no
4022 AC_MSG_RESULT($ac_cv_sqlite_dbstat_vtab)
4023 CFLAGS="$_SAVE_CFLAGS"
4025 if test "x$ac_cv_sqlite_dbstat_vtab" = "xno"; then
4026 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_DBSTAT_VTAB.])
4030 if test -n "$MOZ_SYSTEM_SQLITE"; then
4031 AC_DEFINE(MOZ_SYSTEM_SQLITE)
4033 AC_SUBST(MOZ_SYSTEM_SQLITE)
4035 dnl ========================================================
4036 dnl = Enable url-classifier
4037 dnl ========================================================
4038 MOZ_ARG_ENABLE_BOOL(url-classifier,
4039 [ --enable-url-classifier Enable url classifier module],
4040 MOZ_URL_CLASSIFIER=1,
4041 MOZ_URL_CLASSIFIER= )
4042 if test -n "$MOZ_URL_CLASSIFIER"; then
4043 AC_DEFINE(MOZ_URL_CLASSIFIER)
4045 AC_SUBST(MOZ_URL_CLASSIFIER)
4047 dnl ========================================================
4048 dnl = Disable zipwriter
4049 dnl ========================================================
4050 MOZ_ARG_DISABLE_BOOL(zipwriter,
4051 [ --disable-zipwriter Disable zipwriter component],
4054 AC_SUBST(MOZ_ZIPWRITER)
4056 dnl ========================================================
4057 dnl = faststripe theme
4058 dnl ========================================================
4059 MOZ_ARG_ENABLE_BOOL(faststripe,
4060 [ --enable-faststripe Use faststripe theme],
4061 MOZ_THEME_FASTSTRIPE=1,
4062 MOZ_THEME_FASTSTRIPE= )
4063 AC_SUBST(MOZ_THEME_FASTSTRIPE)
4065 dnl ========================================================
4067 dnl = Feature options that require extra sources to be pulled
4069 dnl ========================================================
4070 dnl MOZ_ARG_HEADER(Features that require extra sources)
4072 dnl ========================================================
4074 dnl = Runtime debugging and Optimization Options
4076 dnl ========================================================
4077 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
4079 dnl ========================================================
4080 dnl enable mobile optimizations
4081 dnl ========================================================
4082 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
4083 [ --enable-mobile-optimize
4084 Enable mobile optimizations],
4085 MOZ_GFX_OPTIMIZE_MOBILE=1)
4087 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
4089 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
4090 # We ignore paint will resample on mobile for performance.
4091 # We may want to revisit this later.
4092 MOZ_IGNORE_PAINT_WILL_RESAMPLE=1
4094 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
4095 AC_DEFINE(MOZ_IGNORE_PAINT_WILL_RESAMPLE)
4098 dnl ========================================================
4099 dnl = Enable code optimization. ON by default.
4100 dnl ========================================================
4101 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
4102 MOZ_OPTIMIZE_FLAGS="-O"
4105 MOZ_ARG_ENABLE_STRING(optimize,
4106 [ --disable-optimize Disable compiler optimization
4107 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
4108 [ if test "$enableval" != "no"; then
4110 if test -n "$enableval" -a "$enableval" != "yes"; then
4111 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
4116 fi ], MOZ_OPTIMIZE=1)
4118 MOZ_SET_FRAMEPTR_FLAGS
4120 if test "$COMPILE_ENVIRONMENT"; then
4121 if test -n "$MOZ_OPTIMIZE"; then
4122 AC_MSG_CHECKING([for valid C compiler optimization flags])
4123 _SAVE_CFLAGS=$CFLAGS
4124 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
4125 AC_TRY_COMPILE([#include <stdio.h>],
4126 [printf("Hello World\n");],
4129 AC_MSG_RESULT([$_results])
4130 if test "$_results" = "no"; then
4131 AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
4133 CFLAGS=$_SAVE_CFLAGS
4135 fi # COMPILE_ENVIRONMENT
4137 AC_SUBST(MOZ_OPTIMIZE)
4138 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
4139 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
4140 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
4141 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
4143 dnl ========================================================
4144 dnl = Disable treating compiler warnings as errors
4145 dnl ========================================================
4146 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
4147 WARNINGS_AS_ERRORS=''
4150 dnl ========================================================
4151 dnl = Enable runtime logging
4152 dnl ========================================================
4153 AC_DEFINE(MOZ_LOGGING)
4154 AC_DEFINE(FORCE_PR_LOG)
4156 dnl ========================================================
4157 dnl = This will enable logging of addref, release, ctor, dtor.
4158 dnl ========================================================
4159 _ENABLE_LOGREFCNT=42
4160 MOZ_ARG_ENABLE_BOOL(logrefcnt,
4161 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
4162 _ENABLE_LOGREFCNT=1,
4163 _ENABLE_LOGREFCNT= )
4164 if test "$_ENABLE_LOGREFCNT" = "1"; then
4165 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
4166 elif test -z "$_ENABLE_LOGREFCNT"; then
4167 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
4170 dnl ========================================================
4171 dnl moz_dump_painting
4172 dnl ========================================================
4173 MOZ_ARG_ENABLE_BOOL(dump-painting,
4174 [ --enable-dump-painting Enable paint debugging.],
4175 MOZ_DUMP_PAINTING=1,
4176 MOZ_DUMP_PAINTING= )
4177 if test -n "$MOZ_DUMP_PAINTING"; then
4178 AC_DEFINE(MOZ_DUMP_PAINTING)
4179 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
4181 if test -n "$MOZ_DEBUG"; then
4182 AC_DEFINE(MOZ_DUMP_PAINTING)
4185 case "${OS_TARGET}" in
4186 Android|WINNT|Darwin)
4187 MOZ_GLUE_IN_PROGRAM=
4190 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
4191 MOZ_GLUE_IN_PROGRAM=1
4192 AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
4196 if test -n "$MOZ_REPLACE_MALLOC"; then
4197 MOZ_SYSTEM_JEMALLOC=
4199 dnl Replace-malloc Mac linkage quirks
4200 if test -n "$MACOSX_DEPLOYMENT_TARGET"; then
4201 AC_CACHE_CHECK([how to do weak dynamic linking],
4202 ac_cv_weak_dynamic_linking,
4203 [echo 'extern void foo() __attribute__((weak_import));int bar() { if (foo) foo(); return 0; }' > conftest.c
4204 if AC_TRY_COMMAND([${CC-cc} -o conftest${DLL_SUFFIX} $CFLAGS -dynamiclib $LDFLAGS -Wl,-U,_foo conftest.c $LIBS 1>&5]) &&
4205 test -s conftest${DLL_SUFFIX}; then
4206 dnl There are several ways the linker can put link edit rules in a binary:
4207 dnl - classic info only (for OSX < 10.6)
4208 dnl - dyld info only
4210 if "$OTOOL" -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO_ONLY" > /dev/null; then
4215 if "$OTOOL" -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO" > /dev/null; then
4220 dnl With classic info, we need to build with -flat_namespace.
4221 dnl With dyld info, Xcode 4.5 does the right thing without additional flags,
4222 dnl but Xcode < 4.5 requires a dummy library and -flat_namespace because it
4223 dnl forgets to set the weak flag in the dyld info.
4224 dnl See http://glandium.org/blog/?p=2764 for more details.
4226 dnl Values for ac_cv_weak_dynamic_linking, and subsequently
4227 dnl MOZ_REPLACE_MALLOC_LINKAGE are thus:
4228 dnl - "flat namespace" when -flat_namespace alone is needed
4229 dnl - "dummy library" when a dummy library and -flat_namespace are needed
4230 dnl - "compiler support" when nothing is needed
4231 if test -n "$_DYLD_INFO" && dyldinfo -bind conftest${DLL_SUFFIX} 2> /dev/null | grep "_foo (weak import)" > /dev/null; then
4232 if test -n "$_CLASSIC_INFO"; then
4233 ac_cv_weak_dynamic_linking="flat namespace"
4235 ac_cv_weak_dynamic_linking="compiler support"
4238 if test -n "$_DYLD_INFO"; then
4239 ac_cv_weak_dynamic_linking="dummy library"
4241 ac_cv_weak_dynamic_linking="flat namespace"
4245 AC_ERROR([couldn't compile a simple C file])
4248 MOZ_REPLACE_MALLOC_LINKAGE="$ac_cv_weak_dynamic_linking"
4251 AC_SUBST(MOZ_REPLACE_MALLOC_LINKAGE)
4253 dnl ========================================================
4254 dnl = Jemalloc build setup
4255 dnl ========================================================
4256 if test -z "$MOZ_MEMORY"; then
4259 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
4260 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.])
4265 if test -n "$MOZ_JEMALLOC4" -a -z "$MOZ_REPLACE_MALLOC"; then
4266 MOZ_SYSTEM_JEMALLOC=1
4267 AC_CHECK_FUNCS(mallctl nallocx,,
4268 [MOZ_SYSTEM_JEMALLOC=
4270 if test -n "$MOZ_SYSTEM_JEMALLOC"; then
4271 AC_DEFINE(MOZ_SYSTEM_JEMALLOC)
4274 if test "x$MOZ_DEBUG" = "x1"; then
4275 AC_DEFINE(MOZ_MEMORY_DEBUG)
4277 dnl The generic feature tests that determine how to compute ncpus are long and
4278 dnl complicated. Therefore, simply define special cpp variables for the
4279 dnl platforms we have special knowledge of.
4282 export MOZ_NO_DEBUG_RTL=1
4286 AC_SUBST(MOZ_SYSTEM_JEMALLOC)
4287 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
4289 # Allow the application to provide a subconfigure script.
4290 # This should be after 'export MOZ_NO_DEBUG_RTL=1' since
4291 # ldap/c-sdk/configure refers to the enviroment value.
4292 if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
4293 do_output_subdirs() {
4294 if test -n "$_subconfigure_subdirs"; then
4295 AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
4297 _subconfigure_subdir="$1"
4298 _subconfigure_config_args="$ac_configure_args"
4300 tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
4301 m4 "${srcdir}/build/autoconf/subconfigure.m4" \
4302 "${srcdir}/build/autoconf/altoptions.m4" \
4303 "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
4308 AC_SUBST_LIST(MOZ_GLUE_WRAP_LDFLAGS)
4309 export MOZ_GLUE_WRAP_LDFLAGS
4311 dnl ========================================================
4312 dnl = Enable using the clang plugin to build
4313 dnl ========================================================
4315 MOZ_CONFIG_CLANG_PLUGIN
4317 dnl ========================================================
4318 dnl = Enable stripping of libs & executables
4319 dnl ========================================================
4320 MOZ_ARG_ENABLE_BOOL(strip,
4321 [ --enable-strip Enable stripping of libs & executables ],
4325 dnl ========================================================
4326 dnl = Enable stripping of libs & executables when packaging
4327 dnl ========================================================
4328 MOZ_ARG_ENABLE_BOOL(install-strip,
4329 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
4333 dnl ========================================================
4334 dnl = --disable-elf-hack
4335 dnl ========================================================
4338 MOZ_ARG_DISABLE_BOOL(elf-hack,
4339 [ --disable-elf-hack Disable elf hacks],
4343 # Only enable elfhack where supported
4344 if test "$USE_ELF_HACK" = 1; then
4345 case "${HOST_OS_ARCH},${OS_ARCH}" in
4347 case "${CPU_ARCH}" in
4362 if test -n "$COMPILE_ENVIRONMENT" -a -n "$USE_ELF_HACK"; then
4363 dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
4364 dnl memory addresses it maps to. The result is that by the time elfhack
4365 dnl kicks in, it is not possible to apply relocations because of that,
4366 dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
4367 dnl segment. It makes elfhack mostly useless, so considering the problems
4368 dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
4369 dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
4370 dnl the linker creates PT_GNU_RELRO segments. However, when we do want
4371 dnl elfhack enabled, disable PT_GNU_RELRO instead.
4372 AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
4373 LINK_WITH_PT_GNU_RELRO,
4374 [echo "int main() {return 0;}" > conftest.${ac_ext}
4375 if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
4376 test -s conftest${ac_exeext}; then
4377 if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
4378 LINK_WITH_PT_GNU_RELRO=yes
4380 LINK_WITH_PT_GNU_RELRO=no
4383 dnl We really don't expect to get here, but just in case
4384 AC_ERROR([couldn't compile a simple C file])
4387 if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
4388 if test "$USE_ELF_HACK" = F; then
4389 AC_MSG_CHECKING([for -z norelro option to ld])
4390 _SAVE_LDFLAGS=$LDFLAGS
4391 LDFLAGS="$LDFLAGS -Wl,-z,norelro"
4392 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
4393 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,norelro"],
4394 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.]))
4397 AC_MSG_WARN([Disabling elfhack])
4401 fi # COMPILE_ENVIRONMENT and others.
4403 dnl ========================================================
4404 dnl = libstdc++ compatibility hacks
4405 dnl ========================================================
4408 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
4409 [ --enable-stdcxx-compat Enable compatibility with older libstdc++],
4412 if test -n "$STDCXX_COMPAT" -a -n "$COMPILE_ENVIRONMENT"; then
4413 eval $(CXX="$CXX" HOST_CXX="$HOST_CXX" $PYTHON -m mozbuild.configure.libstdcxx)
4414 AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
4415 AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
4416 CXXFLAGS="$CXXFLAGS -D_GLIBCXX_USE_CXX11_ABI=0"
4417 HOST_CXXFLAGS="$HOST_CXXFLAGS -D_GLIBCXX_USE_CXX11_ABI=0"
4420 dnl ========================================================
4421 dnl = frontend JS debug mode
4422 dnl ========================================================
4424 MOZ_ARG_ENABLE_BOOL(debug-js-modules,
4425 [ --enable-debug-js-modules Enable debug mode for frontend JS libraries],
4429 AC_SUBST(DEBUG_JS_MODULES)
4431 dnl ========================================================
4433 dnl = Profiling and Instrumenting
4435 dnl ========================================================
4436 MOZ_ARG_HEADER(Profiling and Instrumenting)
4438 dnl ========================================================
4439 dnl = Enable TaskTracer
4440 dnl ========================================================
4441 MOZ_ARG_ENABLE_BOOL(tasktracer,
4442 [ --enable-tasktracer Set compile flags necessary for using TaskTracer],
4445 if test -n "$MOZ_TASK_TRACER"; then
4446 AC_DEFINE(MOZ_TASK_TRACER)
4447 AC_SUBST(MOZ_TASK_TRACER)
4450 dnl ========================================================
4451 dnl Turn on reflow counting
4452 dnl ========================================================
4453 MOZ_ARG_ENABLE_BOOL(reflow-perf,
4454 [ --enable-reflow-perf Enable reflow performance tracing],
4457 if test -n "$MOZ_REFLOW_PERF"; then
4458 AC_DEFINE(MOZ_REFLOW_PERF)
4461 dnl ========================================================
4462 dnl = Horizon build options - set default preferences for
4463 dnl the horizon project. Horizon is a browser built on
4464 dnl top of the graphene runtime.
4465 dnl ========================================================
4466 if test -n "$MOZ_HORIZON"; then
4467 AC_DEFINE(MOZ_HORIZON)
4469 AC_SUBST(MOZ_HORIZON)
4471 dnl ========================================================
4472 dnl = Offer a way to disable the startup cache
4473 dnl ========================================================
4475 MOZ_ARG_DISABLE_BOOL(startupcache,
4476 [ --disable-startupcache Disable startup cache ],
4477 MOZ_DISABLE_STARTUPCACHE=1,
4478 MOZ_DISABLE_STARTUPCACHE=)
4480 dnl bug 988880: disable startup cache on b2g
4481 if test -n "$MOZ_B2G"; then
4482 MOZ_DISABLE_STARTUPCACHE=1
4484 if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
4485 AC_DEFINE(MOZ_DISABLE_STARTUPCACHE)
4487 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
4489 dnl =========================================
4490 dnl = Enable packaging Gaia with B2G desktop
4491 dnl =========================================
4492 if test x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
4493 if test -n "$GAIADIR" -a ! -d "$GAIADIR" ; then
4494 AC_MSG_ERROR([GAIADIR '$GAIADIR' isn't a valid directory])
4498 if test -n "$GAIADIR" ; then
4499 AC_DEFINE(PACKAGE_GAIA)
4502 if test -n "$FXOS_SIMULATOR" -a -z "$GAIADIR" ; then
4503 AC_MSG_ERROR([FXOS_SIMULATOR=1 requires GAIADIR to be defined])
4506 if test -n "$FXOS_SIMULATOR" ; then
4507 AC_DEFINE(FXOS_SIMULATOR)
4508 AC_SUBST(FXOS_SIMULATOR)
4512 dnl ========================================================
4513 dnl = Enable Pico Speech Synthesis (Gonk usually)
4514 dnl ========================================================
4515 MOZ_ARG_ENABLE_BOOL(synth-pico,
4516 [ --enable-synth-pico Set compile flags necessary for compiling Pico Web Speech API ],
4519 if test -n "$MOZ_SYNTH_PICO"; then
4520 AC_DEFINE(MOZ_SYNTH_PICO)
4522 AC_SUBST(MOZ_SYNTH_PICO)
4524 dnl ========================================================
4525 dnl = Enable Support for Time Manager API
4526 dnl ========================================================
4527 if test -n "$MOZ_TIME_MANAGER"; then
4528 AC_DEFINE(MOZ_TIME_MANAGER)
4530 AC_SUBST(MOZ_TIME_MANAGER)
4532 dnl ========================================================
4533 dnl = Enable Support for AudioChannelManager API
4534 dnl ========================================================
4535 if test -n "$MOZ_AUDIO_CHANNEL_MANAGER"; then
4536 AC_DEFINE(MOZ_AUDIO_CHANNEL_MANAGER)
4538 AC_SUBST(MOZ_AUDIO_CHANNEL_MANAGER)
4540 dnl ========================================================
4541 dnl = Enable Support for Secure Element API
4542 dnl ========================================================
4543 MOZ_SECUREELEMENT=1,
4544 if test -n "$MOZ_SECUREELEMENT"; then
4545 AC_DEFINE(MOZ_SECUREELEMENT)
4547 AC_SUBST(MOZ_SECUREELEMENT)
4549 dnl ========================================================
4550 dnl = Support for demangling undefined symbols
4551 dnl ========================================================
4552 if test -z "$SKIP_LIBRARY_CHECKS"; then
4555 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
4559 # Demangle only for debug or DMD builds
4560 MOZ_DEMANGLE_SYMBOLS=
4561 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
4562 MOZ_DEMANGLE_SYMBOLS=1
4563 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
4565 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
4567 dnl ========================================================
4568 dnl = Support for gcc stack unwinding (from gcc 3.3)
4569 dnl ========================================================
4570 if test -z "$SKIP_LIBRARY_CHECKS"; then
4573 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
4577 dnl ========================================================
4579 dnl ========================================================
4581 MOZ_ARG_WITH_STRING(jitreport-granularity,
4582 [ --jitreport-granularity=N
4583 Default granularity at which to report JIT code
4586 1 - code ranges for whole functions only
4587 2 - per-line information
4588 3 - per-op information],
4589 JITREPORT_GRANULARITY=$withval,
4590 JITREPORT_GRANULARITY=3)
4592 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
4594 dnl ========================================================
4595 dnl = Disable Mozilla's versions of RIL and Geolocation
4596 dnl ========================================================
4597 MOZ_ARG_DISABLE_BOOL(mozril-geoloc,
4598 [ --disable-mozril-geoloc Disable Mozilla's RIL and geolocation],
4599 DISABLE_MOZ_RIL_GEOLOC=1,
4600 DISABLE_MOZ_RIL_GEOLOC= )
4601 if test -n "$DISABLE_MOZ_RIL_GEOLOC"; then
4602 AC_DEFINE(DISABLE_MOZ_RIL_GEOLOC)
4604 AC_SUBST(DISABLE_MOZ_RIL_GEOLOC)
4606 dnl ========================================================
4610 dnl ========================================================
4611 MOZ_ARG_HEADER(Misc. Options)
4613 dnl ========================================================
4614 dnl = Define default location for MOZILLA_FIVE_HOME
4615 dnl ========================================================
4616 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
4617 [ --with-default-mozilla-five-home
4618 Set the default value for MOZILLA_FIVE_HOME],
4619 [ val=`echo $withval`
4620 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
4622 dnl ========================================================
4623 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
4624 dnl ========================================================
4625 MOZ_ARG_WITH_STRING(user-appdir,
4626 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
4627 [ val=`echo $withval`
4628 if echo "$val" | grep "\/" >/dev/null; then
4629 AC_MSG_ERROR("Homedir must be single relative path.")
4634 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
4636 dnl ========================================================
4637 dnl = Doxygen configuration
4638 dnl ========================================================
4639 dnl Use commas to specify multiple dirs to this arg
4640 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
4641 MOZ_ARG_WITH_STRING(doc-input-dirs,
4642 [ --with-doc-input-dirs=DIRS
4643 Header/idl dirs to create docs from],
4644 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
4645 AC_SUBST(MOZ_DOC_INPUT_DIRS)
4647 dnl Use commas to specify multiple dirs to this arg
4648 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
4649 MOZ_ARG_WITH_STRING(doc-include-dirs,
4650 [ --with-doc-include-dirs=DIRS
4651 Include dirs to preprocess doc headers],
4652 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
4653 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
4655 MOZ_DOC_OUTPUT_DIR='./dist/docs'
4656 MOZ_ARG_WITH_STRING(doc-output-dir,
4657 [ --with-doc-output-dir=DIR
4658 Dir to generate docs into],
4659 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
4660 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
4662 if test -z "$SKIP_COMPILER_CHECKS"; then
4663 dnl ========================================================
4665 dnl = Compiler Options
4667 dnl ========================================================
4668 MOZ_ARG_HEADER(Compiler Options)
4670 dnl ========================================================
4671 dnl Check for gcc -pipe support
4672 dnl ========================================================
4673 AC_MSG_CHECKING([for -pipe support])
4674 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
4675 dnl Any gcc that supports firefox supports -pipe.
4676 CFLAGS="$CFLAGS -pipe"
4677 CXXFLAGS="$CXXFLAGS -pipe"
4678 AC_MSG_RESULT([yes])
4683 dnl ========================================================
4684 dnl Profile guided optimization (gcc checks)
4685 dnl ========================================================
4686 dnl Test for profiling options
4687 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
4689 _SAVE_CFLAGS="$CFLAGS"
4690 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
4692 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
4693 AC_TRY_COMPILE([], [return 0;],
4694 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
4695 result="yes" ], result="no")
4696 AC_MSG_RESULT([$result])
4698 if test $result = "yes"; then
4699 PROFILE_GEN_LDFLAGS="-fprofile-generate"
4700 PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
4701 PROFILE_USE_LDFLAGS="-fprofile-use"
4704 CFLAGS="$_SAVE_CFLAGS"
4706 AC_SUBST(PROFILE_GEN_CFLAGS)
4707 AC_SUBST(PROFILE_GEN_LDFLAGS)
4708 AC_SUBST(PROFILE_USE_CFLAGS)
4709 AC_SUBST(PROFILE_USE_LDFLAGS)
4711 fi # ! SKIP_COMPILER_CHECKS
4713 AC_DEFINE(CPP_THROW_NEW, [throw()])
4716 if test "$COMPILE_ENVIRONMENT"; then
4718 fi # COMPILE_ENVIRONMENT
4720 dnl ========================================================
4722 dnl = Build depencency options
4724 dnl ========================================================
4725 MOZ_ARG_HEADER(Build dependencies)
4727 if test "$GNU_CC" -a "$GNU_CXX"; then
4728 _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
4730 dnl Don't override this for MSVC
4731 if test -z "$_WIN32_MSVC"; then
4732 _USE_CPP_INCLUDE_FLAG=
4733 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
4734 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
4736 echo '#include <stdio.h>' > dummy-hello.c
4738 dnl This output is localized, split at the first double space or colon and space.
4739 _CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*\\\stdio.h\)$"
4740 CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'`
4741 _CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'`
4743 if ! test -e "$_CL_STDIO_PATH"; then
4744 AC_MSG_ERROR([Unable to parse cl -showIncludes prefix. This compiler's locale has an unsupported formatting.])
4746 if test -z "$CL_INCLUDES_PREFIX"; then
4747 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
4749 AC_SUBST(CL_INCLUDES_PREFIX)
4752 dnl Make sure that the build system can handle non-ASCII characters
4753 dnl in environment variables to prevent it from breaking silently on
4754 dnl non-English systems.
4755 NONASCII=$'\241\241'
4760 dnl ========================================================
4762 dnl = Static Build Options
4764 dnl ========================================================
4765 MOZ_ARG_HEADER(Static build options)
4767 if test -z "$MOZ_SYSTEM_ZLIB"; then
4768 if test -n "$JS_SHARED_LIBRARY"; then
4770 AC_DEFINE(ZLIB_IN_MOZGLUE)
4774 AC_SUBST(ZLIB_IN_MOZGLUE)
4776 dnl ========================================================
4778 dnl = Standalone module options
4780 dnl ========================================================
4781 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
4784 dnl ========================================================
4786 if test -z "$SKIP_PATH_CHECKS"; then
4787 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
4788 if test "$MOZ_ENABLE_GTK" ; then
4789 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
4794 if test -z "${GLIB_GMODULE_LIBS}" \
4795 -a -n "${GLIB_CONFIG}"\
4796 -a "${GLIB_CONFIG}" != no\
4798 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
4801 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
4803 if test "$USE_FC_FREETYPE"; then
4804 if test "$COMPILE_ENVIRONMENT"; then
4805 dnl ========================================================
4806 dnl = Check for freetype2 functionality
4807 dnl ========================================================
4808 if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
4810 _SAVE_CFLAGS="$CFLAGS"
4811 LIBS="$LIBS $FT2_LIBS"
4812 CFLAGS="$CFLAGS $FT2_CFLAGS"
4814 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
4815 ac_cv_member_FT_Bitmap_Size_y_ppem,
4816 [AC_TRY_COMPILE([#include <ft2build.h>
4817 #include FT_FREETYPE_H],
4819 if (sizeof s.y_ppem) return 0;
4821 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
4822 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
4823 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
4824 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
4826 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
4828 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
4829 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
4830 [FT_Bitmap_Size structure includes y_ppem field])
4832 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
4835 CFLAGS="$_SAVE_CFLAGS"
4838 _SAVE_CPPFLAGS="$CPPFLAGS"
4839 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
4840 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
4841 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
4842 CPPFLAGS="$_SAVE_CPPFLAGS"
4846 dnl ========================================================
4847 dnl Check if we need the 32-bit Linux SSE2 error dialog
4848 dnl ========================================================
4850 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
4852 dnl ========================================================
4853 dnl Check for pixman and cairo
4854 dnl ========================================================
4857 MOZ_ARG_ENABLE_BOOL(system-cairo,
4858 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
4863 MOZ_ARG_ENABLE_BOOL(system-pixman,
4864 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
4866 MOZ_TREE_PIXMAN=force,
4869 # System cairo depends on system pixman
4870 if test "$MOZ_TREE_PIXMAN" = "force"; then
4871 if test -z "$MOZ_TREE_CAIRO"; then
4872 AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
4876 elif test -z "$MOZ_TREE_CAIRO"; then
4880 if test "$MOZ_TREE_PIXMAN"; then
4881 AC_DEFINE(MOZ_TREE_PIXMAN)
4883 PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.19.2)
4886 if test "$MOZ_TREE_CAIRO"; then
4887 MOZ_CAIRO_CFLAGS="-I${DIST}/include/cairo"
4888 AC_DEFINE(MOZ_TREE_CAIRO)
4890 if test "$OS_ARCH" = "WINNT"; then
4891 # For now we assume that we will have a uint64_t available through
4892 # one of the above headers or mozstdint.h.
4893 AC_DEFINE(HAVE_UINT64_T)
4896 # Define macros for cairo-features.h
4897 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
4898 if test "$MOZ_X11"; then
4899 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
4900 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
4901 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
4903 if test "$_HAVE_FREETYPE2"; then
4904 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
4905 MOZ_ENABLE_CAIRO_FT=1
4906 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
4909 case "$MOZ_WIDGET_TOOLKIT" in
4911 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
4912 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
4913 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
4916 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
4917 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
4918 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
4919 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
4920 MOZ_ENABLE_D2D_SURFACE=1
4921 MOZ_ENABLE_DWRITE_FONT=1
4923 if test "$COMPILE_ENVIRONMENT"; then
4925 MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
4927 dnl D3D10 Layers depend on D2D Surfaces.
4928 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
4929 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
4934 if test "$USE_FC_FREETYPE"; then
4935 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
4937 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
4938 AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
4939 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
4940 AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
4941 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
4943 AC_SUBST(PS_SURFACE_FEATURE)
4944 AC_SUBST(SVG_SURFACE_FEATURE)
4945 AC_SUBST(XLIB_SURFACE_FEATURE)
4946 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
4947 AC_SUBST(QUARTZ_SURFACE_FEATURE)
4948 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
4949 AC_SUBST(WIN32_SURFACE_FEATURE)
4950 AC_SUBST(OS2_SURFACE_FEATURE)
4951 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
4952 AC_SUBST(FT_FONT_FEATURE)
4953 AC_SUBST(FC_FONT_FEATURE)
4954 AC_SUBST(WIN32_FONT_FEATURE)
4955 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
4956 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
4957 AC_SUBST(QUARTZ_FONT_FEATURE)
4958 AC_SUBST(PNG_FUNCTIONS_FEATURE)
4959 AC_SUBST(QT_SURFACE_FEATURE)
4960 AC_SUBST(TEE_SURFACE_FEATURE)
4962 if test "$MOZ_X11"; then
4963 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
4966 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
4968 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
4969 MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
4970 MOZ_CAIRO_LIBS="$CAIRO_LIBS"
4971 PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
4972 if test "$MOZ_X11"; then
4973 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
4974 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
4975 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
4976 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
4980 case "$MOZ_WIDGET_TOOLKIT" in
4982 TK_CFLAGS="$MOZ_CAIRO_CFLAGS $MOZ_PIXMAN_CFLAGS"
4983 TK_LIBS="$MOZ_CAIRO_LIBS $MOZ_PIXMAN_LIBS"
4987 AC_SUBST(MOZ_TREE_CAIRO)
4988 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
4989 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
4990 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
4991 AC_SUBST(MOZ_TREE_PIXMAN)
4993 dnl ========================================================
4995 dnl ========================================================
4996 MOZ_ARG_DISABLE_BOOL(xul,
4997 [ --disable-xul Disable XUL],
4999 if test "$MOZ_XUL"; then
5002 dnl remove extensions that require XUL
5003 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
5008 dnl ========================================================
5009 dnl necko configuration options
5010 dnl ========================================================
5013 dnl option to disable necko's wifi scanner
5016 case "$OS_TARGET" in
5018 if test -n "$gonkdir"; then
5023 if test -z "$MOZ_IOS"; then
5027 DragonFly|FreeBSD|WINNT)
5036 MOZ_ARG_DISABLE_BOOL(necko-wifi,
5037 [ --disable-necko-wifi Disable necko wifi scanner],
5041 if test "$NECKO_WIFI"; then
5042 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
5043 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
5045 AC_DEFINE(NECKO_WIFI)
5046 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
5048 AC_SUBST(NECKO_WIFI)
5049 AC_SUBST(NECKO_WIFI_DBUS)
5052 dnl option to disable cookies
5054 MOZ_ARG_DISABLE_BOOL(cookies,
5055 [ --disable-cookies Disable cookie support],
5058 AC_SUBST(NECKO_COOKIES)
5059 if test "$NECKO_COOKIES"; then
5060 AC_DEFINE(NECKO_COOKIES)
5061 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
5064 dnl ========================================================
5065 if test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
5066 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
5069 dnl ========================================================
5071 dnl = Maintainer debug option (no --enable equivalent)
5073 dnl ========================================================
5077 AC_SUBST(AR_EXTRACT)
5080 AC_SUBST(AS_DASH_C_FLAG)
5087 AC_SUBST(MOZ_AUTH_EXTENSION)
5088 AC_SUBST(MOZ_PREF_EXTENSIONS)
5090 AC_SUBST(MOZ_DEBUG_LDFLAGS)
5091 AC_SUBST(WARNINGS_AS_ERRORS)
5092 AC_SUBST_SET(MOZ_EXTENSIONS)
5094 AC_SUBST(MOZ_TOOLKIT_SEARCH)
5097 AC_SUBST(MOZ_UNIVERSALCHARDET)
5098 AC_SUBST(ACCESSIBILITY)
5099 AC_SUBST(MOZ_SPELLCHECK)
5100 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
5101 AC_SUBST(MOZ_CRASHREPORTER)
5102 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
5103 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
5104 AC_SUBST(MOZ_STUB_INSTALLER)
5105 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
5106 AC_SUBST(MOZ_ENABLE_SIGNMAR)
5107 AC_SUBST(MOZ_UPDATER)
5109 AC_SUBST(MOZ_ANGLE_RENDERER)
5110 AC_SUBST(MOZ_D3D_CPU_SUFFIX)
5111 AC_SUBST(MOZ_HAS_WINSDK_WITH_D3D)
5112 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL)
5113 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL_PATH)
5115 AC_SUBST(MOZ_ANDROID_APPLICATION_CLASS)
5116 AC_SUBST(MOZ_ANDROID_BROWSER_INTENT_CLASS)
5117 AC_SUBST(MOZ_ANDROID_SEARCH_INTENT_CLASS)
5118 AC_SUBST(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
5119 AC_SUBST(MOZ_INSTALL_TRACKING)
5120 AC_SUBST(ENABLE_STRIP)
5121 AC_SUBST(PKG_SKIP_STRIP)
5122 AC_SUBST(STRIP_FLAGS)
5123 AC_SUBST(USE_ELF_HACK)
5124 AC_SUBST(INCREMENTAL_LINKER)
5125 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
5127 AC_SUBST(MOZ_FIX_LINK_PATHS)
5129 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
5130 AC_SUBST(MOZ_LINKER_EXTRACT)
5132 if test -n "$MOZ_BINARY_EXTENSIONS"; then
5133 AC_DEFINE(MOZ_BINARY_EXTENSIONS)
5136 AC_SUBST(MOZ_ADDON_SIGNING)
5137 if test "$MOZ_ADDON_SIGNING" = 1; then
5138 AC_DEFINE(MOZ_ADDON_SIGNING)
5140 AC_SUBST(MOZ_REQUIRE_SIGNING)
5141 if test "$MOZ_REQUIRE_SIGNING" = 1; then
5142 AC_DEFINE(MOZ_REQUIRE_SIGNING)
5145 AC_SUBST(MOZ_JSDOWNLOADS)
5146 if test -n "$MOZ_JSDOWNLOADS"; then
5147 AC_DEFINE(MOZ_JSDOWNLOADS)
5150 dnl ========================================================
5151 dnl = Mac bundle name prefix
5152 dnl ========================================================
5153 MOZ_ARG_WITH_STRING(macbundlename-prefix,
5154 [ --with-macbundlename-prefix=prefix
5155 Prefix for MOZ_MACBUNDLE_NAME],
5156 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
5158 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
5159 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
5160 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
5163 if test "$MOZ_DEBUG"; then
5164 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
5166 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
5168 AC_SUBST(MOZ_MACBUNDLE_NAME)
5170 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
5171 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
5172 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
5173 if test "$MOZ_DEBUG"; then
5174 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
5177 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
5178 AC_SUBST(MOZ_MACBUNDLE_ID)
5180 dnl ========================================================
5181 dnl = Child Process Name for IPC
5182 dnl ========================================================
5183 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
5184 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
5186 # We want to let Android unpack the file at install time, but it only does
5187 # so if the file is named libsomething.so. The lib/ path is also required
5188 # because the unpacked file will be under the lib/ subdirectory and will
5189 # need to be executed from that path.
5190 MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
5191 MOZ_CHILD_PROCESS_NAME_PIE="libplugin-container-pie.so"
5192 AC_SUBST(MOZ_CHILD_PROCESS_NAME_PIE)
5194 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
5196 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
5197 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
5199 # The following variables are available to branding and application
5200 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
5201 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
5202 # impacts profile location and user-visible fields.
5203 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
5204 # versions of a given application (e.g. Aurora and Firefox both use
5205 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
5206 # for application.ini's "Name" field, which controls profile location in
5207 # the absence of a "Profile" field (see below), and various system
5208 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
5209 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
5210 # Mac Bundle name, Updater, Installer), it is typically used for nightly
5211 # builds (e.g. Aurora for Firefox).
5212 # - MOZ_APP_VERSION: Defines the application version number.
5213 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
5214 # in the "About" window. If not set, defaults to MOZ_APP_VERSION.
5215 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
5216 # defaults to a lowercase form of MOZ_APP_BASENAME.
5217 # - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
5218 # profile name and remoting. If not set, defaults to MOZ_APP_NAME.
5219 # - MOZ_APP_PROFILE: When set, used for application.ini's
5220 # "Profile" field, which controls profile location.
5221 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
5222 # crash reporter server url.
5223 # - MOZ_APP_ANDROID_VERSION_CODE: On Android, "android:versionCode" for
5224 # the main application is set to the value of this variable. If not
5225 # set, it falls back to a Mozilla-specific value derived from the
5227 # - MOZ_ANDROID_SHARED_ID: On Android, "android:sharedUserId" for all Android
5228 # packages produced.
5229 # - MOZ_ANDROID_GCM_SENDERID: On Android, the Android GCM Sender ID used. GCM
5230 # sender IDs are not sensitive: see, http://stackoverflow.com/a/18216063.
5231 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
5233 if test -z "$MOZ_APP_NAME"; then
5234 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
5237 if test -z "$MOZ_APP_REMOTINGNAME"; then
5238 MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
5241 if test -z "$MOZ_APP_VERSION_DISPLAY"; then
5242 MOZ_APP_VERSION_DISPLAY=$MOZ_APP_VERSION
5245 if test -z "$ANDROID_PACKAGE_NAME" ; then
5246 ANDROID_PACKAGE_NAME="org.mozilla.$MOZ_APP_NAME"
5249 # Mozilla released Firefox for Android {Release,Beta} and {Aurora,Nightly} to
5250 # the public with specific common shared IDs and we need to keep them
5251 # consistent forever. The specific common values are set by per-channel
5252 # branding; all other channels use a generic sharedID, set below.
5253 if test -z "$MOZ_ANDROID_SHARED_ID" ; then
5254 MOZ_ANDROID_SHARED_ID="${ANDROID_PACKAGE_NAME}.sharedID"
5257 # For extensions and langpacks, we require a max version that is compatible
5258 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
5259 # 24.0a1 and 24.0a2 aren't affected
5261 # 24.1.1 becomes 24.*
5262 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
5263 if test -z "$IS_ALPHA"; then
5265 if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
5266 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
5268 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
5272 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
5275 MOZ_B2G_VERSION=${MOZ_B2G_VERSION:-"1.0.0"}
5276 AC_DEFINE_UNQUOTED(MOZ_B2G_VERSION,"$MOZ_B2G_VERSION")
5277 AC_DEFINE_UNQUOTED(MOZ_B2G_OS_NAME,"$MOZ_B2G_OS_NAME")
5279 AC_SUBST(MOZ_APP_NAME)
5280 AC_SUBST(MOZ_APP_REMOTINGNAME)
5281 AC_SUBST(MOZ_APP_DISPLAYNAME)
5282 AC_SUBST(MOZ_APP_BASENAME)
5283 AC_SUBST(MOZ_APP_VENDOR)
5284 AC_SUBST(MOZ_APP_PROFILE)
5285 AC_SUBST(MOZ_APP_ID)
5286 AC_SUBST(MOZ_APP_ANDROID_VERSION_CODE)
5287 AC_SUBST(MOZ_ANDROID_SHARED_ID)
5288 AC_SUBST(MOZ_ANDROID_GCM_SENDERID)
5289 AC_SUBST(MAR_CHANNEL_ID)
5290 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
5291 AC_SUBST(MOZ_PROFILE_MIGRATOR)
5292 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
5293 AC_SUBST(MOZ_APP_UA_NAME)
5294 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
5295 AC_SUBST(MOZ_APP_VERSION)
5296 AC_SUBST(MOZ_APP_VERSION_DISPLAY)
5297 AC_SUBST(MOZ_APP_MAXVERSION)
5298 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
5299 AC_SUBST(FIREFOX_VERSION)
5300 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
5301 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
5302 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
5305 AC_SUBST(MOZ_PKG_SPECIAL)
5306 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
5308 AC_SUBST(MOZILLA_OFFICIAL)
5309 if test "$MOZILLA_OFFICIAL"; then
5310 AC_DEFINE(MOZILLA_OFFICIAL)
5311 # Build revisions should always be present in official builds
5312 MOZ_INCLUDE_SOURCE_INFO=1
5315 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
5316 # explicitly set the repository and changeset information in.
5317 AC_SUBST(MOZ_SOURCE_REPO)
5318 AC_SUBST(MOZ_SOURCE_CHANGESET)
5319 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
5321 if test "$MOZ_TELEMETRY_REPORTING"; then
5322 AC_DEFINE(MOZ_TELEMETRY_REPORTING)
5324 # Enable Telemetry by default for nightly and aurora channels
5325 if test -z "$RELEASE_OR_BETA"; then
5326 AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
5330 dnl If we have any service that uploads data (and requires data submission
5331 dnl policy alert), set MOZ_DATA_REPORTING.
5332 dnl We need SUBST for build system and DEFINE for xul preprocessor.
5333 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
5334 MOZ_DATA_REPORTING=1
5335 AC_DEFINE(MOZ_DATA_REPORTING)
5336 AC_SUBST(MOZ_DATA_REPORTING)
5340 AC_SUBST(WIN32_REDIST_DIR)
5341 AC_SUBST(WIN_UCRT_REDIST_DIR)
5343 dnl ========================================================
5345 dnl ========================================================
5347 # Internationalization is not built or exposed on Fennec.
5350 if test "$MOZ_BUILD_APP" = "mobile/android"; then
5356 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
5362 dnl Echo the CFLAGS to remove extra whitespace.
5368 $_WARNINGS_CXXFLAGS \
5371 COMPILE_CFLAGS=`echo \
5375 COMPILE_CXXFLAGS=`echo \
5376 $_DEFINES_CXXFLAGS \
5382 HOST_CXXFLAGS=`echo \
5385 AC_SUBST(_DEPEND_CFLAGS)
5386 AC_SUBST(MOZ_SYSTEM_JPEG)
5387 AC_SUBST(MOZ_SYSTEM_PNG)
5388 AC_SUBST(MOZ_SYSTEM_BZ2)
5390 AC_SUBST_LIST(MOZ_JPEG_CFLAGS)
5391 AC_SUBST_LIST(MOZ_JPEG_LIBS)
5392 AC_SUBST_LIST(MOZ_BZ2_CFLAGS)
5393 AC_SUBST_LIST(MOZ_BZ2_LIBS)
5394 AC_SUBST_LIST(MOZ_PNG_CFLAGS)
5395 AC_SUBST_LIST(MOZ_PNG_LIBS)
5397 AC_SUBST(MOZ_SYSTEM_NSPR)
5399 AC_SUBST(MOZ_SYSTEM_NSS)
5401 HOST_CMFLAGS=-fobjc-exceptions
5402 HOST_CMMFLAGS=-fobjc-exceptions
5403 OS_COMPILE_CMFLAGS=-fobjc-exceptions
5404 OS_COMPILE_CMMFLAGS=-fobjc-exceptions
5405 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
5406 OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
5407 OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
5409 AC_SUBST(HOST_CMFLAGS)
5410 AC_SUBST(HOST_CMMFLAGS)
5411 AC_SUBST(OS_COMPILE_CMFLAGS)
5412 AC_SUBST(OS_COMPILE_CMMFLAGS)
5415 OS_CXXFLAGS="$CXXFLAGS"
5416 OS_CPPFLAGS="$CPPFLAGS"
5417 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
5418 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
5419 OS_LDFLAGS="$LDFLAGS"
5422 AC_SUBST(OS_CXXFLAGS)
5423 AC_SUBST(OS_CPPFLAGS)
5424 AC_SUBST(OS_COMPILE_CFLAGS)
5425 AC_SUBST(OS_COMPILE_CXXFLAGS)
5426 AC_SUBST(OS_LDFLAGS)
5431 AC_SUBST(HOST_CFLAGS)
5432 AC_SUBST(HOST_CPPFLAGS)
5433 AC_SUBST(HOST_CXXFLAGS)
5434 AC_SUBST(HOST_LDFLAGS)
5435 AC_SUBST(HOST_OPTIMIZE_FLAGS)
5437 AC_SUBST(HOST_AR_FLAGS)
5438 AC_SUBST(HOST_RANLIB)
5439 AC_SUBST(HOST_BIN_SUFFIX)
5441 AC_SUBST(TARGET_XPCOM_ABI)
5442 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
5443 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
5444 AC_SUBST(HAVE_X86_AVX2)
5445 AC_SUBST(HAVE_ALTIVEC)
5446 AC_SUBST(GCC_USE_GNU_LD)
5448 AC_SUBST(WRAP_LDFLAGS)
5451 AC_SUBST(DSO_CFLAGS)
5452 AC_SUBST(DSO_PIC_CFLAGS)
5453 AC_SUBST(DSO_LDOPTS)
5454 AC_SUBST(LIB_PREFIX)
5455 AC_SUBST(DLL_PREFIX)
5456 AC_SUBST(DLL_SUFFIX)
5457 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
5458 AC_SUBST(LIB_SUFFIX)
5459 AC_SUBST(OBJ_SUFFIX)
5460 AC_SUBST(BIN_SUFFIX)
5461 AC_SUBST(IMPORT_LIB_SUFFIX)
5463 AC_SUBST(CC_VERSION)
5464 AC_SUBST(NS_ENABLE_TSF)
5465 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
5466 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
5468 AC_SUBST(MOZ_VORBIS)
5469 AC_SUBST(MOZ_TREMOR)
5471 AC_SUBST_LIST(FFVPX_ASFLAGS)
5472 AC_SUBST(MOZ_DIRECTSHOW)
5473 AC_SUBST(MOZ_ANDROID_OMX)
5474 AC_SUBST(MOZ_OMX_PLUGIN)
5475 AC_SUBST(VPX_USE_YASM)
5476 AC_SUBST_LIST(VPX_ASFLAGS)
5477 AC_SUBST(VPX_AS_CONVERSION)
5478 AC_SUBST(VPX_X86_ASM)
5479 AC_SUBST(VPX_ARM_ASM)
5480 AC_SUBST(MOZ_CODE_COVERAGE)
5481 AC_SUBST(LIBJPEG_TURBO_USE_YASM)
5482 AC_SUBST_LIST(LIBJPEG_TURBO_ASFLAGS)
5483 AC_SUBST(MOZ_LIBAV_FFT)
5484 AC_SUBST_LIST(LIBAV_FFT_ASFLAGS)
5485 AC_SUBST(MOZ_DEVTOOLS)
5487 AC_SUBST(MOZ_PACKAGE_JSSHELL)
5488 AC_SUBST(MOZ_FOLD_LIBS)
5489 AC_SUBST(MOZ_FOLD_LIBS_FLAGS)
5490 AC_SUBST(SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE)
5494 dnl Host JavaScript runtime, if any, to use during cross compiles.
5497 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
5499 if test -n "$COMPILE_ENVIRONMENT"; then
5500 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
5502 dnl Check for missing components
5503 if test "$MOZ_X11"; then
5504 dnl ====================================================
5505 dnl = Check if X headers exist
5506 dnl ====================================================
5507 _SAVE_CFLAGS=$CFLAGS
5508 CFLAGS="$CFLAGS $XCFLAGS"
5512 #include <X11/Xlib.h>
5513 #include <X11/Intrinsic.h>
5514 #include <X11/extensions/XShm.h>
5518 if ((dpy = XOpenDisplay(NULL)) == NULL) {
5519 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
5523 [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
5524 CFLAGS="$_SAVE_CFLAGS"
5526 if test -n "$MISSING_X"; then
5527 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
5532 fi # COMPILE_ENVIRONMENT
5534 dnl Set various defines and substitutions
5535 dnl ========================================================
5537 if test "$MOZ_DEBUG"; then
5538 AC_DEFINE(MOZ_REFLOW_PERF)
5539 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
5542 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
5543 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
5544 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
5545 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
5546 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
5547 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
5548 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
5549 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
5550 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
5553 if test -n "$MOZ_DEV_EDITION"; then
5554 AC_DEFINE(MOZ_DEV_EDITION)
5557 if test "$MOZ_DEBUG"; then
5560 case "$MOZ_UPDATE_CHANNEL" in
5561 aurora|beta|release|esr)
5568 if test -n "$A11Y_LOG"; then
5572 AC_SUBST(MOZILLA_VERSION)
5574 dnl Spit out some output
5575 dnl ========================================================
5577 dnl The following defines are used by xpcom
5578 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
5580 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
5581 HAVE_CPP_PARTIAL_SPECIALIZATION
5584 HAVE_ICONV_WITH_CONST_INPUT
5597 dnl ========================================================
5598 dnl Determine options to use for running the preprocessor.
5599 dnl ========================================================
5601 if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT"; then
5602 PREPROCESS_OPTION="-P -Fi"
5604 PREPROCESS_OPTION="-E -o "
5607 AC_SUBST(PREPROCESS_OPTION)
5609 dnl ========================================================
5610 dnl mask as shorthand property
5611 dnl ========================================================
5613 # The control structure code will be removed as soon as the feature is stable
5614 # Refer to bug 1281101 for more details.
5615 MOZ_ENABLE_MASK_AS_SHORTHAND=1
5616 AC_DEFINE(MOZ_ENABLE_MASK_AS_SHORTHAND)
5617 AC_SUBST(MOZ_ENABLE_MASK_AS_SHORTHAND)
5619 # Avoid using obsolete NSPR features
5620 AC_DEFINE(NO_NSPR_10_SUPPORT)
5622 # Don't build NSS libpkix
5623 NSS_DISABLE_LIBPKIX=1
5624 AC_SUBST(NSS_DISABLE_LIBPKIX)
5626 MOZ_CREATE_CONFIG_STATUS()
5628 if test "$COMPILE_ENVIRONMENT"; then
5629 MOZ_SUBCONFIGURE_JEMALLOC()
5632 # Run freetype configure script
5634 if test "$MOZ_TREE_FREETYPE"; then
5635 export CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS -std=c99"
5636 export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS"
5637 export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS"
5638 export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS"
5639 # Spaces in the *_CFLAGS and *_LIBS variables are intentionally placed
5640 # to force freetype to use our settings rather than autodetecting
5641 if test -n "$MOZ_SYSTEM_PNG"; then
5642 export LIBPNG_CFLAGS="$MOZ_PNG_CFLAGS "
5644 export LIBPNG_CFLAGS="-I$_objdir/dist/include"
5646 export LIBPNG_LIBS="$MOZ_PNG_LIBS "
5647 export ZLIB_CFLAGS="$MOZ_ZLIB_CFLAGS "
5648 export ZLIB_LIBS="$MOZ_ZLIB_LIBS "
5649 export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
5650 ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes --with-zlib=yes --without-bzip2 --with-png=yes --without-harfbuzz"
5652 if ! test -e modules; then
5655 # Only export CC, CXX and RANLIB for the subconfigure, and avoid spilling
5656 # that further down the road.
5657 (export CC CXX RANLIB;
5658 AC_OUTPUT_SUBDIRS(modules/freetype2)
5662 if test -z "$direct_nspr_config"; then
5663 dnl ========================================================
5664 dnl = Setup a nice relatively clean build environment for
5665 dnl = sub-configures.
5666 dnl ========================================================
5669 CFLAGS="$_SUBDIR_CFLAGS"
5670 CPPFLAGS="$_SUBDIR_CPPFLAGS"
5671 CXXFLAGS="$_SUBDIR_CXXFLAGS"
5672 LDFLAGS="$_SUBDIR_LDFLAGS"
5673 HOST_CC="$_SUBDIR_HOST_CC"
5674 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
5675 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
5676 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
5683 # Run all configure scripts specified by a subconfigure
5684 if test -n "$_subconfigure_subdir"; then
5685 _save_srcdir="$srcdir"
5687 _save_ac_configure_args="$ac_configure_args"
5688 ac_configure_args="$_subconfigure_config_args"
5689 AC_OUTPUT_SUBDIRS_NOW("$_subconfigure_subdir",$cache_file)
5690 ac_configure_args="$_save_ac_configure_args"
5691 srcdir="$_save_srcdir"
5694 if test "$COMPILE_ENVIRONMENT"; then
5698 dnl ========================================================
5699 dnl = Setup a nice relatively clean build environment for
5700 dnl = sub-configures.
5701 dnl ========================================================
5704 CFLAGS="$_SUBDIR_CFLAGS"
5705 CPPFLAGS="$_SUBDIR_CPPFLAGS"
5706 CXXFLAGS="$_SUBDIR_CXXFLAGS"
5707 LDFLAGS="$_SUBDIR_LDFLAGS"
5708 HOST_CC="$_SUBDIR_HOST_CC"
5709 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
5710 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
5711 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
5714 # Run the SpiderMonkey 'configure' script.
5715 dist=$MOZ_BUILD_ROOT/dist
5716 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
5718 # --with-system-nspr will have been converted into the relevant $NSPR_CFLAGS
5720 ac_configure_args="`echo $ac_configure_args | sed -e 's/--with-system-nspr\S* *//'`"
5722 if test "$_INTL_API" = no; then
5723 ac_configure_args="$ac_configure_args --without-intl-api"
5726 if test -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
5727 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
5728 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
5730 ac_configure_args="$ac_configure_args --prefix=$dist"
5731 if test -n "$ZLIB_IN_MOZGLUE"; then
5734 export MOZ_SYSTEM_ZLIB
5735 export MOZ_ZLIB_CFLAGS
5736 export MOZ_ZLIB_LIBS
5738 export MOZ_APP_REMOTINGNAME
5740 export MOZILLA_CENTRAL_PATH=$_topsrcdir
5741 export STLPORT_CPPFLAGS
5746 export ZLIB_IN_MOZGLUE
5760 export HOST_CPPFLAGS
5761 export HOST_CXXFLAGS
5764 if ! test -e js; then
5768 ac_configure_args="$ac_configure_args JS_STANDALONE="
5769 AC_OUTPUT_SUBDIRS(js/src,$cache_file)
5770 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
5772 fi # COMPILE_ENVIRONMENT
5774 dnl we need to run config.status after js/src subconfigure because we're
5775 dnl traversing its moz.build and we need its config.status for that.
5776 dnl However, writing our own config.status needs to happen before
5777 dnl subconfigures because the setup surrounding subconfigures alters
5778 dnl many AC_SUBSTed variables.
5779 MOZ_RUN_ALL_SUBCONFIGURES()
5781 rm -fr confdefs* $ac_clean_files