1 dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
2 dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
3 dnl This Source Code Form is subject to the terms of the Mozilla Public
4 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
5 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 dnl Process this file with autoconf to produce a configure script.
8 dnl ========================================================
10 AC_INIT(config/config.mk)
11 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
14 dnl ========================================================
16 dnl = Don't change the following lines. Doing so breaks:
18 dnl = CFLAGS="-foo" ./configure
20 dnl ========================================================
22 CPPFLAGS="${CPPFLAGS=}"
23 CXXFLAGS="${CXXFLAGS=}"
25 HOST_CFLAGS="${HOST_CFLAGS=}"
26 HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
27 HOST_LDFLAGS="${HOST_LDFLAGS=}"
29 dnl ========================================================
30 dnl = Preserve certain environment flags passed to configure
31 dnl = We want sub projects to receive the same flags
32 dnl = untainted by this configure script
33 dnl ========================================================
36 _SUBDIR_CFLAGS="$CFLAGS"
37 _SUBDIR_CPPFLAGS="$CPPFLAGS"
38 _SUBDIR_CXXFLAGS="$CXXFLAGS"
39 _SUBDIR_LDFLAGS="$LDFLAGS"
40 _SUBDIR_HOST_CC="$HOST_CC"
41 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
42 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
43 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
44 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
46 dnl Set the version number of the libs included with mozilla
47 dnl ========================================================
50 dnl Set the minimum version of toolkit libs used by mozilla
51 dnl ========================================================
53 GLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_42
54 GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_42
58 GDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_14
62 dnl Set various checks
63 dnl ========================================================
66 dnl Initialize the Pthread test variables early so they can be
67 dnl overridden by each platform.
68 dnl ========================================================
72 LDFLAGS="$LDFLAGS $LINKER_LDFLAGS"
74 if test "$COMPILE_ENVIRONMENT"; then
76 fi # COMPILE_ENVIRONMENT
79 *-android*|*-linuxandroid*)
82 AC_PATH_PROG(OBJCOPY,objcopy)
88 dnl ========================================================
89 dnl Checks for compilers.
90 dnl ========================================================
92 if test "$COMPILE_ENVIRONMENT"; then
94 if test "$target" != "$host"; then
100 # Work around the conftest.exe access problem on Windows
105 MOZ_PATH_PROGS(AS, $AS as, $CC)
106 AC_CHECK_PROGS(STRIP, strip, :)
107 AC_CHECK_PROGS(OTOOL, otool, :)
112 dnl ========================================================
113 dnl Special win32 checks
114 dnl ========================================================
120 if test "$GCC" != "yes"; then
121 # Check to see if we are really running in a msvc environemnt
124 # Make sure compilers are valid
125 CXXFLAGS="$CXXFLAGS -TP"
128 AC_TRY_COMPILE([#include <stdio.h>],
129 [ printf("Hello World\n"); ],,
130 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
133 AC_TRY_COMPILE([#include <new.h>],
134 [ unsigned *test = new unsigned(42); ],,
135 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
139 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
142 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
143 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
144 AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
147 MSVC_C_RUNTIME_DLL=vcruntime140.dll
148 MSVC_CXX_RUNTIME_DLL=msvcp140.dll
150 # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
151 CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
153 if test -n "$WIN_UCRT_REDIST_DIR"; then
154 if test ! -d "$WIN_UCRT_REDIST_DIR"; then
155 AC_MSG_ERROR([Invalid Windows UCRT Redist directory: ${WIN_UCRT_REDIST_DIR}])
157 WIN_UCRT_REDIST_DIR=`cd "$WIN_UCRT_REDIST_DIR" && (pwd -W 2>/dev/null || pwd)`
160 AC_SUBST(MSVC_C_RUNTIME_DLL)
161 AC_SUBST(MSVC_CXX_RUNTIME_DLL)
163 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
165 if test -n "$WIN32_REDIST_DIR"; then
166 if test ! -d "$WIN32_REDIST_DIR"; then
167 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
169 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && (pwd -W 2>/dev/null || pwd)`
172 # Check linker version, except in lld builds
177 _LD_FULL_VERSION=`"${LINKER}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
178 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
179 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
180 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
187 unset _MSVC_VER_FILTER
190 STL_FLAGS="-I${DIST}/stl_wrappers"
192 # Check w32api version
193 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
194 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
195 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
196 AC_TRY_COMPILE([#include <w32api.h>],
197 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
198 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
199 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
200 #error "test failed."
202 , [ res=yes ], [ res=no ])
203 AC_MSG_RESULT([$res])
204 if test "$res" != "yes"; then
205 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
207 # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
208 # causing problems with local implementations with the same name.
209 AC_DEFINE(STRSAFE_NO_DEPRECATE)
212 CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
213 CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
215 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
216 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
217 # Require OS features provided by IE 8.0 (Win7)
218 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0800)
223 if test -n "$_WIN32_MSVC"; then
225 SKIP_COMPILER_CHECKS=1
226 SKIP_LIBRARY_CHECKS=1
228 # Since we're skipping compiler and library checks, hard-code
231 AC_DEFINE(HAVE_ISATTY)
234 fi # COMPILE_ENVIRONMENT
239 AC_SUBST_LIST(STL_FLAGS)
240 AC_SUBST(WRAP_STL_INCLUDES)
242 dnl ========================================================
243 dnl Checks for programs.
244 dnl ========================================================
245 if test "$COMPILE_ENVIRONMENT"; then
251 fi # COMPILE_ENVIRONMENT
253 dnl ========================================================
254 dnl set the defaults first
255 dnl ========================================================
256 MOZ_USER_DIR=".mozilla"
258 MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
262 dnl Configure platform-specific CPU architecture compiler options.
263 dnl ==============================================================
264 if test "$COMPILE_ENVIRONMENT"; then
266 fi # COMPILE_ENVIRONMENT
268 dnl ========================================================
269 dnl Android libstdc++
270 dnl ========================================================
273 if test "$COMPILE_ENVIRONMENT"; then
275 fi # COMPILE_ENVIRONMENT
277 dnl ========================================================
278 dnl Suppress Clang Argument Warnings
279 dnl ========================================================
280 WARNINGS_CFLAGS="$_WARNINGS_CFLAGS"
281 if test -n "${CLANG_CC}${CLANG_CL}"; then
282 WARNINGS_CFLAGS="-Qunused-arguments $WARNINGS_CFLAGS"
283 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
285 if test -n "${CLANG_CXX}${CLANG_CL}"; then
286 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
289 if test -n "$COMPILE_ENVIRONMENT"; then
293 dnl ========================================================
294 dnl GNU specific defaults
295 dnl ========================================================
296 if test "$GNU_CC"; then
300 SSSE3_FLAGS="-mssse3"
301 CFLAGS="$CFLAGS -fno-strict-aliasing"
304 if test "$OS_ARCH" != "WINNT" -o -z "$CLANG_CC"; then
305 DSO_PIC_CFLAGS='-fPIC'
306 ASFLAGS="$ASFLAGS -fPIC"
309 AC_MSG_CHECKING([for --noexecstack option to as])
311 CFLAGS="$CFLAGS -Wa,--noexecstack"
312 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
313 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
316 AC_MSG_CHECKING([for -z noexecstack option to ld])
317 _SAVE_LDFLAGS=$LDFLAGS
318 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
319 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
321 LDFLAGS=$_SAVE_LDFLAGS)
323 AC_MSG_CHECKING([for -z text option to ld])
324 _SAVE_LDFLAGS=$LDFLAGS
325 LDFLAGS="$LDFLAGS -Wl,-z,text"
326 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
328 LDFLAGS=$_SAVE_LDFLAGS)
330 AC_MSG_CHECKING([for -z relro option to ld])
331 _SAVE_LDFLAGS=$LDFLAGS
332 LDFLAGS="$LDFLAGS -Wl,-z,relro"
333 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
335 LDFLAGS=$_SAVE_LDFLAGS)
337 AC_MSG_CHECKING([for -z nocopyreloc option to ld])
338 _SAVE_LDFLAGS=$LDFLAGS
339 LDFLAGS="$LDFLAGS -Wl,-z,nocopyreloc"
340 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
342 LDFLAGS=$_SAVE_LDFLAGS)
344 AC_MSG_CHECKING([for -Bsymbolic-functions option to ld])
345 _SAVE_LDFLAGS=$LDFLAGS
346 LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
347 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
349 LDFLAGS=$_SAVE_LDFLAGS)
351 AC_MSG_CHECKING([for --build-id=sha1 option to ld])
352 _SAVE_LDFLAGS=$LDFLAGS
353 LDFLAGS="$LDFLAGS -Wl,--build-id=sha1"
354 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
356 LDFLAGS=$_SAVE_LDFLAGS)
358 AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
359 HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
360 _SAVE_LDFLAGS=$LDFLAGS
361 LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
362 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
363 [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
365 LDFLAGS=$_SAVE_LDFLAGS
367 # Check for -mssse3 on $CC
368 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
369 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
371 CFLAGS="$CFLAGS -mssse3"
372 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
373 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
377 # Check for -msse4.1 on $CC
378 AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
379 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
381 CFLAGS="$CFLAGS -msse4.1"
382 AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
383 [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
387 case "${CPU_ARCH}" in
389 AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
391 [asm volatile ("vpermq \$0xd8,%ymm0,%ymm0 \n");],
392 result="yes", result="no")
393 AC_MSG_RESULT("$result")
394 if test "$result" = "yes"; then
400 AC_MSG_CHECKING([whether we can enable AltiVec support])
403 CFLAGS="$CFLAGS -maltivec"
404 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
412 if test "$GCC_USE_GNU_LD"; then
413 # Some tools like ASan use a runtime library that is only
414 # linked against executables, so we must allow undefined
415 # symbols for shared objects in some cases.
416 if test -z "$MOZ_ASAN$MOZ_MSAN$MOZ_UBSAN$MOZ_TSAN$FUZZING_INTERFACES"; then
417 # Don't allow undefined symbols in libraries
418 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
420 # BSDs need `environ' exposed for posix_spawn (bug 753046)
422 DragonFly|FreeBSD|NetBSD|OpenBSD)
423 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
424 DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
426 DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
433 _DEFINES_CFLAGS="-include $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
435 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
438 if test "$GNU_CXX"; then
439 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
441 _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
444 dnl ========================================================
446 dnl ========================================================
448 if test "$MOZ_DMD"; then
449 if test "${CPU_ARCH}" = "arm"; then
450 CFLAGS="$CFLAGS -funwind-tables"
451 CXXFLAGS="$CXXFLAGS -funwind-tables"
455 dnl ========================================================
456 dnl System overrides of the defaults for host
457 dnl ========================================================
460 if test -n "$_WIN32_MSVC"; then
461 HOST_CFLAGS="$HOST_CFLAGS"
463 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
465 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
466 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
469 case "${host_cpu}" in
471 if test -n "$_WIN32_MSVC"; then
472 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
476 if test -n "$_WIN32_MSVC"; then
477 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
479 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
485 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
486 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
489 *-linux*|*-kfreebsd*-gnu|*-gnu*)
490 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
491 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
495 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
496 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
500 dnl ========================================================
501 dnl System overrides of the defaults for target
502 dnl ========================================================
506 MOZ_OPTIMIZE_FLAGS="-O3"
507 CXXFLAGS="$CXXFLAGS -stdlib=libc++"
509 # The ExceptionHandling framework is needed for Objective-C exception
510 # logging code in nsObjCExceptions.h. Currently we only use that in debug
512 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
514 dnl DTrace and -dead_strip don't interact well. See bug 403132.
515 dnl ===================================================================
516 if test "x$enable_dtrace" = "xyes"; then
517 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
519 dnl check for the presence of the -dead_strip linker flag
520 AC_MSG_CHECKING([for -dead_strip option to ld])
521 _SAVE_LDFLAGS=$LDFLAGS
522 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
523 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
524 if test -n "$_HAVE_DEAD_STRIP" ; then
526 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
531 LDFLAGS=$_SAVE_LDFLAGS
534 MOZ_FIX_LINK_PATHS="-Wl,-executable_path,${DIST}/bin"
537 *-android*|*-linuxandroid*)
538 if test "$COMPILE_ENVIRONMENT" -a -n "$MOZ_MEMORY"; then
542 if test -z "$CLANG_CC"; then
543 MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
544 elif test -n "$RELEASE_OR_BETA"; then
545 # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
546 # -Oz is smaller than -Os on clang.
547 MOZ_OPTIMIZE_FLAGS="-Oz"
548 # Disable the outliner, which causes performance regressions, and is
549 # enabled on some platforms at -Oz.
550 if test -z "$MOZ_LTO"; then
551 DISABLE_OUTLINER="-mno-outline"
553 CFLAGS="$CFLAGS $DISABLE_OUTLINER"
554 AC_TRY_COMPILE(,,[MOZ_OPTIMIZE_FLAGS="$MOZ_OPTIMIZE_FLAGS $DISABLE_OUTLINER"])
555 CFLAGS="$_SAVE_CFLAGS"
557 DISABLE_OUTLINER="-Wl,-plugin-opt=-enable-machine-outliner=never"
558 _SAVE_LDFLAGS=$LDFLAGS
559 LDFLAGS="$LDFLAGS $MOZ_LTO_LDFLAGS $DISABLE_OUTLINER"
560 AC_TRY_LINK(,,[MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS $DISABLE_OUTLINER"])
561 LDFLAGS="$_SAVE_LDFLAGS"
564 MOZ_OPTIMIZE_FLAGS="-O2"
569 if test "$GNU_CC" -o "$GNU_CXX"; then
570 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
571 if test -n "$MOZ_DEBUG"; then
572 MOZ_OPTIMIZE_FLAGS="-Os"
574 MOZ_OPTIMIZE_FLAGS="-O2"
576 if test -z "$CLANG_CC"; then
577 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
581 case "${target_cpu}" in
583 CFLAGS="$CFLAGS -mieee"
584 CXXFLAGS="$CXXFLAGS -mieee"
591 # certain versions of cygwin's makedepend barf on the
592 # #include <string> vs -I./dist/include/string issue so don't use it
593 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
594 # $GNU_CC will match gcc and clang; while $CLANG_CC will match only clang
595 if test -z "$CLANG_CC"; then
596 AC_MSG_ERROR(Firefox cannot be built with mingw-gcc and requires a mingw-clang toolchain to work)
600 # mingw doesn't require kernel32, user32, and advapi32 explicitly
601 LIBS="$LIBS -luuid -lusp10 -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
604 MOZ_OPTIMIZE_FLAGS="-O2"
606 WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
607 WIN32_GUI_EXE_LDFLAGS=-mwindows
609 # Silence problematic clang warnings
610 CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
611 LDFLAGS="$LDFLAGS -Wl,--no-insert-timestamp"
613 TARGET_COMPILER_ABI=msvc
614 RANLIB='echo not_ranlib'
615 STRIP='echo not_strip'
616 # aarch64 doesn't support subsystems below 6.02
617 if test "$CPU_ARCH" = "aarch64"; then
618 WIN32_SUBSYSTEM_VERSION=6.02
620 WIN32_SUBSYSTEM_VERSION=6.01
622 WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
623 WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
624 DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
625 _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
626 _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
627 CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
628 CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
629 if test -z "$CLANG_CL"; then
630 CPPFLAGS="$CPPFLAGS -utf-8"
632 if test "$CPU_ARCH" = "x86"; then
633 dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
634 dnl more recent, so set that explicitly here unless another
635 dnl target arch has already been set.
637 if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
638 CFLAGS="$CFLAGS -arch:SSE2"
640 if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
641 CXXFLAGS="$CXXFLAGS -arch:SSE2"
644 SSE_FLAGS="-arch:SSE"
645 SSE2_FLAGS="-arch:SSE2"
646 dnl MSVC allows the use of intrinsics without any flags
647 dnl and doesn't have a separate arch for SSSE3
648 SSSE3_FLAGS="-arch:SSE2"
650 dnl clang-cl requires appropriate flags to enable SSSE3 support
651 dnl on all architectures.
652 if test -n "$CLANG_CL"; then
653 SSSE3_FLAGS="-mssse3"
655 dnl VS2013+ supports -Gw for better linker optimizations.
656 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
657 dnl Disabled on ASan because it causes false-positive ODR violations.
658 if test -z "$MOZ_ASAN"; then
660 CXXFLAGS="$CXXFLAGS -Gw"
662 # String tail merging doesn't play nice with ASan's ODR checker.
663 LDFLAGS="$LDFLAGS -opt:nolldtailmerge"
665 if test -n "$CLANG_CL"; then
666 # XXX We should combine some of these with our generic GCC-style
669 # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
670 CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
671 # We use offsetof on non-POD objects all the time.
672 # We also suppress this warning on other platforms.
673 CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
674 # This warns for reasonable things like:
675 # enum { X = 0xffffffffU };
676 # which is annoying for IDL headers.
677 CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
678 # This warns for cases that would be reached by the Microsoft
679 # #include rules, but also currently warns on cases that would
680 # *also* be reached by standard C++ include rules. That
681 # behavior doesn't seem useful, so we turn it off.
682 CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
683 # We normally error out on unknown pragmas, but since clang-cl
684 # claims to be MSVC, it would be difficult to add
685 # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
686 # use such pragmas, so just ignore them.
687 CFLAGS="$CFLAGS -Wno-unknown-pragmas"
688 CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
689 # We get errors about various #pragma intrinsic directives from
690 # clang-cl, and we don't need to hear about those.
691 CFLAGS="$CFLAGS -Wno-ignored-pragmas"
692 CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
693 # clang-cl's Intrin.h marks things like _ReadWriteBarrier
694 # as __attribute((__deprecated__)). This is nice to know,
695 # but since we don't get the equivalent warning from MSVC,
696 # let's just ignore it.
697 CFLAGS="$CFLAGS -Wno-deprecated-declarations"
698 CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
699 # We use a function like:
700 # __declspec(noreturn) __inline void f() {}
701 # which -Winvalid-noreturn complains about. Again, MSVC seems
702 # OK with it, so let's silence the warning.
703 CFLAGS="$CFLAGS -Wno-invalid-noreturn"
704 CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
705 # Missing |override| on virtual function declarations isn't
706 # something that MSVC currently warns about.
707 CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
708 # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
709 # declaration on |operator delete(void*)|. However, clang-cl
710 # must internally declare |operator delete(void*)| differently,
711 # which causes this warning for virtually every file in the
712 # tree. clang-cl doesn't support -fno-exceptions or equivalent,
713 # so there doesn't seem to be any way to convince clang-cl to
714 # declare |delete| differently. Therefore, suppress this
716 CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
717 # Macros like STDMETHOD() and IFACEMETHOD() can declare
718 # __attribute__((nothrow)) on their respective method declarations,
719 # while the definitions are left without the matching attribute.
720 CXXFLAGS="$CXXFLAGS -Wno-microsoft-exception-spec"
721 # At least one MSVC header and several headers in-tree have
722 # unused typedefs, so turn this on.
723 CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
724 # jemalloc uses __declspec(allocator) as a profiler hint,
725 # which clang-cl doesn't understand.
726 CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
727 # __attribute__((unused)) really means "might be unused" and
728 # we use it to avoid warnings about things that are unused
729 # in some compilation units, but used in many others. This
730 # warning insists on complaining about the latter case, which
731 # is annoying, and rather noisy.
732 CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused"
734 # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
735 CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
736 LIBS="$LIBS user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
737 MOZ_DEBUG_LDFLAGS='-DEBUG'
738 # Use a higher optimization level for clang-cl, so we can come closer
739 # to MSVC's performance numbers (see bug 1443590).
740 if test -n "$CLANG_CL"; then
741 MOZ_OPTIMIZE_FLAGS='-O2'
743 MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
746 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE"
747 if test -z "$DEVELOPER_OPTIONS"; then
748 LDFLAGS="$LDFLAGS -RELEASE"
750 dnl Minimum reqiurement of Gecko is VS2015 or later which supports
751 dnl both SSSE3 and SSE4.1.
752 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
753 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
754 dnl allow AVX2 code from VS2015
757 AC_DEFINE(WIN32_LEAN_AND_MEAN)
758 dnl See http://support.microsoft.com/kb/143208 to use STL
761 MOZ_USER_DIR="Mozilla"
765 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.])
771 if test -n "$GNU_CC"; then
772 CFLAGS="$CFLAGS -mstackrealign"
773 CXXFLAGS="$CXXFLAGS -mstackrealign"
774 LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
776 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
777 LDFLAGS="$LDFLAGS -SAFESEH"
783 if test -n "$_WIN32_MSVC"; then
784 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
789 if test -n "$_WIN32_MSVC"; then
790 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:ARM64"
795 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
802 CFLAGS="$CFLAGS -Dunix"
803 CXXFLAGS="$CXXFLAGS -Dunix"
804 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
805 DSO_PIC_CFLAGS='-fPIC -DPIC'
807 MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
809 DSO_PIC_CFLAGS='-fPIC -DPIC'
812 # This will fail on a.out systems prior to 1.5.1_ALPHA.
813 if test "$LIBRUNPATH"; then
814 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
819 if test -z "$X11BASE"; then
822 MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
824 DSO_PIC_CFLAGS='-fPIC'
825 DSO_LDOPTS='-shared -fPIC'
826 if test "$LIBRUNPATH"; then
827 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
832 MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
837 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
838 MOZ_OPTIMIZE_FLAGS="-O"
841 AC_SUBST_LIST(MMX_FLAGS)
842 AC_SUBST_LIST(SSE_FLAGS)
843 AC_SUBST_LIST(SSE2_FLAGS)
844 AC_SUBST_LIST(SSSE3_FLAGS)
847 if test -n "$MOZ_LINKER"; then
848 AC_DEFINE(MOZ_LINKER)
850 AC_CHECK_PROGS(XZ, xz)
853 if test -z "$COMPILE_ENVIRONMENT"; then
854 SKIP_COMPILER_CHECKS=1
855 SKIP_LIBRARY_CHECKS=1
859 fi # COMPILE_ENVIRONMENT
861 if test -z "$SKIP_COMPILER_CHECKS"; then
862 dnl Checks for typedefs, structures, and compiler characteristics.
863 dnl ========================================================
878 case "${OS_TARGET}" in
882 STL_FLAGS="-I${DIST}/stl_wrappers"
887 if test "$MOZ_BUILD_APP" = "tools/crashreporter"; then
891 dnl Checks for header files.
892 dnl ========================================================
895 bitrig*|dragonfly*|freebsd*|openbsd*)
896 # for stuff like -lXshm
897 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
901 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
902 AC_CACHE_CHECK(for sockaddr_in.sin_len,
903 ac_cv_sockaddr_in_sin_len,
904 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
905 #include <sys/types.h>
907 #include <netinet/in.h>
908 struct sockaddr_in x;
909 void *foo = (void*) &x.sin_len;],
911 [ac_cv_sockaddr_in_sin_len=true],
912 [ac_cv_sockaddr_in_sin_len=false])])
913 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
914 AC_DEFINE(HAVE_SIN_LEN)
915 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
916 AC_DEFINE(HAVE_SCONN_LEN)
919 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
920 ac_cv_sockaddr_in6_sin6_len,
921 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
922 #include <sys/types.h>
924 #include <netinet/in.h>
925 struct sockaddr_in6 x;
926 void *foo = (void*) &x.sin6_len;],
928 [ac_cv_sockaddr_in6_sin6_len=true],
929 [ac_cv_sockaddr_in6_sin6_len=false])])
930 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
931 AC_DEFINE(HAVE_SIN6_LEN)
934 AC_CACHE_CHECK(for sockaddr.sa_len,
935 ac_cv_sockaddr_sa_len,
936 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
937 #include <sys/types.h>
939 #include <sys/socket.h>
941 void *foo = (void*) &x.sa_len;],
943 [ac_cv_sockaddr_sa_len=true],
944 [ac_cv_sockaddr_sa_len=false])])
945 if test "$ac_cv_sockaddr_sa_len" = true ; then
946 AC_DEFINE(HAVE_SA_LEN)
949 dnl Checks for libraries.
950 dnl ========================================================
951 AC_CHECK_LIB(c_r, gethostbyname_r)
953 dnl We don't want to link with libdl even if it's present on OS X, since
954 dnl it's not used and not part of the default installation. OS/2 has dlfcn
956 dnl We don't want to link against libm or libpthread on Darwin since
957 dnl they both are just symlinks to libSystem and explicitly linking
958 dnl against libSystem causes issues when debugging (see bug 299601).
963 AC_SEARCH_LIBS(dlopen, dl,
964 MOZ_CHECK_HEADER(dlfcn.h,
965 AC_DEFINE(HAVE_DLOPEN)))
969 _SAVE_CFLAGS="$CFLAGS"
970 CFLAGS="$CFLAGS -D_GNU_SOURCE"
971 AC_CHECK_FUNCS(dladdr memmem)
972 CFLAGS="$_SAVE_CFLAGS"
974 if test ! "$GNU_CXX"; then
975 AC_CHECK_LIB(C, demangle)
978 AC_CHECK_LIB(socket, socket)
981 XLIBS="$X_EXTRA_LIBS"
983 dnl ========================================================
984 dnl Checks for X libraries.
985 dnl Ordering is important.
986 dnl Xt is dependent upon SM as of X11R6
987 dnl ========================================================
988 if test -n "$MOZ_X11"; then
989 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
990 _SAVE_LDFLAGS="$LDFLAGS"
992 LDFLAGS="$XLDFLAGS $LDFLAGS"
993 AC_CHECK_LIB(X11, XDrawLines, [XLIBS="-lX11 $XLIBS"],
994 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
995 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
996 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
998 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
999 unset ac_cv_lib_Xt_XtFree
1000 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
1001 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
1002 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
1003 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
1006 dnl ========================================================
1008 dnl ========================================================
1009 AC_CHECK_LIB(xcb, xcb_connect, [XLIBS="-lxcb $XLIBS"],
1010 [MISSING_X="$MISSING_X -lxcb"], $XLIBS)
1011 AC_CHECK_LIB(xcb-shm, xcb_shm_query_version, [XLIBS="-lxcb-shm $XLIBS"],
1012 [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS)
1013 AC_CHECK_LIB(X11-xcb, XGetXCBConnection, [XLIBS="-lX11-xcb $XLIBS"],
1014 [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS)
1016 LDFLAGS="$_SAVE_LDFLAGS"
1020 AC_SUBST_LIST(XCFLAGS)
1021 AC_SUBST_LIST(XLDFLAGS)
1022 AC_SUBST_LIST(XLIBS)
1023 AC_SUBST_LIST(XEXT_LIBS)
1024 AC_SUBST_LIST(XT_LIBS)
1026 dnl ========================================================
1027 dnl = pthread support
1028 dnl = Start by checking whether the system support pthreads
1029 dnl ========================================================
1030 case "$target_os" in
1035 AC_CHECK_LIB(pthreads, pthread_create,
1036 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
1037 AC_CHECK_LIB(pthread, pthread_create,
1038 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
1039 AC_CHECK_LIB(c_r, pthread_create,
1040 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
1041 AC_CHECK_LIB(c, pthread_create,
1050 dnl ========================================================
1051 dnl Do the platform specific pthread hackery
1052 dnl ========================================================
1053 if test "$MOZ_USE_PTHREADS"x != x
1056 dnl See if -pthread is supported.
1059 ac_cv_have_dash_pthread=no
1060 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
1061 echo 'int main() { return 0; }' | cat > conftest.c
1062 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
1063 if test $? -eq 0; then
1064 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1065 ac_cv_have_dash_pthread=yes
1066 case "$target_os" in
1068 # Freebsd doesn't use -pthread for compiles, it uses them for linking
1071 CFLAGS="$CFLAGS -pthread"
1072 CXXFLAGS="$CXXFLAGS -pthread"
1078 AC_MSG_RESULT($ac_cv_have_dash_pthread)
1081 dnl See if -pthreads is supported.
1083 ac_cv_have_dash_pthreads=no
1084 if test "$ac_cv_have_dash_pthread" = "no"; then
1085 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
1086 echo 'int main() { return 0; }' | cat > conftest.c
1087 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
1088 if test $? -eq 0; then
1089 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1090 ac_cv_have_dash_pthreads=yes
1091 CFLAGS="$CFLAGS -pthreads"
1092 CXXFLAGS="$CXXFLAGS -pthreads"
1096 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
1101 AC_DEFINE(_REENTRANT)
1102 AC_DEFINE(_THREAD_SAFE)
1103 dnl -pthread links in -lpthread, so don't specify it explicitly.
1104 if test "$ac_cv_have_dash_pthread" = "yes"; then
1105 _PTHREAD_LDFLAGS="-pthread"
1109 *-*-openbsd*|*-*-bsdi*)
1110 AC_DEFINE(_REENTRANT)
1111 AC_DEFINE(_THREAD_SAFE)
1112 dnl -pthread links in -lc_r, so don't specify it explicitly.
1113 if test "$ac_cv_have_dash_pthread" = "yes"; then
1114 _PTHREAD_LDFLAGS="-pthread"
1118 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
1119 AC_DEFINE(_REENTRANT)
1123 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
1124 AC_SUBST(MOZ_USE_PTHREADS)
1125 MOZ_CHECK_HEADERS(pthread.h)
1129 dnl Checks for library functions.
1130 dnl ========================================================
1131 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)
1133 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1134 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1135 ac_cv_clock_monotonic,
1136 [for libs in "" -lrt; do
1138 _SAVE_CFLAGS="$CFLAGS"
1140 CFLAGS="$CFLAGS $DSO_PIC_CFLAGS"
1141 dnl clock_gettime is available on OSX since 10.12, so depending on MACOSX_DEPLOYMENT_TARGET,
1142 dnl we should or not be able to use it. To detect if we can, we need to make the
1143 dnl availability attribute strict, so that compilation fails when the target is < 10.12.
1144 AC_TRY_LINK([#define availability(os, ...) availability(os, strict, __VA_ARGS)
1146 [ struct timespec ts;
1147 clock_gettime(CLOCK_MONOTONIC, &ts); ],
1148 ac_cv_clock_monotonic=$libs
1150 CFLAGS="$_SAVE_CFLAGS"
1152 ac_cv_clock_monotonic=no)
1154 CFLAGS="$_SAVE_CFLAGS"
1156 if test "$ac_cv_clock_monotonic" != "no"; then
1157 HAVE_CLOCK_MONOTONIC=1
1158 REALTIME_LIBS=$ac_cv_clock_monotonic
1159 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1160 AC_SUBST(HAVE_CLOCK_MONOTONIC)
1161 AC_SUBST_LIST(REALTIME_LIBS)
1164 dnl Turn on warnings-as-errors to prevent implicit declaration of
1165 dnl pthread_cond_timedwait_monotonic_np, which can cause this test to
1166 dnl inadvertently pass even if the function does not really exist.
1167 _SAVE_CFLAGS="$CFLAGS"
1168 CFLAGS="$CFLAGS $WARNINGS_AS_ERRORS"
1169 AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
1170 ac_cv_pthread_cond_timedwait_monotonic_np,
1171 AC_TRY_LINK([#include <pthread.h>],
1172 [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
1173 ac_cv_pthread_cond_timewait_monotonic_np=yes,
1174 ac_cv_pthread_cond_timewait_monotonic_np=no))
1175 if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
1176 AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
1178 CFLAGS=$_SAVE_CFLAGS
1182 ac_cv_func_res_ninit,
1183 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
1184 dnl no need for res_ninit() on NetBSD and OpenBSD
1185 ac_cv_func_res_ninit=no
1189 #define _BSD_SOURCE 1
1191 #include <sys/types.h>
1192 #include <netinet/in.h>
1193 #include <arpa/nameser.h>
1196 [int foo = res_ninit(&_res);],
1197 [ac_cv_func_res_ninit=yes],
1198 [ac_cv_func_res_ninit=no])
1202 if test "$ac_cv_func_res_ninit" = "yes"; then
1203 AC_DEFINE(HAVE_RES_NINIT)
1204 dnl must add the link line we do something as foolish as this... dougt
1206 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
1207 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
1212 dnl **********************
1213 dnl *** va_copy checks ***
1214 AC_CACHE_CHECK([for an implementation of va_copy()],
1216 [AC_TRY_COMPILE([#include <stdarg.h>
1218 void f (int i, ...) {
1219 va_list args1, args2;
1220 va_start (args1, i);
1221 va_copy (args2, args1);
1222 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1224 va_end (args1); va_end (args2);
1226 [f(0, 42); return 0],
1227 [ac_cv_va_copy=yes],
1231 AC_CACHE_CHECK([whether va_list can be copied by value],
1233 [AC_TRY_COMPILE([#include <stdarg.h>
1235 void f (int i, ...) {
1236 va_list args1, args2;
1237 va_start (args1, i);
1239 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1241 va_end (args1); va_end (args2);
1243 [f(0, 42); return 0],
1244 [ac_cv_va_val_copy=yes],
1245 [ac_cv_va_val_copy=no],
1248 if test "x$ac_cv_va_copy" = "xyes"; then
1249 AC_DEFINE(VA_COPY, va_copy)
1250 AC_DEFINE(HAVE_VA_COPY)
1253 if test "x$ac_cv_va_val_copy" = "xno"; then
1254 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
1257 dnl ===================================================================
1258 dnl ========================================================
1259 dnl Put your C++ language/feature checks below
1260 dnl ========================================================
1264 if test "$GNU_CC"; then
1265 if test "$CPU_ARCH" = "arm" ; then
1266 AC_CACHE_CHECK(for ARM EABI,
1270 #if defined(__ARM_EABI__)
1273 #error Not ARM EABI.
1276 ac_cv_gcc_arm_eabi="yes",
1277 ac_cv_gcc_arm_eabi="no")])
1278 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
1280 ARM_ABI_PREFIX=eabi-
1282 ARM_ABI_PREFIX=oabi-
1286 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
1289 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
1290 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
1291 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
1293 _SAVE_LDFLAGS=$LDFLAGS
1294 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
1295 AC_CACHE_CHECK(for __thread keyword for TLS variables,
1296 ac_cv_thread_keyword,
1297 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
1298 [return tlsIsMainThread;],
1299 ac_cv_thread_keyword=yes,
1300 ac_cv_thread_keyword=no)])
1301 LDFLAGS=$_SAVE_LDFLAGS
1302 # The custom dynamic linker doesn't support TLS variables
1304 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
1305 # mips builds fail with TLS variables because of a binutils bug.
1307 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
1312 *-android*|*-linuxandroid*)
1319 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
1325 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
1326 if test -n "$MOZ_LINKER"; then
1327 if test "$CPU_ARCH" = arm; then
1328 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
1329 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
1330 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1331 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1335 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
1336 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
1337 dnl Since the linker only understands the sysv ones, no need to build the
1338 dnl gnu style tables anyways.
1339 LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
1342 dnl End of C++ language/feature checks
1345 dnl ========================================================
1346 dnl = Internationalization checks
1347 dnl ========================================================
1349 dnl Internationalization and Locale support is different
1350 dnl on various UNIX platforms. Checks for specific i18n
1351 dnl features go here.
1353 AC_HAVE_FUNCS(localeconv)
1355 fi # ! SKIP_COMPILER_CHECKS
1357 if test -n "${COMPILE_ENVIRONMENT}"; then
1362 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1363 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1364 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1367 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1368 dnl features that Windows actually does support.
1370 if test -n "$SKIP_COMPILER_CHECKS"; then
1371 dnl Windows has malloc.h
1372 AC_DEFINE(MALLOC_H, [<malloc.h>])
1373 AC_DEFINE(HAVE_FORCEINLINE)
1374 AC_DEFINE(HAVE_LOCALECONV)
1375 fi # SKIP_COMPILER_CHECKS
1377 dnl Mozilla specific options
1378 dnl ========================================================
1379 dnl The macros used for command line options
1380 dnl are defined in build/autoconf/altoptions.m4.
1382 dnl ========================================================
1384 dnl = Check for external package dependencies
1386 dnl ========================================================
1387 MOZ_ARG_HEADER(External Packages)
1389 dnl ========================================================
1390 dnl system libevent Support
1391 dnl ========================================================
1392 MOZ_ARG_WITH_STRING(system-libevent,
1393 [ --with-system-libevent[=PFX]
1394 Use system libevent [installed at prefix PFX]],
1395 LIBEVENT_DIR=$withval)
1397 _SAVE_CFLAGS=$CFLAGS
1398 _SAVE_LDFLAGS=$LDFLAGS
1400 if test "$LIBEVENT_DIR" = yes; then
1401 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
1402 MOZ_SYSTEM_LIBEVENT=1,
1405 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
1406 MOZ_SYSTEM_LIBEVENT=
1407 elif test -z "$MOZ_SYSTEM_LIBEVENT"; then
1408 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
1409 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
1410 MOZ_CHECK_HEADER(event.h,
1411 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
1412 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
1414 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
1415 AC_CHECK_LIB(event, event_init,
1416 [MOZ_SYSTEM_LIBEVENT=1
1417 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
1418 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
1419 [MOZ_SYSTEM_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
1421 CFLAGS=$_SAVE_CFLAGS
1422 LDFLAGS=$_SAVE_LDFLAGS
1425 AC_SUBST(MOZ_SYSTEM_LIBEVENT)
1427 if test -z "$SKIP_LIBRARY_CHECKS"; then
1429 dnl ========================================================
1430 dnl system PNG Support
1431 dnl ========================================================
1432 MOZ_ARG_WITH_STRING(system-png,
1433 [ --with-system-png[=PFX]
1434 Use system libpng [installed at prefix PFX]],
1437 _SAVE_CFLAGS=$CFLAGS
1438 _SAVE_LDFLAGS=$LDFLAGS
1440 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
1441 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
1442 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
1444 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
1447 AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"],
1448 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1449 AC_CHECK_LIB(png, png_get_acTL, ,
1450 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
1452 if test "$MOZ_SYSTEM_PNG" = 1; then
1453 AC_TRY_COMPILE([ #include <stdio.h>
1454 #include <sys/types.h>
1456 [ #if PNG_LIBPNG_VER < $MOZPNG
1457 #error "Insufficient libpng version ($MOZPNG required)."
1459 #ifndef PNG_UINT_31_MAX
1460 #error "Insufficient libpng version."
1463 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1465 CFLAGS=$_SAVE_CFLAGS
1466 LDFLAGS=$_SAVE_LDFLAGS
1469 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then
1470 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
1471 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
1474 fi # SKIP_LIBRARY_CHECKS
1476 dnl ========================================================
1480 dnl ========================================================
1482 MOZ_ARG_HEADER(Application)
1484 ENABLE_SYSTEM_EXTENSION_DIRS=1
1485 MOZ_BRANDING_DIRECTORY=
1486 MOZ_OFFICIAL_BRANDING=
1487 MOZ_AUTH_EXTENSION=1
1489 MOZ_UNIVERSALCHARDET=1
1493 MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
1495 MOZ_BINARY_EXTENSIONS=
1498 case "$target_os" in
1501 AC_DEFINE(NS_ENABLE_TSF)
1505 # Optional Firefox for Android partner distribution directory.
1506 MOZ_ARG_WITH_STRING(android-distribution-directory,
1507 [ --with-android-distribution-directory=dir
1508 Optional Firefox for Android partner distribution directory.],
1509 MOZ_ANDROID_DISTRIBUTION_DIRECTORY=$withval)
1511 if test -n "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY"; then
1512 # A distribution directory must have an assets/distribution directory.
1513 # See https://wiki.mozilla.org/Mobile/Distribution_Files.
1514 if test ! -d "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY/assets/distribution" ; then
1515 AC_MSG_ERROR([--with-android-distribution-directory does not contain assets/distribution;
1516 (looked for ${MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets/distribution).])
1519 AC_SUBST(MOZ_ANDROID_DISTRIBUTION_DIRECTORY)
1521 dnl ========================================================
1522 dnl = Trademarked Branding
1523 dnl ========================================================
1524 MOZ_ARG_ENABLE_BOOL(official-branding,
1525 [ --enable-official-branding
1526 Enable Official mozilla.org Branding
1527 Do not distribute builds with
1528 --enable-official-branding unless you have
1529 permission to use trademarks per
1530 http://www.mozilla.org/foundation/trademarks/ .],
1531 MOZ_OFFICIAL_BRANDING=1,
1532 MOZ_OFFICIAL_BRANDING=)
1534 # Allow the application to influence configure with a confvars.sh script.
1535 AC_MSG_CHECKING([if app-specific confvars.sh exists])
1536 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
1537 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
1538 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
1543 dnl ========================================================
1544 dnl Ensure Android SDK and build-tools versions depending on
1546 dnl ========================================================
1548 case "$MOZ_BUILD_APP" in
1554 dnl ========================================================
1556 dnl = Toolkit Options
1558 dnl ========================================================
1559 MOZ_ARG_HEADER(Toolkit Options)
1561 dnl ========================================================
1562 dnl = Enable the toolkit as needed =
1563 dnl ========================================================
1565 case "$MOZ_WIDGET_TOOLKIT" in
1568 LDFLAGS="$LDFLAGS -framework Cocoa"
1569 # Use -Wl as a trick to avoid -framework and framework names from
1570 # being separated by AC_SUBST_LIST.
1571 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'
1573 CFLAGS="$CFLAGS $TK_CFLAGS"
1574 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1575 MOZ_USER_DIR="Mozilla"
1576 MOZ_FS_LAYOUT=bundle
1580 LDFLAGS="$LDFLAGS -framework UIKit"
1582 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'
1583 CFLAGS="$CFLAGS $TK_CFLAGS"
1584 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1585 MOZ_USER_DIR="Mozilla"
1586 MOZ_FS_LAYOUT=bundle
1591 if test "$OS_TARGET" = Darwin; then
1592 LDFLAGS="$LDFLAGS -lobjc"
1595 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
1596 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
1597 case "$MOZ_WIDGET_TOOLKIT" in
1603 if test "$COMPILE_ENVIRONMENT"; then
1604 if test "$MOZ_WIDGET_TOOLKIT" = gtk; then
1605 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)
1606 MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
1607 TK_CFLAGS=$MOZ_GTK3_CFLAGS
1608 TK_LIBS=$MOZ_GTK3_LIBS
1609 dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
1610 dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
1611 AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
1613 if test "$MOZ_ENABLE_GTK"; then
1614 if test "$MOZ_X11"; then
1615 GDK_PACKAGES=gdk-x11-2.0
1617 AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
1618 AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
1620 PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 >= $GLIB_VERSION gobject-2.0 gio-unix-2.0 $GDK_PACKAGES)
1621 MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
1623 fi # COMPILE_ENVIRONMENT
1625 AC_SUBST(MOZ_FS_LAYOUT)
1627 AC_SUBST_LIST(TK_CFLAGS)
1628 AC_SUBST_LIST(TK_LIBS)
1630 dnl ========================================================
1632 dnl = Components & Features
1634 dnl ========================================================
1635 MOZ_ARG_HEADER(Components and Features)
1637 AC_SUBST(MOZ_OFFICIAL_BRANDING)
1638 if test -n "$MOZ_OFFICIAL_BRANDING"; then
1639 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
1640 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
1642 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
1643 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
1647 MOZ_ARG_WITH_STRING(branding,
1648 [ --with-branding=dir Use branding from the specified directory.],
1649 MOZ_BRANDING_DIRECTORY=$withval)
1651 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
1652 if test -z "$REAL_BRANDING_DIRECTORY"; then
1653 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
1656 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1657 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
1660 AC_SUBST(MOZ_BRANDING_DIRECTORY)
1662 dnl ========================================================
1663 dnl = Distribution ID
1664 dnl ========================================================
1665 MOZ_ARG_WITH_STRING(distribution-id,
1666 [ --with-distribution-id=ID
1667 Set distribution-specific id (default=org.mozilla)],
1668 [ val=`echo $withval`
1669 MOZ_DISTRIBUTION_ID="$val"])
1671 if test -z "$MOZ_DISTRIBUTION_ID"; then
1672 MOZ_DISTRIBUTION_ID="org.mozilla"
1675 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
1676 AC_SUBST(MOZ_DISTRIBUTION_ID)
1678 dnl ========================================================
1679 dnl = libproxy support
1680 dnl ========================================================
1682 if test "$MOZ_ENABLE_GTK"
1684 MOZ_ENABLE_LIBPROXY=
1686 MOZ_ARG_ENABLE_BOOL(libproxy,
1687 [ --enable-libproxy Enable libproxy support ],
1688 MOZ_ENABLE_LIBPROXY=1,
1689 MOZ_ENABLE_LIBPROXY=)
1691 if test "$MOZ_ENABLE_LIBPROXY"
1693 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
1694 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
1697 AC_SUBST(MOZ_ENABLE_LIBPROXY)
1699 dnl ========================================================
1701 dnl ========================================================
1703 if test "$MOZ_ENABLE_GTK"
1707 MOZ_ARG_DISABLE_BOOL(dbus,
1708 [ --disable-dbus Disable dbus support ],
1712 if test "$MOZ_ENABLE_DBUS"
1714 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
1715 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
1716 AC_DEFINE(MOZ_ENABLE_DBUS)
1719 AC_SUBST(MOZ_ENABLE_DBUS)
1721 dnl =========================================================
1722 dnl = Whether to exclude hyphenations files in the build
1723 dnl =========================================================
1724 if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
1725 AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
1728 AC_TRY_COMPILE([#include <linux/ethtool.h>],
1729 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
1730 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
1732 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
1734 if test -n "$MOZ_WEBRTC"; then
1735 if test -n "$MOZ_X11"; then
1736 MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
1740 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
1742 dnl ========================================================
1743 dnl = Apple platform decoder support
1744 dnl ========================================================
1745 if test "$COMPILE_ENVIRONMENT"; then
1746 if test -n "$MOZ_APPLEMEDIA"; then
1747 # hack in frameworks for fmp4 - see bug 1029974
1748 # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
1749 LDFLAGS="$LDFLAGS -framework AudioToolbox"
1750 dnl Verify CoreMedia is available.
1751 AC_CHECK_HEADERS([CoreMedia/CoreMedia.h VideoToolbox/VideoToolbox.h], [],
1752 [AC_MSG_ERROR([MacOS X 10.9 SDK or later is required])])
1754 fi # COMPILE_ENVIRONMENT
1756 dnl ========================================================
1757 dnl = Handle dependent MEDIA defines
1758 dnl ========================================================
1761 AC_DEFINE(MOZ_WEBM_ENCODER)
1762 AC_SUBST(MOZ_WEBM_ENCODER)
1764 dnl ========================================================
1766 dnl ========================================================
1768 MOZ_ARG_DISABLE_BOOL(negotiateauth,
1769 [ --disable-negotiateauth Disable GSS-API negotiation ],
1770 MOZ_AUTH_EXTENSION=,
1771 MOZ_AUTH_EXTENSION=1 )
1773 dnl ========================================================
1774 dnl Searching of system directories for extensions.
1775 dnl Note: this switch is meant to be used for test builds
1776 dnl whose behavior should not depend on what happens to be
1777 dnl installed on the local machine.
1778 dnl ========================================================
1779 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
1780 [ --disable-system-extension-dirs
1781 Disable searching system- and account-global
1782 directories for extensions of any kind; use
1783 only profile-specific extension directories],
1784 ENABLE_SYSTEM_EXTENSION_DIRS=,
1785 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
1786 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
1787 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
1790 dnl ========================================================
1791 dnl = Universalchardet
1792 dnl ========================================================
1793 MOZ_ARG_DISABLE_BOOL(universalchardet,
1794 [ --disable-universalchardet
1795 Disable universal encoding detection],
1796 MOZ_UNIVERSALCHARDET=,
1797 MOZ_UNIVERSALCHARDET=1 )
1799 dnl ========================================================
1801 dnl ========================================================
1803 if test "$COMPILE_ENVIRONMENT" ; then
1805 dnl Moved gamepad platform check to moz.build, linux header check still needed here.
1806 if test "$OS_TARGET" = "Linux"; then
1807 MOZ_CHECK_HEADER([linux/joystick.h])
1808 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
1809 AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
1813 fi # COMPILE_ENVIRONMENT
1816 dnl ========================================================
1817 dnl = Breakpad crash reporting (on by default on supported platforms)
1818 dnl ========================================================
1821 i?86-*-mingw*|x86_64-*-mingw*|aarch64-*-mingw*)
1824 i?86-apple-darwin*|x86_64-apple-darwin*)
1827 *-android*|*-linuxandroid*)
1828 dnl Android/arm is arm-unknown-linux-androideabi, so android condition should
1829 dnl be before Linux condition
1830 dnl The crash reporter prevents crash stacktraces to be logged in the
1831 dnl logs so we leave it out by default in developer builds.
1832 if test -z "$DEVELOPER_OPTIONS"; then
1836 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
1837 if test "$MOZ_ENABLE_GTK"; then
1843 MOZ_ARG_DISABLE_BOOL(crashreporter,
1844 [ --disable-crashreporter Disable breakpad crash reporting],
1845 [MOZ_CRASHREPORTER=],
1846 [MOZ_CRASHREPORTER=F # Force enable breakpad])
1848 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin" -a "$MOZ_WIDGET_TOOLKIT" != "android"; then
1849 if test "$MOZ_CRASHREPORTER" = F; then
1850 AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
1855 if test -n "$MOZ_CRASHREPORTER"; then
1856 AC_DEFINE(MOZ_CRASHREPORTER)
1858 if test "$OS_TARGET" = "Linux" && \
1859 test -z "$SKIP_LIBRARY_CHECKS"; then
1860 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
1863 if test "$OS_ARCH" = "WINNT"; then
1864 if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
1865 MOZ_CRASHREPORTER_INJECTOR=1
1866 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
1871 dnl ========================================================
1872 dnl = Enable compilation of specific extension modules
1873 dnl ========================================================
1875 MOZ_ARG_ENABLE_STRING(extensions,
1876 [ --enable-extensions Enable extensions],
1877 [ for option in `echo $enableval | sed 's/,/ /g'`; do
1878 if test "$option" = "yes" -o "$option" = "all"; then
1879 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
1880 elif test "$option" = "no" -o "$option" = "none"; then
1882 elif test "$option" = "default"; then
1883 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
1884 elif test `echo "$option" | grep -c \^-` != 0; then
1885 option=`echo $option | sed 's/^-//'`
1886 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
1888 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
1891 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
1893 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
1894 dnl when trying to build a nonexistent extension.
1895 for extension in $MOZ_EXTENSIONS; do
1896 if test ! -d "${srcdir}/extensions/${extension}"; then
1897 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
1901 # Avoid defining MOZ_ENABLE_CAIRO_FT on Windows platforms because
1902 # "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
1903 if test -n "$MOZ_TREE_FREETYPE" -a "$OS_TARGET" != WINNT; then
1904 MOZ_ENABLE_CAIRO_FT=1
1905 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
1906 CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
1907 AC_SUBST_LIST(CAIRO_FT_CFLAGS)
1910 AC_CHECK_PROGS(WGET, wget, "")
1913 dnl ========================================================
1915 dnl ========================================================
1917 MOZ_ARG_DISABLE_BOOL(updater,
1918 [ --disable-updater Disable building of updater],
1922 if test -n "$MOZ_UPDATER"; then
1923 AC_DEFINE(MOZ_UPDATER)
1926 dnl ========================================================
1927 dnl parental controls (for Windows Vista)
1928 dnl ========================================================
1929 MOZ_ARG_DISABLE_BOOL(parental-controls,
1930 [ --disable-parental-controls
1931 Do not build parental controls],
1932 MOZ_DISABLE_PARENTAL_CONTROLS=1,
1933 MOZ_DISABLE_PARENTAL_CONTROLS=)
1934 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
1935 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
1938 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
1940 dnl ========================================================
1941 dnl = Disable smartcard support
1942 dnl ========================================================
1943 if test -n "$MOZ_NO_SMART_CARDS"; then
1944 AC_DEFINE(MOZ_NO_SMART_CARDS)
1946 AC_SUBST(MOZ_NO_SMART_CARDS)
1948 dnl ========================================================
1949 dnl = Sandboxing support
1950 dnl ========================================================
1951 if test -n "$MOZ_TSAN" -o -n "$MOZ_ASAN"; then
1952 # Bug 1182565: TSan conflicts with sandboxing on Linux.
1953 # Bug 1287971: LSan also conflicts with sandboxing on Linux.
1961 MOZ_ARG_DISABLE_BOOL(sandbox,
1962 [ --disable-sandbox Disable sandboxing support],
1966 case "$OS_TARGET" in
1967 WINNT|Darwin|OpenBSD)
1973 # Linux sandbox is only available on x86 and x86_64.
1980 # Only enable the sandbox by default on Linux, OpenBSD, macOS, and Windows
1985 if test -n "$MOZ_SANDBOX"; then
1986 AC_DEFINE(MOZ_SANDBOX)
1989 AC_SUBST(MOZ_SANDBOX)
1992 dnl ========================================================
1994 dnl = Module specific options
1996 dnl ========================================================
1997 MOZ_ARG_HEADER(Individual module options)
1999 dnl ==============================
2000 dnl === SQLite fdatasync check ===
2001 dnl ==============================
2002 dnl Check to see if fdatasync is available and make use of it
2003 AC_CHECK_FUNC(fdatasync)
2005 dnl ========================================================
2006 dnl = Disable zipwriter
2007 dnl ========================================================
2008 MOZ_ARG_DISABLE_BOOL(zipwriter,
2009 [ --disable-zipwriter Disable zipwriter component],
2012 AC_SUBST(MOZ_ZIPWRITER)
2014 dnl ========================================================
2016 dnl = Feature options that require extra sources to be pulled
2018 dnl ========================================================
2019 dnl MOZ_ARG_HEADER(Features that require extra sources)
2021 dnl ========================================================
2023 dnl = Runtime debugging and Optimization Options
2025 dnl ========================================================
2026 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
2028 dnl ========================================================
2029 dnl = Enable code optimization. ON by default.
2030 dnl ========================================================
2032 # Use value from moz.configure if one is defined. Else use our computed
2034 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
2035 MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
2038 if test "$COMPILE_ENVIRONMENT"; then
2039 if test -n "$MOZ_OPTIMIZE"; then
2040 AC_MSG_CHECKING([for valid C compiler optimization flags])
2041 _SAVE_CFLAGS=$CFLAGS
2042 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
2043 AC_TRY_COMPILE([#include <stdio.h>],
2044 [printf("Hello World\n");],
2047 AC_MSG_RESULT([$_results])
2048 if test "$_results" = "no"; then
2049 AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
2051 CFLAGS=$_SAVE_CFLAGS
2052 if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
2053 # When using llvm-based LTO, non numeric optimization levels are
2054 # not supported by the linker, so force the linker to use -O2 (
2055 # which doesn't influence the level compilation units are actually
2057 case " $MOZ_OPTIMIZE_FLAGS " in
2058 *\ -Os\ *|*\ -Oz\ *)
2059 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
2064 fi # COMPILE_ENVIRONMENT
2066 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
2067 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
2068 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
2070 dnl ========================================================
2071 dnl = Enable runtime logging
2072 dnl ========================================================
2073 AC_DEFINE(MOZ_LOGGING)
2074 AC_DEFINE(FORCE_PR_LOG)
2076 dnl ========================================================
2077 dnl = This will enable logging of addref, release, ctor, dtor.
2078 dnl ========================================================
2079 _ENABLE_LOGREFCNT=42
2080 MOZ_ARG_ENABLE_BOOL(logrefcnt,
2081 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
2082 _ENABLE_LOGREFCNT=1,
2083 _ENABLE_LOGREFCNT= )
2084 if test "$_ENABLE_LOGREFCNT" = "1"; then
2085 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
2086 elif test -z "$_ENABLE_LOGREFCNT"; then
2087 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
2090 dnl ========================================================
2091 dnl moz_dump_painting
2092 dnl ========================================================
2093 MOZ_ARG_ENABLE_BOOL(dump-painting,
2094 [ --enable-dump-painting Enable paint debugging.],
2095 MOZ_DUMP_PAINTING=1,
2096 MOZ_DUMP_PAINTING= )
2097 if test -n "$MOZ_DUMP_PAINTING"; then
2098 AC_DEFINE(MOZ_DUMP_PAINTING)
2099 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
2101 if test -n "$MOZ_DEBUG"; then
2102 AC_DEFINE(MOZ_DUMP_PAINTING)
2105 case "${OS_TARGET}" in
2106 Android|WINNT|Darwin)
2107 MOZ_GLUE_IN_PROGRAM=
2110 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
2111 MOZ_GLUE_IN_PROGRAM=1
2112 AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
2116 dnl ========================================================
2117 dnl = Jemalloc build setup
2118 dnl ========================================================
2119 if test -z "$MOZ_MEMORY"; then
2122 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
2123 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.])
2128 dnl The generic feature tests that determine how to compute ncpus are long and
2129 dnl complicated. Therefore, simply define special cpp variables for the
2130 dnl platforms we have special knowledge of.
2133 export MOZ_NO_DEBUG_RTL=1
2137 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
2139 dnl ========================================================
2140 dnl = Enable using the clang plugin to build
2141 dnl ========================================================
2143 if test -n "$COMPILE_ENVIRONMENT"; then
2144 MOZ_CONFIG_CLANG_PLUGIN
2145 fi # COMPILE_ENVIRONMENT
2147 dnl ========================================================
2148 dnl = frontend JS debug mode
2149 dnl ========================================================
2151 MOZ_ARG_ENABLE_BOOL(debug-js-modules,
2152 [ --enable-debug-js-modules Enable debug mode for frontend JS libraries],
2156 AC_SUBST(DEBUG_JS_MODULES)
2158 dnl ========================================================
2160 dnl = Profiling and Instrumenting
2162 dnl ========================================================
2163 MOZ_ARG_HEADER(Profiling and Instrumenting)
2165 dnl ========================================================
2166 dnl = Support for demangling undefined symbols
2167 dnl ========================================================
2168 if test -z "$SKIP_LIBRARY_CHECKS"; then
2171 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
2175 # Demangle only for debug or DMD builds
2176 MOZ_DEMANGLE_SYMBOLS=
2177 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
2178 MOZ_DEMANGLE_SYMBOLS=1
2179 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
2181 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
2183 dnl ========================================================
2184 dnl = Support for gcc stack unwinding (from gcc 3.3)
2185 dnl ========================================================
2186 if test -z "$SKIP_LIBRARY_CHECKS"; then
2189 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
2193 dnl ========================================================
2197 dnl ========================================================
2198 MOZ_ARG_HEADER(Misc. Options)
2200 dnl ========================================================
2201 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
2202 dnl ========================================================
2203 MOZ_ARG_WITH_STRING(user-appdir,
2204 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
2205 [ val=`echo $withval`
2206 if echo "$val" | grep "\/" >/dev/null; then
2207 AC_MSG_ERROR("Homedir must be single relative path.")
2212 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
2214 if test -z "$SKIP_COMPILER_CHECKS"; then
2215 dnl ========================================================
2217 dnl = Compiler Options
2219 dnl ========================================================
2220 MOZ_ARG_HEADER(Compiler Options)
2222 dnl ========================================================
2223 dnl Check for gcc -pipe support
2224 dnl ========================================================
2225 AC_MSG_CHECKING([for -pipe support])
2226 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
2227 dnl Any gcc that supports firefox supports -pipe.
2228 CFLAGS="$CFLAGS -pipe"
2229 CXXFLAGS="$CXXFLAGS -pipe"
2230 AC_MSG_RESULT([yes])
2235 fi # ! SKIP_COMPILER_CHECKS
2239 if test "$COMPILE_ENVIRONMENT"; then
2241 fi # COMPILE_ENVIRONMENT
2243 dnl ========================================================
2245 dnl = Static Build Options
2247 dnl ========================================================
2248 MOZ_ARG_HEADER(Static build options)
2250 if test -z "$MOZ_SYSTEM_ZLIB"; then
2251 if test -n "$JS_SHARED_LIBRARY" -o -n "$MOZ_LINKER" -o "$MOZ_WIDGET_TOOLKIT" = android; then
2253 AC_DEFINE(ZLIB_IN_MOZGLUE)
2257 AC_SUBST(ZLIB_IN_MOZGLUE)
2259 dnl ========================================================
2261 dnl = Standalone module options
2263 dnl ========================================================
2264 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
2267 dnl ========================================================
2269 if test -z "$SKIP_PATH_CHECKS"; then
2270 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
2271 if test "$MOZ_ENABLE_GTK" ; then
2272 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
2277 if test -z "${GLIB_GMODULE_LIBS}" \
2278 -a -n "${GLIB_CONFIG}"\
2279 -a "${GLIB_CONFIG}" != no\
2281 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
2284 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
2286 if test "$USE_FC_FREETYPE"; then
2287 if test "$COMPILE_ENVIRONMENT"; then
2288 dnl ========================================================
2289 dnl = Check for freetype2 functionality
2290 dnl ========================================================
2291 if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
2293 _SAVE_CFLAGS="$CFLAGS"
2294 LIBS="$LIBS $FT2_LIBS"
2295 CFLAGS="$CFLAGS $FT2_CFLAGS"
2297 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
2298 ac_cv_member_FT_Bitmap_Size_y_ppem,
2299 [AC_TRY_COMPILE([#include <ft2build.h>
2300 #include FT_FREETYPE_H],
2302 if (sizeof s.y_ppem) return 0;
2304 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
2305 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
2306 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
2307 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
2309 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
2311 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
2312 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
2313 [FT_Bitmap_Size structure includes y_ppem field])
2315 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
2318 CFLAGS="$_SAVE_CFLAGS"
2321 _SAVE_CPPFLAGS="$CPPFLAGS"
2322 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
2323 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
2324 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
2325 CPPFLAGS="$_SAVE_CPPFLAGS"
2329 dnl ========================================================
2330 dnl Check if we need the 32-bit Linux SSE2 error dialog
2331 dnl ========================================================
2333 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
2335 dnl ========================================================
2336 dnl Check for pixman and cairo
2337 dnl ========================================================
2340 MOZ_ARG_ENABLE_BOOL(system-cairo,
2341 [ --enable-system-cairo Obsolete: do not use this option],
2342 AC_MSG_ERROR(--enable-system-cairo is not supported),
2346 MOZ_ARG_ENABLE_BOOL(system-pixman,
2347 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
2349 MOZ_TREE_PIXMAN=force,
2352 if test "$MOZ_TREE_PIXMAN"; then
2353 AC_DEFINE(MOZ_TREE_PIXMAN)
2355 PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.19.2)
2358 MOZ_CAIRO_CFLAGS="-I${DIST}/include/cairo"
2359 AC_DEFINE(MOZ_TREE_CAIRO)
2361 if test "$OS_ARCH" = "WINNT"; then
2362 # For now we assume that we will have a uint64_t available through
2363 # one of the above headers or mozstdint.h.
2364 AC_DEFINE(HAVE_UINT64_T)
2367 # Define macros for cairo-features.h
2368 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
2369 if test "$MOZ_X11"; then
2370 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
2371 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
2372 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
2374 if test "$_HAVE_FREETYPE2"; then
2375 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2376 MOZ_ENABLE_CAIRO_FT=1
2377 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
2380 case "$MOZ_WIDGET_TOOLKIT" in
2382 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
2383 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
2384 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
2387 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
2388 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
2389 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
2391 if test "$COMPILE_ENVIRONMENT"; then
2392 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
2396 if test "$USE_FC_FREETYPE"; then
2397 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
2399 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
2400 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
2402 AC_SUBST(PS_SURFACE_FEATURE)
2403 AC_SUBST(SVG_SURFACE_FEATURE)
2404 AC_SUBST(XLIB_SURFACE_FEATURE)
2405 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
2406 AC_SUBST(QUARTZ_SURFACE_FEATURE)
2407 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
2408 AC_SUBST(WIN32_SURFACE_FEATURE)
2409 AC_SUBST(OS2_SURFACE_FEATURE)
2410 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
2411 AC_SUBST(FT_FONT_FEATURE)
2412 AC_SUBST(FC_FONT_FEATURE)
2413 AC_SUBST(WIN32_FONT_FEATURE)
2414 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
2415 AC_SUBST(QUARTZ_FONT_FEATURE)
2416 AC_SUBST(PNG_FUNCTIONS_FEATURE)
2417 AC_SUBST(QT_SURFACE_FEATURE)
2418 AC_SUBST(TEE_SURFACE_FEATURE)
2420 if test "$MOZ_X11"; then
2421 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
2424 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
2426 case "$MOZ_WIDGET_TOOLKIT" in
2428 TK_CFLAGS="$MOZ_CAIRO_CFLAGS $MOZ_PIXMAN_CFLAGS"
2429 TK_LIBS="$MOZ_CAIRO_LIBS $MOZ_PIXMAN_LIBS"
2433 AC_SUBST(MOZ_TREE_CAIRO)
2434 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
2435 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
2436 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
2437 AC_SUBST(MOZ_TREE_PIXMAN)
2439 BINDGEN_SYSTEM_FLAGS="$_BINDGEN_CFLAGS $NSPR_CFLAGS $NSS_CFLAGS $MOZ_PIXMAN_CFLAGS $MOZ_CAIRO_CFLAGS"
2440 AC_SUBST(BINDGEN_SYSTEM_FLAGS)
2441 BINDGEN_SYSTEM_TOML_FLAGS="$BINDGEN_SYSTEM_FLAGS"
2442 AC_SUBST_TOML_LIST(BINDGEN_SYSTEM_TOML_FLAGS)
2444 dnl ========================================================
2446 dnl ========================================================
2447 MOZ_ARG_DISABLE_BOOL(xul,
2448 [ --disable-xul Disable XUL],
2450 if test "$MOZ_XUL"; then
2453 dnl remove extensions that require XUL
2454 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
2459 dnl ========================================================
2460 dnl necko configuration options
2461 dnl ========================================================
2464 dnl option to disable necko's wifi scanner
2467 if test "$MOZ_WIDGET_TOOLKIT"; then
2469 case "$OS_TARGET" in
2473 DragonFly|FreeBSD|WINNT)
2484 MOZ_ARG_DISABLE_BOOL(necko-wifi,
2485 [ --disable-necko-wifi Disable necko wifi scanner],
2489 if test "$NECKO_WIFI"; then
2490 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
2491 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
2493 AC_DEFINE(NECKO_WIFI)
2495 AC_SUBST(NECKO_WIFI)
2496 AC_SUBST(NECKO_WIFI_DBUS)
2498 dnl ========================================================
2500 dnl = Maintainer debug option (no --enable equivalent)
2502 dnl ========================================================
2505 AC_SUBST_LIST(ASFLAGS)
2508 AC_SUBST(MOZ_AUTH_EXTENSION)
2509 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
2510 AC_SUBST_LIST(WARNINGS_CFLAGS)
2511 AC_SUBST_SET(MOZ_EXTENSIONS)
2513 AC_SUBST(MOZ_UNIVERSALCHARDET)
2514 AC_SUBST(MOZ_SPELLCHECK)
2515 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
2516 AC_SUBST(MOZ_CRASHREPORTER)
2517 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
2518 AC_SUBST(MOZ_STUB_INSTALLER)
2519 AC_SUBST(MOZ_UPDATER)
2521 AC_SUBST(MOZ_ANDROID_APPLICATION_CLASS)
2522 AC_SUBST(MOZ_ANDROID_BROWSER_INTENT_CLASS)
2523 AC_SUBST(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
2524 AC_SUBST(INCREMENTAL_LINKER)
2526 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
2528 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
2529 AC_SUBST(MOZ_LINKER_EXTRACT)
2531 if test -n "$MOZ_BINARY_EXTENSIONS"; then
2532 AC_DEFINE(MOZ_BINARY_EXTENSIONS)
2535 AC_SUBST(MOZ_REQUIRE_SIGNING)
2536 if test "$MOZ_REQUIRE_SIGNING" = 1; then
2537 AC_DEFINE(MOZ_REQUIRE_SIGNING)
2540 dnl ========================================================
2541 dnl = Mac bundle name prefix
2542 dnl ========================================================
2543 MOZ_ARG_WITH_STRING(macbundlename-prefix,
2544 [ --with-macbundlename-prefix=prefix
2545 Prefix for MOZ_MACBUNDLE_NAME],
2546 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
2548 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
2549 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
2550 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
2553 if test "$MOZ_DEBUG"; then
2554 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
2556 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
2558 AC_SUBST(MOZ_MACBUNDLE_NAME)
2560 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
2561 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
2562 # Otherwise, use MOZ_APP_DISPLAYNAME
2563 if test -z "$MOZ_MACBUNDLE_ID"; then
2564 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
2566 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
2567 if test "$MOZ_DEBUG"; then
2568 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
2571 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
2572 AC_SUBST(MOZ_MACBUNDLE_ID)
2574 dnl ========================================================
2575 dnl = Child Process Name for IPC
2576 dnl ========================================================
2577 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
2578 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
2580 # We want to let Android unpack the file at install time, but it only does
2581 # so if the file is named libsomething.so. The lib/ path is also required
2582 # because the unpacked file will be under the lib/ subdirectory and will
2583 # need to be executed from that path.
2584 MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
2586 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
2587 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
2589 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
2590 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
2591 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
2593 # The following variables are available to branding and application
2594 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
2595 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
2596 # impacts profile location and user-visible fields.
2597 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
2598 # Mac Bundle name, Updater, Installer), it is typically used for nightly
2599 # builds (e.g. Aurora for Firefox).
2600 # - MOZ_APP_PROFILE: When set, used for application.ini's
2601 # "Profile" field, which controls profile location.
2602 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
2603 # crash reporter server url.
2604 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
2606 # The following environment variables used to have an effect, but don't anymore:
2607 # - MOZ_APP_VERSION: Defines the application version number. This was replaced with
2608 # the contents from the version.txt file in the application directory, or
2609 # browser/config/version.txt if there isn't one.
2610 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
2611 # in the "About" window. This was replaced with the contents from the
2612 # version_display.txt or version.txt in the application directory, or
2613 # browser/config/version_display.txt.
2615 # For extensions and langpacks, we require a max version that is compatible
2616 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
2617 # 24.0a1 and 24.0a2 aren't affected
2619 # 24.1.1 becomes 24.*
2620 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
2621 if test -z "$IS_ALPHA"; then
2623 if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
2624 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
2626 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
2630 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
2633 AC_SUBST(MOZ_APP_DISPLAYNAME)
2634 AC_SUBST(MOZ_APP_VENDOR)
2635 AC_SUBST(MOZ_APP_PROFILE)
2636 AC_SUBST(MOZ_APP_ID)
2637 AC_SUBST(MAR_CHANNEL_ID)
2638 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
2639 AC_SUBST(MOZ_PROFILE_MIGRATOR)
2640 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
2641 AC_SUBST(MOZ_APP_UA_NAME)
2642 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
2643 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
2644 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
2646 AC_SUBST(MOZ_APP_MAXVERSION)
2647 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
2648 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
2649 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
2652 AC_SUBST(MOZ_PKG_SPECIAL)
2653 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
2655 if test "$MOZILLA_OFFICIAL"; then
2656 # Build revisions should always be present in official builds
2657 MOZ_INCLUDE_SOURCE_INFO=1
2660 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
2661 # explicitly set the repository and changeset information in.
2662 AC_SUBST(MOZ_SOURCE_REPO)
2663 AC_SUBST(MOZ_SOURCE_CHANGESET)
2664 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
2666 dnl If we have any service that uploads data (and requires data submission
2667 dnl policy alert), set MOZ_DATA_REPORTING.
2668 dnl We need SUBST for build system and DEFINE for xul preprocessor.
2669 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER" || test -n "$MOZ_NORMANDY"; then
2670 MOZ_DATA_REPORTING=1
2671 AC_DEFINE(MOZ_DATA_REPORTING)
2672 AC_SUBST(MOZ_DATA_REPORTING)
2676 AC_SUBST(WIN32_REDIST_DIR)
2677 AC_SUBST(WIN_UCRT_REDIST_DIR)
2679 dnl Echo the CFLAGS to remove extra whitespace.
2681 $_COMPILATION_CFLAGS \
2685 $_WARNINGS_CXXFLAGS \
2686 $_COMPILATION_CXXFLAGS \
2689 COMPILE_CFLAGS=`echo \
2693 COMPILE_CXXFLAGS=`echo \
2694 $_DEFINES_CXXFLAGS \
2698 $_WARNINGS_HOST_CFLAGS \
2699 $_COMPILATION_HOST_CFLAGS \
2702 HOST_CXXFLAGS=`echo \
2703 $_WARNINGS_HOST_CXXFLAGS \
2704 $_COMPILATION_HOST_CXXFLAGS \
2707 AC_SUBST(MOZ_SYSTEM_PNG)
2709 AC_SUBST_LIST(MOZ_PNG_CFLAGS)
2710 AC_SUBST_LIST(MOZ_PNG_LIBS)
2712 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
2713 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
2714 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
2715 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
2716 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
2717 OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
2718 OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
2720 AC_SUBST(HOST_CMFLAGS)
2721 AC_SUBST(HOST_CMMFLAGS)
2722 AC_SUBST(OS_COMPILE_CMFLAGS)
2723 AC_SUBST(OS_COMPILE_CMMFLAGS)
2726 OS_CXXFLAGS="$CXXFLAGS"
2727 OS_CPPFLAGS="$CPPFLAGS"
2728 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
2729 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
2730 OS_LDFLAGS="$LDFLAGS"
2732 AC_SUBST_LIST(OS_CFLAGS)
2733 AC_SUBST_LIST(OS_CXXFLAGS)
2734 AC_SUBST_LIST(OS_CPPFLAGS)
2735 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
2736 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
2737 AC_SUBST_LIST(OS_LDFLAGS)
2742 AC_SUBST_LIST(HOST_CFLAGS)
2743 AC_SUBST_LIST(HOST_CPPFLAGS)
2744 AC_SUBST_LIST(HOST_CXXFLAGS)
2745 AC_SUBST(HOST_LDFLAGS)
2746 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
2747 AC_SUBST(HOST_BIN_SUFFIX)
2749 AC_SUBST(TARGET_XPCOM_ABI)
2750 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
2751 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
2752 AC_SUBST(HAVE_X86_AVX2)
2753 AC_SUBST(HAVE_ALTIVEC)
2755 AC_SUBST_LIST(DSO_CFLAGS)
2756 AC_SUBST_LIST(DSO_PIC_CFLAGS)
2757 AC_SUBST(DSO_LDOPTS)
2758 AC_SUBST(BIN_SUFFIX)
2760 AC_SUBST(NS_ENABLE_TSF)
2761 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
2762 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
2764 AC_SUBST(MOZ_DEVTOOLS)
2766 AC_SUBST(MOZ_PACKAGE_JSSHELL)
2770 dnl Host JavaScript runtime, if any, to use during cross compiles.
2773 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
2775 if test -n "$COMPILE_ENVIRONMENT"; then
2776 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
2778 dnl Check for missing components
2779 if test "$MOZ_X11"; then
2780 dnl ====================================================
2781 dnl = Check if X headers exist
2782 dnl ====================================================
2783 _SAVE_CFLAGS=$CFLAGS
2784 CFLAGS="$CFLAGS $XCFLAGS"
2788 #include <X11/Xlib.h>
2789 #include <X11/Intrinsic.h>
2790 #include <X11/extensions/XShm.h>
2794 if ((dpy = XOpenDisplay(NULL)) == NULL) {
2795 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
2799 [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
2800 CFLAGS="$_SAVE_CFLAGS"
2802 if test -n "$MISSING_X"; then
2803 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
2808 fi # COMPILE_ENVIRONMENT
2810 dnl Set various defines and substitutions
2811 dnl ========================================================
2813 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
2814 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
2815 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
2816 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
2817 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
2818 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
2819 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
2820 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
2821 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
2824 AC_SUBST(MOZ_DEV_EDITION)
2825 if test -n "$MOZ_DEV_EDITION"; then
2826 AC_DEFINE(MOZ_DEV_EDITION)
2829 if test "$MOZ_DEBUG" -o "$DEVELOPER_OPTIONS"; then
2833 if test -n "$A11Y_LOG"; then
2837 dnl Spit out some output
2838 dnl ========================================================
2840 # Avoid using obsolete NSPR features
2841 AC_DEFINE(NO_NSPR_10_SUPPORT)
2843 MOZ_CREATE_CONFIG_STATUS()
2845 rm -fr confdefs* $ac_clean_files