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 # Run some logic to figure out exe extensions (mostly for mingw's sake)
97 if test "$target" != "$host"; then
103 # Work around the conftest.exe access problem on Windows
108 MOZ_PATH_PROGS(AS, $AS as, $CC)
109 AC_CHECK_PROGS(STRIP, strip, :)
110 AC_CHECK_PROGS(OTOOL, otool, :)
115 dnl ========================================================
116 dnl Special win32 checks
117 dnl ========================================================
123 if test "$GCC" != "yes"; then
124 # Check to see if we are really running in a msvc environemnt
127 # Make sure compilers are valid
128 CXXFLAGS="$CXXFLAGS -TP"
131 AC_TRY_COMPILE([#include <stdio.h>],
132 [ printf("Hello World\n"); ],,
133 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
136 AC_TRY_COMPILE([#include <new.h>],
137 [ unsigned *test = new unsigned(42); ],,
138 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
142 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
145 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
146 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
147 AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
150 MSVC_C_RUNTIME_DLL=vcruntime140.dll
151 MSVC_CXX_RUNTIME_DLL=msvcp140.dll
153 # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
154 CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
156 if test -n "$WIN_UCRT_REDIST_DIR"; then
157 if test ! -d "$WIN_UCRT_REDIST_DIR"; then
158 AC_MSG_ERROR([Invalid Windows UCRT Redist directory: ${WIN_UCRT_REDIST_DIR}])
160 WIN_UCRT_REDIST_DIR=`cd "$WIN_UCRT_REDIST_DIR" && (pwd -W 2>/dev/null || pwd)`
163 AC_SUBST(MSVC_C_RUNTIME_DLL)
164 AC_SUBST(MSVC_CXX_RUNTIME_DLL)
166 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
168 if test -n "$WIN32_REDIST_DIR"; then
169 if test ! -d "$WIN32_REDIST_DIR"; then
170 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
172 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && (pwd -W 2>/dev/null || pwd)`
175 # Check linker version, except in lld builds
180 _LD_FULL_VERSION=`"${LINKER}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
181 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
182 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
183 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
190 unset _MSVC_VER_FILTER
193 STL_FLAGS="-I${DIST}/stl_wrappers"
195 # Check w32api version
196 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
197 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
198 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
199 AC_TRY_COMPILE([#include <w32api.h>],
200 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
201 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
202 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
203 #error "test failed."
205 , [ res=yes ], [ res=no ])
206 AC_MSG_RESULT([$res])
207 if test "$res" != "yes"; then
208 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
210 # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
211 # causing problems with local implementations with the same name.
212 AC_DEFINE(STRSAFE_NO_DEPRECATE)
215 CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
216 CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
218 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
219 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
220 # Require OS features provided by IE 8.0 (Win7)
221 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0800)
226 if test -n "$_WIN32_MSVC"; then
228 SKIP_COMPILER_CHECKS=1
229 SKIP_LIBRARY_CHECKS=1
231 # Since we're skipping compiler and library checks, hard-code
234 AC_DEFINE(HAVE_ISATTY)
237 fi # COMPILE_ENVIRONMENT
242 AC_SUBST_LIST(STL_FLAGS)
243 AC_SUBST(WRAP_STL_INCLUDES)
245 dnl ========================================================
246 dnl Checks for programs.
247 dnl ========================================================
248 if test "$COMPILE_ENVIRONMENT"; then
254 fi # COMPILE_ENVIRONMENT
256 dnl ========================================================
257 dnl set the defaults first
258 dnl ========================================================
259 MOZ_USER_DIR=".mozilla"
261 MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
265 dnl Configure platform-specific CPU architecture compiler options.
266 dnl ==============================================================
267 if test "$COMPILE_ENVIRONMENT"; then
269 fi # COMPILE_ENVIRONMENT
271 dnl ========================================================
272 dnl Android libstdc++
273 dnl ========================================================
276 if test "$COMPILE_ENVIRONMENT"; then
278 fi # COMPILE_ENVIRONMENT
280 dnl ========================================================
281 dnl Suppress Clang Argument Warnings
282 dnl ========================================================
283 WARNINGS_CFLAGS="$_WARNINGS_CFLAGS"
284 if test -n "${CLANG_CC}${CLANG_CL}"; then
285 WARNINGS_CFLAGS="-Qunused-arguments $WARNINGS_CFLAGS"
286 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
288 if test -n "${CLANG_CXX}${CLANG_CL}"; then
289 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
292 if test -n "$COMPILE_ENVIRONMENT"; then
296 dnl ========================================================
297 dnl GNU specific defaults
298 dnl ========================================================
299 if test "$GNU_CC"; then
303 SSSE3_FLAGS="-mssse3"
304 CFLAGS="$CFLAGS -fno-strict-aliasing"
307 if test "$OS_ARCH" != "WINNT" -o -z "$CLANG_CC"; then
308 DSO_PIC_CFLAGS='-fPIC'
309 ASFLAGS="$ASFLAGS -fPIC"
312 AC_MSG_CHECKING([for --noexecstack option to as])
314 CFLAGS="$CFLAGS -Wa,--noexecstack"
315 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
316 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
319 AC_MSG_CHECKING([for -z noexecstack option to ld])
320 _SAVE_LDFLAGS=$LDFLAGS
321 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
322 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
324 LDFLAGS=$_SAVE_LDFLAGS)
326 AC_MSG_CHECKING([for -z text option to ld])
327 _SAVE_LDFLAGS=$LDFLAGS
328 LDFLAGS="$LDFLAGS -Wl,-z,text"
329 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
331 LDFLAGS=$_SAVE_LDFLAGS)
333 AC_MSG_CHECKING([for -z relro option to ld])
334 _SAVE_LDFLAGS=$LDFLAGS
335 LDFLAGS="$LDFLAGS -Wl,-z,relro"
336 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
338 LDFLAGS=$_SAVE_LDFLAGS)
340 AC_MSG_CHECKING([for -z nocopyreloc option to ld])
341 _SAVE_LDFLAGS=$LDFLAGS
342 LDFLAGS="$LDFLAGS -Wl,-z,nocopyreloc"
343 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
345 LDFLAGS=$_SAVE_LDFLAGS)
347 AC_MSG_CHECKING([for -Bsymbolic-functions option to ld])
348 _SAVE_LDFLAGS=$LDFLAGS
349 LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
350 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
352 LDFLAGS=$_SAVE_LDFLAGS)
354 AC_MSG_CHECKING([for --build-id=sha1 option to ld])
355 _SAVE_LDFLAGS=$LDFLAGS
356 LDFLAGS="$LDFLAGS -Wl,--build-id=sha1"
357 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
359 LDFLAGS=$_SAVE_LDFLAGS)
361 AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
362 HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
363 _SAVE_LDFLAGS=$LDFLAGS
364 LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
365 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
366 [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
368 LDFLAGS=$_SAVE_LDFLAGS
370 # Check for -mssse3 on $CC
371 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
372 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
374 CFLAGS="$CFLAGS -mssse3"
375 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
376 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
380 # Check for -msse4.1 on $CC
381 AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
382 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
384 CFLAGS="$CFLAGS -msse4.1"
385 AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
386 [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
390 case "${CPU_ARCH}" in
392 AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
394 [asm volatile ("vpermq \$0xd8,%ymm0,%ymm0 \n");],
395 result="yes", result="no")
396 AC_MSG_RESULT("$result")
397 if test "$result" = "yes"; then
403 AC_MSG_CHECKING([whether we can enable AltiVec support])
406 CFLAGS="$CFLAGS -maltivec"
407 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
415 if test "$GCC_USE_GNU_LD"; then
416 # Some tools like ASan use a runtime library that is only
417 # linked against executables, so we must allow undefined
418 # symbols for shared objects in some cases.
419 if test -z "$MOZ_ASAN$MOZ_MSAN$MOZ_UBSAN$MOZ_TSAN$FUZZING_INTERFACES"; then
420 # Don't allow undefined symbols in libraries
421 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
423 # BSDs need `environ' exposed for posix_spawn (bug 753046)
425 DragonFly|FreeBSD|NetBSD|OpenBSD)
426 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
427 DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
429 DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
436 _DEFINES_CFLAGS="-include $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
438 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
441 if test "$GNU_CXX"; then
442 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
444 _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
447 dnl ========================================================
449 dnl ========================================================
451 if test "$MOZ_DMD"; then
452 if test "${CPU_ARCH}" = "arm"; then
453 CFLAGS="$CFLAGS -funwind-tables"
454 CXXFLAGS="$CXXFLAGS -funwind-tables"
458 dnl ========================================================
459 dnl System overrides of the defaults for host
460 dnl ========================================================
463 if test -n "$_WIN32_MSVC"; then
464 HOST_CFLAGS="$HOST_CFLAGS"
466 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
468 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
469 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
472 case "${host_cpu}" in
474 if test -n "$_WIN32_MSVC"; then
475 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
479 if test -n "$_WIN32_MSVC"; then
480 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
482 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
488 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
489 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
492 *-linux*|*-kfreebsd*-gnu|*-gnu*)
493 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
494 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
498 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
499 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
503 dnl ========================================================
504 dnl System overrides of the defaults for target
505 dnl ========================================================
509 MOZ_OPTIMIZE_FLAGS="-O3"
510 CXXFLAGS="$CXXFLAGS -stdlib=libc++"
512 # The ExceptionHandling framework is needed for Objective-C exception
513 # logging code in nsObjCExceptions.h. Currently we only use that in debug
515 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
517 dnl DTrace and -dead_strip don't interact well. See bug 403132.
518 dnl ===================================================================
519 if test "x$enable_dtrace" = "xyes"; then
520 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
522 dnl check for the presence of the -dead_strip linker flag
523 AC_MSG_CHECKING([for -dead_strip option to ld])
524 _SAVE_LDFLAGS=$LDFLAGS
525 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
526 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
527 if test -n "$_HAVE_DEAD_STRIP" ; then
529 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
534 LDFLAGS=$_SAVE_LDFLAGS
537 MOZ_FIX_LINK_PATHS="-Wl,-executable_path,${DIST}/bin"
540 *-android*|*-linuxandroid*)
541 if test "$COMPILE_ENVIRONMENT" -a -n "$MOZ_MEMORY"; then
545 if test -z "$CLANG_CC"; then
546 MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
548 # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
549 # -Oz is smaller than -Os on clang.
550 MOZ_OPTIMIZE_FLAGS="-Oz"
551 # Disable the outliner, which causes performance regressions, and is
552 # enabled on some platforms at -Oz.
553 if test -z "$MOZ_LTO"; then
554 DISABLE_OUTLINER="-mno-outline"
556 CFLAGS="$CFLAGS $DISABLE_OUTLINER"
557 AC_TRY_COMPILE(,,[MOZ_OPTIMIZE_FLAGS="$MOZ_OPTIMIZE_FLAGS $DISABLE_OUTLINER"])
558 CFLAGS="$_SAVE_CFLAGS"
560 DISABLE_OUTLINER="-Wl,-plugin-opt=-enable-machine-outliner=never"
561 _SAVE_LDFLAGS=$LDFLAGS
562 LDFLAGS="$LDFLAGS $MOZ_LTO_LDFLAGS $DISABLE_OUTLINER"
563 AC_TRY_LINK(,,[MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS $DISABLE_OUTLINER"])
564 LDFLAGS="$_SAVE_LDFLAGS"
570 if test "$GNU_CC" -o "$GNU_CXX"; then
571 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
572 if test -n "$MOZ_DEBUG"; then
573 MOZ_OPTIMIZE_FLAGS="-Os"
575 MOZ_OPTIMIZE_FLAGS="-O2"
577 if test -z "$CLANG_CC"; then
578 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
582 case "${target_cpu}" in
584 CFLAGS="$CFLAGS -mieee"
585 CXXFLAGS="$CXXFLAGS -mieee"
592 # certain versions of cygwin's makedepend barf on the
593 # #include <string> vs -I./dist/include/string issue so don't use it
594 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
595 # $GNU_CC will match gcc and clang; while $CLANG_CC will match only clang
596 if test -z "$CLANG_CC"; then
597 AC_MSG_ERROR(Firefox cannot be built with mingw-gcc and requires a mingw-clang toolchain to work)
601 # mingw doesn't require kernel32, user32, and advapi32 explicitly
602 LIBS="$LIBS -luuid -lusp10 -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
605 MOZ_OPTIMIZE_FLAGS="-O2"
607 WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
608 WIN32_GUI_EXE_LDFLAGS=-mwindows
610 # Silence problematic clang warnings
611 CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
612 LDFLAGS="$LDFLAGS -Wl,--no-insert-timestamp"
614 TARGET_COMPILER_ABI=msvc
615 RANLIB='echo not_ranlib'
616 STRIP='echo not_strip'
617 # aarch64 doesn't support subsystems below 6.02
618 if test "$CPU_ARCH" = "aarch64"; then
619 WIN32_SUBSYSTEM_VERSION=6.02
621 WIN32_SUBSYSTEM_VERSION=6.01
623 WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
624 WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
625 DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
626 _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
627 _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
628 CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
629 CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
630 if test -z "$CLANG_CL"; then
631 CPPFLAGS="$CPPFLAGS -utf-8"
633 if test "$CPU_ARCH" = "x86"; then
634 dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
635 dnl more recent, so set that explicitly here unless another
636 dnl target arch has already been set.
638 if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
639 CFLAGS="$CFLAGS -arch:SSE2"
641 if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
642 CXXFLAGS="$CXXFLAGS -arch:SSE2"
645 SSE_FLAGS="-arch:SSE"
646 SSE2_FLAGS="-arch:SSE2"
647 dnl MSVC allows the use of intrinsics without any flags
648 dnl and doesn't have a separate arch for SSSE3
649 SSSE3_FLAGS="-arch:SSE2"
651 dnl clang-cl requires appropriate flags to enable SSSE3 support
652 dnl on all architectures.
653 if test -n "$CLANG_CL"; then
654 SSSE3_FLAGS="-mssse3"
656 dnl VS2013+ supports -Gw for better linker optimizations.
657 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
658 dnl Disabled on ASan because it causes false-positive ODR violations.
659 if test -z "$MOZ_ASAN"; then
661 CXXFLAGS="$CXXFLAGS -Gw"
663 # String tail merging doesn't play nice with ASan's ODR checker.
664 LDFLAGS="$LDFLAGS -opt:nolldtailmerge"
666 if test -n "$CLANG_CL"; then
667 # XXX We should combine some of these with our generic GCC-style
670 # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
671 CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
672 # We use offsetof on non-POD objects all the time.
673 # We also suppress this warning on other platforms.
674 CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
675 # This warns for reasonable things like:
676 # enum { X = 0xffffffffU };
677 # which is annoying for IDL headers.
678 CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
679 # This warns for cases that would be reached by the Microsoft
680 # #include rules, but also currently warns on cases that would
681 # *also* be reached by standard C++ include rules. That
682 # behavior doesn't seem useful, so we turn it off.
683 CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
684 # We normally error out on unknown pragmas, but since clang-cl
685 # claims to be MSVC, it would be difficult to add
686 # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
687 # use such pragmas, so just ignore them.
688 CFLAGS="$CFLAGS -Wno-unknown-pragmas"
689 CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
690 # We get errors about various #pragma intrinsic directives from
691 # clang-cl, and we don't need to hear about those.
692 CFLAGS="$CFLAGS -Wno-ignored-pragmas"
693 CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
694 # clang-cl's Intrin.h marks things like _ReadWriteBarrier
695 # as __attribute((__deprecated__)). This is nice to know,
696 # but since we don't get the equivalent warning from MSVC,
697 # let's just ignore it.
698 CFLAGS="$CFLAGS -Wno-deprecated-declarations"
699 CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
700 # We use a function like:
701 # __declspec(noreturn) __inline void f() {}
702 # which -Winvalid-noreturn complains about. Again, MSVC seems
703 # OK with it, so let's silence the warning.
704 CFLAGS="$CFLAGS -Wno-invalid-noreturn"
705 CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
706 # Missing |override| on virtual function declarations isn't
707 # something that MSVC currently warns about.
708 CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
709 # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
710 # declaration on |operator delete(void*)|. However, clang-cl
711 # must internally declare |operator delete(void*)| differently,
712 # which causes this warning for virtually every file in the
713 # tree. clang-cl doesn't support -fno-exceptions or equivalent,
714 # so there doesn't seem to be any way to convince clang-cl to
715 # declare |delete| differently. Therefore, suppress this
717 CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
718 # Macros like STDMETHOD() and IFACEMETHOD() can declare
719 # __attribute__((nothrow)) on their respective method declarations,
720 # while the definitions are left without the matching attribute.
721 CXXFLAGS="$CXXFLAGS -Wno-microsoft-exception-spec"
722 # At least one MSVC header and several headers in-tree have
723 # unused typedefs, so turn this on.
724 CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
725 # jemalloc uses __declspec(allocator) as a profiler hint,
726 # which clang-cl doesn't understand.
727 CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
728 # __attribute__((unused)) really means "might be unused" and
729 # we use it to avoid warnings about things that are unused
730 # in some compilation units, but used in many others. This
731 # warning insists on complaining about the latter case, which
732 # is annoying, and rather noisy.
733 CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused"
735 # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
736 CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
737 LIBS="$LIBS user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
738 MOZ_DEBUG_LDFLAGS='-DEBUG'
739 if test "$HOST_OS_ARCH" != "WINNT"; then
740 # %_PDB% is a special signal to emit only the PDB basename. This
741 # avoids problems in Windows tools that don't like forward-slashes.
742 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -PDBALTPATH:%_PDB%"
744 # Use a higher optimization level for clang-cl, so we can come closer
745 # to MSVC's performance numbers (see bug 1443590).
746 if test -n "$CLANG_CL"; then
747 MOZ_OPTIMIZE_FLAGS='-O2'
749 MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
752 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE"
753 if test -z "$DEVELOPER_OPTIONS"; then
754 LDFLAGS="$LDFLAGS -RELEASE"
756 dnl Minimum reqiurement of Gecko is VS2015 or later which supports
757 dnl both SSSE3 and SSE4.1.
758 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
759 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
760 dnl allow AVX2 code from VS2015
763 AC_DEFINE(WIN32_LEAN_AND_MEAN)
764 dnl See http://support.microsoft.com/kb/143208 to use STL
767 MOZ_USER_DIR="Mozilla"
771 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.])
777 if test -n "$GNU_CC"; then
778 CFLAGS="$CFLAGS -mstackrealign"
779 CXXFLAGS="$CXXFLAGS -mstackrealign"
780 LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
782 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
783 LDFLAGS="$LDFLAGS -SAFESEH"
789 if test -n "$_WIN32_MSVC"; then
790 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
795 if test -n "$_WIN32_MSVC"; then
796 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:ARM64"
801 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
808 CFLAGS="$CFLAGS -Dunix"
809 CXXFLAGS="$CXXFLAGS -Dunix"
810 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
811 DSO_PIC_CFLAGS='-fPIC -DPIC'
813 MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
815 DSO_PIC_CFLAGS='-fPIC -DPIC'
818 # This will fail on a.out systems prior to 1.5.1_ALPHA.
819 if test "$LIBRUNPATH"; then
820 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
825 if test -z "$X11BASE"; then
828 MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
830 DSO_PIC_CFLAGS='-fPIC'
831 DSO_LDOPTS='-shared -fPIC'
832 if test "$LIBRUNPATH"; then
833 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
838 MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
843 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
844 MOZ_OPTIMIZE_FLAGS="-O"
847 AC_SUBST_LIST(MMX_FLAGS)
848 AC_SUBST_LIST(SSE_FLAGS)
849 AC_SUBST_LIST(SSE2_FLAGS)
850 AC_SUBST_LIST(SSSE3_FLAGS)
853 if test -n "$MOZ_LINKER"; then
854 AC_DEFINE(MOZ_LINKER)
856 AC_CHECK_PROGS(XZ, xz)
859 if test -z "$COMPILE_ENVIRONMENT"; then
860 SKIP_COMPILER_CHECKS=1
861 SKIP_LIBRARY_CHECKS=1
865 fi # COMPILE_ENVIRONMENT
867 if test -z "$SKIP_COMPILER_CHECKS"; then
868 dnl Checks for typedefs, structures, and compiler characteristics.
869 dnl ========================================================
884 case "${OS_TARGET}" in
888 STL_FLAGS="-I${DIST}/stl_wrappers"
893 if test "$MOZ_BUILD_APP" = "tools/crashreporter"; then
897 dnl Checks for header files.
898 dnl ========================================================
901 bitrig*|dragonfly*|freebsd*|openbsd*)
902 # for stuff like -lXshm
903 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
907 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
908 AC_CACHE_CHECK(for sockaddr_in.sin_len,
909 ac_cv_sockaddr_in_sin_len,
910 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
911 #include <sys/types.h>
913 #include <netinet/in.h>
914 struct sockaddr_in x;
915 void *foo = (void*) &x.sin_len;],
917 [ac_cv_sockaddr_in_sin_len=true],
918 [ac_cv_sockaddr_in_sin_len=false])])
919 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
920 AC_DEFINE(HAVE_SIN_LEN)
921 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
922 AC_DEFINE(HAVE_SCONN_LEN)
925 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
926 ac_cv_sockaddr_in6_sin6_len,
927 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
928 #include <sys/types.h>
930 #include <netinet/in.h>
931 struct sockaddr_in6 x;
932 void *foo = (void*) &x.sin6_len;],
934 [ac_cv_sockaddr_in6_sin6_len=true],
935 [ac_cv_sockaddr_in6_sin6_len=false])])
936 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
937 AC_DEFINE(HAVE_SIN6_LEN)
940 AC_CACHE_CHECK(for sockaddr.sa_len,
941 ac_cv_sockaddr_sa_len,
942 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
943 #include <sys/types.h>
945 #include <sys/socket.h>
947 void *foo = (void*) &x.sa_len;],
949 [ac_cv_sockaddr_sa_len=true],
950 [ac_cv_sockaddr_sa_len=false])])
951 if test "$ac_cv_sockaddr_sa_len" = true ; then
952 AC_DEFINE(HAVE_SA_LEN)
955 dnl Checks for libraries.
956 dnl ========================================================
957 AC_CHECK_LIB(c_r, gethostbyname_r)
959 dnl We don't want to link with libdl even if it's present on OS X, since
960 dnl it's not used and not part of the default installation. OS/2 has dlfcn
962 dnl We don't want to link against libm or libpthread on Darwin since
963 dnl they both are just symlinks to libSystem and explicitly linking
964 dnl against libSystem causes issues when debugging (see bug 299601).
969 AC_SEARCH_LIBS(dlopen, dl,
970 MOZ_CHECK_HEADER(dlfcn.h,
971 AC_DEFINE(HAVE_DLOPEN)))
975 _SAVE_CFLAGS="$CFLAGS"
976 CFLAGS="$CFLAGS -D_GNU_SOURCE"
977 AC_CHECK_FUNCS(dladdr memmem)
978 CFLAGS="$_SAVE_CFLAGS"
980 if test ! "$GNU_CXX"; then
981 AC_CHECK_LIB(C, demangle)
984 AC_CHECK_LIB(socket, socket)
987 XLIBS="$X_EXTRA_LIBS"
989 dnl ========================================================
990 dnl Checks for X libraries.
991 dnl Ordering is important.
992 dnl Xt is dependent upon SM as of X11R6
993 dnl ========================================================
994 if test -n "$MOZ_X11"; then
995 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
996 _SAVE_LDFLAGS="$LDFLAGS"
998 LDFLAGS="$XLDFLAGS $LDFLAGS"
999 AC_CHECK_LIB(X11, XDrawLines, [XLIBS="-lX11 $XLIBS"],
1000 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
1001 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
1002 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
1004 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
1005 unset ac_cv_lib_Xt_XtFree
1006 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
1007 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
1008 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
1009 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
1012 dnl ========================================================
1014 dnl ========================================================
1015 AC_CHECK_LIB(xcb, xcb_connect, [XLIBS="-lxcb $XLIBS"],
1016 [MISSING_X="$MISSING_X -lxcb"], $XLIBS)
1017 AC_CHECK_LIB(xcb-shm, xcb_shm_query_version, [XLIBS="-lxcb-shm $XLIBS"],
1018 [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS)
1019 AC_CHECK_LIB(X11-xcb, XGetXCBConnection, [XLIBS="-lX11-xcb $XLIBS"],
1020 [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS)
1022 LDFLAGS="$_SAVE_LDFLAGS"
1026 AC_SUBST_LIST(XCFLAGS)
1027 AC_SUBST_LIST(XLDFLAGS)
1028 AC_SUBST_LIST(XLIBS)
1029 AC_SUBST_LIST(XEXT_LIBS)
1030 AC_SUBST_LIST(XT_LIBS)
1032 dnl ========================================================
1033 dnl = pthread support
1034 dnl = Start by checking whether the system support pthreads
1035 dnl ========================================================
1036 case "$target_os" in
1041 AC_CHECK_LIB(pthreads, pthread_create,
1042 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
1043 AC_CHECK_LIB(pthread, pthread_create,
1044 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
1045 AC_CHECK_LIB(c_r, pthread_create,
1046 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
1047 AC_CHECK_LIB(c, pthread_create,
1056 dnl ========================================================
1057 dnl Do the platform specific pthread hackery
1058 dnl ========================================================
1059 if test "$MOZ_USE_PTHREADS"x != x
1062 dnl See if -pthread is supported.
1065 ac_cv_have_dash_pthread=no
1066 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
1067 echo 'int main() { return 0; }' | cat > conftest.c
1068 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
1069 if test $? -eq 0; then
1070 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1071 ac_cv_have_dash_pthread=yes
1072 case "$target_os" in
1074 # Freebsd doesn't use -pthread for compiles, it uses them for linking
1077 CFLAGS="$CFLAGS -pthread"
1078 CXXFLAGS="$CXXFLAGS -pthread"
1084 AC_MSG_RESULT($ac_cv_have_dash_pthread)
1087 dnl See if -pthreads is supported.
1089 ac_cv_have_dash_pthreads=no
1090 if test "$ac_cv_have_dash_pthread" = "no"; then
1091 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
1092 echo 'int main() { return 0; }' | cat > conftest.c
1093 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
1094 if test $? -eq 0; then
1095 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1096 ac_cv_have_dash_pthreads=yes
1097 CFLAGS="$CFLAGS -pthreads"
1098 CXXFLAGS="$CXXFLAGS -pthreads"
1102 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
1107 AC_DEFINE(_REENTRANT)
1108 AC_DEFINE(_THREAD_SAFE)
1109 dnl -pthread links in -lpthread, so don't specify it explicitly.
1110 if test "$ac_cv_have_dash_pthread" = "yes"; then
1111 _PTHREAD_LDFLAGS="-pthread"
1115 *-*-openbsd*|*-*-bsdi*)
1116 AC_DEFINE(_REENTRANT)
1117 AC_DEFINE(_THREAD_SAFE)
1118 dnl -pthread links in -lc_r, so don't specify it explicitly.
1119 if test "$ac_cv_have_dash_pthread" = "yes"; then
1120 _PTHREAD_LDFLAGS="-pthread"
1124 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
1125 AC_DEFINE(_REENTRANT)
1129 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
1130 AC_SUBST(MOZ_USE_PTHREADS)
1131 MOZ_CHECK_HEADERS(pthread.h)
1135 dnl Checks for library functions.
1136 dnl ========================================================
1137 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)
1139 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1140 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1141 ac_cv_clock_monotonic,
1142 [for libs in "" -lrt; do
1144 _SAVE_CFLAGS="$CFLAGS"
1146 CFLAGS="$CFLAGS $DSO_PIC_CFLAGS"
1147 dnl clock_gettime is available on OSX since 10.12, so depending on MACOSX_DEPLOYMENT_TARGET,
1148 dnl we should or not be able to use it. To detect if we can, we need to make the
1149 dnl availability attribute strict, so that compilation fails when the target is < 10.12.
1150 AC_TRY_LINK([#define availability(os, ...) availability(os, strict, __VA_ARGS)
1152 [ struct timespec ts;
1153 clock_gettime(CLOCK_MONOTONIC, &ts); ],
1154 ac_cv_clock_monotonic=$libs
1156 CFLAGS="$_SAVE_CFLAGS"
1158 ac_cv_clock_monotonic=no)
1160 CFLAGS="$_SAVE_CFLAGS"
1162 if test "$ac_cv_clock_monotonic" != "no"; then
1163 HAVE_CLOCK_MONOTONIC=1
1164 REALTIME_LIBS=$ac_cv_clock_monotonic
1165 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1166 AC_SUBST(HAVE_CLOCK_MONOTONIC)
1167 AC_SUBST_LIST(REALTIME_LIBS)
1170 dnl Turn on warnings-as-errors to prevent implicit declaration of
1171 dnl pthread_cond_timedwait_monotonic_np, which can cause this test to
1172 dnl inadvertently pass even if the function does not really exist.
1173 _SAVE_CFLAGS="$CFLAGS"
1174 CFLAGS="$CFLAGS $WARNINGS_AS_ERRORS"
1175 AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
1176 ac_cv_pthread_cond_timedwait_monotonic_np,
1177 AC_TRY_LINK([#include <pthread.h>],
1178 [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
1179 ac_cv_pthread_cond_timewait_monotonic_np=yes,
1180 ac_cv_pthread_cond_timewait_monotonic_np=no))
1181 if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
1182 AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
1184 CFLAGS=$_SAVE_CFLAGS
1188 ac_cv_func_res_ninit,
1189 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
1190 dnl no need for res_ninit() on NetBSD and OpenBSD
1191 ac_cv_func_res_ninit=no
1195 #define _BSD_SOURCE 1
1197 #include <sys/types.h>
1198 #include <netinet/in.h>
1199 #include <arpa/nameser.h>
1202 [int foo = res_ninit(&_res);],
1203 [ac_cv_func_res_ninit=yes],
1204 [ac_cv_func_res_ninit=no])
1208 if test "$ac_cv_func_res_ninit" = "yes"; then
1209 AC_DEFINE(HAVE_RES_NINIT)
1210 dnl must add the link line we do something as foolish as this... dougt
1212 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
1213 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
1218 dnl **********************
1219 dnl *** va_copy checks ***
1220 AC_CACHE_CHECK([for an implementation of va_copy()],
1222 [AC_TRY_COMPILE([#include <stdarg.h>
1224 void f (int i, ...) {
1225 va_list args1, args2;
1226 va_start (args1, i);
1227 va_copy (args2, args1);
1228 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1230 va_end (args1); va_end (args2);
1232 [f(0, 42); return 0],
1233 [ac_cv_va_copy=yes],
1237 AC_CACHE_CHECK([whether va_list can be copied by value],
1239 [AC_TRY_COMPILE([#include <stdarg.h>
1241 void f (int i, ...) {
1242 va_list args1, args2;
1243 va_start (args1, i);
1245 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1247 va_end (args1); va_end (args2);
1249 [f(0, 42); return 0],
1250 [ac_cv_va_val_copy=yes],
1251 [ac_cv_va_val_copy=no],
1254 if test "x$ac_cv_va_copy" = "xyes"; then
1255 AC_DEFINE(VA_COPY, va_copy)
1256 AC_DEFINE(HAVE_VA_COPY)
1259 if test "x$ac_cv_va_val_copy" = "xno"; then
1260 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
1263 dnl ===================================================================
1264 dnl ========================================================
1265 dnl Put your C++ language/feature checks below
1266 dnl ========================================================
1270 if test "$GNU_CC"; then
1271 if test "$CPU_ARCH" = "arm" ; then
1272 AC_CACHE_CHECK(for ARM EABI,
1276 #if defined(__ARM_EABI__)
1279 #error Not ARM EABI.
1282 ac_cv_gcc_arm_eabi="yes",
1283 ac_cv_gcc_arm_eabi="no")])
1284 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
1286 ARM_ABI_PREFIX=eabi-
1288 ARM_ABI_PREFIX=oabi-
1292 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
1295 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
1296 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
1297 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
1299 _SAVE_LDFLAGS=$LDFLAGS
1300 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
1301 AC_CACHE_CHECK(for __thread keyword for TLS variables,
1302 ac_cv_thread_keyword,
1303 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
1304 [return tlsIsMainThread;],
1305 ac_cv_thread_keyword=yes,
1306 ac_cv_thread_keyword=no)])
1307 LDFLAGS=$_SAVE_LDFLAGS
1308 # The custom dynamic linker doesn't support TLS variables
1310 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
1311 # mips builds fail with TLS variables because of a binutils bug.
1313 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
1318 *-android*|*-linuxandroid*)
1325 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
1331 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
1332 if test -n "$MOZ_LINKER"; then
1333 if test "$CPU_ARCH" = arm; then
1334 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
1335 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
1336 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1337 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1341 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
1342 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
1343 dnl Since the linker only understands the sysv ones, no need to build the
1344 dnl gnu style tables anyways.
1345 LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
1348 dnl End of C++ language/feature checks
1351 dnl ========================================================
1352 dnl = Internationalization checks
1353 dnl ========================================================
1355 dnl Internationalization and Locale support is different
1356 dnl on various UNIX platforms. Checks for specific i18n
1357 dnl features go here.
1359 AC_HAVE_FUNCS(localeconv)
1361 fi # ! SKIP_COMPILER_CHECKS
1363 if test -n "${COMPILE_ENVIRONMENT}"; then
1368 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1369 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1370 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1373 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1374 dnl features that Windows actually does support.
1376 if test -n "$SKIP_COMPILER_CHECKS"; then
1377 dnl Windows has malloc.h
1378 AC_DEFINE(MALLOC_H, [<malloc.h>])
1379 AC_DEFINE(HAVE_FORCEINLINE)
1380 AC_DEFINE(HAVE_LOCALECONV)
1381 fi # SKIP_COMPILER_CHECKS
1383 dnl Mozilla specific options
1384 dnl ========================================================
1385 dnl The macros used for command line options
1386 dnl are defined in build/autoconf/altoptions.m4.
1388 dnl ========================================================
1390 dnl = Check for external package dependencies
1392 dnl ========================================================
1393 MOZ_ARG_HEADER(External Packages)
1395 dnl ========================================================
1396 dnl system libevent Support
1397 dnl ========================================================
1398 MOZ_ARG_WITH_STRING(system-libevent,
1399 [ --with-system-libevent[=PFX]
1400 Use system libevent [installed at prefix PFX]],
1401 LIBEVENT_DIR=$withval)
1403 _SAVE_CFLAGS=$CFLAGS
1404 _SAVE_LDFLAGS=$LDFLAGS
1406 if test "$LIBEVENT_DIR" = yes; then
1407 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
1408 MOZ_SYSTEM_LIBEVENT=1,
1411 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
1412 MOZ_SYSTEM_LIBEVENT=
1413 elif test -z "$MOZ_SYSTEM_LIBEVENT"; then
1414 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
1415 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
1416 MOZ_CHECK_HEADER(event.h,
1417 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
1418 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
1420 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
1421 AC_CHECK_LIB(event, event_init,
1422 [MOZ_SYSTEM_LIBEVENT=1
1423 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
1424 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
1425 [MOZ_SYSTEM_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
1427 CFLAGS=$_SAVE_CFLAGS
1428 LDFLAGS=$_SAVE_LDFLAGS
1431 AC_SUBST(MOZ_SYSTEM_LIBEVENT)
1433 if test -z "$SKIP_LIBRARY_CHECKS"; then
1435 dnl ========================================================
1436 dnl system PNG Support
1437 dnl ========================================================
1438 MOZ_ARG_WITH_STRING(system-png,
1439 [ --with-system-png[=PFX]
1440 Use system libpng [installed at prefix PFX]],
1443 _SAVE_CFLAGS=$CFLAGS
1444 _SAVE_LDFLAGS=$LDFLAGS
1446 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
1447 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
1448 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
1450 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
1453 AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"],
1454 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1455 AC_CHECK_LIB(png, png_get_acTL, ,
1456 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
1458 if test "$MOZ_SYSTEM_PNG" = 1; then
1459 AC_TRY_COMPILE([ #include <stdio.h>
1460 #include <sys/types.h>
1462 [ #if PNG_LIBPNG_VER < $MOZPNG
1463 #error "Insufficient libpng version ($MOZPNG required)."
1465 #ifndef PNG_UINT_31_MAX
1466 #error "Insufficient libpng version."
1469 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1471 CFLAGS=$_SAVE_CFLAGS
1472 LDFLAGS=$_SAVE_LDFLAGS
1475 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then
1476 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
1477 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
1480 fi # SKIP_LIBRARY_CHECKS
1482 dnl ========================================================
1486 dnl ========================================================
1488 MOZ_ARG_HEADER(Application)
1490 ENABLE_SYSTEM_EXTENSION_DIRS=1
1491 MOZ_BRANDING_DIRECTORY=
1492 MOZ_OFFICIAL_BRANDING=
1493 MOZ_AUTH_EXTENSION=1
1495 MOZ_UNIVERSALCHARDET=1
1500 MOZ_BINARY_EXTENSIONS=
1503 dnl ========================================================
1504 dnl = Trademarked Branding
1505 dnl ========================================================
1506 MOZ_ARG_ENABLE_BOOL(official-branding,
1507 [ --enable-official-branding
1508 Enable Official mozilla.org Branding
1509 Do not distribute builds with
1510 --enable-official-branding unless you have
1511 permission to use trademarks per
1512 http://www.mozilla.org/foundation/trademarks/ .],
1513 MOZ_OFFICIAL_BRANDING=1,
1514 MOZ_OFFICIAL_BRANDING=)
1516 # Allow the application to influence configure with a confvars.sh script.
1517 AC_MSG_CHECKING([if app-specific confvars.sh exists])
1518 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
1519 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
1520 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
1525 dnl ========================================================
1526 dnl Ensure Android SDK and build-tools versions depending on
1528 dnl ========================================================
1530 case "$MOZ_BUILD_APP" in
1536 dnl ========================================================
1538 dnl = Toolkit Options
1540 dnl ========================================================
1541 MOZ_ARG_HEADER(Toolkit Options)
1543 dnl ========================================================
1544 dnl = Enable the toolkit as needed =
1545 dnl ========================================================
1547 case "$MOZ_WIDGET_TOOLKIT" in
1550 LDFLAGS="$LDFLAGS -framework Cocoa"
1551 # Use -Wl as a trick to avoid -framework and framework names from
1552 # being separated by AC_SUBST_LIST.
1553 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'
1555 CFLAGS="$CFLAGS $TK_CFLAGS"
1556 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1557 MOZ_USER_DIR="Mozilla"
1558 MOZ_FS_LAYOUT=bundle
1562 LDFLAGS="$LDFLAGS -framework UIKit"
1564 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'
1565 CFLAGS="$CFLAGS $TK_CFLAGS"
1566 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1567 MOZ_USER_DIR="Mozilla"
1568 MOZ_FS_LAYOUT=bundle
1573 if test "$OS_TARGET" = Darwin; then
1574 LDFLAGS="$LDFLAGS -lobjc"
1577 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
1578 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
1579 case "$MOZ_WIDGET_TOOLKIT" in
1585 if test "$COMPILE_ENVIRONMENT"; then
1586 if test "$MOZ_WIDGET_TOOLKIT" = gtk; then
1587 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)
1588 MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
1589 TK_CFLAGS=$MOZ_GTK3_CFLAGS
1590 TK_LIBS=$MOZ_GTK3_LIBS
1591 dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
1592 dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
1593 AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
1595 if test "$MOZ_ENABLE_GTK"; then
1596 AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
1597 AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
1599 if test "$MOZ_X11"; then
1600 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-x11-2.0)
1601 MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
1604 fi # COMPILE_ENVIRONMENT
1606 AC_SUBST(MOZ_FS_LAYOUT)
1608 AC_SUBST_LIST(TK_CFLAGS)
1609 AC_SUBST_LIST(TK_LIBS)
1611 dnl ========================================================
1613 dnl = Components & Features
1615 dnl ========================================================
1616 MOZ_ARG_HEADER(Components and Features)
1618 AC_SUBST(MOZ_OFFICIAL_BRANDING)
1619 if test -n "$MOZ_OFFICIAL_BRANDING"; then
1620 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
1621 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
1623 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
1624 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
1628 MOZ_ARG_WITH_STRING(branding,
1629 [ --with-branding=dir Use branding from the specified directory.],
1630 MOZ_BRANDING_DIRECTORY=$withval)
1632 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
1633 if test -z "$REAL_BRANDING_DIRECTORY"; then
1634 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
1637 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1638 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
1641 AC_SUBST(MOZ_BRANDING_DIRECTORY)
1643 dnl ========================================================
1644 dnl = Distribution ID
1645 dnl ========================================================
1646 MOZ_ARG_WITH_STRING(distribution-id,
1647 [ --with-distribution-id=ID
1648 Set distribution-specific id (default=org.mozilla)],
1649 [ val=`echo $withval`
1650 MOZ_DISTRIBUTION_ID="$val"])
1652 if test -z "$MOZ_DISTRIBUTION_ID"; then
1653 MOZ_DISTRIBUTION_ID="org.mozilla"
1656 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
1657 AC_SUBST(MOZ_DISTRIBUTION_ID)
1659 dnl ========================================================
1660 dnl = libproxy support
1661 dnl ========================================================
1663 if test "$MOZ_ENABLE_GTK"
1665 MOZ_ENABLE_LIBPROXY=
1667 MOZ_ARG_ENABLE_BOOL(libproxy,
1668 [ --enable-libproxy Enable libproxy support ],
1669 MOZ_ENABLE_LIBPROXY=1,
1670 MOZ_ENABLE_LIBPROXY=)
1672 if test "$MOZ_ENABLE_LIBPROXY"
1674 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
1675 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
1678 AC_SUBST(MOZ_ENABLE_LIBPROXY)
1680 dnl ========================================================
1682 dnl ========================================================
1684 if test "$MOZ_ENABLE_GTK"
1688 MOZ_ARG_DISABLE_BOOL(dbus,
1689 [ --disable-dbus Disable dbus support ],
1693 if test "$MOZ_ENABLE_DBUS"
1695 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
1696 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
1697 AC_DEFINE(MOZ_ENABLE_DBUS)
1700 AC_SUBST(MOZ_ENABLE_DBUS)
1702 AC_TRY_COMPILE([#include <linux/ethtool.h>],
1703 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
1704 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
1706 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
1708 if test -n "$MOZ_WEBRTC"; then
1709 if test -n "$MOZ_X11"; then
1710 MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
1714 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
1716 dnl ========================================================
1717 dnl = Apple platform decoder support
1718 dnl ========================================================
1719 if test "$COMPILE_ENVIRONMENT"; then
1720 if test -n "$MOZ_APPLEMEDIA"; then
1721 # hack in frameworks for fmp4 - see bug 1029974
1722 # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
1723 LDFLAGS="$LDFLAGS -framework AudioToolbox"
1724 dnl Verify CoreMedia is available.
1725 AC_CHECK_HEADERS([CoreMedia/CoreMedia.h VideoToolbox/VideoToolbox.h], [],
1726 [AC_MSG_ERROR([MacOS X 10.9 SDK or later is required])])
1728 fi # COMPILE_ENVIRONMENT
1730 dnl ========================================================
1731 dnl = Handle dependent MEDIA defines
1732 dnl ========================================================
1735 AC_DEFINE(MOZ_WEBM_ENCODER)
1736 AC_SUBST(MOZ_WEBM_ENCODER)
1738 dnl ========================================================
1740 dnl ========================================================
1742 MOZ_ARG_DISABLE_BOOL(negotiateauth,
1743 [ --disable-negotiateauth Disable GSS-API negotiation ],
1744 MOZ_AUTH_EXTENSION=,
1745 MOZ_AUTH_EXTENSION=1 )
1747 dnl ========================================================
1748 dnl Searching of system directories for extensions.
1749 dnl Note: this switch is meant to be used for test builds
1750 dnl whose behavior should not depend on what happens to be
1751 dnl installed on the local machine.
1752 dnl ========================================================
1753 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
1754 [ --disable-system-extension-dirs
1755 Disable searching system- and account-global
1756 directories for extensions of any kind; use
1757 only profile-specific extension directories],
1758 ENABLE_SYSTEM_EXTENSION_DIRS=,
1759 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
1760 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
1761 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
1764 dnl ========================================================
1765 dnl = Universalchardet
1766 dnl ========================================================
1767 MOZ_ARG_DISABLE_BOOL(universalchardet,
1768 [ --disable-universalchardet
1769 Disable universal encoding detection],
1770 MOZ_UNIVERSALCHARDET=,
1771 MOZ_UNIVERSALCHARDET=1 )
1773 dnl ========================================================
1775 dnl ========================================================
1777 if test "$COMPILE_ENVIRONMENT" ; then
1779 dnl Moved gamepad platform check to moz.build, linux header check still needed here.
1780 if test "$OS_TARGET" = "Linux"; then
1781 MOZ_CHECK_HEADER([linux/joystick.h])
1782 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
1783 AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
1787 fi # COMPILE_ENVIRONMENT
1790 dnl ========================================================
1791 dnl = Breakpad crash reporting (on by default on supported platforms)
1792 dnl ========================================================
1795 i?86-*-mingw*|x86_64-*-mingw*|aarch64-*-mingw*)
1798 i?86-apple-darwin*|x86_64-apple-darwin*|aarch64-apple-darwin*)
1801 *-android*|*-linuxandroid*)
1802 dnl Android/arm is arm-unknown-linux-androideabi, so android condition should
1803 dnl be before Linux condition
1804 dnl The crash reporter prevents crash stacktraces to be logged in the
1805 dnl logs so we leave it out by default in developer builds.
1806 if test -z "$DEVELOPER_OPTIONS"; then
1810 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
1811 if test "$MOZ_ENABLE_GTK"; then
1817 MOZ_ARG_DISABLE_BOOL(crashreporter,
1818 [ --disable-crashreporter Disable breakpad crash reporting],
1819 [MOZ_CRASHREPORTER=],
1820 [MOZ_CRASHREPORTER=F # Force enable breakpad])
1822 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin" -a "$MOZ_WIDGET_TOOLKIT" != "android"; then
1823 if test "$MOZ_CRASHREPORTER" = F; then
1824 AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
1829 if test -n "$MOZ_CRASHREPORTER"; then
1830 AC_DEFINE(MOZ_CRASHREPORTER)
1832 if test "$OS_TARGET" = "Linux" && \
1833 test -z "$SKIP_LIBRARY_CHECKS"; then
1834 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
1837 if test "$OS_ARCH" = "WINNT"; then
1838 if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
1839 MOZ_CRASHREPORTER_INJECTOR=1
1840 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
1845 dnl ========================================================
1846 dnl = Enable compilation of specific extension modules
1847 dnl ========================================================
1849 MOZ_ARG_ENABLE_STRING(extensions,
1850 [ --enable-extensions Enable extensions],
1851 [ for option in `echo $enableval | sed 's/,/ /g'`; do
1852 if test "$option" = "yes" -o "$option" = "all"; then
1853 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
1854 elif test "$option" = "no" -o "$option" = "none"; then
1856 elif test "$option" = "default"; then
1857 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
1858 elif test `echo "$option" | grep -c \^-` != 0; then
1859 option=`echo $option | sed 's/^-//'`
1860 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
1862 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
1865 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
1867 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
1868 dnl when trying to build a nonexistent extension.
1869 for extension in $MOZ_EXTENSIONS; do
1870 if test ! -d "${srcdir}/extensions/${extension}"; then
1871 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
1875 # Avoid defining MOZ_ENABLE_CAIRO_FT on Windows platforms because
1876 # "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
1877 if test -n "$MOZ_TREE_FREETYPE" -a "$OS_TARGET" != WINNT; then
1878 MOZ_ENABLE_CAIRO_FT=1
1879 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
1880 CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
1881 AC_SUBST_LIST(CAIRO_FT_CFLAGS)
1884 dnl ========================================================
1886 dnl ========================================================
1888 MOZ_ARG_DISABLE_BOOL(updater,
1889 [ --disable-updater Disable building of updater],
1893 if test -n "$MOZ_UPDATER"; then
1894 AC_DEFINE(MOZ_UPDATER)
1897 dnl ========================================================
1898 dnl parental controls (for Windows Vista)
1899 dnl ========================================================
1900 MOZ_ARG_DISABLE_BOOL(parental-controls,
1901 [ --disable-parental-controls
1902 Do not build parental controls],
1903 MOZ_DISABLE_PARENTAL_CONTROLS=1,
1904 MOZ_DISABLE_PARENTAL_CONTROLS=)
1905 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
1906 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
1909 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
1911 dnl ========================================================
1912 dnl = Disable smartcard support
1913 dnl ========================================================
1914 if test -n "$MOZ_NO_SMART_CARDS"; then
1915 AC_DEFINE(MOZ_NO_SMART_CARDS)
1917 AC_SUBST(MOZ_NO_SMART_CARDS)
1919 dnl ========================================================
1920 dnl = Sandboxing support
1921 dnl ========================================================
1922 if test -n "$MOZ_TSAN" -o -n "$MOZ_ASAN"; then
1923 # Bug 1182565: TSan conflicts with sandboxing on Linux.
1924 # Bug 1287971: LSan also conflicts with sandboxing on Linux.
1932 MOZ_ARG_DISABLE_BOOL(sandbox,
1933 [ --disable-sandbox Disable sandboxing support],
1937 case "$OS_TARGET" in
1938 WINNT|Darwin|OpenBSD)
1942 x86_64|x86|arm|aarch64)
1944 # Linux sandbox is only available on x86{,_64} and arm{,64}.
1951 # Only enable the sandbox by default on Linux, OpenBSD, macOS, and Windows
1956 if test -n "$MOZ_SANDBOX"; then
1957 AC_DEFINE(MOZ_SANDBOX)
1960 AC_SUBST(MOZ_SANDBOX)
1963 dnl ========================================================
1965 dnl = Module specific options
1967 dnl ========================================================
1968 MOZ_ARG_HEADER(Individual module options)
1970 dnl ==============================
1971 dnl === SQLite fdatasync check ===
1972 dnl ==============================
1973 dnl Check to see if fdatasync is available and make use of it
1974 AC_CHECK_FUNC(fdatasync)
1976 dnl ========================================================
1977 dnl = Disable zipwriter
1978 dnl ========================================================
1979 MOZ_ARG_DISABLE_BOOL(zipwriter,
1980 [ --disable-zipwriter Disable zipwriter component],
1983 AC_SUBST(MOZ_ZIPWRITER)
1985 dnl ========================================================
1987 dnl = Feature options that require extra sources to be pulled
1989 dnl ========================================================
1990 dnl MOZ_ARG_HEADER(Features that require extra sources)
1992 dnl ========================================================
1994 dnl = Runtime debugging and Optimization Options
1996 dnl ========================================================
1997 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
1999 dnl ========================================================
2000 dnl = Enable code optimization. ON by default.
2001 dnl ========================================================
2003 # Use value from moz.configure if one is defined. Else use our computed
2005 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
2006 MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
2009 if test "$COMPILE_ENVIRONMENT"; then
2010 if test -n "$MOZ_OPTIMIZE"; then
2011 AC_MSG_CHECKING([for valid C compiler optimization flags])
2012 _SAVE_CFLAGS=$CFLAGS
2013 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
2014 AC_TRY_COMPILE([#include <stdio.h>],
2015 [printf("Hello World\n");],
2018 AC_MSG_RESULT([$_results])
2019 if test "$_results" = "no"; then
2020 AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
2022 CFLAGS=$_SAVE_CFLAGS
2023 if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
2024 # When using llvm-based LTO, non numeric optimization levels are
2025 # not supported by the linker, so force the linker to use -O2 (
2026 # which doesn't influence the level compilation units are actually
2028 case " $MOZ_OPTIMIZE_FLAGS " in
2029 *\ -Os\ *|*\ -Oz\ *)
2030 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
2035 fi # COMPILE_ENVIRONMENT
2037 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
2038 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
2039 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
2041 dnl ========================================================
2042 dnl = Enable runtime logging
2043 dnl ========================================================
2044 AC_DEFINE(MOZ_LOGGING)
2045 AC_DEFINE(FORCE_PR_LOG)
2047 dnl ========================================================
2048 dnl = This will enable logging of addref, release, ctor, dtor.
2049 dnl ========================================================
2050 _ENABLE_LOGREFCNT=42
2051 MOZ_ARG_ENABLE_BOOL(logrefcnt,
2052 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
2053 _ENABLE_LOGREFCNT=1,
2054 _ENABLE_LOGREFCNT= )
2055 if test "$_ENABLE_LOGREFCNT" = "1"; then
2056 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
2057 elif test -z "$_ENABLE_LOGREFCNT"; then
2058 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
2061 dnl ========================================================
2062 dnl moz_dump_painting
2063 dnl ========================================================
2064 MOZ_ARG_ENABLE_BOOL(dump-painting,
2065 [ --enable-dump-painting Enable paint debugging.],
2066 MOZ_DUMP_PAINTING=1,
2067 MOZ_DUMP_PAINTING= )
2068 if test -n "$MOZ_DUMP_PAINTING"; then
2069 AC_DEFINE(MOZ_DUMP_PAINTING)
2070 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
2072 if test -n "$MOZ_DEBUG"; then
2073 AC_DEFINE(MOZ_DUMP_PAINTING)
2076 case "${OS_TARGET}" in
2077 Android|WINNT|Darwin)
2078 MOZ_GLUE_IN_PROGRAM=
2081 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
2082 MOZ_GLUE_IN_PROGRAM=1
2083 AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
2087 dnl ========================================================
2088 dnl = Jemalloc build setup
2089 dnl ========================================================
2090 if test -z "$MOZ_MEMORY"; then
2093 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
2094 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.])
2099 dnl The generic feature tests that determine how to compute ncpus are long and
2100 dnl complicated. Therefore, simply define special cpp variables for the
2101 dnl platforms we have special knowledge of.
2104 export MOZ_NO_DEBUG_RTL=1
2108 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
2110 dnl ========================================================
2111 dnl = Enable using the clang plugin to build
2112 dnl ========================================================
2114 if test -n "$COMPILE_ENVIRONMENT"; then
2115 MOZ_CONFIG_CLANG_PLUGIN
2116 fi # COMPILE_ENVIRONMENT
2118 dnl ========================================================
2119 dnl = frontend JS debug mode
2120 dnl ========================================================
2122 MOZ_ARG_ENABLE_BOOL(debug-js-modules,
2123 [ --enable-debug-js-modules Enable debug mode for frontend JS libraries],
2127 AC_SUBST(DEBUG_JS_MODULES)
2129 dnl ========================================================
2131 dnl = Profiling and Instrumenting
2133 dnl ========================================================
2134 MOZ_ARG_HEADER(Profiling and Instrumenting)
2136 dnl ========================================================
2137 dnl = Support for demangling undefined symbols
2138 dnl ========================================================
2139 if test -z "$SKIP_LIBRARY_CHECKS"; then
2142 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
2146 # Demangle only for debug or DMD builds
2147 MOZ_DEMANGLE_SYMBOLS=
2148 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
2149 MOZ_DEMANGLE_SYMBOLS=1
2150 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
2152 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
2154 dnl ========================================================
2155 dnl = Support for gcc stack unwinding (from gcc 3.3)
2156 dnl ========================================================
2157 if test -z "$SKIP_LIBRARY_CHECKS"; then
2160 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
2164 dnl ========================================================
2168 dnl ========================================================
2169 MOZ_ARG_HEADER(Misc. Options)
2171 dnl ========================================================
2172 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
2173 dnl ========================================================
2174 MOZ_ARG_WITH_STRING(user-appdir,
2175 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
2176 [ val=`echo $withval`
2177 if echo "$val" | grep "\/" >/dev/null; then
2178 AC_MSG_ERROR("Homedir must be single relative path.")
2183 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
2185 if test -z "$SKIP_COMPILER_CHECKS"; then
2186 dnl ========================================================
2188 dnl = Compiler Options
2190 dnl ========================================================
2191 MOZ_ARG_HEADER(Compiler Options)
2193 dnl ========================================================
2194 dnl Check for gcc -pipe support
2195 dnl ========================================================
2196 AC_MSG_CHECKING([for -pipe support])
2197 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
2198 dnl Any gcc that supports firefox supports -pipe.
2199 CFLAGS="$CFLAGS -pipe"
2200 CXXFLAGS="$CXXFLAGS -pipe"
2201 AC_MSG_RESULT([yes])
2206 fi # ! SKIP_COMPILER_CHECKS
2210 if test "$COMPILE_ENVIRONMENT"; then
2212 fi # COMPILE_ENVIRONMENT
2214 dnl ========================================================
2216 dnl = Static Build Options
2218 dnl ========================================================
2219 MOZ_ARG_HEADER(Static build options)
2221 if test -z "$MOZ_SYSTEM_ZLIB"; then
2222 if test -n "$JS_SHARED_LIBRARY" -o -n "$MOZ_LINKER" -o "$MOZ_WIDGET_TOOLKIT" = android; then
2224 AC_DEFINE(ZLIB_IN_MOZGLUE)
2228 AC_SUBST(ZLIB_IN_MOZGLUE)
2230 dnl ========================================================
2232 dnl = Standalone module options
2234 dnl ========================================================
2235 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
2238 dnl ========================================================
2240 if test -z "$SKIP_PATH_CHECKS"; then
2241 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
2242 if test "$MOZ_ENABLE_GTK" ; then
2243 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
2248 if test -z "${GLIB_GMODULE_LIBS}" \
2249 -a -n "${GLIB_CONFIG}"\
2250 -a "${GLIB_CONFIG}" != no\
2252 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
2255 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
2257 if test "$USE_FC_FREETYPE"; then
2258 if test "$COMPILE_ENVIRONMENT"; then
2259 dnl ========================================================
2260 dnl = Check for freetype2 functionality
2261 dnl ========================================================
2262 if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
2264 _SAVE_CFLAGS="$CFLAGS"
2265 LIBS="$LIBS $FT2_LIBS"
2266 CFLAGS="$CFLAGS $FT2_CFLAGS"
2268 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
2269 ac_cv_member_FT_Bitmap_Size_y_ppem,
2270 [AC_TRY_COMPILE([#include <ft2build.h>
2271 #include FT_FREETYPE_H],
2273 if (sizeof s.y_ppem) return 0;
2275 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
2276 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
2277 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
2278 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
2280 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
2282 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
2283 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
2284 [FT_Bitmap_Size structure includes y_ppem field])
2286 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
2289 CFLAGS="$_SAVE_CFLAGS"
2292 _SAVE_CPPFLAGS="$CPPFLAGS"
2293 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
2294 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
2295 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
2296 CPPFLAGS="$_SAVE_CPPFLAGS"
2300 dnl ========================================================
2301 dnl Check if we need the 32-bit Linux SSE2 error dialog
2302 dnl ========================================================
2304 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
2306 dnl ========================================================
2307 dnl Check for pixman and cairo
2308 dnl ========================================================
2311 MOZ_ARG_ENABLE_BOOL(system-cairo,
2312 [ --enable-system-cairo Obsolete: do not use this option],
2313 AC_MSG_ERROR(--enable-system-cairo is not supported),
2317 MOZ_ARG_ENABLE_BOOL(system-pixman,
2318 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
2320 MOZ_TREE_PIXMAN=force,
2323 if test "$MOZ_TREE_PIXMAN"; then
2324 AC_DEFINE(MOZ_TREE_PIXMAN)
2326 PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.19.2)
2329 MOZ_CAIRO_CFLAGS="-I${DIST}/include/cairo"
2330 AC_DEFINE(MOZ_TREE_CAIRO)
2332 if test "$OS_ARCH" = "WINNT"; then
2333 # For now we assume that we will have a uint64_t available through
2334 # one of the above headers or mozstdint.h.
2335 AC_DEFINE(HAVE_UINT64_T)
2338 # Define macros for cairo-features.h
2339 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
2340 if test "$MOZ_X11"; then
2341 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
2342 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
2343 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
2345 if test "$_HAVE_FREETYPE2"; then
2346 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2347 MOZ_ENABLE_CAIRO_FT=1
2348 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
2351 case "$MOZ_WIDGET_TOOLKIT" in
2353 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
2354 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
2355 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
2358 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
2359 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
2360 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
2362 if test "$COMPILE_ENVIRONMENT"; then
2363 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
2367 if test "$USE_FC_FREETYPE"; then
2368 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
2370 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
2371 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
2373 AC_SUBST(PS_SURFACE_FEATURE)
2374 AC_SUBST(SVG_SURFACE_FEATURE)
2375 AC_SUBST(XLIB_SURFACE_FEATURE)
2376 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
2377 AC_SUBST(QUARTZ_SURFACE_FEATURE)
2378 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
2379 AC_SUBST(WIN32_SURFACE_FEATURE)
2380 AC_SUBST(OS2_SURFACE_FEATURE)
2381 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
2382 AC_SUBST(FT_FONT_FEATURE)
2383 AC_SUBST(FC_FONT_FEATURE)
2384 AC_SUBST(WIN32_FONT_FEATURE)
2385 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
2386 AC_SUBST(QUARTZ_FONT_FEATURE)
2387 AC_SUBST(PNG_FUNCTIONS_FEATURE)
2388 AC_SUBST(QT_SURFACE_FEATURE)
2389 AC_SUBST(TEE_SURFACE_FEATURE)
2391 if test "$MOZ_X11"; then
2392 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
2395 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
2397 case "$MOZ_WIDGET_TOOLKIT" in
2399 TK_CFLAGS="$MOZ_CAIRO_CFLAGS $MOZ_PIXMAN_CFLAGS"
2400 TK_LIBS="$MOZ_CAIRO_LIBS $MOZ_PIXMAN_LIBS"
2404 AC_SUBST(MOZ_TREE_CAIRO)
2405 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
2406 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
2407 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
2408 AC_SUBST(MOZ_TREE_PIXMAN)
2410 BINDGEN_SYSTEM_FLAGS="$_BINDGEN_CFLAGS $NSPR_CFLAGS $NSS_CFLAGS $MOZ_PIXMAN_CFLAGS $MOZ_CAIRO_CFLAGS"
2411 AC_SUBST(BINDGEN_SYSTEM_FLAGS)
2412 BINDGEN_SYSTEM_TOML_FLAGS="$BINDGEN_SYSTEM_FLAGS"
2413 AC_SUBST_TOML_LIST(BINDGEN_SYSTEM_TOML_FLAGS)
2415 dnl ========================================================
2417 dnl ========================================================
2418 MOZ_ARG_DISABLE_BOOL(xul,
2419 [ --disable-xul Disable XUL],
2421 if test "$MOZ_XUL"; then
2424 dnl remove extensions that require XUL
2425 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
2430 dnl ========================================================
2431 dnl necko configuration options
2432 dnl ========================================================
2435 dnl option to disable necko's wifi scanner
2438 if test "$MOZ_WIDGET_TOOLKIT"; then
2440 case "$OS_TARGET" in
2444 DragonFly|FreeBSD|WINNT)
2455 MOZ_ARG_DISABLE_BOOL(necko-wifi,
2456 [ --disable-necko-wifi Disable necko wifi scanner],
2460 if test "$NECKO_WIFI"; then
2461 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
2462 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
2464 AC_DEFINE(NECKO_WIFI)
2466 AC_SUBST(NECKO_WIFI)
2467 AC_SUBST(NECKO_WIFI_DBUS)
2469 dnl ========================================================
2471 dnl = Maintainer debug option (no --enable equivalent)
2473 dnl ========================================================
2476 AC_SUBST_LIST(ASFLAGS)
2479 AC_SUBST(MOZ_AUTH_EXTENSION)
2480 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
2481 AC_SUBST_LIST(WARNINGS_CFLAGS)
2482 AC_SUBST_SET(MOZ_EXTENSIONS)
2484 AC_SUBST(MOZ_UNIVERSALCHARDET)
2485 AC_SUBST(MOZ_SPELLCHECK)
2486 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
2487 AC_SUBST(MOZ_CRASHREPORTER)
2488 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
2489 AC_SUBST(MOZ_STUB_INSTALLER)
2490 AC_SUBST(MOZ_UPDATER)
2492 AC_SUBST(MOZ_ANDROID_APPLICATION_CLASS)
2493 AC_SUBST(MOZ_ANDROID_BROWSER_INTENT_CLASS)
2494 AC_SUBST(INCREMENTAL_LINKER)
2496 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
2498 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
2499 AC_SUBST(MOZ_LINKER_EXTRACT)
2501 if test -n "$MOZ_BINARY_EXTENSIONS"; then
2502 AC_DEFINE(MOZ_BINARY_EXTENSIONS)
2505 AC_SUBST(MOZ_REQUIRE_SIGNING)
2506 if test "$MOZ_REQUIRE_SIGNING" = 1; then
2507 AC_DEFINE(MOZ_REQUIRE_SIGNING)
2510 dnl ========================================================
2511 dnl = Mac bundle name prefix
2512 dnl ========================================================
2513 MOZ_ARG_WITH_STRING(macbundlename-prefix,
2514 [ --with-macbundlename-prefix=prefix
2515 Prefix for MOZ_MACBUNDLE_NAME],
2516 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
2518 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
2519 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
2520 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
2523 if test "$MOZ_DEBUG"; then
2524 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
2526 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
2528 AC_SUBST(MOZ_MACBUNDLE_NAME)
2530 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
2531 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
2532 # Otherwise, use MOZ_APP_DISPLAYNAME
2533 if test -z "$MOZ_MACBUNDLE_ID"; then
2534 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
2536 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
2537 if test "$MOZ_DEBUG"; then
2538 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
2541 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
2542 AC_SUBST(MOZ_MACBUNDLE_ID)
2544 dnl ========================================================
2545 dnl = Child Process Name for IPC
2546 dnl ========================================================
2547 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
2548 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
2550 # We want to let Android unpack the file at install time, but it only does
2551 # so if the file is named libsomething.so. The lib/ path is also required
2552 # because the unpacked file will be under the lib/ subdirectory and will
2553 # need to be executed from that path.
2554 MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
2556 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
2557 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
2559 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
2560 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
2561 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
2563 # The following variables are available to branding and application
2564 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
2565 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
2566 # impacts profile location and user-visible fields.
2567 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
2568 # Mac Bundle name, Updater, Installer), it is typically used for nightly
2569 # builds (e.g. Aurora for Firefox).
2570 # - MOZ_APP_PROFILE: When set, used for application.ini's
2571 # "Profile" field, which controls profile location.
2572 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
2573 # crash reporter server url.
2574 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
2576 # The following environment variables used to have an effect, but don't anymore:
2577 # - MOZ_APP_VERSION: Defines the application version number. This was replaced with
2578 # the contents from the version.txt file in the application directory, or
2579 # browser/config/version.txt if there isn't one.
2580 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
2581 # in the "About" window. This was replaced with the contents from the
2582 # version_display.txt or version.txt in the application directory, or
2583 # browser/config/version_display.txt.
2585 # For extensions and langpacks, we require a max version that is compatible
2586 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
2587 # 24.0a1 and 24.0a2 aren't affected
2589 # 24.1.1 becomes 24.*
2590 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
2591 if test -z "$IS_ALPHA"; then
2593 if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
2594 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
2596 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
2600 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
2603 AC_SUBST(MOZ_APP_DISPLAYNAME)
2604 AC_SUBST(MOZ_APP_VENDOR)
2605 AC_SUBST(MOZ_APP_PROFILE)
2606 AC_SUBST(MOZ_APP_ID)
2607 AC_SUBST(MAR_CHANNEL_ID)
2608 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
2609 AC_SUBST(MOZ_PROFILE_MIGRATOR)
2610 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
2611 AC_SUBST(MOZ_APP_UA_NAME)
2612 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
2613 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
2614 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
2616 AC_SUBST(MOZ_APP_MAXVERSION)
2617 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
2618 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
2619 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
2622 AC_SUBST(MOZ_PKG_SPECIAL)
2623 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
2625 if test "$MOZILLA_OFFICIAL"; then
2626 # Build revisions should always be present in official builds
2627 MOZ_INCLUDE_SOURCE_INFO=1
2630 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
2631 # explicitly set the repository and changeset information in.
2632 AC_SUBST(MOZ_SOURCE_REPO)
2633 AC_SUBST(MOZ_SOURCE_CHANGESET)
2634 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
2636 dnl If we have any service that uploads data (and requires data submission
2637 dnl policy alert), set MOZ_DATA_REPORTING.
2638 dnl We need SUBST for build system and DEFINE for xul preprocessor.
2639 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER" || test -n "$MOZ_NORMANDY"; then
2640 MOZ_DATA_REPORTING=1
2641 AC_DEFINE(MOZ_DATA_REPORTING)
2642 AC_SUBST(MOZ_DATA_REPORTING)
2646 AC_SUBST(WIN32_REDIST_DIR)
2647 AC_SUBST(WIN_UCRT_REDIST_DIR)
2649 dnl Echo the CFLAGS to remove extra whitespace.
2651 $_COMPILATION_CFLAGS \
2655 $_WARNINGS_CXXFLAGS \
2656 $_COMPILATION_CXXFLAGS \
2659 COMPILE_CFLAGS=`echo \
2663 COMPILE_CXXFLAGS=`echo \
2664 $_DEFINES_CXXFLAGS \
2668 $_WARNINGS_HOST_CFLAGS \
2669 $_COMPILATION_HOST_CFLAGS \
2672 HOST_CXXFLAGS=`echo \
2673 $_WARNINGS_HOST_CXXFLAGS \
2674 $_COMPILATION_HOST_CXXFLAGS \
2677 AC_SUBST(MOZ_SYSTEM_PNG)
2679 AC_SUBST_LIST(MOZ_PNG_CFLAGS)
2680 AC_SUBST_LIST(MOZ_PNG_LIBS)
2682 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
2683 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
2684 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
2685 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
2686 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
2687 OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
2688 OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
2690 AC_SUBST(HOST_CMFLAGS)
2691 AC_SUBST(HOST_CMMFLAGS)
2692 AC_SUBST(OS_COMPILE_CMFLAGS)
2693 AC_SUBST(OS_COMPILE_CMMFLAGS)
2696 OS_CXXFLAGS="$CXXFLAGS"
2697 OS_CPPFLAGS="$CPPFLAGS"
2698 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
2699 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
2700 OS_LDFLAGS="$LDFLAGS"
2702 AC_SUBST_LIST(OS_CFLAGS)
2703 AC_SUBST_LIST(OS_CXXFLAGS)
2704 AC_SUBST_LIST(OS_CPPFLAGS)
2705 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
2706 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
2707 AC_SUBST_LIST(OS_LDFLAGS)
2712 AC_SUBST_LIST(HOST_CFLAGS)
2713 AC_SUBST_LIST(HOST_CPPFLAGS)
2714 AC_SUBST_LIST(HOST_CXXFLAGS)
2715 AC_SUBST(HOST_LDFLAGS)
2716 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
2717 AC_SUBST(HOST_BIN_SUFFIX)
2719 AC_SUBST(TARGET_XPCOM_ABI)
2720 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
2721 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
2722 AC_SUBST(HAVE_X86_AVX2)
2723 AC_SUBST(HAVE_ALTIVEC)
2725 AC_SUBST_LIST(DSO_CFLAGS)
2726 AC_SUBST_LIST(DSO_PIC_CFLAGS)
2727 AC_SUBST(DSO_LDOPTS)
2728 AC_SUBST(BIN_SUFFIX)
2730 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
2731 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
2733 AC_SUBST(MOZ_DEVTOOLS)
2735 AC_SUBST(MOZ_PACKAGE_JSSHELL)
2739 dnl Host JavaScript runtime, if any, to use during cross compiles.
2742 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
2744 if test -n "$COMPILE_ENVIRONMENT"; then
2745 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
2747 dnl Check for missing components
2748 if test "$MOZ_X11"; then
2749 dnl ====================================================
2750 dnl = Check if X headers exist
2751 dnl ====================================================
2752 _SAVE_CFLAGS=$CFLAGS
2753 CFLAGS="$CFLAGS $XCFLAGS"
2757 #include <X11/Xlib.h>
2758 #include <X11/Intrinsic.h>
2759 #include <X11/extensions/XShm.h>
2763 if ((dpy = XOpenDisplay(NULL)) == NULL) {
2764 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
2768 [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
2769 CFLAGS="$_SAVE_CFLAGS"
2771 if test -n "$MISSING_X"; then
2772 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
2777 fi # COMPILE_ENVIRONMENT
2779 dnl Set various defines and substitutions
2780 dnl ========================================================
2782 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
2783 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
2784 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
2785 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
2786 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
2787 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
2788 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
2789 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
2790 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
2793 AC_SUBST(MOZ_DEV_EDITION)
2794 if test -n "$MOZ_DEV_EDITION"; then
2795 AC_DEFINE(MOZ_DEV_EDITION)
2798 if test "$MOZ_DEBUG" -o "$DEVELOPER_OPTIONS"; then
2802 if test -n "$A11Y_LOG"; then
2806 dnl Spit out some output
2807 dnl ========================================================
2809 # Avoid using obsolete NSPR features
2810 AC_DEFINE(NO_NSPR_10_SUPPORT)
2812 MOZ_CREATE_CONFIG_STATUS()
2814 rm -fr confdefs* $ac_clean_files