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 ========================================================
50 dnl Set the minimum version of toolkit libs used by mozilla
51 dnl ========================================================
53 GLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_42
54 GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_42
58 GDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_14
62 dnl Set various checks
63 dnl ========================================================
66 dnl Initialize the Pthread test variables early so they can be
67 dnl overridden by each platform.
68 dnl ========================================================
72 LDFLAGS="$LDFLAGS $LINKER_LDFLAGS"
74 if test "$COMPILE_ENVIRONMENT"; then
76 fi # COMPILE_ENVIRONMENT
79 *-android*|*-linuxandroid*)
82 AC_PATH_PROG(OBJCOPY,objcopy)
86 AC_SUBST(ANDROID_PACKAGE_NAME)
89 dnl ========================================================
90 dnl Checks for compilers.
91 dnl ========================================================
93 if test "$COMPILE_ENVIRONMENT"; then
95 if test "$target" != "$host"; then
101 # Work around the conftest.exe access problem on Windows
106 MOZ_PATH_PROGS(AS, $AS as, $CC)
107 AC_CHECK_PROGS(STRIP, strip, :)
108 AC_CHECK_PROGS(OTOOL, otool, :)
111 if test -n "$MOZ_WINCONSOLE"; then
112 AC_DEFINE(MOZ_WINCONSOLE)
117 dnl ========================================================
118 dnl Special win32 checks
119 dnl ========================================================
125 if test "$GCC" != "yes"; then
126 # Check to see if we are really running in a msvc environemnt
129 # Make sure compilers are valid
130 CXXFLAGS="$CXXFLAGS -TP"
133 AC_TRY_COMPILE([#include <stdio.h>],
134 [ printf("Hello World\n"); ],,
135 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
138 AC_TRY_COMPILE([#include <new.h>],
139 [ unsigned *test = new unsigned(42); ],,
140 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
144 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
147 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
148 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
149 AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
152 MSVC_C_RUNTIME_DLL=vcruntime140.dll
153 MSVC_CXX_RUNTIME_DLL=msvcp140.dll
155 # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
156 CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
158 if test -n "$WIN_UCRT_REDIST_DIR"; then
159 if test ! -d "$WIN_UCRT_REDIST_DIR"; then
160 AC_MSG_ERROR([Invalid Windows UCRT Redist directory: ${WIN_UCRT_REDIST_DIR}])
162 WIN_UCRT_REDIST_DIR=`cd "$WIN_UCRT_REDIST_DIR" && (pwd -W 2>/dev/null || pwd)`
165 AC_SUBST(MSVC_C_RUNTIME_DLL)
166 AC_SUBST(MSVC_CXX_RUNTIME_DLL)
168 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
170 if test -n "$WIN32_REDIST_DIR"; then
171 if test ! -d "$WIN32_REDIST_DIR"; then
172 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
174 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && (pwd -W 2>/dev/null || pwd)`
177 # Check linker version, except in lld builds
182 _LD_FULL_VERSION=`"${LINKER}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
183 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
184 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
185 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
192 unset _MSVC_VER_FILTER
195 STL_FLAGS="-I${DIST}/stl_wrappers"
197 # Check w32api version
198 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
199 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
200 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
201 AC_TRY_COMPILE([#include <w32api.h>],
202 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
203 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
204 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
205 #error "test failed."
207 , [ res=yes ], [ res=no ])
208 AC_MSG_RESULT([$res])
209 if test "$res" != "yes"; then
210 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
212 # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
213 # causing problems with local implementations with the same name.
214 AC_DEFINE(STRSAFE_NO_DEPRECATE)
217 CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
218 CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
220 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
221 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
222 # Require OS features provided by IE 8.0 (Win7)
223 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0800)
228 if test -n "$_WIN32_MSVC"; then
230 SKIP_COMPILER_CHECKS=1
231 SKIP_LIBRARY_CHECKS=1
233 # Since we're skipping compiler and library checks, hard-code
236 AC_DEFINE(HAVE_ISATTY)
239 fi # COMPILE_ENVIRONMENT
244 AC_SUBST_LIST(STL_FLAGS)
245 AC_SUBST(WRAP_STL_INCLUDES)
247 dnl ========================================================
248 dnl Checks for programs.
249 dnl ========================================================
250 if test "$COMPILE_ENVIRONMENT"; then
256 fi # COMPILE_ENVIRONMENT
258 dnl ========================================================
259 dnl set the defaults first
260 dnl ========================================================
261 MOZ_USER_DIR=".mozilla"
263 MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
267 dnl Configure platform-specific CPU architecture compiler options.
268 dnl ==============================================================
269 if test "$COMPILE_ENVIRONMENT"; then
271 fi # COMPILE_ENVIRONMENT
273 dnl ========================================================
274 dnl Android libstdc++
275 dnl ========================================================
278 if test "$COMPILE_ENVIRONMENT"; then
280 fi # COMPILE_ENVIRONMENT
282 dnl ========================================================
283 dnl Suppress Clang Argument Warnings
284 dnl ========================================================
285 WARNINGS_CFLAGS="$_WARNINGS_CFLAGS"
286 if test -n "${CLANG_CC}${CLANG_CL}"; then
287 WARNINGS_CFLAGS="-Qunused-arguments $WARNINGS_CFLAGS"
288 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
290 if test -n "${CLANG_CXX}${CLANG_CL}"; then
291 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
294 if test -n "$COMPILE_ENVIRONMENT"; then
298 dnl ========================================================
299 dnl GNU specific defaults
300 dnl ========================================================
301 if test "$GNU_CC"; then
305 SSSE3_FLAGS="-mssse3"
306 CFLAGS="$CFLAGS -fno-strict-aliasing"
309 if test "$OS_ARCH" != "WINNT" -o -z "$CLANG_CC"; then
310 DSO_PIC_CFLAGS='-fPIC'
311 ASFLAGS="$ASFLAGS -fPIC"
314 AC_MSG_CHECKING([for --noexecstack option to as])
316 CFLAGS="$CFLAGS -Wa,--noexecstack"
317 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
318 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
321 AC_MSG_CHECKING([for -z noexecstack option to ld])
322 _SAVE_LDFLAGS=$LDFLAGS
323 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
324 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
326 LDFLAGS=$_SAVE_LDFLAGS)
328 AC_MSG_CHECKING([for -z text option to ld])
329 _SAVE_LDFLAGS=$LDFLAGS
330 LDFLAGS="$LDFLAGS -Wl,-z,text"
331 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
333 LDFLAGS=$_SAVE_LDFLAGS)
335 AC_MSG_CHECKING([for -z relro option to ld])
336 _SAVE_LDFLAGS=$LDFLAGS
337 LDFLAGS="$LDFLAGS -Wl,-z,relro"
338 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
340 LDFLAGS=$_SAVE_LDFLAGS)
342 AC_MSG_CHECKING([for -z nocopyreloc option to ld])
343 _SAVE_LDFLAGS=$LDFLAGS
344 LDFLAGS="$LDFLAGS -Wl,-z,nocopyreloc"
345 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
347 LDFLAGS=$_SAVE_LDFLAGS)
349 AC_MSG_CHECKING([for -Bsymbolic-functions option to ld])
350 _SAVE_LDFLAGS=$LDFLAGS
351 LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
352 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
354 LDFLAGS=$_SAVE_LDFLAGS)
356 AC_MSG_CHECKING([for --build-id=sha1 option to ld])
357 _SAVE_LDFLAGS=$LDFLAGS
358 LDFLAGS="$LDFLAGS -Wl,--build-id=sha1"
359 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
361 LDFLAGS=$_SAVE_LDFLAGS)
363 AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
364 HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
365 _SAVE_LDFLAGS=$LDFLAGS
366 LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
367 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
368 [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
370 LDFLAGS=$_SAVE_LDFLAGS
372 # Check for -mssse3 on $CC
373 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
374 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
376 CFLAGS="$CFLAGS -mssse3"
377 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
378 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
382 # Check for -msse4.1 on $CC
383 AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
384 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
386 CFLAGS="$CFLAGS -msse4.1"
387 AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
388 [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
392 case "${CPU_ARCH}" in
394 AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
396 [asm volatile ("vpermq \$0xd8,%ymm0,%ymm0 \n");],
397 result="yes", result="no")
398 AC_MSG_RESULT("$result")
399 if test "$result" = "yes"; then
405 AC_MSG_CHECKING([whether we can enable AltiVec support])
408 CFLAGS="$CFLAGS -maltivec"
409 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
417 if test "$GCC_USE_GNU_LD"; then
418 # Some tools like ASan use a runtime library that is only
419 # linked against executables, so we must allow undefined
420 # symbols for shared objects in some cases.
421 if test -z "$MOZ_ASAN$MOZ_MSAN$MOZ_UBSAN$MOZ_TSAN$FUZZING_INTERFACES"; then
422 # Don't allow undefined symbols in libraries
423 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
425 # BSDs need `environ' exposed for posix_spawn (bug 753046)
427 DragonFly|FreeBSD|NetBSD|OpenBSD)
428 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
429 DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
431 DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
438 _DEFINES_CFLAGS="-include $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
440 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
443 if test "$GNU_CXX"; then
444 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
446 _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
449 dnl ========================================================
451 dnl ========================================================
453 if test "$MOZ_DMD"; then
454 if test "${CPU_ARCH}" = "arm"; then
455 CFLAGS="$CFLAGS -funwind-tables"
456 CXXFLAGS="$CXXFLAGS -funwind-tables"
460 dnl ========================================================
461 dnl System overrides of the defaults for host
462 dnl ========================================================
465 if test -n "$_WIN32_MSVC"; then
466 HOST_CFLAGS="$HOST_CFLAGS"
468 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
470 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
471 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
474 case "${host_cpu}" in
476 if test -n "$_WIN32_MSVC"; then
477 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
481 if test -n "$_WIN32_MSVC"; then
482 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
484 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
490 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
491 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
494 *-linux*|*-kfreebsd*-gnu|*-gnu*)
495 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
496 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
500 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
501 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
505 dnl ========================================================
506 dnl System overrides of the defaults for target
507 dnl ========================================================
511 MOZ_OPTIMIZE_FLAGS="-O3"
512 CXXFLAGS="$CXXFLAGS -stdlib=libc++"
514 # The ExceptionHandling framework is needed for Objective-C exception
515 # logging code in nsObjCExceptions.h. Currently we only use that in debug
517 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
519 dnl DTrace and -dead_strip don't interact well. See bug 403132.
520 dnl ===================================================================
521 if test "x$enable_dtrace" = "xyes"; then
522 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
524 dnl check for the presence of the -dead_strip linker flag
525 AC_MSG_CHECKING([for -dead_strip option to ld])
526 _SAVE_LDFLAGS=$LDFLAGS
527 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
528 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
529 if test -n "$_HAVE_DEAD_STRIP" ; then
531 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
536 LDFLAGS=$_SAVE_LDFLAGS
539 MOZ_FIX_LINK_PATHS="-Wl,-executable_path,${DIST}/bin"
542 *-android*|*-linuxandroid*)
543 if test "$COMPILE_ENVIRONMENT" -a -n "$MOZ_MEMORY"; then
547 if test -z "$CLANG_CC"; then
548 MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
549 elif test -n "$RELEASE_OR_BETA"; then
550 # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
551 # -Oz is smaller than -Os on clang.
552 MOZ_OPTIMIZE_FLAGS="-Oz"
553 # Disable the outliner, which causes performance regressions, and is
554 # enabled on some platforms at -Oz.
555 if test -z "$MOZ_LTO"; then
556 DISABLE_OUTLINER="-mno-outline"
558 CFLAGS="$CFLAGS $DISABLE_OUTLINER"
559 AC_TRY_COMPILE(,,[MOZ_OPTIMIZE_FLAGS="$MOZ_OPTIMIZE_FLAGS $DISABLE_OUTLINER"])
560 CFLAGS="$_SAVE_CFLAGS"
562 DISABLE_OUTLINER="-Wl,-plugin-opt=-enable-machine-outliner=never"
563 _SAVE_LDFLAGS=$LDFLAGS
564 LDFLAGS="$LDFLAGS $MOZ_LTO_LDFLAGS $DISABLE_OUTLINER"
565 AC_TRY_LINK(,,[MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS $DISABLE_OUTLINER"])
566 LDFLAGS="$_SAVE_LDFLAGS"
569 MOZ_OPTIMIZE_FLAGS="-O2"
574 if test "$GNU_CC" -o "$GNU_CXX"; then
575 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
576 if test -n "$MOZ_DEBUG"; then
577 MOZ_OPTIMIZE_FLAGS="-Os"
579 MOZ_OPTIMIZE_FLAGS="-O2"
581 if test -z "$CLANG_CC"; then
582 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
586 case "${target_cpu}" in
588 CFLAGS="$CFLAGS -mieee"
589 CXXFLAGS="$CXXFLAGS -mieee"
596 # certain versions of cygwin's makedepend barf on the
597 # #include <string> vs -I./dist/include/string issue so don't use it
598 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
599 # $GNU_CC will match gcc and clang; while $CLANG_CC will match only clang
600 if test -z "$CLANG_CC"; then
601 AC_MSG_ERROR(Firefox cannot be built with mingw-gcc and requires a mingw-clang toolchain to work)
605 # Use temp file for windres (bug 213281)
606 RCFLAGS='-O coff --use-temp-file'
607 # mingw doesn't require kernel32, user32, and advapi32 explicitly
608 LIBS="$LIBS -luuid -lusp10 -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
611 MOZ_OPTIMIZE_FLAGS="-O2"
613 WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
614 WIN32_GUI_EXE_LDFLAGS=-mwindows
616 # Silence problematic clang warnings
617 CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
618 LDFLAGS="$LDFLAGS -Wl,--no-insert-timestamp"
620 TARGET_COMPILER_ABI=msvc
621 RANLIB='echo not_ranlib'
622 STRIP='echo not_strip'
623 # aarch64 doesn't support subsystems below 6.02
624 if test "$CPU_ARCH" = "aarch64"; then
625 WIN32_SUBSYSTEM_VERSION=6.02
627 WIN32_SUBSYSTEM_VERSION=6.01
629 WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
630 WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
631 DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
632 _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
633 _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
634 CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
635 CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
636 if test -z "$CLANG_CL"; then
637 CPPFLAGS="$CPPFLAGS -utf-8"
639 if test "$CPU_ARCH" = "x86"; then
640 dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
641 dnl more recent, so set that explicitly here unless another
642 dnl target arch has already been set.
644 if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
645 CFLAGS="$CFLAGS -arch:SSE2"
647 if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
648 CXXFLAGS="$CXXFLAGS -arch:SSE2"
651 SSE_FLAGS="-arch:SSE"
652 SSE2_FLAGS="-arch:SSE2"
653 dnl MSVC allows the use of intrinsics without any flags
654 dnl and doesn't have a separate arch for SSSE3
655 SSSE3_FLAGS="-arch:SSE2"
657 dnl clang-cl requires appropriate flags to enable SSSE3 support
658 dnl on all architectures.
659 if test -n "$CLANG_CL"; then
660 SSSE3_FLAGS="-mssse3"
662 dnl VS2013+ supports -Gw for better linker optimizations.
663 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
664 dnl Disabled on ASan because it causes false-positive ODR violations.
665 if test -z "$MOZ_ASAN"; then
667 CXXFLAGS="$CXXFLAGS -Gw"
669 # String tail merging doesn't play nice with ASan's ODR checker.
670 LDFLAGS="$LDFLAGS -opt:nolldtailmerge"
672 if test -n "$CLANG_CL"; then
673 # XXX We should combine some of these with our generic GCC-style
676 # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
677 CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
678 # We use offsetof on non-POD objects all the time.
679 # We also suppress this warning on other platforms.
680 CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
681 # This warns for reasonable things like:
682 # enum { X = 0xffffffffU };
683 # which is annoying for IDL headers.
684 CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
685 # This warns for cases that would be reached by the Microsoft
686 # #include rules, but also currently warns on cases that would
687 # *also* be reached by standard C++ include rules. That
688 # behavior doesn't seem useful, so we turn it off.
689 CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
690 # We normally error out on unknown pragmas, but since clang-cl
691 # claims to be MSVC, it would be difficult to add
692 # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
693 # use such pragmas, so just ignore them.
694 CFLAGS="$CFLAGS -Wno-unknown-pragmas"
695 CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
696 # We get errors about various #pragma intrinsic directives from
697 # clang-cl, and we don't need to hear about those.
698 CFLAGS="$CFLAGS -Wno-ignored-pragmas"
699 CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
700 # clang-cl's Intrin.h marks things like _ReadWriteBarrier
701 # as __attribute((__deprecated__)). This is nice to know,
702 # but since we don't get the equivalent warning from MSVC,
703 # let's just ignore it.
704 CFLAGS="$CFLAGS -Wno-deprecated-declarations"
705 CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
706 # We use a function like:
707 # __declspec(noreturn) __inline void f() {}
708 # which -Winvalid-noreturn complains about. Again, MSVC seems
709 # OK with it, so let's silence the warning.
710 CFLAGS="$CFLAGS -Wno-invalid-noreturn"
711 CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
712 # Missing |override| on virtual function declarations isn't
713 # something that MSVC currently warns about.
714 CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
715 # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
716 # declaration on |operator delete(void*)|. However, clang-cl
717 # must internally declare |operator delete(void*)| differently,
718 # which causes this warning for virtually every file in the
719 # tree. clang-cl doesn't support -fno-exceptions or equivalent,
720 # so there doesn't seem to be any way to convince clang-cl to
721 # declare |delete| differently. Therefore, suppress this
723 CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
724 # Macros like STDMETHOD() and IFACEMETHOD() can declare
725 # __attribute__((nothrow)) on their respective method declarations,
726 # while the definitions are left without the matching attribute.
727 CXXFLAGS="$CXXFLAGS -Wno-microsoft-exception-spec"
728 # At least one MSVC header and several headers in-tree have
729 # unused typedefs, so turn this on.
730 CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
731 # jemalloc uses __declspec(allocator) as a profiler hint,
732 # which clang-cl doesn't understand.
733 CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
734 # __attribute__((unused)) really means "might be unused" and
735 # we use it to avoid warnings about things that are unused
736 # in some compilation units, but used in many others. This
737 # warning insists on complaining about the latter case, which
738 # is annoying, and rather noisy.
739 CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused"
741 # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
742 CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
743 LIBS="$LIBS user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
744 MOZ_DEBUG_LDFLAGS='-DEBUG'
745 # Use a higher optimization level for clang-cl, so we can come closer
746 # to MSVC's performance numbers (see bug 1443590).
747 if test -n "$CLANG_CL"; then
748 MOZ_OPTIMIZE_FLAGS='-O2'
750 MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
753 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE"
754 if test -z "$DEVELOPER_OPTIONS"; then
755 LDFLAGS="$LDFLAGS -RELEASE"
758 dnl Minimum reqiurement of Gecko is VS2015 or later which supports
759 dnl both SSSE3 and SSE4.1.
760 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
761 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
762 dnl allow AVX2 code from VS2015
765 AC_DEFINE(WIN32_LEAN_AND_MEAN)
766 dnl See http://support.microsoft.com/kb/143208 to use STL
769 MOZ_USER_DIR="Mozilla"
773 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.])
779 if test -n "$GNU_CC"; then
780 CFLAGS="$CFLAGS -mstackrealign"
781 CXXFLAGS="$CXXFLAGS -mstackrealign"
782 LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
784 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
785 LDFLAGS="$LDFLAGS -SAFESEH"
791 if test -n "$_WIN32_MSVC"; then
792 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
797 if test -n "$_WIN32_MSVC"; then
798 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:ARM64"
803 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
810 CFLAGS="$CFLAGS -Dunix"
811 CXXFLAGS="$CXXFLAGS -Dunix"
812 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
813 DSO_PIC_CFLAGS='-fPIC -DPIC'
815 MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
817 DSO_PIC_CFLAGS='-fPIC -DPIC'
820 # This will fail on a.out systems prior to 1.5.1_ALPHA.
821 if test "$LIBRUNPATH"; then
822 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
827 if test -z "$X11BASE"; then
830 MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
832 DSO_PIC_CFLAGS='-fPIC'
833 DSO_LDOPTS='-shared -fPIC'
834 if test "$LIBRUNPATH"; then
835 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
840 MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
845 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
846 MOZ_OPTIMIZE_FLAGS="-O"
849 AC_SUBST_LIST(MMX_FLAGS)
850 AC_SUBST_LIST(SSE_FLAGS)
851 AC_SUBST_LIST(SSE2_FLAGS)
852 AC_SUBST_LIST(SSSE3_FLAGS)
855 if test -n "$MOZ_LINKER"; then
856 AC_DEFINE(MOZ_LINKER)
858 AC_CHECK_PROGS(XZ, xz)
861 if test -z "$COMPILE_ENVIRONMENT"; then
862 SKIP_COMPILER_CHECKS=1
863 SKIP_LIBRARY_CHECKS=1
867 fi # COMPILE_ENVIRONMENT
869 if test -z "$SKIP_COMPILER_CHECKS"; then
870 dnl Checks for typedefs, structures, and compiler characteristics.
871 dnl ========================================================
886 case "${OS_TARGET}" in
890 STL_FLAGS="-I${DIST}/stl_wrappers"
895 if test "$MOZ_BUILD_APP" = "tools/crashreporter"; then
899 dnl Checks for header files.
900 dnl ========================================================
903 bitrig*|dragonfly*|freebsd*|openbsd*)
904 # for stuff like -lXshm
905 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
909 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
910 AC_CACHE_CHECK(for sockaddr_in.sin_len,
911 ac_cv_sockaddr_in_sin_len,
912 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
913 #include <sys/types.h>
915 #include <netinet/in.h>
916 struct sockaddr_in x;
917 void *foo = (void*) &x.sin_len;],
919 [ac_cv_sockaddr_in_sin_len=true],
920 [ac_cv_sockaddr_in_sin_len=false])])
921 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
922 AC_DEFINE(HAVE_SIN_LEN)
923 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
924 AC_DEFINE(HAVE_SCONN_LEN)
927 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
928 ac_cv_sockaddr_in6_sin6_len,
929 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
930 #include <sys/types.h>
932 #include <netinet/in.h>
933 struct sockaddr_in6 x;
934 void *foo = (void*) &x.sin6_len;],
936 [ac_cv_sockaddr_in6_sin6_len=true],
937 [ac_cv_sockaddr_in6_sin6_len=false])])
938 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
939 AC_DEFINE(HAVE_SIN6_LEN)
942 AC_CACHE_CHECK(for sockaddr.sa_len,
943 ac_cv_sockaddr_sa_len,
944 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
945 #include <sys/types.h>
947 #include <sys/socket.h>
949 void *foo = (void*) &x.sa_len;],
951 [ac_cv_sockaddr_sa_len=true],
952 [ac_cv_sockaddr_sa_len=false])])
953 if test "$ac_cv_sockaddr_sa_len" = true ; then
954 AC_DEFINE(HAVE_SA_LEN)
957 dnl Checks for libraries.
958 dnl ========================================================
959 AC_CHECK_LIB(c_r, gethostbyname_r)
961 dnl We don't want to link with libdl even if it's present on OS X, since
962 dnl it's not used and not part of the default installation. OS/2 has dlfcn
964 dnl We don't want to link against libm or libpthread on Darwin since
965 dnl they both are just symlinks to libSystem and explicitly linking
966 dnl against libSystem causes issues when debugging (see bug 299601).
971 AC_SEARCH_LIBS(dlopen, dl,
972 MOZ_CHECK_HEADER(dlfcn.h,
973 AC_DEFINE(HAVE_DLOPEN)))
977 _SAVE_CFLAGS="$CFLAGS"
978 CFLAGS="$CFLAGS -D_GNU_SOURCE"
979 AC_CHECK_FUNCS(dladdr memmem)
980 CFLAGS="$_SAVE_CFLAGS"
982 if test ! "$GNU_CXX"; then
983 AC_CHECK_LIB(C, demangle)
986 AC_CHECK_LIB(socket, socket)
989 XLIBS="$X_EXTRA_LIBS"
991 dnl ========================================================
992 dnl Checks for X libraries.
993 dnl Ordering is important.
994 dnl Xt is dependent upon SM as of X11R6
995 dnl ========================================================
996 if test -n "$MOZ_X11"; then
997 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
998 _SAVE_LDFLAGS="$LDFLAGS"
1000 LDFLAGS="$XLDFLAGS $LDFLAGS"
1001 AC_CHECK_LIB(X11, XDrawLines, [XLIBS="-lX11 $XLIBS"],
1002 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
1003 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
1004 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
1006 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
1007 unset ac_cv_lib_Xt_XtFree
1008 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
1009 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
1010 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
1011 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
1014 dnl ========================================================
1016 dnl ========================================================
1017 AC_CHECK_LIB(xcb, xcb_connect, [XLIBS="-lxcb $XLIBS"],
1018 [MISSING_X="$MISSING_X -lxcb"], $XLIBS)
1019 AC_CHECK_LIB(xcb-shm, xcb_shm_query_version, [XLIBS="-lxcb-shm $XLIBS"],
1020 [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS)
1021 AC_CHECK_LIB(X11-xcb, XGetXCBConnection, [XLIBS="-lX11-xcb $XLIBS"],
1022 [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS)
1024 LDFLAGS="$_SAVE_LDFLAGS"
1028 AC_SUBST_LIST(XCFLAGS)
1029 AC_SUBST_LIST(XLDFLAGS)
1030 AC_SUBST_LIST(XLIBS)
1031 AC_SUBST_LIST(XEXT_LIBS)
1032 AC_SUBST_LIST(XT_LIBS)
1034 dnl ========================================================
1035 dnl = pthread support
1036 dnl = Start by checking whether the system support pthreads
1037 dnl ========================================================
1038 case "$target_os" in
1043 AC_CHECK_LIB(pthreads, pthread_create,
1044 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
1045 AC_CHECK_LIB(pthread, pthread_create,
1046 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
1047 AC_CHECK_LIB(c_r, pthread_create,
1048 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
1049 AC_CHECK_LIB(c, pthread_create,
1058 dnl ========================================================
1059 dnl Do the platform specific pthread hackery
1060 dnl ========================================================
1061 if test "$MOZ_USE_PTHREADS"x != x
1064 dnl See if -pthread is supported.
1067 ac_cv_have_dash_pthread=no
1068 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
1069 echo 'int main() { return 0; }' | cat > conftest.c
1070 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
1071 if test $? -eq 0; then
1072 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1073 ac_cv_have_dash_pthread=yes
1074 case "$target_os" in
1076 # Freebsd doesn't use -pthread for compiles, it uses them for linking
1079 CFLAGS="$CFLAGS -pthread"
1080 CXXFLAGS="$CXXFLAGS -pthread"
1086 AC_MSG_RESULT($ac_cv_have_dash_pthread)
1089 dnl See if -pthreads is supported.
1091 ac_cv_have_dash_pthreads=no
1092 if test "$ac_cv_have_dash_pthread" = "no"; then
1093 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
1094 echo 'int main() { return 0; }' | cat > conftest.c
1095 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
1096 if test $? -eq 0; then
1097 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1098 ac_cv_have_dash_pthreads=yes
1099 CFLAGS="$CFLAGS -pthreads"
1100 CXXFLAGS="$CXXFLAGS -pthreads"
1104 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
1109 AC_DEFINE(_REENTRANT)
1110 AC_DEFINE(_THREAD_SAFE)
1111 dnl -pthread links in -lpthread, so don't specify it explicitly.
1112 if test "$ac_cv_have_dash_pthread" = "yes"; then
1113 _PTHREAD_LDFLAGS="-pthread"
1117 *-*-openbsd*|*-*-bsdi*)
1118 AC_DEFINE(_REENTRANT)
1119 AC_DEFINE(_THREAD_SAFE)
1120 dnl -pthread links in -lc_r, so don't specify it explicitly.
1121 if test "$ac_cv_have_dash_pthread" = "yes"; then
1122 _PTHREAD_LDFLAGS="-pthread"
1126 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
1127 AC_DEFINE(_REENTRANT)
1131 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
1132 AC_SUBST(MOZ_USE_PTHREADS)
1133 MOZ_CHECK_HEADERS(pthread.h)
1137 dnl Checks for library functions.
1138 dnl ========================================================
1139 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall)
1141 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1142 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1143 ac_cv_clock_monotonic,
1144 [for libs in "" -lrt; do
1146 _SAVE_CFLAGS="$CFLAGS"
1148 CFLAGS="$CFLAGS $DSO_PIC_CFLAGS"
1149 dnl clock_gettime is available on OSX since 10.12, so depending on MACOSX_DEPLOYMENT_TARGET,
1150 dnl we should or not be able to use it. To detect if we can, we need to make the
1151 dnl availability attribute strict, so that compilation fails when the target is < 10.12.
1152 AC_TRY_LINK([#define availability(os, ...) availability(os, strict, __VA_ARGS)
1154 [ struct timespec ts;
1155 clock_gettime(CLOCK_MONOTONIC, &ts); ],
1156 ac_cv_clock_monotonic=$libs
1158 CFLAGS="$_SAVE_CFLAGS"
1160 ac_cv_clock_monotonic=no)
1162 CFLAGS="$_SAVE_CFLAGS"
1164 if test "$ac_cv_clock_monotonic" != "no"; then
1165 HAVE_CLOCK_MONOTONIC=1
1166 REALTIME_LIBS=$ac_cv_clock_monotonic
1167 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1168 AC_SUBST(HAVE_CLOCK_MONOTONIC)
1169 AC_SUBST_LIST(REALTIME_LIBS)
1172 dnl Turn on warnings-as-errors to prevent implicit declaration of
1173 dnl pthread_cond_timedwait_monotonic_np, which can cause this test to
1174 dnl inadvertently pass even if the function does not really exist.
1175 _SAVE_CFLAGS="$CFLAGS"
1176 CFLAGS="$CFLAGS $WARNINGS_AS_ERRORS"
1177 AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
1178 ac_cv_pthread_cond_timedwait_monotonic_np,
1179 AC_TRY_LINK([#include <pthread.h>],
1180 [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
1181 ac_cv_pthread_cond_timewait_monotonic_np=yes,
1182 ac_cv_pthread_cond_timewait_monotonic_np=no))
1183 if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
1184 AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
1186 CFLAGS=$_SAVE_CFLAGS
1190 ac_cv_func_res_ninit,
1191 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
1192 dnl no need for res_ninit() on NetBSD and OpenBSD
1193 ac_cv_func_res_ninit=no
1197 #define _BSD_SOURCE 1
1199 #include <sys/types.h>
1200 #include <netinet/in.h>
1201 #include <arpa/nameser.h>
1204 [int foo = res_ninit(&_res);],
1205 [ac_cv_func_res_ninit=yes],
1206 [ac_cv_func_res_ninit=no])
1210 if test "$ac_cv_func_res_ninit" = "yes"; then
1211 AC_DEFINE(HAVE_RES_NINIT)
1212 dnl must add the link line we do something as foolish as this... dougt
1214 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
1215 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
1220 dnl **********************
1221 dnl *** va_copy checks ***
1222 AC_CACHE_CHECK([for an implementation of va_copy()],
1224 [AC_TRY_COMPILE([#include <stdarg.h>
1226 void f (int i, ...) {
1227 va_list args1, args2;
1228 va_start (args1, i);
1229 va_copy (args2, args1);
1230 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1232 va_end (args1); va_end (args2);
1234 [f(0, 42); return 0],
1235 [ac_cv_va_copy=yes],
1239 AC_CACHE_CHECK([whether va_list can be copied by value],
1241 [AC_TRY_COMPILE([#include <stdarg.h>
1243 void f (int i, ...) {
1244 va_list args1, args2;
1245 va_start (args1, i);
1247 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1249 va_end (args1); va_end (args2);
1251 [f(0, 42); return 0],
1252 [ac_cv_va_val_copy=yes],
1253 [ac_cv_va_val_copy=no],
1256 if test "x$ac_cv_va_copy" = "xyes"; then
1257 AC_DEFINE(VA_COPY, va_copy)
1258 AC_DEFINE(HAVE_VA_COPY)
1261 if test "x$ac_cv_va_val_copy" = "xno"; then
1262 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
1265 dnl ===================================================================
1266 dnl ========================================================
1267 dnl Put your C++ language/feature checks below
1268 dnl ========================================================
1272 if test "$GNU_CC"; then
1273 if test "$CPU_ARCH" = "arm" ; then
1274 AC_CACHE_CHECK(for ARM EABI,
1278 #if defined(__ARM_EABI__)
1281 #error Not ARM EABI.
1284 ac_cv_gcc_arm_eabi="yes",
1285 ac_cv_gcc_arm_eabi="no")])
1286 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
1288 ARM_ABI_PREFIX=eabi-
1290 ARM_ABI_PREFIX=oabi-
1294 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
1297 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
1298 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
1299 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
1301 _SAVE_LDFLAGS=$LDFLAGS
1302 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
1303 AC_CACHE_CHECK(for __thread keyword for TLS variables,
1304 ac_cv_thread_keyword,
1305 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
1306 [return tlsIsMainThread;],
1307 ac_cv_thread_keyword=yes,
1308 ac_cv_thread_keyword=no)])
1309 LDFLAGS=$_SAVE_LDFLAGS
1310 # The custom dynamic linker doesn't support TLS variables
1312 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
1313 # mips builds fail with TLS variables because of a binutils bug.
1315 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
1320 *-android*|*-linuxandroid*)
1327 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
1333 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
1334 if test -n "$MOZ_LINKER"; then
1335 if test "$CPU_ARCH" = arm; then
1336 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
1337 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
1338 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1339 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1343 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
1344 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
1345 dnl Since the linker only understands the sysv ones, no need to build the
1346 dnl gnu style tables anyways.
1347 LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
1350 dnl End of C++ language/feature checks
1353 dnl ========================================================
1354 dnl = Internationalization checks
1355 dnl ========================================================
1357 dnl Internationalization and Locale support is different
1358 dnl on various UNIX platforms. Checks for specific i18n
1359 dnl features go here.
1361 AC_HAVE_FUNCS(localeconv)
1363 fi # ! SKIP_COMPILER_CHECKS
1365 if test -n "${COMPILE_ENVIRONMENT}"; then
1370 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1371 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1372 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1375 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1376 dnl features that Windows actually does support.
1378 if test -n "$SKIP_COMPILER_CHECKS"; then
1379 dnl Windows has malloc.h
1380 AC_DEFINE(MALLOC_H, [<malloc.h>])
1381 AC_DEFINE(HAVE_FORCEINLINE)
1382 AC_DEFINE(HAVE_LOCALECONV)
1383 fi # SKIP_COMPILER_CHECKS
1385 dnl Mozilla specific options
1386 dnl ========================================================
1387 dnl The macros used for command line options
1388 dnl are defined in build/autoconf/altoptions.m4.
1390 dnl ========================================================
1392 dnl = Check for external package dependencies
1394 dnl ========================================================
1395 MOZ_ARG_HEADER(External Packages)
1397 dnl ========================================================
1398 dnl system libevent Support
1399 dnl ========================================================
1400 MOZ_ARG_WITH_STRING(system-libevent,
1401 [ --with-system-libevent[=PFX]
1402 Use system libevent [installed at prefix PFX]],
1403 LIBEVENT_DIR=$withval)
1405 _SAVE_CFLAGS=$CFLAGS
1406 _SAVE_LDFLAGS=$LDFLAGS
1408 if test "$LIBEVENT_DIR" = yes; then
1409 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
1410 MOZ_SYSTEM_LIBEVENT=1,
1413 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
1414 MOZ_SYSTEM_LIBEVENT=
1415 elif test -z "$MOZ_SYSTEM_LIBEVENT"; then
1416 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
1417 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
1418 MOZ_CHECK_HEADER(event.h,
1419 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
1420 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
1422 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
1423 AC_CHECK_LIB(event, event_init,
1424 [MOZ_SYSTEM_LIBEVENT=1
1425 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
1426 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
1427 [MOZ_SYSTEM_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
1429 CFLAGS=$_SAVE_CFLAGS
1430 LDFLAGS=$_SAVE_LDFLAGS
1433 AC_SUBST(MOZ_SYSTEM_LIBEVENT)
1435 if test -z "$SKIP_LIBRARY_CHECKS"; then
1437 dnl ========================================================
1438 dnl system PNG Support
1439 dnl ========================================================
1440 MOZ_ARG_WITH_STRING(system-png,
1441 [ --with-system-png[=PFX]
1442 Use system libpng [installed at prefix PFX]],
1445 _SAVE_CFLAGS=$CFLAGS
1446 _SAVE_LDFLAGS=$LDFLAGS
1448 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
1449 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
1450 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
1452 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
1455 AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"],
1456 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1457 AC_CHECK_LIB(png, png_get_acTL, ,
1458 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
1460 if test "$MOZ_SYSTEM_PNG" = 1; then
1461 AC_TRY_COMPILE([ #include <stdio.h>
1462 #include <sys/types.h>
1464 [ #if PNG_LIBPNG_VER < $MOZPNG
1465 #error "Insufficient libpng version ($MOZPNG required)."
1467 #ifndef PNG_UINT_31_MAX
1468 #error "Insufficient libpng version."
1471 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1473 CFLAGS=$_SAVE_CFLAGS
1474 LDFLAGS=$_SAVE_LDFLAGS
1477 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then
1478 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
1479 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
1482 fi # SKIP_LIBRARY_CHECKS
1484 dnl ========================================================
1488 dnl ========================================================
1490 MOZ_ARG_HEADER(Application)
1492 ENABLE_SYSTEM_EXTENSION_DIRS=1
1493 MOZ_BRANDING_DIRECTORY=
1494 MOZ_OFFICIAL_BRANDING=
1495 MOZ_AUTH_EXTENSION=1
1497 MOZ_UNIVERSALCHARDET=1
1501 MOZ_USE_NATIVE_POPUP_WINDOWS=
1502 MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
1504 MOZ_BINARY_EXTENSIONS=
1507 case "$target_os" in
1510 AC_DEFINE(NS_ENABLE_TSF)
1514 # Optional Firefox for Android partner distribution directory.
1515 MOZ_ARG_WITH_STRING(android-distribution-directory,
1516 [ --with-android-distribution-directory=dir
1517 Optional Firefox for Android partner distribution directory.],
1518 MOZ_ANDROID_DISTRIBUTION_DIRECTORY=$withval)
1520 if test -n "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY"; then
1521 # A distribution directory must have an assets/distribution directory.
1522 # See https://wiki.mozilla.org/Mobile/Distribution_Files.
1523 if test ! -d "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY/assets/distribution" ; then
1524 AC_MSG_ERROR([--with-android-distribution-directory does not contain assets/distribution;
1525 (looked for ${MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets/distribution).])
1528 AC_SUBST(MOZ_ANDROID_DISTRIBUTION_DIRECTORY)
1530 dnl ========================================================
1531 dnl = Trademarked Branding
1532 dnl ========================================================
1533 MOZ_ARG_ENABLE_BOOL(official-branding,
1534 [ --enable-official-branding
1535 Enable Official mozilla.org Branding
1536 Do not distribute builds with
1537 --enable-official-branding unless you have
1538 permission to use trademarks per
1539 http://www.mozilla.org/foundation/trademarks/ .],
1540 MOZ_OFFICIAL_BRANDING=1,
1541 MOZ_OFFICIAL_BRANDING=)
1543 # Allow the application to influence configure with a confvars.sh script.
1544 AC_MSG_CHECKING([if app-specific confvars.sh exists])
1545 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
1546 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
1547 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
1552 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
1553 MOZ_ARG_WITH_STRING(app-name,
1554 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
1555 WITH_APP_NAME=$withval,
1558 if test -n "$WITH_APP_NAME" ; then
1559 MOZ_APP_NAME="$WITH_APP_NAME"
1562 MOZ_ARG_WITH_STRING(app-basename,
1563 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
1564 WITH_APP_BASENAME=$withval,
1567 if test -n "$WITH_APP_BASENAME" ; then
1568 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
1571 dnl ========================================================
1572 dnl Ensure Android SDK and build-tools versions depending on
1574 dnl ========================================================
1576 case "$MOZ_BUILD_APP" in
1582 dnl ========================================================
1584 dnl = Toolkit Options
1586 dnl ========================================================
1587 MOZ_ARG_HEADER(Toolkit Options)
1589 dnl ========================================================
1590 dnl = Enable the toolkit as needed =
1591 dnl ========================================================
1593 case "$MOZ_WIDGET_TOOLKIT" in
1596 LDFLAGS="$LDFLAGS -framework Cocoa"
1597 # Use -Wl as a trick to avoid -framework and framework names from
1598 # being separated by AC_SUBST_LIST.
1599 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'
1601 CFLAGS="$CFLAGS $TK_CFLAGS"
1602 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1603 MOZ_USER_DIR="Mozilla"
1604 MOZ_FS_LAYOUT=bundle
1608 LDFLAGS="$LDFLAGS -framework UIKit"
1610 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'
1611 CFLAGS="$CFLAGS $TK_CFLAGS"
1612 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1613 MOZ_USER_DIR="Mozilla"
1614 MOZ_FS_LAYOUT=bundle
1619 if test "$OS_TARGET" = Darwin; then
1620 LDFLAGS="$LDFLAGS -lobjc"
1623 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
1624 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
1625 case "$MOZ_WIDGET_TOOLKIT" in
1631 if test "$COMPILE_ENVIRONMENT"; then
1632 if test "$MOZ_WIDGET_TOOLKIT" = gtk; then
1633 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)
1634 MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
1635 TK_CFLAGS=$MOZ_GTK3_CFLAGS
1636 TK_LIBS=$MOZ_GTK3_LIBS
1637 dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
1638 dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
1639 AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
1641 if test "$MOZ_ENABLE_GTK"; then
1642 if test "$MOZ_X11"; then
1643 GDK_PACKAGES=gdk-x11-2.0
1645 AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
1646 AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
1648 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)
1649 MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
1651 fi # COMPILE_ENVIRONMENT
1653 AC_SUBST(MOZ_FS_LAYOUT)
1655 AC_SUBST_LIST(TK_CFLAGS)
1656 AC_SUBST_LIST(TK_LIBS)
1658 dnl ========================================================
1660 dnl = Components & Features
1662 dnl ========================================================
1663 MOZ_ARG_HEADER(Components and Features)
1665 AC_SUBST(MOZ_OFFICIAL_BRANDING)
1666 if test -n "$MOZ_OFFICIAL_BRANDING"; then
1667 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
1668 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
1670 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
1671 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
1675 MOZ_ARG_WITH_STRING(branding,
1676 [ --with-branding=dir Use branding from the specified directory.],
1677 MOZ_BRANDING_DIRECTORY=$withval)
1679 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
1680 if test -z "$REAL_BRANDING_DIRECTORY"; then
1681 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
1684 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1685 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
1686 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1687 . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
1690 AC_SUBST(MOZ_BRANDING_DIRECTORY)
1692 dnl ========================================================
1693 dnl = Distribution ID
1694 dnl ========================================================
1695 MOZ_ARG_WITH_STRING(distribution-id,
1696 [ --with-distribution-id=ID
1697 Set distribution-specific id (default=org.mozilla)],
1698 [ val=`echo $withval`
1699 MOZ_DISTRIBUTION_ID="$val"])
1701 if test -z "$MOZ_DISTRIBUTION_ID"; then
1702 MOZ_DISTRIBUTION_ID="org.mozilla"
1705 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
1706 AC_SUBST(MOZ_DISTRIBUTION_ID)
1708 dnl ========================================================
1709 dnl = libproxy support
1710 dnl ========================================================
1712 if test "$MOZ_ENABLE_GTK"
1714 MOZ_ENABLE_LIBPROXY=
1716 MOZ_ARG_ENABLE_BOOL(libproxy,
1717 [ --enable-libproxy Enable libproxy support ],
1718 MOZ_ENABLE_LIBPROXY=1,
1719 MOZ_ENABLE_LIBPROXY=)
1721 if test "$MOZ_ENABLE_LIBPROXY"
1723 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
1724 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
1727 AC_SUBST(MOZ_ENABLE_LIBPROXY)
1729 dnl ========================================================
1731 dnl ========================================================
1733 if test "$MOZ_ENABLE_GTK"
1737 MOZ_ARG_DISABLE_BOOL(dbus,
1738 [ --disable-dbus Disable dbus support ],
1742 if test "$MOZ_ENABLE_DBUS"
1744 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
1745 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
1746 AC_DEFINE(MOZ_ENABLE_DBUS)
1749 AC_SUBST(MOZ_ENABLE_DBUS)
1751 dnl =========================================================
1752 dnl = Whether to exclude hyphenations files in the build
1753 dnl =========================================================
1754 if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
1755 AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
1758 AC_TRY_COMPILE([#include <linux/ethtool.h>],
1759 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
1760 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
1762 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
1764 if test -n "$MOZ_WEBRTC"; then
1765 if test -n "$MOZ_X11"; then
1766 MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
1770 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
1772 dnl ========================================================
1773 dnl = Apple platform decoder support
1774 dnl ========================================================
1775 if test "$COMPILE_ENVIRONMENT"; then
1776 if test -n "$MOZ_APPLEMEDIA"; then
1777 # hack in frameworks for fmp4 - see bug 1029974
1778 # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
1779 LDFLAGS="$LDFLAGS -framework AudioToolbox"
1780 dnl Verify CoreMedia is available.
1781 AC_CHECK_HEADERS([CoreMedia/CoreMedia.h VideoToolbox/VideoToolbox.h], [],
1782 [AC_MSG_ERROR([MacOS X 10.9 SDK or later is required])])
1784 fi # COMPILE_ENVIRONMENT
1786 dnl ========================================================
1787 dnl = Handle dependent MEDIA defines
1788 dnl ========================================================
1791 AC_DEFINE(MOZ_WEBM_ENCODER)
1792 AC_SUBST(MOZ_WEBM_ENCODER)
1794 dnl ========================================================
1796 dnl ========================================================
1798 MOZ_ARG_DISABLE_BOOL(negotiateauth,
1799 [ --disable-negotiateauth Disable GSS-API negotiation ],
1800 MOZ_AUTH_EXTENSION=,
1801 MOZ_AUTH_EXTENSION=1 )
1803 dnl ========================================================
1804 dnl Searching of system directories for extensions.
1805 dnl Note: this switch is meant to be used for test builds
1806 dnl whose behavior should not depend on what happens to be
1807 dnl installed on the local machine.
1808 dnl ========================================================
1809 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
1810 [ --disable-system-extension-dirs
1811 Disable searching system- and account-global
1812 directories for extensions of any kind; use
1813 only profile-specific extension directories],
1814 ENABLE_SYSTEM_EXTENSION_DIRS=,
1815 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
1816 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
1817 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
1820 dnl ========================================================
1821 dnl = Universalchardet
1822 dnl ========================================================
1823 MOZ_ARG_DISABLE_BOOL(universalchardet,
1824 [ --disable-universalchardet
1825 Disable universal encoding detection],
1826 MOZ_UNIVERSALCHARDET=,
1827 MOZ_UNIVERSALCHARDET=1 )
1829 dnl ========================================================
1831 dnl ========================================================
1833 if test "$COMPILE_ENVIRONMENT" ; then
1835 dnl Moved gamepad platform check to moz.build, linux header check still needed here.
1836 if test "$OS_TARGET" = "Linux"; then
1837 MOZ_CHECK_HEADER([linux/joystick.h])
1838 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
1839 AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
1843 fi # COMPILE_ENVIRONMENT
1846 dnl ========================================================
1847 dnl = Breakpad crash reporting (on by default on supported platforms)
1848 dnl ========================================================
1851 i?86-*-mingw*|x86_64-*-mingw*|aarch64-*-mingw*)
1854 i?86-apple-darwin*|x86_64-apple-darwin*)
1857 *-android*|*-linuxandroid*)
1858 dnl Android/arm is arm-unknown-linux-androideabi, so android condition should
1859 dnl be before Linux condition
1862 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
1863 if test "$MOZ_ENABLE_GTK"; then
1869 MOZ_ARG_DISABLE_BOOL(crashreporter,
1870 [ --disable-crashreporter Disable breakpad crash reporting],
1871 [MOZ_CRASHREPORTER=],
1872 [MOZ_CRASHREPORTER=F # Force enable breakpad])
1874 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin" -a "$MOZ_WIDGET_TOOLKIT" != "android"; then
1875 if test "$MOZ_CRASHREPORTER" = F; then
1876 AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
1881 if test -n "$MOZ_CRASHREPORTER"; then
1882 AC_DEFINE(MOZ_CRASHREPORTER)
1884 if test "$OS_TARGET" = "Linux" && \
1885 test -z "$SKIP_LIBRARY_CHECKS"; then
1886 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
1889 if test "$OS_ARCH" = "WINNT"; then
1890 if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
1891 MOZ_CRASHREPORTER_INJECTOR=1
1892 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
1897 dnl ========================================================
1898 dnl = Enable compilation of specific extension modules
1899 dnl ========================================================
1901 MOZ_ARG_ENABLE_STRING(extensions,
1902 [ --enable-extensions Enable extensions],
1903 [ for option in `echo $enableval | sed 's/,/ /g'`; do
1904 if test "$option" = "yes" -o "$option" = "all"; then
1905 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
1906 elif test "$option" = "no" -o "$option" = "none"; then
1908 elif test "$option" = "default"; then
1909 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
1910 elif test `echo "$option" | grep -c \^-` != 0; then
1911 option=`echo $option | sed 's/^-//'`
1912 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
1914 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
1917 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
1919 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
1920 dnl when trying to build a nonexistent extension.
1921 for extension in $MOZ_EXTENSIONS; do
1922 if test ! -d "${srcdir}/extensions/${extension}"; then
1923 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
1927 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
1928 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
1931 # Avoid defining MOZ_ENABLE_CAIRO_FT on Windows platforms because
1932 # "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
1933 if test -n "$MOZ_TREE_FREETYPE" -a "$OS_TARGET" != WINNT; then
1934 MOZ_ENABLE_CAIRO_FT=1
1935 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
1936 CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
1937 AC_SUBST_LIST(CAIRO_FT_CFLAGS)
1940 AC_CHECK_PROGS(WGET, wget, "")
1943 dnl ========================================================
1945 dnl ========================================================
1947 MOZ_ARG_DISABLE_BOOL(updater,
1948 [ --disable-updater Disable building of updater],
1952 if test -n "$MOZ_UPDATER"; then
1953 AC_DEFINE(MOZ_UPDATER)
1956 dnl ========================================================
1957 dnl parental controls (for Windows Vista)
1958 dnl ========================================================
1959 MOZ_ARG_DISABLE_BOOL(parental-controls,
1960 [ --disable-parental-controls
1961 Do not build parental controls],
1962 MOZ_DISABLE_PARENTAL_CONTROLS=1,
1963 MOZ_DISABLE_PARENTAL_CONTROLS=)
1964 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
1965 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
1968 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
1970 dnl ========================================================
1971 dnl = Disable smartcard support
1972 dnl ========================================================
1973 if test -n "$MOZ_NO_SMART_CARDS"; then
1974 AC_DEFINE(MOZ_NO_SMART_CARDS)
1976 AC_SUBST(MOZ_NO_SMART_CARDS)
1978 dnl ========================================================
1979 dnl = Sandboxing support
1980 dnl ========================================================
1981 if test -n "$MOZ_TSAN" -o -n "$MOZ_ASAN"; then
1982 # Bug 1182565: TSan conflicts with sandboxing on Linux.
1983 # Bug 1287971: LSan also conflicts with sandboxing on Linux.
1991 MOZ_ARG_DISABLE_BOOL(sandbox,
1992 [ --disable-sandbox Disable sandboxing support],
1996 case "$OS_TARGET" in
1997 WINNT|Darwin|OpenBSD)
2003 # Linux sandbox is only available on x86 and x86_64.
2010 # Only enable the sandbox by default on Linux, OpenBSD, macOS, and Windows
2015 if test -n "$MOZ_SANDBOX"; then
2016 AC_DEFINE(MOZ_SANDBOX)
2019 AC_SUBST(MOZ_SANDBOX)
2022 dnl ========================================================
2024 dnl = Module specific options
2026 dnl ========================================================
2027 MOZ_ARG_HEADER(Individual module options)
2029 dnl ==============================
2030 dnl === SQLite fdatasync check ===
2031 dnl ==============================
2032 dnl Check to see if fdatasync is available and make use of it
2033 AC_CHECK_FUNC(fdatasync)
2035 dnl ========================================================
2036 dnl = Disable zipwriter
2037 dnl ========================================================
2038 MOZ_ARG_DISABLE_BOOL(zipwriter,
2039 [ --disable-zipwriter Disable zipwriter component],
2042 AC_SUBST(MOZ_ZIPWRITER)
2044 dnl ========================================================
2046 dnl = Feature options that require extra sources to be pulled
2048 dnl ========================================================
2049 dnl MOZ_ARG_HEADER(Features that require extra sources)
2051 dnl ========================================================
2053 dnl = Runtime debugging and Optimization Options
2055 dnl ========================================================
2056 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
2058 dnl ========================================================
2059 dnl = Enable code optimization. ON by default.
2060 dnl ========================================================
2062 # Use value from moz.configure if one is defined. Else use our computed
2064 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
2065 MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
2068 if test "$COMPILE_ENVIRONMENT"; then
2069 if test -n "$MOZ_OPTIMIZE"; then
2070 AC_MSG_CHECKING([for valid C compiler optimization flags])
2071 _SAVE_CFLAGS=$CFLAGS
2072 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
2073 AC_TRY_COMPILE([#include <stdio.h>],
2074 [printf("Hello World\n");],
2077 AC_MSG_RESULT([$_results])
2078 if test "$_results" = "no"; then
2079 AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
2081 CFLAGS=$_SAVE_CFLAGS
2082 if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
2083 # When using llvm-based LTO, non numeric optimization levels are
2084 # not supported by the linker, so force the linker to use -O2 (
2085 # which doesn't influence the level compilation units are actually
2087 case " $MOZ_OPTIMIZE_FLAGS " in
2088 *\ -Os\ *|*\ -Oz\ *)
2089 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
2094 fi # COMPILE_ENVIRONMENT
2096 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
2097 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
2098 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
2100 dnl ========================================================
2101 dnl = Enable runtime logging
2102 dnl ========================================================
2103 AC_DEFINE(MOZ_LOGGING)
2104 AC_DEFINE(FORCE_PR_LOG)
2106 dnl ========================================================
2107 dnl = This will enable logging of addref, release, ctor, dtor.
2108 dnl ========================================================
2109 _ENABLE_LOGREFCNT=42
2110 MOZ_ARG_ENABLE_BOOL(logrefcnt,
2111 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
2112 _ENABLE_LOGREFCNT=1,
2113 _ENABLE_LOGREFCNT= )
2114 if test "$_ENABLE_LOGREFCNT" = "1"; then
2115 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
2116 elif test -z "$_ENABLE_LOGREFCNT"; then
2117 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
2120 dnl ========================================================
2121 dnl moz_dump_painting
2122 dnl ========================================================
2123 MOZ_ARG_ENABLE_BOOL(dump-painting,
2124 [ --enable-dump-painting Enable paint debugging.],
2125 MOZ_DUMP_PAINTING=1,
2126 MOZ_DUMP_PAINTING= )
2127 if test -n "$MOZ_DUMP_PAINTING"; then
2128 AC_DEFINE(MOZ_DUMP_PAINTING)
2129 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
2131 if test -n "$MOZ_DEBUG"; then
2132 AC_DEFINE(MOZ_DUMP_PAINTING)
2135 case "${OS_TARGET}" in
2136 Android|WINNT|Darwin)
2137 MOZ_GLUE_IN_PROGRAM=
2140 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
2141 MOZ_GLUE_IN_PROGRAM=1
2142 AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
2146 dnl ========================================================
2147 dnl = Jemalloc build setup
2148 dnl ========================================================
2149 if test -z "$MOZ_MEMORY"; then
2152 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
2153 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.])
2158 dnl The generic feature tests that determine how to compute ncpus are long and
2159 dnl complicated. Therefore, simply define special cpp variables for the
2160 dnl platforms we have special knowledge of.
2163 export MOZ_NO_DEBUG_RTL=1
2167 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
2169 dnl ========================================================
2170 dnl = Enable using the clang plugin to build
2171 dnl ========================================================
2173 if test -n "$COMPILE_ENVIRONMENT"; then
2174 MOZ_CONFIG_CLANG_PLUGIN
2175 fi # COMPILE_ENVIRONMENT
2177 dnl ========================================================
2178 dnl = frontend JS debug mode
2179 dnl ========================================================
2181 MOZ_ARG_ENABLE_BOOL(debug-js-modules,
2182 [ --enable-debug-js-modules Enable debug mode for frontend JS libraries],
2186 AC_SUBST(DEBUG_JS_MODULES)
2188 dnl ========================================================
2190 dnl = Profiling and Instrumenting
2192 dnl ========================================================
2193 MOZ_ARG_HEADER(Profiling and Instrumenting)
2195 dnl ========================================================
2196 dnl = Support for demangling undefined symbols
2197 dnl ========================================================
2198 if test -z "$SKIP_LIBRARY_CHECKS"; then
2201 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
2205 # Demangle only for debug or DMD builds
2206 MOZ_DEMANGLE_SYMBOLS=
2207 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
2208 MOZ_DEMANGLE_SYMBOLS=1
2209 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
2211 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
2213 dnl ========================================================
2214 dnl = Support for gcc stack unwinding (from gcc 3.3)
2215 dnl ========================================================
2216 if test -z "$SKIP_LIBRARY_CHECKS"; then
2219 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
2223 dnl ========================================================
2227 dnl ========================================================
2228 MOZ_ARG_HEADER(Misc. Options)
2230 dnl ========================================================
2231 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
2232 dnl ========================================================
2233 MOZ_ARG_WITH_STRING(user-appdir,
2234 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
2235 [ val=`echo $withval`
2236 if echo "$val" | grep "\/" >/dev/null; then
2237 AC_MSG_ERROR("Homedir must be single relative path.")
2242 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
2244 if test -z "$SKIP_COMPILER_CHECKS"; then
2245 dnl ========================================================
2247 dnl = Compiler Options
2249 dnl ========================================================
2250 MOZ_ARG_HEADER(Compiler Options)
2252 dnl ========================================================
2253 dnl Check for gcc -pipe support
2254 dnl ========================================================
2255 AC_MSG_CHECKING([for -pipe support])
2256 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
2257 dnl Any gcc that supports firefox supports -pipe.
2258 CFLAGS="$CFLAGS -pipe"
2259 CXXFLAGS="$CXXFLAGS -pipe"
2260 AC_MSG_RESULT([yes])
2265 fi # ! SKIP_COMPILER_CHECKS
2269 if test "$COMPILE_ENVIRONMENT"; then
2271 fi # COMPILE_ENVIRONMENT
2273 dnl ========================================================
2275 dnl = Static Build Options
2277 dnl ========================================================
2278 MOZ_ARG_HEADER(Static build options)
2280 if test -z "$MOZ_SYSTEM_ZLIB"; then
2281 if test -n "$JS_SHARED_LIBRARY" -o -n "$MOZ_LINKER" -o "$MOZ_WIDGET_TOOLKIT" = android; then
2283 AC_DEFINE(ZLIB_IN_MOZGLUE)
2287 AC_SUBST(ZLIB_IN_MOZGLUE)
2289 dnl ========================================================
2291 dnl = Standalone module options
2293 dnl ========================================================
2294 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
2297 dnl ========================================================
2299 if test -z "$SKIP_PATH_CHECKS"; then
2300 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
2301 if test "$MOZ_ENABLE_GTK" ; then
2302 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
2307 if test -z "${GLIB_GMODULE_LIBS}" \
2308 -a -n "${GLIB_CONFIG}"\
2309 -a "${GLIB_CONFIG}" != no\
2311 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
2314 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
2316 if test "$USE_FC_FREETYPE"; then
2317 if test "$COMPILE_ENVIRONMENT"; then
2318 dnl ========================================================
2319 dnl = Check for freetype2 functionality
2320 dnl ========================================================
2321 if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
2323 _SAVE_CFLAGS="$CFLAGS"
2324 LIBS="$LIBS $FT2_LIBS"
2325 CFLAGS="$CFLAGS $FT2_CFLAGS"
2327 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
2328 ac_cv_member_FT_Bitmap_Size_y_ppem,
2329 [AC_TRY_COMPILE([#include <ft2build.h>
2330 #include FT_FREETYPE_H],
2332 if (sizeof s.y_ppem) return 0;
2334 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
2335 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
2336 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
2337 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
2339 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
2341 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
2342 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
2343 [FT_Bitmap_Size structure includes y_ppem field])
2345 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
2348 CFLAGS="$_SAVE_CFLAGS"
2351 _SAVE_CPPFLAGS="$CPPFLAGS"
2352 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
2353 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
2354 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
2355 CPPFLAGS="$_SAVE_CPPFLAGS"
2359 dnl ========================================================
2360 dnl Check if we need the 32-bit Linux SSE2 error dialog
2361 dnl ========================================================
2363 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
2365 dnl ========================================================
2366 dnl Check for pixman and cairo
2367 dnl ========================================================
2370 MOZ_ARG_ENABLE_BOOL(system-cairo,
2371 [ --enable-system-cairo Obsolete: do not use this option],
2372 AC_MSG_ERROR(--enable-system-cairo is not supported),
2376 MOZ_ARG_ENABLE_BOOL(system-pixman,
2377 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
2379 MOZ_TREE_PIXMAN=force,
2382 if test "$MOZ_TREE_PIXMAN"; then
2383 AC_DEFINE(MOZ_TREE_PIXMAN)
2385 PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.19.2)
2388 MOZ_CAIRO_CFLAGS="-I${DIST}/include/cairo"
2389 AC_DEFINE(MOZ_TREE_CAIRO)
2391 if test "$OS_ARCH" = "WINNT"; then
2392 # For now we assume that we will have a uint64_t available through
2393 # one of the above headers or mozstdint.h.
2394 AC_DEFINE(HAVE_UINT64_T)
2397 # Define macros for cairo-features.h
2398 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
2399 if test "$MOZ_X11"; then
2400 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
2401 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
2402 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
2404 if test "$_HAVE_FREETYPE2"; then
2405 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2406 MOZ_ENABLE_CAIRO_FT=1
2407 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
2410 case "$MOZ_WIDGET_TOOLKIT" in
2412 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
2413 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
2414 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
2417 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
2418 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
2419 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
2421 if test "$COMPILE_ENVIRONMENT"; then
2422 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
2426 if test "$USE_FC_FREETYPE"; then
2427 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
2429 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
2430 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
2432 AC_SUBST(PS_SURFACE_FEATURE)
2433 AC_SUBST(SVG_SURFACE_FEATURE)
2434 AC_SUBST(XLIB_SURFACE_FEATURE)
2435 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
2436 AC_SUBST(QUARTZ_SURFACE_FEATURE)
2437 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
2438 AC_SUBST(WIN32_SURFACE_FEATURE)
2439 AC_SUBST(OS2_SURFACE_FEATURE)
2440 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
2441 AC_SUBST(FT_FONT_FEATURE)
2442 AC_SUBST(FC_FONT_FEATURE)
2443 AC_SUBST(WIN32_FONT_FEATURE)
2444 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
2445 AC_SUBST(QUARTZ_FONT_FEATURE)
2446 AC_SUBST(PNG_FUNCTIONS_FEATURE)
2447 AC_SUBST(QT_SURFACE_FEATURE)
2448 AC_SUBST(TEE_SURFACE_FEATURE)
2450 if test "$MOZ_X11"; then
2451 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
2454 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
2456 case "$MOZ_WIDGET_TOOLKIT" in
2458 TK_CFLAGS="$MOZ_CAIRO_CFLAGS $MOZ_PIXMAN_CFLAGS"
2459 TK_LIBS="$MOZ_CAIRO_LIBS $MOZ_PIXMAN_LIBS"
2463 AC_SUBST(MOZ_TREE_CAIRO)
2464 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
2465 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
2466 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
2467 AC_SUBST(MOZ_TREE_PIXMAN)
2469 BINDGEN_SYSTEM_FLAGS="$_BINDGEN_CFLAGS $NSPR_CFLAGS $NSS_CFLAGS $MOZ_PIXMAN_CFLAGS $MOZ_CAIRO_CFLAGS"
2470 AC_SUBST(BINDGEN_SYSTEM_FLAGS)
2471 BINDGEN_SYSTEM_TOML_FLAGS="$BINDGEN_SYSTEM_FLAGS"
2472 AC_SUBST_TOML_LIST(BINDGEN_SYSTEM_TOML_FLAGS)
2474 dnl ========================================================
2476 dnl ========================================================
2477 MOZ_ARG_DISABLE_BOOL(xul,
2478 [ --disable-xul Disable XUL],
2480 if test "$MOZ_XUL"; then
2483 dnl remove extensions that require XUL
2484 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
2489 dnl ========================================================
2490 dnl necko configuration options
2491 dnl ========================================================
2494 dnl option to disable necko's wifi scanner
2497 if test "$MOZ_WIDGET_TOOLKIT"; then
2499 case "$OS_TARGET" in
2503 DragonFly|FreeBSD|WINNT)
2514 MOZ_ARG_DISABLE_BOOL(necko-wifi,
2515 [ --disable-necko-wifi Disable necko wifi scanner],
2519 if test "$NECKO_WIFI"; then
2520 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
2521 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
2523 AC_DEFINE(NECKO_WIFI)
2524 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
2526 AC_SUBST(NECKO_WIFI)
2527 AC_SUBST(NECKO_WIFI_DBUS)
2529 dnl ========================================================
2531 dnl = Maintainer debug option (no --enable equivalent)
2533 dnl ========================================================
2536 AC_SUBST_LIST(ASFLAGS)
2540 AC_SUBST(MOZ_AUTH_EXTENSION)
2541 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
2542 AC_SUBST_LIST(WARNINGS_CFLAGS)
2543 AC_SUBST_SET(MOZ_EXTENSIONS)
2545 AC_SUBST(MOZ_UNIVERSALCHARDET)
2546 AC_SUBST(MOZ_SPELLCHECK)
2547 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
2548 AC_SUBST(MOZ_CRASHREPORTER)
2549 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
2550 AC_SUBST(MOZ_STUB_INSTALLER)
2551 AC_SUBST(MOZ_UPDATER)
2553 AC_SUBST(MOZ_ANDROID_APPLICATION_CLASS)
2554 AC_SUBST(MOZ_ANDROID_BROWSER_INTENT_CLASS)
2555 AC_SUBST(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
2556 AC_SUBST(INCREMENTAL_LINKER)
2558 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
2560 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
2561 AC_SUBST(MOZ_LINKER_EXTRACT)
2563 if test -n "$MOZ_BINARY_EXTENSIONS"; then
2564 AC_DEFINE(MOZ_BINARY_EXTENSIONS)
2567 AC_SUBST(MOZ_REQUIRE_SIGNING)
2568 if test "$MOZ_REQUIRE_SIGNING" = 1; then
2569 AC_DEFINE(MOZ_REQUIRE_SIGNING)
2572 dnl ========================================================
2573 dnl = Mac bundle name prefix
2574 dnl ========================================================
2575 MOZ_ARG_WITH_STRING(macbundlename-prefix,
2576 [ --with-macbundlename-prefix=prefix
2577 Prefix for MOZ_MACBUNDLE_NAME],
2578 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
2580 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
2581 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
2582 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
2585 if test "$MOZ_DEBUG"; then
2586 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
2588 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
2590 AC_SUBST(MOZ_MACBUNDLE_NAME)
2592 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
2593 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
2594 # Otherwise, use MOZ_APP_DISPLAYNAME
2595 if test -z "$MOZ_MACBUNDLE_ID"; then
2596 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
2598 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
2599 if test "$MOZ_DEBUG"; then
2600 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
2603 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
2604 AC_SUBST(MOZ_MACBUNDLE_ID)
2606 dnl ========================================================
2607 dnl = Child Process Name for IPC
2608 dnl ========================================================
2609 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
2610 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
2612 # We want to let Android unpack the file at install time, but it only does
2613 # so if the file is named libsomething.so. The lib/ path is also required
2614 # because the unpacked file will be under the lib/ subdirectory and will
2615 # need to be executed from that path.
2616 MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
2618 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
2619 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
2621 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
2622 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
2623 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
2625 # The following variables are available to branding and application
2626 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
2627 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
2628 # impacts profile location and user-visible fields.
2629 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
2630 # versions of a given application (e.g. Aurora and Firefox both use
2631 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
2632 # for application.ini's "Name" field, which controls profile location in
2633 # the absence of a "Profile" field (see below), and various system
2634 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
2635 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
2636 # Mac Bundle name, Updater, Installer), it is typically used for nightly
2637 # builds (e.g. Aurora for Firefox).
2638 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
2639 # defaults to a lowercase form of MOZ_APP_BASENAME.
2640 # - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
2641 # profile name and remoting. If not set, defaults to MOZ_APP_NAME.
2642 # - MOZ_APP_PROFILE: When set, used for application.ini's
2643 # "Profile" field, which controls profile location.
2644 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
2645 # crash reporter server url.
2646 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
2648 # The following environment variables used to have an effect, but don't anymore:
2649 # - MOZ_APP_VERSION: Defines the application version number. This was replaced with
2650 # the contents from the version.txt file in the application directory, or
2651 # browser/config/version.txt if there isn't one.
2652 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
2653 # in the "About" window. This was replaced with the contents from the
2654 # version_display.txt or version.txt in the application directory, or
2655 # browser/config/version_display.txt.
2657 if test -z "$MOZ_APP_NAME"; then
2658 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
2661 if test -z "$MOZ_APP_REMOTINGNAME"; then
2662 MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
2665 if test -z "$ANDROID_PACKAGE_NAME" ; then
2666 # When we got rid of the Aurora channel we decided to replace the old
2667 # Nightly ANDROID_PACKAGE_NAME with Aurora. To make sure this is inherited
2668 # by all mozilla-central based branches we make this the new "default"
2669 # for Fennec. Non mozilla-central based branches set ANDROID_PACKAGE_NAME
2670 # in their mozconfig, so they will never get this. If there are ever
2671 # non-Fennec builds for Android, they will fall into the else block
2672 # and use their own default name.
2673 # https://bugzilla.mozilla.org/show_bug.cgi?id=1357808 has additional
2674 # background on this.
2675 if test "$MOZ_APP_NAME" = "fennec"; then
2676 ANDROID_PACKAGE_NAME="org.mozilla.fennec_aurora"
2678 ANDROID_PACKAGE_NAME="org.mozilla.$MOZ_APP_NAME"
2682 # For extensions and langpacks, we require a max version that is compatible
2683 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
2684 # 24.0a1 and 24.0a2 aren't affected
2686 # 24.1.1 becomes 24.*
2687 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
2688 if test -z "$IS_ALPHA"; then
2690 if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
2691 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
2693 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
2697 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
2700 AC_SUBST(MOZ_APP_NAME)
2701 AC_SUBST(MOZ_APP_REMOTINGNAME)
2702 AC_SUBST(MOZ_APP_DISPLAYNAME)
2703 AC_SUBST(MOZ_APP_BASENAME)
2704 AC_SUBST(MOZ_APP_VENDOR)
2705 AC_SUBST(MOZ_APP_PROFILE)
2706 AC_SUBST(MOZ_APP_ID)
2707 AC_SUBST(MAR_CHANNEL_ID)
2708 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
2709 AC_SUBST(MOZ_PROFILE_MIGRATOR)
2710 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
2711 AC_SUBST(MOZ_APP_UA_NAME)
2712 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
2713 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
2714 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
2716 AC_SUBST(MOZ_APP_MAXVERSION)
2717 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
2718 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
2719 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
2722 AC_SUBST(MOZ_PKG_SPECIAL)
2723 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
2725 if test "$MOZILLA_OFFICIAL"; then
2726 # Build revisions should always be present in official builds
2727 MOZ_INCLUDE_SOURCE_INFO=1
2730 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
2731 # explicitly set the repository and changeset information in.
2732 AC_SUBST(MOZ_SOURCE_REPO)
2733 AC_SUBST(MOZ_SOURCE_CHANGESET)
2734 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
2736 dnl If we have any service that uploads data (and requires data submission
2737 dnl policy alert), set MOZ_DATA_REPORTING.
2738 dnl We need SUBST for build system and DEFINE for xul preprocessor.
2739 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER" || test -n "$MOZ_NORMANDY"; then
2740 MOZ_DATA_REPORTING=1
2741 AC_DEFINE(MOZ_DATA_REPORTING)
2742 AC_SUBST(MOZ_DATA_REPORTING)
2746 AC_SUBST(WIN32_REDIST_DIR)
2747 AC_SUBST(WIN_UCRT_REDIST_DIR)
2749 dnl Echo the CFLAGS to remove extra whitespace.
2751 $_COMPILATION_CFLAGS \
2755 $_WARNINGS_CXXFLAGS \
2756 $_COMPILATION_CXXFLAGS \
2759 COMPILE_CFLAGS=`echo \
2763 COMPILE_CXXFLAGS=`echo \
2764 $_DEFINES_CXXFLAGS \
2768 $_WARNINGS_HOST_CFLAGS \
2769 $_COMPILATION_HOST_CFLAGS \
2772 HOST_CXXFLAGS=`echo \
2773 $_WARNINGS_HOST_CXXFLAGS \
2774 $_COMPILATION_HOST_CXXFLAGS \
2777 AC_SUBST(MOZ_SYSTEM_PNG)
2779 AC_SUBST_LIST(MOZ_PNG_CFLAGS)
2780 AC_SUBST_LIST(MOZ_PNG_LIBS)
2782 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
2783 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
2784 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
2785 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
2786 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
2787 OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
2788 OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
2790 AC_SUBST(HOST_CMFLAGS)
2791 AC_SUBST(HOST_CMMFLAGS)
2792 AC_SUBST(OS_COMPILE_CMFLAGS)
2793 AC_SUBST(OS_COMPILE_CMMFLAGS)
2796 OS_CXXFLAGS="$CXXFLAGS"
2797 OS_CPPFLAGS="$CPPFLAGS"
2798 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
2799 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
2800 OS_LDFLAGS="$LDFLAGS"
2802 AC_SUBST_LIST(OS_CFLAGS)
2803 AC_SUBST_LIST(OS_CXXFLAGS)
2804 AC_SUBST_LIST(OS_CPPFLAGS)
2805 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
2806 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
2807 AC_SUBST_LIST(OS_LDFLAGS)
2812 AC_SUBST_LIST(HOST_CFLAGS)
2813 AC_SUBST_LIST(HOST_CPPFLAGS)
2814 AC_SUBST_LIST(HOST_CXXFLAGS)
2815 AC_SUBST(HOST_LDFLAGS)
2816 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
2817 AC_SUBST(HOST_BIN_SUFFIX)
2819 AC_SUBST(TARGET_XPCOM_ABI)
2820 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
2821 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
2822 AC_SUBST(HAVE_X86_AVX2)
2823 AC_SUBST(HAVE_ALTIVEC)
2825 AC_SUBST_LIST(DSO_CFLAGS)
2826 AC_SUBST_LIST(DSO_PIC_CFLAGS)
2827 AC_SUBST(DSO_LDOPTS)
2828 AC_SUBST(BIN_SUFFIX)
2830 AC_SUBST(NS_ENABLE_TSF)
2831 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
2832 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
2834 AC_SUBST(MOZ_DEVTOOLS)
2836 AC_SUBST(MOZ_PACKAGE_JSSHELL)
2840 dnl Host JavaScript runtime, if any, to use during cross compiles.
2843 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
2845 if test -n "$COMPILE_ENVIRONMENT"; then
2846 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
2848 dnl Check for missing components
2849 if test "$MOZ_X11"; then
2850 dnl ====================================================
2851 dnl = Check if X headers exist
2852 dnl ====================================================
2853 _SAVE_CFLAGS=$CFLAGS
2854 CFLAGS="$CFLAGS $XCFLAGS"
2858 #include <X11/Xlib.h>
2859 #include <X11/Intrinsic.h>
2860 #include <X11/extensions/XShm.h>
2864 if ((dpy = XOpenDisplay(NULL)) == NULL) {
2865 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
2869 [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
2870 CFLAGS="$_SAVE_CFLAGS"
2872 if test -n "$MISSING_X"; then
2873 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
2878 fi # COMPILE_ENVIRONMENT
2880 dnl Set various defines and substitutions
2881 dnl ========================================================
2883 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
2884 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
2885 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
2886 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
2887 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
2888 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
2889 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
2890 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
2891 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
2894 AC_SUBST(MOZ_DEV_EDITION)
2895 if test -n "$MOZ_DEV_EDITION"; then
2896 AC_DEFINE(MOZ_DEV_EDITION)
2899 if test "$MOZ_DEBUG" -o "$DEVELOPER_OPTIONS"; then
2903 if test -n "$A11Y_LOG"; then
2907 dnl Spit out some output
2908 dnl ========================================================
2910 dnl The following defines are used by xpcom
2911 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
2923 # Avoid using obsolete NSPR features
2924 AC_DEFINE(NO_NSPR_10_SUPPORT)
2926 MOZ_CREATE_CONFIG_STATUS()
2928 rm -fr confdefs* $ac_clean_files