1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
2 dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
3 dnl This Source Code Form is subject to the terms of the Mozilla Public
4 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
5 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 dnl Process this file with autoconf to produce a configure script.
8 dnl ========================================================
10 AC_INIT(config/config.mk)
11 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
14 dnl ========================================================
16 dnl = Don't change the following two lines. Doing so breaks:
18 dnl = CFLAGS="-foo" ./configure
20 dnl ========================================================
22 CPPFLAGS="${CPPFLAGS=}"
23 CXXFLAGS="${CXXFLAGS=}"
25 HOST_CFLAGS="${HOST_CFLAGS=}"
26 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
27 HOST_LDFLAGS="${HOST_LDFLAGS=}"
29 dnl ========================================================
30 dnl = Preserve certain environment flags passed to configure
31 dnl = We want sub projects to receive the same flags
32 dnl = untainted by this configure script
33 dnl ========================================================
36 _SUBDIR_CFLAGS="$CFLAGS"
37 _SUBDIR_CPPFLAGS="$CPPFLAGS"
38 _SUBDIR_CXXFLAGS="$CXXFLAGS"
39 _SUBDIR_LDFLAGS="$LDFLAGS"
40 _SUBDIR_HOST_CC="$HOST_CC"
41 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
42 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
43 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
44 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
46 dnl Set the version number of the libs included with mozilla
47 dnl ========================================================
54 dnl Set the minimum version of toolkit libs used by mozilla
55 dnl ========================================================
57 # 2_26 is the earliest version we can set GLIB_VERSION_MIN_REQUIRED.
58 # The macro won't be used when compiling with earlier versions anyway.
59 GLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_26
63 GDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_4
64 WINDRES_VERSION=2.14.90
67 STARTUP_NOTIFICATION_VERSION=0.8
71 dnl Set various checks
72 dnl ========================================================
75 dnl Initialize the Pthread test variables early so they can be
76 dnl overridden by each platform.
77 dnl ========================================================
81 LDFLAGS="$LDFLAGS $LINKER_LDFLAGS"
85 if test "$COMPILE_ENVIRONMENT"; then
87 fi # COMPILE_ENVIRONMENT
90 *-android*|*-linuxandroid*)
94 AC_PATH_PROG(OBJCOPY,objcopy)
104 AC_SUBST(ANDROID_SOURCE)
105 AC_SUBST(ANDROID_PACKAGE_NAME)
108 dnl ========================================================
109 dnl Checks for compilers.
110 dnl ========================================================
112 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
115 if test "$COMPILE_ENVIRONMENT"; then
117 if test "$target" != "$host"; then
123 # Work around the conftest.exe access problem on Windows
128 MOZ_PATH_PROGS(AS, $AS as, $CC)
129 AC_CHECK_PROGS(AR, ar, :)
130 AC_CHECK_PROGS(STRIP, strip, :)
131 AC_CHECK_PROGS(WINDRES, windres, :)
132 AC_CHECK_PROGS(OTOOL, otool, :)
133 if test -z "$HOST_RANLIB"; then
134 HOST_RANLIB="$RANLIB"
136 if test -z "$HOST_AR"; then
139 if test -z "$HOST_AR_FLAGS"; then
140 HOST_AR_FLAGS="$AR_FLAGS"
144 if test -n "$MOZ_WINCONSOLE"; then
145 AC_DEFINE(MOZ_WINCONSOLE)
150 dnl ========================================================
151 dnl Special win32 checks
152 dnl ========================================================
158 if test "$GCC" != "yes"; then
159 # Check to see if we are really running in a msvc environemnt
161 AC_CHECK_PROGS(MIDL, midl)
163 # Make sure compilers are valid
164 CFLAGS="$CFLAGS -nologo"
165 CXXFLAGS="$CXXFLAGS -TP -nologo"
168 AC_TRY_COMPILE([#include <stdio.h>],
169 [ printf("Hello World\n"); ],,
170 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
173 AC_TRY_COMPILE([#include <new.h>],
174 [ unsigned *test = new unsigned(42); ],,
175 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
179 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
182 _MSC_VER=`echo ${CC_VERSION} | cut -c 1-2,4-5`
184 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
185 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
186 AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
189 MSVC_C_RUNTIME_DLL=vcruntime140.dll
190 MSVC_CXX_RUNTIME_DLL=msvcp140.dll
192 MOZ_CHECK_HEADER(dia2.h, MSVC_HAS_DIA_SDK=1)
193 if test -n "$MSVC_HAS_DIA_SDK"; then
194 AC_DEFINE(MSVC_HAS_DIA_SDK)
197 if test "$_MSC_VER" -ge "1910"; then # VS2017+
198 # C5038: Enable initializer list order warnings
199 # The -w1#### flag treats warning C#### as if it was a warning level
200 # 1 warning, and thus enables it because we enable /W3 warnings. We
201 # don't use -we#### because it would enable warning C#### but treat
202 # it as an error, even in third-party code.
203 # https://docs.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level
204 CXXFLAGS="$CXXFLAGS -w15038"
207 # C5026: move constructor was implicitly defined as deleted
208 CXXFLAGS="$CXXFLAGS -wd5026"
210 # C5027: move assignment operator was implicitly defined as deleted
211 CXXFLAGS="$CXXFLAGS -wd5027"
213 # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
214 CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
216 # https://connect.microsoft.com/VisualStudio/feedback/details/888527/warnings-on-dbghelp-h
217 # for dbghelp.h, imagehlp.h, and shobj.h
218 # C4091: 'typedef ': ignored on left of '' when no variable is declared
219 CFLAGS="$CFLAGS -wd4091"
220 CXXFLAGS="$CXXFLAGS -wd4091"
222 # This is intended as a temporary hack to support building with VS2015.
223 # 'noexcept' used with no exception handling mode specified;
224 # termination on exception is not guaranteed. Specify /EHsc
225 CXXFLAGS="$CXXFLAGS -wd4577"
227 if test -n "$WIN_UCRT_REDIST_DIR"; then
228 if test ! -d "$WIN_UCRT_REDIST_DIR"; then
229 AC_MSG_ERROR([Invalid Windows UCRT Redist directory: ${WIN_UCRT_REDIST_DIR}])
231 WIN_UCRT_REDIST_DIR=`cd "$WIN_UCRT_REDIST_DIR" && pwd -W`
234 if test -n "$WIN_DIA_SDK_BIN_DIR"; then
235 if test ! -d "$WIN_DIA_SDK_BIN_DIR"; then
236 AC_MSG_ERROR([Invalid Windows DIA SDK directory: ${WIN_DIA_SDK_BIN_DIR}])
238 WIN_DIA_SDK_BIN_DIR=`cd "$WIN_DIA_SDK_BIN_DIR" && pwd -W`
241 AC_SUBST(MSVC_HAS_DIA_SDK)
242 AC_SUBST(MSVC_C_RUNTIME_DLL)
243 AC_SUBST(MSVC_CXX_RUNTIME_DLL)
245 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
247 if test -n "$WIN32_REDIST_DIR"; then
248 if test ! -d "$WIN32_REDIST_DIR"; then
249 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
251 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd -W`
254 # Check linker version, except in lld builds
259 _LD_FULL_VERSION=`"${LINKER}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
260 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
261 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
262 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
269 # Set midl environment
272 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
275 MIDL_FLAGS="${MIDL_FLAGS} -env x64"
278 MIDL_FLAGS="${MIDL_FLAGS} -env arm64"
282 unset _MSVC_VER_FILTER
284 AC_CACHE_CHECK(for overridable _RAISE,
289 _SAVE_CXXFLAGS="$CXXFLAGS"
290 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
291 AC_TRY_COMPILE([#include <xstddef>
293 #define _RAISE(x) externallyDefinedFunction((x).what())
296 [std::vector<int> v; return v.at(1);],
297 ac_cv_have__RAISE="no",
298 ac_cv_have__RAISE="yes")
299 CXXFLAGS="$_SAVE_CXXFLAGS"
302 if test "$ac_cv_have__RAISE" = "yes"; then
304 MOZ_MSVC_STL_WRAP_RAISE=1
305 AC_DEFINE(MOZ_MSVC_STL_WRAP_RAISE)
307 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.])
310 if test "$WRAP_STL_INCLUDES" = "1"; then
311 STL_FLAGS="-I${DIST}/stl_wrappers"
313 CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
314 CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
316 # Check w32api version
317 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
318 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
319 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
320 AC_TRY_COMPILE([#include <w32api.h>],
321 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
322 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
323 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
324 #error "test failed."
326 , [ res=yes ], [ res=no ])
327 AC_MSG_RESULT([$res])
328 if test "$res" != "yes"; then
329 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
331 # Check windres version
332 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
333 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
334 AC_MSG_RESULT([$_WINDRES_VERSION])
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 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
339 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
340 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
341 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
342 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
343 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
344 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
345 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
346 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
348 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
351 AC_CHECK_PROGS(MIDL, $target-widl widl)
352 if test -n "$MIDL"; then
355 MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
358 MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
363 # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
364 # causing problems with local implementations with the same name.
365 AC_DEFINE(STRSAFE_NO_DEPRECATE)
368 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
369 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
370 # Require OS features provided by IE 8.0 (Win7)
371 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0800)
376 if test -n "$_WIN32_MSVC"; then
378 SKIP_COMPILER_CHECKS=1
379 SKIP_LIBRARY_CHECKS=1
381 # Since we're skipping compiler and library checks, hard-code
384 AC_DEFINE(HAVE_ISATTY)
387 fi # COMPILE_ENVIRONMENT
396 AC_SUBST_LIST(STL_FLAGS)
397 AC_SUBST(WRAP_STL_INCLUDES)
398 AC_SUBST(MOZ_MSVC_STL_WRAP_RAISE)
400 dnl ========================================================
401 dnl Checks for programs.
402 dnl ========================================================
403 if test "$COMPILE_ENVIRONMENT"; then
405 dnl ========================================================
406 dnl = Mac OS X SDK support
407 dnl ========================================================
409 MOZ_ARG_WITH_STRING(macos-sdk,
410 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
411 MACOS_SDK_DIR=$withval)
413 MACOS_PRIVATE_FRAMEWORKS_DIR_DEFAULTED=
414 MOZ_ARG_WITH_STRING(macos-private-frameworks,
415 [ --with-macos-private-frameworks=dir Location of private frameworks to use (Mac OS X only)],
416 MACOS_PRIVATE_FRAMEWORKS_DIR=$withval,
417 MACOS_PRIVATE_FRAMEWORKS_DIR=/System/Library/PrivateFrameworks
418 MACOS_PRIVATE_FRAMEWORKS_DEFAULTED=1)
420 if test -z "${MACOS_PRIVATE_FRAMEWORKS_DEFAULTED}"; then
421 if test -z "$CROSS_COMPILE"; then
422 AC_MSG_WARN([You should only be using --with-macos-private-frameworks when cross-compiling.])
424 if test ! -d "$MACOS_PRIVATE_FRAMEWORKS_DIR"; then
425 AC_MSG_ERROR([PrivateFrameworks directory not found.])
429 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
430 AC_SUBST(MACOS_SDK_DIR)
431 AC_SUBST(MACOS_PRIVATE_FRAMEWORKS_DIR)
433 if test "$MACOS_SDK_DIR"; then
434 dnl Sync this section with the ones in NSPR and NSS.
435 dnl Changes to the cross environment here need to be accounted for in
436 dnl the libIDL checks (below) and xpidl build.
438 if test ! -d "$MACOS_SDK_DIR"; then
439 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
440 specify a valid SDK. SDKs are installed when the optional cross-development
441 tools are selected during the Xcode/Developer Tools installation.])
444 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
445 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
447 dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
448 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
449 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
452 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
454 AC_TRY_COMPILE([#include <new>],[],
458 AC_MSG_RESULT($result)
460 if test "$result" = "no" ; then
461 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
469 fi # COMPILE_ENVIRONMENT
471 dnl ========================================================
472 dnl set the defaults first
473 dnl ========================================================
478 MOZ_USER_DIR=".mozilla"
480 MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
484 dnl Configure platform-specific CPU architecture compiler options.
485 dnl ==============================================================
486 if test "$COMPILE_ENVIRONMENT"; then
489 if test "$OS_TARGET" = Android; then
490 dnl Default Android builds to ARMv7.
493 fi # COMPILE_ENVIRONMENT
495 dnl ========================================================
496 dnl Android libstdc++, placed here so it can use MOZ_ARCH
498 dnl ========================================================
501 if test "$COMPILE_ENVIRONMENT"; then
503 fi # COMPILE_ENVIRONMENT
505 dnl ========================================================
506 dnl Suppress Clang Argument Warnings
507 dnl ========================================================
508 if test -n "${CLANG_CC}${CLANG_CL}"; then
509 _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
510 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
512 if test -n "${CLANG_CXX}${CLANG_CL}"; then
513 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
516 if test -n "$COMPILE_ENVIRONMENT"; then
520 dnl ========================================================
521 dnl Add optional and non-optional hardening flags
522 dnl ========================================================
524 CFLAGS="$CFLAGS $MOZ_HARDENING_CFLAGS"
525 CPPFLAGS="$CPPFLAGS $MOZ_HARDENING_CFLAGS"
526 CXXFLAGS="$CXXFLAGS $MOZ_HARDENING_CFLAGS"
528 dnl ========================================================
529 dnl GNU specific defaults
530 dnl ========================================================
531 if test "$GNU_CC"; then
535 SSSE3_FLAGS="-mssse3"
536 # FIXME: Let us build with strict aliasing. bug 414641.
537 CFLAGS="$CFLAGS -fno-strict-aliasing"
538 MKSHLIB='$(CXX) $(COMPUTED_CXX_LDFLAGS) $(PGO_CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
539 MKCSHLIB='$(CC) $(COMPUTED_C_LDFLAGS) $(PGO_CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
540 WARNINGS_AS_ERRORS='-Werror'
543 if test "$OS_ARCH" != "WINNT" -o -z "$CLANG_CC"; then
544 DSO_PIC_CFLAGS='-fPIC'
545 ASFLAGS="$ASFLAGS -fPIC"
548 AC_MSG_CHECKING([for --noexecstack option to as])
550 CFLAGS="$CFLAGS -Wa,--noexecstack"
551 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
552 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
555 AC_MSG_CHECKING([for -z noexecstack option to ld])
556 _SAVE_LDFLAGS=$LDFLAGS
557 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
558 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
560 LDFLAGS=$_SAVE_LDFLAGS)
562 AC_MSG_CHECKING([for -z text option to ld])
563 _SAVE_LDFLAGS=$LDFLAGS
564 LDFLAGS="$LDFLAGS -Wl,-z,text"
565 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
567 LDFLAGS=$_SAVE_LDFLAGS)
569 AC_MSG_CHECKING([for -z relro option to ld])
570 _SAVE_LDFLAGS=$LDFLAGS
571 LDFLAGS="$LDFLAGS -Wl,-z,relro"
572 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
574 LDFLAGS=$_SAVE_LDFLAGS)
576 AC_MSG_CHECKING([for --build-id option to ld])
577 _SAVE_LDFLAGS=$LDFLAGS
578 LDFLAGS="$LDFLAGS -Wl,--build-id"
579 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
581 LDFLAGS=$_SAVE_LDFLAGS)
583 AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
584 HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
585 _SAVE_LDFLAGS=$LDFLAGS
586 LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
587 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
588 [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
590 LDFLAGS=$_SAVE_LDFLAGS
592 # Check for -mssse3 on $CC
593 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
594 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
596 CFLAGS="$CFLAGS -mssse3"
597 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
598 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
602 # Check for -msse4.1 on $CC
603 AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
604 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
606 CFLAGS="$CFLAGS -msse4.1"
607 AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
608 [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
612 case "${CPU_ARCH}" in
614 AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
616 [asm volatile ("vpermq \$0xd8,%ymm0,%ymm0 \n");],
617 result="yes", result="no")
618 AC_MSG_RESULT("$result")
619 if test "$result" = "yes"; then
625 AC_MSG_CHECKING([whether we can enable AltiVec support])
628 CFLAGS="$CFLAGS -maltivec"
629 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
637 if test "$GCC_USE_GNU_LD"; then
638 # Some tools like ASan use a runtime library that is only
639 # linked against executables, so we must allow undefined
640 # symbols for shared objects in some cases.
641 if test -z "$MOZ_NO_WLZDEFS"; then
642 # Don't allow undefined symbols in libraries
643 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
645 # BSDs need `environ' exposed for posix_spawn (bug 753046)
647 DragonFly|FreeBSD|NetBSD|OpenBSD)
648 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
649 DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
651 DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
658 _DEFINES_CFLAGS="-include $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
659 _USE_CPP_INCLUDE_FLAG=1
661 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
664 if test "$GNU_CXX"; then
665 # FIXME: Let us build with strict aliasing. bug 414641.
666 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
668 _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
669 _USE_CPP_INCLUDE_FLAG=1
672 # For profiling builds keep the symbol information
673 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
675 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
676 STRIP_FLAGS="--strip-debug"
681 dnl ========================================================
683 dnl ========================================================
685 if test "$MOZ_DMD"; then
686 if test "${CPU_ARCH}" = "arm"; then
687 CFLAGS="$CFLAGS -funwind-tables"
688 CXXFLAGS="$CXXFLAGS -funwind-tables"
692 dnl ========================================================
693 dnl System overrides of the defaults for host
694 dnl ========================================================
697 if test -n "$_WIN32_MSVC"; then
699 HOST_AR_FLAGS='-NOLOGO -OUT:$@'
700 HOST_CFLAGS="$HOST_CFLAGS -nologo"
701 HOST_RANLIB='echo ranlib'
703 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
705 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
706 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
709 case "${host_cpu}" in
711 if test -n "$_WIN32_MSVC"; then
712 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
716 if test -n "$_WIN32_MSVC"; then
717 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
719 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
725 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
726 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
729 *-linux*|*-kfreebsd*-gnu|*-gnu*)
730 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
731 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
735 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
736 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
740 dnl Get version of various core apps from the version files.
741 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
742 FIREFOX_VERSION_DISPLAY=`cat $_topsrcdir/browser/config/version_display.txt`
744 if test -z "$FIREFOX_VERSION"; then
745 AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
748 if test -z "$FIREFOX_VERSION_DISPLAY"; then
749 AC_MSG_ERROR([FIREFOX_VERSION_DISPLAY is unexpectedly blank.])
752 MOZ_DOING_LTO(lto_is_enabled)
754 dnl ========================================================
755 dnl System overrides of the defaults for target
756 dnl ========================================================
760 MKSHLIB='$(CXX) $(COMPUTED_CXX_LDFLAGS) $(PGO_CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
761 MKCSHLIB='$(CC) $(COMPUTED_C_LDFLAGS) $(PGO_CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
762 MOZ_OPTIMIZE_FLAGS="-O3"
763 CXXFLAGS="$CXXFLAGS -stdlib=libc++"
765 STRIP_FLAGS="$STRIP_FLAGS -x -S"
766 # Ensure that if we're targeting iOS an SDK was provided.
767 AC_CACHE_CHECK(for iOS target,
769 [AC_TRY_COMPILE([#include <TargetConditionals.h>
770 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
774 ac_cv_ios_target="yes",
775 ac_cv_ios_target="no")])
776 if test "$ac_cv_ios_target" = "yes" -a -z $MOZ_IOS; then
777 AC_MSG_ERROR([targeting iOS but not using an iOS SDK?])
779 if test -n "$MOZ_IOS"; then
782 # The ExceptionHandling framework is needed for Objective-C exception
783 # logging code in nsObjCExceptions.h. Currently we only use that in debug
785 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
788 if test "x$lto_is_enabled" = "xyes"; then
789 echo "Skipping -dead_strip because lto is enabled."
790 dnl DTrace and -dead_strip don't interact well. See bug 403132.
791 dnl ===================================================================
792 elif test "x$enable_dtrace" = "xyes"; then
793 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
795 dnl check for the presence of the -dead_strip linker flag
796 AC_MSG_CHECKING([for -dead_strip option to ld])
797 _SAVE_LDFLAGS=$LDFLAGS
798 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
799 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
800 if test -n "$_HAVE_DEAD_STRIP" ; then
802 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
807 LDFLAGS=$_SAVE_LDFLAGS
810 MOZ_FIX_LINK_PATHS="-Wl,-executable_path,${DIST}/bin"
813 *-android*|*-linuxandroid*)
814 AC_DEFINE(NO_PW_GECOS)
816 if test "$COMPILE_ENVIRONMENT"; then
820 MOZ_GFX_OPTIMIZE_MOBILE=1
821 if test -z "$CLANG_CC"; then
822 MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
824 # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
825 # -Oz is smaller than -Os on clang.
826 MOZ_OPTIMIZE_FLAGS="-Oz"
831 if test "$GNU_CC" -o "$GNU_CXX"; then
832 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
833 if test -n "$MOZ_DEBUG"; then
834 MOZ_OPTIMIZE_FLAGS="-Os"
836 MOZ_OPTIMIZE_FLAGS="-O2"
838 if test -z "$CLANG_CC"; then
839 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
843 case "${target_cpu}" in
845 CFLAGS="$CFLAGS -mieee"
846 CXXFLAGS="$CXXFLAGS -mieee"
854 # certain versions of cygwin's makedepend barf on the
855 # #include <string> vs -I./dist/include/string issue so don't use it
856 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
860 CFLAGS="$CFLAGS -mms-bitfields"
861 CXXFLAGS="$CXXFLAGS -mms-bitfields"
863 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
864 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
866 # Use temp file for windres (bug 213281)
867 RCFLAGS='-O coff --use-temp-file'
868 # mingw doesn't require kernel32, user32, and advapi32 explicitly
869 LIBS="$LIBS -luuid -lusp10 -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
872 MOZ_OPTIMIZE_FLAGS="-O1"
874 WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
875 WIN32_GUI_EXE_LDFLAGS=-mwindows
877 if test -z "$CLANG_CC"; then
878 # Use static libgcc and libstdc++
879 LDFLAGS="$LDFLAGS -static"
881 # GCC/binutils can't link to a function if we try to include dllexport function
882 # in the same library as dllimport caller. To work around it, we build NSPR
883 # and NSS with -mnop-fun-dllimport flag. The drawback of this solution is that
884 # function thunks need to be generated for cross-DLL calls.
885 MOZ_FOLD_LIBS_FLAGS="-mnop-fun-dllimport"
887 # Silence problematic clang warnings
888 CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
891 TARGET_COMPILER_ABI=msvc
892 if test "$AS_BIN"; then
893 AS="$(basename "$AS_BIN")"
898 AR_FLAGS='-llvmlibthin -out:$@'
902 AR_FLAGS='-NOLOGO -OUT:$@'
906 RANLIB='echo not_ranlib'
907 STRIP='echo not_strip'
909 MKSHLIB='$(LINKER) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
910 MKCSHLIB='$(LINKER) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
911 WIN32_SUBSYSTEM_VERSION=6.01
912 WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
913 WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
914 DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
915 _USE_CPP_INCLUDE_FLAG=1
916 _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
917 _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
918 CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
919 CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
920 if test -z "$CLANG_CL"; then
921 CPPFLAGS="$CPPFLAGS -utf-8"
923 if test "$CPU_ARCH" = "x86"; then
924 dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
925 dnl more recent, so set that explicitly here unless another
926 dnl target arch has already been set.
928 if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
929 CFLAGS="$CFLAGS -arch:SSE2"
931 if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
932 CXXFLAGS="$CXXFLAGS -arch:SSE2"
935 SSE_FLAGS="-arch:SSE"
936 SSE2_FLAGS="-arch:SSE2"
937 dnl MSVC allows the use of intrinsics without any flags
938 dnl and doesn't have a separate arch for SSSE3
939 SSSE3_FLAGS="-arch:SSE2"
941 dnl clang-cl requires appropriate flags to enable SSSE3 support
942 dnl on all architectures.
943 if test -n "$CLANG_CL"; then
944 SSSE3_FLAGS="-mssse3"
946 dnl VS2013+ supports -Gw for better linker optimizations.
947 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
948 dnl Disabled on ASan because it causes false-positive ODR violations.
949 if test -z "$MOZ_ASAN"; then
951 CXXFLAGS="$CXXFLAGS -Gw"
953 # khuey says we can safely ignore MSVC warning C4251
954 # MSVC warning C4244 (implicit type conversion may lose data) warns
955 # and requires workarounds for perfectly valid code. Also, GCC/clang
956 # don't warn about it by default. So for consistency/sanity, we turn
957 # it off on MSVC, too.
958 # MSVC warning C4267 warns for narrowing type conversions from size_t
959 # to 32-bit integer types on 64-bit platforms. Since this is virtually
960 # the same thing as C4244, we disable C4267, too.
961 # MSVC warning C4800 warns when a value is implicitly cast to bool,
962 # because this also forces narrowing to a single byte, which can be a
963 # perf hit. But this matters so little in practice (and often we want
964 # that behavior) that it's better to turn it off.
965 # MSVC warning C4595 warns non-member operator new or delete functions
966 # may not be declared inline, as of VS2015 Update 2.
967 CFLAGS="$CFLAGS -wd4244 -wd4267"
968 CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4267 -wd4800 -wd4595"
969 # Silence "warning C4065: switch statement contains 'default' but no
970 # 'case' labels". See bug 1461304.
971 CXXFLAGS="$CXXFLAGS -wd4065"
972 if test -n "$CLANG_CL"; then
973 # XXX We should combine some of these with our generic GCC-style
976 # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
977 CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
978 # We use offsetof on non-POD objects all the time.
979 # We also suppress this warning on other platforms.
980 CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
981 # This warns for reasonable things like:
982 # enum { X = 0xffffffffU };
983 # which is annoying for IDL headers.
984 CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
985 # This warns for cases that would be reached by the Microsoft
986 # #include rules, but also currently warns on cases that would
987 # *also* be reached by standard C++ include rules. That
988 # behavior doesn't seem useful, so we turn it off.
989 CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
990 # We normally error out on unknown pragmas, but since clang-cl
991 # claims to be MSVC, it would be difficult to add
992 # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
993 # use such pragmas, so just ignore them.
994 CFLAGS="$CFLAGS -Wno-unknown-pragmas"
995 CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
996 # We get errors about various #pragma intrinsic directives from
997 # clang-cl, and we don't need to hear about those.
998 CFLAGS="$CFLAGS -Wno-ignored-pragmas"
999 CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
1000 # clang-cl's Intrin.h marks things like _ReadWriteBarrier
1001 # as __attribute((__deprecated__)). This is nice to know,
1002 # but since we don't get the equivalent warning from MSVC,
1003 # let's just ignore it.
1004 CFLAGS="$CFLAGS -Wno-deprecated-declarations"
1005 CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
1006 # We use a function like:
1007 # __declspec(noreturn) __inline void f() {}
1008 # which -Winvalid-noreturn complains about. Again, MSVC seems
1009 # OK with it, so let's silence the warning.
1010 CFLAGS="$CFLAGS -Wno-invalid-noreturn"
1011 CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
1012 # Missing |override| on virtual function declarations isn't
1013 # something that MSVC currently warns about.
1014 CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
1015 # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
1016 # declaration on |operator delete(void*)|. However, clang-cl
1017 # must internally declare |operator delete(void*)| differently,
1018 # which causes this warning for virtually every file in the
1019 # tree. clang-cl doesn't support -fno-exceptions or equivalent,
1020 # so there doesn't seem to be any way to convince clang-cl to
1021 # declare |delete| differently. Therefore, suppress this
1023 CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
1024 # At least one MSVC header and several headers in-tree have
1025 # unused typedefs, so turn this on.
1026 CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
1027 # jemalloc uses __declspec(allocator) as a profiler hint,
1028 # which clang-cl doesn't understand.
1029 CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
1030 # __attribute__((unused)) really means "might be unused" and
1031 # we use it to avoid warnings about things that are unused
1032 # in some compilation units, but used in many others. This
1033 # warning insists on complaining about the latter case, which
1034 # is annoying, and rather noisy.
1035 CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused"
1037 # make 'foo == bar;' error out
1038 CFLAGS="$CFLAGS -we4553"
1039 CXXFLAGS="$CXXFLAGS -we4553"
1040 # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
1041 CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
1042 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
1043 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1044 WARNINGS_AS_ERRORS='-WX'
1045 # Use a higher optimization level for clang-cl, so we can come closer
1046 # to MSVC's performance numbers (see bug 1443590).
1047 if test -n "$CLANG_CL"; then
1048 MOZ_OPTIMIZE_FLAGS='-O2'
1050 MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
1053 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
1054 if test -z "$DEVELOPER_OPTIONS"; then
1055 LDFLAGS="$LDFLAGS -RELEASE"
1057 LDFLAGS="$LDFLAGS -DYNAMICBASE"
1059 dnl Minimum reqiurement of Gecko is VS2015 or later which supports
1060 dnl both SSSE3 and SSE4.1.
1061 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
1062 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
1063 dnl allow AVX2 code from VS2015
1066 AC_DEFINE(WIN32_LEAN_AND_MEAN)
1067 dnl See http://support.microsoft.com/kb/143208 to use STL
1070 MOZ_USER_DIR="Mozilla"
1074 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.])
1078 if test -n "$GNU_CC" -a -z "$CLANG_CC"; then
1079 CFLAGS="$CFLAGS -fno-keep-inline-dllexport"
1080 CXXFLAGS="$CXXFLAGS -fno-keep-inline-dllexport"
1085 if test -n "$GNU_CC"; then
1086 CFLAGS="$CFLAGS -mstackrealign"
1087 CXXFLAGS="$CXXFLAGS -mstackrealign"
1088 LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup -Wl,--large-address-aware"
1090 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
1091 LDFLAGS="$LDFLAGS -SAFESEH"
1097 if test -n "$_WIN32_MSVC"; then
1098 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
1103 if test -n "$_WIN32_MSVC"; then
1104 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:ARM64"
1109 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
1116 CFLAGS="$CFLAGS -Dunix"
1117 CXXFLAGS="$CXXFLAGS -Dunix"
1118 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
1119 DSO_PIC_CFLAGS='-fPIC -DPIC'
1120 DSO_LDOPTS='-shared'
1121 MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
1123 DSO_PIC_CFLAGS='-fPIC -DPIC'
1124 DSO_LDOPTS='-shared'
1126 # This will fail on a.out systems prior to 1.5.1_ALPHA.
1127 if test "$LIBRUNPATH"; then
1128 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
1130 MKSHLIB='$(CXX) $(COMPUTED_CXX_LDFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
1131 MKCSHLIB='$(CC) $(COMPUTED_C_LDFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
1135 if test -z "$X11BASE"; then
1138 MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
1140 DSO_PIC_CFLAGS='-fPIC'
1141 DSO_LDOPTS='-shared -fPIC'
1142 if test "$LIBRUNPATH"; then
1143 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
1148 MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
1153 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
1154 MOZ_OPTIMIZE_FLAGS="-O"
1157 AC_SUBST_LIST(MMX_FLAGS)
1158 AC_SUBST_LIST(SSE_FLAGS)
1159 AC_SUBST_LIST(SSE2_FLAGS)
1160 AC_SUBST_LIST(SSSE3_FLAGS)
1162 AC_SUBST(MOZ_LINKER)
1163 if test -n "$MOZ_LINKER"; then
1164 AC_DEFINE(MOZ_LINKER)
1165 MOZ_LINKER_EXTRACT=1
1166 AC_CHECK_PROGS(XZ, xz)
1169 if test -z "$COMPILE_ENVIRONMENT"; then
1170 SKIP_COMPILER_CHECKS=1
1171 SKIP_LIBRARY_CHECKS=1
1176 fi # COMPILE_ENVIRONMENT
1178 if test -z "$SKIP_COMPILER_CHECKS"; then
1179 dnl Checks for typedefs, structures, and compiler characteristics.
1180 dnl ========================================================
1195 case "${OS_TARGET}" in
1199 STL_FLAGS="-I${DIST}/stl_wrappers"
1204 dnl Checks for header files.
1205 dnl ========================================================
1207 case "$target_os" in
1208 bitrig*|dragonfly*|freebsd*|openbsd*)
1209 # for stuff like -lXshm
1210 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
1214 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
1215 AC_CACHE_CHECK(for sockaddr_in.sin_len,
1216 ac_cv_sockaddr_in_sin_len,
1217 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1218 #include <sys/types.h>
1220 #include <netinet/in.h>
1221 struct sockaddr_in x;
1222 void *foo = (void*) &x.sin_len;],
1224 [ac_cv_sockaddr_in_sin_len=true],
1225 [ac_cv_sockaddr_in_sin_len=false])])
1226 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
1227 AC_DEFINE(HAVE_SIN_LEN)
1228 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
1229 AC_DEFINE(HAVE_SCONN_LEN)
1232 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
1233 ac_cv_sockaddr_in6_sin6_len,
1234 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1235 #include <sys/types.h>
1237 #include <netinet/in.h>
1238 struct sockaddr_in6 x;
1239 void *foo = (void*) &x.sin6_len;],
1241 [ac_cv_sockaddr_in6_sin6_len=true],
1242 [ac_cv_sockaddr_in6_sin6_len=false])])
1243 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
1244 AC_DEFINE(HAVE_SIN6_LEN)
1247 AC_CACHE_CHECK(for sockaddr.sa_len,
1248 ac_cv_sockaddr_sa_len,
1249 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1250 #include <sys/types.h>
1252 #include <sys/socket.h>
1254 void *foo = (void*) &x.sa_len;],
1256 [ac_cv_sockaddr_sa_len=true],
1257 [ac_cv_sockaddr_sa_len=false])])
1258 if test "$ac_cv_sockaddr_sa_len" = true ; then
1259 AC_DEFINE(HAVE_SA_LEN)
1262 MOZ_ARG_ENABLE_BOOL(dtrace,
1263 [ --enable-dtrace build with dtrace support if available (default=no)],
1264 [enable_dtrace="yes"],)
1265 if test "x$enable_dtrace" = "xyes"; then
1266 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
1267 if test -n "$HAVE_DTRACE"; then
1268 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
1270 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
1273 AC_SUBST(HAVE_DTRACE)
1275 dnl Checks for libraries.
1276 dnl ========================================================
1277 AC_CHECK_LIB(c_r, gethostbyname_r)
1279 dnl We don't want to link with libdl even if it's present on OS X, since
1280 dnl it's not used and not part of the default installation. OS/2 has dlfcn
1282 dnl We don't want to link against libm or libpthread on Darwin since
1283 dnl they both are just symlinks to libSystem and explicitly linking
1284 dnl against libSystem causes issues when debugging (see bug 299601).
1289 AC_SEARCH_LIBS(dlopen, dl,
1290 MOZ_CHECK_HEADER(dlfcn.h,
1291 AC_DEFINE(HAVE_DLOPEN)))
1295 _SAVE_CFLAGS="$CFLAGS"
1296 CFLAGS="$CFLAGS -D_GNU_SOURCE"
1297 AC_CHECK_FUNCS(dladdr memmem)
1298 CFLAGS="$_SAVE_CFLAGS"
1300 if test ! "$GNU_CXX"; then
1301 AC_CHECK_LIB(C, demangle)
1304 AC_CHECK_LIB(socket, socket)
1307 XLIBS="$X_EXTRA_LIBS"
1309 dnl ========================================================
1310 dnl Checks for X libraries.
1311 dnl Ordering is important.
1312 dnl Xt is dependent upon SM as of X11R6
1313 dnl ========================================================
1314 if test -n "$MOZ_X11"; then
1315 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
1316 _SAVE_LDFLAGS="$LDFLAGS"
1318 LDFLAGS="$XLDFLAGS $LDFLAGS"
1319 AC_CHECK_LIB(X11, XDrawLines, [XLIBS="-lX11 $XLIBS"],
1320 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
1321 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
1322 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
1324 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
1325 unset ac_cv_lib_Xt_XtFree
1326 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
1327 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
1328 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
1329 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
1332 dnl ========================================================
1334 dnl ========================================================
1335 AC_CHECK_LIB(xcb, xcb_connect, [XLIBS="-lxcb $XLIBS"],
1336 [MISSING_X="$MISSING_X -lxcb"], $XLIBS)
1337 AC_CHECK_LIB(xcb-shm, xcb_shm_query_version, [XLIBS="-lxcb-shm $XLIBS"],
1338 [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS)
1339 AC_CHECK_LIB(X11-xcb, XGetXCBConnection, [XLIBS="-lX11-xcb $XLIBS"],
1340 [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS)
1342 LDFLAGS="$_SAVE_LDFLAGS"
1346 AC_SUBST_LIST(XCFLAGS)
1347 AC_SUBST_LIST(XLDFLAGS)
1348 AC_SUBST_LIST(XLIBS)
1349 AC_SUBST_LIST(XEXT_LIBS)
1350 AC_SUBST_LIST(XT_LIBS)
1352 dnl ========================================================
1353 dnl = pthread support
1354 dnl = Start by checking whether the system support pthreads
1355 dnl ========================================================
1356 case "$target_os" in
1361 AC_CHECK_LIB(pthreads, pthread_create,
1362 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
1363 AC_CHECK_LIB(pthread, pthread_create,
1364 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
1365 AC_CHECK_LIB(c_r, pthread_create,
1366 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
1367 AC_CHECK_LIB(c, pthread_create,
1376 dnl ========================================================
1377 dnl Do the platform specific pthread hackery
1378 dnl ========================================================
1379 if test "$MOZ_USE_PTHREADS"x != x
1382 dnl See if -pthread is supported.
1385 ac_cv_have_dash_pthread=no
1386 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
1387 echo 'int main() { return 0; }' | cat > conftest.c
1388 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
1389 if test $? -eq 0; then
1390 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1391 ac_cv_have_dash_pthread=yes
1392 case "$target_os" in
1394 # Freebsd doesn't use -pthread for compiles, it uses them for linking
1397 CFLAGS="$CFLAGS -pthread"
1398 CXXFLAGS="$CXXFLAGS -pthread"
1404 AC_MSG_RESULT($ac_cv_have_dash_pthread)
1407 dnl See if -pthreads is supported.
1409 ac_cv_have_dash_pthreads=no
1410 if test "$ac_cv_have_dash_pthread" = "no"; then
1411 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
1412 echo 'int main() { return 0; }' | cat > conftest.c
1413 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
1414 if test $? -eq 0; then
1415 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1416 ac_cv_have_dash_pthreads=yes
1417 CFLAGS="$CFLAGS -pthreads"
1418 CXXFLAGS="$CXXFLAGS -pthreads"
1422 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
1427 AC_DEFINE(_REENTRANT)
1428 AC_DEFINE(_THREAD_SAFE)
1429 dnl -pthread links in -lpthread, so don't specify it explicitly.
1430 if test "$ac_cv_have_dash_pthread" = "yes"; then
1431 _PTHREAD_LDFLAGS="-pthread"
1435 *-*-openbsd*|*-*-bsdi*)
1436 AC_DEFINE(_REENTRANT)
1437 AC_DEFINE(_THREAD_SAFE)
1438 dnl -pthread links in -lc_r, so don't specify it explicitly.
1439 if test "$ac_cv_have_dash_pthread" = "yes"; then
1440 _PTHREAD_LDFLAGS="-pthread"
1444 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
1445 AC_DEFINE(_REENTRANT)
1449 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
1450 AC_SUBST(MOZ_USE_PTHREADS)
1451 MOZ_CHECK_HEADERS(pthread.h)
1455 dnl Checks for library functions.
1456 dnl ========================================================
1457 AC_PROG_GCC_TRADITIONAL
1459 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall)
1461 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1462 dnl avoid this on Darwin, since depending on your system config, we may think
1463 dnl it exists but it really doesn't
1464 case "$OS_TARGET" in
1468 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1469 ac_cv_clock_monotonic,
1470 [for libs in "" -lrt; do
1473 AC_TRY_LINK([#include <time.h>],
1474 [ struct timespec ts;
1475 clock_gettime(CLOCK_MONOTONIC, &ts); ],
1476 ac_cv_clock_monotonic=$libs
1479 ac_cv_clock_monotonic=no)
1482 if test "$ac_cv_clock_monotonic" != "no"; then
1483 HAVE_CLOCK_MONOTONIC=1
1484 REALTIME_LIBS=$ac_cv_clock_monotonic
1485 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1486 AC_SUBST(HAVE_CLOCK_MONOTONIC)
1487 AC_SUBST_LIST(REALTIME_LIBS)
1492 AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
1493 ac_cv_pthread_cond_timedwait_monotonic_np,
1494 AC_TRY_LINK([#include <pthread.h>],
1495 [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
1496 ac_cv_pthread_cond_timewait_monotonic_np=yes,
1497 ac_cv_pthread_cond_timewait_monotonic_np=no))
1498 if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
1499 AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
1504 ac_cv_func_res_ninit,
1505 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
1506 dnl no need for res_ninit() on NetBSD and OpenBSD
1507 ac_cv_func_res_ninit=no
1511 #define _BSD_SOURCE 1
1513 #include <sys/types.h>
1514 #include <netinet/in.h>
1515 #include <arpa/nameser.h>
1518 [int foo = res_ninit(&_res);],
1519 [ac_cv_func_res_ninit=yes],
1520 [ac_cv_func_res_ninit=no])
1524 if test "$ac_cv_func_res_ninit" = "yes"; then
1525 AC_DEFINE(HAVE_RES_NINIT)
1526 dnl must add the link line we do something as foolish as this... dougt
1528 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
1529 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
1534 dnl **********************
1535 dnl *** va_copy checks ***
1536 AC_CACHE_CHECK([for an implementation of va_copy()],
1538 [AC_TRY_COMPILE([#include <stdarg.h>
1540 void f (int i, ...) {
1541 va_list args1, args2;
1542 va_start (args1, i);
1543 va_copy (args2, args1);
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_copy=yes],
1553 AC_CACHE_CHECK([whether va_list can be copied by value],
1555 [AC_TRY_COMPILE([#include <stdarg.h>
1557 void f (int i, ...) {
1558 va_list args1, args2;
1559 va_start (args1, i);
1561 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1563 va_end (args1); va_end (args2);
1565 [f(0, 42); return 0],
1566 [ac_cv_va_val_copy=yes],
1567 [ac_cv_va_val_copy=no],
1570 if test "x$ac_cv_va_copy" = "xyes"; then
1571 AC_DEFINE(VA_COPY, va_copy)
1572 AC_DEFINE(HAVE_VA_COPY)
1575 if test "x$ac_cv_va_val_copy" = "xno"; then
1576 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
1579 dnl ===================================================================
1580 dnl ========================================================
1581 dnl Put your C++ language/feature checks below
1582 dnl ========================================================
1586 if test "$GNU_CC"; then
1587 if test "$CPU_ARCH" = "arm" ; then
1588 AC_CACHE_CHECK(for ARM EABI,
1592 #if defined(__ARM_EABI__)
1595 #error Not ARM EABI.
1598 ac_cv_gcc_arm_eabi="yes",
1599 ac_cv_gcc_arm_eabi="no")])
1600 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
1602 ARM_ABI_PREFIX=eabi-
1604 ARM_ABI_PREFIX=oabi-
1608 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
1611 dnl See if a dynamic_cast to void* gives the most derived object.
1612 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
1613 ac_cv_cpp_dynamic_cast_void_ptr,
1614 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
1615 class Y { int j; public: virtual ~Y() { } };
1616 class Z : public X, public Y { int k; };
1622 return !((((void*)&mdo != (void*)subx) &&
1623 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
1624 (((void*)&mdo != (void*)suby) &&
1625 ((void*)&mdo == dynamic_cast<void*>(suby))));
1627 ac_cv_cpp_dynamic_cast_void_ptr=yes,
1628 ac_cv_cpp_dynamic_cast_void_ptr=no,
1629 ac_cv_cpp_dynamic_cast_void_ptr=no)])
1630 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
1631 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
1635 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
1636 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
1637 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
1639 _SAVE_LDFLAGS=$LDFLAGS
1640 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
1641 AC_CACHE_CHECK(for __thread keyword for TLS variables,
1642 ac_cv_thread_keyword,
1643 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
1644 [return tlsIsMainThread;],
1645 ac_cv_thread_keyword=yes,
1646 ac_cv_thread_keyword=no)])
1647 LDFLAGS=$_SAVE_LDFLAGS
1648 # The custom dynamic linker doesn't support TLS variables
1650 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
1651 # mips builds fail with TLS variables because of a binutils bug.
1653 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
1658 *-android*|*-linuxandroid*)
1665 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
1671 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
1672 if test -n "$MOZ_LINKER"; then
1673 if test "$CPU_ARCH" = arm; then
1674 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
1675 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
1676 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1677 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1681 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
1682 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
1683 dnl Since the linker only understands the sysv ones, no need to build the
1684 dnl gnu style tables anyways.
1685 LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
1688 dnl End of C++ language/feature checks
1691 dnl ========================================================
1692 dnl = Internationalization checks
1693 dnl ========================================================
1695 dnl Internationalization and Locale support is different
1696 dnl on various UNIX platforms. Checks for specific i18n
1697 dnl features go here.
1699 AC_HAVE_FUNCS(localeconv)
1701 fi # ! SKIP_COMPILER_CHECKS
1703 if test -n "${COMPILE_ENVIRONMENT}"; then
1708 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1709 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1710 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1713 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1714 dnl features that Windows actually does support.
1716 if test -n "$SKIP_COMPILER_CHECKS"; then
1717 dnl Windows has malloc.h
1718 AC_DEFINE(MALLOC_H, [<malloc.h>])
1719 AC_DEFINE(HAVE_FORCEINLINE)
1720 AC_DEFINE(HAVE_LOCALECONV)
1721 fi # SKIP_COMPILER_CHECKS
1723 dnl Mozilla specific options
1724 dnl ========================================================
1725 dnl The macros used for command line options
1726 dnl are defined in build/autoconf/altoptions.m4.
1728 dnl ========================================================
1730 dnl = Check for external package dependencies
1732 dnl ========================================================
1733 MOZ_ARG_HEADER(External Packages)
1735 case "$OS_TARGET" in
1736 WINNT|Darwin|Android)
1746 dnl ========================================================
1747 dnl system libevent Support
1748 dnl ========================================================
1749 MOZ_ARG_WITH_STRING(system-libevent,
1750 [ --with-system-libevent[=PFX]
1751 Use system libevent [installed at prefix PFX]],
1752 LIBEVENT_DIR=$withval)
1754 _SAVE_CFLAGS=$CFLAGS
1755 _SAVE_LDFLAGS=$LDFLAGS
1757 if test "$LIBEVENT_DIR" = yes; then
1758 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
1759 MOZ_SYSTEM_LIBEVENT=1,
1762 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
1763 MOZ_SYSTEM_LIBEVENT=
1764 elif test -z "$MOZ_SYSTEM_LIBEVENT"; then
1765 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
1766 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
1767 MOZ_CHECK_HEADER(event.h,
1768 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
1769 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
1771 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
1772 AC_CHECK_LIB(event, event_init,
1773 [MOZ_SYSTEM_LIBEVENT=1
1774 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
1775 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
1776 [MOZ_SYSTEM_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
1778 CFLAGS=$_SAVE_CFLAGS
1779 LDFLAGS=$_SAVE_LDFLAGS
1782 AC_SUBST(MOZ_SYSTEM_LIBEVENT)
1784 dnl ========================================================
1785 dnl = If NSS was not detected in the system,
1786 dnl = use the one in the source tree (mozilla/security/nss)
1787 dnl ========================================================
1789 MOZ_ARG_WITH_BOOL(system-nss,
1790 [ --with-system-nss Use system installed NSS],
1793 if test -n "$_USE_SYSTEM_NSS"; then
1794 AM_PATH_NSS(3.39, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
1797 if test -z "$MOZ_SYSTEM_NSS"; then
1798 NSS_CFLAGS="-I${DIST}/include/nss"
1799 case "${OS_ARCH}" in
1800 # Only few platforms have been tested with GYP
1801 WINNT|Darwin|Linux|DragonFly|FreeBSD|NetBSD|OpenBSD|SunOS)
1804 AC_MSG_ERROR([building in-tree NSS is not supported on this platform. Use --with-system-nss])
1809 if test -z "$SKIP_LIBRARY_CHECKS"; then
1810 dnl system JPEG support
1811 dnl ========================================================
1812 MOZ_ARG_WITH_STRING(system-jpeg,
1813 [ --with-system-jpeg[=PFX]
1814 Use system libjpeg [installed at prefix PFX]],
1817 _SAVE_CFLAGS=$CFLAGS
1818 _SAVE_LDFLAGS=$LDFLAGS
1820 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
1821 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
1822 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
1824 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
1827 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_SYSTEM_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_SYSTEM_JPEG=)
1830 if test "$MOZ_SYSTEM_JPEG" = 1; then
1831 AC_TRY_COMPILE([ #include <stdio.h>
1832 #include <sys/types.h>
1833 #include <jpeglib.h> ],
1834 [ #if JPEG_LIB_VERSION < $MOZJPEG
1835 #error "Insufficient JPEG library version ($MOZJPEG required)."
1837 #ifndef JCS_EXTENSIONS
1838 #error "libjpeg-turbo JCS_EXTENSIONS required"
1842 AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
1844 CFLAGS=$_SAVE_CFLAGS
1845 LDFLAGS=$_SAVE_LDFLAGS
1848 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_SYSTEM_JPEG" = 1; then
1849 MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
1850 MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
1852 fi # SKIP_LIBRARY_CHECKS
1854 dnl system ZLIB support
1855 dnl ========================================================
1856 MOZ_ZLIB_CHECK([1.2.3])
1858 if test -z "$SKIP_LIBRARY_CHECKS"; then
1860 dnl ========================================================
1861 dnl system PNG Support
1862 dnl ========================================================
1863 MOZ_ARG_WITH_STRING(system-png,
1864 [ --with-system-png[=PFX]
1865 Use system libpng [installed at prefix PFX]],
1868 _SAVE_CFLAGS=$CFLAGS
1869 _SAVE_LDFLAGS=$LDFLAGS
1871 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
1872 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
1873 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
1875 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
1878 AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"],
1879 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1880 AC_CHECK_LIB(png, png_get_acTL, ,
1881 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
1883 if test "$MOZ_SYSTEM_PNG" = 1; then
1884 AC_TRY_COMPILE([ #include <stdio.h>
1885 #include <sys/types.h>
1887 [ #if PNG_LIBPNG_VER < $MOZPNG
1888 #error "Insufficient libpng version ($MOZPNG required)."
1890 #ifndef PNG_UINT_31_MAX
1891 #error "Insufficient libpng version."
1894 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1896 CFLAGS=$_SAVE_CFLAGS
1897 LDFLAGS=$_SAVE_LDFLAGS
1900 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then
1901 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
1902 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
1905 fi # SKIP_LIBRARY_CHECKS
1907 dnl ========================================================
1911 dnl ========================================================
1913 MOZ_ARG_HEADER(Application)
1915 ENABLE_SYSTEM_EXTENSION_DIRS=1
1916 MOZ_BRANDING_DIRECTORY=
1917 MOZ_OFFICIAL_BRANDING=
1919 MOZ_AUTH_EXTENSION=1
1920 if test "$MOZ_IOS"; then
1925 MOZ_WEBRTC_HARDWARE_AEC_NS=
1933 LIBJPEG_TURBO_ASFLAGS=
1934 MOZ_PREF_EXTENSIONS=1
1937 MOZ_TOOLKIT_SEARCH=1
1938 MOZ_UNIVERSALCHARDET=1
1943 MOZ_USE_NATIVE_POPUP_WINDOWS=
1944 MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
1946 MOZ_CONTENT_SANDBOX=
1949 MOZ_BINARY_EXTENSIONS=
1952 case "$target_os" in
1955 AC_DEFINE(NS_ENABLE_TSF)
1960 *-android*|*-linuxandroid*)
1966 # Optional Firefox for Android partner distribution directory.
1967 MOZ_ARG_WITH_STRING(android-distribution-directory,
1968 [ --with-android-distribution-directory=dir
1969 Optional Firefox for Android partner distribution directory.],
1970 MOZ_ANDROID_DISTRIBUTION_DIRECTORY=$withval)
1972 if test -n "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY"; then
1973 # A distribution directory must have an assets/distribution directory.
1974 # See https://wiki.mozilla.org/Mobile/Distribution_Files.
1975 if test ! -d "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY/assets/distribution" ; then
1976 AC_MSG_ERROR([--with-android-distribution-directory does not contain assets/distribution;
1977 (looked for ${MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets/distribution).])
1980 AC_SUBST(MOZ_ANDROID_DISTRIBUTION_DIRECTORY)
1982 dnl ========================================================
1983 dnl = Trademarked Branding
1984 dnl ========================================================
1985 MOZ_ARG_ENABLE_BOOL(official-branding,
1986 [ --enable-official-branding
1987 Enable Official mozilla.org Branding
1988 Do not distribute builds with
1989 --enable-official-branding unless you have
1990 permission to use trademarks per
1991 http://www.mozilla.org/foundation/trademarks/ .],
1992 MOZ_OFFICIAL_BRANDING=1,
1993 MOZ_OFFICIAL_BRANDING=)
1995 # Allow the application to influence configure with a confvars.sh script.
1996 AC_MSG_CHECKING([if app-specific confvars.sh exists])
1997 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
1998 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
1999 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
2004 # Allow influencing configure with a defines.sh script.
2005 . "${srcdir}/build/defines.sh"
2007 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
2009 if test "$BUILDING_RELEASE"; then
2010 # Override value in defines.sh, if any
2011 EARLY_BETA_OR_EARLIER=
2012 elif test "$EARLY_BETA_OR_EARLIER"; then
2013 AC_DEFINE(EARLY_BETA_OR_EARLIER)
2015 AC_SUBST(EARLY_BETA_OR_EARLIER)
2017 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
2018 MOZ_ARG_WITH_STRING(app-name,
2019 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
2020 WITH_APP_NAME=$withval,
2023 if test -n "$WITH_APP_NAME" ; then
2024 MOZ_APP_NAME="$WITH_APP_NAME"
2027 MOZ_ARG_WITH_STRING(app-basename,
2028 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
2029 WITH_APP_BASENAME=$withval,
2032 if test -n "$WITH_APP_BASENAME" ; then
2033 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
2036 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
2037 # that haven't made a confvars.sh yet. Don't add new stuff here, use
2039 case "$MOZ_BUILD_APP" in
2041 AC_DEFINE(MOZ_PHOENIX)
2045 AC_DEFINE(MOZ_XULRUNNER)
2049 # Graphene is a desktop runtime for running applications with a HTML UI.
2050 if test -n "$MOZ_GRAPHENE"; then
2051 AC_DEFINE(MOZ_GRAPHENE)
2054 if test -n "$MOZ_MULET"; then
2055 AC_DEFINE(MOZ_MULET)
2058 AC_SUBST(MOZ_PHOENIX)
2059 AC_SUBST(MOZ_XULRUNNER)
2062 dnl ========================================================
2063 dnl Ensure Android SDK and build-tools versions depending on
2065 dnl ========================================================
2067 case "$MOZ_BUILD_APP" in
2069 MOZ_ANDROID_SDK(26, 26, 27.0.3)
2073 dnl ========================================================
2075 dnl = Toolkit Options
2077 dnl ========================================================
2078 MOZ_ARG_HEADER(Toolkit Options)
2080 dnl ========================================================
2081 dnl = Enable the toolkit as needed =
2082 dnl ========================================================
2084 case "$MOZ_WIDGET_TOOLKIT" in
2087 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
2088 # Use -Wl as a trick to avoid -framework and framework names from
2089 # being separated by AC_SUBST_LIST.
2090 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'
2092 CFLAGS="$CFLAGS $TK_CFLAGS"
2093 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
2094 MOZ_USER_DIR="Mozilla"
2095 MOZ_FS_LAYOUT=bundle
2099 LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
2101 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'
2102 CFLAGS="$CFLAGS $TK_CFLAGS"
2103 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
2104 MOZ_USER_DIR="Mozilla"
2105 MOZ_FS_LAYOUT=bundle
2110 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
2111 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
2112 case "$MOZ_WIDGET_TOOLKIT" in
2118 if test "$COMPILE_ENVIRONMENT"; then
2119 if test "$MOZ_WIDGET_TOOLKIT" = gtk3; then
2120 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)
2121 MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
2122 TK_CFLAGS=$MOZ_GTK3_CFLAGS
2123 TK_LIBS=$MOZ_GTK3_LIBS
2124 dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
2125 dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
2126 AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
2127 GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32
2129 if test "$MOZ_WIDGET_TOOLKIT" = gtk2; then
2130 GLIB_VERSION_MAX_ALLOWED=$GLIB_VERSION_MIN_REQUIRED
2132 if test "$MOZ_ENABLE_GTK"; then
2133 if test "$MOZ_X11"; then
2134 GDK_PACKAGES=gdk-x11-2.0
2136 AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
2137 AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
2139 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)
2140 MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
2142 if test "$MOZ_WIDGET_TOOLKIT" = gtk2; then
2143 TK_CFLAGS=$MOZ_GTK2_CFLAGS
2144 TK_LIBS=$MOZ_GTK2_LIBS
2146 fi # COMPILE_ENVIRONMENT
2148 AC_SUBST(MOZ_FS_LAYOUT)
2150 dnl ========================================================
2151 dnl = startup-notification support module
2152 dnl ========================================================
2154 if test "$MOZ_ENABLE_GTK"
2156 MOZ_ENABLE_STARTUP_NOTIFICATION=
2158 MOZ_ARG_ENABLE_BOOL(startup-notification,
2159 [ --enable-startup-notification
2160 Enable startup-notification support (default: disabled) ],
2161 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
2162 MOZ_ENABLE_STARTUP_NOTIFICATION=)
2163 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
2165 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
2166 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
2167 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
2168 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
2170 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
2172 MOZ_ENABLE_STARTUP_NOTIFICATION=
2176 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
2177 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
2180 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
2182 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
2184 AC_SUBST_LIST(TK_CFLAGS)
2185 AC_SUBST_LIST(TK_LIBS)
2190 dnl ========================================================
2192 dnl = Components & Features
2194 dnl ========================================================
2195 MOZ_ARG_HEADER(Components and Features)
2197 AC_SUBST(MOZ_OFFICIAL_BRANDING)
2198 if test -n "$MOZ_OFFICIAL_BRANDING"; then
2199 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
2200 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
2202 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
2203 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
2207 MOZ_ARG_WITH_STRING(branding,
2208 [ --with-branding=dir Use branding from the specified directory.],
2209 MOZ_BRANDING_DIRECTORY=$withval)
2211 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
2212 if test -z "$REAL_BRANDING_DIRECTORY"; then
2213 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
2216 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
2217 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
2218 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
2219 . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
2222 AC_SUBST(MOZ_BRANDING_DIRECTORY)
2224 dnl ========================================================
2225 dnl = Distribution ID
2226 dnl ========================================================
2227 MOZ_ARG_WITH_STRING(distribution-id,
2228 [ --with-distribution-id=ID
2229 Set distribution-specific id (default=org.mozilla)],
2230 [ val=`echo $withval`
2231 MOZ_DISTRIBUTION_ID="$val"])
2233 if test -z "$MOZ_DISTRIBUTION_ID"; then
2234 MOZ_DISTRIBUTION_ID="org.mozilla"
2237 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
2238 AC_SUBST(MOZ_DISTRIBUTION_ID)
2240 dnl ========================================================
2241 dnl = GConf support module
2242 dnl ========================================================
2246 if test "$MOZ_ENABLE_GTK"
2251 dnl ========================================================
2252 dnl = GConf support module
2253 dnl ========================================================
2254 MOZ_ARG_DISABLE_BOOL(gconf,
2255 [ --disable-gconf Disable Gconf support ],
2259 if test "$MOZ_ENABLE_GCONF"
2261 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
2262 MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
2265 if test -n "$MOZ_ENABLE_GCONF";
2267 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
2269 AC_MSG_WARN([Many automated tests will fail with --disable-gconf. See bug 1167201.])
2274 if test "$MOZ_ENABLE_GCONF"; then
2275 AC_DEFINE(MOZ_ENABLE_GCONF)
2278 AC_SUBST(MOZ_ENABLE_GCONF)
2281 dnl ========================================================
2282 dnl = libproxy support
2283 dnl ========================================================
2285 if test "$MOZ_ENABLE_GTK"
2287 MOZ_ENABLE_LIBPROXY=
2289 MOZ_ARG_ENABLE_BOOL(libproxy,
2290 [ --enable-libproxy Enable libproxy support ],
2291 MOZ_ENABLE_LIBPROXY=1,
2292 MOZ_ENABLE_LIBPROXY=)
2294 if test "$MOZ_ENABLE_LIBPROXY"
2296 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
2297 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
2300 AC_SUBST(MOZ_ENABLE_LIBPROXY)
2302 dnl ========================================================
2304 dnl ========================================================
2306 if test "$MOZ_ENABLE_GTK"
2310 MOZ_ARG_DISABLE_BOOL(dbus,
2311 [ --disable-dbus Disable dbus support ],
2315 if test "$MOZ_ENABLE_DBUS"
2317 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
2318 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
2319 AC_DEFINE(MOZ_ENABLE_DBUS)
2322 AC_SUBST(MOZ_ENABLE_DBUS)
2324 dnl =========================================================
2325 dnl = Whether to exclude hyphenations files in the build
2326 dnl =========================================================
2327 if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
2328 AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
2331 dnl ========================================================
2332 dnl accessibility support on by default on all platforms
2333 dnl ========================================================
2334 MOZ_ARG_DISABLE_BOOL(accessibility,
2335 [ --disable-accessibility Disable accessibility support],
2338 if test "$ACCESSIBILITY"; then
2341 if test -z "$MIDL"; then
2342 if test "$GCC" != "yes"; then
2343 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
2345 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.])
2349 AC_DEFINE(ACCESSIBILITY)
2352 dnl ========================================================
2353 dnl Accessibility is required for the linuxgl widget
2355 dnl ========================================================
2356 if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
2357 AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
2360 AC_TRY_COMPILE([#include <linux/ethtool.h>],
2361 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
2362 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
2364 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
2366 if test -n "$MOZ_WEBRTC"; then
2372 if test -n "$MOZ_X11"; then
2373 MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
2377 dnl ========================================================
2378 dnl = Force hardware AEC, disable webrtc.org AEC
2379 dnl ========================================================
2380 MOZ_ARG_ENABLE_BOOL(hardware-aec-ns,
2381 [ --enable-hardware-aec-ns Enable support for hardware AEC and noise suppression],
2382 MOZ_WEBRTC_HARDWARE_AEC_NS=1,
2383 MOZ_WEBRTC_HARDWARE_AEC_NS=)
2385 if test -n "$MOZ_WEBRTC_HARDWARE_AEC_NS"; then
2386 AC_DEFINE(MOZ_WEBRTC_HARDWARE_AEC_NS)
2389 AC_SUBST(MOZ_WEBRTC_HARDWARE_AEC_NS)
2392 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
2394 dnl ========================================================
2395 dnl = Enable Raw Codecs
2396 dnl ========================================================
2397 MOZ_ARG_ENABLE_BOOL(raw,
2398 [ --enable-raw Enable support for RAW media],
2402 if test -n "$MOZ_RAW"; then
2408 dnl ========================================================
2409 dnl = Apple platform decoder support
2410 dnl ========================================================
2411 if test "$COMPILE_ENVIRONMENT"; then
2412 if test -n "$MOZ_APPLEMEDIA"; then
2413 # hack in frameworks for fmp4 - see bug 1029974
2414 # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
2415 LDFLAGS="$LDFLAGS -framework AudioToolbox"
2416 dnl Verify CoreMedia is available.
2417 AC_CHECK_HEADER([CoreMedia/CoreMedia.h], [],
2418 [AC_MSG_ERROR([MacOS X 10.9 SDK or later is required])])
2420 fi # COMPILE_ENVIRONMENT
2422 dnl system libvpx Support
2423 dnl ========================================================
2424 MOZ_ARG_WITH_BOOL(system-libvpx,
2425 [ --with-system-libvpx Use system libvpx (located with pkgconfig)],
2426 MOZ_SYSTEM_LIBVPX=1)
2431 _SAVE_CFLAGS=$CFLAGS
2433 if test -n "$MOZ_SYSTEM_LIBVPX"; then
2434 dnl ============================
2435 dnl === libvpx Version check ===
2436 dnl ============================
2437 dnl Check to see if we have a system libvpx package.
2438 PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.5.0)
2440 CFLAGS="$CFLAGS $MOZ_LIBVPX_CFLAGS"
2441 LIBS="$LIBS $MOZ_LIBVPX_LIBS"
2443 MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
2444 [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.])])
2446 AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
2447 [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
2449 MOZ_CHECK_HEADER([vpx_mem/vpx_mem.h],
2450 [AC_CHECK_FUNC(vpx_mem_set_functions)])
2451 if test "$ac_cv_header_vpx_mem_vpx_mem_h" = no -o \
2452 "$ac_cv_func_vpx_mem_set_functions" = no; then
2453 AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
2456 CFLAGS=$_SAVE_CFLAGS
2459 AC_SUBST(MOZ_SYSTEM_LIBVPX)
2460 AC_SUBST_LIST(MOZ_LIBVPX_CFLAGS)
2461 AC_SUBST_LIST(MOZ_LIBVPX_LIBS)
2463 if test -z "$MOZ_SYSTEM_LIBVPX"; then
2465 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
2466 dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
2467 dnl We currently require gcc on all arm platforms.
2469 dnl See if we have assembly on this platform.
2470 case "$OS_ARCH:$CPU_ARCH" in
2484 dnl Check for yasm 1.1 or greater.
2485 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
2486 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.])
2487 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
2488 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.])
2492 dnl The encoder needs obj_int_extract to get asm offsets.
2493 fi # COMPILE_ENVIRONMENT and others
2496 if test -n "$GNU_AS" ; then
2497 dnl These flags are a lie; they're just used to enable the requisite
2498 dnl opcodes; actual arch detection is done at runtime.
2499 VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
2500 VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/libvpx/build/make/ads2gas.pl'
2502 dnl Building with -mfpu=neon requires either the "softfp" or the
2503 dnl "hardfp" ABI. Depending on the compiler's default target, and the
2504 dnl CFLAGS, the default ABI might be neither, in which case it is the
2505 dnl "softfloat" ABI.
2506 dnl The "softfloat" ABI is binary-compatible with the "softfp" ABI, so
2507 dnl we can safely mix code built with both ABIs. So, if we detect
2508 dnl that compiling uses the "softfloat" ABI, force the use of the
2509 dnl "softfp" ABI instead.
2510 dnl Confusingly, the __SOFTFP__ preprocessor variable indicates the
2511 dnl "softfloat" ABI, not the "softfp" ABI.
2512 dnl Note: VPX_ASFLAGS is also used in CFLAGS.
2515 #error "compiler target supports -mfpu=neon, so we don't have to add extra flags"
2517 VPX_ASFLAGS="$VPX_ASFLAGS -mfloat-abi=softfp"
2522 if $CC -E -dM -</dev/null | grep -q __ELF__; then
2528 if $CC -E -dM -</dev/null | grep -q __ELF__; then
2535 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_USE_YASM" -a -z "$YASM"; then
2536 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.])
2537 fi # COMPILE_ENVIRONMENT and others
2539 if test -n "$VPX_USE_YASM" && test "$OS_ARCH:$CPU_ARCH" != "WINNT:x86_64"; then
2543 if test -n "$VPX_X86_ASM"; then
2544 AC_DEFINE(VPX_X86_ASM)
2545 elif test -n "$VPX_ARM_ASM"; then
2546 AC_DEFINE(VPX_ARM_ASM)
2548 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
2551 dnl native libvpx no longer has vpx_mem_set_functions
2552 AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
2555 dnl ========================================================
2556 dnl = Handle dependent MEDIA defines
2557 dnl ========================================================
2560 AC_DEFINE(MOZ_WEBM_ENCODER)
2561 AC_SUBST(MOZ_WEBM_ENCODER)
2563 dnl ========================================================
2565 dnl ========================================================
2567 MOZ_ARG_DISABLE_BOOL(negotiateauth,
2568 [ --disable-negotiateauth Disable GSS-API negotiation ],
2569 MOZ_AUTH_EXTENSION=,
2570 MOZ_AUTH_EXTENSION=1 )
2572 if test -n "$MOZ_IOS" -a -n "$MOZ_AUTH_EXTENSION"; then
2573 AC_MSG_ERROR([negotiateauth is not supported on iOS.])
2576 dnl ========================================================
2577 dnl Pref extensions (autoconfig)
2578 dnl ========================================================
2579 MOZ_ARG_DISABLE_BOOL(pref-extensions,
2580 [ --disable-pref-extensions
2581 Disable pref extensions such as autoconfig],
2582 MOZ_PREF_EXTENSIONS=,
2583 MOZ_PREF_EXTENSIONS=1 )
2585 dnl ========================================================
2586 dnl Searching of system directories for extensions.
2587 dnl Note: this switch is meant to be used for test builds
2588 dnl whose behavior should not depend on what happens to be
2589 dnl installed on the local machine.
2590 dnl ========================================================
2591 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
2592 [ --disable-system-extension-dirs
2593 Disable searching system- and account-global
2594 directories for extensions of any kind; use
2595 only profile-specific extension directories],
2596 ENABLE_SYSTEM_EXTENSION_DIRS=,
2597 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
2598 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
2599 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
2602 dnl ========================================================
2603 dnl = Universalchardet
2604 dnl ========================================================
2605 MOZ_ARG_DISABLE_BOOL(universalchardet,
2606 [ --disable-universalchardet
2607 Disable universal encoding detection],
2608 MOZ_UNIVERSALCHARDET=,
2609 MOZ_UNIVERSALCHARDET=1 )
2611 dnl ========================================================
2612 dnl = ANGLE OpenGL->D3D translator for WebGL
2613 dnl = * only applies to win32 (and then, not MINGW)
2614 dnl ========================================================
2618 MOZ_HAS_WINSDK_WITH_D3D=
2619 MOZ_D3DCOMPILER_VISTA_DLL=
2620 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
2622 if test "$COMPILE_ENVIRONMENT" ; then
2623 case "$target_os" in
2625 MOZ_ANGLE_RENDERER=1
2629 # The DirectX SDK libraries are split into x86 and x64 sub-directories
2630 case "${target_cpu}" in
2632 MOZ_D3D_CPU_SUFFIX=x86
2635 MOZ_D3D_CPU_SUFFIX=x64
2639 dnl ========================================================
2640 dnl D3D compiler DLL
2641 dnl ========================================================
2642 MOZ_FOUND_D3D_COMPILERS=
2644 if test -n "$MOZ_ANGLE_RENDERER"; then
2645 if test -z "$MOZ_D3D_CPU_SUFFIX"; then
2646 AC_MSG_ERROR([Couldn't determine MOZ_D3D_CPU_SUFFIX.])
2649 ######################################
2650 # Find _46+ for use by Vista+.
2652 # Find a D3D compiler DLL in a Windows SDK.
2653 MOZ_D3DCOMPILER_VISTA_DLL=
2654 case "$MOZ_WINSDK_MAXVER" in
2656 MOZ_D3DCOMPILER_VISTA_DLL=d3dcompiler_47.dll
2657 AC_MSG_RESULT([Found D3D compiler in Windows SDK.])
2661 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
2662 # We have a name, now track down the path.
2663 if test -n "$WINDOWSSDKDIR"; then
2664 MOZ_D3DCOMPILER_VISTA_DLL_PATH="$WINDOWSSDKDIR/Redist/D3D/$MOZ_D3D_CPU_SUFFIX/$MOZ_D3DCOMPILER_VISTA_DLL"
2665 if test -f "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
2666 AC_MSG_RESULT([Found MOZ_D3DCOMPILER_VISTA_DLL_PATH: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
2667 MOZ_HAS_WINSDK_WITH_D3D=1
2669 AC_MSG_RESULT([MOZ_D3DCOMPILER_VISTA_DLL_PATH doesn't exist: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
2670 AC_MSG_ERROR([Windows SDK at "$WINDOWSSDKDIR" appears broken. Try updating to MozillaBuild 1.9 final or higher.])
2671 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
2674 AC_MSG_RESULT([Windows SDK not found.])
2677 if test "$OS_ARCH" = "$HOST_OS_ARCH"; then
2678 AC_MSG_ERROR([Couldn't find Windows SDK 8.1 or higher needed for ANGLE.])
2680 AC_MSG_RESULT([Windows SDK not needed for ANGLE in Linux MinGW build.])
2684 if test -z "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
2685 MOZ_D3DCOMPILER_VISTA_DLL=
2688 # On mingw, check if headers are provided by toolchain.
2689 if test -n "$GNU_CC"; then
2690 MOZ_CHECK_HEADER(d3d10.h, MOZ_HAS_WINSDK_WITH_D3D=1)
2693 ######################################
2694 # Check that we found what we needed.
2695 MOZ_FOUND_A_D3D_COMPILER=
2697 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
2698 MOZ_FOUND_A_D3D_COMPILER=1
2699 AC_MSG_RESULT([Found d3dcompiler DLL for Vista+: $MOZ_D3DCOMPILER_VISTA_DLL])
2702 if test -z "$CROSS_COMPILE"; then
2703 if test -z "MOZ_FOUND_A_D3D_COMPILER"; then
2704 AC_MSG_ERROR([Couldn't find an acceptable D3D compiler DLL.])
2707 fi # MOZ_ANGLE_RENDERER
2709 dnl ========================================================
2711 dnl ========================================================
2713 dnl Moved gamepad platform check to moz.build, linux header check still needed here.
2714 if test "$OS_TARGET" = "Linux"; then
2715 MOZ_CHECK_HEADER([linux/joystick.h])
2716 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
2717 AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
2721 fi # COMPILE_ENVIRONMENT
2724 dnl ========================================================
2725 dnl = Breakpad crash reporting (on by default on supported platforms)
2726 dnl ========================================================
2729 i?86-*-mingw*|x86_64-*-mingw*)
2732 i?86-apple-darwin*|x86_64-apple-darwin*)
2733 if test -z "$MOZ_IOS"; then
2737 *-android*|*-linuxandroid*)
2738 dnl Android/arm is arm-unknown-linux-androideabi, so android condition should
2739 dnl be before Linux condition
2742 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
2743 if test "$MOZ_ENABLE_GTK"; then
2749 MOZ_ARG_DISABLE_BOOL(crashreporter,
2750 [ --disable-crashreporter Disable breakpad crash reporting],
2751 [MOZ_CRASHREPORTER=],
2752 [MOZ_CRASHREPORTER=F # Force enable breakpad])
2754 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin"; then
2755 if test "$MOZ_CRASHREPORTER" = F; then
2756 AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
2761 if test -n "$MOZ_CRASHREPORTER"; then
2762 AC_DEFINE(MOZ_CRASHREPORTER)
2764 if test "$OS_TARGET" = "Linux" && \
2765 test -z "$SKIP_LIBRARY_CHECKS"; then
2766 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
2769 if test "$OS_ARCH" = "WINNT"; then
2770 if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
2771 MOZ_CRASHREPORTER_INJECTOR=1
2772 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
2777 dnl ========================================================
2778 dnl = libjpeg-turbo configuration
2779 dnl ========================================================
2781 LIBJPEG_TURBO_USE_YASM=
2782 if test -z "$MOZ_SYSTEM_JPEG"; then
2786 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
2787 [ --disable-libjpeg-turbo Disable optimized jpeg decoding routines],
2789 MOZ_LIBJPEG_TURBO=1)
2791 if test "$MOZ_SYSTEM_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
2792 AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
2795 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
2798 if test -n "$MOZ_LIBJPEG_TURBO" -a -n "$COMPILE_ENVIRONMENT"; then
2800 dnl Do we support libjpeg-turbo on this platform?
2801 case "$OS_ARCH:$CPU_ARCH" in
2803 LIBJPEG_TURBO_ASFLAGS="-DPIC -DMACHO"
2806 LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DMACHO"
2811 LIBJPEG_TURBO_ASFLAGS="-DPIC -DWIN32"
2814 LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DWIN64 -DMSVC"
2817 LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
2820 LIBJPEG_TURBO_ASFLAGS="-march=armv8-a"
2823 LIBJPEG_TURBO_ASFLAGS="-mdspr2"
2826 if $CC -E -dM -</dev/null | grep -q __ELF__; then
2827 LIBJPEG_TURBO_ASFLAGS="-DPIC -DELF"
2831 if $CC -E -dM -</dev/null | grep -q __ELF__; then
2832 LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DELF"
2838 if test -n "$LIBJPEG_TURBO_ASFLAGS"; then
2840 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
2841 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
2842 dnl it doesn't exist or we have too old of a version.
2844 LIBJPEG_TURBO_USE_YASM=1
2846 if test -z "$YASM" ; then
2847 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.])
2850 dnl Check that we have the right yasm version. We require 1.0.1 or newer
2851 dnl on Linux and 1.1 or newer everywhere else.
2852 if test "$OS_ARCH" = "Linux" ; then
2853 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
2854 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.])
2857 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
2858 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.])
2865 dnl ========================================================
2866 dnl = libav-fft configuration
2867 dnl ========================================================
2871 dnl Turn on libav-fft for 32-bit windows, and all 64-bit supported platforms.
2872 dnl 32-bit linux/os x have text relocation issues.
2874 case "$OS_ARCH:$CPU_ARCH" in
2883 dnl Detect if we can use yasm to compile libav's assembly
2885 if test -n "$MOZ_LIBAV_FFT" -a -n "$COMPILE_ENVIRONMENT"; then
2886 AC_DEFINE(MOZ_LIBAV_FFT)
2887 dnl Do we support libav-fft on this platform?
2888 case "$OS_ARCH:$CPU_ARCH" in
2890 LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DMACHO"
2893 LIBAV_FFT_ASFLAGS="-DPIC -DWIN32"
2896 LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DWIN64 -DMSVC"
2899 if $CC -E -dM -</dev/null | grep -q __ELF__; then
2900 LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DELF"
2904 AC_MSG_ERROR([libav's FFT routines are only available for 32-bit windows or 64-bit x86 based platforms.])
2909 if test -n "$LIBAV_FFT_ASFLAGS"; then
2910 dnl If we're on an x86 or x64 system which supports libav-fft's asm routines
2911 dnl check for Yasm, and error out if it doesn't exist or we have too old of a
2913 if test -z "$YASM" ; then
2914 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.])
2916 dnl Check that we have the right yasm version. We require 1.0.1 or newer
2917 dnl on Linux and 1.1 or newer everywhere else.
2918 if test "$OS_ARCH" = "Linux" ; then
2919 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
2920 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.])
2923 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
2924 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.])
2927 elif test -n "$MOZ_LIBAV_FFT" -a "${CPU_ARCH}" != "arm"; then
2928 dnl Warn if we're not building either libav or opendl-max optimized routines.
2929 AC_MSG_WARN([No assembler or assembly support for libav-fft. Using unoptimized C routines.])
2932 dnl ========================================================
2933 dnl = FFmpeg's ffvpx configuration
2934 dnl ========================================================
2941 dnl Use same conditional as MOZ_LIBAV_FFT to enable FFmpeg's ffvpx assembly decoder.
2942 if test -n "$LIBAV_FFT_ASFLAGS"; then
2943 FFVPX_ASFLAGS=$LIBAV_FFT_ASFLAGS
2945 dnl On x86 system with assembly optimizations disabled, the ffvp9 and
2946 dnl ffvp8 decoders give worse performance than libvpx ones. So we only
2947 dnl enable the FFmpeg FLAC decoder on those machines.
2948 MOZ_FFVPX_FLACONLY=1
2953 MOZ_FFVPX_FLACONLY=1
2954 dnl Use same conditional as MOZ_LIBVPX to enable FFmpeg's ffvpx assembly decoder.
2955 dnl aarch 64 FLAC decoder for now will be C only.
2956 FFVPX_ASFLAGS=$VPX_ASFLAGS
2960 if test -n "$MOZ_FFVPX"; then
2961 AC_DEFINE(MOZ_FFVPX)
2963 if test -n "$MOZ_FFVPX_FLACONLY"; then
2964 AC_DEFINE(MOZ_FFVPX_FLACONLY)
2967 dnl ========================================================
2968 dnl = Enable compilation of specific extension modules
2969 dnl ========================================================
2971 MOZ_ARG_ENABLE_STRING(extensions,
2972 [ --enable-extensions Enable extensions],
2973 [ for option in `echo $enableval | sed 's/,/ /g'`; do
2974 if test "$option" = "yes" -o "$option" = "all"; then
2975 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
2976 elif test "$option" = "no" -o "$option" = "none"; then
2978 elif test "$option" = "default"; then
2979 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
2980 elif test `echo "$option" | grep -c \^-` != 0; then
2981 option=`echo $option | sed 's/^-//'`
2982 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
2984 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
2987 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
2989 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
2990 dnl when trying to build a nonexistent extension.
2991 for extension in $MOZ_EXTENSIONS; do
2992 if test ! -d "${srcdir}/extensions/${extension}"; then
2993 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
2997 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
2998 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
3001 # Avoid defining MOZ_ENABLE_CAIRO_FT on Windows platforms because
3002 # "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
3003 if test -n "$MOZ_TREE_FREETYPE" -a "$OS_TARGET" != WINNT; then
3004 MOZ_ENABLE_CAIRO_FT=1
3005 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
3006 CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
3007 AC_SUBST_LIST(CAIRO_FT_CFLAGS)
3010 AC_CHECK_PROGS(WGET, wget, "")
3013 dnl ========================================================
3014 dnl Maintenance Service
3015 dnl ========================================================
3017 MOZ_ARG_ENABLE_BOOL(maintenance-service,
3018 [ --enable-maintenance-service Enable building of maintenanceservice],
3019 MOZ_MAINTENANCE_SERVICE=1,
3020 MOZ_MAINTENANCE_SERVICE= )
3022 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
3023 if test "$OS_ARCH" = "WINNT"; then
3024 AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
3026 AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
3030 dnl ========================================================
3031 dnl Bundled fonts on desktop platforms
3032 dnl ========================================================
3034 MOZ_ARG_ENABLE_BOOL(bundled-fonts,
3035 [ --enable-bundled-fonts Enable support for bundled fonts on desktop platforms],
3036 MOZ_BUNDLED_FONTS=1,
3039 if test -n "$MOZ_BUNDLED_FONTS"; then
3040 AC_DEFINE(MOZ_BUNDLED_FONTS)
3043 dnl ========================================================
3044 dnl Verify MAR signatures
3045 dnl ========================================================
3047 MOZ_ARG_ENABLE_BOOL(verify-mar,
3048 [ --enable-verify-mar Enable verifying MAR signatures],
3049 MOZ_VERIFY_MAR_SIGNATURE=1,
3050 MOZ_VERIFY_MAR_SIGNATURE= )
3052 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
3053 AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
3056 dnl ========================================================
3057 dnl Enable building the signmar program.
3058 dnl This option is much different than the --enable-verify-mar option.
3059 dnl --enable-verify-mar is for enabling the verification check on MAR
3060 dnl files in the updater. The --enable-signmar option is for building
3061 dnl the signmar program.
3062 dnl ========================================================
3064 MOZ_ARG_ENABLE_BOOL(signmar,
3065 [ --enable-signmar Enable building the signmar program],
3066 MOZ_ENABLE_SIGNMAR=1,
3067 MOZ_ENABLE_SIGNMAR= )
3069 if test -n "$MOZ_ENABLE_SIGNMAR"; then
3070 if test -z "$COMPILE_ENVIRONMENT" ; then
3071 AC_MSG_WARN([Cannot --enable-signmar with --disable-compile-environment])
3074 AC_DEFINE(MOZ_ENABLE_SIGNMAR)
3078 dnl ========================================================
3080 dnl ========================================================
3082 if test "$MOZ_IOS"; then
3086 MOZ_ARG_DISABLE_BOOL(updater,
3087 [ --disable-updater Disable building of updater],
3091 if test -n "$MOZ_UPDATER"; then
3092 AC_DEFINE(MOZ_UPDATER)
3095 dnl ========================================================
3096 dnl parental controls (for Windows Vista)
3097 dnl ========================================================
3098 MOZ_ARG_DISABLE_BOOL(parental-controls,
3099 [ --disable-parental-controls
3100 Do not build parental controls],
3101 MOZ_DISABLE_PARENTAL_CONTROLS=1,
3102 MOZ_DISABLE_PARENTAL_CONTROLS=)
3103 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
3104 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
3107 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
3109 dnl ========================================================
3110 dnl = Disable smartcard support
3111 dnl ========================================================
3112 if test -n "$MOZ_NO_SMART_CARDS"; then
3113 AC_DEFINE(MOZ_NO_SMART_CARDS)
3115 AC_SUBST(MOZ_NO_SMART_CARDS)
3117 dnl ========================================================
3118 dnl = Sandboxing support
3119 dnl ========================================================
3120 if test -n "$MOZ_TSAN" -o -n "$MOZ_ASAN"; then
3121 # Bug 1182565: TSan conflicts with sandboxing on Linux.
3122 # Bug 1287971: LSan also conflicts with sandboxing on Linux.
3130 MOZ_ARG_DISABLE_BOOL(sandbox,
3131 [ --disable-sandbox Disable sandboxing support],
3135 dnl ========================================================
3136 dnl = Content process sandboxing
3137 dnl ========================================================
3139 case "$OS_TARGET" in
3141 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3144 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3149 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3155 MOZ_ARG_ENABLE_BOOL(content-sandbox,
3156 [ --enable-content-sandbox Enable sandboxing support for content-processes
3157 --disable-content-sandbox Disable sandboxing support for content-processes],
3158 MOZ_CONTENT_SANDBOX=1,
3159 MOZ_CONTENT_SANDBOX=)
3161 if test -n "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_SANDBOX"; then
3162 AC_MSG_ERROR([--enable-content-sandbox and --disable-sandbox are conflicting options])
3165 if test -n "$MOZ_CONTENT_SANDBOX"; then
3166 AC_DEFINE(MOZ_CONTENT_SANDBOX)
3169 AC_SUBST(MOZ_CONTENT_SANDBOX)
3171 dnl ========================================================
3172 dnl = Gecko Media Plugin sandboxing
3173 dnl ========================================================
3176 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3181 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3186 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3190 if test -n "$MOZ_GMP_SANDBOX"; then
3191 AC_DEFINE(MOZ_GMP_SANDBOX)
3194 AC_SUBST(MOZ_GMP_SANDBOX)
3196 if test -z "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_GMP_SANDBOX"; then
3200 if test -n "$MOZ_SANDBOX"; then
3201 AC_DEFINE(MOZ_SANDBOX)
3204 AC_SUBST(MOZ_SANDBOX)
3207 dnl ========================================================
3209 dnl = Module specific options
3211 dnl ========================================================
3212 MOZ_ARG_HEADER(Individual module options)
3214 dnl ========================================================
3215 dnl = Disable feed handling components
3216 dnl ========================================================
3217 MOZ_ARG_DISABLE_BOOL(feeds,
3218 [ --disable-feeds Disable feed handling and processing components],
3221 if test -n "$MOZ_FEEDS"; then
3222 AC_DEFINE(MOZ_FEEDS)
3224 if test "$MOZ_BUILD_APP" = "browser"; then
3225 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
3229 dnl ========================================================
3230 dnl Check for sqlite
3231 dnl ========================================================
3234 MOZ_ARG_ENABLE_BOOL(system-sqlite,
3235 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
3236 MOZ_SYSTEM_SQLITE=1,
3237 MOZ_SYSTEM_SQLITE= )
3239 if test -n "$MOZ_SYSTEM_SQLITE"
3241 dnl ============================
3242 dnl === SQLite Version check ===
3243 dnl ============================
3244 dnl Check to see if the system SQLite package is new enough.
3245 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
3247 dnl ==================================
3248 dnl === SQLITE_SECURE_DELETE check ===
3249 dnl ==================================
3250 dnl Check to see if the system SQLite package is compiled with
3251 dnl SQLITE_SECURE_DELETE enabled.
3252 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
3253 _SAVE_CFLAGS="$CFLAGS"
3254 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3256 LIBS="$LIBS $SQLITE_LIBS"
3257 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
3259 #include "sqlite3.h"
3261 int main(int argc, char **argv){
3262 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
3264 ac_cv_sqlite_secure_delete=yes,
3265 ac_cv_sqlite_secure_delete=no,
3266 ac_cv_sqlite_secure_delete=no
3269 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
3270 CFLAGS="$_SAVE_CFLAGS"
3272 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
3273 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
3276 dnl ===============================
3277 dnl === SQLITE_THREADSAFE check ===
3278 dnl ===============================
3279 dnl Check to see if the system SQLite package is compiled with
3280 dnl SQLITE_THREADSAFE enabled.
3281 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
3282 _SAVE_CFLAGS="$CFLAGS"
3283 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3285 LIBS="$LIBS $SQLITE_LIBS"
3286 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
3288 #include "sqlite3.h"
3290 int main(int argc, char **argv){
3291 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
3293 ac_cv_sqlite_threadsafe=yes,
3294 ac_cv_sqlite_threadsafe=no,
3295 ac_cv_sqlite_threadsafe=no
3298 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
3299 CFLAGS="$_SAVE_CFLAGS"
3301 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
3302 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
3305 dnl ================================
3306 dnl === SQLITE_ENABLE_FTS3 check ===
3307 dnl ================================
3308 dnl check to see if the system SQLite package is compiled with
3309 dnl SQLITE_ENABLE_FTS3 enabled.
3310 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
3311 _SAVE_CFLAGS="$CFLAGS"
3312 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3314 LIBS="$LIBS $SQLITE_LIBS"
3315 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
3317 #include "sqlite3.h"
3319 int main(int argc, char **argv){
3320 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
3322 ac_cv_sqlite_enable_fts3=yes,
3323 ac_cv_sqlite_enable_fts3=no,
3324 ac_cv_sqlite_enable_fts3=no
3327 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
3328 CFLAGS="$_SAVE_CFLAGS"
3330 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
3331 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
3334 dnl =========================================
3335 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
3336 dnl =========================================
3337 dnl check to see if the system SQLite package is compiled with
3338 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
3339 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
3340 _SAVE_CFLAGS="$CFLAGS"
3341 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3343 LIBS="$LIBS $SQLITE_LIBS"
3344 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
3346 #include "sqlite3.h"
3348 int main(int argc, char **argv){
3349 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
3351 ac_cv_sqlite_enable_unlock_notify=yes,
3352 ac_cv_sqlite_enable_unlock_notify=no,
3353 ac_cv_sqlite_enable_unlock_notify=no
3356 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
3357 CFLAGS="$_SAVE_CFLAGS"
3359 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
3360 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
3363 dnl =========================================
3364 dnl === SQLITE_ENABLE_DBSTAT_VTAB check ===
3365 dnl =========================================
3366 dnl check to see if the system SQLite package is compiled with
3367 dnl SQLITE_ENABLE_DBSTAT_VTAB.
3368 AC_MSG_CHECKING(for SQLITE_ENABLE_DBSTAT_VTAB support in system SQLite)
3369 _SAVE_CFLAGS="$CFLAGS"
3370 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3372 LIBS="$LIBS $SQLITE_LIBS"
3373 AC_CACHE_VAL(ac_cv_sqlite_dbstat_vtab,[
3375 #include "sqlite3.h"
3377 int main(int argc, char **argv){
3378 return !sqlite3_compileoption_used("SQLITE_ENABLE_DBSTAT_VTAB");
3380 ac_cv_sqlite_dbstat_vtab=yes,
3381 ac_cv_sqlite_dbstat_vtab=no,
3382 ac_cv_sqlite_dbstat_vtab=no
3385 AC_MSG_RESULT($ac_cv_sqlite_dbstat_vtab)
3386 CFLAGS="$_SAVE_CFLAGS"
3388 if test "x$ac_cv_sqlite_dbstat_vtab" = "xno"; then
3389 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_DBSTAT_VTAB.])
3392 dnl ==============================
3393 dnl === SQLite fdatasync check ===
3394 dnl ==============================
3395 dnl Check to see if fdatasync is available
3396 AC_CHECK_FUNC(fdatasync)
3399 if test -n "$MOZ_SYSTEM_SQLITE"; then
3400 AC_DEFINE(MOZ_SYSTEM_SQLITE)
3402 AC_SUBST(MOZ_SYSTEM_SQLITE)
3404 dnl ========================================================
3405 dnl = Disable zipwriter
3406 dnl ========================================================
3407 MOZ_ARG_DISABLE_BOOL(zipwriter,
3408 [ --disable-zipwriter Disable zipwriter component],
3411 AC_SUBST(MOZ_ZIPWRITER)
3413 dnl ========================================================
3415 dnl = Feature options that require extra sources to be pulled
3417 dnl ========================================================
3418 dnl MOZ_ARG_HEADER(Features that require extra sources)
3420 dnl ========================================================
3422 dnl = Runtime debugging and Optimization Options
3424 dnl ========================================================
3425 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
3427 dnl ========================================================
3428 dnl enable mobile optimizations
3429 dnl ========================================================
3430 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
3431 [ --enable-mobile-optimize
3432 Enable mobile optimizations],
3433 MOZ_GFX_OPTIMIZE_MOBILE=1)
3435 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
3437 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
3438 # We ignore paint will resample on mobile for performance.
3439 # We may want to revisit this later.
3440 MOZ_IGNORE_PAINT_WILL_RESAMPLE=1
3442 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
3443 AC_DEFINE(MOZ_IGNORE_PAINT_WILL_RESAMPLE)
3446 dnl ========================================================
3447 dnl = Enable code optimization. ON by default.
3448 dnl ========================================================
3450 # Use value from moz.configure if one is defined. Else use our computed
3452 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
3453 MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
3456 MOZ_SET_FRAMEPTR_FLAGS
3458 if test "$COMPILE_ENVIRONMENT"; then
3459 if test -n "$MOZ_OPTIMIZE"; then
3460 AC_MSG_CHECKING([for valid C compiler optimization flags])
3461 _SAVE_CFLAGS=$CFLAGS
3462 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
3463 AC_TRY_COMPILE([#include <stdio.h>],
3464 [printf("Hello World\n");],
3467 AC_MSG_RESULT([$_results])
3468 if test "$_results" = "no"; then
3469 AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
3471 CFLAGS=$_SAVE_CFLAGS
3472 if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
3473 # When using llvm-based LTO, non numeric optimization levels are
3474 # not supported by the linker, so force the linker to use -O2 (
3475 # which doesn't influence the level compilation units are actually
3477 case " $MOZ_OPTIMIZE_FLAGS " in
3478 *\ -Os\ *|*\ -Oz\ *)
3479 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
3484 fi # COMPILE_ENVIRONMENT
3486 AC_SUBST_LIST(MOZ_FRAMEPTR_FLAGS)
3487 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
3488 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
3489 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
3491 dnl ========================================================
3492 dnl = Disable treating compiler warnings as errors
3493 dnl ========================================================
3494 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
3495 WARNINGS_AS_ERRORS=''
3498 dnl ========================================================
3499 dnl = Enable runtime logging
3500 dnl ========================================================
3501 AC_DEFINE(MOZ_LOGGING)
3502 AC_DEFINE(FORCE_PR_LOG)
3504 dnl ========================================================
3505 dnl = This will enable logging of addref, release, ctor, dtor.
3506 dnl ========================================================
3507 _ENABLE_LOGREFCNT=42
3508 MOZ_ARG_ENABLE_BOOL(logrefcnt,
3509 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
3510 _ENABLE_LOGREFCNT=1,
3511 _ENABLE_LOGREFCNT= )
3512 if test "$_ENABLE_LOGREFCNT" = "1"; then
3513 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
3514 elif test -z "$_ENABLE_LOGREFCNT"; then
3515 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
3518 dnl ========================================================
3519 dnl moz_dump_painting
3520 dnl ========================================================
3521 MOZ_ARG_ENABLE_BOOL(dump-painting,
3522 [ --enable-dump-painting Enable paint debugging.],
3523 MOZ_DUMP_PAINTING=1,
3524 MOZ_DUMP_PAINTING= )
3525 if test -n "$MOZ_DUMP_PAINTING"; then
3526 AC_DEFINE(MOZ_DUMP_PAINTING)
3527 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
3529 if test -n "$MOZ_DEBUG"; then
3530 AC_DEFINE(MOZ_DUMP_PAINTING)
3533 case "${OS_TARGET}" in
3534 Android|WINNT|Darwin)
3535 MOZ_GLUE_IN_PROGRAM=
3538 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
3539 MOZ_GLUE_IN_PROGRAM=1
3540 AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
3544 dnl ========================================================
3545 dnl = Jemalloc build setup
3546 dnl ========================================================
3547 if test -z "$MOZ_MEMORY"; then
3550 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
3551 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.])
3556 dnl The generic feature tests that determine how to compute ncpus are long and
3557 dnl complicated. Therefore, simply define special cpp variables for the
3558 dnl platforms we have special knowledge of.
3561 export MOZ_NO_DEBUG_RTL=1
3565 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
3567 # Allow the application to provide a subconfigure script.
3568 # This should be after 'export MOZ_NO_DEBUG_RTL=1' since
3569 # ldap/c-sdk/configure refers to the enviroment value.
3570 if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
3571 do_output_subdirs() {
3572 if test -n "$_subconfigure_subdirs"; then
3573 AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
3575 _subconfigure_subdir="$1"
3576 _subconfigure_config_args="$ac_configure_args"
3578 tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
3579 m4 "${srcdir}/build/autoconf/subconfigure.m4" \
3580 "${srcdir}/build/autoconf/altoptions.m4" \
3581 "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
3586 AC_SUBST_LIST(MOZ_GLUE_WRAP_LDFLAGS)
3587 export MOZ_GLUE_WRAP_LDFLAGS
3589 dnl ========================================================
3590 dnl = Enable using the clang plugin to build
3591 dnl ========================================================
3593 if test -n "$COMPILE_ENVIRONMENT"; then
3594 MOZ_CONFIG_CLANG_PLUGIN
3595 fi # COMPILE_ENVIRONMENT
3597 dnl ========================================================
3598 dnl = Enable stripping of libs & executables
3599 dnl ========================================================
3600 MOZ_ARG_ENABLE_BOOL(strip,
3601 [ --enable-strip Enable stripping of libs & executables ],
3605 dnl ========================================================
3606 dnl = Enable stripping of libs & executables when packaging
3607 dnl ========================================================
3608 MOZ_ARG_ENABLE_BOOL(install-strip,
3609 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
3613 dnl ========================================================
3614 dnl = frontend JS debug mode
3615 dnl ========================================================
3617 MOZ_ARG_ENABLE_BOOL(debug-js-modules,
3618 [ --enable-debug-js-modules Enable debug mode for frontend JS libraries],
3622 AC_SUBST(DEBUG_JS_MODULES)
3624 dnl ========================================================
3626 dnl = Profiling and Instrumenting
3628 dnl ========================================================
3629 MOZ_ARG_HEADER(Profiling and Instrumenting)
3631 dnl ========================================================
3632 dnl = Enable TaskTracer
3633 dnl ========================================================
3634 MOZ_ARG_ENABLE_BOOL(tasktracer,
3635 [ --enable-tasktracer Set compile flags necessary for using TaskTracer],
3638 if test -n "$MOZ_TASK_TRACER"; then
3639 AC_DEFINE(MOZ_TASK_TRACER)
3640 AC_SUBST(MOZ_TASK_TRACER)
3643 dnl ========================================================
3644 dnl Turn on reflow counting
3645 dnl ========================================================
3646 MOZ_ARG_ENABLE_BOOL(reflow-perf,
3647 [ --enable-reflow-perf Enable reflow performance tracing],
3650 if test -n "$MOZ_REFLOW_PERF"; then
3651 AC_DEFINE(MOZ_REFLOW_PERF)
3654 dnl ========================================================
3655 dnl = Offer a way to disable the startup cache
3656 dnl ========================================================
3658 MOZ_ARG_DISABLE_BOOL(startupcache,
3659 [ --disable-startupcache Disable startup cache ],
3660 MOZ_DISABLE_STARTUPCACHE=1,
3661 MOZ_DISABLE_STARTUPCACHE=)
3663 if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
3664 AC_DEFINE(MOZ_DISABLE_STARTUPCACHE)
3666 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
3668 dnl ========================================================
3669 dnl = Support for demangling undefined symbols
3670 dnl ========================================================
3671 if test -z "$SKIP_LIBRARY_CHECKS"; then
3674 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
3678 # Demangle only for debug or DMD builds
3679 MOZ_DEMANGLE_SYMBOLS=
3680 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
3681 MOZ_DEMANGLE_SYMBOLS=1
3682 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
3684 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
3686 dnl ========================================================
3687 dnl = Support for gcc stack unwinding (from gcc 3.3)
3688 dnl ========================================================
3689 if test -z "$SKIP_LIBRARY_CHECKS"; then
3692 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
3696 dnl ========================================================
3698 dnl ========================================================
3700 MOZ_ARG_WITH_STRING(jitreport-granularity,
3701 [ --jitreport-granularity=N
3702 Default granularity at which to report JIT code
3705 1 - code ranges for whole functions only
3706 2 - per-line information
3707 3 - per-op information],
3708 JITREPORT_GRANULARITY=$withval,
3709 JITREPORT_GRANULARITY=3)
3711 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
3713 dnl ========================================================
3717 dnl ========================================================
3718 MOZ_ARG_HEADER(Misc. Options)
3720 dnl ========================================================
3721 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
3722 dnl ========================================================
3723 MOZ_ARG_WITH_STRING(user-appdir,
3724 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
3725 [ val=`echo $withval`
3726 if echo "$val" | grep "\/" >/dev/null; then
3727 AC_MSG_ERROR("Homedir must be single relative path.")
3732 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
3734 if test -z "$SKIP_COMPILER_CHECKS"; then
3735 dnl ========================================================
3737 dnl = Compiler Options
3739 dnl ========================================================
3740 MOZ_ARG_HEADER(Compiler Options)
3742 dnl ========================================================
3743 dnl Check for gcc -pipe support
3744 dnl ========================================================
3745 AC_MSG_CHECKING([for -pipe support])
3746 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
3747 dnl Any gcc that supports firefox supports -pipe.
3748 CFLAGS="$CFLAGS -pipe"
3749 CXXFLAGS="$CXXFLAGS -pipe"
3750 AC_MSG_RESULT([yes])
3755 fi # ! SKIP_COMPILER_CHECKS
3757 AC_DEFINE(CPP_THROW_NEW, [throw()])
3760 if test "$COMPILE_ENVIRONMENT"; then
3762 fi # COMPILE_ENVIRONMENT
3764 dnl ========================================================
3766 dnl = Build depencency options
3768 dnl ========================================================
3769 MOZ_ARG_HEADER(Build dependencies)
3771 if test "$COMPILE_ENVIRONMENT"; then
3772 if test "$GNU_CC" -a "$GNU_CXX"; then
3773 _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
3775 # clang-cl doesn't accept the normal -MD -MP -MF options that clang does, but
3776 # the underlying cc1 binary understands how to generate dependency files.
3777 # These options are based on analyzing what the normal clang driver sends to
3778 # cc1 when given the "correct" dependency options.
3779 if test -n "$CLANG_CL"; then
3780 _DEPEND_CFLAGS='-Xclang -MP -Xclang -dependency-file -Xclang $(MDDEPDIR)/$(@F).pp -Xclang -MT -Xclang $@'
3782 dnl Don't override this for MSVC
3783 if test -z "$_WIN32_MSVC"; then
3784 _USE_CPP_INCLUDE_FLAG=
3785 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
3786 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
3788 echo '#include <stdio.h>' > dummy-hello.c
3790 dnl This output is localized, split at the first double space or colon and space.
3791 _CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*\\\stdio.h\)$"
3792 CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'`
3793 _CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'`
3795 if ! test -e "$_CL_STDIO_PATH"; then
3796 AC_MSG_ERROR([Unable to parse cl -showIncludes prefix. This compiler's locale has an unsupported formatting.])
3798 if test -z "$CL_INCLUDES_PREFIX"; then
3799 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
3801 AC_SUBST(CL_INCLUDES_PREFIX)
3804 dnl Make sure that the build system can handle non-ASCII characters
3805 dnl in environment variables to prevent it from breaking silently on
3806 dnl non-English systems.
3807 NONASCII=$'\241\241'
3811 fi # COMPILE_ENVIRONMENT
3813 dnl ========================================================
3815 dnl = Static Build Options
3817 dnl ========================================================
3818 MOZ_ARG_HEADER(Static build options)
3820 if test -z "$MOZ_SYSTEM_ZLIB"; then
3821 if test -n "$JS_SHARED_LIBRARY" -o -n "$MOZ_LINKER"; then
3823 AC_DEFINE(ZLIB_IN_MOZGLUE)
3827 AC_SUBST(ZLIB_IN_MOZGLUE)
3829 dnl ========================================================
3831 dnl = Standalone module options
3833 dnl ========================================================
3834 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
3837 dnl ========================================================
3839 if test -z "$SKIP_PATH_CHECKS"; then
3840 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
3841 if test "$MOZ_ENABLE_GTK" ; then
3842 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
3847 if test -z "${GLIB_GMODULE_LIBS}" \
3848 -a -n "${GLIB_CONFIG}"\
3849 -a "${GLIB_CONFIG}" != no\
3851 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
3854 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
3856 if test "$USE_FC_FREETYPE"; then
3857 if test "$COMPILE_ENVIRONMENT"; then
3858 dnl ========================================================
3859 dnl = Check for freetype2 functionality
3860 dnl ========================================================
3861 if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
3863 _SAVE_CFLAGS="$CFLAGS"
3864 LIBS="$LIBS $FT2_LIBS"
3865 CFLAGS="$CFLAGS $FT2_CFLAGS"
3867 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
3868 ac_cv_member_FT_Bitmap_Size_y_ppem,
3869 [AC_TRY_COMPILE([#include <ft2build.h>
3870 #include FT_FREETYPE_H],
3872 if (sizeof s.y_ppem) return 0;
3874 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
3875 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
3876 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
3877 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
3879 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
3881 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
3882 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
3883 [FT_Bitmap_Size structure includes y_ppem field])
3885 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
3888 CFLAGS="$_SAVE_CFLAGS"
3891 _SAVE_CPPFLAGS="$CPPFLAGS"
3892 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
3893 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
3894 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
3895 CPPFLAGS="$_SAVE_CPPFLAGS"
3899 dnl ========================================================
3900 dnl Check if we need the 32-bit Linux SSE2 error dialog
3901 dnl ========================================================
3903 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
3905 dnl ========================================================
3906 dnl Check for pixman and cairo
3907 dnl ========================================================
3910 MOZ_ARG_ENABLE_BOOL(system-cairo,
3911 [ --enable-system-cairo Obsolete: do not use this option],
3912 AC_MSG_ERROR(--enable-system-cairo is not supported),
3916 MOZ_ARG_ENABLE_BOOL(system-pixman,
3917 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
3919 MOZ_TREE_PIXMAN=force,
3922 if test "$MOZ_TREE_PIXMAN"; then
3923 AC_DEFINE(MOZ_TREE_PIXMAN)
3925 PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.19.2)
3928 MOZ_CAIRO_CFLAGS="-I${DIST}/include/cairo"
3929 AC_DEFINE(MOZ_TREE_CAIRO)
3931 if test "$OS_ARCH" = "WINNT"; then
3932 # For now we assume that we will have a uint64_t available through
3933 # one of the above headers or mozstdint.h.
3934 AC_DEFINE(HAVE_UINT64_T)
3937 # Define macros for cairo-features.h
3938 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
3939 if test "$MOZ_X11"; then
3940 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
3941 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
3942 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
3944 if test "$_HAVE_FREETYPE2"; then
3945 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
3946 MOZ_ENABLE_CAIRO_FT=1
3947 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
3950 case "$MOZ_WIDGET_TOOLKIT" in
3952 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
3953 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
3954 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
3957 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
3958 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
3959 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
3960 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
3961 MOZ_ENABLE_D2D_SURFACE=1
3963 if test "$COMPILE_ENVIRONMENT"; then
3965 dnl D3D10 Layers depend on D2D Surfaces.
3966 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
3967 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
3972 if test "$USE_FC_FREETYPE"; then
3973 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
3975 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
3976 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
3977 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
3979 AC_SUBST(PS_SURFACE_FEATURE)
3980 AC_SUBST(SVG_SURFACE_FEATURE)
3981 AC_SUBST(XLIB_SURFACE_FEATURE)
3982 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
3983 AC_SUBST(QUARTZ_SURFACE_FEATURE)
3984 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
3985 AC_SUBST(WIN32_SURFACE_FEATURE)
3986 AC_SUBST(OS2_SURFACE_FEATURE)
3987 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
3988 AC_SUBST(FT_FONT_FEATURE)
3989 AC_SUBST(FC_FONT_FEATURE)
3990 AC_SUBST(WIN32_FONT_FEATURE)
3991 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
3992 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
3993 AC_SUBST(QUARTZ_FONT_FEATURE)
3994 AC_SUBST(PNG_FUNCTIONS_FEATURE)
3995 AC_SUBST(QT_SURFACE_FEATURE)
3996 AC_SUBST(TEE_SURFACE_FEATURE)
3998 if test "$MOZ_X11"; then
3999 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
4002 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
4004 case "$MOZ_WIDGET_TOOLKIT" in
4006 TK_CFLAGS="$MOZ_CAIRO_CFLAGS $MOZ_PIXMAN_CFLAGS"
4007 TK_LIBS="$MOZ_CAIRO_LIBS $MOZ_PIXMAN_LIBS"
4011 AC_SUBST(MOZ_TREE_CAIRO)
4012 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
4013 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
4014 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
4015 AC_SUBST(MOZ_TREE_PIXMAN)
4017 BINDGEN_SYSTEM_FLAGS="$_BINDGEN_CFLAGS $NSPR_CFLAGS $NSS_CFLAGS $MOZ_PIXMAN_CFLAGS $MOZ_CAIRO_CFLAGS"
4018 AC_SUBST_TOML_LIST(BINDGEN_SYSTEM_FLAGS)
4020 dnl ========================================================
4022 dnl ========================================================
4023 MOZ_ARG_DISABLE_BOOL(xul,
4024 [ --disable-xul Disable XUL],
4026 if test "$MOZ_XUL"; then
4029 dnl remove extensions that require XUL
4030 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
4035 dnl ========================================================
4036 dnl necko configuration options
4037 dnl ========================================================
4040 dnl option to disable necko's wifi scanner
4043 if test "$MOZ_WIDGET_TOOLKIT"; then
4045 case "$OS_TARGET" in
4047 if test -z "$MOZ_IOS"; then
4051 DragonFly|FreeBSD|WINNT)
4062 MOZ_ARG_DISABLE_BOOL(necko-wifi,
4063 [ --disable-necko-wifi Disable necko wifi scanner],
4067 if test "$NECKO_WIFI"; then
4068 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
4069 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
4071 AC_DEFINE(NECKO_WIFI)
4072 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
4074 AC_SUBST(NECKO_WIFI)
4075 AC_SUBST(NECKO_WIFI_DBUS)
4078 dnl option to disable cookies
4080 MOZ_ARG_DISABLE_BOOL(cookies,
4081 [ --disable-cookies Disable cookie support],
4084 AC_SUBST(NECKO_COOKIES)
4085 if test "$NECKO_COOKIES"; then
4086 AC_DEFINE(NECKO_COOKIES)
4087 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
4090 dnl ========================================================
4092 dnl = Maintainer debug option (no --enable equivalent)
4094 dnl ========================================================
4098 AC_SUBST(AR_EXTRACT)
4101 AC_SUBST_LIST(ASFLAGS)
4102 AC_SUBST(AS_DASH_C_FLAG)
4108 AC_SUBST(MOZ_AUTH_EXTENSION)
4109 AC_SUBST(MOZ_PREF_EXTENSIONS)
4110 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
4111 AC_SUBST(WARNINGS_AS_ERRORS)
4112 AC_SUBST_SET(MOZ_EXTENSIONS)
4113 AC_SUBST(MOZ_TOOLKIT_SEARCH)
4116 AC_SUBST(MOZ_UNIVERSALCHARDET)
4117 AC_SUBST(ACCESSIBILITY)
4118 AC_SUBST(MOZ_SPELLCHECK)
4119 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
4120 AC_SUBST(MOZ_CRASHREPORTER)
4121 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
4122 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
4123 AC_SUBST(MOZ_STUB_INSTALLER)
4124 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
4125 AC_SUBST(MOZ_ENABLE_SIGNMAR)
4126 AC_SUBST(MOZ_UPDATER)
4128 AC_SUBST(MOZ_ANGLE_RENDERER)
4129 AC_SUBST(MOZ_D3D_CPU_SUFFIX)
4130 AC_SUBST(MOZ_HAS_WINSDK_WITH_D3D)
4131 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL)
4132 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL_PATH)
4134 AC_SUBST(MOZ_ANDROID_APPLICATION_CLASS)
4135 AC_SUBST(MOZ_ANDROID_BROWSER_INTENT_CLASS)
4136 AC_SUBST(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
4137 AC_SUBST(ENABLE_STRIP)
4138 AC_SUBST(PKG_SKIP_STRIP)
4139 AC_SUBST(STRIP_FLAGS)
4140 AC_SUBST(INCREMENTAL_LINKER)
4142 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
4144 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
4145 AC_SUBST(MOZ_LINKER_EXTRACT)
4147 if test -n "$MOZ_BINARY_EXTENSIONS"; then
4148 AC_DEFINE(MOZ_BINARY_EXTENSIONS)
4151 AC_SUBST(MOZ_REQUIRE_SIGNING)
4152 if test "$MOZ_REQUIRE_SIGNING" = 1; then
4153 AC_DEFINE(MOZ_REQUIRE_SIGNING)
4156 dnl ========================================================
4157 dnl = Mac bundle name prefix
4158 dnl ========================================================
4159 MOZ_ARG_WITH_STRING(macbundlename-prefix,
4160 [ --with-macbundlename-prefix=prefix
4161 Prefix for MOZ_MACBUNDLE_NAME],
4162 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
4164 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
4165 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
4166 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
4169 if test "$MOZ_DEBUG"; then
4170 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
4172 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
4174 AC_SUBST(MOZ_MACBUNDLE_NAME)
4176 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
4177 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
4178 # Otherwise, use MOZ_APP_DISPLAYNAME
4179 if test -z "$MOZ_MACBUNDLE_ID"; then
4180 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
4182 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
4183 if test "$MOZ_DEBUG"; then
4184 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
4187 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
4188 AC_SUBST(MOZ_MACBUNDLE_ID)
4190 dnl ========================================================
4191 dnl = Child Process Name for IPC
4192 dnl ========================================================
4193 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
4194 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
4196 # We want to let Android unpack the file at install time, but it only does
4197 # so if the file is named libsomething.so. The lib/ path is also required
4198 # because the unpacked file will be under the lib/ subdirectory and will
4199 # need to be executed from that path.
4200 MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
4202 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
4203 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
4205 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
4206 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
4207 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
4209 # The following variables are available to branding and application
4210 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
4211 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
4212 # impacts profile location and user-visible fields.
4213 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
4214 # versions of a given application (e.g. Aurora and Firefox both use
4215 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
4216 # for application.ini's "Name" field, which controls profile location in
4217 # the absence of a "Profile" field (see below), and various system
4218 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
4219 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
4220 # Mac Bundle name, Updater, Installer), it is typically used for nightly
4221 # builds (e.g. Aurora for Firefox).
4222 # - MOZ_APP_VERSION: Defines the application version number.
4223 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
4224 # in the "About" window. If not set, defaults to MOZ_APP_VERSION.
4225 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
4226 # defaults to a lowercase form of MOZ_APP_BASENAME.
4227 # - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
4228 # profile name and remoting. If not set, defaults to MOZ_APP_NAME.
4229 # - MOZ_APP_PROFILE: When set, used for application.ini's
4230 # "Profile" field, which controls profile location.
4231 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
4232 # crash reporter server url.
4233 # - MOZ_APP_ANDROID_VERSION_CODE: On Android, "android:versionCode" for
4234 # the main application is set to the value of this variable. If not
4235 # set, it falls back to a Mozilla-specific value derived from the
4237 # - MOZ_ANDROID_SHARED_ID: On Android, "android:sharedUserId" for all Android
4238 # packages produced.
4239 # - MOZ_ANDROID_GCM_SENDERID: On Android, the Android GCM Sender ID used. GCM
4240 # sender IDs are not sensitive: see, http://stackoverflow.com/a/18216063.
4241 # - MOZ_MMA_GCM_SENDERID: This GCM Sender ID is used for MMA integration.
4242 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
4244 if test -z "$MOZ_APP_NAME"; then
4245 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
4248 if test -z "$MOZ_APP_REMOTINGNAME"; then
4249 MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
4252 if test -z "$MOZ_APP_VERSION_DISPLAY"; then
4253 MOZ_APP_VERSION_DISPLAY=$MOZ_APP_VERSION
4256 if test -z "$ANDROID_PACKAGE_NAME" ; then
4257 # When we got rid of the Aurora channel we decided to replace the old
4258 # Nightly ANDROID_PACKAGE_NAME with Aurora. To make sure this is inherited
4259 # by all mozilla-central based branches we make this the new "default"
4260 # for Fennec. Non mozilla-central based branches set ANDROID_PACKAGE_NAME
4261 # in their mozconfig, so they will never get this. If there are ever
4262 # non-Fennec builds for Android, they will fall into the else block
4263 # and use their own default name.
4264 # https://bugzilla.mozilla.org/show_bug.cgi?id=1357808 has additional
4265 # background on this.
4266 if test "$MOZ_APP_NAME" = "fennec"; then
4267 ANDROID_PACKAGE_NAME="org.mozilla.fennec_aurora"
4269 ANDROID_PACKAGE_NAME="org.mozilla.$MOZ_APP_NAME"
4273 # Mozilla released Firefox for Android {Release,Beta} and {Aurora,Nightly} to
4274 # the public with specific common shared IDs and we need to keep them
4275 # consistent forever. The specific common values are set by per-channel
4276 # branding; all other channels use a generic sharedID, set below.
4277 if test -z "$MOZ_ANDROID_SHARED_ID" ; then
4278 MOZ_ANDROID_SHARED_ID="${ANDROID_PACKAGE_NAME}.sharedID"
4281 # For extensions and langpacks, we require a max version that is compatible
4282 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
4283 # 24.0a1 and 24.0a2 aren't affected
4285 # 24.1.1 becomes 24.*
4286 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
4287 if test -z "$IS_ALPHA"; then
4289 if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
4290 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
4292 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
4296 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
4299 AC_SUBST(MOZ_APP_NAME)
4300 AC_SUBST(MOZ_APP_REMOTINGNAME)
4301 AC_SUBST(MOZ_APP_DISPLAYNAME)
4302 AC_SUBST(MOZ_APP_BASENAME)
4303 AC_SUBST(MOZ_APP_VENDOR)
4304 AC_SUBST(MOZ_APP_PROFILE)
4305 AC_SUBST(MOZ_APP_ID)
4306 AC_SUBST(MOZ_APP_ANDROID_VERSION_CODE)
4307 AC_SUBST(MOZ_ANDROID_SHARED_ID)
4308 AC_SUBST(MOZ_ANDROID_GCM_SENDERID)
4309 AC_SUBST(MOZ_MMA_GCM_SENDERID)
4310 AC_SUBST(MAR_CHANNEL_ID)
4311 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
4312 AC_SUBST(MOZ_PROFILE_MIGRATOR)
4313 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
4314 AC_SUBST(MOZ_APP_UA_NAME)
4315 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
4316 AC_SUBST(MOZ_APP_VERSION)
4317 AC_SUBST(MOZ_APP_VERSION_DISPLAY)
4318 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
4319 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
4321 AC_SUBST(MOZ_APP_MAXVERSION)
4322 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
4323 AC_SUBST(FIREFOX_VERSION)
4324 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
4325 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
4326 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
4329 AC_SUBST(MOZ_PKG_SPECIAL)
4330 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
4332 if test "$MOZILLA_OFFICIAL"; then
4333 # Build revisions should always be present in official builds
4334 MOZ_INCLUDE_SOURCE_INFO=1
4337 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
4338 # explicitly set the repository and changeset information in.
4339 AC_SUBST(MOZ_SOURCE_REPO)
4340 AC_SUBST(MOZ_SOURCE_CHANGESET)
4341 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
4343 if test "$MOZ_TELEMETRY_REPORTING"; then
4344 AC_DEFINE(MOZ_TELEMETRY_REPORTING)
4346 # Enable Telemetry by default for nightly and aurora channels
4347 if test -z "$RELEASE_OR_BETA"; then
4348 AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
4352 dnl If we have any service that uploads data (and requires data submission
4353 dnl policy alert), set MOZ_DATA_REPORTING.
4354 dnl We need SUBST for build system and DEFINE for xul preprocessor.
4355 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
4356 MOZ_DATA_REPORTING=1
4357 AC_DEFINE(MOZ_DATA_REPORTING)
4358 AC_SUBST(MOZ_DATA_REPORTING)
4362 AC_SUBST(WIN32_REDIST_DIR)
4363 AC_SUBST(WIN_UCRT_REDIST_DIR)
4364 AC_SUBST(WIN_DIA_SDK_BIN_DIR)
4366 dnl ========================================================
4368 dnl ========================================================
4372 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
4378 dnl Echo the CFLAGS to remove extra whitespace.
4381 $_COMPILATION_CFLAGS \
4385 $_WARNINGS_CXXFLAGS \
4386 $_COMPILATION_CXXFLAGS \
4389 COMPILE_CFLAGS=`echo \
4393 COMPILE_CXXFLAGS=`echo \
4394 $_DEFINES_CXXFLAGS \
4398 $_WARNINGS_HOST_CFLAGS \
4399 $_COMPILATION_HOST_CFLAGS \
4402 HOST_CXXFLAGS=`echo \
4403 $_WARNINGS_HOST_CXXFLAGS \
4404 $_COMPILATION_HOST_CXXFLAGS \
4407 AC_SUBST(_DEPEND_CFLAGS)
4408 AC_SUBST(MOZ_SYSTEM_JPEG)
4409 AC_SUBST(MOZ_SYSTEM_PNG)
4411 AC_SUBST_LIST(MOZ_JPEG_CFLAGS)
4412 AC_SUBST_LIST(MOZ_JPEG_LIBS)
4413 AC_SUBST_LIST(MOZ_PNG_CFLAGS)
4414 AC_SUBST_LIST(MOZ_PNG_LIBS)
4416 AC_SUBST(MOZ_SYSTEM_NSPR)
4418 AC_SUBST(MOZ_SYSTEM_NSS)
4420 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
4421 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
4422 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
4423 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
4424 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
4425 OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
4426 OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
4428 AC_SUBST(HOST_CMFLAGS)
4429 AC_SUBST(HOST_CMMFLAGS)
4430 AC_SUBST(OS_COMPILE_CMFLAGS)
4431 AC_SUBST(OS_COMPILE_CMMFLAGS)
4434 OS_CXXFLAGS="$CXXFLAGS"
4435 OS_CPPFLAGS="$CPPFLAGS"
4436 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
4437 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
4438 OS_LDFLAGS="$LDFLAGS"
4440 AC_SUBST_LIST(OS_CFLAGS)
4441 AC_SUBST_LIST(OS_CXXFLAGS)
4442 AC_SUBST_LIST(OS_CPPFLAGS)
4443 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
4444 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
4445 AC_SUBST_LIST(OS_LDFLAGS)
4450 AC_SUBST_LIST(HOST_CFLAGS)
4451 AC_SUBST_LIST(HOST_CPPFLAGS)
4452 AC_SUBST_LIST(HOST_CXXFLAGS)
4453 AC_SUBST(HOST_LDFLAGS)
4454 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
4456 AC_SUBST(HOST_AR_FLAGS)
4457 AC_SUBST(HOST_RANLIB)
4458 AC_SUBST(HOST_BIN_SUFFIX)
4460 AC_SUBST(TARGET_XPCOM_ABI)
4461 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
4462 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
4463 AC_SUBST(HAVE_X86_AVX2)
4464 AC_SUBST(HAVE_ALTIVEC)
4465 AC_SUBST(GCC_USE_GNU_LD)
4469 AC_SUBST_LIST(DSO_CFLAGS)
4470 AC_SUBST_LIST(DSO_PIC_CFLAGS)
4471 AC_SUBST(DSO_LDOPTS)
4472 AC_SUBST(BIN_SUFFIX)
4474 AC_SUBST(CC_VERSION)
4475 AC_SUBST(NS_ENABLE_TSF)
4476 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
4477 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
4480 AC_SUBST(MOZ_FFVPX_FLACONLY)
4481 AC_SUBST_LIST(FFVPX_ASFLAGS)
4482 AC_SUBST(VPX_USE_YASM)
4483 AC_SUBST_LIST(VPX_ASFLAGS)
4484 AC_SUBST(VPX_AS_CONVERSION)
4485 AC_SUBST(VPX_X86_ASM)
4486 AC_SUBST(VPX_ARM_ASM)
4487 AC_SUBST(LIBJPEG_TURBO_USE_YASM)
4488 AC_SUBST_LIST(LIBJPEG_TURBO_ASFLAGS)
4489 AC_SUBST(MOZ_LIBAV_FFT)
4490 AC_SUBST_LIST(LIBAV_FFT_ASFLAGS)
4491 AC_SUBST(MOZ_DEVTOOLS)
4493 AC_SUBST(MOZ_PACKAGE_JSSHELL)
4494 AC_SUBST(MOZ_FOLD_LIBS)
4495 AC_SUBST_LIST(MOZ_FOLD_LIBS_FLAGS)
4499 dnl Host JavaScript runtime, if any, to use during cross compiles.
4502 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
4504 if test -n "$COMPILE_ENVIRONMENT"; then
4505 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
4507 dnl Check for missing components
4508 if test "$MOZ_X11"; then
4509 dnl ====================================================
4510 dnl = Check if X headers exist
4511 dnl ====================================================
4512 _SAVE_CFLAGS=$CFLAGS
4513 CFLAGS="$CFLAGS $XCFLAGS"
4517 #include <X11/Xlib.h>
4518 #include <X11/Intrinsic.h>
4519 #include <X11/extensions/XShm.h>
4523 if ((dpy = XOpenDisplay(NULL)) == NULL) {
4524 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
4528 [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
4529 CFLAGS="$_SAVE_CFLAGS"
4531 if test -n "$MISSING_X"; then
4532 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
4537 fi # COMPILE_ENVIRONMENT
4539 dnl Set various defines and substitutions
4540 dnl ========================================================
4542 if test "$MOZ_DEBUG"; then
4543 AC_DEFINE(MOZ_REFLOW_PERF)
4544 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
4547 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
4548 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
4549 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
4550 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
4551 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
4552 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
4553 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
4554 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
4555 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
4558 AC_SUBST(MOZ_DEV_EDITION)
4559 if test -n "$MOZ_DEV_EDITION"; then
4560 AC_DEFINE(MOZ_DEV_EDITION)
4563 if test "$MOZ_DEBUG" -o "$DEVELOPER_OPTIONS"; then
4567 if test -n "$A11Y_LOG"; then
4571 dnl Spit out some output
4572 dnl ========================================================
4574 dnl The following defines are used by xpcom
4575 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
4577 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
4589 # Avoid using obsolete NSPR features
4590 AC_DEFINE(NO_NSPR_10_SUPPORT)
4592 # Don't build NSS libpkix
4593 NSS_DISABLE_LIBPKIX=1
4594 AC_SUBST(NSS_DISABLE_LIBPKIX)
4596 MOZ_CREATE_CONFIG_STATUS()
4598 if test -z "$direct_nspr_config"; then
4599 dnl ========================================================
4600 dnl = Setup a nice relatively clean build environment for
4601 dnl = sub-configures.
4602 dnl ========================================================
4605 CFLAGS="$_SUBDIR_CFLAGS"
4606 CPPFLAGS="$_SUBDIR_CPPFLAGS"
4607 CXXFLAGS="$_SUBDIR_CXXFLAGS"
4608 LDFLAGS="$_SUBDIR_LDFLAGS"
4609 HOST_CC="$_SUBDIR_HOST_CC"
4610 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
4611 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
4612 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
4619 # Run all configure scripts specified by a subconfigure
4620 if test -n "$_subconfigure_subdir"; then
4621 _save_srcdir="$srcdir"
4623 _save_ac_configure_args="$ac_configure_args"
4624 ac_configure_args="$_subconfigure_config_args"
4625 AC_OUTPUT_SUBDIRS_NOW("$_subconfigure_subdir",$cache_file)
4626 ac_configure_args="$_save_ac_configure_args"
4627 srcdir="$_save_srcdir"
4630 if test "$COMPILE_ENVIRONMENT" -a "$MOZ_WIDGET_TOOLKIT"; then
4633 dnl ========================================================
4634 dnl = Setup a nice relatively clean build environment for
4635 dnl = sub-configures.
4636 dnl ========================================================
4639 CFLAGS="$_SUBDIR_CFLAGS"
4640 CPPFLAGS="$_SUBDIR_CPPFLAGS"
4641 CXXFLAGS="$_SUBDIR_CXXFLAGS"
4642 LDFLAGS="$_SUBDIR_LDFLAGS"
4643 HOST_CC="$_SUBDIR_HOST_CC"
4644 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
4645 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
4646 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
4649 # Run the SpiderMonkey 'configure' script.
4650 dist=$MOZ_BUILD_ROOT/dist
4651 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
4653 # --with-system-nspr will have been converted into the relevant $NSPR_CFLAGS
4655 ac_configure_args="`echo $ac_configure_args | sed -e 's/--with-system-nspr\S* *//'`"
4657 if test "$_INTL_API" = no; then
4658 ac_configure_args="$ac_configure_args --without-intl-api"
4661 if test -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
4662 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
4663 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
4665 ac_configure_args="$ac_configure_args --prefix=$dist"
4666 if test -n "$ZLIB_IN_MOZGLUE"; then
4669 export MOZ_SYSTEM_ZLIB
4670 export MOZ_ZLIB_CFLAGS
4671 export MOZ_ZLIB_LIBS
4673 export MOZ_APP_REMOTINGNAME
4674 export MOZ_DEV_EDITION
4677 export MOZILLA_CENTRAL_PATH=$_topsrcdir
4678 export STLPORT_CPPFLAGS
4683 export ZLIB_IN_MOZGLUE
4697 export HOST_CPPFLAGS
4698 export HOST_CXXFLAGS
4701 if ! test -e js; then
4705 ac_configure_args="$ac_configure_args JS_STANDALONE="
4706 AC_OUTPUT_SUBDIRS(js/src,$cache_file)
4707 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
4709 fi # COMPILE_ENVIRONMENT
4711 dnl we need to run config.status after js/src subconfigure because we're
4712 dnl traversing its moz.build and we need its config.status for that.
4713 dnl However, writing our own config.status needs to happen before
4714 dnl subconfigures because the setup surrounding subconfigures alters
4715 dnl many AC_SUBSTed variables.
4716 MOZ_RUN_ALL_SUBCONFIGURES()
4718 rm -fr confdefs* $ac_clean_files