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, :)
110 if test -n "$MOZ_WINCONSOLE"; then
111 AC_DEFINE(MOZ_WINCONSOLE)
116 dnl ========================================================
117 dnl Special win32 checks
118 dnl ========================================================
124 if test "$GCC" != "yes"; then
125 # Check to see if we are really running in a msvc environemnt
128 # Make sure compilers are valid
129 CXXFLAGS="$CXXFLAGS -TP"
132 AC_TRY_COMPILE([#include <stdio.h>],
133 [ printf("Hello World\n"); ],,
134 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
137 AC_TRY_COMPILE([#include <new.h>],
138 [ unsigned *test = new unsigned(42); ],,
139 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
143 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
146 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
147 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
148 AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
151 MSVC_C_RUNTIME_DLL=vcruntime140.dll
152 MSVC_CXX_RUNTIME_DLL=msvcp140.dll
154 # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
155 CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
157 if test -n "$WIN_UCRT_REDIST_DIR"; then
158 if test ! -d "$WIN_UCRT_REDIST_DIR"; then
159 AC_MSG_ERROR([Invalid Windows UCRT Redist directory: ${WIN_UCRT_REDIST_DIR}])
161 WIN_UCRT_REDIST_DIR=`cd "$WIN_UCRT_REDIST_DIR" && (pwd -W 2>/dev/null || pwd)`
164 AC_SUBST(MSVC_C_RUNTIME_DLL)
165 AC_SUBST(MSVC_CXX_RUNTIME_DLL)
167 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
169 if test -n "$WIN32_REDIST_DIR"; then
170 if test ! -d "$WIN32_REDIST_DIR"; then
171 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
173 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && (pwd -W 2>/dev/null || pwd)`
176 # Check linker version, except in lld builds
181 _LD_FULL_VERSION=`"${LINKER}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
182 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
183 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
184 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
191 unset _MSVC_VER_FILTER
194 STL_FLAGS="-I${DIST}/stl_wrappers"
196 # Check w32api version
197 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
198 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
199 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
200 AC_TRY_COMPILE([#include <w32api.h>],
201 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
202 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
203 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
204 #error "test failed."
206 , [ res=yes ], [ res=no ])
207 AC_MSG_RESULT([$res])
208 if test "$res" != "yes"; then
209 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
211 # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
212 # causing problems with local implementations with the same name.
213 AC_DEFINE(STRSAFE_NO_DEPRECATE)
216 CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
217 CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
219 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
220 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
221 # Require OS features provided by IE 8.0 (Win7)
222 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0800)
227 if test -n "$_WIN32_MSVC"; then
229 SKIP_COMPILER_CHECKS=1
230 SKIP_LIBRARY_CHECKS=1
232 # Since we're skipping compiler and library checks, hard-code
235 AC_DEFINE(HAVE_ISATTY)
238 fi # COMPILE_ENVIRONMENT
243 AC_SUBST_LIST(STL_FLAGS)
244 AC_SUBST(WRAP_STL_INCLUDES)
246 dnl ========================================================
247 dnl Checks for programs.
248 dnl ========================================================
249 if test "$COMPILE_ENVIRONMENT"; then
255 fi # COMPILE_ENVIRONMENT
257 dnl ========================================================
258 dnl set the defaults first
259 dnl ========================================================
260 MOZ_USER_DIR=".mozilla"
262 MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
266 dnl Configure platform-specific CPU architecture compiler options.
267 dnl ==============================================================
268 if test "$COMPILE_ENVIRONMENT"; then
270 fi # COMPILE_ENVIRONMENT
272 dnl ========================================================
273 dnl Android libstdc++
274 dnl ========================================================
277 if test "$COMPILE_ENVIRONMENT"; then
279 fi # COMPILE_ENVIRONMENT
281 dnl ========================================================
282 dnl Suppress Clang Argument Warnings
283 dnl ========================================================
284 WARNINGS_CFLAGS="$_WARNINGS_CFLAGS"
285 if test -n "${CLANG_CC}${CLANG_CL}"; then
286 WARNINGS_CFLAGS="-Qunused-arguments $WARNINGS_CFLAGS"
287 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
289 if test -n "${CLANG_CXX}${CLANG_CL}"; then
290 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
293 if test -n "$COMPILE_ENVIRONMENT"; then
297 dnl ========================================================
298 dnl GNU specific defaults
299 dnl ========================================================
300 if test "$GNU_CC"; then
304 SSSE3_FLAGS="-mssse3"
305 CFLAGS="$CFLAGS -fno-strict-aliasing"
308 if test "$OS_ARCH" != "WINNT" -o -z "$CLANG_CC"; then
309 DSO_PIC_CFLAGS='-fPIC'
310 ASFLAGS="$ASFLAGS -fPIC"
313 AC_MSG_CHECKING([for --noexecstack option to as])
315 CFLAGS="$CFLAGS -Wa,--noexecstack"
316 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
317 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
320 AC_MSG_CHECKING([for -z noexecstack option to ld])
321 _SAVE_LDFLAGS=$LDFLAGS
322 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
323 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
325 LDFLAGS=$_SAVE_LDFLAGS)
327 AC_MSG_CHECKING([for -z text option to ld])
328 _SAVE_LDFLAGS=$LDFLAGS
329 LDFLAGS="$LDFLAGS -Wl,-z,text"
330 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
332 LDFLAGS=$_SAVE_LDFLAGS)
334 AC_MSG_CHECKING([for -z relro option to ld])
335 _SAVE_LDFLAGS=$LDFLAGS
336 LDFLAGS="$LDFLAGS -Wl,-z,relro"
337 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
339 LDFLAGS=$_SAVE_LDFLAGS)
341 AC_MSG_CHECKING([for -z nocopyreloc option to ld])
342 _SAVE_LDFLAGS=$LDFLAGS
343 LDFLAGS="$LDFLAGS -Wl,-z,nocopyreloc"
344 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
346 LDFLAGS=$_SAVE_LDFLAGS)
348 AC_MSG_CHECKING([for -Bsymbolic-functions option to ld])
349 _SAVE_LDFLAGS=$LDFLAGS
350 LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
351 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
353 LDFLAGS=$_SAVE_LDFLAGS)
355 AC_MSG_CHECKING([for --build-id=sha1 option to ld])
356 _SAVE_LDFLAGS=$LDFLAGS
357 LDFLAGS="$LDFLAGS -Wl,--build-id=sha1"
358 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
360 LDFLAGS=$_SAVE_LDFLAGS)
362 AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
363 HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
364 _SAVE_LDFLAGS=$LDFLAGS
365 LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
366 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
367 [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
369 LDFLAGS=$_SAVE_LDFLAGS
371 # Check for -mssse3 on $CC
372 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
373 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
375 CFLAGS="$CFLAGS -mssse3"
376 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
377 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
381 # Check for -msse4.1 on $CC
382 AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
383 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
385 CFLAGS="$CFLAGS -msse4.1"
386 AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
387 [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
391 case "${CPU_ARCH}" in
393 AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
395 [asm volatile ("vpermq \$0xd8,%ymm0,%ymm0 \n");],
396 result="yes", result="no")
397 AC_MSG_RESULT("$result")
398 if test "$result" = "yes"; then
404 AC_MSG_CHECKING([whether we can enable AltiVec support])
407 CFLAGS="$CFLAGS -maltivec"
408 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
416 if test "$GCC_USE_GNU_LD"; then
417 # Some tools like ASan use a runtime library that is only
418 # linked against executables, so we must allow undefined
419 # symbols for shared objects in some cases.
420 if test -z "$MOZ_ASAN$MOZ_MSAN$MOZ_UBSAN$MOZ_TSAN$FUZZING_INTERFACES"; then
421 # Don't allow undefined symbols in libraries
422 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
424 # BSDs need `environ' exposed for posix_spawn (bug 753046)
426 DragonFly|FreeBSD|NetBSD|OpenBSD)
427 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
428 DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
430 DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
437 _DEFINES_CFLAGS="-include $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
439 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
442 if test "$GNU_CXX"; then
443 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
445 _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
448 dnl ========================================================
450 dnl ========================================================
452 if test "$MOZ_DMD"; then
453 if test "${CPU_ARCH}" = "arm"; then
454 CFLAGS="$CFLAGS -funwind-tables"
455 CXXFLAGS="$CXXFLAGS -funwind-tables"
459 dnl ========================================================
460 dnl System overrides of the defaults for host
461 dnl ========================================================
464 if test -n "$_WIN32_MSVC"; then
465 HOST_CFLAGS="$HOST_CFLAGS"
467 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
469 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
470 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
473 case "${host_cpu}" in
475 if test -n "$_WIN32_MSVC"; then
476 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
480 if test -n "$_WIN32_MSVC"; then
481 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
483 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
489 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
490 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
493 *-linux*|*-kfreebsd*-gnu|*-gnu*)
494 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
495 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
499 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
500 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
504 dnl ========================================================
505 dnl System overrides of the defaults for target
506 dnl ========================================================
510 MOZ_OPTIMIZE_FLAGS="-O3"
511 CXXFLAGS="$CXXFLAGS -stdlib=libc++"
513 # The ExceptionHandling framework is needed for Objective-C exception
514 # logging code in nsObjCExceptions.h. Currently we only use that in debug
516 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
518 dnl DTrace and -dead_strip don't interact well. See bug 403132.
519 dnl ===================================================================
520 if test "x$enable_dtrace" = "xyes"; then
521 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
523 dnl check for the presence of the -dead_strip linker flag
524 AC_MSG_CHECKING([for -dead_strip option to ld])
525 _SAVE_LDFLAGS=$LDFLAGS
526 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
527 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
528 if test -n "$_HAVE_DEAD_STRIP" ; then
530 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
535 LDFLAGS=$_SAVE_LDFLAGS
538 MOZ_FIX_LINK_PATHS="-Wl,-executable_path,${DIST}/bin"
541 *-android*|*-linuxandroid*)
542 if test "$COMPILE_ENVIRONMENT" -a -n "$MOZ_MEMORY"; then
546 if test -z "$CLANG_CC"; then
547 MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
548 elif test -n "$RELEASE_OR_BETA"; then
549 # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
550 # -Oz is smaller than -Os on clang.
551 MOZ_OPTIMIZE_FLAGS="-Oz"
552 # Disable the outliner, which causes performance regressions, and is
553 # enabled on some platforms at -Oz.
554 if test -z "$MOZ_LTO"; then
555 DISABLE_OUTLINER="-mno-outline"
557 CFLAGS="$CFLAGS $DISABLE_OUTLINER"
558 AC_TRY_COMPILE(,,[MOZ_OPTIMIZE_FLAGS="$MOZ_OPTIMIZE_FLAGS $DISABLE_OUTLINER"])
559 CFLAGS="$_SAVE_CFLAGS"
561 DISABLE_OUTLINER="-Wl,-plugin-opt=-enable-machine-outliner=never"
562 _SAVE_LDFLAGS=$LDFLAGS
563 LDFLAGS="$LDFLAGS $MOZ_LTO_LDFLAGS $DISABLE_OUTLINER"
564 AC_TRY_LINK(,,[MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS $DISABLE_OUTLINER"])
565 LDFLAGS="$_SAVE_LDFLAGS"
568 MOZ_OPTIMIZE_FLAGS="-O2"
573 if test "$GNU_CC" -o "$GNU_CXX"; then
574 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
575 if test -n "$MOZ_DEBUG"; then
576 MOZ_OPTIMIZE_FLAGS="-Os"
578 MOZ_OPTIMIZE_FLAGS="-O2"
580 if test -z "$CLANG_CC"; then
581 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
585 case "${target_cpu}" in
587 CFLAGS="$CFLAGS -mieee"
588 CXXFLAGS="$CXXFLAGS -mieee"
595 # certain versions of cygwin's makedepend barf on the
596 # #include <string> vs -I./dist/include/string issue so don't use it
597 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
598 # $GNU_CC will match gcc and clang; while $CLANG_CC will match only clang
599 if test -z "$CLANG_CC"; then
600 AC_MSG_ERROR(Firefox cannot be built with mingw-gcc and requires a mingw-clang toolchain to work)
604 # mingw doesn't require kernel32, user32, and advapi32 explicitly
605 LIBS="$LIBS -luuid -lusp10 -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
608 MOZ_OPTIMIZE_FLAGS="-O2"
610 WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
611 WIN32_GUI_EXE_LDFLAGS=-mwindows
613 # Silence problematic clang warnings
614 CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
615 LDFLAGS="$LDFLAGS -Wl,--no-insert-timestamp"
617 TARGET_COMPILER_ABI=msvc
618 RANLIB='echo not_ranlib'
619 STRIP='echo not_strip'
620 # aarch64 doesn't support subsystems below 6.02
621 if test "$CPU_ARCH" = "aarch64"; then
622 WIN32_SUBSYSTEM_VERSION=6.02
624 WIN32_SUBSYSTEM_VERSION=6.01
626 WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
627 WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
628 DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
629 _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
630 _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
631 CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
632 CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
633 if test -z "$CLANG_CL"; then
634 CPPFLAGS="$CPPFLAGS -utf-8"
636 if test "$CPU_ARCH" = "x86"; then
637 dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
638 dnl more recent, so set that explicitly here unless another
639 dnl target arch has already been set.
641 if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
642 CFLAGS="$CFLAGS -arch:SSE2"
644 if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
645 CXXFLAGS="$CXXFLAGS -arch:SSE2"
648 SSE_FLAGS="-arch:SSE"
649 SSE2_FLAGS="-arch:SSE2"
650 dnl MSVC allows the use of intrinsics without any flags
651 dnl and doesn't have a separate arch for SSSE3
652 SSSE3_FLAGS="-arch:SSE2"
654 dnl clang-cl requires appropriate flags to enable SSSE3 support
655 dnl on all architectures.
656 if test -n "$CLANG_CL"; then
657 SSSE3_FLAGS="-mssse3"
659 dnl VS2013+ supports -Gw for better linker optimizations.
660 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
661 dnl Disabled on ASan because it causes false-positive ODR violations.
662 if test -z "$MOZ_ASAN"; then
664 CXXFLAGS="$CXXFLAGS -Gw"
666 # String tail merging doesn't play nice with ASan's ODR checker.
667 LDFLAGS="$LDFLAGS -opt:nolldtailmerge"
669 if test -n "$CLANG_CL"; then
670 # XXX We should combine some of these with our generic GCC-style
673 # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
674 CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
675 # We use offsetof on non-POD objects all the time.
676 # We also suppress this warning on other platforms.
677 CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
678 # This warns for reasonable things like:
679 # enum { X = 0xffffffffU };
680 # which is annoying for IDL headers.
681 CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
682 # This warns for cases that would be reached by the Microsoft
683 # #include rules, but also currently warns on cases that would
684 # *also* be reached by standard C++ include rules. That
685 # behavior doesn't seem useful, so we turn it off.
686 CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
687 # We normally error out on unknown pragmas, but since clang-cl
688 # claims to be MSVC, it would be difficult to add
689 # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
690 # use such pragmas, so just ignore them.
691 CFLAGS="$CFLAGS -Wno-unknown-pragmas"
692 CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
693 # We get errors about various #pragma intrinsic directives from
694 # clang-cl, and we don't need to hear about those.
695 CFLAGS="$CFLAGS -Wno-ignored-pragmas"
696 CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
697 # clang-cl's Intrin.h marks things like _ReadWriteBarrier
698 # as __attribute((__deprecated__)). This is nice to know,
699 # but since we don't get the equivalent warning from MSVC,
700 # let's just ignore it.
701 CFLAGS="$CFLAGS -Wno-deprecated-declarations"
702 CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
703 # We use a function like:
704 # __declspec(noreturn) __inline void f() {}
705 # which -Winvalid-noreturn complains about. Again, MSVC seems
706 # OK with it, so let's silence the warning.
707 CFLAGS="$CFLAGS -Wno-invalid-noreturn"
708 CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
709 # Missing |override| on virtual function declarations isn't
710 # something that MSVC currently warns about.
711 CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
712 # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
713 # declaration on |operator delete(void*)|. However, clang-cl
714 # must internally declare |operator delete(void*)| differently,
715 # which causes this warning for virtually every file in the
716 # tree. clang-cl doesn't support -fno-exceptions or equivalent,
717 # so there doesn't seem to be any way to convince clang-cl to
718 # declare |delete| differently. Therefore, suppress this
720 CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
721 # Macros like STDMETHOD() and IFACEMETHOD() can declare
722 # __attribute__((nothrow)) on their respective method declarations,
723 # while the definitions are left without the matching attribute.
724 CXXFLAGS="$CXXFLAGS -Wno-microsoft-exception-spec"
725 # At least one MSVC header and several headers in-tree have
726 # unused typedefs, so turn this on.
727 CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
728 # jemalloc uses __declspec(allocator) as a profiler hint,
729 # which clang-cl doesn't understand.
730 CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
731 # __attribute__((unused)) really means "might be unused" and
732 # we use it to avoid warnings about things that are unused
733 # in some compilation units, but used in many others. This
734 # warning insists on complaining about the latter case, which
735 # is annoying, and rather noisy.
736 CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused"
738 # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
739 CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
740 LIBS="$LIBS user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
741 MOZ_DEBUG_LDFLAGS='-DEBUG'
742 # Use a higher optimization level for clang-cl, so we can come closer
743 # to MSVC's performance numbers (see bug 1443590).
744 if test -n "$CLANG_CL"; then
745 MOZ_OPTIMIZE_FLAGS='-O2'
747 MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
750 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE"
751 if test -z "$DEVELOPER_OPTIONS"; then
752 LDFLAGS="$LDFLAGS -RELEASE"
754 dnl Minimum reqiurement of Gecko is VS2015 or later which supports
755 dnl both SSSE3 and SSE4.1.
756 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
757 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
758 dnl allow AVX2 code from VS2015
761 AC_DEFINE(WIN32_LEAN_AND_MEAN)
762 dnl See http://support.microsoft.com/kb/143208 to use STL
765 MOZ_USER_DIR="Mozilla"
769 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.])
775 if test -n "$GNU_CC"; then
776 CFLAGS="$CFLAGS -mstackrealign"
777 CXXFLAGS="$CXXFLAGS -mstackrealign"
778 LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
780 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
781 LDFLAGS="$LDFLAGS -SAFESEH"
787 if test -n "$_WIN32_MSVC"; then
788 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
793 if test -n "$_WIN32_MSVC"; then
794 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:ARM64"
799 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
806 CFLAGS="$CFLAGS -Dunix"
807 CXXFLAGS="$CXXFLAGS -Dunix"
808 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
809 DSO_PIC_CFLAGS='-fPIC -DPIC'
811 MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
813 DSO_PIC_CFLAGS='-fPIC -DPIC'
816 # This will fail on a.out systems prior to 1.5.1_ALPHA.
817 if test "$LIBRUNPATH"; then
818 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
823 if test -z "$X11BASE"; then
826 MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
828 DSO_PIC_CFLAGS='-fPIC'
829 DSO_LDOPTS='-shared -fPIC'
830 if test "$LIBRUNPATH"; then
831 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
836 MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
841 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
842 MOZ_OPTIMIZE_FLAGS="-O"
845 AC_SUBST_LIST(MMX_FLAGS)
846 AC_SUBST_LIST(SSE_FLAGS)
847 AC_SUBST_LIST(SSE2_FLAGS)
848 AC_SUBST_LIST(SSSE3_FLAGS)
851 if test -n "$MOZ_LINKER"; then
852 AC_DEFINE(MOZ_LINKER)
854 AC_CHECK_PROGS(XZ, xz)
857 if test -z "$COMPILE_ENVIRONMENT"; then
858 SKIP_COMPILER_CHECKS=1
859 SKIP_LIBRARY_CHECKS=1
863 fi # COMPILE_ENVIRONMENT
865 if test -z "$SKIP_COMPILER_CHECKS"; then
866 dnl Checks for typedefs, structures, and compiler characteristics.
867 dnl ========================================================
882 case "${OS_TARGET}" in
886 STL_FLAGS="-I${DIST}/stl_wrappers"
891 if test "$MOZ_BUILD_APP" = "tools/crashreporter"; then
895 dnl Checks for header files.
896 dnl ========================================================
899 bitrig*|dragonfly*|freebsd*|openbsd*)
900 # for stuff like -lXshm
901 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
905 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
906 AC_CACHE_CHECK(for sockaddr_in.sin_len,
907 ac_cv_sockaddr_in_sin_len,
908 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
909 #include <sys/types.h>
911 #include <netinet/in.h>
912 struct sockaddr_in x;
913 void *foo = (void*) &x.sin_len;],
915 [ac_cv_sockaddr_in_sin_len=true],
916 [ac_cv_sockaddr_in_sin_len=false])])
917 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
918 AC_DEFINE(HAVE_SIN_LEN)
919 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
920 AC_DEFINE(HAVE_SCONN_LEN)
923 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
924 ac_cv_sockaddr_in6_sin6_len,
925 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
926 #include <sys/types.h>
928 #include <netinet/in.h>
929 struct sockaddr_in6 x;
930 void *foo = (void*) &x.sin6_len;],
932 [ac_cv_sockaddr_in6_sin6_len=true],
933 [ac_cv_sockaddr_in6_sin6_len=false])])
934 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
935 AC_DEFINE(HAVE_SIN6_LEN)
938 AC_CACHE_CHECK(for sockaddr.sa_len,
939 ac_cv_sockaddr_sa_len,
940 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
941 #include <sys/types.h>
943 #include <sys/socket.h>
945 void *foo = (void*) &x.sa_len;],
947 [ac_cv_sockaddr_sa_len=true],
948 [ac_cv_sockaddr_sa_len=false])])
949 if test "$ac_cv_sockaddr_sa_len" = true ; then
950 AC_DEFINE(HAVE_SA_LEN)
953 dnl Checks for libraries.
954 dnl ========================================================
955 AC_CHECK_LIB(c_r, gethostbyname_r)
957 dnl We don't want to link with libdl even if it's present on OS X, since
958 dnl it's not used and not part of the default installation. OS/2 has dlfcn
960 dnl We don't want to link against libm or libpthread on Darwin since
961 dnl they both are just symlinks to libSystem and explicitly linking
962 dnl against libSystem causes issues when debugging (see bug 299601).
967 AC_SEARCH_LIBS(dlopen, dl,
968 MOZ_CHECK_HEADER(dlfcn.h,
969 AC_DEFINE(HAVE_DLOPEN)))
973 _SAVE_CFLAGS="$CFLAGS"
974 CFLAGS="$CFLAGS -D_GNU_SOURCE"
975 AC_CHECK_FUNCS(dladdr memmem)
976 CFLAGS="$_SAVE_CFLAGS"
978 if test ! "$GNU_CXX"; then
979 AC_CHECK_LIB(C, demangle)
982 AC_CHECK_LIB(socket, socket)
985 XLIBS="$X_EXTRA_LIBS"
987 dnl ========================================================
988 dnl Checks for X libraries.
989 dnl Ordering is important.
990 dnl Xt is dependent upon SM as of X11R6
991 dnl ========================================================
992 if test -n "$MOZ_X11"; then
993 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
994 _SAVE_LDFLAGS="$LDFLAGS"
996 LDFLAGS="$XLDFLAGS $LDFLAGS"
997 AC_CHECK_LIB(X11, XDrawLines, [XLIBS="-lX11 $XLIBS"],
998 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
999 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
1000 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
1002 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
1003 unset ac_cv_lib_Xt_XtFree
1004 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
1005 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
1006 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
1007 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
1010 dnl ========================================================
1012 dnl ========================================================
1013 AC_CHECK_LIB(xcb, xcb_connect, [XLIBS="-lxcb $XLIBS"],
1014 [MISSING_X="$MISSING_X -lxcb"], $XLIBS)
1015 AC_CHECK_LIB(xcb-shm, xcb_shm_query_version, [XLIBS="-lxcb-shm $XLIBS"],
1016 [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS)
1017 AC_CHECK_LIB(X11-xcb, XGetXCBConnection, [XLIBS="-lX11-xcb $XLIBS"],
1018 [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS)
1020 LDFLAGS="$_SAVE_LDFLAGS"
1024 AC_SUBST_LIST(XCFLAGS)
1025 AC_SUBST_LIST(XLDFLAGS)
1026 AC_SUBST_LIST(XLIBS)
1027 AC_SUBST_LIST(XEXT_LIBS)
1028 AC_SUBST_LIST(XT_LIBS)
1030 dnl ========================================================
1031 dnl = pthread support
1032 dnl = Start by checking whether the system support pthreads
1033 dnl ========================================================
1034 case "$target_os" in
1039 AC_CHECK_LIB(pthreads, pthread_create,
1040 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
1041 AC_CHECK_LIB(pthread, pthread_create,
1042 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
1043 AC_CHECK_LIB(c_r, pthread_create,
1044 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
1045 AC_CHECK_LIB(c, pthread_create,
1054 dnl ========================================================
1055 dnl Do the platform specific pthread hackery
1056 dnl ========================================================
1057 if test "$MOZ_USE_PTHREADS"x != x
1060 dnl See if -pthread is supported.
1063 ac_cv_have_dash_pthread=no
1064 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
1065 echo 'int main() { return 0; }' | cat > conftest.c
1066 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
1067 if test $? -eq 0; then
1068 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1069 ac_cv_have_dash_pthread=yes
1070 case "$target_os" in
1072 # Freebsd doesn't use -pthread for compiles, it uses them for linking
1075 CFLAGS="$CFLAGS -pthread"
1076 CXXFLAGS="$CXXFLAGS -pthread"
1082 AC_MSG_RESULT($ac_cv_have_dash_pthread)
1085 dnl See if -pthreads is supported.
1087 ac_cv_have_dash_pthreads=no
1088 if test "$ac_cv_have_dash_pthread" = "no"; then
1089 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
1090 echo 'int main() { return 0; }' | cat > conftest.c
1091 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
1092 if test $? -eq 0; then
1093 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1094 ac_cv_have_dash_pthreads=yes
1095 CFLAGS="$CFLAGS -pthreads"
1096 CXXFLAGS="$CXXFLAGS -pthreads"
1100 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
1105 AC_DEFINE(_REENTRANT)
1106 AC_DEFINE(_THREAD_SAFE)
1107 dnl -pthread links in -lpthread, so don't specify it explicitly.
1108 if test "$ac_cv_have_dash_pthread" = "yes"; then
1109 _PTHREAD_LDFLAGS="-pthread"
1113 *-*-openbsd*|*-*-bsdi*)
1114 AC_DEFINE(_REENTRANT)
1115 AC_DEFINE(_THREAD_SAFE)
1116 dnl -pthread links in -lc_r, so don't specify it explicitly.
1117 if test "$ac_cv_have_dash_pthread" = "yes"; then
1118 _PTHREAD_LDFLAGS="-pthread"
1122 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
1123 AC_DEFINE(_REENTRANT)
1127 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
1128 AC_SUBST(MOZ_USE_PTHREADS)
1129 MOZ_CHECK_HEADERS(pthread.h)
1133 dnl Checks for library functions.
1134 dnl ========================================================
1135 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall)
1137 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1138 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1139 ac_cv_clock_monotonic,
1140 [for libs in "" -lrt; do
1142 _SAVE_CFLAGS="$CFLAGS"
1144 CFLAGS="$CFLAGS $DSO_PIC_CFLAGS"
1145 dnl clock_gettime is available on OSX since 10.12, so depending on MACOSX_DEPLOYMENT_TARGET,
1146 dnl we should or not be able to use it. To detect if we can, we need to make the
1147 dnl availability attribute strict, so that compilation fails when the target is < 10.12.
1148 AC_TRY_LINK([#define availability(os, ...) availability(os, strict, __VA_ARGS)
1150 [ struct timespec ts;
1151 clock_gettime(CLOCK_MONOTONIC, &ts); ],
1152 ac_cv_clock_monotonic=$libs
1154 CFLAGS="$_SAVE_CFLAGS"
1156 ac_cv_clock_monotonic=no)
1158 CFLAGS="$_SAVE_CFLAGS"
1160 if test "$ac_cv_clock_monotonic" != "no"; then
1161 HAVE_CLOCK_MONOTONIC=1
1162 REALTIME_LIBS=$ac_cv_clock_monotonic
1163 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1164 AC_SUBST(HAVE_CLOCK_MONOTONIC)
1165 AC_SUBST_LIST(REALTIME_LIBS)
1168 dnl Turn on warnings-as-errors to prevent implicit declaration of
1169 dnl pthread_cond_timedwait_monotonic_np, which can cause this test to
1170 dnl inadvertently pass even if the function does not really exist.
1171 _SAVE_CFLAGS="$CFLAGS"
1172 CFLAGS="$CFLAGS $WARNINGS_AS_ERRORS"
1173 AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
1174 ac_cv_pthread_cond_timedwait_monotonic_np,
1175 AC_TRY_LINK([#include <pthread.h>],
1176 [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
1177 ac_cv_pthread_cond_timewait_monotonic_np=yes,
1178 ac_cv_pthread_cond_timewait_monotonic_np=no))
1179 if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
1180 AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
1182 CFLAGS=$_SAVE_CFLAGS
1186 ac_cv_func_res_ninit,
1187 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
1188 dnl no need for res_ninit() on NetBSD and OpenBSD
1189 ac_cv_func_res_ninit=no
1193 #define _BSD_SOURCE 1
1195 #include <sys/types.h>
1196 #include <netinet/in.h>
1197 #include <arpa/nameser.h>
1200 [int foo = res_ninit(&_res);],
1201 [ac_cv_func_res_ninit=yes],
1202 [ac_cv_func_res_ninit=no])
1206 if test "$ac_cv_func_res_ninit" = "yes"; then
1207 AC_DEFINE(HAVE_RES_NINIT)
1208 dnl must add the link line we do something as foolish as this... dougt
1210 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
1211 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
1216 dnl **********************
1217 dnl *** va_copy checks ***
1218 AC_CACHE_CHECK([for an implementation of va_copy()],
1220 [AC_TRY_COMPILE([#include <stdarg.h>
1222 void f (int i, ...) {
1223 va_list args1, args2;
1224 va_start (args1, i);
1225 va_copy (args2, args1);
1226 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1228 va_end (args1); va_end (args2);
1230 [f(0, 42); return 0],
1231 [ac_cv_va_copy=yes],
1235 AC_CACHE_CHECK([whether va_list can be copied by value],
1237 [AC_TRY_COMPILE([#include <stdarg.h>
1239 void f (int i, ...) {
1240 va_list args1, args2;
1241 va_start (args1, i);
1243 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1245 va_end (args1); va_end (args2);
1247 [f(0, 42); return 0],
1248 [ac_cv_va_val_copy=yes],
1249 [ac_cv_va_val_copy=no],
1252 if test "x$ac_cv_va_copy" = "xyes"; then
1253 AC_DEFINE(VA_COPY, va_copy)
1254 AC_DEFINE(HAVE_VA_COPY)
1257 if test "x$ac_cv_va_val_copy" = "xno"; then
1258 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
1261 dnl ===================================================================
1262 dnl ========================================================
1263 dnl Put your C++ language/feature checks below
1264 dnl ========================================================
1268 if test "$GNU_CC"; then
1269 if test "$CPU_ARCH" = "arm" ; then
1270 AC_CACHE_CHECK(for ARM EABI,
1274 #if defined(__ARM_EABI__)
1277 #error Not ARM EABI.
1280 ac_cv_gcc_arm_eabi="yes",
1281 ac_cv_gcc_arm_eabi="no")])
1282 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
1284 ARM_ABI_PREFIX=eabi-
1286 ARM_ABI_PREFIX=oabi-
1290 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
1293 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
1294 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
1295 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
1297 _SAVE_LDFLAGS=$LDFLAGS
1298 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
1299 AC_CACHE_CHECK(for __thread keyword for TLS variables,
1300 ac_cv_thread_keyword,
1301 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
1302 [return tlsIsMainThread;],
1303 ac_cv_thread_keyword=yes,
1304 ac_cv_thread_keyword=no)])
1305 LDFLAGS=$_SAVE_LDFLAGS
1306 # The custom dynamic linker doesn't support TLS variables
1308 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
1309 # mips builds fail with TLS variables because of a binutils bug.
1311 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
1316 *-android*|*-linuxandroid*)
1323 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
1329 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
1330 if test -n "$MOZ_LINKER"; then
1331 if test "$CPU_ARCH" = arm; then
1332 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
1333 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
1334 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1335 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1339 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
1340 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
1341 dnl Since the linker only understands the sysv ones, no need to build the
1342 dnl gnu style tables anyways.
1343 LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
1346 dnl End of C++ language/feature checks
1349 dnl ========================================================
1350 dnl = Internationalization checks
1351 dnl ========================================================
1353 dnl Internationalization and Locale support is different
1354 dnl on various UNIX platforms. Checks for specific i18n
1355 dnl features go here.
1357 AC_HAVE_FUNCS(localeconv)
1359 fi # ! SKIP_COMPILER_CHECKS
1361 if test -n "${COMPILE_ENVIRONMENT}"; then
1366 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1367 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1368 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1371 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1372 dnl features that Windows actually does support.
1374 if test -n "$SKIP_COMPILER_CHECKS"; then
1375 dnl Windows has malloc.h
1376 AC_DEFINE(MALLOC_H, [<malloc.h>])
1377 AC_DEFINE(HAVE_FORCEINLINE)
1378 AC_DEFINE(HAVE_LOCALECONV)
1379 fi # SKIP_COMPILER_CHECKS
1381 dnl Mozilla specific options
1382 dnl ========================================================
1383 dnl The macros used for command line options
1384 dnl are defined in build/autoconf/altoptions.m4.
1386 dnl ========================================================
1388 dnl = Check for external package dependencies
1390 dnl ========================================================
1391 MOZ_ARG_HEADER(External Packages)
1393 dnl ========================================================
1394 dnl system libevent Support
1395 dnl ========================================================
1396 MOZ_ARG_WITH_STRING(system-libevent,
1397 [ --with-system-libevent[=PFX]
1398 Use system libevent [installed at prefix PFX]],
1399 LIBEVENT_DIR=$withval)
1401 _SAVE_CFLAGS=$CFLAGS
1402 _SAVE_LDFLAGS=$LDFLAGS
1404 if test "$LIBEVENT_DIR" = yes; then
1405 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
1406 MOZ_SYSTEM_LIBEVENT=1,
1409 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
1410 MOZ_SYSTEM_LIBEVENT=
1411 elif test -z "$MOZ_SYSTEM_LIBEVENT"; then
1412 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
1413 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
1414 MOZ_CHECK_HEADER(event.h,
1415 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
1416 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
1418 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
1419 AC_CHECK_LIB(event, event_init,
1420 [MOZ_SYSTEM_LIBEVENT=1
1421 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
1422 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
1423 [MOZ_SYSTEM_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
1425 CFLAGS=$_SAVE_CFLAGS
1426 LDFLAGS=$_SAVE_LDFLAGS
1429 AC_SUBST(MOZ_SYSTEM_LIBEVENT)
1431 if test -z "$SKIP_LIBRARY_CHECKS"; then
1433 dnl ========================================================
1434 dnl system PNG Support
1435 dnl ========================================================
1436 MOZ_ARG_WITH_STRING(system-png,
1437 [ --with-system-png[=PFX]
1438 Use system libpng [installed at prefix PFX]],
1441 _SAVE_CFLAGS=$CFLAGS
1442 _SAVE_LDFLAGS=$LDFLAGS
1444 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
1445 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
1446 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
1448 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
1451 AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"],
1452 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1453 AC_CHECK_LIB(png, png_get_acTL, ,
1454 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
1456 if test "$MOZ_SYSTEM_PNG" = 1; then
1457 AC_TRY_COMPILE([ #include <stdio.h>
1458 #include <sys/types.h>
1460 [ #if PNG_LIBPNG_VER < $MOZPNG
1461 #error "Insufficient libpng version ($MOZPNG required)."
1463 #ifndef PNG_UINT_31_MAX
1464 #error "Insufficient libpng version."
1467 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1469 CFLAGS=$_SAVE_CFLAGS
1470 LDFLAGS=$_SAVE_LDFLAGS
1473 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then
1474 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
1475 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
1478 fi # SKIP_LIBRARY_CHECKS
1480 dnl ========================================================
1484 dnl ========================================================
1486 MOZ_ARG_HEADER(Application)
1488 ENABLE_SYSTEM_EXTENSION_DIRS=1
1489 MOZ_BRANDING_DIRECTORY=
1490 MOZ_OFFICIAL_BRANDING=
1491 MOZ_AUTH_EXTENSION=1
1493 MOZ_UNIVERSALCHARDET=1
1497 MOZ_USE_NATIVE_POPUP_WINDOWS=
1498 MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
1500 MOZ_BINARY_EXTENSIONS=
1503 case "$target_os" in
1506 AC_DEFINE(NS_ENABLE_TSF)
1510 # Optional Firefox for Android partner distribution directory.
1511 MOZ_ARG_WITH_STRING(android-distribution-directory,
1512 [ --with-android-distribution-directory=dir
1513 Optional Firefox for Android partner distribution directory.],
1514 MOZ_ANDROID_DISTRIBUTION_DIRECTORY=$withval)
1516 if test -n "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY"; then
1517 # A distribution directory must have an assets/distribution directory.
1518 # See https://wiki.mozilla.org/Mobile/Distribution_Files.
1519 if test ! -d "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY/assets/distribution" ; then
1520 AC_MSG_ERROR([--with-android-distribution-directory does not contain assets/distribution;
1521 (looked for ${MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets/distribution).])
1524 AC_SUBST(MOZ_ANDROID_DISTRIBUTION_DIRECTORY)
1526 dnl ========================================================
1527 dnl = Trademarked Branding
1528 dnl ========================================================
1529 MOZ_ARG_ENABLE_BOOL(official-branding,
1530 [ --enable-official-branding
1531 Enable Official mozilla.org Branding
1532 Do not distribute builds with
1533 --enable-official-branding unless you have
1534 permission to use trademarks per
1535 http://www.mozilla.org/foundation/trademarks/ .],
1536 MOZ_OFFICIAL_BRANDING=1,
1537 MOZ_OFFICIAL_BRANDING=)
1539 # Allow the application to influence configure with a confvars.sh script.
1540 AC_MSG_CHECKING([if app-specific confvars.sh exists])
1541 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
1542 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
1543 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
1548 dnl ========================================================
1549 dnl Ensure Android SDK and build-tools versions depending on
1551 dnl ========================================================
1553 case "$MOZ_BUILD_APP" in
1559 dnl ========================================================
1561 dnl = Toolkit Options
1563 dnl ========================================================
1564 MOZ_ARG_HEADER(Toolkit Options)
1566 dnl ========================================================
1567 dnl = Enable the toolkit as needed =
1568 dnl ========================================================
1570 case "$MOZ_WIDGET_TOOLKIT" in
1573 LDFLAGS="$LDFLAGS -framework Cocoa"
1574 # Use -Wl as a trick to avoid -framework and framework names from
1575 # being separated by AC_SUBST_LIST.
1576 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'
1578 CFLAGS="$CFLAGS $TK_CFLAGS"
1579 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1580 MOZ_USER_DIR="Mozilla"
1581 MOZ_FS_LAYOUT=bundle
1585 LDFLAGS="$LDFLAGS -framework UIKit"
1587 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'
1588 CFLAGS="$CFLAGS $TK_CFLAGS"
1589 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1590 MOZ_USER_DIR="Mozilla"
1591 MOZ_FS_LAYOUT=bundle
1596 if test "$OS_TARGET" = Darwin; then
1597 LDFLAGS="$LDFLAGS -lobjc"
1600 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
1601 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
1602 case "$MOZ_WIDGET_TOOLKIT" in
1608 if test "$COMPILE_ENVIRONMENT"; then
1609 if test "$MOZ_WIDGET_TOOLKIT" = gtk; then
1610 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)
1611 MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
1612 TK_CFLAGS=$MOZ_GTK3_CFLAGS
1613 TK_LIBS=$MOZ_GTK3_LIBS
1614 dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
1615 dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
1616 AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
1618 if test "$MOZ_ENABLE_GTK"; then
1619 if test "$MOZ_X11"; then
1620 GDK_PACKAGES=gdk-x11-2.0
1622 AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
1623 AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
1625 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)
1626 MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
1628 fi # COMPILE_ENVIRONMENT
1630 AC_SUBST(MOZ_FS_LAYOUT)
1632 AC_SUBST_LIST(TK_CFLAGS)
1633 AC_SUBST_LIST(TK_LIBS)
1635 dnl ========================================================
1637 dnl = Components & Features
1639 dnl ========================================================
1640 MOZ_ARG_HEADER(Components and Features)
1642 AC_SUBST(MOZ_OFFICIAL_BRANDING)
1643 if test -n "$MOZ_OFFICIAL_BRANDING"; then
1644 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
1645 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
1647 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
1648 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
1652 MOZ_ARG_WITH_STRING(branding,
1653 [ --with-branding=dir Use branding from the specified directory.],
1654 MOZ_BRANDING_DIRECTORY=$withval)
1656 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
1657 if test -z "$REAL_BRANDING_DIRECTORY"; then
1658 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
1661 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1662 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
1663 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1664 . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
1667 AC_SUBST(MOZ_BRANDING_DIRECTORY)
1669 dnl ========================================================
1670 dnl = Distribution ID
1671 dnl ========================================================
1672 MOZ_ARG_WITH_STRING(distribution-id,
1673 [ --with-distribution-id=ID
1674 Set distribution-specific id (default=org.mozilla)],
1675 [ val=`echo $withval`
1676 MOZ_DISTRIBUTION_ID="$val"])
1678 if test -z "$MOZ_DISTRIBUTION_ID"; then
1679 MOZ_DISTRIBUTION_ID="org.mozilla"
1682 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
1683 AC_SUBST(MOZ_DISTRIBUTION_ID)
1685 dnl ========================================================
1686 dnl = libproxy support
1687 dnl ========================================================
1689 if test "$MOZ_ENABLE_GTK"
1691 MOZ_ENABLE_LIBPROXY=
1693 MOZ_ARG_ENABLE_BOOL(libproxy,
1694 [ --enable-libproxy Enable libproxy support ],
1695 MOZ_ENABLE_LIBPROXY=1,
1696 MOZ_ENABLE_LIBPROXY=)
1698 if test "$MOZ_ENABLE_LIBPROXY"
1700 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
1701 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
1704 AC_SUBST(MOZ_ENABLE_LIBPROXY)
1706 dnl ========================================================
1708 dnl ========================================================
1710 if test "$MOZ_ENABLE_GTK"
1714 MOZ_ARG_DISABLE_BOOL(dbus,
1715 [ --disable-dbus Disable dbus support ],
1719 if test "$MOZ_ENABLE_DBUS"
1721 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
1722 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
1723 AC_DEFINE(MOZ_ENABLE_DBUS)
1726 AC_SUBST(MOZ_ENABLE_DBUS)
1728 dnl =========================================================
1729 dnl = Whether to exclude hyphenations files in the build
1730 dnl =========================================================
1731 if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
1732 AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
1735 AC_TRY_COMPILE([#include <linux/ethtool.h>],
1736 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
1737 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
1739 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
1741 if test -n "$MOZ_WEBRTC"; then
1742 if test -n "$MOZ_X11"; then
1743 MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
1747 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
1749 dnl ========================================================
1750 dnl = Apple platform decoder support
1751 dnl ========================================================
1752 if test "$COMPILE_ENVIRONMENT"; then
1753 if test -n "$MOZ_APPLEMEDIA"; then
1754 # hack in frameworks for fmp4 - see bug 1029974
1755 # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
1756 LDFLAGS="$LDFLAGS -framework AudioToolbox"
1757 dnl Verify CoreMedia is available.
1758 AC_CHECK_HEADERS([CoreMedia/CoreMedia.h VideoToolbox/VideoToolbox.h], [],
1759 [AC_MSG_ERROR([MacOS X 10.9 SDK or later is required])])
1761 fi # COMPILE_ENVIRONMENT
1763 dnl ========================================================
1764 dnl = Handle dependent MEDIA defines
1765 dnl ========================================================
1768 AC_DEFINE(MOZ_WEBM_ENCODER)
1769 AC_SUBST(MOZ_WEBM_ENCODER)
1771 dnl ========================================================
1773 dnl ========================================================
1775 MOZ_ARG_DISABLE_BOOL(negotiateauth,
1776 [ --disable-negotiateauth Disable GSS-API negotiation ],
1777 MOZ_AUTH_EXTENSION=,
1778 MOZ_AUTH_EXTENSION=1 )
1780 dnl ========================================================
1781 dnl Searching of system directories for extensions.
1782 dnl Note: this switch is meant to be used for test builds
1783 dnl whose behavior should not depend on what happens to be
1784 dnl installed on the local machine.
1785 dnl ========================================================
1786 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
1787 [ --disable-system-extension-dirs
1788 Disable searching system- and account-global
1789 directories for extensions of any kind; use
1790 only profile-specific extension directories],
1791 ENABLE_SYSTEM_EXTENSION_DIRS=,
1792 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
1793 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
1794 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
1797 dnl ========================================================
1798 dnl = Universalchardet
1799 dnl ========================================================
1800 MOZ_ARG_DISABLE_BOOL(universalchardet,
1801 [ --disable-universalchardet
1802 Disable universal encoding detection],
1803 MOZ_UNIVERSALCHARDET=,
1804 MOZ_UNIVERSALCHARDET=1 )
1806 dnl ========================================================
1808 dnl ========================================================
1810 if test "$COMPILE_ENVIRONMENT" ; then
1812 dnl Moved gamepad platform check to moz.build, linux header check still needed here.
1813 if test "$OS_TARGET" = "Linux"; then
1814 MOZ_CHECK_HEADER([linux/joystick.h])
1815 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
1816 AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
1820 fi # COMPILE_ENVIRONMENT
1823 dnl ========================================================
1824 dnl = Breakpad crash reporting (on by default on supported platforms)
1825 dnl ========================================================
1828 i?86-*-mingw*|x86_64-*-mingw*|aarch64-*-mingw*)
1831 i?86-apple-darwin*|x86_64-apple-darwin*)
1834 *-android*|*-linuxandroid*)
1835 dnl Android/arm is arm-unknown-linux-androideabi, so android condition should
1836 dnl be before Linux condition
1839 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
1840 if test "$MOZ_ENABLE_GTK"; then
1846 MOZ_ARG_DISABLE_BOOL(crashreporter,
1847 [ --disable-crashreporter Disable breakpad crash reporting],
1848 [MOZ_CRASHREPORTER=],
1849 [MOZ_CRASHREPORTER=F # Force enable breakpad])
1851 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin" -a "$MOZ_WIDGET_TOOLKIT" != "android"; then
1852 if test "$MOZ_CRASHREPORTER" = F; then
1853 AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
1858 if test -n "$MOZ_CRASHREPORTER"; then
1859 AC_DEFINE(MOZ_CRASHREPORTER)
1861 if test "$OS_TARGET" = "Linux" && \
1862 test -z "$SKIP_LIBRARY_CHECKS"; then
1863 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
1866 if test "$OS_ARCH" = "WINNT"; then
1867 if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
1868 MOZ_CRASHREPORTER_INJECTOR=1
1869 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
1874 dnl ========================================================
1875 dnl = Enable compilation of specific extension modules
1876 dnl ========================================================
1878 MOZ_ARG_ENABLE_STRING(extensions,
1879 [ --enable-extensions Enable extensions],
1880 [ for option in `echo $enableval | sed 's/,/ /g'`; do
1881 if test "$option" = "yes" -o "$option" = "all"; then
1882 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
1883 elif test "$option" = "no" -o "$option" = "none"; then
1885 elif test "$option" = "default"; then
1886 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
1887 elif test `echo "$option" | grep -c \^-` != 0; then
1888 option=`echo $option | sed 's/^-//'`
1889 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
1891 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
1894 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
1896 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
1897 dnl when trying to build a nonexistent extension.
1898 for extension in $MOZ_EXTENSIONS; do
1899 if test ! -d "${srcdir}/extensions/${extension}"; then
1900 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
1904 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
1905 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
1908 # Avoid defining MOZ_ENABLE_CAIRO_FT on Windows platforms because
1909 # "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
1910 if test -n "$MOZ_TREE_FREETYPE" -a "$OS_TARGET" != WINNT; then
1911 MOZ_ENABLE_CAIRO_FT=1
1912 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
1913 CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
1914 AC_SUBST_LIST(CAIRO_FT_CFLAGS)
1917 AC_CHECK_PROGS(WGET, wget, "")
1920 dnl ========================================================
1922 dnl ========================================================
1924 MOZ_ARG_DISABLE_BOOL(updater,
1925 [ --disable-updater Disable building of updater],
1929 if test -n "$MOZ_UPDATER"; then
1930 AC_DEFINE(MOZ_UPDATER)
1933 dnl ========================================================
1934 dnl parental controls (for Windows Vista)
1935 dnl ========================================================
1936 MOZ_ARG_DISABLE_BOOL(parental-controls,
1937 [ --disable-parental-controls
1938 Do not build parental controls],
1939 MOZ_DISABLE_PARENTAL_CONTROLS=1,
1940 MOZ_DISABLE_PARENTAL_CONTROLS=)
1941 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
1942 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
1945 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
1947 dnl ========================================================
1948 dnl = Disable smartcard support
1949 dnl ========================================================
1950 if test -n "$MOZ_NO_SMART_CARDS"; then
1951 AC_DEFINE(MOZ_NO_SMART_CARDS)
1953 AC_SUBST(MOZ_NO_SMART_CARDS)
1955 dnl ========================================================
1956 dnl = Sandboxing support
1957 dnl ========================================================
1958 if test -n "$MOZ_TSAN" -o -n "$MOZ_ASAN"; then
1959 # Bug 1182565: TSan conflicts with sandboxing on Linux.
1960 # Bug 1287971: LSan also conflicts with sandboxing on Linux.
1968 MOZ_ARG_DISABLE_BOOL(sandbox,
1969 [ --disable-sandbox Disable sandboxing support],
1973 case "$OS_TARGET" in
1974 WINNT|Darwin|OpenBSD)
1980 # Linux sandbox is only available on x86 and x86_64.
1987 # Only enable the sandbox by default on Linux, OpenBSD, macOS, and Windows
1992 if test -n "$MOZ_SANDBOX"; then
1993 AC_DEFINE(MOZ_SANDBOX)
1996 AC_SUBST(MOZ_SANDBOX)
1999 dnl ========================================================
2001 dnl = Module specific options
2003 dnl ========================================================
2004 MOZ_ARG_HEADER(Individual module options)
2006 dnl ==============================
2007 dnl === SQLite fdatasync check ===
2008 dnl ==============================
2009 dnl Check to see if fdatasync is available and make use of it
2010 AC_CHECK_FUNC(fdatasync)
2012 dnl ========================================================
2013 dnl = Disable zipwriter
2014 dnl ========================================================
2015 MOZ_ARG_DISABLE_BOOL(zipwriter,
2016 [ --disable-zipwriter Disable zipwriter component],
2019 AC_SUBST(MOZ_ZIPWRITER)
2021 dnl ========================================================
2023 dnl = Feature options that require extra sources to be pulled
2025 dnl ========================================================
2026 dnl MOZ_ARG_HEADER(Features that require extra sources)
2028 dnl ========================================================
2030 dnl = Runtime debugging and Optimization Options
2032 dnl ========================================================
2033 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
2035 dnl ========================================================
2036 dnl = Enable code optimization. ON by default.
2037 dnl ========================================================
2039 # Use value from moz.configure if one is defined. Else use our computed
2041 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
2042 MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
2045 if test "$COMPILE_ENVIRONMENT"; then
2046 if test -n "$MOZ_OPTIMIZE"; then
2047 AC_MSG_CHECKING([for valid C compiler optimization flags])
2048 _SAVE_CFLAGS=$CFLAGS
2049 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
2050 AC_TRY_COMPILE([#include <stdio.h>],
2051 [printf("Hello World\n");],
2054 AC_MSG_RESULT([$_results])
2055 if test "$_results" = "no"; then
2056 AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
2058 CFLAGS=$_SAVE_CFLAGS
2059 if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
2060 # When using llvm-based LTO, non numeric optimization levels are
2061 # not supported by the linker, so force the linker to use -O2 (
2062 # which doesn't influence the level compilation units are actually
2064 case " $MOZ_OPTIMIZE_FLAGS " in
2065 *\ -Os\ *|*\ -Oz\ *)
2066 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
2071 fi # COMPILE_ENVIRONMENT
2073 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
2074 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
2075 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
2077 dnl ========================================================
2078 dnl = Enable runtime logging
2079 dnl ========================================================
2080 AC_DEFINE(MOZ_LOGGING)
2081 AC_DEFINE(FORCE_PR_LOG)
2083 dnl ========================================================
2084 dnl = This will enable logging of addref, release, ctor, dtor.
2085 dnl ========================================================
2086 _ENABLE_LOGREFCNT=42
2087 MOZ_ARG_ENABLE_BOOL(logrefcnt,
2088 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
2089 _ENABLE_LOGREFCNT=1,
2090 _ENABLE_LOGREFCNT= )
2091 if test "$_ENABLE_LOGREFCNT" = "1"; then
2092 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
2093 elif test -z "$_ENABLE_LOGREFCNT"; then
2094 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
2097 dnl ========================================================
2098 dnl moz_dump_painting
2099 dnl ========================================================
2100 MOZ_ARG_ENABLE_BOOL(dump-painting,
2101 [ --enable-dump-painting Enable paint debugging.],
2102 MOZ_DUMP_PAINTING=1,
2103 MOZ_DUMP_PAINTING= )
2104 if test -n "$MOZ_DUMP_PAINTING"; then
2105 AC_DEFINE(MOZ_DUMP_PAINTING)
2106 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
2108 if test -n "$MOZ_DEBUG"; then
2109 AC_DEFINE(MOZ_DUMP_PAINTING)
2112 case "${OS_TARGET}" in
2113 Android|WINNT|Darwin)
2114 MOZ_GLUE_IN_PROGRAM=
2117 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
2118 MOZ_GLUE_IN_PROGRAM=1
2119 AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
2123 dnl ========================================================
2124 dnl = Jemalloc build setup
2125 dnl ========================================================
2126 if test -z "$MOZ_MEMORY"; then
2129 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
2130 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.])
2135 dnl The generic feature tests that determine how to compute ncpus are long and
2136 dnl complicated. Therefore, simply define special cpp variables for the
2137 dnl platforms we have special knowledge of.
2140 export MOZ_NO_DEBUG_RTL=1
2144 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
2146 dnl ========================================================
2147 dnl = Enable using the clang plugin to build
2148 dnl ========================================================
2150 if test -n "$COMPILE_ENVIRONMENT"; then
2151 MOZ_CONFIG_CLANG_PLUGIN
2152 fi # COMPILE_ENVIRONMENT
2154 dnl ========================================================
2155 dnl = frontend JS debug mode
2156 dnl ========================================================
2158 MOZ_ARG_ENABLE_BOOL(debug-js-modules,
2159 [ --enable-debug-js-modules Enable debug mode for frontend JS libraries],
2163 AC_SUBST(DEBUG_JS_MODULES)
2165 dnl ========================================================
2167 dnl = Profiling and Instrumenting
2169 dnl ========================================================
2170 MOZ_ARG_HEADER(Profiling and Instrumenting)
2172 dnl ========================================================
2173 dnl = Support for demangling undefined symbols
2174 dnl ========================================================
2175 if test -z "$SKIP_LIBRARY_CHECKS"; then
2178 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
2182 # Demangle only for debug or DMD builds
2183 MOZ_DEMANGLE_SYMBOLS=
2184 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
2185 MOZ_DEMANGLE_SYMBOLS=1
2186 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
2188 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
2190 dnl ========================================================
2191 dnl = Support for gcc stack unwinding (from gcc 3.3)
2192 dnl ========================================================
2193 if test -z "$SKIP_LIBRARY_CHECKS"; then
2196 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
2200 dnl ========================================================
2204 dnl ========================================================
2205 MOZ_ARG_HEADER(Misc. Options)
2207 dnl ========================================================
2208 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
2209 dnl ========================================================
2210 MOZ_ARG_WITH_STRING(user-appdir,
2211 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
2212 [ val=`echo $withval`
2213 if echo "$val" | grep "\/" >/dev/null; then
2214 AC_MSG_ERROR("Homedir must be single relative path.")
2219 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
2221 if test -z "$SKIP_COMPILER_CHECKS"; then
2222 dnl ========================================================
2224 dnl = Compiler Options
2226 dnl ========================================================
2227 MOZ_ARG_HEADER(Compiler Options)
2229 dnl ========================================================
2230 dnl Check for gcc -pipe support
2231 dnl ========================================================
2232 AC_MSG_CHECKING([for -pipe support])
2233 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
2234 dnl Any gcc that supports firefox supports -pipe.
2235 CFLAGS="$CFLAGS -pipe"
2236 CXXFLAGS="$CXXFLAGS -pipe"
2237 AC_MSG_RESULT([yes])
2242 fi # ! SKIP_COMPILER_CHECKS
2246 if test "$COMPILE_ENVIRONMENT"; then
2248 fi # COMPILE_ENVIRONMENT
2250 dnl ========================================================
2252 dnl = Static Build Options
2254 dnl ========================================================
2255 MOZ_ARG_HEADER(Static build options)
2257 if test -z "$MOZ_SYSTEM_ZLIB"; then
2258 if test -n "$JS_SHARED_LIBRARY" -o -n "$MOZ_LINKER" -o "$MOZ_WIDGET_TOOLKIT" = android; then
2260 AC_DEFINE(ZLIB_IN_MOZGLUE)
2264 AC_SUBST(ZLIB_IN_MOZGLUE)
2266 dnl ========================================================
2268 dnl = Standalone module options
2270 dnl ========================================================
2271 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
2274 dnl ========================================================
2276 if test -z "$SKIP_PATH_CHECKS"; then
2277 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
2278 if test "$MOZ_ENABLE_GTK" ; then
2279 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
2284 if test -z "${GLIB_GMODULE_LIBS}" \
2285 -a -n "${GLIB_CONFIG}"\
2286 -a "${GLIB_CONFIG}" != no\
2288 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
2291 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
2293 if test "$USE_FC_FREETYPE"; then
2294 if test "$COMPILE_ENVIRONMENT"; then
2295 dnl ========================================================
2296 dnl = Check for freetype2 functionality
2297 dnl ========================================================
2298 if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
2300 _SAVE_CFLAGS="$CFLAGS"
2301 LIBS="$LIBS $FT2_LIBS"
2302 CFLAGS="$CFLAGS $FT2_CFLAGS"
2304 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
2305 ac_cv_member_FT_Bitmap_Size_y_ppem,
2306 [AC_TRY_COMPILE([#include <ft2build.h>
2307 #include FT_FREETYPE_H],
2309 if (sizeof s.y_ppem) return 0;
2311 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
2312 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
2313 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
2314 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
2316 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
2318 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
2319 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
2320 [FT_Bitmap_Size structure includes y_ppem field])
2322 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
2325 CFLAGS="$_SAVE_CFLAGS"
2328 _SAVE_CPPFLAGS="$CPPFLAGS"
2329 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
2330 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
2331 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
2332 CPPFLAGS="$_SAVE_CPPFLAGS"
2336 dnl ========================================================
2337 dnl Check if we need the 32-bit Linux SSE2 error dialog
2338 dnl ========================================================
2340 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
2342 dnl ========================================================
2343 dnl Check for pixman and cairo
2344 dnl ========================================================
2347 MOZ_ARG_ENABLE_BOOL(system-cairo,
2348 [ --enable-system-cairo Obsolete: do not use this option],
2349 AC_MSG_ERROR(--enable-system-cairo is not supported),
2353 MOZ_ARG_ENABLE_BOOL(system-pixman,
2354 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
2356 MOZ_TREE_PIXMAN=force,
2359 if test "$MOZ_TREE_PIXMAN"; then
2360 AC_DEFINE(MOZ_TREE_PIXMAN)
2362 PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.19.2)
2365 MOZ_CAIRO_CFLAGS="-I${DIST}/include/cairo"
2366 AC_DEFINE(MOZ_TREE_CAIRO)
2368 if test "$OS_ARCH" = "WINNT"; then
2369 # For now we assume that we will have a uint64_t available through
2370 # one of the above headers or mozstdint.h.
2371 AC_DEFINE(HAVE_UINT64_T)
2374 # Define macros for cairo-features.h
2375 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
2376 if test "$MOZ_X11"; then
2377 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
2378 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
2379 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
2381 if test "$_HAVE_FREETYPE2"; then
2382 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2383 MOZ_ENABLE_CAIRO_FT=1
2384 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
2387 case "$MOZ_WIDGET_TOOLKIT" in
2389 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
2390 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
2391 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
2394 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
2395 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
2396 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
2398 if test "$COMPILE_ENVIRONMENT"; then
2399 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
2403 if test "$USE_FC_FREETYPE"; then
2404 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
2406 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
2407 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
2409 AC_SUBST(PS_SURFACE_FEATURE)
2410 AC_SUBST(SVG_SURFACE_FEATURE)
2411 AC_SUBST(XLIB_SURFACE_FEATURE)
2412 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
2413 AC_SUBST(QUARTZ_SURFACE_FEATURE)
2414 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
2415 AC_SUBST(WIN32_SURFACE_FEATURE)
2416 AC_SUBST(OS2_SURFACE_FEATURE)
2417 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
2418 AC_SUBST(FT_FONT_FEATURE)
2419 AC_SUBST(FC_FONT_FEATURE)
2420 AC_SUBST(WIN32_FONT_FEATURE)
2421 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
2422 AC_SUBST(QUARTZ_FONT_FEATURE)
2423 AC_SUBST(PNG_FUNCTIONS_FEATURE)
2424 AC_SUBST(QT_SURFACE_FEATURE)
2425 AC_SUBST(TEE_SURFACE_FEATURE)
2427 if test "$MOZ_X11"; then
2428 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
2431 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
2433 case "$MOZ_WIDGET_TOOLKIT" in
2435 TK_CFLAGS="$MOZ_CAIRO_CFLAGS $MOZ_PIXMAN_CFLAGS"
2436 TK_LIBS="$MOZ_CAIRO_LIBS $MOZ_PIXMAN_LIBS"
2440 AC_SUBST(MOZ_TREE_CAIRO)
2441 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
2442 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
2443 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
2444 AC_SUBST(MOZ_TREE_PIXMAN)
2446 BINDGEN_SYSTEM_FLAGS="$_BINDGEN_CFLAGS $NSPR_CFLAGS $NSS_CFLAGS $MOZ_PIXMAN_CFLAGS $MOZ_CAIRO_CFLAGS"
2447 AC_SUBST(BINDGEN_SYSTEM_FLAGS)
2448 BINDGEN_SYSTEM_TOML_FLAGS="$BINDGEN_SYSTEM_FLAGS"
2449 AC_SUBST_TOML_LIST(BINDGEN_SYSTEM_TOML_FLAGS)
2451 dnl ========================================================
2453 dnl ========================================================
2454 MOZ_ARG_DISABLE_BOOL(xul,
2455 [ --disable-xul Disable XUL],
2457 if test "$MOZ_XUL"; then
2460 dnl remove extensions that require XUL
2461 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
2466 dnl ========================================================
2467 dnl necko configuration options
2468 dnl ========================================================
2471 dnl option to disable necko's wifi scanner
2474 if test "$MOZ_WIDGET_TOOLKIT"; then
2476 case "$OS_TARGET" in
2480 DragonFly|FreeBSD|WINNT)
2491 MOZ_ARG_DISABLE_BOOL(necko-wifi,
2492 [ --disable-necko-wifi Disable necko wifi scanner],
2496 if test "$NECKO_WIFI"; then
2497 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
2498 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
2500 AC_DEFINE(NECKO_WIFI)
2501 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
2503 AC_SUBST(NECKO_WIFI)
2504 AC_SUBST(NECKO_WIFI_DBUS)
2506 dnl ========================================================
2508 dnl = Maintainer debug option (no --enable equivalent)
2510 dnl ========================================================
2513 AC_SUBST_LIST(ASFLAGS)
2516 AC_SUBST(MOZ_AUTH_EXTENSION)
2517 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
2518 AC_SUBST_LIST(WARNINGS_CFLAGS)
2519 AC_SUBST_SET(MOZ_EXTENSIONS)
2521 AC_SUBST(MOZ_UNIVERSALCHARDET)
2522 AC_SUBST(MOZ_SPELLCHECK)
2523 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
2524 AC_SUBST(MOZ_CRASHREPORTER)
2525 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
2526 AC_SUBST(MOZ_STUB_INSTALLER)
2527 AC_SUBST(MOZ_UPDATER)
2529 AC_SUBST(MOZ_ANDROID_APPLICATION_CLASS)
2530 AC_SUBST(MOZ_ANDROID_BROWSER_INTENT_CLASS)
2531 AC_SUBST(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
2532 AC_SUBST(INCREMENTAL_LINKER)
2534 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
2536 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
2537 AC_SUBST(MOZ_LINKER_EXTRACT)
2539 if test -n "$MOZ_BINARY_EXTENSIONS"; then
2540 AC_DEFINE(MOZ_BINARY_EXTENSIONS)
2543 AC_SUBST(MOZ_REQUIRE_SIGNING)
2544 if test "$MOZ_REQUIRE_SIGNING" = 1; then
2545 AC_DEFINE(MOZ_REQUIRE_SIGNING)
2548 dnl ========================================================
2549 dnl = Mac bundle name prefix
2550 dnl ========================================================
2551 MOZ_ARG_WITH_STRING(macbundlename-prefix,
2552 [ --with-macbundlename-prefix=prefix
2553 Prefix for MOZ_MACBUNDLE_NAME],
2554 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
2556 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
2557 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
2558 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
2561 if test "$MOZ_DEBUG"; then
2562 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
2564 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
2566 AC_SUBST(MOZ_MACBUNDLE_NAME)
2568 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
2569 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
2570 # Otherwise, use MOZ_APP_DISPLAYNAME
2571 if test -z "$MOZ_MACBUNDLE_ID"; then
2572 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
2574 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
2575 if test "$MOZ_DEBUG"; then
2576 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
2579 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
2580 AC_SUBST(MOZ_MACBUNDLE_ID)
2582 dnl ========================================================
2583 dnl = Child Process Name for IPC
2584 dnl ========================================================
2585 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
2586 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
2588 # We want to let Android unpack the file at install time, but it only does
2589 # so if the file is named libsomething.so. The lib/ path is also required
2590 # because the unpacked file will be under the lib/ subdirectory and will
2591 # need to be executed from that path.
2592 MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
2594 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
2595 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
2597 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
2598 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
2599 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
2601 # The following variables are available to branding and application
2602 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
2603 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
2604 # impacts profile location and user-visible fields.
2605 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
2606 # Mac Bundle name, Updater, Installer), it is typically used for nightly
2607 # builds (e.g. Aurora for Firefox).
2608 # - MOZ_APP_PROFILE: When set, used for application.ini's
2609 # "Profile" field, which controls profile location.
2610 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
2611 # crash reporter server url.
2612 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
2614 # The following environment variables used to have an effect, but don't anymore:
2615 # - MOZ_APP_VERSION: Defines the application version number. This was replaced with
2616 # the contents from the version.txt file in the application directory, or
2617 # browser/config/version.txt if there isn't one.
2618 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
2619 # in the "About" window. This was replaced with the contents from the
2620 # version_display.txt or version.txt in the application directory, or
2621 # browser/config/version_display.txt.
2623 # For extensions and langpacks, we require a max version that is compatible
2624 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
2625 # 24.0a1 and 24.0a2 aren't affected
2627 # 24.1.1 becomes 24.*
2628 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
2629 if test -z "$IS_ALPHA"; then
2631 if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
2632 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
2634 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
2638 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
2641 AC_SUBST(MOZ_APP_DISPLAYNAME)
2642 AC_SUBST(MOZ_APP_VENDOR)
2643 AC_SUBST(MOZ_APP_PROFILE)
2644 AC_SUBST(MOZ_APP_ID)
2645 AC_SUBST(MAR_CHANNEL_ID)
2646 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
2647 AC_SUBST(MOZ_PROFILE_MIGRATOR)
2648 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
2649 AC_SUBST(MOZ_APP_UA_NAME)
2650 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
2651 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
2652 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
2654 AC_SUBST(MOZ_APP_MAXVERSION)
2655 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
2656 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
2657 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
2660 AC_SUBST(MOZ_PKG_SPECIAL)
2661 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
2663 if test "$MOZILLA_OFFICIAL"; then
2664 # Build revisions should always be present in official builds
2665 MOZ_INCLUDE_SOURCE_INFO=1
2668 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
2669 # explicitly set the repository and changeset information in.
2670 AC_SUBST(MOZ_SOURCE_REPO)
2671 AC_SUBST(MOZ_SOURCE_CHANGESET)
2672 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
2674 dnl If we have any service that uploads data (and requires data submission
2675 dnl policy alert), set MOZ_DATA_REPORTING.
2676 dnl We need SUBST for build system and DEFINE for xul preprocessor.
2677 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER" || test -n "$MOZ_NORMANDY"; then
2678 MOZ_DATA_REPORTING=1
2679 AC_DEFINE(MOZ_DATA_REPORTING)
2680 AC_SUBST(MOZ_DATA_REPORTING)
2684 AC_SUBST(WIN32_REDIST_DIR)
2685 AC_SUBST(WIN_UCRT_REDIST_DIR)
2687 dnl Echo the CFLAGS to remove extra whitespace.
2689 $_COMPILATION_CFLAGS \
2693 $_WARNINGS_CXXFLAGS \
2694 $_COMPILATION_CXXFLAGS \
2697 COMPILE_CFLAGS=`echo \
2701 COMPILE_CXXFLAGS=`echo \
2702 $_DEFINES_CXXFLAGS \
2706 $_WARNINGS_HOST_CFLAGS \
2707 $_COMPILATION_HOST_CFLAGS \
2710 HOST_CXXFLAGS=`echo \
2711 $_WARNINGS_HOST_CXXFLAGS \
2712 $_COMPILATION_HOST_CXXFLAGS \
2715 AC_SUBST(MOZ_SYSTEM_PNG)
2717 AC_SUBST_LIST(MOZ_PNG_CFLAGS)
2718 AC_SUBST_LIST(MOZ_PNG_LIBS)
2720 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
2721 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
2722 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
2723 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
2724 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
2725 OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
2726 OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
2728 AC_SUBST(HOST_CMFLAGS)
2729 AC_SUBST(HOST_CMMFLAGS)
2730 AC_SUBST(OS_COMPILE_CMFLAGS)
2731 AC_SUBST(OS_COMPILE_CMMFLAGS)
2734 OS_CXXFLAGS="$CXXFLAGS"
2735 OS_CPPFLAGS="$CPPFLAGS"
2736 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
2737 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
2738 OS_LDFLAGS="$LDFLAGS"
2740 AC_SUBST_LIST(OS_CFLAGS)
2741 AC_SUBST_LIST(OS_CXXFLAGS)
2742 AC_SUBST_LIST(OS_CPPFLAGS)
2743 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
2744 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
2745 AC_SUBST_LIST(OS_LDFLAGS)
2750 AC_SUBST_LIST(HOST_CFLAGS)
2751 AC_SUBST_LIST(HOST_CPPFLAGS)
2752 AC_SUBST_LIST(HOST_CXXFLAGS)
2753 AC_SUBST(HOST_LDFLAGS)
2754 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
2755 AC_SUBST(HOST_BIN_SUFFIX)
2757 AC_SUBST(TARGET_XPCOM_ABI)
2758 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
2759 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
2760 AC_SUBST(HAVE_X86_AVX2)
2761 AC_SUBST(HAVE_ALTIVEC)
2763 AC_SUBST_LIST(DSO_CFLAGS)
2764 AC_SUBST_LIST(DSO_PIC_CFLAGS)
2765 AC_SUBST(DSO_LDOPTS)
2766 AC_SUBST(BIN_SUFFIX)
2768 AC_SUBST(NS_ENABLE_TSF)
2769 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
2770 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
2772 AC_SUBST(MOZ_DEVTOOLS)
2774 AC_SUBST(MOZ_PACKAGE_JSSHELL)
2778 dnl Host JavaScript runtime, if any, to use during cross compiles.
2781 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
2783 if test -n "$COMPILE_ENVIRONMENT"; then
2784 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
2786 dnl Check for missing components
2787 if test "$MOZ_X11"; then
2788 dnl ====================================================
2789 dnl = Check if X headers exist
2790 dnl ====================================================
2791 _SAVE_CFLAGS=$CFLAGS
2792 CFLAGS="$CFLAGS $XCFLAGS"
2796 #include <X11/Xlib.h>
2797 #include <X11/Intrinsic.h>
2798 #include <X11/extensions/XShm.h>
2802 if ((dpy = XOpenDisplay(NULL)) == NULL) {
2803 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
2807 [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
2808 CFLAGS="$_SAVE_CFLAGS"
2810 if test -n "$MISSING_X"; then
2811 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
2816 fi # COMPILE_ENVIRONMENT
2818 dnl Set various defines and substitutions
2819 dnl ========================================================
2821 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
2822 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
2823 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
2824 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
2825 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
2826 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
2827 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
2828 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
2829 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
2832 AC_SUBST(MOZ_DEV_EDITION)
2833 if test -n "$MOZ_DEV_EDITION"; then
2834 AC_DEFINE(MOZ_DEV_EDITION)
2837 if test "$MOZ_DEBUG" -o "$DEVELOPER_OPTIONS"; then
2841 if test -n "$A11Y_LOG"; then
2845 dnl Spit out some output
2846 dnl ========================================================
2848 dnl The following defines are used by xpcom
2849 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
2861 # Avoid using obsolete NSPR features
2862 AC_DEFINE(NO_NSPR_10_SUPPORT)
2864 MOZ_CREATE_CONFIG_STATUS()
2866 rm -fr confdefs* $ac_clean_files