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 if test -n "${CLANG_CC}${CLANG_CL}"; then
481 _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
482 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
484 if test -n "${CLANG_CXX}${CLANG_CL}"; then
485 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
488 if test -n "$COMPILE_ENVIRONMENT"; then
492 dnl ========================================================
493 dnl Add optional and non-optional hardening flags
494 dnl ========================================================
496 CFLAGS="$CFLAGS $MOZ_HARDENING_CFLAGS"
497 CPPFLAGS="$CPPFLAGS $MOZ_HARDENING_CFLAGS"
498 CXXFLAGS="$CXXFLAGS $MOZ_HARDENING_CFLAGS"
500 dnl ========================================================
501 dnl GNU specific defaults
502 dnl ========================================================
503 if test "$GNU_CC"; then
507 SSSE3_FLAGS="-mssse3"
508 # FIXME: Let us build with strict aliasing. bug 414641.
509 CFLAGS="$CFLAGS -fno-strict-aliasing"
510 MKSHLIB='$(CXX) $(COMPUTED_CXX_LDFLAGS) $(PGO_CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
511 MKCSHLIB='$(CC) $(COMPUTED_C_LDFLAGS) $(PGO_CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
512 WARNINGS_AS_ERRORS='-Werror'
515 if test "$OS_ARCH" != "WINNT" -o -z "$CLANG_CC"; then
516 DSO_PIC_CFLAGS='-fPIC'
517 ASFLAGS="$ASFLAGS -fPIC"
520 AC_MSG_CHECKING([for --noexecstack option to as])
522 CFLAGS="$CFLAGS -Wa,--noexecstack"
523 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
524 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
527 AC_MSG_CHECKING([for -z noexecstack option to ld])
528 _SAVE_LDFLAGS=$LDFLAGS
529 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
530 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
532 LDFLAGS=$_SAVE_LDFLAGS)
534 AC_MSG_CHECKING([for -z text option to ld])
535 _SAVE_LDFLAGS=$LDFLAGS
536 LDFLAGS="$LDFLAGS -Wl,-z,text"
537 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
539 LDFLAGS=$_SAVE_LDFLAGS)
541 AC_MSG_CHECKING([for -z relro option to ld])
542 _SAVE_LDFLAGS=$LDFLAGS
543 LDFLAGS="$LDFLAGS -Wl,-z,relro"
544 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
546 LDFLAGS=$_SAVE_LDFLAGS)
548 AC_MSG_CHECKING([for -z nocopyreloc option to ld])
549 _SAVE_LDFLAGS=$LDFLAGS
550 LDFLAGS="$LDFLAGS -Wl,-z,nocopyreloc"
551 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
553 LDFLAGS=$_SAVE_LDFLAGS)
555 AC_MSG_CHECKING([for --build-id=sha1 option to ld])
556 _SAVE_LDFLAGS=$LDFLAGS
557 LDFLAGS="$LDFLAGS -Wl,--build-id=sha1"
558 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
560 LDFLAGS=$_SAVE_LDFLAGS)
562 AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
563 HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
564 _SAVE_LDFLAGS=$LDFLAGS
565 LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
566 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
567 [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
569 LDFLAGS=$_SAVE_LDFLAGS
571 # Check for -mssse3 on $CC
572 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
573 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
575 CFLAGS="$CFLAGS -mssse3"
576 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
577 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
581 # Check for -msse4.1 on $CC
582 AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
583 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
585 CFLAGS="$CFLAGS -msse4.1"
586 AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
587 [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
591 case "${CPU_ARCH}" in
593 AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
595 [asm volatile ("vpermq \$0xd8,%ymm0,%ymm0 \n");],
596 result="yes", result="no")
597 AC_MSG_RESULT("$result")
598 if test "$result" = "yes"; then
604 AC_MSG_CHECKING([whether we can enable AltiVec support])
607 CFLAGS="$CFLAGS -maltivec"
608 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
616 if test "$GCC_USE_GNU_LD"; then
617 # Some tools like ASan use a runtime library that is only
618 # linked against executables, so we must allow undefined
619 # symbols for shared objects in some cases.
620 if test -z "$MOZ_ASAN$MOZ_MSAN$MOZ_UBSAN$MOZ_TSAN"; then
621 # Don't allow undefined symbols in libraries
622 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
624 # BSDs need `environ' exposed for posix_spawn (bug 753046)
626 DragonFly|FreeBSD|NetBSD|OpenBSD)
627 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
628 DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
630 DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
637 _DEFINES_CFLAGS="-include $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
638 _USE_CPP_INCLUDE_FLAG=1
640 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
643 if test "$GNU_CXX"; then
644 # FIXME: Let us build with strict aliasing. bug 414641.
645 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
647 _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
648 _USE_CPP_INCLUDE_FLAG=1
651 # For profiling builds keep the symbol information
652 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
654 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
655 STRIP_FLAGS="--strip-debug"
660 dnl ========================================================
662 dnl ========================================================
664 if test "$MOZ_DMD"; then
665 if test "${CPU_ARCH}" = "arm"; then
666 CFLAGS="$CFLAGS -funwind-tables"
667 CXXFLAGS="$CXXFLAGS -funwind-tables"
671 dnl ========================================================
672 dnl System overrides of the defaults for host
673 dnl ========================================================
676 if test -n "$_WIN32_MSVC"; then
678 HOST_AR_FLAGS='-NOLOGO -OUT:$@'
679 HOST_CFLAGS="$HOST_CFLAGS -nologo"
680 HOST_RANLIB='echo ranlib'
682 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
684 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
685 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
688 case "${host_cpu}" in
690 if test -n "$_WIN32_MSVC"; then
691 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
695 if test -n "$_WIN32_MSVC"; then
696 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
698 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
704 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
705 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
708 *-linux*|*-kfreebsd*-gnu|*-gnu*)
709 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
710 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
714 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
715 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
719 dnl Get version of various core apps from the version files.
720 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
721 FIREFOX_VERSION_DISPLAY=`cat $_topsrcdir/browser/config/version_display.txt`
723 if test -z "$FIREFOX_VERSION"; then
724 AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
727 if test -z "$FIREFOX_VERSION_DISPLAY"; then
728 AC_MSG_ERROR([FIREFOX_VERSION_DISPLAY is unexpectedly blank.])
731 MOZ_DOING_LTO(lto_is_enabled)
733 dnl ========================================================
734 dnl System overrides of the defaults for target
735 dnl ========================================================
739 MKSHLIB='$(CXX) $(COMPUTED_CXX_LDFLAGS) $(PGO_CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
740 MKCSHLIB='$(CC) $(COMPUTED_C_LDFLAGS) $(PGO_CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
741 MOZ_OPTIMIZE_FLAGS="-O3"
742 CXXFLAGS="$CXXFLAGS -stdlib=libc++"
744 STRIP_FLAGS="$STRIP_FLAGS -x -S"
745 # Ensure that if we're targeting iOS an SDK was provided.
746 AC_CACHE_CHECK(for iOS target,
748 [AC_TRY_COMPILE([#include <TargetConditionals.h>
749 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
753 ac_cv_ios_target="yes",
754 ac_cv_ios_target="no")])
755 if test "$ac_cv_ios_target" = "yes" -a -z $MOZ_IOS; then
756 AC_MSG_ERROR([targeting iOS but not using an iOS SDK?])
758 if test -n "$MOZ_IOS"; then
761 # The ExceptionHandling framework is needed for Objective-C exception
762 # logging code in nsObjCExceptions.h. Currently we only use that in debug
764 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
767 if test "x$lto_is_enabled" = "xyes"; then
768 echo "Skipping -dead_strip because lto is enabled."
769 dnl DTrace and -dead_strip don't interact well. See bug 403132.
770 dnl ===================================================================
771 elif test "x$enable_dtrace" = "xyes"; then
772 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
774 dnl check for the presence of the -dead_strip linker flag
775 AC_MSG_CHECKING([for -dead_strip option to ld])
776 _SAVE_LDFLAGS=$LDFLAGS
777 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
778 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
779 if test -n "$_HAVE_DEAD_STRIP" ; then
781 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
786 LDFLAGS=$_SAVE_LDFLAGS
789 MOZ_FIX_LINK_PATHS="-Wl,-executable_path,${DIST}/bin"
792 *-android*|*-linuxandroid*)
793 AC_DEFINE(NO_PW_GECOS)
795 if test "$COMPILE_ENVIRONMENT"; then
799 MOZ_GFX_OPTIMIZE_MOBILE=1
800 if test -z "$CLANG_CC"; then
801 MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
803 # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
804 # -Oz is smaller than -Os on clang.
805 MOZ_OPTIMIZE_FLAGS="-Oz"
810 if test "$GNU_CC" -o "$GNU_CXX"; then
811 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
812 if test -n "$MOZ_DEBUG"; then
813 MOZ_OPTIMIZE_FLAGS="-Os"
815 MOZ_OPTIMIZE_FLAGS="-O2"
817 if test -z "$CLANG_CC"; then
818 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
822 case "${target_cpu}" in
824 CFLAGS="$CFLAGS -mieee"
825 CXXFLAGS="$CXXFLAGS -mieee"
833 # certain versions of cygwin's makedepend barf on the
834 # #include <string> vs -I./dist/include/string issue so don't use it
835 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
839 CFLAGS="$CFLAGS -mms-bitfields"
840 CXXFLAGS="$CXXFLAGS -mms-bitfields"
842 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
843 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
845 # Use temp file for windres (bug 213281)
846 RCFLAGS='-O coff --use-temp-file'
847 # mingw doesn't require kernel32, user32, and advapi32 explicitly
848 LIBS="$LIBS -luuid -lusp10 -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
851 MOZ_OPTIMIZE_FLAGS="-O1"
853 WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
854 WIN32_GUI_EXE_LDFLAGS=-mwindows
856 if test -z "$CLANG_CC"; then
857 # Use static libgcc and libstdc++
858 LDFLAGS="$LDFLAGS -static"
860 # GCC/binutils can't link to a function if we try to include dllexport function
861 # in the same library as dllimport caller. To work around it, we build NSPR
862 # and NSS with -mnop-fun-dllimport flag. The drawback of this solution is that
863 # function thunks need to be generated for cross-DLL calls.
864 MOZ_FOLD_LIBS_FLAGS="-mnop-fun-dllimport"
866 # Silence problematic clang warnings
867 CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
870 TARGET_COMPILER_ABI=msvc
871 if test "$AS_BIN"; then
872 AS="$(basename "$AS_BIN")"
874 # armasm64 doesn't understand -c.
875 if test "$CPU_ARCH" = "aarch64"; then
881 AR_FLAGS='-llvmlibthin -out:$@'
885 AR_FLAGS='-NOLOGO -OUT:$@'
889 RANLIB='echo not_ranlib'
890 STRIP='echo not_strip'
892 MKSHLIB='$(LINKER) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
893 MKCSHLIB='$(LINKER) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
894 WIN32_SUBSYSTEM_VERSION=6.01
895 WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
896 WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
897 DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
898 _USE_CPP_INCLUDE_FLAG=1
899 _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
900 _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
901 CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
902 CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
903 if test -z "$CLANG_CL"; then
904 CPPFLAGS="$CPPFLAGS -utf-8"
906 if test "$CPU_ARCH" = "x86"; then
907 dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
908 dnl more recent, so set that explicitly here unless another
909 dnl target arch has already been set.
911 if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
912 CFLAGS="$CFLAGS -arch:SSE2"
914 if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
915 CXXFLAGS="$CXXFLAGS -arch:SSE2"
918 SSE_FLAGS="-arch:SSE"
919 SSE2_FLAGS="-arch:SSE2"
920 dnl MSVC allows the use of intrinsics without any flags
921 dnl and doesn't have a separate arch for SSSE3
922 SSSE3_FLAGS="-arch:SSE2"
924 dnl clang-cl requires appropriate flags to enable SSSE3 support
925 dnl on all architectures.
926 if test -n "$CLANG_CL"; then
927 SSSE3_FLAGS="-mssse3"
929 dnl VS2013+ supports -Gw for better linker optimizations.
930 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
931 dnl Disabled on ASan because it causes false-positive ODR violations.
932 if test -z "$MOZ_ASAN"; then
934 CXXFLAGS="$CXXFLAGS -Gw"
936 # khuey says we can safely ignore MSVC warning C4251
937 # MSVC warning C4244 (implicit type conversion may lose data) warns
938 # and requires workarounds for perfectly valid code. Also, GCC/clang
939 # don't warn about it by default. So for consistency/sanity, we turn
940 # it off on MSVC, too.
941 # MSVC warning C4267 warns for narrowing type conversions from size_t
942 # to 32-bit integer types on 64-bit platforms. Since this is virtually
943 # the same thing as C4244, we disable C4267, too.
944 # MSVC warning C4800 warns when a value is implicitly cast to bool,
945 # because this also forces narrowing to a single byte, which can be a
946 # perf hit. But this matters so little in practice (and often we want
947 # that behavior) that it's better to turn it off.
948 # MSVC warning C4595 warns non-member operator new or delete functions
949 # may not be declared inline, as of VS2015 Update 2.
950 CFLAGS="$CFLAGS -wd4244 -wd4267"
951 CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4267 -wd4800 -wd4595"
952 # Silence "warning C4065: switch statement contains 'default' but no
953 # 'case' labels". See bug 1461304.
954 CXXFLAGS="$CXXFLAGS -wd4065"
955 if test -n "$CLANG_CL"; then
956 # XXX We should combine some of these with our generic GCC-style
959 # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
960 CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
961 # We use offsetof on non-POD objects all the time.
962 # We also suppress this warning on other platforms.
963 CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
964 # This warns for reasonable things like:
965 # enum { X = 0xffffffffU };
966 # which is annoying for IDL headers.
967 CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
968 # This warns for cases that would be reached by the Microsoft
969 # #include rules, but also currently warns on cases that would
970 # *also* be reached by standard C++ include rules. That
971 # behavior doesn't seem useful, so we turn it off.
972 CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
973 # We normally error out on unknown pragmas, but since clang-cl
974 # claims to be MSVC, it would be difficult to add
975 # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
976 # use such pragmas, so just ignore them.
977 CFLAGS="$CFLAGS -Wno-unknown-pragmas"
978 CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
979 # We get errors about various #pragma intrinsic directives from
980 # clang-cl, and we don't need to hear about those.
981 CFLAGS="$CFLAGS -Wno-ignored-pragmas"
982 CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
983 # clang-cl's Intrin.h marks things like _ReadWriteBarrier
984 # as __attribute((__deprecated__)). This is nice to know,
985 # but since we don't get the equivalent warning from MSVC,
986 # let's just ignore it.
987 CFLAGS="$CFLAGS -Wno-deprecated-declarations"
988 CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
989 # We use a function like:
990 # __declspec(noreturn) __inline void f() {}
991 # which -Winvalid-noreturn complains about. Again, MSVC seems
992 # OK with it, so let's silence the warning.
993 CFLAGS="$CFLAGS -Wno-invalid-noreturn"
994 CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
995 # Missing |override| on virtual function declarations isn't
996 # something that MSVC currently warns about.
997 CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
998 # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
999 # declaration on |operator delete(void*)|. However, clang-cl
1000 # must internally declare |operator delete(void*)| differently,
1001 # which causes this warning for virtually every file in the
1002 # tree. clang-cl doesn't support -fno-exceptions or equivalent,
1003 # so there doesn't seem to be any way to convince clang-cl to
1004 # declare |delete| differently. Therefore, suppress this
1006 CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
1007 # At least one MSVC header and several headers in-tree have
1008 # unused typedefs, so turn this on.
1009 CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
1010 # jemalloc uses __declspec(allocator) as a profiler hint,
1011 # which clang-cl doesn't understand.
1012 CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
1013 # __attribute__((unused)) really means "might be unused" and
1014 # we use it to avoid warnings about things that are unused
1015 # in some compilation units, but used in many others. This
1016 # warning insists on complaining about the latter case, which
1017 # is annoying, and rather noisy.
1018 CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused"
1020 # make 'foo == bar;' error out
1021 CFLAGS="$CFLAGS -we4553"
1022 CXXFLAGS="$CXXFLAGS -we4553"
1023 # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
1024 CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
1025 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
1026 MOZ_DEBUG_LDFLAGS='-DEBUG'
1027 WARNINGS_AS_ERRORS='-WX'
1028 # Use a higher optimization level for clang-cl, so we can come closer
1029 # to MSVC's performance numbers (see bug 1443590).
1030 if test -n "$CLANG_CL"; then
1031 MOZ_OPTIMIZE_FLAGS='-O2'
1033 MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
1036 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE"
1037 if test -z "$DEVELOPER_OPTIONS"; then
1038 LDFLAGS="$LDFLAGS -RELEASE"
1041 dnl Minimum reqiurement of Gecko is VS2015 or later which supports
1042 dnl both SSSE3 and SSE4.1.
1043 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
1044 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
1045 dnl allow AVX2 code from VS2015
1048 AC_DEFINE(WIN32_LEAN_AND_MEAN)
1049 dnl See http://support.microsoft.com/kb/143208 to use STL
1052 MOZ_USER_DIR="Mozilla"
1056 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.])
1060 if test -n "$GNU_CC" -a -z "$CLANG_CC"; then
1061 CFLAGS="$CFLAGS -fno-keep-inline-dllexport"
1062 CXXFLAGS="$CXXFLAGS -fno-keep-inline-dllexport"
1067 if test -n "$GNU_CC"; then
1068 CFLAGS="$CFLAGS -mstackrealign"
1069 CXXFLAGS="$CXXFLAGS -mstackrealign"
1070 LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup -Wl,--large-address-aware"
1072 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
1073 LDFLAGS="$LDFLAGS -SAFESEH"
1079 if test -n "$_WIN32_MSVC"; then
1080 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
1085 if test -n "$_WIN32_MSVC"; then
1086 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:ARM64"
1091 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
1098 CFLAGS="$CFLAGS -Dunix"
1099 CXXFLAGS="$CXXFLAGS -Dunix"
1100 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
1101 DSO_PIC_CFLAGS='-fPIC -DPIC'
1102 DSO_LDOPTS='-shared'
1103 MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
1105 DSO_PIC_CFLAGS='-fPIC -DPIC'
1106 DSO_LDOPTS='-shared'
1108 # This will fail on a.out systems prior to 1.5.1_ALPHA.
1109 if test "$LIBRUNPATH"; then
1110 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
1112 MKSHLIB='$(CXX) $(COMPUTED_CXX_LDFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
1113 MKCSHLIB='$(CC) $(COMPUTED_C_LDFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
1117 if test -z "$X11BASE"; then
1120 MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
1122 DSO_PIC_CFLAGS='-fPIC'
1123 DSO_LDOPTS='-shared -fPIC'
1124 if test "$LIBRUNPATH"; then
1125 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
1130 MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
1135 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
1136 MOZ_OPTIMIZE_FLAGS="-O"
1139 AC_SUBST_LIST(MMX_FLAGS)
1140 AC_SUBST_LIST(SSE_FLAGS)
1141 AC_SUBST_LIST(SSE2_FLAGS)
1142 AC_SUBST_LIST(SSSE3_FLAGS)
1144 AC_SUBST(MOZ_LINKER)
1145 if test -n "$MOZ_LINKER"; then
1146 AC_DEFINE(MOZ_LINKER)
1147 MOZ_LINKER_EXTRACT=1
1148 AC_CHECK_PROGS(XZ, xz)
1151 if test -z "$COMPILE_ENVIRONMENT"; then
1152 SKIP_COMPILER_CHECKS=1
1153 SKIP_LIBRARY_CHECKS=1
1158 fi # COMPILE_ENVIRONMENT
1160 if test -z "$SKIP_COMPILER_CHECKS"; then
1161 dnl Checks for typedefs, structures, and compiler characteristics.
1162 dnl ========================================================
1177 case "${OS_TARGET}" in
1181 STL_FLAGS="-I${DIST}/stl_wrappers"
1186 dnl Checks for header files.
1187 dnl ========================================================
1189 case "$target_os" in
1190 bitrig*|dragonfly*|freebsd*|openbsd*)
1191 # for stuff like -lXshm
1192 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
1196 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
1197 AC_CACHE_CHECK(for sockaddr_in.sin_len,
1198 ac_cv_sockaddr_in_sin_len,
1199 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1200 #include <sys/types.h>
1202 #include <netinet/in.h>
1203 struct sockaddr_in x;
1204 void *foo = (void*) &x.sin_len;],
1206 [ac_cv_sockaddr_in_sin_len=true],
1207 [ac_cv_sockaddr_in_sin_len=false])])
1208 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
1209 AC_DEFINE(HAVE_SIN_LEN)
1210 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
1211 AC_DEFINE(HAVE_SCONN_LEN)
1214 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
1215 ac_cv_sockaddr_in6_sin6_len,
1216 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1217 #include <sys/types.h>
1219 #include <netinet/in.h>
1220 struct sockaddr_in6 x;
1221 void *foo = (void*) &x.sin6_len;],
1223 [ac_cv_sockaddr_in6_sin6_len=true],
1224 [ac_cv_sockaddr_in6_sin6_len=false])])
1225 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
1226 AC_DEFINE(HAVE_SIN6_LEN)
1229 AC_CACHE_CHECK(for sockaddr.sa_len,
1230 ac_cv_sockaddr_sa_len,
1231 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1232 #include <sys/types.h>
1234 #include <sys/socket.h>
1236 void *foo = (void*) &x.sa_len;],
1238 [ac_cv_sockaddr_sa_len=true],
1239 [ac_cv_sockaddr_sa_len=false])])
1240 if test "$ac_cv_sockaddr_sa_len" = true ; then
1241 AC_DEFINE(HAVE_SA_LEN)
1244 MOZ_ARG_ENABLE_BOOL(dtrace,
1245 [ --enable-dtrace build with dtrace support if available (default=no)],
1246 [enable_dtrace="yes"],)
1247 if test "x$enable_dtrace" = "xyes"; then
1248 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
1249 if test -n "$HAVE_DTRACE"; then
1250 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
1252 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
1255 AC_SUBST(HAVE_DTRACE)
1257 dnl Checks for libraries.
1258 dnl ========================================================
1259 AC_CHECK_LIB(c_r, gethostbyname_r)
1261 dnl We don't want to link with libdl even if it's present on OS X, since
1262 dnl it's not used and not part of the default installation. OS/2 has dlfcn
1264 dnl We don't want to link against libm or libpthread on Darwin since
1265 dnl they both are just symlinks to libSystem and explicitly linking
1266 dnl against libSystem causes issues when debugging (see bug 299601).
1271 AC_SEARCH_LIBS(dlopen, dl,
1272 MOZ_CHECK_HEADER(dlfcn.h,
1273 AC_DEFINE(HAVE_DLOPEN)))
1277 _SAVE_CFLAGS="$CFLAGS"
1278 CFLAGS="$CFLAGS -D_GNU_SOURCE"
1279 AC_CHECK_FUNCS(dladdr memmem)
1280 CFLAGS="$_SAVE_CFLAGS"
1282 if test ! "$GNU_CXX"; then
1283 AC_CHECK_LIB(C, demangle)
1286 AC_CHECK_LIB(socket, socket)
1289 XLIBS="$X_EXTRA_LIBS"
1291 dnl ========================================================
1292 dnl Checks for X libraries.
1293 dnl Ordering is important.
1294 dnl Xt is dependent upon SM as of X11R6
1295 dnl ========================================================
1296 if test -n "$MOZ_X11"; then
1297 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
1298 _SAVE_LDFLAGS="$LDFLAGS"
1300 LDFLAGS="$XLDFLAGS $LDFLAGS"
1301 AC_CHECK_LIB(X11, XDrawLines, [XLIBS="-lX11 $XLIBS"],
1302 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
1303 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
1304 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
1306 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
1307 unset ac_cv_lib_Xt_XtFree
1308 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
1309 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
1310 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
1311 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
1314 dnl ========================================================
1316 dnl ========================================================
1317 AC_CHECK_LIB(xcb, xcb_connect, [XLIBS="-lxcb $XLIBS"],
1318 [MISSING_X="$MISSING_X -lxcb"], $XLIBS)
1319 AC_CHECK_LIB(xcb-shm, xcb_shm_query_version, [XLIBS="-lxcb-shm $XLIBS"],
1320 [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS)
1321 AC_CHECK_LIB(X11-xcb, XGetXCBConnection, [XLIBS="-lX11-xcb $XLIBS"],
1322 [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS)
1324 LDFLAGS="$_SAVE_LDFLAGS"
1328 AC_SUBST_LIST(XCFLAGS)
1329 AC_SUBST_LIST(XLDFLAGS)
1330 AC_SUBST_LIST(XLIBS)
1331 AC_SUBST_LIST(XEXT_LIBS)
1332 AC_SUBST_LIST(XT_LIBS)
1334 dnl ========================================================
1335 dnl = pthread support
1336 dnl = Start by checking whether the system support pthreads
1337 dnl ========================================================
1338 case "$target_os" in
1343 AC_CHECK_LIB(pthreads, pthread_create,
1344 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
1345 AC_CHECK_LIB(pthread, pthread_create,
1346 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
1347 AC_CHECK_LIB(c_r, pthread_create,
1348 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
1349 AC_CHECK_LIB(c, pthread_create,
1358 dnl ========================================================
1359 dnl Do the platform specific pthread hackery
1360 dnl ========================================================
1361 if test "$MOZ_USE_PTHREADS"x != x
1364 dnl See if -pthread is supported.
1367 ac_cv_have_dash_pthread=no
1368 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
1369 echo 'int main() { return 0; }' | cat > conftest.c
1370 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
1371 if test $? -eq 0; then
1372 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1373 ac_cv_have_dash_pthread=yes
1374 case "$target_os" in
1376 # Freebsd doesn't use -pthread for compiles, it uses them for linking
1379 CFLAGS="$CFLAGS -pthread"
1380 CXXFLAGS="$CXXFLAGS -pthread"
1386 AC_MSG_RESULT($ac_cv_have_dash_pthread)
1389 dnl See if -pthreads is supported.
1391 ac_cv_have_dash_pthreads=no
1392 if test "$ac_cv_have_dash_pthread" = "no"; then
1393 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
1394 echo 'int main() { return 0; }' | cat > conftest.c
1395 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
1396 if test $? -eq 0; then
1397 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1398 ac_cv_have_dash_pthreads=yes
1399 CFLAGS="$CFLAGS -pthreads"
1400 CXXFLAGS="$CXXFLAGS -pthreads"
1404 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
1409 AC_DEFINE(_REENTRANT)
1410 AC_DEFINE(_THREAD_SAFE)
1411 dnl -pthread links in -lpthread, so don't specify it explicitly.
1412 if test "$ac_cv_have_dash_pthread" = "yes"; then
1413 _PTHREAD_LDFLAGS="-pthread"
1417 *-*-openbsd*|*-*-bsdi*)
1418 AC_DEFINE(_REENTRANT)
1419 AC_DEFINE(_THREAD_SAFE)
1420 dnl -pthread links in -lc_r, so don't specify it explicitly.
1421 if test "$ac_cv_have_dash_pthread" = "yes"; then
1422 _PTHREAD_LDFLAGS="-pthread"
1426 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
1427 AC_DEFINE(_REENTRANT)
1431 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
1432 AC_SUBST(MOZ_USE_PTHREADS)
1433 MOZ_CHECK_HEADERS(pthread.h)
1437 dnl Checks for library functions.
1438 dnl ========================================================
1439 AC_PROG_GCC_TRADITIONAL
1441 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall)
1443 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1444 dnl avoid this on Darwin, since depending on your system config, we may think
1445 dnl it exists but it really doesn't
1446 case "$OS_TARGET" in
1450 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1451 ac_cv_clock_monotonic,
1452 [for libs in "" -lrt; do
1455 AC_TRY_LINK([#include <time.h>],
1456 [ struct timespec ts;
1457 clock_gettime(CLOCK_MONOTONIC, &ts); ],
1458 ac_cv_clock_monotonic=$libs
1461 ac_cv_clock_monotonic=no)
1464 if test "$ac_cv_clock_monotonic" != "no"; then
1465 HAVE_CLOCK_MONOTONIC=1
1466 REALTIME_LIBS=$ac_cv_clock_monotonic
1467 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1468 AC_SUBST(HAVE_CLOCK_MONOTONIC)
1469 AC_SUBST_LIST(REALTIME_LIBS)
1474 AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
1475 ac_cv_pthread_cond_timedwait_monotonic_np,
1476 AC_TRY_LINK([#include <pthread.h>],
1477 [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
1478 ac_cv_pthread_cond_timewait_monotonic_np=yes,
1479 ac_cv_pthread_cond_timewait_monotonic_np=no))
1480 if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
1481 AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
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 if test -n "$MOZ_MULET"; then
2037 AC_DEFINE(MOZ_MULET)
2040 AC_SUBST(MOZ_PHOENIX)
2041 AC_SUBST(MOZ_XULRUNNER)
2044 dnl ========================================================
2045 dnl Ensure Android SDK and build-tools versions depending on
2047 dnl ========================================================
2049 case "$MOZ_BUILD_APP" in
2051 MOZ_ANDROID_SDK(26, 26, 27.0.3)
2055 dnl ========================================================
2057 dnl = Toolkit Options
2059 dnl ========================================================
2060 MOZ_ARG_HEADER(Toolkit Options)
2062 dnl ========================================================
2063 dnl = Enable the toolkit as needed =
2064 dnl ========================================================
2066 case "$MOZ_WIDGET_TOOLKIT" in
2069 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
2070 # Use -Wl as a trick to avoid -framework and framework names from
2071 # being separated by AC_SUBST_LIST.
2072 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'
2074 CFLAGS="$CFLAGS $TK_CFLAGS"
2075 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
2076 MOZ_USER_DIR="Mozilla"
2077 MOZ_FS_LAYOUT=bundle
2081 LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
2083 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'
2084 CFLAGS="$CFLAGS $TK_CFLAGS"
2085 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
2086 MOZ_USER_DIR="Mozilla"
2087 MOZ_FS_LAYOUT=bundle
2092 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
2093 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
2094 case "$MOZ_WIDGET_TOOLKIT" in
2100 if test "$COMPILE_ENVIRONMENT"; then
2101 if test "$MOZ_WIDGET_TOOLKIT" = gtk3; then
2102 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)
2103 MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
2104 TK_CFLAGS=$MOZ_GTK3_CFLAGS
2105 TK_LIBS=$MOZ_GTK3_LIBS
2106 dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
2107 dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
2108 AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
2109 GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32
2111 if test "$MOZ_WIDGET_TOOLKIT" = gtk2; then
2112 GLIB_VERSION_MAX_ALLOWED=$GLIB_VERSION_MIN_REQUIRED
2114 if test "$MOZ_ENABLE_GTK"; then
2115 if test "$MOZ_X11"; then
2116 GDK_PACKAGES=gdk-x11-2.0
2118 AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
2119 AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
2121 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)
2122 MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
2124 if test "$MOZ_WIDGET_TOOLKIT" = gtk2; then
2125 TK_CFLAGS=$MOZ_GTK2_CFLAGS
2126 TK_LIBS=$MOZ_GTK2_LIBS
2128 fi # COMPILE_ENVIRONMENT
2130 AC_SUBST(MOZ_FS_LAYOUT)
2132 dnl ========================================================
2133 dnl = startup-notification support module
2134 dnl ========================================================
2136 if test "$MOZ_ENABLE_GTK"
2138 MOZ_ENABLE_STARTUP_NOTIFICATION=
2140 MOZ_ARG_ENABLE_BOOL(startup-notification,
2141 [ --enable-startup-notification
2142 Enable startup-notification support (default: disabled) ],
2143 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
2144 MOZ_ENABLE_STARTUP_NOTIFICATION=)
2145 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
2147 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
2148 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
2149 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
2150 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
2152 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
2154 MOZ_ENABLE_STARTUP_NOTIFICATION=
2158 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
2159 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
2162 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
2164 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
2166 AC_SUBST_LIST(TK_CFLAGS)
2167 AC_SUBST_LIST(TK_LIBS)
2172 dnl ========================================================
2174 dnl = Components & Features
2176 dnl ========================================================
2177 MOZ_ARG_HEADER(Components and Features)
2179 AC_SUBST(MOZ_OFFICIAL_BRANDING)
2180 if test -n "$MOZ_OFFICIAL_BRANDING"; then
2181 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
2182 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
2184 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
2185 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
2189 MOZ_ARG_WITH_STRING(branding,
2190 [ --with-branding=dir Use branding from the specified directory.],
2191 MOZ_BRANDING_DIRECTORY=$withval)
2193 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
2194 if test -z "$REAL_BRANDING_DIRECTORY"; then
2195 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
2198 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
2199 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
2200 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
2201 . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
2204 AC_SUBST(MOZ_BRANDING_DIRECTORY)
2206 dnl ========================================================
2207 dnl = Distribution ID
2208 dnl ========================================================
2209 MOZ_ARG_WITH_STRING(distribution-id,
2210 [ --with-distribution-id=ID
2211 Set distribution-specific id (default=org.mozilla)],
2212 [ val=`echo $withval`
2213 MOZ_DISTRIBUTION_ID="$val"])
2215 if test -z "$MOZ_DISTRIBUTION_ID"; then
2216 MOZ_DISTRIBUTION_ID="org.mozilla"
2219 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
2220 AC_SUBST(MOZ_DISTRIBUTION_ID)
2222 dnl ========================================================
2223 dnl = GConf support module
2224 dnl ========================================================
2228 if test "$MOZ_ENABLE_GTK"
2233 dnl ========================================================
2234 dnl = GConf support module
2235 dnl ========================================================
2236 MOZ_ARG_DISABLE_BOOL(gconf,
2237 [ --disable-gconf Disable Gconf support ],
2241 if test "$MOZ_ENABLE_GCONF"
2243 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
2244 MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
2247 if test -n "$MOZ_ENABLE_GCONF";
2249 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
2251 AC_MSG_WARN([Many automated tests will fail with --disable-gconf. See bug 1167201.])
2256 if test "$MOZ_ENABLE_GCONF"; then
2257 AC_DEFINE(MOZ_ENABLE_GCONF)
2260 AC_SUBST(MOZ_ENABLE_GCONF)
2263 dnl ========================================================
2264 dnl = libproxy support
2265 dnl ========================================================
2267 if test "$MOZ_ENABLE_GTK"
2269 MOZ_ENABLE_LIBPROXY=
2271 MOZ_ARG_ENABLE_BOOL(libproxy,
2272 [ --enable-libproxy Enable libproxy support ],
2273 MOZ_ENABLE_LIBPROXY=1,
2274 MOZ_ENABLE_LIBPROXY=)
2276 if test "$MOZ_ENABLE_LIBPROXY"
2278 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
2279 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
2282 AC_SUBST(MOZ_ENABLE_LIBPROXY)
2284 dnl ========================================================
2286 dnl ========================================================
2288 if test "$MOZ_ENABLE_GTK"
2292 MOZ_ARG_DISABLE_BOOL(dbus,
2293 [ --disable-dbus Disable dbus support ],
2297 if test "$MOZ_ENABLE_DBUS"
2299 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
2300 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
2301 AC_DEFINE(MOZ_ENABLE_DBUS)
2304 AC_SUBST(MOZ_ENABLE_DBUS)
2306 dnl =========================================================
2307 dnl = Whether to exclude hyphenations files in the build
2308 dnl =========================================================
2309 if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
2310 AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
2313 dnl ========================================================
2314 dnl accessibility support on by default on all platforms
2315 dnl ========================================================
2316 MOZ_ARG_DISABLE_BOOL(accessibility,
2317 [ --disable-accessibility Disable accessibility support],
2320 if test "$ACCESSIBILITY"; then
2323 if test -z "$MIDL"; then
2324 if test "$GCC" != "yes"; then
2325 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
2327 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.])
2331 AC_DEFINE(ACCESSIBILITY)
2334 dnl ========================================================
2335 dnl Accessibility is required for the linuxgl widget
2337 dnl ========================================================
2338 if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
2339 AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
2342 AC_TRY_COMPILE([#include <linux/ethtool.h>],
2343 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
2344 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
2346 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
2348 if test -n "$MOZ_WEBRTC"; then
2354 if test -n "$MOZ_X11"; then
2355 MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
2359 dnl ========================================================
2360 dnl = Force hardware AEC, disable webrtc.org AEC
2361 dnl ========================================================
2362 MOZ_ARG_ENABLE_BOOL(hardware-aec-ns,
2363 [ --enable-hardware-aec-ns Enable support for hardware AEC and noise suppression],
2364 MOZ_WEBRTC_HARDWARE_AEC_NS=1,
2365 MOZ_WEBRTC_HARDWARE_AEC_NS=)
2367 if test -n "$MOZ_WEBRTC_HARDWARE_AEC_NS"; then
2368 AC_DEFINE(MOZ_WEBRTC_HARDWARE_AEC_NS)
2371 AC_SUBST(MOZ_WEBRTC_HARDWARE_AEC_NS)
2374 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
2376 dnl ========================================================
2377 dnl = Enable Raw Codecs
2378 dnl ========================================================
2379 MOZ_ARG_ENABLE_BOOL(raw,
2380 [ --enable-raw Enable support for RAW media],
2384 if test -n "$MOZ_RAW"; then
2390 dnl ========================================================
2391 dnl = Apple platform decoder support
2392 dnl ========================================================
2393 if test "$COMPILE_ENVIRONMENT"; then
2394 if test -n "$MOZ_APPLEMEDIA"; then
2395 # hack in frameworks for fmp4 - see bug 1029974
2396 # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
2397 LDFLAGS="$LDFLAGS -framework AudioToolbox"
2398 dnl Verify CoreMedia is available.
2399 AC_CHECK_HEADER([CoreMedia/CoreMedia.h], [],
2400 [AC_MSG_ERROR([MacOS X 10.9 SDK or later is required])])
2402 fi # COMPILE_ENVIRONMENT
2404 dnl system libvpx Support
2405 dnl ========================================================
2406 MOZ_ARG_WITH_BOOL(system-libvpx,
2407 [ --with-system-libvpx Use system libvpx (located with pkgconfig)],
2408 MOZ_SYSTEM_LIBVPX=1)
2413 _SAVE_CFLAGS=$CFLAGS
2415 if test -n "$MOZ_SYSTEM_LIBVPX"; then
2416 dnl ============================
2417 dnl === libvpx Version check ===
2418 dnl ============================
2419 dnl Check to see if we have a system libvpx package.
2420 PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.5.0)
2422 CFLAGS="$CFLAGS $MOZ_LIBVPX_CFLAGS"
2423 LIBS="$LIBS $MOZ_LIBVPX_LIBS"
2425 MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
2426 [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.])])
2428 AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
2429 [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
2431 MOZ_CHECK_HEADER([vpx_mem/vpx_mem.h],
2432 [AC_CHECK_FUNC(vpx_mem_set_functions)])
2433 if test "$ac_cv_header_vpx_mem_vpx_mem_h" = no -o \
2434 "$ac_cv_func_vpx_mem_set_functions" = no; then
2435 AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
2438 CFLAGS=$_SAVE_CFLAGS
2441 AC_SUBST(MOZ_SYSTEM_LIBVPX)
2442 AC_SUBST_LIST(MOZ_LIBVPX_CFLAGS)
2443 AC_SUBST_LIST(MOZ_LIBVPX_LIBS)
2445 if test -z "$MOZ_SYSTEM_LIBVPX"; then
2447 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
2448 dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
2449 dnl We currently require gcc on all arm platforms.
2451 dnl See if we have assembly on this platform.
2452 case "$OS_ARCH:$CPU_ARCH" in
2466 dnl Check for yasm 1.1 or greater.
2467 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
2468 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.])
2469 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
2470 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.])
2474 dnl The encoder needs obj_int_extract to get asm offsets.
2475 fi # COMPILE_ENVIRONMENT and others
2478 if test -n "$GNU_AS" ; then
2479 dnl These flags are a lie; they're just used to enable the requisite
2480 dnl opcodes; actual arch detection is done at runtime.
2481 VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
2482 VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/libvpx/build/make/ads2gas.pl'
2484 dnl Building with -mfpu=neon requires either the "softfp" or the
2485 dnl "hardfp" ABI. Depending on the compiler's default target, and the
2486 dnl CFLAGS, the default ABI might be neither, in which case it is the
2487 dnl "softfloat" ABI.
2488 dnl The "softfloat" ABI is binary-compatible with the "softfp" ABI, so
2489 dnl we can safely mix code built with both ABIs. So, if we detect
2490 dnl that compiling uses the "softfloat" ABI, force the use of the
2491 dnl "softfp" ABI instead.
2492 dnl Confusingly, the __SOFTFP__ preprocessor variable indicates the
2493 dnl "softfloat" ABI, not the "softfp" ABI.
2494 dnl Note: VPX_ASFLAGS is also used in CFLAGS.
2497 #error "compiler target supports -mfpu=neon, so we don't have to add extra flags"
2499 VPX_ASFLAGS="$VPX_ASFLAGS -mfloat-abi=softfp"
2504 if $CC -E -dM -</dev/null | grep -q __ELF__; then
2510 if $CC -E -dM -</dev/null | grep -q __ELF__; then
2517 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_USE_YASM" -a -z "$YASM"; then
2518 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.])
2519 fi # COMPILE_ENVIRONMENT and others
2521 if test -n "$VPX_USE_YASM" && test "$OS_ARCH:$CPU_ARCH" != "WINNT:x86_64"; then
2525 if test -n "$VPX_X86_ASM"; then
2526 AC_DEFINE(VPX_X86_ASM)
2527 elif test -n "$VPX_ARM_ASM"; then
2528 AC_DEFINE(VPX_ARM_ASM)
2530 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
2533 dnl native libvpx no longer has vpx_mem_set_functions
2534 AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
2537 dnl ========================================================
2538 dnl = Handle dependent MEDIA defines
2539 dnl ========================================================
2542 AC_DEFINE(MOZ_WEBM_ENCODER)
2543 AC_SUBST(MOZ_WEBM_ENCODER)
2545 dnl ========================================================
2547 dnl ========================================================
2549 MOZ_ARG_DISABLE_BOOL(negotiateauth,
2550 [ --disable-negotiateauth Disable GSS-API negotiation ],
2551 MOZ_AUTH_EXTENSION=,
2552 MOZ_AUTH_EXTENSION=1 )
2554 if test -n "$MOZ_IOS" -a -n "$MOZ_AUTH_EXTENSION"; then
2555 AC_MSG_ERROR([negotiateauth is not supported on iOS.])
2558 dnl ========================================================
2559 dnl Pref extensions (autoconfig)
2560 dnl ========================================================
2561 MOZ_ARG_DISABLE_BOOL(pref-extensions,
2562 [ --disable-pref-extensions
2563 Disable pref extensions such as autoconfig],
2564 MOZ_PREF_EXTENSIONS=,
2565 MOZ_PREF_EXTENSIONS=1 )
2567 dnl ========================================================
2568 dnl Searching of system directories for extensions.
2569 dnl Note: this switch is meant to be used for test builds
2570 dnl whose behavior should not depend on what happens to be
2571 dnl installed on the local machine.
2572 dnl ========================================================
2573 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
2574 [ --disable-system-extension-dirs
2575 Disable searching system- and account-global
2576 directories for extensions of any kind; use
2577 only profile-specific extension directories],
2578 ENABLE_SYSTEM_EXTENSION_DIRS=,
2579 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
2580 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
2581 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
2584 dnl ========================================================
2585 dnl = Universalchardet
2586 dnl ========================================================
2587 MOZ_ARG_DISABLE_BOOL(universalchardet,
2588 [ --disable-universalchardet
2589 Disable universal encoding detection],
2590 MOZ_UNIVERSALCHARDET=,
2591 MOZ_UNIVERSALCHARDET=1 )
2593 dnl ========================================================
2594 dnl = ANGLE OpenGL->D3D translator for WebGL
2595 dnl = * only applies to win32 (and then, not MINGW)
2596 dnl ========================================================
2600 MOZ_HAS_WINSDK_WITH_D3D=
2601 MOZ_D3DCOMPILER_VISTA_DLL=
2602 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
2604 if test "$COMPILE_ENVIRONMENT" ; then
2605 case "$target_os" in
2607 MOZ_ANGLE_RENDERER=1
2611 # The DirectX SDK libraries are split into x86 and x64 sub-directories
2612 case "${target_cpu}" in
2614 MOZ_D3D_CPU_SUFFIX=x86
2617 MOZ_D3D_CPU_SUFFIX=x64
2621 dnl ========================================================
2622 dnl D3D compiler DLL
2623 dnl ========================================================
2624 MOZ_FOUND_D3D_COMPILERS=
2626 if test -n "$MOZ_ANGLE_RENDERER"; then
2627 if test -z "$MOZ_D3D_CPU_SUFFIX"; then
2628 AC_MSG_ERROR([Couldn't determine MOZ_D3D_CPU_SUFFIX.])
2631 ######################################
2632 # Find _46+ for use by Vista+.
2634 # Find a D3D compiler DLL in a Windows SDK.
2635 MOZ_D3DCOMPILER_VISTA_DLL=
2636 case "$MOZ_WINSDK_MAXVER" in
2638 MOZ_D3DCOMPILER_VISTA_DLL=d3dcompiler_47.dll
2639 AC_MSG_RESULT([Found D3D compiler in Windows SDK.])
2643 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
2644 # We have a name, now track down the path.
2645 if test -n "$WINDOWSSDKDIR"; then
2646 MOZ_D3DCOMPILER_VISTA_DLL_PATH="$WINDOWSSDKDIR/Redist/D3D/$MOZ_D3D_CPU_SUFFIX/$MOZ_D3DCOMPILER_VISTA_DLL"
2647 if test -f "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
2648 AC_MSG_RESULT([Found MOZ_D3DCOMPILER_VISTA_DLL_PATH: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
2649 MOZ_HAS_WINSDK_WITH_D3D=1
2651 AC_MSG_RESULT([MOZ_D3DCOMPILER_VISTA_DLL_PATH doesn't exist: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
2652 AC_MSG_ERROR([Windows SDK at "$WINDOWSSDKDIR" appears broken. Try updating to MozillaBuild 1.9 final or higher.])
2653 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
2656 AC_MSG_RESULT([Windows SDK not found.])
2659 if test "$OS_ARCH" = "$HOST_OS_ARCH"; then
2660 AC_MSG_ERROR([Couldn't find Windows SDK 8.1 or higher needed for ANGLE.])
2662 AC_MSG_RESULT([Windows SDK not needed for ANGLE in Linux MinGW build.])
2666 if test -z "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
2667 MOZ_D3DCOMPILER_VISTA_DLL=
2670 # On mingw, check if headers are provided by toolchain.
2671 if test -n "$GNU_CC"; then
2672 MOZ_CHECK_HEADER(d3d10.h, MOZ_HAS_WINSDK_WITH_D3D=1)
2675 ######################################
2676 # Check that we found what we needed.
2677 MOZ_FOUND_A_D3D_COMPILER=
2679 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
2680 MOZ_FOUND_A_D3D_COMPILER=1
2681 AC_MSG_RESULT([Found d3dcompiler DLL for Vista+: $MOZ_D3DCOMPILER_VISTA_DLL])
2684 if test -z "$CROSS_COMPILE"; then
2685 if test -z "MOZ_FOUND_A_D3D_COMPILER"; then
2686 AC_MSG_ERROR([Couldn't find an acceptable D3D compiler DLL.])
2689 fi # MOZ_ANGLE_RENDERER
2691 dnl ========================================================
2693 dnl ========================================================
2695 dnl Moved gamepad platform check to moz.build, linux header check still needed here.
2696 if test "$OS_TARGET" = "Linux"; then
2697 MOZ_CHECK_HEADER([linux/joystick.h])
2698 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
2699 AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
2703 fi # COMPILE_ENVIRONMENT
2706 dnl ========================================================
2707 dnl = Breakpad crash reporting (on by default on supported platforms)
2708 dnl ========================================================
2711 i?86-*-mingw*|x86_64-*-mingw*)
2714 i?86-apple-darwin*|x86_64-apple-darwin*)
2715 if test -z "$MOZ_IOS"; then
2719 *-android*|*-linuxandroid*)
2720 dnl Android/arm is arm-unknown-linux-androideabi, so android condition should
2721 dnl be before Linux condition
2724 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
2725 if test "$MOZ_ENABLE_GTK"; then
2731 MOZ_ARG_DISABLE_BOOL(crashreporter,
2732 [ --disable-crashreporter Disable breakpad crash reporting],
2733 [MOZ_CRASHREPORTER=],
2734 [MOZ_CRASHREPORTER=F # Force enable breakpad])
2736 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin"; then
2737 if test "$MOZ_CRASHREPORTER" = F; then
2738 AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
2743 if test -n "$MOZ_CRASHREPORTER"; then
2744 AC_DEFINE(MOZ_CRASHREPORTER)
2746 if test "$OS_TARGET" = "Linux" && \
2747 test -z "$SKIP_LIBRARY_CHECKS"; then
2748 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
2751 if test "$OS_ARCH" = "WINNT"; then
2752 if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
2753 MOZ_CRASHREPORTER_INJECTOR=1
2754 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
2759 dnl ========================================================
2760 dnl = libjpeg-turbo configuration
2761 dnl ========================================================
2763 LIBJPEG_TURBO_USE_YASM=
2764 if test -z "$MOZ_SYSTEM_JPEG"; then
2768 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
2769 [ --disable-libjpeg-turbo Disable optimized jpeg decoding routines],
2771 MOZ_LIBJPEG_TURBO=1)
2773 if test "$MOZ_SYSTEM_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
2774 AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
2777 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
2780 if test -n "$MOZ_LIBJPEG_TURBO" -a -n "$COMPILE_ENVIRONMENT"; then
2782 dnl Do we support libjpeg-turbo on this platform?
2783 case "$OS_ARCH:$CPU_ARCH" in
2785 LIBJPEG_TURBO_ASFLAGS="-DPIC -DMACHO"
2788 LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DMACHO"
2793 LIBJPEG_TURBO_ASFLAGS="-DPIC -DWIN32"
2796 LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DWIN64 -DMSVC"
2801 LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
2804 LIBJPEG_TURBO_ASFLAGS="-march=armv8-a"
2807 LIBJPEG_TURBO_ASFLAGS="-mdspr2"
2810 if $CC -E -dM -</dev/null | grep -q __ELF__; then
2811 LIBJPEG_TURBO_ASFLAGS="-DPIC -DELF"
2815 if $CC -E -dM -</dev/null | grep -q __ELF__; then
2816 LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DELF"
2822 if test -n "$LIBJPEG_TURBO_ASFLAGS"; then
2824 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
2825 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
2826 dnl it doesn't exist or we have too old of a version.
2828 LIBJPEG_TURBO_USE_YASM=1
2830 if test -z "$YASM" ; then
2831 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.])
2834 dnl Check that we have the right yasm version. We require 1.0.1 or newer
2835 dnl on Linux and 1.1 or newer everywhere else.
2836 if test "$OS_ARCH" = "Linux" ; then
2837 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
2838 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.])
2841 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
2842 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.])
2849 dnl ========================================================
2850 dnl = libav-fft configuration
2851 dnl ========================================================
2855 dnl Turn on libav-fft for 32-bit windows, and all 64-bit supported platforms.
2856 dnl 32-bit linux/os x have text relocation issues.
2858 case "$OS_ARCH:$CPU_ARCH" in
2867 dnl Detect if we can use yasm to compile libav's assembly
2869 if test -n "$MOZ_LIBAV_FFT" -a -n "$COMPILE_ENVIRONMENT"; then
2870 AC_DEFINE(MOZ_LIBAV_FFT)
2871 dnl Do we support libav-fft on this platform?
2872 case "$OS_ARCH:$CPU_ARCH" in
2874 LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DMACHO"
2877 LIBAV_FFT_ASFLAGS="-DPIC -DWIN32"
2880 LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DWIN64 -DMSVC"
2883 if $CC -E -dM -</dev/null | grep -q __ELF__; then
2884 LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DELF"
2888 AC_MSG_ERROR([libav's FFT routines are only available for 32-bit windows or 64-bit x86 based platforms.])
2893 if test -n "$LIBAV_FFT_ASFLAGS"; then
2894 dnl If we're on an x86 or x64 system which supports libav-fft's asm routines
2895 dnl check for Yasm, and error out if it doesn't exist or we have too old of a
2897 if test -z "$YASM" ; then
2898 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.])
2900 dnl Check that we have the right yasm version. We require 1.0.1 or newer
2901 dnl on Linux and 1.1 or newer everywhere else.
2902 if test "$OS_ARCH" = "Linux" ; then
2903 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
2904 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.])
2907 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
2908 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.])
2911 elif test -n "$MOZ_LIBAV_FFT" -a "${CPU_ARCH}" != "arm"; then
2912 dnl Warn if we're not building either libav or opendl-max optimized routines.
2913 AC_MSG_WARN([No assembler or assembly support for libav-fft. Using unoptimized C routines.])
2916 dnl ========================================================
2917 dnl = FFmpeg's ffvpx configuration
2918 dnl ========================================================
2925 dnl Use same conditional as MOZ_LIBAV_FFT to enable FFmpeg's ffvpx assembly decoder.
2926 if test -n "$LIBAV_FFT_ASFLAGS"; then
2927 FFVPX_ASFLAGS=$LIBAV_FFT_ASFLAGS
2929 dnl On x86 system with assembly optimizations disabled, the ffvp9 and
2930 dnl ffvp8 decoders give worse performance than libvpx ones. So we only
2931 dnl enable the FFmpeg FLAC decoder on those machines.
2932 MOZ_FFVPX_FLACONLY=1
2936 case "$OS_TARGET" in
2938 dnl don't set up anything special
2942 MOZ_FFVPX_FLACONLY=1
2943 dnl Use same conditional as MOZ_LIBVPX to enable FFmpeg's ffvpx assembly decoder.
2944 dnl aarch 64 FLAC decoder for now will be C only.
2945 FFVPX_ASFLAGS=$VPX_ASFLAGS
2951 if test -n "$MOZ_FFVPX"; then
2952 AC_DEFINE(MOZ_FFVPX)
2954 if test -n "$MOZ_FFVPX_FLACONLY"; then
2955 AC_DEFINE(MOZ_FFVPX_FLACONLY)
2958 dnl ========================================================
2959 dnl = Enable compilation of specific extension modules
2960 dnl ========================================================
2962 MOZ_ARG_ENABLE_STRING(extensions,
2963 [ --enable-extensions Enable extensions],
2964 [ for option in `echo $enableval | sed 's/,/ /g'`; do
2965 if test "$option" = "yes" -o "$option" = "all"; then
2966 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
2967 elif test "$option" = "no" -o "$option" = "none"; then
2969 elif test "$option" = "default"; then
2970 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
2971 elif test `echo "$option" | grep -c \^-` != 0; then
2972 option=`echo $option | sed 's/^-//'`
2973 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
2975 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
2978 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
2980 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
2981 dnl when trying to build a nonexistent extension.
2982 for extension in $MOZ_EXTENSIONS; do
2983 if test ! -d "${srcdir}/extensions/${extension}"; then
2984 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
2988 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
2989 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
2992 # Avoid defining MOZ_ENABLE_CAIRO_FT on Windows platforms because
2993 # "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
2994 if test -n "$MOZ_TREE_FREETYPE" -a "$OS_TARGET" != WINNT; then
2995 MOZ_ENABLE_CAIRO_FT=1
2996 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2997 CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
2998 AC_SUBST_LIST(CAIRO_FT_CFLAGS)
3001 AC_CHECK_PROGS(WGET, wget, "")
3004 dnl ========================================================
3005 dnl Maintenance Service
3006 dnl ========================================================
3008 MOZ_ARG_ENABLE_BOOL(maintenance-service,
3009 [ --enable-maintenance-service Enable building of maintenanceservice],
3010 MOZ_MAINTENANCE_SERVICE=1,
3011 MOZ_MAINTENANCE_SERVICE= )
3013 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
3014 if test "$OS_ARCH" = "WINNT"; then
3015 AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
3017 AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
3021 dnl ========================================================
3022 dnl Bundled fonts on desktop platforms
3023 dnl ========================================================
3025 MOZ_ARG_ENABLE_BOOL(bundled-fonts,
3026 [ --enable-bundled-fonts Enable support for bundled fonts on desktop platforms],
3027 MOZ_BUNDLED_FONTS=1,
3030 if test -n "$MOZ_BUNDLED_FONTS"; then
3031 AC_DEFINE(MOZ_BUNDLED_FONTS)
3034 dnl ========================================================
3035 dnl Verify MAR signatures
3036 dnl ========================================================
3038 MOZ_ARG_ENABLE_BOOL(verify-mar,
3039 [ --enable-verify-mar Enable verifying MAR signatures],
3040 MOZ_VERIFY_MAR_SIGNATURE=1,
3041 MOZ_VERIFY_MAR_SIGNATURE= )
3043 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
3044 AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
3047 dnl ========================================================
3048 dnl Enable building the signmar program.
3049 dnl This option is much different than the --enable-verify-mar option.
3050 dnl --enable-verify-mar is for enabling the verification check on MAR
3051 dnl files in the updater. The --enable-signmar option is for building
3052 dnl the signmar program.
3053 dnl ========================================================
3055 MOZ_ARG_ENABLE_BOOL(signmar,
3056 [ --enable-signmar Enable building the signmar program],
3057 MOZ_ENABLE_SIGNMAR=1,
3058 MOZ_ENABLE_SIGNMAR= )
3060 if test -n "$MOZ_ENABLE_SIGNMAR"; then
3061 if test -z "$COMPILE_ENVIRONMENT" ; then
3062 AC_MSG_WARN([Cannot --enable-signmar with --disable-compile-environment])
3065 AC_DEFINE(MOZ_ENABLE_SIGNMAR)
3069 dnl ========================================================
3071 dnl ========================================================
3073 if test "$MOZ_IOS"; then
3077 MOZ_ARG_DISABLE_BOOL(updater,
3078 [ --disable-updater Disable building of updater],
3082 if test -n "$MOZ_UPDATER"; then
3083 AC_DEFINE(MOZ_UPDATER)
3086 dnl ========================================================
3087 dnl parental controls (for Windows Vista)
3088 dnl ========================================================
3089 MOZ_ARG_DISABLE_BOOL(parental-controls,
3090 [ --disable-parental-controls
3091 Do not build parental controls],
3092 MOZ_DISABLE_PARENTAL_CONTROLS=1,
3093 MOZ_DISABLE_PARENTAL_CONTROLS=)
3094 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
3095 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
3098 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
3100 dnl ========================================================
3101 dnl = Disable smartcard support
3102 dnl ========================================================
3103 if test -n "$MOZ_NO_SMART_CARDS"; then
3104 AC_DEFINE(MOZ_NO_SMART_CARDS)
3106 AC_SUBST(MOZ_NO_SMART_CARDS)
3108 dnl ========================================================
3109 dnl = Sandboxing support
3110 dnl ========================================================
3111 if test -n "$MOZ_TSAN" -o -n "$MOZ_ASAN"; then
3112 # Bug 1182565: TSan conflicts with sandboxing on Linux.
3113 # Bug 1287971: LSan also conflicts with sandboxing on Linux.
3121 case "$OS_TARGET:$CPU_ARCH" in
3123 # No sandbox support on AArch64 Windows.
3128 MOZ_ARG_DISABLE_BOOL(sandbox,
3129 [ --disable-sandbox Disable sandboxing support],
3133 dnl ========================================================
3134 dnl = Content process sandboxing
3135 dnl ========================================================
3137 case "$OS_TARGET" in
3139 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3142 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3147 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3153 MOZ_ARG_ENABLE_BOOL(content-sandbox,
3154 [ --enable-content-sandbox Enable sandboxing support for content-processes
3155 --disable-content-sandbox Disable sandboxing support for content-processes],
3156 MOZ_CONTENT_SANDBOX=1,
3157 MOZ_CONTENT_SANDBOX=)
3159 if test -n "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_SANDBOX"; then
3160 AC_MSG_ERROR([--enable-content-sandbox and --disable-sandbox are conflicting options])
3163 if test -n "$MOZ_CONTENT_SANDBOX"; then
3164 AC_DEFINE(MOZ_CONTENT_SANDBOX)
3167 AC_SUBST(MOZ_CONTENT_SANDBOX)
3169 dnl ========================================================
3170 dnl = Gecko Media Plugin sandboxing
3171 dnl ========================================================
3174 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3179 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3184 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3188 if test -n "$MOZ_GMP_SANDBOX"; then
3189 AC_DEFINE(MOZ_GMP_SANDBOX)
3192 AC_SUBST(MOZ_GMP_SANDBOX)
3194 if test -z "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_GMP_SANDBOX"; then
3198 if test -n "$MOZ_SANDBOX"; then
3199 AC_DEFINE(MOZ_SANDBOX)
3202 AC_SUBST(MOZ_SANDBOX)
3205 dnl ========================================================
3207 dnl = Module specific options
3209 dnl ========================================================
3210 MOZ_ARG_HEADER(Individual module options)
3212 dnl ========================================================
3213 dnl = Disable feed handling components
3214 dnl ========================================================
3215 MOZ_ARG_DISABLE_BOOL(feeds,
3216 [ --disable-feeds Disable feed handling and processing components],
3219 if test -n "$MOZ_FEEDS"; then
3220 AC_DEFINE(MOZ_FEEDS)
3222 if test "$MOZ_BUILD_APP" = "browser"; then
3223 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
3227 dnl ========================================================
3228 dnl Check for sqlite
3229 dnl ========================================================
3232 MOZ_ARG_ENABLE_BOOL(system-sqlite,
3233 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
3234 MOZ_SYSTEM_SQLITE=1,
3235 MOZ_SYSTEM_SQLITE= )
3237 if test -n "$MOZ_SYSTEM_SQLITE"
3239 dnl ============================
3240 dnl === SQLite Version check ===
3241 dnl ============================
3242 dnl Check to see if the system SQLite package is new enough.
3243 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
3245 dnl ==================================
3246 dnl === SQLITE_SECURE_DELETE check ===
3247 dnl ==================================
3248 dnl Check to see if the system SQLite package is compiled with
3249 dnl SQLITE_SECURE_DELETE enabled.
3250 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
3251 _SAVE_CFLAGS="$CFLAGS"
3252 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3254 LIBS="$LIBS $SQLITE_LIBS"
3255 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
3257 #include "sqlite3.h"
3259 int main(int argc, char **argv){
3260 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
3262 ac_cv_sqlite_secure_delete=yes,
3263 ac_cv_sqlite_secure_delete=no,
3264 ac_cv_sqlite_secure_delete=no
3267 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
3268 CFLAGS="$_SAVE_CFLAGS"
3270 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
3271 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
3274 dnl ===============================
3275 dnl === SQLITE_THREADSAFE check ===
3276 dnl ===============================
3277 dnl Check to see if the system SQLite package is compiled with
3278 dnl SQLITE_THREADSAFE enabled.
3279 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
3280 _SAVE_CFLAGS="$CFLAGS"
3281 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3283 LIBS="$LIBS $SQLITE_LIBS"
3284 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
3286 #include "sqlite3.h"
3288 int main(int argc, char **argv){
3289 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
3291 ac_cv_sqlite_threadsafe=yes,
3292 ac_cv_sqlite_threadsafe=no,
3293 ac_cv_sqlite_threadsafe=no
3296 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
3297 CFLAGS="$_SAVE_CFLAGS"
3299 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
3300 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
3303 dnl ================================
3304 dnl === SQLITE_ENABLE_FTS3 check ===
3305 dnl ================================
3306 dnl check to see if the system SQLite package is compiled with
3307 dnl SQLITE_ENABLE_FTS3 enabled.
3308 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
3309 _SAVE_CFLAGS="$CFLAGS"
3310 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3312 LIBS="$LIBS $SQLITE_LIBS"
3313 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
3315 #include "sqlite3.h"
3317 int main(int argc, char **argv){
3318 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
3320 ac_cv_sqlite_enable_fts3=yes,
3321 ac_cv_sqlite_enable_fts3=no,
3322 ac_cv_sqlite_enable_fts3=no
3325 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
3326 CFLAGS="$_SAVE_CFLAGS"
3328 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
3329 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
3332 dnl =========================================
3333 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
3334 dnl =========================================
3335 dnl check to see if the system SQLite package is compiled with
3336 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
3337 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
3338 _SAVE_CFLAGS="$CFLAGS"
3339 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3341 LIBS="$LIBS $SQLITE_LIBS"
3342 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
3344 #include "sqlite3.h"
3346 int main(int argc, char **argv){
3347 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
3349 ac_cv_sqlite_enable_unlock_notify=yes,
3350 ac_cv_sqlite_enable_unlock_notify=no,
3351 ac_cv_sqlite_enable_unlock_notify=no
3354 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
3355 CFLAGS="$_SAVE_CFLAGS"
3357 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
3358 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
3361 dnl =========================================
3362 dnl === SQLITE_ENABLE_DBSTAT_VTAB check ===
3363 dnl =========================================
3364 dnl check to see if the system SQLite package is compiled with
3365 dnl SQLITE_ENABLE_DBSTAT_VTAB.
3366 AC_MSG_CHECKING(for SQLITE_ENABLE_DBSTAT_VTAB support in system SQLite)
3367 _SAVE_CFLAGS="$CFLAGS"
3368 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3370 LIBS="$LIBS $SQLITE_LIBS"
3371 AC_CACHE_VAL(ac_cv_sqlite_dbstat_vtab,[
3373 #include "sqlite3.h"
3375 int main(int argc, char **argv){
3376 return !sqlite3_compileoption_used("SQLITE_ENABLE_DBSTAT_VTAB");
3378 ac_cv_sqlite_dbstat_vtab=yes,
3379 ac_cv_sqlite_dbstat_vtab=no,
3380 ac_cv_sqlite_dbstat_vtab=no
3383 AC_MSG_RESULT($ac_cv_sqlite_dbstat_vtab)
3384 CFLAGS="$_SAVE_CFLAGS"
3386 if test "x$ac_cv_sqlite_dbstat_vtab" = "xno"; then
3387 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_DBSTAT_VTAB.])
3390 dnl ==============================
3391 dnl === SQLite fdatasync check ===
3392 dnl ==============================
3393 dnl Check to see if fdatasync is available
3394 AC_CHECK_FUNC(fdatasync)
3397 if test -n "$MOZ_SYSTEM_SQLITE"; then
3398 AC_DEFINE(MOZ_SYSTEM_SQLITE)
3400 AC_SUBST(MOZ_SYSTEM_SQLITE)
3402 dnl ========================================================
3403 dnl = Disable zipwriter
3404 dnl ========================================================
3405 MOZ_ARG_DISABLE_BOOL(zipwriter,
3406 [ --disable-zipwriter Disable zipwriter component],
3409 AC_SUBST(MOZ_ZIPWRITER)
3411 dnl ========================================================
3413 dnl = Feature options that require extra sources to be pulled
3415 dnl ========================================================
3416 dnl MOZ_ARG_HEADER(Features that require extra sources)
3418 dnl ========================================================
3420 dnl = Runtime debugging and Optimization Options
3422 dnl ========================================================
3423 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
3425 dnl ========================================================
3426 dnl enable mobile optimizations
3427 dnl ========================================================
3428 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
3429 [ --enable-mobile-optimize
3430 Enable mobile optimizations],
3431 MOZ_GFX_OPTIMIZE_MOBILE=1)
3433 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
3435 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
3436 # We ignore paint will resample on mobile for performance.
3437 # We may want to revisit this later.
3438 MOZ_IGNORE_PAINT_WILL_RESAMPLE=1
3440 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
3441 AC_DEFINE(MOZ_IGNORE_PAINT_WILL_RESAMPLE)
3444 dnl ========================================================
3445 dnl = Enable code optimization. ON by default.
3446 dnl ========================================================
3448 # Use value from moz.configure if one is defined. Else use our computed
3450 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
3451 MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
3454 MOZ_SET_FRAMEPTR_FLAGS
3456 if test "$COMPILE_ENVIRONMENT"; then
3457 if test -n "$MOZ_OPTIMIZE"; then
3458 AC_MSG_CHECKING([for valid C compiler optimization flags])
3459 _SAVE_CFLAGS=$CFLAGS
3460 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
3461 AC_TRY_COMPILE([#include <stdio.h>],
3462 [printf("Hello World\n");],
3465 AC_MSG_RESULT([$_results])
3466 if test "$_results" = "no"; then
3467 AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
3469 CFLAGS=$_SAVE_CFLAGS
3470 if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
3471 # When using llvm-based LTO, non numeric optimization levels are
3472 # not supported by the linker, so force the linker to use -O2 (
3473 # which doesn't influence the level compilation units are actually
3475 case " $MOZ_OPTIMIZE_FLAGS " in
3476 *\ -Os\ *|*\ -Oz\ *)
3477 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
3482 fi # COMPILE_ENVIRONMENT
3484 AC_SUBST_LIST(MOZ_FRAMEPTR_FLAGS)
3485 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
3486 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
3487 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
3489 dnl ========================================================
3490 dnl = Disable treating compiler warnings as errors
3491 dnl ========================================================
3492 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
3493 WARNINGS_AS_ERRORS=''
3496 dnl ========================================================
3497 dnl = Enable runtime logging
3498 dnl ========================================================
3499 AC_DEFINE(MOZ_LOGGING)
3500 AC_DEFINE(FORCE_PR_LOG)
3502 dnl ========================================================
3503 dnl = This will enable logging of addref, release, ctor, dtor.
3504 dnl ========================================================
3505 _ENABLE_LOGREFCNT=42
3506 MOZ_ARG_ENABLE_BOOL(logrefcnt,
3507 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
3508 _ENABLE_LOGREFCNT=1,
3509 _ENABLE_LOGREFCNT= )
3510 if test "$_ENABLE_LOGREFCNT" = "1"; then
3511 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
3512 elif test -z "$_ENABLE_LOGREFCNT"; then
3513 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
3516 dnl ========================================================
3517 dnl moz_dump_painting
3518 dnl ========================================================
3519 MOZ_ARG_ENABLE_BOOL(dump-painting,
3520 [ --enable-dump-painting Enable paint debugging.],
3521 MOZ_DUMP_PAINTING=1,
3522 MOZ_DUMP_PAINTING= )
3523 if test -n "$MOZ_DUMP_PAINTING"; then
3524 AC_DEFINE(MOZ_DUMP_PAINTING)
3525 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
3527 if test -n "$MOZ_DEBUG"; then
3528 AC_DEFINE(MOZ_DUMP_PAINTING)
3531 case "${OS_TARGET}" in
3532 Android|WINNT|Darwin)
3533 MOZ_GLUE_IN_PROGRAM=
3536 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
3537 MOZ_GLUE_IN_PROGRAM=1
3538 AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
3542 dnl ========================================================
3543 dnl = Jemalloc build setup
3544 dnl ========================================================
3545 if test -z "$MOZ_MEMORY"; then
3548 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
3549 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.])
3554 dnl The generic feature tests that determine how to compute ncpus are long and
3555 dnl complicated. Therefore, simply define special cpp variables for the
3556 dnl platforms we have special knowledge of.
3559 export MOZ_NO_DEBUG_RTL=1
3563 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
3565 # Allow the application to provide a subconfigure script.
3566 # This should be after 'export MOZ_NO_DEBUG_RTL=1' since
3567 # ldap/c-sdk/configure refers to the enviroment value.
3568 if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
3569 do_output_subdirs() {
3570 if test -n "$_subconfigure_subdirs"; then
3571 AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
3573 _subconfigure_subdir="$1"
3574 _subconfigure_config_args="$ac_configure_args"
3576 tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
3577 m4 "${srcdir}/build/autoconf/subconfigure.m4" \
3578 "${srcdir}/build/autoconf/altoptions.m4" \
3579 "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
3584 AC_SUBST_LIST(MOZ_GLUE_WRAP_LDFLAGS)
3585 export MOZ_GLUE_WRAP_LDFLAGS
3587 dnl ========================================================
3588 dnl = Enable using the clang plugin to build
3589 dnl ========================================================
3591 if test -n "$COMPILE_ENVIRONMENT"; then
3592 MOZ_CONFIG_CLANG_PLUGIN
3593 fi # COMPILE_ENVIRONMENT
3595 dnl ========================================================
3596 dnl = Enable stripping of libs & executables
3597 dnl ========================================================
3598 MOZ_ARG_ENABLE_BOOL(strip,
3599 [ --enable-strip Enable stripping of libs & executables ],
3603 dnl ========================================================
3604 dnl = Enable stripping of libs & executables when packaging
3605 dnl ========================================================
3606 MOZ_ARG_ENABLE_BOOL(install-strip,
3607 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
3611 dnl ========================================================
3612 dnl = frontend JS debug mode
3613 dnl ========================================================
3615 MOZ_ARG_ENABLE_BOOL(debug-js-modules,
3616 [ --enable-debug-js-modules Enable debug mode for frontend JS libraries],
3620 AC_SUBST(DEBUG_JS_MODULES)
3622 dnl ========================================================
3624 dnl = Profiling and Instrumenting
3626 dnl ========================================================
3627 MOZ_ARG_HEADER(Profiling and Instrumenting)
3629 dnl ========================================================
3630 dnl = Enable TaskTracer
3631 dnl ========================================================
3632 MOZ_ARG_ENABLE_BOOL(tasktracer,
3633 [ --enable-tasktracer Set compile flags necessary for using TaskTracer],
3636 if test -n "$MOZ_TASK_TRACER"; then
3637 AC_DEFINE(MOZ_TASK_TRACER)
3638 AC_SUBST(MOZ_TASK_TRACER)
3641 dnl ========================================================
3642 dnl Turn on reflow counting
3643 dnl ========================================================
3644 MOZ_ARG_ENABLE_BOOL(reflow-perf,
3645 [ --enable-reflow-perf Enable reflow performance tracing],
3648 if test -n "$MOZ_REFLOW_PERF"; then
3649 AC_DEFINE(MOZ_REFLOW_PERF)
3652 dnl ========================================================
3653 dnl = Offer a way to disable the startup cache
3654 dnl ========================================================
3656 MOZ_ARG_DISABLE_BOOL(startupcache,
3657 [ --disable-startupcache Disable startup cache ],
3658 MOZ_DISABLE_STARTUPCACHE=1,
3659 MOZ_DISABLE_STARTUPCACHE=)
3661 if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
3662 AC_DEFINE(MOZ_DISABLE_STARTUPCACHE)
3664 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
3666 dnl ========================================================
3667 dnl = Support for demangling undefined symbols
3668 dnl ========================================================
3669 if test -z "$SKIP_LIBRARY_CHECKS"; then
3672 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
3676 # Demangle only for debug or DMD builds
3677 MOZ_DEMANGLE_SYMBOLS=
3678 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
3679 MOZ_DEMANGLE_SYMBOLS=1
3680 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
3682 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
3684 dnl ========================================================
3685 dnl = Support for gcc stack unwinding (from gcc 3.3)
3686 dnl ========================================================
3687 if test -z "$SKIP_LIBRARY_CHECKS"; then
3690 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
3694 dnl ========================================================
3696 dnl ========================================================
3698 MOZ_ARG_WITH_STRING(jitreport-granularity,
3699 [ --jitreport-granularity=N
3700 Default granularity at which to report JIT code
3703 1 - code ranges for whole functions only
3704 2 - per-line information
3705 3 - per-op information],
3706 JITREPORT_GRANULARITY=$withval,
3707 JITREPORT_GRANULARITY=3)
3709 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
3711 dnl ========================================================
3715 dnl ========================================================
3716 MOZ_ARG_HEADER(Misc. Options)
3718 dnl ========================================================
3719 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
3720 dnl ========================================================
3721 MOZ_ARG_WITH_STRING(user-appdir,
3722 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
3723 [ val=`echo $withval`
3724 if echo "$val" | grep "\/" >/dev/null; then
3725 AC_MSG_ERROR("Homedir must be single relative path.")
3730 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
3732 if test -z "$SKIP_COMPILER_CHECKS"; then
3733 dnl ========================================================
3735 dnl = Compiler Options
3737 dnl ========================================================
3738 MOZ_ARG_HEADER(Compiler Options)
3740 dnl ========================================================
3741 dnl Check for gcc -pipe support
3742 dnl ========================================================
3743 AC_MSG_CHECKING([for -pipe support])
3744 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
3745 dnl Any gcc that supports firefox supports -pipe.
3746 CFLAGS="$CFLAGS -pipe"
3747 CXXFLAGS="$CXXFLAGS -pipe"
3748 AC_MSG_RESULT([yes])
3753 fi # ! SKIP_COMPILER_CHECKS
3755 AC_DEFINE(CPP_THROW_NEW, [throw()])
3758 if test "$COMPILE_ENVIRONMENT"; then
3760 fi # COMPILE_ENVIRONMENT
3762 dnl ========================================================
3764 dnl = Build depencency options
3766 dnl ========================================================
3767 MOZ_ARG_HEADER(Build dependencies)
3769 if test "$COMPILE_ENVIRONMENT"; then
3770 if test "$GNU_CC" -a "$GNU_CXX"; then
3771 _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
3773 # clang-cl doesn't accept the normal -MD -MP -MF options that clang does, but
3774 # the underlying cc1 binary understands how to generate dependency files.
3775 # These options are based on analyzing what the normal clang driver sends to
3776 # cc1 when given the "correct" dependency options.
3777 if test -n "$CLANG_CL"; then
3778 _DEPEND_CFLAGS='-Xclang -MP -Xclang -dependency-file -Xclang $(MDDEPDIR)/$(@F).pp -Xclang -MT -Xclang $@'
3780 dnl Don't override this for MSVC
3781 if test -z "$_WIN32_MSVC"; then
3782 _USE_CPP_INCLUDE_FLAG=
3783 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
3784 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
3786 echo '#include <stdio.h>' > dummy-hello.c
3788 dnl This output is localized, split at the first double space or colon and space.
3789 _CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*\\\stdio.h\)$"
3790 CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'`
3791 _CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'`
3793 if ! test -e "$_CL_STDIO_PATH"; then
3794 AC_MSG_ERROR([Unable to parse cl -showIncludes prefix. This compiler's locale has an unsupported formatting.])
3796 if test -z "$CL_INCLUDES_PREFIX"; then
3797 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
3799 AC_SUBST(CL_INCLUDES_PREFIX)
3802 dnl Make sure that the build system can handle non-ASCII characters
3803 dnl in environment variables to prevent it from breaking silently on
3804 dnl non-English systems.
3805 NONASCII=$'\241\241'
3809 fi # COMPILE_ENVIRONMENT
3811 dnl ========================================================
3813 dnl = Static Build Options
3815 dnl ========================================================
3816 MOZ_ARG_HEADER(Static build options)
3818 if test -z "$MOZ_SYSTEM_ZLIB"; then
3819 if test -n "$JS_SHARED_LIBRARY" -o -n "$MOZ_LINKER"; then
3821 AC_DEFINE(ZLIB_IN_MOZGLUE)
3825 AC_SUBST(ZLIB_IN_MOZGLUE)
3827 dnl ========================================================
3829 dnl = Standalone module options
3831 dnl ========================================================
3832 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
3835 dnl ========================================================
3837 if test -z "$SKIP_PATH_CHECKS"; then
3838 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
3839 if test "$MOZ_ENABLE_GTK" ; then
3840 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
3845 if test -z "${GLIB_GMODULE_LIBS}" \
3846 -a -n "${GLIB_CONFIG}"\
3847 -a "${GLIB_CONFIG}" != no\
3849 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
3852 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
3854 if test "$USE_FC_FREETYPE"; then
3855 if test "$COMPILE_ENVIRONMENT"; then
3856 dnl ========================================================
3857 dnl = Check for freetype2 functionality
3858 dnl ========================================================
3859 if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
3861 _SAVE_CFLAGS="$CFLAGS"
3862 LIBS="$LIBS $FT2_LIBS"
3863 CFLAGS="$CFLAGS $FT2_CFLAGS"
3865 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3866 ac_cv_member_FT_Bitmap_Size_y_ppem,
3867 [AC_TRY_COMPILE([#include <ft2build.h>
3868 #include FT_FREETYPE_H],
3870 if (sizeof s.y_ppem) return 0;
3872 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3873 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3874 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3875 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3877 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3879 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3880 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3881 [FT_Bitmap_Size structure includes y_ppem field])
3883 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
3886 CFLAGS="$_SAVE_CFLAGS"
3889 _SAVE_CPPFLAGS="$CPPFLAGS"
3890 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
3891 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
3892 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
3893 CPPFLAGS="$_SAVE_CPPFLAGS"
3897 dnl ========================================================
3898 dnl Check if we need the 32-bit Linux SSE2 error dialog
3899 dnl ========================================================
3901 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
3903 dnl ========================================================
3904 dnl Check for pixman and cairo
3905 dnl ========================================================
3908 MOZ_ARG_ENABLE_BOOL(system-cairo,
3909 [ --enable-system-cairo Obsolete: do not use this option],
3910 AC_MSG_ERROR(--enable-system-cairo is not supported),
3914 MOZ_ARG_ENABLE_BOOL(system-pixman,
3915 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
3917 MOZ_TREE_PIXMAN=force,
3920 if test "$MOZ_TREE_PIXMAN"; then
3921 AC_DEFINE(MOZ_TREE_PIXMAN)
3923 PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.19.2)
3926 MOZ_CAIRO_CFLAGS="-I${DIST}/include/cairo"
3927 AC_DEFINE(MOZ_TREE_CAIRO)
3929 if test "$OS_ARCH" = "WINNT"; then
3930 # For now we assume that we will have a uint64_t available through
3931 # one of the above headers or mozstdint.h.
3932 AC_DEFINE(HAVE_UINT64_T)
3935 # Define macros for cairo-features.h
3936 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
3937 if test "$MOZ_X11"; then
3938 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
3939 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
3940 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
3942 if test "$_HAVE_FREETYPE2"; then
3943 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
3944 MOZ_ENABLE_CAIRO_FT=1
3945 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
3948 case "$MOZ_WIDGET_TOOLKIT" in
3950 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
3951 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
3952 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
3955 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
3956 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
3957 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
3958 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
3959 MOZ_ENABLE_D2D_SURFACE=1
3961 if test "$COMPILE_ENVIRONMENT"; then
3963 dnl D3D10 Layers depend on D2D Surfaces.
3964 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
3965 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
3970 if test "$USE_FC_FREETYPE"; then
3971 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
3973 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
3974 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
3975 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
3977 AC_SUBST(PS_SURFACE_FEATURE)
3978 AC_SUBST(SVG_SURFACE_FEATURE)
3979 AC_SUBST(XLIB_SURFACE_FEATURE)
3980 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
3981 AC_SUBST(QUARTZ_SURFACE_FEATURE)
3982 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
3983 AC_SUBST(WIN32_SURFACE_FEATURE)
3984 AC_SUBST(OS2_SURFACE_FEATURE)
3985 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
3986 AC_SUBST(FT_FONT_FEATURE)
3987 AC_SUBST(FC_FONT_FEATURE)
3988 AC_SUBST(WIN32_FONT_FEATURE)
3989 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
3990 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
3991 AC_SUBST(QUARTZ_FONT_FEATURE)
3992 AC_SUBST(PNG_FUNCTIONS_FEATURE)
3993 AC_SUBST(QT_SURFACE_FEATURE)
3994 AC_SUBST(TEE_SURFACE_FEATURE)
3996 if test "$MOZ_X11"; then
3997 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
4000 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
4002 case "$MOZ_WIDGET_TOOLKIT" in
4004 TK_CFLAGS="$MOZ_CAIRO_CFLAGS $MOZ_PIXMAN_CFLAGS"
4005 TK_LIBS="$MOZ_CAIRO_LIBS $MOZ_PIXMAN_LIBS"
4009 AC_SUBST(MOZ_TREE_CAIRO)
4010 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
4011 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
4012 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
4013 AC_SUBST(MOZ_TREE_PIXMAN)
4015 BINDGEN_SYSTEM_FLAGS="$_BINDGEN_CFLAGS $NSPR_CFLAGS $NSS_CFLAGS $MOZ_PIXMAN_CFLAGS $MOZ_CAIRO_CFLAGS"
4016 AC_SUBST_TOML_LIST(BINDGEN_SYSTEM_FLAGS)
4018 dnl ========================================================
4020 dnl ========================================================
4021 MOZ_ARG_DISABLE_BOOL(xul,
4022 [ --disable-xul Disable XUL],
4024 if test "$MOZ_XUL"; then
4027 dnl remove extensions that require XUL
4028 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
4033 dnl ========================================================
4034 dnl necko configuration options
4035 dnl ========================================================
4038 dnl option to disable necko's wifi scanner
4041 if test "$MOZ_WIDGET_TOOLKIT"; then
4043 case "$OS_TARGET" in
4045 if test -z "$MOZ_IOS"; then
4049 DragonFly|FreeBSD|WINNT)
4060 MOZ_ARG_DISABLE_BOOL(necko-wifi,
4061 [ --disable-necko-wifi Disable necko wifi scanner],
4065 if test "$NECKO_WIFI"; then
4066 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
4067 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
4069 AC_DEFINE(NECKO_WIFI)
4070 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
4072 AC_SUBST(NECKO_WIFI)
4073 AC_SUBST(NECKO_WIFI_DBUS)
4076 dnl option to disable cookies
4078 MOZ_ARG_DISABLE_BOOL(cookies,
4079 [ --disable-cookies Disable cookie support],
4082 AC_SUBST(NECKO_COOKIES)
4083 if test "$NECKO_COOKIES"; then
4084 AC_DEFINE(NECKO_COOKIES)
4085 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
4088 dnl ========================================================
4090 dnl = Maintainer debug option (no --enable equivalent)
4092 dnl ========================================================
4096 AC_SUBST(AR_EXTRACT)
4099 AC_SUBST_LIST(ASFLAGS)
4100 AC_SUBST(AS_DASH_C_FLAG)
4106 AC_SUBST(MOZ_AUTH_EXTENSION)
4107 AC_SUBST(MOZ_PREF_EXTENSIONS)
4108 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
4109 AC_SUBST(WARNINGS_AS_ERRORS)
4110 AC_SUBST_SET(MOZ_EXTENSIONS)
4111 AC_SUBST(MOZ_TOOLKIT_SEARCH)
4114 AC_SUBST(MOZ_UNIVERSALCHARDET)
4115 AC_SUBST(ACCESSIBILITY)
4116 AC_SUBST(MOZ_SPELLCHECK)
4117 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
4118 AC_SUBST(MOZ_CRASHREPORTER)
4119 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
4120 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
4121 AC_SUBST(MOZ_STUB_INSTALLER)
4122 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
4123 AC_SUBST(MOZ_ENABLE_SIGNMAR)
4124 AC_SUBST(MOZ_UPDATER)
4126 AC_SUBST(MOZ_ANGLE_RENDERER)
4127 AC_SUBST(MOZ_D3D_CPU_SUFFIX)
4128 AC_SUBST(MOZ_HAS_WINSDK_WITH_D3D)
4129 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL)
4130 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL_PATH)
4132 AC_SUBST(MOZ_ANDROID_APPLICATION_CLASS)
4133 AC_SUBST(MOZ_ANDROID_BROWSER_INTENT_CLASS)
4134 AC_SUBST(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
4135 AC_SUBST(ENABLE_STRIP)
4136 AC_SUBST(PKG_SKIP_STRIP)
4137 AC_SUBST(STRIP_FLAGS)
4138 AC_SUBST(INCREMENTAL_LINKER)
4140 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
4142 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
4143 AC_SUBST(MOZ_LINKER_EXTRACT)
4145 if test -n "$MOZ_BINARY_EXTENSIONS"; then
4146 AC_DEFINE(MOZ_BINARY_EXTENSIONS)
4149 AC_SUBST(MOZ_REQUIRE_SIGNING)
4150 if test "$MOZ_REQUIRE_SIGNING" = 1; then
4151 AC_DEFINE(MOZ_REQUIRE_SIGNING)
4154 dnl ========================================================
4155 dnl = Mac bundle name prefix
4156 dnl ========================================================
4157 MOZ_ARG_WITH_STRING(macbundlename-prefix,
4158 [ --with-macbundlename-prefix=prefix
4159 Prefix for MOZ_MACBUNDLE_NAME],
4160 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
4162 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
4163 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
4164 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
4167 if test "$MOZ_DEBUG"; then
4168 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
4170 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
4172 AC_SUBST(MOZ_MACBUNDLE_NAME)
4174 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
4175 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
4176 # Otherwise, use MOZ_APP_DISPLAYNAME
4177 if test -z "$MOZ_MACBUNDLE_ID"; then
4178 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
4180 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
4181 if test "$MOZ_DEBUG"; then
4182 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
4185 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
4186 AC_SUBST(MOZ_MACBUNDLE_ID)
4188 dnl ========================================================
4189 dnl = Child Process Name for IPC
4190 dnl ========================================================
4191 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
4192 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
4194 # We want to let Android unpack the file at install time, but it only does
4195 # so if the file is named libsomething.so. The lib/ path is also required
4196 # because the unpacked file will be under the lib/ subdirectory and will
4197 # need to be executed from that path.
4198 MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
4200 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
4201 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
4203 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
4204 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
4205 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
4207 # The following variables are available to branding and application
4208 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
4209 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
4210 # impacts profile location and user-visible fields.
4211 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
4212 # versions of a given application (e.g. Aurora and Firefox both use
4213 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
4214 # for application.ini's "Name" field, which controls profile location in
4215 # the absence of a "Profile" field (see below), and various system
4216 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
4217 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
4218 # Mac Bundle name, Updater, Installer), it is typically used for nightly
4219 # builds (e.g. Aurora for Firefox).
4220 # - MOZ_APP_VERSION: Defines the application version number.
4221 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
4222 # in the "About" window. If not set, defaults to MOZ_APP_VERSION.
4223 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
4224 # defaults to a lowercase form of MOZ_APP_BASENAME.
4225 # - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
4226 # profile name and remoting. If not set, defaults to MOZ_APP_NAME.
4227 # - MOZ_APP_PROFILE: When set, used for application.ini's
4228 # "Profile" field, which controls profile location.
4229 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
4230 # crash reporter server url.
4231 # - MOZ_APP_ANDROID_VERSION_CODE: On Android, "android:versionCode" for
4232 # the main application is set to the value of this variable. If not
4233 # set, it falls back to a Mozilla-specific value derived from the
4235 # - MOZ_ANDROID_SHARED_ID: On Android, "android:sharedUserId" for all Android
4236 # packages produced.
4237 # - MOZ_ANDROID_GCM_SENDERID: On Android, the Android GCM Sender ID used. GCM
4238 # sender IDs are not sensitive: see, http://stackoverflow.com/a/18216063.
4239 # - MOZ_MMA_GCM_SENDERID: This GCM Sender ID is used for MMA integration.
4240 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
4242 if test -z "$MOZ_APP_NAME"; then
4243 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
4246 if test -z "$MOZ_APP_REMOTINGNAME"; then
4247 MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
4250 if test -z "$MOZ_APP_VERSION_DISPLAY"; then
4251 MOZ_APP_VERSION_DISPLAY=$MOZ_APP_VERSION
4254 if test -z "$ANDROID_PACKAGE_NAME" ; then
4255 # When we got rid of the Aurora channel we decided to replace the old
4256 # Nightly ANDROID_PACKAGE_NAME with Aurora. To make sure this is inherited
4257 # by all mozilla-central based branches we make this the new "default"
4258 # for Fennec. Non mozilla-central based branches set ANDROID_PACKAGE_NAME
4259 # in their mozconfig, so they will never get this. If there are ever
4260 # non-Fennec builds for Android, they will fall into the else block
4261 # and use their own default name.
4262 # https://bugzilla.mozilla.org/show_bug.cgi?id=1357808 has additional
4263 # background on this.
4264 if test "$MOZ_APP_NAME" = "fennec"; then
4265 ANDROID_PACKAGE_NAME="org.mozilla.fennec_aurora"
4267 ANDROID_PACKAGE_NAME="org.mozilla.$MOZ_APP_NAME"
4271 # Mozilla released Firefox for Android {Release,Beta} and {Aurora,Nightly} to
4272 # the public with specific common shared IDs and we need to keep them
4273 # consistent forever. The specific common values are set by per-channel
4274 # branding; all other channels use a generic sharedID, set below.
4275 if test -z "$MOZ_ANDROID_SHARED_ID" ; then
4276 MOZ_ANDROID_SHARED_ID="${ANDROID_PACKAGE_NAME}.sharedID"
4279 # For extensions and langpacks, we require a max version that is compatible
4280 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
4281 # 24.0a1 and 24.0a2 aren't affected
4283 # 24.1.1 becomes 24.*
4284 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
4285 if test -z "$IS_ALPHA"; then
4287 if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
4288 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
4290 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
4294 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
4297 AC_SUBST(MOZ_APP_NAME)
4298 AC_SUBST(MOZ_APP_REMOTINGNAME)
4299 AC_SUBST(MOZ_APP_DISPLAYNAME)
4300 AC_SUBST(MOZ_APP_BASENAME)
4301 AC_SUBST(MOZ_APP_VENDOR)
4302 AC_SUBST(MOZ_APP_PROFILE)
4303 AC_SUBST(MOZ_APP_ID)
4304 AC_SUBST(MOZ_APP_ANDROID_VERSION_CODE)
4305 AC_SUBST(MOZ_ANDROID_SHARED_ID)
4306 AC_SUBST(MOZ_ANDROID_GCM_SENDERID)
4307 AC_SUBST(MOZ_MMA_GCM_SENDERID)
4308 AC_SUBST(MAR_CHANNEL_ID)
4309 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
4310 AC_SUBST(MOZ_PROFILE_MIGRATOR)
4311 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
4312 AC_SUBST(MOZ_APP_UA_NAME)
4313 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
4314 AC_SUBST(MOZ_APP_VERSION)
4315 AC_SUBST(MOZ_APP_VERSION_DISPLAY)
4316 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
4317 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
4319 AC_SUBST(MOZ_APP_MAXVERSION)
4320 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
4321 AC_SUBST(FIREFOX_VERSION)
4322 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
4323 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
4324 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
4327 AC_SUBST(MOZ_PKG_SPECIAL)
4328 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
4330 if test "$MOZILLA_OFFICIAL"; then
4331 # Build revisions should always be present in official builds
4332 MOZ_INCLUDE_SOURCE_INFO=1
4335 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
4336 # explicitly set the repository and changeset information in.
4337 AC_SUBST(MOZ_SOURCE_REPO)
4338 AC_SUBST(MOZ_SOURCE_CHANGESET)
4339 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
4341 if test "$MOZ_TELEMETRY_REPORTING"; then
4342 AC_DEFINE(MOZ_TELEMETRY_REPORTING)
4344 # Enable Telemetry by default for nightly and aurora channels
4345 if test -z "$RELEASE_OR_BETA"; then
4346 AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
4350 dnl If we have any service that uploads data (and requires data submission
4351 dnl policy alert), set MOZ_DATA_REPORTING.
4352 dnl We need SUBST for build system and DEFINE for xul preprocessor.
4353 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
4354 MOZ_DATA_REPORTING=1
4355 AC_DEFINE(MOZ_DATA_REPORTING)
4356 AC_SUBST(MOZ_DATA_REPORTING)
4360 AC_SUBST(WIN32_REDIST_DIR)
4361 AC_SUBST(WIN_UCRT_REDIST_DIR)
4362 AC_SUBST(WIN_DIA_SDK_BIN_DIR)
4364 dnl ========================================================
4366 dnl ========================================================
4370 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
4376 dnl Echo the CFLAGS to remove extra whitespace.
4379 $_COMPILATION_CFLAGS \
4383 $_WARNINGS_CXXFLAGS \
4384 $_COMPILATION_CXXFLAGS \
4387 COMPILE_CFLAGS=`echo \
4391 COMPILE_CXXFLAGS=`echo \
4392 $_DEFINES_CXXFLAGS \
4396 $_WARNINGS_HOST_CFLAGS \
4397 $_COMPILATION_HOST_CFLAGS \
4400 HOST_CXXFLAGS=`echo \
4401 $_WARNINGS_HOST_CXXFLAGS \
4402 $_COMPILATION_HOST_CXXFLAGS \
4405 AC_SUBST(_DEPEND_CFLAGS)
4406 AC_SUBST(MOZ_SYSTEM_JPEG)
4407 AC_SUBST(MOZ_SYSTEM_PNG)
4409 AC_SUBST_LIST(MOZ_JPEG_CFLAGS)
4410 AC_SUBST_LIST(MOZ_JPEG_LIBS)
4411 AC_SUBST_LIST(MOZ_PNG_CFLAGS)
4412 AC_SUBST_LIST(MOZ_PNG_LIBS)
4414 AC_SUBST(MOZ_SYSTEM_NSPR)
4416 AC_SUBST(MOZ_SYSTEM_NSS)
4418 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
4419 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
4420 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
4421 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
4422 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
4423 OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
4424 OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
4426 AC_SUBST(HOST_CMFLAGS)
4427 AC_SUBST(HOST_CMMFLAGS)
4428 AC_SUBST(OS_COMPILE_CMFLAGS)
4429 AC_SUBST(OS_COMPILE_CMMFLAGS)
4432 OS_CXXFLAGS="$CXXFLAGS"
4433 OS_CPPFLAGS="$CPPFLAGS"
4434 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
4435 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
4436 OS_LDFLAGS="$LDFLAGS"
4438 AC_SUBST_LIST(OS_CFLAGS)
4439 AC_SUBST_LIST(OS_CXXFLAGS)
4440 AC_SUBST_LIST(OS_CPPFLAGS)
4441 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
4442 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
4443 AC_SUBST_LIST(OS_LDFLAGS)
4448 AC_SUBST_LIST(HOST_CFLAGS)
4449 AC_SUBST_LIST(HOST_CPPFLAGS)
4450 AC_SUBST_LIST(HOST_CXXFLAGS)
4451 AC_SUBST(HOST_LDFLAGS)
4452 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
4454 AC_SUBST(HOST_AR_FLAGS)
4455 AC_SUBST(HOST_RANLIB)
4456 AC_SUBST(HOST_BIN_SUFFIX)
4458 AC_SUBST(TARGET_XPCOM_ABI)
4459 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
4460 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
4461 AC_SUBST(HAVE_X86_AVX2)
4462 AC_SUBST(HAVE_ALTIVEC)
4463 AC_SUBST(GCC_USE_GNU_LD)
4467 AC_SUBST_LIST(DSO_CFLAGS)
4468 AC_SUBST_LIST(DSO_PIC_CFLAGS)
4469 AC_SUBST(DSO_LDOPTS)
4470 AC_SUBST(BIN_SUFFIX)
4472 AC_SUBST(CC_VERSION)
4473 AC_SUBST(NS_ENABLE_TSF)
4474 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
4475 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
4478 AC_SUBST(MOZ_FFVPX_FLACONLY)
4479 AC_SUBST_LIST(FFVPX_ASFLAGS)
4480 AC_SUBST(VPX_USE_YASM)
4481 AC_SUBST_LIST(VPX_ASFLAGS)
4482 AC_SUBST(VPX_AS_CONVERSION)
4483 AC_SUBST(VPX_X86_ASM)
4484 AC_SUBST(VPX_ARM_ASM)
4485 AC_SUBST(LIBJPEG_TURBO_USE_YASM)
4486 AC_SUBST_LIST(LIBJPEG_TURBO_ASFLAGS)
4487 AC_SUBST(MOZ_LIBAV_FFT)
4488 AC_SUBST_LIST(LIBAV_FFT_ASFLAGS)
4489 AC_SUBST(MOZ_DEVTOOLS)
4491 AC_SUBST(MOZ_PACKAGE_JSSHELL)
4492 AC_SUBST(MOZ_FOLD_LIBS)
4493 AC_SUBST_LIST(MOZ_FOLD_LIBS_FLAGS)
4497 dnl Host JavaScript runtime, if any, to use during cross compiles.
4500 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
4502 if test -n "$COMPILE_ENVIRONMENT"; then
4503 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
4505 dnl Check for missing components
4506 if test "$MOZ_X11"; then
4507 dnl ====================================================
4508 dnl = Check if X headers exist
4509 dnl ====================================================
4510 _SAVE_CFLAGS=$CFLAGS
4511 CFLAGS="$CFLAGS $XCFLAGS"
4515 #include <X11/Xlib.h>
4516 #include <X11/Intrinsic.h>
4517 #include <X11/extensions/XShm.h>
4521 if ((dpy = XOpenDisplay(NULL)) == NULL) {
4522 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
4526 [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
4527 CFLAGS="$_SAVE_CFLAGS"
4529 if test -n "$MISSING_X"; then
4530 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
4535 fi # COMPILE_ENVIRONMENT
4537 dnl Set various defines and substitutions
4538 dnl ========================================================
4540 if test "$MOZ_DEBUG"; then
4541 AC_DEFINE(MOZ_REFLOW_PERF)
4542 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
4545 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
4546 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
4547 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
4548 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
4549 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
4550 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
4551 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
4552 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
4553 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
4556 AC_SUBST(MOZ_DEV_EDITION)
4557 if test -n "$MOZ_DEV_EDITION"; then
4558 AC_DEFINE(MOZ_DEV_EDITION)
4561 if test "$MOZ_DEBUG" -o "$DEVELOPER_OPTIONS"; then
4565 if test -n "$A11Y_LOG"; then
4569 dnl Spit out some output
4570 dnl ========================================================
4572 dnl The following defines are used by xpcom
4573 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
4575 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
4587 # Avoid using obsolete NSPR features
4588 AC_DEFINE(NO_NSPR_10_SUPPORT)
4590 # Don't build NSS libpkix
4591 NSS_DISABLE_LIBPKIX=1
4592 AC_SUBST(NSS_DISABLE_LIBPKIX)
4594 MOZ_CREATE_CONFIG_STATUS()
4596 if test -z "$direct_nspr_config"; then
4597 dnl ========================================================
4598 dnl = Setup a nice relatively clean build environment for
4599 dnl = sub-configures.
4600 dnl ========================================================
4603 CFLAGS="$_SUBDIR_CFLAGS"
4604 CPPFLAGS="$_SUBDIR_CPPFLAGS"
4605 CXXFLAGS="$_SUBDIR_CXXFLAGS"
4606 LDFLAGS="$_SUBDIR_LDFLAGS"
4607 HOST_CC="$_SUBDIR_HOST_CC"
4608 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
4609 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
4610 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
4617 # Run all configure scripts specified by a subconfigure
4618 if test -n "$_subconfigure_subdir"; then
4619 _save_srcdir="$srcdir"
4621 _save_ac_configure_args="$ac_configure_args"
4622 ac_configure_args="$_subconfigure_config_args"
4623 AC_OUTPUT_SUBDIRS_NOW("$_subconfigure_subdir",$cache_file)
4624 ac_configure_args="$_save_ac_configure_args"
4625 srcdir="$_save_srcdir"
4628 if test "$COMPILE_ENVIRONMENT" -a "$MOZ_WIDGET_TOOLKIT"; then
4631 dnl ========================================================
4632 dnl = Setup a nice relatively clean build environment for
4633 dnl = sub-configures.
4634 dnl ========================================================
4637 CFLAGS="$_SUBDIR_CFLAGS"
4638 CPPFLAGS="$_SUBDIR_CPPFLAGS"
4639 CXXFLAGS="$_SUBDIR_CXXFLAGS"
4640 LDFLAGS="$_SUBDIR_LDFLAGS"
4641 HOST_CC="$_SUBDIR_HOST_CC"
4642 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
4643 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
4644 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
4647 # Run the SpiderMonkey 'configure' script.
4648 dist=$MOZ_BUILD_ROOT/dist
4649 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
4651 # --with-system-nspr will have been converted into the relevant $NSPR_CFLAGS
4653 ac_configure_args="`echo $ac_configure_args | sed -e 's/--with-system-nspr\S* *//'`"
4655 if test "$_INTL_API" = no; then
4656 ac_configure_args="$ac_configure_args --without-intl-api"
4659 if test -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
4660 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
4661 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
4663 ac_configure_args="$ac_configure_args --prefix=$dist"
4664 if test -n "$ZLIB_IN_MOZGLUE"; then
4667 export MOZ_SYSTEM_ZLIB
4668 export MOZ_ZLIB_CFLAGS
4669 export MOZ_ZLIB_LIBS
4671 export MOZ_APP_REMOTINGNAME
4672 export MOZ_DEV_EDITION
4675 export MOZILLA_CENTRAL_PATH=$_topsrcdir
4676 export STLPORT_CPPFLAGS
4681 export ZLIB_IN_MOZGLUE
4695 export HOST_CPPFLAGS
4696 export HOST_CXXFLAGS
4699 if ! test -e js; then
4703 ac_configure_args="$ac_configure_args JS_STANDALONE="
4704 AC_OUTPUT_SUBDIRS(js/src,$cache_file)
4705 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
4707 fi # COMPILE_ENVIRONMENT
4709 dnl we need to run config.status after js/src subconfigure because we're
4710 dnl traversing its moz.build and we need its config.status for that.
4711 dnl However, writing our own config.status needs to happen before
4712 dnl subconfigures because the setup surrounding subconfigures alters
4713 dnl many AC_SUBSTed variables.
4714 MOZ_RUN_ALL_SUBCONFIGURES()
4716 rm -fr confdefs* $ac_clean_files