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 6.0 SP2 (XP SP2)
402 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
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.
995 if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
996 CFLAGS="$CFLAGS -arch:SSE2"
998 if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
999 CXXFLAGS="$CXXFLAGS -arch:SSE2"
1001 SSE_FLAGS="-arch:SSE"
1002 SSE2_FLAGS="-arch:SSE2"
1003 dnl MSVC allows the use of intrinsics without any flags
1004 dnl and doesn't have a separate arch for SSSE3
1005 SSSE3_FLAGS="-arch:SSE2"
1007 dnl clang-cl requires appropriate flags to enable SSSE3 support
1008 dnl on all architectures.
1009 if test -n "$CLANG_CL"; then
1010 SSSE3_FLAGS="-mssse3"
1012 dnl VS2013+ requires -FS when parallel building by make -jN.
1013 dnl If nothing, compiler sometimes causes C1041 error.
1014 CFLAGS="$CFLAGS -FS"
1015 CXXFLAGS="$CXXFLAGS -FS"
1016 dnl VS2013+ supports -Gw for better linker optimizations.
1017 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
1018 dnl Disabled on ASan because it causes false-positive ODR violations.
1019 if test -z "$MOZ_ASAN"; then
1020 CFLAGS="$CFLAGS -Gw"
1021 CXXFLAGS="$CXXFLAGS -Gw"
1023 # khuey says we can safely ignore MSVC warning C4251
1024 # MSVC warning C4244 (implicit type conversion may lose data) warns
1025 # and requires workarounds for perfectly valid code. Also, GCC/clang
1026 # don't warn about it by default. So for consistency/sanity, we turn
1027 # it off on MSVC, too.
1028 # MSVC warning C4267 warns for narrowing type conversions from size_t
1029 # to 32-bit integer types on 64-bit platforms. Since this is virtually
1030 # the same thing as C4244, we disable C4267, too.
1031 # MSVC warning C4800 warns when a value is implicitly cast to bool,
1032 # because this also forces narrowing to a single byte, which can be a
1033 # perf hit. But this matters so little in practice (and often we want
1034 # that behavior) that it's better to turn it off.
1035 # MSVC warning C4595 warns non-member operator new or delete functions
1036 # may not be declared inline, as of VS2015 Update 2.
1037 CFLAGS="$CFLAGS -wd4244 -wd4267"
1038 CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4267 -wd4800 -wd4595"
1039 if test -n "$CLANG_CL"; then
1040 # XXX We should combine some of these with our generic GCC-style
1043 # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
1044 CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
1045 # We use offsetof on non-POD objects all the time.
1046 # We also suppress this warning on other platforms.
1047 CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
1048 # MFBT thinks clang-cl supports constexpr, which it does, but
1049 # not everything in Windows C++ headers supports constexpr
1050 # as we might expect until MSVC 2015, so turn off this warning
1052 CXXFLAGS="$CXXFLAGS -Wno-invalid-constexpr"
1053 # This warns for reasonable things like:
1054 # enum { X = 0xffffffffU };
1055 # which is annoying for IDL headers.
1056 CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
1057 # This warns for cases that would be reached by the Microsoft
1058 # #include rules, but also currently warns on cases that would
1059 # *also* be reached by standard C++ include rules. That
1060 # behavior doesn't seem useful, so we turn it off.
1061 CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
1062 # We normally error out on unknown pragmas, but since clang-cl
1063 # claims to be MSVC, it would be difficult to add
1064 # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
1065 # use such pragmas, so just ignore them.
1066 CFLAGS="$CFLAGS -Wno-unknown-pragmas"
1067 CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
1068 # We get errors about various #pragma intrinsic directives from
1069 # clang-cl, and we don't need to hear about those.
1070 CFLAGS="$CFLAGS -Wno-ignored-pragmas"
1071 CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
1072 # clang-cl's Intrin.h marks things like _ReadWriteBarrier
1073 # as __attribute((__deprecated__)). This is nice to know,
1074 # but since we don't get the equivalent warning from MSVC,
1075 # let's just ignore it.
1076 CFLAGS="$CFLAGS -Wno-deprecated-declarations"
1077 CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
1078 # We use a function like:
1079 # __declspec(noreturn) __inline void f() {}
1080 # which -Winvalid-noreturn complains about. Again, MSVC seems
1081 # OK with it, so let's silence the warning.
1082 CFLAGS="$CFLAGS -Wno-invalid-noreturn"
1083 CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
1084 # Missing |override| on virtual function declarations isn't
1085 # something that MSVC currently warns about.
1086 CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
1087 # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
1088 # declaration on |operator delete(void*)|. However, clang-cl
1089 # must internally declare |operator delete(void*)| differently,
1090 # which causes this warning for virtually every file in the
1091 # tree. clang-cl doesn't support -fno-exceptions or equivalent,
1092 # so there doesn't seem to be any way to convince clang-cl to
1093 # declare |delete| differently. Therefore, suppress this
1095 CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
1096 # At least one MSVC header and several headers in-tree have
1097 # unused typedefs, so turn this on.
1098 CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
1099 # Several JS engine header files use __declspec(dllimport) on
1100 # classes, and clang-cl helpfully warns about its non-support
1101 # for such cases. We're not particularly worried about that,
1102 # so ignore that warning.
1103 CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
1105 # make 'foo == bar;' error out
1106 CFLAGS="$CFLAGS -we4553"
1107 CXXFLAGS="$CXXFLAGS -we4553"
1108 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
1109 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1110 WARNINGS_AS_ERRORS='-WX'
1111 MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
1113 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
1114 if test -z "$DEVELOPER_OPTIONS"; then
1115 LDFLAGS="$LDFLAGS -RELEASE"
1117 dnl For profile-guided optimization
1118 PROFILE_GEN_CFLAGS="-GL"
1119 num_cores=$($PYTHON -c 'import multiprocessing; print(min(8,multiprocessing.cpu_count()))')
1120 cgthreads="-CGTHREADS:${num_cores}"
1121 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT -PogoSafeMode $cgthreads"
1122 dnl XXX: PGO builds can fail with warnings treated as errors,
1123 dnl specifically "no profile data available" appears to be
1124 dnl treated as an error sometimes. This might be a consequence
1125 dnl of using WARNINGS_AS_ERRORS in some modules, combined
1126 dnl with the linker doing most of the work in the whole-program
1127 dnl optimization/PGO case. I think it's probably a compiler bug,
1128 dnl but we work around it here.
1129 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
1130 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
1131 dnl Probably also a compiler bug, but what can you do?
1132 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE $cgthreads"
1133 LDFLAGS="$LDFLAGS -DYNAMICBASE"
1135 if test "$CC_VERSION" = "18.00.31101"; then
1136 dnl Use MaxILKSize as a workaround for LNK1248 in VS2013update4
1137 dnl See https://connect.microsoft.com/VisualStudio/feedback/details/1044914/fatal-error-lnk1248
1138 LDFLAGS="$LDFLAGS -MaxILKSize:0x7FF00000"
1140 dnl Minimum reqiurement of Gecko is VS2010 or later which supports
1141 dnl both SSSE3 and SSE4.1.
1142 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
1143 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
1144 dnl allow AVX2 code from VS2012
1147 AC_DEFINE(WIN32_LEAN_AND_MEAN)
1148 dnl See http://support.microsoft.com/kb/143208 to use STL
1151 MOZ_USER_DIR="Mozilla"
1155 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.])
1161 if test -n "$GNU_CC"; then
1162 CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
1163 CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
1164 LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup -Wl,--large-address-aware"
1166 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
1167 LDFLAGS="$LDFLAGS -SAFESEH"
1173 if test -n "$_WIN32_MSVC"; then
1174 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
1179 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
1186 CFLAGS="$CFLAGS -Dunix"
1187 CXXFLAGS="$CXXFLAGS -Dunix"
1188 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
1190 DSO_PIC_CFLAGS='-fPIC -DPIC'
1191 DSO_LDOPTS='-shared'
1192 BIN_FLAGS='-Wl,--export-dynamic'
1194 DSO_PIC_CFLAGS='-fPIC -DPIC'
1195 DLL_SUFFIX=".so.1.0"
1196 DSO_LDOPTS='-shared'
1198 # This will fail on a.out systems prior to 1.5.1_ALPHA.
1199 if test "$LIBRUNPATH"; then
1200 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
1202 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
1203 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
1207 if test "$SO_VERSION"; then
1208 DLL_SUFFIX=".so.$SO_VERSION"
1210 DLL_SUFFIX=".so.1.0"
1212 if test -z "$X11BASE"; then
1215 MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
1217 DSO_PIC_CFLAGS='-fPIC'
1218 DSO_LDOPTS='-shared -fPIC'
1219 if test "$LIBRUNPATH"; then
1220 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
1226 AC_SUBST_LIST(MMX_FLAGS)
1227 AC_SUBST_LIST(SSE_FLAGS)
1228 AC_SUBST_LIST(SSE2_FLAGS)
1229 AC_SUBST_LIST(SSSE3_FLAGS)
1231 AC_SUBST(MOZ_LINKER)
1232 if test -n "$MOZ_LINKER"; then
1233 AC_DEFINE(MOZ_LINKER)
1234 MOZ_LINKER_EXTRACT=1
1235 AC_CHECK_PROGS(XZ, xz)
1238 dnl Only one oddball right now (QNX), but this gives us flexibility
1239 dnl if any other platforms need to override this in the future.
1240 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
1242 dnl ========================================================
1243 dnl = Flags to strip unused symbols from .so components and
1244 dnl = to export jemalloc symbols when linking a program
1245 dnl ========================================================
1247 *-linux*|*-kfreebsd*-gnu|*-gnu*)
1248 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
1251 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,-exported_symbols_list -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-export-list'
1254 if test -n "$GNU_CC"; then
1255 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
1260 if test -z "$COMPILE_ENVIRONMENT"; then
1261 SKIP_COMPILER_CHECKS=1
1262 SKIP_LIBRARY_CHECKS=1
1267 fi # COMPILE_ENVIRONMENT
1269 if test -z "$SKIP_COMPILER_CHECKS"; then
1270 dnl Checks for typedefs, structures, and compiler characteristics.
1271 dnl ========================================================
1286 case "${OS_TARGET}" in
1290 STL_FLAGS="-I${DIST}/stl_wrappers"
1295 dnl Checks for header files.
1296 dnl ========================================================
1298 case "$target_os" in
1299 bitrig*|dragonfly*|freebsd*|openbsd*)
1300 # for stuff like -lXshm
1301 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
1305 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
1306 AC_CACHE_CHECK(for sockaddr_in.sin_len,
1307 ac_cv_sockaddr_in_sin_len,
1308 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1309 #include <sys/types.h>
1311 #include <netinet/in.h>
1312 struct sockaddr_in x;
1313 void *foo = (void*) &x.sin_len;],
1315 [ac_cv_sockaddr_in_sin_len=true],
1316 [ac_cv_sockaddr_in_sin_len=false])])
1317 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
1318 AC_DEFINE(HAVE_SIN_LEN)
1319 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
1320 AC_DEFINE(HAVE_SCONN_LEN)
1323 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
1324 ac_cv_sockaddr_in6_sin6_len,
1325 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1326 #include <sys/types.h>
1328 #include <netinet/in.h>
1329 struct sockaddr_in6 x;
1330 void *foo = (void*) &x.sin6_len;],
1332 [ac_cv_sockaddr_in6_sin6_len=true],
1333 [ac_cv_sockaddr_in6_sin6_len=false])])
1334 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
1335 AC_DEFINE(HAVE_SIN6_LEN)
1338 AC_CACHE_CHECK(for sockaddr.sa_len,
1339 ac_cv_sockaddr_sa_len,
1340 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1341 #include <sys/types.h>
1343 #include <sys/socket.h>
1345 void *foo = (void*) &x.sa_len;],
1347 [ac_cv_sockaddr_sa_len=true],
1348 [ac_cv_sockaddr_sa_len=false])])
1349 if test "$ac_cv_sockaddr_sa_len" = true ; then
1350 AC_DEFINE(HAVE_SA_LEN)
1353 MOZ_ARG_ENABLE_BOOL(dtrace,
1354 [ --enable-dtrace build with dtrace support if available (default=no)],
1355 [enable_dtrace="yes"],)
1356 if test "x$enable_dtrace" = "xyes"; then
1357 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
1358 if test -n "$HAVE_DTRACE"; then
1359 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
1361 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
1364 AC_SUBST(HAVE_DTRACE)
1366 dnl Checks for libraries.
1367 dnl ========================================================
1368 AC_CHECK_LIB(c_r, gethostbyname_r)
1370 dnl We don't want to link with libdl even if it's present on OS X, since
1371 dnl it's not used and not part of the default installation. OS/2 has dlfcn
1373 dnl We don't want to link against libm or libpthread on Darwin since
1374 dnl they both are just symlinks to libSystem and explicitly linking
1375 dnl against libSystem causes issues when debugging (see bug 299601).
1380 AC_SEARCH_LIBS(dlopen, dl,
1381 MOZ_CHECK_HEADER(dlfcn.h,
1382 AC_DEFINE(HAVE_DLOPEN)))
1386 _SAVE_CFLAGS="$CFLAGS"
1387 CFLAGS="$CFLAGS -D_GNU_SOURCE"
1388 AC_CHECK_FUNCS(dladdr memmem)
1389 CFLAGS="$_SAVE_CFLAGS"
1391 if test ! "$GNU_CXX"; then
1392 AC_CHECK_LIB(C, demangle)
1395 AC_CHECK_LIB(socket, socket)
1398 XLIBS="$X_EXTRA_LIBS"
1400 dnl ========================================================
1401 dnl Checks for X libraries.
1402 dnl Ordering is important.
1403 dnl Xt is dependent upon SM as of X11R6
1404 dnl ========================================================
1405 if test -n "$MOZ_X11"; then
1406 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
1407 _SAVE_LDFLAGS="$LDFLAGS"
1409 LDFLAGS="$XLDFLAGS $LDFLAGS"
1410 AC_CHECK_LIB(X11, XDrawLines, [XLIBS="-lX11 $XLIBS"],
1411 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
1412 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
1413 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
1415 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
1416 unset ac_cv_lib_Xt_XtFree
1417 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
1418 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
1419 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
1420 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
1423 dnl ========================================================
1425 dnl ========================================================
1426 AC_CHECK_LIB(xcb, xcb_connect, [XLIBS="-lxcb $XLIBS"],
1427 [MISSING_X="$MISSING_X -lxcb"], $XLIBS)
1428 AC_CHECK_LIB(xcb-shm, xcb_shm_query_version, [XLIBS="-lxcb-shm $XLIBS"],
1429 [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS)
1430 AC_CHECK_LIB(X11-xcb, XGetXCBConnection, [XLIBS="-lX11-xcb $XLIBS"],
1431 [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS)
1433 dnl ========================================================
1435 dnl ========================================================
1436 MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
1437 AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
1438 [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
1439 AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
1441 LDFLAGS="$_SAVE_LDFLAGS"
1445 AC_SUBST_LIST(XCFLAGS)
1446 AC_SUBST_LIST(XLDFLAGS)
1447 AC_SUBST_LIST(XLIBS)
1448 AC_SUBST_LIST(XEXT_LIBS)
1449 AC_SUBST_LIST(XT_LIBS)
1450 AC_SUBST_LIST(XSS_LIBS)
1452 dnl ========================================================
1453 dnl = pthread support
1454 dnl = Start by checking whether the system support pthreads
1455 dnl ========================================================
1456 case "$target_os" in
1461 AC_CHECK_LIB(pthreads, pthread_create,
1462 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
1463 AC_CHECK_LIB(pthread, pthread_create,
1464 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
1465 AC_CHECK_LIB(c_r, pthread_create,
1466 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
1467 AC_CHECK_LIB(c, pthread_create,
1476 dnl ========================================================
1477 dnl Check the command line for --with-pthreads
1478 dnl ========================================================
1479 MOZ_ARG_WITH_BOOL(pthreads,
1480 [ --with-pthreads Force use of system pthread library with NSPR ],
1481 [ if test "$MOZ_USE_PTHREADS"x = x; then
1482 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
1488 dnl ========================================================
1489 dnl Do the platform specific pthread hackery
1490 dnl ========================================================
1491 if test "$MOZ_USE_PTHREADS"x != x
1494 dnl See if -pthread is supported.
1497 ac_cv_have_dash_pthread=no
1498 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
1499 echo 'int main() { return 0; }' | cat > conftest.c
1500 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
1501 if test $? -eq 0; then
1502 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1503 ac_cv_have_dash_pthread=yes
1504 case "$target_os" in
1506 # Freebsd doesn't use -pthread for compiles, it uses them for linking
1509 CFLAGS="$CFLAGS -pthread"
1510 CXXFLAGS="$CXXFLAGS -pthread"
1516 AC_MSG_RESULT($ac_cv_have_dash_pthread)
1519 dnl See if -pthreads is supported.
1521 ac_cv_have_dash_pthreads=no
1522 if test "$ac_cv_have_dash_pthread" = "no"; then
1523 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
1524 echo 'int main() { return 0; }' | cat > conftest.c
1525 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
1526 if test $? -eq 0; then
1527 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1528 ac_cv_have_dash_pthreads=yes
1529 CFLAGS="$CFLAGS -pthreads"
1530 CXXFLAGS="$CXXFLAGS -pthreads"
1534 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
1539 AC_DEFINE(_REENTRANT)
1540 AC_DEFINE(_THREAD_SAFE)
1541 dnl -pthread links in -lpthread, so don't specify it explicitly.
1542 if test "$ac_cv_have_dash_pthread" = "yes"; then
1543 _PTHREAD_LDFLAGS="-pthread"
1547 *-*-openbsd*|*-*-bsdi*)
1548 AC_DEFINE(_REENTRANT)
1549 AC_DEFINE(_THREAD_SAFE)
1550 dnl -pthread links in -lc_r, so don't specify it explicitly.
1551 if test "$ac_cv_have_dash_pthread" = "yes"; then
1552 _PTHREAD_LDFLAGS="-pthread"
1556 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
1557 AC_DEFINE(_REENTRANT)
1561 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
1562 AC_SUBST(MOZ_USE_PTHREADS)
1563 MOZ_CHECK_HEADERS(pthread.h)
1567 dnl Checks for library functions.
1568 dnl ========================================================
1569 AC_PROG_GCC_TRADITIONAL
1571 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall)
1573 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1574 dnl avoid this on Darwin, since depending on your system config, we may think
1575 dnl it exists but it really doesn't
1576 case "$OS_TARGET" in
1580 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1581 ac_cv_clock_monotonic,
1582 [for libs in "" -lrt; do
1585 AC_TRY_LINK([#include <time.h>],
1586 [ struct timespec ts;
1587 clock_gettime(CLOCK_MONOTONIC, &ts); ],
1588 ac_cv_clock_monotonic=$libs
1591 ac_cv_clock_monotonic=no)
1594 if test "$ac_cv_clock_monotonic" != "no"; then
1595 HAVE_CLOCK_MONOTONIC=1
1596 REALTIME_LIBS=$ac_cv_clock_monotonic
1597 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1598 AC_SUBST(HAVE_CLOCK_MONOTONIC)
1599 AC_SUBST_LIST(REALTIME_LIBS)
1604 AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
1605 ac_cv_pthread_cond_timedwait_monotonic_np,
1606 AC_TRY_LINK([#include <pthread.h>],
1607 [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
1608 ac_cv_pthread_cond_timewait_monotonic_np=yes,
1609 ac_cv_pthread_cond_timewait_monotonic_np=no))
1610 if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
1611 AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
1614 dnl check for wcrtomb/mbrtowc
1615 dnl =======================================================================
1616 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
1619 AC_CACHE_CHECK(for wcrtomb,
1621 [AC_TRY_LINK([#include <wchar.h>],
1622 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
1623 ac_cv_have_wcrtomb="yes",
1624 ac_cv_have_wcrtomb="no")])
1625 if test "$ac_cv_have_wcrtomb" = "yes"; then
1626 AC_DEFINE(HAVE_WCRTOMB)
1628 AC_CACHE_CHECK(for mbrtowc,
1630 [AC_TRY_LINK([#include <wchar.h>],
1631 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
1632 ac_cv_have_mbrtowc="yes",
1633 ac_cv_have_mbrtowc="no")])
1634 if test "$ac_cv_have_mbrtowc" = "yes"; then
1635 AC_DEFINE(HAVE_MBRTOWC)
1642 ac_cv_func_res_ninit,
1643 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
1644 dnl no need for res_ninit() on NetBSD and OpenBSD
1645 ac_cv_func_res_ninit=no
1649 #define _BSD_SOURCE 1
1651 #include <sys/types.h>
1652 #include <netinet/in.h>
1653 #include <arpa/nameser.h>
1656 [int foo = res_ninit(&_res);],
1657 [ac_cv_func_res_ninit=yes],
1658 [ac_cv_func_res_ninit=no])
1662 if test "$ac_cv_func_res_ninit" = "yes"; then
1663 AC_DEFINE(HAVE_RES_NINIT)
1664 dnl must add the link line we do something as foolish as this... dougt
1666 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
1667 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
1679 AC_CHECK_LIB(c, iconv, [ICONV_LIBS=],
1680 AC_CHECK_LIB(iconv, iconv, [ICONV_LIBS="-liconv"],
1681 AC_CHECK_LIB(iconv, libiconv, [ICONV_LIBS="-liconv"])))
1683 LIBS="$LIBS $ICONV_LIBS"
1692 iconv_t h = iconv_open("", "");
1693 iconv(h, NULL, NULL, NULL, NULL);
1696 [ac_cv_func_iconv=yes],
1697 [ac_cv_func_iconv=no]
1700 if test "$ac_cv_func_iconv" = "yes"; then
1701 AC_DEFINE(HAVE_ICONV)
1702 LIBICONV="$ICONV_LIBS"
1704 [for iconv() with const input],
1705 ac_cv_func_const_iconv,
1711 const char *input = "testing";
1712 iconv_t h = iconv_open("", "");
1713 iconv(h, &input, NULL, NULL, NULL);
1716 [ac_cv_func_const_iconv=yes],
1717 [ac_cv_func_const_iconv=no]
1720 if test "$ac_cv_func_const_iconv" = "yes"; then
1721 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
1729 AC_SUBST_LIST(ICONV_LIBS)
1735 dnl **********************
1736 dnl *** va_copy checks ***
1737 AC_CACHE_CHECK([for an implementation of va_copy()],
1739 [AC_TRY_COMPILE([#include <stdarg.h>
1741 void f (int i, ...) {
1742 va_list args1, args2;
1743 va_start (args1, i);
1744 va_copy (args2, args1);
1745 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1747 va_end (args1); va_end (args2);
1749 [f(0, 42); return 0],
1750 [ac_cv_va_copy=yes],
1754 AC_CACHE_CHECK([whether va_list can be copied by value],
1756 [AC_TRY_COMPILE([#include <stdarg.h>
1758 void f (int i, ...) {
1759 va_list args1, args2;
1760 va_start (args1, i);
1762 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1764 va_end (args1); va_end (args2);
1766 [f(0, 42); return 0],
1767 [ac_cv_va_val_copy=yes],
1768 [ac_cv_va_val_copy=no],
1771 if test "x$ac_cv_va_copy" = "xyes"; then
1772 AC_DEFINE(VA_COPY, va_copy)
1773 AC_DEFINE(HAVE_VA_COPY)
1776 if test "x$ac_cv_va_val_copy" = "xno"; then
1777 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
1780 dnl ===================================================================
1781 dnl ========================================================
1782 dnl Put your C++ language/feature checks below
1783 dnl ========================================================
1787 if test "$GNU_CC"; then
1788 if test "$CPU_ARCH" = "arm" ; then
1789 AC_CACHE_CHECK(for ARM EABI,
1793 #if defined(__ARM_EABI__)
1796 #error Not ARM EABI.
1799 ac_cv_gcc_arm_eabi="yes",
1800 ac_cv_gcc_arm_eabi="no")])
1801 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
1803 ARM_ABI_PREFIX=eabi-
1805 ARM_ABI_PREFIX=oabi-
1809 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
1812 dnl Check to see if we can resolve ambiguity with |using|.
1813 AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
1814 ac_cv_cpp_ambiguity_resolving_using,
1815 [AC_TRY_COMPILE(class X {
1816 public: int go(const X&) {return 3;}
1817 int jo(const X&) {return 3;}
1819 class Y : public X {
1820 public: int go(int) {return 2;}
1821 int jo(int) {return 2;}
1823 private: using X::go;
1826 ac_cv_cpp_ambiguity_resolving_using=yes,
1827 ac_cv_cpp_ambiguity_resolving_using=no)])
1828 if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
1829 AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
1832 dnl See if a dynamic_cast to void* gives the most derived object.
1833 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
1834 ac_cv_cpp_dynamic_cast_void_ptr,
1835 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
1836 class Y { int j; public: virtual ~Y() { } };
1837 class Z : public X, public Y { int k; };
1843 return !((((void*)&mdo != (void*)subx) &&
1844 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
1845 (((void*)&mdo != (void*)suby) &&
1846 ((void*)&mdo == dynamic_cast<void*>(suby))));
1848 ac_cv_cpp_dynamic_cast_void_ptr=yes,
1849 ac_cv_cpp_dynamic_cast_void_ptr=no,
1850 ac_cv_cpp_dynamic_cast_void_ptr=no)])
1851 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
1852 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
1856 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
1857 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
1858 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
1860 _SAVE_LDFLAGS=$LDFLAGS
1861 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
1862 AC_CACHE_CHECK(for __thread keyword for TLS variables,
1863 ac_cv_thread_keyword,
1864 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
1865 [return tlsIsMainThread;],
1866 ac_cv_thread_keyword=yes,
1867 ac_cv_thread_keyword=no)])
1868 LDFLAGS=$_SAVE_LDFLAGS
1869 # The custom dynamic linker doesn't support TLS variables
1871 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
1872 # mips builds fail with TLS variables because of a binutils bug.
1874 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
1879 *-android*|*-linuxandroid*)
1886 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
1892 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
1893 if test -n "$MOZ_LINKER"; then
1894 if test "$CPU_ARCH" = arm; then
1895 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
1896 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
1897 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1898 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1902 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
1903 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
1904 dnl Since the linker only understands the sysv ones, no need to build the
1905 dnl gnu style tables anyways.
1906 LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
1909 dnl The custom linker doesn't support text relocations, but NDK >= r6b
1910 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
1911 dnl We however want to avoid these text relocations, and this can be done
1912 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
1913 dnl doesn't contain anything at all, beside placeholders for some sections,
1914 dnl and crtbegin only contains a finalizer function that calls
1915 dnl __cxa_finalize. The custom linker actually takes care of calling
1916 dnl __cxa_finalize when the library doesn't call it itself, which makes it
1917 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
1918 dnl link crtbegin and crtend at all.
1919 if test -n "$MOZ_LINKER" -a "$OS_TARGET" = "Android"; then
1920 AC_CACHE_CHECK([whether the CRT objects have text relocations],
1921 ac_cv_crt_has_text_relocations,
1922 [echo 'int foo() { return 0; }' > conftest.cpp
1923 if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
1924 test -s conftest${DLL_SUFFIX}; then
1925 if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
1926 ac_cv_crt_has_text_relocations=yes
1928 ac_cv_crt_has_text_relocations=no
1931 AC_ERROR([couldn't compile a simple C file])
1934 if test "$ac_cv_crt_has_text_relocations" = yes; then
1935 dnl While we want libraries to skip the CRT files, we don't want
1936 dnl executables to be treated the same way. We thus set the flag
1937 dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
1938 dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
1939 dnl Using LDFLAGS in nspr is safe, since we only really build
1940 dnl libraries there.
1941 DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
1942 NSPR_LDFLAGS="$NSPR_LDFLAGS -nostartfiles"
1946 dnl See if compiler supports some gcc-style attributes
1948 AC_CACHE_CHECK(for __attribute__((always_inline)),
1949 ac_cv_attribute_always_inline,
1950 [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
1952 ac_cv_attribute_always_inline=yes,
1953 ac_cv_attribute_always_inline=no)])
1955 dnl End of C++ language/feature checks
1958 dnl ========================================================
1959 dnl = Internationalization checks
1960 dnl ========================================================
1962 dnl Internationalization and Locale support is different
1963 dnl on various UNIX platforms. Checks for specific i18n
1964 dnl features go here.
1966 dnl check for LC_MESSAGES
1967 AC_CACHE_CHECK(for LC_MESSAGES,
1968 ac_cv_i18n_lc_messages,
1969 [AC_TRY_COMPILE([#include <locale.h>],
1970 [int category = LC_MESSAGES;],
1971 ac_cv_i18n_lc_messages=yes,
1972 ac_cv_i18n_lc_messages=no)])
1973 if test "$ac_cv_i18n_lc_messages" = yes; then
1974 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
1977 AC_HAVE_FUNCS(localeconv)
1979 fi # ! SKIP_COMPILER_CHECKS
1981 if test -n "${COMPILE_ENVIRONMENT}"; then
1986 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1987 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1988 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1991 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1992 dnl features that Windows actually does support.
1994 if test -n "$SKIP_COMPILER_CHECKS"; then
1995 dnl Windows has malloc.h
1996 AC_DEFINE(MALLOC_H, [<malloc.h>])
1997 AC_DEFINE(HAVE_FORCEINLINE)
1998 AC_DEFINE(HAVE_LOCALECONV)
1999 fi # SKIP_COMPILER_CHECKS
2001 dnl Mozilla specific options
2002 dnl ========================================================
2003 dnl The macros used for command line options
2004 dnl are defined in build/autoconf/altoptions.m4.
2006 dnl ========================================================
2008 dnl = Check for external package dependencies
2010 dnl ========================================================
2011 MOZ_ARG_HEADER(External Packages)
2013 case "$OS_TARGET" in
2014 WINNT|Darwin|Android)
2024 dnl ========================================================
2025 dnl system libevent Support
2026 dnl ========================================================
2027 MOZ_ARG_WITH_STRING(system-libevent,
2028 [ --with-system-libevent[=PFX]
2029 Use system libevent [installed at prefix PFX]],
2030 LIBEVENT_DIR=$withval)
2032 _SAVE_CFLAGS=$CFLAGS
2033 _SAVE_LDFLAGS=$LDFLAGS
2035 if test "$LIBEVENT_DIR" = yes; then
2036 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
2037 MOZ_SYSTEM_LIBEVENT=1,
2040 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
2041 MOZ_SYSTEM_LIBEVENT=
2042 elif test -z "$MOZ_SYSTEM_LIBEVENT"; then
2043 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
2044 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
2045 MOZ_CHECK_HEADER(event.h,
2046 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
2047 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
2049 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
2050 AC_CHECK_LIB(event, event_init,
2051 [MOZ_SYSTEM_LIBEVENT=1
2052 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
2053 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
2054 [MOZ_SYSTEM_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
2056 CFLAGS=$_SAVE_CFLAGS
2057 LDFLAGS=$_SAVE_LDFLAGS
2060 AC_SUBST(MOZ_SYSTEM_LIBEVENT)
2062 dnl ========================================================
2063 dnl = If NSS was not detected in the system,
2064 dnl = use the one in the source tree (mozilla/security/nss)
2065 dnl ========================================================
2067 MOZ_ARG_WITH_BOOL(system-nss,
2068 [ --with-system-nss Use system installed NSS],
2071 if test -n "$_USE_SYSTEM_NSS"; then
2072 AM_PATH_NSS(3.28, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
2075 if test -n "$MOZ_SYSTEM_NSS"; then
2076 NSS_LIBS="$NSS_LIBS -lcrmf"
2078 NSS_CFLAGS="-I${DIST}/include/nss"
2079 case "${OS_ARCH}" in
2080 # Only few platforms have been tested with GYP
2081 WINNT|Darwin|Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
2084 AC_MSG_ERROR([building in-tree NSS is not supported on this platform. Use --with-system-nss])
2089 if test -z "$SKIP_LIBRARY_CHECKS"; then
2090 dnl system JPEG support
2091 dnl ========================================================
2092 MOZ_ARG_WITH_STRING(system-jpeg,
2093 [ --with-system-jpeg[=PFX]
2094 Use system libjpeg [installed at prefix PFX]],
2097 _SAVE_CFLAGS=$CFLAGS
2098 _SAVE_LDFLAGS=$LDFLAGS
2100 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
2101 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
2102 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
2104 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
2107 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_SYSTEM_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_SYSTEM_JPEG=)
2110 if test "$MOZ_SYSTEM_JPEG" = 1; then
2111 AC_TRY_COMPILE([ #include <stdio.h>
2112 #include <sys/types.h>
2113 #include <jpeglib.h> ],
2114 [ #if JPEG_LIB_VERSION < $MOZJPEG
2115 #error "Insufficient JPEG library version ($MOZJPEG required)."
2117 #ifndef JCS_EXTENSIONS
2118 #error "libjpeg-turbo JCS_EXTENSIONS required"
2122 AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
2124 CFLAGS=$_SAVE_CFLAGS
2125 LDFLAGS=$_SAVE_LDFLAGS
2128 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_SYSTEM_JPEG" = 1; then
2129 MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
2130 MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
2132 fi # SKIP_LIBRARY_CHECKS
2134 dnl system ZLIB support
2135 dnl ========================================================
2136 MOZ_ZLIB_CHECK([1.2.3])
2138 if test "$MOZ_LINKER" = 1 -a "$MOZ_SYSTEM_ZLIB" != 1; then
2139 AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
2142 if test -z "$SKIP_LIBRARY_CHECKS"; then
2143 dnl system BZIP2 Support
2144 dnl ========================================================
2145 MOZ_ARG_WITH_STRING(system-bz2,
2146 [ --with-system-bz2[=PFX]
2147 Use system libbz2 [installed at prefix PFX]],
2150 _SAVE_CFLAGS=$CFLAGS
2151 _SAVE_LDFLAGS=$LDFLAGS
2153 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
2154 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
2155 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
2157 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
2160 AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_SYSTEM_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
2161 [MOZ_SYSTEM_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
2163 CFLAGS=$_SAVE_CFLAGS
2164 LDFLAGS=$_SAVE_LDFLAGS
2167 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_SYSTEM_BZ2" = 1; then
2168 MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
2169 MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
2172 dnl ========================================================
2173 dnl system PNG Support
2174 dnl ========================================================
2175 MOZ_ARG_WITH_STRING(system-png,
2176 [ --with-system-png[=PFX]
2177 Use system libpng [installed at prefix PFX]],
2180 _SAVE_CFLAGS=$CFLAGS
2181 _SAVE_LDFLAGS=$LDFLAGS
2183 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
2184 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
2185 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
2187 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
2190 AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"],
2191 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
2192 AC_CHECK_LIB(png, png_get_acTL, ,
2193 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
2195 if test "$MOZ_SYSTEM_PNG" = 1; then
2196 AC_TRY_COMPILE([ #include <stdio.h>
2197 #include <sys/types.h>
2199 [ #if PNG_LIBPNG_VER < $MOZPNG
2200 #error "Insufficient libpng version ($MOZPNG required)."
2202 #ifndef PNG_UINT_31_MAX
2203 #error "Insufficient libpng version."
2206 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
2208 CFLAGS=$_SAVE_CFLAGS
2209 LDFLAGS=$_SAVE_LDFLAGS
2212 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then
2213 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
2214 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
2217 fi # SKIP_LIBRARY_CHECKS
2219 dnl ========================================================
2223 dnl ========================================================
2225 MOZ_ARG_HEADER(Application)
2227 ENABLE_SYSTEM_EXTENSION_DIRS=1
2228 MOZ_BRANDING_DIRECTORY=
2229 MOZ_OFFICIAL_BRANDING=
2231 MOZ_AUTH_EXTENSION=1
2232 if test "$MOZ_IOS"; then
2238 MOZ_SAMPLE_TYPE_FLOAT32=
2239 MOZ_SAMPLE_TYPE_S16=
2244 MOZ_WEBRTC_SIGNALING=
2245 MOZ_WEBRTC_ASSERT_ALWAYS=1
2246 MOZ_WEBRTC_HARDWARE_AEC_NS=
2250 MOZ_VPX_ERROR_CONCEALMENT=
2257 LIBJPEG_TURBO_ASFLAGS=
2258 MOZ_PREF_EXTENSIONS=1
2261 MOZ_TOOLKIT_SEARCH=1
2263 MOZ_UNIVERSALCHARDET=1
2269 MOZ_USE_NATIVE_POPUP_WINDOWS=
2270 MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
2271 MOZ_INSTALL_TRACKING=
2274 MOZ_AUDIO_CHANNEL_MANAGER=
2275 MOZ_CONTENT_SANDBOX=
2278 MOZ_BINARY_EXTENSIONS=
2281 case "$target_os" in
2284 AC_DEFINE(NS_ENABLE_TSF)
2289 *-android*|*-linuxandroid*)
2290 MOZ_THEME_FASTSTRIPE=1
2296 # Optional Firefox for Android partner distribution directory.
2297 MOZ_ARG_WITH_STRING(android-distribution-directory,
2298 [ --with-android-distribution-directory=dir
2299 Optional Firefox for Android partner distribution directory.],
2300 MOZ_ANDROID_DISTRIBUTION_DIRECTORY=$withval)
2302 if test -n "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY"; then
2303 # A distribution directory must have an assets/distribution directory.
2304 # See https://wiki.mozilla.org/Mobile/Distribution_Files.
2305 if test ! -d "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY/assets/distribution" ; then
2306 AC_MSG_ERROR([--with-android-distribution-directory does not contain assets/distribution;
2307 (looked for ${MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets/distribution).])
2310 AC_SUBST(MOZ_ANDROID_DISTRIBUTION_DIRECTORY)
2312 dnl ========================================================
2313 dnl = Trademarked Branding
2314 dnl ========================================================
2315 MOZ_ARG_ENABLE_BOOL(official-branding,
2316 [ --enable-official-branding
2317 Enable Official mozilla.org Branding
2318 Do not distribute builds with
2319 --enable-official-branding unless you have
2320 permission to use trademarks per
2321 http://www.mozilla.org/foundation/trademarks/ .],
2322 MOZ_OFFICIAL_BRANDING=1,
2323 MOZ_OFFICIAL_BRANDING=)
2325 # Allow the application to influence configure with a confvars.sh script.
2326 AC_MSG_CHECKING([if app-specific confvars.sh exists])
2327 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
2328 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
2329 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
2334 # Allow influencing configure with a defines.sh script.
2335 . "${srcdir}/build/defines.sh"
2337 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
2339 if test "$BUILDING_RELEASE"; then
2340 # Override value in defines.sh, if any
2341 EARLY_BETA_OR_EARLIER=
2342 elif test "$EARLY_BETA_OR_EARLIER"; then
2343 AC_DEFINE(EARLY_BETA_OR_EARLIER)
2345 AC_SUBST(EARLY_BETA_OR_EARLIER)
2347 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
2348 MOZ_ARG_WITH_STRING(app-name,
2349 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
2350 WITH_APP_NAME=$withval,
2353 if test -n "$WITH_APP_NAME" ; then
2354 MOZ_APP_NAME="$WITH_APP_NAME"
2357 MOZ_ARG_WITH_STRING(app-basename,
2358 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
2359 WITH_APP_BASENAME=$withval,
2362 if test -n "$WITH_APP_BASENAME" ; then
2363 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
2366 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
2367 # that haven't made a confvars.sh yet. Don't add new stuff here, use
2369 case "$MOZ_BUILD_APP" in
2371 AC_DEFINE(MOZ_PHOENIX)
2375 AC_DEFINE(MOZ_XULRUNNER)
2379 if test -n "$MOZ_B2G"; then
2383 # Graphene is a desktop runtime for running applications with a HTML UI.
2384 if test -n "$MOZ_GRAPHENE"; then
2385 AC_DEFINE(MOZ_GRAPHENE)
2388 if test -n "$MOZ_MULET"; then
2389 AC_DEFINE(MOZ_MULET)
2392 # Propagate feature switches for code written in rust from confvars.sh
2393 if test -n "$MOZ_RUST"; then
2394 if test -n "$MOZ_RUST_MP4PARSE"; then
2395 AC_DEFINE(MOZ_RUST_MP4PARSE)
2397 if test -n "$MOZ_RUST_URLPARSE"; then
2398 AC_DEFINE(MOZ_RUST_URLPARSE)
2399 AC_SUBST(MOZ_RUST_URLPARSE)
2403 AC_SUBST(MOZ_PHOENIX)
2404 AC_SUBST(MOZ_XULRUNNER)
2407 AC_SUBST(MOZ_B2G_VERSION)
2409 dnl ========================================================
2410 dnl Ensure Android SDK and build-tools versions depending on
2412 dnl ========================================================
2414 if test -z "$gonkdir" ; then
2415 case "$MOZ_BUILD_APP" in
2417 MOZ_ANDROID_SDK(23, 23.0.3 23.0.1)
2422 dnl ========================================================
2424 dnl = Toolkit Options
2426 dnl ========================================================
2427 MOZ_ARG_HEADER(Toolkit Options)
2429 dnl ========================================================
2430 dnl = Enable the toolkit as needed =
2431 dnl ========================================================
2433 case "$MOZ_WIDGET_TOOLKIT" in
2436 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
2437 # Use -Wl as a trick to avoid -framework and framework names from
2438 # being separated by AC_SUBST_LIST.
2439 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'
2441 CFLAGS="$CFLAGS $TK_CFLAGS"
2442 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
2443 MOZ_USER_DIR="Mozilla"
2444 MOZ_FS_LAYOUT=bundle
2448 LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
2450 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'
2451 CFLAGS="$CFLAGS $TK_CFLAGS"
2452 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
2453 MOZ_USER_DIR="Mozilla"
2454 MOZ_FS_LAYOUT=bundle
2459 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
2460 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
2461 case "$MOZ_WIDGET_TOOLKIT" in
2467 if test "$COMPILE_ENVIRONMENT"; then
2468 if test "$MOZ_WIDGET_TOOLKIT" = gtk3; then
2469 PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
2470 MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
2471 TK_CFLAGS=$MOZ_GTK3_CFLAGS
2472 TK_LIBS=$MOZ_GTK3_LIBS
2473 dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
2474 dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
2475 AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
2476 GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32
2478 if test "$MOZ_WIDGET_TOOLKIT" = gtk2; then
2479 GLIB_VERSION_MAX_ALLOWED=$GLIB_VERSION_MIN_REQUIRED
2481 if test "$MOZ_ENABLE_GTK"; then
2482 if test "$MOZ_X11"; then
2483 GDK_PACKAGES=gdk-x11-2.0
2485 AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
2486 AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
2488 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)
2489 MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
2491 if test "$MOZ_WIDGET_TOOLKIT" = gtk2; then
2492 TK_CFLAGS=$MOZ_GTK2_CFLAGS
2493 TK_LIBS=$MOZ_GTK2_LIBS
2495 fi # COMPILE_ENVIRONMENT
2497 AC_SUBST(MOZ_FS_LAYOUT)
2499 dnl ========================================================
2500 dnl = startup-notification support module
2501 dnl ========================================================
2503 if test "$MOZ_ENABLE_GTK"
2505 MOZ_ENABLE_STARTUP_NOTIFICATION=
2507 MOZ_ARG_ENABLE_BOOL(startup-notification,
2508 [ --enable-startup-notification
2509 Enable startup-notification support (default: disabled) ],
2510 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
2511 MOZ_ENABLE_STARTUP_NOTIFICATION=)
2512 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
2514 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
2515 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
2516 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
2517 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
2519 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
2521 MOZ_ENABLE_STARTUP_NOTIFICATION=
2525 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
2526 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
2529 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
2531 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
2533 AC_SUBST_LIST(TK_CFLAGS)
2534 AC_SUBST_LIST(TK_LIBS)
2539 dnl ========================================================
2541 dnl = Components & Features
2543 dnl ========================================================
2544 MOZ_ARG_HEADER(Components and Features)
2546 dnl ========================================================
2548 dnl ========================================================
2549 MOZ_ARG_ENABLE_STRING(ui-locale,
2550 [ --enable-ui-locale=ab-CD
2551 Select the user interface locale (default: en-US)],
2552 MOZ_UI_LOCALE=$enableval )
2553 AC_SUBST(MOZ_UI_LOCALE)
2555 AC_SUBST(MOZ_OFFICIAL_BRANDING)
2556 if test -n "$MOZ_OFFICIAL_BRANDING"; then
2557 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
2558 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
2560 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
2561 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
2565 MOZ_ARG_WITH_STRING(branding,
2566 [ --with-branding=dir Use branding from the specified directory.],
2567 MOZ_BRANDING_DIRECTORY=$withval)
2569 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
2570 if test -z "$REAL_BRANDING_DIRECTORY"; then
2571 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
2574 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
2575 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
2576 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
2577 . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
2580 AC_SUBST(MOZ_BRANDING_DIRECTORY)
2582 dnl ========================================================
2583 dnl = Distribution ID
2584 dnl ========================================================
2585 MOZ_ARG_WITH_STRING(distribution-id,
2586 [ --with-distribution-id=ID
2587 Set distribution-specific id (default=org.mozilla)],
2588 [ val=`echo $withval`
2589 MOZ_DISTRIBUTION_ID="$val"])
2591 if test -z "$MOZ_DISTRIBUTION_ID"; then
2592 MOZ_DISTRIBUTION_ID="org.mozilla"
2595 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
2596 AC_SUBST(MOZ_DISTRIBUTION_ID)
2599 dnl ========================================================
2600 dnl Google Play Services, placed here so it can depend on
2601 dnl values set by configure.sh above.
2602 dnl ========================================================
2604 MOZ_ANDROID_GOOGLE_PLAY_SERVICES
2605 MOZ_ANDROID_GOOGLE_CLOUD_MESSAGING
2606 MOZ_ANDROID_INSTALL_TRACKING
2609 dnl ========================================================
2610 dnl = GIO and GConf support module
2611 dnl ========================================================
2615 dnl build the GIO extension by default only when the
2616 dnl GTK2 toolkit is in use.
2617 if test "$MOZ_ENABLE_GTK"
2623 dnl ========================================================
2624 dnl = GIO support module
2625 dnl ========================================================
2626 MOZ_ARG_DISABLE_BOOL(gio,
2627 [ --disable-gio Disable GIO support],
2629 MOZ_ENABLE_GIO=force)
2631 if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK"
2633 if test "$MOZ_WIDGET_TOOLKIT" = gtk2
2635 PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
2636 [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
2638 PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
2639 MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
2641 AC_DEFINE(MOZ_ENABLE_GIO)
2643 if test "$MOZ_ENABLE_GIO" = "force"
2645 AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
2651 AC_SUBST(MOZ_ENABLE_GIO)
2653 dnl ========================================================
2654 dnl = GConf support module
2655 dnl ========================================================
2656 MOZ_ARG_DISABLE_BOOL(gconf,
2657 [ --disable-gconf Disable Gconf support ],
2661 if test "$MOZ_ENABLE_GCONF"
2663 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
2664 MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
2667 if test -n "$MOZ_ENABLE_GCONF";
2669 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
2671 AC_MSG_WARN([Many automated tests will fail with --disable-gconf. See bug 1167201.])
2676 if test "$MOZ_ENABLE_GCONF"; then
2677 AC_DEFINE(MOZ_ENABLE_GCONF)
2680 AC_SUBST(MOZ_ENABLE_GCONF)
2683 dnl ========================================================
2684 dnl = libproxy support
2685 dnl ========================================================
2687 if test "$MOZ_ENABLE_GTK"
2689 MOZ_ENABLE_LIBPROXY=
2691 MOZ_ARG_ENABLE_BOOL(libproxy,
2692 [ --enable-libproxy Enable libproxy support ],
2693 MOZ_ENABLE_LIBPROXY=1,
2694 MOZ_ENABLE_LIBPROXY=)
2696 if test "$MOZ_ENABLE_LIBPROXY"
2698 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
2699 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
2702 AC_SUBST(MOZ_ENABLE_LIBPROXY)
2704 dnl ========================================================
2705 dnl = libgnomeui support module
2706 dnl ========================================================
2708 if test "$MOZ_ENABLE_GTK"
2710 MOZ_ARG_ENABLE_BOOL(gnomeui,
2711 [ --enable-gnomeui Enable libgnomeui instead of GIO & GTK for icon theme support ],
2712 MOZ_ENABLE_GNOMEUI=force,
2713 MOZ_ENABLE_GNOMEUI=)
2715 if test "$MOZ_ENABLE_GNOMEUI"
2717 PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
2719 MOZ_ENABLE_GNOMEUI=1
2721 if test "$MOZ_ENABLE_GNOMEUI" = "force"
2723 AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
2729 if test "$MOZ_ENABLE_GNOMEUI"; then
2730 AC_DEFINE(MOZ_ENABLE_GNOMEUI)
2734 AC_SUBST(MOZ_ENABLE_GNOMEUI)
2736 dnl ========================================================
2738 dnl ========================================================
2740 if test "$MOZ_ENABLE_GTK"
2744 MOZ_ARG_DISABLE_BOOL(dbus,
2745 [ --disable-dbus Disable dbus support ],
2749 if test "$MOZ_ENABLE_DBUS"
2751 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
2752 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
2753 AC_DEFINE(MOZ_ENABLE_DBUS)
2756 AC_SUBST(MOZ_ENABLE_DBUS)
2758 dnl =========================================================
2759 dnl = Whether to exclude hyphenations files in the build
2760 dnl =========================================================
2761 if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
2762 AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
2765 dnl ========================================================
2766 dnl = Include install tracking on Android
2767 dnl ========================================================
2768 if test -n "$MOZ_INSTALL_TRACKING"; then
2769 if test -z "$MOZ_ADJUST_SDK_KEY"; then
2770 AC_MSG_ERROR([Must specify --with-adjust-sdk-keyfile when MOZ_INSTALL_TRACKING is defined!])
2774 dnl ========================================================
2775 dnl accessibility support on by default on all platforms
2776 dnl ========================================================
2777 MOZ_ARG_DISABLE_BOOL(accessibility,
2778 [ --disable-accessibility Disable accessibility support],
2781 if test "$ACCESSIBILITY"; then
2784 if test -z "$MIDL"; then
2785 if test "$GCC" != "yes"; then
2786 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
2788 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.])
2792 AC_DEFINE(ACCESSIBILITY)
2795 dnl ========================================================
2796 dnl Accessibility is required for the linuxgl widget
2798 dnl ========================================================
2799 if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
2800 AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
2803 dnl Turn off webrtc for OS's we don't handle yet, but allow
2804 dnl --enable-webrtc to override. Can disable for everything in
2805 dnl the master list above.
2806 if test -n "$MOZ_WEBRTC"; then
2808 *-linux*|*-mingw*|*-darwin*|*-android*|*-linuxandroid*|*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*)
2812 dnl default to disabled for all others
2818 AC_TRY_COMPILE([#include <linux/ethtool.h>],
2819 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
2820 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
2822 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
2824 # target_arch is from {ia32|x64|arm|ppc}
2826 x86_64 | arm | aarch64 | x86 | ppc* | ia64)
2830 # unsupported arch for webrtc
2836 dnl ========================================================
2837 dnl = Disable WebRTC code
2838 dnl ========================================================
2839 MOZ_ARG_DISABLE_BOOL(webrtc,
2840 [ --disable-webrtc Disable support for WebRTC],
2844 if test -n "$MOZ_WEBRTC"; then
2845 AC_DEFINE(MOZ_WEBRTC)
2846 dnl MOZ_WEBRTC_ASSERT_ALWAYS turns on a number of safety asserts in
2847 dnl opt/production builds (via MOZ_CRASH())
2848 AC_DEFINE(MOZ_WEBRTC_ASSERT_ALWAYS)
2850 MOZ_VPX_ERROR_CONCEALMENT=1
2852 dnl enable once Signaling lands
2853 MOZ_WEBRTC_SIGNALING=1
2854 AC_DEFINE(MOZ_WEBRTC_SIGNALING)
2855 dnl enable once PeerConnection lands
2856 MOZ_PEERCONNECTION=1
2857 AC_DEFINE(MOZ_PEERCONNECTION)
2862 if test -n "$MOZ_X11"; then
2863 MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
2869 dnl ========================================================
2870 dnl = Force hardware AEC, disable webrtc.org AEC
2871 dnl ========================================================
2872 MOZ_ARG_ENABLE_BOOL(hardware-aec-ns,
2873 [ --enable-hardware-aec-ns Enable support for hardware AEC and noise suppression],
2874 MOZ_WEBRTC_HARDWARE_AEC_NS=1,
2875 MOZ_WEBRTC_HARDWARE_AEC_NS=)
2877 if test -n "$MOZ_WEBRTC_HARDWARE_AEC_NS"; then
2878 AC_DEFINE(MOZ_WEBRTC_HARDWARE_AEC_NS)
2881 AC_SUBST(MOZ_WEBRTC)
2882 AC_SUBST(MOZ_WEBRTC_SIGNALING)
2883 AC_SUBST(MOZ_PEERCONNECTION)
2884 AC_SUBST(MOZ_WEBRTC_ASSERT_ALWAYS)
2885 AC_SUBST(MOZ_WEBRTC_HARDWARE_AEC_NS)
2888 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
2890 dnl Use integers over floats for audio on B2G and Android
2891 dnl (regarless of the CPU architecture, because audio
2892 dnl backends for those platforms don't support floats. We also
2893 dnl use integers on ARM with other OS, because it's more efficient.
2894 if test "$OS_TARGET" = "Android" -o "$CPU_ARCH" = "arm"; then
2895 MOZ_SAMPLE_TYPE_S16=1
2896 AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
2897 AC_SUBST(MOZ_SAMPLE_TYPE_S16)
2899 MOZ_SAMPLE_TYPE_FLOAT32=1
2900 AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
2901 AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
2904 dnl ========================================================
2905 dnl = Enable Raw Codecs
2906 dnl ========================================================
2907 MOZ_ARG_ENABLE_BOOL(raw,
2908 [ --enable-raw Enable support for RAW media],
2912 if test -n "$MOZ_RAW"; then
2918 dnl ========================================================
2919 dnl = Apple platform decoder support
2920 dnl ========================================================
2921 if test "$COMPILE_ENVIRONMENT"; then
2922 if test -n "$MOZ_APPLEMEDIA"; then
2923 # hack in frameworks for fmp4 - see bug 1029974
2924 # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
2925 LDFLAGS="$LDFLAGS -framework AudioToolbox"
2926 dnl Verify CoreMedia is available.
2927 AC_CHECK_HEADER([CoreMedia/CoreMedia.h], [],
2928 [AC_MSG_ERROR([MacOS X 10.7 SDK or later is required])])
2930 fi # COMPILE_ENVIRONMENT
2932 dnl ========================================================
2933 dnl = DirectShow support
2934 dnl ========================================================
2935 if test "$OS_ARCH" = "WINNT"; then
2936 dnl Enable DirectShow support by default.
2940 MOZ_ARG_DISABLE_BOOL(directshow,
2941 [ --disable-directshow Disable support for DirectShow],
2945 if test -n "$MOZ_DIRECTSHOW"; then
2946 AC_DEFINE(MOZ_DIRECTSHOW)
2949 dnl ========================================================
2950 dnl = Built-in fragmented MP4 support.
2951 dnl ========================================================
2953 if test x"$MOZ_WIDGET_TOOLKIT" = x"gonk" -a -n "$MOZ_FMP4" -a -n "$android_version"; then
2954 # we now know for sure that $android_version is not an empty string!
2955 if test "$android_version" -ge "18"; then
2956 MOZ_GONK_MEDIACODEC=1
2957 AC_SUBST(MOZ_GONK_MEDIACODEC)
2962 dnl ========================================================
2963 dnl = Enable media plugin support
2964 dnl ========================================================
2965 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
2966 dnl Enable support on android by default
2970 MOZ_ARG_ENABLE_BOOL(android-omx,
2971 [ --enable-android-omx Enable support for Android OMX media backend],
2975 if test -n "$MOZ_ANDROID_OMX"; then
2976 AC_DEFINE(MOZ_ANDROID_OMX)
2979 dnl ========================================================
2980 dnl = Enable building OMX media plugin (B2G or Android)
2981 dnl ========================================================
2982 if test "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
2983 dnl Enable support on android by default
2987 MOZ_ARG_ENABLE_BOOL(omx-plugin,
2988 [ --enable-omx-plugin Enable building OMX plugin (B2G)],
2992 if test -n "$MOZ_OMX_PLUGIN"; then
2993 if test "$OS_TARGET" = "Android"; then
2994 dnl Only allow building OMX plugin on Gonk (B2G) or Android
2995 AC_DEFINE(MOZ_OMX_PLUGIN)
2997 dnl fail if we're not building on Gonk or Android
2998 AC_MSG_ERROR([OMX media plugin can only be built on B2G or Android])
3002 dnl system libvpx Support
3003 dnl ========================================================
3004 MOZ_ARG_WITH_BOOL(system-libvpx,
3005 [ --with-system-libvpx Use system libvpx (located with pkgconfig)],
3006 MOZ_SYSTEM_LIBVPX=1)
3011 if test -n "$MOZ_VPX_ERROR_CONCEALMENT" ; then
3012 AC_DEFINE(MOZ_VPX_ERROR_CONCEALMENT)
3015 _SAVE_CFLAGS=$CFLAGS
3017 if test -n "$MOZ_SYSTEM_LIBVPX"; then
3018 dnl ============================
3019 dnl === libvpx Version check ===
3020 dnl ============================
3021 dnl Check to see if we have a system libvpx package.
3022 PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.5.0)
3024 CFLAGS="$CFLAGS $MOZ_LIBVPX_CFLAGS"
3025 LIBS="$LIBS $MOZ_LIBVPX_LIBS"
3027 MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
3028 [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.])])
3030 AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
3031 [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
3033 MOZ_CHECK_HEADER([vpx_mem/vpx_mem.h],
3034 [AC_CHECK_FUNC(vpx_mem_set_functions)])
3035 if test "$ac_cv_header_vpx_mem_vpx_mem_h" = no -o \
3036 "$ac_cv_func_vpx_mem_set_functions" = no; then
3037 AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
3040 CFLAGS=$_SAVE_CFLAGS
3043 AC_SUBST(MOZ_SYSTEM_LIBVPX)
3044 AC_SUBST_LIST(MOZ_LIBVPX_CFLAGS)
3045 AC_SUBST_LIST(MOZ_LIBVPX_LIBS)
3047 if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
3053 if test -z "$MOZ_SYSTEM_LIBVPX"; then
3055 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
3056 dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
3057 dnl We currently require gcc on all arm platforms.
3059 dnl See if we have assembly on this platform.
3060 case "$OS_ARCH:$CPU_ARCH" in
3074 dnl Check for yasm 1.1 or greater.
3075 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
3076 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.])
3077 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
3078 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.])
3082 dnl The encoder needs obj_int_extract to get asm offsets.
3083 fi # COMPILE_ENVIRONMENT and others
3086 if test -n "$GNU_AS" ; then
3087 dnl These flags are a lie; they're just used to enable the requisite
3088 dnl opcodes; actual arch detection is done at runtime.
3089 VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
3090 VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
3092 dnl Building with -mfpu=neon requires either the "softfp" or the
3093 dnl "hardfp" ABI. Depending on the compiler's default target, and the
3094 dnl CFLAGS, the default ABI might be neither, in which case it is the
3095 dnl "softfloat" ABI.
3096 dnl The "softfloat" ABI is binary-compatible with the "softfp" ABI, so
3097 dnl we can safely mix code built with both ABIs. So, if we detect
3098 dnl that compiling uses the "softfloat" ABI, force the use of the
3099 dnl "softfp" ABI instead.
3100 dnl Confusingly, the __SOFTFP__ preprocessor variable indicates the
3101 dnl "softfloat" ABI, not the "softfp" ABI.
3102 dnl Note: VPX_ASFLAGS is also used in CFLAGS.
3105 #error "compiler target supports -mfpu=neon, so we don't have to add extra flags"
3107 VPX_ASFLAGS="$VPX_ASFLAGS -mfloat-abi=softfp"
3112 if $CC -E -dM -</dev/null | grep -q __ELF__; then
3118 if $CC -E -dM -</dev/null | grep -q __ELF__; then
3125 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_USE_YASM" -a -z "$YASM"; then
3126 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.])
3127 fi # COMPILE_ENVIRONMENT and others
3129 if test -n "$VPX_USE_YASM" && test "$OS_ARCH:$CPU_ARCH" != "WINNT:x86_64"; then
3133 if test -n "$VPX_X86_ASM"; then
3134 AC_DEFINE(VPX_X86_ASM)
3135 elif test -n "$VPX_ARM_ASM"; then
3136 AC_DEFINE(VPX_ARM_ASM)
3138 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
3141 dnl native libvpx no longer has vpx_mem_set_functions
3142 AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
3145 dnl ========================================================
3146 dnl = Handle dependent MEDIA defines
3147 dnl ========================================================
3149 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
3150 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/])
3153 if test -n "$MOZ_VORBIS"; then
3154 AC_DEFINE(MOZ_VORBIS)
3157 if test -n "$MOZ_TREMOR"; then
3158 AC_DEFINE(MOZ_TREMOR)
3162 AC_DEFINE(MOZ_WEBM_ENCODER)
3163 AC_SUBST(MOZ_WEBM_ENCODER)
3165 dnl ==================================
3166 dnl = Check alsa availability on Linux
3167 dnl ==================================
3169 MOZ_ARG_ENABLE_BOOL(alsa,
3170 [ --enable-alsa Enable Alsa support],
3174 if test -n "$MOZ_ALSA"; then
3175 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
3176 [echo "$MOZ_ALSA_PKG_ERRORS"
3177 AC_MSG_ERROR([Need alsa for audio output on Linux. (On Ubuntu, you might try installing the package libasound2-dev.)])])
3182 dnl ========================================================
3183 dnl = Disable PulseAudio
3184 dnl ========================================================
3186 dnl If using Desktop Linux, ensure that the PA library is available
3187 case "$OS_TARGET" in
3188 WINNT|Darwin|Android|OpenBSD)
3195 MOZ_ARG_DISABLE_BOOL(pulseaudio,
3196 [ --disable-pulseaudio Disable PulseAudio support],
3200 if test -n "$MOZ_PULSEAUDIO"; then
3201 AC_DEFINE(MOZ_PULSEAUDIO)
3202 if test -z "$gonkdir"; then
3203 PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
3204 [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
3205 AC_MSG_ERROR([pulseaudio audio backend requires libpulse development package])])
3207 MOZ_PULSEAUDIO_CFLAGS="-I$gonkdir/external/pulseaudio/pulseaudio/src"
3211 AC_SUBST(MOZ_PULSEAUDIO)
3213 dnl ========================================================
3215 dnl ========================================================
3217 MOZ_ARG_DISABLE_BOOL(negotiateauth,
3218 [ --disable-negotiateauth Disable GSS-API negotiation ],
3219 MOZ_AUTH_EXTENSION=,
3220 MOZ_AUTH_EXTENSION=1 )
3222 if test -n "$MOZ_IOS" -a -n "$MOZ_AUTH_EXTENSION"; then
3223 AC_MSG_ERROR([negotiateauth is not supported on iOS.])
3226 dnl ========================================================
3227 dnl Pref extensions (autoconfig)
3228 dnl ========================================================
3229 MOZ_ARG_DISABLE_BOOL(pref-extensions,
3230 [ --disable-pref-extensions
3231 Disable pref extensions such as autoconfig],
3232 MOZ_PREF_EXTENSIONS=,
3233 MOZ_PREF_EXTENSIONS=1 )
3235 dnl ========================================================
3236 dnl Searching of system directories for extensions.
3237 dnl Note: this switch is meant to be used for test builds
3238 dnl whose behavior should not depend on what happens to be
3239 dnl installed on the local machine.
3240 dnl ========================================================
3241 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
3242 [ --disable-system-extension-dirs
3243 Disable searching system- and account-global
3244 directories for extensions of any kind; use
3245 only profile-specific extension directories],
3246 ENABLE_SYSTEM_EXTENSION_DIRS=,
3247 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
3248 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
3249 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
3252 dnl ========================================================
3253 dnl = Universalchardet
3254 dnl ========================================================
3255 MOZ_ARG_DISABLE_BOOL(universalchardet,
3256 [ --disable-universalchardet
3257 Disable universal encoding detection],
3258 MOZ_UNIVERSALCHARDET=,
3259 MOZ_UNIVERSALCHARDET=1 )
3261 dnl ========================================================
3262 dnl = ANGLE OpenGL->D3D translator for WebGL
3263 dnl = * only applies to win32
3264 dnl ========================================================
3268 MOZ_HAS_WINSDK_WITH_D3D=
3269 MOZ_D3DCOMPILER_VISTA_DLL=
3270 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
3272 if test "$COMPILE_ENVIRONMENT" ; then
3273 case "$target_os" in
3275 MOZ_ANGLE_RENDERER=1
3279 # The DirectX SDK libraries are split into x86 and x64 sub-directories
3280 case "${target_cpu}" in
3282 MOZ_D3D_CPU_SUFFIX=x86
3285 MOZ_D3D_CPU_SUFFIX=x64
3289 # This is potentially set in external mozconfig files; if it's set,
3290 # then the build exposes the "webgl" context name, which is reserved
3291 # for conformant implementations.
3292 if test -n "$MOZ_WEBGL_CONFORMANT"; then
3293 AC_DEFINE(MOZ_WEBGL_CONFORMANT)
3296 dnl ========================================================
3297 dnl D3D compiler DLL
3298 dnl ========================================================
3299 MOZ_FOUND_D3D_COMPILERS=
3301 if test -n "$MOZ_ANGLE_RENDERER"; then
3302 if test -z "$MOZ_D3D_CPU_SUFFIX"; then
3303 AC_MSG_ERROR([Couldn't determine MOZ_D3D_CPU_SUFFIX.])
3306 ######################################
3307 # Find _46+ for use by Vista+.
3309 # Find a D3D compiler DLL in a Windows SDK.
3310 MOZ_D3DCOMPILER_VISTA_DLL=
3311 case "$MOZ_WINSDK_MAXVER" in
3313 MOZ_D3DCOMPILER_VISTA_DLL=d3dcompiler_47.dll
3314 AC_MSG_RESULT([Found D3D compiler in Windows SDK.])
3318 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
3319 # We have a name, now track down the path.
3320 if test -n "$WINDOWSSDKDIR"; then
3321 MOZ_D3DCOMPILER_VISTA_DLL_PATH="$WINDOWSSDKDIR/Redist/D3D/$MOZ_D3D_CPU_SUFFIX/$MOZ_D3DCOMPILER_VISTA_DLL"
3322 if test -f "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
3323 AC_MSG_RESULT([Found MOZ_D3DCOMPILER_VISTA_DLL_PATH: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
3324 MOZ_HAS_WINSDK_WITH_D3D=1
3326 AC_MSG_RESULT([MOZ_D3DCOMPILER_VISTA_DLL_PATH doesn't exist: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
3327 AC_MSG_ERROR([Windows SDK at "$WINDOWSSDKDIR" appears broken. Try updating to MozillaBuild 1.9 final or higher.])
3328 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
3331 AC_MSG_RESULT([Windows SDK not found.])
3334 AC_MSG_ERROR([Couldn't find Windows SDK 8.1 or higher needed for ANGLE.])
3337 if test -z "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
3338 MOZ_D3DCOMPILER_VISTA_DLL=
3341 # On mingw, check if headers are provided by toolchain.
3342 if test -n "$GNU_CC"; then
3343 MOZ_CHECK_HEADER(d3d10.h, MOZ_HAS_WINSDK_WITH_D3D=1)
3346 ######################################
3347 # Check that we found what we needed.
3348 MOZ_FOUND_A_D3D_COMPILER=
3350 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
3351 MOZ_FOUND_A_D3D_COMPILER=1
3352 AC_MSG_RESULT([Found d3dcompiler DLL for Vista+: $MOZ_D3DCOMPILER_VISTA_DLL])
3355 if test -z "$CROSS_COMPILE"; then
3356 if test -z "MOZ_FOUND_A_D3D_COMPILER"; then
3357 AC_MSG_ERROR([Couldn't find an acceptable D3D compiler DLL.])
3360 fi # MOZ_ANGLE_RENDERER
3362 fi # COMPILE_ENVIRONMENT
3365 dnl ========================================================
3367 dnl ========================================================
3368 MOZ_GAMEPAD_BACKEND=stub
3370 case "$OS_TARGET" in
3372 if test -z "$MOZ_IOS"; then
3373 MOZ_GAMEPAD_BACKEND=cocoa
3377 MOZ_GAMEPAD_BACKEND=windows
3380 MOZ_CHECK_HEADER([linux/joystick.h])
3381 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
3382 AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
3384 MOZ_GAMEPAD_BACKEND=linux
3387 MOZ_GAMEPAD_BACKEND=android
3393 AC_SUBST(MOZ_GAMEPAD_BACKEND)
3395 dnl ========================================================
3396 dnl = Breakpad crash reporting (on by default on supported platforms)
3397 dnl ========================================================
3400 i?86-*-mingw*|x86_64-*-mingw*)
3403 i?86-apple-darwin*|x86_64-apple-darwin*)
3404 if test -z "$MOZ_IOS"; then
3408 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
3409 if test "$MOZ_ENABLE_GTK"; then
3413 *-android*|*-linuxandroid*)
3418 MOZ_ARG_DISABLE_BOOL(crashreporter,
3419 [ --disable-crashreporter Disable breakpad crash reporting],
3420 [MOZ_CRASHREPORTER=],
3421 [MOZ_CRASHREPORTER=F # Force enable breakpad])
3423 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin"; then
3424 if test "$MOZ_CRASHREPORTER" = F; then
3425 AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
3430 if test -n "$MOZ_CRASHREPORTER"; then
3431 AC_DEFINE(MOZ_CRASHREPORTER)
3433 if test "$OS_TARGET" = "Linux" && \
3434 test -z "$SKIP_LIBRARY_CHECKS"; then
3435 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
3438 if test "$OS_ARCH" = "WINNT"; then
3439 if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
3440 MOZ_CRASHREPORTER_INJECTOR=1
3441 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
3446 MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
3447 [ --with-crashreporter-enable-percent=NN
3448 Enable sending crash reports by default on NN% of users. (default=100)],
3449 [ val=`echo $withval | sed 's/[^0-9]//g'`
3450 MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
3452 if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
3453 MOZ_CRASHREPORTER_ENABLE_PERCENT=100
3455 AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
3457 dnl ========================================================
3458 dnl = libjpeg-turbo configuration
3459 dnl ========================================================
3461 LIBJPEG_TURBO_USE_YASM=
3462 if test -z "$MOZ_SYSTEM_JPEG"; then
3466 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
3467 [ --disable-libjpeg-turbo Disable optimized jpeg decoding routines],
3469 MOZ_LIBJPEG_TURBO=1)
3471 if test "$MOZ_SYSTEM_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
3472 AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
3475 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
3478 if test -n "$MOZ_LIBJPEG_TURBO" -a -n "$COMPILE_ENVIRONMENT"; then
3480 dnl Do we support libjpeg-turbo on this platform?
3481 case "$OS_ARCH:$CPU_ARCH" in
3483 LIBJPEG_TURBO_ASFLAGS="-DPIC -DMACHO"
3486 LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DMACHO"
3491 LIBJPEG_TURBO_ASFLAGS="-DPIC -DWIN32"
3494 LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DWIN64 -DMSVC"
3497 LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
3500 LIBJPEG_TURBO_ASFLAGS="-march=armv8-a"
3503 LIBJPEG_TURBO_ASFLAGS="-mdspr2"
3506 if $CC -E -dM -</dev/null | grep -q __ELF__; then
3507 LIBJPEG_TURBO_ASFLAGS="-DPIC -DELF"
3511 if $CC -E -dM -</dev/null | grep -q __ELF__; then
3512 LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DELF"
3518 if test -n "$LIBJPEG_TURBO_ASFLAGS"; then
3520 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
3521 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
3522 dnl it doesn't exist or we have too old of a version.
3524 LIBJPEG_TURBO_USE_YASM=1
3526 if test -z "$YASM" ; then
3527 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.])
3530 dnl Check that we have the right yasm version. We require 1.0.1 or newer
3531 dnl on Linux and 1.1 or newer everywhere else.
3532 if test "$OS_ARCH" = "Linux" ; then
3533 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
3534 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.])
3537 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
3538 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.])
3545 dnl ========================================================
3546 dnl = libav-fft configuration
3547 dnl ========================================================
3551 dnl Turn on libav-fft for 32-bit windows, and all 64-bit supported platforms.
3552 dnl 32-bit linux/os x have text relocation issues.
3554 case "$OS_ARCH:$CPU_ARCH" in
3563 dnl Detect if we can use yasm to compile libav's assembly
3565 if test -n "$MOZ_LIBAV_FFT" -a -n "$COMPILE_ENVIRONMENT"; then
3566 AC_DEFINE(MOZ_LIBAV_FFT)
3567 dnl Do we support libav-fft on this platform?
3568 case "$OS_ARCH:$CPU_ARCH" in
3570 LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DMACHO"
3573 LIBAV_FFT_ASFLAGS="-DPIC -DWIN32"
3576 LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DWIN64 -DMSVC"
3579 if $CC -E -dM -</dev/null | grep -q __ELF__; then
3580 LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DELF"
3584 AC_MSG_ERROR([libav's FFT routines are only available for 32-bit windows or 64-bit x86 based platforms.])
3589 if test -n "$LIBAV_FFT_ASFLAGS"; then
3590 dnl If we're on an x86 or x64 system which supports libav-fft's asm routines
3591 dnl check for Yasm, and error out if it doesn't exist or we have too old of a
3593 if test -z "$YASM" ; then
3594 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.])
3596 dnl Check that we have the right yasm version. We require 1.0.1 or newer
3597 dnl on Linux and 1.1 or newer everywhere else.
3598 if test "$OS_ARCH" = "Linux" ; then
3599 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
3600 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.])
3603 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
3604 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.])
3607 elif test -n "$MOZ_LIBAV_FFT" -a "${CPU_ARCH}" != "arm"; then
3608 dnl Warn if we're not building either libav or opendl-max optimized routines.
3609 AC_MSG_WARN([No assembler or assembly support for libav-fft. Using unoptimized C routines.])
3612 dnl ========================================================
3613 dnl = FFmpeg's ffvpx configuration
3614 dnl ========================================================
3626 dnl Use same conditional as MOZ_LIBAV_FFT to enable FFmpeg's ffvpx assembly decoder.
3627 if test -n "$MOZ_LIBAV_FFT"; then
3628 FFVPX_ASFLAGS=$LIBAV_FFT_ASFLAGS
3630 if test -n "$MOZ_FFVPX"; then
3631 AC_DEFINE(MOZ_FFVPX)
3634 dnl ========================================================
3635 dnl = Enable compilation of specific extension modules
3636 dnl ========================================================
3638 MOZ_ARG_ENABLE_STRING(extensions,
3639 [ --enable-extensions Enable extensions],
3640 [ for option in `echo $enableval | sed 's/,/ /g'`; do
3641 if test "$option" = "yes" -o "$option" = "all"; then
3642 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
3643 elif test "$option" = "no" -o "$option" = "none"; then
3645 elif test "$option" = "default"; then
3646 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
3647 elif test `echo "$option" | grep -c \^-` != 0; then
3648 option=`echo $option | sed 's/^-//'`
3649 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
3651 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
3654 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
3656 if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
3657 # Suppress warning on non-X11 platforms
3658 if test -n "$MOZ_X11"; then
3659 AC_MSG_WARN([Removing gio from MOZ_EXTENSIONS due to --disable-gio.])
3661 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
3664 if test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
3666 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
3668 AC_SUBST(MOZ_GIO_COMPONENT)
3670 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
3671 dnl when trying to build a nonexistent extension.
3672 for extension in $MOZ_EXTENSIONS; do
3673 if test ! -d "${srcdir}/extensions/${extension}"; then
3674 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
3678 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
3679 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
3682 if test -n "$MOZ_TREE_FREETYPE"; then
3683 MOZ_ENABLE_CAIRO_FT=1
3684 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
3685 CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
3686 AC_SUBST_LIST(CAIRO_FT_CFLAGS)
3689 AC_CHECK_PROGS(WGET, wget, "")
3692 dnl ========================================================
3693 dnl Maintenance Service
3694 dnl ========================================================
3696 MOZ_ARG_ENABLE_BOOL(maintenance-service,
3697 [ --enable-maintenance-service Enable building of maintenanceservice],
3698 MOZ_MAINTENANCE_SERVICE=1,
3699 MOZ_MAINTENANCE_SERVICE= )
3701 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
3702 if test "$OS_ARCH" = "WINNT"; then
3703 AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
3705 AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
3709 dnl ========================================================
3710 dnl Bundled fonts on desktop platforms
3711 dnl ========================================================
3713 MOZ_ARG_ENABLE_BOOL(bundled-fonts,
3714 [ --enable-bundled-fonts Enable support for bundled fonts on desktop platforms],
3715 MOZ_BUNDLED_FONTS=1,
3718 if test -n "$MOZ_BUNDLED_FONTS"; then
3719 AC_DEFINE(MOZ_BUNDLED_FONTS)
3722 dnl ========================================================
3723 dnl Verify MAR signatures
3724 dnl ========================================================
3726 MOZ_ARG_ENABLE_BOOL(verify-mar,
3727 [ --enable-verify-mar Enable verifying MAR signatures],
3728 MOZ_VERIFY_MAR_SIGNATURE=1,
3729 MOZ_VERIFY_MAR_SIGNATURE= )
3731 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
3732 AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
3735 dnl ========================================================
3736 dnl Enable building the signmar program.
3737 dnl This option is much different than the --enable-verify-mar option.
3738 dnl --enable-verify-mar is for enabling the verification check on MAR
3739 dnl files in the updater. The --enable-signmar option is for building
3740 dnl the signmar program.
3741 dnl ========================================================
3743 MOZ_ARG_ENABLE_BOOL(signmar,
3744 [ --enable-signmar Enable building the signmar program],
3745 MOZ_ENABLE_SIGNMAR=1,
3746 MOZ_ENABLE_SIGNMAR= )
3748 if test -n "$MOZ_ENABLE_SIGNMAR"; then
3749 if test -z "$COMPILE_ENVIRONMENT" ; then
3750 AC_MSG_WARN([Cannot --enable-signmar with --disable-compile-environment])
3753 AC_DEFINE(MOZ_ENABLE_SIGNMAR)
3757 dnl ========================================================
3759 dnl ========================================================
3761 if test "$MOZ_IOS"; then
3765 MOZ_ARG_DISABLE_BOOL(updater,
3766 [ --disable-updater Disable building of updater],
3770 if test -n "$MOZ_UPDATER"; then
3771 AC_DEFINE(MOZ_UPDATER)
3774 dnl ========================================================
3775 dnl parental controls (for Windows Vista)
3776 dnl ========================================================
3777 MOZ_ARG_DISABLE_BOOL(parental-controls,
3778 [ --disable-parental-controls
3779 Do not build parental controls],
3780 MOZ_DISABLE_PARENTAL_CONTROLS=1,
3781 MOZ_DISABLE_PARENTAL_CONTROLS=)
3782 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
3783 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
3786 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
3788 dnl ========================================================
3789 dnl = Disable smartcard support
3790 dnl ========================================================
3791 if test -n "$MOZ_NO_SMART_CARDS"; then
3792 AC_DEFINE(MOZ_NO_SMART_CARDS)
3794 AC_SUBST(MOZ_NO_SMART_CARDS)
3796 dnl ========================================================
3797 dnl = Sandboxing support
3798 dnl ========================================================
3799 if test -n "$MOZ_TSAN" -o -n "$MOZ_ASAN"; then
3800 # Bug 1182565: TSan conflicts with sandboxing on Linux.
3801 # Bug 1287971: LSan also conflicts with sandboxing on Linux.
3809 MOZ_ARG_DISABLE_BOOL(sandbox,
3810 [ --disable-sandbox Disable sandboxing support],
3814 dnl ========================================================
3815 dnl = Content process sandboxing
3816 dnl ========================================================
3817 if test -n "$gonkdir"; then
3818 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3821 case "$OS_TARGET:$NIGHTLY_BUILD" in
3823 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3826 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3831 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3837 MOZ_ARG_ENABLE_BOOL(content-sandbox,
3838 [ --enable-content-sandbox Enable sandboxing support for content-processes
3839 --disable-content-sandbox Disable sandboxing support for content-processes],
3840 MOZ_CONTENT_SANDBOX=1,
3841 MOZ_CONTENT_SANDBOX=)
3843 if test -n "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_SANDBOX"; then
3844 AC_MSG_ERROR([--enable-content-sandbox and --disable-sandbox are conflicting options])
3847 if test -n "$MOZ_CONTENT_SANDBOX"; then
3848 AC_DEFINE(MOZ_CONTENT_SANDBOX)
3851 AC_SUBST(MOZ_CONTENT_SANDBOX)
3853 dnl ========================================================
3854 dnl = Gecko Media Plugin sandboxing
3855 dnl ========================================================
3858 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3863 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3868 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3872 if test -n "$MOZ_GMP_SANDBOX"; then
3873 AC_DEFINE(MOZ_GMP_SANDBOX)
3876 AC_SUBST(MOZ_GMP_SANDBOX)
3878 if test -z "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_GMP_SANDBOX"; then
3882 if test -n "$MOZ_SANDBOX"; then
3883 AC_DEFINE(MOZ_SANDBOX)
3886 AC_SUBST(MOZ_SANDBOX)
3889 dnl ========================================================
3891 dnl = Module specific options
3893 dnl ========================================================
3894 MOZ_ARG_HEADER(Individual module options)
3896 dnl ========================================================
3897 dnl = Disable feed handling components
3898 dnl ========================================================
3899 MOZ_ARG_DISABLE_BOOL(feeds,
3900 [ --disable-feeds Disable feed handling and processing components],
3903 if test -n "$MOZ_FEEDS"; then
3904 AC_DEFINE(MOZ_FEEDS)
3906 if test "$MOZ_BUILD_APP" = "browser"; then
3907 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
3911 dnl ========================================================
3912 dnl Check for sqlite
3913 dnl ========================================================
3916 MOZ_ARG_ENABLE_BOOL(system-sqlite,
3917 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
3918 MOZ_SYSTEM_SQLITE=1,
3919 MOZ_SYSTEM_SQLITE= )
3921 if test -n "$MOZ_SYSTEM_SQLITE"
3923 dnl ============================
3924 dnl === SQLite Version check ===
3925 dnl ============================
3926 dnl Check to see if the system SQLite package is new enough.
3927 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
3929 dnl ==================================
3930 dnl === SQLITE_SECURE_DELETE check ===
3931 dnl ==================================
3932 dnl Check to see if the system SQLite package is compiled with
3933 dnl SQLITE_SECURE_DELETE enabled.
3934 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
3935 _SAVE_CFLAGS="$CFLAGS"
3936 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3938 LIBS="$LIBS $SQLITE_LIBS"
3939 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
3941 #include "sqlite3.h"
3943 int main(int argc, char **argv){
3944 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
3946 ac_cv_sqlite_secure_delete=yes,
3947 ac_cv_sqlite_secure_delete=no,
3948 ac_cv_sqlite_secure_delete=no
3951 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
3952 CFLAGS="$_SAVE_CFLAGS"
3954 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
3955 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
3958 dnl ===============================
3959 dnl === SQLITE_THREADSAFE check ===
3960 dnl ===============================
3961 dnl Check to see if the system SQLite package is compiled with
3962 dnl SQLITE_THREADSAFE enabled.
3963 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
3964 _SAVE_CFLAGS="$CFLAGS"
3965 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3967 LIBS="$LIBS $SQLITE_LIBS"
3968 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
3970 #include "sqlite3.h"
3972 int main(int argc, char **argv){
3973 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
3975 ac_cv_sqlite_threadsafe=yes,
3976 ac_cv_sqlite_threadsafe=no,
3977 ac_cv_sqlite_threadsafe=no
3980 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
3981 CFLAGS="$_SAVE_CFLAGS"
3983 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
3984 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
3987 dnl ================================
3988 dnl === SQLITE_ENABLE_FTS3 check ===
3989 dnl ================================
3990 dnl check to see if the system SQLite package is compiled with
3991 dnl SQLITE_ENABLE_FTS3 enabled.
3992 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
3993 _SAVE_CFLAGS="$CFLAGS"
3994 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3996 LIBS="$LIBS $SQLITE_LIBS"
3997 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
3999 #include "sqlite3.h"
4001 int main(int argc, char **argv){
4002 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
4004 ac_cv_sqlite_enable_fts3=yes,
4005 ac_cv_sqlite_enable_fts3=no,
4006 ac_cv_sqlite_enable_fts3=no
4009 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
4010 CFLAGS="$_SAVE_CFLAGS"
4012 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
4013 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
4016 dnl =========================================
4017 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
4018 dnl =========================================
4019 dnl check to see if the system SQLite package is compiled with
4020 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
4021 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
4022 _SAVE_CFLAGS="$CFLAGS"
4023 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
4025 LIBS="$LIBS $SQLITE_LIBS"
4026 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
4028 #include "sqlite3.h"
4030 int main(int argc, char **argv){
4031 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
4033 ac_cv_sqlite_enable_unlock_notify=yes,
4034 ac_cv_sqlite_enable_unlock_notify=no,
4035 ac_cv_sqlite_enable_unlock_notify=no
4038 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
4039 CFLAGS="$_SAVE_CFLAGS"
4041 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
4042 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
4045 dnl =========================================
4046 dnl === SQLITE_ENABLE_DBSTAT_VTAB check ===
4047 dnl =========================================
4048 dnl check to see if the system SQLite package is compiled with
4049 dnl SQLITE_ENABLE_DBSTAT_VTAB.
4050 AC_MSG_CHECKING(for SQLITE_ENABLE_DBSTAT_VTAB support in system SQLite)
4051 _SAVE_CFLAGS="$CFLAGS"
4052 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
4054 LIBS="$LIBS $SQLITE_LIBS"
4055 AC_CACHE_VAL(ac_cv_sqlite_dbstat_vtab,[
4057 #include "sqlite3.h"
4059 int main(int argc, char **argv){
4060 return !sqlite3_compileoption_used("SQLITE_ENABLE_DBSTAT_VTAB");
4062 ac_cv_sqlite_dbstat_vtab=yes,
4063 ac_cv_sqlite_dbstat_vtab=no,
4064 ac_cv_sqlite_dbstat_vtab=no
4067 AC_MSG_RESULT($ac_cv_sqlite_dbstat_vtab)
4068 CFLAGS="$_SAVE_CFLAGS"
4070 if test "x$ac_cv_sqlite_dbstat_vtab" = "xno"; then
4071 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_DBSTAT_VTAB.])
4075 if test -n "$MOZ_SYSTEM_SQLITE"; then
4076 AC_DEFINE(MOZ_SYSTEM_SQLITE)
4078 AC_SUBST(MOZ_SYSTEM_SQLITE)
4080 dnl ========================================================
4081 dnl = Enable url-classifier
4082 dnl ========================================================
4083 MOZ_ARG_ENABLE_BOOL(url-classifier,
4084 [ --enable-url-classifier Enable url classifier module],
4085 MOZ_URL_CLASSIFIER=1,
4086 MOZ_URL_CLASSIFIER= )
4087 if test -n "$MOZ_URL_CLASSIFIER"; then
4088 AC_DEFINE(MOZ_URL_CLASSIFIER)
4090 AC_SUBST(MOZ_URL_CLASSIFIER)
4092 dnl ========================================================
4093 dnl = Disable zipwriter
4094 dnl ========================================================
4095 MOZ_ARG_DISABLE_BOOL(zipwriter,
4096 [ --disable-zipwriter Disable zipwriter component],
4099 AC_SUBST(MOZ_ZIPWRITER)
4101 dnl ========================================================
4102 dnl = faststripe theme
4103 dnl ========================================================
4104 MOZ_ARG_ENABLE_BOOL(faststripe,
4105 [ --enable-faststripe Use faststripe theme],
4106 MOZ_THEME_FASTSTRIPE=1,
4107 MOZ_THEME_FASTSTRIPE= )
4108 AC_SUBST(MOZ_THEME_FASTSTRIPE)
4110 dnl ========================================================
4112 dnl = Feature options that require extra sources to be pulled
4114 dnl ========================================================
4115 dnl MOZ_ARG_HEADER(Features that require extra sources)
4117 dnl ========================================================
4119 dnl = Runtime debugging and Optimization Options
4121 dnl ========================================================
4122 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
4124 dnl ========================================================
4125 dnl enable mobile optimizations
4126 dnl ========================================================
4127 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
4128 [ --enable-mobile-optimize
4129 Enable mobile optimizations],
4130 MOZ_GFX_OPTIMIZE_MOBILE=1)
4132 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
4134 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
4135 # We ignore paint will resample on mobile for performance.
4136 # We may want to revisit this later.
4137 MOZ_IGNORE_PAINT_WILL_RESAMPLE=1
4139 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
4140 AC_DEFINE(MOZ_IGNORE_PAINT_WILL_RESAMPLE)
4143 dnl ========================================================
4144 dnl = Enable code optimization. ON by default.
4145 dnl ========================================================
4146 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
4147 MOZ_OPTIMIZE_FLAGS="-O"
4150 MOZ_ARG_ENABLE_STRING(optimize,
4151 [ --disable-optimize Disable compiler optimization
4152 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
4153 [ if test "$enableval" != "no"; then
4155 if test -n "$enableval" -a "$enableval" != "yes"; then
4156 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
4161 fi ], MOZ_OPTIMIZE=1)
4163 MOZ_SET_FRAMEPTR_FLAGS
4165 if test "$COMPILE_ENVIRONMENT"; then
4166 if test -n "$MOZ_OPTIMIZE"; then
4167 AC_MSG_CHECKING([for valid C compiler optimization flags])
4168 _SAVE_CFLAGS=$CFLAGS
4169 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
4170 AC_TRY_COMPILE([#include <stdio.h>],
4171 [printf("Hello World\n");],
4174 AC_MSG_RESULT([$_results])
4175 if test "$_results" = "no"; then
4176 AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
4178 CFLAGS=$_SAVE_CFLAGS
4180 fi # COMPILE_ENVIRONMENT
4182 AC_SUBST(MOZ_OPTIMIZE)
4183 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
4184 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
4185 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
4186 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
4188 dnl ========================================================
4189 dnl = Enable NS_StackWalk.
4190 dnl ========================================================
4192 # On Windows, NS_StackWalk will only work correctly if we have frame pointers
4193 # available. That will only be true for non-optimized builds, debug builds or
4194 # builds with --enable-profiling in the .mozconfig (which is turned on in
4195 # Nightly by default.)
4196 case "$OS_TARGET" in
4198 if test -z "$MOZ_OPTIMIZE" -o -n "$MOZ_PROFILING" -o -n "$MOZ_DEBUG"; then
4209 if test -n "$MOZ_STACKWALKING"; then
4210 AC_DEFINE(MOZ_STACKWALKING)
4213 AC_SUBST(MOZ_STACKWALKING)
4215 dnl ========================================================
4216 dnl = Disable treating compiler warnings as errors
4217 dnl ========================================================
4218 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
4219 WARNINGS_AS_ERRORS=''
4222 dnl ========================================================
4223 dnl = Enable runtime logging
4224 dnl ========================================================
4225 AC_DEFINE(MOZ_LOGGING)
4226 AC_DEFINE(FORCE_PR_LOG)
4228 dnl ========================================================
4229 dnl = This will enable logging of addref, release, ctor, dtor.
4230 dnl ========================================================
4231 _ENABLE_LOGREFCNT=42
4232 MOZ_ARG_ENABLE_BOOL(logrefcnt,
4233 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
4234 _ENABLE_LOGREFCNT=1,
4235 _ENABLE_LOGREFCNT= )
4236 if test "$_ENABLE_LOGREFCNT" = "1"; then
4237 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
4238 elif test -z "$_ENABLE_LOGREFCNT"; then
4239 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
4242 dnl ========================================================
4243 dnl moz_dump_painting
4244 dnl ========================================================
4245 MOZ_ARG_ENABLE_BOOL(dump-painting,
4246 [ --enable-dump-painting Enable paint debugging.],
4247 MOZ_DUMP_PAINTING=1,
4248 MOZ_DUMP_PAINTING= )
4249 if test -n "$MOZ_DUMP_PAINTING"; then
4250 AC_DEFINE(MOZ_DUMP_PAINTING)
4251 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
4253 if test -n "$MOZ_DEBUG"; then
4254 AC_DEFINE(MOZ_DUMP_PAINTING)
4257 case "${OS_TARGET}" in
4258 Android|WINNT|Darwin)
4259 MOZ_GLUE_IN_PROGRAM=
4262 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
4263 MOZ_GLUE_IN_PROGRAM=1
4264 AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
4268 if test -n "$MOZ_REPLACE_MALLOC"; then
4269 MOZ_SYSTEM_JEMALLOC=
4271 dnl Replace-malloc Mac linkage quirks
4272 if test -n "$MACOSX_DEPLOYMENT_TARGET"; then
4273 AC_CACHE_CHECK([how to do weak dynamic linking],
4274 ac_cv_weak_dynamic_linking,
4275 [echo 'extern void foo() __attribute__((weak_import));int bar() { if (foo) foo(); return 0; }' > conftest.c
4276 if AC_TRY_COMMAND([${CC-cc} -o conftest${DLL_SUFFIX} $CFLAGS -dynamiclib $LDFLAGS -Wl,-U,_foo conftest.c $LIBS 1>&5]) &&
4277 test -s conftest${DLL_SUFFIX}; then
4278 dnl There are several ways the linker can put link edit rules in a binary:
4279 dnl - classic info only (for OSX < 10.6)
4280 dnl - dyld info only
4282 if "$OTOOL" -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO_ONLY" > /dev/null; then
4287 if "$OTOOL" -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO" > /dev/null; then
4292 dnl With classic info, we need to build with -flat_namespace.
4293 dnl With dyld info, Xcode 4.5 does the right thing without additional flags,
4294 dnl but Xcode < 4.5 requires a dummy library and -flat_namespace because it
4295 dnl forgets to set the weak flag in the dyld info.
4296 dnl See http://glandium.org/blog/?p=2764 for more details.
4298 dnl Values for ac_cv_weak_dynamic_linking, and subsequently
4299 dnl MOZ_REPLACE_MALLOC_LINKAGE are thus:
4300 dnl - "flat namespace" when -flat_namespace alone is needed
4301 dnl - "dummy library" when a dummy library and -flat_namespace are needed
4302 dnl - "compiler support" when nothing is needed
4303 if test -n "$_DYLD_INFO" && dyldinfo -bind conftest${DLL_SUFFIX} 2> /dev/null | grep "_foo (weak import)" > /dev/null; then
4304 if test -n "$_CLASSIC_INFO"; then
4305 ac_cv_weak_dynamic_linking="flat namespace"
4307 ac_cv_weak_dynamic_linking="compiler support"
4310 if test -n "$_DYLD_INFO"; then
4311 ac_cv_weak_dynamic_linking="dummy library"
4313 ac_cv_weak_dynamic_linking="flat namespace"
4317 AC_ERROR([couldn't compile a simple C file])
4320 MOZ_REPLACE_MALLOC_LINKAGE="$ac_cv_weak_dynamic_linking"
4323 AC_SUBST(MOZ_REPLACE_MALLOC_LINKAGE)
4325 dnl ========================================================
4326 dnl = Jemalloc build setup
4327 dnl ========================================================
4328 if test -z "$MOZ_MEMORY"; then
4331 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
4332 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.])
4337 if test -n "$MOZ_JEMALLOC4" -a -z "$MOZ_REPLACE_MALLOC"; then
4338 MOZ_SYSTEM_JEMALLOC=1
4339 AC_CHECK_FUNCS(mallctl nallocx,,
4340 [MOZ_SYSTEM_JEMALLOC=
4342 if test -n "$MOZ_SYSTEM_JEMALLOC"; then
4343 AC_DEFINE(MOZ_SYSTEM_JEMALLOC)
4346 if test "x$MOZ_DEBUG" = "x1"; then
4347 AC_DEFINE(MOZ_MEMORY_DEBUG)
4349 dnl The generic feature tests that determine how to compute ncpus are long and
4350 dnl complicated. Therefore, simply define special cpp variables for the
4351 dnl platforms we have special knowledge of.
4354 export MOZ_NO_DEBUG_RTL=1
4358 AC_SUBST(MOZ_SYSTEM_JEMALLOC)
4359 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
4361 # Allow the application to provide a subconfigure script.
4362 # This should be after 'export MOZ_NO_DEBUG_RTL=1' since
4363 # ldap/c-sdk/configure refers to the enviroment value.
4364 if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
4365 do_output_subdirs() {
4366 if test -n "$_subconfigure_subdirs"; then
4367 AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
4369 _subconfigure_subdir="$1"
4370 _subconfigure_config_args="$ac_configure_args"
4372 tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
4373 m4 "${srcdir}/build/autoconf/subconfigure.m4" \
4374 "${srcdir}/build/autoconf/altoptions.m4" \
4375 "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
4380 AC_SUBST_LIST(MOZ_GLUE_WRAP_LDFLAGS)
4381 export MOZ_GLUE_WRAP_LDFLAGS
4383 dnl ========================================================
4384 dnl = Enable using the clang plugin to build
4385 dnl ========================================================
4387 MOZ_CONFIG_CLANG_PLUGIN
4389 dnl ========================================================
4390 dnl = Enable stripping of libs & executables
4391 dnl ========================================================
4392 MOZ_ARG_ENABLE_BOOL(strip,
4393 [ --enable-strip Enable stripping of libs & executables ],
4397 dnl ========================================================
4398 dnl = Enable stripping of libs & executables when packaging
4399 dnl ========================================================
4400 MOZ_ARG_ENABLE_BOOL(install-strip,
4401 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
4405 dnl ========================================================
4406 dnl = --disable-elf-hack
4407 dnl ========================================================
4410 MOZ_ARG_DISABLE_BOOL(elf-hack,
4411 [ --disable-elf-hack Disable elf hacks],
4415 # Only enable elfhack where supported
4416 if test "$USE_ELF_HACK" = 1; then
4417 case "${HOST_OS_ARCH},${OS_ARCH}" in
4419 case "${CPU_ARCH}" in
4434 if test -n "$COMPILE_ENVIRONMENT" -a -n "$USE_ELF_HACK"; then
4435 dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
4436 dnl memory addresses it maps to. The result is that by the time elfhack
4437 dnl kicks in, it is not possible to apply relocations because of that,
4438 dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
4439 dnl segment. It makes elfhack mostly useless, so considering the problems
4440 dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
4441 dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
4442 dnl the linker creates PT_GNU_RELRO segments. However, when we do want
4443 dnl elfhack enabled, disable PT_GNU_RELRO instead.
4444 AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
4445 LINK_WITH_PT_GNU_RELRO,
4446 [echo "int main() {return 0;}" > conftest.${ac_ext}
4447 if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
4448 test -s conftest${ac_exeext}; then
4449 if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
4450 LINK_WITH_PT_GNU_RELRO=yes
4452 LINK_WITH_PT_GNU_RELRO=no
4455 dnl We really don't expect to get here, but just in case
4456 AC_ERROR([couldn't compile a simple C file])
4459 if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
4460 if test "$USE_ELF_HACK" = F; then
4461 AC_MSG_CHECKING([for -z norelro option to ld])
4462 _SAVE_LDFLAGS=$LDFLAGS
4463 LDFLAGS="$LDFLAGS -Wl,-z,norelro"
4464 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
4465 [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,norelro"],
4466 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.]))
4469 AC_MSG_WARN([Disabling elfhack])
4473 fi # COMPILE_ENVIRONMENT and others.
4475 dnl ========================================================
4476 dnl = libstdc++ compatibility hacks
4477 dnl ========================================================
4480 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
4481 [ --enable-stdcxx-compat Enable compatibility with older libstdc++],
4484 if test -n "$STDCXX_COMPAT"; then
4485 eval $(CXX="$CXX" HOST_CXX="$HOST_CXX" $PYTHON -m mozbuild.configure.libstdcxx)
4486 AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
4487 AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
4488 CXXFLAGS="$CXXFLAGS -D_GLIBCXX_USE_CXX11_ABI=0"
4489 HOST_CXXFLAGS="$HOST_CXXFLAGS -D_GLIBCXX_USE_CXX11_ABI=0"
4492 dnl ========================================================
4493 dnl = frontend JS debug mode
4494 dnl ========================================================
4496 MOZ_ARG_ENABLE_BOOL(debug-js-modules,
4497 [ --enable-debug-js-modules Enable debug mode for frontend JS libraries],
4501 AC_SUBST(DEBUG_JS_MODULES)
4503 dnl ========================================================
4505 dnl = Profiling and Instrumenting
4507 dnl ========================================================
4508 MOZ_ARG_HEADER(Profiling and Instrumenting)
4510 dnl ========================================================
4511 dnl = Enable TaskTracer
4512 dnl ========================================================
4513 MOZ_ARG_ENABLE_BOOL(tasktracer,
4514 [ --enable-tasktracer Set compile flags necessary for using TaskTracer],
4517 if test -n "$MOZ_TASK_TRACER"; then
4518 AC_DEFINE(MOZ_TASK_TRACER)
4519 AC_SUBST(MOZ_TASK_TRACER)
4522 dnl ========================================================
4523 dnl Turn on reflow counting
4524 dnl ========================================================
4525 MOZ_ARG_ENABLE_BOOL(reflow-perf,
4526 [ --enable-reflow-perf Enable reflow performance tracing],
4529 if test -n "$MOZ_REFLOW_PERF"; then
4530 AC_DEFINE(MOZ_REFLOW_PERF)
4533 dnl ========================================================
4534 dnl = Horizon build options - set default preferences for
4535 dnl the horizon project. Horizon is a browser built on
4536 dnl top of the graphene runtime.
4537 dnl ========================================================
4538 if test -n "$MOZ_HORIZON"; then
4539 AC_DEFINE(MOZ_HORIZON)
4541 AC_SUBST(MOZ_HORIZON)
4543 dnl ========================================================
4544 dnl = Offer a way to disable the startup cache
4545 dnl ========================================================
4547 MOZ_ARG_DISABLE_BOOL(startupcache,
4548 [ --disable-startupcache Disable startup cache ],
4549 MOZ_DISABLE_STARTUPCACHE=1,
4550 MOZ_DISABLE_STARTUPCACHE=)
4552 dnl bug 988880: disable startup cache on b2g
4553 if test -n "$MOZ_B2G"; then
4554 MOZ_DISABLE_STARTUPCACHE=1
4556 if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
4557 AC_DEFINE(MOZ_DISABLE_STARTUPCACHE)
4559 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
4561 dnl =========================================
4562 dnl = Enable packaging Gaia with B2G desktop
4563 dnl =========================================
4564 if test x"$MOZ_WIDGET_TOOLKIT" != x"gonk"; then
4565 if test -n "$GAIADIR" -a ! -d "$GAIADIR" ; then
4566 AC_MSG_ERROR([GAIADIR '$GAIADIR' isn't a valid directory])
4570 if test -n "$GAIADIR" ; then
4571 AC_DEFINE(PACKAGE_GAIA)
4574 if test -n "$FXOS_SIMULATOR" -a -z "$GAIADIR" ; then
4575 AC_MSG_ERROR([FXOS_SIMULATOR=1 requires GAIADIR to be defined])
4578 if test -n "$FXOS_SIMULATOR" ; then
4579 AC_DEFINE(FXOS_SIMULATOR)
4580 AC_SUBST(FXOS_SIMULATOR)
4584 dnl ========================================================
4585 dnl = Enable Pico Speech Synthesis (Gonk usually)
4586 dnl ========================================================
4587 MOZ_ARG_ENABLE_BOOL(synth-pico,
4588 [ --enable-synth-pico Set compile flags necessary for compiling Pico Web Speech API ],
4591 if test -n "$MOZ_SYNTH_PICO"; then
4592 AC_DEFINE(MOZ_SYNTH_PICO)
4594 AC_SUBST(MOZ_SYNTH_PICO)
4596 dnl ========================================================
4597 dnl = Enable Support for Time Manager API
4598 dnl ========================================================
4599 if test -n "$MOZ_TIME_MANAGER"; then
4600 AC_DEFINE(MOZ_TIME_MANAGER)
4602 AC_SUBST(MOZ_TIME_MANAGER)
4604 dnl ========================================================
4605 dnl = Enable Support for AudioChannelManager API
4606 dnl ========================================================
4607 if test -n "$MOZ_AUDIO_CHANNEL_MANAGER"; then
4608 AC_DEFINE(MOZ_AUDIO_CHANNEL_MANAGER)
4610 AC_SUBST(MOZ_AUDIO_CHANNEL_MANAGER)
4612 dnl ========================================================
4613 dnl = Enable Support for Secure Element API
4614 dnl ========================================================
4615 MOZ_SECUREELEMENT=1,
4616 if test -n "$MOZ_SECUREELEMENT"; then
4617 AC_DEFINE(MOZ_SECUREELEMENT)
4619 AC_SUBST(MOZ_SECUREELEMENT)
4621 dnl ========================================================
4622 dnl = Support for demangling undefined symbols
4623 dnl ========================================================
4624 if test -z "$SKIP_LIBRARY_CHECKS"; then
4627 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
4631 # Demangle only for debug or DMD builds
4632 MOZ_DEMANGLE_SYMBOLS=
4633 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
4634 MOZ_DEMANGLE_SYMBOLS=1
4635 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
4637 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
4639 dnl ========================================================
4640 dnl = Support for gcc stack unwinding (from gcc 3.3)
4641 dnl ========================================================
4642 if test -z "$SKIP_LIBRARY_CHECKS"; then
4645 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
4649 dnl ========================================================
4651 dnl ========================================================
4653 MOZ_ARG_WITH_STRING(jitreport-granularity,
4654 [ --jitreport-granularity=N
4655 Default granularity at which to report JIT code
4658 1 - code ranges for whole functions only
4659 2 - per-line information
4660 3 - per-op information],
4661 JITREPORT_GRANULARITY=$withval,
4662 JITREPORT_GRANULARITY=3)
4664 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
4666 dnl ========================================================
4667 dnl = Disable Mozilla's versions of RIL and Geolocation
4668 dnl ========================================================
4669 MOZ_ARG_DISABLE_BOOL(mozril-geoloc,
4670 [ --disable-mozril-geoloc Disable Mozilla's RIL and geolocation],
4671 DISABLE_MOZ_RIL_GEOLOC=1,
4672 DISABLE_MOZ_RIL_GEOLOC= )
4673 if test -n "$DISABLE_MOZ_RIL_GEOLOC"; then
4674 AC_DEFINE(DISABLE_MOZ_RIL_GEOLOC)
4676 AC_SUBST(DISABLE_MOZ_RIL_GEOLOC)
4678 dnl ========================================================
4682 dnl ========================================================
4683 MOZ_ARG_HEADER(Misc. Options)
4685 dnl ========================================================
4686 dnl = Define default location for MOZILLA_FIVE_HOME
4687 dnl ========================================================
4688 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
4689 [ --with-default-mozilla-five-home
4690 Set the default value for MOZILLA_FIVE_HOME],
4691 [ val=`echo $withval`
4692 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
4694 dnl ========================================================
4695 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
4696 dnl ========================================================
4697 MOZ_ARG_WITH_STRING(user-appdir,
4698 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
4699 [ val=`echo $withval`
4700 if echo "$val" | grep "\/" >/dev/null; then
4701 AC_MSG_ERROR("Homedir must be single relative path.")
4706 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
4708 dnl ========================================================
4709 dnl = Doxygen configuration
4710 dnl ========================================================
4711 dnl Use commas to specify multiple dirs to this arg
4712 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
4713 MOZ_ARG_WITH_STRING(doc-input-dirs,
4714 [ --with-doc-input-dirs=DIRS
4715 Header/idl dirs to create docs from],
4716 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
4717 AC_SUBST(MOZ_DOC_INPUT_DIRS)
4719 dnl Use commas to specify multiple dirs to this arg
4720 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
4721 MOZ_ARG_WITH_STRING(doc-include-dirs,
4722 [ --with-doc-include-dirs=DIRS
4723 Include dirs to preprocess doc headers],
4724 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
4725 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
4727 MOZ_DOC_OUTPUT_DIR='./dist/docs'
4728 MOZ_ARG_WITH_STRING(doc-output-dir,
4729 [ --with-doc-output-dir=DIR
4730 Dir to generate docs into],
4731 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
4732 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
4734 if test -z "$SKIP_COMPILER_CHECKS"; then
4735 dnl ========================================================
4737 dnl = Compiler Options
4739 dnl ========================================================
4740 MOZ_ARG_HEADER(Compiler Options)
4742 dnl ========================================================
4743 dnl Check for gcc -pipe support
4744 dnl ========================================================
4745 AC_MSG_CHECKING([for -pipe support])
4746 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
4747 dnl Any gcc that supports firefox supports -pipe.
4748 CFLAGS="$CFLAGS -pipe"
4749 CXXFLAGS="$CXXFLAGS -pipe"
4750 AC_MSG_RESULT([yes])
4755 dnl ========================================================
4756 dnl Profile guided optimization (gcc checks)
4757 dnl ========================================================
4758 dnl Test for profiling options
4759 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
4761 _SAVE_CFLAGS="$CFLAGS"
4762 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
4764 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
4765 AC_TRY_COMPILE([], [return 0;],
4766 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
4767 result="yes" ], result="no")
4768 AC_MSG_RESULT([$result])
4770 if test $result = "yes"; then
4771 PROFILE_GEN_LDFLAGS="-fprofile-generate"
4772 PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
4773 PROFILE_USE_LDFLAGS="-fprofile-use"
4776 CFLAGS="$_SAVE_CFLAGS"
4778 AC_SUBST(PROFILE_GEN_CFLAGS)
4779 AC_SUBST(PROFILE_GEN_LDFLAGS)
4780 AC_SUBST(PROFILE_USE_CFLAGS)
4781 AC_SUBST(PROFILE_USE_LDFLAGS)
4783 fi # ! SKIP_COMPILER_CHECKS
4785 AC_DEFINE(CPP_THROW_NEW, [throw()])
4788 if test "$COMPILE_ENVIRONMENT"; then
4790 fi # COMPILE_ENVIRONMENT
4792 dnl ========================================================
4794 dnl = Build depencency options
4796 dnl ========================================================
4797 MOZ_ARG_HEADER(Build dependencies)
4799 if test "$GNU_CC" -a "$GNU_CXX"; then
4800 _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
4802 dnl Don't override this for MSVC
4803 if test -z "$_WIN32_MSVC"; then
4804 _USE_CPP_INCLUDE_FLAG=
4805 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
4806 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
4808 echo '#include <stdio.h>' > dummy-hello.c
4810 dnl This output is localized, split at the first double space or colon and space.
4811 _CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*\\\stdio.h\)$"
4812 CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'`
4813 _CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'`
4815 if ! test -e "$_CL_STDIO_PATH"; then
4816 AC_MSG_ERROR([Unable to parse cl -showIncludes prefix. This compiler's locale has an unsupported formatting.])
4818 if test -z "$CL_INCLUDES_PREFIX"; then
4819 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
4821 AC_SUBST(CL_INCLUDES_PREFIX)
4824 dnl Make sure that the build system can handle non-ASCII characters
4825 dnl in environment variables to prevent it from breaking silently on
4826 dnl non-English systems.
4827 NONASCII=$'\241\241'
4832 dnl ========================================================
4834 dnl = Static Build Options
4836 dnl ========================================================
4837 MOZ_ARG_HEADER(Static build options)
4839 if test -z "$MOZ_SYSTEM_ZLIB"; then
4840 if test -n "$JS_SHARED_LIBRARY"; then
4842 AC_DEFINE(ZLIB_IN_MOZGLUE)
4846 AC_SUBST(ZLIB_IN_MOZGLUE)
4848 dnl ========================================================
4850 dnl = Standalone module options
4852 dnl ========================================================
4853 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
4856 dnl ========================================================
4858 if test -z "$SKIP_PATH_CHECKS"; then
4859 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
4860 if test "$MOZ_ENABLE_GTK" ; then
4861 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
4866 if test -z "${GLIB_GMODULE_LIBS}" \
4867 -a -n "${GLIB_CONFIG}"\
4868 -a "${GLIB_CONFIG}" != no\
4870 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
4873 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
4875 if test "$USE_FC_FREETYPE"; then
4876 if test "$COMPILE_ENVIRONMENT"; then
4877 dnl ========================================================
4878 dnl = Check for freetype2 functionality
4879 dnl ========================================================
4880 if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
4882 _SAVE_CFLAGS="$CFLAGS"
4883 LIBS="$LIBS $FT2_LIBS"
4884 CFLAGS="$CFLAGS $FT2_CFLAGS"
4886 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
4887 ac_cv_member_FT_Bitmap_Size_y_ppem,
4888 [AC_TRY_COMPILE([#include <ft2build.h>
4889 #include FT_FREETYPE_H],
4891 if (sizeof s.y_ppem) return 0;
4893 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
4894 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
4895 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
4896 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
4898 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
4900 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
4901 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
4902 [FT_Bitmap_Size structure includes y_ppem field])
4904 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
4907 CFLAGS="$_SAVE_CFLAGS"
4910 _SAVE_CPPFLAGS="$CPPFLAGS"
4911 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
4912 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
4913 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
4914 CPPFLAGS="$_SAVE_CPPFLAGS"
4918 dnl ========================================================
4919 dnl Check if we need the 32-bit Linux SSE2 error dialog
4920 dnl ========================================================
4922 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
4924 dnl ========================================================
4925 dnl Check for pixman and cairo
4926 dnl ========================================================
4929 MOZ_ARG_ENABLE_BOOL(system-cairo,
4930 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
4935 MOZ_ARG_ENABLE_BOOL(system-pixman,
4936 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
4938 MOZ_TREE_PIXMAN=force,
4941 # System cairo depends on system pixman
4942 if test "$MOZ_TREE_PIXMAN" = "force"; then
4943 if test -z "$MOZ_TREE_CAIRO"; then
4944 AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
4948 elif test -z "$MOZ_TREE_CAIRO"; then
4952 if test "$MOZ_TREE_PIXMAN"; then
4953 AC_DEFINE(MOZ_TREE_PIXMAN)
4955 PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.19.2)
4958 if test "$MOZ_TREE_CAIRO"; then
4959 MOZ_CAIRO_CFLAGS="-I${DIST}/include/cairo"
4960 AC_DEFINE(MOZ_TREE_CAIRO)
4962 if test "$OS_ARCH" = "WINNT"; then
4963 # For now we assume that we will have a uint64_t available through
4964 # one of the above headers or mozstdint.h.
4965 AC_DEFINE(HAVE_UINT64_T)
4968 # Define macros for cairo-features.h
4969 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
4970 if test "$MOZ_X11"; then
4971 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
4972 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
4973 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
4975 if test "$_HAVE_FREETYPE2"; then
4976 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
4977 MOZ_ENABLE_CAIRO_FT=1
4978 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
4981 case "$MOZ_WIDGET_TOOLKIT" in
4983 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
4984 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
4985 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
4988 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
4989 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
4990 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
4991 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
4992 MOZ_ENABLE_D2D_SURFACE=1
4993 MOZ_ENABLE_DWRITE_FONT=1
4995 if test "$COMPILE_ENVIRONMENT"; then
4997 MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
4999 dnl D3D10 Layers depend on D2D Surfaces.
5000 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
5001 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
5006 if test "$USE_FC_FREETYPE"; then
5007 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
5009 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
5010 AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
5011 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
5012 AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
5013 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
5015 AC_SUBST(PS_SURFACE_FEATURE)
5016 AC_SUBST(SVG_SURFACE_FEATURE)
5017 AC_SUBST(XLIB_SURFACE_FEATURE)
5018 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
5019 AC_SUBST(QUARTZ_SURFACE_FEATURE)
5020 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
5021 AC_SUBST(WIN32_SURFACE_FEATURE)
5022 AC_SUBST(OS2_SURFACE_FEATURE)
5023 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
5024 AC_SUBST(FT_FONT_FEATURE)
5025 AC_SUBST(FC_FONT_FEATURE)
5026 AC_SUBST(WIN32_FONT_FEATURE)
5027 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
5028 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
5029 AC_SUBST(QUARTZ_FONT_FEATURE)
5030 AC_SUBST(PNG_FUNCTIONS_FEATURE)
5031 AC_SUBST(QT_SURFACE_FEATURE)
5032 AC_SUBST(TEE_SURFACE_FEATURE)
5034 if test "$MOZ_X11"; then
5035 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
5038 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
5040 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
5041 MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
5042 MOZ_CAIRO_LIBS="$CAIRO_LIBS"
5043 PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
5044 if test "$MOZ_X11"; then
5045 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
5046 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
5047 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
5048 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
5052 case "$MOZ_WIDGET_TOOLKIT" in
5054 TK_CFLAGS="$MOZ_CAIRO_CFLAGS $MOZ_PIXMAN_CFLAGS"
5055 TK_LIBS="$MOZ_CAIRO_LIBS $MOZ_PIXMAN_LIBS"
5059 AC_SUBST(MOZ_TREE_CAIRO)
5060 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
5061 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
5062 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
5063 AC_SUBST(MOZ_TREE_PIXMAN)
5065 dnl ========================================================
5067 dnl ========================================================
5068 MOZ_ARG_DISABLE_BOOL(xul,
5069 [ --disable-xul Disable XUL],
5071 if test "$MOZ_XUL"; then
5074 dnl remove extensions that require XUL
5075 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
5080 dnl ========================================================
5081 dnl necko configuration options
5082 dnl ========================================================
5085 dnl option to disable necko's wifi scanner
5088 case "$OS_TARGET" in
5090 if test -n "$gonkdir"; then
5095 if test -z "$MOZ_IOS"; then
5099 DragonFly|FreeBSD|WINNT)
5108 MOZ_ARG_DISABLE_BOOL(necko-wifi,
5109 [ --disable-necko-wifi Disable necko wifi scanner],
5113 if test "$NECKO_WIFI"; then
5114 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
5115 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
5117 AC_DEFINE(NECKO_WIFI)
5118 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
5120 AC_SUBST(NECKO_WIFI)
5121 AC_SUBST(NECKO_WIFI_DBUS)
5124 dnl option to disable cookies
5126 MOZ_ARG_DISABLE_BOOL(cookies,
5127 [ --disable-cookies Disable cookie support],
5130 AC_SUBST(NECKO_COOKIES)
5131 if test "$NECKO_COOKIES"; then
5132 AC_DEFINE(NECKO_COOKIES)
5133 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
5136 dnl ========================================================
5137 if test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
5138 MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
5141 dnl ========================================================
5143 dnl = Maintainer debug option (no --enable equivalent)
5145 dnl ========================================================
5149 AC_SUBST(AR_EXTRACT)
5152 AC_SUBST(AS_DASH_C_FLAG)
5159 AC_SUBST(MOZ_AUTH_EXTENSION)
5160 AC_SUBST(MOZ_PREF_EXTENSIONS)
5162 AC_SUBST(MOZ_DEBUG_LDFLAGS)
5163 AC_SUBST(WARNINGS_AS_ERRORS)
5164 AC_SUBST_SET(MOZ_EXTENSIONS)
5166 AC_SUBST(MOZ_TOOLKIT_SEARCH)
5169 AC_SUBST(MOZ_UNIVERSALCHARDET)
5170 AC_SUBST(ACCESSIBILITY)
5171 AC_SUBST(MOZ_SPELLCHECK)
5172 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
5173 AC_SUBST(MOZ_CRASHREPORTER)
5174 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
5175 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
5176 AC_SUBST(MOZ_STUB_INSTALLER)
5177 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
5178 AC_SUBST(MOZ_ENABLE_SIGNMAR)
5179 AC_SUBST(MOZ_UPDATER)
5181 AC_SUBST(MOZ_ANGLE_RENDERER)
5182 AC_SUBST(MOZ_D3D_CPU_SUFFIX)
5183 AC_SUBST(MOZ_HAS_WINSDK_WITH_D3D)
5184 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL)
5185 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL_PATH)
5187 AC_SUBST(MOZ_ANDROID_APPLICATION_CLASS)
5188 AC_SUBST(MOZ_ANDROID_BROWSER_INTENT_CLASS)
5189 AC_SUBST(MOZ_ANDROID_SEARCH_INTENT_CLASS)
5190 AC_SUBST(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
5191 AC_SUBST(MOZ_INSTALL_TRACKING)
5192 AC_SUBST(ENABLE_STRIP)
5193 AC_SUBST(PKG_SKIP_STRIP)
5194 AC_SUBST(STRIP_FLAGS)
5195 AC_SUBST(USE_ELF_HACK)
5196 AC_SUBST(INCREMENTAL_LINKER)
5197 AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
5199 AC_SUBST(MOZ_FIX_LINK_PATHS)
5201 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
5202 AC_SUBST(MOZ_LINKER_EXTRACT)
5204 if test -n "$MOZ_BINARY_EXTENSIONS"; then
5205 AC_DEFINE(MOZ_BINARY_EXTENSIONS)
5208 AC_SUBST(MOZ_ADDON_SIGNING)
5209 if test "$MOZ_ADDON_SIGNING" = 1; then
5210 AC_DEFINE(MOZ_ADDON_SIGNING)
5212 AC_SUBST(MOZ_REQUIRE_SIGNING)
5213 if test "$MOZ_REQUIRE_SIGNING" = 1; then
5214 AC_DEFINE(MOZ_REQUIRE_SIGNING)
5217 AC_SUBST(MOZ_JSDOWNLOADS)
5218 if test -n "$MOZ_JSDOWNLOADS"; then
5219 AC_DEFINE(MOZ_JSDOWNLOADS)
5222 dnl ========================================================
5223 dnl = Mac bundle name prefix
5224 dnl ========================================================
5225 MOZ_ARG_WITH_STRING(macbundlename-prefix,
5226 [ --with-macbundlename-prefix=prefix
5227 Prefix for MOZ_MACBUNDLE_NAME],
5228 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
5230 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
5231 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
5232 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
5235 if test "$MOZ_DEBUG"; then
5236 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
5238 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
5240 AC_SUBST(MOZ_MACBUNDLE_NAME)
5242 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
5243 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
5244 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
5245 if test "$MOZ_DEBUG"; then
5246 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
5249 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
5250 AC_SUBST(MOZ_MACBUNDLE_ID)
5252 dnl ========================================================
5253 dnl = Child Process Name for IPC
5254 dnl ========================================================
5255 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
5256 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
5258 # We want to let Android unpack the file at install time, but it only does
5259 # so if the file is named libsomething.so. The lib/ path is also required
5260 # because the unpacked file will be under the lib/ subdirectory and will
5261 # need to be executed from that path.
5262 MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
5263 MOZ_CHILD_PROCESS_NAME_PIE="libplugin-container-pie.so"
5264 AC_SUBST(MOZ_CHILD_PROCESS_NAME_PIE)
5266 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
5268 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
5269 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
5271 # The following variables are available to branding and application
5272 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
5273 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
5274 # impacts profile location and user-visible fields.
5275 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
5276 # versions of a given application (e.g. Aurora and Firefox both use
5277 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
5278 # for application.ini's "Name" field, which controls profile location in
5279 # the absence of a "Profile" field (see below), and various system
5280 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
5281 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
5282 # Mac Bundle name, Updater, Installer), it is typically used for nightly
5283 # builds (e.g. Aurora for Firefox).
5284 # - MOZ_APP_VERSION: Defines the application version number.
5285 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
5286 # in the "About" window. If not set, defaults to MOZ_APP_VERSION.
5287 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
5288 # defaults to a lowercase form of MOZ_APP_BASENAME.
5289 # - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
5290 # profile name and remoting. If not set, defaults to MOZ_APP_NAME.
5291 # - MOZ_APP_PROFILE: When set, used for application.ini's
5292 # "Profile" field, which controls profile location.
5293 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
5294 # crash reporter server url.
5295 # - MOZ_APP_ANDROID_VERSION_CODE: On Android, "android:versionCode" for
5296 # the main application is set to the value of this variable. If not
5297 # set, it falls back to a Mozilla-specific value derived from the
5299 # - MOZ_ANDROID_SHARED_ID: On Android, "android:sharedUserId" for all Android
5300 # packages produced.
5301 # - MOZ_ANDROID_GCM_SENDERID: On Android, the Android GCM Sender ID used. GCM
5302 # sender IDs are not sensitive: see, http://stackoverflow.com/a/18216063.
5303 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
5305 if test -z "$MOZ_APP_NAME"; then
5306 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
5309 if test -z "$MOZ_APP_REMOTINGNAME"; then
5310 MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
5313 if test -z "$MOZ_APP_VERSION_DISPLAY"; then
5314 MOZ_APP_VERSION_DISPLAY=$MOZ_APP_VERSION
5317 if test -z "$ANDROID_PACKAGE_NAME" ; then
5318 ANDROID_PACKAGE_NAME="org.mozilla.$MOZ_APP_NAME"
5321 # Mozilla released Firefox for Android {Release,Beta} and {Aurora,Nightly} to
5322 # the public with specific common shared IDs and we need to keep them
5323 # consistent forever. The specific common values are set by per-channel
5324 # branding; all other channels use a generic sharedID, set below.
5325 if test -z "$MOZ_ANDROID_SHARED_ID" ; then
5326 MOZ_ANDROID_SHARED_ID="${ANDROID_PACKAGE_NAME}.sharedID"
5329 # For extensions and langpacks, we require a max version that is compatible
5330 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
5331 # 24.0a1 and 24.0a2 aren't affected
5333 # 24.1.1 becomes 24.*
5334 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
5335 if test -z "$IS_ALPHA"; then
5337 if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
5338 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
5340 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
5344 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
5347 MOZ_B2G_VERSION=${MOZ_B2G_VERSION:-"1.0.0"}
5348 AC_DEFINE_UNQUOTED(MOZ_B2G_VERSION,"$MOZ_B2G_VERSION")
5349 AC_DEFINE_UNQUOTED(MOZ_B2G_OS_NAME,"$MOZ_B2G_OS_NAME")
5351 AC_SUBST(MOZ_APP_NAME)
5352 AC_SUBST(MOZ_APP_REMOTINGNAME)
5353 AC_SUBST(MOZ_APP_DISPLAYNAME)
5354 AC_SUBST(MOZ_APP_BASENAME)
5355 AC_SUBST(MOZ_APP_VENDOR)
5356 AC_SUBST(MOZ_APP_PROFILE)
5357 AC_SUBST(MOZ_APP_ID)
5358 AC_SUBST(MOZ_APP_ANDROID_VERSION_CODE)
5359 AC_SUBST(MOZ_ANDROID_SHARED_ID)
5360 AC_SUBST(MOZ_ANDROID_GCM_SENDERID)
5361 AC_SUBST(MAR_CHANNEL_ID)
5362 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
5363 AC_SUBST(MOZ_PROFILE_MIGRATOR)
5364 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
5365 AC_SUBST(MOZ_APP_UA_NAME)
5366 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
5367 AC_SUBST(MOZ_APP_VERSION)
5368 AC_SUBST(MOZ_APP_VERSION_DISPLAY)
5369 AC_SUBST(MOZ_APP_MAXVERSION)
5370 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
5371 AC_SUBST(FIREFOX_VERSION)
5372 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
5373 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
5374 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
5377 AC_SUBST(MOZ_APP_STATIC_INI)
5379 AC_SUBST(MOZ_PKG_SPECIAL)
5380 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
5382 AC_SUBST(MOZILLA_OFFICIAL)
5383 if test "$MOZILLA_OFFICIAL"; then
5384 AC_DEFINE(MOZILLA_OFFICIAL)
5385 # Build revisions should always be present in official builds
5386 MOZ_INCLUDE_SOURCE_INFO=1
5389 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
5390 # explicitly set the repository and changeset information in.
5391 AC_SUBST(MOZ_SOURCE_REPO)
5392 AC_SUBST(MOZ_SOURCE_CHANGESET)
5393 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
5395 if test "$MOZ_TELEMETRY_REPORTING"; then
5396 AC_DEFINE(MOZ_TELEMETRY_REPORTING)
5398 # Enable Telemetry by default for nightly and aurora channels
5399 if test -z "$RELEASE_OR_BETA"; then
5400 AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
5404 dnl If we have any service that uploads data (and requires data submission
5405 dnl policy alert), set MOZ_DATA_REPORTING.
5406 dnl We need SUBST for build system and DEFINE for xul preprocessor.
5407 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
5408 MOZ_DATA_REPORTING=1
5409 AC_DEFINE(MOZ_DATA_REPORTING)
5410 AC_SUBST(MOZ_DATA_REPORTING)
5414 AC_SUBST(WIN32_REDIST_DIR)
5415 AC_SUBST(WIN_UCRT_REDIST_DIR)
5417 dnl ========================================================
5419 dnl ========================================================
5421 # Internationalization is not built or exposed on Fennec.
5424 if test "$MOZ_BUILD_APP" = "mobile/android"; then
5430 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
5436 dnl Echo the CFLAGS to remove extra whitespace.
5442 $_WARNINGS_CXXFLAGS \
5445 COMPILE_CFLAGS=`echo \
5449 COMPILE_CXXFLAGS=`echo \
5450 $_DEFINES_CXXFLAGS \
5456 HOST_CXXFLAGS=`echo \
5459 AC_SUBST(_DEPEND_CFLAGS)
5460 AC_SUBST(MOZ_SYSTEM_JPEG)
5461 AC_SUBST(MOZ_SYSTEM_PNG)
5462 AC_SUBST(MOZ_SYSTEM_BZ2)
5464 AC_SUBST_LIST(MOZ_JPEG_CFLAGS)
5465 AC_SUBST_LIST(MOZ_JPEG_LIBS)
5466 AC_SUBST_LIST(MOZ_BZ2_CFLAGS)
5467 AC_SUBST_LIST(MOZ_BZ2_LIBS)
5468 AC_SUBST_LIST(MOZ_PNG_CFLAGS)
5469 AC_SUBST_LIST(MOZ_PNG_LIBS)
5471 AC_SUBST(MOZ_SYSTEM_NSPR)
5473 AC_SUBST(MOZ_SYSTEM_NSS)
5475 HOST_CMFLAGS=-fobjc-exceptions
5476 HOST_CMMFLAGS=-fobjc-exceptions
5477 OS_COMPILE_CMFLAGS=-fobjc-exceptions
5478 OS_COMPILE_CMMFLAGS=-fobjc-exceptions
5479 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
5480 OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
5481 OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
5483 AC_SUBST(HOST_CMFLAGS)
5484 AC_SUBST(HOST_CMMFLAGS)
5485 AC_SUBST(OS_COMPILE_CMFLAGS)
5486 AC_SUBST(OS_COMPILE_CMMFLAGS)
5489 OS_CXXFLAGS="$CXXFLAGS"
5490 OS_CPPFLAGS="$CPPFLAGS"
5491 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
5492 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
5493 OS_LDFLAGS="$LDFLAGS"
5496 AC_SUBST(OS_CXXFLAGS)
5497 AC_SUBST(OS_CPPFLAGS)
5498 AC_SUBST(OS_COMPILE_CFLAGS)
5499 AC_SUBST(OS_COMPILE_CXXFLAGS)
5500 AC_SUBST(OS_LDFLAGS)
5505 AC_SUBST(HOST_CFLAGS)
5506 AC_SUBST(HOST_CPPFLAGS)
5507 AC_SUBST(HOST_CXXFLAGS)
5508 AC_SUBST(HOST_LDFLAGS)
5509 AC_SUBST(HOST_OPTIMIZE_FLAGS)
5511 AC_SUBST(HOST_AR_FLAGS)
5512 AC_SUBST(HOST_RANLIB)
5513 AC_SUBST(HOST_BIN_SUFFIX)
5515 AC_SUBST(TARGET_XPCOM_ABI)
5516 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
5517 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
5518 AC_SUBST(HAVE_X86_AVX2)
5519 AC_SUBST(HAVE_ALTIVEC)
5520 AC_SUBST(GCC_USE_GNU_LD)
5522 AC_SUBST(WRAP_LDFLAGS)
5525 AC_SUBST(DSO_CFLAGS)
5526 AC_SUBST(DSO_PIC_CFLAGS)
5527 AC_SUBST(DSO_LDOPTS)
5528 AC_SUBST(LIB_PREFIX)
5529 AC_SUBST(DLL_PREFIX)
5530 AC_SUBST(DLL_SUFFIX)
5531 AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
5532 AC_SUBST(LIB_SUFFIX)
5533 AC_SUBST(OBJ_SUFFIX)
5534 AC_SUBST(BIN_SUFFIX)
5535 AC_SUBST(IMPORT_LIB_SUFFIX)
5537 AC_SUBST(CC_VERSION)
5538 AC_SUBST(NS_ENABLE_TSF)
5539 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
5540 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
5542 AC_SUBST(MOZ_VORBIS)
5543 AC_SUBST(MOZ_TREMOR)
5545 AC_SUBST_LIST(FFVPX_ASFLAGS)
5546 AC_SUBST(MOZ_DIRECTSHOW)
5547 AC_SUBST(MOZ_ANDROID_OMX)
5548 AC_SUBST(MOZ_OMX_PLUGIN)
5549 AC_SUBST(MOZ_VPX_ERROR_CONCEALMENT)
5550 AC_SUBST(VPX_USE_YASM)
5551 AC_SUBST_LIST(VPX_ASFLAGS)
5552 AC_SUBST(VPX_AS_CONVERSION)
5553 AC_SUBST(VPX_X86_ASM)
5554 AC_SUBST(VPX_ARM_ASM)
5555 AC_SUBST(MOZ_CODE_COVERAGE)
5556 AC_SUBST(LIBJPEG_TURBO_USE_YASM)
5557 AC_SUBST_LIST(LIBJPEG_TURBO_ASFLAGS)
5558 AC_SUBST(MOZ_LIBAV_FFT)
5559 AC_SUBST_LIST(LIBAV_FFT_ASFLAGS)
5560 AC_SUBST(MOZ_DEVTOOLS)
5562 AC_SUBST(MOZ_PACKAGE_JSSHELL)
5563 AC_SUBST(MOZ_FOLD_LIBS)
5564 AC_SUBST(MOZ_FOLD_LIBS_FLAGS)
5565 AC_SUBST(SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE)
5569 dnl Host JavaScript runtime, if any, to use during cross compiles.
5572 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
5574 if test -n "$COMPILE_ENVIRONMENT"; then
5575 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
5577 dnl Check for missing components
5578 if test "$MOZ_X11"; then
5579 dnl ====================================================
5580 dnl = Check if X headers exist
5581 dnl ====================================================
5582 _SAVE_CFLAGS=$CFLAGS
5583 CFLAGS="$CFLAGS $XCFLAGS"
5587 #include <X11/Xlib.h>
5588 #include <X11/Intrinsic.h>
5589 #include <X11/extensions/XShm.h>
5593 if ((dpy = XOpenDisplay(NULL)) == NULL) {
5594 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
5598 [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
5599 CFLAGS="$_SAVE_CFLAGS"
5601 if test -n "$MISSING_X"; then
5602 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
5607 fi # COMPILE_ENVIRONMENT
5609 dnl Set various defines and substitutions
5610 dnl ========================================================
5612 if test "$MOZ_DEBUG"; then
5613 AC_DEFINE(MOZ_REFLOW_PERF)
5614 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
5617 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
5618 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
5619 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
5620 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
5621 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
5622 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
5623 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
5624 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
5625 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
5628 if test -n "$MOZ_DEV_EDITION"; then
5629 AC_DEFINE(MOZ_DEV_EDITION)
5632 if test "$MOZ_DEBUG"; then
5635 case "$MOZ_UPDATE_CHANNEL" in
5636 aurora|beta|release|esr)
5643 if test -n "$A11Y_LOG"; then
5647 AC_SUBST(MOZILLA_VERSION)
5649 dnl Spit out some output
5650 dnl ========================================================
5652 dnl The following defines are used by xpcom
5653 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
5655 HAVE_CPP_AMBIGUITY_RESOLVING_USING
5656 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
5657 HAVE_CPP_PARTIAL_SPECIALIZATION
5660 HAVE_ICONV_WITH_CONST_INPUT
5673 dnl ========================================================
5674 dnl Determine options to use for running the preprocessor.
5675 dnl ========================================================
5677 if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT"; then
5678 PREPROCESS_OPTION="-P -Fi"
5680 PREPROCESS_OPTION="-E -o "
5683 AC_SUBST(PREPROCESS_OPTION)
5685 dnl ========================================================
5686 dnl mask as shorthand property
5687 dnl ========================================================
5689 # The control structure code will be removed as soon as the feature is stable
5690 # Refer to bug 1281101 for more details.
5691 MOZ_ENABLE_MASK_AS_SHORTHAND=1
5692 AC_DEFINE(MOZ_ENABLE_MASK_AS_SHORTHAND)
5693 AC_SUBST(MOZ_ENABLE_MASK_AS_SHORTHAND)
5695 # Avoid using obsolete NSPR features
5696 AC_DEFINE(NO_NSPR_10_SUPPORT)
5698 # Don't build NSS libpkix
5699 NSS_DISABLE_LIBPKIX=1
5700 AC_SUBST(NSS_DISABLE_LIBPKIX)
5702 MOZ_CREATE_CONFIG_STATUS()
5704 if test "$COMPILE_ENVIRONMENT"; then
5705 MOZ_SUBCONFIGURE_JEMALLOC()
5708 # Run freetype configure script
5710 if test "$MOZ_TREE_FREETYPE"; then
5711 export CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS -std=c99"
5712 export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS"
5713 export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS"
5714 export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS"
5715 # Spaces in the *_CFLAGS and *_LIBS variables are intentionally placed
5716 # to force freetype to use our settings rather than autodetecting
5717 if test -n "$MOZ_SYSTEM_PNG"; then
5718 export LIBPNG_CFLAGS="$MOZ_PNG_CFLAGS "
5720 export LIBPNG_CFLAGS="-I$_objdir/dist/include"
5722 export LIBPNG_LIBS="$MOZ_PNG_LIBS "
5723 export ZLIB_CFLAGS="$MOZ_ZLIB_CFLAGS "
5724 export ZLIB_LIBS="$MOZ_ZLIB_LIBS "
5725 export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
5726 ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes --with-zlib=yes --without-bzip2 --with-png=yes --without-harfbuzz"
5728 if ! test -e modules; then
5731 # Only export CC, CXX and RANLIB for the subconfigure, and avoid spilling
5732 # that further down the road.
5733 (export CC CXX RANLIB;
5734 AC_OUTPUT_SUBDIRS(modules/freetype2)
5738 if test -z "$direct_nspr_config"; then
5739 dnl ========================================================
5740 dnl = Setup a nice relatively clean build environment for
5741 dnl = sub-configures.
5742 dnl ========================================================
5745 CFLAGS="$_SUBDIR_CFLAGS"
5746 CPPFLAGS="$_SUBDIR_CPPFLAGS"
5747 CXXFLAGS="$_SUBDIR_CXXFLAGS"
5748 LDFLAGS="$_SUBDIR_LDFLAGS"
5749 HOST_CC="$_SUBDIR_HOST_CC"
5750 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
5751 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
5752 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
5759 # Run all configure scripts specified by a subconfigure
5760 if test -n "$_subconfigure_subdir"; then
5761 _save_srcdir="$srcdir"
5763 _save_ac_configure_args="$ac_configure_args"
5764 ac_configure_args="$_subconfigure_config_args"
5765 AC_OUTPUT_SUBDIRS_NOW("$_subconfigure_subdir",$cache_file)
5766 ac_configure_args="$_save_ac_configure_args"
5767 srcdir="$_save_srcdir"
5770 if test "$COMPILE_ENVIRONMENT"; then
5774 dnl ========================================================
5775 dnl = Setup a nice relatively clean build environment for
5776 dnl = sub-configures.
5777 dnl ========================================================
5780 CFLAGS="$_SUBDIR_CFLAGS"
5781 CPPFLAGS="$_SUBDIR_CPPFLAGS"
5782 CXXFLAGS="$_SUBDIR_CXXFLAGS"
5783 LDFLAGS="$_SUBDIR_LDFLAGS"
5784 HOST_CC="$_SUBDIR_HOST_CC"
5785 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
5786 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
5787 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
5790 # Run the SpiderMonkey 'configure' script.
5791 dist=$MOZ_BUILD_ROOT/dist
5792 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
5794 # --with-system-nspr will have been converted into the relevant $NSPR_CFLAGS
5796 ac_configure_args="`echo $ac_configure_args | sed -e 's/--with-system-nspr\S* *//'`"
5798 if test "$_INTL_API" = no; then
5799 ac_configure_args="$ac_configure_args --without-intl-api"
5802 if test -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
5803 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
5804 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
5806 ac_configure_args="$ac_configure_args --prefix=$dist"
5807 if test -n "$ZLIB_IN_MOZGLUE"; then
5810 export MOZ_SYSTEM_ZLIB
5811 export MOZ_ZLIB_CFLAGS
5812 export MOZ_ZLIB_LIBS
5814 export MOZ_APP_REMOTINGNAME
5816 export MOZILLA_CENTRAL_PATH=$_topsrcdir
5817 export STLPORT_CPPFLAGS
5822 export ZLIB_IN_MOZGLUE
5836 export HOST_CPPFLAGS
5837 export HOST_CXXFLAGS
5840 if ! test -e js; then
5844 ac_configure_args="$ac_configure_args JS_STANDALONE="
5845 AC_OUTPUT_SUBDIRS(js/src,$cache_file)
5846 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
5848 fi # COMPILE_ENVIRONMENT
5850 dnl we need to run config.status after js/src subconfigure because we're
5851 dnl traversing its moz.build and we need its config.status for that.
5852 dnl However, writing our own config.status needs to happen before
5853 dnl subconfigures because the setup surrounding subconfigures alters
5854 dnl many AC_SUBSTed variables.
5855 MOZ_RUN_ALL_SUBCONFIGURES()
5857 rm -fr confdefs* $ac_clean_files