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"
496 CXXFLAGS="$CXXFLAGS -stdlib=libc++"
498 # The ExceptionHandling framework is needed for Objective-C exception
499 # logging code in nsObjCExceptions.h. Currently we only use that in debug
501 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
503 dnl DTrace and -dead_strip don't interact well. See bug 403132.
504 dnl ===================================================================
505 if test "x$enable_dtrace" = "xyes"; then
506 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
508 dnl check for the presence of the -dead_strip linker flag
509 AC_MSG_CHECKING([for -dead_strip option to ld])
510 _SAVE_LDFLAGS=$LDFLAGS
511 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
512 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
513 if test -n "$_HAVE_DEAD_STRIP" ; then
515 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
520 LDFLAGS=$_SAVE_LDFLAGS
523 MOZ_FIX_LINK_PATHS="-Wl,-executable_path,${DIST}/bin"
526 *-android*|*-linuxandroid*)
527 if test "$COMPILE_ENVIRONMENT" -a -n "$MOZ_MEMORY"; then
531 if test -z "$CLANG_CC"; then
532 MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
534 # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
535 # -Oz is smaller than -Os on clang.
536 MOZ_OPTIMIZE_FLAGS="-Oz"
537 # Disable the outliner, which causes performance regressions, and is
538 # enabled on some platforms at -Oz.
539 if test -z "$MOZ_LTO"; then
540 DISABLE_OUTLINER="-mno-outline"
542 CFLAGS="$CFLAGS $DISABLE_OUTLINER"
543 AC_TRY_COMPILE(,,[MOZ_OPTIMIZE_FLAGS="$MOZ_OPTIMIZE_FLAGS $DISABLE_OUTLINER"])
544 CFLAGS="$_SAVE_CFLAGS"
546 DISABLE_OUTLINER="-Wl,-plugin-opt=-enable-machine-outliner=never"
547 _SAVE_LDFLAGS=$LDFLAGS
548 LDFLAGS="$LDFLAGS $MOZ_LTO_LDFLAGS $DISABLE_OUTLINER"
549 AC_TRY_LINK(,,[MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS $DISABLE_OUTLINER"])
550 LDFLAGS="$_SAVE_LDFLAGS"
556 if test "$GNU_CC" -o "$GNU_CXX"; then
557 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
558 if test -n "$MOZ_DEBUG"; then
559 MOZ_OPTIMIZE_FLAGS="-Os"
561 MOZ_OPTIMIZE_FLAGS="-O2"
563 if test -z "$CLANG_CC"; then
564 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
568 case "${target_cpu}" in
570 CFLAGS="$CFLAGS -mieee"
571 CXXFLAGS="$CXXFLAGS -mieee"
577 # certain versions of cygwin's makedepend barf on the
578 # #include <string> vs -I./dist/include/string issue so don't use it
579 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
580 # $GNU_CC will match gcc and clang; while $CLANG_CC will match only clang
581 if test -z "$CLANG_CC"; then
582 AC_MSG_ERROR(Firefox cannot be built with mingw-gcc and requires a mingw-clang toolchain to work)
586 # mingw doesn't require kernel32, user32, and advapi32 explicitly
587 LIBS="$LIBS -luuid -lusp10 -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
590 MOZ_OPTIMIZE_FLAGS="-O2"
592 WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
593 WIN32_GUI_EXE_LDFLAGS=-mwindows
595 # Silence problematic clang warnings
596 CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
597 LDFLAGS="$LDFLAGS -Wl,--no-insert-timestamp"
599 TARGET_COMPILER_ABI=msvc
600 STRIP='echo not_strip'
601 # aarch64 doesn't support subsystems below 6.02
602 if test "$CPU_ARCH" = "aarch64"; then
603 WIN32_SUBSYSTEM_VERSION=6.02
605 WIN32_SUBSYSTEM_VERSION=6.01
607 WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
608 WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
609 DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
610 _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
611 _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
612 CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
613 CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
614 if test -z "$CLANG_CL"; then
615 CPPFLAGS="$CPPFLAGS -utf-8"
617 if test "$CPU_ARCH" = "x86"; then
618 dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
619 dnl more recent, so set that explicitly here unless another
620 dnl target arch has already been set.
622 if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
623 CFLAGS="$CFLAGS -arch:SSE2"
625 if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
626 CXXFLAGS="$CXXFLAGS -arch:SSE2"
629 SSE_FLAGS="-arch:SSE"
630 SSE2_FLAGS="-arch:SSE2"
631 dnl MSVC allows the use of intrinsics without any flags
632 dnl and doesn't have a separate arch for SSSE3
633 SSSE3_FLAGS="-arch:SSE2"
635 dnl clang-cl requires appropriate flags to enable SSSE3 support
636 dnl on all architectures.
637 if test -n "$CLANG_CL"; then
638 SSSE3_FLAGS="-mssse3"
640 dnl VS2013+ supports -Gw for better linker optimizations.
641 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
642 dnl Disabled on ASan because it causes false-positive ODR violations.
643 if test -z "$MOZ_ASAN"; then
645 CXXFLAGS="$CXXFLAGS -Gw"
647 # String tail merging doesn't play nice with ASan's ODR checker.
648 LDFLAGS="$LDFLAGS -opt:nolldtailmerge"
650 if test -n "$CLANG_CL"; then
651 # XXX We should combine some of these with our generic GCC-style
654 # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
655 CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
656 # We use offsetof on non-POD objects all the time.
657 # We also suppress this warning on other platforms.
658 CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
659 # This warns for reasonable things like:
660 # enum { X = 0xffffffffU };
661 # which is annoying for IDL headers.
662 CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
663 # This warns for cases that would be reached by the Microsoft
664 # #include rules, but also currently warns on cases that would
665 # *also* be reached by standard C++ include rules. That
666 # behavior doesn't seem useful, so we turn it off.
667 CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
668 # We normally error out on unknown pragmas, but since clang-cl
669 # claims to be MSVC, it would be difficult to add
670 # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
671 # use such pragmas, so just ignore them.
672 CFLAGS="$CFLAGS -Wno-unknown-pragmas"
673 CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
674 # We get errors about various #pragma intrinsic directives from
675 # clang-cl, and we don't need to hear about those.
676 CFLAGS="$CFLAGS -Wno-ignored-pragmas"
677 CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
678 # clang-cl's Intrin.h marks things like _ReadWriteBarrier
679 # as __attribute((__deprecated__)). This is nice to know,
680 # but since we don't get the equivalent warning from MSVC,
681 # let's just ignore it.
682 CFLAGS="$CFLAGS -Wno-deprecated-declarations"
683 CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
684 # We use a function like:
685 # __declspec(noreturn) __inline void f() {}
686 # which -Winvalid-noreturn complains about. Again, MSVC seems
687 # OK with it, so let's silence the warning.
688 CFLAGS="$CFLAGS -Wno-invalid-noreturn"
689 CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
690 # Missing |override| on virtual function declarations isn't
691 # something that MSVC currently warns about.
692 CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
693 # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
694 # declaration on |operator delete(void*)|. However, clang-cl
695 # must internally declare |operator delete(void*)| differently,
696 # which causes this warning for virtually every file in the
697 # tree. clang-cl doesn't support -fno-exceptions or equivalent,
698 # so there doesn't seem to be any way to convince clang-cl to
699 # declare |delete| differently. Therefore, suppress this
701 CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
702 # Macros like STDMETHOD() and IFACEMETHOD() can declare
703 # __attribute__((nothrow)) on their respective method declarations,
704 # while the definitions are left without the matching attribute.
705 CXXFLAGS="$CXXFLAGS -Wno-microsoft-exception-spec"
706 # At least one MSVC header and several headers in-tree have
707 # unused typedefs, so turn this on.
708 CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
709 # jemalloc uses __declspec(allocator) as a profiler hint,
710 # which clang-cl doesn't understand.
711 CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
712 # __attribute__((unused)) really means "might be unused" and
713 # we use it to avoid warnings about things that are unused
714 # in some compilation units, but used in many others. This
715 # warning insists on complaining about the latter case, which
716 # is annoying, and rather noisy.
717 CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused"
719 # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
720 CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
721 LIBS="$LIBS user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
722 MOZ_DEBUG_LDFLAGS='-DEBUG'
723 if test "$HOST_OS_ARCH" != "WINNT"; then
724 # %_PDB% is a special signal to emit only the PDB basename. This
725 # avoids problems in Windows tools that don't like forward-slashes.
726 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -PDBALTPATH:%_PDB%"
728 # Use a higher optimization level for clang-cl, so we can come closer
729 # to MSVC's performance numbers (see bug 1443590).
730 if test -n "$CLANG_CL"; then
731 MOZ_OPTIMIZE_FLAGS='-O2'
733 MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
736 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE"
737 dnl Minimum reqiurement of Gecko is VS2015 or later which supports
738 dnl both SSSE3 and SSE4.1.
739 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
740 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
741 dnl allow AVX2 code from VS2015
744 AC_DEFINE(WIN32_LEAN_AND_MEAN)
745 dnl See http://support.microsoft.com/kb/143208 to use STL
748 MOZ_USER_DIR="Mozilla"
752 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.])
758 if test -n "$GNU_CC"; then
759 CFLAGS="$CFLAGS -mstackrealign"
760 CXXFLAGS="$CXXFLAGS -mstackrealign"
761 LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
763 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
764 LDFLAGS="$LDFLAGS -SAFESEH"
770 if test -n "$_WIN32_MSVC"; then
771 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
776 if test -n "$_WIN32_MSVC"; then
777 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:ARM64"
782 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
788 CFLAGS="$CFLAGS -Dunix"
789 CXXFLAGS="$CXXFLAGS -Dunix"
790 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
791 DSO_PIC_CFLAGS='-fPIC -DPIC'
793 MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
795 DSO_PIC_CFLAGS='-fPIC -DPIC'
798 # This will fail on a.out systems prior to 1.5.1_ALPHA.
799 if test "$LIBRUNPATH"; then
800 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
805 if test -z "$X11BASE"; then
808 MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
809 DSO_PIC_CFLAGS='-fPIC'
810 DSO_LDOPTS='-shared -fPIC'
811 if test "$LIBRUNPATH"; then
812 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
817 MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
822 CFLAGS="$CFLAGS $DSO_PIC_CFLAGS"
823 CXXFLAGS="$CXXFLAGS $DSO_PIC_CFLAGS"
825 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
826 MOZ_OPTIMIZE_FLAGS="-O"
829 AC_SUBST_LIST(MMX_FLAGS)
830 AC_SUBST_LIST(SSE_FLAGS)
831 AC_SUBST_LIST(SSE2_FLAGS)
832 AC_SUBST_LIST(SSSE3_FLAGS)
835 if test -n "$MOZ_LINKER"; then
836 AC_DEFINE(MOZ_LINKER)
838 AC_CHECK_PROGS(XZ, xz)
841 if test -z "$COMPILE_ENVIRONMENT"; then
842 SKIP_COMPILER_CHECKS=1
843 SKIP_LIBRARY_CHECKS=1
847 fi # COMPILE_ENVIRONMENT
849 if test -z "$SKIP_COMPILER_CHECKS"; then
850 dnl Checks for typedefs, structures, and compiler characteristics.
851 dnl ========================================================
866 case "${OS_TARGET}" in
870 STL_FLAGS="-I${DIST}/stl_wrappers"
875 if test "$MOZ_BUILD_APP" = "tools/crashreporter"; then
878 if test "$MOZ_BUILD_APP" = "tools/crashreporter/injector"; then
882 dnl Checks for header files.
883 dnl ========================================================
886 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
887 AC_CACHE_CHECK(for sockaddr_in.sin_len,
888 ac_cv_sockaddr_in_sin_len,
889 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
890 #include <sys/types.h>
892 #include <netinet/in.h>
893 struct sockaddr_in x;
894 void *foo = (void*) &x.sin_len;],
896 [ac_cv_sockaddr_in_sin_len=true],
897 [ac_cv_sockaddr_in_sin_len=false])])
898 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
899 AC_DEFINE(HAVE_SIN_LEN)
900 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
901 AC_DEFINE(HAVE_SCONN_LEN)
904 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
905 ac_cv_sockaddr_in6_sin6_len,
906 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
907 #include <sys/types.h>
909 #include <netinet/in.h>
910 struct sockaddr_in6 x;
911 void *foo = (void*) &x.sin6_len;],
913 [ac_cv_sockaddr_in6_sin6_len=true],
914 [ac_cv_sockaddr_in6_sin6_len=false])])
915 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
916 AC_DEFINE(HAVE_SIN6_LEN)
919 AC_CACHE_CHECK(for sockaddr.sa_len,
920 ac_cv_sockaddr_sa_len,
921 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
922 #include <sys/types.h>
924 #include <sys/socket.h>
926 void *foo = (void*) &x.sa_len;],
928 [ac_cv_sockaddr_sa_len=true],
929 [ac_cv_sockaddr_sa_len=false])])
930 if test "$ac_cv_sockaddr_sa_len" = true ; then
931 AC_DEFINE(HAVE_SA_LEN)
934 dnl Checks for libraries.
935 dnl ========================================================
936 AC_CHECK_LIB(c_r, gethostbyname_r)
938 dnl We don't want to link with libdl even if it's present on OS X, since
939 dnl it's not used and not part of the default installation. OS/2 has dlfcn
941 dnl We don't want to link against libm or libpthread on Darwin since
942 dnl they both are just symlinks to libSystem and explicitly linking
943 dnl against libSystem causes issues when debugging (see bug 299601).
948 AC_SEARCH_LIBS(dlopen, dl,
949 MOZ_CHECK_HEADER(dlfcn.h,
950 AC_DEFINE(HAVE_DLOPEN)))
954 _SAVE_CFLAGS="$CFLAGS"
955 CFLAGS="$CFLAGS -D_GNU_SOURCE"
956 AC_CHECK_FUNCS(dladdr memmem)
957 CFLAGS="$_SAVE_CFLAGS"
959 if test ! "$GNU_CXX"; then
960 AC_CHECK_LIB(C, demangle)
963 AC_CHECK_LIB(socket, socket)
965 dnl ========================================================
966 dnl = pthread support
967 dnl = Start by checking whether the system support pthreads
968 dnl ========================================================
974 AC_CHECK_LIB(pthreads, pthread_create,
975 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
976 AC_CHECK_LIB(pthread, pthread_create,
977 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
978 AC_CHECK_LIB(c_r, pthread_create,
979 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
980 AC_CHECK_LIB(c, pthread_create,
989 dnl ========================================================
990 dnl Do the platform specific pthread hackery
991 dnl ========================================================
992 if test "$MOZ_USE_PTHREADS"x != x
995 dnl See if -pthread is supported.
998 ac_cv_have_dash_pthread=no
999 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
1000 echo 'int main() { return 0; }' | cat > conftest.c
1001 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
1002 if test $? -eq 0; then
1003 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1004 ac_cv_have_dash_pthread=yes
1005 case "$target_os" in
1007 # Freebsd doesn't use -pthread for compiles, it uses them for linking
1010 CFLAGS="$CFLAGS -pthread"
1011 CXXFLAGS="$CXXFLAGS -pthread"
1017 AC_MSG_RESULT($ac_cv_have_dash_pthread)
1020 dnl See if -pthreads is supported.
1022 ac_cv_have_dash_pthreads=no
1023 if test "$ac_cv_have_dash_pthread" = "no"; then
1024 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
1025 echo 'int main() { return 0; }' | cat > conftest.c
1026 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
1027 if test $? -eq 0; then
1028 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1029 ac_cv_have_dash_pthreads=yes
1030 CFLAGS="$CFLAGS -pthreads"
1031 CXXFLAGS="$CXXFLAGS -pthreads"
1035 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
1040 AC_DEFINE(_REENTRANT)
1041 AC_DEFINE(_THREAD_SAFE)
1042 dnl -pthread links in -lpthread, so don't specify it explicitly.
1043 if test "$ac_cv_have_dash_pthread" = "yes"; then
1044 _PTHREAD_LDFLAGS="-pthread"
1048 *-*-openbsd*|*-*-bsdi*)
1049 AC_DEFINE(_REENTRANT)
1050 AC_DEFINE(_THREAD_SAFE)
1051 dnl -pthread links in -lc_r, so don't specify it explicitly.
1052 if test "$ac_cv_have_dash_pthread" = "yes"; then
1053 _PTHREAD_LDFLAGS="-pthread"
1057 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
1058 AC_DEFINE(_REENTRANT)
1062 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
1063 AC_SUBST(MOZ_USE_PTHREADS)
1064 MOZ_CHECK_HEADERS(pthread.h)
1068 dnl Checks for library functions.
1069 dnl ========================================================
1070 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)
1072 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1073 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1074 ac_cv_clock_monotonic,
1075 [for libs in "" -lrt; do
1078 dnl clock_gettime is available on OSX since 10.12, so depending on MACOSX_DEPLOYMENT_TARGET,
1079 dnl we should or not be able to use it. To detect if we can, we need to make the
1080 dnl availability attribute strict, so that compilation fails when the target is < 10.12.
1081 AC_TRY_LINK([#define availability(os, ...) availability(os, strict, __VA_ARGS)
1083 [ struct timespec ts;
1084 clock_gettime(CLOCK_MONOTONIC, &ts); ],
1085 ac_cv_clock_monotonic=$libs
1088 ac_cv_clock_monotonic=no)
1091 if test "$ac_cv_clock_monotonic" != "no"; then
1092 HAVE_CLOCK_MONOTONIC=1
1093 REALTIME_LIBS=$ac_cv_clock_monotonic
1094 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1095 AC_SUBST(HAVE_CLOCK_MONOTONIC)
1096 AC_SUBST_LIST(REALTIME_LIBS)
1099 dnl Turn on warnings-as-errors to prevent implicit declaration of
1100 dnl pthread_cond_timedwait_monotonic_np, which can cause this test to
1101 dnl inadvertently pass even if the function does not really exist.
1102 _SAVE_CFLAGS="$CFLAGS"
1103 CFLAGS="$CFLAGS $WARNINGS_AS_ERRORS"
1104 AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
1105 ac_cv_pthread_cond_timedwait_monotonic_np,
1106 AC_TRY_LINK([#include <pthread.h>],
1107 [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
1108 ac_cv_pthread_cond_timewait_monotonic_np=yes,
1109 ac_cv_pthread_cond_timewait_monotonic_np=no))
1110 if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
1111 AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
1113 CFLAGS=$_SAVE_CFLAGS
1117 ac_cv_func_res_ninit,
1118 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
1119 dnl no need for res_ninit() on NetBSD and OpenBSD
1120 ac_cv_func_res_ninit=no
1124 #define _BSD_SOURCE 1
1126 #include <sys/types.h>
1127 #include <netinet/in.h>
1128 #include <arpa/nameser.h>
1131 [int foo = res_ninit(&_res);],
1132 [ac_cv_func_res_ninit=yes],
1133 [ac_cv_func_res_ninit=no])
1137 if test "$ac_cv_func_res_ninit" = "yes"; then
1138 AC_DEFINE(HAVE_RES_NINIT)
1139 dnl must add the link line we do something as foolish as this... dougt
1141 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
1142 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
1147 dnl **********************
1148 dnl *** va_copy checks ***
1149 AC_CACHE_CHECK([for an implementation of va_copy()],
1151 [AC_TRY_COMPILE([#include <stdarg.h>
1153 void f (int i, ...) {
1154 va_list args1, args2;
1155 va_start (args1, i);
1156 va_copy (args2, args1);
1157 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1159 va_end (args1); va_end (args2);
1161 [f(0, 42); return 0],
1162 [ac_cv_va_copy=yes],
1166 AC_CACHE_CHECK([whether va_list can be copied by value],
1168 [AC_TRY_COMPILE([#include <stdarg.h>
1170 void f (int i, ...) {
1171 va_list args1, args2;
1172 va_start (args1, i);
1174 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1176 va_end (args1); va_end (args2);
1178 [f(0, 42); return 0],
1179 [ac_cv_va_val_copy=yes],
1180 [ac_cv_va_val_copy=no],
1183 if test "x$ac_cv_va_copy" = "xyes"; then
1184 AC_DEFINE(VA_COPY, va_copy)
1185 AC_DEFINE(HAVE_VA_COPY)
1188 if test "x$ac_cv_va_val_copy" = "xno"; then
1189 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
1192 dnl ===================================================================
1193 dnl ========================================================
1194 dnl Put your C++ language/feature checks below
1195 dnl ========================================================
1199 if test "$GNU_CC"; then
1200 if test "$CPU_ARCH" = "arm" ; then
1201 AC_CACHE_CHECK(for ARM EABI,
1205 #if defined(__ARM_EABI__)
1208 #error Not ARM EABI.
1211 ac_cv_gcc_arm_eabi="yes",
1212 ac_cv_gcc_arm_eabi="no")])
1213 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
1215 ARM_ABI_PREFIX=eabi-
1217 ARM_ABI_PREFIX=oabi-
1221 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
1224 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
1225 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
1226 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
1228 _SAVE_LDFLAGS=$LDFLAGS
1229 LDFLAGS="$LDFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
1230 AC_CACHE_CHECK(for __thread keyword for TLS variables,
1231 ac_cv_thread_keyword,
1232 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
1233 [return tlsIsMainThread;],
1234 ac_cv_thread_keyword=yes,
1235 ac_cv_thread_keyword=no)])
1236 LDFLAGS=$_SAVE_LDFLAGS
1237 # The custom dynamic linker doesn't support TLS variables
1239 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
1240 # mips builds fail with TLS variables because of a binutils bug.
1242 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
1247 *-android*|*-linuxandroid*)
1254 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
1260 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
1261 if test -n "$MOZ_LINKER"; then
1262 if test "$CPU_ARCH" = arm; then
1263 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
1264 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
1265 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1266 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1270 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
1271 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
1272 dnl Since the linker only understands the sysv ones, no need to build the
1273 dnl gnu style tables anyways.
1274 LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
1277 dnl End of C++ language/feature checks
1280 dnl ========================================================
1281 dnl = Internationalization checks
1282 dnl ========================================================
1284 dnl Internationalization and Locale support is different
1285 dnl on various UNIX platforms. Checks for specific i18n
1286 dnl features go here.
1288 AC_HAVE_FUNCS(localeconv)
1290 fi # ! SKIP_COMPILER_CHECKS
1292 if test -n "${COMPILE_ENVIRONMENT}"; then
1297 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1298 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1299 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1302 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1303 dnl features that Windows actually does support.
1305 if test -n "$SKIP_COMPILER_CHECKS"; then
1306 dnl Windows has malloc.h
1307 AC_DEFINE(MALLOC_H, [<malloc.h>])
1308 AC_DEFINE(HAVE_FORCEINLINE)
1309 AC_DEFINE(HAVE_LOCALECONV)
1310 fi # SKIP_COMPILER_CHECKS
1312 dnl Mozilla specific options
1313 dnl ========================================================
1314 dnl The macros used for command line options
1315 dnl are defined in build/autoconf/altoptions.m4.
1317 dnl ========================================================
1319 dnl = Check for external package dependencies
1321 dnl ========================================================
1322 MOZ_ARG_HEADER(External Packages)
1324 dnl ========================================================
1325 dnl system libevent Support
1326 dnl ========================================================
1327 MOZ_ARG_WITH_STRING(system-libevent,
1328 [ --with-system-libevent[=PFX]
1329 Use system libevent [installed at prefix PFX]],
1330 LIBEVENT_DIR=$withval)
1332 _SAVE_CFLAGS=$CFLAGS
1333 _SAVE_LDFLAGS=$LDFLAGS
1335 if test "$LIBEVENT_DIR" = yes; then
1336 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
1337 MOZ_SYSTEM_LIBEVENT=1,
1340 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
1341 MOZ_SYSTEM_LIBEVENT=
1342 elif test -z "$MOZ_SYSTEM_LIBEVENT"; then
1343 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
1344 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
1345 MOZ_CHECK_HEADER(event.h,
1346 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
1347 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
1349 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
1350 AC_CHECK_LIB(event, event_init,
1351 [MOZ_SYSTEM_LIBEVENT=1
1352 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
1353 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
1354 [MOZ_SYSTEM_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
1356 CFLAGS=$_SAVE_CFLAGS
1357 LDFLAGS=$_SAVE_LDFLAGS
1360 AC_SUBST(MOZ_SYSTEM_LIBEVENT)
1362 if test -z "$SKIP_LIBRARY_CHECKS"; then
1364 dnl ========================================================
1365 dnl system PNG Support
1366 dnl ========================================================
1367 MOZ_ARG_WITH_STRING(system-png,
1368 [ --with-system-png[=PFX]
1369 Use system libpng [installed at prefix PFX]],
1372 _SAVE_CFLAGS=$CFLAGS
1373 _SAVE_LDFLAGS=$LDFLAGS
1375 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
1376 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
1377 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
1379 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
1382 AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"],
1383 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1384 AC_CHECK_LIB(png, png_get_acTL, ,
1385 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
1387 if test "$MOZ_SYSTEM_PNG" = 1; then
1388 AC_TRY_COMPILE([ #include <stdio.h>
1389 #include <sys/types.h>
1391 [ #if PNG_LIBPNG_VER < $MOZPNG
1392 #error "Insufficient libpng version ($MOZPNG required)."
1394 #ifndef PNG_UINT_31_MAX
1395 #error "Insufficient libpng version."
1398 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1400 CFLAGS=$_SAVE_CFLAGS
1401 LDFLAGS=$_SAVE_LDFLAGS
1404 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then
1405 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
1406 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
1409 fi # SKIP_LIBRARY_CHECKS
1411 dnl ========================================================
1415 dnl ========================================================
1417 MOZ_ARG_HEADER(Application)
1419 ENABLE_SYSTEM_EXTENSION_DIRS=1
1420 MOZ_BRANDING_DIRECTORY=
1421 MOZ_OFFICIAL_BRANDING=
1422 MOZ_AUTH_EXTENSION=1
1424 MOZ_UNIVERSALCHARDET=1
1429 MOZ_BINARY_EXTENSIONS=
1432 dnl ========================================================
1433 dnl = Trademarked Branding
1434 dnl ========================================================
1435 MOZ_ARG_ENABLE_BOOL(official-branding,
1436 [ --enable-official-branding
1437 Enable Official mozilla.org Branding
1438 Do not distribute builds with
1439 --enable-official-branding unless you have
1440 permission to use trademarks per
1441 http://www.mozilla.org/foundation/trademarks/ .],
1442 MOZ_OFFICIAL_BRANDING=1,
1443 MOZ_OFFICIAL_BRANDING=)
1445 # Allow the application to influence configure with a confvars.sh script.
1446 AC_MSG_CHECKING([if app-specific confvars.sh exists])
1447 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
1448 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
1449 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
1454 dnl ========================================================
1455 dnl Ensure Android SDK and build-tools versions depending on
1457 dnl ========================================================
1459 case "$MOZ_BUILD_APP" in
1465 dnl ========================================================
1467 dnl = Toolkit Options
1469 dnl ========================================================
1470 MOZ_ARG_HEADER(Toolkit Options)
1472 dnl ========================================================
1473 dnl = Enable the toolkit as needed =
1474 dnl ========================================================
1476 case "$MOZ_WIDGET_TOOLKIT" in
1479 LDFLAGS="$LDFLAGS -framework Cocoa"
1480 # Use -Wl as a trick to avoid -framework and framework names from
1481 # being separated by AC_SUBST_LIST.
1482 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'
1484 CFLAGS="$CFLAGS $TK_CFLAGS"
1485 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1486 MOZ_USER_DIR="Mozilla"
1487 MOZ_FS_LAYOUT=bundle
1491 LDFLAGS="$LDFLAGS -framework UIKit"
1493 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'
1494 CFLAGS="$CFLAGS $TK_CFLAGS"
1495 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1496 MOZ_USER_DIR="Mozilla"
1497 MOZ_FS_LAYOUT=bundle
1502 if test "$OS_TARGET" = Darwin; then
1503 LDFLAGS="$LDFLAGS -lobjc"
1506 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
1507 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
1508 case "$MOZ_WIDGET_TOOLKIT" in
1514 if test "$COMPILE_ENVIRONMENT"; then
1515 if test "$MOZ_WIDGET_TOOLKIT" = gtk; then
1516 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)
1517 MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
1518 TK_CFLAGS=$MOZ_GTK3_CFLAGS
1519 TK_LIBS=$MOZ_GTK3_LIBS
1520 dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
1521 dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
1522 AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
1524 if test "$MOZ_ENABLE_GTK"; then
1525 AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
1526 AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
1528 fi # COMPILE_ENVIRONMENT
1530 AC_SUBST(MOZ_FS_LAYOUT)
1532 AC_SUBST_LIST(TK_CFLAGS)
1533 AC_SUBST_LIST(TK_LIBS)
1535 dnl ========================================================
1537 dnl = Components & Features
1539 dnl ========================================================
1540 MOZ_ARG_HEADER(Components and Features)
1542 AC_SUBST(MOZ_OFFICIAL_BRANDING)
1543 if test -n "$MOZ_OFFICIAL_BRANDING"; then
1544 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
1545 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
1547 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
1548 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
1552 MOZ_ARG_WITH_STRING(branding,
1553 [ --with-branding=dir Use branding from the specified directory.],
1554 MOZ_BRANDING_DIRECTORY=$withval)
1556 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
1557 if test -z "$REAL_BRANDING_DIRECTORY"; then
1558 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
1561 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1562 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
1565 AC_SUBST(MOZ_BRANDING_DIRECTORY)
1567 dnl ========================================================
1568 dnl = Distribution ID
1569 dnl ========================================================
1570 MOZ_ARG_WITH_STRING(distribution-id,
1571 [ --with-distribution-id=ID
1572 Set distribution-specific id (default=org.mozilla)],
1573 [ val=`echo $withval`
1574 MOZ_DISTRIBUTION_ID="$val"])
1576 if test -z "$MOZ_DISTRIBUTION_ID"; then
1577 MOZ_DISTRIBUTION_ID="org.mozilla"
1580 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
1581 AC_SUBST(MOZ_DISTRIBUTION_ID)
1583 dnl ========================================================
1584 dnl = libproxy support
1585 dnl ========================================================
1587 if test "$MOZ_ENABLE_GTK"
1589 MOZ_ENABLE_LIBPROXY=
1591 MOZ_ARG_ENABLE_BOOL(libproxy,
1592 [ --enable-libproxy Enable libproxy support ],
1593 MOZ_ENABLE_LIBPROXY=1,
1594 MOZ_ENABLE_LIBPROXY=)
1596 if test "$MOZ_ENABLE_LIBPROXY"
1598 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
1599 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
1602 AC_SUBST(MOZ_ENABLE_LIBPROXY)
1604 dnl ========================================================
1606 dnl ========================================================
1608 if test "$MOZ_ENABLE_GTK"
1612 MOZ_ARG_DISABLE_BOOL(dbus,
1613 [ --disable-dbus Disable dbus support ],
1617 if test "$MOZ_ENABLE_DBUS"
1619 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
1620 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
1621 AC_DEFINE(MOZ_ENABLE_DBUS)
1624 AC_SUBST(MOZ_ENABLE_DBUS)
1626 AC_TRY_COMPILE([#include <linux/ethtool.h>],
1627 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
1628 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
1630 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
1632 dnl ========================================================
1633 dnl = Apple platform decoder support
1634 dnl ========================================================
1635 if test "$COMPILE_ENVIRONMENT"; then
1636 if test -n "$MOZ_APPLEMEDIA"; then
1637 # hack in frameworks for fmp4 - see bug 1029974
1638 # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
1639 LDFLAGS="$LDFLAGS -framework AudioToolbox"
1640 dnl Verify CoreMedia is available.
1641 AC_CHECK_HEADERS([CoreMedia/CoreMedia.h VideoToolbox/VideoToolbox.h], [],
1642 [AC_MSG_ERROR([MacOS X 10.9 SDK or later is required])])
1644 fi # COMPILE_ENVIRONMENT
1646 dnl ========================================================
1647 dnl = Handle dependent MEDIA defines
1648 dnl ========================================================
1651 AC_DEFINE(MOZ_WEBM_ENCODER)
1652 AC_SUBST(MOZ_WEBM_ENCODER)
1654 dnl ========================================================
1656 dnl ========================================================
1658 MOZ_ARG_DISABLE_BOOL(negotiateauth,
1659 [ --disable-negotiateauth Disable GSS-API negotiation ],
1660 MOZ_AUTH_EXTENSION=,
1661 MOZ_AUTH_EXTENSION=1 )
1663 dnl ========================================================
1664 dnl Searching of system directories for extensions.
1665 dnl Note: this switch is meant to be used for test builds
1666 dnl whose behavior should not depend on what happens to be
1667 dnl installed on the local machine.
1668 dnl ========================================================
1669 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
1670 [ --disable-system-extension-dirs
1671 Disable searching system- and account-global
1672 directories for extensions of any kind; use
1673 only profile-specific extension directories],
1674 ENABLE_SYSTEM_EXTENSION_DIRS=,
1675 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
1676 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
1677 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
1680 dnl ========================================================
1681 dnl = Universalchardet
1682 dnl ========================================================
1683 MOZ_ARG_DISABLE_BOOL(universalchardet,
1684 [ --disable-universalchardet
1685 Disable universal encoding detection],
1686 MOZ_UNIVERSALCHARDET=,
1687 MOZ_UNIVERSALCHARDET=1 )
1689 dnl ========================================================
1691 dnl ========================================================
1693 if test "$COMPILE_ENVIRONMENT" ; then
1695 dnl Moved gamepad platform check to moz.build, linux header check still needed here.
1696 if test "$OS_TARGET" = "Linux"; then
1697 MOZ_CHECK_HEADER([linux/joystick.h])
1698 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
1699 AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
1703 fi # COMPILE_ENVIRONMENT
1706 dnl ========================================================
1707 dnl = Breakpad crash reporting (on by default on supported platforms)
1708 dnl ========================================================
1711 i?86-*-mingw*|x86_64-*-mingw*|aarch64-*-mingw*)
1714 i?86-apple-darwin*|x86_64-apple-darwin*|aarch64-apple-darwin*)
1717 *-android*|*-linuxandroid*)
1718 dnl Android/arm is arm-unknown-linux-androideabi, so android condition should
1719 dnl be before Linux condition
1720 dnl The crash reporter prevents crash stacktraces to be logged in the
1721 dnl logs so we leave it out by default in developer builds.
1722 if test -z "$DEVELOPER_OPTIONS"; then
1726 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
1727 if test "$MOZ_ENABLE_GTK"; then
1733 MOZ_ARG_DISABLE_BOOL(crashreporter,
1734 [ --disable-crashreporter Disable breakpad crash reporting],
1735 [MOZ_CRASHREPORTER=],
1736 [MOZ_CRASHREPORTER=F # Force enable breakpad])
1738 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin" -a "$MOZ_WIDGET_TOOLKIT" != "android"; then
1739 if test "$MOZ_CRASHREPORTER" = F; then
1740 AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
1745 if test -n "$MOZ_CRASHREPORTER"; then
1746 AC_DEFINE(MOZ_CRASHREPORTER)
1748 if test "$OS_TARGET" = "Linux" && \
1749 test -z "$SKIP_LIBRARY_CHECKS"; then
1750 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
1753 if test "$OS_ARCH" = "WINNT"; then
1754 if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
1755 MOZ_CRASHREPORTER_INJECTOR=1
1756 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
1761 dnl ========================================================
1762 dnl = Enable compilation of specific extension modules
1763 dnl ========================================================
1765 MOZ_ARG_ENABLE_STRING(extensions,
1766 [ --enable-extensions Enable extensions],
1767 [ for option in `echo $enableval | sed 's/,/ /g'`; do
1768 if test "$option" = "yes" -o "$option" = "all"; then
1769 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
1770 elif test "$option" = "no" -o "$option" = "none"; then
1772 elif test "$option" = "default"; then
1773 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
1774 elif test `echo "$option" | grep -c \^-` != 0; then
1775 option=`echo $option | sed 's/^-//'`
1776 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
1778 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
1781 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
1783 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
1784 dnl when trying to build a nonexistent extension.
1785 for extension in $MOZ_EXTENSIONS; do
1786 if test ! -d "${srcdir}/extensions/${extension}"; then
1787 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
1791 # Avoid defining MOZ_ENABLE_CAIRO_FT on Windows platforms because
1792 # "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
1793 if test -n "$MOZ_TREE_FREETYPE" -a "$OS_TARGET" != WINNT; then
1794 MOZ_ENABLE_CAIRO_FT=1
1795 CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
1796 AC_SUBST_LIST(CAIRO_FT_CFLAGS)
1799 dnl ========================================================
1801 dnl ========================================================
1803 MOZ_ARG_DISABLE_BOOL(updater,
1804 [ --disable-updater Disable building of updater],
1808 if test -n "$MOZ_UPDATER"; then
1809 AC_DEFINE(MOZ_UPDATER)
1812 dnl ========================================================
1813 dnl parental controls (for Windows Vista)
1814 dnl ========================================================
1815 MOZ_ARG_DISABLE_BOOL(parental-controls,
1816 [ --disable-parental-controls
1817 Do not build parental controls],
1818 MOZ_DISABLE_PARENTAL_CONTROLS=1,
1819 MOZ_DISABLE_PARENTAL_CONTROLS=)
1820 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
1821 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
1824 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
1826 dnl ========================================================
1827 dnl = Disable smartcard support
1828 dnl ========================================================
1829 if test -n "$MOZ_NO_SMART_CARDS"; then
1830 AC_DEFINE(MOZ_NO_SMART_CARDS)
1832 AC_SUBST(MOZ_NO_SMART_CARDS)
1834 dnl ========================================================
1835 dnl = Sandboxing support
1836 dnl ========================================================
1837 if test -n "$MOZ_TSAN" -o -n "$MOZ_ASAN"; then
1838 # Bug 1182565: TSan conflicts with sandboxing on Linux.
1839 # Bug 1287971: LSan also conflicts with sandboxing on Linux.
1847 MOZ_ARG_DISABLE_BOOL(sandbox,
1848 [ --disable-sandbox Disable sandboxing support],
1852 case "$OS_TARGET" in
1853 WINNT|Darwin|OpenBSD)
1857 x86_64|x86|arm|aarch64)
1859 # Linux sandbox is only available on x86{,_64} and arm{,64}.
1866 # Only enable the sandbox by default on Linux, OpenBSD, macOS, and Windows
1871 if test -n "$MOZ_SANDBOX"; then
1872 AC_DEFINE(MOZ_SANDBOX)
1875 AC_SUBST(MOZ_SANDBOX)
1878 dnl ========================================================
1880 dnl = Module specific options
1882 dnl ========================================================
1883 MOZ_ARG_HEADER(Individual module options)
1885 dnl ==============================
1886 dnl === SQLite fdatasync check ===
1887 dnl ==============================
1888 dnl Check to see if fdatasync is available and make use of it
1889 AC_CHECK_FUNC(fdatasync)
1891 dnl ========================================================
1892 dnl = Disable zipwriter
1893 dnl ========================================================
1894 MOZ_ARG_DISABLE_BOOL(zipwriter,
1895 [ --disable-zipwriter Disable zipwriter component],
1898 AC_SUBST(MOZ_ZIPWRITER)
1900 dnl ========================================================
1902 dnl = Feature options that require extra sources to be pulled
1904 dnl ========================================================
1905 dnl MOZ_ARG_HEADER(Features that require extra sources)
1907 dnl ========================================================
1909 dnl = Runtime debugging and Optimization Options
1911 dnl ========================================================
1912 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
1914 dnl ========================================================
1915 dnl = Enable code optimization. ON by default.
1916 dnl ========================================================
1918 # Use value from moz.configure if one is defined. Else use our computed
1920 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
1921 MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
1924 if test "$COMPILE_ENVIRONMENT"; then
1925 if test -n "$MOZ_OPTIMIZE"; then
1926 AC_MSG_CHECKING([for valid C compiler optimization flags])
1927 _SAVE_CFLAGS=$CFLAGS
1928 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
1929 AC_TRY_COMPILE([#include <stdio.h>],
1930 [printf("Hello World\n");],
1933 AC_MSG_RESULT([$_results])
1934 if test "$_results" = "no"; then
1935 AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
1937 CFLAGS=$_SAVE_CFLAGS
1938 if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
1939 # When using llvm-based LTO, non numeric optimization levels are
1940 # not supported by the linker, so force the linker to use -O2 (
1941 # which doesn't influence the level compilation units are actually
1943 case " $MOZ_OPTIMIZE_FLAGS " in
1944 *\ -Os\ *|*\ -Oz\ *)
1945 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
1950 fi # COMPILE_ENVIRONMENT
1952 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
1953 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
1954 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
1956 dnl ========================================================
1957 dnl = Enable runtime logging
1958 dnl ========================================================
1959 AC_DEFINE(MOZ_LOGGING)
1960 AC_DEFINE(FORCE_PR_LOG)
1962 dnl ========================================================
1963 dnl = This will enable logging of addref, release, ctor, dtor.
1964 dnl ========================================================
1965 _ENABLE_LOGREFCNT=42
1966 MOZ_ARG_ENABLE_BOOL(logrefcnt,
1967 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
1968 _ENABLE_LOGREFCNT=1,
1969 _ENABLE_LOGREFCNT= )
1970 if test "$_ENABLE_LOGREFCNT" = "1"; then
1971 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
1972 elif test -z "$_ENABLE_LOGREFCNT"; then
1973 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
1976 dnl ========================================================
1977 dnl moz_dump_painting
1978 dnl ========================================================
1979 MOZ_ARG_ENABLE_BOOL(dump-painting,
1980 [ --enable-dump-painting Enable paint debugging.],
1981 MOZ_DUMP_PAINTING=1,
1982 MOZ_DUMP_PAINTING= )
1983 if test -n "$MOZ_DUMP_PAINTING"; then
1984 AC_DEFINE(MOZ_DUMP_PAINTING)
1985 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
1987 if test -n "$MOZ_DEBUG"; then
1988 AC_DEFINE(MOZ_DUMP_PAINTING)
1991 case "${OS_TARGET}" in
1992 Android|WINNT|Darwin)
1993 MOZ_GLUE_IN_PROGRAM=
1996 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
1997 MOZ_GLUE_IN_PROGRAM=1
1998 AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
2002 dnl ========================================================
2003 dnl = Jemalloc build setup
2004 dnl ========================================================
2005 if test -z "$MOZ_MEMORY"; then
2008 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
2009 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.])
2014 dnl The generic feature tests that determine how to compute ncpus are long and
2015 dnl complicated. Therefore, simply define special cpp variables for the
2016 dnl platforms we have special knowledge of.
2019 export MOZ_NO_DEBUG_RTL=1
2023 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
2025 dnl ========================================================
2026 dnl = Enable using the clang plugin to build
2027 dnl ========================================================
2029 if test -n "$COMPILE_ENVIRONMENT"; then
2030 MOZ_CONFIG_CLANG_PLUGIN
2031 fi # COMPILE_ENVIRONMENT
2033 dnl ========================================================
2034 dnl = frontend JS debug mode
2035 dnl ========================================================
2037 MOZ_ARG_ENABLE_BOOL(debug-js-modules,
2038 [ --enable-debug-js-modules Enable debug mode for frontend JS libraries],
2042 AC_SUBST(DEBUG_JS_MODULES)
2044 dnl ========================================================
2046 dnl = Profiling and Instrumenting
2048 dnl ========================================================
2049 MOZ_ARG_HEADER(Profiling and Instrumenting)
2051 dnl ========================================================
2052 dnl = Support for demangling undefined symbols
2053 dnl ========================================================
2054 if test -z "$SKIP_LIBRARY_CHECKS"; then
2057 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
2061 # Demangle only for debug or DMD builds
2062 MOZ_DEMANGLE_SYMBOLS=
2063 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
2064 MOZ_DEMANGLE_SYMBOLS=1
2065 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
2067 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
2069 dnl ========================================================
2070 dnl = Support for gcc stack unwinding (from gcc 3.3)
2071 dnl ========================================================
2072 if test -z "$SKIP_LIBRARY_CHECKS"; then
2075 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
2079 dnl ========================================================
2083 dnl ========================================================
2084 MOZ_ARG_HEADER(Misc. Options)
2086 dnl ========================================================
2087 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
2088 dnl ========================================================
2089 MOZ_ARG_WITH_STRING(user-appdir,
2090 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
2091 [ val=`echo $withval`
2092 if echo "$val" | grep "\/" >/dev/null; then
2093 AC_MSG_ERROR("Homedir must be single relative path.")
2098 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
2100 if test -z "$SKIP_COMPILER_CHECKS"; then
2101 dnl ========================================================
2103 dnl = Compiler Options
2105 dnl ========================================================
2106 MOZ_ARG_HEADER(Compiler Options)
2108 dnl ========================================================
2109 dnl Check for gcc -pipe support
2110 dnl ========================================================
2111 AC_MSG_CHECKING([for -pipe support])
2112 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
2113 dnl Any gcc that supports firefox supports -pipe.
2114 CFLAGS="$CFLAGS -pipe"
2115 CXXFLAGS="$CXXFLAGS -pipe"
2116 AC_MSG_RESULT([yes])
2121 fi # ! SKIP_COMPILER_CHECKS
2125 if test "$COMPILE_ENVIRONMENT"; then
2127 fi # COMPILE_ENVIRONMENT
2129 dnl ========================================================
2131 dnl = Static Build Options
2133 dnl ========================================================
2134 MOZ_ARG_HEADER(Static build options)
2136 if test -z "$MOZ_SYSTEM_ZLIB"; then
2137 if test -n "$JS_SHARED_LIBRARY" -o -n "$MOZ_LINKER" -o "$MOZ_WIDGET_TOOLKIT" = android; then
2139 AC_DEFINE(ZLIB_IN_MOZGLUE)
2143 AC_SUBST(ZLIB_IN_MOZGLUE)
2145 dnl ========================================================
2147 dnl = Standalone module options
2149 dnl ========================================================
2150 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
2153 dnl ========================================================
2155 if test -z "$SKIP_PATH_CHECKS"; then
2156 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
2157 if test "$MOZ_ENABLE_GTK" ; then
2158 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
2163 if test -z "${GLIB_GMODULE_LIBS}" \
2164 -a -n "${GLIB_CONFIG}"\
2165 -a "${GLIB_CONFIG}" != no\
2167 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
2170 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
2172 if test "$USE_FC_FREETYPE"; then
2173 if test "$COMPILE_ENVIRONMENT"; then
2174 dnl ========================================================
2175 dnl = Check for freetype2 functionality
2176 dnl ========================================================
2177 if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
2179 _SAVE_CFLAGS="$CFLAGS"
2180 LIBS="$LIBS $FT2_LIBS"
2181 CFLAGS="$CFLAGS $FT2_CFLAGS"
2183 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
2184 ac_cv_member_FT_Bitmap_Size_y_ppem,
2185 [AC_TRY_COMPILE([#include <ft2build.h>
2186 #include FT_FREETYPE_H],
2188 if (sizeof s.y_ppem) return 0;
2190 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
2191 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
2192 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
2193 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
2195 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
2197 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
2198 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
2199 [FT_Bitmap_Size structure includes y_ppem field])
2201 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
2204 CFLAGS="$_SAVE_CFLAGS"
2207 _SAVE_CPPFLAGS="$CPPFLAGS"
2208 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS"
2209 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
2210 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
2211 CPPFLAGS="$_SAVE_CPPFLAGS"
2215 dnl ========================================================
2216 dnl Check if we need the 32-bit Linux SSE2 error dialog
2217 dnl ========================================================
2219 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
2221 dnl ========================================================
2222 dnl Check for pixman and cairo
2223 dnl ========================================================
2226 MOZ_ARG_ENABLE_BOOL(system-pixman,
2227 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
2229 MOZ_TREE_PIXMAN=force,
2232 if test "$MOZ_TREE_PIXMAN"; then
2233 AC_DEFINE(MOZ_TREE_PIXMAN)
2235 PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.36.0)
2238 if test "$OS_ARCH" = "WINNT"; then
2239 # For now we assume that we will have a uint64_t available through
2240 # one of the above headers or mozstdint.h.
2241 AC_DEFINE(HAVE_UINT64_T)
2244 if test "$_HAVE_FREETYPE2"; then
2245 MOZ_ENABLE_CAIRO_FT=1
2246 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
2249 case "$MOZ_WIDGET_TOOLKIT" in
2251 if test "$COMPILE_ENVIRONMENT"; then
2252 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
2256 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
2257 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
2259 AC_SUBST(MOZ_TREE_PIXMAN)
2261 dnl ========================================================
2263 dnl ========================================================
2264 MOZ_ARG_DISABLE_BOOL(xul,
2265 [ --disable-xul Disable XUL],
2267 if test "$MOZ_XUL"; then
2270 dnl remove extensions that require XUL
2271 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
2276 dnl ========================================================
2277 dnl necko configuration options
2278 dnl ========================================================
2281 dnl option to disable necko's wifi scanner
2284 if test "$MOZ_WIDGET_TOOLKIT"; then
2286 case "$OS_TARGET" in
2290 DragonFly|FreeBSD|WINNT)
2301 MOZ_ARG_DISABLE_BOOL(necko-wifi,
2302 [ --disable-necko-wifi Disable necko wifi scanner],
2306 if test "$NECKO_WIFI"; then
2307 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
2308 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
2310 AC_DEFINE(NECKO_WIFI)
2312 AC_SUBST(NECKO_WIFI)
2313 AC_SUBST(NECKO_WIFI_DBUS)
2315 dnl ========================================================
2317 dnl = Maintainer debug option (no --enable equivalent)
2319 dnl ========================================================
2321 AC_SUBST_LIST(ASFLAGS)
2324 AC_SUBST(MOZ_AUTH_EXTENSION)
2325 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
2326 AC_SUBST_LIST(WARNINGS_CFLAGS)
2327 AC_SUBST_SET(MOZ_EXTENSIONS)
2329 AC_SUBST(MOZ_UNIVERSALCHARDET)
2330 AC_SUBST(MOZ_SPELLCHECK)
2331 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
2332 AC_SUBST(MOZ_CRASHREPORTER)
2333 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
2334 AC_SUBST(MOZ_STUB_INSTALLER)
2335 AC_SUBST(MOZ_UPDATER)
2337 AC_SUBST(INCREMENTAL_LINKER)
2339 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
2341 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
2342 AC_SUBST(MOZ_LINKER_EXTRACT)
2344 if test -n "$MOZ_BINARY_EXTENSIONS"; then
2345 AC_DEFINE(MOZ_BINARY_EXTENSIONS)
2348 dnl ========================================================
2349 dnl = Mac bundle name prefix
2350 dnl ========================================================
2351 MOZ_ARG_WITH_STRING(macbundlename-prefix,
2352 [ --with-macbundlename-prefix=prefix
2353 Prefix for MOZ_MACBUNDLE_NAME],
2354 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
2356 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
2357 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
2358 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
2361 if test "$MOZ_DEBUG"; then
2362 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
2364 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
2366 AC_SUBST(MOZ_MACBUNDLE_NAME)
2368 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
2369 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
2370 # Otherwise, use MOZ_APP_DISPLAYNAME
2371 if test -z "$MOZ_MACBUNDLE_ID"; then
2372 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
2374 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
2375 if test "$MOZ_DEBUG"; then
2376 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
2379 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
2380 AC_SUBST(MOZ_MACBUNDLE_ID)
2382 dnl ========================================================
2383 dnl = Child Process Name for IPC
2384 dnl ========================================================
2385 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
2386 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
2388 # We want to let Android unpack the file at install time, but it only does
2389 # so if the file is named libsomething.so. The lib/ path is also required
2390 # because the unpacked file will be under the lib/ subdirectory and will
2391 # need to be executed from that path.
2392 MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
2394 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
2395 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
2397 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
2398 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
2399 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
2401 # The following variables are available to branding and application
2402 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
2403 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
2404 # impacts profile location and user-visible fields.
2405 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
2406 # Mac Bundle name, Updater, Installer), it is typically used for nightly
2407 # builds (e.g. Aurora for Firefox).
2408 # - MOZ_APP_PROFILE: When set, used for application.ini's
2409 # "Profile" field, which controls profile location.
2410 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
2411 # crash reporter server url.
2412 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
2414 # The following environment variables used to have an effect, but don't anymore:
2415 # - MOZ_APP_VERSION: Defines the application version number. This was replaced with
2416 # the contents from the version.txt file in the application directory, or
2417 # browser/config/version.txt if there isn't one.
2418 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
2419 # in the "About" window. This was replaced with the contents from the
2420 # version_display.txt or version.txt in the application directory, or
2421 # browser/config/version_display.txt.
2423 # For extensions and langpacks, we require a max version that is compatible
2424 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
2425 # 24.0a1 and 24.0a2 aren't affected
2427 # 24.1.1 becomes 24.*
2428 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
2429 if test -z "$IS_ALPHA"; then
2431 if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
2432 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
2434 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
2438 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
2441 AC_SUBST(MOZ_APP_DISPLAYNAME)
2442 AC_SUBST(MOZ_APP_VENDOR)
2443 AC_SUBST(MOZ_APP_PROFILE)
2444 AC_SUBST(MOZ_APP_ID)
2445 AC_SUBST(MAR_CHANNEL_ID)
2446 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
2447 AC_SUBST(MOZ_PROFILE_MIGRATOR)
2448 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
2449 AC_SUBST(MOZ_APP_UA_NAME)
2450 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
2451 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
2452 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
2454 AC_SUBST(MOZ_APP_MAXVERSION)
2455 AC_SUBST(MOZ_PKG_SPECIAL)
2456 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
2458 if test "$MOZILLA_OFFICIAL"; then
2459 # Build revisions should always be present in official builds
2460 MOZ_INCLUDE_SOURCE_INFO=1
2463 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
2464 # explicitly set the repository and changeset information in.
2465 AC_SUBST(MOZ_SOURCE_REPO)
2466 AC_SUBST(MOZ_SOURCE_CHANGESET)
2467 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
2469 dnl If we have any service that uploads data (and requires data submission
2470 dnl policy alert), set MOZ_DATA_REPORTING.
2471 dnl We need SUBST for build system and DEFINE for xul preprocessor.
2472 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER" || test -n "$MOZ_NORMANDY"; then
2473 MOZ_DATA_REPORTING=1
2474 AC_DEFINE(MOZ_DATA_REPORTING)
2475 AC_SUBST(MOZ_DATA_REPORTING)
2479 AC_SUBST(WIN32_REDIST_DIR)
2480 AC_SUBST(WIN_UCRT_REDIST_DIR)
2482 dnl Echo the CFLAGS to remove extra whitespace.
2484 $_COMPILATION_CFLAGS \
2488 $_WARNINGS_CXXFLAGS \
2489 $_COMPILATION_CXXFLAGS \
2492 COMPILE_CFLAGS=`echo \
2496 COMPILE_CXXFLAGS=`echo \
2497 $_DEFINES_CXXFLAGS \
2501 $_WARNINGS_HOST_CFLAGS \
2502 $_COMPILATION_HOST_CFLAGS \
2505 HOST_CXXFLAGS=`echo \
2506 $_WARNINGS_HOST_CXXFLAGS \
2507 $_COMPILATION_HOST_CXXFLAGS \
2510 AC_SUBST(MOZ_SYSTEM_PNG)
2512 AC_SUBST_LIST(MOZ_PNG_CFLAGS)
2513 AC_SUBST_LIST(MOZ_PNG_LIBS)
2515 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
2516 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
2517 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
2518 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
2519 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
2520 OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
2521 OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
2523 AC_SUBST(HOST_CMFLAGS)
2524 AC_SUBST(HOST_CMMFLAGS)
2525 AC_SUBST(OS_COMPILE_CMFLAGS)
2526 AC_SUBST(OS_COMPILE_CMMFLAGS)
2529 OS_CXXFLAGS="$CXXFLAGS"
2530 OS_CPPFLAGS="$CPPFLAGS"
2531 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
2532 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
2533 OS_LDFLAGS="$LDFLAGS"
2535 AC_SUBST_LIST(OS_CFLAGS)
2536 AC_SUBST_LIST(OS_CXXFLAGS)
2537 AC_SUBST_LIST(OS_CPPFLAGS)
2538 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
2539 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
2540 AC_SUBST_LIST(OS_LDFLAGS)
2545 AC_SUBST_LIST(HOST_CFLAGS)
2546 AC_SUBST_LIST(HOST_CPPFLAGS)
2547 AC_SUBST_LIST(HOST_CXXFLAGS)
2548 AC_SUBST(HOST_LDFLAGS)
2549 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
2550 AC_SUBST(HOST_BIN_SUFFIX)
2552 AC_SUBST(TARGET_XPCOM_ABI)
2553 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
2554 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
2555 AC_SUBST(HAVE_X86_AVX2)
2556 AC_SUBST(HAVE_ALTIVEC)
2558 AC_SUBST(DSO_LDOPTS)
2559 AC_SUBST(BIN_SUFFIX)
2561 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
2562 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
2564 AC_SUBST(MOZ_DEVTOOLS)
2566 AC_SUBST(MOZ_PACKAGE_JSSHELL)
2570 dnl Host JavaScript runtime, if any, to use during cross compiles.
2573 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
2575 if test -n "$COMPILE_ENVIRONMENT"; then
2576 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
2577 fi # COMPILE_ENVIRONMENT
2579 dnl Set various defines and substitutions
2580 dnl ========================================================
2582 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
2583 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
2584 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
2585 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
2586 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
2587 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
2588 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
2589 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
2590 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
2593 AC_SUBST(MOZ_DEV_EDITION)
2594 if test -n "$MOZ_DEV_EDITION"; then
2595 AC_DEFINE(MOZ_DEV_EDITION)
2598 if test "$MOZ_DEBUG" -o "$DEVELOPER_OPTIONS"; then
2602 if test -n "$A11Y_LOG"; then
2606 dnl Windows AccessibilityHandler
2607 dnl ========================================================
2609 if test -z "$MOZ_HANDLER_CLSID"; then
2610 MOZ_HANDLER_CLSID="4a195748-dca2-45fb-9295-0a139e76a9e7"
2611 MOZ_IHANDLERCONTROL_IID="3316ce35-f892-4832-97c5-06c52c03cdba"
2612 MOZ_ASYNCIHANDLERCONTROL_IID="15b48b76-ad38-4ad3-bd1a-d3c48a5a9947"
2613 MOZ_IGECKOBACKCHANNEL_IID="dd2e4a89-999e-4d65-8b65-440c923ddb61"
2616 AC_SUBST(MOZ_HANDLER_CLSID)
2617 AC_SUBST(MOZ_IHANDLERCONTROL_IID)
2618 AC_SUBST(MOZ_ASYNCIHANDLERCONTROL_IID)
2619 AC_SUBST(MOZ_IGECKOBACKCHANNEL_IID)
2621 dnl Spit out some output
2622 dnl ========================================================
2624 # Avoid using obsolete NSPR features
2625 AC_DEFINE(NO_NSPR_10_SUPPORT)
2627 MOZ_CREATE_CONFIG_STATUS()
2629 rm -fr confdefs* $ac_clean_files