1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
2 dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
3 dnl This Source Code Form is subject to the terms of the Mozilla Public
4 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
5 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 dnl Process this file with autoconf to produce a configure script.
8 dnl ========================================================
10 AC_INIT(config/config.mk)
11 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
14 dnl ========================================================
16 dnl = Don't change the following two lines. Doing so breaks:
18 dnl = CFLAGS="-foo" ./configure
20 dnl ========================================================
22 CPPFLAGS="${CPPFLAGS=}"
23 CXXFLAGS="${CXXFLAGS=}"
25 HOST_CFLAGS="${HOST_CFLAGS=}"
26 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
27 HOST_LDFLAGS="${HOST_LDFLAGS=}"
29 dnl ========================================================
30 dnl = Preserve certain environment flags passed to configure
31 dnl = We want sub projects to receive the same flags
32 dnl = untainted by this configure script
33 dnl ========================================================
36 _SUBDIR_CFLAGS="$CFLAGS"
37 _SUBDIR_CPPFLAGS="$CPPFLAGS"
38 _SUBDIR_CXXFLAGS="$CXXFLAGS"
39 _SUBDIR_LDFLAGS="$LDFLAGS"
40 _SUBDIR_HOST_CC="$HOST_CC"
41 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
42 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
43 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
44 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
46 dnl Set the version number of the libs included with mozilla
47 dnl ========================================================
54 dnl Set the minimum version of toolkit libs used by mozilla
55 dnl ========================================================
57 # 2_26 is the earliest version we can set GLIB_VERSION_MIN_REQUIRED.
58 # The macro won't be used when compiling with earlier versions anyway.
59 GLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_26
63 GDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_4
64 WINDRES_VERSION=2.14.90
67 STARTUP_NOTIFICATION_VERSION=0.8
71 dnl Set various checks
72 dnl ========================================================
75 dnl Initialize the Pthread test variables early so they can be
76 dnl overridden by each platform.
77 dnl ========================================================
83 if test "$COMPILE_ENVIRONMENT"; then
85 fi # COMPILE_ENVIRONMENT
88 *-android*|*-linuxandroid*)
92 AC_PATH_PROG(OBJCOPY,objcopy)
102 AC_SUBST(ANDROID_SOURCE)
103 AC_SUBST(ANDROID_PACKAGE_NAME)
106 dnl ========================================================
107 dnl Checks for compilers.
108 dnl ========================================================
110 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
113 if test "$COMPILE_ENVIRONMENT"; then
115 if test "$target" != "$host"; then
121 # Work around the conftest.exe access problem on Windows
126 MOZ_PATH_PROGS(AS, $AS as, $CC)
127 AC_CHECK_PROGS(AR, ar, :)
128 AC_CHECK_PROGS(STRIP, strip, :)
129 AC_CHECK_PROGS(WINDRES, windres, :)
130 AC_CHECK_PROGS(OTOOL, otool, :)
131 if test -z "$HOST_RANLIB"; then
132 HOST_RANLIB="$RANLIB"
134 if test -z "$HOST_AR"; then
137 if test -z "$HOST_AR_FLAGS"; then
138 HOST_AR_FLAGS="$AR_FLAGS"
142 if test -n "$MOZ_WINCONSOLE"; then
143 AC_DEFINE(MOZ_WINCONSOLE)
148 dnl ========================================================
149 dnl Special win32 checks
150 dnl ========================================================
156 if test "$GCC" != "yes"; then
157 # Check to see if we are really running in a msvc environemnt
159 AC_CHECK_PROGS(MIDL, midl)
161 # Make sure compilers are valid
162 CFLAGS="$CFLAGS -TC -nologo"
163 CXXFLAGS="$CXXFLAGS -TP -nologo"
166 AC_TRY_COMPILE([#include <stdio.h>],
167 [ printf("Hello World\n"); ],,
168 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
171 AC_TRY_COMPILE([#include <new.h>],
172 [ unsigned *test = new unsigned(42); ],,
173 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
177 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
180 _MSC_VER=`echo ${CC_VERSION} | cut -c 1-2,4-5`
182 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
183 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
184 AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
186 case "$CC_VERSION" in
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 # C5026: move constructor was implicitly defined as deleted
198 CXXFLAGS="$CXXFLAGS -wd5026"
200 # C5027: move assignment operator was implicitly defined as deleted
201 CXXFLAGS="$CXXFLAGS -wd5027"
203 # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
204 CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
206 # https://connect.microsoft.com/VisualStudio/feedback/details/888527/warnings-on-dbghelp-h
207 # for dbghelp.h, imagehlp.h, and shobj.h
208 # C4091: 'typedef ': ignored on left of '' when no variable is declared
209 CFLAGS="$CFLAGS -wd4091"
210 CXXFLAGS="$CXXFLAGS -wd4091"
212 # This is intended as a temporary hack to support building with VS2015.
213 # 'noexcept' used with no exception handling mode specified;
214 # termination on exception is not guaranteed. Specify /EHsc
215 CXXFLAGS="$CXXFLAGS -wd4577"
217 if test -n "$WIN_UCRT_REDIST_DIR"; then
218 if test ! -d "$WIN_UCRT_REDIST_DIR"; then
219 AC_MSG_ERROR([Invalid Windows UCRT Redist directory: ${WIN_UCRT_REDIST_DIR}])
221 WIN_UCRT_REDIST_DIR=`cd "$WIN_UCRT_REDIST_DIR" && pwd -W`
225 AC_SUBST(MSVC_HAS_DIA_SDK)
226 AC_SUBST(MSVC_C_RUNTIME_DLL)
227 AC_SUBST(MSVC_CXX_RUNTIME_DLL)
229 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
231 if test -n "$WIN32_REDIST_DIR"; then
232 if test ! -d "$WIN32_REDIST_DIR"; then
233 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
235 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd -W`
238 # Check linker version
239 _LD_FULL_VERSION=`"${LINK}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
240 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
241 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
242 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
247 # Set midl environment
250 MIDL_FLAGS="${MIDL_FLAGS} -env win32"
253 MIDL_FLAGS="${MIDL_FLAGS} -env x64"
257 unset _MSVC_VER_FILTER
259 AC_CACHE_CHECK(for overridable _RAISE,
264 _SAVE_CXXFLAGS="$CXXFLAGS"
265 CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
266 AC_TRY_COMPILE([#include <xstddef>
268 #define _RAISE(x) externallyDefinedFunction((x).what())
271 [std::vector<int> v; return v.at(1);],
272 ac_cv_have__RAISE="no",
273 ac_cv_have__RAISE="yes")
274 CXXFLAGS="$_SAVE_CXXFLAGS"
277 if test "$ac_cv_have__RAISE" = "yes"; then
279 MOZ_MSVC_STL_WRAP_RAISE=1
280 AC_DEFINE(MOZ_MSVC_STL_WRAP_RAISE)
282 AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.])
285 if test "$WRAP_STL_INCLUDES" = "1"; then
286 STL_FLAGS="-I${DIST}/stl_wrappers"
288 CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
289 CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
291 # Check w32api version
292 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
293 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
294 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
295 AC_TRY_COMPILE([#include <w32api.h>],
296 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
297 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
298 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
299 #error "test failed."
301 , [ res=yes ], [ res=no ])
302 AC_MSG_RESULT([$res])
303 if test "$res" != "yes"; then
304 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
306 # Check windres version
307 AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
308 _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
309 AC_MSG_RESULT([$_WINDRES_VERSION])
310 _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
311 _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
312 _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
313 WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
314 WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
315 WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
316 if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
317 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
318 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
319 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
320 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
321 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
323 AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
326 AC_CHECK_PROGS(MIDL, $target-widl widl)
327 if test -n "$MIDL"; then
330 MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
333 MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
338 # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
339 # causing problems with local implementations with the same name.
340 AC_DEFINE(STRSAFE_NO_DEPRECATE)
343 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
344 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
345 # Require OS features provided by IE 8.0 (Win7)
346 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0800)
351 if test -n "$_WIN32_MSVC"; then
353 SKIP_COMPILER_CHECKS=1
354 SKIP_LIBRARY_CHECKS=1
356 # Since we're skipping compiler and library checks, hard-code
359 AC_DEFINE(HAVE_ISATTY)
362 fi # COMPILE_ENVIRONMENT
372 AC_SUBST(WRAP_STL_INCLUDES)
373 AC_SUBST(MOZ_MSVC_STL_WRAP_RAISE)
375 dnl ========================================================
376 dnl Checks for programs.
377 dnl ========================================================
378 if test "$COMPILE_ENVIRONMENT"; then
380 dnl ========================================================
381 dnl = Mac OS X SDK support
382 dnl ========================================================
384 MOZ_ARG_WITH_STRING(macos-sdk,
385 [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
386 MACOS_SDK_DIR=$withval)
388 MACOS_PRIVATE_FRAMEWORKS_DIR_DEFAULTED=
389 MOZ_ARG_WITH_STRING(macos-private-frameworks,
390 [ --with-macos-private-frameworks=dir Location of private frameworks to use (Mac OS X only)],
391 MACOS_PRIVATE_FRAMEWORKS_DIR=$withval,
392 MACOS_PRIVATE_FRAMEWORKS_DIR=/System/Library/PrivateFrameworks
393 MACOS_PRIVATE_FRAMEWORKS_DEFAULTED=1)
395 if test -z "${MACOS_PRIVATE_FRAMEWORKS_DEFAULTED}"; then
396 if test -z "$CROSS_COMPILE"; then
397 AC_MSG_WARN([You should only be using --with-macos-private-frameworks when cross-compiling.])
399 if test ! -d "$MACOS_PRIVATE_FRAMEWORKS_DIR"; then
400 AC_MSG_ERROR([PrivateFrameworks directory not found.])
404 dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
405 AC_SUBST(MACOS_SDK_DIR)
406 AC_SUBST(MACOS_PRIVATE_FRAMEWORKS_DIR)
408 if test "$MACOS_SDK_DIR"; then
409 dnl Sync this section with the ones in NSPR and NSS.
410 dnl Changes to the cross environment here need to be accounted for in
411 dnl the libIDL checks (below) and xpidl build.
413 if test ! -d "$MACOS_SDK_DIR"; then
414 AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
415 specify a valid SDK. SDKs are installed when the optional cross-development
416 tools are selected during the Xcode/Developer Tools installation.])
419 CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
420 CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
422 dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
423 CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
424 CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
427 AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
429 AC_TRY_COMPILE([#include <new>],[],
433 AC_MSG_RESULT($result)
435 if test "$result" = "no" ; then
436 AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
444 fi # COMPILE_ENVIRONMENT
446 dnl ========================================================
447 dnl set the defaults first
448 dnl ========================================================
454 MOZ_USER_DIR=".mozilla"
456 MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
460 dnl Configure platform-specific CPU architecture compiler options.
461 dnl ==============================================================
462 if test "$COMPILE_ENVIRONMENT"; then
465 if test "$OS_TARGET" = Android; then
466 dnl Default Android builds to ARMv7.
469 fi # COMPILE_ENVIRONMENT
471 dnl ========================================================
472 dnl Android libstdc++, placed here so it can use MOZ_ARCH
474 dnl ========================================================
477 if test "$COMPILE_ENVIRONMENT"; then
479 fi # COMPILE_ENVIRONMENT
481 dnl ========================================================
482 dnl Suppress Clang Argument Warnings
483 dnl ========================================================
484 if test -n "${CLANG_CC}${CLANG_CL}"; then
485 _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
486 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
488 if test -n "${CLANG_CXX}${CLANG_CL}"; then
489 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
492 if test -n "$COMPILE_ENVIRONMENT"; then
496 # Add the hardening flags from moz.configure
497 CFLAGS="$CFLAGS $HARDENING_CFLAGS"
498 CPPFLAGS="$CPPFLAGS $HARDENING_CFLAGS"
499 CXXFLAGS="$CXXFLAGS $HARDENING_CFLAGS"
501 dnl ========================================================
502 dnl GNU specific defaults
503 dnl ========================================================
504 if test "$GNU_CC"; then
508 SSSE3_FLAGS="-mssse3"
509 # FIXME: Let us build with strict aliasing. bug 414641.
510 CFLAGS="$CFLAGS -fno-strict-aliasing"
511 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
512 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
513 WARNINGS_AS_ERRORS='-Werror'
515 DSO_PIC_CFLAGS='-fPIC'
516 ASFLAGS="$ASFLAGS -fPIC"
517 AC_MSG_CHECKING([for --noexecstack option to as])
519 CFLAGS="$CFLAGS -Wa,--noexecstack"
520 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
521 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
524 AC_MSG_CHECKING([for -z noexecstack option to ld])
525 _SAVE_LDFLAGS=$LDFLAGS
526 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
527 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
529 LDFLAGS=$_SAVE_LDFLAGS)
531 AC_MSG_CHECKING([for -z text option to ld])
532 _SAVE_LDFLAGS=$LDFLAGS
533 LDFLAGS="$LDFLAGS -Wl,-z,text"
534 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
536 LDFLAGS=$_SAVE_LDFLAGS)
538 AC_MSG_CHECKING([for -z relro option to ld])
539 _SAVE_LDFLAGS=$LDFLAGS
540 LDFLAGS="$LDFLAGS -Wl,-z,relro"
541 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
543 LDFLAGS=$_SAVE_LDFLAGS)
545 AC_MSG_CHECKING([for --build-id option to ld])
546 _SAVE_LDFLAGS=$LDFLAGS
547 LDFLAGS="$LDFLAGS -Wl,--build-id"
548 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
550 LDFLAGS=$_SAVE_LDFLAGS)
552 AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
553 HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
554 _SAVE_LDFLAGS=$LDFLAGS
555 LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
556 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
557 [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
559 LDFLAGS=$_SAVE_LDFLAGS
561 # Check for -mssse3 on $CC
562 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
563 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
565 CFLAGS="$CFLAGS -mssse3"
566 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
567 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
571 # Check for -msse4.1 on $CC
572 AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
573 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
575 CFLAGS="$CFLAGS -msse4.1"
576 AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
577 [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
581 case "${CPU_ARCH}" in
583 AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
585 [asm volatile ("vpermq \$0xd8,%ymm0,%ymm0 \n");],
586 result="yes", result="no")
587 AC_MSG_RESULT("$result")
588 if test "$result" = "yes"; then
594 AC_MSG_CHECKING([whether we can enable AltiVec support])
597 CFLAGS="$CFLAGS -maltivec"
598 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
606 if test "$GCC_USE_GNU_LD"; then
607 # Some tools like ASan use a runtime library that is only
608 # linked against executables, so we must allow undefined
609 # symbols for shared objects in some cases.
610 if test -z "$MOZ_NO_WLZDEFS"; then
611 # Don't allow undefined symbols in libraries
612 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
614 # BSDs need `environ' exposed for posix_spawn (bug 753046)
616 DragonFly|FreeBSD|NetBSD|OpenBSD)
617 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
618 DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
620 DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
627 _DEFINES_CFLAGS='-include $(topobjdir)/mozilla-config.h -DMOZILLA_CLIENT'
628 _USE_CPP_INCLUDE_FLAG=1
630 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
633 if test "$GNU_CXX"; then
634 # FIXME: Let us build with strict aliasing. bug 414641.
635 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
637 _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(topobjdir)/mozilla-config.h'
638 _USE_CPP_INCLUDE_FLAG=1
641 dnl ========================================================
643 dnl ========================================================
644 MOZ_ARG_ENABLE_BOOL(valgrind,
645 [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
648 if test -n "$MOZ_VALGRIND"; then
649 MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
651 [--enable-valgrind specified but Valgrind is not installed]))
652 AC_DEFINE(MOZ_VALGRIND)
654 AC_SUBST(MOZ_VALGRIND)
656 # For profiling builds keep the symbol information
657 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
659 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
660 STRIP_FLAGS="--strip-debug"
665 dnl ========================================================
667 dnl ========================================================
669 if test "$MOZ_DMD"; then
670 if test "${CPU_ARCH}" = "arm"; then
671 CFLAGS="$CFLAGS -funwind-tables"
672 CXXFLAGS="$CXXFLAGS -funwind-tables"
676 dnl ========================================================
677 dnl System overrides of the defaults for host
678 dnl ========================================================
681 if test -n "$_WIN32_MSVC"; then
683 HOST_AR_FLAGS='-NOLOGO -OUT:$@'
684 HOST_CFLAGS="$HOST_CFLAGS -TC -nologo"
685 HOST_RANLIB='echo ranlib'
687 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
689 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
690 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
693 case "${host_cpu}" in
695 if test -n "$_WIN32_MSVC"; then
696 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
700 if test -n "$_WIN32_MSVC"; then
701 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
703 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
709 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
710 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
713 *-linux*|*-kfreebsd*-gnu|*-gnu*)
714 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
715 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
719 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
720 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
724 dnl ==============================================================
725 dnl Get mozilla version from central milestone file
726 dnl ==============================================================
727 MOZILLA_VERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir`
728 MOZILLA_UAVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --uaversion`
729 MOZILLA_SYMBOLVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --symbolversion`
730 if test -z "$MOZILLA_VERSION"; then
731 AC_MSG_ERROR([failed to read version info from milestone file])
734 dnl Get version of various core apps from the version files.
735 FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`
736 FIREFOX_VERSION_DISPLAY=`cat $_topsrcdir/browser/config/version_display.txt`
738 if test -z "$FIREFOX_VERSION"; then
739 AC_MSG_ERROR([FIREFOX_VERSION is unexpectedly blank.])
742 if test -z "$FIREFOX_VERSION_DISPLAY"; then
743 AC_MSG_ERROR([FIREFOX_VERSION_DISPLAY is unexpectedly blank.])
746 AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
747 AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
748 AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
749 AC_SUBST(MOZILLA_SYMBOLVERSION)
751 MOZ_DOING_LTO(lto_is_enabled)
753 dnl ========================================================
754 dnl System overrides of the defaults for target
755 dnl ========================================================
759 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
760 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
761 MOZ_OPTIMIZE_FLAGS="-O3"
762 CXXFLAGS="$CXXFLAGS -stdlib=libc++"
764 STRIP_FLAGS="$STRIP_FLAGS -x -S"
765 # Ensure that if we're targeting iOS an SDK was provided.
766 AC_CACHE_CHECK(for iOS target,
768 [AC_TRY_COMPILE([#include <TargetConditionals.h>
769 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
773 ac_cv_ios_target="yes",
774 ac_cv_ios_target="no")])
775 if test "$ac_cv_ios_target" = "yes" -a -z $MOZ_IOS; then
776 AC_MSG_ERROR([targeting iOS but not using an iOS SDK?])
778 if test -n "$MOZ_IOS"; then
781 # The ExceptionHandling framework is needed for Objective-C exception
782 # logging code in nsObjCExceptions.h. Currently we only use that in debug
784 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
787 if test "x$lto_is_enabled" = "xyes"; then
788 echo "Skipping -dead_strip because lto is enabled."
789 dnl DTrace and -dead_strip don't interact well. See bug 403132.
790 dnl ===================================================================
791 elif test "x$enable_dtrace" = "xyes"; then
792 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
794 dnl check for the presence of the -dead_strip linker flag
795 AC_MSG_CHECKING([for -dead_strip option to ld])
796 _SAVE_LDFLAGS=$LDFLAGS
797 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
798 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
799 if test -n "$_HAVE_DEAD_STRIP" ; then
801 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
806 LDFLAGS=$_SAVE_LDFLAGS
809 MOZ_FIX_LINK_PATHS="-Wl,-executable_path,${DIST}/bin"
812 *-android*|*-linuxandroid*)
813 AC_DEFINE(NO_PW_GECOS)
815 if test "$COMPILE_ENVIRONMENT"; then
819 MOZ_GFX_OPTIMIZE_MOBILE=1
820 if test -z "$CLANG_CC"; then
821 MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
823 # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
824 # -Oz is smaller than -Os on clang.
825 MOZ_OPTIMIZE_FLAGS="-Oz"
830 if test "$GNU_CC" -o "$GNU_CXX"; then
831 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
832 if test -n "$MOZ_DEBUG"; then
833 MOZ_OPTIMIZE_FLAGS="-Os"
835 MOZ_OPTIMIZE_FLAGS="-O2"
837 if test -z "$CLANG_CC"; then
838 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
842 case "${target_cpu}" in
844 CFLAGS="$CFLAGS -mieee"
845 CXXFLAGS="$CXXFLAGS -mieee"
853 # certain versions of cygwin's makedepend barf on the
854 # #include <string> vs -I./dist/include/string issue so don't use it
855 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
859 CFLAGS="$CFLAGS -mms-bitfields"
860 CXXFLAGS="$CXXFLAGS -mms-bitfields"
862 MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
863 MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
865 # Use static libgcc and libstdc++
866 LDFLAGS="$LDFLAGS -static"
867 # Use temp file for windres (bug 213281)
868 RCFLAGS='-O coff --use-temp-file'
869 # mingw doesn't require kernel32, user32, and advapi32 explicitly
870 LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
873 WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
874 WIN32_GUI_EXE_LDFLAGS=-mwindows
876 # GCC/binutils can't link to a function if we try to include dllexport function
877 # in the same library as dllimport caller. To work around it, we build NSPR
878 # and NSS with -mnop-fun-dllimport flag. The drawback of this solution is that
879 # function thunks need to be generated for cross-DLL calls.
880 MOZ_FOLD_LIBS_FLAGS="-mnop-fun-dllimport"
882 TARGET_COMPILER_ABI=msvc
883 if test "$AS_BIN"; then
884 AS="$(basename "$AS_BIN")"
887 AR_FLAGS='-NOLOGO -OUT:$@'
889 RANLIB='echo not_ranlib'
890 STRIP='echo not_strip'
892 MKSHLIB='$(LINK) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
893 MKCSHLIB='$(LINK) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
894 WIN32_SUBSYSTEM_VERSION=6.01
895 WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
896 WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
897 DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
898 _USE_CPP_INCLUDE_FLAG=1
899 _DEFINES_CFLAGS='-FI $(topobjdir)/mozilla-config.h -DMOZILLA_CLIENT'
900 _DEFINES_CXXFLAGS='-FI $(topobjdir)/mozilla-config.h -DMOZILLA_CLIENT'
901 CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
902 CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
903 if test -z "$CLANG_CL"; then
904 CPPFLAGS="$CPPFLAGS -utf-8"
906 if test "$CPU_ARCH" = "x86"; then
907 dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
908 dnl more recent, so set that explicitly here unless another
909 dnl target arch has already been set.
911 if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
912 CFLAGS="$CFLAGS -arch:SSE2"
914 if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
915 CXXFLAGS="$CXXFLAGS -arch:SSE2"
918 SSE_FLAGS="-arch:SSE"
919 SSE2_FLAGS="-arch:SSE2"
920 dnl MSVC allows the use of intrinsics without any flags
921 dnl and doesn't have a separate arch for SSSE3
922 SSSE3_FLAGS="-arch:SSE2"
924 dnl clang-cl requires appropriate flags to enable SSSE3 support
925 dnl on all architectures.
926 if test -n "$CLANG_CL"; then
927 SSSE3_FLAGS="-mssse3"
929 dnl VS2013+ supports -Gw for better linker optimizations.
930 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
931 dnl Disabled on ASan because it causes false-positive ODR violations.
932 if test -z "$MOZ_ASAN"; then
934 CXXFLAGS="$CXXFLAGS -Gw"
936 # khuey says we can safely ignore MSVC warning C4251
937 # MSVC warning C4244 (implicit type conversion may lose data) warns
938 # and requires workarounds for perfectly valid code. Also, GCC/clang
939 # don't warn about it by default. So for consistency/sanity, we turn
940 # it off on MSVC, too.
941 # MSVC warning C4267 warns for narrowing type conversions from size_t
942 # to 32-bit integer types on 64-bit platforms. Since this is virtually
943 # the same thing as C4244, we disable C4267, too.
944 # MSVC warning C4800 warns when a value is implicitly cast to bool,
945 # because this also forces narrowing to a single byte, which can be a
946 # perf hit. But this matters so little in practice (and often we want
947 # that behavior) that it's better to turn it off.
948 # MSVC warning C4595 warns non-member operator new or delete functions
949 # may not be declared inline, as of VS2015 Update 2.
950 CFLAGS="$CFLAGS -wd4244 -wd4267"
951 CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4267 -wd4800 -wd4595"
952 if test -n "$CLANG_CL"; then
953 # XXX We should combine some of these with our generic GCC-style
956 # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
957 CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
958 # We use offsetof on non-POD objects all the time.
959 # We also suppress this warning on other platforms.
960 CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
961 # This warns for reasonable things like:
962 # enum { X = 0xffffffffU };
963 # which is annoying for IDL headers.
964 CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
965 # This warns for cases that would be reached by the Microsoft
966 # #include rules, but also currently warns on cases that would
967 # *also* be reached by standard C++ include rules. That
968 # behavior doesn't seem useful, so we turn it off.
969 CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
970 # We normally error out on unknown pragmas, but since clang-cl
971 # claims to be MSVC, it would be difficult to add
972 # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
973 # use such pragmas, so just ignore them.
974 CFLAGS="$CFLAGS -Wno-unknown-pragmas"
975 CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
976 # We get errors about various #pragma intrinsic directives from
977 # clang-cl, and we don't need to hear about those.
978 CFLAGS="$CFLAGS -Wno-ignored-pragmas"
979 CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
980 # clang-cl's Intrin.h marks things like _ReadWriteBarrier
981 # as __attribute((__deprecated__)). This is nice to know,
982 # but since we don't get the equivalent warning from MSVC,
983 # let's just ignore it.
984 CFLAGS="$CFLAGS -Wno-deprecated-declarations"
985 CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
986 # We use a function like:
987 # __declspec(noreturn) __inline void f() {}
988 # which -Winvalid-noreturn complains about. Again, MSVC seems
989 # OK with it, so let's silence the warning.
990 CFLAGS="$CFLAGS -Wno-invalid-noreturn"
991 CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
992 # Missing |override| on virtual function declarations isn't
993 # something that MSVC currently warns about.
994 CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
995 # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
996 # declaration on |operator delete(void*)|. However, clang-cl
997 # must internally declare |operator delete(void*)| differently,
998 # which causes this warning for virtually every file in the
999 # tree. clang-cl doesn't support -fno-exceptions or equivalent,
1000 # so there doesn't seem to be any way to convince clang-cl to
1001 # declare |delete| differently. Therefore, suppress this
1003 CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
1004 # At least one MSVC header and several headers in-tree have
1005 # unused typedefs, so turn this on.
1006 CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
1007 # jemalloc uses __declspec(allocator) as a profiler hint,
1008 # which clang-cl doesn't understand.
1009 CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
1011 # make 'foo == bar;' error out
1012 CFLAGS="$CFLAGS -we4553"
1013 CXXFLAGS="$CXXFLAGS -we4553"
1014 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
1015 MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
1016 WARNINGS_AS_ERRORS='-WX'
1017 MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
1019 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
1020 if test -z "$DEVELOPER_OPTIONS"; then
1021 LDFLAGS="$LDFLAGS -RELEASE"
1023 LDFLAGS="$LDFLAGS -DYNAMICBASE"
1025 dnl Minimum reqiurement of Gecko is VS2015 or later which supports
1026 dnl both SSSE3 and SSE4.1.
1027 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
1028 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
1029 dnl allow AVX2 code from VS2015
1032 AC_DEFINE(WIN32_LEAN_AND_MEAN)
1033 dnl See http://support.microsoft.com/kb/143208 to use STL
1036 MOZ_USER_DIR="Mozilla"
1040 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.])
1046 if test -n "$GNU_CC"; then
1047 CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
1048 CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
1049 LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup -Wl,--large-address-aware"
1051 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
1052 LDFLAGS="$LDFLAGS -SAFESEH"
1058 if test -n "$_WIN32_MSVC"; then
1059 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
1064 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
1071 CFLAGS="$CFLAGS -Dunix"
1072 CXXFLAGS="$CXXFLAGS -Dunix"
1073 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
1074 DSO_PIC_CFLAGS='-fPIC -DPIC'
1075 DSO_LDOPTS='-shared'
1076 BIN_FLAGS='-Wl,--export-dynamic'
1078 DSO_PIC_CFLAGS='-fPIC -DPIC'
1079 DSO_LDOPTS='-shared'
1081 # This will fail on a.out systems prior to 1.5.1_ALPHA.
1082 if test "$LIBRUNPATH"; then
1083 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
1085 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
1086 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
1090 if test -z "$X11BASE"; then
1093 MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
1095 DSO_PIC_CFLAGS='-fPIC'
1096 DSO_LDOPTS='-shared -fPIC'
1097 if test "$LIBRUNPATH"; then
1098 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
1108 AC_SUBST_LIST(MMX_FLAGS)
1109 AC_SUBST_LIST(SSE_FLAGS)
1110 AC_SUBST_LIST(SSE2_FLAGS)
1111 AC_SUBST_LIST(SSSE3_FLAGS)
1113 AC_SUBST(MOZ_LINKER)
1114 if test -n "$MOZ_LINKER"; then
1115 AC_DEFINE(MOZ_LINKER)
1116 MOZ_LINKER_EXTRACT=1
1117 AC_CHECK_PROGS(XZ, xz)
1120 dnl Only one oddball right now (QNX), but this gives us flexibility
1121 dnl if any other platforms need to override this in the future.
1122 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
1124 if test -z "$COMPILE_ENVIRONMENT"; then
1125 SKIP_COMPILER_CHECKS=1
1126 SKIP_LIBRARY_CHECKS=1
1131 fi # COMPILE_ENVIRONMENT
1133 if test -z "$SKIP_COMPILER_CHECKS"; then
1134 dnl Checks for typedefs, structures, and compiler characteristics.
1135 dnl ========================================================
1150 case "${OS_TARGET}" in
1154 STL_FLAGS="-I${DIST}/stl_wrappers"
1159 dnl Checks for header files.
1160 dnl ========================================================
1162 case "$target_os" in
1163 bitrig*|dragonfly*|freebsd*|openbsd*)
1164 # for stuff like -lXshm
1165 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
1169 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
1170 AC_CACHE_CHECK(for sockaddr_in.sin_len,
1171 ac_cv_sockaddr_in_sin_len,
1172 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1173 #include <sys/types.h>
1175 #include <netinet/in.h>
1176 struct sockaddr_in x;
1177 void *foo = (void*) &x.sin_len;],
1179 [ac_cv_sockaddr_in_sin_len=true],
1180 [ac_cv_sockaddr_in_sin_len=false])])
1181 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
1182 AC_DEFINE(HAVE_SIN_LEN)
1183 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
1184 AC_DEFINE(HAVE_SCONN_LEN)
1187 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
1188 ac_cv_sockaddr_in6_sin6_len,
1189 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1190 #include <sys/types.h>
1192 #include <netinet/in.h>
1193 struct sockaddr_in6 x;
1194 void *foo = (void*) &x.sin6_len;],
1196 [ac_cv_sockaddr_in6_sin6_len=true],
1197 [ac_cv_sockaddr_in6_sin6_len=false])])
1198 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
1199 AC_DEFINE(HAVE_SIN6_LEN)
1202 AC_CACHE_CHECK(for sockaddr.sa_len,
1203 ac_cv_sockaddr_sa_len,
1204 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1205 #include <sys/types.h>
1207 #include <sys/socket.h>
1209 void *foo = (void*) &x.sa_len;],
1211 [ac_cv_sockaddr_sa_len=true],
1212 [ac_cv_sockaddr_sa_len=false])])
1213 if test "$ac_cv_sockaddr_sa_len" = true ; then
1214 AC_DEFINE(HAVE_SA_LEN)
1217 MOZ_ARG_ENABLE_BOOL(dtrace,
1218 [ --enable-dtrace build with dtrace support if available (default=no)],
1219 [enable_dtrace="yes"],)
1220 if test "x$enable_dtrace" = "xyes"; then
1221 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
1222 if test -n "$HAVE_DTRACE"; then
1223 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
1225 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
1228 AC_SUBST(HAVE_DTRACE)
1230 dnl Checks for libraries.
1231 dnl ========================================================
1232 AC_CHECK_LIB(c_r, gethostbyname_r)
1234 dnl We don't want to link with libdl even if it's present on OS X, since
1235 dnl it's not used and not part of the default installation. OS/2 has dlfcn
1237 dnl We don't want to link against libm or libpthread on Darwin since
1238 dnl they both are just symlinks to libSystem and explicitly linking
1239 dnl against libSystem causes issues when debugging (see bug 299601).
1244 AC_SEARCH_LIBS(dlopen, dl,
1245 MOZ_CHECK_HEADER(dlfcn.h,
1246 AC_DEFINE(HAVE_DLOPEN)))
1250 _SAVE_CFLAGS="$CFLAGS"
1251 CFLAGS="$CFLAGS -D_GNU_SOURCE"
1252 AC_CHECK_FUNCS(dladdr memmem)
1253 CFLAGS="$_SAVE_CFLAGS"
1255 if test ! "$GNU_CXX"; then
1256 AC_CHECK_LIB(C, demangle)
1259 AC_CHECK_LIB(socket, socket)
1262 XLIBS="$X_EXTRA_LIBS"
1264 dnl ========================================================
1265 dnl Checks for X libraries.
1266 dnl Ordering is important.
1267 dnl Xt is dependent upon SM as of X11R6
1268 dnl ========================================================
1269 if test -n "$MOZ_X11"; then
1270 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
1271 _SAVE_LDFLAGS="$LDFLAGS"
1273 LDFLAGS="$XLDFLAGS $LDFLAGS"
1274 AC_CHECK_LIB(X11, XDrawLines, [XLIBS="-lX11 $XLIBS"],
1275 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
1276 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
1277 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
1279 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
1280 unset ac_cv_lib_Xt_XtFree
1281 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
1282 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
1283 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
1284 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
1287 dnl ========================================================
1289 dnl ========================================================
1290 AC_CHECK_LIB(xcb, xcb_connect, [XLIBS="-lxcb $XLIBS"],
1291 [MISSING_X="$MISSING_X -lxcb"], $XLIBS)
1292 AC_CHECK_LIB(xcb-shm, xcb_shm_query_version, [XLIBS="-lxcb-shm $XLIBS"],
1293 [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS)
1294 AC_CHECK_LIB(X11-xcb, XGetXCBConnection, [XLIBS="-lX11-xcb $XLIBS"],
1295 [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS)
1297 dnl ========================================================
1299 dnl ========================================================
1300 MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
1301 AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
1302 [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
1303 AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
1305 LDFLAGS="$_SAVE_LDFLAGS"
1309 AC_SUBST_LIST(XCFLAGS)
1310 AC_SUBST_LIST(XLDFLAGS)
1311 AC_SUBST_LIST(XLIBS)
1312 AC_SUBST_LIST(XEXT_LIBS)
1313 AC_SUBST_LIST(XT_LIBS)
1314 AC_SUBST_LIST(XSS_LIBS)
1316 dnl ========================================================
1317 dnl = pthread support
1318 dnl = Start by checking whether the system support pthreads
1319 dnl ========================================================
1320 case "$target_os" in
1325 AC_CHECK_LIB(pthreads, pthread_create,
1326 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
1327 AC_CHECK_LIB(pthread, pthread_create,
1328 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
1329 AC_CHECK_LIB(c_r, pthread_create,
1330 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
1331 AC_CHECK_LIB(c, pthread_create,
1340 dnl ========================================================
1341 dnl Check the command line for --with-pthreads
1342 dnl ========================================================
1343 MOZ_ARG_WITH_BOOL(pthreads,
1344 [ --with-pthreads Force use of system pthread library with NSPR ],
1345 [ if test "$MOZ_USE_PTHREADS"x = x; then
1346 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
1352 dnl ========================================================
1353 dnl Do the platform specific pthread hackery
1354 dnl ========================================================
1355 if test "$MOZ_USE_PTHREADS"x != x
1358 dnl See if -pthread is supported.
1361 ac_cv_have_dash_pthread=no
1362 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
1363 echo 'int main() { return 0; }' | cat > conftest.c
1364 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
1365 if test $? -eq 0; then
1366 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1367 ac_cv_have_dash_pthread=yes
1368 case "$target_os" in
1370 # Freebsd doesn't use -pthread for compiles, it uses them for linking
1373 CFLAGS="$CFLAGS -pthread"
1374 CXXFLAGS="$CXXFLAGS -pthread"
1380 AC_MSG_RESULT($ac_cv_have_dash_pthread)
1383 dnl See if -pthreads is supported.
1385 ac_cv_have_dash_pthreads=no
1386 if test "$ac_cv_have_dash_pthread" = "no"; then
1387 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
1388 echo 'int main() { return 0; }' | cat > conftest.c
1389 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
1390 if test $? -eq 0; then
1391 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1392 ac_cv_have_dash_pthreads=yes
1393 CFLAGS="$CFLAGS -pthreads"
1394 CXXFLAGS="$CXXFLAGS -pthreads"
1398 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
1403 AC_DEFINE(_REENTRANT)
1404 AC_DEFINE(_THREAD_SAFE)
1405 dnl -pthread links in -lpthread, so don't specify it explicitly.
1406 if test "$ac_cv_have_dash_pthread" = "yes"; then
1407 _PTHREAD_LDFLAGS="-pthread"
1411 *-*-openbsd*|*-*-bsdi*)
1412 AC_DEFINE(_REENTRANT)
1413 AC_DEFINE(_THREAD_SAFE)
1414 dnl -pthread links in -lc_r, so don't specify it explicitly.
1415 if test "$ac_cv_have_dash_pthread" = "yes"; then
1416 _PTHREAD_LDFLAGS="-pthread"
1420 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
1421 AC_DEFINE(_REENTRANT)
1425 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
1426 AC_SUBST(MOZ_USE_PTHREADS)
1427 MOZ_CHECK_HEADERS(pthread.h)
1431 dnl Checks for library functions.
1432 dnl ========================================================
1433 AC_PROG_GCC_TRADITIONAL
1435 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall)
1437 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1438 dnl avoid this on Darwin, since depending on your system config, we may think
1439 dnl it exists but it really doesn't
1440 case "$OS_TARGET" in
1444 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1445 ac_cv_clock_monotonic,
1446 [for libs in "" -lrt; do
1449 AC_TRY_LINK([#include <time.h>],
1450 [ struct timespec ts;
1451 clock_gettime(CLOCK_MONOTONIC, &ts); ],
1452 ac_cv_clock_monotonic=$libs
1455 ac_cv_clock_monotonic=no)
1458 if test "$ac_cv_clock_monotonic" != "no"; then
1459 HAVE_CLOCK_MONOTONIC=1
1460 REALTIME_LIBS=$ac_cv_clock_monotonic
1461 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1462 AC_SUBST(HAVE_CLOCK_MONOTONIC)
1463 AC_SUBST_LIST(REALTIME_LIBS)
1468 AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
1469 ac_cv_pthread_cond_timedwait_monotonic_np,
1470 AC_TRY_LINK([#include <pthread.h>],
1471 [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
1472 ac_cv_pthread_cond_timewait_monotonic_np=yes,
1473 ac_cv_pthread_cond_timewait_monotonic_np=no))
1474 if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
1475 AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
1478 dnl check for wcrtomb/mbrtowc
1479 dnl =======================================================================
1480 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
1483 AC_CACHE_CHECK(for wcrtomb,
1485 [AC_TRY_LINK([#include <wchar.h>],
1486 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
1487 ac_cv_have_wcrtomb="yes",
1488 ac_cv_have_wcrtomb="no")])
1489 if test "$ac_cv_have_wcrtomb" = "yes"; then
1490 AC_DEFINE(HAVE_WCRTOMB)
1492 AC_CACHE_CHECK(for mbrtowc,
1494 [AC_TRY_LINK([#include <wchar.h>],
1495 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
1496 ac_cv_have_mbrtowc="yes",
1497 ac_cv_have_mbrtowc="no")])
1498 if test "$ac_cv_have_mbrtowc" = "yes"; then
1499 AC_DEFINE(HAVE_MBRTOWC)
1506 ac_cv_func_res_ninit,
1507 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
1508 dnl no need for res_ninit() on NetBSD and OpenBSD
1509 ac_cv_func_res_ninit=no
1513 #define _BSD_SOURCE 1
1515 #include <sys/types.h>
1516 #include <netinet/in.h>
1517 #include <arpa/nameser.h>
1520 [int foo = res_ninit(&_res);],
1521 [ac_cv_func_res_ninit=yes],
1522 [ac_cv_func_res_ninit=no])
1526 if test "$ac_cv_func_res_ninit" = "yes"; then
1527 AC_DEFINE(HAVE_RES_NINIT)
1528 dnl must add the link line we do something as foolish as this... dougt
1530 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
1531 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
1543 AC_CHECK_LIB(c, iconv, [ICONV_LIBS=],
1544 AC_CHECK_LIB(iconv, iconv, [ICONV_LIBS="-liconv"],
1545 AC_CHECK_LIB(iconv, libiconv, [ICONV_LIBS="-liconv"])))
1547 LIBS="$LIBS $ICONV_LIBS"
1556 iconv_t h = iconv_open("", "");
1557 iconv(h, NULL, NULL, NULL, NULL);
1560 [ac_cv_func_iconv=yes],
1561 [ac_cv_func_iconv=no]
1564 if test "$ac_cv_func_iconv" = "yes"; then
1565 AC_DEFINE(HAVE_ICONV)
1566 LIBICONV="$ICONV_LIBS"
1568 [for iconv() with const input],
1569 ac_cv_func_const_iconv,
1575 const char *input = "testing";
1576 iconv_t h = iconv_open("", "");
1577 iconv(h, &input, NULL, NULL, NULL);
1580 [ac_cv_func_const_iconv=yes],
1581 [ac_cv_func_const_iconv=no]
1584 if test "$ac_cv_func_const_iconv" = "yes"; then
1585 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
1593 AC_SUBST_LIST(ICONV_LIBS)
1599 dnl **********************
1600 dnl *** va_copy checks ***
1601 AC_CACHE_CHECK([for an implementation of va_copy()],
1603 [AC_TRY_COMPILE([#include <stdarg.h>
1605 void f (int i, ...) {
1606 va_list args1, args2;
1607 va_start (args1, i);
1608 va_copy (args2, args1);
1609 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1611 va_end (args1); va_end (args2);
1613 [f(0, 42); return 0],
1614 [ac_cv_va_copy=yes],
1618 AC_CACHE_CHECK([whether va_list can be copied by value],
1620 [AC_TRY_COMPILE([#include <stdarg.h>
1622 void f (int i, ...) {
1623 va_list args1, args2;
1624 va_start (args1, i);
1626 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1628 va_end (args1); va_end (args2);
1630 [f(0, 42); return 0],
1631 [ac_cv_va_val_copy=yes],
1632 [ac_cv_va_val_copy=no],
1635 if test "x$ac_cv_va_copy" = "xyes"; then
1636 AC_DEFINE(VA_COPY, va_copy)
1637 AC_DEFINE(HAVE_VA_COPY)
1640 if test "x$ac_cv_va_val_copy" = "xno"; then
1641 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
1644 dnl ===================================================================
1645 dnl ========================================================
1646 dnl Put your C++ language/feature checks below
1647 dnl ========================================================
1651 if test "$GNU_CC"; then
1652 if test "$CPU_ARCH" = "arm" ; then
1653 AC_CACHE_CHECK(for ARM EABI,
1657 #if defined(__ARM_EABI__)
1660 #error Not ARM EABI.
1663 ac_cv_gcc_arm_eabi="yes",
1664 ac_cv_gcc_arm_eabi="no")])
1665 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
1667 ARM_ABI_PREFIX=eabi-
1669 ARM_ABI_PREFIX=oabi-
1673 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
1676 dnl See if a dynamic_cast to void* gives the most derived object.
1677 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
1678 ac_cv_cpp_dynamic_cast_void_ptr,
1679 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
1680 class Y { int j; public: virtual ~Y() { } };
1681 class Z : public X, public Y { int k; };
1687 return !((((void*)&mdo != (void*)subx) &&
1688 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
1689 (((void*)&mdo != (void*)suby) &&
1690 ((void*)&mdo == dynamic_cast<void*>(suby))));
1692 ac_cv_cpp_dynamic_cast_void_ptr=yes,
1693 ac_cv_cpp_dynamic_cast_void_ptr=no,
1694 ac_cv_cpp_dynamic_cast_void_ptr=no)])
1695 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
1696 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
1700 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
1701 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
1702 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
1704 _SAVE_LDFLAGS=$LDFLAGS
1705 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
1706 AC_CACHE_CHECK(for __thread keyword for TLS variables,
1707 ac_cv_thread_keyword,
1708 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
1709 [return tlsIsMainThread;],
1710 ac_cv_thread_keyword=yes,
1711 ac_cv_thread_keyword=no)])
1712 LDFLAGS=$_SAVE_LDFLAGS
1713 # The custom dynamic linker doesn't support TLS variables
1715 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
1716 # mips builds fail with TLS variables because of a binutils bug.
1718 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
1723 *-android*|*-linuxandroid*)
1730 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
1736 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
1737 if test -n "$MOZ_LINKER"; then
1738 if test "$CPU_ARCH" = arm; then
1739 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
1740 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
1741 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1742 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1746 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
1747 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
1748 dnl Since the linker only understands the sysv ones, no need to build the
1749 dnl gnu style tables anyways.
1750 LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
1753 dnl The custom linker doesn't support text relocations, but NDK >= r6b
1754 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
1755 dnl We however want to avoid these text relocations, and this can be done
1756 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
1757 dnl doesn't contain anything at all, beside placeholders for some sections,
1758 dnl and crtbegin only contains a finalizer function that calls
1759 dnl __cxa_finalize. The custom linker actually takes care of calling
1760 dnl __cxa_finalize when the library doesn't call it itself, which makes it
1761 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
1762 dnl link crtbegin and crtend at all.
1763 if test -n "$MOZ_LINKER" -a "$OS_TARGET" = "Android"; then
1764 AC_CACHE_CHECK([whether the CRT objects have text relocations],
1765 ac_cv_crt_has_text_relocations,
1766 [echo 'int foo() { return 0; }' > conftest.cpp
1767 if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
1768 test -s conftest${DLL_SUFFIX}; then
1769 if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
1770 ac_cv_crt_has_text_relocations=yes
1772 ac_cv_crt_has_text_relocations=no
1775 AC_ERROR([couldn't compile a simple C file])
1778 if test "$ac_cv_crt_has_text_relocations" = yes; then
1779 dnl While we want libraries to skip the CRT files, we don't want
1780 dnl executables to be treated the same way. We thus set the flag
1781 dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
1782 dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
1783 dnl Using LDFLAGS in nspr is safe, since we only really build
1784 dnl libraries there.
1785 DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
1789 dnl End of C++ language/feature checks
1792 dnl ========================================================
1793 dnl = Internationalization checks
1794 dnl ========================================================
1796 dnl Internationalization and Locale support is different
1797 dnl on various UNIX platforms. Checks for specific i18n
1798 dnl features go here.
1800 dnl check for LC_MESSAGES
1801 AC_CACHE_CHECK(for LC_MESSAGES,
1802 ac_cv_i18n_lc_messages,
1803 [AC_TRY_COMPILE([#include <locale.h>],
1804 [int category = LC_MESSAGES;],
1805 ac_cv_i18n_lc_messages=yes,
1806 ac_cv_i18n_lc_messages=no)])
1807 if test "$ac_cv_i18n_lc_messages" = yes; then
1808 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
1811 AC_HAVE_FUNCS(localeconv)
1813 fi # ! SKIP_COMPILER_CHECKS
1815 if test -n "${COMPILE_ENVIRONMENT}"; then
1820 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1821 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1822 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1825 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1826 dnl features that Windows actually does support.
1828 if test -n "$SKIP_COMPILER_CHECKS"; then
1829 dnl Windows has malloc.h
1830 AC_DEFINE(MALLOC_H, [<malloc.h>])
1831 AC_DEFINE(HAVE_FORCEINLINE)
1832 AC_DEFINE(HAVE_LOCALECONV)
1833 fi # SKIP_COMPILER_CHECKS
1835 dnl Mozilla specific options
1836 dnl ========================================================
1837 dnl The macros used for command line options
1838 dnl are defined in build/autoconf/altoptions.m4.
1840 dnl ========================================================
1842 dnl = Check for external package dependencies
1844 dnl ========================================================
1845 MOZ_ARG_HEADER(External Packages)
1847 case "$OS_TARGET" in
1848 WINNT|Darwin|Android)
1858 dnl ========================================================
1859 dnl system libevent Support
1860 dnl ========================================================
1861 MOZ_ARG_WITH_STRING(system-libevent,
1862 [ --with-system-libevent[=PFX]
1863 Use system libevent [installed at prefix PFX]],
1864 LIBEVENT_DIR=$withval)
1866 _SAVE_CFLAGS=$CFLAGS
1867 _SAVE_LDFLAGS=$LDFLAGS
1869 if test "$LIBEVENT_DIR" = yes; then
1870 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
1871 MOZ_SYSTEM_LIBEVENT=1,
1874 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
1875 MOZ_SYSTEM_LIBEVENT=
1876 elif test -z "$MOZ_SYSTEM_LIBEVENT"; then
1877 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
1878 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
1879 MOZ_CHECK_HEADER(event.h,
1880 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
1881 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
1883 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
1884 AC_CHECK_LIB(event, event_init,
1885 [MOZ_SYSTEM_LIBEVENT=1
1886 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
1887 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
1888 [MOZ_SYSTEM_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
1890 CFLAGS=$_SAVE_CFLAGS
1891 LDFLAGS=$_SAVE_LDFLAGS
1894 AC_SUBST(MOZ_SYSTEM_LIBEVENT)
1896 dnl ========================================================
1897 dnl = If NSS was not detected in the system,
1898 dnl = use the one in the source tree (mozilla/security/nss)
1899 dnl ========================================================
1901 MOZ_ARG_WITH_BOOL(system-nss,
1902 [ --with-system-nss Use system installed NSS],
1905 if test -n "$_USE_SYSTEM_NSS"; then
1906 AM_PATH_NSS(3.33, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
1909 if test -n "$MOZ_SYSTEM_NSS"; then
1910 NSS_LIBS="$NSS_LIBS -lcrmf"
1912 NSS_CFLAGS="-I${DIST}/include/nss"
1913 case "${OS_ARCH}" in
1914 # Only few platforms have been tested with GYP
1915 WINNT|Darwin|Linux|DragonFly|FreeBSD|NetBSD|OpenBSD|SunOS)
1918 AC_MSG_ERROR([building in-tree NSS is not supported on this platform. Use --with-system-nss])
1923 if test -z "$SKIP_LIBRARY_CHECKS"; then
1924 dnl system JPEG support
1925 dnl ========================================================
1926 MOZ_ARG_WITH_STRING(system-jpeg,
1927 [ --with-system-jpeg[=PFX]
1928 Use system libjpeg [installed at prefix PFX]],
1931 _SAVE_CFLAGS=$CFLAGS
1932 _SAVE_LDFLAGS=$LDFLAGS
1934 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
1935 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
1936 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
1938 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
1941 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_SYSTEM_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_SYSTEM_JPEG=)
1944 if test "$MOZ_SYSTEM_JPEG" = 1; then
1945 AC_TRY_COMPILE([ #include <stdio.h>
1946 #include <sys/types.h>
1947 #include <jpeglib.h> ],
1948 [ #if JPEG_LIB_VERSION < $MOZJPEG
1949 #error "Insufficient JPEG library version ($MOZJPEG required)."
1951 #ifndef JCS_EXTENSIONS
1952 #error "libjpeg-turbo JCS_EXTENSIONS required"
1956 AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
1958 CFLAGS=$_SAVE_CFLAGS
1959 LDFLAGS=$_SAVE_LDFLAGS
1962 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_SYSTEM_JPEG" = 1; then
1963 MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
1964 MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
1966 fi # SKIP_LIBRARY_CHECKS
1968 dnl system ZLIB support
1969 dnl ========================================================
1970 MOZ_ZLIB_CHECK([1.2.3])
1972 if test -z "$SKIP_LIBRARY_CHECKS"; then
1973 dnl system BZIP2 Support
1974 dnl ========================================================
1975 MOZ_ARG_WITH_STRING(system-bz2,
1976 [ --with-system-bz2[=PFX]
1977 Use system libbz2 [installed at prefix PFX]],
1980 _SAVE_CFLAGS=$CFLAGS
1981 _SAVE_LDFLAGS=$LDFLAGS
1983 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
1984 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
1985 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
1987 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
1990 AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_SYSTEM_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
1991 [MOZ_SYSTEM_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
1993 CFLAGS=$_SAVE_CFLAGS
1994 LDFLAGS=$_SAVE_LDFLAGS
1997 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_SYSTEM_BZ2" = 1; then
1998 MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
1999 MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
2002 dnl ========================================================
2003 dnl system PNG Support
2004 dnl ========================================================
2005 MOZ_ARG_WITH_STRING(system-png,
2006 [ --with-system-png[=PFX]
2007 Use system libpng [installed at prefix PFX]],
2010 _SAVE_CFLAGS=$CFLAGS
2011 _SAVE_LDFLAGS=$LDFLAGS
2013 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
2014 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
2015 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
2017 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
2020 AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"],
2021 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
2022 AC_CHECK_LIB(png, png_get_acTL, ,
2023 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
2025 if test "$MOZ_SYSTEM_PNG" = 1; then
2026 AC_TRY_COMPILE([ #include <stdio.h>
2027 #include <sys/types.h>
2029 [ #if PNG_LIBPNG_VER < $MOZPNG
2030 #error "Insufficient libpng version ($MOZPNG required)."
2032 #ifndef PNG_UINT_31_MAX
2033 #error "Insufficient libpng version."
2036 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
2038 CFLAGS=$_SAVE_CFLAGS
2039 LDFLAGS=$_SAVE_LDFLAGS
2042 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then
2043 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
2044 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
2047 fi # SKIP_LIBRARY_CHECKS
2049 dnl ========================================================
2053 dnl ========================================================
2055 MOZ_ARG_HEADER(Application)
2057 ENABLE_SYSTEM_EXTENSION_DIRS=1
2058 MOZ_BRANDING_DIRECTORY=
2059 MOZ_OFFICIAL_BRANDING=
2061 MOZ_AUTH_EXTENSION=1
2062 if test "$MOZ_IOS"; then
2068 MOZ_SAMPLE_TYPE_FLOAT32=
2069 MOZ_SAMPLE_TYPE_S16=
2073 MOZ_WEBRTC_SIGNALING=
2074 MOZ_WEBRTC_ASSERT_ALWAYS=1
2075 MOZ_WEBRTC_HARDWARE_AEC_NS=
2083 LIBJPEG_TURBO_ASFLAGS=
2084 MOZ_PREF_EXTENSIONS=1
2087 MOZ_TOOLKIT_SEARCH=1
2089 MOZ_UNIVERSALCHARDET=1
2094 MOZ_USE_NATIVE_POPUP_WINDOWS=
2095 MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
2098 MOZ_CONTENT_SANDBOX=
2101 MOZ_BINARY_EXTENSIONS=
2104 case "$target_os" in
2107 AC_DEFINE(NS_ENABLE_TSF)
2112 *-android*|*-linuxandroid*)
2118 # Optional Firefox for Android partner distribution directory.
2119 MOZ_ARG_WITH_STRING(android-distribution-directory,
2120 [ --with-android-distribution-directory=dir
2121 Optional Firefox for Android partner distribution directory.],
2122 MOZ_ANDROID_DISTRIBUTION_DIRECTORY=$withval)
2124 if test -n "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY"; then
2125 # A distribution directory must have an assets/distribution directory.
2126 # See https://wiki.mozilla.org/Mobile/Distribution_Files.
2127 if test ! -d "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY/assets/distribution" ; then
2128 AC_MSG_ERROR([--with-android-distribution-directory does not contain assets/distribution;
2129 (looked for ${MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets/distribution).])
2132 AC_SUBST(MOZ_ANDROID_DISTRIBUTION_DIRECTORY)
2134 dnl ========================================================
2135 dnl = Trademarked Branding
2136 dnl ========================================================
2137 MOZ_ARG_ENABLE_BOOL(official-branding,
2138 [ --enable-official-branding
2139 Enable Official mozilla.org Branding
2140 Do not distribute builds with
2141 --enable-official-branding unless you have
2142 permission to use trademarks per
2143 http://www.mozilla.org/foundation/trademarks/ .],
2144 MOZ_OFFICIAL_BRANDING=1,
2145 MOZ_OFFICIAL_BRANDING=)
2147 # Allow the application to influence configure with a confvars.sh script.
2148 AC_MSG_CHECKING([if app-specific confvars.sh exists])
2149 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
2150 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
2151 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
2156 # Allow influencing configure with a defines.sh script.
2157 . "${srcdir}/build/defines.sh"
2159 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
2161 if test "$BUILDING_RELEASE"; then
2162 # Override value in defines.sh, if any
2163 EARLY_BETA_OR_EARLIER=
2164 elif test "$EARLY_BETA_OR_EARLIER"; then
2165 AC_DEFINE(EARLY_BETA_OR_EARLIER)
2167 AC_SUBST(EARLY_BETA_OR_EARLIER)
2169 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
2170 MOZ_ARG_WITH_STRING(app-name,
2171 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
2172 WITH_APP_NAME=$withval,
2175 if test -n "$WITH_APP_NAME" ; then
2176 MOZ_APP_NAME="$WITH_APP_NAME"
2179 MOZ_ARG_WITH_STRING(app-basename,
2180 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
2181 WITH_APP_BASENAME=$withval,
2184 if test -n "$WITH_APP_BASENAME" ; then
2185 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
2188 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
2189 # that haven't made a confvars.sh yet. Don't add new stuff here, use
2191 case "$MOZ_BUILD_APP" in
2193 AC_DEFINE(MOZ_PHOENIX)
2197 AC_DEFINE(MOZ_XULRUNNER)
2201 # Graphene is a desktop runtime for running applications with a HTML UI.
2202 if test -n "$MOZ_GRAPHENE"; then
2203 AC_DEFINE(MOZ_GRAPHENE)
2206 if test -n "$MOZ_MULET"; then
2207 AC_DEFINE(MOZ_MULET)
2210 # Propagate feature switches for code written in rust from confvars.sh
2211 if test -n "$MOZ_RUST_URLPARSE"; then
2212 AC_DEFINE(MOZ_RUST_URLPARSE)
2213 AC_SUBST(MOZ_RUST_URLPARSE)
2216 AC_SUBST(MOZ_PHOENIX)
2217 AC_SUBST(MOZ_XULRUNNER)
2220 dnl ========================================================
2221 dnl Ensure Android SDK and build-tools versions depending on
2223 dnl ========================================================
2225 case "$MOZ_BUILD_APP" in
2227 MOZ_ANDROID_SDK(23, 23, 23.0.3 23.0.1, 25.3.2 25.3.1)
2231 dnl ========================================================
2233 dnl = Toolkit Options
2235 dnl ========================================================
2236 MOZ_ARG_HEADER(Toolkit Options)
2238 dnl ========================================================
2239 dnl = Enable the toolkit as needed =
2240 dnl ========================================================
2242 case "$MOZ_WIDGET_TOOLKIT" in
2245 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
2246 # Use -Wl as a trick to avoid -framework and framework names from
2247 # being separated by AC_SUBST_LIST.
2248 TK_LIBS='-Wl,-framework,CoreLocation -Wl,-framework,QuartzCore -Wl,-framework,Carbon -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit -Wl,-framework,AddressBook -Wl,-framework,OpenGL -Wl,-framework,Security -Wl,-framework,ServiceManagement'
2250 CFLAGS="$CFLAGS $TK_CFLAGS"
2251 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
2252 MOZ_USER_DIR="Mozilla"
2253 MOZ_FS_LAYOUT=bundle
2257 LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
2259 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'
2260 CFLAGS="$CFLAGS $TK_CFLAGS"
2261 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
2262 MOZ_USER_DIR="Mozilla"
2263 MOZ_FS_LAYOUT=bundle
2268 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
2269 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
2270 case "$MOZ_WIDGET_TOOLKIT" in
2276 if test "$COMPILE_ENVIRONMENT"; then
2277 if test "$MOZ_WIDGET_TOOLKIT" = gtk3; then
2278 PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
2279 MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
2280 TK_CFLAGS=$MOZ_GTK3_CFLAGS
2281 TK_LIBS=$MOZ_GTK3_LIBS
2282 dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
2283 dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
2284 AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
2285 GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32
2287 if test "$MOZ_WIDGET_TOOLKIT" = gtk2; then
2288 GLIB_VERSION_MAX_ALLOWED=$GLIB_VERSION_MIN_REQUIRED
2290 if test "$MOZ_ENABLE_GTK"; then
2291 if test "$MOZ_X11"; then
2292 GDK_PACKAGES=gdk-x11-2.0
2294 AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
2295 AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
2297 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 >= $GLIB_VERSION gobject-2.0 $GDK_PACKAGES)
2298 MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
2300 if test "$MOZ_WIDGET_TOOLKIT" = gtk2; then
2301 TK_CFLAGS=$MOZ_GTK2_CFLAGS
2302 TK_LIBS=$MOZ_GTK2_LIBS
2304 fi # COMPILE_ENVIRONMENT
2306 AC_SUBST(MOZ_FS_LAYOUT)
2308 dnl ========================================================
2309 dnl = startup-notification support module
2310 dnl ========================================================
2312 if test "$MOZ_ENABLE_GTK"
2314 MOZ_ENABLE_STARTUP_NOTIFICATION=
2316 MOZ_ARG_ENABLE_BOOL(startup-notification,
2317 [ --enable-startup-notification
2318 Enable startup-notification support (default: disabled) ],
2319 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
2320 MOZ_ENABLE_STARTUP_NOTIFICATION=)
2321 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
2323 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
2324 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
2325 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
2326 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
2328 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
2330 MOZ_ENABLE_STARTUP_NOTIFICATION=
2334 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
2335 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
2338 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
2340 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
2342 AC_SUBST_LIST(TK_CFLAGS)
2343 AC_SUBST_LIST(TK_LIBS)
2348 dnl ========================================================
2350 dnl = Components & Features
2352 dnl ========================================================
2353 MOZ_ARG_HEADER(Components and Features)
2355 dnl ========================================================
2357 dnl ========================================================
2358 MOZ_ARG_ENABLE_STRING(ui-locale,
2359 [ --enable-ui-locale=ab-CD
2360 Select the user interface locale (default: en-US)],
2361 MOZ_UI_LOCALE=$enableval )
2362 AC_SUBST(MOZ_UI_LOCALE)
2364 AC_SUBST(MOZ_OFFICIAL_BRANDING)
2365 if test -n "$MOZ_OFFICIAL_BRANDING"; then
2366 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
2367 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
2369 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
2370 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
2374 MOZ_ARG_WITH_STRING(branding,
2375 [ --with-branding=dir Use branding from the specified directory.],
2376 MOZ_BRANDING_DIRECTORY=$withval)
2378 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
2379 if test -z "$REAL_BRANDING_DIRECTORY"; then
2380 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
2383 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
2384 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
2385 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
2386 . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
2389 AC_SUBST(MOZ_BRANDING_DIRECTORY)
2391 dnl ========================================================
2392 dnl = Distribution ID
2393 dnl ========================================================
2394 MOZ_ARG_WITH_STRING(distribution-id,
2395 [ --with-distribution-id=ID
2396 Set distribution-specific id (default=org.mozilla)],
2397 [ val=`echo $withval`
2398 MOZ_DISTRIBUTION_ID="$val"])
2400 if test -z "$MOZ_DISTRIBUTION_ID"; then
2401 MOZ_DISTRIBUTION_ID="org.mozilla"
2404 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
2405 AC_SUBST(MOZ_DISTRIBUTION_ID)
2408 dnl ========================================================
2409 dnl Google Play Services, placed here so it can depend on
2410 dnl values set by configure.sh above.
2411 dnl ========================================================
2413 MOZ_ANDROID_GOOGLE_PLAY_SERVICES
2414 MOZ_ANDROID_GOOGLE_CLOUD_MESSAGING
2415 MOZ_ANDROID_INSTALL_TRACKING
2418 dnl ========================================================
2419 dnl = GConf support module
2420 dnl ========================================================
2424 if test "$MOZ_ENABLE_GTK"
2429 dnl ========================================================
2430 dnl = GConf support module
2431 dnl ========================================================
2432 MOZ_ARG_DISABLE_BOOL(gconf,
2433 [ --disable-gconf Disable Gconf support ],
2437 if test "$MOZ_ENABLE_GCONF"
2439 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
2440 MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
2443 if test -n "$MOZ_ENABLE_GCONF";
2445 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
2447 AC_MSG_WARN([Many automated tests will fail with --disable-gconf. See bug 1167201.])
2452 if test "$MOZ_ENABLE_GCONF"; then
2453 AC_DEFINE(MOZ_ENABLE_GCONF)
2456 AC_SUBST(MOZ_ENABLE_GCONF)
2459 dnl ========================================================
2460 dnl = libproxy support
2461 dnl ========================================================
2463 if test "$MOZ_ENABLE_GTK"
2465 MOZ_ENABLE_LIBPROXY=
2467 MOZ_ARG_ENABLE_BOOL(libproxy,
2468 [ --enable-libproxy Enable libproxy support ],
2469 MOZ_ENABLE_LIBPROXY=1,
2470 MOZ_ENABLE_LIBPROXY=)
2472 if test "$MOZ_ENABLE_LIBPROXY"
2474 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
2475 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
2478 AC_SUBST(MOZ_ENABLE_LIBPROXY)
2480 dnl ========================================================
2482 dnl ========================================================
2484 if test "$MOZ_ENABLE_GTK"
2488 MOZ_ARG_DISABLE_BOOL(dbus,
2489 [ --disable-dbus Disable dbus support ],
2493 if test "$MOZ_ENABLE_DBUS"
2495 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
2496 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
2497 AC_DEFINE(MOZ_ENABLE_DBUS)
2500 AC_SUBST(MOZ_ENABLE_DBUS)
2502 dnl =========================================================
2503 dnl = Whether to exclude hyphenations files in the build
2504 dnl =========================================================
2505 if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
2506 AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
2509 dnl ========================================================
2510 dnl accessibility support on by default on all platforms
2511 dnl ========================================================
2512 MOZ_ARG_DISABLE_BOOL(accessibility,
2513 [ --disable-accessibility Disable accessibility support],
2516 if test "$ACCESSIBILITY"; then
2519 if test -z "$MIDL"; then
2520 if test "$GCC" != "yes"; then
2521 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
2523 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.])
2527 AC_DEFINE(ACCESSIBILITY)
2530 dnl ========================================================
2531 dnl Accessibility is required for the linuxgl widget
2533 dnl ========================================================
2534 if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
2535 AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
2538 dnl Turn off webrtc for OS's we don't handle yet, but allow
2539 dnl --enable-webrtc to override. Can disable for everything in
2540 dnl the master list above.
2541 if test -n "$MOZ_WEBRTC"; then
2543 *-linux*|*-mingw*|*-darwin*|*-android*|*-linuxandroid*|*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*)
2547 dnl default to disabled for all others
2553 AC_TRY_COMPILE([#include <linux/ethtool.h>],
2554 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
2555 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
2557 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
2559 # target_arch is from {ia32|x64|arm|ppc}
2561 x86_64 | arm | aarch64 | x86 | ppc* | ia64)
2565 # unsupported arch for webrtc
2571 dnl ========================================================
2572 dnl = Disable WebRTC code
2573 dnl ========================================================
2574 MOZ_ARG_DISABLE_BOOL(webrtc,
2575 [ --disable-webrtc Disable support for WebRTC],
2579 if test -n "$MOZ_WEBRTC"; then
2580 AC_DEFINE(MOZ_WEBRTC)
2581 dnl MOZ_WEBRTC_ASSERT_ALWAYS turns on a number of safety asserts in
2582 dnl opt/production builds (via MOZ_CRASH())
2583 AC_DEFINE(MOZ_WEBRTC_ASSERT_ALWAYS)
2586 dnl enable once Signaling lands
2587 MOZ_WEBRTC_SIGNALING=1
2588 AC_DEFINE(MOZ_WEBRTC_SIGNALING)
2589 dnl enable once PeerConnection lands
2590 MOZ_PEERCONNECTION=1
2591 AC_DEFINE(MOZ_PEERCONNECTION)
2596 if test -n "$MOZ_X11"; then
2597 MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
2603 dnl ========================================================
2604 dnl = Force hardware AEC, disable webrtc.org AEC
2605 dnl ========================================================
2606 MOZ_ARG_ENABLE_BOOL(hardware-aec-ns,
2607 [ --enable-hardware-aec-ns Enable support for hardware AEC and noise suppression],
2608 MOZ_WEBRTC_HARDWARE_AEC_NS=1,
2609 MOZ_WEBRTC_HARDWARE_AEC_NS=)
2611 if test -n "$MOZ_WEBRTC_HARDWARE_AEC_NS"; then
2612 AC_DEFINE(MOZ_WEBRTC_HARDWARE_AEC_NS)
2615 AC_SUBST(MOZ_WEBRTC)
2616 AC_SUBST(MOZ_WEBRTC_SIGNALING)
2617 AC_SUBST(MOZ_PEERCONNECTION)
2618 AC_SUBST(MOZ_WEBRTC_ASSERT_ALWAYS)
2619 AC_SUBST(MOZ_WEBRTC_HARDWARE_AEC_NS)
2622 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
2624 dnl Use integers over floats for audio on B2G and Android
2625 dnl (regarless of the CPU architecture, because audio
2626 dnl backends for those platforms don't support floats. We also
2627 dnl use integers on ARM with other OS, because it's more efficient.
2628 if test "$OS_TARGET" = "Android" -o "$CPU_ARCH" = "arm"; then
2629 MOZ_SAMPLE_TYPE_S16=1
2630 AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
2631 AC_SUBST(MOZ_SAMPLE_TYPE_S16)
2633 MOZ_SAMPLE_TYPE_FLOAT32=1
2634 AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
2635 AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
2638 dnl ========================================================
2639 dnl = Enable Raw Codecs
2640 dnl ========================================================
2641 MOZ_ARG_ENABLE_BOOL(raw,
2642 [ --enable-raw Enable support for RAW media],
2646 if test -n "$MOZ_RAW"; then
2652 dnl ========================================================
2653 dnl = Apple platform decoder support
2654 dnl ========================================================
2655 if test "$COMPILE_ENVIRONMENT"; then
2656 if test -n "$MOZ_APPLEMEDIA"; then
2657 # hack in frameworks for fmp4 - see bug 1029974
2658 # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
2659 LDFLAGS="$LDFLAGS -framework AudioToolbox"
2660 dnl Verify CoreMedia is available.
2661 AC_CHECK_HEADER([CoreMedia/CoreMedia.h], [],
2662 [AC_MSG_ERROR([MacOS X 10.7 SDK or later is required])])
2664 fi # COMPILE_ENVIRONMENT
2666 dnl system libvpx Support
2667 dnl ========================================================
2668 MOZ_ARG_WITH_BOOL(system-libvpx,
2669 [ --with-system-libvpx Use system libvpx (located with pkgconfig)],
2670 MOZ_SYSTEM_LIBVPX=1)
2675 _SAVE_CFLAGS=$CFLAGS
2677 if test -n "$MOZ_SYSTEM_LIBVPX"; then
2678 dnl ============================
2679 dnl === libvpx Version check ===
2680 dnl ============================
2681 dnl Check to see if we have a system libvpx package.
2682 PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.5.0)
2684 CFLAGS="$CFLAGS $MOZ_LIBVPX_CFLAGS"
2685 LIBS="$LIBS $MOZ_LIBVPX_LIBS"
2687 MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
2688 [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.])])
2690 AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
2691 [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
2693 MOZ_CHECK_HEADER([vpx_mem/vpx_mem.h],
2694 [AC_CHECK_FUNC(vpx_mem_set_functions)])
2695 if test "$ac_cv_header_vpx_mem_vpx_mem_h" = no -o \
2696 "$ac_cv_func_vpx_mem_set_functions" = no; then
2697 AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
2700 CFLAGS=$_SAVE_CFLAGS
2703 AC_SUBST(MOZ_SYSTEM_LIBVPX)
2704 AC_SUBST_LIST(MOZ_LIBVPX_CFLAGS)
2705 AC_SUBST_LIST(MOZ_LIBVPX_LIBS)
2707 if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
2713 if test -z "$MOZ_SYSTEM_LIBVPX"; then
2715 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
2716 dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
2717 dnl We currently require gcc on all arm platforms.
2719 dnl See if we have assembly on this platform.
2720 case "$OS_ARCH:$CPU_ARCH" in
2734 dnl Check for yasm 1.1 or greater.
2735 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
2736 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.])
2737 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
2738 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.])
2742 dnl The encoder needs obj_int_extract to get asm offsets.
2743 fi # COMPILE_ENVIRONMENT and others
2746 if test -n "$GNU_AS" ; then
2747 dnl These flags are a lie; they're just used to enable the requisite
2748 dnl opcodes; actual arch detection is done at runtime.
2749 VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
2750 VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/libvpx/build/make/ads2gas.pl'
2752 dnl Building with -mfpu=neon requires either the "softfp" or the
2753 dnl "hardfp" ABI. Depending on the compiler's default target, and the
2754 dnl CFLAGS, the default ABI might be neither, in which case it is the
2755 dnl "softfloat" ABI.
2756 dnl The "softfloat" ABI is binary-compatible with the "softfp" ABI, so
2757 dnl we can safely mix code built with both ABIs. So, if we detect
2758 dnl that compiling uses the "softfloat" ABI, force the use of the
2759 dnl "softfp" ABI instead.
2760 dnl Confusingly, the __SOFTFP__ preprocessor variable indicates the
2761 dnl "softfloat" ABI, not the "softfp" ABI.
2762 dnl Note: VPX_ASFLAGS is also used in CFLAGS.
2765 #error "compiler target supports -mfpu=neon, so we don't have to add extra flags"
2767 VPX_ASFLAGS="$VPX_ASFLAGS -mfloat-abi=softfp"
2772 if $CC -E -dM -</dev/null | grep -q __ELF__; then
2778 if $CC -E -dM -</dev/null | grep -q __ELF__; then
2785 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_USE_YASM" -a -z "$YASM"; then
2786 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.])
2787 fi # COMPILE_ENVIRONMENT and others
2789 if test -n "$VPX_USE_YASM" && test "$OS_ARCH:$CPU_ARCH" != "WINNT:x86_64"; then
2793 if test -n "$VPX_X86_ASM"; then
2794 AC_DEFINE(VPX_X86_ASM)
2795 elif test -n "$VPX_ARM_ASM"; then
2796 AC_DEFINE(VPX_ARM_ASM)
2798 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
2801 dnl native libvpx no longer has vpx_mem_set_functions
2802 AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
2805 dnl ========================================================
2806 dnl = Handle dependent MEDIA defines
2807 dnl ========================================================
2809 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
2810 AC_MSG_ERROR([MOZ_VORBIS and MOZ_TREMOR are mutually exclusive! The build system should not allow them both to be set, but they are. Please file a bug at https://bugzilla.mozilla.org/])
2813 if test -n "$MOZ_VORBIS"; then
2814 AC_DEFINE(MOZ_VORBIS)
2817 if test -n "$MOZ_TREMOR"; then
2818 AC_DEFINE(MOZ_TREMOR)
2822 AC_DEFINE(MOZ_WEBM_ENCODER)
2823 AC_SUBST(MOZ_WEBM_ENCODER)
2825 dnl ==================================
2826 dnl = Check alsa availability on Linux
2827 dnl ==================================
2829 MOZ_ARG_ENABLE_BOOL(alsa,
2830 [ --enable-alsa Enable Alsa support],
2834 if test -n "$MOZ_ALSA"; then
2835 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
2836 [echo "$MOZ_ALSA_PKG_ERRORS"
2837 AC_MSG_ERROR([Need alsa for audio output on Linux. (On Ubuntu, you might try installing the package libasound2-dev.)])])
2842 dnl ========================================================
2843 dnl = Disable PulseAudio
2844 dnl ========================================================
2846 dnl If using Desktop Linux, ensure that the PA library is available
2847 case "$OS_TARGET" in
2848 WINNT|Darwin|Android|OpenBSD)
2855 MOZ_ARG_DISABLE_BOOL(pulseaudio,
2856 [ --disable-pulseaudio Disable PulseAudio support],
2860 if test -n "$MOZ_PULSEAUDIO"; then
2861 AC_DEFINE(MOZ_PULSEAUDIO)
2862 PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
2863 [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
2864 AC_MSG_ERROR([pulseaudio audio backend requires libpulse development package])])
2867 AC_SUBST(MOZ_PULSEAUDIO)
2869 dnl ========================================================
2871 dnl ========================================================
2873 MOZ_ARG_DISABLE_BOOL(negotiateauth,
2874 [ --disable-negotiateauth Disable GSS-API negotiation ],
2875 MOZ_AUTH_EXTENSION=,
2876 MOZ_AUTH_EXTENSION=1 )
2878 if test -n "$MOZ_IOS" -a -n "$MOZ_AUTH_EXTENSION"; then
2879 AC_MSG_ERROR([negotiateauth is not supported on iOS.])
2882 dnl ========================================================
2883 dnl Pref extensions (autoconfig)
2884 dnl ========================================================
2885 MOZ_ARG_DISABLE_BOOL(pref-extensions,
2886 [ --disable-pref-extensions
2887 Disable pref extensions such as autoconfig],
2888 MOZ_PREF_EXTENSIONS=,
2889 MOZ_PREF_EXTENSIONS=1 )
2891 dnl ========================================================
2892 dnl Searching of system directories for extensions.
2893 dnl Note: this switch is meant to be used for test builds
2894 dnl whose behavior should not depend on what happens to be
2895 dnl installed on the local machine.
2896 dnl ========================================================
2897 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
2898 [ --disable-system-extension-dirs
2899 Disable searching system- and account-global
2900 directories for extensions of any kind; use
2901 only profile-specific extension directories],
2902 ENABLE_SYSTEM_EXTENSION_DIRS=,
2903 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
2904 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
2905 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
2908 dnl ========================================================
2909 dnl = Universalchardet
2910 dnl ========================================================
2911 MOZ_ARG_DISABLE_BOOL(universalchardet,
2912 [ --disable-universalchardet
2913 Disable universal encoding detection],
2914 MOZ_UNIVERSALCHARDET=,
2915 MOZ_UNIVERSALCHARDET=1 )
2917 dnl ========================================================
2918 dnl = ANGLE OpenGL->D3D translator for WebGL
2919 dnl = * only applies to win32 (and then, not MINGW)
2920 dnl ========================================================
2924 MOZ_HAS_WINSDK_WITH_D3D=
2925 MOZ_D3DCOMPILER_VISTA_DLL=
2926 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
2928 if test "$COMPILE_ENVIRONMENT" ; then
2929 case "$target_os" in
2931 MOZ_ANGLE_RENDERER=1
2935 # The DirectX SDK libraries are split into x86 and x64 sub-directories
2936 case "${target_cpu}" in
2938 MOZ_D3D_CPU_SUFFIX=x86
2941 MOZ_D3D_CPU_SUFFIX=x64
2945 dnl ========================================================
2946 dnl D3D compiler DLL
2947 dnl ========================================================
2948 MOZ_FOUND_D3D_COMPILERS=
2950 if test -n "$MOZ_ANGLE_RENDERER"; then
2951 if test -z "$MOZ_D3D_CPU_SUFFIX"; then
2952 AC_MSG_ERROR([Couldn't determine MOZ_D3D_CPU_SUFFIX.])
2955 ######################################
2956 # Find _46+ for use by Vista+.
2958 # Find a D3D compiler DLL in a Windows SDK.
2959 MOZ_D3DCOMPILER_VISTA_DLL=
2960 case "$MOZ_WINSDK_MAXVER" in
2962 MOZ_D3DCOMPILER_VISTA_DLL=d3dcompiler_47.dll
2963 AC_MSG_RESULT([Found D3D compiler in Windows SDK.])
2967 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
2968 # We have a name, now track down the path.
2969 if test -n "$WINDOWSSDKDIR"; then
2970 MOZ_D3DCOMPILER_VISTA_DLL_PATH="$WINDOWSSDKDIR/Redist/D3D/$MOZ_D3D_CPU_SUFFIX/$MOZ_D3DCOMPILER_VISTA_DLL"
2971 if test -f "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
2972 AC_MSG_RESULT([Found MOZ_D3DCOMPILER_VISTA_DLL_PATH: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
2973 MOZ_HAS_WINSDK_WITH_D3D=1
2975 AC_MSG_RESULT([MOZ_D3DCOMPILER_VISTA_DLL_PATH doesn't exist: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
2976 AC_MSG_ERROR([Windows SDK at "$WINDOWSSDKDIR" appears broken. Try updating to MozillaBuild 1.9 final or higher.])
2977 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
2980 AC_MSG_RESULT([Windows SDK not found.])
2983 if test "$OS_ARCH" = "$HOST_OS_ARCH"; then
2984 AC_MSG_ERROR([Couldn't find Windows SDK 8.1 or higher needed for ANGLE.])
2986 AC_MSG_RESULT([Windows SDK not needed for ANGLE in Linux MinGW build.])
2990 if test -z "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
2991 MOZ_D3DCOMPILER_VISTA_DLL=
2994 # On mingw, check if headers are provided by toolchain.
2995 if test -n "$GNU_CC"; then
2996 MOZ_CHECK_HEADER(d3d10.h, MOZ_HAS_WINSDK_WITH_D3D=1)
2999 ######################################
3000 # Check that we found what we needed.
3001 MOZ_FOUND_A_D3D_COMPILER=
3003 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
3004 MOZ_FOUND_A_D3D_COMPILER=1
3005 AC_MSG_RESULT([Found d3dcompiler DLL for Vista+: $MOZ_D3DCOMPILER_VISTA_DLL])
3008 if test -z "$CROSS_COMPILE"; then
3009 if test -z "MOZ_FOUND_A_D3D_COMPILER"; then
3010 AC_MSG_ERROR([Couldn't find an acceptable D3D compiler DLL.])
3013 fi # MOZ_ANGLE_RENDERER
3015 fi # COMPILE_ENVIRONMENT
3018 dnl ========================================================
3020 dnl ========================================================
3021 MOZ_GAMEPAD_BACKEND=stub
3023 case "$OS_TARGET" in
3025 if test -z "$MOZ_IOS"; then
3026 MOZ_GAMEPAD_BACKEND=cocoa
3030 MOZ_GAMEPAD_BACKEND=windows
3033 MOZ_CHECK_HEADER([linux/joystick.h])
3034 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
3035 AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
3037 MOZ_GAMEPAD_BACKEND=linux
3040 MOZ_GAMEPAD_BACKEND=android
3046 AC_SUBST(MOZ_GAMEPAD_BACKEND)
3048 dnl ========================================================
3049 dnl = Breakpad crash reporting (on by default on supported platforms)
3050 dnl ========================================================
3053 i?86-*-mingw*|x86_64-*-mingw*)
3056 i?86-apple-darwin*|x86_64-apple-darwin*)
3057 if test -z "$MOZ_IOS"; then
3061 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
3062 if test "$MOZ_ENABLE_GTK"; then
3066 *-android*|*-linuxandroid*)
3071 MOZ_ARG_DISABLE_BOOL(crashreporter,
3072 [ --disable-crashreporter Disable breakpad crash reporting],
3073 [MOZ_CRASHREPORTER=],
3074 [MOZ_CRASHREPORTER=F # Force enable breakpad])
3076 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin"; then
3077 if test "$MOZ_CRASHREPORTER" = F; then
3078 AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
3083 if test -n "$MOZ_CRASHREPORTER"; then
3084 AC_DEFINE(MOZ_CRASHREPORTER)
3086 if test "$OS_TARGET" = "Linux" && \
3087 test -z "$SKIP_LIBRARY_CHECKS"; then
3088 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
3091 if test "$OS_ARCH" = "WINNT"; then
3092 if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
3093 MOZ_CRASHREPORTER_INJECTOR=1
3094 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
3099 dnl ========================================================
3100 dnl = libjpeg-turbo configuration
3101 dnl ========================================================
3103 LIBJPEG_TURBO_USE_YASM=
3104 if test -z "$MOZ_SYSTEM_JPEG"; then
3108 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
3109 [ --disable-libjpeg-turbo Disable optimized jpeg decoding routines],
3111 MOZ_LIBJPEG_TURBO=1)
3113 if test "$MOZ_SYSTEM_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
3114 AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
3117 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
3120 if test -n "$MOZ_LIBJPEG_TURBO" -a -n "$COMPILE_ENVIRONMENT"; then
3122 dnl Do we support libjpeg-turbo on this platform?
3123 case "$OS_ARCH:$CPU_ARCH" in
3125 LIBJPEG_TURBO_ASFLAGS="-DPIC -DMACHO"
3128 LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DMACHO"
3133 LIBJPEG_TURBO_ASFLAGS="-DPIC -DWIN32"
3136 LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DWIN64 -DMSVC"
3139 LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
3142 LIBJPEG_TURBO_ASFLAGS="-march=armv8-a"
3145 LIBJPEG_TURBO_ASFLAGS="-mdspr2"
3148 if $CC -E -dM -</dev/null | grep -q __ELF__; then
3149 LIBJPEG_TURBO_ASFLAGS="-DPIC -DELF"
3153 if $CC -E -dM -</dev/null | grep -q __ELF__; then
3154 LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DELF"
3160 if test -n "$LIBJPEG_TURBO_ASFLAGS"; then
3162 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
3163 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
3164 dnl it doesn't exist or we have too old of a version.
3166 LIBJPEG_TURBO_USE_YASM=1
3168 if test -z "$YASM" ; then
3169 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.])
3172 dnl Check that we have the right yasm version. We require 1.0.1 or newer
3173 dnl on Linux and 1.1 or newer everywhere else.
3174 if test "$OS_ARCH" = "Linux" ; then
3175 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
3176 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.])
3179 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
3180 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.])
3187 dnl ========================================================
3188 dnl = libav-fft configuration
3189 dnl ========================================================
3193 dnl Turn on libav-fft for 32-bit windows, and all 64-bit supported platforms.
3194 dnl 32-bit linux/os x have text relocation issues.
3196 case "$OS_ARCH:$CPU_ARCH" in
3205 dnl Detect if we can use yasm to compile libav's assembly
3207 if test -n "$MOZ_LIBAV_FFT" -a -n "$COMPILE_ENVIRONMENT"; then
3208 AC_DEFINE(MOZ_LIBAV_FFT)
3209 dnl Do we support libav-fft on this platform?
3210 case "$OS_ARCH:$CPU_ARCH" in
3212 LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DMACHO"
3215 LIBAV_FFT_ASFLAGS="-DPIC -DWIN32"
3218 LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DWIN64 -DMSVC"
3221 if $CC -E -dM -</dev/null | grep -q __ELF__; then
3222 LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DELF"
3226 AC_MSG_ERROR([libav's FFT routines are only available for 32-bit windows or 64-bit x86 based platforms.])
3231 if test -n "$LIBAV_FFT_ASFLAGS"; then
3232 dnl If we're on an x86 or x64 system which supports libav-fft's asm routines
3233 dnl check for Yasm, and error out if it doesn't exist or we have too old of a
3235 if test -z "$YASM" ; then
3236 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.])
3238 dnl Check that we have the right yasm version. We require 1.0.1 or newer
3239 dnl on Linux and 1.1 or newer everywhere else.
3240 if test "$OS_ARCH" = "Linux" ; then
3241 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
3242 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.])
3245 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
3246 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.])
3249 elif test -n "$MOZ_LIBAV_FFT" -a "${CPU_ARCH}" != "arm"; then
3250 dnl Warn if we're not building either libav or opendl-max optimized routines.
3251 AC_MSG_WARN([No assembler or assembly support for libav-fft. Using unoptimized C routines.])
3254 dnl ========================================================
3255 dnl = FFmpeg's ffvpx configuration
3256 dnl ========================================================
3268 dnl Use same conditional as MOZ_LIBAV_FFT to enable FFmpeg's ffvpx assembly decoder.
3269 if test -n "$MOZ_LIBAV_FFT"; then
3270 FFVPX_ASFLAGS=$LIBAV_FFT_ASFLAGS
3272 if test -n "$MOZ_FFVPX"; then
3273 AC_DEFINE(MOZ_FFVPX)
3276 dnl ========================================================
3277 dnl = Enable compilation of specific extension modules
3278 dnl ========================================================
3280 MOZ_ARG_ENABLE_STRING(extensions,
3281 [ --enable-extensions Enable extensions],
3282 [ for option in `echo $enableval | sed 's/,/ /g'`; do
3283 if test "$option" = "yes" -o "$option" = "all"; then
3284 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
3285 elif test "$option" = "no" -o "$option" = "none"; then
3287 elif test "$option" = "default"; then
3288 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
3289 elif test `echo "$option" | grep -c \^-` != 0; then
3290 option=`echo $option | sed 's/^-//'`
3291 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
3293 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
3296 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
3298 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
3299 dnl when trying to build a nonexistent extension.
3300 for extension in $MOZ_EXTENSIONS; do
3301 if test ! -d "${srcdir}/extensions/${extension}"; then
3302 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
3306 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
3307 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
3310 # Avoid defining MOZ_ENABLE_CAIRO_FT on Windows platforms because
3311 # "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
3312 if test -n "$MOZ_TREE_FREETYPE" -a "$OS_TARGET" != WINNT; then
3313 MOZ_ENABLE_CAIRO_FT=1
3314 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
3315 CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
3316 AC_SUBST_LIST(CAIRO_FT_CFLAGS)
3319 AC_CHECK_PROGS(WGET, wget, "")
3322 dnl ========================================================
3323 dnl Maintenance Service
3324 dnl ========================================================
3326 MOZ_ARG_ENABLE_BOOL(maintenance-service,
3327 [ --enable-maintenance-service Enable building of maintenanceservice],
3328 MOZ_MAINTENANCE_SERVICE=1,
3329 MOZ_MAINTENANCE_SERVICE= )
3331 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
3332 if test "$OS_ARCH" = "WINNT"; then
3333 AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
3335 AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
3339 dnl ========================================================
3340 dnl Bundled fonts on desktop platforms
3341 dnl ========================================================
3343 MOZ_ARG_ENABLE_BOOL(bundled-fonts,
3344 [ --enable-bundled-fonts Enable support for bundled fonts on desktop platforms],
3345 MOZ_BUNDLED_FONTS=1,
3348 if test -n "$MOZ_BUNDLED_FONTS"; then
3349 AC_DEFINE(MOZ_BUNDLED_FONTS)
3352 dnl ========================================================
3353 dnl Verify MAR signatures
3354 dnl ========================================================
3356 MOZ_ARG_ENABLE_BOOL(verify-mar,
3357 [ --enable-verify-mar Enable verifying MAR signatures],
3358 MOZ_VERIFY_MAR_SIGNATURE=1,
3359 MOZ_VERIFY_MAR_SIGNATURE= )
3361 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
3362 AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
3365 dnl ========================================================
3366 dnl Enable building the signmar program.
3367 dnl This option is much different than the --enable-verify-mar option.
3368 dnl --enable-verify-mar is for enabling the verification check on MAR
3369 dnl files in the updater. The --enable-signmar option is for building
3370 dnl the signmar program.
3371 dnl ========================================================
3373 MOZ_ARG_ENABLE_BOOL(signmar,
3374 [ --enable-signmar Enable building the signmar program],
3375 MOZ_ENABLE_SIGNMAR=1,
3376 MOZ_ENABLE_SIGNMAR= )
3378 if test -n "$MOZ_ENABLE_SIGNMAR"; then
3379 if test -z "$COMPILE_ENVIRONMENT" ; then
3380 AC_MSG_WARN([Cannot --enable-signmar with --disable-compile-environment])
3383 AC_DEFINE(MOZ_ENABLE_SIGNMAR)
3387 dnl ========================================================
3389 dnl ========================================================
3391 if test "$MOZ_IOS"; then
3395 MOZ_ARG_DISABLE_BOOL(updater,
3396 [ --disable-updater Disable building of updater],
3400 if test -n "$MOZ_UPDATER"; then
3401 AC_DEFINE(MOZ_UPDATER)
3404 dnl ========================================================
3405 dnl parental controls (for Windows Vista)
3406 dnl ========================================================
3407 MOZ_ARG_DISABLE_BOOL(parental-controls,
3408 [ --disable-parental-controls
3409 Do not build parental controls],
3410 MOZ_DISABLE_PARENTAL_CONTROLS=1,
3411 MOZ_DISABLE_PARENTAL_CONTROLS=)
3412 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
3413 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
3416 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
3418 dnl ========================================================
3419 dnl = Disable smartcard support
3420 dnl ========================================================
3421 if test -n "$MOZ_NO_SMART_CARDS"; then
3422 AC_DEFINE(MOZ_NO_SMART_CARDS)
3424 AC_SUBST(MOZ_NO_SMART_CARDS)
3426 dnl ========================================================
3427 dnl = Sandboxing support
3428 dnl ========================================================
3429 if test -n "$MOZ_TSAN" -o -n "$MOZ_ASAN"; then
3430 # Bug 1182565: TSan conflicts with sandboxing on Linux.
3431 # Bug 1287971: LSan also conflicts with sandboxing on Linux.
3439 MOZ_ARG_DISABLE_BOOL(sandbox,
3440 [ --disable-sandbox Disable sandboxing support],
3444 dnl ========================================================
3445 dnl = Content process sandboxing
3446 dnl ========================================================
3448 case "$OS_TARGET" in
3450 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3453 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3458 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3464 MOZ_ARG_ENABLE_BOOL(content-sandbox,
3465 [ --enable-content-sandbox Enable sandboxing support for content-processes
3466 --disable-content-sandbox Disable sandboxing support for content-processes],
3467 MOZ_CONTENT_SANDBOX=1,
3468 MOZ_CONTENT_SANDBOX=)
3470 if test -n "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_SANDBOX"; then
3471 AC_MSG_ERROR([--enable-content-sandbox and --disable-sandbox are conflicting options])
3474 if test -n "$MOZ_CONTENT_SANDBOX"; then
3475 AC_DEFINE(MOZ_CONTENT_SANDBOX)
3478 AC_SUBST(MOZ_CONTENT_SANDBOX)
3480 dnl ========================================================
3481 dnl = Gecko Media Plugin sandboxing
3482 dnl ========================================================
3485 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3490 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3495 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3499 if test -n "$MOZ_GMP_SANDBOX"; then
3500 AC_DEFINE(MOZ_GMP_SANDBOX)
3503 AC_SUBST(MOZ_GMP_SANDBOX)
3505 if test -z "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_GMP_SANDBOX"; then
3509 if test -n "$MOZ_SANDBOX"; then
3510 AC_DEFINE(MOZ_SANDBOX)
3513 AC_SUBST(MOZ_SANDBOX)
3516 dnl ========================================================
3518 dnl = Module specific options
3520 dnl ========================================================
3521 MOZ_ARG_HEADER(Individual module options)
3523 dnl ========================================================
3524 dnl = Disable feed handling components
3525 dnl ========================================================
3526 MOZ_ARG_DISABLE_BOOL(feeds,
3527 [ --disable-feeds Disable feed handling and processing components],
3530 if test -n "$MOZ_FEEDS"; then
3531 AC_DEFINE(MOZ_FEEDS)
3533 if test "$MOZ_BUILD_APP" = "browser"; then
3534 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
3538 dnl ========================================================
3539 dnl Check for sqlite
3540 dnl ========================================================
3543 MOZ_ARG_ENABLE_BOOL(system-sqlite,
3544 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
3545 MOZ_SYSTEM_SQLITE=1,
3546 MOZ_SYSTEM_SQLITE= )
3548 if test -n "$MOZ_SYSTEM_SQLITE"
3550 dnl ============================
3551 dnl === SQLite Version check ===
3552 dnl ============================
3553 dnl Check to see if the system SQLite package is new enough.
3554 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
3556 dnl ==================================
3557 dnl === SQLITE_SECURE_DELETE check ===
3558 dnl ==================================
3559 dnl Check to see if the system SQLite package is compiled with
3560 dnl SQLITE_SECURE_DELETE enabled.
3561 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
3562 _SAVE_CFLAGS="$CFLAGS"
3563 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3565 LIBS="$LIBS $SQLITE_LIBS"
3566 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
3568 #include "sqlite3.h"
3570 int main(int argc, char **argv){
3571 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
3573 ac_cv_sqlite_secure_delete=yes,
3574 ac_cv_sqlite_secure_delete=no,
3575 ac_cv_sqlite_secure_delete=no
3578 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
3579 CFLAGS="$_SAVE_CFLAGS"
3581 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
3582 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
3585 dnl ===============================
3586 dnl === SQLITE_THREADSAFE check ===
3587 dnl ===============================
3588 dnl Check to see if the system SQLite package is compiled with
3589 dnl SQLITE_THREADSAFE enabled.
3590 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
3591 _SAVE_CFLAGS="$CFLAGS"
3592 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3594 LIBS="$LIBS $SQLITE_LIBS"
3595 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
3597 #include "sqlite3.h"
3599 int main(int argc, char **argv){
3600 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
3602 ac_cv_sqlite_threadsafe=yes,
3603 ac_cv_sqlite_threadsafe=no,
3604 ac_cv_sqlite_threadsafe=no
3607 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
3608 CFLAGS="$_SAVE_CFLAGS"
3610 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
3611 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
3614 dnl ================================
3615 dnl === SQLITE_ENABLE_FTS3 check ===
3616 dnl ================================
3617 dnl check to see if the system SQLite package is compiled with
3618 dnl SQLITE_ENABLE_FTS3 enabled.
3619 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
3620 _SAVE_CFLAGS="$CFLAGS"
3621 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3623 LIBS="$LIBS $SQLITE_LIBS"
3624 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
3626 #include "sqlite3.h"
3628 int main(int argc, char **argv){
3629 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
3631 ac_cv_sqlite_enable_fts3=yes,
3632 ac_cv_sqlite_enable_fts3=no,
3633 ac_cv_sqlite_enable_fts3=no
3636 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
3637 CFLAGS="$_SAVE_CFLAGS"
3639 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
3640 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
3643 dnl =========================================
3644 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
3645 dnl =========================================
3646 dnl check to see if the system SQLite package is compiled with
3647 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
3648 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
3649 _SAVE_CFLAGS="$CFLAGS"
3650 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3652 LIBS="$LIBS $SQLITE_LIBS"
3653 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
3655 #include "sqlite3.h"
3657 int main(int argc, char **argv){
3658 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
3660 ac_cv_sqlite_enable_unlock_notify=yes,
3661 ac_cv_sqlite_enable_unlock_notify=no,
3662 ac_cv_sqlite_enable_unlock_notify=no
3665 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
3666 CFLAGS="$_SAVE_CFLAGS"
3668 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
3669 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
3672 dnl =========================================
3673 dnl === SQLITE_ENABLE_DBSTAT_VTAB check ===
3674 dnl =========================================
3675 dnl check to see if the system SQLite package is compiled with
3676 dnl SQLITE_ENABLE_DBSTAT_VTAB.
3677 AC_MSG_CHECKING(for SQLITE_ENABLE_DBSTAT_VTAB support in system SQLite)
3678 _SAVE_CFLAGS="$CFLAGS"
3679 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3681 LIBS="$LIBS $SQLITE_LIBS"
3682 AC_CACHE_VAL(ac_cv_sqlite_dbstat_vtab,[
3684 #include "sqlite3.h"
3686 int main(int argc, char **argv){
3687 return !sqlite3_compileoption_used("SQLITE_ENABLE_DBSTAT_VTAB");
3689 ac_cv_sqlite_dbstat_vtab=yes,
3690 ac_cv_sqlite_dbstat_vtab=no,
3691 ac_cv_sqlite_dbstat_vtab=no
3694 AC_MSG_RESULT($ac_cv_sqlite_dbstat_vtab)
3695 CFLAGS="$_SAVE_CFLAGS"
3697 if test "x$ac_cv_sqlite_dbstat_vtab" = "xno"; then
3698 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_DBSTAT_VTAB.])
3702 if test -n "$MOZ_SYSTEM_SQLITE"; then
3703 AC_DEFINE(MOZ_SYSTEM_SQLITE)
3705 AC_SUBST(MOZ_SYSTEM_SQLITE)
3707 dnl ========================================================
3708 dnl = Disable zipwriter
3709 dnl ========================================================
3710 MOZ_ARG_DISABLE_BOOL(zipwriter,
3711 [ --disable-zipwriter Disable zipwriter component],
3714 AC_SUBST(MOZ_ZIPWRITER)
3716 dnl ========================================================
3718 dnl = Feature options that require extra sources to be pulled
3720 dnl ========================================================
3721 dnl MOZ_ARG_HEADER(Features that require extra sources)
3723 dnl ========================================================
3725 dnl = Runtime debugging and Optimization Options
3727 dnl ========================================================
3728 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
3730 dnl ========================================================
3731 dnl enable mobile optimizations
3732 dnl ========================================================
3733 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
3734 [ --enable-mobile-optimize
3735 Enable mobile optimizations],
3736 MOZ_GFX_OPTIMIZE_MOBILE=1)
3738 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
3740 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
3741 # We ignore paint will resample on mobile for performance.
3742 # We may want to revisit this later.
3743 MOZ_IGNORE_PAINT_WILL_RESAMPLE=1
3745 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
3746 AC_DEFINE(MOZ_IGNORE_PAINT_WILL_RESAMPLE)
3749 dnl ========================================================
3750 dnl = Enable code optimization. ON by default.
3751 dnl ========================================================
3752 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
3753 MOZ_OPTIMIZE_FLAGS="-O"
3756 MOZ_ARG_ENABLE_STRING(optimize,
3757 [ --disable-optimize Disable compiler optimization
3758 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
3759 [ if test "$enableval" != "no"; then
3761 if test -n "$enableval" -a "$enableval" != "yes"; then
3762 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
3767 fi ], MOZ_OPTIMIZE=1)
3769 MOZ_SET_FRAMEPTR_FLAGS
3771 if test "$COMPILE_ENVIRONMENT"; then
3772 if test -n "$MOZ_OPTIMIZE"; then
3773 AC_MSG_CHECKING([for valid C compiler optimization flags])
3774 _SAVE_CFLAGS=$CFLAGS
3775 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
3776 AC_TRY_COMPILE([#include <stdio.h>],
3777 [printf("Hello World\n");],
3780 AC_MSG_RESULT([$_results])
3781 if test "$_results" = "no"; then
3782 AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
3784 CFLAGS=$_SAVE_CFLAGS
3786 fi # COMPILE_ENVIRONMENT
3788 AC_SUBST(MOZ_OPTIMIZE)
3789 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
3790 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
3791 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
3792 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
3794 dnl ========================================================
3795 dnl = Disable treating compiler warnings as errors
3796 dnl ========================================================
3797 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
3798 WARNINGS_AS_ERRORS=''
3801 dnl ========================================================
3802 dnl = Enable runtime logging
3803 dnl ========================================================
3804 AC_DEFINE(MOZ_LOGGING)
3805 AC_DEFINE(FORCE_PR_LOG)
3807 dnl ========================================================
3808 dnl = This will enable logging of addref, release, ctor, dtor.
3809 dnl ========================================================
3810 _ENABLE_LOGREFCNT=42
3811 MOZ_ARG_ENABLE_BOOL(logrefcnt,
3812 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
3813 _ENABLE_LOGREFCNT=1,
3814 _ENABLE_LOGREFCNT= )
3815 if test "$_ENABLE_LOGREFCNT" = "1"; then
3816 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
3817 elif test -z "$_ENABLE_LOGREFCNT"; then
3818 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
3821 dnl ========================================================
3822 dnl moz_dump_painting
3823 dnl ========================================================
3824 MOZ_ARG_ENABLE_BOOL(dump-painting,
3825 [ --enable-dump-painting Enable paint debugging.],
3826 MOZ_DUMP_PAINTING=1,
3827 MOZ_DUMP_PAINTING= )
3828 if test -n "$MOZ_DUMP_PAINTING"; then
3829 AC_DEFINE(MOZ_DUMP_PAINTING)
3830 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
3832 if test -n "$MOZ_DEBUG"; then
3833 AC_DEFINE(MOZ_DUMP_PAINTING)
3836 case "${OS_TARGET}" in
3837 Android|WINNT|Darwin)
3838 MOZ_GLUE_IN_PROGRAM=
3841 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
3842 MOZ_GLUE_IN_PROGRAM=1
3843 AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
3847 dnl ========================================================
3848 dnl = Jemalloc build setup
3849 dnl ========================================================
3850 if test -z "$MOZ_MEMORY"; then
3853 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
3854 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.])
3859 dnl The generic feature tests that determine how to compute ncpus are long and
3860 dnl complicated. Therefore, simply define special cpp variables for the
3861 dnl platforms we have special knowledge of.
3864 export MOZ_NO_DEBUG_RTL=1
3868 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
3870 # Allow the application to provide a subconfigure script.
3871 # This should be after 'export MOZ_NO_DEBUG_RTL=1' since
3872 # ldap/c-sdk/configure refers to the enviroment value.
3873 if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
3874 do_output_subdirs() {
3875 if test -n "$_subconfigure_subdirs"; then
3876 AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
3878 _subconfigure_subdir="$1"
3879 _subconfigure_config_args="$ac_configure_args"
3881 tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
3882 m4 "${srcdir}/build/autoconf/subconfigure.m4" \
3883 "${srcdir}/build/autoconf/altoptions.m4" \
3884 "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
3889 AC_SUBST_LIST(MOZ_GLUE_WRAP_LDFLAGS)
3890 export MOZ_GLUE_WRAP_LDFLAGS
3892 dnl ========================================================
3893 dnl = Enable using the clang plugin to build
3894 dnl ========================================================
3896 if test -n "$COMPILE_ENVIRONMENT"; then
3897 MOZ_CONFIG_CLANG_PLUGIN
3898 fi # COMPILE_ENVIRONMENT
3900 dnl ========================================================
3901 dnl = Enable stripping of libs & executables
3902 dnl ========================================================
3903 MOZ_ARG_ENABLE_BOOL(strip,
3904 [ --enable-strip Enable stripping of libs & executables ],
3908 dnl ========================================================
3909 dnl = Enable stripping of libs & executables when packaging
3910 dnl ========================================================
3911 MOZ_ARG_ENABLE_BOOL(install-strip,
3912 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
3916 dnl ========================================================
3917 dnl = --disable-elf-hack
3918 dnl ========================================================
3921 MOZ_ARG_DISABLE_BOOL(elf-hack,
3922 [ --disable-elf-hack Disable elf hacks],
3926 # Only enable elfhack where supported
3927 if test "$USE_ELF_HACK" = 1; then
3928 case "${HOST_OS_ARCH},${OS_ARCH}" in
3930 case "${CPU_ARCH}" in
3945 dnl ========================================================
3946 dnl = libstdc++ compatibility hacks
3947 dnl ========================================================
3950 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
3951 [ --enable-stdcxx-compat Enable compatibility with older libstdc++],
3954 if test -n "$STDCXX_COMPAT" -a -n "$COMPILE_ENVIRONMENT"; then
3955 eval $(CXX="$CXX" HOST_CXX="$HOST_CXX" $PYTHON -m mozbuild.configure.libstdcxx)
3956 AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
3957 AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
3958 CXXFLAGS="$CXXFLAGS -D_GLIBCXX_USE_CXX11_ABI=0"
3959 HOST_CXXFLAGS="$HOST_CXXFLAGS -D_GLIBCXX_USE_CXX11_ABI=0"
3962 dnl ========================================================
3963 dnl = frontend JS debug mode
3964 dnl ========================================================
3966 MOZ_ARG_ENABLE_BOOL(debug-js-modules,
3967 [ --enable-debug-js-modules Enable debug mode for frontend JS libraries],
3971 AC_SUBST(DEBUG_JS_MODULES)
3973 dnl ========================================================
3975 dnl = Profiling and Instrumenting
3977 dnl ========================================================
3978 MOZ_ARG_HEADER(Profiling and Instrumenting)
3980 dnl ========================================================
3981 dnl = Enable TaskTracer
3982 dnl ========================================================
3983 MOZ_ARG_ENABLE_BOOL(tasktracer,
3984 [ --enable-tasktracer Set compile flags necessary for using TaskTracer],
3987 if test -n "$MOZ_TASK_TRACER"; then
3988 AC_DEFINE(MOZ_TASK_TRACER)
3989 AC_SUBST(MOZ_TASK_TRACER)
3992 dnl ========================================================
3993 dnl Turn on reflow counting
3994 dnl ========================================================
3995 MOZ_ARG_ENABLE_BOOL(reflow-perf,
3996 [ --enable-reflow-perf Enable reflow performance tracing],
3999 if test -n "$MOZ_REFLOW_PERF"; then
4000 AC_DEFINE(MOZ_REFLOW_PERF)
4003 dnl ========================================================
4004 dnl = Horizon build options - set default preferences for
4005 dnl the horizon project. Horizon is a browser built on
4006 dnl top of the graphene runtime.
4007 dnl ========================================================
4008 if test -n "$MOZ_HORIZON"; then
4009 AC_DEFINE(MOZ_HORIZON)
4011 AC_SUBST(MOZ_HORIZON)
4013 dnl ========================================================
4014 dnl = Offer a way to disable the startup cache
4015 dnl ========================================================
4017 MOZ_ARG_DISABLE_BOOL(startupcache,
4018 [ --disable-startupcache Disable startup cache ],
4019 MOZ_DISABLE_STARTUPCACHE=1,
4020 MOZ_DISABLE_STARTUPCACHE=)
4022 if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
4023 AC_DEFINE(MOZ_DISABLE_STARTUPCACHE)
4025 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
4027 dnl ========================================================
4028 dnl = Enable Pico Speech Synthesis
4029 dnl ========================================================
4030 MOZ_ARG_ENABLE_BOOL(synth-pico,
4031 [ --enable-synth-pico Set compile flags necessary for compiling Pico Web Speech API ],
4034 if test -n "$MOZ_SYNTH_PICO"; then
4035 AC_DEFINE(MOZ_SYNTH_PICO)
4037 AC_SUBST(MOZ_SYNTH_PICO)
4039 dnl ========================================================
4040 dnl = Enable Support for Time Manager API
4041 dnl ========================================================
4042 if test -n "$MOZ_TIME_MANAGER"; then
4043 AC_DEFINE(MOZ_TIME_MANAGER)
4045 AC_SUBST(MOZ_TIME_MANAGER)
4047 dnl ========================================================
4048 dnl = Enable Support for Secure Element API
4049 dnl ========================================================
4050 MOZ_SECUREELEMENT=1,
4051 if test -n "$MOZ_SECUREELEMENT"; then
4052 AC_DEFINE(MOZ_SECUREELEMENT)
4054 AC_SUBST(MOZ_SECUREELEMENT)
4056 dnl ========================================================
4057 dnl = Support for demangling undefined symbols
4058 dnl ========================================================
4059 if test -z "$SKIP_LIBRARY_CHECKS"; then
4062 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
4066 # Demangle only for debug or DMD builds
4067 MOZ_DEMANGLE_SYMBOLS=
4068 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
4069 MOZ_DEMANGLE_SYMBOLS=1
4070 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
4072 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
4074 dnl ========================================================
4075 dnl = Support for gcc stack unwinding (from gcc 3.3)
4076 dnl ========================================================
4077 if test -z "$SKIP_LIBRARY_CHECKS"; then
4080 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
4084 dnl ========================================================
4086 dnl ========================================================
4088 MOZ_ARG_WITH_STRING(jitreport-granularity,
4089 [ --jitreport-granularity=N
4090 Default granularity at which to report JIT code
4093 1 - code ranges for whole functions only
4094 2 - per-line information
4095 3 - per-op information],
4096 JITREPORT_GRANULARITY=$withval,
4097 JITREPORT_GRANULARITY=3)
4099 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
4101 dnl ========================================================
4105 dnl ========================================================
4106 MOZ_ARG_HEADER(Misc. Options)
4108 dnl ========================================================
4109 dnl = Define default location for MOZILLA_FIVE_HOME
4110 dnl ========================================================
4111 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
4112 [ --with-default-mozilla-five-home
4113 Set the default value for MOZILLA_FIVE_HOME],
4114 [ val=`echo $withval`
4115 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
4117 dnl ========================================================
4118 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
4119 dnl ========================================================
4120 MOZ_ARG_WITH_STRING(user-appdir,
4121 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
4122 [ val=`echo $withval`
4123 if echo "$val" | grep "\/" >/dev/null; then
4124 AC_MSG_ERROR("Homedir must be single relative path.")
4129 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
4131 dnl ========================================================
4132 dnl = Doxygen configuration
4133 dnl ========================================================
4134 dnl Use commas to specify multiple dirs to this arg
4135 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
4136 MOZ_ARG_WITH_STRING(doc-input-dirs,
4137 [ --with-doc-input-dirs=DIRS
4138 Header/idl dirs to create docs from],
4139 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
4140 AC_SUBST(MOZ_DOC_INPUT_DIRS)
4142 dnl Use commas to specify multiple dirs to this arg
4143 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
4144 MOZ_ARG_WITH_STRING(doc-include-dirs,
4145 [ --with-doc-include-dirs=DIRS
4146 Include dirs to preprocess doc headers],
4147 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
4148 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
4150 MOZ_DOC_OUTPUT_DIR='./dist/docs'
4151 MOZ_ARG_WITH_STRING(doc-output-dir,
4152 [ --with-doc-output-dir=DIR
4153 Dir to generate docs into],
4154 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
4155 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
4157 if test -z "$SKIP_COMPILER_CHECKS"; then
4158 dnl ========================================================
4160 dnl = Compiler Options
4162 dnl ========================================================
4163 MOZ_ARG_HEADER(Compiler Options)
4165 dnl ========================================================
4166 dnl Check for gcc -pipe support
4167 dnl ========================================================
4168 AC_MSG_CHECKING([for -pipe support])
4169 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
4170 dnl Any gcc that supports firefox supports -pipe.
4171 CFLAGS="$CFLAGS -pipe"
4172 CXXFLAGS="$CXXFLAGS -pipe"
4173 AC_MSG_RESULT([yes])
4178 fi # ! SKIP_COMPILER_CHECKS
4180 AC_DEFINE(CPP_THROW_NEW, [throw()])
4183 if test "$COMPILE_ENVIRONMENT"; then
4185 fi # COMPILE_ENVIRONMENT
4187 dnl ========================================================
4189 dnl = Build depencency options
4191 dnl ========================================================
4192 MOZ_ARG_HEADER(Build dependencies)
4194 if test "$GNU_CC" -a "$GNU_CXX"; then
4195 _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
4197 dnl Don't override this for MSVC
4198 if test -z "$_WIN32_MSVC"; then
4199 _USE_CPP_INCLUDE_FLAG=
4200 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
4201 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
4203 echo '#include <stdio.h>' > dummy-hello.c
4205 dnl This output is localized, split at the first double space or colon and space.
4206 _CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*\\\stdio.h\)$"
4207 CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'`
4208 _CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'`
4210 if ! test -e "$_CL_STDIO_PATH"; then
4211 AC_MSG_ERROR([Unable to parse cl -showIncludes prefix. This compiler's locale has an unsupported formatting.])
4213 if test -z "$CL_INCLUDES_PREFIX"; then
4214 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
4216 AC_SUBST(CL_INCLUDES_PREFIX)
4219 dnl Make sure that the build system can handle non-ASCII characters
4220 dnl in environment variables to prevent it from breaking silently on
4221 dnl non-English systems.
4222 NONASCII=$'\241\241'
4227 dnl ========================================================
4229 dnl = Static Build Options
4231 dnl ========================================================
4232 MOZ_ARG_HEADER(Static build options)
4234 if test -z "$MOZ_SYSTEM_ZLIB"; then
4235 if test -n "$JS_SHARED_LIBRARY" -o -n "$MOZ_LINKER"; then
4237 AC_DEFINE(ZLIB_IN_MOZGLUE)
4241 AC_SUBST(ZLIB_IN_MOZGLUE)
4243 dnl ========================================================
4245 dnl = Standalone module options
4247 dnl ========================================================
4248 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
4251 dnl ========================================================
4253 if test -z "$SKIP_PATH_CHECKS"; then
4254 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
4255 if test "$MOZ_ENABLE_GTK" ; then
4256 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
4261 if test -z "${GLIB_GMODULE_LIBS}" \
4262 -a -n "${GLIB_CONFIG}"\
4263 -a "${GLIB_CONFIG}" != no\
4265 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
4268 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
4270 if test "$USE_FC_FREETYPE"; then
4271 if test "$COMPILE_ENVIRONMENT"; then
4272 dnl ========================================================
4273 dnl = Check for freetype2 functionality
4274 dnl ========================================================
4275 if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
4277 _SAVE_CFLAGS="$CFLAGS"
4278 LIBS="$LIBS $FT2_LIBS"
4279 CFLAGS="$CFLAGS $FT2_CFLAGS"
4281 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
4282 ac_cv_member_FT_Bitmap_Size_y_ppem,
4283 [AC_TRY_COMPILE([#include <ft2build.h>
4284 #include FT_FREETYPE_H],
4286 if (sizeof s.y_ppem) return 0;
4288 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
4289 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
4290 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
4291 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
4293 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
4295 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
4296 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
4297 [FT_Bitmap_Size structure includes y_ppem field])
4299 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
4302 CFLAGS="$_SAVE_CFLAGS"
4305 _SAVE_CPPFLAGS="$CPPFLAGS"
4306 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
4307 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
4308 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
4309 CPPFLAGS="$_SAVE_CPPFLAGS"
4313 dnl ========================================================
4314 dnl Check if we need the 32-bit Linux SSE2 error dialog
4315 dnl ========================================================
4317 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
4319 dnl ========================================================
4320 dnl Check for pixman and cairo
4321 dnl ========================================================
4324 MOZ_ARG_ENABLE_BOOL(system-cairo,
4325 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
4330 MOZ_ARG_ENABLE_BOOL(system-pixman,
4331 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
4333 MOZ_TREE_PIXMAN=force,
4336 # System cairo depends on system pixman
4337 if test "$MOZ_TREE_PIXMAN" = "force"; then
4338 if test -z "$MOZ_TREE_CAIRO"; then
4339 AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
4343 elif test -z "$MOZ_TREE_CAIRO"; then
4347 if test "$MOZ_TREE_PIXMAN"; then
4348 AC_DEFINE(MOZ_TREE_PIXMAN)
4350 PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.19.2)
4353 if test "$MOZ_TREE_CAIRO"; then
4354 MOZ_CAIRO_CFLAGS="-I${DIST}/include/cairo"
4355 AC_DEFINE(MOZ_TREE_CAIRO)
4357 if test "$OS_ARCH" = "WINNT"; then
4358 # For now we assume that we will have a uint64_t available through
4359 # one of the above headers or mozstdint.h.
4360 AC_DEFINE(HAVE_UINT64_T)
4363 # Define macros for cairo-features.h
4364 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
4365 if test "$MOZ_X11"; then
4366 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
4367 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
4368 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
4370 if test "$_HAVE_FREETYPE2"; then
4371 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
4372 MOZ_ENABLE_CAIRO_FT=1
4373 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
4376 case "$MOZ_WIDGET_TOOLKIT" in
4378 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
4379 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
4380 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
4383 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
4384 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
4385 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
4386 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
4387 MOZ_ENABLE_D2D_SURFACE=1
4389 if test "$COMPILE_ENVIRONMENT"; then
4391 dnl D3D10 Layers depend on D2D Surfaces.
4392 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
4393 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
4398 if test "$USE_FC_FREETYPE"; then
4399 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
4401 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
4402 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
4403 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
4405 AC_SUBST(PS_SURFACE_FEATURE)
4406 AC_SUBST(SVG_SURFACE_FEATURE)
4407 AC_SUBST(XLIB_SURFACE_FEATURE)
4408 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
4409 AC_SUBST(QUARTZ_SURFACE_FEATURE)
4410 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
4411 AC_SUBST(WIN32_SURFACE_FEATURE)
4412 AC_SUBST(OS2_SURFACE_FEATURE)
4413 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
4414 AC_SUBST(FT_FONT_FEATURE)
4415 AC_SUBST(FC_FONT_FEATURE)
4416 AC_SUBST(WIN32_FONT_FEATURE)
4417 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
4418 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
4419 AC_SUBST(QUARTZ_FONT_FEATURE)
4420 AC_SUBST(PNG_FUNCTIONS_FEATURE)
4421 AC_SUBST(QT_SURFACE_FEATURE)
4422 AC_SUBST(TEE_SURFACE_FEATURE)
4424 if test "$MOZ_X11"; then
4425 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
4428 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
4430 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
4431 MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
4432 MOZ_CAIRO_LIBS="$CAIRO_LIBS"
4433 PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
4434 if test "$MOZ_X11"; then
4435 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
4436 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
4437 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
4438 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
4442 case "$MOZ_WIDGET_TOOLKIT" in
4444 TK_CFLAGS="$MOZ_CAIRO_CFLAGS $MOZ_PIXMAN_CFLAGS"
4445 TK_LIBS="$MOZ_CAIRO_LIBS $MOZ_PIXMAN_LIBS"
4449 AC_SUBST(MOZ_TREE_CAIRO)
4450 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
4451 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
4452 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
4453 AC_SUBST(MOZ_TREE_PIXMAN)
4455 dnl ========================================================
4457 dnl ========================================================
4458 MOZ_ARG_DISABLE_BOOL(xul,
4459 [ --disable-xul Disable XUL],
4461 if test "$MOZ_XUL"; then
4464 dnl remove extensions that require XUL
4465 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
4470 dnl ========================================================
4471 dnl necko configuration options
4472 dnl ========================================================
4475 dnl option to disable necko's wifi scanner
4478 case "$OS_TARGET" in
4480 if test -z "$MOZ_IOS"; then
4484 DragonFly|FreeBSD|WINNT)
4493 MOZ_ARG_DISABLE_BOOL(necko-wifi,
4494 [ --disable-necko-wifi Disable necko wifi scanner],
4498 if test "$NECKO_WIFI"; then
4499 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
4500 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
4502 AC_DEFINE(NECKO_WIFI)
4503 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
4505 AC_SUBST(NECKO_WIFI)
4506 AC_SUBST(NECKO_WIFI_DBUS)
4509 dnl option to disable cookies
4511 MOZ_ARG_DISABLE_BOOL(cookies,
4512 [ --disable-cookies Disable cookie support],
4515 AC_SUBST(NECKO_COOKIES)
4516 if test "$NECKO_COOKIES"; then
4517 AC_DEFINE(NECKO_COOKIES)
4518 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
4521 dnl ========================================================
4523 dnl = Maintainer debug option (no --enable equivalent)
4525 dnl ========================================================
4529 AC_SUBST(AR_EXTRACT)
4532 AC_SUBST(AS_DASH_C_FLAG)
4539 AC_SUBST(MOZ_AUTH_EXTENSION)
4540 AC_SUBST(MOZ_PREF_EXTENSIONS)
4542 AC_SUBST(MOZ_DEBUG_LDFLAGS)
4543 AC_SUBST(WARNINGS_AS_ERRORS)
4544 AC_SUBST_SET(MOZ_EXTENSIONS)
4546 AC_SUBST(MOZ_TOOLKIT_SEARCH)
4549 AC_SUBST(MOZ_UNIVERSALCHARDET)
4550 AC_SUBST(ACCESSIBILITY)
4551 AC_SUBST(MOZ_SPELLCHECK)
4552 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
4553 AC_SUBST(MOZ_CRASHREPORTER)
4554 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
4555 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
4556 AC_SUBST(MOZ_STUB_INSTALLER)
4557 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
4558 AC_SUBST(MOZ_ENABLE_SIGNMAR)
4559 AC_SUBST(MOZ_UPDATER)
4561 AC_SUBST(MOZ_ANGLE_RENDERER)
4562 AC_SUBST(MOZ_D3D_CPU_SUFFIX)
4563 AC_SUBST(MOZ_HAS_WINSDK_WITH_D3D)
4564 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL)
4565 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL_PATH)
4567 AC_SUBST(MOZ_ANDROID_APPLICATION_CLASS)
4568 AC_SUBST(MOZ_ANDROID_BROWSER_INTENT_CLASS)
4569 AC_SUBST(MOZ_ANDROID_SEARCH_INTENT_CLASS)
4570 AC_SUBST(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
4571 AC_SUBST(ENABLE_STRIP)
4572 AC_SUBST(PKG_SKIP_STRIP)
4573 AC_SUBST(STRIP_FLAGS)
4574 AC_SUBST(USE_ELF_HACK)
4575 AC_SUBST(INCREMENTAL_LINKER)
4577 AC_SUBST(MOZ_FIX_LINK_PATHS)
4579 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
4580 AC_SUBST(MOZ_LINKER_EXTRACT)
4582 if test -n "$MOZ_BINARY_EXTENSIONS"; then
4583 AC_DEFINE(MOZ_BINARY_EXTENSIONS)
4586 AC_SUBST(MOZ_ADDON_SIGNING)
4587 if test "$MOZ_ADDON_SIGNING" = 1; then
4588 AC_DEFINE(MOZ_ADDON_SIGNING)
4590 AC_SUBST(MOZ_REQUIRE_SIGNING)
4591 if test "$MOZ_REQUIRE_SIGNING" = 1; then
4592 AC_DEFINE(MOZ_REQUIRE_SIGNING)
4595 dnl ========================================================
4596 dnl = Mac bundle name prefix
4597 dnl ========================================================
4598 MOZ_ARG_WITH_STRING(macbundlename-prefix,
4599 [ --with-macbundlename-prefix=prefix
4600 Prefix for MOZ_MACBUNDLE_NAME],
4601 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
4603 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
4604 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
4605 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
4608 if test "$MOZ_DEBUG"; then
4609 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
4611 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
4613 AC_SUBST(MOZ_MACBUNDLE_NAME)
4615 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
4616 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
4617 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
4618 if test "$MOZ_DEBUG"; then
4619 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
4622 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
4623 AC_SUBST(MOZ_MACBUNDLE_ID)
4625 dnl ========================================================
4626 dnl = Child Process Name for IPC
4627 dnl ========================================================
4628 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
4629 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
4631 # We want to let Android unpack the file at install time, but it only does
4632 # so if the file is named libsomething.so. The lib/ path is also required
4633 # because the unpacked file will be under the lib/ subdirectory and will
4634 # need to be executed from that path.
4635 MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
4636 MOZ_CHILD_PROCESS_NAME_PIE="libplugin-container-pie.so"
4637 AC_SUBST(MOZ_CHILD_PROCESS_NAME_PIE)
4639 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
4640 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
4642 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
4643 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
4644 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
4646 # The following variables are available to branding and application
4647 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
4648 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
4649 # impacts profile location and user-visible fields.
4650 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
4651 # versions of a given application (e.g. Aurora and Firefox both use
4652 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
4653 # for application.ini's "Name" field, which controls profile location in
4654 # the absence of a "Profile" field (see below), and various system
4655 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
4656 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
4657 # Mac Bundle name, Updater, Installer), it is typically used for nightly
4658 # builds (e.g. Aurora for Firefox).
4659 # - MOZ_APP_VERSION: Defines the application version number.
4660 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
4661 # in the "About" window. If not set, defaults to MOZ_APP_VERSION.
4662 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
4663 # defaults to a lowercase form of MOZ_APP_BASENAME.
4664 # - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
4665 # profile name and remoting. If not set, defaults to MOZ_APP_NAME.
4666 # - MOZ_APP_PROFILE: When set, used for application.ini's
4667 # "Profile" field, which controls profile location.
4668 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
4669 # crash reporter server url.
4670 # - MOZ_APP_ANDROID_VERSION_CODE: On Android, "android:versionCode" for
4671 # the main application is set to the value of this variable. If not
4672 # set, it falls back to a Mozilla-specific value derived from the
4674 # - MOZ_ANDROID_SHARED_ID: On Android, "android:sharedUserId" for all Android
4675 # packages produced.
4676 # - MOZ_ANDROID_GCM_SENDERID: On Android, the Android GCM Sender ID used. GCM
4677 # sender IDs are not sensitive: see, http://stackoverflow.com/a/18216063.
4678 # - MOZ_MMA_GCM_SENDERID: This GCM Sender ID is used for MMA integration.
4679 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
4681 if test -z "$MOZ_APP_NAME"; then
4682 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
4685 if test -z "$MOZ_APP_REMOTINGNAME"; then
4686 MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
4689 if test -z "$MOZ_APP_VERSION_DISPLAY"; then
4690 MOZ_APP_VERSION_DISPLAY=$MOZ_APP_VERSION
4693 if test -z "$ANDROID_PACKAGE_NAME" ; then
4694 # When we got rid of the Aurora channel we decided to replace the old
4695 # Nightly ANDROID_PACKAGE_NAME with Aurora. To make sure this is inherited
4696 # by all mozilla-central based branches we make this the new "default"
4697 # for Fennec. Non mozilla-central based branches set ANDROID_PACKAGE_NAME
4698 # in their mozconfig, so they will never get this. If there are ever
4699 # non-Fennec builds for Android, they will fall into the else block
4700 # and use their own default name.
4701 # https://bugzilla.mozilla.org/show_bug.cgi?id=1357808 has additional
4702 # background on this.
4703 if test "$MOZ_APP_NAME" = "fennec"; then
4704 ANDROID_PACKAGE_NAME="org.mozilla.fennec_aurora"
4706 ANDROID_PACKAGE_NAME="org.mozilla.$MOZ_APP_NAME"
4710 # Mozilla released Firefox for Android {Release,Beta} and {Aurora,Nightly} to
4711 # the public with specific common shared IDs and we need to keep them
4712 # consistent forever. The specific common values are set by per-channel
4713 # branding; all other channels use a generic sharedID, set below.
4714 if test -z "$MOZ_ANDROID_SHARED_ID" ; then
4715 MOZ_ANDROID_SHARED_ID="${ANDROID_PACKAGE_NAME}.sharedID"
4718 # For extensions and langpacks, we require a max version that is compatible
4719 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
4720 # 24.0a1 and 24.0a2 aren't affected
4722 # 24.1.1 becomes 24.*
4723 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
4724 if test -z "$IS_ALPHA"; then
4726 if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
4727 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
4729 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
4733 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
4736 AC_SUBST(MOZ_APP_NAME)
4737 AC_SUBST(MOZ_APP_REMOTINGNAME)
4738 AC_SUBST(MOZ_APP_DISPLAYNAME)
4739 AC_SUBST(MOZ_APP_BASENAME)
4740 AC_SUBST(MOZ_APP_VENDOR)
4741 AC_SUBST(MOZ_APP_PROFILE)
4742 AC_SUBST(MOZ_APP_ID)
4743 AC_SUBST(MOZ_APP_ANDROID_VERSION_CODE)
4744 AC_SUBST(MOZ_ANDROID_SHARED_ID)
4745 AC_SUBST(MOZ_ANDROID_GCM_SENDERID)
4746 AC_SUBST(MOZ_MMA_GCM_SENDERID)
4747 AC_SUBST(MAR_CHANNEL_ID)
4748 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
4749 AC_SUBST(MOZ_PROFILE_MIGRATOR)
4750 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
4751 AC_SUBST(MOZ_APP_UA_NAME)
4752 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
4753 AC_SUBST(MOZ_APP_VERSION)
4754 AC_SUBST(MOZ_APP_VERSION_DISPLAY)
4755 AC_SUBST(MOZ_APP_MAXVERSION)
4756 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
4757 AC_SUBST(FIREFOX_VERSION)
4758 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
4759 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
4760 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
4763 AC_SUBST(MOZ_PKG_SPECIAL)
4764 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
4766 if test "$MOZILLA_OFFICIAL"; then
4767 # Build revisions should always be present in official builds
4768 MOZ_INCLUDE_SOURCE_INFO=1
4771 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
4772 # explicitly set the repository and changeset information in.
4773 AC_SUBST(MOZ_SOURCE_REPO)
4774 AC_SUBST(MOZ_SOURCE_CHANGESET)
4775 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
4777 if test "$MOZ_TELEMETRY_REPORTING"; then
4778 AC_DEFINE(MOZ_TELEMETRY_REPORTING)
4780 # Enable Telemetry by default for nightly and aurora channels
4781 if test -z "$RELEASE_OR_BETA"; then
4782 AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
4786 dnl If we have any service that uploads data (and requires data submission
4787 dnl policy alert), set MOZ_DATA_REPORTING.
4788 dnl We need SUBST for build system and DEFINE for xul preprocessor.
4789 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
4790 MOZ_DATA_REPORTING=1
4791 AC_DEFINE(MOZ_DATA_REPORTING)
4792 AC_SUBST(MOZ_DATA_REPORTING)
4796 AC_SUBST(WIN32_REDIST_DIR)
4797 AC_SUBST(WIN_UCRT_REDIST_DIR)
4799 dnl ========================================================
4801 dnl ========================================================
4805 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
4811 dnl Echo the CFLAGS to remove extra whitespace.
4817 $_WARNINGS_CXXFLAGS \
4820 COMPILE_CFLAGS=`echo \
4824 COMPILE_CXXFLAGS=`echo \
4825 $_DEFINES_CXXFLAGS \
4831 HOST_CXXFLAGS=`echo \
4834 AC_SUBST(_DEPEND_CFLAGS)
4835 AC_SUBST(MOZ_SYSTEM_JPEG)
4836 AC_SUBST(MOZ_SYSTEM_PNG)
4837 AC_SUBST(MOZ_SYSTEM_BZ2)
4839 AC_SUBST_LIST(MOZ_JPEG_CFLAGS)
4840 AC_SUBST_LIST(MOZ_JPEG_LIBS)
4841 AC_SUBST_LIST(MOZ_BZ2_CFLAGS)
4842 AC_SUBST_LIST(MOZ_BZ2_LIBS)
4843 AC_SUBST_LIST(MOZ_PNG_CFLAGS)
4844 AC_SUBST_LIST(MOZ_PNG_LIBS)
4846 AC_SUBST(MOZ_SYSTEM_NSPR)
4848 AC_SUBST(MOZ_SYSTEM_NSS)
4850 HOST_CMFLAGS=-fobjc-exceptions
4851 HOST_CMMFLAGS=-fobjc-exceptions
4852 OS_COMPILE_CMFLAGS=-fobjc-exceptions
4853 OS_COMPILE_CMMFLAGS=-fobjc-exceptions
4854 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
4855 OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
4856 OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
4858 AC_SUBST(HOST_CMFLAGS)
4859 AC_SUBST(HOST_CMMFLAGS)
4860 AC_SUBST(OS_COMPILE_CMFLAGS)
4861 AC_SUBST(OS_COMPILE_CMMFLAGS)
4864 OS_CXXFLAGS="$CXXFLAGS"
4865 OS_CPPFLAGS="$CPPFLAGS"
4866 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
4867 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
4868 OS_LDFLAGS="$LDFLAGS"
4871 AC_SUBST(OS_CXXFLAGS)
4872 AC_SUBST(OS_CPPFLAGS)
4873 AC_SUBST(OS_COMPILE_CFLAGS)
4874 AC_SUBST(OS_COMPILE_CXXFLAGS)
4875 AC_SUBST(OS_LDFLAGS)
4880 AC_SUBST(HOST_CFLAGS)
4881 AC_SUBST(HOST_CPPFLAGS)
4882 AC_SUBST(HOST_CXXFLAGS)
4883 AC_SUBST(HOST_LDFLAGS)
4884 AC_SUBST(HOST_OPTIMIZE_FLAGS)
4886 AC_SUBST(HOST_AR_FLAGS)
4887 AC_SUBST(HOST_RANLIB)
4888 AC_SUBST(HOST_BIN_SUFFIX)
4890 AC_SUBST(TARGET_XPCOM_ABI)
4891 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
4892 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
4893 AC_SUBST(HAVE_X86_AVX2)
4894 AC_SUBST(HAVE_ALTIVEC)
4895 AC_SUBST(GCC_USE_GNU_LD)
4897 AC_SUBST(WRAP_LDFLAGS)
4900 AC_SUBST(DSO_CFLAGS)
4901 AC_SUBST(DSO_PIC_CFLAGS)
4902 AC_SUBST(DSO_LDOPTS)
4903 AC_SUBST(BIN_SUFFIX)
4905 AC_SUBST(CC_VERSION)
4906 AC_SUBST(NS_ENABLE_TSF)
4907 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
4908 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
4910 AC_SUBST(MOZ_VORBIS)
4911 AC_SUBST(MOZ_TREMOR)
4913 AC_SUBST_LIST(FFVPX_ASFLAGS)
4914 AC_SUBST(VPX_USE_YASM)
4915 AC_SUBST_LIST(VPX_ASFLAGS)
4916 AC_SUBST(VPX_AS_CONVERSION)
4917 AC_SUBST(VPX_X86_ASM)
4918 AC_SUBST(VPX_ARM_ASM)
4919 AC_SUBST(LIBJPEG_TURBO_USE_YASM)
4920 AC_SUBST_LIST(LIBJPEG_TURBO_ASFLAGS)
4921 AC_SUBST(MOZ_LIBAV_FFT)
4922 AC_SUBST_LIST(LIBAV_FFT_ASFLAGS)
4923 AC_SUBST(MOZ_DEVTOOLS)
4925 AC_SUBST(MOZ_PACKAGE_JSSHELL)
4926 AC_SUBST(MOZ_FOLD_LIBS)
4927 AC_SUBST_LIST(MOZ_FOLD_LIBS_FLAGS)
4928 AC_SUBST(SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE)
4932 dnl Host JavaScript runtime, if any, to use during cross compiles.
4935 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
4937 if test -n "$COMPILE_ENVIRONMENT"; then
4938 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
4940 dnl Check for missing components
4941 if test "$MOZ_X11"; then
4942 dnl ====================================================
4943 dnl = Check if X headers exist
4944 dnl ====================================================
4945 _SAVE_CFLAGS=$CFLAGS
4946 CFLAGS="$CFLAGS $XCFLAGS"
4950 #include <X11/Xlib.h>
4951 #include <X11/Intrinsic.h>
4952 #include <X11/extensions/XShm.h>
4956 if ((dpy = XOpenDisplay(NULL)) == NULL) {
4957 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
4961 [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
4962 CFLAGS="$_SAVE_CFLAGS"
4964 if test -n "$MISSING_X"; then
4965 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
4970 fi # COMPILE_ENVIRONMENT
4972 dnl Set various defines and substitutions
4973 dnl ========================================================
4975 if test "$MOZ_DEBUG"; then
4976 AC_DEFINE(MOZ_REFLOW_PERF)
4977 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
4980 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
4981 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
4982 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
4983 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
4984 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
4985 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
4986 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
4987 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
4988 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
4991 AC_SUBST(MOZ_DEV_EDITION)
4992 if test -n "$MOZ_DEV_EDITION"; then
4993 AC_DEFINE(MOZ_DEV_EDITION)
4996 if test "$MOZ_DEBUG"; then
4999 case "$MOZ_UPDATE_CHANNEL" in
5000 aurora|beta|release|esr)
5007 if test -n "$A11Y_LOG"; then
5011 AC_SUBST(MOZILLA_VERSION)
5013 dnl Spit out some output
5014 dnl ========================================================
5016 dnl The following defines are used by xpcom
5017 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
5019 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
5020 HAVE_CPP_PARTIAL_SPECIALIZATION
5023 HAVE_ICONV_WITH_CONST_INPUT
5036 dnl ========================================================
5037 dnl Determine options to use for running the preprocessor.
5038 dnl ========================================================
5040 if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT"; then
5041 PREPROCESS_OPTION="-P -Fi"
5043 PREPROCESS_OPTION="-E -o "
5046 AC_SUBST(PREPROCESS_OPTION)
5048 dnl ========================================================
5049 dnl mask as shorthand property
5050 dnl ========================================================
5052 # The control structure code will be removed as soon as the feature is stable
5053 # Refer to bug 1281101 for more details.
5054 MOZ_ENABLE_MASK_AS_SHORTHAND=1
5055 AC_DEFINE(MOZ_ENABLE_MASK_AS_SHORTHAND)
5056 AC_SUBST(MOZ_ENABLE_MASK_AS_SHORTHAND)
5058 # Avoid using obsolete NSPR features
5059 AC_DEFINE(NO_NSPR_10_SUPPORT)
5061 # Don't build NSS libpkix
5062 NSS_DISABLE_LIBPKIX=1
5063 AC_SUBST(NSS_DISABLE_LIBPKIX)
5065 MOZ_CREATE_CONFIG_STATUS()
5067 if test -z "$direct_nspr_config"; then
5068 dnl ========================================================
5069 dnl = Setup a nice relatively clean build environment for
5070 dnl = sub-configures.
5071 dnl ========================================================
5074 CFLAGS="$_SUBDIR_CFLAGS"
5075 CPPFLAGS="$_SUBDIR_CPPFLAGS"
5076 CXXFLAGS="$_SUBDIR_CXXFLAGS"
5077 LDFLAGS="$_SUBDIR_LDFLAGS"
5078 HOST_CC="$_SUBDIR_HOST_CC"
5079 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
5080 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
5081 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
5088 # Run all configure scripts specified by a subconfigure
5089 if test -n "$_subconfigure_subdir"; then
5090 _save_srcdir="$srcdir"
5092 _save_ac_configure_args="$ac_configure_args"
5093 ac_configure_args="$_subconfigure_config_args"
5094 AC_OUTPUT_SUBDIRS_NOW("$_subconfigure_subdir",$cache_file)
5095 ac_configure_args="$_save_ac_configure_args"
5096 srcdir="$_save_srcdir"
5099 if test "$COMPILE_ENVIRONMENT"; then
5103 dnl ========================================================
5104 dnl = Setup a nice relatively clean build environment for
5105 dnl = sub-configures.
5106 dnl ========================================================
5109 CFLAGS="$_SUBDIR_CFLAGS"
5110 CPPFLAGS="$_SUBDIR_CPPFLAGS"
5111 CXXFLAGS="$_SUBDIR_CXXFLAGS"
5112 LDFLAGS="$_SUBDIR_LDFLAGS"
5113 HOST_CC="$_SUBDIR_HOST_CC"
5114 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
5115 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
5116 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
5119 # Run the SpiderMonkey 'configure' script.
5120 dist=$MOZ_BUILD_ROOT/dist
5121 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
5123 # --with-system-nspr will have been converted into the relevant $NSPR_CFLAGS
5125 ac_configure_args="`echo $ac_configure_args | sed -e 's/--with-system-nspr\S* *//'`"
5127 if test "$_INTL_API" = no; then
5128 ac_configure_args="$ac_configure_args --without-intl-api"
5131 if test -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
5132 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
5133 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
5135 ac_configure_args="$ac_configure_args --prefix=$dist"
5136 if test -n "$ZLIB_IN_MOZGLUE"; then
5139 export MOZ_SYSTEM_ZLIB
5140 export MOZ_ZLIB_CFLAGS
5141 export MOZ_ZLIB_LIBS
5143 export MOZ_APP_REMOTINGNAME
5145 export MOZILLA_CENTRAL_PATH=$_topsrcdir
5146 export STLPORT_CPPFLAGS
5151 export ZLIB_IN_MOZGLUE
5165 export HOST_CPPFLAGS
5166 export HOST_CXXFLAGS
5169 if ! test -e js; then
5173 ac_configure_args="$ac_configure_args JS_STANDALONE="
5174 AC_OUTPUT_SUBDIRS(js/src,$cache_file)
5175 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
5177 fi # COMPILE_ENVIRONMENT
5179 dnl we need to run config.status after js/src subconfigure because we're
5180 dnl traversing its moz.build and we need its config.status for that.
5181 dnl However, writing our own config.status needs to happen before
5182 dnl subconfigures because the setup surrounding subconfigures alters
5183 dnl many AC_SUBSTed variables.
5184 MOZ_RUN_ALL_SUBCONFIGURES()
5186 rm -fr confdefs* $ac_clean_files