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
63 GDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_4
64 WINDRES_VERSION=2.14.90
67 STARTUP_NOTIFICATION_VERSION=0.8
71 dnl Set various checks
72 dnl ========================================================
75 dnl Initialize the Pthread test variables early so they can be
76 dnl overridden by each platform.
77 dnl ========================================================
83 if test "$COMPILE_ENVIRONMENT"; then
85 fi # COMPILE_ENVIRONMENT
88 *-android*|*-linuxandroid*)
92 AC_PATH_PROG(OBJCOPY,objcopy)
102 AC_SUBST(ANDROID_SOURCE)
103 AC_SUBST(ANDROID_PACKAGE_NAME)
106 dnl ========================================================
107 dnl Checks for compilers.
108 dnl ========================================================
110 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
113 if test "$COMPILE_ENVIRONMENT"; then
115 if test "$target" != "$host"; then
121 # Work around the conftest.exe access problem on Windows
126 MOZ_PATH_PROGS(AS, $AS as, $CC)
127 AC_CHECK_PROGS(AR, ar, :)
128 AC_CHECK_PROGS(STRIP, strip, :)
129 AC_CHECK_PROGS(WINDRES, windres, :)
130 AC_CHECK_PROGS(OTOOL, otool, :)
131 if test -z "$HOST_RANLIB"; then
132 HOST_RANLIB="$RANLIB"
134 if test -z "$HOST_AR"; then
137 if test -z "$HOST_AR_FLAGS"; then
138 HOST_AR_FLAGS="$AR_FLAGS"
142 if test -n "$MOZ_WINCONSOLE"; then
143 AC_DEFINE(MOZ_WINCONSOLE)
148 dnl ========================================================
149 dnl Special win32 checks
150 dnl ========================================================
156 if test "$GCC" != "yes"; then
157 # Check to see if we are really running in a msvc environemnt
159 AC_CHECK_PROGS(MIDL, midl)
161 # Make sure compilers are valid
162 CFLAGS="$CFLAGS -nologo"
163 CXXFLAGS="$CXXFLAGS -TP -nologo"
166 AC_TRY_COMPILE([#include <stdio.h>],
167 [ printf("Hello World\n"); ],,
168 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
171 AC_TRY_COMPILE([#include <new.h>],
172 [ unsigned *test = new unsigned(42); ],,
173 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
177 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
180 _MSC_VER=`echo ${CC_VERSION} | cut -c 1-2,4-5`
182 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
183 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
184 AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
187 MSVC_C_RUNTIME_DLL=vcruntime140.dll
188 MSVC_CXX_RUNTIME_DLL=msvcp140.dll
190 MOZ_CHECK_HEADER(dia2.h, MSVC_HAS_DIA_SDK=1)
191 if test -n "$MSVC_HAS_DIA_SDK"; then
192 AC_DEFINE(MSVC_HAS_DIA_SDK)
195 if test "$_MSC_VER" -ge "1910"; then # VS2017+
196 # C5038: Enable initializer list order warnings
197 # The -w1#### flag treats warning C#### as if it was a warning level
198 # 1 warning, and thus enables it because we enable /W3 warnings. We
199 # don't use -we#### because it would enable warning C#### but treat
200 # it as an error, even in third-party code.
201 # https://docs.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level
202 CXXFLAGS="$CXXFLAGS -w15038"
205 # C5026: move constructor was implicitly defined as deleted
206 CXXFLAGS="$CXXFLAGS -wd5026"
208 # C5027: move assignment operator was implicitly defined as deleted
209 CXXFLAGS="$CXXFLAGS -wd5027"
211 # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
212 CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
214 # https://connect.microsoft.com/VisualStudio/feedback/details/888527/warnings-on-dbghelp-h
215 # for dbghelp.h, imagehlp.h, and shobj.h
216 # C4091: 'typedef ': ignored on left of '' when no variable is declared
217 CFLAGS="$CFLAGS -wd4091"
218 CXXFLAGS="$CXXFLAGS -wd4091"
220 # This is intended as a temporary hack to support building with VS2015.
221 # 'noexcept' used with no exception handling mode specified;
222 # termination on exception is not guaranteed. Specify /EHsc
223 CXXFLAGS="$CXXFLAGS -wd4577"
225 if test -n "$WIN_UCRT_REDIST_DIR"; then
226 if test ! -d "$WIN_UCRT_REDIST_DIR"; then
227 AC_MSG_ERROR([Invalid Windows UCRT Redist directory: ${WIN_UCRT_REDIST_DIR}])
229 WIN_UCRT_REDIST_DIR=`cd "$WIN_UCRT_REDIST_DIR" && pwd -W`
232 if test -n "$WIN_DIA_SDK_BIN_DIR"; then
233 if test ! -d "$WIN_DIA_SDK_BIN_DIR"; then
234 AC_MSG_ERROR([Invalid Windows DIA SDK directory: ${WIN_DIA_SDK_BIN_DIR}])
236 WIN_DIA_SDK_BIN_DIR=`cd "$WIN_DIA_SDK_BIN_DIR" && pwd -W`
239 AC_SUBST(MSVC_HAS_DIA_SDK)
240 AC_SUBST(MSVC_C_RUNTIME_DLL)
241 AC_SUBST(MSVC_CXX_RUNTIME_DLL)
243 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
245 if test -n "$WIN32_REDIST_DIR"; then
246 if test ! -d "$WIN32_REDIST_DIR"; then
247 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
249 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd -W`
252 # Check linker version, except in lld builds
257 _LD_FULL_VERSION=`"${LINKER}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
258 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
259 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
260 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
267 # Set midl environment
270 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
273 MIDL_FLAGS="${MIDL_FLAGS} -env x64"
277 unset _MSVC_VER_FILTER
279 AC_CACHE_CHECK(for overridable _RAISE,
284 _SAVE_CXXFLAGS="$CXXFLAGS"
285 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
286 AC_TRY_COMPILE([#include <xstddef>
288 #define _RAISE(x) externallyDefinedFunction((x).what())
291 [std::vector<int> v; return v.at(1);],
292 ac_cv_have__RAISE="no",
293 ac_cv_have__RAISE="yes")
294 CXXFLAGS="$_SAVE_CXXFLAGS"
297 if test "$ac_cv_have__RAISE" = "yes"; then
299 MOZ_MSVC_STL_WRAP_RAISE=1
300 AC_DEFINE(MOZ_MSVC_STL_WRAP_RAISE)
302 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.])
305 if test "$WRAP_STL_INCLUDES" = "1"; then
306 STL_FLAGS="-I${DIST}/stl_wrappers"
308 CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
309 CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
311 # Check w32api version
312 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
313 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
314 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
315 AC_TRY_COMPILE([#include <w32api.h>],
316 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
317 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
318 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
319 #error "test failed."
321 , [ res=yes ], [ res=no ])
322 AC_MSG_RESULT([$res])
323 if test "$res" != "yes"; then
324 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
326 # Check windres version
327 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
328 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
329 AC_MSG_RESULT([$_WINDRES_VERSION])
330 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
331 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
332 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
333 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
334 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
335 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
336 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
337 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
338 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
339 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
340 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
341 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
343 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
346 AC_CHECK_PROGS(MIDL, $target-widl widl)
347 if test -n "$MIDL"; then
350 MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
353 MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
358 # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
359 # causing problems with local implementations with the same name.
360 AC_DEFINE(STRSAFE_NO_DEPRECATE)
363 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
364 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
365 # Require OS features provided by IE 8.0 (Win7)
366 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0800)
371 if test -n "$_WIN32_MSVC"; then
373 SKIP_COMPILER_CHECKS=1
374 SKIP_LIBRARY_CHECKS=1
376 # Since we're skipping compiler and library checks, hard-code
379 AC_DEFINE(HAVE_ISATTY)
382 fi # COMPILE_ENVIRONMENT
391 AC_SUBST_LIST(STL_FLAGS)
392 AC_SUBST(WRAP_STL_INCLUDES)
393 AC_SUBST(MOZ_MSVC_STL_WRAP_RAISE)
395 dnl ========================================================
396 dnl Checks for programs.
397 dnl ========================================================
398 if test "$COMPILE_ENVIRONMENT"; then
400 dnl ========================================================
401 dnl = Mac OS X SDK support
402 dnl ========================================================
404 MOZ_ARG_WITH_STRING(macos-sdk,
405 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
406 MACOS_SDK_DIR=$withval)
408 MACOS_PRIVATE_FRAMEWORKS_DIR_DEFAULTED=
409 MOZ_ARG_WITH_STRING(macos-private-frameworks,
410 [ --with-macos-private-frameworks=dir Location of private frameworks to use (Mac OS X only)],
411 MACOS_PRIVATE_FRAMEWORKS_DIR=$withval,
412 MACOS_PRIVATE_FRAMEWORKS_DIR=/System/Library/PrivateFrameworks
413 MACOS_PRIVATE_FRAMEWORKS_DEFAULTED=1)
415 if test -z "${MACOS_PRIVATE_FRAMEWORKS_DEFAULTED}"; then
416 if test -z "$CROSS_COMPILE"; then
417 AC_MSG_WARN([You should only be using --with-macos-private-frameworks when cross-compiling.])
419 if test ! -d "$MACOS_PRIVATE_FRAMEWORKS_DIR"; then
420 AC_MSG_ERROR([PrivateFrameworks directory not found.])
424 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
425 AC_SUBST(MACOS_SDK_DIR)
426 AC_SUBST(MACOS_PRIVATE_FRAMEWORKS_DIR)
428 if test "$MACOS_SDK_DIR"; then
429 dnl Sync this section with the ones in NSPR and NSS.
430 dnl Changes to the cross environment here need to be accounted for in
431 dnl the libIDL checks (below) and xpidl build.
433 if test ! -d "$MACOS_SDK_DIR"; then
434 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
435 specify a valid SDK. SDKs are installed when the optional cross-development
436 tools are selected during the Xcode/Developer Tools installation.])
439 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
440 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
442 dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
443 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
444 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
447 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
449 AC_TRY_COMPILE([#include <new>],[],
453 AC_MSG_RESULT($result)
455 if test "$result" = "no" ; then
456 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
464 fi # COMPILE_ENVIRONMENT
466 dnl ========================================================
467 dnl set the defaults first
468 dnl ========================================================
473 MOZ_USER_DIR=".mozilla"
475 MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
479 dnl Configure platform-specific CPU architecture compiler options.
480 dnl ==============================================================
481 if test "$COMPILE_ENVIRONMENT"; then
484 if test "$OS_TARGET" = Android; then
485 dnl Default Android builds to ARMv7.
488 fi # COMPILE_ENVIRONMENT
490 dnl ========================================================
491 dnl Android libstdc++, placed here so it can use MOZ_ARCH
493 dnl ========================================================
496 if test "$COMPILE_ENVIRONMENT"; then
498 fi # COMPILE_ENVIRONMENT
500 dnl ========================================================
501 dnl Suppress Clang Argument Warnings
502 dnl ========================================================
503 if test -n "${CLANG_CC}${CLANG_CL}"; then
504 _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
505 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
507 if test -n "${CLANG_CXX}${CLANG_CL}"; then
508 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
511 if test -n "$COMPILE_ENVIRONMENT"; then
515 dnl ========================================================
516 dnl Add optional and non-optional hardening flags
517 dnl ========================================================
519 CFLAGS="$CFLAGS $MOZ_HARDENING_CFLAGS"
520 CPPFLAGS="$CPPFLAGS $MOZ_HARDENING_CFLAGS"
521 CXXFLAGS="$CXXFLAGS $MOZ_HARDENING_CFLAGS"
523 dnl ========================================================
524 dnl GNU specific defaults
525 dnl ========================================================
526 if test "$GNU_CC"; then
530 SSSE3_FLAGS="-mssse3"
531 # FIXME: Let us build with strict aliasing. bug 414641.
532 CFLAGS="$CFLAGS -fno-strict-aliasing"
533 MKSHLIB='$(CXX) $(COMPUTED_CXX_LDFLAGS) $(PGO_CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
534 MKCSHLIB='$(CC) $(COMPUTED_C_LDFLAGS) $(PGO_CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
535 WARNINGS_AS_ERRORS='-Werror'
537 DSO_PIC_CFLAGS='-fPIC'
538 ASFLAGS="$ASFLAGS -fPIC"
539 AC_MSG_CHECKING([for --noexecstack option to as])
541 CFLAGS="$CFLAGS -Wa,--noexecstack"
542 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
543 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
546 AC_MSG_CHECKING([for -z noexecstack option to ld])
547 _SAVE_LDFLAGS=$LDFLAGS
548 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
549 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
551 LDFLAGS=$_SAVE_LDFLAGS)
553 AC_MSG_CHECKING([for -z text option to ld])
554 _SAVE_LDFLAGS=$LDFLAGS
555 LDFLAGS="$LDFLAGS -Wl,-z,text"
556 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
558 LDFLAGS=$_SAVE_LDFLAGS)
560 AC_MSG_CHECKING([for -z relro option to ld])
561 _SAVE_LDFLAGS=$LDFLAGS
562 LDFLAGS="$LDFLAGS -Wl,-z,relro"
563 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
565 LDFLAGS=$_SAVE_LDFLAGS)
567 AC_MSG_CHECKING([for --build-id option to ld])
568 _SAVE_LDFLAGS=$LDFLAGS
569 LDFLAGS="$LDFLAGS -Wl,--build-id"
570 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
572 LDFLAGS=$_SAVE_LDFLAGS)
574 AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
575 HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
576 _SAVE_LDFLAGS=$LDFLAGS
577 LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
578 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
579 [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
581 LDFLAGS=$_SAVE_LDFLAGS
583 # Check for -mssse3 on $CC
584 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
585 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
587 CFLAGS="$CFLAGS -mssse3"
588 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
589 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
593 # Check for -msse4.1 on $CC
594 AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
595 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
597 CFLAGS="$CFLAGS -msse4.1"
598 AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
599 [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
603 case "${CPU_ARCH}" in
605 AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
607 [asm volatile ("vpermq \$0xd8,%ymm0,%ymm0 \n");],
608 result="yes", result="no")
609 AC_MSG_RESULT("$result")
610 if test "$result" = "yes"; then
616 AC_MSG_CHECKING([whether we can enable AltiVec support])
619 CFLAGS="$CFLAGS -maltivec"
620 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
628 if test "$GCC_USE_GNU_LD"; then
629 # Some tools like ASan use a runtime library that is only
630 # linked against executables, so we must allow undefined
631 # symbols for shared objects in some cases.
632 if test -z "$MOZ_NO_WLZDEFS"; then
633 # Don't allow undefined symbols in libraries
634 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
636 # BSDs need `environ' exposed for posix_spawn (bug 753046)
638 DragonFly|FreeBSD|NetBSD|OpenBSD)
639 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
640 DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
642 DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
649 _DEFINES_CFLAGS="-include $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
650 _USE_CPP_INCLUDE_FLAG=1
652 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
655 if test "$GNU_CXX"; then
656 # FIXME: Let us build with strict aliasing. bug 414641.
657 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
659 _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
660 _USE_CPP_INCLUDE_FLAG=1
663 # For profiling builds keep the symbol information
664 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
666 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
667 STRIP_FLAGS="--strip-debug"
672 dnl ========================================================
674 dnl ========================================================
676 if test "$MOZ_DMD"; then
677 if test "${CPU_ARCH}" = "arm"; then
678 CFLAGS="$CFLAGS -funwind-tables"
679 CXXFLAGS="$CXXFLAGS -funwind-tables"
683 dnl ========================================================
684 dnl System overrides of the defaults for host
685 dnl ========================================================
688 if test -n "$_WIN32_MSVC"; then
690 HOST_AR_FLAGS='-NOLOGO -OUT:$@'
691 HOST_CFLAGS="$HOST_CFLAGS -nologo"
692 HOST_RANLIB='echo ranlib'
694 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
696 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
697 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
700 case "${host_cpu}" in
702 if test -n "$_WIN32_MSVC"; then
703 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
707 if test -n "$_WIN32_MSVC"; then
708 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
710 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
716 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
717 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
720 *-linux*|*-kfreebsd*-gnu|*-gnu*)
721 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
722 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
726 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
727 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
731 dnl Get version of various core apps from the version files.
732 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
733 FIREFOX_VERSION_DISPLAY=`cat $_topsrcdir/browser/config/version_display.txt`
735 if test -z "$FIREFOX_VERSION"; then
736 AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
739 if test -z "$FIREFOX_VERSION_DISPLAY"; then
740 AC_MSG_ERROR([FIREFOX_VERSION_DISPLAY is unexpectedly blank.])
743 MOZ_DOING_LTO(lto_is_enabled)
745 dnl ========================================================
746 dnl System overrides of the defaults for target
747 dnl ========================================================
751 MKSHLIB='$(CXX) $(COMPUTED_CXX_LDFLAGS) $(PGO_CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
752 MKCSHLIB='$(CC) $(COMPUTED_C_LDFLAGS) $(PGO_CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
753 MOZ_OPTIMIZE_FLAGS="-O3"
754 CXXFLAGS="$CXXFLAGS -stdlib=libc++"
756 STRIP_FLAGS="$STRIP_FLAGS -x -S"
757 # Ensure that if we're targeting iOS an SDK was provided.
758 AC_CACHE_CHECK(for iOS target,
760 [AC_TRY_COMPILE([#include <TargetConditionals.h>
761 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
765 ac_cv_ios_target="yes",
766 ac_cv_ios_target="no")])
767 if test "$ac_cv_ios_target" = "yes" -a -z $MOZ_IOS; then
768 AC_MSG_ERROR([targeting iOS but not using an iOS SDK?])
770 if test -n "$MOZ_IOS"; then
773 # The ExceptionHandling framework is needed for Objective-C exception
774 # logging code in nsObjCExceptions.h. Currently we only use that in debug
776 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
779 if test "x$lto_is_enabled" = "xyes"; then
780 echo "Skipping -dead_strip because lto is enabled."
781 dnl DTrace and -dead_strip don't interact well. See bug 403132.
782 dnl ===================================================================
783 elif test "x$enable_dtrace" = "xyes"; then
784 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
786 dnl check for the presence of the -dead_strip linker flag
787 AC_MSG_CHECKING([for -dead_strip option to ld])
788 _SAVE_LDFLAGS=$LDFLAGS
789 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
790 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
791 if test -n "$_HAVE_DEAD_STRIP" ; then
793 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
798 LDFLAGS=$_SAVE_LDFLAGS
801 MOZ_FIX_LINK_PATHS="-Wl,-executable_path,${DIST}/bin"
804 *-android*|*-linuxandroid*)
805 AC_DEFINE(NO_PW_GECOS)
807 if test "$COMPILE_ENVIRONMENT"; then
811 MOZ_GFX_OPTIMIZE_MOBILE=1
812 if test -z "$CLANG_CC"; then
813 MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
815 # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
816 # -Oz is smaller than -Os on clang.
817 MOZ_OPTIMIZE_FLAGS="-Oz"
822 if test "$GNU_CC" -o "$GNU_CXX"; then
823 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
824 if test -n "$MOZ_DEBUG"; then
825 MOZ_OPTIMIZE_FLAGS="-Os"
827 MOZ_OPTIMIZE_FLAGS="-O2"
829 if test -z "$CLANG_CC"; then
830 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
834 case "${target_cpu}" in
836 CFLAGS="$CFLAGS -mieee"
837 CXXFLAGS="$CXXFLAGS -mieee"
845 # certain versions of cygwin's makedepend barf on the
846 # #include <string> vs -I./dist/include/string issue so don't use it
847 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
851 CFLAGS="$CFLAGS -mms-bitfields"
852 CXXFLAGS="$CXXFLAGS -mms-bitfields"
854 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
855 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
857 # Use static libgcc and libstdc++
858 LDFLAGS="$LDFLAGS -static"
859 # Use temp file for windres (bug 213281)
860 RCFLAGS='-O coff --use-temp-file'
861 # mingw doesn't require kernel32, user32, and advapi32 explicitly
862 LIBS="$LIBS -luuid -lusp10 -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
865 MOZ_OPTIMIZE_FLAGS="-O1"
867 WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
868 WIN32_GUI_EXE_LDFLAGS=-mwindows
870 # GCC/binutils can't link to a function if we try to include dllexport function
871 # in the same library as dllimport caller. To work around it, we build NSPR
872 # and NSS with -mnop-fun-dllimport flag. The drawback of this solution is that
873 # function thunks need to be generated for cross-DLL calls.
874 MOZ_FOLD_LIBS_FLAGS="-mnop-fun-dllimport"
876 TARGET_COMPILER_ABI=msvc
877 if test "$AS_BIN"; then
878 AS="$(basename "$AS_BIN")"
881 AR_FLAGS='-NOLOGO -OUT:$@'
883 RANLIB='echo not_ranlib'
884 STRIP='echo not_strip'
886 MKSHLIB='$(LINKER) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
887 MKCSHLIB='$(LINKER) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
888 WIN32_SUBSYSTEM_VERSION=6.01
889 WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
890 WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
891 DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
892 _USE_CPP_INCLUDE_FLAG=1
893 _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
894 _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
895 CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
896 CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
897 if test -z "$CLANG_CL"; then
898 CPPFLAGS="$CPPFLAGS -utf-8"
900 if test "$CPU_ARCH" = "x86"; then
901 dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
902 dnl more recent, so set that explicitly here unless another
903 dnl target arch has already been set.
905 if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
906 CFLAGS="$CFLAGS -arch:SSE2"
908 if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
909 CXXFLAGS="$CXXFLAGS -arch:SSE2"
912 SSE_FLAGS="-arch:SSE"
913 SSE2_FLAGS="-arch:SSE2"
914 dnl MSVC allows the use of intrinsics without any flags
915 dnl and doesn't have a separate arch for SSSE3
916 SSSE3_FLAGS="-arch:SSE2"
918 dnl clang-cl requires appropriate flags to enable SSSE3 support
919 dnl on all architectures.
920 if test -n "$CLANG_CL"; then
921 SSSE3_FLAGS="-mssse3"
923 dnl VS2013+ supports -Gw for better linker optimizations.
924 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
925 dnl Disabled on ASan because it causes false-positive ODR violations.
926 if test -z "$MOZ_ASAN"; then
928 CXXFLAGS="$CXXFLAGS -Gw"
930 # khuey says we can safely ignore MSVC warning C4251
931 # MSVC warning C4244 (implicit type conversion may lose data) warns
932 # and requires workarounds for perfectly valid code. Also, GCC/clang
933 # don't warn about it by default. So for consistency/sanity, we turn
934 # it off on MSVC, too.
935 # MSVC warning C4267 warns for narrowing type conversions from size_t
936 # to 32-bit integer types on 64-bit platforms. Since this is virtually
937 # the same thing as C4244, we disable C4267, too.
938 # MSVC warning C4800 warns when a value is implicitly cast to bool,
939 # because this also forces narrowing to a single byte, which can be a
940 # perf hit. But this matters so little in practice (and often we want
941 # that behavior) that it's better to turn it off.
942 # MSVC warning C4595 warns non-member operator new or delete functions
943 # may not be declared inline, as of VS2015 Update 2.
944 CFLAGS="$CFLAGS -wd4244 -wd4267"
945 CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4267 -wd4800 -wd4595"
946 # Silence "warning C4065: switch statement contains 'default' but no
947 # 'case' labels". See bug 1461304.
948 CXXFLAGS="$CXXFLAGS -wd4065"
949 if test -n "$CLANG_CL"; then
950 # XXX We should combine some of these with our generic GCC-style
953 # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
954 CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
955 # We use offsetof on non-POD objects all the time.
956 # We also suppress this warning on other platforms.
957 CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
958 # This warns for reasonable things like:
959 # enum { X = 0xffffffffU };
960 # which is annoying for IDL headers.
961 CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
962 # This warns for cases that would be reached by the Microsoft
963 # #include rules, but also currently warns on cases that would
964 # *also* be reached by standard C++ include rules. That
965 # behavior doesn't seem useful, so we turn it off.
966 CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
967 # We normally error out on unknown pragmas, but since clang-cl
968 # claims to be MSVC, it would be difficult to add
969 # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
970 # use such pragmas, so just ignore them.
971 CFLAGS="$CFLAGS -Wno-unknown-pragmas"
972 CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
973 # We get errors about various #pragma intrinsic directives from
974 # clang-cl, and we don't need to hear about those.
975 CFLAGS="$CFLAGS -Wno-ignored-pragmas"
976 CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
977 # clang-cl's Intrin.h marks things like _ReadWriteBarrier
978 # as __attribute((__deprecated__)). This is nice to know,
979 # but since we don't get the equivalent warning from MSVC,
980 # let's just ignore it.
981 CFLAGS="$CFLAGS -Wno-deprecated-declarations"
982 CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
983 # We use a function like:
984 # __declspec(noreturn) __inline void f() {}
985 # which -Winvalid-noreturn complains about. Again, MSVC seems
986 # OK with it, so let's silence the warning.
987 CFLAGS="$CFLAGS -Wno-invalid-noreturn"
988 CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
989 # Missing |override| on virtual function declarations isn't
990 # something that MSVC currently warns about.
991 CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
992 # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
993 # declaration on |operator delete(void*)|. However, clang-cl
994 # must internally declare |operator delete(void*)| differently,
995 # which causes this warning for virtually every file in the
996 # tree. clang-cl doesn't support -fno-exceptions or equivalent,
997 # so there doesn't seem to be any way to convince clang-cl to
998 # declare |delete| differently. Therefore, suppress this
1000 CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
1001 # At least one MSVC header and several headers in-tree have
1002 # unused typedefs, so turn this on.
1003 CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
1004 # jemalloc uses __declspec(allocator) as a profiler hint,
1005 # which clang-cl doesn't understand.
1006 CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
1008 # make 'foo == bar;' error out
1009 CFLAGS="$CFLAGS -we4553"
1010 CXXFLAGS="$CXXFLAGS -we4553"
1011 # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
1012 CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
1013 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
1014 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1015 WARNINGS_AS_ERRORS='-WX'
1016 # Use a higher optimization level for clang-cl, so we can come closer
1017 # to MSVC's performance numbers (see bug 1443590).
1018 if test -n "$CLANG_CL"; then
1019 MOZ_OPTIMIZE_FLAGS='-O2'
1021 MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
1024 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
1025 if test -z "$DEVELOPER_OPTIONS"; then
1026 LDFLAGS="$LDFLAGS -RELEASE"
1028 LDFLAGS="$LDFLAGS -DYNAMICBASE"
1030 dnl Minimum reqiurement of Gecko is VS2015 or later which supports
1031 dnl both SSSE3 and SSE4.1.
1032 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
1033 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
1034 dnl allow AVX2 code from VS2015
1037 AC_DEFINE(WIN32_LEAN_AND_MEAN)
1038 dnl See http://support.microsoft.com/kb/143208 to use STL
1041 MOZ_USER_DIR="Mozilla"
1045 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.])
1049 if test -n "$GNU_CC"; then
1050 CFLAGS="$CFLAGS -fno-keep-inline-dllexport"
1051 CXXFLAGS="$CXXFLAGS -fno-keep-inline-dllexport"
1056 if test -n "$GNU_CC"; then
1057 CFLAGS="$CFLAGS -mstackrealign"
1058 CXXFLAGS="$CXXFLAGS -mstackrealign"
1059 LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup -Wl,--large-address-aware"
1061 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
1062 LDFLAGS="$LDFLAGS -SAFESEH"
1068 if test -n "$_WIN32_MSVC"; then
1069 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
1074 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
1081 CFLAGS="$CFLAGS -Dunix"
1082 CXXFLAGS="$CXXFLAGS -Dunix"
1083 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
1084 DSO_PIC_CFLAGS='-fPIC -DPIC'
1085 DSO_LDOPTS='-shared'
1086 MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
1088 DSO_PIC_CFLAGS='-fPIC -DPIC'
1089 DSO_LDOPTS='-shared'
1091 # This will fail on a.out systems prior to 1.5.1_ALPHA.
1092 if test "$LIBRUNPATH"; then
1093 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
1095 MKSHLIB='$(CXX) $(COMPUTED_CXX_LDFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
1096 MKCSHLIB='$(CC) $(COMPUTED_C_LDFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
1100 if test -z "$X11BASE"; then
1103 MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
1105 DSO_PIC_CFLAGS='-fPIC'
1106 DSO_LDOPTS='-shared -fPIC'
1107 if test "$LIBRUNPATH"; then
1108 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
1113 MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
1118 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
1119 MOZ_OPTIMIZE_FLAGS="-O"
1122 AC_SUBST_LIST(MMX_FLAGS)
1123 AC_SUBST_LIST(SSE_FLAGS)
1124 AC_SUBST_LIST(SSE2_FLAGS)
1125 AC_SUBST_LIST(SSSE3_FLAGS)
1127 AC_SUBST(MOZ_LINKER)
1128 if test -n "$MOZ_LINKER"; then
1129 AC_DEFINE(MOZ_LINKER)
1130 MOZ_LINKER_EXTRACT=1
1131 AC_CHECK_PROGS(XZ, xz)
1134 if test -z "$COMPILE_ENVIRONMENT"; then
1135 SKIP_COMPILER_CHECKS=1
1136 SKIP_LIBRARY_CHECKS=1
1141 fi # COMPILE_ENVIRONMENT
1143 if test -z "$SKIP_COMPILER_CHECKS"; then
1144 dnl Checks for typedefs, structures, and compiler characteristics.
1145 dnl ========================================================
1160 case "${OS_TARGET}" in
1164 STL_FLAGS="-I${DIST}/stl_wrappers"
1169 dnl Checks for header files.
1170 dnl ========================================================
1172 case "$target_os" in
1173 bitrig*|dragonfly*|freebsd*|openbsd*)
1174 # for stuff like -lXshm
1175 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
1179 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
1180 AC_CACHE_CHECK(for sockaddr_in.sin_len,
1181 ac_cv_sockaddr_in_sin_len,
1182 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1183 #include <sys/types.h>
1185 #include <netinet/in.h>
1186 struct sockaddr_in x;
1187 void *foo = (void*) &x.sin_len;],
1189 [ac_cv_sockaddr_in_sin_len=true],
1190 [ac_cv_sockaddr_in_sin_len=false])])
1191 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
1192 AC_DEFINE(HAVE_SIN_LEN)
1193 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
1194 AC_DEFINE(HAVE_SCONN_LEN)
1197 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
1198 ac_cv_sockaddr_in6_sin6_len,
1199 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1200 #include <sys/types.h>
1202 #include <netinet/in.h>
1203 struct sockaddr_in6 x;
1204 void *foo = (void*) &x.sin6_len;],
1206 [ac_cv_sockaddr_in6_sin6_len=true],
1207 [ac_cv_sockaddr_in6_sin6_len=false])])
1208 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
1209 AC_DEFINE(HAVE_SIN6_LEN)
1212 AC_CACHE_CHECK(for sockaddr.sa_len,
1213 ac_cv_sockaddr_sa_len,
1214 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1215 #include <sys/types.h>
1217 #include <sys/socket.h>
1219 void *foo = (void*) &x.sa_len;],
1221 [ac_cv_sockaddr_sa_len=true],
1222 [ac_cv_sockaddr_sa_len=false])])
1223 if test "$ac_cv_sockaddr_sa_len" = true ; then
1224 AC_DEFINE(HAVE_SA_LEN)
1227 MOZ_ARG_ENABLE_BOOL(dtrace,
1228 [ --enable-dtrace build with dtrace support if available (default=no)],
1229 [enable_dtrace="yes"],)
1230 if test "x$enable_dtrace" = "xyes"; then
1231 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
1232 if test -n "$HAVE_DTRACE"; then
1233 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
1235 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
1238 AC_SUBST(HAVE_DTRACE)
1240 dnl Checks for libraries.
1241 dnl ========================================================
1242 AC_CHECK_LIB(c_r, gethostbyname_r)
1244 dnl We don't want to link with libdl even if it's present on OS X, since
1245 dnl it's not used and not part of the default installation. OS/2 has dlfcn
1247 dnl We don't want to link against libm or libpthread on Darwin since
1248 dnl they both are just symlinks to libSystem and explicitly linking
1249 dnl against libSystem causes issues when debugging (see bug 299601).
1254 AC_SEARCH_LIBS(dlopen, dl,
1255 MOZ_CHECK_HEADER(dlfcn.h,
1256 AC_DEFINE(HAVE_DLOPEN)))
1260 _SAVE_CFLAGS="$CFLAGS"
1261 CFLAGS="$CFLAGS -D_GNU_SOURCE"
1262 AC_CHECK_FUNCS(dladdr memmem)
1263 CFLAGS="$_SAVE_CFLAGS"
1265 if test ! "$GNU_CXX"; then
1266 AC_CHECK_LIB(C, demangle)
1269 AC_CHECK_LIB(socket, socket)
1272 XLIBS="$X_EXTRA_LIBS"
1274 dnl ========================================================
1275 dnl Checks for X libraries.
1276 dnl Ordering is important.
1277 dnl Xt is dependent upon SM as of X11R6
1278 dnl ========================================================
1279 if test -n "$MOZ_X11"; then
1280 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
1281 _SAVE_LDFLAGS="$LDFLAGS"
1283 LDFLAGS="$XLDFLAGS $LDFLAGS"
1284 AC_CHECK_LIB(X11, XDrawLines, [XLIBS="-lX11 $XLIBS"],
1285 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
1286 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
1287 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
1289 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
1290 unset ac_cv_lib_Xt_XtFree
1291 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
1292 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
1293 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
1294 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
1297 dnl ========================================================
1299 dnl ========================================================
1300 AC_CHECK_LIB(xcb, xcb_connect, [XLIBS="-lxcb $XLIBS"],
1301 [MISSING_X="$MISSING_X -lxcb"], $XLIBS)
1302 AC_CHECK_LIB(xcb-shm, xcb_shm_query_version, [XLIBS="-lxcb-shm $XLIBS"],
1303 [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS)
1304 AC_CHECK_LIB(X11-xcb, XGetXCBConnection, [XLIBS="-lX11-xcb $XLIBS"],
1305 [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS)
1307 LDFLAGS="$_SAVE_LDFLAGS"
1311 AC_SUBST_LIST(XCFLAGS)
1312 AC_SUBST_LIST(XLDFLAGS)
1313 AC_SUBST_LIST(XLIBS)
1314 AC_SUBST_LIST(XEXT_LIBS)
1315 AC_SUBST_LIST(XT_LIBS)
1317 dnl ========================================================
1318 dnl = pthread support
1319 dnl = Start by checking whether the system support pthreads
1320 dnl ========================================================
1321 case "$target_os" in
1326 AC_CHECK_LIB(pthreads, pthread_create,
1327 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
1328 AC_CHECK_LIB(pthread, pthread_create,
1329 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
1330 AC_CHECK_LIB(c_r, pthread_create,
1331 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
1332 AC_CHECK_LIB(c, pthread_create,
1341 dnl ========================================================
1342 dnl Do the platform specific pthread hackery
1343 dnl ========================================================
1344 if test "$MOZ_USE_PTHREADS"x != x
1347 dnl See if -pthread is supported.
1350 ac_cv_have_dash_pthread=no
1351 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
1352 echo 'int main() { return 0; }' | cat > conftest.c
1353 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
1354 if test $? -eq 0; then
1355 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1356 ac_cv_have_dash_pthread=yes
1357 case "$target_os" in
1359 # Freebsd doesn't use -pthread for compiles, it uses them for linking
1362 CFLAGS="$CFLAGS -pthread"
1363 CXXFLAGS="$CXXFLAGS -pthread"
1369 AC_MSG_RESULT($ac_cv_have_dash_pthread)
1372 dnl See if -pthreads is supported.
1374 ac_cv_have_dash_pthreads=no
1375 if test "$ac_cv_have_dash_pthread" = "no"; then
1376 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
1377 echo 'int main() { return 0; }' | cat > conftest.c
1378 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
1379 if test $? -eq 0; then
1380 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1381 ac_cv_have_dash_pthreads=yes
1382 CFLAGS="$CFLAGS -pthreads"
1383 CXXFLAGS="$CXXFLAGS -pthreads"
1387 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
1392 AC_DEFINE(_REENTRANT)
1393 AC_DEFINE(_THREAD_SAFE)
1394 dnl -pthread links in -lpthread, so don't specify it explicitly.
1395 if test "$ac_cv_have_dash_pthread" = "yes"; then
1396 _PTHREAD_LDFLAGS="-pthread"
1400 *-*-openbsd*|*-*-bsdi*)
1401 AC_DEFINE(_REENTRANT)
1402 AC_DEFINE(_THREAD_SAFE)
1403 dnl -pthread links in -lc_r, so don't specify it explicitly.
1404 if test "$ac_cv_have_dash_pthread" = "yes"; then
1405 _PTHREAD_LDFLAGS="-pthread"
1409 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
1410 AC_DEFINE(_REENTRANT)
1414 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
1415 AC_SUBST(MOZ_USE_PTHREADS)
1416 MOZ_CHECK_HEADERS(pthread.h)
1420 dnl Checks for library functions.
1421 dnl ========================================================
1422 AC_PROG_GCC_TRADITIONAL
1424 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall)
1426 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1427 dnl avoid this on Darwin, since depending on your system config, we may think
1428 dnl it exists but it really doesn't
1429 case "$OS_TARGET" in
1433 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1434 ac_cv_clock_monotonic,
1435 [for libs in "" -lrt; do
1438 AC_TRY_LINK([#include <time.h>],
1439 [ struct timespec ts;
1440 clock_gettime(CLOCK_MONOTONIC, &ts); ],
1441 ac_cv_clock_monotonic=$libs
1444 ac_cv_clock_monotonic=no)
1447 if test "$ac_cv_clock_monotonic" != "no"; then
1448 HAVE_CLOCK_MONOTONIC=1
1449 REALTIME_LIBS=$ac_cv_clock_monotonic
1450 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1451 AC_SUBST(HAVE_CLOCK_MONOTONIC)
1452 AC_SUBST_LIST(REALTIME_LIBS)
1457 AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
1458 ac_cv_pthread_cond_timedwait_monotonic_np,
1459 AC_TRY_LINK([#include <pthread.h>],
1460 [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
1461 ac_cv_pthread_cond_timewait_monotonic_np=yes,
1462 ac_cv_pthread_cond_timewait_monotonic_np=no))
1463 if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
1464 AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
1469 ac_cv_func_res_ninit,
1470 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
1471 dnl no need for res_ninit() on NetBSD and OpenBSD
1472 ac_cv_func_res_ninit=no
1476 #define _BSD_SOURCE 1
1478 #include <sys/types.h>
1479 #include <netinet/in.h>
1480 #include <arpa/nameser.h>
1483 [int foo = res_ninit(&_res);],
1484 [ac_cv_func_res_ninit=yes],
1485 [ac_cv_func_res_ninit=no])
1489 if test "$ac_cv_func_res_ninit" = "yes"; then
1490 AC_DEFINE(HAVE_RES_NINIT)
1491 dnl must add the link line we do something as foolish as this... dougt
1493 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
1494 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
1499 dnl **********************
1500 dnl *** va_copy checks ***
1501 AC_CACHE_CHECK([for an implementation of va_copy()],
1503 [AC_TRY_COMPILE([#include <stdarg.h>
1505 void f (int i, ...) {
1506 va_list args1, args2;
1507 va_start (args1, i);
1508 va_copy (args2, args1);
1509 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1511 va_end (args1); va_end (args2);
1513 [f(0, 42); return 0],
1514 [ac_cv_va_copy=yes],
1518 AC_CACHE_CHECK([whether va_list can be copied by value],
1520 [AC_TRY_COMPILE([#include <stdarg.h>
1522 void f (int i, ...) {
1523 va_list args1, args2;
1524 va_start (args1, i);
1526 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1528 va_end (args1); va_end (args2);
1530 [f(0, 42); return 0],
1531 [ac_cv_va_val_copy=yes],
1532 [ac_cv_va_val_copy=no],
1535 if test "x$ac_cv_va_copy" = "xyes"; then
1536 AC_DEFINE(VA_COPY, va_copy)
1537 AC_DEFINE(HAVE_VA_COPY)
1540 if test "x$ac_cv_va_val_copy" = "xno"; then
1541 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
1544 dnl ===================================================================
1545 dnl ========================================================
1546 dnl Put your C++ language/feature checks below
1547 dnl ========================================================
1551 if test "$GNU_CC"; then
1552 if test "$CPU_ARCH" = "arm" ; then
1553 AC_CACHE_CHECK(for ARM EABI,
1557 #if defined(__ARM_EABI__)
1560 #error Not ARM EABI.
1563 ac_cv_gcc_arm_eabi="yes",
1564 ac_cv_gcc_arm_eabi="no")])
1565 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
1567 ARM_ABI_PREFIX=eabi-
1569 ARM_ABI_PREFIX=oabi-
1573 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
1576 dnl See if a dynamic_cast to void* gives the most derived object.
1577 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
1578 ac_cv_cpp_dynamic_cast_void_ptr,
1579 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
1580 class Y { int j; public: virtual ~Y() { } };
1581 class Z : public X, public Y { int k; };
1587 return !((((void*)&mdo != (void*)subx) &&
1588 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
1589 (((void*)&mdo != (void*)suby) &&
1590 ((void*)&mdo == dynamic_cast<void*>(suby))));
1592 ac_cv_cpp_dynamic_cast_void_ptr=yes,
1593 ac_cv_cpp_dynamic_cast_void_ptr=no,
1594 ac_cv_cpp_dynamic_cast_void_ptr=no)])
1595 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
1596 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
1600 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
1601 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
1602 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
1604 _SAVE_LDFLAGS=$LDFLAGS
1605 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
1606 AC_CACHE_CHECK(for __thread keyword for TLS variables,
1607 ac_cv_thread_keyword,
1608 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
1609 [return tlsIsMainThread;],
1610 ac_cv_thread_keyword=yes,
1611 ac_cv_thread_keyword=no)])
1612 LDFLAGS=$_SAVE_LDFLAGS
1613 # The custom dynamic linker doesn't support TLS variables
1615 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
1616 # mips builds fail with TLS variables because of a binutils bug.
1618 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
1623 *-android*|*-linuxandroid*)
1630 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
1636 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
1637 if test -n "$MOZ_LINKER"; then
1638 if test "$CPU_ARCH" = arm; then
1639 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
1640 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
1641 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1642 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1646 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
1647 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
1648 dnl Since the linker only understands the sysv ones, no need to build the
1649 dnl gnu style tables anyways.
1650 LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
1653 dnl End of C++ language/feature checks
1656 dnl ========================================================
1657 dnl = Internationalization checks
1658 dnl ========================================================
1660 dnl Internationalization and Locale support is different
1661 dnl on various UNIX platforms. Checks for specific i18n
1662 dnl features go here.
1664 AC_HAVE_FUNCS(localeconv)
1666 fi # ! SKIP_COMPILER_CHECKS
1668 if test -n "${COMPILE_ENVIRONMENT}"; then
1673 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1674 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1675 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1678 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1679 dnl features that Windows actually does support.
1681 if test -n "$SKIP_COMPILER_CHECKS"; then
1682 dnl Windows has malloc.h
1683 AC_DEFINE(MALLOC_H, [<malloc.h>])
1684 AC_DEFINE(HAVE_FORCEINLINE)
1685 AC_DEFINE(HAVE_LOCALECONV)
1686 fi # SKIP_COMPILER_CHECKS
1688 dnl Mozilla specific options
1689 dnl ========================================================
1690 dnl The macros used for command line options
1691 dnl are defined in build/autoconf/altoptions.m4.
1693 dnl ========================================================
1695 dnl = Check for external package dependencies
1697 dnl ========================================================
1698 MOZ_ARG_HEADER(External Packages)
1700 case "$OS_TARGET" in
1701 WINNT|Darwin|Android)
1711 dnl ========================================================
1712 dnl system libevent Support
1713 dnl ========================================================
1714 MOZ_ARG_WITH_STRING(system-libevent,
1715 [ --with-system-libevent[=PFX]
1716 Use system libevent [installed at prefix PFX]],
1717 LIBEVENT_DIR=$withval)
1719 _SAVE_CFLAGS=$CFLAGS
1720 _SAVE_LDFLAGS=$LDFLAGS
1722 if test "$LIBEVENT_DIR" = yes; then
1723 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
1724 MOZ_SYSTEM_LIBEVENT=1,
1727 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
1728 MOZ_SYSTEM_LIBEVENT=
1729 elif test -z "$MOZ_SYSTEM_LIBEVENT"; then
1730 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
1731 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
1732 MOZ_CHECK_HEADER(event.h,
1733 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
1734 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
1736 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
1737 AC_CHECK_LIB(event, event_init,
1738 [MOZ_SYSTEM_LIBEVENT=1
1739 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
1740 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
1741 [MOZ_SYSTEM_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
1743 CFLAGS=$_SAVE_CFLAGS
1744 LDFLAGS=$_SAVE_LDFLAGS
1747 AC_SUBST(MOZ_SYSTEM_LIBEVENT)
1749 dnl ========================================================
1750 dnl = If NSS was not detected in the system,
1751 dnl = use the one in the source tree (mozilla/security/nss)
1752 dnl ========================================================
1754 MOZ_ARG_WITH_BOOL(system-nss,
1755 [ --with-system-nss Use system installed NSS],
1758 if test -n "$_USE_SYSTEM_NSS"; then
1759 AM_PATH_NSS(3.38, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
1762 if test -z "$MOZ_SYSTEM_NSS"; then
1763 NSS_CFLAGS="-I${DIST}/include/nss"
1764 case "${OS_ARCH}" in
1765 # Only few platforms have been tested with GYP
1766 WINNT|Darwin|Linux|DragonFly|FreeBSD|NetBSD|OpenBSD|SunOS)
1769 AC_MSG_ERROR([building in-tree NSS is not supported on this platform. Use --with-system-nss])
1774 if test -z "$SKIP_LIBRARY_CHECKS"; then
1775 dnl system JPEG support
1776 dnl ========================================================
1777 MOZ_ARG_WITH_STRING(system-jpeg,
1778 [ --with-system-jpeg[=PFX]
1779 Use system libjpeg [installed at prefix PFX]],
1782 _SAVE_CFLAGS=$CFLAGS
1783 _SAVE_LDFLAGS=$LDFLAGS
1785 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
1786 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
1787 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
1789 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
1792 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_SYSTEM_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_SYSTEM_JPEG=)
1795 if test "$MOZ_SYSTEM_JPEG" = 1; then
1796 AC_TRY_COMPILE([ #include <stdio.h>
1797 #include <sys/types.h>
1798 #include <jpeglib.h> ],
1799 [ #if JPEG_LIB_VERSION < $MOZJPEG
1800 #error "Insufficient JPEG library version ($MOZJPEG required)."
1802 #ifndef JCS_EXTENSIONS
1803 #error "libjpeg-turbo JCS_EXTENSIONS required"
1807 AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
1809 CFLAGS=$_SAVE_CFLAGS
1810 LDFLAGS=$_SAVE_LDFLAGS
1813 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_SYSTEM_JPEG" = 1; then
1814 MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
1815 MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
1817 fi # SKIP_LIBRARY_CHECKS
1819 dnl system ZLIB support
1820 dnl ========================================================
1821 MOZ_ZLIB_CHECK([1.2.3])
1823 if test -z "$SKIP_LIBRARY_CHECKS"; then
1825 dnl ========================================================
1826 dnl system PNG Support
1827 dnl ========================================================
1828 MOZ_ARG_WITH_STRING(system-png,
1829 [ --with-system-png[=PFX]
1830 Use system libpng [installed at prefix PFX]],
1833 _SAVE_CFLAGS=$CFLAGS
1834 _SAVE_LDFLAGS=$LDFLAGS
1836 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
1837 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
1838 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
1840 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
1843 AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"],
1844 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1845 AC_CHECK_LIB(png, png_get_acTL, ,
1846 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
1848 if test "$MOZ_SYSTEM_PNG" = 1; then
1849 AC_TRY_COMPILE([ #include <stdio.h>
1850 #include <sys/types.h>
1852 [ #if PNG_LIBPNG_VER < $MOZPNG
1853 #error "Insufficient libpng version ($MOZPNG required)."
1855 #ifndef PNG_UINT_31_MAX
1856 #error "Insufficient libpng version."
1859 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1861 CFLAGS=$_SAVE_CFLAGS
1862 LDFLAGS=$_SAVE_LDFLAGS
1865 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then
1866 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
1867 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
1870 fi # SKIP_LIBRARY_CHECKS
1872 dnl ========================================================
1876 dnl ========================================================
1878 MOZ_ARG_HEADER(Application)
1880 ENABLE_SYSTEM_EXTENSION_DIRS=1
1881 MOZ_BRANDING_DIRECTORY=
1882 MOZ_OFFICIAL_BRANDING=
1884 MOZ_AUTH_EXTENSION=1
1885 if test "$MOZ_IOS"; then
1890 MOZ_WEBRTC_HARDWARE_AEC_NS=
1898 LIBJPEG_TURBO_ASFLAGS=
1899 MOZ_PREF_EXTENSIONS=1
1902 MOZ_TOOLKIT_SEARCH=1
1903 MOZ_UNIVERSALCHARDET=1
1908 MOZ_USE_NATIVE_POPUP_WINDOWS=
1909 MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
1911 MOZ_CONTENT_SANDBOX=
1914 MOZ_BINARY_EXTENSIONS=
1917 case "$target_os" in
1920 AC_DEFINE(NS_ENABLE_TSF)
1925 *-android*|*-linuxandroid*)
1931 # Optional Firefox for Android partner distribution directory.
1932 MOZ_ARG_WITH_STRING(android-distribution-directory,
1933 [ --with-android-distribution-directory=dir
1934 Optional Firefox for Android partner distribution directory.],
1935 MOZ_ANDROID_DISTRIBUTION_DIRECTORY=$withval)
1937 if test -n "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY"; then
1938 # A distribution directory must have an assets/distribution directory.
1939 # See https://wiki.mozilla.org/Mobile/Distribution_Files.
1940 if test ! -d "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY/assets/distribution" ; then
1941 AC_MSG_ERROR([--with-android-distribution-directory does not contain assets/distribution;
1942 (looked for ${MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets/distribution).])
1945 AC_SUBST(MOZ_ANDROID_DISTRIBUTION_DIRECTORY)
1947 dnl ========================================================
1948 dnl = Trademarked Branding
1949 dnl ========================================================
1950 MOZ_ARG_ENABLE_BOOL(official-branding,
1951 [ --enable-official-branding
1952 Enable Official mozilla.org Branding
1953 Do not distribute builds with
1954 --enable-official-branding unless you have
1955 permission to use trademarks per
1956 http://www.mozilla.org/foundation/trademarks/ .],
1957 MOZ_OFFICIAL_BRANDING=1,
1958 MOZ_OFFICIAL_BRANDING=)
1960 # Allow the application to influence configure with a confvars.sh script.
1961 AC_MSG_CHECKING([if app-specific confvars.sh exists])
1962 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
1963 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
1964 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
1969 # Allow influencing configure with a defines.sh script.
1970 . "${srcdir}/build/defines.sh"
1972 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
1974 if test "$BUILDING_RELEASE"; then
1975 # Override value in defines.sh, if any
1976 EARLY_BETA_OR_EARLIER=
1977 elif test "$EARLY_BETA_OR_EARLIER"; then
1978 AC_DEFINE(EARLY_BETA_OR_EARLIER)
1980 AC_SUBST(EARLY_BETA_OR_EARLIER)
1982 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
1983 MOZ_ARG_WITH_STRING(app-name,
1984 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
1985 WITH_APP_NAME=$withval,
1988 if test -n "$WITH_APP_NAME" ; then
1989 MOZ_APP_NAME="$WITH_APP_NAME"
1992 MOZ_ARG_WITH_STRING(app-basename,
1993 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
1994 WITH_APP_BASENAME=$withval,
1997 if test -n "$WITH_APP_BASENAME" ; then
1998 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
2001 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
2002 # that haven't made a confvars.sh yet. Don't add new stuff here, use
2004 case "$MOZ_BUILD_APP" in
2006 AC_DEFINE(MOZ_PHOENIX)
2010 AC_DEFINE(MOZ_XULRUNNER)
2014 # Graphene is a desktop runtime for running applications with a HTML UI.
2015 if test -n "$MOZ_GRAPHENE"; then
2016 AC_DEFINE(MOZ_GRAPHENE)
2019 if test -n "$MOZ_MULET"; then
2020 AC_DEFINE(MOZ_MULET)
2023 AC_SUBST(MOZ_PHOENIX)
2024 AC_SUBST(MOZ_XULRUNNER)
2027 dnl ========================================================
2028 dnl Ensure Android SDK and build-tools versions depending on
2030 dnl ========================================================
2032 case "$MOZ_BUILD_APP" in
2034 MOZ_ANDROID_SDK(26, 23, 26.0.2)
2038 dnl ========================================================
2040 dnl = Toolkit Options
2042 dnl ========================================================
2043 MOZ_ARG_HEADER(Toolkit Options)
2045 dnl ========================================================
2046 dnl = Enable the toolkit as needed =
2047 dnl ========================================================
2049 case "$MOZ_WIDGET_TOOLKIT" in
2052 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
2053 # Use -Wl as a trick to avoid -framework and framework names from
2054 # being separated by AC_SUBST_LIST.
2055 TK_LIBS='-Wl,-framework,Foundation -Wl,-framework,CoreFoundation -Wl,-framework,CoreLocation -Wl,-framework,QuartzCore -Wl,-framework,Carbon -Wl,-framework,CoreAudio -Wl,-framework,CoreVideo -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit -Wl,-framework,AddressBook -Wl,-framework,OpenGL -Wl,-framework,Security -Wl,-framework,ServiceManagement -Wl,-framework,CoreServices -Wl,-framework,ApplicationServices -Wl,-framework,AppKit'
2057 CFLAGS="$CFLAGS $TK_CFLAGS"
2058 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
2059 MOZ_USER_DIR="Mozilla"
2060 MOZ_FS_LAYOUT=bundle
2064 LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
2066 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'
2067 CFLAGS="$CFLAGS $TK_CFLAGS"
2068 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
2069 MOZ_USER_DIR="Mozilla"
2070 MOZ_FS_LAYOUT=bundle
2075 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
2076 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
2077 case "$MOZ_WIDGET_TOOLKIT" in
2083 if test "$COMPILE_ENVIRONMENT"; then
2084 if test "$MOZ_WIDGET_TOOLKIT" = gtk3; then
2085 PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 gio-unix-2.0 $GDK_PACKAGES)
2086 MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
2087 TK_CFLAGS=$MOZ_GTK3_CFLAGS
2088 TK_LIBS=$MOZ_GTK3_LIBS
2089 dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
2090 dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
2091 AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
2092 GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32
2094 if test "$MOZ_WIDGET_TOOLKIT" = gtk2; then
2095 GLIB_VERSION_MAX_ALLOWED=$GLIB_VERSION_MIN_REQUIRED
2097 if test "$MOZ_ENABLE_GTK"; then
2098 if test "$MOZ_X11"; then
2099 GDK_PACKAGES=gdk-x11-2.0
2101 AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
2102 AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
2104 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 >= $GLIB_VERSION gobject-2.0 gio-unix-2.0 $GDK_PACKAGES)
2105 MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
2107 if test "$MOZ_WIDGET_TOOLKIT" = gtk2; then
2108 TK_CFLAGS=$MOZ_GTK2_CFLAGS
2109 TK_LIBS=$MOZ_GTK2_LIBS
2111 fi # COMPILE_ENVIRONMENT
2113 AC_SUBST(MOZ_FS_LAYOUT)
2115 dnl ========================================================
2116 dnl = startup-notification support module
2117 dnl ========================================================
2119 if test "$MOZ_ENABLE_GTK"
2121 MOZ_ENABLE_STARTUP_NOTIFICATION=
2123 MOZ_ARG_ENABLE_BOOL(startup-notification,
2124 [ --enable-startup-notification
2125 Enable startup-notification support (default: disabled) ],
2126 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
2127 MOZ_ENABLE_STARTUP_NOTIFICATION=)
2128 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
2130 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
2131 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
2132 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
2133 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
2135 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
2137 MOZ_ENABLE_STARTUP_NOTIFICATION=
2141 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
2142 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
2145 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
2147 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
2149 AC_SUBST_LIST(TK_CFLAGS)
2150 AC_SUBST_LIST(TK_LIBS)
2155 dnl ========================================================
2157 dnl = Components & Features
2159 dnl ========================================================
2160 MOZ_ARG_HEADER(Components and Features)
2162 AC_SUBST(MOZ_OFFICIAL_BRANDING)
2163 if test -n "$MOZ_OFFICIAL_BRANDING"; then
2164 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
2165 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
2167 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
2168 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
2172 MOZ_ARG_WITH_STRING(branding,
2173 [ --with-branding=dir Use branding from the specified directory.],
2174 MOZ_BRANDING_DIRECTORY=$withval)
2176 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
2177 if test -z "$REAL_BRANDING_DIRECTORY"; then
2178 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
2181 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
2182 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
2183 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
2184 . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
2187 AC_SUBST(MOZ_BRANDING_DIRECTORY)
2189 dnl ========================================================
2190 dnl = Distribution ID
2191 dnl ========================================================
2192 MOZ_ARG_WITH_STRING(distribution-id,
2193 [ --with-distribution-id=ID
2194 Set distribution-specific id (default=org.mozilla)],
2195 [ val=`echo $withval`
2196 MOZ_DISTRIBUTION_ID="$val"])
2198 if test -z "$MOZ_DISTRIBUTION_ID"; then
2199 MOZ_DISTRIBUTION_ID="org.mozilla"
2202 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
2203 AC_SUBST(MOZ_DISTRIBUTION_ID)
2205 dnl ========================================================
2206 dnl = GConf support module
2207 dnl ========================================================
2211 if test "$MOZ_ENABLE_GTK"
2216 dnl ========================================================
2217 dnl = GConf support module
2218 dnl ========================================================
2219 MOZ_ARG_DISABLE_BOOL(gconf,
2220 [ --disable-gconf Disable Gconf support ],
2224 if test "$MOZ_ENABLE_GCONF"
2226 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
2227 MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
2230 if test -n "$MOZ_ENABLE_GCONF";
2232 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
2234 AC_MSG_WARN([Many automated tests will fail with --disable-gconf. See bug 1167201.])
2239 if test "$MOZ_ENABLE_GCONF"; then
2240 AC_DEFINE(MOZ_ENABLE_GCONF)
2243 AC_SUBST(MOZ_ENABLE_GCONF)
2246 dnl ========================================================
2247 dnl = libproxy support
2248 dnl ========================================================
2250 if test "$MOZ_ENABLE_GTK"
2252 MOZ_ENABLE_LIBPROXY=
2254 MOZ_ARG_ENABLE_BOOL(libproxy,
2255 [ --enable-libproxy Enable libproxy support ],
2256 MOZ_ENABLE_LIBPROXY=1,
2257 MOZ_ENABLE_LIBPROXY=)
2259 if test "$MOZ_ENABLE_LIBPROXY"
2261 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
2262 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
2265 AC_SUBST(MOZ_ENABLE_LIBPROXY)
2267 dnl ========================================================
2269 dnl ========================================================
2271 if test "$MOZ_ENABLE_GTK"
2275 MOZ_ARG_DISABLE_BOOL(dbus,
2276 [ --disable-dbus Disable dbus support ],
2280 if test "$MOZ_ENABLE_DBUS"
2282 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
2283 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
2284 AC_DEFINE(MOZ_ENABLE_DBUS)
2287 AC_SUBST(MOZ_ENABLE_DBUS)
2289 dnl =========================================================
2290 dnl = Whether to exclude hyphenations files in the build
2291 dnl =========================================================
2292 if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
2293 AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
2296 dnl ========================================================
2297 dnl accessibility support on by default on all platforms
2298 dnl ========================================================
2299 MOZ_ARG_DISABLE_BOOL(accessibility,
2300 [ --disable-accessibility Disable accessibility support],
2303 if test "$ACCESSIBILITY"; then
2306 if test -z "$MIDL"; then
2307 if test "$GCC" != "yes"; then
2308 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
2310 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.])
2314 AC_DEFINE(ACCESSIBILITY)
2317 dnl ========================================================
2318 dnl Accessibility is required for the linuxgl widget
2320 dnl ========================================================
2321 if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
2322 AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
2325 AC_TRY_COMPILE([#include <linux/ethtool.h>],
2326 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
2327 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
2329 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
2331 if test -n "$MOZ_WEBRTC"; then
2337 if test -n "$MOZ_X11"; then
2338 MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
2342 dnl ========================================================
2343 dnl = Force hardware AEC, disable webrtc.org AEC
2344 dnl ========================================================
2345 MOZ_ARG_ENABLE_BOOL(hardware-aec-ns,
2346 [ --enable-hardware-aec-ns Enable support for hardware AEC and noise suppression],
2347 MOZ_WEBRTC_HARDWARE_AEC_NS=1,
2348 MOZ_WEBRTC_HARDWARE_AEC_NS=)
2350 if test -n "$MOZ_WEBRTC_HARDWARE_AEC_NS"; then
2351 AC_DEFINE(MOZ_WEBRTC_HARDWARE_AEC_NS)
2354 AC_SUBST(MOZ_WEBRTC_HARDWARE_AEC_NS)
2357 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
2359 dnl ========================================================
2360 dnl = Enable Raw Codecs
2361 dnl ========================================================
2362 MOZ_ARG_ENABLE_BOOL(raw,
2363 [ --enable-raw Enable support for RAW media],
2367 if test -n "$MOZ_RAW"; then
2373 dnl ========================================================
2374 dnl = Apple platform decoder support
2375 dnl ========================================================
2376 if test "$COMPILE_ENVIRONMENT"; then
2377 if test -n "$MOZ_APPLEMEDIA"; then
2378 # hack in frameworks for fmp4 - see bug 1029974
2379 # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
2380 LDFLAGS="$LDFLAGS -framework AudioToolbox"
2381 dnl Verify CoreMedia is available.
2382 AC_CHECK_HEADER([CoreMedia/CoreMedia.h], [],
2383 [AC_MSG_ERROR([MacOS X 10.9 SDK or later is required])])
2385 fi # COMPILE_ENVIRONMENT
2387 dnl system libvpx Support
2388 dnl ========================================================
2389 MOZ_ARG_WITH_BOOL(system-libvpx,
2390 [ --with-system-libvpx Use system libvpx (located with pkgconfig)],
2391 MOZ_SYSTEM_LIBVPX=1)
2396 _SAVE_CFLAGS=$CFLAGS
2398 if test -n "$MOZ_SYSTEM_LIBVPX"; then
2399 dnl ============================
2400 dnl === libvpx Version check ===
2401 dnl ============================
2402 dnl Check to see if we have a system libvpx package.
2403 PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.5.0)
2405 CFLAGS="$CFLAGS $MOZ_LIBVPX_CFLAGS"
2406 LIBS="$LIBS $MOZ_LIBVPX_LIBS"
2408 MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
2409 [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.])])
2411 AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
2412 [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
2414 MOZ_CHECK_HEADER([vpx_mem/vpx_mem.h],
2415 [AC_CHECK_FUNC(vpx_mem_set_functions)])
2416 if test "$ac_cv_header_vpx_mem_vpx_mem_h" = no -o \
2417 "$ac_cv_func_vpx_mem_set_functions" = no; then
2418 AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
2421 CFLAGS=$_SAVE_CFLAGS
2424 AC_SUBST(MOZ_SYSTEM_LIBVPX)
2425 AC_SUBST_LIST(MOZ_LIBVPX_CFLAGS)
2426 AC_SUBST_LIST(MOZ_LIBVPX_LIBS)
2428 if test -z "$MOZ_SYSTEM_LIBVPX"; then
2430 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
2431 dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
2432 dnl We currently require gcc on all arm platforms.
2434 dnl See if we have assembly on this platform.
2435 case "$OS_ARCH:$CPU_ARCH" in
2449 dnl Check for yasm 1.1 or greater.
2450 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
2451 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.])
2452 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
2453 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.])
2457 dnl The encoder needs obj_int_extract to get asm offsets.
2458 fi # COMPILE_ENVIRONMENT and others
2461 if test -n "$GNU_AS" ; then
2462 dnl These flags are a lie; they're just used to enable the requisite
2463 dnl opcodes; actual arch detection is done at runtime.
2464 VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
2465 VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/libvpx/build/make/ads2gas.pl'
2467 dnl Building with -mfpu=neon requires either the "softfp" or the
2468 dnl "hardfp" ABI. Depending on the compiler's default target, and the
2469 dnl CFLAGS, the default ABI might be neither, in which case it is the
2470 dnl "softfloat" ABI.
2471 dnl The "softfloat" ABI is binary-compatible with the "softfp" ABI, so
2472 dnl we can safely mix code built with both ABIs. So, if we detect
2473 dnl that compiling uses the "softfloat" ABI, force the use of the
2474 dnl "softfp" ABI instead.
2475 dnl Confusingly, the __SOFTFP__ preprocessor variable indicates the
2476 dnl "softfloat" ABI, not the "softfp" ABI.
2477 dnl Note: VPX_ASFLAGS is also used in CFLAGS.
2480 #error "compiler target supports -mfpu=neon, so we don't have to add extra flags"
2482 VPX_ASFLAGS="$VPX_ASFLAGS -mfloat-abi=softfp"
2487 if $CC -E -dM -</dev/null | grep -q __ELF__; then
2493 if $CC -E -dM -</dev/null | grep -q __ELF__; then
2500 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_USE_YASM" -a -z "$YASM"; then
2501 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.])
2502 fi # COMPILE_ENVIRONMENT and others
2504 if test -n "$VPX_USE_YASM" && test "$OS_ARCH:$CPU_ARCH" != "WINNT:x86_64"; then
2508 if test -n "$VPX_X86_ASM"; then
2509 AC_DEFINE(VPX_X86_ASM)
2510 elif test -n "$VPX_ARM_ASM"; then
2511 AC_DEFINE(VPX_ARM_ASM)
2513 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
2516 dnl native libvpx no longer has vpx_mem_set_functions
2517 AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
2520 dnl ========================================================
2521 dnl = Handle dependent MEDIA defines
2522 dnl ========================================================
2525 AC_DEFINE(MOZ_WEBM_ENCODER)
2526 AC_SUBST(MOZ_WEBM_ENCODER)
2528 dnl ========================================================
2530 dnl ========================================================
2532 MOZ_ARG_DISABLE_BOOL(negotiateauth,
2533 [ --disable-negotiateauth Disable GSS-API negotiation ],
2534 MOZ_AUTH_EXTENSION=,
2535 MOZ_AUTH_EXTENSION=1 )
2537 if test -n "$MOZ_IOS" -a -n "$MOZ_AUTH_EXTENSION"; then
2538 AC_MSG_ERROR([negotiateauth is not supported on iOS.])
2541 dnl ========================================================
2542 dnl Pref extensions (autoconfig)
2543 dnl ========================================================
2544 MOZ_ARG_DISABLE_BOOL(pref-extensions,
2545 [ --disable-pref-extensions
2546 Disable pref extensions such as autoconfig],
2547 MOZ_PREF_EXTENSIONS=,
2548 MOZ_PREF_EXTENSIONS=1 )
2550 dnl ========================================================
2551 dnl Searching of system directories for extensions.
2552 dnl Note: this switch is meant to be used for test builds
2553 dnl whose behavior should not depend on what happens to be
2554 dnl installed on the local machine.
2555 dnl ========================================================
2556 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
2557 [ --disable-system-extension-dirs
2558 Disable searching system- and account-global
2559 directories for extensions of any kind; use
2560 only profile-specific extension directories],
2561 ENABLE_SYSTEM_EXTENSION_DIRS=,
2562 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
2563 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
2564 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
2567 dnl ========================================================
2568 dnl = Universalchardet
2569 dnl ========================================================
2570 MOZ_ARG_DISABLE_BOOL(universalchardet,
2571 [ --disable-universalchardet
2572 Disable universal encoding detection],
2573 MOZ_UNIVERSALCHARDET=,
2574 MOZ_UNIVERSALCHARDET=1 )
2576 dnl ========================================================
2577 dnl = ANGLE OpenGL->D3D translator for WebGL
2578 dnl = * only applies to win32 (and then, not MINGW)
2579 dnl ========================================================
2583 MOZ_HAS_WINSDK_WITH_D3D=
2584 MOZ_D3DCOMPILER_VISTA_DLL=
2585 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
2587 if test "$COMPILE_ENVIRONMENT" ; then
2588 case "$target_os" in
2590 MOZ_ANGLE_RENDERER=1
2594 # The DirectX SDK libraries are split into x86 and x64 sub-directories
2595 case "${target_cpu}" in
2597 MOZ_D3D_CPU_SUFFIX=x86
2600 MOZ_D3D_CPU_SUFFIX=x64
2604 dnl ========================================================
2605 dnl D3D compiler DLL
2606 dnl ========================================================
2607 MOZ_FOUND_D3D_COMPILERS=
2609 if test -n "$MOZ_ANGLE_RENDERER"; then
2610 if test -z "$MOZ_D3D_CPU_SUFFIX"; then
2611 AC_MSG_ERROR([Couldn't determine MOZ_D3D_CPU_SUFFIX.])
2614 ######################################
2615 # Find _46+ for use by Vista+.
2617 # Find a D3D compiler DLL in a Windows SDK.
2618 MOZ_D3DCOMPILER_VISTA_DLL=
2619 case "$MOZ_WINSDK_MAXVER" in
2621 MOZ_D3DCOMPILER_VISTA_DLL=d3dcompiler_47.dll
2622 AC_MSG_RESULT([Found D3D compiler in Windows SDK.])
2626 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
2627 # We have a name, now track down the path.
2628 if test -n "$WINDOWSSDKDIR"; then
2629 MOZ_D3DCOMPILER_VISTA_DLL_PATH="$WINDOWSSDKDIR/Redist/D3D/$MOZ_D3D_CPU_SUFFIX/$MOZ_D3DCOMPILER_VISTA_DLL"
2630 if test -f "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
2631 AC_MSG_RESULT([Found MOZ_D3DCOMPILER_VISTA_DLL_PATH: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
2632 MOZ_HAS_WINSDK_WITH_D3D=1
2634 AC_MSG_RESULT([MOZ_D3DCOMPILER_VISTA_DLL_PATH doesn't exist: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
2635 AC_MSG_ERROR([Windows SDK at "$WINDOWSSDKDIR" appears broken. Try updating to MozillaBuild 1.9 final or higher.])
2636 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
2639 AC_MSG_RESULT([Windows SDK not found.])
2642 if test "$OS_ARCH" = "$HOST_OS_ARCH"; then
2643 AC_MSG_ERROR([Couldn't find Windows SDK 8.1 or higher needed for ANGLE.])
2645 AC_MSG_RESULT([Windows SDK not needed for ANGLE in Linux MinGW build.])
2649 if test -z "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
2650 MOZ_D3DCOMPILER_VISTA_DLL=
2653 # On mingw, check if headers are provided by toolchain.
2654 if test -n "$GNU_CC"; then
2655 MOZ_CHECK_HEADER(d3d10.h, MOZ_HAS_WINSDK_WITH_D3D=1)
2658 ######################################
2659 # Check that we found what we needed.
2660 MOZ_FOUND_A_D3D_COMPILER=
2662 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
2663 MOZ_FOUND_A_D3D_COMPILER=1
2664 AC_MSG_RESULT([Found d3dcompiler DLL for Vista+: $MOZ_D3DCOMPILER_VISTA_DLL])
2667 if test -z "$CROSS_COMPILE"; then
2668 if test -z "MOZ_FOUND_A_D3D_COMPILER"; then
2669 AC_MSG_ERROR([Couldn't find an acceptable D3D compiler DLL.])
2672 fi # MOZ_ANGLE_RENDERER
2674 fi # COMPILE_ENVIRONMENT
2677 dnl ========================================================
2679 dnl ========================================================
2680 MOZ_GAMEPAD_BACKEND=stub
2682 case "$OS_TARGET" in
2684 if test -z "$MOZ_IOS"; then
2685 MOZ_GAMEPAD_BACKEND=cocoa
2689 MOZ_GAMEPAD_BACKEND=windows
2692 MOZ_CHECK_HEADER([linux/joystick.h])
2693 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
2694 AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
2696 MOZ_GAMEPAD_BACKEND=linux
2699 MOZ_GAMEPAD_BACKEND=android
2705 AC_SUBST(MOZ_GAMEPAD_BACKEND)
2707 dnl ========================================================
2708 dnl = Breakpad crash reporting (on by default on supported platforms)
2709 dnl ========================================================
2712 i?86-*-mingw*|x86_64-*-mingw*)
2715 i?86-apple-darwin*|x86_64-apple-darwin*)
2716 if test -z "$MOZ_IOS"; then
2720 *-android*|*-linuxandroid*)
2721 dnl Android/arm is arm-unknown-linux-androideabi, so android condition should
2722 dnl be before Linux condition
2725 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
2726 if test "$MOZ_ENABLE_GTK"; then
2732 MOZ_ARG_DISABLE_BOOL(crashreporter,
2733 [ --disable-crashreporter Disable breakpad crash reporting],
2734 [MOZ_CRASHREPORTER=],
2735 [MOZ_CRASHREPORTER=F # Force enable breakpad])
2737 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin"; then
2738 if test "$MOZ_CRASHREPORTER" = F; then
2739 AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
2744 if test -n "$MOZ_CRASHREPORTER"; then
2745 AC_DEFINE(MOZ_CRASHREPORTER)
2747 if test "$OS_TARGET" = "Linux" && \
2748 test -z "$SKIP_LIBRARY_CHECKS"; then
2749 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
2752 if test "$OS_ARCH" = "WINNT"; then
2753 if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
2754 MOZ_CRASHREPORTER_INJECTOR=1
2755 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
2760 dnl ========================================================
2761 dnl = libjpeg-turbo configuration
2762 dnl ========================================================
2764 LIBJPEG_TURBO_USE_YASM=
2765 if test -z "$MOZ_SYSTEM_JPEG"; then
2769 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
2770 [ --disable-libjpeg-turbo Disable optimized jpeg decoding routines],
2772 MOZ_LIBJPEG_TURBO=1)
2774 if test "$MOZ_SYSTEM_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
2775 AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
2778 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
2781 if test -n "$MOZ_LIBJPEG_TURBO" -a -n "$COMPILE_ENVIRONMENT"; then
2783 dnl Do we support libjpeg-turbo on this platform?
2784 case "$OS_ARCH:$CPU_ARCH" in
2786 LIBJPEG_TURBO_ASFLAGS="-DPIC -DMACHO"
2789 LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DMACHO"
2794 LIBJPEG_TURBO_ASFLAGS="-DPIC -DWIN32"
2797 LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DWIN64 -DMSVC"
2800 LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
2803 LIBJPEG_TURBO_ASFLAGS="-march=armv8-a"
2806 LIBJPEG_TURBO_ASFLAGS="-mdspr2"
2809 if $CC -E -dM -</dev/null | grep -q __ELF__; then
2810 LIBJPEG_TURBO_ASFLAGS="-DPIC -DELF"
2814 if $CC -E -dM -</dev/null | grep -q __ELF__; then
2815 LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DELF"
2821 if test -n "$LIBJPEG_TURBO_ASFLAGS"; then
2823 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
2824 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
2825 dnl it doesn't exist or we have too old of a version.
2827 LIBJPEG_TURBO_USE_YASM=1
2829 if test -z "$YASM" ; then
2830 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.])
2833 dnl Check that we have the right yasm version. We require 1.0.1 or newer
2834 dnl on Linux and 1.1 or newer everywhere else.
2835 if test "$OS_ARCH" = "Linux" ; then
2836 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
2837 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.])
2840 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
2841 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.])
2848 dnl ========================================================
2849 dnl = libav-fft configuration
2850 dnl ========================================================
2854 dnl Turn on libav-fft for 32-bit windows, and all 64-bit supported platforms.
2855 dnl 32-bit linux/os x have text relocation issues.
2857 case "$OS_ARCH:$CPU_ARCH" in
2866 dnl Detect if we can use yasm to compile libav's assembly
2868 if test -n "$MOZ_LIBAV_FFT" -a -n "$COMPILE_ENVIRONMENT"; then
2869 AC_DEFINE(MOZ_LIBAV_FFT)
2870 dnl Do we support libav-fft on this platform?
2871 case "$OS_ARCH:$CPU_ARCH" in
2873 LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DMACHO"
2876 LIBAV_FFT_ASFLAGS="-DPIC -DWIN32"
2879 LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DWIN64 -DMSVC"
2882 if $CC -E -dM -</dev/null | grep -q __ELF__; then
2883 LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DELF"
2887 AC_MSG_ERROR([libav's FFT routines are only available for 32-bit windows or 64-bit x86 based platforms.])
2892 if test -n "$LIBAV_FFT_ASFLAGS"; then
2893 dnl If we're on an x86 or x64 system which supports libav-fft's asm routines
2894 dnl check for Yasm, and error out if it doesn't exist or we have too old of a
2896 if test -z "$YASM" ; then
2897 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.])
2899 dnl Check that we have the right yasm version. We require 1.0.1 or newer
2900 dnl on Linux and 1.1 or newer everywhere else.
2901 if test "$OS_ARCH" = "Linux" ; then
2902 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
2903 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.])
2906 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
2907 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.])
2910 elif test -n "$MOZ_LIBAV_FFT" -a "${CPU_ARCH}" != "arm"; then
2911 dnl Warn if we're not building either libav or opendl-max optimized routines.
2912 AC_MSG_WARN([No assembler or assembly support for libav-fft. Using unoptimized C routines.])
2915 dnl ========================================================
2916 dnl = FFmpeg's ffvpx configuration
2917 dnl ========================================================
2924 dnl Use same conditional as MOZ_LIBAV_FFT to enable FFmpeg's ffvpx assembly decoder.
2925 if test -n "$LIBAV_FFT_ASFLAGS"; then
2926 FFVPX_ASFLAGS=$LIBAV_FFT_ASFLAGS
2928 dnl On x86 system with assembly optimizations disabled, the ffvp9 and
2929 dnl ffvp8 decoders give worse performance than libvpx ones. So we only
2930 dnl enable the FFmpeg FLAC decoder on those machines.
2931 MOZ_FFVPX_FLACONLY=1
2936 MOZ_FFVPX_FLACONLY=1
2937 dnl Use same conditional as MOZ_LIBVPX to enable FFmpeg's ffvpx assembly decoder.
2938 dnl aarch 64 FLAC decoder for now will be C only.
2939 FFVPX_ASFLAGS=$VPX_ASFLAGS
2943 if test -n "$MOZ_FFVPX"; then
2944 AC_DEFINE(MOZ_FFVPX)
2946 if test -n "$MOZ_FFVPX_FLACONLY"; then
2947 AC_DEFINE(MOZ_FFVPX_FLACONLY)
2950 dnl ========================================================
2951 dnl = Enable compilation of specific extension modules
2952 dnl ========================================================
2954 MOZ_ARG_ENABLE_STRING(extensions,
2955 [ --enable-extensions Enable extensions],
2956 [ for option in `echo $enableval | sed 's/,/ /g'`; do
2957 if test "$option" = "yes" -o "$option" = "all"; then
2958 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
2959 elif test "$option" = "no" -o "$option" = "none"; then
2961 elif test "$option" = "default"; then
2962 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
2963 elif test `echo "$option" | grep -c \^-` != 0; then
2964 option=`echo $option | sed 's/^-//'`
2965 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
2967 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
2970 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
2972 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
2973 dnl when trying to build a nonexistent extension.
2974 for extension in $MOZ_EXTENSIONS; do
2975 if test ! -d "${srcdir}/extensions/${extension}"; then
2976 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
2980 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
2981 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
2984 # Avoid defining MOZ_ENABLE_CAIRO_FT on Windows platforms because
2985 # "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
2986 if test -n "$MOZ_TREE_FREETYPE" -a "$OS_TARGET" != WINNT; then
2987 MOZ_ENABLE_CAIRO_FT=1
2988 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2989 CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
2990 AC_SUBST_LIST(CAIRO_FT_CFLAGS)
2993 AC_CHECK_PROGS(WGET, wget, "")
2996 dnl ========================================================
2997 dnl Maintenance Service
2998 dnl ========================================================
3000 MOZ_ARG_ENABLE_BOOL(maintenance-service,
3001 [ --enable-maintenance-service Enable building of maintenanceservice],
3002 MOZ_MAINTENANCE_SERVICE=1,
3003 MOZ_MAINTENANCE_SERVICE= )
3005 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
3006 if test "$OS_ARCH" = "WINNT"; then
3007 AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
3009 AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
3013 dnl ========================================================
3014 dnl Bundled fonts on desktop platforms
3015 dnl ========================================================
3017 MOZ_ARG_ENABLE_BOOL(bundled-fonts,
3018 [ --enable-bundled-fonts Enable support for bundled fonts on desktop platforms],
3019 MOZ_BUNDLED_FONTS=1,
3022 if test -n "$MOZ_BUNDLED_FONTS"; then
3023 AC_DEFINE(MOZ_BUNDLED_FONTS)
3026 dnl ========================================================
3027 dnl Verify MAR signatures
3028 dnl ========================================================
3030 MOZ_ARG_ENABLE_BOOL(verify-mar,
3031 [ --enable-verify-mar Enable verifying MAR signatures],
3032 MOZ_VERIFY_MAR_SIGNATURE=1,
3033 MOZ_VERIFY_MAR_SIGNATURE= )
3035 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
3036 AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
3039 dnl ========================================================
3040 dnl Enable building the signmar program.
3041 dnl This option is much different than the --enable-verify-mar option.
3042 dnl --enable-verify-mar is for enabling the verification check on MAR
3043 dnl files in the updater. The --enable-signmar option is for building
3044 dnl the signmar program.
3045 dnl ========================================================
3047 MOZ_ARG_ENABLE_BOOL(signmar,
3048 [ --enable-signmar Enable building the signmar program],
3049 MOZ_ENABLE_SIGNMAR=1,
3050 MOZ_ENABLE_SIGNMAR= )
3052 if test -n "$MOZ_ENABLE_SIGNMAR"; then
3053 if test -z "$COMPILE_ENVIRONMENT" ; then
3054 AC_MSG_WARN([Cannot --enable-signmar with --disable-compile-environment])
3057 AC_DEFINE(MOZ_ENABLE_SIGNMAR)
3061 dnl ========================================================
3063 dnl ========================================================
3065 if test "$MOZ_IOS"; then
3069 MOZ_ARG_DISABLE_BOOL(updater,
3070 [ --disable-updater Disable building of updater],
3074 if test -n "$MOZ_UPDATER"; then
3075 AC_DEFINE(MOZ_UPDATER)
3078 dnl ========================================================
3079 dnl parental controls (for Windows Vista)
3080 dnl ========================================================
3081 MOZ_ARG_DISABLE_BOOL(parental-controls,
3082 [ --disable-parental-controls
3083 Do not build parental controls],
3084 MOZ_DISABLE_PARENTAL_CONTROLS=1,
3085 MOZ_DISABLE_PARENTAL_CONTROLS=)
3086 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
3087 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
3090 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
3092 dnl ========================================================
3093 dnl = Disable smartcard support
3094 dnl ========================================================
3095 if test -n "$MOZ_NO_SMART_CARDS"; then
3096 AC_DEFINE(MOZ_NO_SMART_CARDS)
3098 AC_SUBST(MOZ_NO_SMART_CARDS)
3100 dnl ========================================================
3101 dnl = Sandboxing support
3102 dnl ========================================================
3103 if test -n "$MOZ_TSAN" -o -n "$MOZ_ASAN"; then
3104 # Bug 1182565: TSan conflicts with sandboxing on Linux.
3105 # Bug 1287971: LSan also conflicts with sandboxing on Linux.
3113 MOZ_ARG_DISABLE_BOOL(sandbox,
3114 [ --disable-sandbox Disable sandboxing support],
3118 dnl ========================================================
3119 dnl = Content process sandboxing
3120 dnl ========================================================
3122 case "$OS_TARGET" in
3124 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3127 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3132 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3138 MOZ_ARG_ENABLE_BOOL(content-sandbox,
3139 [ --enable-content-sandbox Enable sandboxing support for content-processes
3140 --disable-content-sandbox Disable sandboxing support for content-processes],
3141 MOZ_CONTENT_SANDBOX=1,
3142 MOZ_CONTENT_SANDBOX=)
3144 if test -n "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_SANDBOX"; then
3145 AC_MSG_ERROR([--enable-content-sandbox and --disable-sandbox are conflicting options])
3148 if test -n "$MOZ_CONTENT_SANDBOX"; then
3149 AC_DEFINE(MOZ_CONTENT_SANDBOX)
3152 AC_SUBST(MOZ_CONTENT_SANDBOX)
3154 dnl ========================================================
3155 dnl = Gecko Media Plugin sandboxing
3156 dnl ========================================================
3159 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3164 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3169 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3173 if test -n "$MOZ_GMP_SANDBOX"; then
3174 AC_DEFINE(MOZ_GMP_SANDBOX)
3177 AC_SUBST(MOZ_GMP_SANDBOX)
3179 if test -z "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_GMP_SANDBOX"; then
3183 if test -n "$MOZ_SANDBOX"; then
3184 AC_DEFINE(MOZ_SANDBOX)
3187 AC_SUBST(MOZ_SANDBOX)
3190 dnl ========================================================
3192 dnl = Module specific options
3194 dnl ========================================================
3195 MOZ_ARG_HEADER(Individual module options)
3197 dnl ========================================================
3198 dnl = Disable feed handling components
3199 dnl ========================================================
3200 MOZ_ARG_DISABLE_BOOL(feeds,
3201 [ --disable-feeds Disable feed handling and processing components],
3204 if test -n "$MOZ_FEEDS"; then
3205 AC_DEFINE(MOZ_FEEDS)
3207 if test "$MOZ_BUILD_APP" = "browser"; then
3208 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
3212 dnl ========================================================
3213 dnl Check for sqlite
3214 dnl ========================================================
3217 MOZ_ARG_ENABLE_BOOL(system-sqlite,
3218 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
3219 MOZ_SYSTEM_SQLITE=1,
3220 MOZ_SYSTEM_SQLITE= )
3222 if test -n "$MOZ_SYSTEM_SQLITE"
3224 dnl ============================
3225 dnl === SQLite Version check ===
3226 dnl ============================
3227 dnl Check to see if the system SQLite package is new enough.
3228 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
3230 dnl ==================================
3231 dnl === SQLITE_SECURE_DELETE check ===
3232 dnl ==================================
3233 dnl Check to see if the system SQLite package is compiled with
3234 dnl SQLITE_SECURE_DELETE enabled.
3235 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
3236 _SAVE_CFLAGS="$CFLAGS"
3237 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3239 LIBS="$LIBS $SQLITE_LIBS"
3240 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
3242 #include "sqlite3.h"
3244 int main(int argc, char **argv){
3245 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
3247 ac_cv_sqlite_secure_delete=yes,
3248 ac_cv_sqlite_secure_delete=no,
3249 ac_cv_sqlite_secure_delete=no
3252 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
3253 CFLAGS="$_SAVE_CFLAGS"
3255 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
3256 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
3259 dnl ===============================
3260 dnl === SQLITE_THREADSAFE check ===
3261 dnl ===============================
3262 dnl Check to see if the system SQLite package is compiled with
3263 dnl SQLITE_THREADSAFE enabled.
3264 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
3265 _SAVE_CFLAGS="$CFLAGS"
3266 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3268 LIBS="$LIBS $SQLITE_LIBS"
3269 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
3271 #include "sqlite3.h"
3273 int main(int argc, char **argv){
3274 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
3276 ac_cv_sqlite_threadsafe=yes,
3277 ac_cv_sqlite_threadsafe=no,
3278 ac_cv_sqlite_threadsafe=no
3281 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
3282 CFLAGS="$_SAVE_CFLAGS"
3284 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
3285 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
3288 dnl ================================
3289 dnl === SQLITE_ENABLE_FTS3 check ===
3290 dnl ================================
3291 dnl check to see if the system SQLite package is compiled with
3292 dnl SQLITE_ENABLE_FTS3 enabled.
3293 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
3294 _SAVE_CFLAGS="$CFLAGS"
3295 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3297 LIBS="$LIBS $SQLITE_LIBS"
3298 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
3300 #include "sqlite3.h"
3302 int main(int argc, char **argv){
3303 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
3305 ac_cv_sqlite_enable_fts3=yes,
3306 ac_cv_sqlite_enable_fts3=no,
3307 ac_cv_sqlite_enable_fts3=no
3310 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
3311 CFLAGS="$_SAVE_CFLAGS"
3313 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
3314 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
3317 dnl =========================================
3318 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
3319 dnl =========================================
3320 dnl check to see if the system SQLite package is compiled with
3321 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
3322 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
3323 _SAVE_CFLAGS="$CFLAGS"
3324 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3326 LIBS="$LIBS $SQLITE_LIBS"
3327 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
3329 #include "sqlite3.h"
3331 int main(int argc, char **argv){
3332 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
3334 ac_cv_sqlite_enable_unlock_notify=yes,
3335 ac_cv_sqlite_enable_unlock_notify=no,
3336 ac_cv_sqlite_enable_unlock_notify=no
3339 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
3340 CFLAGS="$_SAVE_CFLAGS"
3342 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
3343 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
3346 dnl =========================================
3347 dnl === SQLITE_ENABLE_DBSTAT_VTAB check ===
3348 dnl =========================================
3349 dnl check to see if the system SQLite package is compiled with
3350 dnl SQLITE_ENABLE_DBSTAT_VTAB.
3351 AC_MSG_CHECKING(for SQLITE_ENABLE_DBSTAT_VTAB support in system SQLite)
3352 _SAVE_CFLAGS="$CFLAGS"
3353 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3355 LIBS="$LIBS $SQLITE_LIBS"
3356 AC_CACHE_VAL(ac_cv_sqlite_dbstat_vtab,[
3358 #include "sqlite3.h"
3360 int main(int argc, char **argv){
3361 return !sqlite3_compileoption_used("SQLITE_ENABLE_DBSTAT_VTAB");
3363 ac_cv_sqlite_dbstat_vtab=yes,
3364 ac_cv_sqlite_dbstat_vtab=no,
3365 ac_cv_sqlite_dbstat_vtab=no
3368 AC_MSG_RESULT($ac_cv_sqlite_dbstat_vtab)
3369 CFLAGS="$_SAVE_CFLAGS"
3371 if test "x$ac_cv_sqlite_dbstat_vtab" = "xno"; then
3372 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_DBSTAT_VTAB.])
3375 dnl ==============================
3376 dnl === SQLite fdatasync check ===
3377 dnl ==============================
3378 dnl Check to see if fdatasync is available
3379 AC_CHECK_FUNC(fdatasync)
3382 if test -n "$MOZ_SYSTEM_SQLITE"; then
3383 AC_DEFINE(MOZ_SYSTEM_SQLITE)
3385 AC_SUBST(MOZ_SYSTEM_SQLITE)
3387 dnl ========================================================
3388 dnl = Disable zipwriter
3389 dnl ========================================================
3390 MOZ_ARG_DISABLE_BOOL(zipwriter,
3391 [ --disable-zipwriter Disable zipwriter component],
3394 AC_SUBST(MOZ_ZIPWRITER)
3396 dnl ========================================================
3398 dnl = Feature options that require extra sources to be pulled
3400 dnl ========================================================
3401 dnl MOZ_ARG_HEADER(Features that require extra sources)
3403 dnl ========================================================
3405 dnl = Runtime debugging and Optimization Options
3407 dnl ========================================================
3408 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
3410 dnl ========================================================
3411 dnl enable mobile optimizations
3412 dnl ========================================================
3413 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
3414 [ --enable-mobile-optimize
3415 Enable mobile optimizations],
3416 MOZ_GFX_OPTIMIZE_MOBILE=1)
3418 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
3420 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
3421 # We ignore paint will resample on mobile for performance.
3422 # We may want to revisit this later.
3423 MOZ_IGNORE_PAINT_WILL_RESAMPLE=1
3425 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
3426 AC_DEFINE(MOZ_IGNORE_PAINT_WILL_RESAMPLE)
3429 dnl ========================================================
3430 dnl = Enable code optimization. ON by default.
3431 dnl ========================================================
3433 # Use value from moz.configure if one is defined. Else use our computed
3435 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
3436 MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
3439 MOZ_SET_FRAMEPTR_FLAGS
3441 if test "$COMPILE_ENVIRONMENT"; then
3442 if test -n "$MOZ_OPTIMIZE"; then
3443 AC_MSG_CHECKING([for valid C compiler optimization flags])
3444 _SAVE_CFLAGS=$CFLAGS
3445 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
3446 AC_TRY_COMPILE([#include <stdio.h>],
3447 [printf("Hello World\n");],
3450 AC_MSG_RESULT([$_results])
3451 if test "$_results" = "no"; then
3452 AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
3454 CFLAGS=$_SAVE_CFLAGS
3456 fi # COMPILE_ENVIRONMENT
3458 AC_SUBST_LIST(MOZ_FRAMEPTR_FLAGS)
3459 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
3460 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
3461 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
3463 dnl ========================================================
3464 dnl = Disable treating compiler warnings as errors
3465 dnl ========================================================
3466 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
3467 WARNINGS_AS_ERRORS=''
3470 dnl ========================================================
3471 dnl = Enable runtime logging
3472 dnl ========================================================
3473 AC_DEFINE(MOZ_LOGGING)
3474 AC_DEFINE(FORCE_PR_LOG)
3476 dnl ========================================================
3477 dnl = This will enable logging of addref, release, ctor, dtor.
3478 dnl ========================================================
3479 _ENABLE_LOGREFCNT=42
3480 MOZ_ARG_ENABLE_BOOL(logrefcnt,
3481 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
3482 _ENABLE_LOGREFCNT=1,
3483 _ENABLE_LOGREFCNT= )
3484 if test "$_ENABLE_LOGREFCNT" = "1"; then
3485 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
3486 elif test -z "$_ENABLE_LOGREFCNT"; then
3487 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
3490 dnl ========================================================
3491 dnl moz_dump_painting
3492 dnl ========================================================
3493 MOZ_ARG_ENABLE_BOOL(dump-painting,
3494 [ --enable-dump-painting Enable paint debugging.],
3495 MOZ_DUMP_PAINTING=1,
3496 MOZ_DUMP_PAINTING= )
3497 if test -n "$MOZ_DUMP_PAINTING"; then
3498 AC_DEFINE(MOZ_DUMP_PAINTING)
3499 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
3501 if test -n "$MOZ_DEBUG"; then
3502 AC_DEFINE(MOZ_DUMP_PAINTING)
3505 case "${OS_TARGET}" in
3506 Android|WINNT|Darwin)
3507 MOZ_GLUE_IN_PROGRAM=
3510 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
3511 MOZ_GLUE_IN_PROGRAM=1
3512 AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
3516 dnl ========================================================
3517 dnl = Jemalloc build setup
3518 dnl ========================================================
3519 if test -z "$MOZ_MEMORY"; then
3522 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
3523 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.])
3528 dnl The generic feature tests that determine how to compute ncpus are long and
3529 dnl complicated. Therefore, simply define special cpp variables for the
3530 dnl platforms we have special knowledge of.
3533 export MOZ_NO_DEBUG_RTL=1
3537 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
3539 # Allow the application to provide a subconfigure script.
3540 # This should be after 'export MOZ_NO_DEBUG_RTL=1' since
3541 # ldap/c-sdk/configure refers to the enviroment value.
3542 if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
3543 do_output_subdirs() {
3544 if test -n "$_subconfigure_subdirs"; then
3545 AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
3547 _subconfigure_subdir="$1"
3548 _subconfigure_config_args="$ac_configure_args"
3550 tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
3551 m4 "${srcdir}/build/autoconf/subconfigure.m4" \
3552 "${srcdir}/build/autoconf/altoptions.m4" \
3553 "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
3558 AC_SUBST_LIST(MOZ_GLUE_WRAP_LDFLAGS)
3559 export MOZ_GLUE_WRAP_LDFLAGS
3561 dnl ========================================================
3562 dnl = Enable using the clang plugin to build
3563 dnl ========================================================
3565 if test -n "$COMPILE_ENVIRONMENT"; then
3566 MOZ_CONFIG_CLANG_PLUGIN
3567 fi # COMPILE_ENVIRONMENT
3569 dnl ========================================================
3570 dnl = Enable stripping of libs & executables
3571 dnl ========================================================
3572 MOZ_ARG_ENABLE_BOOL(strip,
3573 [ --enable-strip Enable stripping of libs & executables ],
3577 dnl ========================================================
3578 dnl = Enable stripping of libs & executables when packaging
3579 dnl ========================================================
3580 MOZ_ARG_ENABLE_BOOL(install-strip,
3581 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
3585 dnl ========================================================
3586 dnl = frontend JS debug mode
3587 dnl ========================================================
3589 MOZ_ARG_ENABLE_BOOL(debug-js-modules,
3590 [ --enable-debug-js-modules Enable debug mode for frontend JS libraries],
3594 AC_SUBST(DEBUG_JS_MODULES)
3596 dnl ========================================================
3598 dnl = Profiling and Instrumenting
3600 dnl ========================================================
3601 MOZ_ARG_HEADER(Profiling and Instrumenting)
3603 dnl ========================================================
3604 dnl = Enable TaskTracer
3605 dnl ========================================================
3606 MOZ_ARG_ENABLE_BOOL(tasktracer,
3607 [ --enable-tasktracer Set compile flags necessary for using TaskTracer],
3610 if test -n "$MOZ_TASK_TRACER"; then
3611 AC_DEFINE(MOZ_TASK_TRACER)
3612 AC_SUBST(MOZ_TASK_TRACER)
3615 dnl ========================================================
3616 dnl Turn on reflow counting
3617 dnl ========================================================
3618 MOZ_ARG_ENABLE_BOOL(reflow-perf,
3619 [ --enable-reflow-perf Enable reflow performance tracing],
3622 if test -n "$MOZ_REFLOW_PERF"; then
3623 AC_DEFINE(MOZ_REFLOW_PERF)
3626 dnl ========================================================
3627 dnl = Offer a way to disable the startup cache
3628 dnl ========================================================
3630 MOZ_ARG_DISABLE_BOOL(startupcache,
3631 [ --disable-startupcache Disable startup cache ],
3632 MOZ_DISABLE_STARTUPCACHE=1,
3633 MOZ_DISABLE_STARTUPCACHE=)
3635 if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
3636 AC_DEFINE(MOZ_DISABLE_STARTUPCACHE)
3638 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
3640 dnl ========================================================
3641 dnl = Support for demangling undefined symbols
3642 dnl ========================================================
3643 if test -z "$SKIP_LIBRARY_CHECKS"; then
3646 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
3650 # Demangle only for debug or DMD builds
3651 MOZ_DEMANGLE_SYMBOLS=
3652 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
3653 MOZ_DEMANGLE_SYMBOLS=1
3654 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
3656 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
3658 dnl ========================================================
3659 dnl = Support for gcc stack unwinding (from gcc 3.3)
3660 dnl ========================================================
3661 if test -z "$SKIP_LIBRARY_CHECKS"; then
3664 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
3668 dnl ========================================================
3670 dnl ========================================================
3672 MOZ_ARG_WITH_STRING(jitreport-granularity,
3673 [ --jitreport-granularity=N
3674 Default granularity at which to report JIT code
3677 1 - code ranges for whole functions only
3678 2 - per-line information
3679 3 - per-op information],
3680 JITREPORT_GRANULARITY=$withval,
3681 JITREPORT_GRANULARITY=3)
3683 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
3685 dnl ========================================================
3689 dnl ========================================================
3690 MOZ_ARG_HEADER(Misc. Options)
3692 dnl ========================================================
3693 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
3694 dnl ========================================================
3695 MOZ_ARG_WITH_STRING(user-appdir,
3696 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
3697 [ val=`echo $withval`
3698 if echo "$val" | grep "\/" >/dev/null; then
3699 AC_MSG_ERROR("Homedir must be single relative path.")
3704 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
3706 if test -z "$SKIP_COMPILER_CHECKS"; then
3707 dnl ========================================================
3709 dnl = Compiler Options
3711 dnl ========================================================
3712 MOZ_ARG_HEADER(Compiler Options)
3714 dnl ========================================================
3715 dnl Check for gcc -pipe support
3716 dnl ========================================================
3717 AC_MSG_CHECKING([for -pipe support])
3718 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
3719 dnl Any gcc that supports firefox supports -pipe.
3720 CFLAGS="$CFLAGS -pipe"
3721 CXXFLAGS="$CXXFLAGS -pipe"
3722 AC_MSG_RESULT([yes])
3727 fi # ! SKIP_COMPILER_CHECKS
3729 AC_DEFINE(CPP_THROW_NEW, [throw()])
3732 if test "$COMPILE_ENVIRONMENT"; then
3734 fi # COMPILE_ENVIRONMENT
3736 dnl ========================================================
3738 dnl = Build depencency options
3740 dnl ========================================================
3741 MOZ_ARG_HEADER(Build dependencies)
3743 if test "$COMPILE_ENVIRONMENT"; then
3744 if test "$GNU_CC" -a "$GNU_CXX"; then
3745 _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
3747 # clang-cl doesn't accept the normal -MD -MP -MF options that clang does, but
3748 # the underlying cc1 binary understands how to generate dependency files.
3749 # These options are based on analyzing what the normal clang driver sends to
3750 # cc1 when given the "correct" dependency options.
3751 if test -n "$CLANG_CL"; then
3752 _DEPEND_CFLAGS='-Xclang -MP -Xclang -MG -Xclang -dependency-file -Xclang $(MDDEPDIR)/$(@F).pp -Xclang -MT -Xclang $@'
3754 dnl Don't override this for MSVC
3755 if test -z "$_WIN32_MSVC"; then
3756 _USE_CPP_INCLUDE_FLAG=
3757 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
3758 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
3760 echo '#include <stdio.h>' > dummy-hello.c
3762 dnl This output is localized, split at the first double space or colon and space.
3763 _CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*\\\stdio.h\)$"
3764 CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'`
3765 _CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'`
3767 if ! test -e "$_CL_STDIO_PATH"; then
3768 AC_MSG_ERROR([Unable to parse cl -showIncludes prefix. This compiler's locale has an unsupported formatting.])
3770 if test -z "$CL_INCLUDES_PREFIX"; then
3771 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
3773 AC_SUBST(CL_INCLUDES_PREFIX)
3776 dnl Make sure that the build system can handle non-ASCII characters
3777 dnl in environment variables to prevent it from breaking silently on
3778 dnl non-English systems.
3779 NONASCII=$'\241\241'
3783 fi # COMPILE_ENVIRONMENT
3785 dnl ========================================================
3787 dnl = Static Build Options
3789 dnl ========================================================
3790 MOZ_ARG_HEADER(Static build options)
3792 if test -z "$MOZ_SYSTEM_ZLIB"; then
3793 if test -n "$JS_SHARED_LIBRARY" -o -n "$MOZ_LINKER"; then
3795 AC_DEFINE(ZLIB_IN_MOZGLUE)
3799 AC_SUBST(ZLIB_IN_MOZGLUE)
3801 dnl ========================================================
3803 dnl = Standalone module options
3805 dnl ========================================================
3806 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
3809 dnl ========================================================
3811 if test -z "$SKIP_PATH_CHECKS"; then
3812 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
3813 if test "$MOZ_ENABLE_GTK" ; then
3814 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
3819 if test -z "${GLIB_GMODULE_LIBS}" \
3820 -a -n "${GLIB_CONFIG}"\
3821 -a "${GLIB_CONFIG}" != no\
3823 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
3826 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
3828 if test "$USE_FC_FREETYPE"; then
3829 if test "$COMPILE_ENVIRONMENT"; then
3830 dnl ========================================================
3831 dnl = Check for freetype2 functionality
3832 dnl ========================================================
3833 if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
3835 _SAVE_CFLAGS="$CFLAGS"
3836 LIBS="$LIBS $FT2_LIBS"
3837 CFLAGS="$CFLAGS $FT2_CFLAGS"
3839 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3840 ac_cv_member_FT_Bitmap_Size_y_ppem,
3841 [AC_TRY_COMPILE([#include <ft2build.h>
3842 #include FT_FREETYPE_H],
3844 if (sizeof s.y_ppem) return 0;
3846 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3847 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3848 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3849 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3851 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3853 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3854 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3855 [FT_Bitmap_Size structure includes y_ppem field])
3857 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
3860 CFLAGS="$_SAVE_CFLAGS"
3863 _SAVE_CPPFLAGS="$CPPFLAGS"
3864 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
3865 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
3866 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
3867 CPPFLAGS="$_SAVE_CPPFLAGS"
3871 dnl ========================================================
3872 dnl Check if we need the 32-bit Linux SSE2 error dialog
3873 dnl ========================================================
3875 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
3877 dnl ========================================================
3878 dnl Check for pixman and cairo
3879 dnl ========================================================
3882 MOZ_ARG_ENABLE_BOOL(system-cairo,
3883 [ --enable-system-cairo Obsolete: do not use this option],
3884 AC_MSG_ERROR(--enable-system-cairo is not supported),
3888 MOZ_ARG_ENABLE_BOOL(system-pixman,
3889 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
3891 MOZ_TREE_PIXMAN=force,
3894 if test "$MOZ_TREE_PIXMAN"; then
3895 AC_DEFINE(MOZ_TREE_PIXMAN)
3897 PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.19.2)
3900 MOZ_CAIRO_CFLAGS="-I${DIST}/include/cairo"
3901 AC_DEFINE(MOZ_TREE_CAIRO)
3903 if test "$OS_ARCH" = "WINNT"; then
3904 # For now we assume that we will have a uint64_t available through
3905 # one of the above headers or mozstdint.h.
3906 AC_DEFINE(HAVE_UINT64_T)
3909 # Define macros for cairo-features.h
3910 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
3911 if test "$MOZ_X11"; then
3912 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
3913 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
3914 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
3916 if test "$_HAVE_FREETYPE2"; then
3917 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
3918 MOZ_ENABLE_CAIRO_FT=1
3919 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
3922 case "$MOZ_WIDGET_TOOLKIT" in
3924 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
3925 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
3926 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
3929 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
3930 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
3931 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
3932 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
3933 MOZ_ENABLE_D2D_SURFACE=1
3935 if test "$COMPILE_ENVIRONMENT"; then
3937 dnl D3D10 Layers depend on D2D Surfaces.
3938 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
3939 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
3944 if test "$USE_FC_FREETYPE"; then
3945 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
3947 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
3948 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
3949 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
3951 AC_SUBST(PS_SURFACE_FEATURE)
3952 AC_SUBST(SVG_SURFACE_FEATURE)
3953 AC_SUBST(XLIB_SURFACE_FEATURE)
3954 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
3955 AC_SUBST(QUARTZ_SURFACE_FEATURE)
3956 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
3957 AC_SUBST(WIN32_SURFACE_FEATURE)
3958 AC_SUBST(OS2_SURFACE_FEATURE)
3959 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
3960 AC_SUBST(FT_FONT_FEATURE)
3961 AC_SUBST(FC_FONT_FEATURE)
3962 AC_SUBST(WIN32_FONT_FEATURE)
3963 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
3964 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
3965 AC_SUBST(QUARTZ_FONT_FEATURE)
3966 AC_SUBST(PNG_FUNCTIONS_FEATURE)
3967 AC_SUBST(QT_SURFACE_FEATURE)
3968 AC_SUBST(TEE_SURFACE_FEATURE)
3970 if test "$MOZ_X11"; then
3971 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
3974 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
3976 case "$MOZ_WIDGET_TOOLKIT" in
3978 TK_CFLAGS="$MOZ_CAIRO_CFLAGS $MOZ_PIXMAN_CFLAGS"
3979 TK_LIBS="$MOZ_CAIRO_LIBS $MOZ_PIXMAN_LIBS"
3983 AC_SUBST(MOZ_TREE_CAIRO)
3984 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
3985 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
3986 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
3987 AC_SUBST(MOZ_TREE_PIXMAN)
3989 BINDGEN_SYSTEM_FLAGS="$_BINDGEN_CFLAGS $NSPR_CFLAGS $NSS_CFLAGS $MOZ_PIXMAN_CFLAGS $MOZ_CAIRO_CFLAGS"
3990 AC_SUBST_TOML_LIST(BINDGEN_SYSTEM_FLAGS)
3992 dnl ========================================================
3994 dnl ========================================================
3995 MOZ_ARG_DISABLE_BOOL(xul,
3996 [ --disable-xul Disable XUL],
3998 if test "$MOZ_XUL"; then
4001 dnl remove extensions that require XUL
4002 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
4007 dnl ========================================================
4008 dnl necko configuration options
4009 dnl ========================================================
4012 dnl option to disable necko's wifi scanner
4015 if test "$MOZ_WIDGET_TOOLKIT"; then
4017 case "$OS_TARGET" in
4019 if test -z "$MOZ_IOS"; then
4023 DragonFly|FreeBSD|WINNT)
4034 MOZ_ARG_DISABLE_BOOL(necko-wifi,
4035 [ --disable-necko-wifi Disable necko wifi scanner],
4039 if test "$NECKO_WIFI"; then
4040 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
4041 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
4043 AC_DEFINE(NECKO_WIFI)
4044 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
4046 AC_SUBST(NECKO_WIFI)
4047 AC_SUBST(NECKO_WIFI_DBUS)
4050 dnl option to disable cookies
4052 MOZ_ARG_DISABLE_BOOL(cookies,
4053 [ --disable-cookies Disable cookie support],
4056 AC_SUBST(NECKO_COOKIES)
4057 if test "$NECKO_COOKIES"; then
4058 AC_DEFINE(NECKO_COOKIES)
4059 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
4062 dnl ========================================================
4064 dnl = Maintainer debug option (no --enable equivalent)
4066 dnl ========================================================
4070 AC_SUBST(AR_EXTRACT)
4073 AC_SUBST_LIST(ASFLAGS)
4074 AC_SUBST(AS_DASH_C_FLAG)
4080 AC_SUBST(MOZ_AUTH_EXTENSION)
4081 AC_SUBST(MOZ_PREF_EXTENSIONS)
4082 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
4083 AC_SUBST(WARNINGS_AS_ERRORS)
4084 AC_SUBST_SET(MOZ_EXTENSIONS)
4085 AC_SUBST(MOZ_TOOLKIT_SEARCH)
4088 AC_SUBST(MOZ_UNIVERSALCHARDET)
4089 AC_SUBST(ACCESSIBILITY)
4090 AC_SUBST(MOZ_SPELLCHECK)
4091 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
4092 AC_SUBST(MOZ_CRASHREPORTER)
4093 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
4094 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
4095 AC_SUBST(MOZ_STUB_INSTALLER)
4096 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
4097 AC_SUBST(MOZ_ENABLE_SIGNMAR)
4098 AC_SUBST(MOZ_UPDATER)
4100 AC_SUBST(MOZ_ANGLE_RENDERER)
4101 AC_SUBST(MOZ_D3D_CPU_SUFFIX)
4102 AC_SUBST(MOZ_HAS_WINSDK_WITH_D3D)
4103 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL)
4104 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL_PATH)
4106 AC_SUBST(MOZ_ANDROID_APPLICATION_CLASS)
4107 AC_SUBST(MOZ_ANDROID_BROWSER_INTENT_CLASS)
4108 AC_SUBST(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
4109 AC_SUBST(ENABLE_STRIP)
4110 AC_SUBST(PKG_SKIP_STRIP)
4111 AC_SUBST(STRIP_FLAGS)
4112 AC_SUBST(INCREMENTAL_LINKER)
4114 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
4116 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
4117 AC_SUBST(MOZ_LINKER_EXTRACT)
4119 if test -n "$MOZ_BINARY_EXTENSIONS"; then
4120 AC_DEFINE(MOZ_BINARY_EXTENSIONS)
4123 AC_SUBST(MOZ_ADDON_SIGNING)
4124 if test "$MOZ_ADDON_SIGNING" = 1; then
4125 AC_DEFINE(MOZ_ADDON_SIGNING)
4127 AC_SUBST(MOZ_REQUIRE_SIGNING)
4128 if test "$MOZ_REQUIRE_SIGNING" = 1; then
4129 AC_DEFINE(MOZ_REQUIRE_SIGNING)
4132 dnl ========================================================
4133 dnl = Mac bundle name prefix
4134 dnl ========================================================
4135 MOZ_ARG_WITH_STRING(macbundlename-prefix,
4136 [ --with-macbundlename-prefix=prefix
4137 Prefix for MOZ_MACBUNDLE_NAME],
4138 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
4140 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
4141 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
4142 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
4145 if test "$MOZ_DEBUG"; then
4146 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
4148 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
4150 AC_SUBST(MOZ_MACBUNDLE_NAME)
4152 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
4153 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
4154 # Otherwise, use MOZ_APP_DISPLAYNAME
4155 if test -z "$MOZ_MACBUNDLE_ID"; then
4156 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
4158 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
4159 if test "$MOZ_DEBUG"; then
4160 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
4163 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
4164 AC_SUBST(MOZ_MACBUNDLE_ID)
4166 dnl ========================================================
4167 dnl = Child Process Name for IPC
4168 dnl ========================================================
4169 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
4170 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
4172 # We want to let Android unpack the file at install time, but it only does
4173 # so if the file is named libsomething.so. The lib/ path is also required
4174 # because the unpacked file will be under the lib/ subdirectory and will
4175 # need to be executed from that path.
4176 MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
4178 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
4179 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
4181 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
4182 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
4183 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
4185 # The following variables are available to branding and application
4186 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
4187 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
4188 # impacts profile location and user-visible fields.
4189 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
4190 # versions of a given application (e.g. Aurora and Firefox both use
4191 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
4192 # for application.ini's "Name" field, which controls profile location in
4193 # the absence of a "Profile" field (see below), and various system
4194 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
4195 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
4196 # Mac Bundle name, Updater, Installer), it is typically used for nightly
4197 # builds (e.g. Aurora for Firefox).
4198 # - MOZ_APP_VERSION: Defines the application version number.
4199 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
4200 # in the "About" window. If not set, defaults to MOZ_APP_VERSION.
4201 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
4202 # defaults to a lowercase form of MOZ_APP_BASENAME.
4203 # - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
4204 # profile name and remoting. If not set, defaults to MOZ_APP_NAME.
4205 # - MOZ_APP_PROFILE: When set, used for application.ini's
4206 # "Profile" field, which controls profile location.
4207 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
4208 # crash reporter server url.
4209 # - MOZ_APP_ANDROID_VERSION_CODE: On Android, "android:versionCode" for
4210 # the main application is set to the value of this variable. If not
4211 # set, it falls back to a Mozilla-specific value derived from the
4213 # - MOZ_ANDROID_SHARED_ID: On Android, "android:sharedUserId" for all Android
4214 # packages produced.
4215 # - MOZ_ANDROID_GCM_SENDERID: On Android, the Android GCM Sender ID used. GCM
4216 # sender IDs are not sensitive: see, http://stackoverflow.com/a/18216063.
4217 # - MOZ_MMA_GCM_SENDERID: This GCM Sender ID is used for MMA integration.
4218 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
4220 if test -z "$MOZ_APP_NAME"; then
4221 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
4224 if test -z "$MOZ_APP_REMOTINGNAME"; then
4225 MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
4228 if test -z "$MOZ_APP_VERSION_DISPLAY"; then
4229 MOZ_APP_VERSION_DISPLAY=$MOZ_APP_VERSION
4232 if test -z "$ANDROID_PACKAGE_NAME" ; then
4233 # When we got rid of the Aurora channel we decided to replace the old
4234 # Nightly ANDROID_PACKAGE_NAME with Aurora. To make sure this is inherited
4235 # by all mozilla-central based branches we make this the new "default"
4236 # for Fennec. Non mozilla-central based branches set ANDROID_PACKAGE_NAME
4237 # in their mozconfig, so they will never get this. If there are ever
4238 # non-Fennec builds for Android, they will fall into the else block
4239 # and use their own default name.
4240 # https://bugzilla.mozilla.org/show_bug.cgi?id=1357808 has additional
4241 # background on this.
4242 if test "$MOZ_APP_NAME" = "fennec"; then
4243 ANDROID_PACKAGE_NAME="org.mozilla.fennec_aurora"
4245 ANDROID_PACKAGE_NAME="org.mozilla.$MOZ_APP_NAME"
4249 # Mozilla released Firefox for Android {Release,Beta} and {Aurora,Nightly} to
4250 # the public with specific common shared IDs and we need to keep them
4251 # consistent forever. The specific common values are set by per-channel
4252 # branding; all other channels use a generic sharedID, set below.
4253 if test -z "$MOZ_ANDROID_SHARED_ID" ; then
4254 MOZ_ANDROID_SHARED_ID="${ANDROID_PACKAGE_NAME}.sharedID"
4257 # For extensions and langpacks, we require a max version that is compatible
4258 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
4259 # 24.0a1 and 24.0a2 aren't affected
4261 # 24.1.1 becomes 24.*
4262 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
4263 if test -z "$IS_ALPHA"; then
4265 if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
4266 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
4268 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
4272 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
4275 AC_SUBST(MOZ_APP_NAME)
4276 AC_SUBST(MOZ_APP_REMOTINGNAME)
4277 AC_SUBST(MOZ_APP_DISPLAYNAME)
4278 AC_SUBST(MOZ_APP_BASENAME)
4279 AC_SUBST(MOZ_APP_VENDOR)
4280 AC_SUBST(MOZ_APP_PROFILE)
4281 AC_SUBST(MOZ_APP_ID)
4282 AC_SUBST(MOZ_APP_ANDROID_VERSION_CODE)
4283 AC_SUBST(MOZ_ANDROID_SHARED_ID)
4284 AC_SUBST(MOZ_ANDROID_GCM_SENDERID)
4285 AC_SUBST(MOZ_MMA_GCM_SENDERID)
4286 AC_SUBST(MAR_CHANNEL_ID)
4287 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
4288 AC_SUBST(MOZ_PROFILE_MIGRATOR)
4289 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
4290 AC_SUBST(MOZ_APP_UA_NAME)
4291 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
4292 AC_SUBST(MOZ_APP_VERSION)
4293 AC_SUBST(MOZ_APP_VERSION_DISPLAY)
4294 AC_SUBST(MOZ_APP_MAXVERSION)
4295 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
4296 AC_SUBST(FIREFOX_VERSION)
4297 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
4298 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
4299 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
4302 AC_SUBST(MOZ_PKG_SPECIAL)
4303 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
4305 if test "$MOZILLA_OFFICIAL"; then
4306 # Build revisions should always be present in official builds
4307 MOZ_INCLUDE_SOURCE_INFO=1
4310 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
4311 # explicitly set the repository and changeset information in.
4312 AC_SUBST(MOZ_SOURCE_REPO)
4313 AC_SUBST(MOZ_SOURCE_CHANGESET)
4314 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
4316 if test "$MOZ_TELEMETRY_REPORTING"; then
4317 AC_DEFINE(MOZ_TELEMETRY_REPORTING)
4319 # Enable Telemetry by default for nightly and aurora channels
4320 if test -z "$RELEASE_OR_BETA"; then
4321 AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
4325 dnl If we have any service that uploads data (and requires data submission
4326 dnl policy alert), set MOZ_DATA_REPORTING.
4327 dnl We need SUBST for build system and DEFINE for xul preprocessor.
4328 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
4329 MOZ_DATA_REPORTING=1
4330 AC_DEFINE(MOZ_DATA_REPORTING)
4331 AC_SUBST(MOZ_DATA_REPORTING)
4335 AC_SUBST(WIN32_REDIST_DIR)
4336 AC_SUBST(WIN_UCRT_REDIST_DIR)
4337 AC_SUBST(WIN_DIA_SDK_BIN_DIR)
4339 dnl ========================================================
4341 dnl ========================================================
4345 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
4351 dnl Echo the CFLAGS to remove extra whitespace.
4354 $_COMPILATION_CFLAGS \
4358 $_WARNINGS_CXXFLAGS \
4359 $_COMPILATION_CXXFLAGS \
4362 COMPILE_CFLAGS=`echo \
4366 COMPILE_CXXFLAGS=`echo \
4367 $_DEFINES_CXXFLAGS \
4371 $_WARNINGS_HOST_CFLAGS \
4372 $_COMPILATION_HOST_CFLAGS \
4375 HOST_CXXFLAGS=`echo \
4376 $_WARNINGS_HOST_CXXFLAGS \
4377 $_COMPILATION_HOST_CXXFLAGS \
4380 AC_SUBST(_DEPEND_CFLAGS)
4381 AC_SUBST(MOZ_SYSTEM_JPEG)
4382 AC_SUBST(MOZ_SYSTEM_PNG)
4384 AC_SUBST_LIST(MOZ_JPEG_CFLAGS)
4385 AC_SUBST_LIST(MOZ_JPEG_LIBS)
4386 AC_SUBST_LIST(MOZ_PNG_CFLAGS)
4387 AC_SUBST_LIST(MOZ_PNG_LIBS)
4389 AC_SUBST(MOZ_SYSTEM_NSPR)
4391 AC_SUBST(MOZ_SYSTEM_NSS)
4393 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
4394 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
4395 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
4396 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
4397 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
4398 OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
4399 OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
4401 AC_SUBST(HOST_CMFLAGS)
4402 AC_SUBST(HOST_CMMFLAGS)
4403 AC_SUBST(OS_COMPILE_CMFLAGS)
4404 AC_SUBST(OS_COMPILE_CMMFLAGS)
4407 OS_CXXFLAGS="$CXXFLAGS"
4408 OS_CPPFLAGS="$CPPFLAGS"
4409 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
4410 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
4411 OS_LDFLAGS="$LDFLAGS"
4413 AC_SUBST_LIST(OS_CFLAGS)
4414 AC_SUBST_LIST(OS_CXXFLAGS)
4415 AC_SUBST_LIST(OS_CPPFLAGS)
4416 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
4417 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
4418 AC_SUBST_LIST(OS_LDFLAGS)
4423 AC_SUBST_LIST(HOST_CFLAGS)
4424 AC_SUBST_LIST(HOST_CPPFLAGS)
4425 AC_SUBST_LIST(HOST_CXXFLAGS)
4426 AC_SUBST(HOST_LDFLAGS)
4427 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
4429 AC_SUBST(HOST_AR_FLAGS)
4430 AC_SUBST(HOST_RANLIB)
4431 AC_SUBST(HOST_BIN_SUFFIX)
4433 AC_SUBST(TARGET_XPCOM_ABI)
4434 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
4435 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
4436 AC_SUBST(HAVE_X86_AVX2)
4437 AC_SUBST(HAVE_ALTIVEC)
4438 AC_SUBST(GCC_USE_GNU_LD)
4442 AC_SUBST_LIST(DSO_CFLAGS)
4443 AC_SUBST_LIST(DSO_PIC_CFLAGS)
4444 AC_SUBST(DSO_LDOPTS)
4445 AC_SUBST(BIN_SUFFIX)
4447 AC_SUBST(CC_VERSION)
4448 AC_SUBST(NS_ENABLE_TSF)
4449 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
4450 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
4453 AC_SUBST(MOZ_FFVPX_FLACONLY)
4454 AC_SUBST_LIST(FFVPX_ASFLAGS)
4455 AC_SUBST(VPX_USE_YASM)
4456 AC_SUBST_LIST(VPX_ASFLAGS)
4457 AC_SUBST(VPX_AS_CONVERSION)
4458 AC_SUBST(VPX_X86_ASM)
4459 AC_SUBST(VPX_ARM_ASM)
4460 AC_SUBST(LIBJPEG_TURBO_USE_YASM)
4461 AC_SUBST_LIST(LIBJPEG_TURBO_ASFLAGS)
4462 AC_SUBST(MOZ_LIBAV_FFT)
4463 AC_SUBST_LIST(LIBAV_FFT_ASFLAGS)
4464 AC_SUBST(MOZ_DEVTOOLS)
4466 AC_SUBST(MOZ_PACKAGE_JSSHELL)
4467 AC_SUBST(MOZ_FOLD_LIBS)
4468 AC_SUBST_LIST(MOZ_FOLD_LIBS_FLAGS)
4472 dnl Host JavaScript runtime, if any, to use during cross compiles.
4475 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
4477 if test -n "$COMPILE_ENVIRONMENT"; then
4478 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
4480 dnl Check for missing components
4481 if test "$MOZ_X11"; then
4482 dnl ====================================================
4483 dnl = Check if X headers exist
4484 dnl ====================================================
4485 _SAVE_CFLAGS=$CFLAGS
4486 CFLAGS="$CFLAGS $XCFLAGS"
4490 #include <X11/Xlib.h>
4491 #include <X11/Intrinsic.h>
4492 #include <X11/extensions/XShm.h>
4496 if ((dpy = XOpenDisplay(NULL)) == NULL) {
4497 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
4501 [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
4502 CFLAGS="$_SAVE_CFLAGS"
4504 if test -n "$MISSING_X"; then
4505 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
4510 fi # COMPILE_ENVIRONMENT
4512 dnl Set various defines and substitutions
4513 dnl ========================================================
4515 if test "$MOZ_DEBUG"; then
4516 AC_DEFINE(MOZ_REFLOW_PERF)
4517 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
4520 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
4521 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
4522 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
4523 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
4524 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
4525 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
4526 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
4527 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
4528 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
4531 AC_SUBST(MOZ_DEV_EDITION)
4532 if test -n "$MOZ_DEV_EDITION"; then
4533 AC_DEFINE(MOZ_DEV_EDITION)
4536 if test "$MOZ_DEBUG" -o "$DEVELOPER_OPTIONS"; then
4540 if test -n "$A11Y_LOG"; then
4544 dnl Spit out some output
4545 dnl ========================================================
4547 dnl The following defines are used by xpcom
4548 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
4550 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
4562 # Avoid using obsolete NSPR features
4563 AC_DEFINE(NO_NSPR_10_SUPPORT)
4565 # Don't build NSS libpkix
4566 NSS_DISABLE_LIBPKIX=1
4567 AC_SUBST(NSS_DISABLE_LIBPKIX)
4569 MOZ_CREATE_CONFIG_STATUS()
4571 if test -z "$direct_nspr_config"; then
4572 dnl ========================================================
4573 dnl = Setup a nice relatively clean build environment for
4574 dnl = sub-configures.
4575 dnl ========================================================
4578 CFLAGS="$_SUBDIR_CFLAGS"
4579 CPPFLAGS="$_SUBDIR_CPPFLAGS"
4580 CXXFLAGS="$_SUBDIR_CXXFLAGS"
4581 LDFLAGS="$_SUBDIR_LDFLAGS"
4582 HOST_CC="$_SUBDIR_HOST_CC"
4583 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
4584 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
4585 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
4592 # Run all configure scripts specified by a subconfigure
4593 if test -n "$_subconfigure_subdir"; then
4594 _save_srcdir="$srcdir"
4596 _save_ac_configure_args="$ac_configure_args"
4597 ac_configure_args="$_subconfigure_config_args"
4598 AC_OUTPUT_SUBDIRS_NOW("$_subconfigure_subdir",$cache_file)
4599 ac_configure_args="$_save_ac_configure_args"
4600 srcdir="$_save_srcdir"
4603 if test "$COMPILE_ENVIRONMENT" -a "$MOZ_WIDGET_TOOLKIT"; then
4606 dnl ========================================================
4607 dnl = Setup a nice relatively clean build environment for
4608 dnl = sub-configures.
4609 dnl ========================================================
4612 CFLAGS="$_SUBDIR_CFLAGS"
4613 CPPFLAGS="$_SUBDIR_CPPFLAGS"
4614 CXXFLAGS="$_SUBDIR_CXXFLAGS"
4615 LDFLAGS="$_SUBDIR_LDFLAGS"
4616 HOST_CC="$_SUBDIR_HOST_CC"
4617 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
4618 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
4619 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
4622 # Run the SpiderMonkey 'configure' script.
4623 dist=$MOZ_BUILD_ROOT/dist
4624 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
4626 # --with-system-nspr will have been converted into the relevant $NSPR_CFLAGS
4628 ac_configure_args="`echo $ac_configure_args | sed -e 's/--with-system-nspr\S* *//'`"
4630 if test "$_INTL_API" = no; then
4631 ac_configure_args="$ac_configure_args --without-intl-api"
4634 if test -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
4635 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
4636 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
4638 ac_configure_args="$ac_configure_args --prefix=$dist"
4639 if test -n "$ZLIB_IN_MOZGLUE"; then
4642 export MOZ_SYSTEM_ZLIB
4643 export MOZ_ZLIB_CFLAGS
4644 export MOZ_ZLIB_LIBS
4646 export MOZ_APP_REMOTINGNAME
4647 export MOZ_DEV_EDITION
4649 export MOZILLA_CENTRAL_PATH=$_topsrcdir
4650 export STLPORT_CPPFLAGS
4655 export ZLIB_IN_MOZGLUE
4669 export HOST_CPPFLAGS
4670 export HOST_CXXFLAGS
4673 if ! test -e js; then
4677 ac_configure_args="$ac_configure_args JS_STANDALONE="
4678 AC_OUTPUT_SUBDIRS(js/src,$cache_file)
4679 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
4681 fi # COMPILE_ENVIRONMENT
4683 dnl we need to run config.status after js/src subconfigure because we're
4684 dnl traversing its moz.build and we need its config.status for that.
4685 dnl However, writing our own config.status needs to happen before
4686 dnl subconfigures because the setup surrounding subconfigures alters
4687 dnl many AC_SUBSTed variables.
4688 MOZ_RUN_ALL_SUBCONFIGURES()
4690 rm -fr confdefs* $ac_clean_files