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 dnl For profile-guided optimization
1024 PROFILE_GEN_CFLAGS="-GL"
1025 num_cores=$($PYTHON -c 'import multiprocessing; print(min(8,multiprocessing.cpu_count()))')
1026 cgthreads="-CGTHREADS:${num_cores}"
1027 PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT -PogoSafeMode $cgthreads"
1028 dnl XXX: PGO builds can fail with warnings treated as errors,
1029 dnl specifically "no profile data available" appears to be
1030 dnl treated as an error sometimes. This might be a consequence
1031 dnl of using WARNINGS_AS_ERRORS in some modules, combined
1032 dnl with the linker doing most of the work in the whole-program
1033 dnl optimization/PGO case. I think it's probably a compiler bug,
1034 dnl but we work around it here.
1035 PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
1036 dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
1037 dnl Probably also a compiler bug, but what can you do?
1038 PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE $cgthreads"
1039 LDFLAGS="$LDFLAGS -DYNAMICBASE"
1041 dnl Minimum reqiurement of Gecko is VS2015 or later which supports
1042 dnl both SSSE3 and SSE4.1.
1043 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
1044 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
1045 dnl allow AVX2 code from VS2015
1048 AC_DEFINE(WIN32_LEAN_AND_MEAN)
1049 dnl See http://support.microsoft.com/kb/143208 to use STL
1052 MOZ_USER_DIR="Mozilla"
1056 AC_MSG_ERROR([Using a Cygwin build environment is unsupported. Configure cannot check for presence of necessary headers. Please upgrade to MozillaBuild; see https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
1062 if test -n "$GNU_CC"; then
1063 CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
1064 CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
1065 LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup -Wl,--large-address-aware"
1067 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
1068 LDFLAGS="$LDFLAGS -SAFESEH"
1074 if test -n "$_WIN32_MSVC"; then
1075 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
1080 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
1087 CFLAGS="$CFLAGS -Dunix"
1088 CXXFLAGS="$CXXFLAGS -Dunix"
1089 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
1090 DSO_PIC_CFLAGS='-fPIC -DPIC'
1091 DSO_LDOPTS='-shared'
1092 BIN_FLAGS='-Wl,--export-dynamic'
1094 DSO_PIC_CFLAGS='-fPIC -DPIC'
1095 DSO_LDOPTS='-shared'
1097 # This will fail on a.out systems prior to 1.5.1_ALPHA.
1098 if test "$LIBRUNPATH"; then
1099 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
1101 MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
1102 MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
1106 if test -z "$X11BASE"; then
1109 MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
1111 DSO_PIC_CFLAGS='-fPIC'
1112 DSO_LDOPTS='-shared -fPIC'
1113 if test "$LIBRUNPATH"; then
1114 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
1124 AC_SUBST_LIST(MMX_FLAGS)
1125 AC_SUBST_LIST(SSE_FLAGS)
1126 AC_SUBST_LIST(SSE2_FLAGS)
1127 AC_SUBST_LIST(SSSE3_FLAGS)
1129 AC_SUBST(MOZ_LINKER)
1130 if test -n "$MOZ_LINKER"; then
1131 AC_DEFINE(MOZ_LINKER)
1132 MOZ_LINKER_EXTRACT=1
1133 AC_CHECK_PROGS(XZ, xz)
1136 dnl Only one oddball right now (QNX), but this gives us flexibility
1137 dnl if any other platforms need to override this in the future.
1138 AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
1140 if test -z "$COMPILE_ENVIRONMENT"; then
1141 SKIP_COMPILER_CHECKS=1
1142 SKIP_LIBRARY_CHECKS=1
1147 fi # COMPILE_ENVIRONMENT
1149 if test -z "$SKIP_COMPILER_CHECKS"; then
1150 dnl Checks for typedefs, structures, and compiler characteristics.
1151 dnl ========================================================
1166 case "${OS_TARGET}" in
1170 STL_FLAGS="-I${DIST}/stl_wrappers"
1175 dnl Checks for header files.
1176 dnl ========================================================
1178 case "$target_os" in
1179 bitrig*|dragonfly*|freebsd*|openbsd*)
1180 # for stuff like -lXshm
1181 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
1185 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
1186 AC_CACHE_CHECK(for sockaddr_in.sin_len,
1187 ac_cv_sockaddr_in_sin_len,
1188 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1189 #include <sys/types.h>
1191 #include <netinet/in.h>
1192 struct sockaddr_in x;
1193 void *foo = (void*) &x.sin_len;],
1195 [ac_cv_sockaddr_in_sin_len=true],
1196 [ac_cv_sockaddr_in_sin_len=false])])
1197 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
1198 AC_DEFINE(HAVE_SIN_LEN)
1199 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
1200 AC_DEFINE(HAVE_SCONN_LEN)
1203 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
1204 ac_cv_sockaddr_in6_sin6_len,
1205 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1206 #include <sys/types.h>
1208 #include <netinet/in.h>
1209 struct sockaddr_in6 x;
1210 void *foo = (void*) &x.sin6_len;],
1212 [ac_cv_sockaddr_in6_sin6_len=true],
1213 [ac_cv_sockaddr_in6_sin6_len=false])])
1214 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
1215 AC_DEFINE(HAVE_SIN6_LEN)
1218 AC_CACHE_CHECK(for sockaddr.sa_len,
1219 ac_cv_sockaddr_sa_len,
1220 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1221 #include <sys/types.h>
1223 #include <sys/socket.h>
1225 void *foo = (void*) &x.sa_len;],
1227 [ac_cv_sockaddr_sa_len=true],
1228 [ac_cv_sockaddr_sa_len=false])])
1229 if test "$ac_cv_sockaddr_sa_len" = true ; then
1230 AC_DEFINE(HAVE_SA_LEN)
1233 MOZ_ARG_ENABLE_BOOL(dtrace,
1234 [ --enable-dtrace build with dtrace support if available (default=no)],
1235 [enable_dtrace="yes"],)
1236 if test "x$enable_dtrace" = "xyes"; then
1237 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
1238 if test -n "$HAVE_DTRACE"; then
1239 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
1241 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
1244 AC_SUBST(HAVE_DTRACE)
1246 dnl Checks for libraries.
1247 dnl ========================================================
1248 AC_CHECK_LIB(c_r, gethostbyname_r)
1250 dnl We don't want to link with libdl even if it's present on OS X, since
1251 dnl it's not used and not part of the default installation. OS/2 has dlfcn
1253 dnl We don't want to link against libm or libpthread on Darwin since
1254 dnl they both are just symlinks to libSystem and explicitly linking
1255 dnl against libSystem causes issues when debugging (see bug 299601).
1260 AC_SEARCH_LIBS(dlopen, dl,
1261 MOZ_CHECK_HEADER(dlfcn.h,
1262 AC_DEFINE(HAVE_DLOPEN)))
1266 _SAVE_CFLAGS="$CFLAGS"
1267 CFLAGS="$CFLAGS -D_GNU_SOURCE"
1268 AC_CHECK_FUNCS(dladdr memmem)
1269 CFLAGS="$_SAVE_CFLAGS"
1271 if test ! "$GNU_CXX"; then
1272 AC_CHECK_LIB(C, demangle)
1275 AC_CHECK_LIB(socket, socket)
1278 XLIBS="$X_EXTRA_LIBS"
1280 dnl ========================================================
1281 dnl Checks for X libraries.
1282 dnl Ordering is important.
1283 dnl Xt is dependent upon SM as of X11R6
1284 dnl ========================================================
1285 if test -n "$MOZ_X11"; then
1286 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
1287 _SAVE_LDFLAGS="$LDFLAGS"
1289 LDFLAGS="$XLDFLAGS $LDFLAGS"
1290 AC_CHECK_LIB(X11, XDrawLines, [XLIBS="-lX11 $XLIBS"],
1291 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
1292 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
1293 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
1295 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
1296 unset ac_cv_lib_Xt_XtFree
1297 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
1298 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
1299 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
1300 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
1303 dnl ========================================================
1305 dnl ========================================================
1306 AC_CHECK_LIB(xcb, xcb_connect, [XLIBS="-lxcb $XLIBS"],
1307 [MISSING_X="$MISSING_X -lxcb"], $XLIBS)
1308 AC_CHECK_LIB(xcb-shm, xcb_shm_query_version, [XLIBS="-lxcb-shm $XLIBS"],
1309 [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS)
1310 AC_CHECK_LIB(X11-xcb, XGetXCBConnection, [XLIBS="-lX11-xcb $XLIBS"],
1311 [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS)
1313 dnl ========================================================
1315 dnl ========================================================
1316 MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
1317 AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
1318 [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
1319 AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
1321 LDFLAGS="$_SAVE_LDFLAGS"
1325 AC_SUBST_LIST(XCFLAGS)
1326 AC_SUBST_LIST(XLDFLAGS)
1327 AC_SUBST_LIST(XLIBS)
1328 AC_SUBST_LIST(XEXT_LIBS)
1329 AC_SUBST_LIST(XT_LIBS)
1330 AC_SUBST_LIST(XSS_LIBS)
1332 dnl ========================================================
1333 dnl = pthread support
1334 dnl = Start by checking whether the system support pthreads
1335 dnl ========================================================
1336 case "$target_os" in
1341 AC_CHECK_LIB(pthreads, pthread_create,
1342 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
1343 AC_CHECK_LIB(pthread, pthread_create,
1344 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
1345 AC_CHECK_LIB(c_r, pthread_create,
1346 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
1347 AC_CHECK_LIB(c, pthread_create,
1356 dnl ========================================================
1357 dnl Check the command line for --with-pthreads
1358 dnl ========================================================
1359 MOZ_ARG_WITH_BOOL(pthreads,
1360 [ --with-pthreads Force use of system pthread library with NSPR ],
1361 [ if test "$MOZ_USE_PTHREADS"x = x; then
1362 AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
1368 dnl ========================================================
1369 dnl Do the platform specific pthread hackery
1370 dnl ========================================================
1371 if test "$MOZ_USE_PTHREADS"x != x
1374 dnl See if -pthread is supported.
1377 ac_cv_have_dash_pthread=no
1378 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
1379 echo 'int main() { return 0; }' | cat > conftest.c
1380 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
1381 if test $? -eq 0; then
1382 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1383 ac_cv_have_dash_pthread=yes
1384 case "$target_os" in
1386 # Freebsd doesn't use -pthread for compiles, it uses them for linking
1389 CFLAGS="$CFLAGS -pthread"
1390 CXXFLAGS="$CXXFLAGS -pthread"
1396 AC_MSG_RESULT($ac_cv_have_dash_pthread)
1399 dnl See if -pthreads is supported.
1401 ac_cv_have_dash_pthreads=no
1402 if test "$ac_cv_have_dash_pthread" = "no"; then
1403 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
1404 echo 'int main() { return 0; }' | cat > conftest.c
1405 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
1406 if test $? -eq 0; then
1407 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1408 ac_cv_have_dash_pthreads=yes
1409 CFLAGS="$CFLAGS -pthreads"
1410 CXXFLAGS="$CXXFLAGS -pthreads"
1414 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
1419 AC_DEFINE(_REENTRANT)
1420 AC_DEFINE(_THREAD_SAFE)
1421 dnl -pthread links in -lpthread, so don't specify it explicitly.
1422 if test "$ac_cv_have_dash_pthread" = "yes"; then
1423 _PTHREAD_LDFLAGS="-pthread"
1427 *-*-openbsd*|*-*-bsdi*)
1428 AC_DEFINE(_REENTRANT)
1429 AC_DEFINE(_THREAD_SAFE)
1430 dnl -pthread links in -lc_r, so don't specify it explicitly.
1431 if test "$ac_cv_have_dash_pthread" = "yes"; then
1432 _PTHREAD_LDFLAGS="-pthread"
1436 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
1437 AC_DEFINE(_REENTRANT)
1441 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
1442 AC_SUBST(MOZ_USE_PTHREADS)
1443 MOZ_CHECK_HEADERS(pthread.h)
1447 dnl Checks for library functions.
1448 dnl ========================================================
1449 AC_PROG_GCC_TRADITIONAL
1451 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall)
1453 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1454 dnl avoid this on Darwin, since depending on your system config, we may think
1455 dnl it exists but it really doesn't
1456 case "$OS_TARGET" in
1460 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1461 ac_cv_clock_monotonic,
1462 [for libs in "" -lrt; do
1465 AC_TRY_LINK([#include <time.h>],
1466 [ struct timespec ts;
1467 clock_gettime(CLOCK_MONOTONIC, &ts); ],
1468 ac_cv_clock_monotonic=$libs
1471 ac_cv_clock_monotonic=no)
1474 if test "$ac_cv_clock_monotonic" != "no"; then
1475 HAVE_CLOCK_MONOTONIC=1
1476 REALTIME_LIBS=$ac_cv_clock_monotonic
1477 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1478 AC_SUBST(HAVE_CLOCK_MONOTONIC)
1479 AC_SUBST_LIST(REALTIME_LIBS)
1484 AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
1485 ac_cv_pthread_cond_timedwait_monotonic_np,
1486 AC_TRY_LINK([#include <pthread.h>],
1487 [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
1488 ac_cv_pthread_cond_timewait_monotonic_np=yes,
1489 ac_cv_pthread_cond_timewait_monotonic_np=no))
1490 if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
1491 AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
1494 dnl check for wcrtomb/mbrtowc
1495 dnl =======================================================================
1496 if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
1499 AC_CACHE_CHECK(for wcrtomb,
1501 [AC_TRY_LINK([#include <wchar.h>],
1502 [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
1503 ac_cv_have_wcrtomb="yes",
1504 ac_cv_have_wcrtomb="no")])
1505 if test "$ac_cv_have_wcrtomb" = "yes"; then
1506 AC_DEFINE(HAVE_WCRTOMB)
1508 AC_CACHE_CHECK(for mbrtowc,
1510 [AC_TRY_LINK([#include <wchar.h>],
1511 [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
1512 ac_cv_have_mbrtowc="yes",
1513 ac_cv_have_mbrtowc="no")])
1514 if test "$ac_cv_have_mbrtowc" = "yes"; then
1515 AC_DEFINE(HAVE_MBRTOWC)
1522 ac_cv_func_res_ninit,
1523 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
1524 dnl no need for res_ninit() on NetBSD and OpenBSD
1525 ac_cv_func_res_ninit=no
1529 #define _BSD_SOURCE 1
1531 #include <sys/types.h>
1532 #include <netinet/in.h>
1533 #include <arpa/nameser.h>
1536 [int foo = res_ninit(&_res);],
1537 [ac_cv_func_res_ninit=yes],
1538 [ac_cv_func_res_ninit=no])
1542 if test "$ac_cv_func_res_ninit" = "yes"; then
1543 AC_DEFINE(HAVE_RES_NINIT)
1544 dnl must add the link line we do something as foolish as this... dougt
1546 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
1547 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
1559 AC_CHECK_LIB(c, iconv, [ICONV_LIBS=],
1560 AC_CHECK_LIB(iconv, iconv, [ICONV_LIBS="-liconv"],
1561 AC_CHECK_LIB(iconv, libiconv, [ICONV_LIBS="-liconv"])))
1563 LIBS="$LIBS $ICONV_LIBS"
1572 iconv_t h = iconv_open("", "");
1573 iconv(h, NULL, NULL, NULL, NULL);
1576 [ac_cv_func_iconv=yes],
1577 [ac_cv_func_iconv=no]
1580 if test "$ac_cv_func_iconv" = "yes"; then
1581 AC_DEFINE(HAVE_ICONV)
1582 LIBICONV="$ICONV_LIBS"
1584 [for iconv() with const input],
1585 ac_cv_func_const_iconv,
1591 const char *input = "testing";
1592 iconv_t h = iconv_open("", "");
1593 iconv(h, &input, NULL, NULL, NULL);
1596 [ac_cv_func_const_iconv=yes],
1597 [ac_cv_func_const_iconv=no]
1600 if test "$ac_cv_func_const_iconv" = "yes"; then
1601 AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
1609 AC_SUBST_LIST(ICONV_LIBS)
1615 dnl **********************
1616 dnl *** va_copy checks ***
1617 AC_CACHE_CHECK([for an implementation of va_copy()],
1619 [AC_TRY_COMPILE([#include <stdarg.h>
1621 void f (int i, ...) {
1622 va_list args1, args2;
1623 va_start (args1, i);
1624 va_copy (args2, args1);
1625 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1627 va_end (args1); va_end (args2);
1629 [f(0, 42); return 0],
1630 [ac_cv_va_copy=yes],
1634 AC_CACHE_CHECK([whether va_list can be copied by value],
1636 [AC_TRY_COMPILE([#include <stdarg.h>
1638 void f (int i, ...) {
1639 va_list args1, args2;
1640 va_start (args1, i);
1642 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1644 va_end (args1); va_end (args2);
1646 [f(0, 42); return 0],
1647 [ac_cv_va_val_copy=yes],
1648 [ac_cv_va_val_copy=no],
1651 if test "x$ac_cv_va_copy" = "xyes"; then
1652 AC_DEFINE(VA_COPY, va_copy)
1653 AC_DEFINE(HAVE_VA_COPY)
1656 if test "x$ac_cv_va_val_copy" = "xno"; then
1657 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
1660 dnl ===================================================================
1661 dnl ========================================================
1662 dnl Put your C++ language/feature checks below
1663 dnl ========================================================
1667 if test "$GNU_CC"; then
1668 if test "$CPU_ARCH" = "arm" ; then
1669 AC_CACHE_CHECK(for ARM EABI,
1673 #if defined(__ARM_EABI__)
1676 #error Not ARM EABI.
1679 ac_cv_gcc_arm_eabi="yes",
1680 ac_cv_gcc_arm_eabi="no")])
1681 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
1683 ARM_ABI_PREFIX=eabi-
1685 ARM_ABI_PREFIX=oabi-
1689 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
1692 dnl See if a dynamic_cast to void* gives the most derived object.
1693 AC_CACHE_CHECK(for C++ dynamic_cast to void*,
1694 ac_cv_cpp_dynamic_cast_void_ptr,
1695 [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
1696 class Y { int j; public: virtual ~Y() { } };
1697 class Z : public X, public Y { int k; };
1703 return !((((void*)&mdo != (void*)subx) &&
1704 ((void*)&mdo == dynamic_cast<void*>(subx))) ||
1705 (((void*)&mdo != (void*)suby) &&
1706 ((void*)&mdo == dynamic_cast<void*>(suby))));
1708 ac_cv_cpp_dynamic_cast_void_ptr=yes,
1709 ac_cv_cpp_dynamic_cast_void_ptr=no,
1710 ac_cv_cpp_dynamic_cast_void_ptr=no)])
1711 if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
1712 AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
1716 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
1717 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
1718 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
1720 _SAVE_LDFLAGS=$LDFLAGS
1721 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
1722 AC_CACHE_CHECK(for __thread keyword for TLS variables,
1723 ac_cv_thread_keyword,
1724 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
1725 [return tlsIsMainThread;],
1726 ac_cv_thread_keyword=yes,
1727 ac_cv_thread_keyword=no)])
1728 LDFLAGS=$_SAVE_LDFLAGS
1729 # The custom dynamic linker doesn't support TLS variables
1731 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
1732 # mips builds fail with TLS variables because of a binutils bug.
1734 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
1739 *-android*|*-linuxandroid*)
1746 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
1752 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
1753 if test -n "$MOZ_LINKER"; then
1754 if test "$CPU_ARCH" = arm; then
1755 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
1756 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
1757 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1758 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1762 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
1763 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
1764 dnl Since the linker only understands the sysv ones, no need to build the
1765 dnl gnu style tables anyways.
1766 LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
1769 dnl The custom linker doesn't support text relocations, but NDK >= r6b
1770 dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
1771 dnl We however want to avoid these text relocations, and this can be done
1772 dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
1773 dnl doesn't contain anything at all, beside placeholders for some sections,
1774 dnl and crtbegin only contains a finalizer function that calls
1775 dnl __cxa_finalize. The custom linker actually takes care of calling
1776 dnl __cxa_finalize when the library doesn't call it itself, which makes it
1777 dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
1778 dnl link crtbegin and crtend at all.
1779 if test -n "$MOZ_LINKER" -a "$OS_TARGET" = "Android"; then
1780 AC_CACHE_CHECK([whether the CRT objects have text relocations],
1781 ac_cv_crt_has_text_relocations,
1782 [echo 'int foo() { return 0; }' > conftest.cpp
1783 if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
1784 test -s conftest${DLL_SUFFIX}; then
1785 if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
1786 ac_cv_crt_has_text_relocations=yes
1788 ac_cv_crt_has_text_relocations=no
1791 AC_ERROR([couldn't compile a simple C file])
1794 if test "$ac_cv_crt_has_text_relocations" = yes; then
1795 dnl While we want libraries to skip the CRT files, we don't want
1796 dnl executables to be treated the same way. We thus set the flag
1797 dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
1798 dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
1799 dnl Using LDFLAGS in nspr is safe, since we only really build
1800 dnl libraries there.
1801 DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
1805 dnl End of C++ language/feature checks
1808 dnl ========================================================
1809 dnl = Internationalization checks
1810 dnl ========================================================
1812 dnl Internationalization and Locale support is different
1813 dnl on various UNIX platforms. Checks for specific i18n
1814 dnl features go here.
1816 dnl check for LC_MESSAGES
1817 AC_CACHE_CHECK(for LC_MESSAGES,
1818 ac_cv_i18n_lc_messages,
1819 [AC_TRY_COMPILE([#include <locale.h>],
1820 [int category = LC_MESSAGES;],
1821 ac_cv_i18n_lc_messages=yes,
1822 ac_cv_i18n_lc_messages=no)])
1823 if test "$ac_cv_i18n_lc_messages" = yes; then
1824 AC_DEFINE(HAVE_I18N_LC_MESSAGES)
1827 AC_HAVE_FUNCS(localeconv)
1829 fi # ! SKIP_COMPILER_CHECKS
1831 if test -n "${COMPILE_ENVIRONMENT}"; then
1836 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1837 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1838 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1841 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1842 dnl features that Windows actually does support.
1844 if test -n "$SKIP_COMPILER_CHECKS"; then
1845 dnl Windows has malloc.h
1846 AC_DEFINE(MALLOC_H, [<malloc.h>])
1847 AC_DEFINE(HAVE_FORCEINLINE)
1848 AC_DEFINE(HAVE_LOCALECONV)
1849 fi # SKIP_COMPILER_CHECKS
1851 dnl Mozilla specific options
1852 dnl ========================================================
1853 dnl The macros used for command line options
1854 dnl are defined in build/autoconf/altoptions.m4.
1856 dnl ========================================================
1858 dnl = Check for external package dependencies
1860 dnl ========================================================
1861 MOZ_ARG_HEADER(External Packages)
1863 case "$OS_TARGET" in
1864 WINNT|Darwin|Android)
1874 dnl ========================================================
1875 dnl system libevent Support
1876 dnl ========================================================
1877 MOZ_ARG_WITH_STRING(system-libevent,
1878 [ --with-system-libevent[=PFX]
1879 Use system libevent [installed at prefix PFX]],
1880 LIBEVENT_DIR=$withval)
1882 _SAVE_CFLAGS=$CFLAGS
1883 _SAVE_LDFLAGS=$LDFLAGS
1885 if test "$LIBEVENT_DIR" = yes; then
1886 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
1887 MOZ_SYSTEM_LIBEVENT=1,
1890 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
1891 MOZ_SYSTEM_LIBEVENT=
1892 elif test -z "$MOZ_SYSTEM_LIBEVENT"; then
1893 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
1894 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
1895 MOZ_CHECK_HEADER(event.h,
1896 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
1897 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
1899 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
1900 AC_CHECK_LIB(event, event_init,
1901 [MOZ_SYSTEM_LIBEVENT=1
1902 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
1903 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
1904 [MOZ_SYSTEM_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
1906 CFLAGS=$_SAVE_CFLAGS
1907 LDFLAGS=$_SAVE_LDFLAGS
1910 AC_SUBST(MOZ_SYSTEM_LIBEVENT)
1912 dnl ========================================================
1913 dnl = If NSS was not detected in the system,
1914 dnl = use the one in the source tree (mozilla/security/nss)
1915 dnl ========================================================
1917 MOZ_ARG_WITH_BOOL(system-nss,
1918 [ --with-system-nss Use system installed NSS],
1921 if test -n "$_USE_SYSTEM_NSS"; then
1922 AM_PATH_NSS(3.32, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
1925 if test -n "$MOZ_SYSTEM_NSS"; then
1926 NSS_LIBS="$NSS_LIBS -lcrmf"
1928 NSS_CFLAGS="-I${DIST}/include/nss"
1929 case "${OS_ARCH}" in
1930 # Only few platforms have been tested with GYP
1931 WINNT|Darwin|Linux|DragonFly|FreeBSD|NetBSD|OpenBSD|SunOS)
1934 AC_MSG_ERROR([building in-tree NSS is not supported on this platform. Use --with-system-nss])
1939 if test -z "$SKIP_LIBRARY_CHECKS"; then
1940 dnl system JPEG support
1941 dnl ========================================================
1942 MOZ_ARG_WITH_STRING(system-jpeg,
1943 [ --with-system-jpeg[=PFX]
1944 Use system libjpeg [installed at prefix PFX]],
1947 _SAVE_CFLAGS=$CFLAGS
1948 _SAVE_LDFLAGS=$LDFLAGS
1950 if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
1951 CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
1952 LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
1954 if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
1957 AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_SYSTEM_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_SYSTEM_JPEG=)
1960 if test "$MOZ_SYSTEM_JPEG" = 1; then
1961 AC_TRY_COMPILE([ #include <stdio.h>
1962 #include <sys/types.h>
1963 #include <jpeglib.h> ],
1964 [ #if JPEG_LIB_VERSION < $MOZJPEG
1965 #error "Insufficient JPEG library version ($MOZJPEG required)."
1967 #ifndef JCS_EXTENSIONS
1968 #error "libjpeg-turbo JCS_EXTENSIONS required"
1972 AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
1974 CFLAGS=$_SAVE_CFLAGS
1975 LDFLAGS=$_SAVE_LDFLAGS
1978 if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_SYSTEM_JPEG" = 1; then
1979 MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
1980 MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
1982 fi # SKIP_LIBRARY_CHECKS
1984 dnl system ZLIB support
1985 dnl ========================================================
1986 MOZ_ZLIB_CHECK([1.2.3])
1988 if test -z "$SKIP_LIBRARY_CHECKS"; then
1989 dnl system BZIP2 Support
1990 dnl ========================================================
1991 MOZ_ARG_WITH_STRING(system-bz2,
1992 [ --with-system-bz2[=PFX]
1993 Use system libbz2 [installed at prefix PFX]],
1996 _SAVE_CFLAGS=$CFLAGS
1997 _SAVE_LDFLAGS=$LDFLAGS
1999 if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
2000 CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
2001 LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
2003 if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
2006 AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_SYSTEM_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
2007 [MOZ_SYSTEM_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
2009 CFLAGS=$_SAVE_CFLAGS
2010 LDFLAGS=$_SAVE_LDFLAGS
2013 if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_SYSTEM_BZ2" = 1; then
2014 MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
2015 MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
2018 dnl ========================================================
2019 dnl system PNG Support
2020 dnl ========================================================
2021 MOZ_ARG_WITH_STRING(system-png,
2022 [ --with-system-png[=PFX]
2023 Use system libpng [installed at prefix PFX]],
2026 _SAVE_CFLAGS=$CFLAGS
2027 _SAVE_LDFLAGS=$LDFLAGS
2029 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
2030 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
2031 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
2033 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
2036 AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"],
2037 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
2038 AC_CHECK_LIB(png, png_get_acTL, ,
2039 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
2041 if test "$MOZ_SYSTEM_PNG" = 1; then
2042 AC_TRY_COMPILE([ #include <stdio.h>
2043 #include <sys/types.h>
2045 [ #if PNG_LIBPNG_VER < $MOZPNG
2046 #error "Insufficient libpng version ($MOZPNG required)."
2048 #ifndef PNG_UINT_31_MAX
2049 #error "Insufficient libpng version."
2052 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
2054 CFLAGS=$_SAVE_CFLAGS
2055 LDFLAGS=$_SAVE_LDFLAGS
2058 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then
2059 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
2060 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
2063 fi # SKIP_LIBRARY_CHECKS
2065 dnl ========================================================
2069 dnl ========================================================
2071 MOZ_ARG_HEADER(Application)
2073 ENABLE_SYSTEM_EXTENSION_DIRS=1
2074 MOZ_BRANDING_DIRECTORY=
2075 MOZ_OFFICIAL_BRANDING=
2077 MOZ_AUTH_EXTENSION=1
2078 if test "$MOZ_IOS"; then
2084 MOZ_SAMPLE_TYPE_FLOAT32=
2085 MOZ_SAMPLE_TYPE_S16=
2089 MOZ_WEBRTC_SIGNALING=
2090 MOZ_WEBRTC_ASSERT_ALWAYS=1
2091 MOZ_WEBRTC_HARDWARE_AEC_NS=
2099 LIBJPEG_TURBO_ASFLAGS=
2100 MOZ_PREF_EXTENSIONS=1
2103 MOZ_TOOLKIT_SEARCH=1
2105 MOZ_UNIVERSALCHARDET=1
2111 MOZ_USE_NATIVE_POPUP_WINDOWS=
2112 MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
2115 MOZ_CONTENT_SANDBOX=
2118 MOZ_BINARY_EXTENSIONS=
2121 case "$target_os" in
2124 AC_DEFINE(NS_ENABLE_TSF)
2129 *-android*|*-linuxandroid*)
2135 # Optional Firefox for Android partner distribution directory.
2136 MOZ_ARG_WITH_STRING(android-distribution-directory,
2137 [ --with-android-distribution-directory=dir
2138 Optional Firefox for Android partner distribution directory.],
2139 MOZ_ANDROID_DISTRIBUTION_DIRECTORY=$withval)
2141 if test -n "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY"; then
2142 # A distribution directory must have an assets/distribution directory.
2143 # See https://wiki.mozilla.org/Mobile/Distribution_Files.
2144 if test ! -d "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY/assets/distribution" ; then
2145 AC_MSG_ERROR([--with-android-distribution-directory does not contain assets/distribution;
2146 (looked for ${MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets/distribution).])
2149 AC_SUBST(MOZ_ANDROID_DISTRIBUTION_DIRECTORY)
2151 dnl ========================================================
2152 dnl = Trademarked Branding
2153 dnl ========================================================
2154 MOZ_ARG_ENABLE_BOOL(official-branding,
2155 [ --enable-official-branding
2156 Enable Official mozilla.org Branding
2157 Do not distribute builds with
2158 --enable-official-branding unless you have
2159 permission to use trademarks per
2160 http://www.mozilla.org/foundation/trademarks/ .],
2161 MOZ_OFFICIAL_BRANDING=1,
2162 MOZ_OFFICIAL_BRANDING=)
2164 # Allow the application to influence configure with a confvars.sh script.
2165 AC_MSG_CHECKING([if app-specific confvars.sh exists])
2166 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
2167 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
2168 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
2173 # Allow influencing configure with a defines.sh script.
2174 . "${srcdir}/build/defines.sh"
2176 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
2178 if test "$BUILDING_RELEASE"; then
2179 # Override value in defines.sh, if any
2180 EARLY_BETA_OR_EARLIER=
2181 elif test "$EARLY_BETA_OR_EARLIER"; then
2182 AC_DEFINE(EARLY_BETA_OR_EARLIER)
2184 AC_SUBST(EARLY_BETA_OR_EARLIER)
2186 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
2187 MOZ_ARG_WITH_STRING(app-name,
2188 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
2189 WITH_APP_NAME=$withval,
2192 if test -n "$WITH_APP_NAME" ; then
2193 MOZ_APP_NAME="$WITH_APP_NAME"
2196 MOZ_ARG_WITH_STRING(app-basename,
2197 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
2198 WITH_APP_BASENAME=$withval,
2201 if test -n "$WITH_APP_BASENAME" ; then
2202 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
2205 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
2206 # that haven't made a confvars.sh yet. Don't add new stuff here, use
2208 case "$MOZ_BUILD_APP" in
2210 AC_DEFINE(MOZ_PHOENIX)
2214 AC_DEFINE(MOZ_XULRUNNER)
2218 if test -n "$MOZ_B2G"; then
2222 # Graphene is a desktop runtime for running applications with a HTML UI.
2223 if test -n "$MOZ_GRAPHENE"; then
2224 AC_DEFINE(MOZ_GRAPHENE)
2227 if test -n "$MOZ_MULET"; then
2228 AC_DEFINE(MOZ_MULET)
2231 # Propagate feature switches for code written in rust from confvars.sh
2232 if test -n "$MOZ_RUST_URLPARSE"; then
2233 AC_DEFINE(MOZ_RUST_URLPARSE)
2234 AC_SUBST(MOZ_RUST_URLPARSE)
2237 AC_SUBST(MOZ_PHOENIX)
2238 AC_SUBST(MOZ_XULRUNNER)
2241 AC_SUBST(MOZ_B2G_VERSION)
2243 dnl ========================================================
2244 dnl Ensure Android SDK and build-tools versions depending on
2246 dnl ========================================================
2248 case "$MOZ_BUILD_APP" in
2250 MOZ_ANDROID_SDK(23, 23, 23.0.3 23.0.1, 25.3.2 25.3.1)
2254 dnl ========================================================
2256 dnl = Toolkit Options
2258 dnl ========================================================
2259 MOZ_ARG_HEADER(Toolkit Options)
2261 dnl ========================================================
2262 dnl = Enable the toolkit as needed =
2263 dnl ========================================================
2265 case "$MOZ_WIDGET_TOOLKIT" in
2268 LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
2269 # Use -Wl as a trick to avoid -framework and framework names from
2270 # being separated by AC_SUBST_LIST.
2271 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'
2273 CFLAGS="$CFLAGS $TK_CFLAGS"
2274 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
2275 MOZ_USER_DIR="Mozilla"
2276 MOZ_FS_LAYOUT=bundle
2280 LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
2282 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'
2283 CFLAGS="$CFLAGS $TK_CFLAGS"
2284 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
2285 MOZ_USER_DIR="Mozilla"
2286 MOZ_FS_LAYOUT=bundle
2291 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
2292 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
2293 case "$MOZ_WIDGET_TOOLKIT" in
2299 if test "$COMPILE_ENVIRONMENT"; then
2300 if test "$MOZ_WIDGET_TOOLKIT" = gtk3; then
2301 PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
2302 MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
2303 TK_CFLAGS=$MOZ_GTK3_CFLAGS
2304 TK_LIBS=$MOZ_GTK3_LIBS
2305 dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
2306 dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
2307 AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
2308 GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32
2310 if test "$MOZ_WIDGET_TOOLKIT" = gtk2; then
2311 GLIB_VERSION_MAX_ALLOWED=$GLIB_VERSION_MIN_REQUIRED
2313 if test "$MOZ_ENABLE_GTK"; then
2314 if test "$MOZ_X11"; then
2315 GDK_PACKAGES=gdk-x11-2.0
2317 AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
2318 AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
2320 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)
2321 MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
2323 if test "$MOZ_WIDGET_TOOLKIT" = gtk2; then
2324 TK_CFLAGS=$MOZ_GTK2_CFLAGS
2325 TK_LIBS=$MOZ_GTK2_LIBS
2327 fi # COMPILE_ENVIRONMENT
2329 AC_SUBST(MOZ_FS_LAYOUT)
2331 dnl ========================================================
2332 dnl = startup-notification support module
2333 dnl ========================================================
2335 if test "$MOZ_ENABLE_GTK"
2337 MOZ_ENABLE_STARTUP_NOTIFICATION=
2339 MOZ_ARG_ENABLE_BOOL(startup-notification,
2340 [ --enable-startup-notification
2341 Enable startup-notification support (default: disabled) ],
2342 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
2343 MOZ_ENABLE_STARTUP_NOTIFICATION=)
2344 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
2346 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
2347 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
2348 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
2349 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
2351 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
2353 MOZ_ENABLE_STARTUP_NOTIFICATION=
2357 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
2358 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
2361 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
2363 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
2365 AC_SUBST_LIST(TK_CFLAGS)
2366 AC_SUBST_LIST(TK_LIBS)
2371 dnl ========================================================
2373 dnl = Components & Features
2375 dnl ========================================================
2376 MOZ_ARG_HEADER(Components and Features)
2378 dnl ========================================================
2380 dnl ========================================================
2381 MOZ_ARG_ENABLE_STRING(ui-locale,
2382 [ --enable-ui-locale=ab-CD
2383 Select the user interface locale (default: en-US)],
2384 MOZ_UI_LOCALE=$enableval )
2385 AC_SUBST(MOZ_UI_LOCALE)
2387 AC_SUBST(MOZ_OFFICIAL_BRANDING)
2388 if test -n "$MOZ_OFFICIAL_BRANDING"; then
2389 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
2390 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
2392 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
2393 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
2397 MOZ_ARG_WITH_STRING(branding,
2398 [ --with-branding=dir Use branding from the specified directory.],
2399 MOZ_BRANDING_DIRECTORY=$withval)
2401 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
2402 if test -z "$REAL_BRANDING_DIRECTORY"; then
2403 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
2406 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
2407 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
2408 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
2409 . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
2412 AC_SUBST(MOZ_BRANDING_DIRECTORY)
2414 dnl ========================================================
2415 dnl = Distribution ID
2416 dnl ========================================================
2417 MOZ_ARG_WITH_STRING(distribution-id,
2418 [ --with-distribution-id=ID
2419 Set distribution-specific id (default=org.mozilla)],
2420 [ val=`echo $withval`
2421 MOZ_DISTRIBUTION_ID="$val"])
2423 if test -z "$MOZ_DISTRIBUTION_ID"; then
2424 MOZ_DISTRIBUTION_ID="org.mozilla"
2427 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
2428 AC_SUBST(MOZ_DISTRIBUTION_ID)
2431 dnl ========================================================
2432 dnl Google Play Services, placed here so it can depend on
2433 dnl values set by configure.sh above.
2434 dnl ========================================================
2436 MOZ_ANDROID_GOOGLE_PLAY_SERVICES
2437 MOZ_ANDROID_GOOGLE_CLOUD_MESSAGING
2438 MOZ_ANDROID_INSTALL_TRACKING
2441 dnl ========================================================
2442 dnl = GConf support module
2443 dnl ========================================================
2447 if test "$MOZ_ENABLE_GTK"
2452 dnl ========================================================
2453 dnl = GConf support module
2454 dnl ========================================================
2455 MOZ_ARG_DISABLE_BOOL(gconf,
2456 [ --disable-gconf Disable Gconf support ],
2460 if test "$MOZ_ENABLE_GCONF"
2462 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
2463 MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
2466 if test -n "$MOZ_ENABLE_GCONF";
2468 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
2470 AC_MSG_WARN([Many automated tests will fail with --disable-gconf. See bug 1167201.])
2475 if test "$MOZ_ENABLE_GCONF"; then
2476 AC_DEFINE(MOZ_ENABLE_GCONF)
2479 AC_SUBST(MOZ_ENABLE_GCONF)
2482 dnl ========================================================
2483 dnl = libproxy support
2484 dnl ========================================================
2486 if test "$MOZ_ENABLE_GTK"
2488 MOZ_ENABLE_LIBPROXY=
2490 MOZ_ARG_ENABLE_BOOL(libproxy,
2491 [ --enable-libproxy Enable libproxy support ],
2492 MOZ_ENABLE_LIBPROXY=1,
2493 MOZ_ENABLE_LIBPROXY=)
2495 if test "$MOZ_ENABLE_LIBPROXY"
2497 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
2498 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
2501 AC_SUBST(MOZ_ENABLE_LIBPROXY)
2503 dnl ========================================================
2505 dnl ========================================================
2507 if test "$MOZ_ENABLE_GTK"
2511 MOZ_ARG_DISABLE_BOOL(dbus,
2512 [ --disable-dbus Disable dbus support ],
2516 if test "$MOZ_ENABLE_DBUS"
2518 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
2519 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
2520 AC_DEFINE(MOZ_ENABLE_DBUS)
2523 AC_SUBST(MOZ_ENABLE_DBUS)
2525 dnl =========================================================
2526 dnl = Whether to exclude hyphenations files in the build
2527 dnl =========================================================
2528 if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
2529 AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
2532 dnl ========================================================
2533 dnl accessibility support on by default on all platforms
2534 dnl ========================================================
2535 MOZ_ARG_DISABLE_BOOL(accessibility,
2536 [ --disable-accessibility Disable accessibility support],
2539 if test "$ACCESSIBILITY"; then
2542 if test -z "$MIDL"; then
2543 if test "$GCC" != "yes"; then
2544 AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
2546 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.])
2550 AC_DEFINE(ACCESSIBILITY)
2553 dnl ========================================================
2554 dnl Accessibility is required for the linuxgl widget
2556 dnl ========================================================
2557 if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
2558 AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
2561 dnl Turn off webrtc for OS's we don't handle yet, but allow
2562 dnl --enable-webrtc to override. Can disable for everything in
2563 dnl the master list above.
2564 if test -n "$MOZ_WEBRTC"; then
2566 *-linux*|*-mingw*|*-darwin*|*-android*|*-linuxandroid*|*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*)
2570 dnl default to disabled for all others
2576 AC_TRY_COMPILE([#include <linux/ethtool.h>],
2577 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
2578 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
2580 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
2582 # target_arch is from {ia32|x64|arm|ppc}
2584 x86_64 | arm | aarch64 | x86 | ppc* | ia64)
2588 # unsupported arch for webrtc
2594 dnl ========================================================
2595 dnl = Disable WebRTC code
2596 dnl ========================================================
2597 MOZ_ARG_DISABLE_BOOL(webrtc,
2598 [ --disable-webrtc Disable support for WebRTC],
2602 if test -n "$MOZ_WEBRTC"; then
2603 AC_DEFINE(MOZ_WEBRTC)
2604 dnl MOZ_WEBRTC_ASSERT_ALWAYS turns on a number of safety asserts in
2605 dnl opt/production builds (via MOZ_CRASH())
2606 AC_DEFINE(MOZ_WEBRTC_ASSERT_ALWAYS)
2609 dnl enable once Signaling lands
2610 MOZ_WEBRTC_SIGNALING=1
2611 AC_DEFINE(MOZ_WEBRTC_SIGNALING)
2612 dnl enable once PeerConnection lands
2613 MOZ_PEERCONNECTION=1
2614 AC_DEFINE(MOZ_PEERCONNECTION)
2619 if test -n "$MOZ_X11"; then
2620 MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
2626 dnl ========================================================
2627 dnl = Force hardware AEC, disable webrtc.org AEC
2628 dnl ========================================================
2629 MOZ_ARG_ENABLE_BOOL(hardware-aec-ns,
2630 [ --enable-hardware-aec-ns Enable support for hardware AEC and noise suppression],
2631 MOZ_WEBRTC_HARDWARE_AEC_NS=1,
2632 MOZ_WEBRTC_HARDWARE_AEC_NS=)
2634 if test -n "$MOZ_WEBRTC_HARDWARE_AEC_NS"; then
2635 AC_DEFINE(MOZ_WEBRTC_HARDWARE_AEC_NS)
2638 AC_SUBST(MOZ_WEBRTC)
2639 AC_SUBST(MOZ_WEBRTC_SIGNALING)
2640 AC_SUBST(MOZ_PEERCONNECTION)
2641 AC_SUBST(MOZ_WEBRTC_ASSERT_ALWAYS)
2642 AC_SUBST(MOZ_WEBRTC_HARDWARE_AEC_NS)
2645 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
2647 dnl Use integers over floats for audio on B2G and Android
2648 dnl (regarless of the CPU architecture, because audio
2649 dnl backends for those platforms don't support floats. We also
2650 dnl use integers on ARM with other OS, because it's more efficient.
2651 if test "$OS_TARGET" = "Android" -o "$CPU_ARCH" = "arm"; then
2652 MOZ_SAMPLE_TYPE_S16=1
2653 AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
2654 AC_SUBST(MOZ_SAMPLE_TYPE_S16)
2656 MOZ_SAMPLE_TYPE_FLOAT32=1
2657 AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
2658 AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
2661 dnl ========================================================
2662 dnl = Enable Raw Codecs
2663 dnl ========================================================
2664 MOZ_ARG_ENABLE_BOOL(raw,
2665 [ --enable-raw Enable support for RAW media],
2669 if test -n "$MOZ_RAW"; then
2675 dnl ========================================================
2676 dnl = Apple platform decoder support
2677 dnl ========================================================
2678 if test "$COMPILE_ENVIRONMENT"; then
2679 if test -n "$MOZ_APPLEMEDIA"; then
2680 # hack in frameworks for fmp4 - see bug 1029974
2681 # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
2682 LDFLAGS="$LDFLAGS -framework AudioToolbox"
2683 dnl Verify CoreMedia is available.
2684 AC_CHECK_HEADER([CoreMedia/CoreMedia.h], [],
2685 [AC_MSG_ERROR([MacOS X 10.7 SDK or later is required])])
2687 fi # COMPILE_ENVIRONMENT
2689 dnl system libvpx Support
2690 dnl ========================================================
2691 MOZ_ARG_WITH_BOOL(system-libvpx,
2692 [ --with-system-libvpx Use system libvpx (located with pkgconfig)],
2693 MOZ_SYSTEM_LIBVPX=1)
2698 _SAVE_CFLAGS=$CFLAGS
2700 if test -n "$MOZ_SYSTEM_LIBVPX"; then
2701 dnl ============================
2702 dnl === libvpx Version check ===
2703 dnl ============================
2704 dnl Check to see if we have a system libvpx package.
2705 PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.5.0)
2707 CFLAGS="$CFLAGS $MOZ_LIBVPX_CFLAGS"
2708 LIBS="$LIBS $MOZ_LIBVPX_LIBS"
2710 MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [],
2711 [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.])])
2713 AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [],
2714 [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])])
2716 MOZ_CHECK_HEADER([vpx_mem/vpx_mem.h],
2717 [AC_CHECK_FUNC(vpx_mem_set_functions)])
2718 if test "$ac_cv_header_vpx_mem_vpx_mem_h" = no -o \
2719 "$ac_cv_func_vpx_mem_set_functions" = no; then
2720 AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
2723 CFLAGS=$_SAVE_CFLAGS
2726 AC_SUBST(MOZ_SYSTEM_LIBVPX)
2727 AC_SUBST_LIST(MOZ_LIBVPX_CFLAGS)
2728 AC_SUBST_LIST(MOZ_LIBVPX_LIBS)
2730 if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
2736 if test -z "$MOZ_SYSTEM_LIBVPX"; then
2738 dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
2739 dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
2740 dnl We currently require gcc on all arm platforms.
2742 dnl See if we have assembly on this platform.
2743 case "$OS_ARCH:$CPU_ARCH" in
2757 dnl Check for yasm 1.1 or greater.
2758 if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
2759 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.])
2760 elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
2761 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.])
2765 dnl The encoder needs obj_int_extract to get asm offsets.
2766 fi # COMPILE_ENVIRONMENT and others
2769 if test -n "$GNU_AS" ; then
2770 dnl These flags are a lie; they're just used to enable the requisite
2771 dnl opcodes; actual arch detection is done at runtime.
2772 VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
2773 VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/libvpx/build/make/ads2gas.pl'
2775 dnl Building with -mfpu=neon requires either the "softfp" or the
2776 dnl "hardfp" ABI. Depending on the compiler's default target, and the
2777 dnl CFLAGS, the default ABI might be neither, in which case it is the
2778 dnl "softfloat" ABI.
2779 dnl The "softfloat" ABI is binary-compatible with the "softfp" ABI, so
2780 dnl we can safely mix code built with both ABIs. So, if we detect
2781 dnl that compiling uses the "softfloat" ABI, force the use of the
2782 dnl "softfp" ABI instead.
2783 dnl Confusingly, the __SOFTFP__ preprocessor variable indicates the
2784 dnl "softfloat" ABI, not the "softfp" ABI.
2785 dnl Note: VPX_ASFLAGS is also used in CFLAGS.
2788 #error "compiler target supports -mfpu=neon, so we don't have to add extra flags"
2790 VPX_ASFLAGS="$VPX_ASFLAGS -mfloat-abi=softfp"
2795 if $CC -E -dM -</dev/null | grep -q __ELF__; then
2801 if $CC -E -dM -</dev/null | grep -q __ELF__; then
2808 if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_USE_YASM" -a -z "$YASM"; then
2809 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.])
2810 fi # COMPILE_ENVIRONMENT and others
2812 if test -n "$VPX_USE_YASM" && test "$OS_ARCH:$CPU_ARCH" != "WINNT:x86_64"; then
2816 if test -n "$VPX_X86_ASM"; then
2817 AC_DEFINE(VPX_X86_ASM)
2818 elif test -n "$VPX_ARM_ASM"; then
2819 AC_DEFINE(VPX_ARM_ASM)
2821 AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
2824 dnl native libvpx no longer has vpx_mem_set_functions
2825 AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
2828 dnl ========================================================
2829 dnl = Handle dependent MEDIA defines
2830 dnl ========================================================
2832 if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
2833 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/])
2836 if test -n "$MOZ_VORBIS"; then
2837 AC_DEFINE(MOZ_VORBIS)
2840 if test -n "$MOZ_TREMOR"; then
2841 AC_DEFINE(MOZ_TREMOR)
2845 AC_DEFINE(MOZ_WEBM_ENCODER)
2846 AC_SUBST(MOZ_WEBM_ENCODER)
2848 dnl ==================================
2849 dnl = Check alsa availability on Linux
2850 dnl ==================================
2852 MOZ_ARG_ENABLE_BOOL(alsa,
2853 [ --enable-alsa Enable Alsa support],
2857 if test -n "$MOZ_ALSA"; then
2858 PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
2859 [echo "$MOZ_ALSA_PKG_ERRORS"
2860 AC_MSG_ERROR([Need alsa for audio output on Linux. (On Ubuntu, you might try installing the package libasound2-dev.)])])
2865 dnl ========================================================
2866 dnl = Disable PulseAudio
2867 dnl ========================================================
2869 dnl If using Desktop Linux, ensure that the PA library is available
2870 case "$OS_TARGET" in
2871 WINNT|Darwin|Android|OpenBSD)
2878 MOZ_ARG_DISABLE_BOOL(pulseaudio,
2879 [ --disable-pulseaudio Disable PulseAudio support],
2883 if test -n "$MOZ_PULSEAUDIO"; then
2884 AC_DEFINE(MOZ_PULSEAUDIO)
2885 PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
2886 [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
2887 AC_MSG_ERROR([pulseaudio audio backend requires libpulse development package])])
2890 AC_SUBST(MOZ_PULSEAUDIO)
2892 dnl ========================================================
2894 dnl ========================================================
2896 MOZ_ARG_DISABLE_BOOL(negotiateauth,
2897 [ --disable-negotiateauth Disable GSS-API negotiation ],
2898 MOZ_AUTH_EXTENSION=,
2899 MOZ_AUTH_EXTENSION=1 )
2901 if test -n "$MOZ_IOS" -a -n "$MOZ_AUTH_EXTENSION"; then
2902 AC_MSG_ERROR([negotiateauth is not supported on iOS.])
2905 dnl ========================================================
2906 dnl Pref extensions (autoconfig)
2907 dnl ========================================================
2908 MOZ_ARG_DISABLE_BOOL(pref-extensions,
2909 [ --disable-pref-extensions
2910 Disable pref extensions such as autoconfig],
2911 MOZ_PREF_EXTENSIONS=,
2912 MOZ_PREF_EXTENSIONS=1 )
2914 dnl ========================================================
2915 dnl Searching of system directories for extensions.
2916 dnl Note: this switch is meant to be used for test builds
2917 dnl whose behavior should not depend on what happens to be
2918 dnl installed on the local machine.
2919 dnl ========================================================
2920 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
2921 [ --disable-system-extension-dirs
2922 Disable searching system- and account-global
2923 directories for extensions of any kind; use
2924 only profile-specific extension directories],
2925 ENABLE_SYSTEM_EXTENSION_DIRS=,
2926 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
2927 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
2928 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
2931 dnl ========================================================
2932 dnl = Universalchardet
2933 dnl ========================================================
2934 MOZ_ARG_DISABLE_BOOL(universalchardet,
2935 [ --disable-universalchardet
2936 Disable universal encoding detection],
2937 MOZ_UNIVERSALCHARDET=,
2938 MOZ_UNIVERSALCHARDET=1 )
2940 dnl ========================================================
2941 dnl = ANGLE OpenGL->D3D translator for WebGL
2942 dnl = * only applies to win32 (and then, not MINGW)
2943 dnl ========================================================
2947 MOZ_HAS_WINSDK_WITH_D3D=
2948 MOZ_D3DCOMPILER_VISTA_DLL=
2949 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
2951 if test "$COMPILE_ENVIRONMENT" ; then
2952 case "$target_os" in
2954 MOZ_ANGLE_RENDERER=1
2958 # The DirectX SDK libraries are split into x86 and x64 sub-directories
2959 case "${target_cpu}" in
2961 MOZ_D3D_CPU_SUFFIX=x86
2964 MOZ_D3D_CPU_SUFFIX=x64
2968 dnl ========================================================
2969 dnl D3D compiler DLL
2970 dnl ========================================================
2971 MOZ_FOUND_D3D_COMPILERS=
2973 if test -n "$MOZ_ANGLE_RENDERER"; then
2974 if test -z "$MOZ_D3D_CPU_SUFFIX"; then
2975 AC_MSG_ERROR([Couldn't determine MOZ_D3D_CPU_SUFFIX.])
2978 ######################################
2979 # Find _46+ for use by Vista+.
2981 # Find a D3D compiler DLL in a Windows SDK.
2982 MOZ_D3DCOMPILER_VISTA_DLL=
2983 case "$MOZ_WINSDK_MAXVER" in
2985 MOZ_D3DCOMPILER_VISTA_DLL=d3dcompiler_47.dll
2986 AC_MSG_RESULT([Found D3D compiler in Windows SDK.])
2990 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
2991 # We have a name, now track down the path.
2992 if test -n "$WINDOWSSDKDIR"; then
2993 MOZ_D3DCOMPILER_VISTA_DLL_PATH="$WINDOWSSDKDIR/Redist/D3D/$MOZ_D3D_CPU_SUFFIX/$MOZ_D3DCOMPILER_VISTA_DLL"
2994 if test -f "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
2995 AC_MSG_RESULT([Found MOZ_D3DCOMPILER_VISTA_DLL_PATH: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
2996 MOZ_HAS_WINSDK_WITH_D3D=1
2998 AC_MSG_RESULT([MOZ_D3DCOMPILER_VISTA_DLL_PATH doesn't exist: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
2999 AC_MSG_ERROR([Windows SDK at "$WINDOWSSDKDIR" appears broken. Try updating to MozillaBuild 1.9 final or higher.])
3000 MOZ_D3DCOMPILER_VISTA_DLL_PATH=
3003 AC_MSG_RESULT([Windows SDK not found.])
3006 if test "$OS_ARCH" = "$HOST_OS_ARCH"; then
3007 AC_MSG_ERROR([Couldn't find Windows SDK 8.1 or higher needed for ANGLE.])
3009 AC_MSG_RESULT([Windows SDK not needed for ANGLE in Linux MinGW build.])
3013 if test -z "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
3014 MOZ_D3DCOMPILER_VISTA_DLL=
3017 # On mingw, check if headers are provided by toolchain.
3018 if test -n "$GNU_CC"; then
3019 MOZ_CHECK_HEADER(d3d10.h, MOZ_HAS_WINSDK_WITH_D3D=1)
3022 ######################################
3023 # Check that we found what we needed.
3024 MOZ_FOUND_A_D3D_COMPILER=
3026 if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
3027 MOZ_FOUND_A_D3D_COMPILER=1
3028 AC_MSG_RESULT([Found d3dcompiler DLL for Vista+: $MOZ_D3DCOMPILER_VISTA_DLL])
3031 if test -z "$CROSS_COMPILE"; then
3032 if test -z "MOZ_FOUND_A_D3D_COMPILER"; then
3033 AC_MSG_ERROR([Couldn't find an acceptable D3D compiler DLL.])
3036 fi # MOZ_ANGLE_RENDERER
3038 fi # COMPILE_ENVIRONMENT
3041 dnl ========================================================
3043 dnl ========================================================
3044 MOZ_GAMEPAD_BACKEND=stub
3046 case "$OS_TARGET" in
3048 if test -z "$MOZ_IOS"; then
3049 MOZ_GAMEPAD_BACKEND=cocoa
3053 MOZ_GAMEPAD_BACKEND=windows
3056 MOZ_CHECK_HEADER([linux/joystick.h])
3057 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
3058 AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
3060 MOZ_GAMEPAD_BACKEND=linux
3063 MOZ_GAMEPAD_BACKEND=android
3069 AC_SUBST(MOZ_GAMEPAD_BACKEND)
3071 dnl ========================================================
3072 dnl = Breakpad crash reporting (on by default on supported platforms)
3073 dnl ========================================================
3076 i?86-*-mingw*|x86_64-*-mingw*)
3079 i?86-apple-darwin*|x86_64-apple-darwin*)
3080 if test -z "$MOZ_IOS"; then
3084 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
3085 if test "$MOZ_ENABLE_GTK"; then
3089 *-android*|*-linuxandroid*)
3094 MOZ_ARG_DISABLE_BOOL(crashreporter,
3095 [ --disable-crashreporter Disable breakpad crash reporting],
3096 [MOZ_CRASHREPORTER=],
3097 [MOZ_CRASHREPORTER=F # Force enable breakpad])
3099 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin"; then
3100 if test "$MOZ_CRASHREPORTER" = F; then
3101 AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
3106 if test -n "$MOZ_CRASHREPORTER"; then
3107 AC_DEFINE(MOZ_CRASHREPORTER)
3109 if test "$OS_TARGET" = "Linux" && \
3110 test -z "$SKIP_LIBRARY_CHECKS"; then
3111 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
3114 if test "$OS_ARCH" = "WINNT"; then
3115 if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
3116 MOZ_CRASHREPORTER_INJECTOR=1
3117 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
3122 dnl ========================================================
3123 dnl = libjpeg-turbo configuration
3124 dnl ========================================================
3126 LIBJPEG_TURBO_USE_YASM=
3127 if test -z "$MOZ_SYSTEM_JPEG"; then
3131 MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
3132 [ --disable-libjpeg-turbo Disable optimized jpeg decoding routines],
3134 MOZ_LIBJPEG_TURBO=1)
3136 if test "$MOZ_SYSTEM_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
3137 AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
3140 dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
3143 if test -n "$MOZ_LIBJPEG_TURBO" -a -n "$COMPILE_ENVIRONMENT"; then
3145 dnl Do we support libjpeg-turbo on this platform?
3146 case "$OS_ARCH:$CPU_ARCH" in
3148 LIBJPEG_TURBO_ASFLAGS="-DPIC -DMACHO"
3151 LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DMACHO"
3156 LIBJPEG_TURBO_ASFLAGS="-DPIC -DWIN32"
3159 LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DWIN64 -DMSVC"
3162 LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
3165 LIBJPEG_TURBO_ASFLAGS="-march=armv8-a"
3168 LIBJPEG_TURBO_ASFLAGS="-mdspr2"
3171 if $CC -E -dM -</dev/null | grep -q __ELF__; then
3172 LIBJPEG_TURBO_ASFLAGS="-DPIC -DELF"
3176 if $CC -E -dM -</dev/null | grep -q __ELF__; then
3177 LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DELF"
3183 if test -n "$LIBJPEG_TURBO_ASFLAGS"; then
3185 dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
3186 dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
3187 dnl it doesn't exist or we have too old of a version.
3189 LIBJPEG_TURBO_USE_YASM=1
3191 if test -z "$YASM" ; then
3192 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.])
3195 dnl Check that we have the right yasm version. We require 1.0.1 or newer
3196 dnl on Linux and 1.1 or newer everywhere else.
3197 if test "$OS_ARCH" = "Linux" ; then
3198 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
3199 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.])
3202 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
3203 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.])
3210 dnl ========================================================
3211 dnl = libav-fft configuration
3212 dnl ========================================================
3216 dnl Turn on libav-fft for 32-bit windows, and all 64-bit supported platforms.
3217 dnl 32-bit linux/os x have text relocation issues.
3219 case "$OS_ARCH:$CPU_ARCH" in
3228 dnl Detect if we can use yasm to compile libav's assembly
3230 if test -n "$MOZ_LIBAV_FFT" -a -n "$COMPILE_ENVIRONMENT"; then
3231 AC_DEFINE(MOZ_LIBAV_FFT)
3232 dnl Do we support libav-fft on this platform?
3233 case "$OS_ARCH:$CPU_ARCH" in
3235 LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DMACHO"
3238 LIBAV_FFT_ASFLAGS="-DPIC -DWIN32"
3241 LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DWIN64 -DMSVC"
3244 if $CC -E -dM -</dev/null | grep -q __ELF__; then
3245 LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DELF"
3249 AC_MSG_ERROR([libav's FFT routines are only available for 32-bit windows or 64-bit x86 based platforms.])
3254 if test -n "$LIBAV_FFT_ASFLAGS"; then
3255 dnl If we're on an x86 or x64 system which supports libav-fft's asm routines
3256 dnl check for Yasm, and error out if it doesn't exist or we have too old of a
3258 if test -z "$YASM" ; then
3259 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.])
3261 dnl Check that we have the right yasm version. We require 1.0.1 or newer
3262 dnl on Linux and 1.1 or newer everywhere else.
3263 if test "$OS_ARCH" = "Linux" ; then
3264 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
3265 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.])
3268 if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
3269 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.])
3272 elif test -n "$MOZ_LIBAV_FFT" -a "${CPU_ARCH}" != "arm"; then
3273 dnl Warn if we're not building either libav or opendl-max optimized routines.
3274 AC_MSG_WARN([No assembler or assembly support for libav-fft. Using unoptimized C routines.])
3277 dnl ========================================================
3278 dnl = FFmpeg's ffvpx configuration
3279 dnl ========================================================
3291 dnl Use same conditional as MOZ_LIBAV_FFT to enable FFmpeg's ffvpx assembly decoder.
3292 if test -n "$MOZ_LIBAV_FFT"; then
3293 FFVPX_ASFLAGS=$LIBAV_FFT_ASFLAGS
3295 if test -n "$MOZ_FFVPX"; then
3296 AC_DEFINE(MOZ_FFVPX)
3299 dnl ========================================================
3300 dnl = Enable compilation of specific extension modules
3301 dnl ========================================================
3303 MOZ_ARG_ENABLE_STRING(extensions,
3304 [ --enable-extensions Enable extensions],
3305 [ for option in `echo $enableval | sed 's/,/ /g'`; do
3306 if test "$option" = "yes" -o "$option" = "all"; then
3307 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
3308 elif test "$option" = "no" -o "$option" = "none"; then
3310 elif test "$option" = "default"; then
3311 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
3312 elif test `echo "$option" | grep -c \^-` != 0; then
3313 option=`echo $option | sed 's/^-//'`
3314 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
3316 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
3319 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
3321 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
3322 dnl when trying to build a nonexistent extension.
3323 for extension in $MOZ_EXTENSIONS; do
3324 if test ! -d "${srcdir}/extensions/${extension}"; then
3325 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
3329 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
3330 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
3333 # Avoid defining MOZ_ENABLE_CAIRO_FT on Windows platforms because
3334 # "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
3335 if test -n "$MOZ_TREE_FREETYPE" -a "$OS_TARGET" != WINNT; then
3336 MOZ_ENABLE_CAIRO_FT=1
3337 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
3338 CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
3339 AC_SUBST_LIST(CAIRO_FT_CFLAGS)
3342 AC_CHECK_PROGS(WGET, wget, "")
3345 dnl ========================================================
3346 dnl Maintenance Service
3347 dnl ========================================================
3349 MOZ_ARG_ENABLE_BOOL(maintenance-service,
3350 [ --enable-maintenance-service Enable building of maintenanceservice],
3351 MOZ_MAINTENANCE_SERVICE=1,
3352 MOZ_MAINTENANCE_SERVICE= )
3354 if test -n "$MOZ_MAINTENANCE_SERVICE"; then
3355 if test "$OS_ARCH" = "WINNT"; then
3356 AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
3358 AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
3362 dnl ========================================================
3363 dnl Bundled fonts on desktop platforms
3364 dnl ========================================================
3366 MOZ_ARG_ENABLE_BOOL(bundled-fonts,
3367 [ --enable-bundled-fonts Enable support for bundled fonts on desktop platforms],
3368 MOZ_BUNDLED_FONTS=1,
3371 if test -n "$MOZ_BUNDLED_FONTS"; then
3372 AC_DEFINE(MOZ_BUNDLED_FONTS)
3375 dnl ========================================================
3376 dnl Verify MAR signatures
3377 dnl ========================================================
3379 MOZ_ARG_ENABLE_BOOL(verify-mar,
3380 [ --enable-verify-mar Enable verifying MAR signatures],
3381 MOZ_VERIFY_MAR_SIGNATURE=1,
3382 MOZ_VERIFY_MAR_SIGNATURE= )
3384 if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
3385 AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
3388 dnl ========================================================
3389 dnl Enable building the signmar program.
3390 dnl This option is much different than the --enable-verify-mar option.
3391 dnl --enable-verify-mar is for enabling the verification check on MAR
3392 dnl files in the updater. The --enable-signmar option is for building
3393 dnl the signmar program.
3394 dnl ========================================================
3396 MOZ_ARG_ENABLE_BOOL(signmar,
3397 [ --enable-signmar Enable building the signmar program],
3398 MOZ_ENABLE_SIGNMAR=1,
3399 MOZ_ENABLE_SIGNMAR= )
3401 if test -n "$MOZ_ENABLE_SIGNMAR"; then
3402 if test -z "$COMPILE_ENVIRONMENT" ; then
3403 AC_MSG_WARN([Cannot --enable-signmar with --disable-compile-environment])
3406 AC_DEFINE(MOZ_ENABLE_SIGNMAR)
3410 dnl ========================================================
3412 dnl ========================================================
3414 if test "$MOZ_IOS"; then
3418 MOZ_ARG_DISABLE_BOOL(updater,
3419 [ --disable-updater Disable building of updater],
3423 if test -n "$MOZ_UPDATER"; then
3424 AC_DEFINE(MOZ_UPDATER)
3427 dnl ========================================================
3428 dnl parental controls (for Windows Vista)
3429 dnl ========================================================
3430 MOZ_ARG_DISABLE_BOOL(parental-controls,
3431 [ --disable-parental-controls
3432 Do not build parental controls],
3433 MOZ_DISABLE_PARENTAL_CONTROLS=1,
3434 MOZ_DISABLE_PARENTAL_CONTROLS=)
3435 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
3436 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
3439 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
3441 dnl ========================================================
3442 dnl = Disable smartcard support
3443 dnl ========================================================
3444 if test -n "$MOZ_NO_SMART_CARDS"; then
3445 AC_DEFINE(MOZ_NO_SMART_CARDS)
3447 AC_SUBST(MOZ_NO_SMART_CARDS)
3449 dnl ========================================================
3450 dnl = Sandboxing support
3451 dnl ========================================================
3452 if test -n "$MOZ_TSAN" -o -n "$MOZ_ASAN"; then
3453 # Bug 1182565: TSan conflicts with sandboxing on Linux.
3454 # Bug 1287971: LSan also conflicts with sandboxing on Linux.
3462 MOZ_ARG_DISABLE_BOOL(sandbox,
3463 [ --disable-sandbox Disable sandboxing support],
3467 dnl ========================================================
3468 dnl = Content process sandboxing
3469 dnl ========================================================
3471 case "$OS_TARGET" in
3473 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3476 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3481 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
3487 MOZ_ARG_ENABLE_BOOL(content-sandbox,
3488 [ --enable-content-sandbox Enable sandboxing support for content-processes
3489 --disable-content-sandbox Disable sandboxing support for content-processes],
3490 MOZ_CONTENT_SANDBOX=1,
3491 MOZ_CONTENT_SANDBOX=)
3493 if test -n "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_SANDBOX"; then
3494 AC_MSG_ERROR([--enable-content-sandbox and --disable-sandbox are conflicting options])
3497 if test -n "$MOZ_CONTENT_SANDBOX"; then
3498 AC_DEFINE(MOZ_CONTENT_SANDBOX)
3501 AC_SUBST(MOZ_CONTENT_SANDBOX)
3503 dnl ========================================================
3504 dnl = Gecko Media Plugin sandboxing
3505 dnl ========================================================
3508 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3513 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3518 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
3522 if test -n "$MOZ_GMP_SANDBOX"; then
3523 AC_DEFINE(MOZ_GMP_SANDBOX)
3526 AC_SUBST(MOZ_GMP_SANDBOX)
3528 if test -z "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_GMP_SANDBOX"; then
3532 if test -n "$MOZ_SANDBOX"; then
3533 AC_DEFINE(MOZ_SANDBOX)
3536 AC_SUBST(MOZ_SANDBOX)
3539 dnl ========================================================
3541 dnl = Module specific options
3543 dnl ========================================================
3544 MOZ_ARG_HEADER(Individual module options)
3546 dnl ========================================================
3547 dnl = Disable feed handling components
3548 dnl ========================================================
3549 MOZ_ARG_DISABLE_BOOL(feeds,
3550 [ --disable-feeds Disable feed handling and processing components],
3553 if test -n "$MOZ_FEEDS"; then
3554 AC_DEFINE(MOZ_FEEDS)
3556 if test "$MOZ_BUILD_APP" = "browser"; then
3557 AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
3561 dnl ========================================================
3562 dnl Check for sqlite
3563 dnl ========================================================
3566 MOZ_ARG_ENABLE_BOOL(system-sqlite,
3567 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
3568 MOZ_SYSTEM_SQLITE=1,
3569 MOZ_SYSTEM_SQLITE= )
3571 if test -n "$MOZ_SYSTEM_SQLITE"
3573 dnl ============================
3574 dnl === SQLite Version check ===
3575 dnl ============================
3576 dnl Check to see if the system SQLite package is new enough.
3577 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
3579 dnl ==================================
3580 dnl === SQLITE_SECURE_DELETE check ===
3581 dnl ==================================
3582 dnl Check to see if the system SQLite package is compiled with
3583 dnl SQLITE_SECURE_DELETE enabled.
3584 AC_MSG_CHECKING(for SQLITE_SECURE_DELETE support in system SQLite)
3585 _SAVE_CFLAGS="$CFLAGS"
3586 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3588 LIBS="$LIBS $SQLITE_LIBS"
3589 AC_CACHE_VAL(ac_cv_sqlite_secure_delete,[
3591 #include "sqlite3.h"
3593 int main(int argc, char **argv){
3594 return !sqlite3_compileoption_used("SQLITE_SECURE_DELETE");
3596 ac_cv_sqlite_secure_delete=yes,
3597 ac_cv_sqlite_secure_delete=no,
3598 ac_cv_sqlite_secure_delete=no
3601 AC_MSG_RESULT($ac_cv_sqlite_secure_delete)
3602 CFLAGS="$_SAVE_CFLAGS"
3604 if test "x$ac_cv_sqlite_secure_delete" = "xno"; then
3605 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_SECURE_DELETE.])
3608 dnl ===============================
3609 dnl === SQLITE_THREADSAFE check ===
3610 dnl ===============================
3611 dnl Check to see if the system SQLite package is compiled with
3612 dnl SQLITE_THREADSAFE enabled.
3613 AC_MSG_CHECKING(for SQLITE_THREADSAFE support in system SQLite)
3614 _SAVE_CFLAGS="$CFLAGS"
3615 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3617 LIBS="$LIBS $SQLITE_LIBS"
3618 AC_CACHE_VAL(ac_cv_sqlite_threadsafe,[
3620 #include "sqlite3.h"
3622 int main(int argc, char **argv){
3623 return !sqlite3_compileoption_used("SQLITE_THREADSAFE=1");
3625 ac_cv_sqlite_threadsafe=yes,
3626 ac_cv_sqlite_threadsafe=no,
3627 ac_cv_sqlite_threadsafe=no
3630 AC_MSG_RESULT($ac_cv_sqlite_threadsafe)
3631 CFLAGS="$_SAVE_CFLAGS"
3633 if test "x$ac_cv_sqlite_threadsafe" = "xno"; then
3634 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_THREADSAFE.])
3637 dnl ================================
3638 dnl === SQLITE_ENABLE_FTS3 check ===
3639 dnl ================================
3640 dnl check to see if the system SQLite package is compiled with
3641 dnl SQLITE_ENABLE_FTS3 enabled.
3642 AC_MSG_CHECKING(for SQLITE_ENABLE_FTS3 support in system SQLite)
3643 _SAVE_CFLAGS="$CFLAGS"
3644 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3646 LIBS="$LIBS $SQLITE_LIBS"
3647 AC_CACHE_VAL(ac_cv_sqlite_enable_fts3,[
3649 #include "sqlite3.h"
3651 int main(int argc, char **argv){
3652 return !sqlite3_compileoption_used("SQLITE_ENABLE_FTS3");
3654 ac_cv_sqlite_enable_fts3=yes,
3655 ac_cv_sqlite_enable_fts3=no,
3656 ac_cv_sqlite_enable_fts3=no
3659 AC_MSG_RESULT($ac_cv_sqlite_enable_fts3)
3660 CFLAGS="$_SAVE_CFLAGS"
3662 if test "x$ac_cv_sqlite_enable_fts3" = "xno"; then
3663 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_FTS3.])
3666 dnl =========================================
3667 dnl === SQLITE_ENABLE_UNLOCK_NOTIFY check ===
3668 dnl =========================================
3669 dnl check to see if the system SQLite package is compiled with
3670 dnl SQLITE_ENABLE_UNLOCK_NOTIFY enabled.
3671 AC_MSG_CHECKING(for SQLITE_ENABLE_UNLOCK_NOTIFY support in system SQLite)
3672 _SAVE_CFLAGS="$CFLAGS"
3673 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3675 LIBS="$LIBS $SQLITE_LIBS"
3676 AC_CACHE_VAL(ac_cv_sqlite_enable_unlock_notify,[
3678 #include "sqlite3.h"
3680 int main(int argc, char **argv){
3681 return !sqlite3_compileoption_used("SQLITE_ENABLE_UNLOCK_NOTIFY");
3683 ac_cv_sqlite_enable_unlock_notify=yes,
3684 ac_cv_sqlite_enable_unlock_notify=no,
3685 ac_cv_sqlite_enable_unlock_notify=no
3688 AC_MSG_RESULT($ac_cv_sqlite_enable_unlock_notify)
3689 CFLAGS="$_SAVE_CFLAGS"
3691 if test "x$ac_cv_sqlite_enable_unlock_notify" = "xno"; then
3692 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_UNLOCK_NOTIFY.])
3695 dnl =========================================
3696 dnl === SQLITE_ENABLE_DBSTAT_VTAB check ===
3697 dnl =========================================
3698 dnl check to see if the system SQLite package is compiled with
3699 dnl SQLITE_ENABLE_DBSTAT_VTAB.
3700 AC_MSG_CHECKING(for SQLITE_ENABLE_DBSTAT_VTAB support in system SQLite)
3701 _SAVE_CFLAGS="$CFLAGS"
3702 CFLAGS="$CFLAGS $SQLITE_CFLAGS"
3704 LIBS="$LIBS $SQLITE_LIBS"
3705 AC_CACHE_VAL(ac_cv_sqlite_dbstat_vtab,[
3707 #include "sqlite3.h"
3709 int main(int argc, char **argv){
3710 return !sqlite3_compileoption_used("SQLITE_ENABLE_DBSTAT_VTAB");
3712 ac_cv_sqlite_dbstat_vtab=yes,
3713 ac_cv_sqlite_dbstat_vtab=no,
3714 ac_cv_sqlite_dbstat_vtab=no
3717 AC_MSG_RESULT($ac_cv_sqlite_dbstat_vtab)
3718 CFLAGS="$_SAVE_CFLAGS"
3720 if test "x$ac_cv_sqlite_dbstat_vtab" = "xno"; then
3721 AC_MSG_ERROR([System SQLite library is not compiled with SQLITE_ENABLE_DBSTAT_VTAB.])
3725 if test -n "$MOZ_SYSTEM_SQLITE"; then
3726 AC_DEFINE(MOZ_SYSTEM_SQLITE)
3728 AC_SUBST(MOZ_SYSTEM_SQLITE)
3730 dnl ========================================================
3731 dnl = Enable url-classifier
3732 dnl ========================================================
3733 MOZ_ARG_ENABLE_BOOL(url-classifier,
3734 [ --enable-url-classifier Enable url classifier module],
3735 MOZ_URL_CLASSIFIER=1,
3736 MOZ_URL_CLASSIFIER= )
3737 if test -n "$MOZ_URL_CLASSIFIER"; then
3738 AC_DEFINE(MOZ_URL_CLASSIFIER)
3740 AC_SUBST(MOZ_URL_CLASSIFIER)
3742 dnl ========================================================
3743 dnl = Disable zipwriter
3744 dnl ========================================================
3745 MOZ_ARG_DISABLE_BOOL(zipwriter,
3746 [ --disable-zipwriter Disable zipwriter component],
3749 AC_SUBST(MOZ_ZIPWRITER)
3751 dnl ========================================================
3753 dnl = Feature options that require extra sources to be pulled
3755 dnl ========================================================
3756 dnl MOZ_ARG_HEADER(Features that require extra sources)
3758 dnl ========================================================
3760 dnl = Runtime debugging and Optimization Options
3762 dnl ========================================================
3763 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
3765 dnl ========================================================
3766 dnl enable mobile optimizations
3767 dnl ========================================================
3768 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
3769 [ --enable-mobile-optimize
3770 Enable mobile optimizations],
3771 MOZ_GFX_OPTIMIZE_MOBILE=1)
3773 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
3775 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
3776 # We ignore paint will resample on mobile for performance.
3777 # We may want to revisit this later.
3778 MOZ_IGNORE_PAINT_WILL_RESAMPLE=1
3780 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
3781 AC_DEFINE(MOZ_IGNORE_PAINT_WILL_RESAMPLE)
3784 dnl ========================================================
3785 dnl = Enable code optimization. ON by default.
3786 dnl ========================================================
3787 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
3788 MOZ_OPTIMIZE_FLAGS="-O"
3791 MOZ_ARG_ENABLE_STRING(optimize,
3792 [ --disable-optimize Disable compiler optimization
3793 --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
3794 [ if test "$enableval" != "no"; then
3796 if test -n "$enableval" -a "$enableval" != "yes"; then
3797 MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
3802 fi ], MOZ_OPTIMIZE=1)
3804 MOZ_SET_FRAMEPTR_FLAGS
3806 if test "$COMPILE_ENVIRONMENT"; then
3807 if test -n "$MOZ_OPTIMIZE"; then
3808 AC_MSG_CHECKING([for valid C compiler optimization flags])
3809 _SAVE_CFLAGS=$CFLAGS
3810 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
3811 AC_TRY_COMPILE([#include <stdio.h>],
3812 [printf("Hello World\n");],
3815 AC_MSG_RESULT([$_results])
3816 if test "$_results" = "no"; then
3817 AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
3819 CFLAGS=$_SAVE_CFLAGS
3821 fi # COMPILE_ENVIRONMENT
3823 AC_SUBST(MOZ_OPTIMIZE)
3824 AC_SUBST(MOZ_FRAMEPTR_FLAGS)
3825 AC_SUBST(MOZ_OPTIMIZE_FLAGS)
3826 AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
3827 AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
3829 dnl ========================================================
3830 dnl = Disable treating compiler warnings as errors
3831 dnl ========================================================
3832 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
3833 WARNINGS_AS_ERRORS=''
3836 dnl ========================================================
3837 dnl = Enable runtime logging
3838 dnl ========================================================
3839 AC_DEFINE(MOZ_LOGGING)
3840 AC_DEFINE(FORCE_PR_LOG)
3842 dnl ========================================================
3843 dnl = This will enable logging of addref, release, ctor, dtor.
3844 dnl ========================================================
3845 _ENABLE_LOGREFCNT=42
3846 MOZ_ARG_ENABLE_BOOL(logrefcnt,
3847 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
3848 _ENABLE_LOGREFCNT=1,
3849 _ENABLE_LOGREFCNT= )
3850 if test "$_ENABLE_LOGREFCNT" = "1"; then
3851 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
3852 elif test -z "$_ENABLE_LOGREFCNT"; then
3853 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
3856 dnl ========================================================
3857 dnl moz_dump_painting
3858 dnl ========================================================
3859 MOZ_ARG_ENABLE_BOOL(dump-painting,
3860 [ --enable-dump-painting Enable paint debugging.],
3861 MOZ_DUMP_PAINTING=1,
3862 MOZ_DUMP_PAINTING= )
3863 if test -n "$MOZ_DUMP_PAINTING"; then
3864 AC_DEFINE(MOZ_DUMP_PAINTING)
3865 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
3867 if test -n "$MOZ_DEBUG"; then
3868 AC_DEFINE(MOZ_DUMP_PAINTING)
3871 case "${OS_TARGET}" in
3872 Android|WINNT|Darwin)
3873 MOZ_GLUE_IN_PROGRAM=
3876 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
3877 MOZ_GLUE_IN_PROGRAM=1
3878 AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
3882 dnl ========================================================
3883 dnl = Jemalloc build setup
3884 dnl ========================================================
3885 if test -z "$MOZ_MEMORY"; then
3888 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
3889 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.])
3894 dnl The generic feature tests that determine how to compute ncpus are long and
3895 dnl complicated. Therefore, simply define special cpp variables for the
3896 dnl platforms we have special knowledge of.
3899 export MOZ_NO_DEBUG_RTL=1
3903 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
3905 # Allow the application to provide a subconfigure script.
3906 # This should be after 'export MOZ_NO_DEBUG_RTL=1' since
3907 # ldap/c-sdk/configure refers to the enviroment value.
3908 if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
3909 do_output_subdirs() {
3910 if test -n "$_subconfigure_subdirs"; then
3911 AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
3913 _subconfigure_subdir="$1"
3914 _subconfigure_config_args="$ac_configure_args"
3916 tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
3917 m4 "${srcdir}/build/autoconf/subconfigure.m4" \
3918 "${srcdir}/build/autoconf/altoptions.m4" \
3919 "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
3924 AC_SUBST_LIST(MOZ_GLUE_WRAP_LDFLAGS)
3925 export MOZ_GLUE_WRAP_LDFLAGS
3927 dnl ========================================================
3928 dnl = Enable using the clang plugin to build
3929 dnl ========================================================
3931 if test -n "$COMPILE_ENVIRONMENT"; then
3932 MOZ_CONFIG_CLANG_PLUGIN
3933 fi # COMPILE_ENVIRONMENT
3935 dnl ========================================================
3936 dnl = Enable stripping of libs & executables
3937 dnl ========================================================
3938 MOZ_ARG_ENABLE_BOOL(strip,
3939 [ --enable-strip Enable stripping of libs & executables ],
3943 dnl ========================================================
3944 dnl = Enable stripping of libs & executables when packaging
3945 dnl ========================================================
3946 MOZ_ARG_ENABLE_BOOL(install-strip,
3947 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
3951 dnl ========================================================
3952 dnl = --disable-elf-hack
3953 dnl ========================================================
3956 MOZ_ARG_DISABLE_BOOL(elf-hack,
3957 [ --disable-elf-hack Disable elf hacks],
3961 # Only enable elfhack where supported
3962 if test "$USE_ELF_HACK" = 1; then
3963 case "${HOST_OS_ARCH},${OS_ARCH}" in
3965 case "${CPU_ARCH}" in
3980 dnl ========================================================
3981 dnl = libstdc++ compatibility hacks
3982 dnl ========================================================
3985 MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
3986 [ --enable-stdcxx-compat Enable compatibility with older libstdc++],
3989 if test -n "$STDCXX_COMPAT" -a -n "$COMPILE_ENVIRONMENT"; then
3990 eval $(CXX="$CXX" HOST_CXX="$HOST_CXX" $PYTHON -m mozbuild.configure.libstdcxx)
3991 AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
3992 AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
3993 CXXFLAGS="$CXXFLAGS -D_GLIBCXX_USE_CXX11_ABI=0"
3994 HOST_CXXFLAGS="$HOST_CXXFLAGS -D_GLIBCXX_USE_CXX11_ABI=0"
3997 dnl ========================================================
3998 dnl = frontend JS debug mode
3999 dnl ========================================================
4001 MOZ_ARG_ENABLE_BOOL(debug-js-modules,
4002 [ --enable-debug-js-modules Enable debug mode for frontend JS libraries],
4006 AC_SUBST(DEBUG_JS_MODULES)
4008 dnl ========================================================
4010 dnl = Profiling and Instrumenting
4012 dnl ========================================================
4013 MOZ_ARG_HEADER(Profiling and Instrumenting)
4015 dnl ========================================================
4016 dnl = Enable TaskTracer
4017 dnl ========================================================
4018 MOZ_ARG_ENABLE_BOOL(tasktracer,
4019 [ --enable-tasktracer Set compile flags necessary for using TaskTracer],
4022 if test -n "$MOZ_TASK_TRACER"; then
4023 AC_DEFINE(MOZ_TASK_TRACER)
4024 AC_SUBST(MOZ_TASK_TRACER)
4027 dnl ========================================================
4028 dnl Turn on reflow counting
4029 dnl ========================================================
4030 MOZ_ARG_ENABLE_BOOL(reflow-perf,
4031 [ --enable-reflow-perf Enable reflow performance tracing],
4034 if test -n "$MOZ_REFLOW_PERF"; then
4035 AC_DEFINE(MOZ_REFLOW_PERF)
4038 dnl ========================================================
4039 dnl = Horizon build options - set default preferences for
4040 dnl the horizon project. Horizon is a browser built on
4041 dnl top of the graphene runtime.
4042 dnl ========================================================
4043 if test -n "$MOZ_HORIZON"; then
4044 AC_DEFINE(MOZ_HORIZON)
4046 AC_SUBST(MOZ_HORIZON)
4048 dnl ========================================================
4049 dnl = Offer a way to disable the startup cache
4050 dnl ========================================================
4052 MOZ_ARG_DISABLE_BOOL(startupcache,
4053 [ --disable-startupcache Disable startup cache ],
4054 MOZ_DISABLE_STARTUPCACHE=1,
4055 MOZ_DISABLE_STARTUPCACHE=)
4057 dnl bug 988880: disable startup cache on b2g
4058 if test -n "$MOZ_B2G"; then
4059 MOZ_DISABLE_STARTUPCACHE=1
4061 if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
4062 AC_DEFINE(MOZ_DISABLE_STARTUPCACHE)
4064 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
4066 dnl ========================================================
4067 dnl = Enable Pico Speech Synthesis (Gonk usually)
4068 dnl ========================================================
4069 MOZ_ARG_ENABLE_BOOL(synth-pico,
4070 [ --enable-synth-pico Set compile flags necessary for compiling Pico Web Speech API ],
4073 if test -n "$MOZ_SYNTH_PICO"; then
4074 AC_DEFINE(MOZ_SYNTH_PICO)
4076 AC_SUBST(MOZ_SYNTH_PICO)
4078 dnl ========================================================
4079 dnl = Enable Support for Time Manager API
4080 dnl ========================================================
4081 if test -n "$MOZ_TIME_MANAGER"; then
4082 AC_DEFINE(MOZ_TIME_MANAGER)
4084 AC_SUBST(MOZ_TIME_MANAGER)
4086 dnl ========================================================
4087 dnl = Enable Support for Secure Element API
4088 dnl ========================================================
4089 MOZ_SECUREELEMENT=1,
4090 if test -n "$MOZ_SECUREELEMENT"; then
4091 AC_DEFINE(MOZ_SECUREELEMENT)
4093 AC_SUBST(MOZ_SECUREELEMENT)
4095 dnl ========================================================
4096 dnl = Support for demangling undefined symbols
4097 dnl ========================================================
4098 if test -z "$SKIP_LIBRARY_CHECKS"; then
4101 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
4105 # Demangle only for debug or DMD builds
4106 MOZ_DEMANGLE_SYMBOLS=
4107 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
4108 MOZ_DEMANGLE_SYMBOLS=1
4109 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
4111 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
4113 dnl ========================================================
4114 dnl = Support for gcc stack unwinding (from gcc 3.3)
4115 dnl ========================================================
4116 if test -z "$SKIP_LIBRARY_CHECKS"; then
4119 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
4123 dnl ========================================================
4125 dnl ========================================================
4127 MOZ_ARG_WITH_STRING(jitreport-granularity,
4128 [ --jitreport-granularity=N
4129 Default granularity at which to report JIT code
4132 1 - code ranges for whole functions only
4133 2 - per-line information
4134 3 - per-op information],
4135 JITREPORT_GRANULARITY=$withval,
4136 JITREPORT_GRANULARITY=3)
4138 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
4140 dnl ========================================================
4141 dnl = Disable Mozilla's versions of RIL and Geolocation
4142 dnl ========================================================
4143 MOZ_ARG_DISABLE_BOOL(mozril-geoloc,
4144 [ --disable-mozril-geoloc Disable Mozilla's RIL and geolocation],
4145 DISABLE_MOZ_RIL_GEOLOC=1,
4146 DISABLE_MOZ_RIL_GEOLOC= )
4147 if test -n "$DISABLE_MOZ_RIL_GEOLOC"; then
4148 AC_DEFINE(DISABLE_MOZ_RIL_GEOLOC)
4150 AC_SUBST(DISABLE_MOZ_RIL_GEOLOC)
4152 dnl ========================================================
4156 dnl ========================================================
4157 MOZ_ARG_HEADER(Misc. Options)
4159 dnl ========================================================
4160 dnl = Define default location for MOZILLA_FIVE_HOME
4161 dnl ========================================================
4162 MOZ_ARG_WITH_STRING(default-mozilla-five-home,
4163 [ --with-default-mozilla-five-home
4164 Set the default value for MOZILLA_FIVE_HOME],
4165 [ val=`echo $withval`
4166 AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
4168 dnl ========================================================
4169 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
4170 dnl ========================================================
4171 MOZ_ARG_WITH_STRING(user-appdir,
4172 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
4173 [ val=`echo $withval`
4174 if echo "$val" | grep "\/" >/dev/null; then
4175 AC_MSG_ERROR("Homedir must be single relative path.")
4180 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
4182 dnl ========================================================
4183 dnl = Doxygen configuration
4184 dnl ========================================================
4185 dnl Use commas to specify multiple dirs to this arg
4186 MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
4187 MOZ_ARG_WITH_STRING(doc-input-dirs,
4188 [ --with-doc-input-dirs=DIRS
4189 Header/idl dirs to create docs from],
4190 [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
4191 AC_SUBST(MOZ_DOC_INPUT_DIRS)
4193 dnl Use commas to specify multiple dirs to this arg
4194 MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
4195 MOZ_ARG_WITH_STRING(doc-include-dirs,
4196 [ --with-doc-include-dirs=DIRS
4197 Include dirs to preprocess doc headers],
4198 [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
4199 AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
4201 MOZ_DOC_OUTPUT_DIR='./dist/docs'
4202 MOZ_ARG_WITH_STRING(doc-output-dir,
4203 [ --with-doc-output-dir=DIR
4204 Dir to generate docs into],
4205 [ MOZ_DOC_OUTPUT_DIR=$withval ] )
4206 AC_SUBST(MOZ_DOC_OUTPUT_DIR)
4208 if test -z "$SKIP_COMPILER_CHECKS"; then
4209 dnl ========================================================
4211 dnl = Compiler Options
4213 dnl ========================================================
4214 MOZ_ARG_HEADER(Compiler Options)
4216 dnl ========================================================
4217 dnl Check for gcc -pipe support
4218 dnl ========================================================
4219 AC_MSG_CHECKING([for -pipe support])
4220 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
4221 dnl Any gcc that supports firefox supports -pipe.
4222 CFLAGS="$CFLAGS -pipe"
4223 CXXFLAGS="$CXXFLAGS -pipe"
4224 AC_MSG_RESULT([yes])
4229 dnl ========================================================
4230 dnl Profile guided optimization (gcc checks)
4231 dnl ========================================================
4232 dnl Test for profiling options
4233 dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
4235 _SAVE_CFLAGS="$CFLAGS"
4236 CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
4238 AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
4239 AC_TRY_COMPILE([], [return 0;],
4240 [ PROFILE_GEN_CFLAGS="-fprofile-generate"
4241 result="yes" ], result="no")
4242 AC_MSG_RESULT([$result])
4244 if test $result = "yes"; then
4245 PROFILE_GEN_LDFLAGS="-fprofile-generate"
4246 PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
4247 PROFILE_USE_LDFLAGS="-fprofile-use"
4250 CFLAGS="$_SAVE_CFLAGS"
4252 AC_SUBST(PROFILE_GEN_CFLAGS)
4253 AC_SUBST(PROFILE_GEN_LDFLAGS)
4254 AC_SUBST(PROFILE_USE_CFLAGS)
4255 AC_SUBST(PROFILE_USE_LDFLAGS)
4257 fi # ! SKIP_COMPILER_CHECKS
4259 AC_DEFINE(CPP_THROW_NEW, [throw()])
4262 if test "$COMPILE_ENVIRONMENT"; then
4264 fi # COMPILE_ENVIRONMENT
4266 dnl ========================================================
4268 dnl = Build depencency options
4270 dnl ========================================================
4271 MOZ_ARG_HEADER(Build dependencies)
4273 if test "$GNU_CC" -a "$GNU_CXX"; then
4274 _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
4276 dnl Don't override this for MSVC
4277 if test -z "$_WIN32_MSVC"; then
4278 _USE_CPP_INCLUDE_FLAG=
4279 _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
4280 _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
4282 echo '#include <stdio.h>' > dummy-hello.c
4284 dnl This output is localized, split at the first double space or colon and space.
4285 _CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*\\\stdio.h\)$"
4286 CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'`
4287 _CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'`
4289 if ! test -e "$_CL_STDIO_PATH"; then
4290 AC_MSG_ERROR([Unable to parse cl -showIncludes prefix. This compiler's locale has an unsupported formatting.])
4292 if test -z "$CL_INCLUDES_PREFIX"; then
4293 AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
4295 AC_SUBST(CL_INCLUDES_PREFIX)
4298 dnl Make sure that the build system can handle non-ASCII characters
4299 dnl in environment variables to prevent it from breaking silently on
4300 dnl non-English systems.
4301 NONASCII=$'\241\241'
4306 dnl ========================================================
4308 dnl = Static Build Options
4310 dnl ========================================================
4311 MOZ_ARG_HEADER(Static build options)
4313 if test -z "$MOZ_SYSTEM_ZLIB"; then
4314 if test -n "$JS_SHARED_LIBRARY" -o -n "$MOZ_LINKER"; then
4316 AC_DEFINE(ZLIB_IN_MOZGLUE)
4320 AC_SUBST(ZLIB_IN_MOZGLUE)
4322 dnl ========================================================
4324 dnl = Standalone module options
4326 dnl ========================================================
4327 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
4330 dnl ========================================================
4332 if test -z "$SKIP_PATH_CHECKS"; then
4333 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
4334 if test "$MOZ_ENABLE_GTK" ; then
4335 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
4340 if test -z "${GLIB_GMODULE_LIBS}" \
4341 -a -n "${GLIB_CONFIG}"\
4342 -a "${GLIB_CONFIG}" != no\
4344 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
4347 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
4349 if test "$USE_FC_FREETYPE"; then
4350 if test "$COMPILE_ENVIRONMENT"; then
4351 dnl ========================================================
4352 dnl = Check for freetype2 functionality
4353 dnl ========================================================
4354 if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
4356 _SAVE_CFLAGS="$CFLAGS"
4357 LIBS="$LIBS $FT2_LIBS"
4358 CFLAGS="$CFLAGS $FT2_CFLAGS"
4360 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
4361 ac_cv_member_FT_Bitmap_Size_y_ppem,
4362 [AC_TRY_COMPILE([#include <ft2build.h>
4363 #include FT_FREETYPE_H],
4365 if (sizeof s.y_ppem) return 0;
4367 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
4368 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
4369 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
4370 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
4372 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
4374 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
4375 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
4376 [FT_Bitmap_Size structure includes y_ppem field])
4378 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
4381 CFLAGS="$_SAVE_CFLAGS"
4384 _SAVE_CPPFLAGS="$CPPFLAGS"
4385 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
4386 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
4387 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
4388 CPPFLAGS="$_SAVE_CPPFLAGS"
4392 dnl ========================================================
4393 dnl Check if we need the 32-bit Linux SSE2 error dialog
4394 dnl ========================================================
4396 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
4398 dnl ========================================================
4399 dnl Check for pixman and cairo
4400 dnl ========================================================
4403 MOZ_ARG_ENABLE_BOOL(system-cairo,
4404 [ --enable-system-cairo Use system cairo (located with pkgconfig)],
4409 MOZ_ARG_ENABLE_BOOL(system-pixman,
4410 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
4412 MOZ_TREE_PIXMAN=force,
4415 # System cairo depends on system pixman
4416 if test "$MOZ_TREE_PIXMAN" = "force"; then
4417 if test -z "$MOZ_TREE_CAIRO"; then
4418 AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
4422 elif test -z "$MOZ_TREE_CAIRO"; then
4426 if test "$MOZ_TREE_PIXMAN"; then
4427 AC_DEFINE(MOZ_TREE_PIXMAN)
4429 PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.19.2)
4432 if test "$MOZ_TREE_CAIRO"; then
4433 MOZ_CAIRO_CFLAGS="-I${DIST}/include/cairo"
4434 AC_DEFINE(MOZ_TREE_CAIRO)
4436 if test "$OS_ARCH" = "WINNT"; then
4437 # For now we assume that we will have a uint64_t available through
4438 # one of the above headers or mozstdint.h.
4439 AC_DEFINE(HAVE_UINT64_T)
4442 # Define macros for cairo-features.h
4443 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
4444 if test "$MOZ_X11"; then
4445 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
4446 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
4447 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
4449 if test "$_HAVE_FREETYPE2"; then
4450 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
4451 MOZ_ENABLE_CAIRO_FT=1
4452 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
4455 case "$MOZ_WIDGET_TOOLKIT" in
4457 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
4458 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
4459 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
4462 WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
4463 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
4464 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
4465 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
4466 MOZ_ENABLE_D2D_SURFACE=1
4468 if test "$COMPILE_ENVIRONMENT"; then
4470 dnl D3D10 Layers depend on D2D Surfaces.
4471 if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
4472 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
4477 if test "$USE_FC_FREETYPE"; then
4478 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
4480 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
4481 AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
4482 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
4484 AC_SUBST(PS_SURFACE_FEATURE)
4485 AC_SUBST(SVG_SURFACE_FEATURE)
4486 AC_SUBST(XLIB_SURFACE_FEATURE)
4487 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
4488 AC_SUBST(QUARTZ_SURFACE_FEATURE)
4489 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
4490 AC_SUBST(WIN32_SURFACE_FEATURE)
4491 AC_SUBST(OS2_SURFACE_FEATURE)
4492 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
4493 AC_SUBST(FT_FONT_FEATURE)
4494 AC_SUBST(FC_FONT_FEATURE)
4495 AC_SUBST(WIN32_FONT_FEATURE)
4496 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
4497 AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
4498 AC_SUBST(QUARTZ_FONT_FEATURE)
4499 AC_SUBST(PNG_FUNCTIONS_FEATURE)
4500 AC_SUBST(QT_SURFACE_FEATURE)
4501 AC_SUBST(TEE_SURFACE_FEATURE)
4503 if test "$MOZ_X11"; then
4504 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
4507 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
4509 PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
4510 MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
4511 MOZ_CAIRO_LIBS="$CAIRO_LIBS"
4512 PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
4513 if test "$MOZ_X11"; then
4514 PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
4515 MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
4516 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
4517 MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
4521 case "$MOZ_WIDGET_TOOLKIT" in
4523 TK_CFLAGS="$MOZ_CAIRO_CFLAGS $MOZ_PIXMAN_CFLAGS"
4524 TK_LIBS="$MOZ_CAIRO_LIBS $MOZ_PIXMAN_LIBS"
4528 AC_SUBST(MOZ_TREE_CAIRO)
4529 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
4530 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
4531 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
4532 AC_SUBST(MOZ_TREE_PIXMAN)
4534 dnl ========================================================
4536 dnl ========================================================
4537 MOZ_ARG_DISABLE_BOOL(xul,
4538 [ --disable-xul Disable XUL],
4540 if test "$MOZ_XUL"; then
4543 dnl remove extensions that require XUL
4544 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
4549 dnl ========================================================
4550 dnl necko configuration options
4551 dnl ========================================================
4554 dnl option to disable necko's wifi scanner
4557 case "$OS_TARGET" in
4559 if test -z "$MOZ_IOS"; then
4563 DragonFly|FreeBSD|WINNT)
4572 MOZ_ARG_DISABLE_BOOL(necko-wifi,
4573 [ --disable-necko-wifi Disable necko wifi scanner],
4577 if test "$NECKO_WIFI"; then
4578 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
4579 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
4581 AC_DEFINE(NECKO_WIFI)
4582 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
4584 AC_SUBST(NECKO_WIFI)
4585 AC_SUBST(NECKO_WIFI_DBUS)
4588 dnl option to disable cookies
4590 MOZ_ARG_DISABLE_BOOL(cookies,
4591 [ --disable-cookies Disable cookie support],
4594 AC_SUBST(NECKO_COOKIES)
4595 if test "$NECKO_COOKIES"; then
4596 AC_DEFINE(NECKO_COOKIES)
4597 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
4600 dnl ========================================================
4602 dnl = Maintainer debug option (no --enable equivalent)
4604 dnl ========================================================
4608 AC_SUBST(AR_EXTRACT)
4611 AC_SUBST(AS_DASH_C_FLAG)
4618 AC_SUBST(MOZ_AUTH_EXTENSION)
4619 AC_SUBST(MOZ_PREF_EXTENSIONS)
4621 AC_SUBST(MOZ_DEBUG_LDFLAGS)
4622 AC_SUBST(WARNINGS_AS_ERRORS)
4623 AC_SUBST_SET(MOZ_EXTENSIONS)
4625 AC_SUBST(MOZ_TOOLKIT_SEARCH)
4628 AC_SUBST(MOZ_UNIVERSALCHARDET)
4629 AC_SUBST(ACCESSIBILITY)
4630 AC_SUBST(MOZ_SPELLCHECK)
4631 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
4632 AC_SUBST(MOZ_CRASHREPORTER)
4633 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
4634 AC_SUBST(MOZ_MAINTENANCE_SERVICE)
4635 AC_SUBST(MOZ_STUB_INSTALLER)
4636 AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
4637 AC_SUBST(MOZ_ENABLE_SIGNMAR)
4638 AC_SUBST(MOZ_UPDATER)
4640 AC_SUBST(MOZ_ANGLE_RENDERER)
4641 AC_SUBST(MOZ_D3D_CPU_SUFFIX)
4642 AC_SUBST(MOZ_HAS_WINSDK_WITH_D3D)
4643 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL)
4644 AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL_PATH)
4646 AC_SUBST(MOZ_ANDROID_APPLICATION_CLASS)
4647 AC_SUBST(MOZ_ANDROID_BROWSER_INTENT_CLASS)
4648 AC_SUBST(MOZ_ANDROID_SEARCH_INTENT_CLASS)
4649 AC_SUBST(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
4650 AC_SUBST(ENABLE_STRIP)
4651 AC_SUBST(PKG_SKIP_STRIP)
4652 AC_SUBST(STRIP_FLAGS)
4653 AC_SUBST(USE_ELF_HACK)
4654 AC_SUBST(INCREMENTAL_LINKER)
4656 AC_SUBST(MOZ_FIX_LINK_PATHS)
4658 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
4659 AC_SUBST(MOZ_LINKER_EXTRACT)
4661 if test -n "$MOZ_BINARY_EXTENSIONS"; then
4662 AC_DEFINE(MOZ_BINARY_EXTENSIONS)
4665 AC_SUBST(MOZ_ADDON_SIGNING)
4666 if test "$MOZ_ADDON_SIGNING" = 1; then
4667 AC_DEFINE(MOZ_ADDON_SIGNING)
4669 AC_SUBST(MOZ_REQUIRE_SIGNING)
4670 if test "$MOZ_REQUIRE_SIGNING" = 1; then
4671 AC_DEFINE(MOZ_REQUIRE_SIGNING)
4674 dnl ========================================================
4675 dnl = Mac bundle name prefix
4676 dnl ========================================================
4677 MOZ_ARG_WITH_STRING(macbundlename-prefix,
4678 [ --with-macbundlename-prefix=prefix
4679 Prefix for MOZ_MACBUNDLE_NAME],
4680 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
4682 MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
4683 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
4684 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
4687 if test "$MOZ_DEBUG"; then
4688 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
4690 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
4692 AC_SUBST(MOZ_MACBUNDLE_NAME)
4694 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
4695 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
4696 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
4697 if test "$MOZ_DEBUG"; then
4698 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
4701 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
4702 AC_SUBST(MOZ_MACBUNDLE_ID)
4704 dnl ========================================================
4705 dnl = Child Process Name for IPC
4706 dnl ========================================================
4707 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
4708 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
4710 # We want to let Android unpack the file at install time, but it only does
4711 # so if the file is named libsomething.so. The lib/ path is also required
4712 # because the unpacked file will be under the lib/ subdirectory and will
4713 # need to be executed from that path.
4714 MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
4715 MOZ_CHILD_PROCESS_NAME_PIE="libplugin-container-pie.so"
4716 AC_SUBST(MOZ_CHILD_PROCESS_NAME_PIE)
4718 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
4719 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
4721 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
4722 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
4723 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
4725 # The following variables are available to branding and application
4726 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
4727 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
4728 # impacts profile location and user-visible fields.
4729 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
4730 # versions of a given application (e.g. Aurora and Firefox both use
4731 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
4732 # for application.ini's "Name" field, which controls profile location in
4733 # the absence of a "Profile" field (see below), and various system
4734 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
4735 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
4736 # Mac Bundle name, Updater, Installer), it is typically used for nightly
4737 # builds (e.g. Aurora for Firefox).
4738 # - MOZ_APP_VERSION: Defines the application version number.
4739 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
4740 # in the "About" window. If not set, defaults to MOZ_APP_VERSION.
4741 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
4742 # defaults to a lowercase form of MOZ_APP_BASENAME.
4743 # - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
4744 # profile name and remoting. If not set, defaults to MOZ_APP_NAME.
4745 # - MOZ_APP_PROFILE: When set, used for application.ini's
4746 # "Profile" field, which controls profile location.
4747 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
4748 # crash reporter server url.
4749 # - MOZ_APP_ANDROID_VERSION_CODE: On Android, "android:versionCode" for
4750 # the main application is set to the value of this variable. If not
4751 # set, it falls back to a Mozilla-specific value derived from the
4753 # - MOZ_ANDROID_SHARED_ID: On Android, "android:sharedUserId" for all Android
4754 # packages produced.
4755 # - MOZ_ANDROID_GCM_SENDERID: On Android, the Android GCM Sender ID used. GCM
4756 # sender IDs are not sensitive: see, http://stackoverflow.com/a/18216063.
4757 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
4759 if test -z "$MOZ_APP_NAME"; then
4760 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
4763 if test -z "$MOZ_APP_REMOTINGNAME"; then
4764 MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
4767 if test -z "$MOZ_APP_VERSION_DISPLAY"; then
4768 MOZ_APP_VERSION_DISPLAY=$MOZ_APP_VERSION
4771 if test -z "$ANDROID_PACKAGE_NAME" ; then
4772 # When we got rid of the Aurora channel we decided to replace the old
4773 # Nightly ANDROID_PACKAGE_NAME with Aurora. To make sure this is inherited
4774 # by all mozilla-central based branches we make this the new "default"
4775 # for Fennec. Non mozilla-central based branches set ANDROID_PACKAGE_NAME
4776 # in their mozconfig, so they will never get this. If there are ever
4777 # non-Fennec builds for Android, they will fall into the else block
4778 # and use their own default name.
4779 # https://bugzilla.mozilla.org/show_bug.cgi?id=1357808 has additional
4780 # background on this.
4781 if test "$MOZ_APP_NAME" = "fennec"; then
4782 ANDROID_PACKAGE_NAME="org.mozilla.fennec_aurora"
4784 ANDROID_PACKAGE_NAME="org.mozilla.$MOZ_APP_NAME"
4788 # Mozilla released Firefox for Android {Release,Beta} and {Aurora,Nightly} to
4789 # the public with specific common shared IDs and we need to keep them
4790 # consistent forever. The specific common values are set by per-channel
4791 # branding; all other channels use a generic sharedID, set below.
4792 if test -z "$MOZ_ANDROID_SHARED_ID" ; then
4793 MOZ_ANDROID_SHARED_ID="${ANDROID_PACKAGE_NAME}.sharedID"
4796 # For extensions and langpacks, we require a max version that is compatible
4797 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
4798 # 24.0a1 and 24.0a2 aren't affected
4800 # 24.1.1 becomes 24.*
4801 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
4802 if test -z "$IS_ALPHA"; then
4804 if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
4805 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
4807 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
4811 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
4814 MOZ_B2G_VERSION=${MOZ_B2G_VERSION:-"1.0.0"}
4815 AC_DEFINE_UNQUOTED(MOZ_B2G_VERSION,"$MOZ_B2G_VERSION")
4816 AC_DEFINE_UNQUOTED(MOZ_B2G_OS_NAME,"$MOZ_B2G_OS_NAME")
4818 AC_SUBST(MOZ_APP_NAME)
4819 AC_SUBST(MOZ_APP_REMOTINGNAME)
4820 AC_SUBST(MOZ_APP_DISPLAYNAME)
4821 AC_SUBST(MOZ_APP_BASENAME)
4822 AC_SUBST(MOZ_APP_VENDOR)
4823 AC_SUBST(MOZ_APP_PROFILE)
4824 AC_SUBST(MOZ_APP_ID)
4825 AC_SUBST(MOZ_APP_ANDROID_VERSION_CODE)
4826 AC_SUBST(MOZ_ANDROID_SHARED_ID)
4827 AC_SUBST(MOZ_ANDROID_GCM_SENDERID)
4828 AC_SUBST(MAR_CHANNEL_ID)
4829 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
4830 AC_SUBST(MOZ_PROFILE_MIGRATOR)
4831 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
4832 AC_SUBST(MOZ_APP_UA_NAME)
4833 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
4834 AC_SUBST(MOZ_APP_VERSION)
4835 AC_SUBST(MOZ_APP_VERSION_DISPLAY)
4836 AC_SUBST(MOZ_APP_MAXVERSION)
4837 AC_DEFINE_UNQUOTED(FIREFOX_VERSION,$FIREFOX_VERSION)
4838 AC_SUBST(FIREFOX_VERSION)
4839 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
4840 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
4841 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
4844 AC_SUBST(MOZ_PKG_SPECIAL)
4845 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
4847 if test "$MOZILLA_OFFICIAL"; then
4848 # Build revisions should always be present in official builds
4849 MOZ_INCLUDE_SOURCE_INFO=1
4852 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
4853 # explicitly set the repository and changeset information in.
4854 AC_SUBST(MOZ_SOURCE_REPO)
4855 AC_SUBST(MOZ_SOURCE_CHANGESET)
4856 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
4858 if test "$MOZ_TELEMETRY_REPORTING"; then
4859 AC_DEFINE(MOZ_TELEMETRY_REPORTING)
4861 # Enable Telemetry by default for nightly and aurora channels
4862 if test -z "$RELEASE_OR_BETA"; then
4863 AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
4867 dnl If we have any service that uploads data (and requires data submission
4868 dnl policy alert), set MOZ_DATA_REPORTING.
4869 dnl We need SUBST for build system and DEFINE for xul preprocessor.
4870 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
4871 MOZ_DATA_REPORTING=1
4872 AC_DEFINE(MOZ_DATA_REPORTING)
4873 AC_SUBST(MOZ_DATA_REPORTING)
4877 AC_SUBST(WIN32_REDIST_DIR)
4878 AC_SUBST(WIN_UCRT_REDIST_DIR)
4880 dnl ========================================================
4882 dnl ========================================================
4886 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
4892 dnl Echo the CFLAGS to remove extra whitespace.
4898 $_WARNINGS_CXXFLAGS \
4901 COMPILE_CFLAGS=`echo \
4905 COMPILE_CXXFLAGS=`echo \
4906 $_DEFINES_CXXFLAGS \
4912 HOST_CXXFLAGS=`echo \
4915 AC_SUBST(_DEPEND_CFLAGS)
4916 AC_SUBST(MOZ_SYSTEM_JPEG)
4917 AC_SUBST(MOZ_SYSTEM_PNG)
4918 AC_SUBST(MOZ_SYSTEM_BZ2)
4920 AC_SUBST_LIST(MOZ_JPEG_CFLAGS)
4921 AC_SUBST_LIST(MOZ_JPEG_LIBS)
4922 AC_SUBST_LIST(MOZ_BZ2_CFLAGS)
4923 AC_SUBST_LIST(MOZ_BZ2_LIBS)
4924 AC_SUBST_LIST(MOZ_PNG_CFLAGS)
4925 AC_SUBST_LIST(MOZ_PNG_LIBS)
4927 AC_SUBST(MOZ_SYSTEM_NSPR)
4929 AC_SUBST(MOZ_SYSTEM_NSS)
4931 HOST_CMFLAGS=-fobjc-exceptions
4932 HOST_CMMFLAGS=-fobjc-exceptions
4933 OS_COMPILE_CMFLAGS=-fobjc-exceptions
4934 OS_COMPILE_CMMFLAGS=-fobjc-exceptions
4935 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
4936 OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
4937 OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
4939 AC_SUBST(HOST_CMFLAGS)
4940 AC_SUBST(HOST_CMMFLAGS)
4941 AC_SUBST(OS_COMPILE_CMFLAGS)
4942 AC_SUBST(OS_COMPILE_CMMFLAGS)
4945 OS_CXXFLAGS="$CXXFLAGS"
4946 OS_CPPFLAGS="$CPPFLAGS"
4947 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
4948 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
4949 OS_LDFLAGS="$LDFLAGS"
4952 AC_SUBST(OS_CXXFLAGS)
4953 AC_SUBST(OS_CPPFLAGS)
4954 AC_SUBST(OS_COMPILE_CFLAGS)
4955 AC_SUBST(OS_COMPILE_CXXFLAGS)
4956 AC_SUBST(OS_LDFLAGS)
4961 AC_SUBST(HOST_CFLAGS)
4962 AC_SUBST(HOST_CPPFLAGS)
4963 AC_SUBST(HOST_CXXFLAGS)
4964 AC_SUBST(HOST_LDFLAGS)
4965 AC_SUBST(HOST_OPTIMIZE_FLAGS)
4967 AC_SUBST(HOST_AR_FLAGS)
4968 AC_SUBST(HOST_RANLIB)
4969 AC_SUBST(HOST_BIN_SUFFIX)
4971 AC_SUBST(TARGET_XPCOM_ABI)
4972 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
4973 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
4974 AC_SUBST(HAVE_X86_AVX2)
4975 AC_SUBST(HAVE_ALTIVEC)
4976 AC_SUBST(GCC_USE_GNU_LD)
4978 AC_SUBST(WRAP_LDFLAGS)
4981 AC_SUBST(DSO_CFLAGS)
4982 AC_SUBST(DSO_PIC_CFLAGS)
4983 AC_SUBST(DSO_LDOPTS)
4984 AC_SUBST(BIN_SUFFIX)
4986 AC_SUBST(CC_VERSION)
4987 AC_SUBST(NS_ENABLE_TSF)
4988 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
4989 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
4991 AC_SUBST(MOZ_VORBIS)
4992 AC_SUBST(MOZ_TREMOR)
4994 AC_SUBST_LIST(FFVPX_ASFLAGS)
4995 AC_SUBST(VPX_USE_YASM)
4996 AC_SUBST_LIST(VPX_ASFLAGS)
4997 AC_SUBST(VPX_AS_CONVERSION)
4998 AC_SUBST(VPX_X86_ASM)
4999 AC_SUBST(VPX_ARM_ASM)
5000 AC_SUBST(LIBJPEG_TURBO_USE_YASM)
5001 AC_SUBST_LIST(LIBJPEG_TURBO_ASFLAGS)
5002 AC_SUBST(MOZ_LIBAV_FFT)
5003 AC_SUBST_LIST(LIBAV_FFT_ASFLAGS)
5004 AC_SUBST(MOZ_DEVTOOLS)
5006 AC_SUBST(MOZ_PACKAGE_JSSHELL)
5007 AC_SUBST(MOZ_FOLD_LIBS)
5008 AC_SUBST_LIST(MOZ_FOLD_LIBS_FLAGS)
5009 AC_SUBST(SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE)
5013 dnl Host JavaScript runtime, if any, to use during cross compiles.
5016 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
5018 if test -n "$COMPILE_ENVIRONMENT"; then
5019 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
5021 dnl Check for missing components
5022 if test "$MOZ_X11"; then
5023 dnl ====================================================
5024 dnl = Check if X headers exist
5025 dnl ====================================================
5026 _SAVE_CFLAGS=$CFLAGS
5027 CFLAGS="$CFLAGS $XCFLAGS"
5031 #include <X11/Xlib.h>
5032 #include <X11/Intrinsic.h>
5033 #include <X11/extensions/XShm.h>
5037 if ((dpy = XOpenDisplay(NULL)) == NULL) {
5038 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
5042 [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
5043 CFLAGS="$_SAVE_CFLAGS"
5045 if test -n "$MISSING_X"; then
5046 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
5051 fi # COMPILE_ENVIRONMENT
5053 dnl Set various defines and substitutions
5054 dnl ========================================================
5056 if test "$MOZ_DEBUG"; then
5057 AC_DEFINE(MOZ_REFLOW_PERF)
5058 AC_DEFINE(MOZ_REFLOW_PERF_DSP)
5061 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
5062 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
5063 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
5064 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
5065 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
5066 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
5067 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
5068 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
5069 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
5072 AC_SUBST(MOZ_DEV_EDITION)
5073 if test -n "$MOZ_DEV_EDITION"; then
5074 AC_DEFINE(MOZ_DEV_EDITION)
5077 if test "$MOZ_DEBUG"; then
5080 case "$MOZ_UPDATE_CHANNEL" in
5081 aurora|beta|release|esr)
5088 if test -n "$A11Y_LOG"; then
5092 AC_SUBST(MOZILLA_VERSION)
5094 dnl Spit out some output
5095 dnl ========================================================
5097 dnl The following defines are used by xpcom
5098 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
5100 HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
5101 HAVE_CPP_PARTIAL_SPECIALIZATION
5104 HAVE_ICONV_WITH_CONST_INPUT
5117 dnl ========================================================
5118 dnl Determine options to use for running the preprocessor.
5119 dnl ========================================================
5121 if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT"; then
5122 PREPROCESS_OPTION="-P -Fi"
5124 PREPROCESS_OPTION="-E -o "
5127 AC_SUBST(PREPROCESS_OPTION)
5129 dnl ========================================================
5130 dnl mask as shorthand property
5131 dnl ========================================================
5133 # The control structure code will be removed as soon as the feature is stable
5134 # Refer to bug 1281101 for more details.
5135 MOZ_ENABLE_MASK_AS_SHORTHAND=1
5136 AC_DEFINE(MOZ_ENABLE_MASK_AS_SHORTHAND)
5137 AC_SUBST(MOZ_ENABLE_MASK_AS_SHORTHAND)
5139 # Avoid using obsolete NSPR features
5140 AC_DEFINE(NO_NSPR_10_SUPPORT)
5142 # Don't build NSS libpkix
5143 NSS_DISABLE_LIBPKIX=1
5144 AC_SUBST(NSS_DISABLE_LIBPKIX)
5146 MOZ_CREATE_CONFIG_STATUS()
5148 if test -z "$direct_nspr_config"; then
5149 dnl ========================================================
5150 dnl = Setup a nice relatively clean build environment for
5151 dnl = sub-configures.
5152 dnl ========================================================
5155 CFLAGS="$_SUBDIR_CFLAGS"
5156 CPPFLAGS="$_SUBDIR_CPPFLAGS"
5157 CXXFLAGS="$_SUBDIR_CXXFLAGS"
5158 LDFLAGS="$_SUBDIR_LDFLAGS"
5159 HOST_CC="$_SUBDIR_HOST_CC"
5160 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
5161 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
5162 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
5169 # Run all configure scripts specified by a subconfigure
5170 if test -n "$_subconfigure_subdir"; then
5171 _save_srcdir="$srcdir"
5173 _save_ac_configure_args="$ac_configure_args"
5174 ac_configure_args="$_subconfigure_config_args"
5175 AC_OUTPUT_SUBDIRS_NOW("$_subconfigure_subdir",$cache_file)
5176 ac_configure_args="$_save_ac_configure_args"
5177 srcdir="$_save_srcdir"
5180 if test "$COMPILE_ENVIRONMENT"; then
5184 dnl ========================================================
5185 dnl = Setup a nice relatively clean build environment for
5186 dnl = sub-configures.
5187 dnl ========================================================
5190 CFLAGS="$_SUBDIR_CFLAGS"
5191 CPPFLAGS="$_SUBDIR_CPPFLAGS"
5192 CXXFLAGS="$_SUBDIR_CXXFLAGS"
5193 LDFLAGS="$_SUBDIR_LDFLAGS"
5194 HOST_CC="$_SUBDIR_HOST_CC"
5195 HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
5196 HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
5197 HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
5200 # Run the SpiderMonkey 'configure' script.
5201 dist=$MOZ_BUILD_ROOT/dist
5202 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
5204 # --with-system-nspr will have been converted into the relevant $NSPR_CFLAGS
5206 ac_configure_args="`echo $ac_configure_args | sed -e 's/--with-system-nspr\S* *//'`"
5208 if test "$_INTL_API" = no; then
5209 ac_configure_args="$ac_configure_args --without-intl-api"
5212 if test -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
5213 ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
5214 ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
5216 ac_configure_args="$ac_configure_args --prefix=$dist"
5217 if test -n "$ZLIB_IN_MOZGLUE"; then
5220 export MOZ_SYSTEM_ZLIB
5221 export MOZ_ZLIB_CFLAGS
5222 export MOZ_ZLIB_LIBS
5224 export MOZ_APP_REMOTINGNAME
5226 export MOZILLA_CENTRAL_PATH=$_topsrcdir
5227 export STLPORT_CPPFLAGS
5232 export ZLIB_IN_MOZGLUE
5246 export HOST_CPPFLAGS
5247 export HOST_CXXFLAGS
5250 if ! test -e js; then
5254 ac_configure_args="$ac_configure_args JS_STANDALONE="
5255 AC_OUTPUT_SUBDIRS(js/src,$cache_file)
5256 ac_configure_args="$_SUBDIR_CONFIG_ARGS"
5258 fi # COMPILE_ENVIRONMENT
5260 dnl we need to run config.status after js/src subconfigure because we're
5261 dnl traversing its moz.build and we need its config.status for that.
5262 dnl However, writing our own config.status needs to happen before
5263 dnl subconfigures because the setup surrounding subconfigures alters
5264 dnl many AC_SUBSTed variables.
5265 MOZ_RUN_ALL_SUBCONFIGURES()
5267 rm -fr confdefs* $ac_clean_files