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
57 GDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_14
61 dnl Set various checks
62 dnl ========================================================
65 dnl Initialize the Pthread test variables early so they can be
66 dnl overridden by each platform.
67 dnl ========================================================
71 LDFLAGS="$LDFLAGS $LINKER_LDFLAGS"
73 if test "$COMPILE_ENVIRONMENT"; then
75 fi # COMPILE_ENVIRONMENT
78 *-android*|*-linuxandroid*)
81 AC_PATH_PROG(OBJCOPY,objcopy)
87 dnl ========================================================
88 dnl Checks for compilers.
89 dnl ========================================================
91 if test "$COMPILE_ENVIRONMENT"; then
93 # Run some logic to figure out exe extensions (mostly for mingw's sake)
96 if test "$target" != "$host"; then
102 # 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, :)
113 dnl ========================================================
114 dnl Special win32 checks
115 dnl ========================================================
121 if test "$GCC" != "yes"; then
122 # Check to see if we are really running in a msvc environemnt
125 # Make sure compilers are valid
126 CXXFLAGS="$CXXFLAGS -TP"
129 AC_TRY_COMPILE([#include <stdio.h>],
130 [ printf("Hello World\n"); ],,
131 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
134 AC_TRY_COMPILE([#include <new.h>],
135 [ unsigned *test = new unsigned(42); ],,
136 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
140 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
143 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
144 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
145 AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
148 MSVC_C_RUNTIME_DLL=vcruntime140.dll
149 MSVC_CXX_RUNTIME_DLL=msvcp140.dll
151 # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
152 CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
154 if test -n "$WIN_UCRT_REDIST_DIR"; then
155 if test ! -d "$WIN_UCRT_REDIST_DIR"; then
156 AC_MSG_ERROR([Invalid Windows UCRT Redist directory: ${WIN_UCRT_REDIST_DIR}])
158 WIN_UCRT_REDIST_DIR=`cd "$WIN_UCRT_REDIST_DIR" && (pwd -W 2>/dev/null || pwd)`
161 AC_SUBST(MSVC_C_RUNTIME_DLL)
162 AC_SUBST(MSVC_CXX_RUNTIME_DLL)
164 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
166 if test -n "$WIN32_REDIST_DIR"; then
167 if test ! -d "$WIN32_REDIST_DIR"; then
168 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
170 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && (pwd -W 2>/dev/null || pwd)`
173 # Check linker version, except in lld builds
178 _LD_FULL_VERSION=`"${LINKER}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
179 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
180 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
181 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
188 unset _MSVC_VER_FILTER
191 STL_FLAGS="-I${DIST}/stl_wrappers"
193 # Check w32api version
194 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
195 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
196 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
197 AC_TRY_COMPILE([#include <w32api.h>],
198 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
199 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
200 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
201 #error "test failed."
203 , [ res=yes ], [ res=no ])
204 AC_MSG_RESULT([$res])
205 if test "$res" != "yes"; then
206 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
208 # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
209 # causing problems with local implementations with the same name.
210 AC_DEFINE(STRSAFE_NO_DEPRECATE)
213 CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
214 CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
216 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
217 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
218 # Require OS features provided by IE 8.0 (Win7)
219 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0800)
224 if test -n "$_WIN32_MSVC"; then
226 SKIP_COMPILER_CHECKS=1
227 SKIP_LIBRARY_CHECKS=1
229 # Since we're skipping compiler and library checks, hard-code
232 AC_DEFINE(HAVE_ISATTY)
235 fi # COMPILE_ENVIRONMENT
240 AC_SUBST_LIST(STL_FLAGS)
241 AC_SUBST(WRAP_STL_INCLUDES)
243 dnl ========================================================
244 dnl set the defaults first
245 dnl ========================================================
246 MOZ_USER_DIR=".mozilla"
248 MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
252 dnl Configure platform-specific CPU architecture compiler options.
253 dnl ==============================================================
254 if test "$COMPILE_ENVIRONMENT"; then
256 fi # COMPILE_ENVIRONMENT
258 dnl ========================================================
259 dnl Android libstdc++
260 dnl ========================================================
263 if test "$COMPILE_ENVIRONMENT"; then
265 fi # COMPILE_ENVIRONMENT
267 dnl ========================================================
268 dnl Suppress Clang Argument Warnings
269 dnl ========================================================
270 WARNINGS_CFLAGS="$_WARNINGS_CFLAGS"
271 if test -n "${CLANG_CC}${CLANG_CL}"; then
272 WARNINGS_CFLAGS="-Qunused-arguments $WARNINGS_CFLAGS"
273 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
275 if test -n "${CLANG_CXX}${CLANG_CL}"; then
276 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
279 if test -n "$COMPILE_ENVIRONMENT"; then
283 dnl ========================================================
284 dnl GNU specific defaults
285 dnl ========================================================
286 if test "$GNU_CC"; then
290 SSSE3_FLAGS="-mssse3"
291 CFLAGS="$CFLAGS -fno-strict-aliasing"
293 if test "$OS_ARCH" != "WINNT" -o -z "$CLANG_CC"; then
294 DSO_PIC_CFLAGS='-fPIC'
295 ASFLAGS="$ASFLAGS -fPIC"
298 AC_MSG_CHECKING([for --noexecstack option to as])
300 CFLAGS="$CFLAGS -Wa,--noexecstack"
301 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
302 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
305 AC_MSG_CHECKING([for -z noexecstack option to ld])
306 _SAVE_LDFLAGS=$LDFLAGS
307 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
308 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
310 LDFLAGS=$_SAVE_LDFLAGS)
312 AC_MSG_CHECKING([for -z text option to ld])
313 _SAVE_LDFLAGS=$LDFLAGS
314 LDFLAGS="$LDFLAGS -Wl,-z,text"
315 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
317 LDFLAGS=$_SAVE_LDFLAGS)
319 AC_MSG_CHECKING([for -z relro option to ld])
320 _SAVE_LDFLAGS=$LDFLAGS
321 LDFLAGS="$LDFLAGS -Wl,-z,relro"
322 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
324 LDFLAGS=$_SAVE_LDFLAGS)
326 AC_MSG_CHECKING([for -z nocopyreloc option to ld])
327 _SAVE_LDFLAGS=$LDFLAGS
328 LDFLAGS="$LDFLAGS -Wl,-z,nocopyreloc"
329 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
331 LDFLAGS=$_SAVE_LDFLAGS)
333 AC_MSG_CHECKING([for -Bsymbolic-functions option to ld])
334 _SAVE_LDFLAGS=$LDFLAGS
335 LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
336 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
338 LDFLAGS=$_SAVE_LDFLAGS)
340 AC_MSG_CHECKING([for --build-id=sha1 option to ld])
341 _SAVE_LDFLAGS=$LDFLAGS
342 LDFLAGS="$LDFLAGS -Wl,--build-id=sha1"
343 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
345 LDFLAGS=$_SAVE_LDFLAGS)
347 AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
348 HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
349 _SAVE_LDFLAGS=$LDFLAGS
350 LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
351 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
352 [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
354 LDFLAGS=$_SAVE_LDFLAGS
356 # Check for -mssse3 on $CC
357 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
358 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
360 CFLAGS="$CFLAGS -mssse3"
361 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
362 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
366 # Check for -msse4.1 on $CC
367 AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
368 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
370 CFLAGS="$CFLAGS -msse4.1"
371 AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
372 [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
376 case "${CPU_ARCH}" in
378 AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
380 [asm volatile ("vpermq \$0xd8,%ymm0,%ymm0 \n");],
381 result="yes", result="no")
382 AC_MSG_RESULT("$result")
383 if test "$result" = "yes"; then
389 AC_MSG_CHECKING([whether we can enable AltiVec support])
392 CFLAGS="$CFLAGS -maltivec"
393 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
401 if test "$GCC_USE_GNU_LD"; then
402 # Some tools like ASan use a runtime library that is only
403 # linked against executables, so we must allow undefined
404 # symbols for shared objects in some cases.
405 if test -z "$MOZ_ASAN$MOZ_MSAN$MOZ_UBSAN$MOZ_TSAN$FUZZING_INTERFACES"; then
406 # Don't allow undefined symbols in libraries
407 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
409 # BSDs need `environ' exposed for posix_spawn (bug 753046)
411 DragonFly|FreeBSD|NetBSD|OpenBSD)
412 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
413 DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
415 DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
422 _DEFINES_CFLAGS="-include $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
424 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
427 if test "$GNU_CXX"; then
428 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
430 _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
433 dnl ========================================================
435 dnl ========================================================
437 if test "$MOZ_DMD"; then
438 if test "${CPU_ARCH}" = "arm"; then
439 CFLAGS="$CFLAGS -funwind-tables"
440 CXXFLAGS="$CXXFLAGS -funwind-tables"
444 dnl ========================================================
445 dnl System overrides of the defaults for host
446 dnl ========================================================
449 if test -n "$_WIN32_MSVC"; then
450 HOST_CFLAGS="$HOST_CFLAGS"
452 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
454 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
455 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
458 case "${host_cpu}" in
460 if test -n "$_WIN32_MSVC"; then
461 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
465 if test -n "$_WIN32_MSVC"; then
466 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
468 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
474 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
475 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
478 *-linux*|*-kfreebsd*-gnu|*-gnu*)
479 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
480 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
484 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
485 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
489 dnl ========================================================
490 dnl System overrides of the defaults for target
491 dnl ========================================================
495 MOZ_OPTIMIZE_FLAGS="-O3"
497 # The ExceptionHandling framework is needed for Objective-C exception
498 # logging code in nsObjCExceptions.h. Currently we only use that in debug
500 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
502 dnl DTrace and -dead_strip don't interact well. See bug 403132.
503 dnl ===================================================================
504 if test "x$enable_dtrace" = "xyes"; then
505 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
507 dnl check for the presence of the -dead_strip linker flag
508 AC_MSG_CHECKING([for -dead_strip option to ld])
509 _SAVE_LDFLAGS=$LDFLAGS
510 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
511 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
512 if test -n "$_HAVE_DEAD_STRIP" ; then
514 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
519 LDFLAGS=$_SAVE_LDFLAGS
522 MOZ_FIX_LINK_PATHS="-Wl,-executable_path,${DIST}/bin"
525 *-android*|*-linuxandroid*)
526 if test "$COMPILE_ENVIRONMENT" -a -n "$MOZ_MEMORY"; then
530 if test -z "$CLANG_CC"; then
531 MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
533 # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
534 # -Oz is smaller than -Os on clang.
535 MOZ_OPTIMIZE_FLAGS="-Oz"
536 # Disable the outliner, which causes performance regressions, and is
537 # enabled on some platforms at -Oz.
538 if test -z "$MOZ_LTO"; then
539 DISABLE_OUTLINER="-mno-outline"
541 CFLAGS="$CFLAGS $DISABLE_OUTLINER"
542 AC_TRY_COMPILE(,,[MOZ_OPTIMIZE_FLAGS="$MOZ_OPTIMIZE_FLAGS $DISABLE_OUTLINER"])
543 CFLAGS="$_SAVE_CFLAGS"
545 DISABLE_OUTLINER="-Wl,-plugin-opt=-enable-machine-outliner=never"
546 _SAVE_LDFLAGS=$LDFLAGS
547 LDFLAGS="$LDFLAGS $MOZ_LTO_LDFLAGS $DISABLE_OUTLINER"
548 AC_TRY_LINK(,,[MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS $DISABLE_OUTLINER"])
549 LDFLAGS="$_SAVE_LDFLAGS"
555 if test "$GNU_CC" -o "$GNU_CXX"; then
556 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
557 if test -n "$MOZ_DEBUG"; then
558 MOZ_OPTIMIZE_FLAGS="-Os"
560 MOZ_OPTIMIZE_FLAGS="-O2"
562 if test -z "$CLANG_CC"; then
563 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
567 case "${target_cpu}" in
569 CFLAGS="$CFLAGS -mieee"
570 CXXFLAGS="$CXXFLAGS -mieee"
576 # certain versions of cygwin's makedepend barf on the
577 # #include <string> vs -I./dist/include/string issue so don't use it
578 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
579 # $GNU_CC will match gcc and clang; while $CLANG_CC will match only clang
580 if test -z "$CLANG_CC"; then
581 AC_MSG_ERROR(Firefox cannot be built with mingw-gcc and requires a mingw-clang toolchain to work)
585 # mingw doesn't require kernel32, user32, and advapi32 explicitly
586 LIBS="$LIBS -luuid -lusp10 -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
589 MOZ_OPTIMIZE_FLAGS="-O2"
591 WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
592 WIN32_GUI_EXE_LDFLAGS=-mwindows
594 # Silence problematic clang warnings
595 CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
596 LDFLAGS="$LDFLAGS -Wl,--no-insert-timestamp"
598 TARGET_COMPILER_ABI=msvc
599 STRIP='echo not_strip'
600 # aarch64 doesn't support subsystems below 6.02
601 if test "$CPU_ARCH" = "aarch64"; then
602 WIN32_SUBSYSTEM_VERSION=6.02
604 WIN32_SUBSYSTEM_VERSION=6.01
606 WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
607 WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
608 DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
609 _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
610 _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
611 CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
612 CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
613 if test -z "$CLANG_CL"; then
614 CPPFLAGS="$CPPFLAGS -utf-8"
616 if test "$CPU_ARCH" = "x86"; then
617 dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
618 dnl more recent, so set that explicitly here unless another
619 dnl target arch has already been set.
621 if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
622 CFLAGS="$CFLAGS -arch:SSE2"
624 if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
625 CXXFLAGS="$CXXFLAGS -arch:SSE2"
628 SSE_FLAGS="-arch:SSE"
629 SSE2_FLAGS="-arch:SSE2"
630 dnl MSVC allows the use of intrinsics without any flags
631 dnl and doesn't have a separate arch for SSSE3
632 SSSE3_FLAGS="-arch:SSE2"
634 dnl clang-cl requires appropriate flags to enable SSSE3 support
635 dnl on all architectures.
636 if test -n "$CLANG_CL"; then
637 SSSE3_FLAGS="-mssse3"
639 dnl VS2013+ supports -Gw for better linker optimizations.
640 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
641 dnl Disabled on ASan because it causes false-positive ODR violations.
642 if test -z "$MOZ_ASAN"; then
644 CXXFLAGS="$CXXFLAGS -Gw"
646 # String tail merging doesn't play nice with ASan's ODR checker.
647 LDFLAGS="$LDFLAGS -opt:nolldtailmerge"
649 if test -n "$CLANG_CL"; then
650 # XXX We should combine some of these with our generic GCC-style
653 # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
654 CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
655 # We use offsetof on non-POD objects all the time.
656 # We also suppress this warning on other platforms.
657 CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
658 # This warns for reasonable things like:
659 # enum { X = 0xffffffffU };
660 # which is annoying for IDL headers.
661 CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
662 # This warns for cases that would be reached by the Microsoft
663 # #include rules, but also currently warns on cases that would
664 # *also* be reached by standard C++ include rules. That
665 # behavior doesn't seem useful, so we turn it off.
666 CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
667 # We normally error out on unknown pragmas, but since clang-cl
668 # claims to be MSVC, it would be difficult to add
669 # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
670 # use such pragmas, so just ignore them.
671 CFLAGS="$CFLAGS -Wno-unknown-pragmas"
672 CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
673 # We get errors about various #pragma intrinsic directives from
674 # clang-cl, and we don't need to hear about those.
675 CFLAGS="$CFLAGS -Wno-ignored-pragmas"
676 CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
677 # clang-cl's Intrin.h marks things like _ReadWriteBarrier
678 # as __attribute((__deprecated__)). This is nice to know,
679 # but since we don't get the equivalent warning from MSVC,
680 # let's just ignore it.
681 CFLAGS="$CFLAGS -Wno-deprecated-declarations"
682 CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
683 # We use a function like:
684 # __declspec(noreturn) __inline void f() {}
685 # which -Winvalid-noreturn complains about. Again, MSVC seems
686 # OK with it, so let's silence the warning.
687 CFLAGS="$CFLAGS -Wno-invalid-noreturn"
688 CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
689 # Missing |override| on virtual function declarations isn't
690 # something that MSVC currently warns about.
691 CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
692 # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
693 # declaration on |operator delete(void*)|. However, clang-cl
694 # must internally declare |operator delete(void*)| differently,
695 # which causes this warning for virtually every file in the
696 # tree. clang-cl doesn't support -fno-exceptions or equivalent,
697 # so there doesn't seem to be any way to convince clang-cl to
698 # declare |delete| differently. Therefore, suppress this
700 CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
701 # Macros like STDMETHOD() and IFACEMETHOD() can declare
702 # __attribute__((nothrow)) on their respective method declarations,
703 # while the definitions are left without the matching attribute.
704 CXXFLAGS="$CXXFLAGS -Wno-microsoft-exception-spec"
705 # At least one MSVC header and several headers in-tree have
706 # unused typedefs, so turn this on.
707 CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
708 # jemalloc uses __declspec(allocator) as a profiler hint,
709 # which clang-cl doesn't understand.
710 CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
711 # __attribute__((unused)) really means "might be unused" and
712 # we use it to avoid warnings about things that are unused
713 # in some compilation units, but used in many others. This
714 # warning insists on complaining about the latter case, which
715 # is annoying, and rather noisy.
716 CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused"
718 # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
719 CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
720 LIBS="$LIBS user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
721 MOZ_DEBUG_LDFLAGS='-DEBUG'
722 if test "$HOST_OS_ARCH" != "WINNT"; then
723 # %_PDB% is a special signal to emit only the PDB basename. This
724 # avoids problems in Windows tools that don't like forward-slashes.
725 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -PDBALTPATH:%_PDB%"
727 # Use a higher optimization level for clang-cl, so we can come closer
728 # to MSVC's performance numbers (see bug 1443590).
729 if test -n "$CLANG_CL"; then
730 MOZ_OPTIMIZE_FLAGS='-O2'
732 MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
735 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE"
736 dnl Minimum reqiurement of Gecko is VS2015 or later which supports
737 dnl both SSSE3 and SSE4.1.
738 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
739 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
740 dnl allow AVX2 code from VS2015
743 AC_DEFINE(WIN32_LEAN_AND_MEAN)
744 dnl See http://support.microsoft.com/kb/143208 to use STL
747 MOZ_USER_DIR="Mozilla"
751 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.])
757 if test -n "$GNU_CC"; then
758 CFLAGS="$CFLAGS -mstackrealign"
759 CXXFLAGS="$CXXFLAGS -mstackrealign"
760 LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
762 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
763 LDFLAGS="$LDFLAGS -SAFESEH"
769 if test -n "$_WIN32_MSVC"; then
770 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
775 if test -n "$_WIN32_MSVC"; then
776 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:ARM64"
781 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
787 CFLAGS="$CFLAGS -Dunix"
788 CXXFLAGS="$CXXFLAGS -Dunix"
789 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
790 DSO_PIC_CFLAGS='-fPIC -DPIC'
792 MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
794 DSO_PIC_CFLAGS='-fPIC -DPIC'
797 # This will fail on a.out systems prior to 1.5.1_ALPHA.
798 if test "$LIBRUNPATH"; then
799 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
804 if test -z "$X11BASE"; then
807 MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
808 DSO_PIC_CFLAGS='-fPIC'
809 DSO_LDOPTS='-shared -fPIC'
810 if test "$LIBRUNPATH"; then
811 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
816 MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
821 CFLAGS="$CFLAGS $DSO_PIC_CFLAGS"
822 CXXFLAGS="$CXXFLAGS $DSO_PIC_CFLAGS"
824 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
825 MOZ_OPTIMIZE_FLAGS="-O"
828 AC_SUBST_LIST(MMX_FLAGS)
829 AC_SUBST_LIST(SSE_FLAGS)
830 AC_SUBST_LIST(SSE2_FLAGS)
831 AC_SUBST_LIST(SSSE3_FLAGS)
834 if test -n "$MOZ_LINKER"; then
835 AC_DEFINE(MOZ_LINKER)
837 AC_CHECK_PROGS(XZ, xz)
840 if test -z "$COMPILE_ENVIRONMENT"; then
841 SKIP_COMPILER_CHECKS=1
842 SKIP_LIBRARY_CHECKS=1
846 fi # COMPILE_ENVIRONMENT
848 if test -z "$SKIP_COMPILER_CHECKS"; then
849 dnl Checks for typedefs, structures, and compiler characteristics.
850 dnl ========================================================
865 case "${OS_TARGET}" in
869 STL_FLAGS="-I${DIST}/stl_wrappers"
874 if test "$MOZ_BUILD_APP" = "tools/crashreporter"; then
877 if test "$MOZ_BUILD_APP" = "tools/crashreporter/injector"; then
881 dnl Checks for header files.
882 dnl ========================================================
885 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
886 AC_CACHE_CHECK(for sockaddr_in.sin_len,
887 ac_cv_sockaddr_in_sin_len,
888 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
889 #include <sys/types.h>
891 #include <netinet/in.h>
892 struct sockaddr_in x;
893 void *foo = (void*) &x.sin_len;],
895 [ac_cv_sockaddr_in_sin_len=true],
896 [ac_cv_sockaddr_in_sin_len=false])])
897 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
898 AC_DEFINE(HAVE_SIN_LEN)
899 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
900 AC_DEFINE(HAVE_SCONN_LEN)
903 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
904 ac_cv_sockaddr_in6_sin6_len,
905 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
906 #include <sys/types.h>
908 #include <netinet/in.h>
909 struct sockaddr_in6 x;
910 void *foo = (void*) &x.sin6_len;],
912 [ac_cv_sockaddr_in6_sin6_len=true],
913 [ac_cv_sockaddr_in6_sin6_len=false])])
914 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
915 AC_DEFINE(HAVE_SIN6_LEN)
918 AC_CACHE_CHECK(for sockaddr.sa_len,
919 ac_cv_sockaddr_sa_len,
920 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
921 #include <sys/types.h>
923 #include <sys/socket.h>
925 void *foo = (void*) &x.sa_len;],
927 [ac_cv_sockaddr_sa_len=true],
928 [ac_cv_sockaddr_sa_len=false])])
929 if test "$ac_cv_sockaddr_sa_len" = true ; then
930 AC_DEFINE(HAVE_SA_LEN)
933 dnl Checks for libraries.
934 dnl ========================================================
935 AC_CHECK_LIB(c_r, gethostbyname_r)
937 dnl We don't want to link with libdl even if it's present on OS X, since
938 dnl it's not used and not part of the default installation. OS/2 has dlfcn
940 dnl We don't want to link against libm or libpthread on Darwin since
941 dnl they both are just symlinks to libSystem and explicitly linking
942 dnl against libSystem causes issues when debugging (see bug 299601).
947 AC_SEARCH_LIBS(dlopen, dl,
948 MOZ_CHECK_HEADER(dlfcn.h,
949 AC_DEFINE(HAVE_DLOPEN)))
953 _SAVE_CFLAGS="$CFLAGS"
954 CFLAGS="$CFLAGS -D_GNU_SOURCE"
955 AC_CHECK_FUNCS(dladdr memmem)
956 CFLAGS="$_SAVE_CFLAGS"
958 if test ! "$GNU_CXX"; then
959 AC_CHECK_LIB(C, demangle)
962 AC_CHECK_LIB(socket, socket)
964 dnl ========================================================
965 dnl = pthread support
966 dnl = Start by checking whether the system support pthreads
967 dnl ========================================================
973 AC_CHECK_LIB(pthreads, pthread_create,
974 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
975 AC_CHECK_LIB(pthread, pthread_create,
976 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
977 AC_CHECK_LIB(c_r, pthread_create,
978 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
979 AC_CHECK_LIB(c, pthread_create,
988 dnl ========================================================
989 dnl Do the platform specific pthread hackery
990 dnl ========================================================
991 if test "$MOZ_USE_PTHREADS"x != x
994 dnl See if -pthread is supported.
997 ac_cv_have_dash_pthread=no
998 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
999 echo 'int main() { return 0; }' | cat > conftest.c
1000 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
1001 if test $? -eq 0; then
1002 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1003 ac_cv_have_dash_pthread=yes
1004 case "$target_os" in
1006 # Freebsd doesn't use -pthread for compiles, it uses them for linking
1009 CFLAGS="$CFLAGS -pthread"
1010 CXXFLAGS="$CXXFLAGS -pthread"
1016 AC_MSG_RESULT($ac_cv_have_dash_pthread)
1019 dnl See if -pthreads is supported.
1021 ac_cv_have_dash_pthreads=no
1022 if test "$ac_cv_have_dash_pthread" = "no"; then
1023 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
1024 echo 'int main() { return 0; }' | cat > conftest.c
1025 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
1026 if test $? -eq 0; then
1027 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1028 ac_cv_have_dash_pthreads=yes
1029 CFLAGS="$CFLAGS -pthreads"
1030 CXXFLAGS="$CXXFLAGS -pthreads"
1034 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
1039 AC_DEFINE(_REENTRANT)
1040 AC_DEFINE(_THREAD_SAFE)
1041 dnl -pthread links in -lpthread, so don't specify it explicitly.
1042 if test "$ac_cv_have_dash_pthread" = "yes"; then
1043 _PTHREAD_LDFLAGS="-pthread"
1047 *-*-openbsd*|*-*-bsdi*)
1048 AC_DEFINE(_REENTRANT)
1049 AC_DEFINE(_THREAD_SAFE)
1050 dnl -pthread links in -lc_r, so don't specify it explicitly.
1051 if test "$ac_cv_have_dash_pthread" = "yes"; then
1052 _PTHREAD_LDFLAGS="-pthread"
1056 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
1057 AC_DEFINE(_REENTRANT)
1061 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
1062 AC_SUBST(MOZ_USE_PTHREADS)
1063 MOZ_CHECK_HEADERS(pthread.h)
1067 dnl Checks for library functions.
1068 dnl ========================================================
1069 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall lutimes)
1071 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1072 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1073 ac_cv_clock_monotonic,
1074 [for libs in "" -lrt; do
1077 dnl clock_gettime is available on OSX since 10.12, so depending on MACOSX_DEPLOYMENT_TARGET,
1078 dnl we should or not be able to use it. To detect if we can, we need to make the
1079 dnl availability attribute strict, so that compilation fails when the target is < 10.12.
1080 AC_TRY_LINK([#define availability(os, ...) availability(os, strict, __VA_ARGS)
1082 [ struct timespec ts;
1083 clock_gettime(CLOCK_MONOTONIC, &ts); ],
1084 ac_cv_clock_monotonic=$libs
1087 ac_cv_clock_monotonic=no)
1090 if test "$ac_cv_clock_monotonic" != "no"; then
1091 HAVE_CLOCK_MONOTONIC=1
1092 REALTIME_LIBS=$ac_cv_clock_monotonic
1093 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1094 AC_SUBST(HAVE_CLOCK_MONOTONIC)
1095 AC_SUBST_LIST(REALTIME_LIBS)
1098 dnl Turn on warnings-as-errors to prevent implicit declaration of
1099 dnl pthread_cond_timedwait_monotonic_np, which can cause this test to
1100 dnl inadvertently pass even if the function does not really exist.
1101 _SAVE_CFLAGS="$CFLAGS"
1102 CFLAGS="$CFLAGS $WARNINGS_AS_ERRORS"
1103 AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
1104 ac_cv_pthread_cond_timedwait_monotonic_np,
1105 AC_TRY_LINK([#include <pthread.h>],
1106 [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
1107 ac_cv_pthread_cond_timewait_monotonic_np=yes,
1108 ac_cv_pthread_cond_timewait_monotonic_np=no))
1109 if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
1110 AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
1112 CFLAGS=$_SAVE_CFLAGS
1116 ac_cv_func_res_ninit,
1117 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
1118 dnl no need for res_ninit() on NetBSD and OpenBSD
1119 ac_cv_func_res_ninit=no
1123 #define _BSD_SOURCE 1
1125 #include <sys/types.h>
1126 #include <netinet/in.h>
1127 #include <arpa/nameser.h>
1130 [int foo = res_ninit(&_res);],
1131 [ac_cv_func_res_ninit=yes],
1132 [ac_cv_func_res_ninit=no])
1136 if test "$ac_cv_func_res_ninit" = "yes"; then
1137 AC_DEFINE(HAVE_RES_NINIT)
1138 dnl must add the link line we do something as foolish as this... dougt
1140 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
1141 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
1146 dnl **********************
1147 dnl *** va_copy checks ***
1148 AC_CACHE_CHECK([for an implementation of va_copy()],
1150 [AC_TRY_COMPILE([#include <stdarg.h>
1152 void f (int i, ...) {
1153 va_list args1, args2;
1154 va_start (args1, i);
1155 va_copy (args2, args1);
1156 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1158 va_end (args1); va_end (args2);
1160 [f(0, 42); return 0],
1161 [ac_cv_va_copy=yes],
1165 AC_CACHE_CHECK([whether va_list can be copied by value],
1167 [AC_TRY_COMPILE([#include <stdarg.h>
1169 void f (int i, ...) {
1170 va_list args1, args2;
1171 va_start (args1, i);
1173 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1175 va_end (args1); va_end (args2);
1177 [f(0, 42); return 0],
1178 [ac_cv_va_val_copy=yes],
1179 [ac_cv_va_val_copy=no],
1182 if test "x$ac_cv_va_copy" = "xyes"; then
1183 AC_DEFINE(VA_COPY, va_copy)
1184 AC_DEFINE(HAVE_VA_COPY)
1187 if test "x$ac_cv_va_val_copy" = "xno"; then
1188 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
1191 dnl ===================================================================
1192 dnl ========================================================
1193 dnl Put your C++ language/feature checks below
1194 dnl ========================================================
1198 if test "$GNU_CC"; then
1199 if test "$CPU_ARCH" = "arm" ; then
1200 AC_CACHE_CHECK(for ARM EABI,
1204 #if defined(__ARM_EABI__)
1207 #error Not ARM EABI.
1210 ac_cv_gcc_arm_eabi="yes",
1211 ac_cv_gcc_arm_eabi="no")])
1212 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
1214 ARM_ABI_PREFIX=eabi-
1216 ARM_ABI_PREFIX=oabi-
1220 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
1223 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
1224 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
1225 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
1227 _SAVE_LDFLAGS=$LDFLAGS
1228 LDFLAGS="$LDFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
1229 AC_CACHE_CHECK(for __thread keyword for TLS variables,
1230 ac_cv_thread_keyword,
1231 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
1232 [return tlsIsMainThread;],
1233 ac_cv_thread_keyword=yes,
1234 ac_cv_thread_keyword=no)])
1235 LDFLAGS=$_SAVE_LDFLAGS
1236 # The custom dynamic linker doesn't support TLS variables
1238 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
1239 # mips builds fail with TLS variables because of a binutils bug.
1241 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
1246 *-android*|*-linuxandroid*)
1253 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
1259 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
1260 if test -n "$MOZ_LINKER"; then
1261 if test "$CPU_ARCH" = arm; then
1262 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
1263 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
1264 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1265 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1269 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
1270 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
1271 dnl Since the linker only understands the sysv ones, no need to build the
1272 dnl gnu style tables anyways.
1273 LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
1276 dnl End of C++ language/feature checks
1279 dnl ========================================================
1280 dnl = Internationalization checks
1281 dnl ========================================================
1283 dnl Internationalization and Locale support is different
1284 dnl on various UNIX platforms. Checks for specific i18n
1285 dnl features go here.
1287 AC_HAVE_FUNCS(localeconv)
1289 fi # ! SKIP_COMPILER_CHECKS
1291 if test -n "${COMPILE_ENVIRONMENT}"; then
1296 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1297 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1298 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1301 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1302 dnl features that Windows actually does support.
1304 if test -n "$SKIP_COMPILER_CHECKS"; then
1305 dnl Windows has malloc.h
1306 AC_DEFINE(MALLOC_H, [<malloc.h>])
1307 AC_DEFINE(HAVE_FORCEINLINE)
1308 AC_DEFINE(HAVE_LOCALECONV)
1309 fi # SKIP_COMPILER_CHECKS
1311 dnl Mozilla specific options
1312 dnl ========================================================
1313 dnl The macros used for command line options
1314 dnl are defined in build/autoconf/altoptions.m4.
1316 dnl ========================================================
1318 dnl = Check for external package dependencies
1320 dnl ========================================================
1321 MOZ_ARG_HEADER(External Packages)
1323 dnl ========================================================
1324 dnl system libevent Support
1325 dnl ========================================================
1326 MOZ_ARG_WITH_STRING(system-libevent,
1327 [ --with-system-libevent[=PFX]
1328 Use system libevent [installed at prefix PFX]],
1329 LIBEVENT_DIR=$withval)
1331 _SAVE_CFLAGS=$CFLAGS
1332 _SAVE_LDFLAGS=$LDFLAGS
1334 if test "$LIBEVENT_DIR" = yes; then
1335 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
1336 MOZ_SYSTEM_LIBEVENT=1,
1339 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
1340 MOZ_SYSTEM_LIBEVENT=
1341 elif test -z "$MOZ_SYSTEM_LIBEVENT"; then
1342 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
1343 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
1344 MOZ_CHECK_HEADER(event.h,
1345 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
1346 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
1348 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
1349 AC_CHECK_LIB(event, event_init,
1350 [MOZ_SYSTEM_LIBEVENT=1
1351 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
1352 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
1353 [MOZ_SYSTEM_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
1355 CFLAGS=$_SAVE_CFLAGS
1356 LDFLAGS=$_SAVE_LDFLAGS
1359 AC_SUBST(MOZ_SYSTEM_LIBEVENT)
1361 if test -z "$SKIP_LIBRARY_CHECKS"; then
1363 dnl ========================================================
1364 dnl system PNG Support
1365 dnl ========================================================
1366 MOZ_ARG_WITH_STRING(system-png,
1367 [ --with-system-png[=PFX]
1368 Use system libpng [installed at prefix PFX]],
1371 _SAVE_CFLAGS=$CFLAGS
1372 _SAVE_LDFLAGS=$LDFLAGS
1374 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
1375 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
1376 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
1378 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
1381 AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"],
1382 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1383 AC_CHECK_LIB(png, png_get_acTL, ,
1384 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
1386 if test "$MOZ_SYSTEM_PNG" = 1; then
1387 AC_TRY_COMPILE([ #include <stdio.h>
1388 #include <sys/types.h>
1390 [ #if PNG_LIBPNG_VER < $MOZPNG
1391 #error "Insufficient libpng version ($MOZPNG required)."
1393 #ifndef PNG_UINT_31_MAX
1394 #error "Insufficient libpng version."
1397 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1399 CFLAGS=$_SAVE_CFLAGS
1400 LDFLAGS=$_SAVE_LDFLAGS
1403 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then
1404 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
1405 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
1408 fi # SKIP_LIBRARY_CHECKS
1410 dnl ========================================================
1414 dnl ========================================================
1416 MOZ_ARG_HEADER(Application)
1418 ENABLE_SYSTEM_EXTENSION_DIRS=1
1419 MOZ_BRANDING_DIRECTORY=
1420 MOZ_OFFICIAL_BRANDING=
1421 MOZ_AUTH_EXTENSION=1
1423 MOZ_UNIVERSALCHARDET=1
1428 MOZ_BINARY_EXTENSIONS=
1431 dnl ========================================================
1432 dnl = Trademarked Branding
1433 dnl ========================================================
1434 MOZ_ARG_ENABLE_BOOL(official-branding,
1435 [ --enable-official-branding
1436 Enable Official mozilla.org Branding
1437 Do not distribute builds with
1438 --enable-official-branding unless you have
1439 permission to use trademarks per
1440 http://www.mozilla.org/foundation/trademarks/ .],
1441 MOZ_OFFICIAL_BRANDING=1,
1442 MOZ_OFFICIAL_BRANDING=)
1444 # Allow the application to influence configure with a confvars.sh script.
1445 AC_MSG_CHECKING([if app-specific confvars.sh exists])
1446 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
1447 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
1448 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
1453 dnl ========================================================
1454 dnl Ensure Android SDK and build-tools versions depending on
1456 dnl ========================================================
1458 case "$MOZ_BUILD_APP" in
1464 dnl ========================================================
1466 dnl = Toolkit Options
1468 dnl ========================================================
1469 MOZ_ARG_HEADER(Toolkit Options)
1471 dnl ========================================================
1472 dnl = Enable the toolkit as needed =
1473 dnl ========================================================
1475 case "$MOZ_WIDGET_TOOLKIT" in
1478 LDFLAGS="$LDFLAGS -framework Cocoa"
1479 # Use -Wl as a trick to avoid -framework and framework names from
1480 # being separated by AC_SUBST_LIST.
1481 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'
1483 CFLAGS="$CFLAGS $TK_CFLAGS"
1484 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1485 MOZ_USER_DIR="Mozilla"
1486 MOZ_FS_LAYOUT=bundle
1490 LDFLAGS="$LDFLAGS -framework UIKit"
1492 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'
1493 CFLAGS="$CFLAGS $TK_CFLAGS"
1494 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1495 MOZ_USER_DIR="Mozilla"
1496 MOZ_FS_LAYOUT=bundle
1501 if test "$OS_TARGET" = Darwin; then
1502 LDFLAGS="$LDFLAGS -lobjc"
1505 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
1506 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
1507 case "$MOZ_WIDGET_TOOLKIT" in
1513 if test "$COMPILE_ENVIRONMENT"; then
1514 if test "$MOZ_WIDGET_TOOLKIT" = gtk; then
1515 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)
1516 MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
1517 TK_CFLAGS=$MOZ_GTK3_CFLAGS
1518 TK_LIBS=$MOZ_GTK3_LIBS
1519 dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
1520 dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
1521 AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
1523 if test "$MOZ_ENABLE_GTK"; then
1524 AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
1525 AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
1527 fi # COMPILE_ENVIRONMENT
1529 AC_SUBST(MOZ_FS_LAYOUT)
1531 AC_SUBST_LIST(TK_CFLAGS)
1532 AC_SUBST_LIST(TK_LIBS)
1534 dnl ========================================================
1536 dnl = Components & Features
1538 dnl ========================================================
1539 MOZ_ARG_HEADER(Components and Features)
1541 AC_SUBST(MOZ_OFFICIAL_BRANDING)
1542 if test -n "$MOZ_OFFICIAL_BRANDING"; then
1543 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
1544 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
1546 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
1547 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
1551 MOZ_ARG_WITH_STRING(branding,
1552 [ --with-branding=dir Use branding from the specified directory.],
1553 MOZ_BRANDING_DIRECTORY=$withval)
1555 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
1556 if test -z "$REAL_BRANDING_DIRECTORY"; then
1557 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
1560 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1561 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
1564 AC_SUBST(MOZ_BRANDING_DIRECTORY)
1566 dnl ========================================================
1567 dnl = Distribution ID
1568 dnl ========================================================
1569 MOZ_ARG_WITH_STRING(distribution-id,
1570 [ --with-distribution-id=ID
1571 Set distribution-specific id (default=org.mozilla)],
1572 [ val=`echo $withval`
1573 MOZ_DISTRIBUTION_ID="$val"])
1575 if test -z "$MOZ_DISTRIBUTION_ID"; then
1576 MOZ_DISTRIBUTION_ID="org.mozilla"
1579 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
1580 AC_SUBST(MOZ_DISTRIBUTION_ID)
1582 dnl ========================================================
1583 dnl = libproxy support
1584 dnl ========================================================
1586 if test "$MOZ_ENABLE_GTK"
1588 MOZ_ENABLE_LIBPROXY=
1590 MOZ_ARG_ENABLE_BOOL(libproxy,
1591 [ --enable-libproxy Enable libproxy support ],
1592 MOZ_ENABLE_LIBPROXY=1,
1593 MOZ_ENABLE_LIBPROXY=)
1595 if test "$MOZ_ENABLE_LIBPROXY"
1597 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
1598 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
1601 AC_SUBST(MOZ_ENABLE_LIBPROXY)
1603 dnl ========================================================
1605 dnl ========================================================
1607 if test "$MOZ_ENABLE_GTK"
1611 MOZ_ARG_DISABLE_BOOL(dbus,
1612 [ --disable-dbus Disable dbus support ],
1616 if test "$MOZ_ENABLE_DBUS"
1618 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
1619 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
1620 AC_DEFINE(MOZ_ENABLE_DBUS)
1623 AC_SUBST(MOZ_ENABLE_DBUS)
1625 AC_TRY_COMPILE([#include <linux/ethtool.h>],
1626 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
1627 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
1629 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
1631 dnl ========================================================
1632 dnl = Apple platform decoder support
1633 dnl ========================================================
1634 if test "$COMPILE_ENVIRONMENT"; then
1635 if test -n "$MOZ_APPLEMEDIA"; then
1636 # hack in frameworks for fmp4 - see bug 1029974
1637 # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
1638 LDFLAGS="$LDFLAGS -framework AudioToolbox"
1639 dnl Verify CoreMedia is available.
1640 AC_CHECK_HEADERS([CoreMedia/CoreMedia.h VideoToolbox/VideoToolbox.h], [],
1641 [AC_MSG_ERROR([MacOS X 10.9 SDK or later is required])])
1643 fi # COMPILE_ENVIRONMENT
1645 dnl ========================================================
1646 dnl = Handle dependent MEDIA defines
1647 dnl ========================================================
1650 AC_DEFINE(MOZ_WEBM_ENCODER)
1651 AC_SUBST(MOZ_WEBM_ENCODER)
1653 dnl ========================================================
1655 dnl ========================================================
1657 MOZ_ARG_DISABLE_BOOL(negotiateauth,
1658 [ --disable-negotiateauth Disable GSS-API negotiation ],
1659 MOZ_AUTH_EXTENSION=,
1660 MOZ_AUTH_EXTENSION=1 )
1662 dnl ========================================================
1663 dnl Searching of system directories for extensions.
1664 dnl Note: this switch is meant to be used for test builds
1665 dnl whose behavior should not depend on what happens to be
1666 dnl installed on the local machine.
1667 dnl ========================================================
1668 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
1669 [ --disable-system-extension-dirs
1670 Disable searching system- and account-global
1671 directories for extensions of any kind; use
1672 only profile-specific extension directories],
1673 ENABLE_SYSTEM_EXTENSION_DIRS=,
1674 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
1675 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
1676 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
1679 dnl ========================================================
1680 dnl = Universalchardet
1681 dnl ========================================================
1682 MOZ_ARG_DISABLE_BOOL(universalchardet,
1683 [ --disable-universalchardet
1684 Disable universal encoding detection],
1685 MOZ_UNIVERSALCHARDET=,
1686 MOZ_UNIVERSALCHARDET=1 )
1688 dnl ========================================================
1690 dnl ========================================================
1692 if test "$COMPILE_ENVIRONMENT" ; then
1694 dnl Moved gamepad platform check to moz.build, linux header check still needed here.
1695 if test "$OS_TARGET" = "Linux"; then
1696 MOZ_CHECK_HEADER([linux/joystick.h])
1697 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
1698 AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
1702 fi # COMPILE_ENVIRONMENT
1705 dnl ========================================================
1706 dnl = Breakpad crash reporting (on by default on supported platforms)
1707 dnl ========================================================
1710 i?86-*-mingw*|x86_64-*-mingw*|aarch64-*-mingw*)
1713 i?86-apple-darwin*|x86_64-apple-darwin*|aarch64-apple-darwin*)
1716 *-android*|*-linuxandroid*)
1717 dnl Android/arm is arm-unknown-linux-androideabi, so android condition should
1718 dnl be before Linux condition
1719 dnl The crash reporter prevents crash stacktraces to be logged in the
1720 dnl logs so we leave it out by default in developer builds.
1721 if test -z "$DEVELOPER_OPTIONS"; then
1725 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
1726 if test "$MOZ_ENABLE_GTK"; then
1732 MOZ_ARG_DISABLE_BOOL(crashreporter,
1733 [ --disable-crashreporter Disable breakpad crash reporting],
1734 [MOZ_CRASHREPORTER=],
1735 [MOZ_CRASHREPORTER=F # Force enable breakpad])
1737 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin" -a "$MOZ_WIDGET_TOOLKIT" != "android"; then
1738 if test "$MOZ_CRASHREPORTER" = F; then
1739 AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
1744 if test -n "$MOZ_CRASHREPORTER"; then
1745 AC_DEFINE(MOZ_CRASHREPORTER)
1747 if test "$OS_TARGET" = "Linux" && \
1748 test -z "$SKIP_LIBRARY_CHECKS"; then
1749 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
1752 if test "$OS_ARCH" = "WINNT"; then
1753 if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
1754 MOZ_CRASHREPORTER_INJECTOR=1
1755 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
1760 dnl ========================================================
1761 dnl = Enable compilation of specific extension modules
1762 dnl ========================================================
1764 MOZ_ARG_ENABLE_STRING(extensions,
1765 [ --enable-extensions Enable extensions],
1766 [ for option in `echo $enableval | sed 's/,/ /g'`; do
1767 if test "$option" = "yes" -o "$option" = "all"; then
1768 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
1769 elif test "$option" = "no" -o "$option" = "none"; then
1771 elif test "$option" = "default"; then
1772 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
1773 elif test `echo "$option" | grep -c \^-` != 0; then
1774 option=`echo $option | sed 's/^-//'`
1775 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
1777 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
1780 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
1782 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
1783 dnl when trying to build a nonexistent extension.
1784 for extension in $MOZ_EXTENSIONS; do
1785 if test ! -d "${srcdir}/extensions/${extension}"; then
1786 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
1790 # Avoid defining MOZ_ENABLE_CAIRO_FT on Windows platforms because
1791 # "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
1792 if test -n "$MOZ_TREE_FREETYPE" -a "$OS_TARGET" != WINNT; then
1793 MOZ_ENABLE_CAIRO_FT=1
1794 CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
1795 AC_SUBST_LIST(CAIRO_FT_CFLAGS)
1798 dnl ========================================================
1800 dnl ========================================================
1802 MOZ_ARG_DISABLE_BOOL(updater,
1803 [ --disable-updater Disable building of updater],
1807 if test -n "$MOZ_UPDATER"; then
1808 AC_DEFINE(MOZ_UPDATER)
1811 dnl ========================================================
1812 dnl parental controls (for Windows Vista)
1813 dnl ========================================================
1814 MOZ_ARG_DISABLE_BOOL(parental-controls,
1815 [ --disable-parental-controls
1816 Do not build parental controls],
1817 MOZ_DISABLE_PARENTAL_CONTROLS=1,
1818 MOZ_DISABLE_PARENTAL_CONTROLS=)
1819 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
1820 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
1823 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
1825 dnl ========================================================
1826 dnl = Disable smartcard support
1827 dnl ========================================================
1828 if test -n "$MOZ_NO_SMART_CARDS"; then
1829 AC_DEFINE(MOZ_NO_SMART_CARDS)
1831 AC_SUBST(MOZ_NO_SMART_CARDS)
1833 dnl ========================================================
1834 dnl = Sandboxing support
1835 dnl ========================================================
1836 if test -n "$MOZ_TSAN" -o -n "$MOZ_ASAN"; then
1837 # Bug 1182565: TSan conflicts with sandboxing on Linux.
1838 # Bug 1287971: LSan also conflicts with sandboxing on Linux.
1846 MOZ_ARG_DISABLE_BOOL(sandbox,
1847 [ --disable-sandbox Disable sandboxing support],
1851 case "$OS_TARGET" in
1852 WINNT|Darwin|OpenBSD)
1856 x86_64|x86|arm|aarch64)
1858 # Linux sandbox is only available on x86{,_64} and arm{,64}.
1865 # Only enable the sandbox by default on Linux, OpenBSD, macOS, and Windows
1870 if test -n "$MOZ_SANDBOX"; then
1871 AC_DEFINE(MOZ_SANDBOX)
1874 AC_SUBST(MOZ_SANDBOX)
1877 dnl ========================================================
1879 dnl = Module specific options
1881 dnl ========================================================
1882 MOZ_ARG_HEADER(Individual module options)
1884 dnl ==============================
1885 dnl === SQLite fdatasync check ===
1886 dnl ==============================
1887 dnl Check to see if fdatasync is available and make use of it
1888 AC_CHECK_FUNC(fdatasync)
1890 dnl ========================================================
1891 dnl = Disable zipwriter
1892 dnl ========================================================
1893 MOZ_ARG_DISABLE_BOOL(zipwriter,
1894 [ --disable-zipwriter Disable zipwriter component],
1897 AC_SUBST(MOZ_ZIPWRITER)
1899 dnl ========================================================
1901 dnl = Feature options that require extra sources to be pulled
1903 dnl ========================================================
1904 dnl MOZ_ARG_HEADER(Features that require extra sources)
1906 dnl ========================================================
1908 dnl = Runtime debugging and Optimization Options
1910 dnl ========================================================
1911 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
1913 dnl ========================================================
1914 dnl = Enable code optimization. ON by default.
1915 dnl ========================================================
1917 # Use value from moz.configure if one is defined. Else use our computed
1919 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
1920 MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
1923 if test "$COMPILE_ENVIRONMENT"; then
1924 if test -n "$MOZ_OPTIMIZE"; then
1925 AC_MSG_CHECKING([for valid C compiler optimization flags])
1926 _SAVE_CFLAGS=$CFLAGS
1927 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
1928 AC_TRY_COMPILE([#include <stdio.h>],
1929 [printf("Hello World\n");],
1932 AC_MSG_RESULT([$_results])
1933 if test "$_results" = "no"; then
1934 AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
1936 CFLAGS=$_SAVE_CFLAGS
1937 if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
1938 # When using llvm-based LTO, non numeric optimization levels are
1939 # not supported by the linker, so force the linker to use -O2 (
1940 # which doesn't influence the level compilation units are actually
1942 case " $MOZ_OPTIMIZE_FLAGS " in
1943 *\ -Os\ *|*\ -Oz\ *)
1944 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
1949 fi # COMPILE_ENVIRONMENT
1951 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
1952 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
1953 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
1955 dnl ========================================================
1956 dnl = Enable runtime logging
1957 dnl ========================================================
1958 AC_DEFINE(MOZ_LOGGING)
1959 AC_DEFINE(FORCE_PR_LOG)
1961 dnl ========================================================
1962 dnl = This will enable logging of addref, release, ctor, dtor.
1963 dnl ========================================================
1964 _ENABLE_LOGREFCNT=42
1965 MOZ_ARG_ENABLE_BOOL(logrefcnt,
1966 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
1967 _ENABLE_LOGREFCNT=1,
1968 _ENABLE_LOGREFCNT= )
1969 if test "$_ENABLE_LOGREFCNT" = "1"; then
1970 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
1971 elif test -z "$_ENABLE_LOGREFCNT"; then
1972 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
1975 dnl ========================================================
1976 dnl moz_dump_painting
1977 dnl ========================================================
1978 MOZ_ARG_ENABLE_BOOL(dump-painting,
1979 [ --enable-dump-painting Enable paint debugging.],
1980 MOZ_DUMP_PAINTING=1,
1981 MOZ_DUMP_PAINTING= )
1982 if test -n "$MOZ_DUMP_PAINTING"; then
1983 AC_DEFINE(MOZ_DUMP_PAINTING)
1984 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
1986 if test -n "$MOZ_DEBUG"; then
1987 AC_DEFINE(MOZ_DUMP_PAINTING)
1990 case "${OS_TARGET}" in
1991 Android|WINNT|Darwin)
1992 MOZ_GLUE_IN_PROGRAM=
1995 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
1996 MOZ_GLUE_IN_PROGRAM=1
1997 AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
2001 dnl ========================================================
2002 dnl = Jemalloc build setup
2003 dnl ========================================================
2004 if test -z "$MOZ_MEMORY"; then
2007 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
2008 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.])
2013 dnl The generic feature tests that determine how to compute ncpus are long and
2014 dnl complicated. Therefore, simply define special cpp variables for the
2015 dnl platforms we have special knowledge of.
2018 export MOZ_NO_DEBUG_RTL=1
2022 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
2024 dnl ========================================================
2025 dnl = Enable using the clang plugin to build
2026 dnl ========================================================
2028 if test -n "$COMPILE_ENVIRONMENT"; then
2029 MOZ_CONFIG_CLANG_PLUGIN
2030 fi # COMPILE_ENVIRONMENT
2032 dnl ========================================================
2033 dnl = frontend JS debug mode
2034 dnl ========================================================
2036 MOZ_ARG_ENABLE_BOOL(debug-js-modules,
2037 [ --enable-debug-js-modules Enable debug mode for frontend JS libraries],
2041 AC_SUBST(DEBUG_JS_MODULES)
2043 dnl ========================================================
2045 dnl = Profiling and Instrumenting
2047 dnl ========================================================
2048 MOZ_ARG_HEADER(Profiling and Instrumenting)
2050 dnl ========================================================
2051 dnl = Support for demangling undefined symbols
2052 dnl ========================================================
2053 if test -z "$SKIP_LIBRARY_CHECKS"; then
2056 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
2060 # Demangle only for debug or DMD builds
2061 MOZ_DEMANGLE_SYMBOLS=
2062 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
2063 MOZ_DEMANGLE_SYMBOLS=1
2064 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
2066 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
2068 dnl ========================================================
2069 dnl = Support for gcc stack unwinding (from gcc 3.3)
2070 dnl ========================================================
2071 if test -z "$SKIP_LIBRARY_CHECKS"; then
2074 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
2078 dnl ========================================================
2082 dnl ========================================================
2083 MOZ_ARG_HEADER(Misc. Options)
2085 dnl ========================================================
2086 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
2087 dnl ========================================================
2088 MOZ_ARG_WITH_STRING(user-appdir,
2089 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
2090 [ val=`echo $withval`
2091 if echo "$val" | grep "\/" >/dev/null; then
2092 AC_MSG_ERROR("Homedir must be single relative path.")
2097 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
2099 if test -z "$SKIP_COMPILER_CHECKS"; then
2100 dnl ========================================================
2102 dnl = Compiler Options
2104 dnl ========================================================
2105 MOZ_ARG_HEADER(Compiler Options)
2107 dnl ========================================================
2108 dnl Check for gcc -pipe support
2109 dnl ========================================================
2110 AC_MSG_CHECKING([for -pipe support])
2111 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
2112 dnl Any gcc that supports firefox supports -pipe.
2113 CFLAGS="$CFLAGS -pipe"
2114 CXXFLAGS="$CXXFLAGS -pipe"
2115 AC_MSG_RESULT([yes])
2120 fi # ! SKIP_COMPILER_CHECKS
2124 if test "$COMPILE_ENVIRONMENT"; then
2126 fi # COMPILE_ENVIRONMENT
2128 dnl ========================================================
2130 dnl = Static Build Options
2132 dnl ========================================================
2133 MOZ_ARG_HEADER(Static build options)
2135 if test -z "$MOZ_SYSTEM_ZLIB"; then
2136 if test -n "$JS_SHARED_LIBRARY" -o -n "$MOZ_LINKER" -o "$MOZ_WIDGET_TOOLKIT" = android; then
2138 AC_DEFINE(ZLIB_IN_MOZGLUE)
2142 AC_SUBST(ZLIB_IN_MOZGLUE)
2144 dnl ========================================================
2146 dnl = Standalone module options
2148 dnl ========================================================
2149 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
2152 dnl ========================================================
2154 if test -z "$SKIP_PATH_CHECKS"; then
2155 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
2156 if test "$MOZ_ENABLE_GTK" ; then
2157 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
2162 if test -z "${GLIB_GMODULE_LIBS}" \
2163 -a -n "${GLIB_CONFIG}"\
2164 -a "${GLIB_CONFIG}" != no\
2166 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
2169 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
2171 if test "$USE_FC_FREETYPE"; then
2172 if test "$COMPILE_ENVIRONMENT"; then
2173 dnl ========================================================
2174 dnl = Check for freetype2 functionality
2175 dnl ========================================================
2176 if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
2178 _SAVE_CFLAGS="$CFLAGS"
2179 LIBS="$LIBS $FT2_LIBS"
2180 CFLAGS="$CFLAGS $FT2_CFLAGS"
2182 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
2183 ac_cv_member_FT_Bitmap_Size_y_ppem,
2184 [AC_TRY_COMPILE([#include <ft2build.h>
2185 #include FT_FREETYPE_H],
2187 if (sizeof s.y_ppem) return 0;
2189 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
2190 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
2191 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
2192 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
2194 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
2196 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
2197 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
2198 [FT_Bitmap_Size structure includes y_ppem field])
2200 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
2203 CFLAGS="$_SAVE_CFLAGS"
2206 _SAVE_CPPFLAGS="$CPPFLAGS"
2207 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS"
2208 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
2209 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
2210 CPPFLAGS="$_SAVE_CPPFLAGS"
2214 dnl ========================================================
2215 dnl Check if we need the 32-bit Linux SSE2 error dialog
2216 dnl ========================================================
2218 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
2220 dnl ========================================================
2221 dnl Check for pixman and cairo
2222 dnl ========================================================
2225 MOZ_ARG_ENABLE_BOOL(system-pixman,
2226 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
2228 MOZ_TREE_PIXMAN=force,
2231 if test "$MOZ_TREE_PIXMAN"; then
2232 AC_DEFINE(MOZ_TREE_PIXMAN)
2234 PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.36.0)
2237 if test "$OS_ARCH" = "WINNT"; then
2238 # For now we assume that we will have a uint64_t available through
2239 # one of the above headers or mozstdint.h.
2240 AC_DEFINE(HAVE_UINT64_T)
2243 if test "$_HAVE_FREETYPE2"; then
2244 MOZ_ENABLE_CAIRO_FT=1
2245 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
2248 case "$MOZ_WIDGET_TOOLKIT" in
2250 if test "$COMPILE_ENVIRONMENT"; then
2251 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
2255 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
2256 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
2258 AC_SUBST(MOZ_TREE_PIXMAN)
2260 dnl ========================================================
2262 dnl ========================================================
2263 MOZ_ARG_DISABLE_BOOL(xul,
2264 [ --disable-xul Disable XUL],
2266 if test "$MOZ_XUL"; then
2269 dnl remove extensions that require XUL
2270 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
2275 dnl ========================================================
2276 dnl necko configuration options
2277 dnl ========================================================
2280 dnl option to disable necko's wifi scanner
2283 if test "$MOZ_WIDGET_TOOLKIT"; then
2285 case "$OS_TARGET" in
2289 DragonFly|FreeBSD|WINNT)
2300 MOZ_ARG_DISABLE_BOOL(necko-wifi,
2301 [ --disable-necko-wifi Disable necko wifi scanner],
2305 if test "$NECKO_WIFI"; then
2306 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
2307 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
2309 AC_DEFINE(NECKO_WIFI)
2311 AC_SUBST(NECKO_WIFI)
2312 AC_SUBST(NECKO_WIFI_DBUS)
2314 dnl ========================================================
2316 dnl = Maintainer debug option (no --enable equivalent)
2318 dnl ========================================================
2320 AC_SUBST_LIST(ASFLAGS)
2323 AC_SUBST(MOZ_AUTH_EXTENSION)
2324 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
2325 AC_SUBST_LIST(WARNINGS_CFLAGS)
2326 AC_SUBST_SET(MOZ_EXTENSIONS)
2328 AC_SUBST(MOZ_UNIVERSALCHARDET)
2329 AC_SUBST(MOZ_SPELLCHECK)
2330 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
2331 AC_SUBST(MOZ_CRASHREPORTER)
2332 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
2333 AC_SUBST(MOZ_STUB_INSTALLER)
2334 AC_SUBST(MOZ_UPDATER)
2336 AC_SUBST(INCREMENTAL_LINKER)
2338 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
2340 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
2341 AC_SUBST(MOZ_LINKER_EXTRACT)
2343 if test -n "$MOZ_BINARY_EXTENSIONS"; then
2344 AC_DEFINE(MOZ_BINARY_EXTENSIONS)
2347 dnl ========================================================
2348 dnl = Mac bundle name prefix
2349 dnl ========================================================
2350 MOZ_ARG_WITH_STRING(macbundlename-prefix,
2351 [ --with-macbundlename-prefix=prefix
2352 Prefix for MOZ_MACBUNDLE_NAME],
2353 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
2355 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
2356 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
2357 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
2360 if test "$MOZ_DEBUG"; then
2361 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
2363 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
2365 AC_SUBST(MOZ_MACBUNDLE_NAME)
2367 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
2368 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
2369 # Otherwise, use MOZ_APP_DISPLAYNAME
2370 if test -z "$MOZ_MACBUNDLE_ID"; then
2371 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
2373 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
2374 if test "$MOZ_DEBUG"; then
2375 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
2378 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
2379 AC_SUBST(MOZ_MACBUNDLE_ID)
2381 dnl ========================================================
2382 dnl = Child Process Name for IPC
2383 dnl ========================================================
2384 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
2385 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
2387 # We want to let Android unpack the file at install time, but it only does
2388 # so if the file is named libsomething.so. The lib/ path is also required
2389 # because the unpacked file will be under the lib/ subdirectory and will
2390 # need to be executed from that path.
2391 MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
2393 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
2394 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
2396 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
2397 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
2398 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
2400 # The following variables are available to branding and application
2401 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
2402 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
2403 # impacts profile location and user-visible fields.
2404 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
2405 # Mac Bundle name, Updater, Installer), it is typically used for nightly
2406 # builds (e.g. Aurora for Firefox).
2407 # - MOZ_APP_PROFILE: When set, used for application.ini's
2408 # "Profile" field, which controls profile location.
2409 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
2410 # crash reporter server url.
2411 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
2413 # The following environment variables used to have an effect, but don't anymore:
2414 # - MOZ_APP_VERSION: Defines the application version number. This was replaced with
2415 # the contents from the version.txt file in the application directory, or
2416 # browser/config/version.txt if there isn't one.
2417 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
2418 # in the "About" window. This was replaced with the contents from the
2419 # version_display.txt or version.txt in the application directory, or
2420 # browser/config/version_display.txt.
2422 # For extensions and langpacks, we require a max version that is compatible
2423 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
2424 # 24.0a1 and 24.0a2 aren't affected
2426 # 24.1.1 becomes 24.*
2427 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
2428 if test -z "$IS_ALPHA"; then
2430 if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
2431 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
2433 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
2437 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
2440 AC_SUBST(MOZ_APP_DISPLAYNAME)
2441 AC_SUBST(MOZ_APP_VENDOR)
2442 AC_SUBST(MOZ_APP_PROFILE)
2443 AC_SUBST(MOZ_APP_ID)
2444 AC_SUBST(MAR_CHANNEL_ID)
2445 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
2446 AC_SUBST(MOZ_PROFILE_MIGRATOR)
2447 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
2448 AC_SUBST(MOZ_APP_UA_NAME)
2449 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
2450 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
2451 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
2453 AC_SUBST(MOZ_APP_MAXVERSION)
2454 AC_SUBST(MOZ_PKG_SPECIAL)
2455 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
2457 if test "$MOZILLA_OFFICIAL"; then
2458 # Build revisions should always be present in official builds
2459 MOZ_INCLUDE_SOURCE_INFO=1
2462 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
2463 # explicitly set the repository and changeset information in.
2464 AC_SUBST(MOZ_SOURCE_REPO)
2465 AC_SUBST(MOZ_SOURCE_CHANGESET)
2466 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
2468 dnl If we have any service that uploads data (and requires data submission
2469 dnl policy alert), set MOZ_DATA_REPORTING.
2470 dnl We need SUBST for build system and DEFINE for xul preprocessor.
2471 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER" || test -n "$MOZ_NORMANDY"; then
2472 MOZ_DATA_REPORTING=1
2473 AC_DEFINE(MOZ_DATA_REPORTING)
2474 AC_SUBST(MOZ_DATA_REPORTING)
2478 AC_SUBST(WIN32_REDIST_DIR)
2479 AC_SUBST(WIN_UCRT_REDIST_DIR)
2481 dnl Echo the CFLAGS to remove extra whitespace.
2483 $_COMPILATION_CFLAGS \
2487 $_WARNINGS_CXXFLAGS \
2488 $_COMPILATION_CXXFLAGS \
2491 COMPILE_CFLAGS=`echo \
2495 COMPILE_CXXFLAGS=`echo \
2496 $_DEFINES_CXXFLAGS \
2500 $_WARNINGS_HOST_CFLAGS \
2501 $_COMPILATION_HOST_CFLAGS \
2504 HOST_CXXFLAGS=`echo \
2505 $_WARNINGS_HOST_CXXFLAGS \
2506 $_COMPILATION_HOST_CXXFLAGS \
2509 AC_SUBST(MOZ_SYSTEM_PNG)
2511 AC_SUBST_LIST(MOZ_PNG_CFLAGS)
2512 AC_SUBST_LIST(MOZ_PNG_LIBS)
2514 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
2515 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
2516 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
2517 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
2518 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
2519 OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
2520 OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
2522 AC_SUBST(HOST_CMFLAGS)
2523 AC_SUBST(HOST_CMMFLAGS)
2524 AC_SUBST(OS_COMPILE_CMFLAGS)
2525 AC_SUBST(OS_COMPILE_CMMFLAGS)
2528 OS_CXXFLAGS="$CXXFLAGS"
2529 OS_CPPFLAGS="$CPPFLAGS"
2530 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
2531 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
2532 OS_LDFLAGS="$LDFLAGS"
2534 AC_SUBST_LIST(OS_CFLAGS)
2535 AC_SUBST_LIST(OS_CXXFLAGS)
2536 AC_SUBST_LIST(OS_CPPFLAGS)
2537 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
2538 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
2539 AC_SUBST_LIST(OS_LDFLAGS)
2544 AC_SUBST_LIST(HOST_CFLAGS)
2545 AC_SUBST_LIST(HOST_CPPFLAGS)
2546 AC_SUBST_LIST(HOST_CXXFLAGS)
2547 AC_SUBST(HOST_LDFLAGS)
2548 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
2549 AC_SUBST(HOST_BIN_SUFFIX)
2551 AC_SUBST(TARGET_XPCOM_ABI)
2552 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
2553 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
2554 AC_SUBST(HAVE_X86_AVX2)
2555 AC_SUBST(HAVE_ALTIVEC)
2557 AC_SUBST(DSO_LDOPTS)
2558 AC_SUBST(BIN_SUFFIX)
2560 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
2561 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
2563 AC_SUBST(MOZ_DEVTOOLS)
2565 AC_SUBST(MOZ_PACKAGE_JSSHELL)
2569 dnl Host JavaScript runtime, if any, to use during cross compiles.
2572 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
2574 if test -n "$COMPILE_ENVIRONMENT"; then
2575 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
2576 fi # COMPILE_ENVIRONMENT
2578 dnl Set various defines and substitutions
2579 dnl ========================================================
2581 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
2582 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
2583 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
2584 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
2585 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
2586 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
2587 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
2588 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
2589 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
2592 AC_SUBST(MOZ_DEV_EDITION)
2593 if test -n "$MOZ_DEV_EDITION"; then
2594 AC_DEFINE(MOZ_DEV_EDITION)
2597 if test "$MOZ_DEBUG" -o "$DEVELOPER_OPTIONS"; then
2601 if test -n "$A11Y_LOG"; then
2605 dnl Windows AccessibilityHandler
2606 dnl ========================================================
2608 if test -z "$MOZ_HANDLER_CLSID"; then
2609 MOZ_HANDLER_CLSID="4a195748-dca2-45fb-9295-0a139e76a9e7"
2610 MOZ_IHANDLERCONTROL_IID="3316ce35-f892-4832-97c5-06c52c03cdba"
2611 MOZ_ASYNCIHANDLERCONTROL_IID="15b48b76-ad38-4ad3-bd1a-d3c48a5a9947"
2612 MOZ_IGECKOBACKCHANNEL_IID="dd2e4a89-999e-4d65-8b65-440c923ddb61"
2615 AC_SUBST(MOZ_HANDLER_CLSID)
2616 AC_SUBST(MOZ_IHANDLERCONTROL_IID)
2617 AC_SUBST(MOZ_ASYNCIHANDLERCONTROL_IID)
2618 AC_SUBST(MOZ_IGECKOBACKCHANNEL_IID)
2620 dnl Spit out some output
2621 dnl ========================================================
2623 # Avoid using obsolete NSPR features
2624 AC_DEFINE(NO_NSPR_10_SUPPORT)
2626 MOZ_CREATE_CONFIG_STATUS()
2628 rm -fr confdefs* $ac_clean_files