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 ========================================================
53 dnl Set the minimum version of toolkit libs used by mozilla
54 dnl ========================================================
56 # 2_26 is the earliest version we can set GLIB_VERSION_MIN_REQUIRED.
57 # The macro won't be used when compiling with earlier versions anyway.
58 GLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_26
62 GDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_4
66 dnl Set various checks
67 dnl ========================================================
70 dnl Initialize the Pthread test variables early so they can be
71 dnl overridden by each platform.
72 dnl ========================================================
76 LDFLAGS="$LDFLAGS $LINKER_LDFLAGS"
78 if test "$COMPILE_ENVIRONMENT"; then
80 fi # COMPILE_ENVIRONMENT
83 *-android*|*-linuxandroid*)
86 AC_PATH_PROG(OBJCOPY,objcopy)
96 AC_SUBST(ANDROID_PACKAGE_NAME)
99 dnl ========================================================
100 dnl Checks for compilers.
101 dnl ========================================================
103 if test "$COMPILE_ENVIRONMENT"; then
105 if test "$target" != "$host"; then
111 # Work around the conftest.exe access problem on Windows
116 MOZ_PATH_PROGS(AS, $AS as, $CC)
117 AC_CHECK_PROGS(STRIP, strip, :)
118 AC_CHECK_PROGS(OTOOL, otool, :)
121 if test -n "$MOZ_WINCONSOLE"; then
122 AC_DEFINE(MOZ_WINCONSOLE)
127 dnl ========================================================
128 dnl Special win32 checks
129 dnl ========================================================
135 if test "$GCC" != "yes"; then
136 # Check to see if we are really running in a msvc environemnt
139 # Make sure compilers are valid
140 CXXFLAGS="$CXXFLAGS -TP"
143 AC_TRY_COMPILE([#include <stdio.h>],
144 [ printf("Hello World\n"); ],,
145 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
148 AC_TRY_COMPILE([#include <new.h>],
149 [ unsigned *test = new unsigned(42); ],,
150 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
154 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
157 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
158 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
159 AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
162 MSVC_C_RUNTIME_DLL=vcruntime140.dll
163 MSVC_CXX_RUNTIME_DLL=msvcp140.dll
165 # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
166 CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
168 if test -n "$WIN_UCRT_REDIST_DIR"; then
169 if test ! -d "$WIN_UCRT_REDIST_DIR"; then
170 AC_MSG_ERROR([Invalid Windows UCRT Redist directory: ${WIN_UCRT_REDIST_DIR}])
172 WIN_UCRT_REDIST_DIR=`cd "$WIN_UCRT_REDIST_DIR" && (pwd -W 2>/dev/null || pwd)`
175 AC_SUBST(MSVC_C_RUNTIME_DLL)
176 AC_SUBST(MSVC_CXX_RUNTIME_DLL)
178 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
180 if test -n "$WIN32_REDIST_DIR"; then
181 if test ! -d "$WIN32_REDIST_DIR"; then
182 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
184 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && (pwd -W 2>/dev/null || pwd)`
187 # Check linker version, except in lld builds
192 _LD_FULL_VERSION=`"${LINKER}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
193 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
194 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
195 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
202 unset _MSVC_VER_FILTER
205 STL_FLAGS="-I${DIST}/stl_wrappers"
207 # Check w32api version
208 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
209 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
210 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
211 AC_TRY_COMPILE([#include <w32api.h>],
212 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
213 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
214 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
215 #error "test failed."
217 , [ res=yes ], [ res=no ])
218 AC_MSG_RESULT([$res])
219 if test "$res" != "yes"; then
220 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
222 # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
223 # causing problems with local implementations with the same name.
224 AC_DEFINE(STRSAFE_NO_DEPRECATE)
227 CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
228 CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
230 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
231 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
232 # Require OS features provided by IE 8.0 (Win7)
233 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0800)
238 if test -n "$_WIN32_MSVC"; then
240 SKIP_COMPILER_CHECKS=1
241 SKIP_LIBRARY_CHECKS=1
243 # Since we're skipping compiler and library checks, hard-code
246 AC_DEFINE(HAVE_ISATTY)
249 fi # COMPILE_ENVIRONMENT
254 AC_SUBST_LIST(STL_FLAGS)
255 AC_SUBST(WRAP_STL_INCLUDES)
257 dnl ========================================================
258 dnl Checks for programs.
259 dnl ========================================================
260 if test "$COMPILE_ENVIRONMENT"; then
266 fi # COMPILE_ENVIRONMENT
268 dnl ========================================================
269 dnl set the defaults first
270 dnl ========================================================
271 MOZ_USER_DIR=".mozilla"
273 MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
277 dnl Configure platform-specific CPU architecture compiler options.
278 dnl ==============================================================
279 if test "$COMPILE_ENVIRONMENT"; then
281 fi # COMPILE_ENVIRONMENT
283 dnl ========================================================
284 dnl Android libstdc++
285 dnl ========================================================
288 if test "$COMPILE_ENVIRONMENT"; then
290 fi # COMPILE_ENVIRONMENT
292 dnl ========================================================
293 dnl Suppress Clang Argument Warnings
294 dnl ========================================================
295 WARNINGS_CFLAGS="$_WARNINGS_CFLAGS"
296 if test -n "${CLANG_CC}${CLANG_CL}"; then
297 WARNINGS_CFLAGS="-Qunused-arguments $WARNINGS_CFLAGS"
298 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
300 if test -n "${CLANG_CXX}${CLANG_CL}"; then
301 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
304 if test -n "$COMPILE_ENVIRONMENT"; then
308 dnl ========================================================
309 dnl GNU specific defaults
310 dnl ========================================================
311 if test "$GNU_CC"; then
315 SSSE3_FLAGS="-mssse3"
316 CFLAGS="$CFLAGS -fno-strict-aliasing"
319 if test "$OS_ARCH" != "WINNT" -o -z "$CLANG_CC"; then
320 DSO_PIC_CFLAGS='-fPIC'
321 ASFLAGS="$ASFLAGS -fPIC"
324 AC_MSG_CHECKING([for --noexecstack option to as])
326 CFLAGS="$CFLAGS -Wa,--noexecstack"
327 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
328 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
331 AC_MSG_CHECKING([for -z noexecstack option to ld])
332 _SAVE_LDFLAGS=$LDFLAGS
333 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
334 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
336 LDFLAGS=$_SAVE_LDFLAGS)
338 AC_MSG_CHECKING([for -z text option to ld])
339 _SAVE_LDFLAGS=$LDFLAGS
340 LDFLAGS="$LDFLAGS -Wl,-z,text"
341 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
343 LDFLAGS=$_SAVE_LDFLAGS)
345 AC_MSG_CHECKING([for -z relro option to ld])
346 _SAVE_LDFLAGS=$LDFLAGS
347 LDFLAGS="$LDFLAGS -Wl,-z,relro"
348 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
350 LDFLAGS=$_SAVE_LDFLAGS)
352 AC_MSG_CHECKING([for -z nocopyreloc option to ld])
353 _SAVE_LDFLAGS=$LDFLAGS
354 LDFLAGS="$LDFLAGS -Wl,-z,nocopyreloc"
355 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
357 LDFLAGS=$_SAVE_LDFLAGS)
359 AC_MSG_CHECKING([for -Bsymbolic-functions option to ld])
360 _SAVE_LDFLAGS=$LDFLAGS
361 LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
362 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
364 LDFLAGS=$_SAVE_LDFLAGS)
366 AC_MSG_CHECKING([for --build-id=sha1 option to ld])
367 _SAVE_LDFLAGS=$LDFLAGS
368 LDFLAGS="$LDFLAGS -Wl,--build-id=sha1"
369 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
371 LDFLAGS=$_SAVE_LDFLAGS)
373 AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
374 HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
375 _SAVE_LDFLAGS=$LDFLAGS
376 LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
377 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
378 [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
380 LDFLAGS=$_SAVE_LDFLAGS
382 # Check for -mssse3 on $CC
383 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
384 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
386 CFLAGS="$CFLAGS -mssse3"
387 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
388 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
392 # Check for -msse4.1 on $CC
393 AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
394 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
396 CFLAGS="$CFLAGS -msse4.1"
397 AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
398 [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
402 case "${CPU_ARCH}" in
404 AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
406 [asm volatile ("vpermq \$0xd8,%ymm0,%ymm0 \n");],
407 result="yes", result="no")
408 AC_MSG_RESULT("$result")
409 if test "$result" = "yes"; then
415 AC_MSG_CHECKING([whether we can enable AltiVec support])
418 CFLAGS="$CFLAGS -maltivec"
419 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
427 if test "$GCC_USE_GNU_LD"; then
428 # Some tools like ASan use a runtime library that is only
429 # linked against executables, so we must allow undefined
430 # symbols for shared objects in some cases.
431 if test -z "$MOZ_ASAN$MOZ_MSAN$MOZ_UBSAN$MOZ_TSAN$FUZZING_INTERFACES"; then
432 # Don't allow undefined symbols in libraries
433 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
435 # BSDs need `environ' exposed for posix_spawn (bug 753046)
437 DragonFly|FreeBSD|NetBSD|OpenBSD)
438 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
439 DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
441 DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
448 _DEFINES_CFLAGS="-include $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
450 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
453 if test "$GNU_CXX"; then
454 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
456 _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
459 # For profiling builds keep the symbol information
460 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
462 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
463 STRIP_FLAGS="--strip-debug"
468 dnl ========================================================
470 dnl ========================================================
472 if test "$MOZ_DMD"; then
473 if test "${CPU_ARCH}" = "arm"; then
474 CFLAGS="$CFLAGS -funwind-tables"
475 CXXFLAGS="$CXXFLAGS -funwind-tables"
479 dnl ========================================================
480 dnl System overrides of the defaults for host
481 dnl ========================================================
484 if test -n "$_WIN32_MSVC"; then
485 HOST_CFLAGS="$HOST_CFLAGS"
487 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
489 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
490 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
493 case "${host_cpu}" in
495 if test -n "$_WIN32_MSVC"; then
496 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
500 if test -n "$_WIN32_MSVC"; then
501 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
503 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
509 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
510 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
513 *-linux*|*-kfreebsd*-gnu|*-gnu*)
514 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
515 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
519 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
520 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
524 dnl ========================================================
525 dnl System overrides of the defaults for target
526 dnl ========================================================
530 MOZ_OPTIMIZE_FLAGS="-O3"
531 CXXFLAGS="$CXXFLAGS -stdlib=libc++"
533 STRIP_FLAGS="$STRIP_FLAGS -x -S"
534 # Ensure that if we're targeting iOS an SDK was provided.
535 AC_CACHE_CHECK(for iOS target,
537 [AC_TRY_COMPILE([#include <TargetConditionals.h>
538 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
542 ac_cv_ios_target="yes",
543 ac_cv_ios_target="no")])
544 if test "$ac_cv_ios_target" = "yes" -a -z $MOZ_IOS; then
545 AC_MSG_ERROR([targeting iOS but not using an iOS SDK?])
547 if test -z "$MOZ_IOS"; then
548 # The ExceptionHandling framework is needed for Objective-C exception
549 # logging code in nsObjCExceptions.h. Currently we only use that in debug
551 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
554 dnl DTrace and -dead_strip don't interact well. See bug 403132.
555 dnl ===================================================================
556 if test "x$enable_dtrace" = "xyes"; then
557 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
559 dnl check for the presence of the -dead_strip linker flag
560 AC_MSG_CHECKING([for -dead_strip option to ld])
561 _SAVE_LDFLAGS=$LDFLAGS
562 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
563 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
564 if test -n "$_HAVE_DEAD_STRIP" ; then
566 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
571 LDFLAGS=$_SAVE_LDFLAGS
574 MOZ_FIX_LINK_PATHS="-Wl,-executable_path,${DIST}/bin"
577 *-android*|*-linuxandroid*)
578 if test "$COMPILE_ENVIRONMENT" -a -n "$MOZ_MEMORY"; then
582 MOZ_GFX_OPTIMIZE_MOBILE=1
583 if test -z "$CLANG_CC"; then
584 MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
585 elif test -n "$RELEASE_OR_BETA"; then
586 # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
587 # -Oz is smaller than -Os on clang.
588 MOZ_OPTIMIZE_FLAGS="-Oz"
589 # Disable the outliner, which causes performance regressions, and is
590 # enabled on some platforms at -Oz.
591 if test -z "$MOZ_LTO"; then
592 DISABLE_OUTLINER="-mno-outline"
594 CFLAGS="$CFLAGS $DISABLE_OUTLINER"
595 AC_TRY_COMPILE(,,[MOZ_OPTIMIZE_FLAGS="$MOZ_OPTIMIZE_FLAGS $DISABLE_OUTLINER"])
596 CFLAGS="$_SAVE_CFLAGS"
598 DISABLE_OUTLINER="-Wl,-plugin-opt=-enable-machine-outliner=never"
599 _SAVE_LDFLAGS=$LDFLAGS
600 LDFLAGS="$LDFLAGS $MOZ_LTO_LDFLAGS $DISABLE_OUTLINER"
601 AC_TRY_LINK(,,[MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS $DISABLE_OUTLINER"])
602 LDFLAGS="$_SAVE_LDFLAGS"
605 MOZ_OPTIMIZE_FLAGS="-O2"
610 if test "$GNU_CC" -o "$GNU_CXX"; then
611 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
612 if test -n "$MOZ_DEBUG"; then
613 MOZ_OPTIMIZE_FLAGS="-Os"
615 MOZ_OPTIMIZE_FLAGS="-O2"
617 if test -z "$CLANG_CC"; then
618 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
622 case "${target_cpu}" in
624 CFLAGS="$CFLAGS -mieee"
625 CXXFLAGS="$CXXFLAGS -mieee"
632 # certain versions of cygwin's makedepend barf on the
633 # #include <string> vs -I./dist/include/string issue so don't use it
634 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
635 # $GNU_CC will match gcc and clang; while $CLANG_CC will match only clang
636 if test -z "$CLANG_CC"; then
637 AC_MSG_ERROR(Firefox cannot be built with mingw-gcc and requires a mingw-clang toolchain to work)
641 # Use temp file for windres (bug 213281)
642 RCFLAGS='-O coff --use-temp-file'
643 # mingw doesn't require kernel32, user32, and advapi32 explicitly
644 LIBS="$LIBS -luuid -lusp10 -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
647 MOZ_OPTIMIZE_FLAGS="-O2"
649 WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
650 WIN32_GUI_EXE_LDFLAGS=-mwindows
652 # Silence problematic clang warnings
653 CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
654 LDFLAGS="$LDFLAGS -Wl,--no-insert-timestamp"
656 TARGET_COMPILER_ABI=msvc
657 RANLIB='echo not_ranlib'
658 STRIP='echo not_strip'
660 # aarch64 doesn't support subsystems below 6.02
661 if test "$CPU_ARCH" = "aarch64"; then
662 WIN32_SUBSYSTEM_VERSION=6.02
664 WIN32_SUBSYSTEM_VERSION=6.01
666 WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
667 WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
668 DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
669 _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
670 _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
671 CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
672 CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
673 if test -z "$CLANG_CL"; then
674 CPPFLAGS="$CPPFLAGS -utf-8"
676 if test "$CPU_ARCH" = "x86"; then
677 dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
678 dnl more recent, so set that explicitly here unless another
679 dnl target arch has already been set.
681 if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
682 CFLAGS="$CFLAGS -arch:SSE2"
684 if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
685 CXXFLAGS="$CXXFLAGS -arch:SSE2"
688 SSE_FLAGS="-arch:SSE"
689 SSE2_FLAGS="-arch:SSE2"
690 dnl MSVC allows the use of intrinsics without any flags
691 dnl and doesn't have a separate arch for SSSE3
692 SSSE3_FLAGS="-arch:SSE2"
694 dnl clang-cl requires appropriate flags to enable SSSE3 support
695 dnl on all architectures.
696 if test -n "$CLANG_CL"; then
697 SSSE3_FLAGS="-mssse3"
699 dnl VS2013+ supports -Gw for better linker optimizations.
700 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
701 dnl Disabled on ASan because it causes false-positive ODR violations.
702 if test -z "$MOZ_ASAN"; then
704 CXXFLAGS="$CXXFLAGS -Gw"
706 # String tail merging doesn't play nice with ASan's ODR checker.
707 LDFLAGS="$LDFLAGS -opt:nolldtailmerge"
709 if test -n "$CLANG_CL"; then
710 # XXX We should combine some of these with our generic GCC-style
713 # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
714 CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
715 # We use offsetof on non-POD objects all the time.
716 # We also suppress this warning on other platforms.
717 CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
718 # This warns for reasonable things like:
719 # enum { X = 0xffffffffU };
720 # which is annoying for IDL headers.
721 CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
722 # This warns for cases that would be reached by the Microsoft
723 # #include rules, but also currently warns on cases that would
724 # *also* be reached by standard C++ include rules. That
725 # behavior doesn't seem useful, so we turn it off.
726 CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
727 # We normally error out on unknown pragmas, but since clang-cl
728 # claims to be MSVC, it would be difficult to add
729 # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
730 # use such pragmas, so just ignore them.
731 CFLAGS="$CFLAGS -Wno-unknown-pragmas"
732 CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
733 # We get errors about various #pragma intrinsic directives from
734 # clang-cl, and we don't need to hear about those.
735 CFLAGS="$CFLAGS -Wno-ignored-pragmas"
736 CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
737 # clang-cl's Intrin.h marks things like _ReadWriteBarrier
738 # as __attribute((__deprecated__)). This is nice to know,
739 # but since we don't get the equivalent warning from MSVC,
740 # let's just ignore it.
741 CFLAGS="$CFLAGS -Wno-deprecated-declarations"
742 CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
743 # We use a function like:
744 # __declspec(noreturn) __inline void f() {}
745 # which -Winvalid-noreturn complains about. Again, MSVC seems
746 # OK with it, so let's silence the warning.
747 CFLAGS="$CFLAGS -Wno-invalid-noreturn"
748 CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
749 # Missing |override| on virtual function declarations isn't
750 # something that MSVC currently warns about.
751 CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
752 # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
753 # declaration on |operator delete(void*)|. However, clang-cl
754 # must internally declare |operator delete(void*)| differently,
755 # which causes this warning for virtually every file in the
756 # tree. clang-cl doesn't support -fno-exceptions or equivalent,
757 # so there doesn't seem to be any way to convince clang-cl to
758 # declare |delete| differently. Therefore, suppress this
760 CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
761 # Macros like STDMETHOD() and IFACEMETHOD() can declare
762 # __attribute__((nothrow)) on their respective method declarations,
763 # while the definitions are left without the matching attribute.
764 CXXFLAGS="$CXXFLAGS -Wno-microsoft-exception-spec"
765 # At least one MSVC header and several headers in-tree have
766 # unused typedefs, so turn this on.
767 CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
768 # jemalloc uses __declspec(allocator) as a profiler hint,
769 # which clang-cl doesn't understand.
770 CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
771 # __attribute__((unused)) really means "might be unused" and
772 # we use it to avoid warnings about things that are unused
773 # in some compilation units, but used in many others. This
774 # warning insists on complaining about the latter case, which
775 # is annoying, and rather noisy.
776 CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused"
778 # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
779 CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
780 LIBS="$LIBS user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
781 MOZ_DEBUG_LDFLAGS='-DEBUG'
782 # Use a higher optimization level for clang-cl, so we can come closer
783 # to MSVC's performance numbers (see bug 1443590).
784 if test -n "$CLANG_CL"; then
785 MOZ_OPTIMIZE_FLAGS='-O2'
787 MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
790 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE"
791 if test -z "$DEVELOPER_OPTIONS"; then
792 LDFLAGS="$LDFLAGS -RELEASE"
795 dnl Minimum reqiurement of Gecko is VS2015 or later which supports
796 dnl both SSSE3 and SSE4.1.
797 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
798 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
799 dnl allow AVX2 code from VS2015
802 AC_DEFINE(WIN32_LEAN_AND_MEAN)
803 dnl See http://support.microsoft.com/kb/143208 to use STL
806 MOZ_USER_DIR="Mozilla"
810 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.])
816 if test -n "$GNU_CC"; then
817 CFLAGS="$CFLAGS -mstackrealign"
818 CXXFLAGS="$CXXFLAGS -mstackrealign"
819 LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
821 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
822 LDFLAGS="$LDFLAGS -SAFESEH"
828 if test -n "$_WIN32_MSVC"; then
829 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
834 if test -n "$_WIN32_MSVC"; then
835 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:ARM64"
840 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
847 CFLAGS="$CFLAGS -Dunix"
848 CXXFLAGS="$CXXFLAGS -Dunix"
849 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
850 DSO_PIC_CFLAGS='-fPIC -DPIC'
852 MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
854 DSO_PIC_CFLAGS='-fPIC -DPIC'
857 # This will fail on a.out systems prior to 1.5.1_ALPHA.
858 if test "$LIBRUNPATH"; then
859 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
864 if test -z "$X11BASE"; then
867 MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
869 DSO_PIC_CFLAGS='-fPIC'
870 DSO_LDOPTS='-shared -fPIC'
871 if test "$LIBRUNPATH"; then
872 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
877 MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
882 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
883 MOZ_OPTIMIZE_FLAGS="-O"
886 AC_SUBST_LIST(MMX_FLAGS)
887 AC_SUBST_LIST(SSE_FLAGS)
888 AC_SUBST_LIST(SSE2_FLAGS)
889 AC_SUBST_LIST(SSSE3_FLAGS)
892 if test -n "$MOZ_LINKER"; then
893 AC_DEFINE(MOZ_LINKER)
895 AC_CHECK_PROGS(XZ, xz)
898 if test -z "$COMPILE_ENVIRONMENT"; then
899 SKIP_COMPILER_CHECKS=1
900 SKIP_LIBRARY_CHECKS=1
905 fi # COMPILE_ENVIRONMENT
907 if test -z "$SKIP_COMPILER_CHECKS"; then
908 dnl Checks for typedefs, structures, and compiler characteristics.
909 dnl ========================================================
924 case "${OS_TARGET}" in
928 STL_FLAGS="-I${DIST}/stl_wrappers"
933 if test "$MOZ_BUILD_APP" = "tools/crashreporter"; then
937 dnl Checks for header files.
938 dnl ========================================================
941 bitrig*|dragonfly*|freebsd*|openbsd*)
942 # for stuff like -lXshm
943 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
947 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
948 AC_CACHE_CHECK(for sockaddr_in.sin_len,
949 ac_cv_sockaddr_in_sin_len,
950 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
951 #include <sys/types.h>
953 #include <netinet/in.h>
954 struct sockaddr_in x;
955 void *foo = (void*) &x.sin_len;],
957 [ac_cv_sockaddr_in_sin_len=true],
958 [ac_cv_sockaddr_in_sin_len=false])])
959 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
960 AC_DEFINE(HAVE_SIN_LEN)
961 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
962 AC_DEFINE(HAVE_SCONN_LEN)
965 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
966 ac_cv_sockaddr_in6_sin6_len,
967 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
968 #include <sys/types.h>
970 #include <netinet/in.h>
971 struct sockaddr_in6 x;
972 void *foo = (void*) &x.sin6_len;],
974 [ac_cv_sockaddr_in6_sin6_len=true],
975 [ac_cv_sockaddr_in6_sin6_len=false])])
976 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
977 AC_DEFINE(HAVE_SIN6_LEN)
980 AC_CACHE_CHECK(for sockaddr.sa_len,
981 ac_cv_sockaddr_sa_len,
982 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
983 #include <sys/types.h>
985 #include <sys/socket.h>
987 void *foo = (void*) &x.sa_len;],
989 [ac_cv_sockaddr_sa_len=true],
990 [ac_cv_sockaddr_sa_len=false])])
991 if test "$ac_cv_sockaddr_sa_len" = true ; then
992 AC_DEFINE(HAVE_SA_LEN)
995 MOZ_ARG_ENABLE_BOOL(dtrace,
996 [ --enable-dtrace build with dtrace support if available (default=no)],
997 [enable_dtrace="yes"],)
998 if test "x$enable_dtrace" = "xyes"; then
999 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
1000 if test -n "$HAVE_DTRACE"; then
1001 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
1003 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
1006 AC_SUBST(HAVE_DTRACE)
1008 dnl Checks for libraries.
1009 dnl ========================================================
1010 AC_CHECK_LIB(c_r, gethostbyname_r)
1012 dnl We don't want to link with libdl even if it's present on OS X, since
1013 dnl it's not used and not part of the default installation. OS/2 has dlfcn
1015 dnl We don't want to link against libm or libpthread on Darwin since
1016 dnl they both are just symlinks to libSystem and explicitly linking
1017 dnl against libSystem causes issues when debugging (see bug 299601).
1022 AC_SEARCH_LIBS(dlopen, dl,
1023 MOZ_CHECK_HEADER(dlfcn.h,
1024 AC_DEFINE(HAVE_DLOPEN)))
1028 _SAVE_CFLAGS="$CFLAGS"
1029 CFLAGS="$CFLAGS -D_GNU_SOURCE"
1030 AC_CHECK_FUNCS(dladdr memmem)
1031 CFLAGS="$_SAVE_CFLAGS"
1033 if test ! "$GNU_CXX"; then
1034 AC_CHECK_LIB(C, demangle)
1037 AC_CHECK_LIB(socket, socket)
1040 XLIBS="$X_EXTRA_LIBS"
1042 dnl ========================================================
1043 dnl Checks for X libraries.
1044 dnl Ordering is important.
1045 dnl Xt is dependent upon SM as of X11R6
1046 dnl ========================================================
1047 if test -n "$MOZ_X11"; then
1048 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
1049 _SAVE_LDFLAGS="$LDFLAGS"
1051 LDFLAGS="$XLDFLAGS $LDFLAGS"
1052 AC_CHECK_LIB(X11, XDrawLines, [XLIBS="-lX11 $XLIBS"],
1053 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
1054 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
1055 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
1057 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
1058 unset ac_cv_lib_Xt_XtFree
1059 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
1060 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
1061 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
1062 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
1065 dnl ========================================================
1067 dnl ========================================================
1068 AC_CHECK_LIB(xcb, xcb_connect, [XLIBS="-lxcb $XLIBS"],
1069 [MISSING_X="$MISSING_X -lxcb"], $XLIBS)
1070 AC_CHECK_LIB(xcb-shm, xcb_shm_query_version, [XLIBS="-lxcb-shm $XLIBS"],
1071 [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS)
1072 AC_CHECK_LIB(X11-xcb, XGetXCBConnection, [XLIBS="-lX11-xcb $XLIBS"],
1073 [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS)
1075 LDFLAGS="$_SAVE_LDFLAGS"
1079 AC_SUBST_LIST(XCFLAGS)
1080 AC_SUBST_LIST(XLDFLAGS)
1081 AC_SUBST_LIST(XLIBS)
1082 AC_SUBST_LIST(XEXT_LIBS)
1083 AC_SUBST_LIST(XT_LIBS)
1085 dnl ========================================================
1086 dnl = pthread support
1087 dnl = Start by checking whether the system support pthreads
1088 dnl ========================================================
1089 case "$target_os" in
1094 AC_CHECK_LIB(pthreads, pthread_create,
1095 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
1096 AC_CHECK_LIB(pthread, pthread_create,
1097 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
1098 AC_CHECK_LIB(c_r, pthread_create,
1099 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
1100 AC_CHECK_LIB(c, pthread_create,
1109 dnl ========================================================
1110 dnl Do the platform specific pthread hackery
1111 dnl ========================================================
1112 if test "$MOZ_USE_PTHREADS"x != x
1115 dnl See if -pthread is supported.
1118 ac_cv_have_dash_pthread=no
1119 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
1120 echo 'int main() { return 0; }' | cat > conftest.c
1121 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
1122 if test $? -eq 0; then
1123 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1124 ac_cv_have_dash_pthread=yes
1125 case "$target_os" in
1127 # Freebsd doesn't use -pthread for compiles, it uses them for linking
1130 CFLAGS="$CFLAGS -pthread"
1131 CXXFLAGS="$CXXFLAGS -pthread"
1137 AC_MSG_RESULT($ac_cv_have_dash_pthread)
1140 dnl See if -pthreads is supported.
1142 ac_cv_have_dash_pthreads=no
1143 if test "$ac_cv_have_dash_pthread" = "no"; then
1144 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
1145 echo 'int main() { return 0; }' | cat > conftest.c
1146 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
1147 if test $? -eq 0; then
1148 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1149 ac_cv_have_dash_pthreads=yes
1150 CFLAGS="$CFLAGS -pthreads"
1151 CXXFLAGS="$CXXFLAGS -pthreads"
1155 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
1160 AC_DEFINE(_REENTRANT)
1161 AC_DEFINE(_THREAD_SAFE)
1162 dnl -pthread links in -lpthread, so don't specify it explicitly.
1163 if test "$ac_cv_have_dash_pthread" = "yes"; then
1164 _PTHREAD_LDFLAGS="-pthread"
1168 *-*-openbsd*|*-*-bsdi*)
1169 AC_DEFINE(_REENTRANT)
1170 AC_DEFINE(_THREAD_SAFE)
1171 dnl -pthread links in -lc_r, so don't specify it explicitly.
1172 if test "$ac_cv_have_dash_pthread" = "yes"; then
1173 _PTHREAD_LDFLAGS="-pthread"
1177 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
1178 AC_DEFINE(_REENTRANT)
1182 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
1183 AC_SUBST(MOZ_USE_PTHREADS)
1184 MOZ_CHECK_HEADERS(pthread.h)
1188 dnl Checks for library functions.
1189 dnl ========================================================
1190 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall)
1192 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1193 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1194 ac_cv_clock_monotonic,
1195 [for libs in "" -lrt; do
1197 _SAVE_CFLAGS="$CFLAGS"
1199 CFLAGS="$CFLAGS $DSO_PIC_CFLAGS"
1200 dnl clock_gettime is available on OSX since 10.12, so depending on MACOSX_DEPLOYMENT_TARGET,
1201 dnl we should or not be able to use it. To detect if we can, we need to make the
1202 dnl availability attribute strict, so that compilation fails when the target is < 10.12.
1203 AC_TRY_LINK([#define availability(os, ...) availability(os, strict, __VA_ARGS)
1205 [ struct timespec ts;
1206 clock_gettime(CLOCK_MONOTONIC, &ts); ],
1207 ac_cv_clock_monotonic=$libs
1209 CFLAGS="$_SAVE_CFLAGS"
1211 ac_cv_clock_monotonic=no)
1213 CFLAGS="$_SAVE_CFLAGS"
1215 if test "$ac_cv_clock_monotonic" != "no"; then
1216 HAVE_CLOCK_MONOTONIC=1
1217 REALTIME_LIBS=$ac_cv_clock_monotonic
1218 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1219 AC_SUBST(HAVE_CLOCK_MONOTONIC)
1220 AC_SUBST_LIST(REALTIME_LIBS)
1223 dnl Turn on warnings-as-errors to prevent implicit declaration of
1224 dnl pthread_cond_timedwait_monotonic_np, which can cause this test to
1225 dnl inadvertently pass even if the function does not really exist.
1226 _SAVE_CFLAGS="$CFLAGS"
1227 CFLAGS="$CFLAGS $WARNINGS_AS_ERRORS"
1228 AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
1229 ac_cv_pthread_cond_timedwait_monotonic_np,
1230 AC_TRY_LINK([#include <pthread.h>],
1231 [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
1232 ac_cv_pthread_cond_timewait_monotonic_np=yes,
1233 ac_cv_pthread_cond_timewait_monotonic_np=no))
1234 if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
1235 AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
1237 CFLAGS=$_SAVE_CFLAGS
1241 ac_cv_func_res_ninit,
1242 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
1243 dnl no need for res_ninit() on NetBSD and OpenBSD
1244 ac_cv_func_res_ninit=no
1248 #define _BSD_SOURCE 1
1250 #include <sys/types.h>
1251 #include <netinet/in.h>
1252 #include <arpa/nameser.h>
1255 [int foo = res_ninit(&_res);],
1256 [ac_cv_func_res_ninit=yes],
1257 [ac_cv_func_res_ninit=no])
1261 if test "$ac_cv_func_res_ninit" = "yes"; then
1262 AC_DEFINE(HAVE_RES_NINIT)
1263 dnl must add the link line we do something as foolish as this... dougt
1265 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
1266 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
1271 dnl **********************
1272 dnl *** va_copy checks ***
1273 AC_CACHE_CHECK([for an implementation of va_copy()],
1275 [AC_TRY_COMPILE([#include <stdarg.h>
1277 void f (int i, ...) {
1278 va_list args1, args2;
1279 va_start (args1, i);
1280 va_copy (args2, args1);
1281 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1283 va_end (args1); va_end (args2);
1285 [f(0, 42); return 0],
1286 [ac_cv_va_copy=yes],
1290 AC_CACHE_CHECK([whether va_list can be copied by value],
1292 [AC_TRY_COMPILE([#include <stdarg.h>
1294 void f (int i, ...) {
1295 va_list args1, args2;
1296 va_start (args1, i);
1298 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1300 va_end (args1); va_end (args2);
1302 [f(0, 42); return 0],
1303 [ac_cv_va_val_copy=yes],
1304 [ac_cv_va_val_copy=no],
1307 if test "x$ac_cv_va_copy" = "xyes"; then
1308 AC_DEFINE(VA_COPY, va_copy)
1309 AC_DEFINE(HAVE_VA_COPY)
1312 if test "x$ac_cv_va_val_copy" = "xno"; then
1313 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
1316 dnl ===================================================================
1317 dnl ========================================================
1318 dnl Put your C++ language/feature checks below
1319 dnl ========================================================
1323 if test "$GNU_CC"; then
1324 if test "$CPU_ARCH" = "arm" ; then
1325 AC_CACHE_CHECK(for ARM EABI,
1329 #if defined(__ARM_EABI__)
1332 #error Not ARM EABI.
1335 ac_cv_gcc_arm_eabi="yes",
1336 ac_cv_gcc_arm_eabi="no")])
1337 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
1339 ARM_ABI_PREFIX=eabi-
1341 ARM_ABI_PREFIX=oabi-
1345 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
1348 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
1349 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
1350 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
1352 _SAVE_LDFLAGS=$LDFLAGS
1353 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
1354 AC_CACHE_CHECK(for __thread keyword for TLS variables,
1355 ac_cv_thread_keyword,
1356 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
1357 [return tlsIsMainThread;],
1358 ac_cv_thread_keyword=yes,
1359 ac_cv_thread_keyword=no)])
1360 LDFLAGS=$_SAVE_LDFLAGS
1361 # The custom dynamic linker doesn't support TLS variables
1363 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
1364 # mips builds fail with TLS variables because of a binutils bug.
1366 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
1371 *-android*|*-linuxandroid*)
1378 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
1384 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
1385 if test -n "$MOZ_LINKER"; then
1386 if test "$CPU_ARCH" = arm; then
1387 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
1388 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
1389 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1390 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1394 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
1395 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
1396 dnl Since the linker only understands the sysv ones, no need to build the
1397 dnl gnu style tables anyways.
1398 LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
1401 dnl End of C++ language/feature checks
1404 dnl ========================================================
1405 dnl = Internationalization checks
1406 dnl ========================================================
1408 dnl Internationalization and Locale support is different
1409 dnl on various UNIX platforms. Checks for specific i18n
1410 dnl features go here.
1412 AC_HAVE_FUNCS(localeconv)
1414 fi # ! SKIP_COMPILER_CHECKS
1416 if test -n "${COMPILE_ENVIRONMENT}"; then
1421 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1422 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1423 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1426 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1427 dnl features that Windows actually does support.
1429 if test -n "$SKIP_COMPILER_CHECKS"; then
1430 dnl Windows has malloc.h
1431 AC_DEFINE(MALLOC_H, [<malloc.h>])
1432 AC_DEFINE(HAVE_FORCEINLINE)
1433 AC_DEFINE(HAVE_LOCALECONV)
1434 fi # SKIP_COMPILER_CHECKS
1436 dnl Mozilla specific options
1437 dnl ========================================================
1438 dnl The macros used for command line options
1439 dnl are defined in build/autoconf/altoptions.m4.
1441 dnl ========================================================
1443 dnl = Check for external package dependencies
1445 dnl ========================================================
1446 MOZ_ARG_HEADER(External Packages)
1448 case "$OS_TARGET" in
1449 WINNT|Darwin|Android)
1459 dnl ========================================================
1460 dnl system libevent Support
1461 dnl ========================================================
1462 MOZ_ARG_WITH_STRING(system-libevent,
1463 [ --with-system-libevent[=PFX]
1464 Use system libevent [installed at prefix PFX]],
1465 LIBEVENT_DIR=$withval)
1467 _SAVE_CFLAGS=$CFLAGS
1468 _SAVE_LDFLAGS=$LDFLAGS
1470 if test "$LIBEVENT_DIR" = yes; then
1471 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
1472 MOZ_SYSTEM_LIBEVENT=1,
1475 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
1476 MOZ_SYSTEM_LIBEVENT=
1477 elif test -z "$MOZ_SYSTEM_LIBEVENT"; then
1478 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
1479 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
1480 MOZ_CHECK_HEADER(event.h,
1481 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
1482 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
1484 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
1485 AC_CHECK_LIB(event, event_init,
1486 [MOZ_SYSTEM_LIBEVENT=1
1487 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
1488 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
1489 [MOZ_SYSTEM_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
1491 CFLAGS=$_SAVE_CFLAGS
1492 LDFLAGS=$_SAVE_LDFLAGS
1495 AC_SUBST(MOZ_SYSTEM_LIBEVENT)
1497 dnl ========================================================
1498 dnl = If NSS was not detected in the system,
1499 dnl = use the one in the source tree (mozilla/security/nss)
1500 dnl ========================================================
1502 MOZ_ARG_WITH_BOOL(system-nss,
1503 [ --with-system-nss Use system installed NSS],
1506 if test -n "$_USE_SYSTEM_NSS"; then
1507 AM_PATH_NSS(3.52, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
1510 NSS_CFLAGS="$NSS_CFLAGS -I${DIST}/include/nss"
1511 if test -z "$MOZ_SYSTEM_NSS"; then
1512 case "${OS_ARCH}" in
1513 # Only few platforms have been tested with GYP
1514 WINNT|Darwin|Linux|DragonFly|FreeBSD|NetBSD|OpenBSD|SunOS)
1517 AC_MSG_ERROR([building in-tree NSS is not supported on this platform. Use --with-system-nss])
1522 dnl system ZLIB support
1523 dnl ========================================================
1524 MOZ_ZLIB_CHECK([1.2.3])
1526 if test -z "$SKIP_LIBRARY_CHECKS"; then
1528 dnl ========================================================
1529 dnl system PNG Support
1530 dnl ========================================================
1531 MOZ_ARG_WITH_STRING(system-png,
1532 [ --with-system-png[=PFX]
1533 Use system libpng [installed at prefix PFX]],
1536 _SAVE_CFLAGS=$CFLAGS
1537 _SAVE_LDFLAGS=$LDFLAGS
1539 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
1540 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
1541 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
1543 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
1546 AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"],
1547 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1548 AC_CHECK_LIB(png, png_get_acTL, ,
1549 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
1551 if test "$MOZ_SYSTEM_PNG" = 1; then
1552 AC_TRY_COMPILE([ #include <stdio.h>
1553 #include <sys/types.h>
1555 [ #if PNG_LIBPNG_VER < $MOZPNG
1556 #error "Insufficient libpng version ($MOZPNG required)."
1558 #ifndef PNG_UINT_31_MAX
1559 #error "Insufficient libpng version."
1562 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1564 CFLAGS=$_SAVE_CFLAGS
1565 LDFLAGS=$_SAVE_LDFLAGS
1568 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then
1569 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
1570 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
1573 fi # SKIP_LIBRARY_CHECKS
1575 dnl ========================================================
1579 dnl ========================================================
1581 MOZ_ARG_HEADER(Application)
1583 ENABLE_SYSTEM_EXTENSION_DIRS=1
1584 MOZ_BRANDING_DIRECTORY=
1585 MOZ_OFFICIAL_BRANDING=
1586 MOZ_AUTH_EXTENSION=1
1587 if test "$MOZ_IOS"; then
1590 MOZ_PREF_EXTENSIONS=1
1592 MOZ_UNIVERSALCHARDET=1
1596 MOZ_USE_NATIVE_POPUP_WINDOWS=
1597 MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
1599 MOZ_BINARY_EXTENSIONS=
1602 case "$target_os" in
1605 AC_DEFINE(NS_ENABLE_TSF)
1609 # Optional Firefox for Android partner distribution directory.
1610 MOZ_ARG_WITH_STRING(android-distribution-directory,
1611 [ --with-android-distribution-directory=dir
1612 Optional Firefox for Android partner distribution directory.],
1613 MOZ_ANDROID_DISTRIBUTION_DIRECTORY=$withval)
1615 if test -n "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY"; then
1616 # A distribution directory must have an assets/distribution directory.
1617 # See https://wiki.mozilla.org/Mobile/Distribution_Files.
1618 if test ! -d "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY/assets/distribution" ; then
1619 AC_MSG_ERROR([--with-android-distribution-directory does not contain assets/distribution;
1620 (looked for ${MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets/distribution).])
1623 AC_SUBST(MOZ_ANDROID_DISTRIBUTION_DIRECTORY)
1625 dnl ========================================================
1626 dnl = Trademarked Branding
1627 dnl ========================================================
1628 MOZ_ARG_ENABLE_BOOL(official-branding,
1629 [ --enable-official-branding
1630 Enable Official mozilla.org Branding
1631 Do not distribute builds with
1632 --enable-official-branding unless you have
1633 permission to use trademarks per
1634 http://www.mozilla.org/foundation/trademarks/ .],
1635 MOZ_OFFICIAL_BRANDING=1,
1636 MOZ_OFFICIAL_BRANDING=)
1638 # Allow the application to influence configure with a confvars.sh script.
1639 AC_MSG_CHECKING([if app-specific confvars.sh exists])
1640 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
1641 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
1642 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
1647 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
1648 MOZ_ARG_WITH_STRING(app-name,
1649 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
1650 WITH_APP_NAME=$withval,
1653 if test -n "$WITH_APP_NAME" ; then
1654 MOZ_APP_NAME="$WITH_APP_NAME"
1657 MOZ_ARG_WITH_STRING(app-basename,
1658 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
1659 WITH_APP_BASENAME=$withval,
1662 if test -n "$WITH_APP_BASENAME" ; then
1663 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
1666 dnl ========================================================
1667 dnl Ensure Android SDK and build-tools versions depending on
1669 dnl ========================================================
1671 case "$MOZ_BUILD_APP" in
1677 dnl ========================================================
1679 dnl = Toolkit Options
1681 dnl ========================================================
1682 MOZ_ARG_HEADER(Toolkit Options)
1684 dnl ========================================================
1685 dnl = Enable the toolkit as needed =
1686 dnl ========================================================
1688 case "$MOZ_WIDGET_TOOLKIT" in
1691 LDFLAGS="$LDFLAGS -framework Cocoa"
1692 # Use -Wl as a trick to avoid -framework and framework names from
1693 # being separated by AC_SUBST_LIST.
1694 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'
1696 CFLAGS="$CFLAGS $TK_CFLAGS"
1697 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1698 MOZ_USER_DIR="Mozilla"
1699 MOZ_FS_LAYOUT=bundle
1703 LDFLAGS="$LDFLAGS -framework UIKit"
1705 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'
1706 CFLAGS="$CFLAGS $TK_CFLAGS"
1707 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1708 MOZ_USER_DIR="Mozilla"
1709 MOZ_FS_LAYOUT=bundle
1714 if test "$OS_TARGET" = Darwin; then
1715 LDFLAGS="$LDFLAGS -lobjc"
1718 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
1719 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
1720 case "$MOZ_WIDGET_TOOLKIT" in
1726 if test "$COMPILE_ENVIRONMENT"; then
1727 if test "$MOZ_WIDGET_TOOLKIT" = gtk; then
1728 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)
1729 MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
1730 TK_CFLAGS=$MOZ_GTK3_CFLAGS
1731 TK_LIBS=$MOZ_GTK3_LIBS
1732 dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
1733 dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
1734 AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
1735 GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32
1737 if test "$MOZ_ENABLE_GTK"; then
1738 if test "$MOZ_X11"; then
1739 GDK_PACKAGES=gdk-x11-2.0
1741 AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
1742 AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
1744 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)
1745 MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
1747 fi # COMPILE_ENVIRONMENT
1749 AC_SUBST(MOZ_FS_LAYOUT)
1751 AC_SUBST_LIST(TK_CFLAGS)
1752 AC_SUBST_LIST(TK_LIBS)
1754 dnl ========================================================
1756 dnl = Components & Features
1758 dnl ========================================================
1759 MOZ_ARG_HEADER(Components and Features)
1761 AC_SUBST(MOZ_OFFICIAL_BRANDING)
1762 if test -n "$MOZ_OFFICIAL_BRANDING"; then
1763 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
1764 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
1766 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
1767 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
1771 MOZ_ARG_WITH_STRING(branding,
1772 [ --with-branding=dir Use branding from the specified directory.],
1773 MOZ_BRANDING_DIRECTORY=$withval)
1775 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
1776 if test -z "$REAL_BRANDING_DIRECTORY"; then
1777 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
1780 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1781 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
1782 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1783 . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
1786 AC_SUBST(MOZ_BRANDING_DIRECTORY)
1788 dnl ========================================================
1789 dnl = Distribution ID
1790 dnl ========================================================
1791 MOZ_ARG_WITH_STRING(distribution-id,
1792 [ --with-distribution-id=ID
1793 Set distribution-specific id (default=org.mozilla)],
1794 [ val=`echo $withval`
1795 MOZ_DISTRIBUTION_ID="$val"])
1797 if test -z "$MOZ_DISTRIBUTION_ID"; then
1798 MOZ_DISTRIBUTION_ID="org.mozilla"
1801 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
1802 AC_SUBST(MOZ_DISTRIBUTION_ID)
1804 dnl ========================================================
1805 dnl = libproxy support
1806 dnl ========================================================
1808 if test "$MOZ_ENABLE_GTK"
1810 MOZ_ENABLE_LIBPROXY=
1812 MOZ_ARG_ENABLE_BOOL(libproxy,
1813 [ --enable-libproxy Enable libproxy support ],
1814 MOZ_ENABLE_LIBPROXY=1,
1815 MOZ_ENABLE_LIBPROXY=)
1817 if test "$MOZ_ENABLE_LIBPROXY"
1819 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
1820 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
1823 AC_SUBST(MOZ_ENABLE_LIBPROXY)
1825 dnl ========================================================
1827 dnl ========================================================
1829 if test "$MOZ_ENABLE_GTK"
1833 MOZ_ARG_DISABLE_BOOL(dbus,
1834 [ --disable-dbus Disable dbus support ],
1838 if test "$MOZ_ENABLE_DBUS"
1840 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
1841 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
1842 AC_DEFINE(MOZ_ENABLE_DBUS)
1845 AC_SUBST(MOZ_ENABLE_DBUS)
1847 dnl =========================================================
1848 dnl = Whether to exclude hyphenations files in the build
1849 dnl =========================================================
1850 if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
1851 AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
1854 AC_TRY_COMPILE([#include <linux/ethtool.h>],
1855 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
1856 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
1858 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
1860 if test -n "$MOZ_WEBRTC"; then
1861 if test -n "$MOZ_X11"; then
1862 MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
1866 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
1868 dnl ========================================================
1869 dnl = Apple platform decoder support
1870 dnl ========================================================
1871 if test "$COMPILE_ENVIRONMENT"; then
1872 if test -n "$MOZ_APPLEMEDIA"; then
1873 # hack in frameworks for fmp4 - see bug 1029974
1874 # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
1875 LDFLAGS="$LDFLAGS -framework AudioToolbox"
1876 dnl Verify CoreMedia is available.
1877 AC_CHECK_HEADERS([CoreMedia/CoreMedia.h VideoToolbox/VideoToolbox.h], [],
1878 [AC_MSG_ERROR([MacOS X 10.9 SDK or later is required])])
1880 fi # COMPILE_ENVIRONMENT
1882 dnl ========================================================
1883 dnl = Handle dependent MEDIA defines
1884 dnl ========================================================
1887 AC_DEFINE(MOZ_WEBM_ENCODER)
1888 AC_SUBST(MOZ_WEBM_ENCODER)
1890 dnl ========================================================
1892 dnl ========================================================
1894 MOZ_ARG_DISABLE_BOOL(negotiateauth,
1895 [ --disable-negotiateauth Disable GSS-API negotiation ],
1896 MOZ_AUTH_EXTENSION=,
1897 MOZ_AUTH_EXTENSION=1 )
1899 if test -n "$MOZ_IOS" -a -n "$MOZ_AUTH_EXTENSION"; then
1900 AC_MSG_ERROR([negotiateauth is not supported on iOS.])
1903 dnl ========================================================
1904 dnl Pref extensions (autoconfig)
1905 dnl ========================================================
1906 MOZ_ARG_DISABLE_BOOL(pref-extensions,
1907 [ --disable-pref-extensions
1908 Disable pref extensions such as autoconfig],
1909 MOZ_PREF_EXTENSIONS=,
1910 MOZ_PREF_EXTENSIONS=1 )
1912 dnl ========================================================
1913 dnl Searching of system directories for extensions.
1914 dnl Note: this switch is meant to be used for test builds
1915 dnl whose behavior should not depend on what happens to be
1916 dnl installed on the local machine.
1917 dnl ========================================================
1918 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
1919 [ --disable-system-extension-dirs
1920 Disable searching system- and account-global
1921 directories for extensions of any kind; use
1922 only profile-specific extension directories],
1923 ENABLE_SYSTEM_EXTENSION_DIRS=,
1924 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
1925 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
1926 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
1929 dnl ========================================================
1930 dnl = Universalchardet
1931 dnl ========================================================
1932 MOZ_ARG_DISABLE_BOOL(universalchardet,
1933 [ --disable-universalchardet
1934 Disable universal encoding detection],
1935 MOZ_UNIVERSALCHARDET=,
1936 MOZ_UNIVERSALCHARDET=1 )
1938 dnl ========================================================
1940 dnl ========================================================
1942 if test "$COMPILE_ENVIRONMENT" ; then
1944 dnl Moved gamepad platform check to moz.build, linux header check still needed here.
1945 if test "$OS_TARGET" = "Linux"; then
1946 MOZ_CHECK_HEADER([linux/joystick.h])
1947 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
1948 AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
1952 fi # COMPILE_ENVIRONMENT
1955 dnl ========================================================
1956 dnl = Breakpad crash reporting (on by default on supported platforms)
1957 dnl ========================================================
1960 i?86-*-mingw*|x86_64-*-mingw*|aarch64-*-mingw*)
1963 i?86-apple-darwin*|x86_64-apple-darwin*)
1964 if test -z "$MOZ_IOS"; then
1968 *-android*|*-linuxandroid*)
1969 dnl Android/arm is arm-unknown-linux-androideabi, so android condition should
1970 dnl be before Linux condition
1973 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
1974 if test "$MOZ_ENABLE_GTK"; then
1980 MOZ_ARG_DISABLE_BOOL(crashreporter,
1981 [ --disable-crashreporter Disable breakpad crash reporting],
1982 [MOZ_CRASHREPORTER=],
1983 [MOZ_CRASHREPORTER=F # Force enable breakpad])
1985 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin" -a "$MOZ_WIDGET_TOOLKIT" != "android"; then
1986 if test "$MOZ_CRASHREPORTER" = F; then
1987 AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
1992 if test -n "$MOZ_CRASHREPORTER"; then
1993 AC_DEFINE(MOZ_CRASHREPORTER)
1995 if test "$OS_TARGET" = "Linux" && \
1996 test -z "$SKIP_LIBRARY_CHECKS"; then
1997 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
2000 if test "$OS_ARCH" = "WINNT"; then
2001 if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
2002 MOZ_CRASHREPORTER_INJECTOR=1
2003 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
2008 dnl ========================================================
2009 dnl = Enable compilation of specific extension modules
2010 dnl ========================================================
2012 MOZ_ARG_ENABLE_STRING(extensions,
2013 [ --enable-extensions Enable extensions],
2014 [ for option in `echo $enableval | sed 's/,/ /g'`; do
2015 if test "$option" = "yes" -o "$option" = "all"; then
2016 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
2017 elif test "$option" = "no" -o "$option" = "none"; then
2019 elif test "$option" = "default"; then
2020 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
2021 elif test `echo "$option" | grep -c \^-` != 0; then
2022 option=`echo $option | sed 's/^-//'`
2023 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
2025 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
2028 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
2030 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
2031 dnl when trying to build a nonexistent extension.
2032 for extension in $MOZ_EXTENSIONS; do
2033 if test ! -d "${srcdir}/extensions/${extension}"; then
2034 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
2038 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
2039 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
2042 # Avoid defining MOZ_ENABLE_CAIRO_FT on Windows platforms because
2043 # "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
2044 if test -n "$MOZ_TREE_FREETYPE" -a "$OS_TARGET" != WINNT; then
2045 MOZ_ENABLE_CAIRO_FT=1
2046 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2047 CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
2048 AC_SUBST_LIST(CAIRO_FT_CFLAGS)
2051 AC_CHECK_PROGS(WGET, wget, "")
2054 dnl ========================================================
2056 dnl ========================================================
2058 if test "$MOZ_IOS"; then
2062 MOZ_ARG_DISABLE_BOOL(updater,
2063 [ --disable-updater Disable building of updater],
2067 if test -n "$MOZ_UPDATER"; then
2068 AC_DEFINE(MOZ_UPDATER)
2071 dnl ========================================================
2072 dnl parental controls (for Windows Vista)
2073 dnl ========================================================
2074 MOZ_ARG_DISABLE_BOOL(parental-controls,
2075 [ --disable-parental-controls
2076 Do not build parental controls],
2077 MOZ_DISABLE_PARENTAL_CONTROLS=1,
2078 MOZ_DISABLE_PARENTAL_CONTROLS=)
2079 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
2080 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
2083 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
2085 dnl ========================================================
2086 dnl = Disable smartcard support
2087 dnl ========================================================
2088 if test -n "$MOZ_NO_SMART_CARDS"; then
2089 AC_DEFINE(MOZ_NO_SMART_CARDS)
2091 AC_SUBST(MOZ_NO_SMART_CARDS)
2093 dnl ========================================================
2094 dnl = Sandboxing support
2095 dnl ========================================================
2096 if test -n "$MOZ_TSAN" -o -n "$MOZ_ASAN"; then
2097 # Bug 1182565: TSan conflicts with sandboxing on Linux.
2098 # Bug 1287971: LSan also conflicts with sandboxing on Linux.
2106 MOZ_ARG_DISABLE_BOOL(sandbox,
2107 [ --disable-sandbox Disable sandboxing support],
2111 case "$OS_TARGET" in
2112 WINNT|Darwin|OpenBSD)
2118 # Linux sandbox is only available on x86 and x86_64.
2125 # Only enable the sandbox by default on Linux, OpenBSD, macOS, and Windows
2130 if test -n "$MOZ_SANDBOX"; then
2131 AC_DEFINE(MOZ_SANDBOX)
2134 AC_SUBST(MOZ_SANDBOX)
2137 dnl ========================================================
2139 dnl = Module specific options
2141 dnl ========================================================
2142 MOZ_ARG_HEADER(Individual module options)
2144 dnl ==============================
2145 dnl === SQLite fdatasync check ===
2146 dnl ==============================
2147 dnl Check to see if fdatasync is available and make use of it
2148 AC_CHECK_FUNC(fdatasync)
2150 dnl ========================================================
2151 dnl = Disable zipwriter
2152 dnl ========================================================
2153 MOZ_ARG_DISABLE_BOOL(zipwriter,
2154 [ --disable-zipwriter Disable zipwriter component],
2157 AC_SUBST(MOZ_ZIPWRITER)
2159 dnl ========================================================
2161 dnl = Feature options that require extra sources to be pulled
2163 dnl ========================================================
2164 dnl MOZ_ARG_HEADER(Features that require extra sources)
2166 dnl ========================================================
2168 dnl = Runtime debugging and Optimization Options
2170 dnl ========================================================
2171 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
2173 dnl ========================================================
2174 dnl enable mobile optimizations
2175 dnl ========================================================
2176 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
2177 [ --enable-mobile-optimize
2178 Enable mobile optimizations],
2179 MOZ_GFX_OPTIMIZE_MOBILE=1)
2181 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
2183 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
2184 # We ignore paint will resample on mobile for performance.
2185 # We may want to revisit this later.
2186 MOZ_IGNORE_PAINT_WILL_RESAMPLE=1
2188 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
2189 AC_DEFINE(MOZ_IGNORE_PAINT_WILL_RESAMPLE)
2192 dnl ========================================================
2193 dnl = Enable code optimization. ON by default.
2194 dnl ========================================================
2196 # Use value from moz.configure if one is defined. Else use our computed
2198 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
2199 MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
2202 if test "$COMPILE_ENVIRONMENT"; then
2203 if test -n "$MOZ_OPTIMIZE"; then
2204 AC_MSG_CHECKING([for valid C compiler optimization flags])
2205 _SAVE_CFLAGS=$CFLAGS
2206 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
2207 AC_TRY_COMPILE([#include <stdio.h>],
2208 [printf("Hello World\n");],
2211 AC_MSG_RESULT([$_results])
2212 if test "$_results" = "no"; then
2213 AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
2215 CFLAGS=$_SAVE_CFLAGS
2216 if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
2217 # When using llvm-based LTO, non numeric optimization levels are
2218 # not supported by the linker, so force the linker to use -O2 (
2219 # which doesn't influence the level compilation units are actually
2221 case " $MOZ_OPTIMIZE_FLAGS " in
2222 *\ -Os\ *|*\ -Oz\ *)
2223 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
2228 fi # COMPILE_ENVIRONMENT
2230 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
2231 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
2232 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
2234 dnl ========================================================
2235 dnl = Enable runtime logging
2236 dnl ========================================================
2237 AC_DEFINE(MOZ_LOGGING)
2238 AC_DEFINE(FORCE_PR_LOG)
2240 dnl ========================================================
2241 dnl = This will enable logging of addref, release, ctor, dtor.
2242 dnl ========================================================
2243 _ENABLE_LOGREFCNT=42
2244 MOZ_ARG_ENABLE_BOOL(logrefcnt,
2245 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
2246 _ENABLE_LOGREFCNT=1,
2247 _ENABLE_LOGREFCNT= )
2248 if test "$_ENABLE_LOGREFCNT" = "1"; then
2249 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
2250 elif test -z "$_ENABLE_LOGREFCNT"; then
2251 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
2254 dnl ========================================================
2255 dnl moz_dump_painting
2256 dnl ========================================================
2257 MOZ_ARG_ENABLE_BOOL(dump-painting,
2258 [ --enable-dump-painting Enable paint debugging.],
2259 MOZ_DUMP_PAINTING=1,
2260 MOZ_DUMP_PAINTING= )
2261 if test -n "$MOZ_DUMP_PAINTING"; then
2262 AC_DEFINE(MOZ_DUMP_PAINTING)
2263 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
2265 if test -n "$MOZ_DEBUG"; then
2266 AC_DEFINE(MOZ_DUMP_PAINTING)
2269 case "${OS_TARGET}" in
2270 Android|WINNT|Darwin)
2271 MOZ_GLUE_IN_PROGRAM=
2274 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
2275 MOZ_GLUE_IN_PROGRAM=1
2276 AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
2280 dnl ========================================================
2281 dnl = Jemalloc build setup
2282 dnl ========================================================
2283 if test -z "$MOZ_MEMORY"; then
2286 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
2287 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.])
2292 dnl The generic feature tests that determine how to compute ncpus are long and
2293 dnl complicated. Therefore, simply define special cpp variables for the
2294 dnl platforms we have special knowledge of.
2297 export MOZ_NO_DEBUG_RTL=1
2301 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
2303 dnl ========================================================
2304 dnl = Enable using the clang plugin to build
2305 dnl ========================================================
2307 if test -n "$COMPILE_ENVIRONMENT"; then
2308 MOZ_CONFIG_CLANG_PLUGIN
2309 fi # COMPILE_ENVIRONMENT
2311 dnl ========================================================
2312 dnl = Enable stripping of libs & executables
2313 dnl ========================================================
2314 MOZ_ARG_ENABLE_BOOL(strip,
2315 [ --enable-strip Enable stripping of libs & executables ],
2319 dnl ========================================================
2320 dnl = Enable stripping of libs & executables when packaging
2321 dnl ========================================================
2322 MOZ_ARG_ENABLE_BOOL(install-strip,
2323 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
2327 dnl ========================================================
2328 dnl = frontend JS debug mode
2329 dnl ========================================================
2331 MOZ_ARG_ENABLE_BOOL(debug-js-modules,
2332 [ --enable-debug-js-modules Enable debug mode for frontend JS libraries],
2336 AC_SUBST(DEBUG_JS_MODULES)
2338 dnl ========================================================
2340 dnl = Profiling and Instrumenting
2342 dnl ========================================================
2343 MOZ_ARG_HEADER(Profiling and Instrumenting)
2345 dnl ========================================================
2346 dnl = Offer a way to disable the startup cache
2347 dnl ========================================================
2349 MOZ_ARG_DISABLE_BOOL(startupcache,
2350 [ --disable-startupcache Disable startup cache ],
2351 MOZ_DISABLE_STARTUPCACHE=1,
2352 MOZ_DISABLE_STARTUPCACHE=)
2354 if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
2355 AC_DEFINE(MOZ_DISABLE_STARTUPCACHE)
2357 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
2359 dnl ========================================================
2360 dnl = Support for demangling undefined symbols
2361 dnl ========================================================
2362 if test -z "$SKIP_LIBRARY_CHECKS"; then
2365 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
2369 # Demangle only for debug or DMD builds
2370 MOZ_DEMANGLE_SYMBOLS=
2371 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
2372 MOZ_DEMANGLE_SYMBOLS=1
2373 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
2375 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
2377 dnl ========================================================
2378 dnl = Support for gcc stack unwinding (from gcc 3.3)
2379 dnl ========================================================
2380 if test -z "$SKIP_LIBRARY_CHECKS"; then
2383 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
2387 dnl ========================================================
2389 dnl ========================================================
2391 MOZ_ARG_WITH_STRING(jitreport-granularity,
2392 [ --jitreport-granularity=N
2393 Default granularity at which to report JIT code
2396 1 - code ranges for whole functions only
2397 2 - per-line information
2398 3 - per-op information],
2399 JITREPORT_GRANULARITY=$withval,
2400 JITREPORT_GRANULARITY=3)
2402 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
2404 dnl ========================================================
2408 dnl ========================================================
2409 MOZ_ARG_HEADER(Misc. Options)
2411 dnl ========================================================
2412 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
2413 dnl ========================================================
2414 MOZ_ARG_WITH_STRING(user-appdir,
2415 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
2416 [ val=`echo $withval`
2417 if echo "$val" | grep "\/" >/dev/null; then
2418 AC_MSG_ERROR("Homedir must be single relative path.")
2423 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
2425 if test -z "$SKIP_COMPILER_CHECKS"; then
2426 dnl ========================================================
2428 dnl = Compiler Options
2430 dnl ========================================================
2431 MOZ_ARG_HEADER(Compiler Options)
2433 dnl ========================================================
2434 dnl Check for gcc -pipe support
2435 dnl ========================================================
2436 AC_MSG_CHECKING([for -pipe support])
2437 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
2438 dnl Any gcc that supports firefox supports -pipe.
2439 CFLAGS="$CFLAGS -pipe"
2440 CXXFLAGS="$CXXFLAGS -pipe"
2441 AC_MSG_RESULT([yes])
2446 fi # ! SKIP_COMPILER_CHECKS
2450 if test "$COMPILE_ENVIRONMENT"; then
2452 fi # COMPILE_ENVIRONMENT
2454 dnl ========================================================
2456 dnl = Static Build Options
2458 dnl ========================================================
2459 MOZ_ARG_HEADER(Static build options)
2461 if test -z "$MOZ_SYSTEM_ZLIB"; then
2462 if test -n "$JS_SHARED_LIBRARY" -o -n "$MOZ_LINKER" -o "$MOZ_WIDGET_TOOLKIT" = android; then
2464 AC_DEFINE(ZLIB_IN_MOZGLUE)
2468 AC_SUBST(ZLIB_IN_MOZGLUE)
2470 dnl ========================================================
2472 dnl = Standalone module options
2474 dnl ========================================================
2475 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
2478 dnl ========================================================
2480 if test -z "$SKIP_PATH_CHECKS"; then
2481 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
2482 if test "$MOZ_ENABLE_GTK" ; then
2483 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
2488 if test -z "${GLIB_GMODULE_LIBS}" \
2489 -a -n "${GLIB_CONFIG}"\
2490 -a "${GLIB_CONFIG}" != no\
2492 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
2495 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
2497 if test "$USE_FC_FREETYPE"; then
2498 if test "$COMPILE_ENVIRONMENT"; then
2499 dnl ========================================================
2500 dnl = Check for freetype2 functionality
2501 dnl ========================================================
2502 if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
2504 _SAVE_CFLAGS="$CFLAGS"
2505 LIBS="$LIBS $FT2_LIBS"
2506 CFLAGS="$CFLAGS $FT2_CFLAGS"
2508 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
2509 ac_cv_member_FT_Bitmap_Size_y_ppem,
2510 [AC_TRY_COMPILE([#include <ft2build.h>
2511 #include FT_FREETYPE_H],
2513 if (sizeof s.y_ppem) return 0;
2515 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
2516 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
2517 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
2518 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
2520 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
2522 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
2523 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
2524 [FT_Bitmap_Size structure includes y_ppem field])
2526 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
2529 CFLAGS="$_SAVE_CFLAGS"
2532 _SAVE_CPPFLAGS="$CPPFLAGS"
2533 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
2534 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
2535 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
2536 CPPFLAGS="$_SAVE_CPPFLAGS"
2540 dnl ========================================================
2541 dnl Check if we need the 32-bit Linux SSE2 error dialog
2542 dnl ========================================================
2544 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
2546 dnl ========================================================
2547 dnl Check for pixman and cairo
2548 dnl ========================================================
2551 MOZ_ARG_ENABLE_BOOL(system-cairo,
2552 [ --enable-system-cairo Obsolete: do not use this option],
2553 AC_MSG_ERROR(--enable-system-cairo is not supported),
2557 MOZ_ARG_ENABLE_BOOL(system-pixman,
2558 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
2560 MOZ_TREE_PIXMAN=force,
2563 if test "$MOZ_TREE_PIXMAN"; then
2564 AC_DEFINE(MOZ_TREE_PIXMAN)
2566 PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.19.2)
2569 MOZ_CAIRO_CFLAGS="-I${DIST}/include/cairo"
2570 AC_DEFINE(MOZ_TREE_CAIRO)
2572 if test "$OS_ARCH" = "WINNT"; then
2573 # For now we assume that we will have a uint64_t available through
2574 # one of the above headers or mozstdint.h.
2575 AC_DEFINE(HAVE_UINT64_T)
2578 # Define macros for cairo-features.h
2579 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
2580 if test "$MOZ_X11"; then
2581 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
2582 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
2583 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
2585 if test "$_HAVE_FREETYPE2"; then
2586 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2587 MOZ_ENABLE_CAIRO_FT=1
2588 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
2591 case "$MOZ_WIDGET_TOOLKIT" in
2593 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
2594 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
2595 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
2598 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
2599 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
2600 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
2602 if test "$COMPILE_ENVIRONMENT"; then
2603 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
2607 if test "$USE_FC_FREETYPE"; then
2608 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
2610 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
2611 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
2613 AC_SUBST(PS_SURFACE_FEATURE)
2614 AC_SUBST(SVG_SURFACE_FEATURE)
2615 AC_SUBST(XLIB_SURFACE_FEATURE)
2616 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
2617 AC_SUBST(QUARTZ_SURFACE_FEATURE)
2618 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
2619 AC_SUBST(WIN32_SURFACE_FEATURE)
2620 AC_SUBST(OS2_SURFACE_FEATURE)
2621 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
2622 AC_SUBST(FT_FONT_FEATURE)
2623 AC_SUBST(FC_FONT_FEATURE)
2624 AC_SUBST(WIN32_FONT_FEATURE)
2625 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
2626 AC_SUBST(QUARTZ_FONT_FEATURE)
2627 AC_SUBST(PNG_FUNCTIONS_FEATURE)
2628 AC_SUBST(QT_SURFACE_FEATURE)
2629 AC_SUBST(TEE_SURFACE_FEATURE)
2631 if test "$MOZ_X11"; then
2632 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
2635 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
2637 case "$MOZ_WIDGET_TOOLKIT" in
2639 TK_CFLAGS="$MOZ_CAIRO_CFLAGS $MOZ_PIXMAN_CFLAGS"
2640 TK_LIBS="$MOZ_CAIRO_LIBS $MOZ_PIXMAN_LIBS"
2644 AC_SUBST(MOZ_TREE_CAIRO)
2645 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
2646 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
2647 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
2648 AC_SUBST(MOZ_TREE_PIXMAN)
2650 BINDGEN_SYSTEM_FLAGS="$_BINDGEN_CFLAGS $NSPR_CFLAGS $NSS_CFLAGS $MOZ_PIXMAN_CFLAGS $MOZ_CAIRO_CFLAGS"
2651 AC_SUBST(BINDGEN_SYSTEM_FLAGS)
2652 BINDGEN_SYSTEM_TOML_FLAGS="$BINDGEN_SYSTEM_FLAGS"
2653 AC_SUBST_TOML_LIST(BINDGEN_SYSTEM_TOML_FLAGS)
2655 dnl ========================================================
2657 dnl ========================================================
2658 MOZ_ARG_DISABLE_BOOL(xul,
2659 [ --disable-xul Disable XUL],
2661 if test "$MOZ_XUL"; then
2664 dnl remove extensions that require XUL
2665 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
2670 dnl ========================================================
2671 dnl necko configuration options
2672 dnl ========================================================
2675 dnl option to disable necko's wifi scanner
2678 if test "$MOZ_WIDGET_TOOLKIT"; then
2680 case "$OS_TARGET" in
2682 if test -z "$MOZ_IOS"; then
2686 DragonFly|FreeBSD|WINNT)
2697 MOZ_ARG_DISABLE_BOOL(necko-wifi,
2698 [ --disable-necko-wifi Disable necko wifi scanner],
2702 if test "$NECKO_WIFI"; then
2703 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
2704 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
2706 AC_DEFINE(NECKO_WIFI)
2707 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
2709 AC_SUBST(NECKO_WIFI)
2710 AC_SUBST(NECKO_WIFI_DBUS)
2712 dnl ========================================================
2714 dnl = Maintainer debug option (no --enable equivalent)
2716 dnl ========================================================
2719 AC_SUBST_LIST(ASFLAGS)
2723 AC_SUBST(MOZ_AUTH_EXTENSION)
2724 AC_SUBST(MOZ_PREF_EXTENSIONS)
2725 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
2726 AC_SUBST_LIST(WARNINGS_CFLAGS)
2727 AC_SUBST_SET(MOZ_EXTENSIONS)
2729 AC_SUBST(MOZ_UNIVERSALCHARDET)
2730 AC_SUBST(MOZ_SPELLCHECK)
2731 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
2732 AC_SUBST(MOZ_CRASHREPORTER)
2733 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
2734 AC_SUBST(MOZ_STUB_INSTALLER)
2735 AC_SUBST(MOZ_UPDATER)
2737 AC_SUBST(MOZ_ANDROID_APPLICATION_CLASS)
2738 AC_SUBST(MOZ_ANDROID_BROWSER_INTENT_CLASS)
2739 AC_SUBST(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
2740 AC_SUBST(ENABLE_STRIP)
2741 AC_SUBST(PKG_SKIP_STRIP)
2742 AC_SUBST(STRIP_FLAGS)
2743 AC_SUBST(INCREMENTAL_LINKER)
2745 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
2747 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
2748 AC_SUBST(MOZ_LINKER_EXTRACT)
2750 if test -n "$MOZ_BINARY_EXTENSIONS"; then
2751 AC_DEFINE(MOZ_BINARY_EXTENSIONS)
2754 AC_SUBST(MOZ_REQUIRE_SIGNING)
2755 if test "$MOZ_REQUIRE_SIGNING" = 1; then
2756 AC_DEFINE(MOZ_REQUIRE_SIGNING)
2759 dnl ========================================================
2760 dnl = Mac bundle name prefix
2761 dnl ========================================================
2762 MOZ_ARG_WITH_STRING(macbundlename-prefix,
2763 [ --with-macbundlename-prefix=prefix
2764 Prefix for MOZ_MACBUNDLE_NAME],
2765 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
2767 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
2768 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
2769 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
2772 if test "$MOZ_DEBUG"; then
2773 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
2775 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
2777 AC_SUBST(MOZ_MACBUNDLE_NAME)
2779 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
2780 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
2781 # Otherwise, use MOZ_APP_DISPLAYNAME
2782 if test -z "$MOZ_MACBUNDLE_ID"; then
2783 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
2785 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
2786 if test "$MOZ_DEBUG"; then
2787 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
2790 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
2791 AC_SUBST(MOZ_MACBUNDLE_ID)
2793 dnl ========================================================
2794 dnl = Child Process Name for IPC
2795 dnl ========================================================
2796 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
2797 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
2799 # We want to let Android unpack the file at install time, but it only does
2800 # so if the file is named libsomething.so. The lib/ path is also required
2801 # because the unpacked file will be under the lib/ subdirectory and will
2802 # need to be executed from that path.
2803 MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
2805 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
2806 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
2808 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
2809 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
2810 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
2812 # The following variables are available to branding and application
2813 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
2814 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
2815 # impacts profile location and user-visible fields.
2816 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
2817 # versions of a given application (e.g. Aurora and Firefox both use
2818 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
2819 # for application.ini's "Name" field, which controls profile location in
2820 # the absence of a "Profile" field (see below), and various system
2821 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
2822 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
2823 # Mac Bundle name, Updater, Installer), it is typically used for nightly
2824 # builds (e.g. Aurora for Firefox).
2825 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
2826 # defaults to a lowercase form of MOZ_APP_BASENAME.
2827 # - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
2828 # profile name and remoting. If not set, defaults to MOZ_APP_NAME.
2829 # - MOZ_APP_PROFILE: When set, used for application.ini's
2830 # "Profile" field, which controls profile location.
2831 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
2832 # crash reporter server url.
2833 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
2835 # The following environment variables used to have an effect, but don't anymore:
2836 # - MOZ_APP_VERSION: Defines the application version number. This was replaced with
2837 # the contents from the version.txt file in the application directory, or
2838 # browser/config/version.txt if there isn't one.
2839 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
2840 # in the "About" window. This was replaced with the contents from the
2841 # version_display.txt or version.txt in the application directory, or
2842 # browser/config/version_display.txt.
2844 if test -z "$MOZ_APP_NAME"; then
2845 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
2848 if test -z "$MOZ_APP_REMOTINGNAME"; then
2849 MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
2852 if test -z "$ANDROID_PACKAGE_NAME" ; then
2853 # When we got rid of the Aurora channel we decided to replace the old
2854 # Nightly ANDROID_PACKAGE_NAME with Aurora. To make sure this is inherited
2855 # by all mozilla-central based branches we make this the new "default"
2856 # for Fennec. Non mozilla-central based branches set ANDROID_PACKAGE_NAME
2857 # in their mozconfig, so they will never get this. If there are ever
2858 # non-Fennec builds for Android, they will fall into the else block
2859 # and use their own default name.
2860 # https://bugzilla.mozilla.org/show_bug.cgi?id=1357808 has additional
2861 # background on this.
2862 if test "$MOZ_APP_NAME" = "fennec"; then
2863 ANDROID_PACKAGE_NAME="org.mozilla.fennec_aurora"
2865 ANDROID_PACKAGE_NAME="org.mozilla.$MOZ_APP_NAME"
2869 # For extensions and langpacks, we require a max version that is compatible
2870 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
2871 # 24.0a1 and 24.0a2 aren't affected
2873 # 24.1.1 becomes 24.*
2874 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
2875 if test -z "$IS_ALPHA"; then
2877 if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
2878 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
2880 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
2884 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
2887 AC_SUBST(MOZ_APP_NAME)
2888 AC_SUBST(MOZ_APP_REMOTINGNAME)
2889 AC_SUBST(MOZ_APP_DISPLAYNAME)
2890 AC_SUBST(MOZ_APP_BASENAME)
2891 AC_SUBST(MOZ_APP_VENDOR)
2892 AC_SUBST(MOZ_APP_PROFILE)
2893 AC_SUBST(MOZ_APP_ID)
2894 AC_SUBST(MAR_CHANNEL_ID)
2895 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
2896 AC_SUBST(MOZ_PROFILE_MIGRATOR)
2897 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
2898 AC_SUBST(MOZ_APP_UA_NAME)
2899 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
2900 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
2901 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
2903 AC_SUBST(MOZ_APP_MAXVERSION)
2904 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
2905 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
2906 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
2909 AC_SUBST(MOZ_PKG_SPECIAL)
2910 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
2912 if test "$MOZILLA_OFFICIAL"; then
2913 # Build revisions should always be present in official builds
2914 MOZ_INCLUDE_SOURCE_INFO=1
2917 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
2918 # explicitly set the repository and changeset information in.
2919 AC_SUBST(MOZ_SOURCE_REPO)
2920 AC_SUBST(MOZ_SOURCE_CHANGESET)
2921 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
2923 dnl If we have any service that uploads data (and requires data submission
2924 dnl policy alert), set MOZ_DATA_REPORTING.
2925 dnl We need SUBST for build system and DEFINE for xul preprocessor.
2926 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER" || test -n "$MOZ_NORMANDY"; then
2927 MOZ_DATA_REPORTING=1
2928 AC_DEFINE(MOZ_DATA_REPORTING)
2929 AC_SUBST(MOZ_DATA_REPORTING)
2933 AC_SUBST(WIN32_REDIST_DIR)
2934 AC_SUBST(WIN_UCRT_REDIST_DIR)
2936 dnl ========================================================
2938 dnl ========================================================
2942 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
2948 dnl Echo the CFLAGS to remove extra whitespace.
2950 $_COMPILATION_CFLAGS \
2954 $_WARNINGS_CXXFLAGS \
2955 $_COMPILATION_CXXFLAGS \
2958 COMPILE_CFLAGS=`echo \
2962 COMPILE_CXXFLAGS=`echo \
2963 $_DEFINES_CXXFLAGS \
2967 $_WARNINGS_HOST_CFLAGS \
2968 $_COMPILATION_HOST_CFLAGS \
2971 HOST_CXXFLAGS=`echo \
2972 $_WARNINGS_HOST_CXXFLAGS \
2973 $_COMPILATION_HOST_CXXFLAGS \
2976 AC_SUBST(MOZ_SYSTEM_PNG)
2978 AC_SUBST_LIST(MOZ_PNG_CFLAGS)
2979 AC_SUBST_LIST(MOZ_PNG_LIBS)
2981 AC_SUBST(MOZ_SYSTEM_NSPR)
2983 AC_SUBST(MOZ_SYSTEM_NSS)
2985 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
2986 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
2987 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
2988 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
2989 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
2990 OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
2991 OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
2993 AC_SUBST(HOST_CMFLAGS)
2994 AC_SUBST(HOST_CMMFLAGS)
2995 AC_SUBST(OS_COMPILE_CMFLAGS)
2996 AC_SUBST(OS_COMPILE_CMMFLAGS)
2999 OS_CXXFLAGS="$CXXFLAGS"
3000 OS_CPPFLAGS="$CPPFLAGS"
3001 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
3002 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
3003 OS_LDFLAGS="$LDFLAGS"
3005 AC_SUBST_LIST(OS_CFLAGS)
3006 AC_SUBST_LIST(OS_CXXFLAGS)
3007 AC_SUBST_LIST(OS_CPPFLAGS)
3008 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
3009 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
3010 AC_SUBST_LIST(OS_LDFLAGS)
3015 AC_SUBST_LIST(HOST_CFLAGS)
3016 AC_SUBST_LIST(HOST_CPPFLAGS)
3017 AC_SUBST_LIST(HOST_CXXFLAGS)
3018 AC_SUBST(HOST_LDFLAGS)
3019 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
3020 AC_SUBST(HOST_BIN_SUFFIX)
3022 AC_SUBST(TARGET_XPCOM_ABI)
3023 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
3024 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
3025 AC_SUBST(HAVE_X86_AVX2)
3026 AC_SUBST(HAVE_ALTIVEC)
3028 AC_SUBST_LIST(DSO_CFLAGS)
3029 AC_SUBST_LIST(DSO_PIC_CFLAGS)
3030 AC_SUBST(DSO_LDOPTS)
3031 AC_SUBST(BIN_SUFFIX)
3033 AC_SUBST(NS_ENABLE_TSF)
3034 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
3035 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
3037 AC_SUBST(MOZ_DEVTOOLS)
3039 AC_SUBST(MOZ_PACKAGE_JSSHELL)
3040 AC_SUBST(MOZ_FOLD_LIBS)
3041 AC_SUBST_LIST(MOZ_FOLD_LIBS_FLAGS)
3045 dnl Host JavaScript runtime, if any, to use during cross compiles.
3048 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
3050 if test -n "$COMPILE_ENVIRONMENT"; then
3051 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
3053 dnl Check for missing components
3054 if test "$MOZ_X11"; then
3055 dnl ====================================================
3056 dnl = Check if X headers exist
3057 dnl ====================================================
3058 _SAVE_CFLAGS=$CFLAGS
3059 CFLAGS="$CFLAGS $XCFLAGS"
3063 #include <X11/Xlib.h>
3064 #include <X11/Intrinsic.h>
3065 #include <X11/extensions/XShm.h>
3069 if ((dpy = XOpenDisplay(NULL)) == NULL) {
3070 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
3074 [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
3075 CFLAGS="$_SAVE_CFLAGS"
3077 if test -n "$MISSING_X"; then
3078 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
3083 fi # COMPILE_ENVIRONMENT
3085 dnl Set various defines and substitutions
3086 dnl ========================================================
3088 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
3089 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
3090 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
3091 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
3092 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
3093 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
3094 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
3095 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
3096 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
3099 AC_SUBST(MOZ_DEV_EDITION)
3100 if test -n "$MOZ_DEV_EDITION"; then
3101 AC_DEFINE(MOZ_DEV_EDITION)
3104 if test "$MOZ_DEBUG" -o "$DEVELOPER_OPTIONS"; then
3108 if test -n "$A11Y_LOG"; then
3112 dnl Spit out some output
3113 dnl ========================================================
3115 dnl The following defines are used by xpcom
3116 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
3128 # Avoid using obsolete NSPR features
3129 AC_DEFINE(NO_NSPR_10_SUPPORT)
3131 MOZ_CREATE_CONFIG_STATUS()
3133 rm -fr confdefs* $ac_clean_files