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 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 ========================================================
53 dnl Set the minimum version of toolkit libs used by mozilla
54 dnl ========================================================
56 # 2_26 is the earliest version we can set GLIB_VERSION_MIN_REQUIRED.
57 # The macro won't be used when compiling with earlier versions anyway.
58 GLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_26
62 GDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_4
64 STARTUP_NOTIFICATION_VERSION=0.8
68 dnl Set various checks
69 dnl ========================================================
72 dnl Initialize the Pthread test variables early so they can be
73 dnl overridden by each platform.
74 dnl ========================================================
78 LDFLAGS="$LDFLAGS $LINKER_LDFLAGS"
80 if test "$COMPILE_ENVIRONMENT"; then
82 fi # COMPILE_ENVIRONMENT
85 *-android*|*-linuxandroid*)
88 AC_PATH_PROG(OBJCOPY,objcopy)
98 AC_SUBST(ANDROID_PACKAGE_NAME)
101 dnl ========================================================
102 dnl Checks for compilers.
103 dnl ========================================================
105 if test "$COMPILE_ENVIRONMENT"; then
107 if test "$target" != "$host"; then
113 # Work around the conftest.exe access problem on Windows
118 MOZ_PATH_PROGS(AS, $AS as, $CC)
119 AC_CHECK_PROGS(STRIP, strip, :)
120 AC_CHECK_PROGS(OTOOL, otool, :)
123 if test -n "$MOZ_WINCONSOLE"; then
124 AC_DEFINE(MOZ_WINCONSOLE)
129 dnl ========================================================
130 dnl Special win32 checks
131 dnl ========================================================
137 if test "$GCC" != "yes"; then
138 # Check to see if we are really running in a msvc environemnt
141 # Make sure compilers are valid
142 CFLAGS="$CFLAGS -nologo"
143 CXXFLAGS="$CXXFLAGS -TP -nologo"
146 AC_TRY_COMPILE([#include <stdio.h>],
147 [ printf("Hello World\n"); ],,
148 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
151 AC_TRY_COMPILE([#include <new.h>],
152 [ unsigned *test = new unsigned(42); ],,
153 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
157 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
160 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
161 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
162 AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
165 MSVC_C_RUNTIME_DLL=vcruntime140.dll
166 MSVC_CXX_RUNTIME_DLL=msvcp140.dll
168 # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
169 CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
171 if test -n "$WIN_UCRT_REDIST_DIR"; then
172 if test ! -d "$WIN_UCRT_REDIST_DIR"; then
173 AC_MSG_ERROR([Invalid Windows UCRT Redist directory: ${WIN_UCRT_REDIST_DIR}])
175 WIN_UCRT_REDIST_DIR=`cd "$WIN_UCRT_REDIST_DIR" && pwd -W`
178 AC_SUBST(MSVC_C_RUNTIME_DLL)
179 AC_SUBST(MSVC_CXX_RUNTIME_DLL)
181 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
183 if test -n "$WIN32_REDIST_DIR"; then
184 if test ! -d "$WIN32_REDIST_DIR"; then
185 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
187 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd -W`
190 # Check linker version, except in lld builds
195 _LD_FULL_VERSION=`"${LINKER}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
196 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
197 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
198 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
205 unset _MSVC_VER_FILTER
208 STL_FLAGS="-I${DIST}/stl_wrappers"
209 CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
210 CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
212 # Check w32api version
213 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
214 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
215 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
216 AC_TRY_COMPILE([#include <w32api.h>],
217 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
218 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
219 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
220 #error "test failed."
222 , [ res=yes ], [ res=no ])
223 AC_MSG_RESULT([$res])
224 if test "$res" != "yes"; then
225 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
227 # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
228 # causing problems with local implementations with the same name.
229 AC_DEFINE(STRSAFE_NO_DEPRECATE)
232 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
233 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
234 # Require OS features provided by IE 8.0 (Win7)
235 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0800)
240 if test -n "$_WIN32_MSVC"; then
242 SKIP_COMPILER_CHECKS=1
243 SKIP_LIBRARY_CHECKS=1
245 # Since we're skipping compiler and library checks, hard-code
248 AC_DEFINE(HAVE_ISATTY)
251 fi # COMPILE_ENVIRONMENT
256 AC_SUBST_LIST(STL_FLAGS)
257 AC_SUBST(WRAP_STL_INCLUDES)
259 dnl ========================================================
260 dnl Checks for programs.
261 dnl ========================================================
262 if test "$COMPILE_ENVIRONMENT"; then
268 fi # COMPILE_ENVIRONMENT
270 dnl ========================================================
271 dnl set the defaults first
272 dnl ========================================================
273 MOZ_USER_DIR=".mozilla"
275 MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
279 dnl Configure platform-specific CPU architecture compiler options.
280 dnl ==============================================================
281 if test "$COMPILE_ENVIRONMENT"; then
283 fi # COMPILE_ENVIRONMENT
285 dnl ========================================================
286 dnl Android libstdc++
287 dnl ========================================================
290 if test "$COMPILE_ENVIRONMENT"; then
292 fi # COMPILE_ENVIRONMENT
294 dnl ========================================================
295 dnl Suppress Clang Argument Warnings
296 dnl ========================================================
297 WARNINGS_CFLAGS="$_WARNINGS_CFLAGS"
298 if test -n "${CLANG_CC}${CLANG_CL}"; then
299 WARNINGS_CFLAGS="-Qunused-arguments $WARNINGS_CFLAGS"
300 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
302 if test -n "${CLANG_CXX}${CLANG_CL}"; then
303 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
306 if test -n "$COMPILE_ENVIRONMENT"; then
310 dnl ========================================================
311 dnl Add optional and non-optional hardening flags
312 dnl ========================================================
314 CFLAGS="$CFLAGS $MOZ_HARDENING_CFLAGS"
315 CPPFLAGS="$CPPFLAGS $MOZ_HARDENING_CFLAGS"
316 CXXFLAGS="$CXXFLAGS $MOZ_HARDENING_CFLAGS"
317 LDFLAGS="$LDFLAGS $MOZ_HARDENING_LDFLAGS"
319 dnl ========================================================
320 dnl GNU specific defaults
321 dnl ========================================================
322 if test "$GNU_CC"; then
326 SSSE3_FLAGS="-mssse3"
327 # FIXME: Let us build with strict aliasing. bug 414641.
328 CFLAGS="$CFLAGS -fno-strict-aliasing"
329 WARNINGS_AS_ERRORS='-Werror'
332 if test "$OS_ARCH" != "WINNT" -o -z "$CLANG_CC"; then
333 DSO_PIC_CFLAGS='-fPIC'
334 ASFLAGS="$ASFLAGS -fPIC"
337 AC_MSG_CHECKING([for --noexecstack option to as])
339 CFLAGS="$CFLAGS -Wa,--noexecstack"
340 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
341 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
344 AC_MSG_CHECKING([for -z noexecstack option to ld])
345 _SAVE_LDFLAGS=$LDFLAGS
346 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
347 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
349 LDFLAGS=$_SAVE_LDFLAGS)
351 AC_MSG_CHECKING([for -z text option to ld])
352 _SAVE_LDFLAGS=$LDFLAGS
353 LDFLAGS="$LDFLAGS -Wl,-z,text"
354 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
356 LDFLAGS=$_SAVE_LDFLAGS)
358 AC_MSG_CHECKING([for -z relro option to ld])
359 _SAVE_LDFLAGS=$LDFLAGS
360 LDFLAGS="$LDFLAGS -Wl,-z,relro"
361 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
363 LDFLAGS=$_SAVE_LDFLAGS)
365 AC_MSG_CHECKING([for -z nocopyreloc option to ld])
366 _SAVE_LDFLAGS=$LDFLAGS
367 LDFLAGS="$LDFLAGS -Wl,-z,nocopyreloc"
368 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
370 LDFLAGS=$_SAVE_LDFLAGS)
372 AC_MSG_CHECKING([for -Bsymbolic-functions option to ld])
373 _SAVE_LDFLAGS=$LDFLAGS
374 LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
375 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
377 LDFLAGS=$_SAVE_LDFLAGS)
379 AC_MSG_CHECKING([for --build-id=sha1 option to ld])
380 _SAVE_LDFLAGS=$LDFLAGS
381 LDFLAGS="$LDFLAGS -Wl,--build-id=sha1"
382 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
384 LDFLAGS=$_SAVE_LDFLAGS)
386 AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
387 HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
388 _SAVE_LDFLAGS=$LDFLAGS
389 LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
390 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
391 [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
393 LDFLAGS=$_SAVE_LDFLAGS
395 # Check for -mssse3 on $CC
396 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
397 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
399 CFLAGS="$CFLAGS -mssse3"
400 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
401 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
405 # Check for -msse4.1 on $CC
406 AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
407 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
409 CFLAGS="$CFLAGS -msse4.1"
410 AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
411 [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
415 case "${CPU_ARCH}" in
417 AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
419 [asm volatile ("vpermq \$0xd8,%ymm0,%ymm0 \n");],
420 result="yes", result="no")
421 AC_MSG_RESULT("$result")
422 if test "$result" = "yes"; then
428 AC_MSG_CHECKING([whether we can enable AltiVec support])
431 CFLAGS="$CFLAGS -maltivec"
432 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
440 if test "$GCC_USE_GNU_LD"; then
441 # Some tools like ASan use a runtime library that is only
442 # linked against executables, so we must allow undefined
443 # symbols for shared objects in some cases.
444 if test -z "$MOZ_ASAN$MOZ_MSAN$MOZ_UBSAN$MOZ_TSAN$FUZZING_INTERFACES"; then
445 # Don't allow undefined symbols in libraries
446 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
448 # BSDs need `environ' exposed for posix_spawn (bug 753046)
450 DragonFly|FreeBSD|NetBSD|OpenBSD)
451 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
452 DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
454 DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
461 _DEFINES_CFLAGS="-include $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
462 _USE_CPP_INCLUDE_FLAG=1
464 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
467 if test "$GNU_CXX"; then
468 # FIXME: Let us build with strict aliasing. bug 414641.
469 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
471 _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
472 _USE_CPP_INCLUDE_FLAG=1
475 # For profiling builds keep the symbol information
476 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
478 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
479 STRIP_FLAGS="--strip-debug"
484 dnl ========================================================
486 dnl ========================================================
488 if test "$MOZ_DMD"; then
489 if test "${CPU_ARCH}" = "arm"; then
490 CFLAGS="$CFLAGS -funwind-tables"
491 CXXFLAGS="$CXXFLAGS -funwind-tables"
495 dnl ========================================================
496 dnl System overrides of the defaults for host
497 dnl ========================================================
500 if test -n "$_WIN32_MSVC"; then
501 HOST_CFLAGS="$HOST_CFLAGS -nologo"
503 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
505 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
506 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
509 case "${host_cpu}" in
511 if test -n "$_WIN32_MSVC"; then
512 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
516 if test -n "$_WIN32_MSVC"; then
517 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
519 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
525 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
526 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
529 *-linux*|*-kfreebsd*-gnu|*-gnu*)
530 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
531 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
535 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
536 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
540 dnl ========================================================
541 dnl System overrides of the defaults for target
542 dnl ========================================================
546 MOZ_OPTIMIZE_FLAGS="-O3"
547 CXXFLAGS="$CXXFLAGS -stdlib=libc++"
549 STRIP_FLAGS="$STRIP_FLAGS -x -S"
550 # Ensure that if we're targeting iOS an SDK was provided.
551 AC_CACHE_CHECK(for iOS target,
553 [AC_TRY_COMPILE([#include <TargetConditionals.h>
554 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
558 ac_cv_ios_target="yes",
559 ac_cv_ios_target="no")])
560 if test "$ac_cv_ios_target" = "yes" -a -z $MOZ_IOS; then
561 AC_MSG_ERROR([targeting iOS but not using an iOS SDK?])
563 if test -z "$MOZ_IOS"; then
564 # The ExceptionHandling framework is needed for Objective-C exception
565 # logging code in nsObjCExceptions.h. Currently we only use that in debug
567 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
570 dnl DTrace and -dead_strip don't interact well. See bug 403132.
571 dnl ===================================================================
572 if test "x$enable_dtrace" = "xyes"; then
573 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
575 dnl check for the presence of the -dead_strip linker flag
576 AC_MSG_CHECKING([for -dead_strip option to ld])
577 _SAVE_LDFLAGS=$LDFLAGS
578 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
579 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
580 if test -n "$_HAVE_DEAD_STRIP" ; then
582 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
587 LDFLAGS=$_SAVE_LDFLAGS
590 MOZ_FIX_LINK_PATHS="-Wl,-executable_path,${DIST}/bin"
593 *-android*|*-linuxandroid*)
594 AC_DEFINE(NO_PW_GECOS)
596 if test "$COMPILE_ENVIRONMENT"; then
600 MOZ_GFX_OPTIMIZE_MOBILE=1
601 if test -z "$CLANG_CC"; then
602 MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
604 # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
605 # -Oz is smaller than -Os on clang.
606 MOZ_OPTIMIZE_FLAGS="-Oz"
607 # Disable the outliner, which causes performance regressions, and is
608 # enabled on some platforms at -Oz.
609 if test -z "$MOZ_LTO"; then
610 DISABLE_OUTLINER="-mno-outline"
612 CFLAGS="$CFLAGS $DISABLE_OUTLINER"
613 AC_TRY_COMPILE(,,[MOZ_OPTIMIZE_FLAGS="$MOZ_OPTIMIZE_FLAGS $DISABLE_OUTLINER"])
614 CFLAGS="$_SAVE_CFLAGS"
616 DISABLE_OUTLINER="-Wl,-plugin-opt=-enable-machine-outliner=never"
617 _SAVE_LDFLAGS=$LDFLAGS
618 LDFLAGS="$LDFLAGS $MOZ_LTO_LDFLAGS $DISABLE_OUTLINER"
619 AC_TRY_LINK(,,[MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS $DISABLE_OUTLINER"])
620 LDFLAGS="$_SAVE_LDFLAGS"
626 if test "$GNU_CC" -o "$GNU_CXX"; then
627 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
628 if test -n "$MOZ_DEBUG"; then
629 MOZ_OPTIMIZE_FLAGS="-Os"
631 MOZ_OPTIMIZE_FLAGS="-O2"
633 if test -z "$CLANG_CC"; then
634 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
638 case "${target_cpu}" in
640 CFLAGS="$CFLAGS -mieee"
641 CXXFLAGS="$CXXFLAGS -mieee"
648 # certain versions of cygwin's makedepend barf on the
649 # #include <string> vs -I./dist/include/string issue so don't use it
650 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
654 CFLAGS="$CFLAGS -mms-bitfields"
655 CXXFLAGS="$CXXFLAGS -mms-bitfields"
657 # Use temp file for windres (bug 213281)
658 RCFLAGS='-O coff --use-temp-file'
659 # mingw doesn't require kernel32, user32, and advapi32 explicitly
660 LIBS="$LIBS -luuid -lusp10 -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
663 MOZ_OPTIMIZE_FLAGS="-O1"
665 WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
666 WIN32_GUI_EXE_LDFLAGS=-mwindows
668 if test -z "$CLANG_CC"; then
669 # Use static libgcc and libstdc++
670 LDFLAGS="$LDFLAGS -static"
672 # GCC/binutils can't link to a function if we try to include dllexport function
673 # in the same library as dllimport caller. To work around it, we build NSPR
674 # and NSS with -mnop-fun-dllimport flag. The drawback of this solution is that
675 # function thunks need to be generated for cross-DLL calls.
676 MOZ_FOLD_LIBS_FLAGS="-mnop-fun-dllimport"
678 # Silence problematic clang warnings
679 CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
682 TARGET_COMPILER_ABI=msvc
683 RANLIB='echo not_ranlib'
684 STRIP='echo not_strip'
686 # aarch64 doesn't support subsystems below 6.02
687 if test "$CPU_ARCH" = "aarch64"; then
688 WIN32_SUBSYSTEM_VERSION=6.02
690 WIN32_SUBSYSTEM_VERSION=6.01
692 WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
693 WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
694 DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
695 _USE_CPP_INCLUDE_FLAG=1
696 _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
697 _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
698 CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
699 CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
700 if test -z "$CLANG_CL"; then
701 CPPFLAGS="$CPPFLAGS -utf-8"
703 if test "$CPU_ARCH" = "x86"; then
704 dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
705 dnl more recent, so set that explicitly here unless another
706 dnl target arch has already been set.
708 if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
709 CFLAGS="$CFLAGS -arch:SSE2"
711 if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
712 CXXFLAGS="$CXXFLAGS -arch:SSE2"
715 SSE_FLAGS="-arch:SSE"
716 SSE2_FLAGS="-arch:SSE2"
717 dnl MSVC allows the use of intrinsics without any flags
718 dnl and doesn't have a separate arch for SSSE3
719 SSSE3_FLAGS="-arch:SSE2"
721 dnl clang-cl requires appropriate flags to enable SSSE3 support
722 dnl on all architectures.
723 if test -n "$CLANG_CL"; then
724 SSSE3_FLAGS="-mssse3"
726 dnl VS2013+ supports -Gw for better linker optimizations.
727 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
728 dnl Disabled on ASan because it causes false-positive ODR violations.
729 if test -z "$MOZ_ASAN"; then
731 CXXFLAGS="$CXXFLAGS -Gw"
733 # String tail merging doesn't play nice with ASan's ODR checker.
734 LDFLAGS="$LDFLAGS -opt:nolldtailmerge"
736 if test -n "$CLANG_CL"; then
737 # XXX We should combine some of these with our generic GCC-style
740 # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
741 CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
742 # We use offsetof on non-POD objects all the time.
743 # We also suppress this warning on other platforms.
744 CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
745 # This warns for reasonable things like:
746 # enum { X = 0xffffffffU };
747 # which is annoying for IDL headers.
748 CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
749 # This warns for cases that would be reached by the Microsoft
750 # #include rules, but also currently warns on cases that would
751 # *also* be reached by standard C++ include rules. That
752 # behavior doesn't seem useful, so we turn it off.
753 CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
754 # We normally error out on unknown pragmas, but since clang-cl
755 # claims to be MSVC, it would be difficult to add
756 # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
757 # use such pragmas, so just ignore them.
758 CFLAGS="$CFLAGS -Wno-unknown-pragmas"
759 CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
760 # We get errors about various #pragma intrinsic directives from
761 # clang-cl, and we don't need to hear about those.
762 CFLAGS="$CFLAGS -Wno-ignored-pragmas"
763 CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
764 # clang-cl's Intrin.h marks things like _ReadWriteBarrier
765 # as __attribute((__deprecated__)). This is nice to know,
766 # but since we don't get the equivalent warning from MSVC,
767 # let's just ignore it.
768 CFLAGS="$CFLAGS -Wno-deprecated-declarations"
769 CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
770 # We use a function like:
771 # __declspec(noreturn) __inline void f() {}
772 # which -Winvalid-noreturn complains about. Again, MSVC seems
773 # OK with it, so let's silence the warning.
774 CFLAGS="$CFLAGS -Wno-invalid-noreturn"
775 CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
776 # Missing |override| on virtual function declarations isn't
777 # something that MSVC currently warns about.
778 CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
779 # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
780 # declaration on |operator delete(void*)|. However, clang-cl
781 # must internally declare |operator delete(void*)| differently,
782 # which causes this warning for virtually every file in the
783 # tree. clang-cl doesn't support -fno-exceptions or equivalent,
784 # so there doesn't seem to be any way to convince clang-cl to
785 # declare |delete| differently. Therefore, suppress this
787 CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
788 # At least one MSVC header and several headers in-tree have
789 # unused typedefs, so turn this on.
790 CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
791 # jemalloc uses __declspec(allocator) as a profiler hint,
792 # which clang-cl doesn't understand.
793 CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
794 # __attribute__((unused)) really means "might be unused" and
795 # we use it to avoid warnings about things that are unused
796 # in some compilation units, but used in many others. This
797 # warning insists on complaining about the latter case, which
798 # is annoying, and rather noisy.
799 CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused"
801 # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
802 CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
803 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
804 MOZ_DEBUG_LDFLAGS='-DEBUG'
805 WARNINGS_AS_ERRORS='-WX'
806 # Use a higher optimization level for clang-cl, so we can come closer
807 # to MSVC's performance numbers (see bug 1443590).
808 if test -n "$CLANG_CL"; then
809 MOZ_OPTIMIZE_FLAGS='-O2'
811 MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
814 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE"
815 if test -z "$DEVELOPER_OPTIONS"; then
816 LDFLAGS="$LDFLAGS -RELEASE"
819 dnl Minimum reqiurement of Gecko is VS2015 or later which supports
820 dnl both SSSE3 and SSE4.1.
821 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
822 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
823 dnl allow AVX2 code from VS2015
826 AC_DEFINE(WIN32_LEAN_AND_MEAN)
827 dnl See http://support.microsoft.com/kb/143208 to use STL
830 MOZ_USER_DIR="Mozilla"
834 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.])
838 if test -n "$GNU_CC" -a -z "$CLANG_CC"; then
839 CFLAGS="$CFLAGS -fno-keep-inline-dllexport"
840 CXXFLAGS="$CXXFLAGS -fno-keep-inline-dllexport"
845 if test -n "$GNU_CC"; then
846 CFLAGS="$CFLAGS -mstackrealign"
847 CXXFLAGS="$CXXFLAGS -mstackrealign"
848 LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
849 if test -z "$CLANG_CC"; then
850 LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup"
853 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
854 LDFLAGS="$LDFLAGS -SAFESEH"
860 if test -n "$_WIN32_MSVC"; then
861 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
866 if test -n "$_WIN32_MSVC"; then
867 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:ARM64"
872 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
879 CFLAGS="$CFLAGS -Dunix"
880 CXXFLAGS="$CXXFLAGS -Dunix"
881 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
882 DSO_PIC_CFLAGS='-fPIC -DPIC'
884 MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
886 DSO_PIC_CFLAGS='-fPIC -DPIC'
889 # This will fail on a.out systems prior to 1.5.1_ALPHA.
890 if test "$LIBRUNPATH"; then
891 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
896 if test -z "$X11BASE"; then
899 MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
901 DSO_PIC_CFLAGS='-fPIC'
902 DSO_LDOPTS='-shared -fPIC'
903 if test "$LIBRUNPATH"; then
904 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
909 MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
914 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
915 MOZ_OPTIMIZE_FLAGS="-O"
918 AC_SUBST_LIST(MMX_FLAGS)
919 AC_SUBST_LIST(SSE_FLAGS)
920 AC_SUBST_LIST(SSE2_FLAGS)
921 AC_SUBST_LIST(SSSE3_FLAGS)
924 if test -n "$MOZ_LINKER"; then
925 AC_DEFINE(MOZ_LINKER)
927 AC_CHECK_PROGS(XZ, xz)
930 if test -z "$COMPILE_ENVIRONMENT"; then
931 SKIP_COMPILER_CHECKS=1
932 SKIP_LIBRARY_CHECKS=1
937 fi # COMPILE_ENVIRONMENT
939 if test -z "$SKIP_COMPILER_CHECKS"; then
940 dnl Checks for typedefs, structures, and compiler characteristics.
941 dnl ========================================================
956 case "${OS_TARGET}" in
960 STL_FLAGS="-I${DIST}/stl_wrappers"
965 if test "$MOZ_BUILD_APP" = "tools/crashreporter"; then
969 dnl Checks for header files.
970 dnl ========================================================
973 bitrig*|dragonfly*|freebsd*|openbsd*)
974 # for stuff like -lXshm
975 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
979 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
980 AC_CACHE_CHECK(for sockaddr_in.sin_len,
981 ac_cv_sockaddr_in_sin_len,
982 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
983 #include <sys/types.h>
985 #include <netinet/in.h>
986 struct sockaddr_in x;
987 void *foo = (void*) &x.sin_len;],
989 [ac_cv_sockaddr_in_sin_len=true],
990 [ac_cv_sockaddr_in_sin_len=false])])
991 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
992 AC_DEFINE(HAVE_SIN_LEN)
993 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
994 AC_DEFINE(HAVE_SCONN_LEN)
997 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
998 ac_cv_sockaddr_in6_sin6_len,
999 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1000 #include <sys/types.h>
1002 #include <netinet/in.h>
1003 struct sockaddr_in6 x;
1004 void *foo = (void*) &x.sin6_len;],
1006 [ac_cv_sockaddr_in6_sin6_len=true],
1007 [ac_cv_sockaddr_in6_sin6_len=false])])
1008 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
1009 AC_DEFINE(HAVE_SIN6_LEN)
1012 AC_CACHE_CHECK(for sockaddr.sa_len,
1013 ac_cv_sockaddr_sa_len,
1014 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1015 #include <sys/types.h>
1017 #include <sys/socket.h>
1019 void *foo = (void*) &x.sa_len;],
1021 [ac_cv_sockaddr_sa_len=true],
1022 [ac_cv_sockaddr_sa_len=false])])
1023 if test "$ac_cv_sockaddr_sa_len" = true ; then
1024 AC_DEFINE(HAVE_SA_LEN)
1027 MOZ_ARG_ENABLE_BOOL(dtrace,
1028 [ --enable-dtrace build with dtrace support if available (default=no)],
1029 [enable_dtrace="yes"],)
1030 if test "x$enable_dtrace" = "xyes"; then
1031 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
1032 if test -n "$HAVE_DTRACE"; then
1033 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
1035 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
1038 AC_SUBST(HAVE_DTRACE)
1040 dnl Checks for libraries.
1041 dnl ========================================================
1042 AC_CHECK_LIB(c_r, gethostbyname_r)
1044 dnl We don't want to link with libdl even if it's present on OS X, since
1045 dnl it's not used and not part of the default installation. OS/2 has dlfcn
1047 dnl We don't want to link against libm or libpthread on Darwin since
1048 dnl they both are just symlinks to libSystem and explicitly linking
1049 dnl against libSystem causes issues when debugging (see bug 299601).
1054 AC_SEARCH_LIBS(dlopen, dl,
1055 MOZ_CHECK_HEADER(dlfcn.h,
1056 AC_DEFINE(HAVE_DLOPEN)))
1060 _SAVE_CFLAGS="$CFLAGS"
1061 CFLAGS="$CFLAGS -D_GNU_SOURCE"
1062 AC_CHECK_FUNCS(dladdr memmem)
1063 CFLAGS="$_SAVE_CFLAGS"
1065 if test ! "$GNU_CXX"; then
1066 AC_CHECK_LIB(C, demangle)
1069 AC_CHECK_LIB(socket, socket)
1072 XLIBS="$X_EXTRA_LIBS"
1074 dnl ========================================================
1075 dnl Checks for X libraries.
1076 dnl Ordering is important.
1077 dnl Xt is dependent upon SM as of X11R6
1078 dnl ========================================================
1079 if test -n "$MOZ_X11"; then
1080 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
1081 _SAVE_LDFLAGS="$LDFLAGS"
1083 LDFLAGS="$XLDFLAGS $LDFLAGS"
1084 AC_CHECK_LIB(X11, XDrawLines, [XLIBS="-lX11 $XLIBS"],
1085 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
1086 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
1087 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
1089 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
1090 unset ac_cv_lib_Xt_XtFree
1091 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
1092 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
1093 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
1094 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
1097 dnl ========================================================
1099 dnl ========================================================
1100 AC_CHECK_LIB(xcb, xcb_connect, [XLIBS="-lxcb $XLIBS"],
1101 [MISSING_X="$MISSING_X -lxcb"], $XLIBS)
1102 AC_CHECK_LIB(xcb-shm, xcb_shm_query_version, [XLIBS="-lxcb-shm $XLIBS"],
1103 [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS)
1104 AC_CHECK_LIB(X11-xcb, XGetXCBConnection, [XLIBS="-lX11-xcb $XLIBS"],
1105 [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS)
1107 LDFLAGS="$_SAVE_LDFLAGS"
1111 AC_SUBST_LIST(XCFLAGS)
1112 AC_SUBST_LIST(XLDFLAGS)
1113 AC_SUBST_LIST(XLIBS)
1114 AC_SUBST_LIST(XEXT_LIBS)
1115 AC_SUBST_LIST(XT_LIBS)
1117 dnl ========================================================
1118 dnl = pthread support
1119 dnl = Start by checking whether the system support pthreads
1120 dnl ========================================================
1121 case "$target_os" in
1126 AC_CHECK_LIB(pthreads, pthread_create,
1127 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
1128 AC_CHECK_LIB(pthread, pthread_create,
1129 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
1130 AC_CHECK_LIB(c_r, pthread_create,
1131 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
1132 AC_CHECK_LIB(c, pthread_create,
1141 dnl ========================================================
1142 dnl Do the platform specific pthread hackery
1143 dnl ========================================================
1144 if test "$MOZ_USE_PTHREADS"x != x
1147 dnl See if -pthread is supported.
1150 ac_cv_have_dash_pthread=no
1151 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
1152 echo 'int main() { return 0; }' | cat > conftest.c
1153 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
1154 if test $? -eq 0; then
1155 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1156 ac_cv_have_dash_pthread=yes
1157 case "$target_os" in
1159 # Freebsd doesn't use -pthread for compiles, it uses them for linking
1162 CFLAGS="$CFLAGS -pthread"
1163 CXXFLAGS="$CXXFLAGS -pthread"
1169 AC_MSG_RESULT($ac_cv_have_dash_pthread)
1172 dnl See if -pthreads is supported.
1174 ac_cv_have_dash_pthreads=no
1175 if test "$ac_cv_have_dash_pthread" = "no"; then
1176 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
1177 echo 'int main() { return 0; }' | cat > conftest.c
1178 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
1179 if test $? -eq 0; then
1180 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1181 ac_cv_have_dash_pthreads=yes
1182 CFLAGS="$CFLAGS -pthreads"
1183 CXXFLAGS="$CXXFLAGS -pthreads"
1187 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
1192 AC_DEFINE(_REENTRANT)
1193 AC_DEFINE(_THREAD_SAFE)
1194 dnl -pthread links in -lpthread, so don't specify it explicitly.
1195 if test "$ac_cv_have_dash_pthread" = "yes"; then
1196 _PTHREAD_LDFLAGS="-pthread"
1200 *-*-openbsd*|*-*-bsdi*)
1201 AC_DEFINE(_REENTRANT)
1202 AC_DEFINE(_THREAD_SAFE)
1203 dnl -pthread links in -lc_r, so don't specify it explicitly.
1204 if test "$ac_cv_have_dash_pthread" = "yes"; then
1205 _PTHREAD_LDFLAGS="-pthread"
1209 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
1210 AC_DEFINE(_REENTRANT)
1214 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
1215 AC_SUBST(MOZ_USE_PTHREADS)
1216 MOZ_CHECK_HEADERS(pthread.h)
1220 dnl Checks for library functions.
1221 dnl ========================================================
1222 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall)
1224 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1225 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1226 ac_cv_clock_monotonic,
1227 [for libs in "" -lrt; do
1229 _SAVE_CFLAGS="$CFLAGS"
1231 CFLAGS="$CFLAGS $DSO_PIC_CFLAGS"
1232 dnl clock_gettime is available on OSX since 10.12, so depending on MACOSX_DEPLOYMENT_TARGET,
1233 dnl we should or not be able to use it. To detect if we can, we need to make the
1234 dnl availability attribute strict, so that compilation fails when the target is < 10.12.
1235 AC_TRY_LINK([#define availability(os, ...) availability(os, strict, __VA_ARGS)
1237 [ struct timespec ts;
1238 clock_gettime(CLOCK_MONOTONIC, &ts); ],
1239 ac_cv_clock_monotonic=$libs
1242 ac_cv_clock_monotonic=no)
1244 CFLAGS="$_SAVE_CFLAGS"
1246 if test "$ac_cv_clock_monotonic" != "no"; then
1247 HAVE_CLOCK_MONOTONIC=1
1248 REALTIME_LIBS=$ac_cv_clock_monotonic
1249 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1250 AC_SUBST(HAVE_CLOCK_MONOTONIC)
1251 AC_SUBST_LIST(REALTIME_LIBS)
1254 dnl Turn on warnings-as-errors to prevent implicit declaration of
1255 dnl pthread_cond_timedwait_monotonic_np, which can cause this test to
1256 dnl inadvertently pass even if the function does not really exist.
1257 _SAVE_CFLAGS="$CFLAGS"
1258 CFLAGS="$CFLAGS $WARNINGS_AS_ERRORS"
1259 AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
1260 ac_cv_pthread_cond_timedwait_monotonic_np,
1261 AC_TRY_LINK([#include <pthread.h>],
1262 [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
1263 ac_cv_pthread_cond_timewait_monotonic_np=yes,
1264 ac_cv_pthread_cond_timewait_monotonic_np=no))
1265 if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
1266 AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
1268 CFLAGS=$_SAVE_CFLAGS
1272 ac_cv_func_res_ninit,
1273 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
1274 dnl no need for res_ninit() on NetBSD and OpenBSD
1275 ac_cv_func_res_ninit=no
1279 #define _BSD_SOURCE 1
1281 #include <sys/types.h>
1282 #include <netinet/in.h>
1283 #include <arpa/nameser.h>
1286 [int foo = res_ninit(&_res);],
1287 [ac_cv_func_res_ninit=yes],
1288 [ac_cv_func_res_ninit=no])
1292 if test "$ac_cv_func_res_ninit" = "yes"; then
1293 AC_DEFINE(HAVE_RES_NINIT)
1294 dnl must add the link line we do something as foolish as this... dougt
1296 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
1297 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
1302 dnl **********************
1303 dnl *** va_copy checks ***
1304 AC_CACHE_CHECK([for an implementation of va_copy()],
1306 [AC_TRY_COMPILE([#include <stdarg.h>
1308 void f (int i, ...) {
1309 va_list args1, args2;
1310 va_start (args1, i);
1311 va_copy (args2, args1);
1312 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1314 va_end (args1); va_end (args2);
1316 [f(0, 42); return 0],
1317 [ac_cv_va_copy=yes],
1321 AC_CACHE_CHECK([whether va_list can be copied by value],
1323 [AC_TRY_COMPILE([#include <stdarg.h>
1325 void f (int i, ...) {
1326 va_list args1, args2;
1327 va_start (args1, i);
1329 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1331 va_end (args1); va_end (args2);
1333 [f(0, 42); return 0],
1334 [ac_cv_va_val_copy=yes],
1335 [ac_cv_va_val_copy=no],
1338 if test "x$ac_cv_va_copy" = "xyes"; then
1339 AC_DEFINE(VA_COPY, va_copy)
1340 AC_DEFINE(HAVE_VA_COPY)
1343 if test "x$ac_cv_va_val_copy" = "xno"; then
1344 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
1347 dnl ===================================================================
1348 dnl ========================================================
1349 dnl Put your C++ language/feature checks below
1350 dnl ========================================================
1354 if test "$GNU_CC"; then
1355 if test "$CPU_ARCH" = "arm" ; then
1356 AC_CACHE_CHECK(for ARM EABI,
1360 #if defined(__ARM_EABI__)
1363 #error Not ARM EABI.
1366 ac_cv_gcc_arm_eabi="yes",
1367 ac_cv_gcc_arm_eabi="no")])
1368 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
1370 ARM_ABI_PREFIX=eabi-
1372 ARM_ABI_PREFIX=oabi-
1376 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
1379 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
1380 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
1381 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
1383 _SAVE_LDFLAGS=$LDFLAGS
1384 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
1385 AC_CACHE_CHECK(for __thread keyword for TLS variables,
1386 ac_cv_thread_keyword,
1387 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
1388 [return tlsIsMainThread;],
1389 ac_cv_thread_keyword=yes,
1390 ac_cv_thread_keyword=no)])
1391 LDFLAGS=$_SAVE_LDFLAGS
1392 # The custom dynamic linker doesn't support TLS variables
1394 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
1395 # mips builds fail with TLS variables because of a binutils bug.
1397 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
1402 *-android*|*-linuxandroid*)
1409 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
1415 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
1416 if test -n "$MOZ_LINKER"; then
1417 if test "$CPU_ARCH" = arm; then
1418 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
1419 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
1420 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1421 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1425 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
1426 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
1427 dnl Since the linker only understands the sysv ones, no need to build the
1428 dnl gnu style tables anyways.
1429 LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
1432 dnl End of C++ language/feature checks
1435 dnl ========================================================
1436 dnl = Internationalization checks
1437 dnl ========================================================
1439 dnl Internationalization and Locale support is different
1440 dnl on various UNIX platforms. Checks for specific i18n
1441 dnl features go here.
1443 AC_HAVE_FUNCS(localeconv)
1445 fi # ! SKIP_COMPILER_CHECKS
1447 if test -n "${COMPILE_ENVIRONMENT}"; then
1452 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1453 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1454 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1457 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1458 dnl features that Windows actually does support.
1460 if test -n "$SKIP_COMPILER_CHECKS"; then
1461 dnl Windows has malloc.h
1462 AC_DEFINE(MALLOC_H, [<malloc.h>])
1463 AC_DEFINE(HAVE_FORCEINLINE)
1464 AC_DEFINE(HAVE_LOCALECONV)
1465 fi # SKIP_COMPILER_CHECKS
1467 dnl Mozilla specific options
1468 dnl ========================================================
1469 dnl The macros used for command line options
1470 dnl are defined in build/autoconf/altoptions.m4.
1472 dnl ========================================================
1474 dnl = Check for external package dependencies
1476 dnl ========================================================
1477 MOZ_ARG_HEADER(External Packages)
1479 case "$OS_TARGET" in
1480 WINNT|Darwin|Android)
1490 dnl ========================================================
1491 dnl system libevent Support
1492 dnl ========================================================
1493 MOZ_ARG_WITH_STRING(system-libevent,
1494 [ --with-system-libevent[=PFX]
1495 Use system libevent [installed at prefix PFX]],
1496 LIBEVENT_DIR=$withval)
1498 _SAVE_CFLAGS=$CFLAGS
1499 _SAVE_LDFLAGS=$LDFLAGS
1501 if test "$LIBEVENT_DIR" = yes; then
1502 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
1503 MOZ_SYSTEM_LIBEVENT=1,
1506 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
1507 MOZ_SYSTEM_LIBEVENT=
1508 elif test -z "$MOZ_SYSTEM_LIBEVENT"; then
1509 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
1510 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
1511 MOZ_CHECK_HEADER(event.h,
1512 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
1513 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
1515 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
1516 AC_CHECK_LIB(event, event_init,
1517 [MOZ_SYSTEM_LIBEVENT=1
1518 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
1519 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
1520 [MOZ_SYSTEM_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
1522 CFLAGS=$_SAVE_CFLAGS
1523 LDFLAGS=$_SAVE_LDFLAGS
1526 AC_SUBST(MOZ_SYSTEM_LIBEVENT)
1528 dnl ========================================================
1529 dnl = If NSS was not detected in the system,
1530 dnl = use the one in the source tree (mozilla/security/nss)
1531 dnl ========================================================
1533 MOZ_ARG_WITH_BOOL(system-nss,
1534 [ --with-system-nss Use system installed NSS],
1537 if test -n "$_USE_SYSTEM_NSS"; then
1538 AM_PATH_NSS(3.46, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
1541 NSS_CFLAGS="$NSS_CFLAGS -I${DIST}/include/nss"
1542 if test -z "$MOZ_SYSTEM_NSS"; then
1543 case "${OS_ARCH}" in
1544 # Only few platforms have been tested with GYP
1545 WINNT|Darwin|Linux|DragonFly|FreeBSD|NetBSD|OpenBSD|SunOS)
1548 AC_MSG_ERROR([building in-tree NSS is not supported on this platform. Use --with-system-nss])
1553 dnl system ZLIB support
1554 dnl ========================================================
1555 MOZ_ZLIB_CHECK([1.2.3])
1557 if test -z "$SKIP_LIBRARY_CHECKS"; then
1559 dnl ========================================================
1560 dnl system PNG Support
1561 dnl ========================================================
1562 MOZ_ARG_WITH_STRING(system-png,
1563 [ --with-system-png[=PFX]
1564 Use system libpng [installed at prefix PFX]],
1567 _SAVE_CFLAGS=$CFLAGS
1568 _SAVE_LDFLAGS=$LDFLAGS
1570 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
1571 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
1572 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
1574 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
1577 AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"],
1578 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1579 AC_CHECK_LIB(png, png_get_acTL, ,
1580 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
1582 if test "$MOZ_SYSTEM_PNG" = 1; then
1583 AC_TRY_COMPILE([ #include <stdio.h>
1584 #include <sys/types.h>
1586 [ #if PNG_LIBPNG_VER < $MOZPNG
1587 #error "Insufficient libpng version ($MOZPNG required)."
1589 #ifndef PNG_UINT_31_MAX
1590 #error "Insufficient libpng version."
1593 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1595 CFLAGS=$_SAVE_CFLAGS
1596 LDFLAGS=$_SAVE_LDFLAGS
1599 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then
1600 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
1601 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
1604 fi # SKIP_LIBRARY_CHECKS
1606 dnl ========================================================
1610 dnl ========================================================
1612 MOZ_ARG_HEADER(Application)
1614 ENABLE_SYSTEM_EXTENSION_DIRS=1
1615 MOZ_BRANDING_DIRECTORY=
1616 MOZ_OFFICIAL_BRANDING=
1617 MOZ_AUTH_EXTENSION=1
1618 if test "$MOZ_IOS"; then
1621 MOZ_PREF_EXTENSIONS=1
1623 MOZ_UNIVERSALCHARDET=1
1628 MOZ_USE_NATIVE_POPUP_WINDOWS=
1629 MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
1631 MOZ_BINARY_EXTENSIONS=
1634 case "$target_os" in
1637 AC_DEFINE(NS_ENABLE_TSF)
1641 # Optional Firefox for Android partner distribution directory.
1642 MOZ_ARG_WITH_STRING(android-distribution-directory,
1643 [ --with-android-distribution-directory=dir
1644 Optional Firefox for Android partner distribution directory.],
1645 MOZ_ANDROID_DISTRIBUTION_DIRECTORY=$withval)
1647 if test -n "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY"; then
1648 # A distribution directory must have an assets/distribution directory.
1649 # See https://wiki.mozilla.org/Mobile/Distribution_Files.
1650 if test ! -d "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY/assets/distribution" ; then
1651 AC_MSG_ERROR([--with-android-distribution-directory does not contain assets/distribution;
1652 (looked for ${MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets/distribution).])
1655 AC_SUBST(MOZ_ANDROID_DISTRIBUTION_DIRECTORY)
1657 dnl ========================================================
1658 dnl = Trademarked Branding
1659 dnl ========================================================
1660 MOZ_ARG_ENABLE_BOOL(official-branding,
1661 [ --enable-official-branding
1662 Enable Official mozilla.org Branding
1663 Do not distribute builds with
1664 --enable-official-branding unless you have
1665 permission to use trademarks per
1666 http://www.mozilla.org/foundation/trademarks/ .],
1667 MOZ_OFFICIAL_BRANDING=1,
1668 MOZ_OFFICIAL_BRANDING=)
1670 # Allow the application to influence configure with a confvars.sh script.
1671 AC_MSG_CHECKING([if app-specific confvars.sh exists])
1672 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
1673 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
1674 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
1679 # Allow influencing configure with a defines.sh script.
1680 . "${srcdir}/build/defines.sh"
1682 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
1684 if test "$BUILDING_RELEASE"; then
1685 # Override value in defines.sh, if any
1686 EARLY_BETA_OR_EARLIER=
1687 elif test "$EARLY_BETA_OR_EARLIER"; then
1688 AC_DEFINE(EARLY_BETA_OR_EARLIER)
1690 AC_SUBST(EARLY_BETA_OR_EARLIER)
1692 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
1693 MOZ_ARG_WITH_STRING(app-name,
1694 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
1695 WITH_APP_NAME=$withval,
1698 if test -n "$WITH_APP_NAME" ; then
1699 MOZ_APP_NAME="$WITH_APP_NAME"
1702 MOZ_ARG_WITH_STRING(app-basename,
1703 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
1704 WITH_APP_BASENAME=$withval,
1707 if test -n "$WITH_APP_BASENAME" ; then
1708 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
1711 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
1712 # that haven't made a confvars.sh yet. Don't add new stuff here, use
1714 case "$MOZ_BUILD_APP" in
1716 AC_DEFINE(MOZ_PHOENIX)
1720 # Graphene is a desktop runtime for running applications with a HTML UI.
1721 if test -n "$MOZ_GRAPHENE"; then
1722 AC_DEFINE(MOZ_GRAPHENE)
1725 AC_SUBST(MOZ_PHOENIX)
1727 dnl ========================================================
1728 dnl Ensure Android SDK and build-tools versions depending on
1730 dnl ========================================================
1732 case "$MOZ_BUILD_APP" in
1738 dnl ========================================================
1740 dnl = Toolkit Options
1742 dnl ========================================================
1743 MOZ_ARG_HEADER(Toolkit Options)
1745 dnl ========================================================
1746 dnl = Enable the toolkit as needed =
1747 dnl ========================================================
1749 case "$MOZ_WIDGET_TOOLKIT" in
1752 LDFLAGS="$LDFLAGS -framework Cocoa"
1753 # Use -Wl as a trick to avoid -framework and framework names from
1754 # being separated by AC_SUBST_LIST.
1755 TK_LIBS='-Wl,-framework,Foundation -Wl,-framework,CoreFoundation -Wl,-framework,CoreLocation -Wl,-framework,QuartzCore -Wl,-framework,Carbon -Wl,-framework,CoreAudio -Wl,-framework,CoreVideo -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit -Wl,-framework,AddressBook -Wl,-framework,OpenGL -Wl,-framework,Security -Wl,-framework,ServiceManagement -Wl,-framework,CoreServices -Wl,-framework,ApplicationServices -Wl,-framework,AppKit'
1757 CFLAGS="$CFLAGS $TK_CFLAGS"
1758 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1759 MOZ_USER_DIR="Mozilla"
1760 MOZ_FS_LAYOUT=bundle
1764 LDFLAGS="$LDFLAGS -framework UIKit"
1766 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'
1767 CFLAGS="$CFLAGS $TK_CFLAGS"
1768 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1769 MOZ_USER_DIR="Mozilla"
1770 MOZ_FS_LAYOUT=bundle
1775 if test "$OS_TARGET" = Darwin; then
1776 LDFLAGS="$LDFLAGS -lobjc"
1779 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
1780 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
1781 case "$MOZ_WIDGET_TOOLKIT" in
1787 if test "$COMPILE_ENVIRONMENT"; then
1788 if test "$MOZ_WIDGET_TOOLKIT" = gtk3; then
1789 PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 gio-unix-2.0 $GDK_PACKAGES)
1790 MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
1791 TK_CFLAGS=$MOZ_GTK3_CFLAGS
1792 TK_LIBS=$MOZ_GTK3_LIBS
1793 dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
1794 dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
1795 AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
1796 GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32
1798 if test "$MOZ_ENABLE_GTK"; then
1799 if test "$MOZ_X11"; then
1800 GDK_PACKAGES=gdk-x11-2.0
1802 AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
1803 AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
1805 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 >= $GLIB_VERSION gobject-2.0 gio-unix-2.0 $GDK_PACKAGES)
1806 MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
1808 fi # COMPILE_ENVIRONMENT
1810 AC_SUBST(MOZ_FS_LAYOUT)
1812 dnl ========================================================
1813 dnl = startup-notification support module
1814 dnl ========================================================
1816 if test "$MOZ_ENABLE_GTK"
1818 MOZ_ENABLE_STARTUP_NOTIFICATION=
1820 MOZ_ARG_ENABLE_BOOL(startup-notification,
1821 [ --enable-startup-notification
1822 Enable startup-notification support (default: disabled) ],
1823 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
1824 MOZ_ENABLE_STARTUP_NOTIFICATION=)
1825 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
1827 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
1828 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
1829 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
1830 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
1832 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
1834 MOZ_ENABLE_STARTUP_NOTIFICATION=
1838 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
1839 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
1842 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
1844 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
1846 AC_SUBST_LIST(TK_CFLAGS)
1847 AC_SUBST_LIST(TK_LIBS)
1849 dnl ========================================================
1851 dnl = Components & Features
1853 dnl ========================================================
1854 MOZ_ARG_HEADER(Components and Features)
1856 AC_SUBST(MOZ_OFFICIAL_BRANDING)
1857 if test -n "$MOZ_OFFICIAL_BRANDING"; then
1858 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
1859 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
1861 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
1862 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
1866 MOZ_ARG_WITH_STRING(branding,
1867 [ --with-branding=dir Use branding from the specified directory.],
1868 MOZ_BRANDING_DIRECTORY=$withval)
1870 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
1871 if test -z "$REAL_BRANDING_DIRECTORY"; then
1872 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
1875 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1876 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
1877 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1878 . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
1881 AC_SUBST(MOZ_BRANDING_DIRECTORY)
1883 dnl ========================================================
1884 dnl = Distribution ID
1885 dnl ========================================================
1886 MOZ_ARG_WITH_STRING(distribution-id,
1887 [ --with-distribution-id=ID
1888 Set distribution-specific id (default=org.mozilla)],
1889 [ val=`echo $withval`
1890 MOZ_DISTRIBUTION_ID="$val"])
1892 if test -z "$MOZ_DISTRIBUTION_ID"; then
1893 MOZ_DISTRIBUTION_ID="org.mozilla"
1896 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
1897 AC_SUBST(MOZ_DISTRIBUTION_ID)
1899 dnl ========================================================
1900 dnl = libproxy support
1901 dnl ========================================================
1903 if test "$MOZ_ENABLE_GTK"
1905 MOZ_ENABLE_LIBPROXY=
1907 MOZ_ARG_ENABLE_BOOL(libproxy,
1908 [ --enable-libproxy Enable libproxy support ],
1909 MOZ_ENABLE_LIBPROXY=1,
1910 MOZ_ENABLE_LIBPROXY=)
1912 if test "$MOZ_ENABLE_LIBPROXY"
1914 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
1915 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
1918 AC_SUBST(MOZ_ENABLE_LIBPROXY)
1920 dnl ========================================================
1922 dnl ========================================================
1924 if test "$MOZ_ENABLE_GTK"
1928 MOZ_ARG_DISABLE_BOOL(dbus,
1929 [ --disable-dbus Disable dbus support ],
1933 if test "$MOZ_ENABLE_DBUS"
1935 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
1936 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
1937 AC_DEFINE(MOZ_ENABLE_DBUS)
1940 AC_SUBST(MOZ_ENABLE_DBUS)
1942 dnl =========================================================
1943 dnl = Whether to exclude hyphenations files in the build
1944 dnl =========================================================
1945 if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
1946 AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
1949 AC_TRY_COMPILE([#include <linux/ethtool.h>],
1950 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
1951 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
1953 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
1955 if test -n "$MOZ_WEBRTC"; then
1956 if test -n "$MOZ_X11"; then
1957 MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
1961 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
1963 dnl ========================================================
1964 dnl = Apple platform decoder support
1965 dnl ========================================================
1966 if test "$COMPILE_ENVIRONMENT"; then
1967 if test -n "$MOZ_APPLEMEDIA"; then
1968 # hack in frameworks for fmp4 - see bug 1029974
1969 # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
1970 LDFLAGS="$LDFLAGS -framework AudioToolbox"
1971 dnl Verify CoreMedia is available.
1972 AC_CHECK_HEADERS([CoreMedia/CoreMedia.h VideoToolbox/VideoToolbox.h], [],
1973 [AC_MSG_ERROR([MacOS X 10.9 SDK or later is required])])
1975 fi # COMPILE_ENVIRONMENT
1977 dnl ========================================================
1978 dnl = Handle dependent MEDIA defines
1979 dnl ========================================================
1982 AC_DEFINE(MOZ_WEBM_ENCODER)
1983 AC_SUBST(MOZ_WEBM_ENCODER)
1985 dnl ========================================================
1987 dnl ========================================================
1989 MOZ_ARG_DISABLE_BOOL(negotiateauth,
1990 [ --disable-negotiateauth Disable GSS-API negotiation ],
1991 MOZ_AUTH_EXTENSION=,
1992 MOZ_AUTH_EXTENSION=1 )
1994 if test -n "$MOZ_IOS" -a -n "$MOZ_AUTH_EXTENSION"; then
1995 AC_MSG_ERROR([negotiateauth is not supported on iOS.])
1998 dnl ========================================================
1999 dnl Pref extensions (autoconfig)
2000 dnl ========================================================
2001 MOZ_ARG_DISABLE_BOOL(pref-extensions,
2002 [ --disable-pref-extensions
2003 Disable pref extensions such as autoconfig],
2004 MOZ_PREF_EXTENSIONS=,
2005 MOZ_PREF_EXTENSIONS=1 )
2007 dnl ========================================================
2008 dnl Searching of system directories for extensions.
2009 dnl Note: this switch is meant to be used for test builds
2010 dnl whose behavior should not depend on what happens to be
2011 dnl installed on the local machine.
2012 dnl ========================================================
2013 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
2014 [ --disable-system-extension-dirs
2015 Disable searching system- and account-global
2016 directories for extensions of any kind; use
2017 only profile-specific extension directories],
2018 ENABLE_SYSTEM_EXTENSION_DIRS=,
2019 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
2020 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
2021 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
2024 dnl ========================================================
2025 dnl = Universalchardet
2026 dnl ========================================================
2027 MOZ_ARG_DISABLE_BOOL(universalchardet,
2028 [ --disable-universalchardet
2029 Disable universal encoding detection],
2030 MOZ_UNIVERSALCHARDET=,
2031 MOZ_UNIVERSALCHARDET=1 )
2033 dnl ========================================================
2035 dnl ========================================================
2037 if test "$COMPILE_ENVIRONMENT" ; then
2039 dnl Moved gamepad platform check to moz.build, linux header check still needed here.
2040 if test "$OS_TARGET" = "Linux"; then
2041 MOZ_CHECK_HEADER([linux/joystick.h])
2042 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
2043 AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
2047 fi # COMPILE_ENVIRONMENT
2050 dnl ========================================================
2051 dnl = Breakpad crash reporting (on by default on supported platforms)
2052 dnl ========================================================
2055 i?86-*-mingw*|x86_64-*-mingw*|aarch64-*-mingw*)
2058 i?86-apple-darwin*|x86_64-apple-darwin*)
2059 if test -z "$MOZ_IOS"; then
2063 *-android*|*-linuxandroid*)
2064 dnl Android/arm is arm-unknown-linux-androideabi, so android condition should
2065 dnl be before Linux condition
2068 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
2069 if test "$MOZ_ENABLE_GTK"; then
2075 MOZ_ARG_DISABLE_BOOL(crashreporter,
2076 [ --disable-crashreporter Disable breakpad crash reporting],
2077 [MOZ_CRASHREPORTER=],
2078 [MOZ_CRASHREPORTER=F # Force enable breakpad])
2080 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin" -a "$MOZ_WIDGET_TOOLKIT" != "android"; then
2081 if test "$MOZ_CRASHREPORTER" = F; then
2082 AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
2087 if test -n "$MOZ_CRASHREPORTER"; then
2088 AC_DEFINE(MOZ_CRASHREPORTER)
2090 if test "$OS_TARGET" = "Linux" && \
2091 test -z "$SKIP_LIBRARY_CHECKS"; then
2092 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
2095 if test "$OS_ARCH" = "WINNT"; then
2096 if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
2097 MOZ_CRASHREPORTER_INJECTOR=1
2098 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
2103 dnl ========================================================
2104 dnl = Enable compilation of specific extension modules
2105 dnl ========================================================
2107 MOZ_ARG_ENABLE_STRING(extensions,
2108 [ --enable-extensions Enable extensions],
2109 [ for option in `echo $enableval | sed 's/,/ /g'`; do
2110 if test "$option" = "yes" -o "$option" = "all"; then
2111 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
2112 elif test "$option" = "no" -o "$option" = "none"; then
2114 elif test "$option" = "default"; then
2115 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
2116 elif test `echo "$option" | grep -c \^-` != 0; then
2117 option=`echo $option | sed 's/^-//'`
2118 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
2120 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
2123 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
2125 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
2126 dnl when trying to build a nonexistent extension.
2127 for extension in $MOZ_EXTENSIONS; do
2128 if test ! -d "${srcdir}/extensions/${extension}"; then
2129 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
2133 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
2134 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
2137 # Avoid defining MOZ_ENABLE_CAIRO_FT on Windows platforms because
2138 # "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
2139 if test -n "$MOZ_TREE_FREETYPE" -a "$OS_TARGET" != WINNT; then
2140 MOZ_ENABLE_CAIRO_FT=1
2141 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2142 CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
2143 AC_SUBST_LIST(CAIRO_FT_CFLAGS)
2146 AC_CHECK_PROGS(WGET, wget, "")
2149 dnl ========================================================
2151 dnl ========================================================
2153 if test "$MOZ_IOS"; then
2157 MOZ_ARG_DISABLE_BOOL(updater,
2158 [ --disable-updater Disable building of updater],
2162 if test -n "$MOZ_UPDATER"; then
2163 AC_DEFINE(MOZ_UPDATER)
2166 dnl ========================================================
2167 dnl parental controls (for Windows Vista)
2168 dnl ========================================================
2169 MOZ_ARG_DISABLE_BOOL(parental-controls,
2170 [ --disable-parental-controls
2171 Do not build parental controls],
2172 MOZ_DISABLE_PARENTAL_CONTROLS=1,
2173 MOZ_DISABLE_PARENTAL_CONTROLS=)
2174 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
2175 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
2178 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
2180 dnl ========================================================
2181 dnl = Disable smartcard support
2182 dnl ========================================================
2183 if test -n "$MOZ_NO_SMART_CARDS"; then
2184 AC_DEFINE(MOZ_NO_SMART_CARDS)
2186 AC_SUBST(MOZ_NO_SMART_CARDS)
2188 dnl ========================================================
2189 dnl = Sandboxing support
2190 dnl ========================================================
2191 if test -n "$MOZ_TSAN" -o -n "$MOZ_ASAN"; then
2192 # Bug 1182565: TSan conflicts with sandboxing on Linux.
2193 # Bug 1287971: LSan also conflicts with sandboxing on Linux.
2201 MOZ_ARG_DISABLE_BOOL(sandbox,
2202 [ --disable-sandbox Disable sandboxing support],
2206 case "$OS_TARGET" in
2213 # Linux sandbox is only available on x86 and x86_64.
2220 # Only enable the sandbox by default on Linux, macOS, and Windows
2225 if test -n "$MOZ_SANDBOX"; then
2226 AC_DEFINE(MOZ_SANDBOX)
2229 AC_SUBST(MOZ_SANDBOX)
2232 dnl ========================================================
2234 dnl = Module specific options
2236 dnl ========================================================
2237 MOZ_ARG_HEADER(Individual module options)
2239 dnl ========================================================
2240 dnl Check for sqlite
2241 dnl ========================================================
2244 MOZ_ARG_ENABLE_BOOL(system-sqlite,
2245 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
2246 MOZ_SYSTEM_SQLITE=1,
2247 MOZ_SYSTEM_SQLITE= )
2249 if test -n "$MOZ_SYSTEM_SQLITE"
2251 dnl ============================
2252 dnl === SQLite Version check ===
2253 dnl ============================
2254 dnl Check to see if the system SQLite package is new enough.
2255 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
2257 dnl ==============================
2258 dnl === SQLite fdatasync check ===
2259 dnl ==============================
2260 dnl Check to see if fdatasync is available
2261 AC_CHECK_FUNC(fdatasync)
2264 if test -n "$MOZ_SYSTEM_SQLITE"; then
2265 AC_DEFINE(MOZ_SYSTEM_SQLITE)
2267 AC_SUBST(MOZ_SYSTEM_SQLITE)
2269 dnl ========================================================
2270 dnl = Disable zipwriter
2271 dnl ========================================================
2272 MOZ_ARG_DISABLE_BOOL(zipwriter,
2273 [ --disable-zipwriter Disable zipwriter component],
2276 AC_SUBST(MOZ_ZIPWRITER)
2278 dnl ========================================================
2280 dnl = Feature options that require extra sources to be pulled
2282 dnl ========================================================
2283 dnl MOZ_ARG_HEADER(Features that require extra sources)
2285 dnl ========================================================
2287 dnl = Runtime debugging and Optimization Options
2289 dnl ========================================================
2290 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
2292 dnl ========================================================
2293 dnl enable mobile optimizations
2294 dnl ========================================================
2295 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
2296 [ --enable-mobile-optimize
2297 Enable mobile optimizations],
2298 MOZ_GFX_OPTIMIZE_MOBILE=1)
2300 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
2302 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
2303 # We ignore paint will resample on mobile for performance.
2304 # We may want to revisit this later.
2305 MOZ_IGNORE_PAINT_WILL_RESAMPLE=1
2307 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
2308 AC_DEFINE(MOZ_IGNORE_PAINT_WILL_RESAMPLE)
2311 dnl ========================================================
2312 dnl = Enable code optimization. ON by default.
2313 dnl ========================================================
2315 # Use value from moz.configure if one is defined. Else use our computed
2317 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
2318 MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
2321 if test "$COMPILE_ENVIRONMENT"; then
2322 if test -n "$MOZ_OPTIMIZE"; then
2323 AC_MSG_CHECKING([for valid C compiler optimization flags])
2324 _SAVE_CFLAGS=$CFLAGS
2325 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
2326 AC_TRY_COMPILE([#include <stdio.h>],
2327 [printf("Hello World\n");],
2330 AC_MSG_RESULT([$_results])
2331 if test "$_results" = "no"; then
2332 AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
2334 CFLAGS=$_SAVE_CFLAGS
2335 if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
2336 # When using llvm-based LTO, non numeric optimization levels are
2337 # not supported by the linker, so force the linker to use -O2 (
2338 # which doesn't influence the level compilation units are actually
2340 case " $MOZ_OPTIMIZE_FLAGS " in
2341 *\ -Os\ *|*\ -Oz\ *)
2342 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
2347 fi # COMPILE_ENVIRONMENT
2349 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
2350 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
2351 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
2353 dnl ========================================================
2354 dnl = Disable treating compiler warnings as errors
2355 dnl ========================================================
2356 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
2357 WARNINGS_AS_ERRORS=''
2360 dnl ========================================================
2361 dnl = Enable runtime logging
2362 dnl ========================================================
2363 AC_DEFINE(MOZ_LOGGING)
2364 AC_DEFINE(FORCE_PR_LOG)
2366 dnl ========================================================
2367 dnl = This will enable logging of addref, release, ctor, dtor.
2368 dnl ========================================================
2369 _ENABLE_LOGREFCNT=42
2370 MOZ_ARG_ENABLE_BOOL(logrefcnt,
2371 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
2372 _ENABLE_LOGREFCNT=1,
2373 _ENABLE_LOGREFCNT= )
2374 if test "$_ENABLE_LOGREFCNT" = "1"; then
2375 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
2376 elif test -z "$_ENABLE_LOGREFCNT"; then
2377 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
2380 dnl ========================================================
2381 dnl moz_dump_painting
2382 dnl ========================================================
2383 MOZ_ARG_ENABLE_BOOL(dump-painting,
2384 [ --enable-dump-painting Enable paint debugging.],
2385 MOZ_DUMP_PAINTING=1,
2386 MOZ_DUMP_PAINTING= )
2387 if test -n "$MOZ_DUMP_PAINTING"; then
2388 AC_DEFINE(MOZ_DUMP_PAINTING)
2389 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
2391 if test -n "$MOZ_DEBUG"; then
2392 AC_DEFINE(MOZ_DUMP_PAINTING)
2395 case "${OS_TARGET}" in
2396 Android|WINNT|Darwin)
2397 MOZ_GLUE_IN_PROGRAM=
2400 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
2401 MOZ_GLUE_IN_PROGRAM=1
2402 AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
2406 dnl ========================================================
2407 dnl = Jemalloc build setup
2408 dnl ========================================================
2409 if test -z "$MOZ_MEMORY"; then
2412 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
2413 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.])
2418 dnl The generic feature tests that determine how to compute ncpus are long and
2419 dnl complicated. Therefore, simply define special cpp variables for the
2420 dnl platforms we have special knowledge of.
2423 export MOZ_NO_DEBUG_RTL=1
2427 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
2429 dnl ========================================================
2430 dnl = Enable using the clang plugin to build
2431 dnl ========================================================
2433 if test -n "$COMPILE_ENVIRONMENT"; then
2434 MOZ_CONFIG_CLANG_PLUGIN
2435 fi # COMPILE_ENVIRONMENT
2437 dnl ========================================================
2438 dnl = Enable stripping of libs & executables
2439 dnl ========================================================
2440 MOZ_ARG_ENABLE_BOOL(strip,
2441 [ --enable-strip Enable stripping of libs & executables ],
2445 dnl ========================================================
2446 dnl = Enable stripping of libs & executables when packaging
2447 dnl ========================================================
2448 MOZ_ARG_ENABLE_BOOL(install-strip,
2449 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
2453 dnl ========================================================
2454 dnl = frontend JS debug mode
2455 dnl ========================================================
2457 MOZ_ARG_ENABLE_BOOL(debug-js-modules,
2458 [ --enable-debug-js-modules Enable debug mode for frontend JS libraries],
2462 AC_SUBST(DEBUG_JS_MODULES)
2464 dnl ========================================================
2466 dnl = Profiling and Instrumenting
2468 dnl ========================================================
2469 MOZ_ARG_HEADER(Profiling and Instrumenting)
2471 dnl ========================================================
2472 dnl = Offer a way to disable the startup cache
2473 dnl ========================================================
2475 MOZ_ARG_DISABLE_BOOL(startupcache,
2476 [ --disable-startupcache Disable startup cache ],
2477 MOZ_DISABLE_STARTUPCACHE=1,
2478 MOZ_DISABLE_STARTUPCACHE=)
2480 if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
2481 AC_DEFINE(MOZ_DISABLE_STARTUPCACHE)
2483 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
2485 dnl ========================================================
2486 dnl = Support for demangling undefined symbols
2487 dnl ========================================================
2488 if test -z "$SKIP_LIBRARY_CHECKS"; then
2491 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
2495 # Demangle only for debug or DMD builds
2496 MOZ_DEMANGLE_SYMBOLS=
2497 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
2498 MOZ_DEMANGLE_SYMBOLS=1
2499 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
2501 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
2503 dnl ========================================================
2504 dnl = Support for gcc stack unwinding (from gcc 3.3)
2505 dnl ========================================================
2506 if test -z "$SKIP_LIBRARY_CHECKS"; then
2509 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
2513 dnl ========================================================
2515 dnl ========================================================
2517 MOZ_ARG_WITH_STRING(jitreport-granularity,
2518 [ --jitreport-granularity=N
2519 Default granularity at which to report JIT code
2522 1 - code ranges for whole functions only
2523 2 - per-line information
2524 3 - per-op information],
2525 JITREPORT_GRANULARITY=$withval,
2526 JITREPORT_GRANULARITY=3)
2528 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
2530 dnl ========================================================
2534 dnl ========================================================
2535 MOZ_ARG_HEADER(Misc. Options)
2537 dnl ========================================================
2538 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
2539 dnl ========================================================
2540 MOZ_ARG_WITH_STRING(user-appdir,
2541 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
2542 [ val=`echo $withval`
2543 if echo "$val" | grep "\/" >/dev/null; then
2544 AC_MSG_ERROR("Homedir must be single relative path.")
2549 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
2551 if test -z "$SKIP_COMPILER_CHECKS"; then
2552 dnl ========================================================
2554 dnl = Compiler Options
2556 dnl ========================================================
2557 MOZ_ARG_HEADER(Compiler Options)
2559 dnl ========================================================
2560 dnl Check for gcc -pipe support
2561 dnl ========================================================
2562 AC_MSG_CHECKING([for -pipe support])
2563 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
2564 dnl Any gcc that supports firefox supports -pipe.
2565 CFLAGS="$CFLAGS -pipe"
2566 CXXFLAGS="$CXXFLAGS -pipe"
2567 AC_MSG_RESULT([yes])
2572 fi # ! SKIP_COMPILER_CHECKS
2574 AC_DEFINE(CPP_THROW_NEW, [throw()])
2577 if test "$COMPILE_ENVIRONMENT"; then
2579 fi # COMPILE_ENVIRONMENT
2581 dnl ========================================================
2583 dnl = Static Build Options
2585 dnl ========================================================
2586 MOZ_ARG_HEADER(Static build options)
2588 if test -z "$MOZ_SYSTEM_ZLIB"; then
2589 if test -n "$JS_SHARED_LIBRARY" -o -n "$MOZ_LINKER"; then
2591 AC_DEFINE(ZLIB_IN_MOZGLUE)
2595 AC_SUBST(ZLIB_IN_MOZGLUE)
2597 dnl ========================================================
2599 dnl = Standalone module options
2601 dnl ========================================================
2602 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
2605 dnl ========================================================
2607 if test -z "$SKIP_PATH_CHECKS"; then
2608 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
2609 if test "$MOZ_ENABLE_GTK" ; then
2610 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
2615 if test -z "${GLIB_GMODULE_LIBS}" \
2616 -a -n "${GLIB_CONFIG}"\
2617 -a "${GLIB_CONFIG}" != no\
2619 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
2622 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
2624 if test "$USE_FC_FREETYPE"; then
2625 if test "$COMPILE_ENVIRONMENT"; then
2626 dnl ========================================================
2627 dnl = Check for freetype2 functionality
2628 dnl ========================================================
2629 if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
2631 _SAVE_CFLAGS="$CFLAGS"
2632 LIBS="$LIBS $FT2_LIBS"
2633 CFLAGS="$CFLAGS $FT2_CFLAGS"
2635 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
2636 ac_cv_member_FT_Bitmap_Size_y_ppem,
2637 [AC_TRY_COMPILE([#include <ft2build.h>
2638 #include FT_FREETYPE_H],
2640 if (sizeof s.y_ppem) return 0;
2642 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
2643 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
2644 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
2645 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
2647 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
2649 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
2650 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
2651 [FT_Bitmap_Size structure includes y_ppem field])
2653 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
2656 CFLAGS="$_SAVE_CFLAGS"
2659 _SAVE_CPPFLAGS="$CPPFLAGS"
2660 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
2661 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
2662 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
2663 CPPFLAGS="$_SAVE_CPPFLAGS"
2667 dnl ========================================================
2668 dnl Check if we need the 32-bit Linux SSE2 error dialog
2669 dnl ========================================================
2671 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
2673 dnl ========================================================
2674 dnl Check for pixman and cairo
2675 dnl ========================================================
2678 MOZ_ARG_ENABLE_BOOL(system-cairo,
2679 [ --enable-system-cairo Obsolete: do not use this option],
2680 AC_MSG_ERROR(--enable-system-cairo is not supported),
2684 MOZ_ARG_ENABLE_BOOL(system-pixman,
2685 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
2687 MOZ_TREE_PIXMAN=force,
2690 if test "$MOZ_TREE_PIXMAN"; then
2691 AC_DEFINE(MOZ_TREE_PIXMAN)
2693 PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.19.2)
2696 MOZ_CAIRO_CFLAGS="-I${DIST}/include/cairo"
2697 AC_DEFINE(MOZ_TREE_CAIRO)
2699 if test "$OS_ARCH" = "WINNT"; then
2700 # For now we assume that we will have a uint64_t available through
2701 # one of the above headers or mozstdint.h.
2702 AC_DEFINE(HAVE_UINT64_T)
2705 # Define macros for cairo-features.h
2706 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
2707 if test "$MOZ_X11"; then
2708 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
2709 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
2710 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
2712 if test "$_HAVE_FREETYPE2"; then
2713 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2714 MOZ_ENABLE_CAIRO_FT=1
2715 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
2718 case "$MOZ_WIDGET_TOOLKIT" in
2720 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
2721 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
2722 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
2725 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
2726 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
2727 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
2729 if test "$COMPILE_ENVIRONMENT"; then
2730 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
2734 if test "$USE_FC_FREETYPE"; then
2735 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
2737 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
2738 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
2740 AC_SUBST(PS_SURFACE_FEATURE)
2741 AC_SUBST(SVG_SURFACE_FEATURE)
2742 AC_SUBST(XLIB_SURFACE_FEATURE)
2743 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
2744 AC_SUBST(QUARTZ_SURFACE_FEATURE)
2745 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
2746 AC_SUBST(WIN32_SURFACE_FEATURE)
2747 AC_SUBST(OS2_SURFACE_FEATURE)
2748 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
2749 AC_SUBST(FT_FONT_FEATURE)
2750 AC_SUBST(FC_FONT_FEATURE)
2751 AC_SUBST(WIN32_FONT_FEATURE)
2752 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
2753 AC_SUBST(QUARTZ_FONT_FEATURE)
2754 AC_SUBST(PNG_FUNCTIONS_FEATURE)
2755 AC_SUBST(QT_SURFACE_FEATURE)
2756 AC_SUBST(TEE_SURFACE_FEATURE)
2758 if test "$MOZ_X11"; then
2759 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
2762 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
2764 case "$MOZ_WIDGET_TOOLKIT" in
2766 TK_CFLAGS="$MOZ_CAIRO_CFLAGS $MOZ_PIXMAN_CFLAGS"
2767 TK_LIBS="$MOZ_CAIRO_LIBS $MOZ_PIXMAN_LIBS"
2771 AC_SUBST(MOZ_TREE_CAIRO)
2772 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
2773 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
2774 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
2775 AC_SUBST(MOZ_TREE_PIXMAN)
2777 BINDGEN_SYSTEM_FLAGS="$_BINDGEN_CFLAGS $NSPR_CFLAGS $NSS_CFLAGS $MOZ_PIXMAN_CFLAGS $MOZ_CAIRO_CFLAGS"
2778 AC_SUBST(BINDGEN_SYSTEM_FLAGS)
2779 BINDGEN_SYSTEM_TOML_FLAGS="$BINDGEN_SYSTEM_FLAGS"
2780 AC_SUBST_TOML_LIST(BINDGEN_SYSTEM_TOML_FLAGS)
2782 dnl ========================================================
2784 dnl ========================================================
2785 MOZ_ARG_DISABLE_BOOL(xul,
2786 [ --disable-xul Disable XUL],
2788 if test "$MOZ_XUL"; then
2791 dnl remove extensions that require XUL
2792 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
2797 dnl ========================================================
2798 dnl necko configuration options
2799 dnl ========================================================
2802 dnl option to disable necko's wifi scanner
2805 if test "$MOZ_WIDGET_TOOLKIT"; then
2807 case "$OS_TARGET" in
2809 if test -z "$MOZ_IOS"; then
2813 DragonFly|FreeBSD|WINNT)
2824 MOZ_ARG_DISABLE_BOOL(necko-wifi,
2825 [ --disable-necko-wifi Disable necko wifi scanner],
2829 if test "$NECKO_WIFI"; then
2830 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
2831 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
2833 AC_DEFINE(NECKO_WIFI)
2834 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
2836 AC_SUBST(NECKO_WIFI)
2837 AC_SUBST(NECKO_WIFI_DBUS)
2840 dnl option to disable cookies
2842 MOZ_ARG_DISABLE_BOOL(cookies,
2843 [ --disable-cookies Disable cookie support],
2846 AC_SUBST(NECKO_COOKIES)
2847 if test "$NECKO_COOKIES"; then
2848 AC_DEFINE(NECKO_COOKIES)
2849 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
2852 dnl ========================================================
2854 dnl = Maintainer debug option (no --enable equivalent)
2856 dnl ========================================================
2859 AC_SUBST_LIST(ASFLAGS)
2863 AC_SUBST(MOZ_AUTH_EXTENSION)
2864 AC_SUBST(MOZ_PREF_EXTENSIONS)
2865 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
2866 AC_SUBST(WARNINGS_AS_ERRORS)
2867 AC_SUBST_LIST(WARNINGS_CFLAGS)
2868 AC_SUBST_SET(MOZ_EXTENSIONS)
2870 AC_SUBST(MOZ_UNIVERSALCHARDET)
2871 AC_SUBST(MOZ_SPELLCHECK)
2872 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
2873 AC_SUBST(MOZ_CRASHREPORTER)
2874 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
2875 AC_SUBST(MOZ_STUB_INSTALLER)
2876 AC_SUBST(MOZ_UPDATER)
2878 AC_SUBST(MOZ_ANDROID_APPLICATION_CLASS)
2879 AC_SUBST(MOZ_ANDROID_BROWSER_INTENT_CLASS)
2880 AC_SUBST(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
2881 AC_SUBST(ENABLE_STRIP)
2882 AC_SUBST(PKG_SKIP_STRIP)
2883 AC_SUBST(STRIP_FLAGS)
2884 AC_SUBST(INCREMENTAL_LINKER)
2886 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
2888 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
2889 AC_SUBST(MOZ_LINKER_EXTRACT)
2891 if test -n "$MOZ_BINARY_EXTENSIONS"; then
2892 AC_DEFINE(MOZ_BINARY_EXTENSIONS)
2895 AC_SUBST(MOZ_REQUIRE_SIGNING)
2896 if test "$MOZ_REQUIRE_SIGNING" = 1; then
2897 AC_DEFINE(MOZ_REQUIRE_SIGNING)
2900 dnl ========================================================
2901 dnl = Mac bundle name prefix
2902 dnl ========================================================
2903 MOZ_ARG_WITH_STRING(macbundlename-prefix,
2904 [ --with-macbundlename-prefix=prefix
2905 Prefix for MOZ_MACBUNDLE_NAME],
2906 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
2908 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
2909 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
2910 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
2913 if test "$MOZ_DEBUG"; then
2914 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
2916 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
2918 AC_SUBST(MOZ_MACBUNDLE_NAME)
2920 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
2921 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
2922 # Otherwise, use MOZ_APP_DISPLAYNAME
2923 if test -z "$MOZ_MACBUNDLE_ID"; then
2924 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
2926 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
2927 if test "$MOZ_DEBUG"; then
2928 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
2931 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
2932 AC_SUBST(MOZ_MACBUNDLE_ID)
2934 dnl ========================================================
2935 dnl = Child Process Name for IPC
2936 dnl ========================================================
2937 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
2938 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
2940 # We want to let Android unpack the file at install time, but it only does
2941 # so if the file is named libsomething.so. The lib/ path is also required
2942 # because the unpacked file will be under the lib/ subdirectory and will
2943 # need to be executed from that path.
2944 MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
2946 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
2947 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
2949 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
2950 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
2951 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
2953 # The following variables are available to branding and application
2954 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
2955 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
2956 # impacts profile location and user-visible fields.
2957 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
2958 # versions of a given application (e.g. Aurora and Firefox both use
2959 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
2960 # for application.ini's "Name" field, which controls profile location in
2961 # the absence of a "Profile" field (see below), and various system
2962 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
2963 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
2964 # Mac Bundle name, Updater, Installer), it is typically used for nightly
2965 # builds (e.g. Aurora for Firefox).
2966 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
2967 # defaults to a lowercase form of MOZ_APP_BASENAME.
2968 # - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
2969 # profile name and remoting. If not set, defaults to MOZ_APP_NAME.
2970 # - MOZ_APP_PROFILE: When set, used for application.ini's
2971 # "Profile" field, which controls profile location.
2972 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
2973 # crash reporter server url.
2974 # - MOZ_APP_ANDROID_VERSION_CODE: On Android, "android:versionCode" for
2975 # the main application is set to the value of this variable. If not
2976 # set, it falls back to a Mozilla-specific value derived from the
2978 # - MOZ_ANDROID_SHARED_ID: On Android, "android:sharedUserId" for all Android
2979 # packages produced.
2980 # - MOZ_ANDROID_GCM_SENDERID: On Android, the Android GCM Sender ID used. GCM
2981 # sender IDs are not sensitive: see, http://stackoverflow.com/a/18216063.
2982 # - MOZ_MMA_GCM_SENDERID: This GCM Sender ID is used for MMA integration.
2983 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
2985 # The following environment variables used to have an effect, but don't anymore:
2986 # - MOZ_APP_VERSION: Defines the application version number. This was replaced with
2987 # the contents from the version.txt file in the application directory, or
2988 # browser/config/version.txt if there isn't one.
2989 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
2990 # in the "About" window. This was replaced with the contents from the
2991 # version_display.txt or version.txt in the application directory, or
2992 # browser/config/version_display.txt.
2994 if test -z "$MOZ_APP_NAME"; then
2995 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
2998 if test -z "$MOZ_APP_REMOTINGNAME"; then
2999 MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
3002 if test -z "$ANDROID_PACKAGE_NAME" ; then
3003 # When we got rid of the Aurora channel we decided to replace the old
3004 # Nightly ANDROID_PACKAGE_NAME with Aurora. To make sure this is inherited
3005 # by all mozilla-central based branches we make this the new "default"
3006 # for Fennec. Non mozilla-central based branches set ANDROID_PACKAGE_NAME
3007 # in their mozconfig, so they will never get this. If there are ever
3008 # non-Fennec builds for Android, they will fall into the else block
3009 # and use their own default name.
3010 # https://bugzilla.mozilla.org/show_bug.cgi?id=1357808 has additional
3011 # background on this.
3012 if test "$MOZ_APP_NAME" = "fennec"; then
3013 ANDROID_PACKAGE_NAME="org.mozilla.fennec_aurora"
3015 ANDROID_PACKAGE_NAME="org.mozilla.$MOZ_APP_NAME"
3019 # Mozilla released Firefox for Android {Release,Beta} and {Aurora,Nightly} to
3020 # the public with specific common shared IDs and we need to keep them
3021 # consistent forever. The specific common values are set by per-channel
3022 # branding; all other channels use a generic sharedID, set below.
3023 if test -z "$MOZ_ANDROID_SHARED_ID" ; then
3024 MOZ_ANDROID_SHARED_ID="${ANDROID_PACKAGE_NAME}.sharedID"
3027 # For extensions and langpacks, we require a max version that is compatible
3028 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
3029 # 24.0a1 and 24.0a2 aren't affected
3031 # 24.1.1 becomes 24.*
3032 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
3033 if test -z "$IS_ALPHA"; then
3035 if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
3036 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
3038 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
3042 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
3045 AC_SUBST(MOZ_APP_NAME)
3046 AC_SUBST(MOZ_APP_REMOTINGNAME)
3047 AC_SUBST(MOZ_APP_DISPLAYNAME)
3048 AC_SUBST(MOZ_APP_BASENAME)
3049 AC_SUBST(MOZ_APP_VENDOR)
3050 AC_SUBST(MOZ_APP_PROFILE)
3051 AC_SUBST(MOZ_APP_ID)
3052 AC_SUBST(MOZ_APP_ANDROID_VERSION_CODE)
3053 AC_SUBST(MOZ_ANDROID_SHARED_ID)
3054 AC_SUBST(MOZ_ANDROID_GCM_SENDERID)
3055 AC_SUBST(MOZ_MMA_GCM_SENDERID)
3056 AC_SUBST(MAR_CHANNEL_ID)
3057 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
3058 AC_SUBST(MOZ_PROFILE_MIGRATOR)
3059 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
3060 AC_SUBST(MOZ_APP_UA_NAME)
3061 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
3062 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
3063 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
3065 AC_SUBST(MOZ_APP_MAXVERSION)
3066 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
3067 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
3068 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
3071 AC_SUBST(MOZ_PKG_SPECIAL)
3072 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
3074 if test "$MOZILLA_OFFICIAL"; then
3075 # Build revisions should always be present in official builds
3076 MOZ_INCLUDE_SOURCE_INFO=1
3079 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
3080 # explicitly set the repository and changeset information in.
3081 AC_SUBST(MOZ_SOURCE_REPO)
3082 AC_SUBST(MOZ_SOURCE_CHANGESET)
3083 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
3085 dnl If we have any service that uploads data (and requires data submission
3086 dnl policy alert), set MOZ_DATA_REPORTING.
3087 dnl We need SUBST for build system and DEFINE for xul preprocessor.
3088 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
3089 MOZ_DATA_REPORTING=1
3090 AC_DEFINE(MOZ_DATA_REPORTING)
3091 AC_SUBST(MOZ_DATA_REPORTING)
3095 AC_SUBST(WIN32_REDIST_DIR)
3096 AC_SUBST(WIN_UCRT_REDIST_DIR)
3098 dnl ========================================================
3100 dnl ========================================================
3104 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
3110 dnl Echo the CFLAGS to remove extra whitespace.
3112 $_COMPILATION_CFLAGS \
3116 $_WARNINGS_CXXFLAGS \
3117 $_COMPILATION_CXXFLAGS \
3120 COMPILE_CFLAGS=`echo \
3124 COMPILE_CXXFLAGS=`echo \
3125 $_DEFINES_CXXFLAGS \
3129 $_WARNINGS_HOST_CFLAGS \
3130 $_COMPILATION_HOST_CFLAGS \
3133 HOST_CXXFLAGS=`echo \
3134 $_WARNINGS_HOST_CXXFLAGS \
3135 $_COMPILATION_HOST_CXXFLAGS \
3138 AC_SUBST(MOZ_SYSTEM_PNG)
3140 AC_SUBST_LIST(MOZ_PNG_CFLAGS)
3141 AC_SUBST_LIST(MOZ_PNG_LIBS)
3143 AC_SUBST(MOZ_SYSTEM_NSPR)
3145 AC_SUBST(MOZ_SYSTEM_NSS)
3147 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
3148 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
3149 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
3150 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
3151 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
3152 OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
3153 OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
3155 AC_SUBST(HOST_CMFLAGS)
3156 AC_SUBST(HOST_CMMFLAGS)
3157 AC_SUBST(OS_COMPILE_CMFLAGS)
3158 AC_SUBST(OS_COMPILE_CMMFLAGS)
3161 OS_CXXFLAGS="$CXXFLAGS"
3162 OS_CPPFLAGS="$CPPFLAGS"
3163 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
3164 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
3165 OS_LDFLAGS="$LDFLAGS"
3167 AC_SUBST_LIST(OS_CFLAGS)
3168 AC_SUBST_LIST(OS_CXXFLAGS)
3169 AC_SUBST_LIST(OS_CPPFLAGS)
3170 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
3171 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
3172 AC_SUBST_LIST(OS_LDFLAGS)
3177 AC_SUBST_LIST(HOST_CFLAGS)
3178 AC_SUBST_LIST(HOST_CPPFLAGS)
3179 AC_SUBST_LIST(HOST_CXXFLAGS)
3180 AC_SUBST(HOST_LDFLAGS)
3181 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
3182 AC_SUBST(HOST_BIN_SUFFIX)
3184 AC_SUBST(TARGET_XPCOM_ABI)
3185 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
3186 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
3187 AC_SUBST(HAVE_X86_AVX2)
3188 AC_SUBST(HAVE_ALTIVEC)
3190 AC_SUBST_LIST(DSO_CFLAGS)
3191 AC_SUBST_LIST(DSO_PIC_CFLAGS)
3192 AC_SUBST(DSO_LDOPTS)
3193 AC_SUBST(BIN_SUFFIX)
3195 AC_SUBST(NS_ENABLE_TSF)
3196 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
3197 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
3199 AC_SUBST(MOZ_DEVTOOLS)
3201 AC_SUBST(MOZ_PACKAGE_JSSHELL)
3202 AC_SUBST(MOZ_FOLD_LIBS)
3203 AC_SUBST_LIST(MOZ_FOLD_LIBS_FLAGS)
3207 dnl Host JavaScript runtime, if any, to use during cross compiles.
3210 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
3212 if test -n "$COMPILE_ENVIRONMENT"; then
3213 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
3215 dnl Check for missing components
3216 if test "$MOZ_X11"; then
3217 dnl ====================================================
3218 dnl = Check if X headers exist
3219 dnl ====================================================
3220 _SAVE_CFLAGS=$CFLAGS
3221 CFLAGS="$CFLAGS $XCFLAGS"
3225 #include <X11/Xlib.h>
3226 #include <X11/Intrinsic.h>
3227 #include <X11/extensions/XShm.h>
3231 if ((dpy = XOpenDisplay(NULL)) == NULL) {
3232 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
3236 [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
3237 CFLAGS="$_SAVE_CFLAGS"
3239 if test -n "$MISSING_X"; then
3240 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
3245 fi # COMPILE_ENVIRONMENT
3247 dnl Set various defines and substitutions
3248 dnl ========================================================
3250 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
3251 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
3252 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
3253 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
3254 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
3255 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
3256 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
3257 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
3258 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
3261 AC_SUBST(MOZ_DEV_EDITION)
3262 if test -n "$MOZ_DEV_EDITION"; then
3263 AC_DEFINE(MOZ_DEV_EDITION)
3266 if test "$MOZ_DEBUG" -o "$DEVELOPER_OPTIONS"; then
3270 if test -n "$A11Y_LOG"; then
3274 dnl Spit out some output
3275 dnl ========================================================
3277 dnl The following defines are used by xpcom
3278 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
3291 # Avoid using obsolete NSPR features
3292 AC_DEFINE(NO_NSPR_10_SUPPORT)
3294 MOZ_CREATE_CONFIG_STATUS()
3296 rm -fr confdefs* $ac_clean_files