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"
449 _USE_CPP_INCLUDE_FLAG=1
451 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
454 if test "$GNU_CXX"; then
455 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
457 _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
458 _USE_CPP_INCLUDE_FLAG=1
461 # For profiling builds keep the symbol information
462 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
464 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
465 STRIP_FLAGS="--strip-debug"
470 dnl ========================================================
472 dnl ========================================================
474 if test "$MOZ_DMD"; then
475 if test "${CPU_ARCH}" = "arm"; then
476 CFLAGS="$CFLAGS -funwind-tables"
477 CXXFLAGS="$CXXFLAGS -funwind-tables"
481 dnl ========================================================
482 dnl System overrides of the defaults for host
483 dnl ========================================================
486 if test -n "$_WIN32_MSVC"; then
487 HOST_CFLAGS="$HOST_CFLAGS"
489 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
491 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
492 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
495 case "${host_cpu}" in
497 if test -n "$_WIN32_MSVC"; then
498 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
502 if test -n "$_WIN32_MSVC"; then
503 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
505 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
511 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
512 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
515 *-linux*|*-kfreebsd*-gnu|*-gnu*)
516 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
517 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
521 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
522 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
526 dnl ========================================================
527 dnl System overrides of the defaults for target
528 dnl ========================================================
532 MOZ_OPTIMIZE_FLAGS="-O3"
533 CXXFLAGS="$CXXFLAGS -stdlib=libc++"
535 STRIP_FLAGS="$STRIP_FLAGS -x -S"
536 # Ensure that if we're targeting iOS an SDK was provided.
537 AC_CACHE_CHECK(for iOS target,
539 [AC_TRY_COMPILE([#include <TargetConditionals.h>
540 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
544 ac_cv_ios_target="yes",
545 ac_cv_ios_target="no")])
546 if test "$ac_cv_ios_target" = "yes" -a -z $MOZ_IOS; then
547 AC_MSG_ERROR([targeting iOS but not using an iOS SDK?])
549 if test -z "$MOZ_IOS"; then
550 # The ExceptionHandling framework is needed for Objective-C exception
551 # logging code in nsObjCExceptions.h. Currently we only use that in debug
553 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
556 dnl DTrace and -dead_strip don't interact well. See bug 403132.
557 dnl ===================================================================
558 if test "x$enable_dtrace" = "xyes"; then
559 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
561 dnl check for the presence of the -dead_strip linker flag
562 AC_MSG_CHECKING([for -dead_strip option to ld])
563 _SAVE_LDFLAGS=$LDFLAGS
564 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
565 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
566 if test -n "$_HAVE_DEAD_STRIP" ; then
568 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
573 LDFLAGS=$_SAVE_LDFLAGS
576 MOZ_FIX_LINK_PATHS="-Wl,-executable_path,${DIST}/bin"
579 *-android*|*-linuxandroid*)
580 if test "$COMPILE_ENVIRONMENT" -a -n "$MOZ_MEMORY"; then
584 MOZ_GFX_OPTIMIZE_MOBILE=1
585 if test -z "$CLANG_CC"; then
586 MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
587 elif test -n "$RELEASE_OR_BETA"; then
588 # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
589 # -Oz is smaller than -Os on clang.
590 MOZ_OPTIMIZE_FLAGS="-Oz"
591 # Disable the outliner, which causes performance regressions, and is
592 # enabled on some platforms at -Oz.
593 if test -z "$MOZ_LTO"; then
594 DISABLE_OUTLINER="-mno-outline"
596 CFLAGS="$CFLAGS $DISABLE_OUTLINER"
597 AC_TRY_COMPILE(,,[MOZ_OPTIMIZE_FLAGS="$MOZ_OPTIMIZE_FLAGS $DISABLE_OUTLINER"])
598 CFLAGS="$_SAVE_CFLAGS"
600 DISABLE_OUTLINER="-Wl,-plugin-opt=-enable-machine-outliner=never"
601 _SAVE_LDFLAGS=$LDFLAGS
602 LDFLAGS="$LDFLAGS $MOZ_LTO_LDFLAGS $DISABLE_OUTLINER"
603 AC_TRY_LINK(,,[MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS $DISABLE_OUTLINER"])
604 LDFLAGS="$_SAVE_LDFLAGS"
607 MOZ_OPTIMIZE_FLAGS="-O2"
612 if test "$GNU_CC" -o "$GNU_CXX"; then
613 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
614 if test -n "$MOZ_DEBUG"; then
615 MOZ_OPTIMIZE_FLAGS="-Os"
617 MOZ_OPTIMIZE_FLAGS="-O2"
619 if test -z "$CLANG_CC"; then
620 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
624 case "${target_cpu}" in
626 CFLAGS="$CFLAGS -mieee"
627 CXXFLAGS="$CXXFLAGS -mieee"
634 # certain versions of cygwin's makedepend barf on the
635 # #include <string> vs -I./dist/include/string issue so don't use it
636 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
637 # $GNU_CC will match gcc and clang; while $CLANG_CC will match only clang
638 if test -z "$CLANG_CC"; then
639 AC_MSG_ERROR(Firefox cannot be built with mingw-gcc and requires a mingw-clang toolchain to work)
643 # Use temp file for windres (bug 213281)
644 RCFLAGS='-O coff --use-temp-file'
645 # mingw doesn't require kernel32, user32, and advapi32 explicitly
646 LIBS="$LIBS -luuid -lusp10 -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
649 MOZ_OPTIMIZE_FLAGS="-O2"
651 WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
652 WIN32_GUI_EXE_LDFLAGS=-mwindows
654 # Silence problematic clang warnings
655 CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
656 LDFLAGS="$LDFLAGS -Wl,--no-insert-timestamp"
658 TARGET_COMPILER_ABI=msvc
659 RANLIB='echo not_ranlib'
660 STRIP='echo not_strip'
662 # aarch64 doesn't support subsystems below 6.02
663 if test "$CPU_ARCH" = "aarch64"; then
664 WIN32_SUBSYSTEM_VERSION=6.02
666 WIN32_SUBSYSTEM_VERSION=6.01
668 WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
669 WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
670 DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
671 _USE_CPP_INCLUDE_FLAG=1
672 _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
673 _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
674 CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
675 CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
676 if test -z "$CLANG_CL"; then
677 CPPFLAGS="$CPPFLAGS -utf-8"
679 if test "$CPU_ARCH" = "x86"; then
680 dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
681 dnl more recent, so set that explicitly here unless another
682 dnl target arch has already been set.
684 if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
685 CFLAGS="$CFLAGS -arch:SSE2"
687 if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
688 CXXFLAGS="$CXXFLAGS -arch:SSE2"
691 SSE_FLAGS="-arch:SSE"
692 SSE2_FLAGS="-arch:SSE2"
693 dnl MSVC allows the use of intrinsics without any flags
694 dnl and doesn't have a separate arch for SSSE3
695 SSSE3_FLAGS="-arch:SSE2"
697 dnl clang-cl requires appropriate flags to enable SSSE3 support
698 dnl on all architectures.
699 if test -n "$CLANG_CL"; then
700 SSSE3_FLAGS="-mssse3"
702 dnl VS2013+ supports -Gw for better linker optimizations.
703 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
704 dnl Disabled on ASan because it causes false-positive ODR violations.
705 if test -z "$MOZ_ASAN"; then
707 CXXFLAGS="$CXXFLAGS -Gw"
709 # String tail merging doesn't play nice with ASan's ODR checker.
710 LDFLAGS="$LDFLAGS -opt:nolldtailmerge"
712 if test -n "$CLANG_CL"; then
713 # XXX We should combine some of these with our generic GCC-style
716 # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
717 CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
718 # We use offsetof on non-POD objects all the time.
719 # We also suppress this warning on other platforms.
720 CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
721 # This warns for reasonable things like:
722 # enum { X = 0xffffffffU };
723 # which is annoying for IDL headers.
724 CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
725 # This warns for cases that would be reached by the Microsoft
726 # #include rules, but also currently warns on cases that would
727 # *also* be reached by standard C++ include rules. That
728 # behavior doesn't seem useful, so we turn it off.
729 CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
730 # We normally error out on unknown pragmas, but since clang-cl
731 # claims to be MSVC, it would be difficult to add
732 # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
733 # use such pragmas, so just ignore them.
734 CFLAGS="$CFLAGS -Wno-unknown-pragmas"
735 CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
736 # We get errors about various #pragma intrinsic directives from
737 # clang-cl, and we don't need to hear about those.
738 CFLAGS="$CFLAGS -Wno-ignored-pragmas"
739 CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
740 # clang-cl's Intrin.h marks things like _ReadWriteBarrier
741 # as __attribute((__deprecated__)). This is nice to know,
742 # but since we don't get the equivalent warning from MSVC,
743 # let's just ignore it.
744 CFLAGS="$CFLAGS -Wno-deprecated-declarations"
745 CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
746 # We use a function like:
747 # __declspec(noreturn) __inline void f() {}
748 # which -Winvalid-noreturn complains about. Again, MSVC seems
749 # OK with it, so let's silence the warning.
750 CFLAGS="$CFLAGS -Wno-invalid-noreturn"
751 CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
752 # Missing |override| on virtual function declarations isn't
753 # something that MSVC currently warns about.
754 CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
755 # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
756 # declaration on |operator delete(void*)|. However, clang-cl
757 # must internally declare |operator delete(void*)| differently,
758 # which causes this warning for virtually every file in the
759 # tree. clang-cl doesn't support -fno-exceptions or equivalent,
760 # so there doesn't seem to be any way to convince clang-cl to
761 # declare |delete| differently. Therefore, suppress this
763 CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
764 # Macros like STDMETHOD() and IFACEMETHOD() can declare
765 # __attribute__((nothrow)) on their respective method declarations,
766 # while the definitions are left without the matching attribute.
767 CXXFLAGS="$CXXFLAGS -Wno-microsoft-exception-spec"
768 # At least one MSVC header and several headers in-tree have
769 # unused typedefs, so turn this on.
770 CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
771 # jemalloc uses __declspec(allocator) as a profiler hint,
772 # which clang-cl doesn't understand.
773 CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
774 # __attribute__((unused)) really means "might be unused" and
775 # we use it to avoid warnings about things that are unused
776 # in some compilation units, but used in many others. This
777 # warning insists on complaining about the latter case, which
778 # is annoying, and rather noisy.
779 CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused"
781 # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
782 CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
783 LIBS="$LIBS user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
784 MOZ_DEBUG_LDFLAGS='-DEBUG'
785 # Use a higher optimization level for clang-cl, so we can come closer
786 # to MSVC's performance numbers (see bug 1443590).
787 if test -n "$CLANG_CL"; then
788 MOZ_OPTIMIZE_FLAGS='-O2'
790 MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
793 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE"
794 if test -z "$DEVELOPER_OPTIONS"; then
795 LDFLAGS="$LDFLAGS -RELEASE"
798 dnl Minimum reqiurement of Gecko is VS2015 or later which supports
799 dnl both SSSE3 and SSE4.1.
800 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
801 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
802 dnl allow AVX2 code from VS2015
805 AC_DEFINE(WIN32_LEAN_AND_MEAN)
806 dnl See http://support.microsoft.com/kb/143208 to use STL
809 MOZ_USER_DIR="Mozilla"
813 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.])
819 if test -n "$GNU_CC"; then
820 CFLAGS="$CFLAGS -mstackrealign"
821 CXXFLAGS="$CXXFLAGS -mstackrealign"
822 LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
824 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
825 LDFLAGS="$LDFLAGS -SAFESEH"
831 if test -n "$_WIN32_MSVC"; then
832 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
837 if test -n "$_WIN32_MSVC"; then
838 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:ARM64"
843 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
850 CFLAGS="$CFLAGS -Dunix"
851 CXXFLAGS="$CXXFLAGS -Dunix"
852 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
853 DSO_PIC_CFLAGS='-fPIC -DPIC'
855 MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
857 DSO_PIC_CFLAGS='-fPIC -DPIC'
860 # This will fail on a.out systems prior to 1.5.1_ALPHA.
861 if test "$LIBRUNPATH"; then
862 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
867 if test -z "$X11BASE"; then
870 MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
872 DSO_PIC_CFLAGS='-fPIC'
873 DSO_LDOPTS='-shared -fPIC'
874 if test "$LIBRUNPATH"; then
875 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
880 MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
885 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
886 MOZ_OPTIMIZE_FLAGS="-O"
889 AC_SUBST_LIST(MMX_FLAGS)
890 AC_SUBST_LIST(SSE_FLAGS)
891 AC_SUBST_LIST(SSE2_FLAGS)
892 AC_SUBST_LIST(SSSE3_FLAGS)
895 if test -n "$MOZ_LINKER"; then
896 AC_DEFINE(MOZ_LINKER)
898 AC_CHECK_PROGS(XZ, xz)
901 if test -z "$COMPILE_ENVIRONMENT"; then
902 SKIP_COMPILER_CHECKS=1
903 SKIP_LIBRARY_CHECKS=1
908 fi # COMPILE_ENVIRONMENT
910 if test -z "$SKIP_COMPILER_CHECKS"; then
911 dnl Checks for typedefs, structures, and compiler characteristics.
912 dnl ========================================================
927 case "${OS_TARGET}" in
931 STL_FLAGS="-I${DIST}/stl_wrappers"
936 if test "$MOZ_BUILD_APP" = "tools/crashreporter"; then
940 dnl Checks for header files.
941 dnl ========================================================
944 bitrig*|dragonfly*|freebsd*|openbsd*)
945 # for stuff like -lXshm
946 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
950 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
951 AC_CACHE_CHECK(for sockaddr_in.sin_len,
952 ac_cv_sockaddr_in_sin_len,
953 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
954 #include <sys/types.h>
956 #include <netinet/in.h>
957 struct sockaddr_in x;
958 void *foo = (void*) &x.sin_len;],
960 [ac_cv_sockaddr_in_sin_len=true],
961 [ac_cv_sockaddr_in_sin_len=false])])
962 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
963 AC_DEFINE(HAVE_SIN_LEN)
964 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
965 AC_DEFINE(HAVE_SCONN_LEN)
968 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
969 ac_cv_sockaddr_in6_sin6_len,
970 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
971 #include <sys/types.h>
973 #include <netinet/in.h>
974 struct sockaddr_in6 x;
975 void *foo = (void*) &x.sin6_len;],
977 [ac_cv_sockaddr_in6_sin6_len=true],
978 [ac_cv_sockaddr_in6_sin6_len=false])])
979 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
980 AC_DEFINE(HAVE_SIN6_LEN)
983 AC_CACHE_CHECK(for sockaddr.sa_len,
984 ac_cv_sockaddr_sa_len,
985 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
986 #include <sys/types.h>
988 #include <sys/socket.h>
990 void *foo = (void*) &x.sa_len;],
992 [ac_cv_sockaddr_sa_len=true],
993 [ac_cv_sockaddr_sa_len=false])])
994 if test "$ac_cv_sockaddr_sa_len" = true ; then
995 AC_DEFINE(HAVE_SA_LEN)
998 MOZ_ARG_ENABLE_BOOL(dtrace,
999 [ --enable-dtrace build with dtrace support if available (default=no)],
1000 [enable_dtrace="yes"],)
1001 if test "x$enable_dtrace" = "xyes"; then
1002 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
1003 if test -n "$HAVE_DTRACE"; then
1004 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
1006 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
1009 AC_SUBST(HAVE_DTRACE)
1011 dnl Checks for libraries.
1012 dnl ========================================================
1013 AC_CHECK_LIB(c_r, gethostbyname_r)
1015 dnl We don't want to link with libdl even if it's present on OS X, since
1016 dnl it's not used and not part of the default installation. OS/2 has dlfcn
1018 dnl We don't want to link against libm or libpthread on Darwin since
1019 dnl they both are just symlinks to libSystem and explicitly linking
1020 dnl against libSystem causes issues when debugging (see bug 299601).
1025 AC_SEARCH_LIBS(dlopen, dl,
1026 MOZ_CHECK_HEADER(dlfcn.h,
1027 AC_DEFINE(HAVE_DLOPEN)))
1031 _SAVE_CFLAGS="$CFLAGS"
1032 CFLAGS="$CFLAGS -D_GNU_SOURCE"
1033 AC_CHECK_FUNCS(dladdr memmem)
1034 CFLAGS="$_SAVE_CFLAGS"
1036 if test ! "$GNU_CXX"; then
1037 AC_CHECK_LIB(C, demangle)
1040 AC_CHECK_LIB(socket, socket)
1043 XLIBS="$X_EXTRA_LIBS"
1045 dnl ========================================================
1046 dnl Checks for X libraries.
1047 dnl Ordering is important.
1048 dnl Xt is dependent upon SM as of X11R6
1049 dnl ========================================================
1050 if test -n "$MOZ_X11"; then
1051 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
1052 _SAVE_LDFLAGS="$LDFLAGS"
1054 LDFLAGS="$XLDFLAGS $LDFLAGS"
1055 AC_CHECK_LIB(X11, XDrawLines, [XLIBS="-lX11 $XLIBS"],
1056 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
1057 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
1058 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
1060 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
1061 unset ac_cv_lib_Xt_XtFree
1062 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
1063 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
1064 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
1065 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
1068 dnl ========================================================
1070 dnl ========================================================
1071 AC_CHECK_LIB(xcb, xcb_connect, [XLIBS="-lxcb $XLIBS"],
1072 [MISSING_X="$MISSING_X -lxcb"], $XLIBS)
1073 AC_CHECK_LIB(xcb-shm, xcb_shm_query_version, [XLIBS="-lxcb-shm $XLIBS"],
1074 [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS)
1075 AC_CHECK_LIB(X11-xcb, XGetXCBConnection, [XLIBS="-lX11-xcb $XLIBS"],
1076 [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS)
1078 LDFLAGS="$_SAVE_LDFLAGS"
1082 AC_SUBST_LIST(XCFLAGS)
1083 AC_SUBST_LIST(XLDFLAGS)
1084 AC_SUBST_LIST(XLIBS)
1085 AC_SUBST_LIST(XEXT_LIBS)
1086 AC_SUBST_LIST(XT_LIBS)
1088 dnl ========================================================
1089 dnl = pthread support
1090 dnl = Start by checking whether the system support pthreads
1091 dnl ========================================================
1092 case "$target_os" in
1097 AC_CHECK_LIB(pthreads, pthread_create,
1098 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
1099 AC_CHECK_LIB(pthread, pthread_create,
1100 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
1101 AC_CHECK_LIB(c_r, pthread_create,
1102 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
1103 AC_CHECK_LIB(c, pthread_create,
1112 dnl ========================================================
1113 dnl Do the platform specific pthread hackery
1114 dnl ========================================================
1115 if test "$MOZ_USE_PTHREADS"x != x
1118 dnl See if -pthread is supported.
1121 ac_cv_have_dash_pthread=no
1122 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
1123 echo 'int main() { return 0; }' | cat > conftest.c
1124 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
1125 if test $? -eq 0; then
1126 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1127 ac_cv_have_dash_pthread=yes
1128 case "$target_os" in
1130 # Freebsd doesn't use -pthread for compiles, it uses them for linking
1133 CFLAGS="$CFLAGS -pthread"
1134 CXXFLAGS="$CXXFLAGS -pthread"
1140 AC_MSG_RESULT($ac_cv_have_dash_pthread)
1143 dnl See if -pthreads is supported.
1145 ac_cv_have_dash_pthreads=no
1146 if test "$ac_cv_have_dash_pthread" = "no"; then
1147 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
1148 echo 'int main() { return 0; }' | cat > conftest.c
1149 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
1150 if test $? -eq 0; then
1151 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1152 ac_cv_have_dash_pthreads=yes
1153 CFLAGS="$CFLAGS -pthreads"
1154 CXXFLAGS="$CXXFLAGS -pthreads"
1158 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
1163 AC_DEFINE(_REENTRANT)
1164 AC_DEFINE(_THREAD_SAFE)
1165 dnl -pthread links in -lpthread, so don't specify it explicitly.
1166 if test "$ac_cv_have_dash_pthread" = "yes"; then
1167 _PTHREAD_LDFLAGS="-pthread"
1171 *-*-openbsd*|*-*-bsdi*)
1172 AC_DEFINE(_REENTRANT)
1173 AC_DEFINE(_THREAD_SAFE)
1174 dnl -pthread links in -lc_r, so don't specify it explicitly.
1175 if test "$ac_cv_have_dash_pthread" = "yes"; then
1176 _PTHREAD_LDFLAGS="-pthread"
1180 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
1181 AC_DEFINE(_REENTRANT)
1185 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
1186 AC_SUBST(MOZ_USE_PTHREADS)
1187 MOZ_CHECK_HEADERS(pthread.h)
1191 dnl Checks for library functions.
1192 dnl ========================================================
1193 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall)
1195 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1196 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1197 ac_cv_clock_monotonic,
1198 [for libs in "" -lrt; do
1200 _SAVE_CFLAGS="$CFLAGS"
1202 CFLAGS="$CFLAGS $DSO_PIC_CFLAGS"
1203 dnl clock_gettime is available on OSX since 10.12, so depending on MACOSX_DEPLOYMENT_TARGET,
1204 dnl we should or not be able to use it. To detect if we can, we need to make the
1205 dnl availability attribute strict, so that compilation fails when the target is < 10.12.
1206 AC_TRY_LINK([#define availability(os, ...) availability(os, strict, __VA_ARGS)
1208 [ struct timespec ts;
1209 clock_gettime(CLOCK_MONOTONIC, &ts); ],
1210 ac_cv_clock_monotonic=$libs
1213 ac_cv_clock_monotonic=no)
1215 CFLAGS="$_SAVE_CFLAGS"
1217 if test "$ac_cv_clock_monotonic" != "no"; then
1218 HAVE_CLOCK_MONOTONIC=1
1219 REALTIME_LIBS=$ac_cv_clock_monotonic
1220 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1221 AC_SUBST(HAVE_CLOCK_MONOTONIC)
1222 AC_SUBST_LIST(REALTIME_LIBS)
1225 dnl Turn on warnings-as-errors to prevent implicit declaration of
1226 dnl pthread_cond_timedwait_monotonic_np, which can cause this test to
1227 dnl inadvertently pass even if the function does not really exist.
1228 _SAVE_CFLAGS="$CFLAGS"
1229 CFLAGS="$CFLAGS $WARNINGS_AS_ERRORS"
1230 AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
1231 ac_cv_pthread_cond_timedwait_monotonic_np,
1232 AC_TRY_LINK([#include <pthread.h>],
1233 [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
1234 ac_cv_pthread_cond_timewait_monotonic_np=yes,
1235 ac_cv_pthread_cond_timewait_monotonic_np=no))
1236 if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
1237 AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
1239 CFLAGS=$_SAVE_CFLAGS
1243 ac_cv_func_res_ninit,
1244 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
1245 dnl no need for res_ninit() on NetBSD and OpenBSD
1246 ac_cv_func_res_ninit=no
1250 #define _BSD_SOURCE 1
1252 #include <sys/types.h>
1253 #include <netinet/in.h>
1254 #include <arpa/nameser.h>
1257 [int foo = res_ninit(&_res);],
1258 [ac_cv_func_res_ninit=yes],
1259 [ac_cv_func_res_ninit=no])
1263 if test "$ac_cv_func_res_ninit" = "yes"; then
1264 AC_DEFINE(HAVE_RES_NINIT)
1265 dnl must add the link line we do something as foolish as this... dougt
1267 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
1268 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
1273 dnl **********************
1274 dnl *** va_copy checks ***
1275 AC_CACHE_CHECK([for an implementation of va_copy()],
1277 [AC_TRY_COMPILE([#include <stdarg.h>
1279 void f (int i, ...) {
1280 va_list args1, args2;
1281 va_start (args1, i);
1282 va_copy (args2, args1);
1283 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1285 va_end (args1); va_end (args2);
1287 [f(0, 42); return 0],
1288 [ac_cv_va_copy=yes],
1292 AC_CACHE_CHECK([whether va_list can be copied by value],
1294 [AC_TRY_COMPILE([#include <stdarg.h>
1296 void f (int i, ...) {
1297 va_list args1, args2;
1298 va_start (args1, i);
1300 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1302 va_end (args1); va_end (args2);
1304 [f(0, 42); return 0],
1305 [ac_cv_va_val_copy=yes],
1306 [ac_cv_va_val_copy=no],
1309 if test "x$ac_cv_va_copy" = "xyes"; then
1310 AC_DEFINE(VA_COPY, va_copy)
1311 AC_DEFINE(HAVE_VA_COPY)
1314 if test "x$ac_cv_va_val_copy" = "xno"; then
1315 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
1318 dnl ===================================================================
1319 dnl ========================================================
1320 dnl Put your C++ language/feature checks below
1321 dnl ========================================================
1325 if test "$GNU_CC"; then
1326 if test "$CPU_ARCH" = "arm" ; then
1327 AC_CACHE_CHECK(for ARM EABI,
1331 #if defined(__ARM_EABI__)
1334 #error Not ARM EABI.
1337 ac_cv_gcc_arm_eabi="yes",
1338 ac_cv_gcc_arm_eabi="no")])
1339 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
1341 ARM_ABI_PREFIX=eabi-
1343 ARM_ABI_PREFIX=oabi-
1347 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
1350 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
1351 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
1352 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
1354 _SAVE_LDFLAGS=$LDFLAGS
1355 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
1356 AC_CACHE_CHECK(for __thread keyword for TLS variables,
1357 ac_cv_thread_keyword,
1358 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
1359 [return tlsIsMainThread;],
1360 ac_cv_thread_keyword=yes,
1361 ac_cv_thread_keyword=no)])
1362 LDFLAGS=$_SAVE_LDFLAGS
1363 # The custom dynamic linker doesn't support TLS variables
1365 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
1366 # mips builds fail with TLS variables because of a binutils bug.
1368 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
1373 *-android*|*-linuxandroid*)
1380 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
1386 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
1387 if test -n "$MOZ_LINKER"; then
1388 if test "$CPU_ARCH" = arm; then
1389 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
1390 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
1391 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1392 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1396 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
1397 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
1398 dnl Since the linker only understands the sysv ones, no need to build the
1399 dnl gnu style tables anyways.
1400 LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
1403 dnl End of C++ language/feature checks
1406 dnl ========================================================
1407 dnl = Internationalization checks
1408 dnl ========================================================
1410 dnl Internationalization and Locale support is different
1411 dnl on various UNIX platforms. Checks for specific i18n
1412 dnl features go here.
1414 AC_HAVE_FUNCS(localeconv)
1416 fi # ! SKIP_COMPILER_CHECKS
1418 if test -n "${COMPILE_ENVIRONMENT}"; then
1423 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1424 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1425 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1428 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1429 dnl features that Windows actually does support.
1431 if test -n "$SKIP_COMPILER_CHECKS"; then
1432 dnl Windows has malloc.h
1433 AC_DEFINE(MALLOC_H, [<malloc.h>])
1434 AC_DEFINE(HAVE_FORCEINLINE)
1435 AC_DEFINE(HAVE_LOCALECONV)
1436 fi # SKIP_COMPILER_CHECKS
1438 dnl Mozilla specific options
1439 dnl ========================================================
1440 dnl The macros used for command line options
1441 dnl are defined in build/autoconf/altoptions.m4.
1443 dnl ========================================================
1445 dnl = Check for external package dependencies
1447 dnl ========================================================
1448 MOZ_ARG_HEADER(External Packages)
1450 case "$OS_TARGET" in
1451 WINNT|Darwin|Android)
1461 dnl ========================================================
1462 dnl system libevent Support
1463 dnl ========================================================
1464 MOZ_ARG_WITH_STRING(system-libevent,
1465 [ --with-system-libevent[=PFX]
1466 Use system libevent [installed at prefix PFX]],
1467 LIBEVENT_DIR=$withval)
1469 _SAVE_CFLAGS=$CFLAGS
1470 _SAVE_LDFLAGS=$LDFLAGS
1472 if test "$LIBEVENT_DIR" = yes; then
1473 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
1474 MOZ_SYSTEM_LIBEVENT=1,
1477 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
1478 MOZ_SYSTEM_LIBEVENT=
1479 elif test -z "$MOZ_SYSTEM_LIBEVENT"; then
1480 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
1481 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
1482 MOZ_CHECK_HEADER(event.h,
1483 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
1484 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
1486 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
1487 AC_CHECK_LIB(event, event_init,
1488 [MOZ_SYSTEM_LIBEVENT=1
1489 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
1490 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
1491 [MOZ_SYSTEM_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
1493 CFLAGS=$_SAVE_CFLAGS
1494 LDFLAGS=$_SAVE_LDFLAGS
1497 AC_SUBST(MOZ_SYSTEM_LIBEVENT)
1499 dnl ========================================================
1500 dnl = If NSS was not detected in the system,
1501 dnl = use the one in the source tree (mozilla/security/nss)
1502 dnl ========================================================
1504 MOZ_ARG_WITH_BOOL(system-nss,
1505 [ --with-system-nss Use system installed NSS],
1508 if test -n "$_USE_SYSTEM_NSS"; then
1509 AM_PATH_NSS(3.52, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
1512 NSS_CFLAGS="$NSS_CFLAGS -I${DIST}/include/nss"
1513 if test -z "$MOZ_SYSTEM_NSS"; then
1514 case "${OS_ARCH}" in
1515 # Only few platforms have been tested with GYP
1516 WINNT|Darwin|Linux|DragonFly|FreeBSD|NetBSD|OpenBSD|SunOS)
1519 AC_MSG_ERROR([building in-tree NSS is not supported on this platform. Use --with-system-nss])
1524 dnl system ZLIB support
1525 dnl ========================================================
1526 MOZ_ZLIB_CHECK([1.2.3])
1528 if test -z "$SKIP_LIBRARY_CHECKS"; then
1530 dnl ========================================================
1531 dnl system PNG Support
1532 dnl ========================================================
1533 MOZ_ARG_WITH_STRING(system-png,
1534 [ --with-system-png[=PFX]
1535 Use system libpng [installed at prefix PFX]],
1538 _SAVE_CFLAGS=$CFLAGS
1539 _SAVE_LDFLAGS=$LDFLAGS
1541 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
1542 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
1543 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
1545 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
1548 AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"],
1549 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1550 AC_CHECK_LIB(png, png_get_acTL, ,
1551 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
1553 if test "$MOZ_SYSTEM_PNG" = 1; then
1554 AC_TRY_COMPILE([ #include <stdio.h>
1555 #include <sys/types.h>
1557 [ #if PNG_LIBPNG_VER < $MOZPNG
1558 #error "Insufficient libpng version ($MOZPNG required)."
1560 #ifndef PNG_UINT_31_MAX
1561 #error "Insufficient libpng version."
1564 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1566 CFLAGS=$_SAVE_CFLAGS
1567 LDFLAGS=$_SAVE_LDFLAGS
1570 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then
1571 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
1572 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
1575 fi # SKIP_LIBRARY_CHECKS
1577 dnl ========================================================
1581 dnl ========================================================
1583 MOZ_ARG_HEADER(Application)
1585 ENABLE_SYSTEM_EXTENSION_DIRS=1
1586 MOZ_BRANDING_DIRECTORY=
1587 MOZ_OFFICIAL_BRANDING=
1588 MOZ_AUTH_EXTENSION=1
1589 if test "$MOZ_IOS"; then
1592 MOZ_PREF_EXTENSIONS=1
1594 MOZ_UNIVERSALCHARDET=1
1598 MOZ_USE_NATIVE_POPUP_WINDOWS=
1599 MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
1601 MOZ_BINARY_EXTENSIONS=
1604 case "$target_os" in
1607 AC_DEFINE(NS_ENABLE_TSF)
1611 # Optional Firefox for Android partner distribution directory.
1612 MOZ_ARG_WITH_STRING(android-distribution-directory,
1613 [ --with-android-distribution-directory=dir
1614 Optional Firefox for Android partner distribution directory.],
1615 MOZ_ANDROID_DISTRIBUTION_DIRECTORY=$withval)
1617 if test -n "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY"; then
1618 # A distribution directory must have an assets/distribution directory.
1619 # See https://wiki.mozilla.org/Mobile/Distribution_Files.
1620 if test ! -d "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY/assets/distribution" ; then
1621 AC_MSG_ERROR([--with-android-distribution-directory does not contain assets/distribution;
1622 (looked for ${MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets/distribution).])
1625 AC_SUBST(MOZ_ANDROID_DISTRIBUTION_DIRECTORY)
1627 dnl ========================================================
1628 dnl = Trademarked Branding
1629 dnl ========================================================
1630 MOZ_ARG_ENABLE_BOOL(official-branding,
1631 [ --enable-official-branding
1632 Enable Official mozilla.org Branding
1633 Do not distribute builds with
1634 --enable-official-branding unless you have
1635 permission to use trademarks per
1636 http://www.mozilla.org/foundation/trademarks/ .],
1637 MOZ_OFFICIAL_BRANDING=1,
1638 MOZ_OFFICIAL_BRANDING=)
1640 # Allow the application to influence configure with a confvars.sh script.
1641 AC_MSG_CHECKING([if app-specific confvars.sh exists])
1642 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
1643 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
1644 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
1649 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
1650 MOZ_ARG_WITH_STRING(app-name,
1651 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
1652 WITH_APP_NAME=$withval,
1655 if test -n "$WITH_APP_NAME" ; then
1656 MOZ_APP_NAME="$WITH_APP_NAME"
1659 MOZ_ARG_WITH_STRING(app-basename,
1660 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
1661 WITH_APP_BASENAME=$withval,
1664 if test -n "$WITH_APP_BASENAME" ; then
1665 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
1668 dnl ========================================================
1669 dnl Ensure Android SDK and build-tools versions depending on
1671 dnl ========================================================
1673 case "$MOZ_BUILD_APP" in
1679 dnl ========================================================
1681 dnl = Toolkit Options
1683 dnl ========================================================
1684 MOZ_ARG_HEADER(Toolkit Options)
1686 dnl ========================================================
1687 dnl = Enable the toolkit as needed =
1688 dnl ========================================================
1690 case "$MOZ_WIDGET_TOOLKIT" in
1693 LDFLAGS="$LDFLAGS -framework Cocoa"
1694 # Use -Wl as a trick to avoid -framework and framework names from
1695 # being separated by AC_SUBST_LIST.
1696 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'
1698 CFLAGS="$CFLAGS $TK_CFLAGS"
1699 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1700 MOZ_USER_DIR="Mozilla"
1701 MOZ_FS_LAYOUT=bundle
1705 LDFLAGS="$LDFLAGS -framework UIKit"
1707 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'
1708 CFLAGS="$CFLAGS $TK_CFLAGS"
1709 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1710 MOZ_USER_DIR="Mozilla"
1711 MOZ_FS_LAYOUT=bundle
1716 if test "$OS_TARGET" = Darwin; then
1717 LDFLAGS="$LDFLAGS -lobjc"
1720 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
1721 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
1722 case "$MOZ_WIDGET_TOOLKIT" in
1728 if test "$COMPILE_ENVIRONMENT"; then
1729 if test "$MOZ_WIDGET_TOOLKIT" = gtk; then
1730 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)
1731 MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
1732 TK_CFLAGS=$MOZ_GTK3_CFLAGS
1733 TK_LIBS=$MOZ_GTK3_LIBS
1734 dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
1735 dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
1736 AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
1737 GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32
1739 if test "$MOZ_ENABLE_GTK"; then
1740 if test "$MOZ_X11"; then
1741 GDK_PACKAGES=gdk-x11-2.0
1743 AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
1744 AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
1746 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)
1747 MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
1749 fi # COMPILE_ENVIRONMENT
1751 AC_SUBST(MOZ_FS_LAYOUT)
1753 AC_SUBST_LIST(TK_CFLAGS)
1754 AC_SUBST_LIST(TK_LIBS)
1756 dnl ========================================================
1758 dnl = Components & Features
1760 dnl ========================================================
1761 MOZ_ARG_HEADER(Components and Features)
1763 AC_SUBST(MOZ_OFFICIAL_BRANDING)
1764 if test -n "$MOZ_OFFICIAL_BRANDING"; then
1765 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
1766 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
1768 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
1769 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
1773 MOZ_ARG_WITH_STRING(branding,
1774 [ --with-branding=dir Use branding from the specified directory.],
1775 MOZ_BRANDING_DIRECTORY=$withval)
1777 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
1778 if test -z "$REAL_BRANDING_DIRECTORY"; then
1779 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
1782 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1783 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
1784 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1785 . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
1788 AC_SUBST(MOZ_BRANDING_DIRECTORY)
1790 dnl ========================================================
1791 dnl = Distribution ID
1792 dnl ========================================================
1793 MOZ_ARG_WITH_STRING(distribution-id,
1794 [ --with-distribution-id=ID
1795 Set distribution-specific id (default=org.mozilla)],
1796 [ val=`echo $withval`
1797 MOZ_DISTRIBUTION_ID="$val"])
1799 if test -z "$MOZ_DISTRIBUTION_ID"; then
1800 MOZ_DISTRIBUTION_ID="org.mozilla"
1803 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
1804 AC_SUBST(MOZ_DISTRIBUTION_ID)
1806 dnl ========================================================
1807 dnl = libproxy support
1808 dnl ========================================================
1810 if test "$MOZ_ENABLE_GTK"
1812 MOZ_ENABLE_LIBPROXY=
1814 MOZ_ARG_ENABLE_BOOL(libproxy,
1815 [ --enable-libproxy Enable libproxy support ],
1816 MOZ_ENABLE_LIBPROXY=1,
1817 MOZ_ENABLE_LIBPROXY=)
1819 if test "$MOZ_ENABLE_LIBPROXY"
1821 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
1822 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
1825 AC_SUBST(MOZ_ENABLE_LIBPROXY)
1827 dnl ========================================================
1829 dnl ========================================================
1831 if test "$MOZ_ENABLE_GTK"
1835 MOZ_ARG_DISABLE_BOOL(dbus,
1836 [ --disable-dbus Disable dbus support ],
1840 if test "$MOZ_ENABLE_DBUS"
1842 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
1843 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
1844 AC_DEFINE(MOZ_ENABLE_DBUS)
1847 AC_SUBST(MOZ_ENABLE_DBUS)
1849 dnl =========================================================
1850 dnl = Whether to exclude hyphenations files in the build
1851 dnl =========================================================
1852 if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
1853 AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
1856 AC_TRY_COMPILE([#include <linux/ethtool.h>],
1857 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
1858 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
1860 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
1862 if test -n "$MOZ_WEBRTC"; then
1863 if test -n "$MOZ_X11"; then
1864 MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
1868 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
1870 dnl ========================================================
1871 dnl = Apple platform decoder support
1872 dnl ========================================================
1873 if test "$COMPILE_ENVIRONMENT"; then
1874 if test -n "$MOZ_APPLEMEDIA"; then
1875 # hack in frameworks for fmp4 - see bug 1029974
1876 # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
1877 LDFLAGS="$LDFLAGS -framework AudioToolbox"
1878 dnl Verify CoreMedia is available.
1879 AC_CHECK_HEADERS([CoreMedia/CoreMedia.h VideoToolbox/VideoToolbox.h], [],
1880 [AC_MSG_ERROR([MacOS X 10.9 SDK or later is required])])
1882 fi # COMPILE_ENVIRONMENT
1884 dnl ========================================================
1885 dnl = Handle dependent MEDIA defines
1886 dnl ========================================================
1889 AC_DEFINE(MOZ_WEBM_ENCODER)
1890 AC_SUBST(MOZ_WEBM_ENCODER)
1892 dnl ========================================================
1894 dnl ========================================================
1896 MOZ_ARG_DISABLE_BOOL(negotiateauth,
1897 [ --disable-negotiateauth Disable GSS-API negotiation ],
1898 MOZ_AUTH_EXTENSION=,
1899 MOZ_AUTH_EXTENSION=1 )
1901 if test -n "$MOZ_IOS" -a -n "$MOZ_AUTH_EXTENSION"; then
1902 AC_MSG_ERROR([negotiateauth is not supported on iOS.])
1905 dnl ========================================================
1906 dnl Pref extensions (autoconfig)
1907 dnl ========================================================
1908 MOZ_ARG_DISABLE_BOOL(pref-extensions,
1909 [ --disable-pref-extensions
1910 Disable pref extensions such as autoconfig],
1911 MOZ_PREF_EXTENSIONS=,
1912 MOZ_PREF_EXTENSIONS=1 )
1914 dnl ========================================================
1915 dnl Searching of system directories for extensions.
1916 dnl Note: this switch is meant to be used for test builds
1917 dnl whose behavior should not depend on what happens to be
1918 dnl installed on the local machine.
1919 dnl ========================================================
1920 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
1921 [ --disable-system-extension-dirs
1922 Disable searching system- and account-global
1923 directories for extensions of any kind; use
1924 only profile-specific extension directories],
1925 ENABLE_SYSTEM_EXTENSION_DIRS=,
1926 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
1927 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
1928 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
1931 dnl ========================================================
1932 dnl = Universalchardet
1933 dnl ========================================================
1934 MOZ_ARG_DISABLE_BOOL(universalchardet,
1935 [ --disable-universalchardet
1936 Disable universal encoding detection],
1937 MOZ_UNIVERSALCHARDET=,
1938 MOZ_UNIVERSALCHARDET=1 )
1940 dnl ========================================================
1942 dnl ========================================================
1944 if test "$COMPILE_ENVIRONMENT" ; then
1946 dnl Moved gamepad platform check to moz.build, linux header check still needed here.
1947 if test "$OS_TARGET" = "Linux"; then
1948 MOZ_CHECK_HEADER([linux/joystick.h])
1949 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
1950 AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
1954 fi # COMPILE_ENVIRONMENT
1957 dnl ========================================================
1958 dnl = Breakpad crash reporting (on by default on supported platforms)
1959 dnl ========================================================
1962 i?86-*-mingw*|x86_64-*-mingw*|aarch64-*-mingw*)
1965 i?86-apple-darwin*|x86_64-apple-darwin*)
1966 if test -z "$MOZ_IOS"; then
1970 *-android*|*-linuxandroid*)
1971 dnl Android/arm is arm-unknown-linux-androideabi, so android condition should
1972 dnl be before Linux condition
1975 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
1976 if test "$MOZ_ENABLE_GTK"; then
1982 MOZ_ARG_DISABLE_BOOL(crashreporter,
1983 [ --disable-crashreporter Disable breakpad crash reporting],
1984 [MOZ_CRASHREPORTER=],
1985 [MOZ_CRASHREPORTER=F # Force enable breakpad])
1987 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin" -a "$MOZ_WIDGET_TOOLKIT" != "android"; then
1988 if test "$MOZ_CRASHREPORTER" = F; then
1989 AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
1994 if test -n "$MOZ_CRASHREPORTER"; then
1995 AC_DEFINE(MOZ_CRASHREPORTER)
1997 if test "$OS_TARGET" = "Linux" && \
1998 test -z "$SKIP_LIBRARY_CHECKS"; then
1999 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
2002 if test "$OS_ARCH" = "WINNT"; then
2003 if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
2004 MOZ_CRASHREPORTER_INJECTOR=1
2005 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
2010 dnl ========================================================
2011 dnl = Enable compilation of specific extension modules
2012 dnl ========================================================
2014 MOZ_ARG_ENABLE_STRING(extensions,
2015 [ --enable-extensions Enable extensions],
2016 [ for option in `echo $enableval | sed 's/,/ /g'`; do
2017 if test "$option" = "yes" -o "$option" = "all"; then
2018 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
2019 elif test "$option" = "no" -o "$option" = "none"; then
2021 elif test "$option" = "default"; then
2022 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
2023 elif test `echo "$option" | grep -c \^-` != 0; then
2024 option=`echo $option | sed 's/^-//'`
2025 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
2027 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
2030 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
2032 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
2033 dnl when trying to build a nonexistent extension.
2034 for extension in $MOZ_EXTENSIONS; do
2035 if test ! -d "${srcdir}/extensions/${extension}"; then
2036 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
2040 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
2041 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
2044 # Avoid defining MOZ_ENABLE_CAIRO_FT on Windows platforms because
2045 # "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
2046 if test -n "$MOZ_TREE_FREETYPE" -a "$OS_TARGET" != WINNT; then
2047 MOZ_ENABLE_CAIRO_FT=1
2048 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2049 CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
2050 AC_SUBST_LIST(CAIRO_FT_CFLAGS)
2053 AC_CHECK_PROGS(WGET, wget, "")
2056 dnl ========================================================
2058 dnl ========================================================
2060 if test "$MOZ_IOS"; then
2064 MOZ_ARG_DISABLE_BOOL(updater,
2065 [ --disable-updater Disable building of updater],
2069 if test -n "$MOZ_UPDATER"; then
2070 AC_DEFINE(MOZ_UPDATER)
2073 dnl ========================================================
2074 dnl parental controls (for Windows Vista)
2075 dnl ========================================================
2076 MOZ_ARG_DISABLE_BOOL(parental-controls,
2077 [ --disable-parental-controls
2078 Do not build parental controls],
2079 MOZ_DISABLE_PARENTAL_CONTROLS=1,
2080 MOZ_DISABLE_PARENTAL_CONTROLS=)
2081 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
2082 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
2085 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
2087 dnl ========================================================
2088 dnl = Disable smartcard support
2089 dnl ========================================================
2090 if test -n "$MOZ_NO_SMART_CARDS"; then
2091 AC_DEFINE(MOZ_NO_SMART_CARDS)
2093 AC_SUBST(MOZ_NO_SMART_CARDS)
2095 dnl ========================================================
2096 dnl = Sandboxing support
2097 dnl ========================================================
2098 if test -n "$MOZ_TSAN" -o -n "$MOZ_ASAN"; then
2099 # Bug 1182565: TSan conflicts with sandboxing on Linux.
2100 # Bug 1287971: LSan also conflicts with sandboxing on Linux.
2108 MOZ_ARG_DISABLE_BOOL(sandbox,
2109 [ --disable-sandbox Disable sandboxing support],
2113 case "$OS_TARGET" in
2114 WINNT|Darwin|OpenBSD)
2120 # Linux sandbox is only available on x86 and x86_64.
2127 # Only enable the sandbox by default on Linux, OpenBSD, macOS, and Windows
2132 if test -n "$MOZ_SANDBOX"; then
2133 AC_DEFINE(MOZ_SANDBOX)
2136 AC_SUBST(MOZ_SANDBOX)
2139 dnl ========================================================
2141 dnl = Module specific options
2143 dnl ========================================================
2144 MOZ_ARG_HEADER(Individual module options)
2146 dnl ==============================
2147 dnl === SQLite fdatasync check ===
2148 dnl ==============================
2149 dnl Check to see if fdatasync is available and make use of it
2150 AC_CHECK_FUNC(fdatasync)
2152 dnl ========================================================
2153 dnl = Disable zipwriter
2154 dnl ========================================================
2155 MOZ_ARG_DISABLE_BOOL(zipwriter,
2156 [ --disable-zipwriter Disable zipwriter component],
2159 AC_SUBST(MOZ_ZIPWRITER)
2161 dnl ========================================================
2163 dnl = Feature options that require extra sources to be pulled
2165 dnl ========================================================
2166 dnl MOZ_ARG_HEADER(Features that require extra sources)
2168 dnl ========================================================
2170 dnl = Runtime debugging and Optimization Options
2172 dnl ========================================================
2173 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
2175 dnl ========================================================
2176 dnl enable mobile optimizations
2177 dnl ========================================================
2178 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
2179 [ --enable-mobile-optimize
2180 Enable mobile optimizations],
2181 MOZ_GFX_OPTIMIZE_MOBILE=1)
2183 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
2185 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
2186 # We ignore paint will resample on mobile for performance.
2187 # We may want to revisit this later.
2188 MOZ_IGNORE_PAINT_WILL_RESAMPLE=1
2190 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
2191 AC_DEFINE(MOZ_IGNORE_PAINT_WILL_RESAMPLE)
2194 dnl ========================================================
2195 dnl = Enable code optimization. ON by default.
2196 dnl ========================================================
2198 # Use value from moz.configure if one is defined. Else use our computed
2200 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
2201 MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
2204 if test "$COMPILE_ENVIRONMENT"; then
2205 if test -n "$MOZ_OPTIMIZE"; then
2206 AC_MSG_CHECKING([for valid C compiler optimization flags])
2207 _SAVE_CFLAGS=$CFLAGS
2208 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
2209 AC_TRY_COMPILE([#include <stdio.h>],
2210 [printf("Hello World\n");],
2213 AC_MSG_RESULT([$_results])
2214 if test "$_results" = "no"; then
2215 AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
2217 CFLAGS=$_SAVE_CFLAGS
2218 if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
2219 # When using llvm-based LTO, non numeric optimization levels are
2220 # not supported by the linker, so force the linker to use -O2 (
2221 # which doesn't influence the level compilation units are actually
2223 case " $MOZ_OPTIMIZE_FLAGS " in
2224 *\ -Os\ *|*\ -Oz\ *)
2225 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
2230 fi # COMPILE_ENVIRONMENT
2232 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
2233 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
2234 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
2236 dnl ========================================================
2237 dnl = Enable runtime logging
2238 dnl ========================================================
2239 AC_DEFINE(MOZ_LOGGING)
2240 AC_DEFINE(FORCE_PR_LOG)
2242 dnl ========================================================
2243 dnl = This will enable logging of addref, release, ctor, dtor.
2244 dnl ========================================================
2245 _ENABLE_LOGREFCNT=42
2246 MOZ_ARG_ENABLE_BOOL(logrefcnt,
2247 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
2248 _ENABLE_LOGREFCNT=1,
2249 _ENABLE_LOGREFCNT= )
2250 if test "$_ENABLE_LOGREFCNT" = "1"; then
2251 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
2252 elif test -z "$_ENABLE_LOGREFCNT"; then
2253 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
2256 dnl ========================================================
2257 dnl moz_dump_painting
2258 dnl ========================================================
2259 MOZ_ARG_ENABLE_BOOL(dump-painting,
2260 [ --enable-dump-painting Enable paint debugging.],
2261 MOZ_DUMP_PAINTING=1,
2262 MOZ_DUMP_PAINTING= )
2263 if test -n "$MOZ_DUMP_PAINTING"; then
2264 AC_DEFINE(MOZ_DUMP_PAINTING)
2265 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
2267 if test -n "$MOZ_DEBUG"; then
2268 AC_DEFINE(MOZ_DUMP_PAINTING)
2271 case "${OS_TARGET}" in
2272 Android|WINNT|Darwin)
2273 MOZ_GLUE_IN_PROGRAM=
2276 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
2277 MOZ_GLUE_IN_PROGRAM=1
2278 AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
2282 dnl ========================================================
2283 dnl = Jemalloc build setup
2284 dnl ========================================================
2285 if test -z "$MOZ_MEMORY"; then
2288 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
2289 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.])
2294 dnl The generic feature tests that determine how to compute ncpus are long and
2295 dnl complicated. Therefore, simply define special cpp variables for the
2296 dnl platforms we have special knowledge of.
2299 export MOZ_NO_DEBUG_RTL=1
2303 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
2305 dnl ========================================================
2306 dnl = Enable using the clang plugin to build
2307 dnl ========================================================
2309 if test -n "$COMPILE_ENVIRONMENT"; then
2310 MOZ_CONFIG_CLANG_PLUGIN
2311 fi # COMPILE_ENVIRONMENT
2313 dnl ========================================================
2314 dnl = Enable stripping of libs & executables
2315 dnl ========================================================
2316 MOZ_ARG_ENABLE_BOOL(strip,
2317 [ --enable-strip Enable stripping of libs & executables ],
2321 dnl ========================================================
2322 dnl = Enable stripping of libs & executables when packaging
2323 dnl ========================================================
2324 MOZ_ARG_ENABLE_BOOL(install-strip,
2325 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
2329 dnl ========================================================
2330 dnl = frontend JS debug mode
2331 dnl ========================================================
2333 MOZ_ARG_ENABLE_BOOL(debug-js-modules,
2334 [ --enable-debug-js-modules Enable debug mode for frontend JS libraries],
2338 AC_SUBST(DEBUG_JS_MODULES)
2340 dnl ========================================================
2342 dnl = Profiling and Instrumenting
2344 dnl ========================================================
2345 MOZ_ARG_HEADER(Profiling and Instrumenting)
2347 dnl ========================================================
2348 dnl = Offer a way to disable the startup cache
2349 dnl ========================================================
2351 MOZ_ARG_DISABLE_BOOL(startupcache,
2352 [ --disable-startupcache Disable startup cache ],
2353 MOZ_DISABLE_STARTUPCACHE=1,
2354 MOZ_DISABLE_STARTUPCACHE=)
2356 if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
2357 AC_DEFINE(MOZ_DISABLE_STARTUPCACHE)
2359 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
2361 dnl ========================================================
2362 dnl = Support for demangling undefined symbols
2363 dnl ========================================================
2364 if test -z "$SKIP_LIBRARY_CHECKS"; then
2367 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
2371 # Demangle only for debug or DMD builds
2372 MOZ_DEMANGLE_SYMBOLS=
2373 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
2374 MOZ_DEMANGLE_SYMBOLS=1
2375 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
2377 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
2379 dnl ========================================================
2380 dnl = Support for gcc stack unwinding (from gcc 3.3)
2381 dnl ========================================================
2382 if test -z "$SKIP_LIBRARY_CHECKS"; then
2385 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
2389 dnl ========================================================
2391 dnl ========================================================
2393 MOZ_ARG_WITH_STRING(jitreport-granularity,
2394 [ --jitreport-granularity=N
2395 Default granularity at which to report JIT code
2398 1 - code ranges for whole functions only
2399 2 - per-line information
2400 3 - per-op information],
2401 JITREPORT_GRANULARITY=$withval,
2402 JITREPORT_GRANULARITY=3)
2404 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
2406 dnl ========================================================
2410 dnl ========================================================
2411 MOZ_ARG_HEADER(Misc. Options)
2413 dnl ========================================================
2414 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
2415 dnl ========================================================
2416 MOZ_ARG_WITH_STRING(user-appdir,
2417 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
2418 [ val=`echo $withval`
2419 if echo "$val" | grep "\/" >/dev/null; then
2420 AC_MSG_ERROR("Homedir must be single relative path.")
2425 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
2427 if test -z "$SKIP_COMPILER_CHECKS"; then
2428 dnl ========================================================
2430 dnl = Compiler Options
2432 dnl ========================================================
2433 MOZ_ARG_HEADER(Compiler Options)
2435 dnl ========================================================
2436 dnl Check for gcc -pipe support
2437 dnl ========================================================
2438 AC_MSG_CHECKING([for -pipe support])
2439 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
2440 dnl Any gcc that supports firefox supports -pipe.
2441 CFLAGS="$CFLAGS -pipe"
2442 CXXFLAGS="$CXXFLAGS -pipe"
2443 AC_MSG_RESULT([yes])
2448 fi # ! SKIP_COMPILER_CHECKS
2452 if test "$COMPILE_ENVIRONMENT"; then
2454 fi # COMPILE_ENVIRONMENT
2456 dnl ========================================================
2458 dnl = Static Build Options
2460 dnl ========================================================
2461 MOZ_ARG_HEADER(Static build options)
2463 if test -z "$MOZ_SYSTEM_ZLIB"; then
2464 if test -n "$JS_SHARED_LIBRARY" -o -n "$MOZ_LINKER" -o "$MOZ_WIDGET_TOOLKIT" = android; then
2466 AC_DEFINE(ZLIB_IN_MOZGLUE)
2470 AC_SUBST(ZLIB_IN_MOZGLUE)
2472 dnl ========================================================
2474 dnl = Standalone module options
2476 dnl ========================================================
2477 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
2480 dnl ========================================================
2482 if test -z "$SKIP_PATH_CHECKS"; then
2483 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
2484 if test "$MOZ_ENABLE_GTK" ; then
2485 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
2490 if test -z "${GLIB_GMODULE_LIBS}" \
2491 -a -n "${GLIB_CONFIG}"\
2492 -a "${GLIB_CONFIG}" != no\
2494 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
2497 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
2499 if test "$USE_FC_FREETYPE"; then
2500 if test "$COMPILE_ENVIRONMENT"; then
2501 dnl ========================================================
2502 dnl = Check for freetype2 functionality
2503 dnl ========================================================
2504 if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
2506 _SAVE_CFLAGS="$CFLAGS"
2507 LIBS="$LIBS $FT2_LIBS"
2508 CFLAGS="$CFLAGS $FT2_CFLAGS"
2510 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
2511 ac_cv_member_FT_Bitmap_Size_y_ppem,
2512 [AC_TRY_COMPILE([#include <ft2build.h>
2513 #include FT_FREETYPE_H],
2515 if (sizeof s.y_ppem) return 0;
2517 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
2518 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
2519 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
2520 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
2522 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
2524 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
2525 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
2526 [FT_Bitmap_Size structure includes y_ppem field])
2528 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
2531 CFLAGS="$_SAVE_CFLAGS"
2534 _SAVE_CPPFLAGS="$CPPFLAGS"
2535 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
2536 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
2537 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
2538 CPPFLAGS="$_SAVE_CPPFLAGS"
2542 dnl ========================================================
2543 dnl Check if we need the 32-bit Linux SSE2 error dialog
2544 dnl ========================================================
2546 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
2548 dnl ========================================================
2549 dnl Check for pixman and cairo
2550 dnl ========================================================
2553 MOZ_ARG_ENABLE_BOOL(system-cairo,
2554 [ --enable-system-cairo Obsolete: do not use this option],
2555 AC_MSG_ERROR(--enable-system-cairo is not supported),
2559 MOZ_ARG_ENABLE_BOOL(system-pixman,
2560 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
2562 MOZ_TREE_PIXMAN=force,
2565 if test "$MOZ_TREE_PIXMAN"; then
2566 AC_DEFINE(MOZ_TREE_PIXMAN)
2568 PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.19.2)
2571 MOZ_CAIRO_CFLAGS="-I${DIST}/include/cairo"
2572 AC_DEFINE(MOZ_TREE_CAIRO)
2574 if test "$OS_ARCH" = "WINNT"; then
2575 # For now we assume that we will have a uint64_t available through
2576 # one of the above headers or mozstdint.h.
2577 AC_DEFINE(HAVE_UINT64_T)
2580 # Define macros for cairo-features.h
2581 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
2582 if test "$MOZ_X11"; then
2583 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
2584 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
2585 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
2587 if test "$_HAVE_FREETYPE2"; then
2588 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2589 MOZ_ENABLE_CAIRO_FT=1
2590 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
2593 case "$MOZ_WIDGET_TOOLKIT" in
2595 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
2596 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
2597 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
2600 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
2601 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
2602 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
2604 if test "$COMPILE_ENVIRONMENT"; then
2605 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
2609 if test "$USE_FC_FREETYPE"; then
2610 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
2612 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
2613 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
2615 AC_SUBST(PS_SURFACE_FEATURE)
2616 AC_SUBST(SVG_SURFACE_FEATURE)
2617 AC_SUBST(XLIB_SURFACE_FEATURE)
2618 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
2619 AC_SUBST(QUARTZ_SURFACE_FEATURE)
2620 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
2621 AC_SUBST(WIN32_SURFACE_FEATURE)
2622 AC_SUBST(OS2_SURFACE_FEATURE)
2623 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
2624 AC_SUBST(FT_FONT_FEATURE)
2625 AC_SUBST(FC_FONT_FEATURE)
2626 AC_SUBST(WIN32_FONT_FEATURE)
2627 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
2628 AC_SUBST(QUARTZ_FONT_FEATURE)
2629 AC_SUBST(PNG_FUNCTIONS_FEATURE)
2630 AC_SUBST(QT_SURFACE_FEATURE)
2631 AC_SUBST(TEE_SURFACE_FEATURE)
2633 if test "$MOZ_X11"; then
2634 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
2637 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
2639 case "$MOZ_WIDGET_TOOLKIT" in
2641 TK_CFLAGS="$MOZ_CAIRO_CFLAGS $MOZ_PIXMAN_CFLAGS"
2642 TK_LIBS="$MOZ_CAIRO_LIBS $MOZ_PIXMAN_LIBS"
2646 AC_SUBST(MOZ_TREE_CAIRO)
2647 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
2648 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
2649 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
2650 AC_SUBST(MOZ_TREE_PIXMAN)
2652 BINDGEN_SYSTEM_FLAGS="$_BINDGEN_CFLAGS $NSPR_CFLAGS $NSS_CFLAGS $MOZ_PIXMAN_CFLAGS $MOZ_CAIRO_CFLAGS"
2653 AC_SUBST(BINDGEN_SYSTEM_FLAGS)
2654 BINDGEN_SYSTEM_TOML_FLAGS="$BINDGEN_SYSTEM_FLAGS"
2655 AC_SUBST_TOML_LIST(BINDGEN_SYSTEM_TOML_FLAGS)
2657 dnl ========================================================
2659 dnl ========================================================
2660 MOZ_ARG_DISABLE_BOOL(xul,
2661 [ --disable-xul Disable XUL],
2663 if test "$MOZ_XUL"; then
2666 dnl remove extensions that require XUL
2667 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
2672 dnl ========================================================
2673 dnl necko configuration options
2674 dnl ========================================================
2677 dnl option to disable necko's wifi scanner
2680 if test "$MOZ_WIDGET_TOOLKIT"; then
2682 case "$OS_TARGET" in
2684 if test -z "$MOZ_IOS"; then
2688 DragonFly|FreeBSD|WINNT)
2699 MOZ_ARG_DISABLE_BOOL(necko-wifi,
2700 [ --disable-necko-wifi Disable necko wifi scanner],
2704 if test "$NECKO_WIFI"; then
2705 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
2706 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
2708 AC_DEFINE(NECKO_WIFI)
2709 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
2711 AC_SUBST(NECKO_WIFI)
2712 AC_SUBST(NECKO_WIFI_DBUS)
2714 dnl ========================================================
2716 dnl = Maintainer debug option (no --enable equivalent)
2718 dnl ========================================================
2721 AC_SUBST_LIST(ASFLAGS)
2725 AC_SUBST(MOZ_AUTH_EXTENSION)
2726 AC_SUBST(MOZ_PREF_EXTENSIONS)
2727 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
2728 AC_SUBST_LIST(WARNINGS_CFLAGS)
2729 AC_SUBST_SET(MOZ_EXTENSIONS)
2731 AC_SUBST(MOZ_UNIVERSALCHARDET)
2732 AC_SUBST(MOZ_SPELLCHECK)
2733 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
2734 AC_SUBST(MOZ_CRASHREPORTER)
2735 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
2736 AC_SUBST(MOZ_STUB_INSTALLER)
2737 AC_SUBST(MOZ_UPDATER)
2739 AC_SUBST(MOZ_ANDROID_APPLICATION_CLASS)
2740 AC_SUBST(MOZ_ANDROID_BROWSER_INTENT_CLASS)
2741 AC_SUBST(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
2742 AC_SUBST(ENABLE_STRIP)
2743 AC_SUBST(PKG_SKIP_STRIP)
2744 AC_SUBST(STRIP_FLAGS)
2745 AC_SUBST(INCREMENTAL_LINKER)
2747 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
2749 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
2750 AC_SUBST(MOZ_LINKER_EXTRACT)
2752 if test -n "$MOZ_BINARY_EXTENSIONS"; then
2753 AC_DEFINE(MOZ_BINARY_EXTENSIONS)
2756 AC_SUBST(MOZ_REQUIRE_SIGNING)
2757 if test "$MOZ_REQUIRE_SIGNING" = 1; then
2758 AC_DEFINE(MOZ_REQUIRE_SIGNING)
2761 dnl ========================================================
2762 dnl = Mac bundle name prefix
2763 dnl ========================================================
2764 MOZ_ARG_WITH_STRING(macbundlename-prefix,
2765 [ --with-macbundlename-prefix=prefix
2766 Prefix for MOZ_MACBUNDLE_NAME],
2767 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
2769 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
2770 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
2771 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
2774 if test "$MOZ_DEBUG"; then
2775 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
2777 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
2779 AC_SUBST(MOZ_MACBUNDLE_NAME)
2781 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
2782 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
2783 # Otherwise, use MOZ_APP_DISPLAYNAME
2784 if test -z "$MOZ_MACBUNDLE_ID"; then
2785 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
2787 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
2788 if test "$MOZ_DEBUG"; then
2789 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
2792 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
2793 AC_SUBST(MOZ_MACBUNDLE_ID)
2795 dnl ========================================================
2796 dnl = Child Process Name for IPC
2797 dnl ========================================================
2798 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
2799 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
2801 # We want to let Android unpack the file at install time, but it only does
2802 # so if the file is named libsomething.so. The lib/ path is also required
2803 # because the unpacked file will be under the lib/ subdirectory and will
2804 # need to be executed from that path.
2805 MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
2807 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
2808 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
2810 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
2811 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
2812 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
2814 # The following variables are available to branding and application
2815 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
2816 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
2817 # impacts profile location and user-visible fields.
2818 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
2819 # versions of a given application (e.g. Aurora and Firefox both use
2820 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
2821 # for application.ini's "Name" field, which controls profile location in
2822 # the absence of a "Profile" field (see below), and various system
2823 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
2824 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
2825 # Mac Bundle name, Updater, Installer), it is typically used for nightly
2826 # builds (e.g. Aurora for Firefox).
2827 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
2828 # defaults to a lowercase form of MOZ_APP_BASENAME.
2829 # - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
2830 # profile name and remoting. If not set, defaults to MOZ_APP_NAME.
2831 # - MOZ_APP_PROFILE: When set, used for application.ini's
2832 # "Profile" field, which controls profile location.
2833 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
2834 # crash reporter server url.
2835 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
2837 # The following environment variables used to have an effect, but don't anymore:
2838 # - MOZ_APP_VERSION: Defines the application version number. This was replaced with
2839 # the contents from the version.txt file in the application directory, or
2840 # browser/config/version.txt if there isn't one.
2841 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
2842 # in the "About" window. This was replaced with the contents from the
2843 # version_display.txt or version.txt in the application directory, or
2844 # browser/config/version_display.txt.
2846 if test -z "$MOZ_APP_NAME"; then
2847 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
2850 if test -z "$MOZ_APP_REMOTINGNAME"; then
2851 MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
2854 if test -z "$ANDROID_PACKAGE_NAME" ; then
2855 # When we got rid of the Aurora channel we decided to replace the old
2856 # Nightly ANDROID_PACKAGE_NAME with Aurora. To make sure this is inherited
2857 # by all mozilla-central based branches we make this the new "default"
2858 # for Fennec. Non mozilla-central based branches set ANDROID_PACKAGE_NAME
2859 # in their mozconfig, so they will never get this. If there are ever
2860 # non-Fennec builds for Android, they will fall into the else block
2861 # and use their own default name.
2862 # https://bugzilla.mozilla.org/show_bug.cgi?id=1357808 has additional
2863 # background on this.
2864 if test "$MOZ_APP_NAME" = "fennec"; then
2865 ANDROID_PACKAGE_NAME="org.mozilla.fennec_aurora"
2867 ANDROID_PACKAGE_NAME="org.mozilla.$MOZ_APP_NAME"
2871 # For extensions and langpacks, we require a max version that is compatible
2872 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
2873 # 24.0a1 and 24.0a2 aren't affected
2875 # 24.1.1 becomes 24.*
2876 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
2877 if test -z "$IS_ALPHA"; then
2879 if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
2880 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
2882 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
2886 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
2889 AC_SUBST(MOZ_APP_NAME)
2890 AC_SUBST(MOZ_APP_REMOTINGNAME)
2891 AC_SUBST(MOZ_APP_DISPLAYNAME)
2892 AC_SUBST(MOZ_APP_BASENAME)
2893 AC_SUBST(MOZ_APP_VENDOR)
2894 AC_SUBST(MOZ_APP_PROFILE)
2895 AC_SUBST(MOZ_APP_ID)
2896 AC_SUBST(MAR_CHANNEL_ID)
2897 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
2898 AC_SUBST(MOZ_PROFILE_MIGRATOR)
2899 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
2900 AC_SUBST(MOZ_APP_UA_NAME)
2901 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
2902 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
2903 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
2905 AC_SUBST(MOZ_APP_MAXVERSION)
2906 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
2907 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
2908 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
2911 AC_SUBST(MOZ_PKG_SPECIAL)
2912 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
2914 if test "$MOZILLA_OFFICIAL"; then
2915 # Build revisions should always be present in official builds
2916 MOZ_INCLUDE_SOURCE_INFO=1
2919 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
2920 # explicitly set the repository and changeset information in.
2921 AC_SUBST(MOZ_SOURCE_REPO)
2922 AC_SUBST(MOZ_SOURCE_CHANGESET)
2923 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
2925 dnl If we have any service that uploads data (and requires data submission
2926 dnl policy alert), set MOZ_DATA_REPORTING.
2927 dnl We need SUBST for build system and DEFINE for xul preprocessor.
2928 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER" || test -n "$MOZ_NORMANDY"; then
2929 MOZ_DATA_REPORTING=1
2930 AC_DEFINE(MOZ_DATA_REPORTING)
2931 AC_SUBST(MOZ_DATA_REPORTING)
2935 AC_SUBST(WIN32_REDIST_DIR)
2936 AC_SUBST(WIN_UCRT_REDIST_DIR)
2938 dnl ========================================================
2940 dnl ========================================================
2944 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
2950 dnl Echo the CFLAGS to remove extra whitespace.
2952 $_COMPILATION_CFLAGS \
2956 $_WARNINGS_CXXFLAGS \
2957 $_COMPILATION_CXXFLAGS \
2960 COMPILE_CFLAGS=`echo \
2964 COMPILE_CXXFLAGS=`echo \
2965 $_DEFINES_CXXFLAGS \
2969 $_WARNINGS_HOST_CFLAGS \
2970 $_COMPILATION_HOST_CFLAGS \
2973 HOST_CXXFLAGS=`echo \
2974 $_WARNINGS_HOST_CXXFLAGS \
2975 $_COMPILATION_HOST_CXXFLAGS \
2978 AC_SUBST(MOZ_SYSTEM_PNG)
2980 AC_SUBST_LIST(MOZ_PNG_CFLAGS)
2981 AC_SUBST_LIST(MOZ_PNG_LIBS)
2983 AC_SUBST(MOZ_SYSTEM_NSPR)
2985 AC_SUBST(MOZ_SYSTEM_NSS)
2987 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
2988 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
2989 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
2990 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
2991 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
2992 OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
2993 OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
2995 AC_SUBST(HOST_CMFLAGS)
2996 AC_SUBST(HOST_CMMFLAGS)
2997 AC_SUBST(OS_COMPILE_CMFLAGS)
2998 AC_SUBST(OS_COMPILE_CMMFLAGS)
3001 OS_CXXFLAGS="$CXXFLAGS"
3002 OS_CPPFLAGS="$CPPFLAGS"
3003 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
3004 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
3005 OS_LDFLAGS="$LDFLAGS"
3007 AC_SUBST_LIST(OS_CFLAGS)
3008 AC_SUBST_LIST(OS_CXXFLAGS)
3009 AC_SUBST_LIST(OS_CPPFLAGS)
3010 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
3011 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
3012 AC_SUBST_LIST(OS_LDFLAGS)
3017 AC_SUBST_LIST(HOST_CFLAGS)
3018 AC_SUBST_LIST(HOST_CPPFLAGS)
3019 AC_SUBST_LIST(HOST_CXXFLAGS)
3020 AC_SUBST(HOST_LDFLAGS)
3021 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
3022 AC_SUBST(HOST_BIN_SUFFIX)
3024 AC_SUBST(TARGET_XPCOM_ABI)
3025 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
3026 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
3027 AC_SUBST(HAVE_X86_AVX2)
3028 AC_SUBST(HAVE_ALTIVEC)
3030 AC_SUBST_LIST(DSO_CFLAGS)
3031 AC_SUBST_LIST(DSO_PIC_CFLAGS)
3032 AC_SUBST(DSO_LDOPTS)
3033 AC_SUBST(BIN_SUFFIX)
3035 AC_SUBST(NS_ENABLE_TSF)
3036 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
3037 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
3039 AC_SUBST(MOZ_DEVTOOLS)
3041 AC_SUBST(MOZ_PACKAGE_JSSHELL)
3042 AC_SUBST(MOZ_FOLD_LIBS)
3043 AC_SUBST_LIST(MOZ_FOLD_LIBS_FLAGS)
3047 dnl Host JavaScript runtime, if any, to use during cross compiles.
3050 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
3052 if test -n "$COMPILE_ENVIRONMENT"; then
3053 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
3055 dnl Check for missing components
3056 if test "$MOZ_X11"; then
3057 dnl ====================================================
3058 dnl = Check if X headers exist
3059 dnl ====================================================
3060 _SAVE_CFLAGS=$CFLAGS
3061 CFLAGS="$CFLAGS $XCFLAGS"
3065 #include <X11/Xlib.h>
3066 #include <X11/Intrinsic.h>
3067 #include <X11/extensions/XShm.h>
3071 if ((dpy = XOpenDisplay(NULL)) == NULL) {
3072 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
3076 [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
3077 CFLAGS="$_SAVE_CFLAGS"
3079 if test -n "$MISSING_X"; then
3080 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
3085 fi # COMPILE_ENVIRONMENT
3087 dnl Set various defines and substitutions
3088 dnl ========================================================
3090 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
3091 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
3092 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
3093 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
3094 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
3095 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
3096 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
3097 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
3098 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
3101 AC_SUBST(MOZ_DEV_EDITION)
3102 if test -n "$MOZ_DEV_EDITION"; then
3103 AC_DEFINE(MOZ_DEV_EDITION)
3106 if test "$MOZ_DEBUG" -o "$DEVELOPER_OPTIONS"; then
3110 if test -n "$A11Y_LOG"; then
3114 dnl Spit out some output
3115 dnl ========================================================
3117 dnl The following defines are used by xpcom
3118 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
3130 # Avoid using obsolete NSPR features
3131 AC_DEFINE(NO_NSPR_10_SUPPORT)
3133 MOZ_CREATE_CONFIG_STATUS()
3135 rm -fr confdefs* $ac_clean_files