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"
279 unset _MSVC_VER_FILTER
281 AC_CACHE_CHECK(for overridable _RAISE,
286 _SAVE_CXXFLAGS="$CXXFLAGS"
287 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
288 AC_TRY_COMPILE([#include <xstddef>
290 #define _RAISE(x) externallyDefinedFunction((x).what())
293 [std::vector<int> v; return v.at(1);],
294 ac_cv_have__RAISE="no",
295 ac_cv_have__RAISE="yes")
296 CXXFLAGS="$_SAVE_CXXFLAGS"
299 if test "$ac_cv_have__RAISE" = "yes"; then
301 MOZ_MSVC_STL_WRAP_RAISE=1
302 AC_DEFINE(MOZ_MSVC_STL_WRAP_RAISE)
304 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.])
307 if test "$WRAP_STL_INCLUDES" = "1"; then
308 STL_FLAGS="-I${DIST}/stl_wrappers"
310 CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
311 CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
313 # Check w32api version
314 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
315 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
316 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
317 AC_TRY_COMPILE([#include <w32api.h>],
318 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
319 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
320 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
321 #error "test failed."
323 , [ res=yes ], [ res=no ])
324 AC_MSG_RESULT([$res])
325 if test "$res" != "yes"; then
326 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
328 # Check windres version
329 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
330 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
331 AC_MSG_RESULT([$_WINDRES_VERSION])
332 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
333 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
334 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
335 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
336 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
337 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
338 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
339 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
340 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
341 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
342 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
343 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
345 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
348 AC_CHECK_PROGS(MIDL, $target-widl widl)
349 if test -n "$MIDL"; then
352 MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
355 MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
360 # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
361 # causing problems with local implementations with the same name.
362 AC_DEFINE(STRSAFE_NO_DEPRECATE)
365 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
366 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
367 # Require OS features provided by IE 8.0 (Win7)
368 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0800)
373 if test -n "$_WIN32_MSVC"; then
375 SKIP_COMPILER_CHECKS=1
376 SKIP_LIBRARY_CHECKS=1
378 # Since we're skipping compiler and library checks, hard-code
381 AC_DEFINE(HAVE_ISATTY)
384 fi # COMPILE_ENVIRONMENT
393 AC_SUBST_LIST(STL_FLAGS)
394 AC_SUBST(WRAP_STL_INCLUDES)
395 AC_SUBST(MOZ_MSVC_STL_WRAP_RAISE)
397 dnl ========================================================
398 dnl Checks for programs.
399 dnl ========================================================
400 if test "$COMPILE_ENVIRONMENT"; then
402 dnl ========================================================
403 dnl = Mac OS X SDK support
404 dnl ========================================================
406 MOZ_ARG_WITH_STRING(macos-sdk,
407 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
408 MACOS_SDK_DIR=$withval)
410 MACOS_PRIVATE_FRAMEWORKS_DIR_DEFAULTED=
411 MOZ_ARG_WITH_STRING(macos-private-frameworks,
412 [ --with-macos-private-frameworks=dir Location of private frameworks to use (Mac OS X only)],
413 MACOS_PRIVATE_FRAMEWORKS_DIR=$withval,
414 MACOS_PRIVATE_FRAMEWORKS_DIR=/System/Library/PrivateFrameworks
415 MACOS_PRIVATE_FRAMEWORKS_DEFAULTED=1)
417 if test -z "${MACOS_PRIVATE_FRAMEWORKS_DEFAULTED}"; then
418 if test -z "$CROSS_COMPILE"; then
419 AC_MSG_WARN([You should only be using --with-macos-private-frameworks when cross-compiling.])
421 if test ! -d "$MACOS_PRIVATE_FRAMEWORKS_DIR"; then
422 AC_MSG_ERROR([PrivateFrameworks directory not found.])
426 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
427 AC_SUBST(MACOS_SDK_DIR)
428 AC_SUBST(MACOS_PRIVATE_FRAMEWORKS_DIR)
430 if test "$MACOS_SDK_DIR"; then
431 dnl Sync this section with the ones in NSPR and NSS.
432 dnl Changes to the cross environment here need to be accounted for in
433 dnl the libIDL checks (below) and xpidl build.
435 if test ! -d "$MACOS_SDK_DIR"; then
436 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
437 specify a valid SDK. SDKs are installed when the optional cross-development
438 tools are selected during the Xcode/Developer Tools installation.])
441 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
442 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
444 dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
445 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
446 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
449 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
451 AC_TRY_COMPILE([#include <new>],[],
455 AC_MSG_RESULT($result)
457 if test "$result" = "no" ; then
458 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
466 fi # COMPILE_ENVIRONMENT
468 dnl ========================================================
469 dnl set the defaults first
470 dnl ========================================================
475 MOZ_USER_DIR=".mozilla"
477 MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
481 dnl Configure platform-specific CPU architecture compiler options.
482 dnl ==============================================================
483 if test "$COMPILE_ENVIRONMENT"; then
486 if test "$OS_TARGET" = Android; then
487 dnl Default Android builds to ARMv7.
490 fi # COMPILE_ENVIRONMENT
492 dnl ========================================================
493 dnl Android libstdc++, placed here so it can use MOZ_ARCH
495 dnl ========================================================
498 if test "$COMPILE_ENVIRONMENT"; then
500 fi # COMPILE_ENVIRONMENT
502 dnl ========================================================
503 dnl Suppress Clang Argument Warnings
504 dnl ========================================================
505 if test -n "${CLANG_CC}${CLANG_CL}"; then
506 _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
507 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
509 if test -n "${CLANG_CXX}${CLANG_CL}"; then
510 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
513 if test -n "$COMPILE_ENVIRONMENT"; then
517 dnl ========================================================
518 dnl Add optional and non-optional hardening flags
519 dnl ========================================================
521 CFLAGS="$CFLAGS $MOZ_HARDENING_CFLAGS"
522 CPPFLAGS="$CPPFLAGS $MOZ_HARDENING_CFLAGS"
523 CXXFLAGS="$CXXFLAGS $MOZ_HARDENING_CFLAGS"
525 dnl ========================================================
526 dnl GNU specific defaults
527 dnl ========================================================
528 if test "$GNU_CC"; then
532 SSSE3_FLAGS="-mssse3"
533 # FIXME: Let us build with strict aliasing. bug 414641.
534 CFLAGS="$CFLAGS -fno-strict-aliasing"
535 MKSHLIB='$(CXX) $(COMPUTED_CXX_LDFLAGS) $(PGO_CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
536 MKCSHLIB='$(CC) $(COMPUTED_C_LDFLAGS) $(PGO_CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
537 WARNINGS_AS_ERRORS='-Werror'
540 if test "$OS_ARCH" != "WINNT" -o -z "$CLANG_CC"; then
541 DSO_PIC_CFLAGS='-fPIC'
542 ASFLAGS="$ASFLAGS -fPIC"
545 AC_MSG_CHECKING([for --noexecstack option to as])
547 CFLAGS="$CFLAGS -Wa,--noexecstack"
548 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
549 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
552 AC_MSG_CHECKING([for -z noexecstack option to ld])
553 _SAVE_LDFLAGS=$LDFLAGS
554 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
555 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
557 LDFLAGS=$_SAVE_LDFLAGS)
559 AC_MSG_CHECKING([for -z text option to ld])
560 _SAVE_LDFLAGS=$LDFLAGS
561 LDFLAGS="$LDFLAGS -Wl,-z,text"
562 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
564 LDFLAGS=$_SAVE_LDFLAGS)
566 AC_MSG_CHECKING([for -z relro option to ld])
567 _SAVE_LDFLAGS=$LDFLAGS
568 LDFLAGS="$LDFLAGS -Wl,-z,relro"
569 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
571 LDFLAGS=$_SAVE_LDFLAGS)
573 AC_MSG_CHECKING([for --build-id option to ld])
574 _SAVE_LDFLAGS=$LDFLAGS
575 LDFLAGS="$LDFLAGS -Wl,--build-id"
576 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
578 LDFLAGS=$_SAVE_LDFLAGS)
580 AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
581 HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
582 _SAVE_LDFLAGS=$LDFLAGS
583 LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
584 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
585 [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
587 LDFLAGS=$_SAVE_LDFLAGS
589 # Check for -mssse3 on $CC
590 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
591 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
593 CFLAGS="$CFLAGS -mssse3"
594 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
595 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
599 # Check for -msse4.1 on $CC
600 AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
601 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
603 CFLAGS="$CFLAGS -msse4.1"
604 AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
605 [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
609 case "${CPU_ARCH}" in
611 AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
613 [asm volatile ("vpermq \$0xd8,%ymm0,%ymm0 \n");],
614 result="yes", result="no")
615 AC_MSG_RESULT("$result")
616 if test "$result" = "yes"; then
622 AC_MSG_CHECKING([whether we can enable AltiVec support])
625 CFLAGS="$CFLAGS -maltivec"
626 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
634 if test "$GCC_USE_GNU_LD"; then
635 # Some tools like ASan use a runtime library that is only
636 # linked against executables, so we must allow undefined
637 # symbols for shared objects in some cases.
638 if test -z "$MOZ_NO_WLZDEFS"; then
639 # Don't allow undefined symbols in libraries
640 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
642 # BSDs need `environ' exposed for posix_spawn (bug 753046)
644 DragonFly|FreeBSD|NetBSD|OpenBSD)
645 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
646 DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
648 DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
655 _DEFINES_CFLAGS="-include $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
656 _USE_CPP_INCLUDE_FLAG=1
658 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
661 if test "$GNU_CXX"; then
662 # FIXME: Let us build with strict aliasing. bug 414641.
663 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
665 _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
666 _USE_CPP_INCLUDE_FLAG=1
669 # For profiling builds keep the symbol information
670 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
672 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
673 STRIP_FLAGS="--strip-debug"
678 dnl ========================================================
680 dnl ========================================================
682 if test "$MOZ_DMD"; then
683 if test "${CPU_ARCH}" = "arm"; then
684 CFLAGS="$CFLAGS -funwind-tables"
685 CXXFLAGS="$CXXFLAGS -funwind-tables"
689 dnl ========================================================
690 dnl System overrides of the defaults for host
691 dnl ========================================================
694 if test -n "$_WIN32_MSVC"; then
696 HOST_AR_FLAGS='-NOLOGO -OUT:$@'
697 HOST_CFLAGS="$HOST_CFLAGS -nologo"
698 HOST_RANLIB='echo ranlib'
700 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
702 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
703 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
706 case "${host_cpu}" in
708 if test -n "$_WIN32_MSVC"; then
709 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
713 if test -n "$_WIN32_MSVC"; then
714 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
716 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
722 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
723 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
726 *-linux*|*-kfreebsd*-gnu|*-gnu*)
727 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
728 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
732 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
733 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
737 dnl Get version of various core apps from the version files.
738 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
739 FIREFOX_VERSION_DISPLAY=`cat $_topsrcdir/browser/config/version_display.txt`
741 if test -z "$FIREFOX_VERSION"; then
742 AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
745 if test -z "$FIREFOX_VERSION_DISPLAY"; then
746 AC_MSG_ERROR([FIREFOX_VERSION_DISPLAY is unexpectedly blank.])
749 MOZ_DOING_LTO(lto_is_enabled)
751 dnl ========================================================
752 dnl System overrides of the defaults for target
753 dnl ========================================================
757 MKSHLIB='$(CXX) $(COMPUTED_CXX_LDFLAGS) $(PGO_CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
758 MKCSHLIB='$(CC) $(COMPUTED_C_LDFLAGS) $(PGO_CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
759 MOZ_OPTIMIZE_FLAGS="-O3"
760 CXXFLAGS="$CXXFLAGS -stdlib=libc++"
762 STRIP_FLAGS="$STRIP_FLAGS -x -S"
763 # Ensure that if we're targeting iOS an SDK was provided.
764 AC_CACHE_CHECK(for iOS target,
766 [AC_TRY_COMPILE([#include <TargetConditionals.h>
767 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
771 ac_cv_ios_target="yes",
772 ac_cv_ios_target="no")])
773 if test "$ac_cv_ios_target" = "yes" -a -z $MOZ_IOS; then
774 AC_MSG_ERROR([targeting iOS but not using an iOS SDK?])
776 if test -n "$MOZ_IOS"; then
779 # The ExceptionHandling framework is needed for Objective-C exception
780 # logging code in nsObjCExceptions.h. Currently we only use that in debug
782 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
785 if test "x$lto_is_enabled" = "xyes"; then
786 echo "Skipping -dead_strip because lto is enabled."
787 dnl DTrace and -dead_strip don't interact well. See bug 403132.
788 dnl ===================================================================
789 elif test "x$enable_dtrace" = "xyes"; then
790 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
792 dnl check for the presence of the -dead_strip linker flag
793 AC_MSG_CHECKING([for -dead_strip option to ld])
794 _SAVE_LDFLAGS=$LDFLAGS
795 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
796 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
797 if test -n "$_HAVE_DEAD_STRIP" ; then
799 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
804 LDFLAGS=$_SAVE_LDFLAGS
807 MOZ_FIX_LINK_PATHS="-Wl,-executable_path,${DIST}/bin"
810 *-android*|*-linuxandroid*)
811 AC_DEFINE(NO_PW_GECOS)
813 if test "$COMPILE_ENVIRONMENT"; then
817 MOZ_GFX_OPTIMIZE_MOBILE=1
818 if test -z "$CLANG_CC"; then
819 MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
821 # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
822 # -Oz is smaller than -Os on clang.
823 MOZ_OPTIMIZE_FLAGS="-Oz"
828 if test "$GNU_CC" -o "$GNU_CXX"; then
829 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
830 if test -n "$MOZ_DEBUG"; then
831 MOZ_OPTIMIZE_FLAGS="-Os"
833 MOZ_OPTIMIZE_FLAGS="-O2"
835 if test -z "$CLANG_CC"; then
836 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
840 case "${target_cpu}" in
842 CFLAGS="$CFLAGS -mieee"
843 CXXFLAGS="$CXXFLAGS -mieee"
851 # certain versions of cygwin's makedepend barf on the
852 # #include <string> vs -I./dist/include/string issue so don't use it
853 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
857 CFLAGS="$CFLAGS -mms-bitfields"
858 CXXFLAGS="$CXXFLAGS -mms-bitfields"
860 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
861 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
863 # Use temp file for windres (bug 213281)
864 RCFLAGS='-O coff --use-temp-file'
865 # mingw doesn't require kernel32, user32, and advapi32 explicitly
866 LIBS="$LIBS -luuid -lusp10 -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
869 MOZ_OPTIMIZE_FLAGS="-O1"
871 WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
872 WIN32_GUI_EXE_LDFLAGS=-mwindows
874 if test -z "$CLANG_CC"; then
875 # Use static libgcc and libstdc++
876 LDFLAGS="$LDFLAGS -static"
878 # GCC/binutils can't link to a function if we try to include dllexport function
879 # in the same library as dllimport caller. To work around it, we build NSPR
880 # and NSS with -mnop-fun-dllimport flag. The drawback of this solution is that
881 # function thunks need to be generated for cross-DLL calls.
882 MOZ_FOLD_LIBS_FLAGS="-mnop-fun-dllimport"
884 # Silence problematic clang warnings
885 CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
888 TARGET_COMPILER_ABI=msvc
889 if test "$AS_BIN"; then
890 AS="$(basename "$AS_BIN")"
893 AR_FLAGS='-NOLOGO -OUT:$@'
895 RANLIB='echo not_ranlib'
896 STRIP='echo not_strip'
898 MKSHLIB='$(LINKER) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
899 MKCSHLIB='$(LINKER) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
900 WIN32_SUBSYSTEM_VERSION=6.01
901 WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
902 WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
903 DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
904 _USE_CPP_INCLUDE_FLAG=1
905 _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
906 _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
907 CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
908 CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
909 if test -z "$CLANG_CL"; then
910 CPPFLAGS="$CPPFLAGS -utf-8"
912 if test "$CPU_ARCH" = "x86"; then
913 dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
914 dnl more recent, so set that explicitly here unless another
915 dnl target arch has already been set.
917 if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
918 CFLAGS="$CFLAGS -arch:SSE2"
920 if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
921 CXXFLAGS="$CXXFLAGS -arch:SSE2"
924 SSE_FLAGS="-arch:SSE"
925 SSE2_FLAGS="-arch:SSE2"
926 dnl MSVC allows the use of intrinsics without any flags
927 dnl and doesn't have a separate arch for SSSE3
928 SSSE3_FLAGS="-arch:SSE2"
930 dnl clang-cl requires appropriate flags to enable SSSE3 support
931 dnl on all architectures.
932 if test -n "$CLANG_CL"; then
933 SSSE3_FLAGS="-mssse3"
935 dnl VS2013+ supports -Gw for better linker optimizations.
936 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
937 dnl Disabled on ASan because it causes false-positive ODR violations.
938 if test -z "$MOZ_ASAN"; then
940 CXXFLAGS="$CXXFLAGS -Gw"
942 # khuey says we can safely ignore MSVC warning C4251
943 # MSVC warning C4244 (implicit type conversion may lose data) warns
944 # and requires workarounds for perfectly valid code. Also, GCC/clang
945 # don't warn about it by default. So for consistency/sanity, we turn
946 # it off on MSVC, too.
947 # MSVC warning C4267 warns for narrowing type conversions from size_t
948 # to 32-bit integer types on 64-bit platforms. Since this is virtually
949 # the same thing as C4244, we disable C4267, too.
950 # MSVC warning C4800 warns when a value is implicitly cast to bool,
951 # because this also forces narrowing to a single byte, which can be a
952 # perf hit. But this matters so little in practice (and often we want
953 # that behavior) that it's better to turn it off.
954 # MSVC warning C4595 warns non-member operator new or delete functions
955 # may not be declared inline, as of VS2015 Update 2.
956 CFLAGS="$CFLAGS -wd4244 -wd4267"
957 CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4267 -wd4800 -wd4595"
958 # Silence "warning C4065: switch statement contains 'default' but no
959 # 'case' labels". See bug 1461304.
960 CXXFLAGS="$CXXFLAGS -wd4065"
961 if test -n "$CLANG_CL"; then
962 # XXX We should combine some of these with our generic GCC-style
965 # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
966 CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
967 # We use offsetof on non-POD objects all the time.
968 # We also suppress this warning on other platforms.
969 CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
970 # This warns for reasonable things like:
971 # enum { X = 0xffffffffU };
972 # which is annoying for IDL headers.
973 CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
974 # This warns for cases that would be reached by the Microsoft
975 # #include rules, but also currently warns on cases that would
976 # *also* be reached by standard C++ include rules. That
977 # behavior doesn't seem useful, so we turn it off.
978 CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
979 # We normally error out on unknown pragmas, but since clang-cl
980 # claims to be MSVC, it would be difficult to add
981 # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
982 # use such pragmas, so just ignore them.
983 CFLAGS="$CFLAGS -Wno-unknown-pragmas"
984 CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
985 # We get errors about various #pragma intrinsic directives from
986 # clang-cl, and we don't need to hear about those.
987 CFLAGS="$CFLAGS -Wno-ignored-pragmas"
988 CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
989 # clang-cl's Intrin.h marks things like _ReadWriteBarrier
990 # as __attribute((__deprecated__)). This is nice to know,
991 # but since we don't get the equivalent warning from MSVC,
992 # let's just ignore it.
993 CFLAGS="$CFLAGS -Wno-deprecated-declarations"
994 CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
995 # We use a function like:
996 # __declspec(noreturn) __inline void f() {}
997 # which -Winvalid-noreturn complains about. Again, MSVC seems
998 # OK with it, so let's silence the warning.
999 CFLAGS="$CFLAGS -Wno-invalid-noreturn"
1000 CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
1001 # Missing |override| on virtual function declarations isn't
1002 # something that MSVC currently warns about.
1003 CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
1004 # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
1005 # declaration on |operator delete(void*)|. However, clang-cl
1006 # must internally declare |operator delete(void*)| differently,
1007 # which causes this warning for virtually every file in the
1008 # tree. clang-cl doesn't support -fno-exceptions or equivalent,
1009 # so there doesn't seem to be any way to convince clang-cl to
1010 # declare |delete| differently. Therefore, suppress this
1012 CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
1013 # At least one MSVC header and several headers in-tree have
1014 # unused typedefs, so turn this on.
1015 CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
1016 # jemalloc uses __declspec(allocator) as a profiler hint,
1017 # which clang-cl doesn't understand.
1018 CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
1019 # __attribute__((unused)) really means "might be unused" and
1020 # we use it to avoid warnings about things that are unused
1021 # in some compilation units, but used in many others. This
1022 # warning insists on complaining about the latter case, which
1023 # is annoying, and rather noisy.
1024 CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused"
1026 # make 'foo == bar;' error out
1027 CFLAGS="$CFLAGS -we4553"
1028 CXXFLAGS="$CXXFLAGS -we4553"
1029 # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
1030 CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
1031 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
1032 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1033 WARNINGS_AS_ERRORS='-WX'
1034 # Use a higher optimization level for clang-cl, so we can come closer
1035 # to MSVC's performance numbers (see bug 1443590).
1036 if test -n "$CLANG_CL"; then
1037 MOZ_OPTIMIZE_FLAGS='-O2'
1039 MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
1042 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
1043 if test -z "$DEVELOPER_OPTIONS"; then
1044 LDFLAGS="$LDFLAGS -RELEASE"
1046 LDFLAGS="$LDFLAGS -DYNAMICBASE"
1048 dnl Minimum reqiurement of Gecko is VS2015 or later which supports
1049 dnl both SSSE3 and SSE4.1.
1050 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
1051 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
1052 dnl allow AVX2 code from VS2015
1055 AC_DEFINE(WIN32_LEAN_AND_MEAN)
1056 dnl See http://support.microsoft.com/kb/143208 to use STL
1059 MOZ_USER_DIR="Mozilla"
1063 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.])
1067 if test -n "$GNU_CC" -a -z "$CLANG_CC"; then
1068 CFLAGS="$CFLAGS -fno-keep-inline-dllexport"
1069 CXXFLAGS="$CXXFLAGS -fno-keep-inline-dllexport"
1074 if test -n "$GNU_CC"; then
1075 CFLAGS="$CFLAGS -mstackrealign"
1076 CXXFLAGS="$CXXFLAGS -mstackrealign"
1077 LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup -Wl,--large-address-aware"
1079 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
1080 LDFLAGS="$LDFLAGS -SAFESEH"
1086 if test -n "$_WIN32_MSVC"; then
1087 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
1092 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
1099 CFLAGS="$CFLAGS -Dunix"
1100 CXXFLAGS="$CXXFLAGS -Dunix"
1101 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
1102 DSO_PIC_CFLAGS='-fPIC -DPIC'
1103 DSO_LDOPTS='-shared'
1104 MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
1106 DSO_PIC_CFLAGS='-fPIC -DPIC'
1107 DSO_LDOPTS='-shared'
1109 # This will fail on a.out systems prior to 1.5.1_ALPHA.
1110 if test "$LIBRUNPATH"; then
1111 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
1113 MKSHLIB='$(CXX) $(COMPUTED_CXX_LDFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
1114 MKCSHLIB='$(CC) $(COMPUTED_C_LDFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
1118 if test -z "$X11BASE"; then
1121 MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
1123 DSO_PIC_CFLAGS='-fPIC'
1124 DSO_LDOPTS='-shared -fPIC'
1125 if test "$LIBRUNPATH"; then
1126 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
1131 MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
1136 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
1137 MOZ_OPTIMIZE_FLAGS="-O"
1140 AC_SUBST_LIST(MMX_FLAGS)
1141 AC_SUBST_LIST(SSE_FLAGS)
1142 AC_SUBST_LIST(SSE2_FLAGS)
1143 AC_SUBST_LIST(SSSE3_FLAGS)
1145 AC_SUBST(MOZ_LINKER)
1146 if test -n "$MOZ_LINKER"; then
1147 AC_DEFINE(MOZ_LINKER)
1148 MOZ_LINKER_EXTRACT=1
1149 AC_CHECK_PROGS(XZ, xz)
1152 if test -z "$COMPILE_ENVIRONMENT"; then
1153 SKIP_COMPILER_CHECKS=1
1154 SKIP_LIBRARY_CHECKS=1
1159 fi # COMPILE_ENVIRONMENT
1161 if test -z "$SKIP_COMPILER_CHECKS"; then
1162 dnl Checks for typedefs, structures, and compiler characteristics.
1163 dnl ========================================================
1178 case "${OS_TARGET}" in
1182 STL_FLAGS="-I${DIST}/stl_wrappers"
1187 dnl Checks for header files.
1188 dnl ========================================================
1190 case "$target_os" in
1191 bitrig*|dragonfly*|freebsd*|openbsd*)
1192 # for stuff like -lXshm
1193 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
1197 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
1198 AC_CACHE_CHECK(for sockaddr_in.sin_len,
1199 ac_cv_sockaddr_in_sin_len,
1200 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1201 #include <sys/types.h>
1203 #include <netinet/in.h>
1204 struct sockaddr_in x;
1205 void *foo = (void*) &x.sin_len;],
1207 [ac_cv_sockaddr_in_sin_len=true],
1208 [ac_cv_sockaddr_in_sin_len=false])])
1209 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
1210 AC_DEFINE(HAVE_SIN_LEN)
1211 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
1212 AC_DEFINE(HAVE_SCONN_LEN)
1215 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
1216 ac_cv_sockaddr_in6_sin6_len,
1217 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1218 #include <sys/types.h>
1220 #include <netinet/in.h>
1221 struct sockaddr_in6 x;
1222 void *foo = (void*) &x.sin6_len;],
1224 [ac_cv_sockaddr_in6_sin6_len=true],
1225 [ac_cv_sockaddr_in6_sin6_len=false])])
1226 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
1227 AC_DEFINE(HAVE_SIN6_LEN)
1230 AC_CACHE_CHECK(for sockaddr.sa_len,
1231 ac_cv_sockaddr_sa_len,
1232 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1233 #include <sys/types.h>
1235 #include <sys/socket.h>
1237 void *foo = (void*) &x.sa_len;],
1239 [ac_cv_sockaddr_sa_len=true],
1240 [ac_cv_sockaddr_sa_len=false])])
1241 if test "$ac_cv_sockaddr_sa_len" = true ; then
1242 AC_DEFINE(HAVE_SA_LEN)
1245 MOZ_ARG_ENABLE_BOOL(dtrace,
1246 [ --enable-dtrace build with dtrace support if available (default=no)],
1247 [enable_dtrace="yes"],)
1248 if test "x$enable_dtrace" = "xyes"; then
1249 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
1250 if test -n "$HAVE_DTRACE"; then
1251 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
1253 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
1256 AC_SUBST(HAVE_DTRACE)
1258 dnl Checks for libraries.
1259 dnl ========================================================
1260 AC_CHECK_LIB(c_r, gethostbyname_r)
1262 dnl We don't want to link with libdl even if it's present on OS X, since
1263 dnl it's not used and not part of the default installation. OS/2 has dlfcn
1265 dnl We don't want to link against libm or libpthread on Darwin since
1266 dnl they both are just symlinks to libSystem and explicitly linking
1267 dnl against libSystem causes issues when debugging (see bug 299601).
1272 AC_SEARCH_LIBS(dlopen, dl,
1273 MOZ_CHECK_HEADER(dlfcn.h,
1274 AC_DEFINE(HAVE_DLOPEN)))
1278 _SAVE_CFLAGS="$CFLAGS"
1279 CFLAGS="$CFLAGS -D_GNU_SOURCE"
1280 AC_CHECK_FUNCS(dladdr memmem)
1281 CFLAGS="$_SAVE_CFLAGS"
1283 if test ! "$GNU_CXX"; then
1284 AC_CHECK_LIB(C, demangle)
1287 AC_CHECK_LIB(socket, socket)
1290 XLIBS="$X_EXTRA_LIBS"
1292 dnl ========================================================
1293 dnl Checks for X libraries.
1294 dnl Ordering is important.
1295 dnl Xt is dependent upon SM as of X11R6
1296 dnl ========================================================
1297 if test -n "$MOZ_X11"; then
1298 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
1299 _SAVE_LDFLAGS="$LDFLAGS"
1301 LDFLAGS="$XLDFLAGS $LDFLAGS"
1302 AC_CHECK_LIB(X11, XDrawLines, [XLIBS="-lX11 $XLIBS"],
1303 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
1304 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
1305 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
1307 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
1308 unset ac_cv_lib_Xt_XtFree
1309 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
1310 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
1311 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
1312 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
1315 dnl ========================================================
1317 dnl ========================================================
1318 AC_CHECK_LIB(xcb, xcb_connect, [XLIBS="-lxcb $XLIBS"],
1319 [MISSING_X="$MISSING_X -lxcb"], $XLIBS)
1320 AC_CHECK_LIB(xcb-shm, xcb_shm_query_version, [XLIBS="-lxcb-shm $XLIBS"],
1321 [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS)
1322 AC_CHECK_LIB(X11-xcb, XGetXCBConnection, [XLIBS="-lX11-xcb $XLIBS"],
1323 [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS)
1325 LDFLAGS="$_SAVE_LDFLAGS"
1329 AC_SUBST_LIST(XCFLAGS)
1330 AC_SUBST_LIST(XLDFLAGS)
1331 AC_SUBST_LIST(XLIBS)
1332 AC_SUBST_LIST(XEXT_LIBS)
1333 AC_SUBST_LIST(XT_LIBS)
1335 dnl ========================================================
1336 dnl = pthread support
1337 dnl = Start by checking whether the system support pthreads
1338 dnl ========================================================
1339 case "$target_os" in
1344 AC_CHECK_LIB(pthreads, pthread_create,
1345 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
1346 AC_CHECK_LIB(pthread, pthread_create,
1347 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
1348 AC_CHECK_LIB(c_r, pthread_create,
1349 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
1350 AC_CHECK_LIB(c, pthread_create,
1359 dnl ========================================================
1360 dnl Do the platform specific pthread hackery
1361 dnl ========================================================
1362 if test "$MOZ_USE_PTHREADS"x != x
1365 dnl See if -pthread is supported.
1368 ac_cv_have_dash_pthread=no
1369 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
1370 echo 'int main() { return 0; }' | cat > conftest.c
1371 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
1372 if test $? -eq 0; then
1373 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1374 ac_cv_have_dash_pthread=yes
1375 case "$target_os" in
1377 # Freebsd doesn't use -pthread for compiles, it uses them for linking
1380 CFLAGS="$CFLAGS -pthread"
1381 CXXFLAGS="$CXXFLAGS -pthread"
1387 AC_MSG_RESULT($ac_cv_have_dash_pthread)
1390 dnl See if -pthreads is supported.
1392 ac_cv_have_dash_pthreads=no
1393 if test "$ac_cv_have_dash_pthread" = "no"; then
1394 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
1395 echo 'int main() { return 0; }' | cat > conftest.c
1396 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
1397 if test $? -eq 0; then
1398 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1399 ac_cv_have_dash_pthreads=yes
1400 CFLAGS="$CFLAGS -pthreads"
1401 CXXFLAGS="$CXXFLAGS -pthreads"
1405 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
1410 AC_DEFINE(_REENTRANT)
1411 AC_DEFINE(_THREAD_SAFE)
1412 dnl -pthread links in -lpthread, so don't specify it explicitly.
1413 if test "$ac_cv_have_dash_pthread" = "yes"; then
1414 _PTHREAD_LDFLAGS="-pthread"
1418 *-*-openbsd*|*-*-bsdi*)
1419 AC_DEFINE(_REENTRANT)
1420 AC_DEFINE(_THREAD_SAFE)
1421 dnl -pthread links in -lc_r, so don't specify it explicitly.
1422 if test "$ac_cv_have_dash_pthread" = "yes"; then
1423 _PTHREAD_LDFLAGS="-pthread"
1427 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
1428 AC_DEFINE(_REENTRANT)
1432 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
1433 AC_SUBST(MOZ_USE_PTHREADS)
1434 MOZ_CHECK_HEADERS(pthread.h)
1438 dnl Checks for library functions.
1439 dnl ========================================================
1440 AC_PROG_GCC_TRADITIONAL
1442 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall)
1444 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1445 dnl avoid this on Darwin, since depending on your system config, we may think
1446 dnl it exists but it really doesn't
1447 case "$OS_TARGET" in
1451 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1452 ac_cv_clock_monotonic,
1453 [for libs in "" -lrt; do
1456 AC_TRY_LINK([#include <time.h>],
1457 [ struct timespec ts;
1458 clock_gettime(CLOCK_MONOTONIC, &ts); ],
1459 ac_cv_clock_monotonic=$libs
1462 ac_cv_clock_monotonic=no)
1465 if test "$ac_cv_clock_monotonic" != "no"; then
1466 HAVE_CLOCK_MONOTONIC=1
1467 REALTIME_LIBS=$ac_cv_clock_monotonic
1468 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1469 AC_SUBST(HAVE_CLOCK_MONOTONIC)
1470 AC_SUBST_LIST(REALTIME_LIBS)
1475 AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
1476 ac_cv_pthread_cond_timedwait_monotonic_np,
1477 AC_TRY_LINK([#include <pthread.h>],
1478 [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
1479 ac_cv_pthread_cond_timewait_monotonic_np=yes,
1480 ac_cv_pthread_cond_timewait_monotonic_np=no))
1481 if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
1482 AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
1487 ac_cv_func_res_ninit,
1488 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
1489 dnl no need for res_ninit() on NetBSD and OpenBSD
1490 ac_cv_func_res_ninit=no
1494 #define _BSD_SOURCE 1
1496 #include <sys/types.h>
1497 #include <netinet/in.h>
1498 #include <arpa/nameser.h>
1501 [int foo = res_ninit(&_res);],
1502 [ac_cv_func_res_ninit=yes],
1503 [ac_cv_func_res_ninit=no])
1507 if test "$ac_cv_func_res_ninit" = "yes"; then
1508 AC_DEFINE(HAVE_RES_NINIT)
1509 dnl must add the link line we do something as foolish as this... dougt
1511 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
1512 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
1517 dnl **********************
1518 dnl *** va_copy checks ***
1519 AC_CACHE_CHECK([for an implementation of va_copy()],
1521 [AC_TRY_COMPILE([#include <stdarg.h>
1523 void f (int i, ...) {
1524 va_list args1, args2;
1525 va_start (args1, i);
1526 va_copy (args2, args1);
1527 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1529 va_end (args1); va_end (args2);
1531 [f(0, 42); return 0],
1532 [ac_cv_va_copy=yes],
1536 AC_CACHE_CHECK([whether va_list can be copied by value],
1538 [AC_TRY_COMPILE([#include <stdarg.h>
1540 void f (int i, ...) {
1541 va_list args1, args2;
1542 va_start (args1, i);
1544 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1546 va_end (args1); va_end (args2);
1548 [f(0, 42); return 0],
1549 [ac_cv_va_val_copy=yes],
1550 [ac_cv_va_val_copy=no],
1553 if test "x$ac_cv_va_copy" = "xyes"; then
1554 AC_DEFINE(VA_COPY, va_copy)
1555 AC_DEFINE(HAVE_VA_COPY)
1558 if test "x$ac_cv_va_val_copy" = "xno"; then
1559 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
1562 dnl ===================================================================
1563 dnl ========================================================
1564 dnl Put your C++ language/feature checks below
1565 dnl ========================================================
1569 if test "$GNU_CC"; then
1570 if test "$CPU_ARCH" = "arm" ; then
1571 AC_CACHE_CHECK(for ARM EABI,
1575 #if defined(__ARM_EABI__)
1578 #error Not ARM EABI.
1581 ac_cv_gcc_arm_eabi="yes",
1582 ac_cv_gcc_arm_eabi="no")])
1583 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
1585 ARM_ABI_PREFIX=eabi-
1587 ARM_ABI_PREFIX=oabi-
1591 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
1594 dnl See if a dynamic_cast to void* gives the most derived object.
1595 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
1596 ac_cv_cpp_dynamic_cast_void_ptr,
1597 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
1598 class Y { int j; public: virtual ~Y() { } };
1599 class Z : public X, public Y { int k; };
1605 return !((((void*)&mdo != (void*)subx) &&
1606 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
1607 (((void*)&mdo != (void*)suby) &&
1608 ((void*)&mdo == dynamic_cast<void*>(suby))));
1610 ac_cv_cpp_dynamic_cast_void_ptr=yes,
1611 ac_cv_cpp_dynamic_cast_void_ptr=no,
1612 ac_cv_cpp_dynamic_cast_void_ptr=no)])
1613 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
1614 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
1618 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
1619 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
1620 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
1622 _SAVE_LDFLAGS=$LDFLAGS
1623 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
1624 AC_CACHE_CHECK(for __thread keyword for TLS variables,
1625 ac_cv_thread_keyword,
1626 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
1627 [return tlsIsMainThread;],
1628 ac_cv_thread_keyword=yes,
1629 ac_cv_thread_keyword=no)])
1630 LDFLAGS=$_SAVE_LDFLAGS
1631 # The custom dynamic linker doesn't support TLS variables
1633 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
1634 # mips builds fail with TLS variables because of a binutils bug.
1636 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
1641 *-android*|*-linuxandroid*)
1648 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
1654 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
1655 if test -n "$MOZ_LINKER"; then
1656 if test "$CPU_ARCH" = arm; then
1657 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
1658 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
1659 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1660 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1664 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
1665 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
1666 dnl Since the linker only understands the sysv ones, no need to build the
1667 dnl gnu style tables anyways.
1668 LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
1671 dnl End of C++ language/feature checks
1674 dnl ========================================================
1675 dnl = Internationalization checks
1676 dnl ========================================================
1678 dnl Internationalization and Locale support is different
1679 dnl on various UNIX platforms. Checks for specific i18n
1680 dnl features go here.
1682 AC_HAVE_FUNCS(localeconv)
1684 fi # ! SKIP_COMPILER_CHECKS
1686 if test -n "${COMPILE_ENVIRONMENT}"; then
1691 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1692 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1693 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1696 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1697 dnl features that Windows actually does support.
1699 if test -n "$SKIP_COMPILER_CHECKS"; then
1700 dnl Windows has malloc.h
1701 AC_DEFINE(MALLOC_H, [<malloc.h>])
1702 AC_DEFINE(HAVE_FORCEINLINE)
1703 AC_DEFINE(HAVE_LOCALECONV)
1704 fi # SKIP_COMPILER_CHECKS
1706 dnl Mozilla specific options
1707 dnl ========================================================
1708 dnl The macros used for command line options
1709 dnl are defined in build/autoconf/altoptions.m4.
1711 dnl ========================================================
1713 dnl = Check for external package dependencies
1715 dnl ========================================================
1716 MOZ_ARG_HEADER(External Packages)
1718 case "$OS_TARGET" in
1719 WINNT|Darwin|Android)
1729 dnl ========================================================
1730 dnl system libevent Support
1731 dnl ========================================================
1732 MOZ_ARG_WITH_STRING(system-libevent,
1733 [ --with-system-libevent[=PFX]
1734 Use system libevent [installed at prefix PFX]],
1735 LIBEVENT_DIR=$withval)
1737 _SAVE_CFLAGS=$CFLAGS
1738 _SAVE_LDFLAGS=$LDFLAGS
1740 if test "$LIBEVENT_DIR" = yes; then
1741 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
1742 MOZ_SYSTEM_LIBEVENT=1,
1745 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
1746 MOZ_SYSTEM_LIBEVENT=
1747 elif test -z "$MOZ_SYSTEM_LIBEVENT"; then
1748 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
1749 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
1750 MOZ_CHECK_HEADER(event.h,
1751 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
1752 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
1754 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
1755 AC_CHECK_LIB(event, event_init,
1756 [MOZ_SYSTEM_LIBEVENT=1
1757 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
1758 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
1759 [MOZ_SYSTEM_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
1761 CFLAGS=$_SAVE_CFLAGS
1762 LDFLAGS=$_SAVE_LDFLAGS
1765 AC_SUBST(MOZ_SYSTEM_LIBEVENT)
1767 dnl ========================================================
1768 dnl = If NSS was not detected in the system,
1769 dnl = use the one in the source tree (mozilla/security/nss)
1770 dnl ========================================================
1772 MOZ_ARG_WITH_BOOL(system-nss,
1773 [ --with-system-nss Use system installed NSS],
1776 if test -n "$_USE_SYSTEM_NSS"; then
1777 AM_PATH_NSS(3.39, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
1780 if test -z "$MOZ_SYSTEM_NSS"; then
1781 NSS_CFLAGS="-I${DIST}/include/nss"
1782 case "${OS_ARCH}" in
1783 # Only few platforms have been tested with GYP
1784 WINNT|Darwin|Linux|DragonFly|FreeBSD|NetBSD|OpenBSD|SunOS)
1787 AC_MSG_ERROR([building in-tree NSS is not supported on this platform. Use --with-system-nss])
1792 if test -z "$SKIP_LIBRARY_CHECKS"; then
1793 dnl system JPEG support
1794 dnl ========================================================
1795 MOZ_ARG_WITH_STRING(system-jpeg,
1796 [ --with-system-jpeg[=PFX]
1797 Use system libjpeg [installed at prefix PFX]],
1800 _SAVE_CFLAGS=$CFLAGS
1801 _SAVE_LDFLAGS=$LDFLAGS
1803 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
1804 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
1805 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
1807 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
1810 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_SYSTEM_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_SYSTEM_JPEG=)
1813 if test "$MOZ_SYSTEM_JPEG" = 1; then
1814 AC_TRY_COMPILE([ #include <stdio.h>
1815 #include <sys/types.h>
1816 #include <jpeglib.h> ],
1817 [ #if JPEG_LIB_VERSION < $MOZJPEG
1818 #error "Insufficient JPEG library version ($MOZJPEG required)."
1820 #ifndef JCS_EXTENSIONS
1821 #error "libjpeg-turbo JCS_EXTENSIONS required"
1825 AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
1827 CFLAGS=$_SAVE_CFLAGS
1828 LDFLAGS=$_SAVE_LDFLAGS
1831 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_SYSTEM_JPEG" = 1; then
1832 MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
1833 MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
1835 fi # SKIP_LIBRARY_CHECKS
1837 dnl system ZLIB support
1838 dnl ========================================================
1839 MOZ_ZLIB_CHECK([1.2.3])
1841 if test -z "$SKIP_LIBRARY_CHECKS"; then
1843 dnl ========================================================
1844 dnl system PNG Support
1845 dnl ========================================================
1846 MOZ_ARG_WITH_STRING(system-png,
1847 [ --with-system-png[=PFX]
1848 Use system libpng [installed at prefix PFX]],
1851 _SAVE_CFLAGS=$CFLAGS
1852 _SAVE_LDFLAGS=$LDFLAGS
1854 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
1855 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
1856 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
1858 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
1861 AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"],
1862 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1863 AC_CHECK_LIB(png, png_get_acTL, ,
1864 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
1866 if test "$MOZ_SYSTEM_PNG" = 1; then
1867 AC_TRY_COMPILE([ #include <stdio.h>
1868 #include <sys/types.h>
1870 [ #if PNG_LIBPNG_VER < $MOZPNG
1871 #error "Insufficient libpng version ($MOZPNG required)."
1873 #ifndef PNG_UINT_31_MAX
1874 #error "Insufficient libpng version."
1877 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1879 CFLAGS=$_SAVE_CFLAGS
1880 LDFLAGS=$_SAVE_LDFLAGS
1883 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then
1884 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
1885 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
1888 fi # SKIP_LIBRARY_CHECKS
1890 dnl ========================================================
1894 dnl ========================================================
1896 MOZ_ARG_HEADER(Application)
1898 ENABLE_SYSTEM_EXTENSION_DIRS=1
1899 MOZ_BRANDING_DIRECTORY=
1900 MOZ_OFFICIAL_BRANDING=
1902 MOZ_AUTH_EXTENSION=1
1903 if test "$MOZ_IOS"; then
1908 MOZ_WEBRTC_HARDWARE_AEC_NS=
1916 LIBJPEG_TURBO_ASFLAGS=
1917 MOZ_PREF_EXTENSIONS=1
1920 MOZ_TOOLKIT_SEARCH=1
1921 MOZ_UNIVERSALCHARDET=1
1926 MOZ_USE_NATIVE_POPUP_WINDOWS=
1927 MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
1929 MOZ_CONTENT_SANDBOX=
1932 MOZ_BINARY_EXTENSIONS=
1935 case "$target_os" in
1938 AC_DEFINE(NS_ENABLE_TSF)
1943 *-android*|*-linuxandroid*)
1949 # Optional Firefox for Android partner distribution directory.
1950 MOZ_ARG_WITH_STRING(android-distribution-directory,
1951 [ --with-android-distribution-directory=dir
1952 Optional Firefox for Android partner distribution directory.],
1953 MOZ_ANDROID_DISTRIBUTION_DIRECTORY=$withval)
1955 if test -n "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY"; then
1956 # A distribution directory must have an assets/distribution directory.
1957 # See https://wiki.mozilla.org/Mobile/Distribution_Files.
1958 if test ! -d "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY/assets/distribution" ; then
1959 AC_MSG_ERROR([--with-android-distribution-directory does not contain assets/distribution;
1960 (looked for ${MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets/distribution).])
1963 AC_SUBST(MOZ_ANDROID_DISTRIBUTION_DIRECTORY)
1965 dnl ========================================================
1966 dnl = Trademarked Branding
1967 dnl ========================================================
1968 MOZ_ARG_ENABLE_BOOL(official-branding,
1969 [ --enable-official-branding
1970 Enable Official mozilla.org Branding
1971 Do not distribute builds with
1972 --enable-official-branding unless you have
1973 permission to use trademarks per
1974 http://www.mozilla.org/foundation/trademarks/ .],
1975 MOZ_OFFICIAL_BRANDING=1,
1976 MOZ_OFFICIAL_BRANDING=)
1978 # Allow the application to influence configure with a confvars.sh script.
1979 AC_MSG_CHECKING([if app-specific confvars.sh exists])
1980 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
1981 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
1982 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
1987 # Allow influencing configure with a defines.sh script.
1988 . "${srcdir}/build/defines.sh"
1990 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
1992 if test "$BUILDING_RELEASE"; then
1993 # Override value in defines.sh, if any
1994 EARLY_BETA_OR_EARLIER=
1995 elif test "$EARLY_BETA_OR_EARLIER"; then
1996 AC_DEFINE(EARLY_BETA_OR_EARLIER)
1998 AC_SUBST(EARLY_BETA_OR_EARLIER)
2000 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
2001 MOZ_ARG_WITH_STRING(app-name,
2002 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
2003 WITH_APP_NAME=$withval,
2006 if test -n "$WITH_APP_NAME" ; then
2007 MOZ_APP_NAME="$WITH_APP_NAME"
2010 MOZ_ARG_WITH_STRING(app-basename,
2011 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
2012 WITH_APP_BASENAME=$withval,
2015 if test -n "$WITH_APP_BASENAME" ; then
2016 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
2019 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
2020 # that haven't made a confvars.sh yet. Don't add new stuff here, use
2022 case "$MOZ_BUILD_APP" in
2024 AC_DEFINE(MOZ_PHOENIX)
2028 AC_DEFINE(MOZ_XULRUNNER)
2032 # Graphene is a desktop runtime for running applications with a HTML UI.
2033 if test -n "$MOZ_GRAPHENE"; then
2034 AC_DEFINE(MOZ_GRAPHENE)
2037 if test -n "$MOZ_MULET"; then
2038 AC_DEFINE(MOZ_MULET)
2041 AC_SUBST(MOZ_PHOENIX)
2042 AC_SUBST(MOZ_XULRUNNER)
2045 dnl ========================================================
2046 dnl Ensure Android SDK and build-tools versions depending on
2048 dnl ========================================================
2050 case "$MOZ_BUILD_APP" in
2052 MOZ_ANDROID_SDK(26, 23, 26.0.2)
2056 dnl ========================================================
2058 dnl = Toolkit Options
2060 dnl ========================================================
2061 MOZ_ARG_HEADER(Toolkit Options)
2063 dnl ========================================================
2064 dnl = Enable the toolkit as needed =
2065 dnl ========================================================
2067 case "$MOZ_WIDGET_TOOLKIT" in
2070 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
2071 # Use -Wl as a trick to avoid -framework and framework names from
2072 # being separated by AC_SUBST_LIST.
2073 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'
2075 CFLAGS="$CFLAGS $TK_CFLAGS"
2076 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
2077 MOZ_USER_DIR="Mozilla"
2078 MOZ_FS_LAYOUT=bundle
2082 LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
2084 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'
2085 CFLAGS="$CFLAGS $TK_CFLAGS"
2086 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
2087 MOZ_USER_DIR="Mozilla"
2088 MOZ_FS_LAYOUT=bundle
2093 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
2094 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
2095 case "$MOZ_WIDGET_TOOLKIT" in
2101 if test "$COMPILE_ENVIRONMENT"; then
2102 if test "$MOZ_WIDGET_TOOLKIT" = gtk3; then
2103 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)
2104 MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
2105 TK_CFLAGS=$MOZ_GTK3_CFLAGS
2106 TK_LIBS=$MOZ_GTK3_LIBS
2107 dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
2108 dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
2109 AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
2110 GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32
2112 if test "$MOZ_WIDGET_TOOLKIT" = gtk2; then
2113 GLIB_VERSION_MAX_ALLOWED=$GLIB_VERSION_MIN_REQUIRED
2115 if test "$MOZ_ENABLE_GTK"; then
2116 if test "$MOZ_X11"; then
2117 GDK_PACKAGES=gdk-x11-2.0
2119 AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
2120 AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
2122 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)
2123 MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
2125 if test "$MOZ_WIDGET_TOOLKIT" = gtk2; then
2126 TK_CFLAGS=$MOZ_GTK2_CFLAGS
2127 TK_LIBS=$MOZ_GTK2_LIBS
2129 fi # COMPILE_ENVIRONMENT
2131 AC_SUBST(MOZ_FS_LAYOUT)
2133 dnl ========================================================
2134 dnl = startup-notification support module
2135 dnl ========================================================
2137 if test "$MOZ_ENABLE_GTK"
2139 MOZ_ENABLE_STARTUP_NOTIFICATION=
2141 MOZ_ARG_ENABLE_BOOL(startup-notification,
2142 [ --enable-startup-notification
2143 Enable startup-notification support (default: disabled) ],
2144 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
2145 MOZ_ENABLE_STARTUP_NOTIFICATION=)
2146 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
2148 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
2149 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
2150 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
2151 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
2153 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
2155 MOZ_ENABLE_STARTUP_NOTIFICATION=
2159 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
2160 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
2163 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
2165 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
2167 AC_SUBST_LIST(TK_CFLAGS)
2168 AC_SUBST_LIST(TK_LIBS)
2173 dnl ========================================================
2175 dnl = Components & Features
2177 dnl ========================================================
2178 MOZ_ARG_HEADER(Components and Features)
2180 AC_SUBST(MOZ_OFFICIAL_BRANDING)
2181 if test -n "$MOZ_OFFICIAL_BRANDING"; then
2182 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
2183 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
2185 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
2186 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
2190 MOZ_ARG_WITH_STRING(branding,
2191 [ --with-branding=dir Use branding from the specified directory.],
2192 MOZ_BRANDING_DIRECTORY=$withval)
2194 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
2195 if test -z "$REAL_BRANDING_DIRECTORY"; then
2196 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
2199 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
2200 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
2201 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
2202 . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
2205 AC_SUBST(MOZ_BRANDING_DIRECTORY)
2207 dnl ========================================================
2208 dnl = Distribution ID
2209 dnl ========================================================
2210 MOZ_ARG_WITH_STRING(distribution-id,
2211 [ --with-distribution-id=ID
2212 Set distribution-specific id (default=org.mozilla)],
2213 [ val=`echo $withval`
2214 MOZ_DISTRIBUTION_ID="$val"])
2216 if test -z "$MOZ_DISTRIBUTION_ID"; then
2217 MOZ_DISTRIBUTION_ID="org.mozilla"
2220 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
2221 AC_SUBST(MOZ_DISTRIBUTION_ID)
2223 dnl ========================================================
2224 dnl = GConf support module
2225 dnl ========================================================
2229 if test "$MOZ_ENABLE_GTK"
2234 dnl ========================================================
2235 dnl = GConf support module
2236 dnl ========================================================
2237 MOZ_ARG_DISABLE_BOOL(gconf,
2238 [ --disable-gconf Disable Gconf support ],
2242 if test "$MOZ_ENABLE_GCONF"
2244 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
2245 MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
2248 if test -n "$MOZ_ENABLE_GCONF";
2250 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
2252 AC_MSG_WARN([Many automated tests will fail with --disable-gconf. See bug 1167201.])
2257 if test "$MOZ_ENABLE_GCONF"; then
2258 AC_DEFINE(MOZ_ENABLE_GCONF)
2261 AC_SUBST(MOZ_ENABLE_GCONF)
2264 dnl ========================================================
2265 dnl = libproxy support
2266 dnl ========================================================
2268 if test "$MOZ_ENABLE_GTK"
2270 MOZ_ENABLE_LIBPROXY=
2272 MOZ_ARG_ENABLE_BOOL(libproxy,
2273 [ --enable-libproxy Enable libproxy support ],
2274 MOZ_ENABLE_LIBPROXY=1,
2275 MOZ_ENABLE_LIBPROXY=)
2277 if test "$MOZ_ENABLE_LIBPROXY"
2279 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
2280 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
2283 AC_SUBST(MOZ_ENABLE_LIBPROXY)
2285 dnl ========================================================
2287 dnl ========================================================
2289 if test "$MOZ_ENABLE_GTK"
2293 MOZ_ARG_DISABLE_BOOL(dbus,
2294 [ --disable-dbus Disable dbus support ],
2298 if test "$MOZ_ENABLE_DBUS"
2300 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
2301 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
2302 AC_DEFINE(MOZ_ENABLE_DBUS)
2305 AC_SUBST(MOZ_ENABLE_DBUS)
2307 dnl =========================================================
2308 dnl = Whether to exclude hyphenations files in the build
2309 dnl =========================================================
2310 if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
2311 AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
2314 dnl ========================================================
2315 dnl accessibility support on by default on all platforms
2316 dnl ========================================================
2317 MOZ_ARG_DISABLE_BOOL(accessibility,
2318 [ --disable-accessibility Disable accessibility support],
2321 if test "$ACCESSIBILITY"; then
2324 if test -z "$MIDL"; then
2325 if test "$GCC" != "yes"; then
2326 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
2328 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.])
2332 AC_DEFINE(ACCESSIBILITY)
2335 dnl ========================================================
2336 dnl Accessibility is required for the linuxgl widget
2338 dnl ========================================================
2339 if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
2340 AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
2343 AC_TRY_COMPILE([#include <linux/ethtool.h>],
2344 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
2345 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
2347 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
2349 if test -n "$MOZ_WEBRTC"; then
2355 if test -n "$MOZ_X11"; then
2356 MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
2360 dnl ========================================================
2361 dnl = Force hardware AEC, disable webrtc.org AEC
2362 dnl ========================================================
2363 MOZ_ARG_ENABLE_BOOL(hardware-aec-ns,
2364 [ --enable-hardware-aec-ns Enable support for hardware AEC and noise suppression],
2365 MOZ_WEBRTC_HARDWARE_AEC_NS=1,
2366 MOZ_WEBRTC_HARDWARE_AEC_NS=)
2368 if test -n "$MOZ_WEBRTC_HARDWARE_AEC_NS"; then
2369 AC_DEFINE(MOZ_WEBRTC_HARDWARE_AEC_NS)
2372 AC_SUBST(MOZ_WEBRTC_HARDWARE_AEC_NS)
2375 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
2377 dnl ========================================================
2378 dnl = Enable Raw Codecs
2379 dnl ========================================================
2380 MOZ_ARG_ENABLE_BOOL(raw,
2381 [ --enable-raw Enable support for RAW media],
2385 if test -n "$MOZ_RAW"; then
2391 dnl ========================================================
2392 dnl = Apple platform decoder support
2393 dnl ========================================================
2394 if test "$COMPILE_ENVIRONMENT"; then
2395 if test -n "$MOZ_APPLEMEDIA"; then
2396 # hack in frameworks for fmp4 - see bug 1029974
2397 # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
2398 LDFLAGS="$LDFLAGS -framework AudioToolbox"
2399 dnl Verify CoreMedia is available.
2400 AC_CHECK_HEADER([CoreMedia/CoreMedia.h], [],
2401 [AC_MSG_ERROR([MacOS X 10.9 SDK or later is required])])
2403 fi # COMPILE_ENVIRONMENT
2405 dnl system libvpx Support
2406 dnl ========================================================
2407 MOZ_ARG_WITH_BOOL(system-libvpx,
2408 [ --with-system-libvpx Use system libvpx (located with pkgconfig)],
2409 MOZ_SYSTEM_LIBVPX=1)
2414 _SAVE_CFLAGS=$CFLAGS
2416 if test -n "$MOZ_SYSTEM_LIBVPX"; then
2417 dnl ============================
2418 dnl === libvpx Version check ===
2419 dnl ============================
2420 dnl Check to see if we have a system libvpx package.
2421 PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.5.0)
2423 CFLAGS="$CFLAGS $MOZ_LIBVPX_CFLAGS"
2424 LIBS="$LIBS $MOZ_LIBVPX_LIBS"
2426 MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
2427 [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.])])
2429 AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
2430 [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
2432 MOZ_CHECK_HEADER([vpx_mem/vpx_mem.h],
2433 [AC_CHECK_FUNC(vpx_mem_set_functions)])
2434 if test "$ac_cv_header_vpx_mem_vpx_mem_h" = no -o \
2435 "$ac_cv_func_vpx_mem_set_functions" = no; then
2436 AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
2439 CFLAGS=$_SAVE_CFLAGS
2442 AC_SUBST(MOZ_SYSTEM_LIBVPX)
2443 AC_SUBST_LIST(MOZ_LIBVPX_CFLAGS)
2444 AC_SUBST_LIST(MOZ_LIBVPX_LIBS)
2446 if test -z "$MOZ_SYSTEM_LIBVPX"; then
2448 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
2449 dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
2450 dnl We currently require gcc on all arm platforms.
2452 dnl See if we have assembly on this platform.
2453 case "$OS_ARCH:$CPU_ARCH" in
2467 dnl Check for yasm 1.1 or greater.
2468 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
2469 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.])
2470 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
2471 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.])
2475 dnl The encoder needs obj_int_extract to get asm offsets.
2476 fi # COMPILE_ENVIRONMENT and others
2479 if test -n "$GNU_AS" ; then
2480 dnl These flags are a lie; they're just used to enable the requisite
2481 dnl opcodes; actual arch detection is done at runtime.
2482 VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
2483 VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/libvpx/build/make/ads2gas.pl'
2485 dnl Building with -mfpu=neon requires either the "softfp" or the
2486 dnl "hardfp" ABI. Depending on the compiler's default target, and the
2487 dnl CFLAGS, the default ABI might be neither, in which case it is the
2488 dnl "softfloat" ABI.
2489 dnl The "softfloat" ABI is binary-compatible with the "softfp" ABI, so
2490 dnl we can safely mix code built with both ABIs. So, if we detect
2491 dnl that compiling uses the "softfloat" ABI, force the use of the
2492 dnl "softfp" ABI instead.
2493 dnl Confusingly, the __SOFTFP__ preprocessor variable indicates the
2494 dnl "softfloat" ABI, not the "softfp" ABI.
2495 dnl Note: VPX_ASFLAGS is also used in CFLAGS.
2498 #error "compiler target supports -mfpu=neon, so we don't have to add extra flags"
2500 VPX_ASFLAGS="$VPX_ASFLAGS -mfloat-abi=softfp"
2505 if $CC -E -dM -</dev/null | grep -q __ELF__; then
2511 if $CC -E -dM -</dev/null | grep -q __ELF__; then
2518 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_USE_YASM" -a -z "$YASM"; then
2519 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.])
2520 fi # COMPILE_ENVIRONMENT and others
2522 if test -n "$VPX_USE_YASM" && test "$OS_ARCH:$CPU_ARCH" != "WINNT:x86_64"; then
2526 if test -n "$VPX_X86_ASM"; then
2527 AC_DEFINE(VPX_X86_ASM)
2528 elif test -n "$VPX_ARM_ASM"; then
2529 AC_DEFINE(VPX_ARM_ASM)
2531 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
2534 dnl native libvpx no longer has vpx_mem_set_functions
2535 AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
2538 dnl ========================================================
2539 dnl = Handle dependent MEDIA defines
2540 dnl ========================================================
2543 AC_DEFINE(MOZ_WEBM_ENCODER)
2544 AC_SUBST(MOZ_WEBM_ENCODER)
2546 dnl ========================================================
2548 dnl ========================================================
2550 MOZ_ARG_DISABLE_BOOL(negotiateauth,
2551 [ --disable-negotiateauth Disable GSS-API negotiation ],
2552 MOZ_AUTH_EXTENSION=,
2553 MOZ_AUTH_EXTENSION=1 )
2555 if test -n "$MOZ_IOS" -a -n "$MOZ_AUTH_EXTENSION"; then
2556 AC_MSG_ERROR([negotiateauth is not supported on iOS.])
2559 dnl ========================================================
2560 dnl Pref extensions (autoconfig)
2561 dnl ========================================================
2562 MOZ_ARG_DISABLE_BOOL(pref-extensions,
2563 [ --disable-pref-extensions
2564 Disable pref extensions such as autoconfig],
2565 MOZ_PREF_EXTENSIONS=,
2566 MOZ_PREF_EXTENSIONS=1 )
2568 dnl ========================================================
2569 dnl Searching of system directories for extensions.
2570 dnl Note: this switch is meant to be used for test builds
2571 dnl whose behavior should not depend on what happens to be
2572 dnl installed on the local machine.
2573 dnl ========================================================
2574 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
2575 [ --disable-system-extension-dirs
2576 Disable searching system- and account-global
2577 directories for extensions of any kind; use
2578 only profile-specific extension directories],
2579 ENABLE_SYSTEM_EXTENSION_DIRS=,
2580 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
2581 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
2582 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
2585 dnl ========================================================
2586 dnl = Universalchardet
2587 dnl ========================================================
2588 MOZ_ARG_DISABLE_BOOL(universalchardet,
2589 [ --disable-universalchardet
2590 Disable universal encoding detection],
2591 MOZ_UNIVERSALCHARDET=,
2592 MOZ_UNIVERSALCHARDET=1 )
2594 dnl ========================================================
2595 dnl = ANGLE OpenGL->D3D translator for WebGL
2596 dnl = * only applies to win32 (and then, not MINGW)
2597 dnl ========================================================
2601 MOZ_HAS_WINSDK_WITH_D3D=
2602 MOZ_D3DCOMPILER_VISTA_DLL=
2603 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
2605 if test "$COMPILE_ENVIRONMENT" ; then
2606 case "$target_os" in
2608 MOZ_ANGLE_RENDERER=1
2612 # The DirectX SDK libraries are split into x86 and x64 sub-directories
2613 case "${target_cpu}" in
2615 MOZ_D3D_CPU_SUFFIX=x86
2618 MOZ_D3D_CPU_SUFFIX=x64
2622 dnl ========================================================
2623 dnl D3D compiler DLL
2624 dnl ========================================================
2625 MOZ_FOUND_D3D_COMPILERS=
2627 if test -n "$MOZ_ANGLE_RENDERER"; then
2628 if test -z "$MOZ_D3D_CPU_SUFFIX"; then
2629 AC_MSG_ERROR([Couldn't determine MOZ_D3D_CPU_SUFFIX.])
2632 ######################################
2633 # Find _46+ for use by Vista+.
2635 # Find a D3D compiler DLL in a Windows SDK.
2636 MOZ_D3DCOMPILER_VISTA_DLL=
2637 case "$MOZ_WINSDK_MAXVER" in
2639 MOZ_D3DCOMPILER_VISTA_DLL=d3dcompiler_47.dll
2640 AC_MSG_RESULT([Found D3D compiler in Windows SDK.])
2644 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
2645 # We have a name, now track down the path.
2646 if test -n "$WINDOWSSDKDIR"; then
2647 MOZ_D3DCOMPILER_VISTA_DLL_PATH="$WINDOWSSDKDIR/Redist/D3D/$MOZ_D3D_CPU_SUFFIX/$MOZ_D3DCOMPILER_VISTA_DLL"
2648 if test -f "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
2649 AC_MSG_RESULT([Found MOZ_D3DCOMPILER_VISTA_DLL_PATH: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
2650 MOZ_HAS_WINSDK_WITH_D3D=1
2652 AC_MSG_RESULT([MOZ_D3DCOMPILER_VISTA_DLL_PATH doesn't exist: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
2653 AC_MSG_ERROR([Windows SDK at "$WINDOWSSDKDIR" appears broken. Try updating to MozillaBuild 1.9 final or higher.])
2654 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
2657 AC_MSG_RESULT([Windows SDK not found.])
2660 if test "$OS_ARCH" = "$HOST_OS_ARCH"; then
2661 AC_MSG_ERROR([Couldn't find Windows SDK 8.1 or higher needed for ANGLE.])
2663 AC_MSG_RESULT([Windows SDK not needed for ANGLE in Linux MinGW build.])
2667 if test -z "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
2668 MOZ_D3DCOMPILER_VISTA_DLL=
2671 # On mingw, check if headers are provided by toolchain.
2672 if test -n "$GNU_CC"; then
2673 MOZ_CHECK_HEADER(d3d10.h, MOZ_HAS_WINSDK_WITH_D3D=1)
2676 ######################################
2677 # Check that we found what we needed.
2678 MOZ_FOUND_A_D3D_COMPILER=
2680 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
2681 MOZ_FOUND_A_D3D_COMPILER=1
2682 AC_MSG_RESULT([Found d3dcompiler DLL for Vista+: $MOZ_D3DCOMPILER_VISTA_DLL])
2685 if test -z "$CROSS_COMPILE"; then
2686 if test -z "MOZ_FOUND_A_D3D_COMPILER"; then
2687 AC_MSG_ERROR([Couldn't find an acceptable D3D compiler DLL.])
2690 fi # MOZ_ANGLE_RENDERER
2692 fi # COMPILE_ENVIRONMENT
2695 dnl ========================================================
2697 dnl ========================================================
2699 dnl Moved gamepad platform check to moz.build, linux header check still needed here.
2700 if test "$OS_TARGET" = "Linux"; then
2701 MOZ_CHECK_HEADER([linux/joystick.h])
2702 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
2703 AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
2707 dnl ========================================================
2708 dnl = Breakpad crash reporting (on by default on supported platforms)
2709 dnl ========================================================
2712 i?86-*-mingw*|x86_64-*-mingw*)
2715 i?86-apple-darwin*|x86_64-apple-darwin*)
2716 if test -z "$MOZ_IOS"; then
2720 *-android*|*-linuxandroid*)
2721 dnl Android/arm is arm-unknown-linux-androideabi, so android condition should
2722 dnl be before Linux condition
2725 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
2726 if test "$MOZ_ENABLE_GTK"; then
2732 MOZ_ARG_DISABLE_BOOL(crashreporter,
2733 [ --disable-crashreporter Disable breakpad crash reporting],
2734 [MOZ_CRASHREPORTER=],
2735 [MOZ_CRASHREPORTER=F # Force enable breakpad])
2737 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin"; then
2738 if test "$MOZ_CRASHREPORTER" = F; then
2739 AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
2744 if test -n "$MOZ_CRASHREPORTER"; then
2745 AC_DEFINE(MOZ_CRASHREPORTER)
2747 if test "$OS_TARGET" = "Linux" && \
2748 test -z "$SKIP_LIBRARY_CHECKS"; then
2749 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
2752 if test "$OS_ARCH" = "WINNT"; then
2753 if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
2754 MOZ_CRASHREPORTER_INJECTOR=1
2755 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
2760 dnl ========================================================
2761 dnl = libjpeg-turbo configuration
2762 dnl ========================================================
2764 LIBJPEG_TURBO_USE_YASM=
2765 if test -z "$MOZ_SYSTEM_JPEG"; then
2769 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
2770 [ --disable-libjpeg-turbo Disable optimized jpeg decoding routines],
2772 MOZ_LIBJPEG_TURBO=1)
2774 if test "$MOZ_SYSTEM_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
2775 AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
2778 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
2781 if test -n "$MOZ_LIBJPEG_TURBO" -a -n "$COMPILE_ENVIRONMENT"; then
2783 dnl Do we support libjpeg-turbo on this platform?
2784 case "$OS_ARCH:$CPU_ARCH" in
2786 LIBJPEG_TURBO_ASFLAGS="-DPIC -DMACHO"
2789 LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DMACHO"
2794 LIBJPEG_TURBO_ASFLAGS="-DPIC -DWIN32"
2797 LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DWIN64 -DMSVC"
2800 LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
2803 LIBJPEG_TURBO_ASFLAGS="-march=armv8-a"
2806 LIBJPEG_TURBO_ASFLAGS="-mdspr2"
2809 if $CC -E -dM -</dev/null | grep -q __ELF__; then
2810 LIBJPEG_TURBO_ASFLAGS="-DPIC -DELF"
2814 if $CC -E -dM -</dev/null | grep -q __ELF__; then
2815 LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DELF"
2821 if test -n "$LIBJPEG_TURBO_ASFLAGS"; then
2823 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
2824 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
2825 dnl it doesn't exist or we have too old of a version.
2827 LIBJPEG_TURBO_USE_YASM=1
2829 if test -z "$YASM" ; then
2830 AC_MSG_ERROR([Yasm is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you do not appear to have Yasm installed. Either install it or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder. See https://developer.mozilla.org/en/YASM for more details.])
2833 dnl Check that we have the right yasm version. We require 1.0.1 or newer
2834 dnl on Linux and 1.1 or newer everywhere else.
2835 if test "$OS_ARCH" = "Linux" ; then
2836 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -eq "0" -a "$_YASM_RELEASE" -lt "1" \) ; then
2837 AC_MSG_ERROR([Yasm 1.0.1 or greater is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION.$_YASM_RELEASE. Upgrade to the newest version or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder. See https://developer.mozilla.org/en/YASM for more details.])
2840 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
2841 AC_MSG_ERROR([Yasm 1.1 or greater is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION. Upgrade to the newest version or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder. See https://developer.mozilla.org/en/YASM for more details.])
2848 dnl ========================================================
2849 dnl = libav-fft configuration
2850 dnl ========================================================
2854 dnl Turn on libav-fft for 32-bit windows, and all 64-bit supported platforms.
2855 dnl 32-bit linux/os x have text relocation issues.
2857 case "$OS_ARCH:$CPU_ARCH" in
2866 dnl Detect if we can use yasm to compile libav's assembly
2868 if test -n "$MOZ_LIBAV_FFT" -a -n "$COMPILE_ENVIRONMENT"; then
2869 AC_DEFINE(MOZ_LIBAV_FFT)
2870 dnl Do we support libav-fft on this platform?
2871 case "$OS_ARCH:$CPU_ARCH" in
2873 LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DMACHO"
2876 LIBAV_FFT_ASFLAGS="-DPIC -DWIN32"
2879 LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DWIN64 -DMSVC"
2882 if $CC -E -dM -</dev/null | grep -q __ELF__; then
2883 LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DELF"
2887 AC_MSG_ERROR([libav's FFT routines are only available for 32-bit windows or 64-bit x86 based platforms.])
2892 if test -n "$LIBAV_FFT_ASFLAGS"; then
2893 dnl If we're on an x86 or x64 system which supports libav-fft's asm routines
2894 dnl check for Yasm, and error out if it doesn't exist or we have too old of a
2896 if test -z "$YASM" ; then
2897 AC_MSG_ERROR([Yasm is required to build with libav's optimized FFT routines, but you do not appear to have Yasm installed. See https://developer.mozilla.org/en/YASM for more details.])
2899 dnl Check that we have the right yasm version. We require 1.0.1 or newer
2900 dnl on Linux and 1.1 or newer everywhere else.
2901 if test "$OS_ARCH" = "Linux" ; then
2902 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -eq "0" -a "$_YASM_RELEASE" -lt "1" \) ; then
2903 AC_MSG_ERROR([Yasm 1.0.1 or greater is required to build with libav's optimized FFT routines, but you do not appear to have Yasm installed. See https://developer.mozilla.org/en/YASM for more details.])
2906 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
2907 AC_MSG_ERROR([Yasm 1.1 or greater is required to build with libav's optimized FFT routines, but you do not appear to have Yasm installed. See https://developer.mozilla.org/en/YASM for more details.])
2910 elif test -n "$MOZ_LIBAV_FFT" -a "${CPU_ARCH}" != "arm"; then
2911 dnl Warn if we're not building either libav or opendl-max optimized routines.
2912 AC_MSG_WARN([No assembler or assembly support for libav-fft. Using unoptimized C routines.])
2915 dnl ========================================================
2916 dnl = FFmpeg's ffvpx configuration
2917 dnl ========================================================
2924 dnl Use same conditional as MOZ_LIBAV_FFT to enable FFmpeg's ffvpx assembly decoder.
2925 if test -n "$LIBAV_FFT_ASFLAGS"; then
2926 FFVPX_ASFLAGS=$LIBAV_FFT_ASFLAGS
2928 dnl On x86 system with assembly optimizations disabled, the ffvp9 and
2929 dnl ffvp8 decoders give worse performance than libvpx ones. So we only
2930 dnl enable the FFmpeg FLAC decoder on those machines.
2931 MOZ_FFVPX_FLACONLY=1
2936 MOZ_FFVPX_FLACONLY=1
2937 dnl Use same conditional as MOZ_LIBVPX to enable FFmpeg's ffvpx assembly decoder.
2938 dnl aarch 64 FLAC decoder for now will be C only.
2939 FFVPX_ASFLAGS=$VPX_ASFLAGS
2943 if test -n "$MOZ_FFVPX"; then
2944 AC_DEFINE(MOZ_FFVPX)
2946 if test -n "$MOZ_FFVPX_FLACONLY"; then
2947 AC_DEFINE(MOZ_FFVPX_FLACONLY)
2950 dnl ========================================================
2951 dnl = Enable compilation of specific extension modules
2952 dnl ========================================================
2954 MOZ_ARG_ENABLE_STRING(extensions,
2955 [ --enable-extensions Enable extensions],
2956 [ for option in `echo $enableval | sed 's/,/ /g'`; do
2957 if test "$option" = "yes" -o "$option" = "all"; then
2958 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
2959 elif test "$option" = "no" -o "$option" = "none"; then
2961 elif test "$option" = "default"; then
2962 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
2963 elif test `echo "$option" | grep -c \^-` != 0; then
2964 option=`echo $option | sed 's/^-//'`
2965 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
2967 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
2970 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
2972 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
2973 dnl when trying to build a nonexistent extension.
2974 for extension in $MOZ_EXTENSIONS; do
2975 if test ! -d "${srcdir}/extensions/${extension}"; then
2976 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
2980 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
2981 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
2984 # Avoid defining MOZ_ENABLE_CAIRO_FT on Windows platforms because
2985 # "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
2986 if test -n "$MOZ_TREE_FREETYPE" -a "$OS_TARGET" != WINNT; then
2987 MOZ_ENABLE_CAIRO_FT=1
2988 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2989 CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
2990 AC_SUBST_LIST(CAIRO_FT_CFLAGS)
2993 AC_CHECK_PROGS(WGET, wget, "")
2996 dnl ========================================================
2997 dnl Maintenance Service
2998 dnl ========================================================
3000 MOZ_ARG_ENABLE_BOOL(maintenance-service,
3001 [ --enable-maintenance-service Enable building of maintenanceservice],
3002 MOZ_MAINTENANCE_SERVICE=1,
3003 MOZ_MAINTENANCE_SERVICE= )
3005 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
3006 if test "$OS_ARCH" = "WINNT"; then
3007 AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
3009 AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
3013 dnl ========================================================
3014 dnl Bundled fonts on desktop platforms
3015 dnl ========================================================
3017 MOZ_ARG_ENABLE_BOOL(bundled-fonts,
3018 [ --enable-bundled-fonts Enable support for bundled fonts on desktop platforms],
3019 MOZ_BUNDLED_FONTS=1,
3022 if test -n "$MOZ_BUNDLED_FONTS"; then
3023 AC_DEFINE(MOZ_BUNDLED_FONTS)
3026 dnl ========================================================
3027 dnl Verify MAR signatures
3028 dnl ========================================================
3030 MOZ_ARG_ENABLE_BOOL(verify-mar,
3031 [ --enable-verify-mar Enable verifying MAR signatures],
3032 MOZ_VERIFY_MAR_SIGNATURE=1,
3033 MOZ_VERIFY_MAR_SIGNATURE= )
3035 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
3036 AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
3039 dnl ========================================================
3040 dnl Enable building the signmar program.
3041 dnl This option is much different than the --enable-verify-mar option.
3042 dnl --enable-verify-mar is for enabling the verification check on MAR
3043 dnl files in the updater. The --enable-signmar option is for building
3044 dnl the signmar program.
3045 dnl ========================================================
3047 MOZ_ARG_ENABLE_BOOL(signmar,
3048 [ --enable-signmar Enable building the signmar program],
3049 MOZ_ENABLE_SIGNMAR=1,
3050 MOZ_ENABLE_SIGNMAR= )
3052 if test -n "$MOZ_ENABLE_SIGNMAR"; then
3053 if test -z "$COMPILE_ENVIRONMENT" ; then
3054 AC_MSG_WARN([Cannot --enable-signmar with --disable-compile-environment])
3057 AC_DEFINE(MOZ_ENABLE_SIGNMAR)
3061 dnl ========================================================
3063 dnl ========================================================
3065 if test "$MOZ_IOS"; then
3069 MOZ_ARG_DISABLE_BOOL(updater,
3070 [ --disable-updater Disable building of updater],
3074 if test -n "$MOZ_UPDATER"; then
3075 AC_DEFINE(MOZ_UPDATER)
3078 dnl ========================================================
3079 dnl parental controls (for Windows Vista)
3080 dnl ========================================================
3081 MOZ_ARG_DISABLE_BOOL(parental-controls,
3082 [ --disable-parental-controls
3083 Do not build parental controls],
3084 MOZ_DISABLE_PARENTAL_CONTROLS=1,
3085 MOZ_DISABLE_PARENTAL_CONTROLS=)
3086 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
3087 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
3090 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
3092 dnl ========================================================
3093 dnl = Disable smartcard support
3094 dnl ========================================================
3095 if test -n "$MOZ_NO_SMART_CARDS"; then
3096 AC_DEFINE(MOZ_NO_SMART_CARDS)
3098 AC_SUBST(MOZ_NO_SMART_CARDS)
3100 dnl ========================================================
3101 dnl = Sandboxing support
3102 dnl ========================================================
3103 if test -n "$MOZ_TSAN" -o -n "$MOZ_ASAN"; then
3104 # Bug 1182565: TSan conflicts with sandboxing on Linux.
3105 # Bug 1287971: LSan also conflicts with sandboxing on Linux.
3113 MOZ_ARG_DISABLE_BOOL(sandbox,
3114 [ --disable-sandbox Disable sandboxing support],
3118 dnl ========================================================
3119 dnl = Content process sandboxing
3120 dnl ========================================================
3122 case "$OS_TARGET" in
3124 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3127 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3132 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3138 MOZ_ARG_ENABLE_BOOL(content-sandbox,
3139 [ --enable-content-sandbox Enable sandboxing support for content-processes
3140 --disable-content-sandbox Disable sandboxing support for content-processes],
3141 MOZ_CONTENT_SANDBOX=1,
3142 MOZ_CONTENT_SANDBOX=)
3144 if test -n "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_SANDBOX"; then
3145 AC_MSG_ERROR([--enable-content-sandbox and --disable-sandbox are conflicting options])
3148 if test -n "$MOZ_CONTENT_SANDBOX"; then
3149 AC_DEFINE(MOZ_CONTENT_SANDBOX)
3152 AC_SUBST(MOZ_CONTENT_SANDBOX)
3154 dnl ========================================================
3155 dnl = Gecko Media Plugin sandboxing
3156 dnl ========================================================
3159 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3164 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3169 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3173 if test -n "$MOZ_GMP_SANDBOX"; then
3174 AC_DEFINE(MOZ_GMP_SANDBOX)
3177 AC_SUBST(MOZ_GMP_SANDBOX)
3179 if test -z "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_GMP_SANDBOX"; then
3183 if test -n "$MOZ_SANDBOX"; then
3184 AC_DEFINE(MOZ_SANDBOX)
3187 AC_SUBST(MOZ_SANDBOX)
3190 dnl ========================================================
3192 dnl = Module specific options
3194 dnl ========================================================
3195 MOZ_ARG_HEADER(Individual module options)
3197 dnl ========================================================
3198 dnl = Disable feed handling components
3199 dnl ========================================================
3200 MOZ_ARG_DISABLE_BOOL(feeds,
3201 [ --disable-feeds Disable feed handling and processing components],
3204 if test -n "$MOZ_FEEDS"; then
3205 AC_DEFINE(MOZ_FEEDS)
3207 if test "$MOZ_BUILD_APP" = "browser"; then
3208 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
3212 dnl ========================================================
3213 dnl Check for sqlite
3214 dnl ========================================================
3217 MOZ_ARG_ENABLE_BOOL(system-sqlite,
3218 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
3219 MOZ_SYSTEM_SQLITE=1,
3220 MOZ_SYSTEM_SQLITE= )
3222 if test -n "$MOZ_SYSTEM_SQLITE"
3224 dnl ============================
3225 dnl === SQLite Version check ===
3226 dnl ============================
3227 dnl Check to see if the system SQLite package is new enough.
3228 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
3230 dnl ==================================
3231 dnl === SQLITE_SECURE_DELETE check ===
3232 dnl ==================================
3233 dnl Check to see if the system SQLite package is compiled with
3234 dnl SQLITE_SECURE_DELETE enabled.
3235 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
3236 _SAVE_CFLAGS="$CFLAGS"
3237 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3239 LIBS="$LIBS $SQLITE_LIBS"
3240 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
3242 #include "sqlite3.h"
3244 int main(int argc, char **argv){
3245 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
3247 ac_cv_sqlite_secure_delete=yes,
3248 ac_cv_sqlite_secure_delete=no,
3249 ac_cv_sqlite_secure_delete=no
3252 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
3253 CFLAGS="$_SAVE_CFLAGS"
3255 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
3256 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
3259 dnl ===============================
3260 dnl === SQLITE_THREADSAFE check ===
3261 dnl ===============================
3262 dnl Check to see if the system SQLite package is compiled with
3263 dnl SQLITE_THREADSAFE enabled.
3264 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
3265 _SAVE_CFLAGS="$CFLAGS"
3266 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3268 LIBS="$LIBS $SQLITE_LIBS"
3269 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
3271 #include "sqlite3.h"
3273 int main(int argc, char **argv){
3274 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
3276 ac_cv_sqlite_threadsafe=yes,
3277 ac_cv_sqlite_threadsafe=no,
3278 ac_cv_sqlite_threadsafe=no
3281 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
3282 CFLAGS="$_SAVE_CFLAGS"
3284 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
3285 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
3288 dnl ================================
3289 dnl === SQLITE_ENABLE_FTS3 check ===
3290 dnl ================================
3291 dnl check to see if the system SQLite package is compiled with
3292 dnl SQLITE_ENABLE_FTS3 enabled.
3293 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
3294 _SAVE_CFLAGS="$CFLAGS"
3295 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3297 LIBS="$LIBS $SQLITE_LIBS"
3298 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
3300 #include "sqlite3.h"
3302 int main(int argc, char **argv){
3303 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
3305 ac_cv_sqlite_enable_fts3=yes,
3306 ac_cv_sqlite_enable_fts3=no,
3307 ac_cv_sqlite_enable_fts3=no
3310 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
3311 CFLAGS="$_SAVE_CFLAGS"
3313 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
3314 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
3317 dnl =========================================
3318 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
3319 dnl =========================================
3320 dnl check to see if the system SQLite package is compiled with
3321 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
3322 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
3323 _SAVE_CFLAGS="$CFLAGS"
3324 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3326 LIBS="$LIBS $SQLITE_LIBS"
3327 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
3329 #include "sqlite3.h"
3331 int main(int argc, char **argv){
3332 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
3334 ac_cv_sqlite_enable_unlock_notify=yes,
3335 ac_cv_sqlite_enable_unlock_notify=no,
3336 ac_cv_sqlite_enable_unlock_notify=no
3339 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
3340 CFLAGS="$_SAVE_CFLAGS"
3342 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
3343 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
3346 dnl =========================================
3347 dnl === SQLITE_ENABLE_DBSTAT_VTAB check ===
3348 dnl =========================================
3349 dnl check to see if the system SQLite package is compiled with
3350 dnl SQLITE_ENABLE_DBSTAT_VTAB.
3351 AC_MSG_CHECKING(for SQLITE_ENABLE_DBSTAT_VTAB support in system SQLite)
3352 _SAVE_CFLAGS="$CFLAGS"
3353 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3355 LIBS="$LIBS $SQLITE_LIBS"
3356 AC_CACHE_VAL(ac_cv_sqlite_dbstat_vtab,[
3358 #include "sqlite3.h"
3360 int main(int argc, char **argv){
3361 return !sqlite3_compileoption_used("SQLITE_ENABLE_DBSTAT_VTAB");
3363 ac_cv_sqlite_dbstat_vtab=yes,
3364 ac_cv_sqlite_dbstat_vtab=no,
3365 ac_cv_sqlite_dbstat_vtab=no
3368 AC_MSG_RESULT($ac_cv_sqlite_dbstat_vtab)
3369 CFLAGS="$_SAVE_CFLAGS"
3371 if test "x$ac_cv_sqlite_dbstat_vtab" = "xno"; then
3372 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_DBSTAT_VTAB.])
3375 dnl ==============================
3376 dnl === SQLite fdatasync check ===
3377 dnl ==============================
3378 dnl Check to see if fdatasync is available
3379 AC_CHECK_FUNC(fdatasync)
3382 if test -n "$MOZ_SYSTEM_SQLITE"; then
3383 AC_DEFINE(MOZ_SYSTEM_SQLITE)
3385 AC_SUBST(MOZ_SYSTEM_SQLITE)
3387 dnl ========================================================
3388 dnl = Disable zipwriter
3389 dnl ========================================================
3390 MOZ_ARG_DISABLE_BOOL(zipwriter,
3391 [ --disable-zipwriter Disable zipwriter component],
3394 AC_SUBST(MOZ_ZIPWRITER)
3396 dnl ========================================================
3398 dnl = Feature options that require extra sources to be pulled
3400 dnl ========================================================
3401 dnl MOZ_ARG_HEADER(Features that require extra sources)
3403 dnl ========================================================
3405 dnl = Runtime debugging and Optimization Options
3407 dnl ========================================================
3408 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
3410 dnl ========================================================
3411 dnl enable mobile optimizations
3412 dnl ========================================================
3413 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
3414 [ --enable-mobile-optimize
3415 Enable mobile optimizations],
3416 MOZ_GFX_OPTIMIZE_MOBILE=1)
3418 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
3420 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
3421 # We ignore paint will resample on mobile for performance.
3422 # We may want to revisit this later.
3423 MOZ_IGNORE_PAINT_WILL_RESAMPLE=1
3425 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
3426 AC_DEFINE(MOZ_IGNORE_PAINT_WILL_RESAMPLE)
3429 dnl ========================================================
3430 dnl = Enable code optimization. ON by default.
3431 dnl ========================================================
3433 # Use value from moz.configure if one is defined. Else use our computed
3435 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
3436 MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
3439 MOZ_SET_FRAMEPTR_FLAGS
3441 if test "$COMPILE_ENVIRONMENT"; then
3442 if test -n "$MOZ_OPTIMIZE"; then
3443 AC_MSG_CHECKING([for valid C compiler optimization flags])
3444 _SAVE_CFLAGS=$CFLAGS
3445 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
3446 AC_TRY_COMPILE([#include <stdio.h>],
3447 [printf("Hello World\n");],
3450 AC_MSG_RESULT([$_results])
3451 if test "$_results" = "no"; then
3452 AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
3454 CFLAGS=$_SAVE_CFLAGS
3456 fi # COMPILE_ENVIRONMENT
3458 AC_SUBST_LIST(MOZ_FRAMEPTR_FLAGS)
3459 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
3460 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
3461 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
3463 dnl ========================================================
3464 dnl = Disable treating compiler warnings as errors
3465 dnl ========================================================
3466 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
3467 WARNINGS_AS_ERRORS=''
3470 dnl ========================================================
3471 dnl = Enable runtime logging
3472 dnl ========================================================
3473 AC_DEFINE(MOZ_LOGGING)
3474 AC_DEFINE(FORCE_PR_LOG)
3476 dnl ========================================================
3477 dnl = This will enable logging of addref, release, ctor, dtor.
3478 dnl ========================================================
3479 _ENABLE_LOGREFCNT=42
3480 MOZ_ARG_ENABLE_BOOL(logrefcnt,
3481 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
3482 _ENABLE_LOGREFCNT=1,
3483 _ENABLE_LOGREFCNT= )
3484 if test "$_ENABLE_LOGREFCNT" = "1"; then
3485 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
3486 elif test -z "$_ENABLE_LOGREFCNT"; then
3487 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
3490 dnl ========================================================
3491 dnl moz_dump_painting
3492 dnl ========================================================
3493 MOZ_ARG_ENABLE_BOOL(dump-painting,
3494 [ --enable-dump-painting Enable paint debugging.],
3495 MOZ_DUMP_PAINTING=1,
3496 MOZ_DUMP_PAINTING= )
3497 if test -n "$MOZ_DUMP_PAINTING"; then
3498 AC_DEFINE(MOZ_DUMP_PAINTING)
3499 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
3501 if test -n "$MOZ_DEBUG"; then
3502 AC_DEFINE(MOZ_DUMP_PAINTING)
3505 case "${OS_TARGET}" in
3506 Android|WINNT|Darwin)
3507 MOZ_GLUE_IN_PROGRAM=
3510 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
3511 MOZ_GLUE_IN_PROGRAM=1
3512 AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
3516 dnl ========================================================
3517 dnl = Jemalloc build setup
3518 dnl ========================================================
3519 if test -z "$MOZ_MEMORY"; then
3522 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
3523 AC_MSG_WARN([When not building jemalloc, you need to set WIN32_REDIST_DIR to the path to the Visual C++ Redist (usually VCINSTALLDIR\redist\x86\Microsoft.VC80.CRT, for VC++ v8) if you intend to distribute your build.])
3528 dnl The generic feature tests that determine how to compute ncpus are long and
3529 dnl complicated. Therefore, simply define special cpp variables for the
3530 dnl platforms we have special knowledge of.
3533 export MOZ_NO_DEBUG_RTL=1
3537 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
3539 # Allow the application to provide a subconfigure script.
3540 # This should be after 'export MOZ_NO_DEBUG_RTL=1' since
3541 # ldap/c-sdk/configure refers to the enviroment value.
3542 if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
3543 do_output_subdirs() {
3544 if test -n "$_subconfigure_subdirs"; then
3545 AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
3547 _subconfigure_subdir="$1"
3548 _subconfigure_config_args="$ac_configure_args"
3550 tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
3551 m4 "${srcdir}/build/autoconf/subconfigure.m4" \
3552 "${srcdir}/build/autoconf/altoptions.m4" \
3553 "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
3558 AC_SUBST_LIST(MOZ_GLUE_WRAP_LDFLAGS)
3559 export MOZ_GLUE_WRAP_LDFLAGS
3561 dnl ========================================================
3562 dnl = Enable using the clang plugin to build
3563 dnl ========================================================
3565 if test -n "$COMPILE_ENVIRONMENT"; then
3566 MOZ_CONFIG_CLANG_PLUGIN
3567 fi # COMPILE_ENVIRONMENT
3569 dnl ========================================================
3570 dnl = Enable stripping of libs & executables
3571 dnl ========================================================
3572 MOZ_ARG_ENABLE_BOOL(strip,
3573 [ --enable-strip Enable stripping of libs & executables ],
3577 dnl ========================================================
3578 dnl = Enable stripping of libs & executables when packaging
3579 dnl ========================================================
3580 MOZ_ARG_ENABLE_BOOL(install-strip,
3581 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
3585 dnl ========================================================
3586 dnl = frontend JS debug mode
3587 dnl ========================================================
3589 MOZ_ARG_ENABLE_BOOL(debug-js-modules,
3590 [ --enable-debug-js-modules Enable debug mode for frontend JS libraries],
3594 AC_SUBST(DEBUG_JS_MODULES)
3596 dnl ========================================================
3598 dnl = Profiling and Instrumenting
3600 dnl ========================================================
3601 MOZ_ARG_HEADER(Profiling and Instrumenting)
3603 dnl ========================================================
3604 dnl = Enable TaskTracer
3605 dnl ========================================================
3606 MOZ_ARG_ENABLE_BOOL(tasktracer,
3607 [ --enable-tasktracer Set compile flags necessary for using TaskTracer],
3610 if test -n "$MOZ_TASK_TRACER"; then
3611 AC_DEFINE(MOZ_TASK_TRACER)
3612 AC_SUBST(MOZ_TASK_TRACER)
3615 dnl ========================================================
3616 dnl Turn on reflow counting
3617 dnl ========================================================
3618 MOZ_ARG_ENABLE_BOOL(reflow-perf,
3619 [ --enable-reflow-perf Enable reflow performance tracing],
3622 if test -n "$MOZ_REFLOW_PERF"; then
3623 AC_DEFINE(MOZ_REFLOW_PERF)
3626 dnl ========================================================
3627 dnl = Offer a way to disable the startup cache
3628 dnl ========================================================
3630 MOZ_ARG_DISABLE_BOOL(startupcache,
3631 [ --disable-startupcache Disable startup cache ],
3632 MOZ_DISABLE_STARTUPCACHE=1,
3633 MOZ_DISABLE_STARTUPCACHE=)
3635 if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
3636 AC_DEFINE(MOZ_DISABLE_STARTUPCACHE)
3638 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
3640 dnl ========================================================
3641 dnl = Support for demangling undefined symbols
3642 dnl ========================================================
3643 if test -z "$SKIP_LIBRARY_CHECKS"; then
3646 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
3650 # Demangle only for debug or DMD builds
3651 MOZ_DEMANGLE_SYMBOLS=
3652 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
3653 MOZ_DEMANGLE_SYMBOLS=1
3654 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
3656 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
3658 dnl ========================================================
3659 dnl = Support for gcc stack unwinding (from gcc 3.3)
3660 dnl ========================================================
3661 if test -z "$SKIP_LIBRARY_CHECKS"; then
3664 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
3668 dnl ========================================================
3670 dnl ========================================================
3672 MOZ_ARG_WITH_STRING(jitreport-granularity,
3673 [ --jitreport-granularity=N
3674 Default granularity at which to report JIT code
3677 1 - code ranges for whole functions only
3678 2 - per-line information
3679 3 - per-op information],
3680 JITREPORT_GRANULARITY=$withval,
3681 JITREPORT_GRANULARITY=3)
3683 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
3685 dnl ========================================================
3689 dnl ========================================================
3690 MOZ_ARG_HEADER(Misc. Options)
3692 dnl ========================================================
3693 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
3694 dnl ========================================================
3695 MOZ_ARG_WITH_STRING(user-appdir,
3696 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
3697 [ val=`echo $withval`
3698 if echo "$val" | grep "\/" >/dev/null; then
3699 AC_MSG_ERROR("Homedir must be single relative path.")
3704 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
3706 if test -z "$SKIP_COMPILER_CHECKS"; then
3707 dnl ========================================================
3709 dnl = Compiler Options
3711 dnl ========================================================
3712 MOZ_ARG_HEADER(Compiler Options)
3714 dnl ========================================================
3715 dnl Check for gcc -pipe support
3716 dnl ========================================================
3717 AC_MSG_CHECKING([for -pipe support])
3718 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
3719 dnl Any gcc that supports firefox supports -pipe.
3720 CFLAGS="$CFLAGS -pipe"
3721 CXXFLAGS="$CXXFLAGS -pipe"
3722 AC_MSG_RESULT([yes])
3727 fi # ! SKIP_COMPILER_CHECKS
3729 AC_DEFINE(CPP_THROW_NEW, [throw()])
3732 if test "$COMPILE_ENVIRONMENT"; then
3734 fi # COMPILE_ENVIRONMENT
3736 dnl ========================================================
3738 dnl = Build depencency options
3740 dnl ========================================================
3741 MOZ_ARG_HEADER(Build dependencies)
3743 if test "$COMPILE_ENVIRONMENT"; then
3744 if test "$GNU_CC" -a "$GNU_CXX"; then
3745 _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
3747 # clang-cl doesn't accept the normal -MD -MP -MF options that clang does, but
3748 # the underlying cc1 binary understands how to generate dependency files.
3749 # These options are based on analyzing what the normal clang driver sends to
3750 # cc1 when given the "correct" dependency options.
3751 if test -n "$CLANG_CL"; then
3752 _DEPEND_CFLAGS='-Xclang -MP -Xclang -dependency-file -Xclang $(MDDEPDIR)/$(@F).pp -Xclang -MT -Xclang $@'
3754 dnl Don't override this for MSVC
3755 if test -z "$_WIN32_MSVC"; then
3756 _USE_CPP_INCLUDE_FLAG=
3757 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
3758 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
3760 echo '#include <stdio.h>' > dummy-hello.c
3762 dnl This output is localized, split at the first double space or colon and space.
3763 _CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*\\\stdio.h\)$"
3764 CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'`
3765 _CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'`
3767 if ! test -e "$_CL_STDIO_PATH"; then
3768 AC_MSG_ERROR([Unable to parse cl -showIncludes prefix. This compiler's locale has an unsupported formatting.])
3770 if test -z "$CL_INCLUDES_PREFIX"; then
3771 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
3773 AC_SUBST(CL_INCLUDES_PREFIX)
3776 dnl Make sure that the build system can handle non-ASCII characters
3777 dnl in environment variables to prevent it from breaking silently on
3778 dnl non-English systems.
3779 NONASCII=$'\241\241'
3783 fi # COMPILE_ENVIRONMENT
3785 dnl ========================================================
3787 dnl = Static Build Options
3789 dnl ========================================================
3790 MOZ_ARG_HEADER(Static build options)
3792 if test -z "$MOZ_SYSTEM_ZLIB"; then
3793 if test -n "$JS_SHARED_LIBRARY" -o -n "$MOZ_LINKER"; then
3795 AC_DEFINE(ZLIB_IN_MOZGLUE)
3799 AC_SUBST(ZLIB_IN_MOZGLUE)
3801 dnl ========================================================
3803 dnl = Standalone module options
3805 dnl ========================================================
3806 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
3809 dnl ========================================================
3811 if test -z "$SKIP_PATH_CHECKS"; then
3812 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
3813 if test "$MOZ_ENABLE_GTK" ; then
3814 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
3819 if test -z "${GLIB_GMODULE_LIBS}" \
3820 -a -n "${GLIB_CONFIG}"\
3821 -a "${GLIB_CONFIG}" != no\
3823 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
3826 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
3828 if test "$USE_FC_FREETYPE"; then
3829 if test "$COMPILE_ENVIRONMENT"; then
3830 dnl ========================================================
3831 dnl = Check for freetype2 functionality
3832 dnl ========================================================
3833 if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
3835 _SAVE_CFLAGS="$CFLAGS"
3836 LIBS="$LIBS $FT2_LIBS"
3837 CFLAGS="$CFLAGS $FT2_CFLAGS"
3839 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3840 ac_cv_member_FT_Bitmap_Size_y_ppem,
3841 [AC_TRY_COMPILE([#include <ft2build.h>
3842 #include FT_FREETYPE_H],
3844 if (sizeof s.y_ppem) return 0;
3846 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3847 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3848 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3849 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3851 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3853 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3854 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3855 [FT_Bitmap_Size structure includes y_ppem field])
3857 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
3860 CFLAGS="$_SAVE_CFLAGS"
3863 _SAVE_CPPFLAGS="$CPPFLAGS"
3864 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
3865 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
3866 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
3867 CPPFLAGS="$_SAVE_CPPFLAGS"
3871 dnl ========================================================
3872 dnl Check if we need the 32-bit Linux SSE2 error dialog
3873 dnl ========================================================
3875 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
3877 dnl ========================================================
3878 dnl Check for pixman and cairo
3879 dnl ========================================================
3882 MOZ_ARG_ENABLE_BOOL(system-cairo,
3883 [ --enable-system-cairo Obsolete: do not use this option],
3884 AC_MSG_ERROR(--enable-system-cairo is not supported),
3888 MOZ_ARG_ENABLE_BOOL(system-pixman,
3889 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
3891 MOZ_TREE_PIXMAN=force,
3894 if test "$MOZ_TREE_PIXMAN"; then
3895 AC_DEFINE(MOZ_TREE_PIXMAN)
3897 PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.19.2)
3900 MOZ_CAIRO_CFLAGS="-I${DIST}/include/cairo"
3901 AC_DEFINE(MOZ_TREE_CAIRO)
3903 if test "$OS_ARCH" = "WINNT"; then
3904 # For now we assume that we will have a uint64_t available through
3905 # one of the above headers or mozstdint.h.
3906 AC_DEFINE(HAVE_UINT64_T)
3909 # Define macros for cairo-features.h
3910 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
3911 if test "$MOZ_X11"; then
3912 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
3913 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
3914 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
3916 if test "$_HAVE_FREETYPE2"; then
3917 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
3918 MOZ_ENABLE_CAIRO_FT=1
3919 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
3922 case "$MOZ_WIDGET_TOOLKIT" in
3924 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
3925 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
3926 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
3929 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
3930 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
3931 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
3932 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
3933 MOZ_ENABLE_D2D_SURFACE=1
3935 if test "$COMPILE_ENVIRONMENT"; then
3937 dnl D3D10 Layers depend on D2D Surfaces.
3938 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
3939 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
3944 if test "$USE_FC_FREETYPE"; then
3945 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
3947 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
3948 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
3949 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
3951 AC_SUBST(PS_SURFACE_FEATURE)
3952 AC_SUBST(SVG_SURFACE_FEATURE)
3953 AC_SUBST(XLIB_SURFACE_FEATURE)
3954 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
3955 AC_SUBST(QUARTZ_SURFACE_FEATURE)
3956 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
3957 AC_SUBST(WIN32_SURFACE_FEATURE)
3958 AC_SUBST(OS2_SURFACE_FEATURE)
3959 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
3960 AC_SUBST(FT_FONT_FEATURE)
3961 AC_SUBST(FC_FONT_FEATURE)
3962 AC_SUBST(WIN32_FONT_FEATURE)
3963 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
3964 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
3965 AC_SUBST(QUARTZ_FONT_FEATURE)
3966 AC_SUBST(PNG_FUNCTIONS_FEATURE)
3967 AC_SUBST(QT_SURFACE_FEATURE)
3968 AC_SUBST(TEE_SURFACE_FEATURE)
3970 if test "$MOZ_X11"; then
3971 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
3974 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
3976 case "$MOZ_WIDGET_TOOLKIT" in
3978 TK_CFLAGS="$MOZ_CAIRO_CFLAGS $MOZ_PIXMAN_CFLAGS"
3979 TK_LIBS="$MOZ_CAIRO_LIBS $MOZ_PIXMAN_LIBS"
3983 AC_SUBST(MOZ_TREE_CAIRO)
3984 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
3985 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
3986 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
3987 AC_SUBST(MOZ_TREE_PIXMAN)
3989 BINDGEN_SYSTEM_FLAGS="$_BINDGEN_CFLAGS $NSPR_CFLAGS $NSS_CFLAGS $MOZ_PIXMAN_CFLAGS $MOZ_CAIRO_CFLAGS"
3990 AC_SUBST_TOML_LIST(BINDGEN_SYSTEM_FLAGS)
3992 dnl ========================================================
3994 dnl ========================================================
3995 MOZ_ARG_DISABLE_BOOL(xul,
3996 [ --disable-xul Disable XUL],
3998 if test "$MOZ_XUL"; then
4001 dnl remove extensions that require XUL
4002 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
4007 dnl ========================================================
4008 dnl necko configuration options
4009 dnl ========================================================
4012 dnl option to disable necko's wifi scanner
4015 if test "$MOZ_WIDGET_TOOLKIT"; then
4017 case "$OS_TARGET" in
4019 if test -z "$MOZ_IOS"; then
4023 DragonFly|FreeBSD|WINNT)
4034 MOZ_ARG_DISABLE_BOOL(necko-wifi,
4035 [ --disable-necko-wifi Disable necko wifi scanner],
4039 if test "$NECKO_WIFI"; then
4040 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
4041 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
4043 AC_DEFINE(NECKO_WIFI)
4044 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
4046 AC_SUBST(NECKO_WIFI)
4047 AC_SUBST(NECKO_WIFI_DBUS)
4050 dnl option to disable cookies
4052 MOZ_ARG_DISABLE_BOOL(cookies,
4053 [ --disable-cookies Disable cookie support],
4056 AC_SUBST(NECKO_COOKIES)
4057 if test "$NECKO_COOKIES"; then
4058 AC_DEFINE(NECKO_COOKIES)
4059 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
4062 dnl ========================================================
4064 dnl = Maintainer debug option (no --enable equivalent)
4066 dnl ========================================================
4070 AC_SUBST(AR_EXTRACT)
4073 AC_SUBST_LIST(ASFLAGS)
4074 AC_SUBST(AS_DASH_C_FLAG)
4080 AC_SUBST(MOZ_AUTH_EXTENSION)
4081 AC_SUBST(MOZ_PREF_EXTENSIONS)
4082 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
4083 AC_SUBST(WARNINGS_AS_ERRORS)
4084 AC_SUBST_SET(MOZ_EXTENSIONS)
4085 AC_SUBST(MOZ_TOOLKIT_SEARCH)
4088 AC_SUBST(MOZ_UNIVERSALCHARDET)
4089 AC_SUBST(ACCESSIBILITY)
4090 AC_SUBST(MOZ_SPELLCHECK)
4091 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
4092 AC_SUBST(MOZ_CRASHREPORTER)
4093 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
4094 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
4095 AC_SUBST(MOZ_STUB_INSTALLER)
4096 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
4097 AC_SUBST(MOZ_ENABLE_SIGNMAR)
4098 AC_SUBST(MOZ_UPDATER)
4100 AC_SUBST(MOZ_ANGLE_RENDERER)
4101 AC_SUBST(MOZ_D3D_CPU_SUFFIX)
4102 AC_SUBST(MOZ_HAS_WINSDK_WITH_D3D)
4103 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL)
4104 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL_PATH)
4106 AC_SUBST(MOZ_ANDROID_APPLICATION_CLASS)
4107 AC_SUBST(MOZ_ANDROID_BROWSER_INTENT_CLASS)
4108 AC_SUBST(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
4109 AC_SUBST(ENABLE_STRIP)
4110 AC_SUBST(PKG_SKIP_STRIP)
4111 AC_SUBST(STRIP_FLAGS)
4112 AC_SUBST(INCREMENTAL_LINKER)
4114 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
4116 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
4117 AC_SUBST(MOZ_LINKER_EXTRACT)
4119 if test -n "$MOZ_BINARY_EXTENSIONS"; then
4120 AC_DEFINE(MOZ_BINARY_EXTENSIONS)
4123 AC_SUBST(MOZ_REQUIRE_SIGNING)
4124 if test "$MOZ_REQUIRE_SIGNING" = 1; then
4125 AC_DEFINE(MOZ_REQUIRE_SIGNING)
4128 dnl ========================================================
4129 dnl = Mac bundle name prefix
4130 dnl ========================================================
4131 MOZ_ARG_WITH_STRING(macbundlename-prefix,
4132 [ --with-macbundlename-prefix=prefix
4133 Prefix for MOZ_MACBUNDLE_NAME],
4134 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
4136 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
4137 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
4138 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
4141 if test "$MOZ_DEBUG"; then
4142 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
4144 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
4146 AC_SUBST(MOZ_MACBUNDLE_NAME)
4148 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
4149 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
4150 # Otherwise, use MOZ_APP_DISPLAYNAME
4151 if test -z "$MOZ_MACBUNDLE_ID"; then
4152 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
4154 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
4155 if test "$MOZ_DEBUG"; then
4156 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
4159 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
4160 AC_SUBST(MOZ_MACBUNDLE_ID)
4162 dnl ========================================================
4163 dnl = Child Process Name for IPC
4164 dnl ========================================================
4165 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
4166 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
4168 # We want to let Android unpack the file at install time, but it only does
4169 # so if the file is named libsomething.so. The lib/ path is also required
4170 # because the unpacked file will be under the lib/ subdirectory and will
4171 # need to be executed from that path.
4172 MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
4174 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
4175 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
4177 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
4178 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
4179 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
4181 # The following variables are available to branding and application
4182 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
4183 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
4184 # impacts profile location and user-visible fields.
4185 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
4186 # versions of a given application (e.g. Aurora and Firefox both use
4187 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
4188 # for application.ini's "Name" field, which controls profile location in
4189 # the absence of a "Profile" field (see below), and various system
4190 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
4191 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
4192 # Mac Bundle name, Updater, Installer), it is typically used for nightly
4193 # builds (e.g. Aurora for Firefox).
4194 # - MOZ_APP_VERSION: Defines the application version number.
4195 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
4196 # in the "About" window. If not set, defaults to MOZ_APP_VERSION.
4197 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
4198 # defaults to a lowercase form of MOZ_APP_BASENAME.
4199 # - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
4200 # profile name and remoting. If not set, defaults to MOZ_APP_NAME.
4201 # - MOZ_APP_PROFILE: When set, used for application.ini's
4202 # "Profile" field, which controls profile location.
4203 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
4204 # crash reporter server url.
4205 # - MOZ_APP_ANDROID_VERSION_CODE: On Android, "android:versionCode" for
4206 # the main application is set to the value of this variable. If not
4207 # set, it falls back to a Mozilla-specific value derived from the
4209 # - MOZ_ANDROID_SHARED_ID: On Android, "android:sharedUserId" for all Android
4210 # packages produced.
4211 # - MOZ_ANDROID_GCM_SENDERID: On Android, the Android GCM Sender ID used. GCM
4212 # sender IDs are not sensitive: see, http://stackoverflow.com/a/18216063.
4213 # - MOZ_MMA_GCM_SENDERID: This GCM Sender ID is used for MMA integration.
4214 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
4216 if test -z "$MOZ_APP_NAME"; then
4217 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
4220 if test -z "$MOZ_APP_REMOTINGNAME"; then
4221 MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
4224 if test -z "$MOZ_APP_VERSION_DISPLAY"; then
4225 MOZ_APP_VERSION_DISPLAY=$MOZ_APP_VERSION
4228 if test -z "$ANDROID_PACKAGE_NAME" ; then
4229 # When we got rid of the Aurora channel we decided to replace the old
4230 # Nightly ANDROID_PACKAGE_NAME with Aurora. To make sure this is inherited
4231 # by all mozilla-central based branches we make this the new "default"
4232 # for Fennec. Non mozilla-central based branches set ANDROID_PACKAGE_NAME
4233 # in their mozconfig, so they will never get this. If there are ever
4234 # non-Fennec builds for Android, they will fall into the else block
4235 # and use their own default name.
4236 # https://bugzilla.mozilla.org/show_bug.cgi?id=1357808 has additional
4237 # background on this.
4238 if test "$MOZ_APP_NAME" = "fennec"; then
4239 ANDROID_PACKAGE_NAME="org.mozilla.fennec_aurora"
4241 ANDROID_PACKAGE_NAME="org.mozilla.$MOZ_APP_NAME"
4245 # Mozilla released Firefox for Android {Release,Beta} and {Aurora,Nightly} to
4246 # the public with specific common shared IDs and we need to keep them
4247 # consistent forever. The specific common values are set by per-channel
4248 # branding; all other channels use a generic sharedID, set below.
4249 if test -z "$MOZ_ANDROID_SHARED_ID" ; then
4250 MOZ_ANDROID_SHARED_ID="${ANDROID_PACKAGE_NAME}.sharedID"
4253 # For extensions and langpacks, we require a max version that is compatible
4254 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
4255 # 24.0a1 and 24.0a2 aren't affected
4257 # 24.1.1 becomes 24.*
4258 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
4259 if test -z "$IS_ALPHA"; then
4261 if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
4262 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
4264 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
4268 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
4271 AC_SUBST(MOZ_APP_NAME)
4272 AC_SUBST(MOZ_APP_REMOTINGNAME)
4273 AC_SUBST(MOZ_APP_DISPLAYNAME)
4274 AC_SUBST(MOZ_APP_BASENAME)
4275 AC_SUBST(MOZ_APP_VENDOR)
4276 AC_SUBST(MOZ_APP_PROFILE)
4277 AC_SUBST(MOZ_APP_ID)
4278 AC_SUBST(MOZ_APP_ANDROID_VERSION_CODE)
4279 AC_SUBST(MOZ_ANDROID_SHARED_ID)
4280 AC_SUBST(MOZ_ANDROID_GCM_SENDERID)
4281 AC_SUBST(MOZ_MMA_GCM_SENDERID)
4282 AC_SUBST(MAR_CHANNEL_ID)
4283 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
4284 AC_SUBST(MOZ_PROFILE_MIGRATOR)
4285 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
4286 AC_SUBST(MOZ_APP_UA_NAME)
4287 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
4288 AC_SUBST(MOZ_APP_VERSION)
4289 AC_SUBST(MOZ_APP_VERSION_DISPLAY)
4290 AC_SUBST(MOZ_APP_MAXVERSION)
4291 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
4292 AC_SUBST(FIREFOX_VERSION)
4293 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
4294 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
4295 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
4298 AC_SUBST(MOZ_PKG_SPECIAL)
4299 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
4301 if test "$MOZILLA_OFFICIAL"; then
4302 # Build revisions should always be present in official builds
4303 MOZ_INCLUDE_SOURCE_INFO=1
4306 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
4307 # explicitly set the repository and changeset information in.
4308 AC_SUBST(MOZ_SOURCE_REPO)
4309 AC_SUBST(MOZ_SOURCE_CHANGESET)
4310 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
4312 if test "$MOZ_TELEMETRY_REPORTING"; then
4313 AC_DEFINE(MOZ_TELEMETRY_REPORTING)
4315 # Enable Telemetry by default for nightly and aurora channels
4316 if test -z "$RELEASE_OR_BETA"; then
4317 AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
4321 dnl If we have any service that uploads data (and requires data submission
4322 dnl policy alert), set MOZ_DATA_REPORTING.
4323 dnl We need SUBST for build system and DEFINE for xul preprocessor.
4324 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
4325 MOZ_DATA_REPORTING=1
4326 AC_DEFINE(MOZ_DATA_REPORTING)
4327 AC_SUBST(MOZ_DATA_REPORTING)
4331 AC_SUBST(WIN32_REDIST_DIR)
4332 AC_SUBST(WIN_UCRT_REDIST_DIR)
4333 AC_SUBST(WIN_DIA_SDK_BIN_DIR)
4335 dnl ========================================================
4337 dnl ========================================================
4341 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
4347 dnl Echo the CFLAGS to remove extra whitespace.
4350 $_COMPILATION_CFLAGS \
4354 $_WARNINGS_CXXFLAGS \
4355 $_COMPILATION_CXXFLAGS \
4358 COMPILE_CFLAGS=`echo \
4362 COMPILE_CXXFLAGS=`echo \
4363 $_DEFINES_CXXFLAGS \
4367 $_WARNINGS_HOST_CFLAGS \
4368 $_COMPILATION_HOST_CFLAGS \
4371 HOST_CXXFLAGS=`echo \
4372 $_WARNINGS_HOST_CXXFLAGS \
4373 $_COMPILATION_HOST_CXXFLAGS \
4376 AC_SUBST(_DEPEND_CFLAGS)
4377 AC_SUBST(MOZ_SYSTEM_JPEG)
4378 AC_SUBST(MOZ_SYSTEM_PNG)
4380 AC_SUBST_LIST(MOZ_JPEG_CFLAGS)
4381 AC_SUBST_LIST(MOZ_JPEG_LIBS)
4382 AC_SUBST_LIST(MOZ_PNG_CFLAGS)
4383 AC_SUBST_LIST(MOZ_PNG_LIBS)
4385 AC_SUBST(MOZ_SYSTEM_NSPR)
4387 AC_SUBST(MOZ_SYSTEM_NSS)
4389 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
4390 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
4391 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
4392 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
4393 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
4394 OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
4395 OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
4397 AC_SUBST(HOST_CMFLAGS)
4398 AC_SUBST(HOST_CMMFLAGS)
4399 AC_SUBST(OS_COMPILE_CMFLAGS)
4400 AC_SUBST(OS_COMPILE_CMMFLAGS)
4403 OS_CXXFLAGS="$CXXFLAGS"
4404 OS_CPPFLAGS="$CPPFLAGS"
4405 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
4406 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
4407 OS_LDFLAGS="$LDFLAGS"
4409 AC_SUBST_LIST(OS_CFLAGS)
4410 AC_SUBST_LIST(OS_CXXFLAGS)
4411 AC_SUBST_LIST(OS_CPPFLAGS)
4412 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
4413 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
4414 AC_SUBST_LIST(OS_LDFLAGS)
4419 AC_SUBST_LIST(HOST_CFLAGS)
4420 AC_SUBST_LIST(HOST_CPPFLAGS)
4421 AC_SUBST_LIST(HOST_CXXFLAGS)
4422 AC_SUBST(HOST_LDFLAGS)
4423 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
4425 AC_SUBST(HOST_AR_FLAGS)
4426 AC_SUBST(HOST_RANLIB)
4427 AC_SUBST(HOST_BIN_SUFFIX)
4429 AC_SUBST(TARGET_XPCOM_ABI)
4430 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
4431 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
4432 AC_SUBST(HAVE_X86_AVX2)
4433 AC_SUBST(HAVE_ALTIVEC)
4434 AC_SUBST(GCC_USE_GNU_LD)
4438 AC_SUBST_LIST(DSO_CFLAGS)
4439 AC_SUBST_LIST(DSO_PIC_CFLAGS)
4440 AC_SUBST(DSO_LDOPTS)
4441 AC_SUBST(BIN_SUFFIX)
4443 AC_SUBST(CC_VERSION)
4444 AC_SUBST(NS_ENABLE_TSF)
4445 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
4446 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
4449 AC_SUBST(MOZ_FFVPX_FLACONLY)
4450 AC_SUBST_LIST(FFVPX_ASFLAGS)
4451 AC_SUBST(VPX_USE_YASM)
4452 AC_SUBST_LIST(VPX_ASFLAGS)
4453 AC_SUBST(VPX_AS_CONVERSION)
4454 AC_SUBST(VPX_X86_ASM)
4455 AC_SUBST(VPX_ARM_ASM)
4456 AC_SUBST(LIBJPEG_TURBO_USE_YASM)
4457 AC_SUBST_LIST(LIBJPEG_TURBO_ASFLAGS)
4458 AC_SUBST(MOZ_LIBAV_FFT)
4459 AC_SUBST_LIST(LIBAV_FFT_ASFLAGS)
4460 AC_SUBST(MOZ_DEVTOOLS)
4462 AC_SUBST(MOZ_PACKAGE_JSSHELL)
4463 AC_SUBST(MOZ_FOLD_LIBS)
4464 AC_SUBST_LIST(MOZ_FOLD_LIBS_FLAGS)
4468 dnl Host JavaScript runtime, if any, to use during cross compiles.
4471 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
4473 if test -n "$COMPILE_ENVIRONMENT"; then
4474 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
4476 dnl Check for missing components
4477 if test "$MOZ_X11"; then
4478 dnl ====================================================
4479 dnl = Check if X headers exist
4480 dnl ====================================================
4481 _SAVE_CFLAGS=$CFLAGS
4482 CFLAGS="$CFLAGS $XCFLAGS"
4486 #include <X11/Xlib.h>
4487 #include <X11/Intrinsic.h>
4488 #include <X11/extensions/XShm.h>
4492 if ((dpy = XOpenDisplay(NULL)) == NULL) {
4493 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
4497 [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
4498 CFLAGS="$_SAVE_CFLAGS"
4500 if test -n "$MISSING_X"; then
4501 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
4506 fi # COMPILE_ENVIRONMENT
4508 dnl Set various defines and substitutions
4509 dnl ========================================================
4511 if test "$MOZ_DEBUG"; then
4512 AC_DEFINE(MOZ_REFLOW_PERF)
4513 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
4516 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
4517 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
4518 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
4519 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
4520 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
4521 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
4522 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
4523 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
4524 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
4527 AC_SUBST(MOZ_DEV_EDITION)
4528 if test -n "$MOZ_DEV_EDITION"; then
4529 AC_DEFINE(MOZ_DEV_EDITION)
4532 if test "$MOZ_DEBUG" -o "$DEVELOPER_OPTIONS"; then
4536 if test -n "$A11Y_LOG"; then
4540 dnl Spit out some output
4541 dnl ========================================================
4543 dnl The following defines are used by xpcom
4544 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
4546 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
4558 # Avoid using obsolete NSPR features
4559 AC_DEFINE(NO_NSPR_10_SUPPORT)
4561 # Don't build NSS libpkix
4562 NSS_DISABLE_LIBPKIX=1
4563 AC_SUBST(NSS_DISABLE_LIBPKIX)
4565 MOZ_CREATE_CONFIG_STATUS()
4567 if test -z "$direct_nspr_config"; then
4568 dnl ========================================================
4569 dnl = Setup a nice relatively clean build environment for
4570 dnl = sub-configures.
4571 dnl ========================================================
4574 CFLAGS="$_SUBDIR_CFLAGS"
4575 CPPFLAGS="$_SUBDIR_CPPFLAGS"
4576 CXXFLAGS="$_SUBDIR_CXXFLAGS"
4577 LDFLAGS="$_SUBDIR_LDFLAGS"
4578 HOST_CC="$_SUBDIR_HOST_CC"
4579 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
4580 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
4581 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
4588 # Run all configure scripts specified by a subconfigure
4589 if test -n "$_subconfigure_subdir"; then
4590 _save_srcdir="$srcdir"
4592 _save_ac_configure_args="$ac_configure_args"
4593 ac_configure_args="$_subconfigure_config_args"
4594 AC_OUTPUT_SUBDIRS_NOW("$_subconfigure_subdir",$cache_file)
4595 ac_configure_args="$_save_ac_configure_args"
4596 srcdir="$_save_srcdir"
4599 if test "$COMPILE_ENVIRONMENT" -a "$MOZ_WIDGET_TOOLKIT"; then
4602 dnl ========================================================
4603 dnl = Setup a nice relatively clean build environment for
4604 dnl = sub-configures.
4605 dnl ========================================================
4608 CFLAGS="$_SUBDIR_CFLAGS"
4609 CPPFLAGS="$_SUBDIR_CPPFLAGS"
4610 CXXFLAGS="$_SUBDIR_CXXFLAGS"
4611 LDFLAGS="$_SUBDIR_LDFLAGS"
4612 HOST_CC="$_SUBDIR_HOST_CC"
4613 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
4614 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
4615 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
4618 # Run the SpiderMonkey 'configure' script.
4619 dist=$MOZ_BUILD_ROOT/dist
4620 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
4622 # --with-system-nspr will have been converted into the relevant $NSPR_CFLAGS
4624 ac_configure_args="`echo $ac_configure_args | sed -e 's/--with-system-nspr\S* *//'`"
4626 if test "$_INTL_API" = no; then
4627 ac_configure_args="$ac_configure_args --without-intl-api"
4630 if test -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
4631 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
4632 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
4634 ac_configure_args="$ac_configure_args --prefix=$dist"
4635 if test -n "$ZLIB_IN_MOZGLUE"; then
4638 export MOZ_SYSTEM_ZLIB
4639 export MOZ_ZLIB_CFLAGS
4640 export MOZ_ZLIB_LIBS
4642 export MOZ_APP_REMOTINGNAME
4643 export MOZ_DEV_EDITION
4645 export MOZILLA_CENTRAL_PATH=$_topsrcdir
4646 export STLPORT_CPPFLAGS
4651 export ZLIB_IN_MOZGLUE
4665 export HOST_CPPFLAGS
4666 export HOST_CXXFLAGS
4669 if ! test -e js; then
4673 ac_configure_args="$ac_configure_args JS_STANDALONE="
4674 AC_OUTPUT_SUBDIRS(js/src,$cache_file)
4675 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
4677 fi # COMPILE_ENVIRONMENT
4679 dnl we need to run config.status after js/src subconfigure because we're
4680 dnl traversing its moz.build and we need its config.status for that.
4681 dnl However, writing our own config.status needs to happen before
4682 dnl subconfigures because the setup surrounding subconfigures alters
4683 dnl many AC_SUBSTed variables.
4684 MOZ_RUN_ALL_SUBCONFIGURES()
4686 rm -fr confdefs* $ac_clean_files