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 ========================================================
81 LDFLAGS="$LDFLAGS $LINKER_LDFLAGS"
85 if test "$COMPILE_ENVIRONMENT"; then
87 fi # COMPILE_ENVIRONMENT
90 *-android*|*-linuxandroid*)
94 AC_PATH_PROG(OBJCOPY,objcopy)
104 AC_SUBST(ANDROID_SOURCE)
105 AC_SUBST(ANDROID_PACKAGE_NAME)
108 dnl ========================================================
109 dnl Checks for compilers.
110 dnl ========================================================
112 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
115 if test "$COMPILE_ENVIRONMENT"; then
117 if test "$target" != "$host"; then
123 # Work around the conftest.exe access problem on Windows
128 MOZ_PATH_PROGS(AS, $AS as, $CC)
129 AC_CHECK_PROGS(AR, ar, :)
130 AC_CHECK_PROGS(STRIP, strip, :)
131 AC_CHECK_PROGS(WINDRES, windres, :)
132 AC_CHECK_PROGS(OTOOL, otool, :)
133 if test -z "$HOST_RANLIB"; then
134 HOST_RANLIB="$RANLIB"
136 if test -z "$HOST_AR"; then
139 if test -z "$HOST_AR_FLAGS"; then
140 HOST_AR_FLAGS="$AR_FLAGS"
144 if test -n "$MOZ_WINCONSOLE"; then
145 AC_DEFINE(MOZ_WINCONSOLE)
150 dnl ========================================================
151 dnl Special win32 checks
152 dnl ========================================================
158 if test "$GCC" != "yes"; then
159 # Check to see if we are really running in a msvc environemnt
161 AC_CHECK_PROGS(MIDL, midl)
163 # Make sure compilers are valid
164 CFLAGS="$CFLAGS -nologo"
165 CXXFLAGS="$CXXFLAGS -TP -nologo"
168 AC_TRY_COMPILE([#include <stdio.h>],
169 [ printf("Hello World\n"); ],,
170 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
173 AC_TRY_COMPILE([#include <new.h>],
174 [ unsigned *test = new unsigned(42); ],,
175 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
179 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
182 _MSC_VER=`echo ${CC_VERSION} | cut -c 1-2,4-5`
184 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
185 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
186 AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
189 MSVC_C_RUNTIME_DLL=vcruntime140.dll
190 MSVC_CXX_RUNTIME_DLL=msvcp140.dll
192 MOZ_CHECK_HEADER(dia2.h, MSVC_HAS_DIA_SDK=1)
193 if test -n "$MSVC_HAS_DIA_SDK"; then
194 AC_DEFINE(MSVC_HAS_DIA_SDK)
197 if test "$_MSC_VER" -ge "1910"; then # VS2017+
198 # C5038: Enable initializer list order warnings
199 # The -w1#### flag treats warning C#### as if it was a warning level
200 # 1 warning, and thus enables it because we enable /W3 warnings. We
201 # don't use -we#### because it would enable warning C#### but treat
202 # it as an error, even in third-party code.
203 # https://docs.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level
204 CXXFLAGS="$CXXFLAGS -w15038"
207 # C5026: move constructor was implicitly defined as deleted
208 CXXFLAGS="$CXXFLAGS -wd5026"
210 # C5027: move assignment operator was implicitly defined as deleted
211 CXXFLAGS="$CXXFLAGS -wd5027"
213 # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
214 CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
216 # https://connect.microsoft.com/VisualStudio/feedback/details/888527/warnings-on-dbghelp-h
217 # for dbghelp.h, imagehlp.h, and shobj.h
218 # C4091: 'typedef ': ignored on left of '' when no variable is declared
219 CFLAGS="$CFLAGS -wd4091"
220 CXXFLAGS="$CXXFLAGS -wd4091"
222 # This is intended as a temporary hack to support building with VS2015.
223 # 'noexcept' used with no exception handling mode specified;
224 # termination on exception is not guaranteed. Specify /EHsc
225 CXXFLAGS="$CXXFLAGS -wd4577"
227 if test -n "$WIN_UCRT_REDIST_DIR"; then
228 if test ! -d "$WIN_UCRT_REDIST_DIR"; then
229 AC_MSG_ERROR([Invalid Windows UCRT Redist directory: ${WIN_UCRT_REDIST_DIR}])
231 WIN_UCRT_REDIST_DIR=`cd "$WIN_UCRT_REDIST_DIR" && pwd -W`
234 if test -n "$WIN_DIA_SDK_BIN_DIR"; then
235 if test ! -d "$WIN_DIA_SDK_BIN_DIR"; then
236 AC_MSG_ERROR([Invalid Windows DIA SDK directory: ${WIN_DIA_SDK_BIN_DIR}])
238 WIN_DIA_SDK_BIN_DIR=`cd "$WIN_DIA_SDK_BIN_DIR" && pwd -W`
241 AC_SUBST(MSVC_HAS_DIA_SDK)
242 AC_SUBST(MSVC_C_RUNTIME_DLL)
243 AC_SUBST(MSVC_CXX_RUNTIME_DLL)
245 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
247 if test -n "$WIN32_REDIST_DIR"; then
248 if test ! -d "$WIN32_REDIST_DIR"; then
249 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
251 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd -W`
254 # Check linker version, except in lld builds
259 _LD_FULL_VERSION=`"${LINKER}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
260 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
261 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
262 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
269 # Set midl environment
272 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
275 MIDL_FLAGS="${MIDL_FLAGS} -env x64"
278 MIDL_FLAGS="${MIDL_FLAGS} -env arm64"
282 unset _MSVC_VER_FILTER
285 STL_FLAGS="-I${DIST}/stl_wrappers"
286 CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
287 CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
289 # Check w32api version
290 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
291 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
292 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
293 AC_TRY_COMPILE([#include <w32api.h>],
294 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
295 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
296 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
297 #error "test failed."
299 , [ res=yes ], [ res=no ])
300 AC_MSG_RESULT([$res])
301 if test "$res" != "yes"; then
302 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
304 # Check windres version
305 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
306 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
307 AC_MSG_RESULT([$_WINDRES_VERSION])
308 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
309 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
310 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
311 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
312 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
313 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
314 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
315 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
316 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
317 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
318 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
319 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
321 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
324 AC_CHECK_PROGS(MIDL, $target-widl widl)
325 if test -n "$MIDL"; then
328 MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
331 MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
336 # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
337 # causing problems with local implementations with the same name.
338 AC_DEFINE(STRSAFE_NO_DEPRECATE)
341 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
342 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
343 # Require OS features provided by IE 8.0 (Win7)
344 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0800)
349 if test -n "$_WIN32_MSVC"; then
351 SKIP_COMPILER_CHECKS=1
352 SKIP_LIBRARY_CHECKS=1
354 # Since we're skipping compiler and library checks, hard-code
357 AC_DEFINE(HAVE_ISATTY)
360 fi # COMPILE_ENVIRONMENT
369 AC_SUBST_LIST(STL_FLAGS)
370 AC_SUBST(WRAP_STL_INCLUDES)
372 dnl ========================================================
373 dnl Checks for programs.
374 dnl ========================================================
375 if test "$COMPILE_ENVIRONMENT"; then
377 dnl ========================================================
378 dnl = Mac OS X SDK support
379 dnl ========================================================
381 MOZ_ARG_WITH_STRING(macos-sdk,
382 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
383 MACOS_SDK_DIR=$withval)
385 MACOS_PRIVATE_FRAMEWORKS_DIR_DEFAULTED=
386 MOZ_ARG_WITH_STRING(macos-private-frameworks,
387 [ --with-macos-private-frameworks=dir Location of private frameworks to use (Mac OS X only)],
388 MACOS_PRIVATE_FRAMEWORKS_DIR=$withval,
389 MACOS_PRIVATE_FRAMEWORKS_DIR=/System/Library/PrivateFrameworks
390 MACOS_PRIVATE_FRAMEWORKS_DEFAULTED=1)
392 if test -z "${MACOS_PRIVATE_FRAMEWORKS_DEFAULTED}"; then
393 if test -z "$CROSS_COMPILE"; then
394 AC_MSG_WARN([You should only be using --with-macos-private-frameworks when cross-compiling.])
396 if test ! -d "$MACOS_PRIVATE_FRAMEWORKS_DIR"; then
397 AC_MSG_ERROR([PrivateFrameworks directory not found.])
401 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
402 AC_SUBST(MACOS_SDK_DIR)
403 AC_SUBST(MACOS_PRIVATE_FRAMEWORKS_DIR)
405 if test "$MACOS_SDK_DIR"; then
406 dnl Sync this section with the ones in NSPR and NSS.
407 dnl Changes to the cross environment here need to be accounted for in
408 dnl the libIDL checks (below) and xpidl build.
410 if test ! -d "$MACOS_SDK_DIR"; then
411 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
412 specify a valid SDK. SDKs are installed when the optional cross-development
413 tools are selected during the Xcode/Developer Tools installation.])
416 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
417 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
419 dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
420 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
421 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
424 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
426 AC_TRY_COMPILE([#include <new>],[],
430 AC_MSG_RESULT($result)
432 if test "$result" = "no" ; then
433 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
441 fi # COMPILE_ENVIRONMENT
443 dnl ========================================================
444 dnl set the defaults first
445 dnl ========================================================
450 MOZ_USER_DIR=".mozilla"
452 MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
456 dnl Configure platform-specific CPU architecture compiler options.
457 dnl ==============================================================
458 if test "$COMPILE_ENVIRONMENT"; then
461 if test "$OS_TARGET" = Android; then
462 dnl Default Android builds to ARMv7.
465 fi # COMPILE_ENVIRONMENT
467 dnl ========================================================
468 dnl Android libstdc++, placed here so it can use MOZ_ARCH
470 dnl ========================================================
473 if test "$COMPILE_ENVIRONMENT"; then
475 fi # COMPILE_ENVIRONMENT
477 dnl ========================================================
478 dnl Suppress Clang Argument Warnings
479 dnl ========================================================
480 WARNINGS_CFLAGS="$_WARNINGS_CFLAGS"
481 if test -n "${CLANG_CC}${CLANG_CL}"; then
482 WARNINGS_CFLAGS="-Qunused-arguments $WARNINGS_CFLAGS"
483 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
485 if test -n "${CLANG_CXX}${CLANG_CL}"; then
486 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
489 if test -n "$COMPILE_ENVIRONMENT"; then
493 dnl ========================================================
494 dnl Add optional and non-optional hardening flags
495 dnl ========================================================
497 CFLAGS="$CFLAGS $MOZ_HARDENING_CFLAGS"
498 CPPFLAGS="$CPPFLAGS $MOZ_HARDENING_CFLAGS"
499 CXXFLAGS="$CXXFLAGS $MOZ_HARDENING_CFLAGS"
501 dnl ========================================================
502 dnl GNU specific defaults
503 dnl ========================================================
504 if test "$GNU_CC"; then
508 SSSE3_FLAGS="-mssse3"
509 # FIXME: Let us build with strict aliasing. bug 414641.
510 CFLAGS="$CFLAGS -fno-strict-aliasing"
511 WARNINGS_AS_ERRORS='-Werror'
514 if test "$OS_ARCH" != "WINNT" -o -z "$CLANG_CC"; then
515 DSO_PIC_CFLAGS='-fPIC'
516 ASFLAGS="$ASFLAGS -fPIC"
519 AC_MSG_CHECKING([for --noexecstack option to as])
521 CFLAGS="$CFLAGS -Wa,--noexecstack"
522 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
523 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
526 AC_MSG_CHECKING([for -z noexecstack option to ld])
527 _SAVE_LDFLAGS=$LDFLAGS
528 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
529 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
531 LDFLAGS=$_SAVE_LDFLAGS)
533 AC_MSG_CHECKING([for -z text option to ld])
534 _SAVE_LDFLAGS=$LDFLAGS
535 LDFLAGS="$LDFLAGS -Wl,-z,text"
536 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
538 LDFLAGS=$_SAVE_LDFLAGS)
540 AC_MSG_CHECKING([for -z relro option to ld])
541 _SAVE_LDFLAGS=$LDFLAGS
542 LDFLAGS="$LDFLAGS -Wl,-z,relro"
543 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
545 LDFLAGS=$_SAVE_LDFLAGS)
547 AC_MSG_CHECKING([for -z nocopyreloc option to ld])
548 _SAVE_LDFLAGS=$LDFLAGS
549 LDFLAGS="$LDFLAGS -Wl,-z,nocopyreloc"
550 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
552 LDFLAGS=$_SAVE_LDFLAGS)
554 AC_MSG_CHECKING([for --build-id=sha1 option to ld])
555 _SAVE_LDFLAGS=$LDFLAGS
556 LDFLAGS="$LDFLAGS -Wl,--build-id=sha1"
557 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
559 LDFLAGS=$_SAVE_LDFLAGS)
561 AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
562 HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
563 _SAVE_LDFLAGS=$LDFLAGS
564 LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
565 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
566 [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
568 LDFLAGS=$_SAVE_LDFLAGS
570 # Check for -mssse3 on $CC
571 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
572 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
574 CFLAGS="$CFLAGS -mssse3"
575 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
576 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
580 # Check for -msse4.1 on $CC
581 AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
582 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
584 CFLAGS="$CFLAGS -msse4.1"
585 AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
586 [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
590 case "${CPU_ARCH}" in
592 AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
594 [asm volatile ("vpermq \$0xd8,%ymm0,%ymm0 \n");],
595 result="yes", result="no")
596 AC_MSG_RESULT("$result")
597 if test "$result" = "yes"; then
603 AC_MSG_CHECKING([whether we can enable AltiVec support])
606 CFLAGS="$CFLAGS -maltivec"
607 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
615 if test "$GCC_USE_GNU_LD"; then
616 # Some tools like ASan use a runtime library that is only
617 # linked against executables, so we must allow undefined
618 # symbols for shared objects in some cases.
619 if test -z "$MOZ_ASAN$MOZ_MSAN$MOZ_UBSAN$MOZ_TSAN"; then
620 # Don't allow undefined symbols in libraries
621 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
623 # BSDs need `environ' exposed for posix_spawn (bug 753046)
625 DragonFly|FreeBSD|NetBSD|OpenBSD)
626 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
627 DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
629 DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
636 _DEFINES_CFLAGS="-include $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
637 _USE_CPP_INCLUDE_FLAG=1
639 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
642 if test "$GNU_CXX"; then
643 # FIXME: Let us build with strict aliasing. bug 414641.
644 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
646 _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
647 _USE_CPP_INCLUDE_FLAG=1
650 # For profiling builds keep the symbol information
651 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
653 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
654 STRIP_FLAGS="--strip-debug"
659 dnl ========================================================
661 dnl ========================================================
663 if test "$MOZ_DMD"; then
664 if test "${CPU_ARCH}" = "arm"; then
665 CFLAGS="$CFLAGS -funwind-tables"
666 CXXFLAGS="$CXXFLAGS -funwind-tables"
670 dnl ========================================================
671 dnl System overrides of the defaults for host
672 dnl ========================================================
675 if test -n "$_WIN32_MSVC"; then
677 HOST_AR_FLAGS='-NOLOGO -OUT:$@'
678 HOST_CFLAGS="$HOST_CFLAGS -nologo"
679 HOST_RANLIB='echo ranlib'
681 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
683 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
684 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
687 case "${host_cpu}" in
689 if test -n "$_WIN32_MSVC"; then
690 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
694 if test -n "$_WIN32_MSVC"; then
695 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
697 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
703 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
704 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
707 *-linux*|*-kfreebsd*-gnu|*-gnu*)
708 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
709 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
713 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
714 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
718 dnl Get version of various core apps from the version files.
719 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
720 FIREFOX_VERSION_DISPLAY=`cat $_topsrcdir/browser/config/version_display.txt`
722 if test -z "$FIREFOX_VERSION"; then
723 AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
726 if test -z "$FIREFOX_VERSION_DISPLAY"; then
727 AC_MSG_ERROR([FIREFOX_VERSION_DISPLAY is unexpectedly blank.])
730 MOZ_DOING_LTO(lto_is_enabled)
732 dnl ========================================================
733 dnl System overrides of the defaults for target
734 dnl ========================================================
738 MOZ_OPTIMIZE_FLAGS="-O3"
739 CXXFLAGS="$CXXFLAGS -stdlib=libc++"
741 STRIP_FLAGS="$STRIP_FLAGS -x -S"
742 # Ensure that if we're targeting iOS an SDK was provided.
743 AC_CACHE_CHECK(for iOS target,
745 [AC_TRY_COMPILE([#include <TargetConditionals.h>
746 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
750 ac_cv_ios_target="yes",
751 ac_cv_ios_target="no")])
752 if test "$ac_cv_ios_target" = "yes" -a -z $MOZ_IOS; then
753 AC_MSG_ERROR([targeting iOS but not using an iOS SDK?])
755 if test -n "$MOZ_IOS"; then
758 # The ExceptionHandling framework is needed for Objective-C exception
759 # logging code in nsObjCExceptions.h. Currently we only use that in debug
761 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
764 if test "x$lto_is_enabled" = "xyes"; then
765 echo "Skipping -dead_strip because lto is enabled."
766 dnl DTrace and -dead_strip don't interact well. See bug 403132.
767 dnl ===================================================================
768 elif test "x$enable_dtrace" = "xyes"; then
769 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
771 dnl check for the presence of the -dead_strip linker flag
772 AC_MSG_CHECKING([for -dead_strip option to ld])
773 _SAVE_LDFLAGS=$LDFLAGS
774 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
775 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
776 if test -n "$_HAVE_DEAD_STRIP" ; then
778 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
783 LDFLAGS=$_SAVE_LDFLAGS
786 MOZ_FIX_LINK_PATHS="-Wl,-executable_path,${DIST}/bin"
789 *-android*|*-linuxandroid*)
790 AC_DEFINE(NO_PW_GECOS)
792 if test "$COMPILE_ENVIRONMENT"; then
796 MOZ_GFX_OPTIMIZE_MOBILE=1
797 if test -z "$CLANG_CC"; then
798 MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
800 # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
801 # -Oz is smaller than -Os on clang.
802 MOZ_OPTIMIZE_FLAGS="-Oz"
807 if test "$GNU_CC" -o "$GNU_CXX"; then
808 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
809 if test -n "$MOZ_DEBUG"; then
810 MOZ_OPTIMIZE_FLAGS="-Os"
812 MOZ_OPTIMIZE_FLAGS="-O2"
814 if test -z "$CLANG_CC"; then
815 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
819 case "${target_cpu}" in
821 CFLAGS="$CFLAGS -mieee"
822 CXXFLAGS="$CXXFLAGS -mieee"
830 # certain versions of cygwin's makedepend barf on the
831 # #include <string> vs -I./dist/include/string issue so don't use it
832 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
836 CFLAGS="$CFLAGS -mms-bitfields"
837 CXXFLAGS="$CXXFLAGS -mms-bitfields"
840 # Use temp file for windres (bug 213281)
841 RCFLAGS='-O coff --use-temp-file'
842 # mingw doesn't require kernel32, user32, and advapi32 explicitly
843 LIBS="$LIBS -luuid -lusp10 -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
846 MOZ_OPTIMIZE_FLAGS="-O1"
848 WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
849 WIN32_GUI_EXE_LDFLAGS=-mwindows
851 if test -z "$CLANG_CC"; then
852 # Use static libgcc and libstdc++
853 LDFLAGS="$LDFLAGS -static"
855 # GCC/binutils can't link to a function if we try to include dllexport function
856 # in the same library as dllimport caller. To work around it, we build NSPR
857 # and NSS with -mnop-fun-dllimport flag. The drawback of this solution is that
858 # function thunks need to be generated for cross-DLL calls.
859 MOZ_FOLD_LIBS_FLAGS="-mnop-fun-dllimport"
861 # Silence problematic clang warnings
862 CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
865 TARGET_COMPILER_ABI=msvc
866 if test "$AS_BIN"; then
867 AS="$(basename "$AS_BIN")"
869 # armasm64 doesn't understand -c.
870 if test "$CPU_ARCH" = "aarch64"; then
876 AR_FLAGS='-llvmlibthin -out:$@'
880 AR_FLAGS='-NOLOGO -OUT:$@'
884 RANLIB='echo not_ranlib'
885 STRIP='echo not_strip'
887 WIN32_SUBSYSTEM_VERSION=6.01
888 WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
889 WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
890 DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
891 _USE_CPP_INCLUDE_FLAG=1
892 _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
893 _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
894 CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
895 CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
896 if test -z "$CLANG_CL"; then
897 CPPFLAGS="$CPPFLAGS -utf-8"
899 if test "$CPU_ARCH" = "x86"; then
900 dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
901 dnl more recent, so set that explicitly here unless another
902 dnl target arch has already been set.
904 if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
905 CFLAGS="$CFLAGS -arch:SSE2"
907 if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
908 CXXFLAGS="$CXXFLAGS -arch:SSE2"
911 SSE_FLAGS="-arch:SSE"
912 SSE2_FLAGS="-arch:SSE2"
913 dnl MSVC allows the use of intrinsics without any flags
914 dnl and doesn't have a separate arch for SSSE3
915 SSSE3_FLAGS="-arch:SSE2"
917 dnl clang-cl requires appropriate flags to enable SSSE3 support
918 dnl on all architectures.
919 if test -n "$CLANG_CL"; then
920 SSSE3_FLAGS="-mssse3"
922 dnl VS2013+ supports -Gw for better linker optimizations.
923 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
924 dnl Disabled on ASan because it causes false-positive ODR violations.
925 if test -z "$MOZ_ASAN"; then
927 CXXFLAGS="$CXXFLAGS -Gw"
929 # khuey says we can safely ignore MSVC warning C4251
930 # MSVC warning C4244 (implicit type conversion may lose data) warns
931 # and requires workarounds for perfectly valid code. Also, GCC/clang
932 # don't warn about it by default. So for consistency/sanity, we turn
933 # it off on MSVC, too.
934 # MSVC warning C4267 warns for narrowing type conversions from size_t
935 # to 32-bit integer types on 64-bit platforms. Since this is virtually
936 # the same thing as C4244, we disable C4267, too.
937 # MSVC warning C4800 warns when a value is implicitly cast to bool,
938 # because this also forces narrowing to a single byte, which can be a
939 # perf hit. But this matters so little in practice (and often we want
940 # that behavior) that it's better to turn it off.
941 # MSVC warning C4595 warns non-member operator new or delete functions
942 # may not be declared inline, as of VS2015 Update 2.
943 CFLAGS="$CFLAGS -wd4244 -wd4267"
944 CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4267 -wd4800 -wd4595"
945 # Silence "warning C4065: switch statement contains 'default' but no
946 # 'case' labels". See bug 1461304.
947 CXXFLAGS="$CXXFLAGS -wd4065"
948 if test -n "$CLANG_CL"; then
949 # XXX We should combine some of these with our generic GCC-style
952 # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
953 CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
954 # We use offsetof on non-POD objects all the time.
955 # We also suppress this warning on other platforms.
956 CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
957 # This warns for reasonable things like:
958 # enum { X = 0xffffffffU };
959 # which is annoying for IDL headers.
960 CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
961 # This warns for cases that would be reached by the Microsoft
962 # #include rules, but also currently warns on cases that would
963 # *also* be reached by standard C++ include rules. That
964 # behavior doesn't seem useful, so we turn it off.
965 CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
966 # We normally error out on unknown pragmas, but since clang-cl
967 # claims to be MSVC, it would be difficult to add
968 # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
969 # use such pragmas, so just ignore them.
970 CFLAGS="$CFLAGS -Wno-unknown-pragmas"
971 CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
972 # We get errors about various #pragma intrinsic directives from
973 # clang-cl, and we don't need to hear about those.
974 CFLAGS="$CFLAGS -Wno-ignored-pragmas"
975 CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
976 # clang-cl's Intrin.h marks things like _ReadWriteBarrier
977 # as __attribute((__deprecated__)). This is nice to know,
978 # but since we don't get the equivalent warning from MSVC,
979 # let's just ignore it.
980 CFLAGS="$CFLAGS -Wno-deprecated-declarations"
981 CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
982 # We use a function like:
983 # __declspec(noreturn) __inline void f() {}
984 # which -Winvalid-noreturn complains about. Again, MSVC seems
985 # OK with it, so let's silence the warning.
986 CFLAGS="$CFLAGS -Wno-invalid-noreturn"
987 CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
988 # Missing |override| on virtual function declarations isn't
989 # something that MSVC currently warns about.
990 CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
991 # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
992 # declaration on |operator delete(void*)|. However, clang-cl
993 # must internally declare |operator delete(void*)| differently,
994 # which causes this warning for virtually every file in the
995 # tree. clang-cl doesn't support -fno-exceptions or equivalent,
996 # so there doesn't seem to be any way to convince clang-cl to
997 # declare |delete| differently. Therefore, suppress this
999 CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
1000 # At least one MSVC header and several headers in-tree have
1001 # unused typedefs, so turn this on.
1002 CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
1003 # jemalloc uses __declspec(allocator) as a profiler hint,
1004 # which clang-cl doesn't understand.
1005 CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
1006 # __attribute__((unused)) really means "might be unused" and
1007 # we use it to avoid warnings about things that are unused
1008 # in some compilation units, but used in many others. This
1009 # warning insists on complaining about the latter case, which
1010 # is annoying, and rather noisy.
1011 CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused"
1013 # make 'foo == bar;' error out
1014 CFLAGS="$CFLAGS -we4553"
1015 CXXFLAGS="$CXXFLAGS -we4553"
1016 # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
1017 CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
1018 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
1019 MOZ_DEBUG_LDFLAGS='-DEBUG'
1020 WARNINGS_AS_ERRORS='-WX'
1021 # Use a higher optimization level for clang-cl, so we can come closer
1022 # to MSVC's performance numbers (see bug 1443590).
1023 if test -n "$CLANG_CL"; then
1024 MOZ_OPTIMIZE_FLAGS='-O2'
1026 MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
1029 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE"
1030 if test -z "$DEVELOPER_OPTIONS"; then
1031 LDFLAGS="$LDFLAGS -RELEASE"
1034 dnl Minimum reqiurement of Gecko is VS2015 or later which supports
1035 dnl both SSSE3 and SSE4.1.
1036 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
1037 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
1038 dnl allow AVX2 code from VS2015
1041 AC_DEFINE(WIN32_LEAN_AND_MEAN)
1042 dnl See http://support.microsoft.com/kb/143208 to use STL
1045 MOZ_USER_DIR="Mozilla"
1049 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.])
1053 if test -n "$GNU_CC" -a -z "$CLANG_CC"; then
1054 CFLAGS="$CFLAGS -fno-keep-inline-dllexport"
1055 CXXFLAGS="$CXXFLAGS -fno-keep-inline-dllexport"
1060 if test -n "$GNU_CC"; then
1061 CFLAGS="$CFLAGS -mstackrealign"
1062 CXXFLAGS="$CXXFLAGS -mstackrealign"
1063 LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
1064 if test -z "$CLANG_CC"; then
1065 LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup"
1068 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
1069 LDFLAGS="$LDFLAGS -SAFESEH"
1075 if test -n "$_WIN32_MSVC"; then
1076 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
1081 if test -n "$_WIN32_MSVC"; then
1082 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:ARM64"
1087 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
1094 CFLAGS="$CFLAGS -Dunix"
1095 CXXFLAGS="$CXXFLAGS -Dunix"
1096 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
1097 DSO_PIC_CFLAGS='-fPIC -DPIC'
1098 DSO_LDOPTS='-shared'
1099 MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
1101 DSO_PIC_CFLAGS='-fPIC -DPIC'
1102 DSO_LDOPTS='-shared'
1104 # This will fail on a.out systems prior to 1.5.1_ALPHA.
1105 if test "$LIBRUNPATH"; then
1106 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
1111 if test -z "$X11BASE"; then
1114 MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
1116 DSO_PIC_CFLAGS='-fPIC'
1117 DSO_LDOPTS='-shared -fPIC'
1118 if test "$LIBRUNPATH"; then
1119 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
1124 MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
1129 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
1130 MOZ_OPTIMIZE_FLAGS="-O"
1133 AC_SUBST_LIST(MMX_FLAGS)
1134 AC_SUBST_LIST(SSE_FLAGS)
1135 AC_SUBST_LIST(SSE2_FLAGS)
1136 AC_SUBST_LIST(SSSE3_FLAGS)
1138 AC_SUBST(MOZ_LINKER)
1139 if test -n "$MOZ_LINKER"; then
1140 AC_DEFINE(MOZ_LINKER)
1141 MOZ_LINKER_EXTRACT=1
1142 AC_CHECK_PROGS(XZ, xz)
1145 if test -z "$COMPILE_ENVIRONMENT"; then
1146 SKIP_COMPILER_CHECKS=1
1147 SKIP_LIBRARY_CHECKS=1
1152 fi # COMPILE_ENVIRONMENT
1154 if test -z "$SKIP_COMPILER_CHECKS"; then
1155 dnl Checks for typedefs, structures, and compiler characteristics.
1156 dnl ========================================================
1171 case "${OS_TARGET}" in
1175 STL_FLAGS="-I${DIST}/stl_wrappers"
1180 dnl Checks for header files.
1181 dnl ========================================================
1183 case "$target_os" in
1184 bitrig*|dragonfly*|freebsd*|openbsd*)
1185 # for stuff like -lXshm
1186 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
1190 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
1191 AC_CACHE_CHECK(for sockaddr_in.sin_len,
1192 ac_cv_sockaddr_in_sin_len,
1193 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1194 #include <sys/types.h>
1196 #include <netinet/in.h>
1197 struct sockaddr_in x;
1198 void *foo = (void*) &x.sin_len;],
1200 [ac_cv_sockaddr_in_sin_len=true],
1201 [ac_cv_sockaddr_in_sin_len=false])])
1202 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
1203 AC_DEFINE(HAVE_SIN_LEN)
1204 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
1205 AC_DEFINE(HAVE_SCONN_LEN)
1208 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
1209 ac_cv_sockaddr_in6_sin6_len,
1210 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1211 #include <sys/types.h>
1213 #include <netinet/in.h>
1214 struct sockaddr_in6 x;
1215 void *foo = (void*) &x.sin6_len;],
1217 [ac_cv_sockaddr_in6_sin6_len=true],
1218 [ac_cv_sockaddr_in6_sin6_len=false])])
1219 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
1220 AC_DEFINE(HAVE_SIN6_LEN)
1223 AC_CACHE_CHECK(for sockaddr.sa_len,
1224 ac_cv_sockaddr_sa_len,
1225 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1226 #include <sys/types.h>
1228 #include <sys/socket.h>
1230 void *foo = (void*) &x.sa_len;],
1232 [ac_cv_sockaddr_sa_len=true],
1233 [ac_cv_sockaddr_sa_len=false])])
1234 if test "$ac_cv_sockaddr_sa_len" = true ; then
1235 AC_DEFINE(HAVE_SA_LEN)
1238 MOZ_ARG_ENABLE_BOOL(dtrace,
1239 [ --enable-dtrace build with dtrace support if available (default=no)],
1240 [enable_dtrace="yes"],)
1241 if test "x$enable_dtrace" = "xyes"; then
1242 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
1243 if test -n "$HAVE_DTRACE"; then
1244 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
1246 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
1249 AC_SUBST(HAVE_DTRACE)
1251 dnl Checks for libraries.
1252 dnl ========================================================
1253 AC_CHECK_LIB(c_r, gethostbyname_r)
1255 dnl We don't want to link with libdl even if it's present on OS X, since
1256 dnl it's not used and not part of the default installation. OS/2 has dlfcn
1258 dnl We don't want to link against libm or libpthread on Darwin since
1259 dnl they both are just symlinks to libSystem and explicitly linking
1260 dnl against libSystem causes issues when debugging (see bug 299601).
1265 AC_SEARCH_LIBS(dlopen, dl,
1266 MOZ_CHECK_HEADER(dlfcn.h,
1267 AC_DEFINE(HAVE_DLOPEN)))
1271 _SAVE_CFLAGS="$CFLAGS"
1272 CFLAGS="$CFLAGS -D_GNU_SOURCE"
1273 AC_CHECK_FUNCS(dladdr memmem)
1274 CFLAGS="$_SAVE_CFLAGS"
1276 if test ! "$GNU_CXX"; then
1277 AC_CHECK_LIB(C, demangle)
1280 AC_CHECK_LIB(socket, socket)
1283 XLIBS="$X_EXTRA_LIBS"
1285 dnl ========================================================
1286 dnl Checks for X libraries.
1287 dnl Ordering is important.
1288 dnl Xt is dependent upon SM as of X11R6
1289 dnl ========================================================
1290 if test -n "$MOZ_X11"; then
1291 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
1292 _SAVE_LDFLAGS="$LDFLAGS"
1294 LDFLAGS="$XLDFLAGS $LDFLAGS"
1295 AC_CHECK_LIB(X11, XDrawLines, [XLIBS="-lX11 $XLIBS"],
1296 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
1297 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
1298 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
1300 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
1301 unset ac_cv_lib_Xt_XtFree
1302 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
1303 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
1304 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
1305 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
1308 dnl ========================================================
1310 dnl ========================================================
1311 AC_CHECK_LIB(xcb, xcb_connect, [XLIBS="-lxcb $XLIBS"],
1312 [MISSING_X="$MISSING_X -lxcb"], $XLIBS)
1313 AC_CHECK_LIB(xcb-shm, xcb_shm_query_version, [XLIBS="-lxcb-shm $XLIBS"],
1314 [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS)
1315 AC_CHECK_LIB(X11-xcb, XGetXCBConnection, [XLIBS="-lX11-xcb $XLIBS"],
1316 [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS)
1318 LDFLAGS="$_SAVE_LDFLAGS"
1322 AC_SUBST_LIST(XCFLAGS)
1323 AC_SUBST_LIST(XLDFLAGS)
1324 AC_SUBST_LIST(XLIBS)
1325 AC_SUBST_LIST(XEXT_LIBS)
1326 AC_SUBST_LIST(XT_LIBS)
1328 dnl ========================================================
1329 dnl = pthread support
1330 dnl = Start by checking whether the system support pthreads
1331 dnl ========================================================
1332 case "$target_os" in
1337 AC_CHECK_LIB(pthreads, pthread_create,
1338 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
1339 AC_CHECK_LIB(pthread, pthread_create,
1340 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
1341 AC_CHECK_LIB(c_r, pthread_create,
1342 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
1343 AC_CHECK_LIB(c, pthread_create,
1352 dnl ========================================================
1353 dnl Do the platform specific pthread hackery
1354 dnl ========================================================
1355 if test "$MOZ_USE_PTHREADS"x != x
1358 dnl See if -pthread is supported.
1361 ac_cv_have_dash_pthread=no
1362 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
1363 echo 'int main() { return 0; }' | cat > conftest.c
1364 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
1365 if test $? -eq 0; then
1366 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1367 ac_cv_have_dash_pthread=yes
1368 case "$target_os" in
1370 # Freebsd doesn't use -pthread for compiles, it uses them for linking
1373 CFLAGS="$CFLAGS -pthread"
1374 CXXFLAGS="$CXXFLAGS -pthread"
1380 AC_MSG_RESULT($ac_cv_have_dash_pthread)
1383 dnl See if -pthreads is supported.
1385 ac_cv_have_dash_pthreads=no
1386 if test "$ac_cv_have_dash_pthread" = "no"; then
1387 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
1388 echo 'int main() { return 0; }' | cat > conftest.c
1389 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
1390 if test $? -eq 0; then
1391 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1392 ac_cv_have_dash_pthreads=yes
1393 CFLAGS="$CFLAGS -pthreads"
1394 CXXFLAGS="$CXXFLAGS -pthreads"
1398 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
1403 AC_DEFINE(_REENTRANT)
1404 AC_DEFINE(_THREAD_SAFE)
1405 dnl -pthread links in -lpthread, so don't specify it explicitly.
1406 if test "$ac_cv_have_dash_pthread" = "yes"; then
1407 _PTHREAD_LDFLAGS="-pthread"
1411 *-*-openbsd*|*-*-bsdi*)
1412 AC_DEFINE(_REENTRANT)
1413 AC_DEFINE(_THREAD_SAFE)
1414 dnl -pthread links in -lc_r, so don't specify it explicitly.
1415 if test "$ac_cv_have_dash_pthread" = "yes"; then
1416 _PTHREAD_LDFLAGS="-pthread"
1420 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
1421 AC_DEFINE(_REENTRANT)
1425 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
1426 AC_SUBST(MOZ_USE_PTHREADS)
1427 MOZ_CHECK_HEADERS(pthread.h)
1431 dnl Checks for library functions.
1432 dnl ========================================================
1433 AC_PROG_GCC_TRADITIONAL
1435 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall)
1437 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1438 dnl avoid this on Darwin, since depending on your system config, we may think
1439 dnl it exists but it really doesn't
1440 case "$OS_TARGET" in
1444 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1445 ac_cv_clock_monotonic,
1446 [for libs in "" -lrt; do
1449 AC_TRY_LINK([#include <time.h>],
1450 [ struct timespec ts;
1451 clock_gettime(CLOCK_MONOTONIC, &ts); ],
1452 ac_cv_clock_monotonic=$libs
1455 ac_cv_clock_monotonic=no)
1458 if test "$ac_cv_clock_monotonic" != "no"; then
1459 HAVE_CLOCK_MONOTONIC=1
1460 REALTIME_LIBS=$ac_cv_clock_monotonic
1461 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1462 AC_SUBST(HAVE_CLOCK_MONOTONIC)
1463 AC_SUBST_LIST(REALTIME_LIBS)
1468 dnl Turn on warnings-as-errors to prevent implicit declaration of
1469 dnl pthread_cond_timedwait_monotonic_np, which can cause this test to
1470 dnl inadvertently pass even if the function does not really exist.
1471 _SAVE_CFLAGS="$CFLAGS"
1472 CFLAGS="$CFLAGS $WARNINGS_AS_ERRORS"
1473 AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
1474 ac_cv_pthread_cond_timedwait_monotonic_np,
1475 AC_TRY_LINK([#include <pthread.h>],
1476 [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
1477 ac_cv_pthread_cond_timewait_monotonic_np=yes,
1478 ac_cv_pthread_cond_timewait_monotonic_np=no))
1479 if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
1480 AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
1482 CFLAGS=$_SAVE_CFLAGS
1486 ac_cv_func_res_ninit,
1487 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
1488 dnl no need for res_ninit() on NetBSD and OpenBSD
1489 ac_cv_func_res_ninit=no
1493 #define _BSD_SOURCE 1
1495 #include <sys/types.h>
1496 #include <netinet/in.h>
1497 #include <arpa/nameser.h>
1500 [int foo = res_ninit(&_res);],
1501 [ac_cv_func_res_ninit=yes],
1502 [ac_cv_func_res_ninit=no])
1506 if test "$ac_cv_func_res_ninit" = "yes"; then
1507 AC_DEFINE(HAVE_RES_NINIT)
1508 dnl must add the link line we do something as foolish as this... dougt
1510 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
1511 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
1516 dnl **********************
1517 dnl *** va_copy checks ***
1518 AC_CACHE_CHECK([for an implementation of va_copy()],
1520 [AC_TRY_COMPILE([#include <stdarg.h>
1522 void f (int i, ...) {
1523 va_list args1, args2;
1524 va_start (args1, i);
1525 va_copy (args2, args1);
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_copy=yes],
1535 AC_CACHE_CHECK([whether va_list can be copied by value],
1537 [AC_TRY_COMPILE([#include <stdarg.h>
1539 void f (int i, ...) {
1540 va_list args1, args2;
1541 va_start (args1, i);
1543 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1545 va_end (args1); va_end (args2);
1547 [f(0, 42); return 0],
1548 [ac_cv_va_val_copy=yes],
1549 [ac_cv_va_val_copy=no],
1552 if test "x$ac_cv_va_copy" = "xyes"; then
1553 AC_DEFINE(VA_COPY, va_copy)
1554 AC_DEFINE(HAVE_VA_COPY)
1557 if test "x$ac_cv_va_val_copy" = "xno"; then
1558 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
1561 dnl ===================================================================
1562 dnl ========================================================
1563 dnl Put your C++ language/feature checks below
1564 dnl ========================================================
1568 if test "$GNU_CC"; then
1569 if test "$CPU_ARCH" = "arm" ; then
1570 AC_CACHE_CHECK(for ARM EABI,
1574 #if defined(__ARM_EABI__)
1577 #error Not ARM EABI.
1580 ac_cv_gcc_arm_eabi="yes",
1581 ac_cv_gcc_arm_eabi="no")])
1582 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
1584 ARM_ABI_PREFIX=eabi-
1586 ARM_ABI_PREFIX=oabi-
1590 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
1593 dnl See if a dynamic_cast to void* gives the most derived object.
1594 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
1595 ac_cv_cpp_dynamic_cast_void_ptr,
1596 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
1597 class Y { int j; public: virtual ~Y() { } };
1598 class Z : public X, public Y { int k; };
1604 return !((((void*)&mdo != (void*)subx) &&
1605 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
1606 (((void*)&mdo != (void*)suby) &&
1607 ((void*)&mdo == dynamic_cast<void*>(suby))));
1609 ac_cv_cpp_dynamic_cast_void_ptr=yes,
1610 ac_cv_cpp_dynamic_cast_void_ptr=no,
1611 ac_cv_cpp_dynamic_cast_void_ptr=no)])
1612 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
1613 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
1617 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
1618 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
1619 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
1621 _SAVE_LDFLAGS=$LDFLAGS
1622 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
1623 AC_CACHE_CHECK(for __thread keyword for TLS variables,
1624 ac_cv_thread_keyword,
1625 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
1626 [return tlsIsMainThread;],
1627 ac_cv_thread_keyword=yes,
1628 ac_cv_thread_keyword=no)])
1629 LDFLAGS=$_SAVE_LDFLAGS
1630 # The custom dynamic linker doesn't support TLS variables
1632 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
1633 # mips builds fail with TLS variables because of a binutils bug.
1635 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
1640 *-android*|*-linuxandroid*)
1647 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
1653 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
1654 if test -n "$MOZ_LINKER"; then
1655 if test "$CPU_ARCH" = arm; then
1656 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
1657 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
1658 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1659 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1663 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
1664 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
1665 dnl Since the linker only understands the sysv ones, no need to build the
1666 dnl gnu style tables anyways.
1667 LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
1670 dnl End of C++ language/feature checks
1673 dnl ========================================================
1674 dnl = Internationalization checks
1675 dnl ========================================================
1677 dnl Internationalization and Locale support is different
1678 dnl on various UNIX platforms. Checks for specific i18n
1679 dnl features go here.
1681 AC_HAVE_FUNCS(localeconv)
1683 fi # ! SKIP_COMPILER_CHECKS
1685 if test -n "${COMPILE_ENVIRONMENT}"; then
1690 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1691 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1692 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1695 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1696 dnl features that Windows actually does support.
1698 if test -n "$SKIP_COMPILER_CHECKS"; then
1699 dnl Windows has malloc.h
1700 AC_DEFINE(MALLOC_H, [<malloc.h>])
1701 AC_DEFINE(HAVE_FORCEINLINE)
1702 AC_DEFINE(HAVE_LOCALECONV)
1703 fi # SKIP_COMPILER_CHECKS
1705 dnl Mozilla specific options
1706 dnl ========================================================
1707 dnl The macros used for command line options
1708 dnl are defined in build/autoconf/altoptions.m4.
1710 dnl ========================================================
1712 dnl = Check for external package dependencies
1714 dnl ========================================================
1715 MOZ_ARG_HEADER(External Packages)
1717 case "$OS_TARGET" in
1718 WINNT|Darwin|Android)
1728 dnl ========================================================
1729 dnl system libevent Support
1730 dnl ========================================================
1731 MOZ_ARG_WITH_STRING(system-libevent,
1732 [ --with-system-libevent[=PFX]
1733 Use system libevent [installed at prefix PFX]],
1734 LIBEVENT_DIR=$withval)
1736 _SAVE_CFLAGS=$CFLAGS
1737 _SAVE_LDFLAGS=$LDFLAGS
1739 if test "$LIBEVENT_DIR" = yes; then
1740 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
1741 MOZ_SYSTEM_LIBEVENT=1,
1744 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
1745 MOZ_SYSTEM_LIBEVENT=
1746 elif test -z "$MOZ_SYSTEM_LIBEVENT"; then
1747 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
1748 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
1749 MOZ_CHECK_HEADER(event.h,
1750 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
1751 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
1753 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
1754 AC_CHECK_LIB(event, event_init,
1755 [MOZ_SYSTEM_LIBEVENT=1
1756 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
1757 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
1758 [MOZ_SYSTEM_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
1760 CFLAGS=$_SAVE_CFLAGS
1761 LDFLAGS=$_SAVE_LDFLAGS
1764 AC_SUBST(MOZ_SYSTEM_LIBEVENT)
1766 dnl ========================================================
1767 dnl = If NSS was not detected in the system,
1768 dnl = use the one in the source tree (mozilla/security/nss)
1769 dnl ========================================================
1771 MOZ_ARG_WITH_BOOL(system-nss,
1772 [ --with-system-nss Use system installed NSS],
1775 if test -n "$_USE_SYSTEM_NSS"; then
1776 AM_PATH_NSS(3.39, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
1779 if test -z "$MOZ_SYSTEM_NSS"; then
1780 NSS_CFLAGS="-I${DIST}/include/nss"
1781 case "${OS_ARCH}" in
1782 # Only few platforms have been tested with GYP
1783 WINNT|Darwin|Linux|DragonFly|FreeBSD|NetBSD|OpenBSD|SunOS)
1786 AC_MSG_ERROR([building in-tree NSS is not supported on this platform. Use --with-system-nss])
1791 if test -z "$SKIP_LIBRARY_CHECKS"; then
1792 dnl system JPEG support
1793 dnl ========================================================
1794 MOZ_ARG_WITH_STRING(system-jpeg,
1795 [ --with-system-jpeg[=PFX]
1796 Use system libjpeg [installed at prefix PFX]],
1799 _SAVE_CFLAGS=$CFLAGS
1800 _SAVE_LDFLAGS=$LDFLAGS
1802 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
1803 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
1804 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
1806 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
1809 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_SYSTEM_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_SYSTEM_JPEG=)
1812 if test "$MOZ_SYSTEM_JPEG" = 1; then
1813 AC_TRY_COMPILE([ #include <stdio.h>
1814 #include <sys/types.h>
1815 #include <jpeglib.h> ],
1816 [ #if JPEG_LIB_VERSION < $MOZJPEG
1817 #error "Insufficient JPEG library version ($MOZJPEG required)."
1819 #ifndef JCS_EXTENSIONS
1820 #error "libjpeg-turbo JCS_EXTENSIONS required"
1824 AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
1826 CFLAGS=$_SAVE_CFLAGS
1827 LDFLAGS=$_SAVE_LDFLAGS
1830 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_SYSTEM_JPEG" = 1; then
1831 MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
1832 MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
1834 fi # SKIP_LIBRARY_CHECKS
1836 dnl system ZLIB support
1837 dnl ========================================================
1838 MOZ_ZLIB_CHECK([1.2.3])
1840 if test -z "$SKIP_LIBRARY_CHECKS"; then
1842 dnl ========================================================
1843 dnl system PNG Support
1844 dnl ========================================================
1845 MOZ_ARG_WITH_STRING(system-png,
1846 [ --with-system-png[=PFX]
1847 Use system libpng [installed at prefix PFX]],
1850 _SAVE_CFLAGS=$CFLAGS
1851 _SAVE_LDFLAGS=$LDFLAGS
1853 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
1854 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
1855 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
1857 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
1860 AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"],
1861 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1862 AC_CHECK_LIB(png, png_get_acTL, ,
1863 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
1865 if test "$MOZ_SYSTEM_PNG" = 1; then
1866 AC_TRY_COMPILE([ #include <stdio.h>
1867 #include <sys/types.h>
1869 [ #if PNG_LIBPNG_VER < $MOZPNG
1870 #error "Insufficient libpng version ($MOZPNG required)."
1872 #ifndef PNG_UINT_31_MAX
1873 #error "Insufficient libpng version."
1876 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1878 CFLAGS=$_SAVE_CFLAGS
1879 LDFLAGS=$_SAVE_LDFLAGS
1882 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then
1883 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
1884 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
1887 fi # SKIP_LIBRARY_CHECKS
1889 dnl ========================================================
1893 dnl ========================================================
1895 MOZ_ARG_HEADER(Application)
1897 ENABLE_SYSTEM_EXTENSION_DIRS=1
1898 MOZ_BRANDING_DIRECTORY=
1899 MOZ_OFFICIAL_BRANDING=
1901 MOZ_AUTH_EXTENSION=1
1902 if test "$MOZ_IOS"; then
1907 MOZ_WEBRTC_HARDWARE_AEC_NS=
1915 LIBJPEG_TURBO_ASFLAGS=
1916 MOZ_PREF_EXTENSIONS=1
1919 MOZ_TOOLKIT_SEARCH=1
1920 MOZ_UNIVERSALCHARDET=1
1925 MOZ_USE_NATIVE_POPUP_WINDOWS=
1926 MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
1928 MOZ_CONTENT_SANDBOX=
1931 MOZ_BINARY_EXTENSIONS=
1934 case "$target_os" in
1937 AC_DEFINE(NS_ENABLE_TSF)
1942 *-android*|*-linuxandroid*)
1948 # Optional Firefox for Android partner distribution directory.
1949 MOZ_ARG_WITH_STRING(android-distribution-directory,
1950 [ --with-android-distribution-directory=dir
1951 Optional Firefox for Android partner distribution directory.],
1952 MOZ_ANDROID_DISTRIBUTION_DIRECTORY=$withval)
1954 if test -n "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY"; then
1955 # A distribution directory must have an assets/distribution directory.
1956 # See https://wiki.mozilla.org/Mobile/Distribution_Files.
1957 if test ! -d "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY/assets/distribution" ; then
1958 AC_MSG_ERROR([--with-android-distribution-directory does not contain assets/distribution;
1959 (looked for ${MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets/distribution).])
1962 AC_SUBST(MOZ_ANDROID_DISTRIBUTION_DIRECTORY)
1964 dnl ========================================================
1965 dnl = Trademarked Branding
1966 dnl ========================================================
1967 MOZ_ARG_ENABLE_BOOL(official-branding,
1968 [ --enable-official-branding
1969 Enable Official mozilla.org Branding
1970 Do not distribute builds with
1971 --enable-official-branding unless you have
1972 permission to use trademarks per
1973 http://www.mozilla.org/foundation/trademarks/ .],
1974 MOZ_OFFICIAL_BRANDING=1,
1975 MOZ_OFFICIAL_BRANDING=)
1977 # Allow the application to influence configure with a confvars.sh script.
1978 AC_MSG_CHECKING([if app-specific confvars.sh exists])
1979 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
1980 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
1981 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
1986 # Allow influencing configure with a defines.sh script.
1987 . "${srcdir}/build/defines.sh"
1989 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
1991 if test "$BUILDING_RELEASE"; then
1992 # Override value in defines.sh, if any
1993 EARLY_BETA_OR_EARLIER=
1994 elif test "$EARLY_BETA_OR_EARLIER"; then
1995 AC_DEFINE(EARLY_BETA_OR_EARLIER)
1997 AC_SUBST(EARLY_BETA_OR_EARLIER)
1999 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
2000 MOZ_ARG_WITH_STRING(app-name,
2001 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
2002 WITH_APP_NAME=$withval,
2005 if test -n "$WITH_APP_NAME" ; then
2006 MOZ_APP_NAME="$WITH_APP_NAME"
2009 MOZ_ARG_WITH_STRING(app-basename,
2010 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
2011 WITH_APP_BASENAME=$withval,
2014 if test -n "$WITH_APP_BASENAME" ; then
2015 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
2018 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
2019 # that haven't made a confvars.sh yet. Don't add new stuff here, use
2021 case "$MOZ_BUILD_APP" in
2023 AC_DEFINE(MOZ_PHOENIX)
2027 AC_DEFINE(MOZ_XULRUNNER)
2031 # Graphene is a desktop runtime for running applications with a HTML UI.
2032 if test -n "$MOZ_GRAPHENE"; then
2033 AC_DEFINE(MOZ_GRAPHENE)
2036 AC_SUBST(MOZ_PHOENIX)
2037 AC_SUBST(MOZ_XULRUNNER)
2039 dnl ========================================================
2040 dnl Ensure Android SDK and build-tools versions depending on
2042 dnl ========================================================
2044 case "$MOZ_BUILD_APP" in
2046 MOZ_ANDROID_SDK(26, 26, 27.0.3)
2050 dnl ========================================================
2052 dnl = Toolkit Options
2054 dnl ========================================================
2055 MOZ_ARG_HEADER(Toolkit Options)
2057 dnl ========================================================
2058 dnl = Enable the toolkit as needed =
2059 dnl ========================================================
2061 case "$MOZ_WIDGET_TOOLKIT" in
2064 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
2065 # Use -Wl as a trick to avoid -framework and framework names from
2066 # being separated by AC_SUBST_LIST.
2067 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'
2069 CFLAGS="$CFLAGS $TK_CFLAGS"
2070 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
2071 MOZ_USER_DIR="Mozilla"
2072 MOZ_FS_LAYOUT=bundle
2076 LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
2078 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'
2079 CFLAGS="$CFLAGS $TK_CFLAGS"
2080 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
2081 MOZ_USER_DIR="Mozilla"
2082 MOZ_FS_LAYOUT=bundle
2087 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
2088 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
2089 case "$MOZ_WIDGET_TOOLKIT" in
2095 if test "$COMPILE_ENVIRONMENT"; then
2096 if test "$MOZ_WIDGET_TOOLKIT" = gtk3; then
2097 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)
2098 MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
2099 TK_CFLAGS=$MOZ_GTK3_CFLAGS
2100 TK_LIBS=$MOZ_GTK3_LIBS
2101 dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
2102 dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
2103 AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
2104 GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32
2106 if test "$MOZ_WIDGET_TOOLKIT" = gtk2; then
2107 GLIB_VERSION_MAX_ALLOWED=$GLIB_VERSION_MIN_REQUIRED
2109 if test "$MOZ_ENABLE_GTK"; then
2110 if test "$MOZ_X11"; then
2111 GDK_PACKAGES=gdk-x11-2.0
2113 AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
2114 AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
2116 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)
2117 MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
2119 if test "$MOZ_WIDGET_TOOLKIT" = gtk2; then
2120 TK_CFLAGS=$MOZ_GTK2_CFLAGS
2121 TK_LIBS=$MOZ_GTK2_LIBS
2123 fi # COMPILE_ENVIRONMENT
2125 AC_SUBST(MOZ_FS_LAYOUT)
2127 dnl ========================================================
2128 dnl = startup-notification support module
2129 dnl ========================================================
2131 if test "$MOZ_ENABLE_GTK"
2133 MOZ_ENABLE_STARTUP_NOTIFICATION=
2135 MOZ_ARG_ENABLE_BOOL(startup-notification,
2136 [ --enable-startup-notification
2137 Enable startup-notification support (default: disabled) ],
2138 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
2139 MOZ_ENABLE_STARTUP_NOTIFICATION=)
2140 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
2142 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
2143 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
2144 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
2145 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
2147 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
2149 MOZ_ENABLE_STARTUP_NOTIFICATION=
2153 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
2154 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
2157 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
2159 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
2161 AC_SUBST_LIST(TK_CFLAGS)
2162 AC_SUBST_LIST(TK_LIBS)
2167 dnl ========================================================
2169 dnl = Components & Features
2171 dnl ========================================================
2172 MOZ_ARG_HEADER(Components and Features)
2174 AC_SUBST(MOZ_OFFICIAL_BRANDING)
2175 if test -n "$MOZ_OFFICIAL_BRANDING"; then
2176 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
2177 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
2179 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
2180 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
2184 MOZ_ARG_WITH_STRING(branding,
2185 [ --with-branding=dir Use branding from the specified directory.],
2186 MOZ_BRANDING_DIRECTORY=$withval)
2188 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
2189 if test -z "$REAL_BRANDING_DIRECTORY"; then
2190 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
2193 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
2194 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
2195 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
2196 . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
2199 AC_SUBST(MOZ_BRANDING_DIRECTORY)
2201 dnl ========================================================
2202 dnl = Distribution ID
2203 dnl ========================================================
2204 MOZ_ARG_WITH_STRING(distribution-id,
2205 [ --with-distribution-id=ID
2206 Set distribution-specific id (default=org.mozilla)],
2207 [ val=`echo $withval`
2208 MOZ_DISTRIBUTION_ID="$val"])
2210 if test -z "$MOZ_DISTRIBUTION_ID"; then
2211 MOZ_DISTRIBUTION_ID="org.mozilla"
2214 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
2215 AC_SUBST(MOZ_DISTRIBUTION_ID)
2217 dnl ========================================================
2218 dnl = GConf support module
2219 dnl ========================================================
2223 if test "$MOZ_ENABLE_GTK"
2228 dnl ========================================================
2229 dnl = GConf support module
2230 dnl ========================================================
2231 MOZ_ARG_DISABLE_BOOL(gconf,
2232 [ --disable-gconf Disable Gconf support ],
2236 if test "$MOZ_ENABLE_GCONF"
2238 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
2239 MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
2242 if test -n "$MOZ_ENABLE_GCONF";
2244 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
2246 AC_MSG_WARN([Many automated tests will fail with --disable-gconf. See bug 1167201.])
2251 if test "$MOZ_ENABLE_GCONF"; then
2252 AC_DEFINE(MOZ_ENABLE_GCONF)
2255 AC_SUBST(MOZ_ENABLE_GCONF)
2258 dnl ========================================================
2259 dnl = libproxy support
2260 dnl ========================================================
2262 if test "$MOZ_ENABLE_GTK"
2264 MOZ_ENABLE_LIBPROXY=
2266 MOZ_ARG_ENABLE_BOOL(libproxy,
2267 [ --enable-libproxy Enable libproxy support ],
2268 MOZ_ENABLE_LIBPROXY=1,
2269 MOZ_ENABLE_LIBPROXY=)
2271 if test "$MOZ_ENABLE_LIBPROXY"
2273 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
2274 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
2277 AC_SUBST(MOZ_ENABLE_LIBPROXY)
2279 dnl ========================================================
2281 dnl ========================================================
2283 if test "$MOZ_ENABLE_GTK"
2287 MOZ_ARG_DISABLE_BOOL(dbus,
2288 [ --disable-dbus Disable dbus support ],
2292 if test "$MOZ_ENABLE_DBUS"
2294 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
2295 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
2296 AC_DEFINE(MOZ_ENABLE_DBUS)
2299 AC_SUBST(MOZ_ENABLE_DBUS)
2301 dnl =========================================================
2302 dnl = Whether to exclude hyphenations files in the build
2303 dnl =========================================================
2304 if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
2305 AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
2308 dnl ========================================================
2309 dnl accessibility support on by default on all platforms
2310 dnl ========================================================
2311 MOZ_ARG_DISABLE_BOOL(accessibility,
2312 [ --disable-accessibility Disable accessibility support],
2315 if test "$ACCESSIBILITY"; then
2318 if test -z "$MIDL"; then
2319 if test "$GCC" != "yes"; then
2320 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
2322 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.])
2326 AC_DEFINE(ACCESSIBILITY)
2329 dnl ========================================================
2330 dnl Accessibility is required for the linuxgl widget
2332 dnl ========================================================
2333 if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
2334 AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
2337 AC_TRY_COMPILE([#include <linux/ethtool.h>],
2338 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
2339 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
2341 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
2343 if test -n "$MOZ_WEBRTC"; then
2349 if test -n "$MOZ_X11"; then
2350 MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
2354 dnl ========================================================
2355 dnl = Force hardware AEC, disable webrtc.org AEC
2356 dnl ========================================================
2357 MOZ_ARG_ENABLE_BOOL(hardware-aec-ns,
2358 [ --enable-hardware-aec-ns Enable support for hardware AEC and noise suppression],
2359 MOZ_WEBRTC_HARDWARE_AEC_NS=1,
2360 MOZ_WEBRTC_HARDWARE_AEC_NS=)
2362 if test -n "$MOZ_WEBRTC_HARDWARE_AEC_NS"; then
2363 AC_DEFINE(MOZ_WEBRTC_HARDWARE_AEC_NS)
2366 AC_SUBST(MOZ_WEBRTC_HARDWARE_AEC_NS)
2369 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
2371 dnl ========================================================
2372 dnl = Enable Raw Codecs
2373 dnl ========================================================
2374 MOZ_ARG_ENABLE_BOOL(raw,
2375 [ --enable-raw Enable support for RAW media],
2379 if test -n "$MOZ_RAW"; then
2385 dnl ========================================================
2386 dnl = Apple platform decoder support
2387 dnl ========================================================
2388 if test "$COMPILE_ENVIRONMENT"; then
2389 if test -n "$MOZ_APPLEMEDIA"; then
2390 # hack in frameworks for fmp4 - see bug 1029974
2391 # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
2392 LDFLAGS="$LDFLAGS -framework AudioToolbox"
2393 dnl Verify CoreMedia is available.
2394 AC_CHECK_HEADER([CoreMedia/CoreMedia.h], [],
2395 [AC_MSG_ERROR([MacOS X 10.9 SDK or later is required])])
2397 fi # COMPILE_ENVIRONMENT
2399 dnl system libvpx Support
2400 dnl ========================================================
2401 MOZ_ARG_WITH_BOOL(system-libvpx,
2402 [ --with-system-libvpx Use system libvpx (located with pkgconfig)],
2403 MOZ_SYSTEM_LIBVPX=1)
2408 _SAVE_CFLAGS=$CFLAGS
2410 if test -n "$MOZ_SYSTEM_LIBVPX"; then
2411 dnl ============================
2412 dnl === libvpx Version check ===
2413 dnl ============================
2414 dnl Check to see if we have a system libvpx package.
2415 PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.5.0)
2417 CFLAGS="$CFLAGS $MOZ_LIBVPX_CFLAGS"
2418 LIBS="$LIBS $MOZ_LIBVPX_LIBS"
2420 MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
2421 [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.])])
2423 AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
2424 [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
2426 MOZ_CHECK_HEADER([vpx_mem/vpx_mem.h],
2427 [AC_CHECK_FUNC(vpx_mem_set_functions)])
2428 if test "$ac_cv_header_vpx_mem_vpx_mem_h" = no -o \
2429 "$ac_cv_func_vpx_mem_set_functions" = no; then
2430 AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
2433 CFLAGS=$_SAVE_CFLAGS
2436 AC_SUBST(MOZ_SYSTEM_LIBVPX)
2437 AC_SUBST_LIST(MOZ_LIBVPX_CFLAGS)
2438 AC_SUBST_LIST(MOZ_LIBVPX_LIBS)
2440 if test -z "$MOZ_SYSTEM_LIBVPX"; then
2442 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
2443 dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
2444 dnl We currently require gcc on all arm platforms.
2446 dnl See if we have assembly on this platform.
2447 case "$OS_ARCH:$CPU_ARCH" in
2461 dnl Check for yasm 1.1 or greater.
2462 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
2463 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.])
2464 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
2465 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.])
2469 dnl The encoder needs obj_int_extract to get asm offsets.
2470 fi # COMPILE_ENVIRONMENT and others
2473 if test -n "$GNU_AS" ; then
2474 dnl These flags are a lie; they're just used to enable the requisite
2475 dnl opcodes; actual arch detection is done at runtime.
2476 VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
2477 VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/libvpx/build/make/ads2gas.pl'
2479 dnl Building with -mfpu=neon requires either the "softfp" or the
2480 dnl "hardfp" ABI. Depending on the compiler's default target, and the
2481 dnl CFLAGS, the default ABI might be neither, in which case it is the
2482 dnl "softfloat" ABI.
2483 dnl The "softfloat" ABI is binary-compatible with the "softfp" ABI, so
2484 dnl we can safely mix code built with both ABIs. So, if we detect
2485 dnl that compiling uses the "softfloat" ABI, force the use of the
2486 dnl "softfp" ABI instead.
2487 dnl Confusingly, the __SOFTFP__ preprocessor variable indicates the
2488 dnl "softfloat" ABI, not the "softfp" ABI.
2489 dnl Note: VPX_ASFLAGS is also used in CFLAGS.
2492 #error "compiler target supports -mfpu=neon, so we don't have to add extra flags"
2494 VPX_ASFLAGS="$VPX_ASFLAGS -mfloat-abi=softfp"
2499 if $CC -E -dM -</dev/null | grep -q __ELF__; then
2505 if $CC -E -dM -</dev/null | grep -q __ELF__; then
2512 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_USE_YASM" -a -z "$YASM"; then
2513 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.])
2514 fi # COMPILE_ENVIRONMENT and others
2516 if test -n "$VPX_USE_YASM" && test "$OS_ARCH:$CPU_ARCH" != "WINNT:x86_64"; then
2520 if test -n "$VPX_X86_ASM"; then
2521 AC_DEFINE(VPX_X86_ASM)
2522 elif test -n "$VPX_ARM_ASM"; then
2523 AC_DEFINE(VPX_ARM_ASM)
2525 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
2528 dnl native libvpx no longer has vpx_mem_set_functions
2529 AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
2532 dnl ========================================================
2533 dnl = Handle dependent MEDIA defines
2534 dnl ========================================================
2537 AC_DEFINE(MOZ_WEBM_ENCODER)
2538 AC_SUBST(MOZ_WEBM_ENCODER)
2540 dnl ========================================================
2542 dnl ========================================================
2544 MOZ_ARG_DISABLE_BOOL(negotiateauth,
2545 [ --disable-negotiateauth Disable GSS-API negotiation ],
2546 MOZ_AUTH_EXTENSION=,
2547 MOZ_AUTH_EXTENSION=1 )
2549 if test -n "$MOZ_IOS" -a -n "$MOZ_AUTH_EXTENSION"; then
2550 AC_MSG_ERROR([negotiateauth is not supported on iOS.])
2553 dnl ========================================================
2554 dnl Pref extensions (autoconfig)
2555 dnl ========================================================
2556 MOZ_ARG_DISABLE_BOOL(pref-extensions,
2557 [ --disable-pref-extensions
2558 Disable pref extensions such as autoconfig],
2559 MOZ_PREF_EXTENSIONS=,
2560 MOZ_PREF_EXTENSIONS=1 )
2562 dnl ========================================================
2563 dnl Searching of system directories for extensions.
2564 dnl Note: this switch is meant to be used for test builds
2565 dnl whose behavior should not depend on what happens to be
2566 dnl installed on the local machine.
2567 dnl ========================================================
2568 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
2569 [ --disable-system-extension-dirs
2570 Disable searching system- and account-global
2571 directories for extensions of any kind; use
2572 only profile-specific extension directories],
2573 ENABLE_SYSTEM_EXTENSION_DIRS=,
2574 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
2575 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
2576 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
2579 dnl ========================================================
2580 dnl = Universalchardet
2581 dnl ========================================================
2582 MOZ_ARG_DISABLE_BOOL(universalchardet,
2583 [ --disable-universalchardet
2584 Disable universal encoding detection],
2585 MOZ_UNIVERSALCHARDET=,
2586 MOZ_UNIVERSALCHARDET=1 )
2588 dnl ========================================================
2589 dnl = ANGLE OpenGL->D3D translator for WebGL
2590 dnl = * only applies to win32 (and then, not MINGW)
2591 dnl ========================================================
2595 MOZ_HAS_WINSDK_WITH_D3D=
2596 MOZ_D3DCOMPILER_VISTA_DLL=
2597 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
2599 if test "$COMPILE_ENVIRONMENT" ; then
2600 case "$target_os" in
2602 MOZ_ANGLE_RENDERER=1
2606 # The DirectX SDK libraries are split into x86 and x64 sub-directories
2607 case "${target_cpu}" in
2609 MOZ_D3D_CPU_SUFFIX=x86
2612 MOZ_D3D_CPU_SUFFIX=x64
2615 MOZ_D3D_CPU_SUFFIX=arm
2619 dnl ========================================================
2620 dnl D3D compiler DLL
2621 dnl ========================================================
2622 MOZ_FOUND_D3D_COMPILERS=
2624 if test -n "$MOZ_ANGLE_RENDERER"; then
2625 if test -z "$MOZ_D3D_CPU_SUFFIX"; then
2626 AC_MSG_ERROR([Couldn't determine MOZ_D3D_CPU_SUFFIX.])
2629 ######################################
2630 # Find _46+ for use by Vista+.
2632 # Find a D3D compiler DLL in a Windows SDK.
2633 MOZ_D3DCOMPILER_VISTA_DLL=
2634 case "$MOZ_WINSDK_MAXVER" in
2636 MOZ_D3DCOMPILER_VISTA_DLL=d3dcompiler_47.dll
2637 AC_MSG_RESULT([Found D3D compiler in Windows SDK.])
2641 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
2642 # We have a name, now track down the path.
2643 if test -n "$WINDOWSSDKDIR"; then
2644 MOZ_D3DCOMPILER_VISTA_DLL_PATH="$WINDOWSSDKDIR/Redist/D3D/$MOZ_D3D_CPU_SUFFIX/$MOZ_D3DCOMPILER_VISTA_DLL"
2645 if test -f "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
2646 AC_MSG_RESULT([Found MOZ_D3DCOMPILER_VISTA_DLL_PATH: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
2647 MOZ_HAS_WINSDK_WITH_D3D=1
2648 elif test "$target_cpu" = "aarch64" -a "$MOZ_D3DCOMPILER_VISTA_DLL" = "d3dcompiler_47.dll"; then
2649 AC_MSG_RESULT([AArch64 Windows includes d3dcompiler DLLs])
2650 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
2652 AC_MSG_RESULT([MOZ_D3DCOMPILER_VISTA_DLL_PATH doesn't exist: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
2653 AC_MSG_ERROR([Windows SDK at "$WINDOWSSDKDIR" appears broken. Try updating to MozillaBuild 1.9 final or higher.])
2654 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
2657 AC_MSG_RESULT([Windows SDK not found.])
2660 if test "$OS_ARCH" = "$HOST_OS_ARCH"; then
2661 AC_MSG_ERROR([Couldn't find Windows SDK 8.1 or higher needed for ANGLE.])
2663 AC_MSG_RESULT([Windows SDK not needed for ANGLE in Linux MinGW build.])
2667 if test -z "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
2668 MOZ_D3DCOMPILER_VISTA_DLL=
2671 # On mingw, check if headers are provided by toolchain.
2672 if test -n "$GNU_CC"; then
2673 MOZ_CHECK_HEADER(d3d10.h, MOZ_HAS_WINSDK_WITH_D3D=1)
2676 ######################################
2677 # Check that we found what we needed.
2678 MOZ_FOUND_A_D3D_COMPILER=
2680 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
2681 MOZ_FOUND_A_D3D_COMPILER=1
2682 AC_MSG_RESULT([Found d3dcompiler DLL for Vista+: $MOZ_D3DCOMPILER_VISTA_DLL])
2685 if test -z "$CROSS_COMPILE"; then
2686 if test -z "MOZ_FOUND_A_D3D_COMPILER"; then
2687 AC_MSG_ERROR([Couldn't find an acceptable D3D compiler DLL.])
2690 fi # MOZ_ANGLE_RENDERER
2692 dnl ========================================================
2694 dnl ========================================================
2696 dnl Moved gamepad platform check to moz.build, linux header check still needed here.
2697 if test "$OS_TARGET" = "Linux"; then
2698 MOZ_CHECK_HEADER([linux/joystick.h])
2699 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
2700 AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
2704 fi # COMPILE_ENVIRONMENT
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"
2802 LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
2805 LIBJPEG_TURBO_ASFLAGS="-march=armv8-a"
2808 LIBJPEG_TURBO_ASFLAGS="-mdspr2"
2811 if $CC -E -dM -</dev/null | grep -q __ELF__; then
2812 LIBJPEG_TURBO_ASFLAGS="-DPIC -DELF"
2816 if $CC -E -dM -</dev/null | grep -q __ELF__; then
2817 LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DELF"
2823 if test -n "$LIBJPEG_TURBO_ASFLAGS"; then
2825 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
2826 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
2827 dnl it doesn't exist or we have too old of a version.
2829 LIBJPEG_TURBO_USE_YASM=1
2831 if test -z "$YASM" ; then
2832 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.])
2835 dnl Check that we have the right yasm version. We require 1.0.1 or newer
2836 dnl on Linux and 1.1 or newer everywhere else.
2837 if test "$OS_ARCH" = "Linux" ; then
2838 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
2839 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.])
2842 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
2843 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.])
2850 dnl ========================================================
2851 dnl = libav-fft configuration
2852 dnl ========================================================
2856 dnl Turn on libav-fft for 32-bit windows, and all 64-bit supported platforms.
2857 dnl 32-bit linux/os x have text relocation issues.
2859 case "$OS_ARCH:$CPU_ARCH" in
2868 dnl Detect if we can use yasm to compile libav's assembly
2870 if test -n "$MOZ_LIBAV_FFT" -a -n "$COMPILE_ENVIRONMENT"; then
2871 AC_DEFINE(MOZ_LIBAV_FFT)
2872 dnl Do we support libav-fft on this platform?
2873 case "$OS_ARCH:$CPU_ARCH" in
2875 LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DMACHO"
2878 LIBAV_FFT_ASFLAGS="-DPIC -DWIN32"
2881 LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DWIN64 -DMSVC"
2884 if $CC -E -dM -</dev/null | grep -q __ELF__; then
2885 LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DELF"
2889 AC_MSG_ERROR([libav's FFT routines are only available for 32-bit windows or 64-bit x86 based platforms.])
2894 if test -n "$LIBAV_FFT_ASFLAGS"; then
2895 dnl If we're on an x86 or x64 system which supports libav-fft's asm routines
2896 dnl check for Yasm, and error out if it doesn't exist or we have too old of a
2898 if test -z "$YASM" ; then
2899 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.])
2901 dnl Check that we have the right yasm version. We require 1.0.1 or newer
2902 dnl on Linux and 1.1 or newer everywhere else.
2903 if test "$OS_ARCH" = "Linux" ; then
2904 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
2905 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.])
2908 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
2909 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.])
2912 elif test -n "$MOZ_LIBAV_FFT" -a "${CPU_ARCH}" != "arm"; then
2913 dnl Warn if we're not building either libav or opendl-max optimized routines.
2914 AC_MSG_WARN([No assembler or assembly support for libav-fft. Using unoptimized C routines.])
2917 dnl ========================================================
2918 dnl = FFmpeg's ffvpx configuration
2919 dnl ========================================================
2926 dnl Use same conditional as MOZ_LIBAV_FFT to enable FFmpeg's ffvpx assembly decoder.
2927 if test -n "$LIBAV_FFT_ASFLAGS"; then
2928 FFVPX_ASFLAGS=$LIBAV_FFT_ASFLAGS
2930 dnl On x86 system with assembly optimizations disabled, the ffvp9 and
2931 dnl ffvp8 decoders give worse performance than libvpx ones. So we only
2932 dnl enable the FFmpeg FLAC decoder on those machines.
2933 MOZ_FFVPX_FLACONLY=1
2937 case "$OS_TARGET" in
2939 dnl don't set up anything special
2943 MOZ_FFVPX_FLACONLY=1
2944 dnl Use same conditional as MOZ_LIBVPX to enable FFmpeg's ffvpx assembly decoder.
2945 dnl aarch 64 FLAC decoder for now will be C only.
2946 FFVPX_ASFLAGS=$VPX_ASFLAGS
2952 if test -n "$MOZ_FFVPX"; then
2953 AC_DEFINE(MOZ_FFVPX)
2955 if test -n "$MOZ_FFVPX_FLACONLY"; then
2956 AC_DEFINE(MOZ_FFVPX_FLACONLY)
2959 dnl ========================================================
2960 dnl = Enable compilation of specific extension modules
2961 dnl ========================================================
2963 MOZ_ARG_ENABLE_STRING(extensions,
2964 [ --enable-extensions Enable extensions],
2965 [ for option in `echo $enableval | sed 's/,/ /g'`; do
2966 if test "$option" = "yes" -o "$option" = "all"; then
2967 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
2968 elif test "$option" = "no" -o "$option" = "none"; then
2970 elif test "$option" = "default"; then
2971 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
2972 elif test `echo "$option" | grep -c \^-` != 0; then
2973 option=`echo $option | sed 's/^-//'`
2974 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
2976 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
2979 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
2981 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
2982 dnl when trying to build a nonexistent extension.
2983 for extension in $MOZ_EXTENSIONS; do
2984 if test ! -d "${srcdir}/extensions/${extension}"; then
2985 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
2989 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
2990 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
2993 # Avoid defining MOZ_ENABLE_CAIRO_FT on Windows platforms because
2994 # "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
2995 if test -n "$MOZ_TREE_FREETYPE" -a "$OS_TARGET" != WINNT; then
2996 MOZ_ENABLE_CAIRO_FT=1
2997 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2998 CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
2999 AC_SUBST_LIST(CAIRO_FT_CFLAGS)
3002 AC_CHECK_PROGS(WGET, wget, "")
3005 dnl ========================================================
3006 dnl Maintenance Service
3007 dnl ========================================================
3009 MOZ_ARG_ENABLE_BOOL(maintenance-service,
3010 [ --enable-maintenance-service Enable building of maintenanceservice],
3011 MOZ_MAINTENANCE_SERVICE=1,
3012 MOZ_MAINTENANCE_SERVICE= )
3014 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
3015 if test "$OS_ARCH" = "WINNT"; then
3016 AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
3018 AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
3022 dnl ========================================================
3023 dnl Bundled fonts on desktop platforms
3024 dnl ========================================================
3026 MOZ_ARG_ENABLE_BOOL(bundled-fonts,
3027 [ --enable-bundled-fonts Enable support for bundled fonts on desktop platforms],
3028 MOZ_BUNDLED_FONTS=1,
3031 if test -n "$MOZ_BUNDLED_FONTS"; then
3032 AC_DEFINE(MOZ_BUNDLED_FONTS)
3035 dnl ========================================================
3036 dnl Verify MAR signatures
3037 dnl ========================================================
3039 MOZ_ARG_ENABLE_BOOL(verify-mar,
3040 [ --enable-verify-mar Enable verifying MAR signatures],
3041 MOZ_VERIFY_MAR_SIGNATURE=1,
3042 MOZ_VERIFY_MAR_SIGNATURE= )
3044 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
3045 AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
3048 dnl ========================================================
3049 dnl Enable building the signmar program.
3050 dnl This option is much different than the --enable-verify-mar option.
3051 dnl --enable-verify-mar is for enabling the verification check on MAR
3052 dnl files in the updater. The --enable-signmar option is for building
3053 dnl the signmar program.
3054 dnl ========================================================
3056 MOZ_ARG_ENABLE_BOOL(signmar,
3057 [ --enable-signmar Enable building the signmar program],
3058 MOZ_ENABLE_SIGNMAR=1,
3059 MOZ_ENABLE_SIGNMAR= )
3061 if test -n "$MOZ_ENABLE_SIGNMAR"; then
3062 if test -z "$COMPILE_ENVIRONMENT" ; then
3063 AC_MSG_WARN([Cannot --enable-signmar with --disable-compile-environment])
3066 AC_DEFINE(MOZ_ENABLE_SIGNMAR)
3070 dnl ========================================================
3072 dnl ========================================================
3074 if test "$MOZ_IOS"; then
3078 MOZ_ARG_DISABLE_BOOL(updater,
3079 [ --disable-updater Disable building of updater],
3083 if test -n "$MOZ_UPDATER"; then
3084 AC_DEFINE(MOZ_UPDATER)
3087 dnl ========================================================
3088 dnl parental controls (for Windows Vista)
3089 dnl ========================================================
3090 MOZ_ARG_DISABLE_BOOL(parental-controls,
3091 [ --disable-parental-controls
3092 Do not build parental controls],
3093 MOZ_DISABLE_PARENTAL_CONTROLS=1,
3094 MOZ_DISABLE_PARENTAL_CONTROLS=)
3095 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
3096 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
3099 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
3101 dnl ========================================================
3102 dnl = Disable smartcard support
3103 dnl ========================================================
3104 if test -n "$MOZ_NO_SMART_CARDS"; then
3105 AC_DEFINE(MOZ_NO_SMART_CARDS)
3107 AC_SUBST(MOZ_NO_SMART_CARDS)
3109 dnl ========================================================
3110 dnl = Sandboxing support
3111 dnl ========================================================
3112 if test -n "$MOZ_TSAN" -o -n "$MOZ_ASAN"; then
3113 # Bug 1182565: TSan conflicts with sandboxing on Linux.
3114 # Bug 1287971: LSan also conflicts with sandboxing on Linux.
3122 case "$OS_TARGET:$CPU_ARCH" in
3124 # No sandbox support on AArch64 Windows.
3129 MOZ_ARG_DISABLE_BOOL(sandbox,
3130 [ --disable-sandbox Disable sandboxing support],
3134 dnl ========================================================
3135 dnl = Content process sandboxing
3136 dnl ========================================================
3138 case "$OS_TARGET" in
3140 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3143 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3148 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3154 MOZ_ARG_ENABLE_BOOL(content-sandbox,
3155 [ --enable-content-sandbox Enable sandboxing support for content-processes
3156 --disable-content-sandbox Disable sandboxing support for content-processes],
3157 MOZ_CONTENT_SANDBOX=1,
3158 MOZ_CONTENT_SANDBOX=)
3160 if test -n "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_SANDBOX"; then
3161 AC_MSG_ERROR([--enable-content-sandbox and --disable-sandbox are conflicting options])
3164 if test -n "$MOZ_CONTENT_SANDBOX"; then
3165 AC_DEFINE(MOZ_CONTENT_SANDBOX)
3168 AC_SUBST(MOZ_CONTENT_SANDBOX)
3170 dnl ========================================================
3171 dnl = Gecko Media Plugin sandboxing
3172 dnl ========================================================
3175 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3180 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3185 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3189 if test -n "$MOZ_GMP_SANDBOX"; then
3190 AC_DEFINE(MOZ_GMP_SANDBOX)
3193 AC_SUBST(MOZ_GMP_SANDBOX)
3195 if test -z "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_GMP_SANDBOX"; then
3199 if test -n "$MOZ_SANDBOX"; then
3200 AC_DEFINE(MOZ_SANDBOX)
3203 AC_SUBST(MOZ_SANDBOX)
3206 dnl ========================================================
3208 dnl = Module specific options
3210 dnl ========================================================
3211 MOZ_ARG_HEADER(Individual module options)
3213 dnl ========================================================
3214 dnl = Disable feed handling components
3215 dnl ========================================================
3216 MOZ_ARG_DISABLE_BOOL(feeds,
3217 [ --disable-feeds Disable feed handling and processing components],
3220 if test -n "$MOZ_FEEDS"; then
3221 AC_DEFINE(MOZ_FEEDS)
3223 if test "$MOZ_BUILD_APP" = "browser"; then
3224 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
3228 dnl ========================================================
3229 dnl Check for sqlite
3230 dnl ========================================================
3233 MOZ_ARG_ENABLE_BOOL(system-sqlite,
3234 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
3235 MOZ_SYSTEM_SQLITE=1,
3236 MOZ_SYSTEM_SQLITE= )
3238 if test -n "$MOZ_SYSTEM_SQLITE"
3240 dnl ============================
3241 dnl === SQLite Version check ===
3242 dnl ============================
3243 dnl Check to see if the system SQLite package is new enough.
3244 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
3246 dnl ==================================
3247 dnl === SQLITE_SECURE_DELETE check ===
3248 dnl ==================================
3249 dnl Check to see if the system SQLite package is compiled with
3250 dnl SQLITE_SECURE_DELETE enabled.
3251 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
3252 _SAVE_CFLAGS="$CFLAGS"
3253 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3255 LIBS="$LIBS $SQLITE_LIBS"
3256 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
3258 #include "sqlite3.h"
3260 int main(int argc, char **argv){
3261 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
3263 ac_cv_sqlite_secure_delete=yes,
3264 ac_cv_sqlite_secure_delete=no,
3265 ac_cv_sqlite_secure_delete=no
3268 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
3269 CFLAGS="$_SAVE_CFLAGS"
3271 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
3272 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
3275 dnl ===============================
3276 dnl === SQLITE_THREADSAFE check ===
3277 dnl ===============================
3278 dnl Check to see if the system SQLite package is compiled with
3279 dnl SQLITE_THREADSAFE enabled.
3280 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
3281 _SAVE_CFLAGS="$CFLAGS"
3282 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3284 LIBS="$LIBS $SQLITE_LIBS"
3285 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
3287 #include "sqlite3.h"
3289 int main(int argc, char **argv){
3290 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
3292 ac_cv_sqlite_threadsafe=yes,
3293 ac_cv_sqlite_threadsafe=no,
3294 ac_cv_sqlite_threadsafe=no
3297 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
3298 CFLAGS="$_SAVE_CFLAGS"
3300 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
3301 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
3304 dnl ================================
3305 dnl === SQLITE_ENABLE_FTS3 check ===
3306 dnl ================================
3307 dnl check to see if the system SQLite package is compiled with
3308 dnl SQLITE_ENABLE_FTS3 enabled.
3309 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
3310 _SAVE_CFLAGS="$CFLAGS"
3311 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3313 LIBS="$LIBS $SQLITE_LIBS"
3314 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
3316 #include "sqlite3.h"
3318 int main(int argc, char **argv){
3319 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
3321 ac_cv_sqlite_enable_fts3=yes,
3322 ac_cv_sqlite_enable_fts3=no,
3323 ac_cv_sqlite_enable_fts3=no
3326 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
3327 CFLAGS="$_SAVE_CFLAGS"
3329 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
3330 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
3333 dnl =========================================
3334 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
3335 dnl =========================================
3336 dnl check to see if the system SQLite package is compiled with
3337 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
3338 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
3339 _SAVE_CFLAGS="$CFLAGS"
3340 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3342 LIBS="$LIBS $SQLITE_LIBS"
3343 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
3345 #include "sqlite3.h"
3347 int main(int argc, char **argv){
3348 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
3350 ac_cv_sqlite_enable_unlock_notify=yes,
3351 ac_cv_sqlite_enable_unlock_notify=no,
3352 ac_cv_sqlite_enable_unlock_notify=no
3355 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
3356 CFLAGS="$_SAVE_CFLAGS"
3358 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
3359 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
3362 dnl =========================================
3363 dnl === SQLITE_ENABLE_DBSTAT_VTAB check ===
3364 dnl =========================================
3365 dnl check to see if the system SQLite package is compiled with
3366 dnl SQLITE_ENABLE_DBSTAT_VTAB.
3367 AC_MSG_CHECKING(for SQLITE_ENABLE_DBSTAT_VTAB support in system SQLite)
3368 _SAVE_CFLAGS="$CFLAGS"
3369 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3371 LIBS="$LIBS $SQLITE_LIBS"
3372 AC_CACHE_VAL(ac_cv_sqlite_dbstat_vtab,[
3374 #include "sqlite3.h"
3376 int main(int argc, char **argv){
3377 return !sqlite3_compileoption_used("SQLITE_ENABLE_DBSTAT_VTAB");
3379 ac_cv_sqlite_dbstat_vtab=yes,
3380 ac_cv_sqlite_dbstat_vtab=no,
3381 ac_cv_sqlite_dbstat_vtab=no
3384 AC_MSG_RESULT($ac_cv_sqlite_dbstat_vtab)
3385 CFLAGS="$_SAVE_CFLAGS"
3387 if test "x$ac_cv_sqlite_dbstat_vtab" = "xno"; then
3388 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_DBSTAT_VTAB.])
3391 dnl ==============================
3392 dnl === SQLite fdatasync check ===
3393 dnl ==============================
3394 dnl Check to see if fdatasync is available
3395 AC_CHECK_FUNC(fdatasync)
3398 if test -n "$MOZ_SYSTEM_SQLITE"; then
3399 AC_DEFINE(MOZ_SYSTEM_SQLITE)
3401 AC_SUBST(MOZ_SYSTEM_SQLITE)
3403 dnl ========================================================
3404 dnl = Disable zipwriter
3405 dnl ========================================================
3406 MOZ_ARG_DISABLE_BOOL(zipwriter,
3407 [ --disable-zipwriter Disable zipwriter component],
3410 AC_SUBST(MOZ_ZIPWRITER)
3412 dnl ========================================================
3414 dnl = Feature options that require extra sources to be pulled
3416 dnl ========================================================
3417 dnl MOZ_ARG_HEADER(Features that require extra sources)
3419 dnl ========================================================
3421 dnl = Runtime debugging and Optimization Options
3423 dnl ========================================================
3424 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
3426 dnl ========================================================
3427 dnl enable mobile optimizations
3428 dnl ========================================================
3429 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
3430 [ --enable-mobile-optimize
3431 Enable mobile optimizations],
3432 MOZ_GFX_OPTIMIZE_MOBILE=1)
3434 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
3436 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
3437 # We ignore paint will resample on mobile for performance.
3438 # We may want to revisit this later.
3439 MOZ_IGNORE_PAINT_WILL_RESAMPLE=1
3441 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
3442 AC_DEFINE(MOZ_IGNORE_PAINT_WILL_RESAMPLE)
3445 dnl ========================================================
3446 dnl = Enable code optimization. ON by default.
3447 dnl ========================================================
3449 # Use value from moz.configure if one is defined. Else use our computed
3451 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
3452 MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
3455 MOZ_SET_FRAMEPTR_FLAGS
3457 if test "$COMPILE_ENVIRONMENT"; then
3458 if test -n "$MOZ_OPTIMIZE"; then
3459 AC_MSG_CHECKING([for valid C compiler optimization flags])
3460 _SAVE_CFLAGS=$CFLAGS
3461 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
3462 AC_TRY_COMPILE([#include <stdio.h>],
3463 [printf("Hello World\n");],
3466 AC_MSG_RESULT([$_results])
3467 if test "$_results" = "no"; then
3468 AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
3470 CFLAGS=$_SAVE_CFLAGS
3471 if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
3472 # When using llvm-based LTO, non numeric optimization levels are
3473 # not supported by the linker, so force the linker to use -O2 (
3474 # which doesn't influence the level compilation units are actually
3476 case " $MOZ_OPTIMIZE_FLAGS " in
3477 *\ -Os\ *|*\ -Oz\ *)
3478 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
3483 fi # COMPILE_ENVIRONMENT
3485 AC_SUBST_LIST(MOZ_FRAMEPTR_FLAGS)
3486 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
3487 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
3488 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
3490 dnl ========================================================
3491 dnl = Disable treating compiler warnings as errors
3492 dnl ========================================================
3493 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
3494 WARNINGS_AS_ERRORS=''
3497 dnl ========================================================
3498 dnl = Enable runtime logging
3499 dnl ========================================================
3500 AC_DEFINE(MOZ_LOGGING)
3501 AC_DEFINE(FORCE_PR_LOG)
3503 dnl ========================================================
3504 dnl = This will enable logging of addref, release, ctor, dtor.
3505 dnl ========================================================
3506 _ENABLE_LOGREFCNT=42
3507 MOZ_ARG_ENABLE_BOOL(logrefcnt,
3508 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
3509 _ENABLE_LOGREFCNT=1,
3510 _ENABLE_LOGREFCNT= )
3511 if test "$_ENABLE_LOGREFCNT" = "1"; then
3512 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
3513 elif test -z "$_ENABLE_LOGREFCNT"; then
3514 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
3517 dnl ========================================================
3518 dnl moz_dump_painting
3519 dnl ========================================================
3520 MOZ_ARG_ENABLE_BOOL(dump-painting,
3521 [ --enable-dump-painting Enable paint debugging.],
3522 MOZ_DUMP_PAINTING=1,
3523 MOZ_DUMP_PAINTING= )
3524 if test -n "$MOZ_DUMP_PAINTING"; then
3525 AC_DEFINE(MOZ_DUMP_PAINTING)
3526 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
3528 if test -n "$MOZ_DEBUG"; then
3529 AC_DEFINE(MOZ_DUMP_PAINTING)
3532 case "${OS_TARGET}" in
3533 Android|WINNT|Darwin)
3534 MOZ_GLUE_IN_PROGRAM=
3537 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
3538 MOZ_GLUE_IN_PROGRAM=1
3539 AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
3543 dnl ========================================================
3544 dnl = Jemalloc build setup
3545 dnl ========================================================
3546 if test -z "$MOZ_MEMORY"; then
3549 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
3550 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.])
3555 dnl The generic feature tests that determine how to compute ncpus are long and
3556 dnl complicated. Therefore, simply define special cpp variables for the
3557 dnl platforms we have special knowledge of.
3560 export MOZ_NO_DEBUG_RTL=1
3564 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
3566 AC_SUBST_LIST(MOZ_GLUE_WRAP_LDFLAGS)
3567 export MOZ_GLUE_WRAP_LDFLAGS
3569 dnl ========================================================
3570 dnl = Enable using the clang plugin to build
3571 dnl ========================================================
3573 if test -n "$COMPILE_ENVIRONMENT"; then
3574 MOZ_CONFIG_CLANG_PLUGIN
3575 fi # COMPILE_ENVIRONMENT
3577 dnl ========================================================
3578 dnl = Enable stripping of libs & executables
3579 dnl ========================================================
3580 MOZ_ARG_ENABLE_BOOL(strip,
3581 [ --enable-strip Enable stripping of libs & executables ],
3585 dnl ========================================================
3586 dnl = Enable stripping of libs & executables when packaging
3587 dnl ========================================================
3588 MOZ_ARG_ENABLE_BOOL(install-strip,
3589 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
3593 dnl ========================================================
3594 dnl = frontend JS debug mode
3595 dnl ========================================================
3597 MOZ_ARG_ENABLE_BOOL(debug-js-modules,
3598 [ --enable-debug-js-modules Enable debug mode for frontend JS libraries],
3602 AC_SUBST(DEBUG_JS_MODULES)
3604 dnl ========================================================
3606 dnl = Profiling and Instrumenting
3608 dnl ========================================================
3609 MOZ_ARG_HEADER(Profiling and Instrumenting)
3611 dnl ========================================================
3612 dnl = Enable TaskTracer
3613 dnl ========================================================
3614 MOZ_ARG_ENABLE_BOOL(tasktracer,
3615 [ --enable-tasktracer Set compile flags necessary for using TaskTracer],
3618 if test -n "$MOZ_TASK_TRACER"; then
3619 AC_DEFINE(MOZ_TASK_TRACER)
3620 AC_SUBST(MOZ_TASK_TRACER)
3623 dnl ========================================================
3624 dnl Turn on reflow counting
3625 dnl ========================================================
3626 MOZ_ARG_ENABLE_BOOL(reflow-perf,
3627 [ --enable-reflow-perf Enable reflow performance tracing],
3630 if test -n "$MOZ_REFLOW_PERF"; then
3631 AC_DEFINE(MOZ_REFLOW_PERF)
3634 dnl ========================================================
3635 dnl = Offer a way to disable the startup cache
3636 dnl ========================================================
3638 MOZ_ARG_DISABLE_BOOL(startupcache,
3639 [ --disable-startupcache Disable startup cache ],
3640 MOZ_DISABLE_STARTUPCACHE=1,
3641 MOZ_DISABLE_STARTUPCACHE=)
3643 if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
3644 AC_DEFINE(MOZ_DISABLE_STARTUPCACHE)
3646 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
3648 dnl ========================================================
3649 dnl = Support for demangling undefined symbols
3650 dnl ========================================================
3651 if test -z "$SKIP_LIBRARY_CHECKS"; then
3654 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
3658 # Demangle only for debug or DMD builds
3659 MOZ_DEMANGLE_SYMBOLS=
3660 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
3661 MOZ_DEMANGLE_SYMBOLS=1
3662 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
3664 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
3666 dnl ========================================================
3667 dnl = Support for gcc stack unwinding (from gcc 3.3)
3668 dnl ========================================================
3669 if test -z "$SKIP_LIBRARY_CHECKS"; then
3672 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
3676 dnl ========================================================
3678 dnl ========================================================
3680 MOZ_ARG_WITH_STRING(jitreport-granularity,
3681 [ --jitreport-granularity=N
3682 Default granularity at which to report JIT code
3685 1 - code ranges for whole functions only
3686 2 - per-line information
3687 3 - per-op information],
3688 JITREPORT_GRANULARITY=$withval,
3689 JITREPORT_GRANULARITY=3)
3691 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
3693 dnl ========================================================
3697 dnl ========================================================
3698 MOZ_ARG_HEADER(Misc. Options)
3700 dnl ========================================================
3701 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
3702 dnl ========================================================
3703 MOZ_ARG_WITH_STRING(user-appdir,
3704 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
3705 [ val=`echo $withval`
3706 if echo "$val" | grep "\/" >/dev/null; then
3707 AC_MSG_ERROR("Homedir must be single relative path.")
3712 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
3714 if test -z "$SKIP_COMPILER_CHECKS"; then
3715 dnl ========================================================
3717 dnl = Compiler Options
3719 dnl ========================================================
3720 MOZ_ARG_HEADER(Compiler Options)
3722 dnl ========================================================
3723 dnl Check for gcc -pipe support
3724 dnl ========================================================
3725 AC_MSG_CHECKING([for -pipe support])
3726 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
3727 dnl Any gcc that supports firefox supports -pipe.
3728 CFLAGS="$CFLAGS -pipe"
3729 CXXFLAGS="$CXXFLAGS -pipe"
3730 AC_MSG_RESULT([yes])
3735 fi # ! SKIP_COMPILER_CHECKS
3737 AC_DEFINE(CPP_THROW_NEW, [throw()])
3740 if test "$COMPILE_ENVIRONMENT"; then
3742 fi # COMPILE_ENVIRONMENT
3744 dnl ========================================================
3746 dnl = Static Build Options
3748 dnl ========================================================
3749 MOZ_ARG_HEADER(Static build options)
3751 if test -z "$MOZ_SYSTEM_ZLIB"; then
3752 if test -n "$JS_SHARED_LIBRARY" -o -n "$MOZ_LINKER"; then
3754 AC_DEFINE(ZLIB_IN_MOZGLUE)
3758 AC_SUBST(ZLIB_IN_MOZGLUE)
3760 dnl ========================================================
3762 dnl = Standalone module options
3764 dnl ========================================================
3765 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
3768 dnl ========================================================
3770 if test -z "$SKIP_PATH_CHECKS"; then
3771 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
3772 if test "$MOZ_ENABLE_GTK" ; then
3773 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
3778 if test -z "${GLIB_GMODULE_LIBS}" \
3779 -a -n "${GLIB_CONFIG}"\
3780 -a "${GLIB_CONFIG}" != no\
3782 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
3785 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
3787 if test "$USE_FC_FREETYPE"; then
3788 if test "$COMPILE_ENVIRONMENT"; then
3789 dnl ========================================================
3790 dnl = Check for freetype2 functionality
3791 dnl ========================================================
3792 if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
3794 _SAVE_CFLAGS="$CFLAGS"
3795 LIBS="$LIBS $FT2_LIBS"
3796 CFLAGS="$CFLAGS $FT2_CFLAGS"
3798 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3799 ac_cv_member_FT_Bitmap_Size_y_ppem,
3800 [AC_TRY_COMPILE([#include <ft2build.h>
3801 #include FT_FREETYPE_H],
3803 if (sizeof s.y_ppem) return 0;
3805 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3806 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3807 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3808 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3810 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3812 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3813 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3814 [FT_Bitmap_Size structure includes y_ppem field])
3816 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
3819 CFLAGS="$_SAVE_CFLAGS"
3822 _SAVE_CPPFLAGS="$CPPFLAGS"
3823 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
3824 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
3825 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
3826 CPPFLAGS="$_SAVE_CPPFLAGS"
3830 dnl ========================================================
3831 dnl Check if we need the 32-bit Linux SSE2 error dialog
3832 dnl ========================================================
3834 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
3836 dnl ========================================================
3837 dnl Check for pixman and cairo
3838 dnl ========================================================
3841 MOZ_ARG_ENABLE_BOOL(system-cairo,
3842 [ --enable-system-cairo Obsolete: do not use this option],
3843 AC_MSG_ERROR(--enable-system-cairo is not supported),
3847 MOZ_ARG_ENABLE_BOOL(system-pixman,
3848 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
3850 MOZ_TREE_PIXMAN=force,
3853 if test "$MOZ_TREE_PIXMAN"; then
3854 AC_DEFINE(MOZ_TREE_PIXMAN)
3856 PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.19.2)
3859 MOZ_CAIRO_CFLAGS="-I${DIST}/include/cairo"
3860 AC_DEFINE(MOZ_TREE_CAIRO)
3862 if test "$OS_ARCH" = "WINNT"; then
3863 # For now we assume that we will have a uint64_t available through
3864 # one of the above headers or mozstdint.h.
3865 AC_DEFINE(HAVE_UINT64_T)
3868 # Define macros for cairo-features.h
3869 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
3870 if test "$MOZ_X11"; then
3871 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
3872 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
3873 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
3875 if test "$_HAVE_FREETYPE2"; then
3876 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
3877 MOZ_ENABLE_CAIRO_FT=1
3878 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
3881 case "$MOZ_WIDGET_TOOLKIT" in
3883 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
3884 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
3885 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
3888 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
3889 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
3890 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
3891 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
3892 MOZ_ENABLE_D2D_SURFACE=1
3894 if test "$COMPILE_ENVIRONMENT"; then
3896 dnl D3D10 Layers depend on D2D Surfaces.
3897 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
3898 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
3903 if test "$USE_FC_FREETYPE"; then
3904 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
3906 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
3907 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
3908 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
3910 AC_SUBST(PS_SURFACE_FEATURE)
3911 AC_SUBST(SVG_SURFACE_FEATURE)
3912 AC_SUBST(XLIB_SURFACE_FEATURE)
3913 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
3914 AC_SUBST(QUARTZ_SURFACE_FEATURE)
3915 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
3916 AC_SUBST(WIN32_SURFACE_FEATURE)
3917 AC_SUBST(OS2_SURFACE_FEATURE)
3918 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
3919 AC_SUBST(FT_FONT_FEATURE)
3920 AC_SUBST(FC_FONT_FEATURE)
3921 AC_SUBST(WIN32_FONT_FEATURE)
3922 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
3923 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
3924 AC_SUBST(QUARTZ_FONT_FEATURE)
3925 AC_SUBST(PNG_FUNCTIONS_FEATURE)
3926 AC_SUBST(QT_SURFACE_FEATURE)
3927 AC_SUBST(TEE_SURFACE_FEATURE)
3929 if test "$MOZ_X11"; then
3930 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
3933 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
3935 case "$MOZ_WIDGET_TOOLKIT" in
3937 TK_CFLAGS="$MOZ_CAIRO_CFLAGS $MOZ_PIXMAN_CFLAGS"
3938 TK_LIBS="$MOZ_CAIRO_LIBS $MOZ_PIXMAN_LIBS"
3942 AC_SUBST(MOZ_TREE_CAIRO)
3943 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
3944 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
3945 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
3946 AC_SUBST(MOZ_TREE_PIXMAN)
3948 BINDGEN_SYSTEM_FLAGS="$_BINDGEN_CFLAGS $NSPR_CFLAGS $NSS_CFLAGS $MOZ_PIXMAN_CFLAGS $MOZ_CAIRO_CFLAGS"
3949 AC_SUBST_TOML_LIST(BINDGEN_SYSTEM_FLAGS)
3951 dnl ========================================================
3953 dnl ========================================================
3954 MOZ_ARG_DISABLE_BOOL(xul,
3955 [ --disable-xul Disable XUL],
3957 if test "$MOZ_XUL"; then
3960 dnl remove extensions that require XUL
3961 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
3966 dnl ========================================================
3967 dnl necko configuration options
3968 dnl ========================================================
3971 dnl option to disable necko's wifi scanner
3974 if test "$MOZ_WIDGET_TOOLKIT"; then
3976 case "$OS_TARGET" in
3978 if test -z "$MOZ_IOS"; then
3982 DragonFly|FreeBSD|WINNT)
3993 MOZ_ARG_DISABLE_BOOL(necko-wifi,
3994 [ --disable-necko-wifi Disable necko wifi scanner],
3998 if test "$NECKO_WIFI"; then
3999 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
4000 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
4002 AC_DEFINE(NECKO_WIFI)
4003 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
4005 AC_SUBST(NECKO_WIFI)
4006 AC_SUBST(NECKO_WIFI_DBUS)
4009 dnl option to disable cookies
4011 MOZ_ARG_DISABLE_BOOL(cookies,
4012 [ --disable-cookies Disable cookie support],
4015 AC_SUBST(NECKO_COOKIES)
4016 if test "$NECKO_COOKIES"; then
4017 AC_DEFINE(NECKO_COOKIES)
4018 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
4021 dnl ========================================================
4023 dnl = Maintainer debug option (no --enable equivalent)
4025 dnl ========================================================
4029 AC_SUBST(AR_EXTRACT)
4032 AC_SUBST_LIST(ASFLAGS)
4033 AC_SUBST(AS_DASH_C_FLAG)
4039 AC_SUBST(MOZ_AUTH_EXTENSION)
4040 AC_SUBST(MOZ_PREF_EXTENSIONS)
4041 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
4042 AC_SUBST(WARNINGS_AS_ERRORS)
4043 AC_SUBST_LIST(WARNINGS_CFLAGS)
4044 AC_SUBST_SET(MOZ_EXTENSIONS)
4045 AC_SUBST(MOZ_TOOLKIT_SEARCH)
4048 AC_SUBST(MOZ_UNIVERSALCHARDET)
4049 AC_SUBST(ACCESSIBILITY)
4050 AC_SUBST(MOZ_SPELLCHECK)
4051 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
4052 AC_SUBST(MOZ_CRASHREPORTER)
4053 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
4054 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
4055 AC_SUBST(MOZ_STUB_INSTALLER)
4056 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
4057 AC_SUBST(MOZ_ENABLE_SIGNMAR)
4058 AC_SUBST(MOZ_UPDATER)
4060 AC_SUBST(MOZ_ANGLE_RENDERER)
4061 AC_SUBST(MOZ_D3D_CPU_SUFFIX)
4062 AC_SUBST(MOZ_HAS_WINSDK_WITH_D3D)
4063 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL)
4064 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL_PATH)
4066 AC_SUBST(MOZ_ANDROID_APPLICATION_CLASS)
4067 AC_SUBST(MOZ_ANDROID_BROWSER_INTENT_CLASS)
4068 AC_SUBST(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
4069 AC_SUBST(ENABLE_STRIP)
4070 AC_SUBST(PKG_SKIP_STRIP)
4071 AC_SUBST(STRIP_FLAGS)
4072 AC_SUBST(INCREMENTAL_LINKER)
4074 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
4076 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
4077 AC_SUBST(MOZ_LINKER_EXTRACT)
4079 if test -n "$MOZ_BINARY_EXTENSIONS"; then
4080 AC_DEFINE(MOZ_BINARY_EXTENSIONS)
4083 AC_SUBST(MOZ_REQUIRE_SIGNING)
4084 if test "$MOZ_REQUIRE_SIGNING" = 1; then
4085 AC_DEFINE(MOZ_REQUIRE_SIGNING)
4088 dnl ========================================================
4089 dnl = Mac bundle name prefix
4090 dnl ========================================================
4091 MOZ_ARG_WITH_STRING(macbundlename-prefix,
4092 [ --with-macbundlename-prefix=prefix
4093 Prefix for MOZ_MACBUNDLE_NAME],
4094 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
4096 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
4097 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
4098 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
4101 if test "$MOZ_DEBUG"; then
4102 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
4104 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
4106 AC_SUBST(MOZ_MACBUNDLE_NAME)
4108 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
4109 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
4110 # Otherwise, use MOZ_APP_DISPLAYNAME
4111 if test -z "$MOZ_MACBUNDLE_ID"; then
4112 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
4114 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
4115 if test "$MOZ_DEBUG"; then
4116 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
4119 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
4120 AC_SUBST(MOZ_MACBUNDLE_ID)
4122 dnl ========================================================
4123 dnl = Child Process Name for IPC
4124 dnl ========================================================
4125 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
4126 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
4128 # We want to let Android unpack the file at install time, but it only does
4129 # so if the file is named libsomething.so. The lib/ path is also required
4130 # because the unpacked file will be under the lib/ subdirectory and will
4131 # need to be executed from that path.
4132 MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
4134 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
4135 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
4137 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
4138 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
4139 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
4141 # The following variables are available to branding and application
4142 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
4143 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
4144 # impacts profile location and user-visible fields.
4145 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
4146 # versions of a given application (e.g. Aurora and Firefox both use
4147 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
4148 # for application.ini's "Name" field, which controls profile location in
4149 # the absence of a "Profile" field (see below), and various system
4150 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
4151 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
4152 # Mac Bundle name, Updater, Installer), it is typically used for nightly
4153 # builds (e.g. Aurora for Firefox).
4154 # - MOZ_APP_VERSION: Defines the application version number.
4155 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
4156 # in the "About" window. If not set, defaults to MOZ_APP_VERSION.
4157 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
4158 # defaults to a lowercase form of MOZ_APP_BASENAME.
4159 # - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
4160 # profile name and remoting. If not set, defaults to MOZ_APP_NAME.
4161 # - MOZ_APP_PROFILE: When set, used for application.ini's
4162 # "Profile" field, which controls profile location.
4163 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
4164 # crash reporter server url.
4165 # - MOZ_APP_ANDROID_VERSION_CODE: On Android, "android:versionCode" for
4166 # the main application is set to the value of this variable. If not
4167 # set, it falls back to a Mozilla-specific value derived from the
4169 # - MOZ_ANDROID_SHARED_ID: On Android, "android:sharedUserId" for all Android
4170 # packages produced.
4171 # - MOZ_ANDROID_GCM_SENDERID: On Android, the Android GCM Sender ID used. GCM
4172 # sender IDs are not sensitive: see, http://stackoverflow.com/a/18216063.
4173 # - MOZ_MMA_GCM_SENDERID: This GCM Sender ID is used for MMA integration.
4174 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
4176 if test -z "$MOZ_APP_NAME"; then
4177 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
4180 if test -z "$MOZ_APP_REMOTINGNAME"; then
4181 MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
4184 if test -z "$MOZ_APP_VERSION_DISPLAY"; then
4185 MOZ_APP_VERSION_DISPLAY=$MOZ_APP_VERSION
4188 if test -z "$ANDROID_PACKAGE_NAME" ; then
4189 # When we got rid of the Aurora channel we decided to replace the old
4190 # Nightly ANDROID_PACKAGE_NAME with Aurora. To make sure this is inherited
4191 # by all mozilla-central based branches we make this the new "default"
4192 # for Fennec. Non mozilla-central based branches set ANDROID_PACKAGE_NAME
4193 # in their mozconfig, so they will never get this. If there are ever
4194 # non-Fennec builds for Android, they will fall into the else block
4195 # and use their own default name.
4196 # https://bugzilla.mozilla.org/show_bug.cgi?id=1357808 has additional
4197 # background on this.
4198 if test "$MOZ_APP_NAME" = "fennec"; then
4199 ANDROID_PACKAGE_NAME="org.mozilla.fennec_aurora"
4201 ANDROID_PACKAGE_NAME="org.mozilla.$MOZ_APP_NAME"
4205 # Mozilla released Firefox for Android {Release,Beta} and {Aurora,Nightly} to
4206 # the public with specific common shared IDs and we need to keep them
4207 # consistent forever. The specific common values are set by per-channel
4208 # branding; all other channels use a generic sharedID, set below.
4209 if test -z "$MOZ_ANDROID_SHARED_ID" ; then
4210 MOZ_ANDROID_SHARED_ID="${ANDROID_PACKAGE_NAME}.sharedID"
4213 # For extensions and langpacks, we require a max version that is compatible
4214 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
4215 # 24.0a1 and 24.0a2 aren't affected
4217 # 24.1.1 becomes 24.*
4218 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
4219 if test -z "$IS_ALPHA"; then
4221 if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
4222 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
4224 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
4228 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
4231 AC_SUBST(MOZ_APP_NAME)
4232 AC_SUBST(MOZ_APP_REMOTINGNAME)
4233 AC_SUBST(MOZ_APP_DISPLAYNAME)
4234 AC_SUBST(MOZ_APP_BASENAME)
4235 AC_SUBST(MOZ_APP_VENDOR)
4236 AC_SUBST(MOZ_APP_PROFILE)
4237 AC_SUBST(MOZ_APP_ID)
4238 AC_SUBST(MOZ_APP_ANDROID_VERSION_CODE)
4239 AC_SUBST(MOZ_ANDROID_SHARED_ID)
4240 AC_SUBST(MOZ_ANDROID_GCM_SENDERID)
4241 AC_SUBST(MOZ_MMA_GCM_SENDERID)
4242 AC_SUBST(MAR_CHANNEL_ID)
4243 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
4244 AC_SUBST(MOZ_PROFILE_MIGRATOR)
4245 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
4246 AC_SUBST(MOZ_APP_UA_NAME)
4247 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
4248 AC_SUBST(MOZ_APP_VERSION)
4249 AC_SUBST(MOZ_APP_VERSION_DISPLAY)
4250 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
4251 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
4253 AC_SUBST(MOZ_APP_MAXVERSION)
4254 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
4255 AC_SUBST(FIREFOX_VERSION)
4256 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
4257 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
4258 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
4261 AC_SUBST(MOZ_PKG_SPECIAL)
4262 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
4264 if test "$MOZILLA_OFFICIAL"; then
4265 # Build revisions should always be present in official builds
4266 MOZ_INCLUDE_SOURCE_INFO=1
4269 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
4270 # explicitly set the repository and changeset information in.
4271 AC_SUBST(MOZ_SOURCE_REPO)
4272 AC_SUBST(MOZ_SOURCE_CHANGESET)
4273 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
4275 if test "$MOZ_TELEMETRY_REPORTING"; then
4276 AC_DEFINE(MOZ_TELEMETRY_REPORTING)
4278 # Enable Telemetry by default for nightly and aurora channels
4279 if test -z "$RELEASE_OR_BETA"; then
4280 AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
4284 dnl If we have any service that uploads data (and requires data submission
4285 dnl policy alert), set MOZ_DATA_REPORTING.
4286 dnl We need SUBST for build system and DEFINE for xul preprocessor.
4287 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
4288 MOZ_DATA_REPORTING=1
4289 AC_DEFINE(MOZ_DATA_REPORTING)
4290 AC_SUBST(MOZ_DATA_REPORTING)
4294 AC_SUBST(WIN32_REDIST_DIR)
4295 AC_SUBST(WIN_UCRT_REDIST_DIR)
4296 AC_SUBST(WIN_DIA_SDK_BIN_DIR)
4298 dnl ========================================================
4300 dnl ========================================================
4304 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
4310 dnl Echo the CFLAGS to remove extra whitespace.
4312 $_COMPILATION_CFLAGS \
4316 $_WARNINGS_CXXFLAGS \
4317 $_COMPILATION_CXXFLAGS \
4320 COMPILE_CFLAGS=`echo \
4324 COMPILE_CXXFLAGS=`echo \
4325 $_DEFINES_CXXFLAGS \
4329 $_WARNINGS_HOST_CFLAGS \
4330 $_COMPILATION_HOST_CFLAGS \
4333 HOST_CXXFLAGS=`echo \
4334 $_WARNINGS_HOST_CXXFLAGS \
4335 $_COMPILATION_HOST_CXXFLAGS \
4338 AC_SUBST(MOZ_SYSTEM_JPEG)
4339 AC_SUBST(MOZ_SYSTEM_PNG)
4341 AC_SUBST_LIST(MOZ_JPEG_CFLAGS)
4342 AC_SUBST_LIST(MOZ_JPEG_LIBS)
4343 AC_SUBST_LIST(MOZ_PNG_CFLAGS)
4344 AC_SUBST_LIST(MOZ_PNG_LIBS)
4346 AC_SUBST(MOZ_SYSTEM_NSPR)
4348 AC_SUBST(MOZ_SYSTEM_NSS)
4350 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
4351 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
4352 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
4353 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
4354 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
4355 OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
4356 OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
4358 AC_SUBST(HOST_CMFLAGS)
4359 AC_SUBST(HOST_CMMFLAGS)
4360 AC_SUBST(OS_COMPILE_CMFLAGS)
4361 AC_SUBST(OS_COMPILE_CMMFLAGS)
4364 OS_CXXFLAGS="$CXXFLAGS"
4365 OS_CPPFLAGS="$CPPFLAGS"
4366 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
4367 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
4368 OS_LDFLAGS="$LDFLAGS"
4370 AC_SUBST_LIST(OS_CFLAGS)
4371 AC_SUBST_LIST(OS_CXXFLAGS)
4372 AC_SUBST_LIST(OS_CPPFLAGS)
4373 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
4374 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
4375 AC_SUBST_LIST(OS_LDFLAGS)
4380 AC_SUBST_LIST(HOST_CFLAGS)
4381 AC_SUBST_LIST(HOST_CPPFLAGS)
4382 AC_SUBST_LIST(HOST_CXXFLAGS)
4383 AC_SUBST(HOST_LDFLAGS)
4384 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
4386 AC_SUBST(HOST_AR_FLAGS)
4387 AC_SUBST(HOST_RANLIB)
4388 AC_SUBST(HOST_BIN_SUFFIX)
4390 AC_SUBST(TARGET_XPCOM_ABI)
4391 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
4392 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
4393 AC_SUBST(HAVE_X86_AVX2)
4394 AC_SUBST(HAVE_ALTIVEC)
4395 AC_SUBST(GCC_USE_GNU_LD)
4397 AC_SUBST_LIST(DSO_CFLAGS)
4398 AC_SUBST_LIST(DSO_PIC_CFLAGS)
4399 AC_SUBST(DSO_LDOPTS)
4400 AC_SUBST(BIN_SUFFIX)
4402 AC_SUBST(CC_VERSION)
4403 AC_SUBST(NS_ENABLE_TSF)
4404 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
4405 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
4408 AC_SUBST(MOZ_FFVPX_FLACONLY)
4409 AC_SUBST_LIST(FFVPX_ASFLAGS)
4410 AC_SUBST(VPX_USE_YASM)
4411 AC_SUBST_LIST(VPX_ASFLAGS)
4412 AC_SUBST(VPX_AS_CONVERSION)
4413 AC_SUBST(VPX_X86_ASM)
4414 AC_SUBST(VPX_ARM_ASM)
4415 AC_SUBST(LIBJPEG_TURBO_USE_YASM)
4416 AC_SUBST_LIST(LIBJPEG_TURBO_ASFLAGS)
4417 AC_SUBST(MOZ_LIBAV_FFT)
4418 AC_SUBST_LIST(LIBAV_FFT_ASFLAGS)
4419 AC_SUBST(MOZ_DEVTOOLS)
4421 AC_SUBST(MOZ_PACKAGE_JSSHELL)
4422 AC_SUBST(MOZ_FOLD_LIBS)
4423 AC_SUBST_LIST(MOZ_FOLD_LIBS_FLAGS)
4427 dnl Host JavaScript runtime, if any, to use during cross compiles.
4430 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
4432 if test -n "$COMPILE_ENVIRONMENT"; then
4433 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
4435 dnl Check for missing components
4436 if test "$MOZ_X11"; then
4437 dnl ====================================================
4438 dnl = Check if X headers exist
4439 dnl ====================================================
4440 _SAVE_CFLAGS=$CFLAGS
4441 CFLAGS="$CFLAGS $XCFLAGS"
4445 #include <X11/Xlib.h>
4446 #include <X11/Intrinsic.h>
4447 #include <X11/extensions/XShm.h>
4451 if ((dpy = XOpenDisplay(NULL)) == NULL) {
4452 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
4456 [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
4457 CFLAGS="$_SAVE_CFLAGS"
4459 if test -n "$MISSING_X"; then
4460 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
4465 fi # COMPILE_ENVIRONMENT
4467 dnl Set various defines and substitutions
4468 dnl ========================================================
4470 if test "$MOZ_DEBUG"; then
4471 AC_DEFINE(MOZ_REFLOW_PERF)
4472 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
4475 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
4476 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
4477 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
4478 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
4479 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
4480 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
4481 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
4482 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
4483 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
4486 AC_SUBST(MOZ_DEV_EDITION)
4487 if test -n "$MOZ_DEV_EDITION"; then
4488 AC_DEFINE(MOZ_DEV_EDITION)
4491 if test "$MOZ_DEBUG" -o "$DEVELOPER_OPTIONS"; then
4495 if test -n "$A11Y_LOG"; then
4499 dnl Spit out some output
4500 dnl ========================================================
4502 dnl The following defines are used by xpcom
4503 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
4505 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
4517 # Avoid using obsolete NSPR features
4518 AC_DEFINE(NO_NSPR_10_SUPPORT)
4520 # Don't build NSS libpkix
4521 NSS_DISABLE_LIBPKIX=1
4522 AC_SUBST(NSS_DISABLE_LIBPKIX)
4524 MOZ_CREATE_CONFIG_STATUS()
4526 if test -z "$direct_nspr_config"; then
4527 dnl ========================================================
4528 dnl = Setup a nice relatively clean build environment for
4529 dnl = sub-configures.
4530 dnl ========================================================
4533 CFLAGS="$_SUBDIR_CFLAGS"
4534 CPPFLAGS="$_SUBDIR_CPPFLAGS"
4535 CXXFLAGS="$_SUBDIR_CXXFLAGS"
4536 LDFLAGS="$_SUBDIR_LDFLAGS"
4537 HOST_CC="$_SUBDIR_HOST_CC"
4538 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
4539 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
4540 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
4547 # Run all configure scripts specified by a subconfigure
4548 if test -n "$_subconfigure_subdir"; then
4549 _save_srcdir="$srcdir"
4551 _save_ac_configure_args="$ac_configure_args"
4552 ac_configure_args="$_subconfigure_config_args"
4553 AC_OUTPUT_SUBDIRS_NOW("$_subconfigure_subdir",$cache_file)
4554 ac_configure_args="$_save_ac_configure_args"
4555 srcdir="$_save_srcdir"
4558 if test "$COMPILE_ENVIRONMENT" -a "$MOZ_WIDGET_TOOLKIT"; then
4561 dnl ========================================================
4562 dnl = Setup a nice relatively clean build environment for
4563 dnl = sub-configures.
4564 dnl ========================================================
4567 CFLAGS="$_SUBDIR_CFLAGS"
4568 CPPFLAGS="$_SUBDIR_CPPFLAGS"
4569 CXXFLAGS="$_SUBDIR_CXXFLAGS"
4570 LDFLAGS="$_SUBDIR_LDFLAGS"
4571 HOST_CC="$_SUBDIR_HOST_CC"
4572 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
4573 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
4574 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
4577 # Run the SpiderMonkey 'configure' script.
4578 dist=$MOZ_BUILD_ROOT/dist
4579 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
4581 # --with-system-nspr will have been converted into the relevant $NSPR_CFLAGS
4583 ac_configure_args="`echo $ac_configure_args | sed -e 's/--with-system-nspr\S* *//'`"
4585 if test "$_INTL_API" = no; then
4586 ac_configure_args="$ac_configure_args --without-intl-api"
4589 if test -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
4590 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
4591 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
4593 ac_configure_args="$ac_configure_args --prefix=$dist"
4594 if test -n "$ZLIB_IN_MOZGLUE"; then
4597 export MOZ_SYSTEM_ZLIB
4598 export MOZ_ZLIB_CFLAGS
4599 export MOZ_ZLIB_LIBS
4601 export MOZ_APP_REMOTINGNAME
4602 export MOZ_DEV_EDITION
4605 export MOZILLA_CENTRAL_PATH=$_topsrcdir
4606 export STLPORT_CPPFLAGS
4611 export ZLIB_IN_MOZGLUE
4625 export HOST_CPPFLAGS
4626 export HOST_CXXFLAGS
4629 if ! test -e js; then
4633 ac_configure_args="$ac_configure_args JS_STANDALONE="
4634 AC_OUTPUT_SUBDIRS(js/src,$cache_file)
4635 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
4637 fi # COMPILE_ENVIRONMENT
4639 dnl we need to run config.status after js/src subconfigure because we're
4640 dnl traversing its moz.build and we need its config.status for that.
4641 dnl However, writing our own config.status needs to happen before
4642 dnl subconfigures because the setup surrounding subconfigures alters
4643 dnl many AC_SUBSTed variables.
4644 MOZ_RUN_ALL_SUBCONFIGURES()
4646 rm -fr confdefs* $ac_clean_files