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
67 dnl Set various checks
68 dnl ========================================================
71 dnl Initialize the Pthread test variables early so they can be
72 dnl overridden by each platform.
73 dnl ========================================================
77 LDFLAGS="$LDFLAGS $LINKER_LDFLAGS"
79 if test "$COMPILE_ENVIRONMENT"; then
81 fi # COMPILE_ENVIRONMENT
84 *-android*|*-linuxandroid*)
87 AC_PATH_PROG(OBJCOPY,objcopy)
97 AC_SUBST(ANDROID_PACKAGE_NAME)
100 dnl ========================================================
101 dnl Checks for compilers.
102 dnl ========================================================
104 if test "$COMPILE_ENVIRONMENT"; then
106 if test "$target" != "$host"; then
112 # Work around the conftest.exe access problem on Windows
117 MOZ_PATH_PROGS(AS, $AS as, $CC)
118 AC_CHECK_PROGS(STRIP, strip, :)
119 AC_CHECK_PROGS(OTOOL, otool, :)
122 if test -n "$MOZ_WINCONSOLE"; then
123 AC_DEFINE(MOZ_WINCONSOLE)
128 dnl ========================================================
129 dnl Special win32 checks
130 dnl ========================================================
136 if test "$GCC" != "yes"; then
137 # Check to see if we are really running in a msvc environemnt
140 # Make sure compilers are valid
141 CFLAGS="$CFLAGS -nologo"
142 CXXFLAGS="$CXXFLAGS -TP -nologo"
145 AC_TRY_COMPILE([#include <stdio.h>],
146 [ printf("Hello World\n"); ],,
147 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
150 AC_TRY_COMPILE([#include <new.h>],
151 [ unsigned *test = new unsigned(42); ],,
152 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
156 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
159 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
160 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
161 AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
164 MSVC_C_RUNTIME_DLL=vcruntime140.dll
165 MSVC_CXX_RUNTIME_DLL=msvcp140.dll
167 # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
168 CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
170 if test -n "$WIN_UCRT_REDIST_DIR"; then
171 if test ! -d "$WIN_UCRT_REDIST_DIR"; then
172 AC_MSG_ERROR([Invalid Windows UCRT Redist directory: ${WIN_UCRT_REDIST_DIR}])
174 WIN_UCRT_REDIST_DIR=`cd "$WIN_UCRT_REDIST_DIR" && pwd -W`
177 AC_SUBST(MSVC_C_RUNTIME_DLL)
178 AC_SUBST(MSVC_CXX_RUNTIME_DLL)
180 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
182 if test -n "$WIN32_REDIST_DIR"; then
183 if test ! -d "$WIN32_REDIST_DIR"; then
184 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
186 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd -W`
189 # Check linker version, except in lld builds
194 _LD_FULL_VERSION=`"${LINKER}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
195 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
196 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
197 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
204 unset _MSVC_VER_FILTER
207 STL_FLAGS="-I${DIST}/stl_wrappers"
209 # Check w32api version
210 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
211 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
212 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
213 AC_TRY_COMPILE([#include <w32api.h>],
214 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
215 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
216 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
217 #error "test failed."
219 , [ res=yes ], [ res=no ])
220 AC_MSG_RESULT([$res])
221 if test "$res" != "yes"; then
222 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
224 # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
225 # causing problems with local implementations with the same name.
226 AC_DEFINE(STRSAFE_NO_DEPRECATE)
229 CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
230 CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
232 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
233 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
234 # Require OS features provided by IE 8.0 (Win7)
235 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0800)
240 if test -n "$_WIN32_MSVC"; then
242 SKIP_COMPILER_CHECKS=1
243 SKIP_LIBRARY_CHECKS=1
245 # Since we're skipping compiler and library checks, hard-code
248 AC_DEFINE(HAVE_ISATTY)
251 fi # COMPILE_ENVIRONMENT
256 AC_SUBST_LIST(STL_FLAGS)
257 AC_SUBST(WRAP_STL_INCLUDES)
259 dnl ========================================================
260 dnl Checks for programs.
261 dnl ========================================================
262 if test "$COMPILE_ENVIRONMENT"; then
268 fi # COMPILE_ENVIRONMENT
270 dnl ========================================================
271 dnl set the defaults first
272 dnl ========================================================
273 MOZ_USER_DIR=".mozilla"
275 MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
279 dnl Configure platform-specific CPU architecture compiler options.
280 dnl ==============================================================
281 if test "$COMPILE_ENVIRONMENT"; then
283 fi # COMPILE_ENVIRONMENT
285 dnl ========================================================
286 dnl Android libstdc++
287 dnl ========================================================
290 if test "$COMPILE_ENVIRONMENT"; then
292 fi # COMPILE_ENVIRONMENT
294 dnl ========================================================
295 dnl Suppress Clang Argument Warnings
296 dnl ========================================================
297 WARNINGS_CFLAGS="$_WARNINGS_CFLAGS"
298 if test -n "${CLANG_CC}${CLANG_CL}"; then
299 WARNINGS_CFLAGS="-Qunused-arguments $WARNINGS_CFLAGS"
300 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
302 if test -n "${CLANG_CXX}${CLANG_CL}"; then
303 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
306 if test -n "$COMPILE_ENVIRONMENT"; then
310 dnl ========================================================
311 dnl GNU specific defaults
312 dnl ========================================================
313 if test "$GNU_CC"; then
317 SSSE3_FLAGS="-mssse3"
318 CFLAGS="$CFLAGS -fno-strict-aliasing"
321 if test "$OS_ARCH" != "WINNT" -o -z "$CLANG_CC"; then
322 DSO_PIC_CFLAGS='-fPIC'
323 ASFLAGS="$ASFLAGS -fPIC"
326 AC_MSG_CHECKING([for --noexecstack option to as])
328 CFLAGS="$CFLAGS -Wa,--noexecstack"
329 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
330 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
333 AC_MSG_CHECKING([for -z noexecstack option to ld])
334 _SAVE_LDFLAGS=$LDFLAGS
335 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
336 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
338 LDFLAGS=$_SAVE_LDFLAGS)
340 AC_MSG_CHECKING([for -z text option to ld])
341 _SAVE_LDFLAGS=$LDFLAGS
342 LDFLAGS="$LDFLAGS -Wl,-z,text"
343 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
345 LDFLAGS=$_SAVE_LDFLAGS)
347 AC_MSG_CHECKING([for -z relro option to ld])
348 _SAVE_LDFLAGS=$LDFLAGS
349 LDFLAGS="$LDFLAGS -Wl,-z,relro"
350 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
352 LDFLAGS=$_SAVE_LDFLAGS)
354 AC_MSG_CHECKING([for -z nocopyreloc option to ld])
355 _SAVE_LDFLAGS=$LDFLAGS
356 LDFLAGS="$LDFLAGS -Wl,-z,nocopyreloc"
357 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
359 LDFLAGS=$_SAVE_LDFLAGS)
361 AC_MSG_CHECKING([for -Bsymbolic-functions option to ld])
362 _SAVE_LDFLAGS=$LDFLAGS
363 LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
364 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
366 LDFLAGS=$_SAVE_LDFLAGS)
368 AC_MSG_CHECKING([for --build-id=sha1 option to ld])
369 _SAVE_LDFLAGS=$LDFLAGS
370 LDFLAGS="$LDFLAGS -Wl,--build-id=sha1"
371 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
373 LDFLAGS=$_SAVE_LDFLAGS)
375 AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
376 HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
377 _SAVE_LDFLAGS=$LDFLAGS
378 LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
379 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
380 [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
382 LDFLAGS=$_SAVE_LDFLAGS
384 # Check for -mssse3 on $CC
385 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
386 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
388 CFLAGS="$CFLAGS -mssse3"
389 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
390 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
394 # Check for -msse4.1 on $CC
395 AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
396 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
398 CFLAGS="$CFLAGS -msse4.1"
399 AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
400 [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
404 case "${CPU_ARCH}" in
406 AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
408 [asm volatile ("vpermq \$0xd8,%ymm0,%ymm0 \n");],
409 result="yes", result="no")
410 AC_MSG_RESULT("$result")
411 if test "$result" = "yes"; then
417 AC_MSG_CHECKING([whether we can enable AltiVec support])
420 CFLAGS="$CFLAGS -maltivec"
421 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
429 if test "$GCC_USE_GNU_LD"; then
430 # Some tools like ASan use a runtime library that is only
431 # linked against executables, so we must allow undefined
432 # symbols for shared objects in some cases.
433 if test -z "$MOZ_ASAN$MOZ_MSAN$MOZ_UBSAN$MOZ_TSAN$FUZZING_INTERFACES"; then
434 # Don't allow undefined symbols in libraries
435 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
437 # BSDs need `environ' exposed for posix_spawn (bug 753046)
439 DragonFly|FreeBSD|NetBSD|OpenBSD)
440 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
441 DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
443 DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
450 _DEFINES_CFLAGS="-include $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
451 _USE_CPP_INCLUDE_FLAG=1
453 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
456 if test "$GNU_CXX"; then
457 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
459 _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
460 _USE_CPP_INCLUDE_FLAG=1
463 # For profiling builds keep the symbol information
464 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
466 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
467 STRIP_FLAGS="--strip-debug"
472 dnl ========================================================
474 dnl ========================================================
476 if test "$MOZ_DMD"; then
477 if test "${CPU_ARCH}" = "arm"; then
478 CFLAGS="$CFLAGS -funwind-tables"
479 CXXFLAGS="$CXXFLAGS -funwind-tables"
483 dnl ========================================================
484 dnl System overrides of the defaults for host
485 dnl ========================================================
488 if test -n "$_WIN32_MSVC"; then
489 HOST_CFLAGS="$HOST_CFLAGS -nologo"
491 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
493 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
494 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
497 case "${host_cpu}" in
499 if test -n "$_WIN32_MSVC"; then
500 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
504 if test -n "$_WIN32_MSVC"; then
505 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
507 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
513 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
514 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
517 *-linux*|*-kfreebsd*-gnu|*-gnu*)
518 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
519 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
523 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
524 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
528 dnl ========================================================
529 dnl System overrides of the defaults for target
530 dnl ========================================================
534 MOZ_OPTIMIZE_FLAGS="-O3"
535 CXXFLAGS="$CXXFLAGS -stdlib=libc++"
537 STRIP_FLAGS="$STRIP_FLAGS -x -S"
538 # Ensure that if we're targeting iOS an SDK was provided.
539 AC_CACHE_CHECK(for iOS target,
541 [AC_TRY_COMPILE([#include <TargetConditionals.h>
542 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
546 ac_cv_ios_target="yes",
547 ac_cv_ios_target="no")])
548 if test "$ac_cv_ios_target" = "yes" -a -z $MOZ_IOS; then
549 AC_MSG_ERROR([targeting iOS but not using an iOS SDK?])
551 if test -z "$MOZ_IOS"; then
552 # The ExceptionHandling framework is needed for Objective-C exception
553 # logging code in nsObjCExceptions.h. Currently we only use that in debug
555 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
558 dnl DTrace and -dead_strip don't interact well. See bug 403132.
559 dnl ===================================================================
560 if test "x$enable_dtrace" = "xyes"; then
561 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
563 dnl check for the presence of the -dead_strip linker flag
564 AC_MSG_CHECKING([for -dead_strip option to ld])
565 _SAVE_LDFLAGS=$LDFLAGS
566 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
567 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
568 if test -n "$_HAVE_DEAD_STRIP" ; then
570 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
575 LDFLAGS=$_SAVE_LDFLAGS
578 MOZ_FIX_LINK_PATHS="-Wl,-executable_path,${DIST}/bin"
581 *-android*|*-linuxandroid*)
582 if test "$COMPILE_ENVIRONMENT" -a -n "$MOZ_MEMORY"; then
586 MOZ_GFX_OPTIMIZE_MOBILE=1
587 if test -z "$CLANG_CC"; then
588 MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
590 MOZ_OPTIMIZE_FLAGS="-O2"
595 if test "$GNU_CC" -o "$GNU_CXX"; then
596 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
597 if test -n "$MOZ_DEBUG"; then
598 MOZ_OPTIMIZE_FLAGS="-Os"
600 MOZ_OPTIMIZE_FLAGS="-O2"
602 if test -z "$CLANG_CC"; then
603 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
607 case "${target_cpu}" in
609 CFLAGS="$CFLAGS -mieee"
610 CXXFLAGS="$CXXFLAGS -mieee"
617 # certain versions of cygwin's makedepend barf on the
618 # #include <string> vs -I./dist/include/string issue so don't use it
619 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
620 # $GNU_CC will match gcc and clang; while $CLANG_CC will match only clang
621 if test -z "$CLANG_CC"; then
622 AC_MSG_ERROR(Firefox cannot be built with mingw-gcc and requires a mingw-clang toolchain to work)
626 # Use temp file for windres (bug 213281)
627 RCFLAGS='-O coff --use-temp-file'
628 # mingw doesn't require kernel32, user32, and advapi32 explicitly
629 LIBS="$LIBS -luuid -lusp10 -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
632 MOZ_OPTIMIZE_FLAGS="-O2"
634 WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
635 WIN32_GUI_EXE_LDFLAGS=-mwindows
637 # Silence problematic clang warnings
638 CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
640 TARGET_COMPILER_ABI=msvc
641 RANLIB='echo not_ranlib'
642 STRIP='echo not_strip'
644 # aarch64 doesn't support subsystems below 6.02
645 if test "$CPU_ARCH" = "aarch64"; then
646 WIN32_SUBSYSTEM_VERSION=6.02
648 WIN32_SUBSYSTEM_VERSION=6.01
650 WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
651 WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
652 DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
653 _USE_CPP_INCLUDE_FLAG=1
654 _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
655 _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
656 CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
657 CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
658 if test -z "$CLANG_CL"; then
659 CPPFLAGS="$CPPFLAGS -utf-8"
661 if test "$CPU_ARCH" = "x86"; then
662 dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
663 dnl more recent, so set that explicitly here unless another
664 dnl target arch has already been set.
666 if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
667 CFLAGS="$CFLAGS -arch:SSE2"
669 if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
670 CXXFLAGS="$CXXFLAGS -arch:SSE2"
673 SSE_FLAGS="-arch:SSE"
674 SSE2_FLAGS="-arch:SSE2"
675 dnl MSVC allows the use of intrinsics without any flags
676 dnl and doesn't have a separate arch for SSSE3
677 SSSE3_FLAGS="-arch:SSE2"
679 dnl clang-cl requires appropriate flags to enable SSSE3 support
680 dnl on all architectures.
681 if test -n "$CLANG_CL"; then
682 SSSE3_FLAGS="-mssse3"
684 dnl VS2013+ supports -Gw for better linker optimizations.
685 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
686 dnl Disabled on ASan because it causes false-positive ODR violations.
687 if test -z "$MOZ_ASAN"; then
689 CXXFLAGS="$CXXFLAGS -Gw"
691 # String tail merging doesn't play nice with ASan's ODR checker.
692 LDFLAGS="$LDFLAGS -opt:nolldtailmerge"
694 if test -n "$CLANG_CL"; then
695 # XXX We should combine some of these with our generic GCC-style
698 # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
699 CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
700 # We use offsetof on non-POD objects all the time.
701 # We also suppress this warning on other platforms.
702 CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
703 # This warns for reasonable things like:
704 # enum { X = 0xffffffffU };
705 # which is annoying for IDL headers.
706 CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
707 # This warns for cases that would be reached by the Microsoft
708 # #include rules, but also currently warns on cases that would
709 # *also* be reached by standard C++ include rules. That
710 # behavior doesn't seem useful, so we turn it off.
711 CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
712 # We normally error out on unknown pragmas, but since clang-cl
713 # claims to be MSVC, it would be difficult to add
714 # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
715 # use such pragmas, so just ignore them.
716 CFLAGS="$CFLAGS -Wno-unknown-pragmas"
717 CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
718 # We get errors about various #pragma intrinsic directives from
719 # clang-cl, and we don't need to hear about those.
720 CFLAGS="$CFLAGS -Wno-ignored-pragmas"
721 CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
722 # clang-cl's Intrin.h marks things like _ReadWriteBarrier
723 # as __attribute((__deprecated__)). This is nice to know,
724 # but since we don't get the equivalent warning from MSVC,
725 # let's just ignore it.
726 CFLAGS="$CFLAGS -Wno-deprecated-declarations"
727 CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
728 # We use a function like:
729 # __declspec(noreturn) __inline void f() {}
730 # which -Winvalid-noreturn complains about. Again, MSVC seems
731 # OK with it, so let's silence the warning.
732 CFLAGS="$CFLAGS -Wno-invalid-noreturn"
733 CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
734 # Missing |override| on virtual function declarations isn't
735 # something that MSVC currently warns about.
736 CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
737 # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
738 # declaration on |operator delete(void*)|. However, clang-cl
739 # must internally declare |operator delete(void*)| differently,
740 # which causes this warning for virtually every file in the
741 # tree. clang-cl doesn't support -fno-exceptions or equivalent,
742 # so there doesn't seem to be any way to convince clang-cl to
743 # declare |delete| differently. Therefore, suppress this
745 CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
746 # Macros like STDMETHOD() and IFACEMETHOD() can declare
747 # __attribute__((nothrow)) on their respective method declarations,
748 # while the definitions are left without the matching attribute.
749 CXXFLAGS="$CXXFLAGS -Wno-microsoft-exception-spec"
750 # At least one MSVC header and several headers in-tree have
751 # unused typedefs, so turn this on.
752 CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
753 # jemalloc uses __declspec(allocator) as a profiler hint,
754 # which clang-cl doesn't understand.
755 CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
756 # __attribute__((unused)) really means "might be unused" and
757 # we use it to avoid warnings about things that are unused
758 # in some compilation units, but used in many others. This
759 # warning insists on complaining about the latter case, which
760 # is annoying, and rather noisy.
761 CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused"
763 # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
764 CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
765 LIBS="$LIBS user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
766 MOZ_DEBUG_LDFLAGS='-DEBUG'
767 # Use a higher optimization level for clang-cl, so we can come closer
768 # to MSVC's performance numbers (see bug 1443590).
769 if test -n "$CLANG_CL"; then
770 MOZ_OPTIMIZE_FLAGS='-O2'
772 MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
775 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE"
776 if test -z "$DEVELOPER_OPTIONS"; then
777 LDFLAGS="$LDFLAGS -RELEASE"
780 dnl Minimum reqiurement of Gecko is VS2015 or later which supports
781 dnl both SSSE3 and SSE4.1.
782 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
783 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
784 dnl allow AVX2 code from VS2015
787 AC_DEFINE(WIN32_LEAN_AND_MEAN)
788 dnl See http://support.microsoft.com/kb/143208 to use STL
791 MOZ_USER_DIR="Mozilla"
795 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.])
801 if test -n "$GNU_CC"; then
802 CFLAGS="$CFLAGS -mstackrealign"
803 CXXFLAGS="$CXXFLAGS -mstackrealign"
804 LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
806 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
807 LDFLAGS="$LDFLAGS -SAFESEH"
813 if test -n "$_WIN32_MSVC"; then
814 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
819 if test -n "$_WIN32_MSVC"; then
820 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:ARM64"
825 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
832 CFLAGS="$CFLAGS -Dunix"
833 CXXFLAGS="$CXXFLAGS -Dunix"
834 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
835 DSO_PIC_CFLAGS='-fPIC -DPIC'
837 MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
839 DSO_PIC_CFLAGS='-fPIC -DPIC'
842 # This will fail on a.out systems prior to 1.5.1_ALPHA.
843 if test "$LIBRUNPATH"; then
844 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
849 if test -z "$X11BASE"; then
852 MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
854 DSO_PIC_CFLAGS='-fPIC'
855 DSO_LDOPTS='-shared -fPIC'
856 if test "$LIBRUNPATH"; then
857 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
862 MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
867 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
868 MOZ_OPTIMIZE_FLAGS="-O"
871 AC_SUBST_LIST(MMX_FLAGS)
872 AC_SUBST_LIST(SSE_FLAGS)
873 AC_SUBST_LIST(SSE2_FLAGS)
874 AC_SUBST_LIST(SSSE3_FLAGS)
877 if test -n "$MOZ_LINKER"; then
878 AC_DEFINE(MOZ_LINKER)
880 AC_CHECK_PROGS(XZ, xz)
883 if test -z "$COMPILE_ENVIRONMENT"; then
884 SKIP_COMPILER_CHECKS=1
885 SKIP_LIBRARY_CHECKS=1
890 fi # COMPILE_ENVIRONMENT
892 if test -z "$SKIP_COMPILER_CHECKS"; then
893 dnl Checks for typedefs, structures, and compiler characteristics.
894 dnl ========================================================
909 case "${OS_TARGET}" in
913 STL_FLAGS="-I${DIST}/stl_wrappers"
918 if test "$MOZ_BUILD_APP" = "tools/crashreporter"; then
922 dnl Checks for header files.
923 dnl ========================================================
926 bitrig*|dragonfly*|freebsd*|openbsd*)
927 # for stuff like -lXshm
928 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
932 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
933 AC_CACHE_CHECK(for sockaddr_in.sin_len,
934 ac_cv_sockaddr_in_sin_len,
935 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
936 #include <sys/types.h>
938 #include <netinet/in.h>
939 struct sockaddr_in x;
940 void *foo = (void*) &x.sin_len;],
942 [ac_cv_sockaddr_in_sin_len=true],
943 [ac_cv_sockaddr_in_sin_len=false])])
944 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
945 AC_DEFINE(HAVE_SIN_LEN)
946 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
947 AC_DEFINE(HAVE_SCONN_LEN)
950 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
951 ac_cv_sockaddr_in6_sin6_len,
952 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
953 #include <sys/types.h>
955 #include <netinet/in.h>
956 struct sockaddr_in6 x;
957 void *foo = (void*) &x.sin6_len;],
959 [ac_cv_sockaddr_in6_sin6_len=true],
960 [ac_cv_sockaddr_in6_sin6_len=false])])
961 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
962 AC_DEFINE(HAVE_SIN6_LEN)
965 AC_CACHE_CHECK(for sockaddr.sa_len,
966 ac_cv_sockaddr_sa_len,
967 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
968 #include <sys/types.h>
970 #include <sys/socket.h>
972 void *foo = (void*) &x.sa_len;],
974 [ac_cv_sockaddr_sa_len=true],
975 [ac_cv_sockaddr_sa_len=false])])
976 if test "$ac_cv_sockaddr_sa_len" = true ; then
977 AC_DEFINE(HAVE_SA_LEN)
980 MOZ_ARG_ENABLE_BOOL(dtrace,
981 [ --enable-dtrace build with dtrace support if available (default=no)],
982 [enable_dtrace="yes"],)
983 if test "x$enable_dtrace" = "xyes"; then
984 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
985 if test -n "$HAVE_DTRACE"; then
986 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
988 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
991 AC_SUBST(HAVE_DTRACE)
993 dnl Checks for libraries.
994 dnl ========================================================
995 AC_CHECK_LIB(c_r, gethostbyname_r)
997 dnl We don't want to link with libdl even if it's present on OS X, since
998 dnl it's not used and not part of the default installation. OS/2 has dlfcn
1000 dnl We don't want to link against libm or libpthread on Darwin since
1001 dnl they both are just symlinks to libSystem and explicitly linking
1002 dnl against libSystem causes issues when debugging (see bug 299601).
1007 AC_SEARCH_LIBS(dlopen, dl,
1008 MOZ_CHECK_HEADER(dlfcn.h,
1009 AC_DEFINE(HAVE_DLOPEN)))
1013 _SAVE_CFLAGS="$CFLAGS"
1014 CFLAGS="$CFLAGS -D_GNU_SOURCE"
1015 AC_CHECK_FUNCS(dladdr memmem)
1016 CFLAGS="$_SAVE_CFLAGS"
1018 if test ! "$GNU_CXX"; then
1019 AC_CHECK_LIB(C, demangle)
1022 AC_CHECK_LIB(socket, socket)
1025 XLIBS="$X_EXTRA_LIBS"
1027 dnl ========================================================
1028 dnl Checks for X libraries.
1029 dnl Ordering is important.
1030 dnl Xt is dependent upon SM as of X11R6
1031 dnl ========================================================
1032 if test -n "$MOZ_X11"; then
1033 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
1034 _SAVE_LDFLAGS="$LDFLAGS"
1036 LDFLAGS="$XLDFLAGS $LDFLAGS"
1037 AC_CHECK_LIB(X11, XDrawLines, [XLIBS="-lX11 $XLIBS"],
1038 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
1039 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
1040 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
1042 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
1043 unset ac_cv_lib_Xt_XtFree
1044 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
1045 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
1046 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
1047 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
1050 dnl ========================================================
1052 dnl ========================================================
1053 AC_CHECK_LIB(xcb, xcb_connect, [XLIBS="-lxcb $XLIBS"],
1054 [MISSING_X="$MISSING_X -lxcb"], $XLIBS)
1055 AC_CHECK_LIB(xcb-shm, xcb_shm_query_version, [XLIBS="-lxcb-shm $XLIBS"],
1056 [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS)
1057 AC_CHECK_LIB(X11-xcb, XGetXCBConnection, [XLIBS="-lX11-xcb $XLIBS"],
1058 [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS)
1060 LDFLAGS="$_SAVE_LDFLAGS"
1064 AC_SUBST_LIST(XCFLAGS)
1065 AC_SUBST_LIST(XLDFLAGS)
1066 AC_SUBST_LIST(XLIBS)
1067 AC_SUBST_LIST(XEXT_LIBS)
1068 AC_SUBST_LIST(XT_LIBS)
1070 dnl ========================================================
1071 dnl = pthread support
1072 dnl = Start by checking whether the system support pthreads
1073 dnl ========================================================
1074 case "$target_os" in
1079 AC_CHECK_LIB(pthreads, pthread_create,
1080 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
1081 AC_CHECK_LIB(pthread, pthread_create,
1082 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
1083 AC_CHECK_LIB(c_r, pthread_create,
1084 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
1085 AC_CHECK_LIB(c, pthread_create,
1094 dnl ========================================================
1095 dnl Do the platform specific pthread hackery
1096 dnl ========================================================
1097 if test "$MOZ_USE_PTHREADS"x != x
1100 dnl See if -pthread is supported.
1103 ac_cv_have_dash_pthread=no
1104 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
1105 echo 'int main() { return 0; }' | cat > conftest.c
1106 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
1107 if test $? -eq 0; then
1108 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1109 ac_cv_have_dash_pthread=yes
1110 case "$target_os" in
1112 # Freebsd doesn't use -pthread for compiles, it uses them for linking
1115 CFLAGS="$CFLAGS -pthread"
1116 CXXFLAGS="$CXXFLAGS -pthread"
1122 AC_MSG_RESULT($ac_cv_have_dash_pthread)
1125 dnl See if -pthreads is supported.
1127 ac_cv_have_dash_pthreads=no
1128 if test "$ac_cv_have_dash_pthread" = "no"; then
1129 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
1130 echo 'int main() { return 0; }' | cat > conftest.c
1131 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
1132 if test $? -eq 0; then
1133 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1134 ac_cv_have_dash_pthreads=yes
1135 CFLAGS="$CFLAGS -pthreads"
1136 CXXFLAGS="$CXXFLAGS -pthreads"
1140 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
1145 AC_DEFINE(_REENTRANT)
1146 AC_DEFINE(_THREAD_SAFE)
1147 dnl -pthread links in -lpthread, so don't specify it explicitly.
1148 if test "$ac_cv_have_dash_pthread" = "yes"; then
1149 _PTHREAD_LDFLAGS="-pthread"
1153 *-*-openbsd*|*-*-bsdi*)
1154 AC_DEFINE(_REENTRANT)
1155 AC_DEFINE(_THREAD_SAFE)
1156 dnl -pthread links in -lc_r, so don't specify it explicitly.
1157 if test "$ac_cv_have_dash_pthread" = "yes"; then
1158 _PTHREAD_LDFLAGS="-pthread"
1162 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
1163 AC_DEFINE(_REENTRANT)
1167 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
1168 AC_SUBST(MOZ_USE_PTHREADS)
1169 MOZ_CHECK_HEADERS(pthread.h)
1173 dnl Checks for library functions.
1174 dnl ========================================================
1175 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall)
1177 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1178 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1179 ac_cv_clock_monotonic,
1180 [for libs in "" -lrt; do
1182 _SAVE_CFLAGS="$CFLAGS"
1184 CFLAGS="$CFLAGS $DSO_PIC_CFLAGS"
1185 dnl clock_gettime is available on OSX since 10.12, so depending on MACOSX_DEPLOYMENT_TARGET,
1186 dnl we should or not be able to use it. To detect if we can, we need to make the
1187 dnl availability attribute strict, so that compilation fails when the target is < 10.12.
1188 AC_TRY_LINK([#define availability(os, ...) availability(os, strict, __VA_ARGS)
1190 [ struct timespec ts;
1191 clock_gettime(CLOCK_MONOTONIC, &ts); ],
1192 ac_cv_clock_monotonic=$libs
1195 ac_cv_clock_monotonic=no)
1197 CFLAGS="$_SAVE_CFLAGS"
1199 if test "$ac_cv_clock_monotonic" != "no"; then
1200 HAVE_CLOCK_MONOTONIC=1
1201 REALTIME_LIBS=$ac_cv_clock_monotonic
1202 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1203 AC_SUBST(HAVE_CLOCK_MONOTONIC)
1204 AC_SUBST_LIST(REALTIME_LIBS)
1207 dnl Turn on warnings-as-errors to prevent implicit declaration of
1208 dnl pthread_cond_timedwait_monotonic_np, which can cause this test to
1209 dnl inadvertently pass even if the function does not really exist.
1210 _SAVE_CFLAGS="$CFLAGS"
1211 CFLAGS="$CFLAGS $WARNINGS_AS_ERRORS"
1212 AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
1213 ac_cv_pthread_cond_timedwait_monotonic_np,
1214 AC_TRY_LINK([#include <pthread.h>],
1215 [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
1216 ac_cv_pthread_cond_timewait_monotonic_np=yes,
1217 ac_cv_pthread_cond_timewait_monotonic_np=no))
1218 if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
1219 AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
1221 CFLAGS=$_SAVE_CFLAGS
1225 ac_cv_func_res_ninit,
1226 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
1227 dnl no need for res_ninit() on NetBSD and OpenBSD
1228 ac_cv_func_res_ninit=no
1232 #define _BSD_SOURCE 1
1234 #include <sys/types.h>
1235 #include <netinet/in.h>
1236 #include <arpa/nameser.h>
1239 [int foo = res_ninit(&_res);],
1240 [ac_cv_func_res_ninit=yes],
1241 [ac_cv_func_res_ninit=no])
1245 if test "$ac_cv_func_res_ninit" = "yes"; then
1246 AC_DEFINE(HAVE_RES_NINIT)
1247 dnl must add the link line we do something as foolish as this... dougt
1249 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
1250 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
1255 dnl **********************
1256 dnl *** va_copy checks ***
1257 AC_CACHE_CHECK([for an implementation of va_copy()],
1259 [AC_TRY_COMPILE([#include <stdarg.h>
1261 void f (int i, ...) {
1262 va_list args1, args2;
1263 va_start (args1, i);
1264 va_copy (args2, args1);
1265 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1267 va_end (args1); va_end (args2);
1269 [f(0, 42); return 0],
1270 [ac_cv_va_copy=yes],
1274 AC_CACHE_CHECK([whether va_list can be copied by value],
1276 [AC_TRY_COMPILE([#include <stdarg.h>
1278 void f (int i, ...) {
1279 va_list args1, args2;
1280 va_start (args1, i);
1282 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1284 va_end (args1); va_end (args2);
1286 [f(0, 42); return 0],
1287 [ac_cv_va_val_copy=yes],
1288 [ac_cv_va_val_copy=no],
1291 if test "x$ac_cv_va_copy" = "xyes"; then
1292 AC_DEFINE(VA_COPY, va_copy)
1293 AC_DEFINE(HAVE_VA_COPY)
1296 if test "x$ac_cv_va_val_copy" = "xno"; then
1297 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
1300 dnl ===================================================================
1301 dnl ========================================================
1302 dnl Put your C++ language/feature checks below
1303 dnl ========================================================
1307 if test "$GNU_CC"; then
1308 if test "$CPU_ARCH" = "arm" ; then
1309 AC_CACHE_CHECK(for ARM EABI,
1313 #if defined(__ARM_EABI__)
1316 #error Not ARM EABI.
1319 ac_cv_gcc_arm_eabi="yes",
1320 ac_cv_gcc_arm_eabi="no")])
1321 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
1323 ARM_ABI_PREFIX=eabi-
1325 ARM_ABI_PREFIX=oabi-
1329 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
1332 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
1333 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
1334 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
1336 _SAVE_LDFLAGS=$LDFLAGS
1337 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
1338 AC_CACHE_CHECK(for __thread keyword for TLS variables,
1339 ac_cv_thread_keyword,
1340 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
1341 [return tlsIsMainThread;],
1342 ac_cv_thread_keyword=yes,
1343 ac_cv_thread_keyword=no)])
1344 LDFLAGS=$_SAVE_LDFLAGS
1345 # The custom dynamic linker doesn't support TLS variables
1347 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
1348 # mips builds fail with TLS variables because of a binutils bug.
1350 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
1355 *-android*|*-linuxandroid*)
1362 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
1368 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
1369 if test -n "$MOZ_LINKER"; then
1370 if test "$CPU_ARCH" = arm; then
1371 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
1372 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
1373 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1374 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1378 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
1379 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
1380 dnl Since the linker only understands the sysv ones, no need to build the
1381 dnl gnu style tables anyways.
1382 LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
1385 dnl End of C++ language/feature checks
1388 dnl ========================================================
1389 dnl = Internationalization checks
1390 dnl ========================================================
1392 dnl Internationalization and Locale support is different
1393 dnl on various UNIX platforms. Checks for specific i18n
1394 dnl features go here.
1396 AC_HAVE_FUNCS(localeconv)
1398 fi # ! SKIP_COMPILER_CHECKS
1400 if test -n "${COMPILE_ENVIRONMENT}"; then
1405 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1406 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1407 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1410 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1411 dnl features that Windows actually does support.
1413 if test -n "$SKIP_COMPILER_CHECKS"; then
1414 dnl Windows has malloc.h
1415 AC_DEFINE(MALLOC_H, [<malloc.h>])
1416 AC_DEFINE(HAVE_FORCEINLINE)
1417 AC_DEFINE(HAVE_LOCALECONV)
1418 fi # SKIP_COMPILER_CHECKS
1420 dnl Mozilla specific options
1421 dnl ========================================================
1422 dnl The macros used for command line options
1423 dnl are defined in build/autoconf/altoptions.m4.
1425 dnl ========================================================
1427 dnl = Check for external package dependencies
1429 dnl ========================================================
1430 MOZ_ARG_HEADER(External Packages)
1432 case "$OS_TARGET" in
1433 WINNT|Darwin|Android)
1443 dnl ========================================================
1444 dnl system libevent Support
1445 dnl ========================================================
1446 MOZ_ARG_WITH_STRING(system-libevent,
1447 [ --with-system-libevent[=PFX]
1448 Use system libevent [installed at prefix PFX]],
1449 LIBEVENT_DIR=$withval)
1451 _SAVE_CFLAGS=$CFLAGS
1452 _SAVE_LDFLAGS=$LDFLAGS
1454 if test "$LIBEVENT_DIR" = yes; then
1455 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
1456 MOZ_SYSTEM_LIBEVENT=1,
1459 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
1460 MOZ_SYSTEM_LIBEVENT=
1461 elif test -z "$MOZ_SYSTEM_LIBEVENT"; then
1462 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
1463 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
1464 MOZ_CHECK_HEADER(event.h,
1465 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
1466 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
1468 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
1469 AC_CHECK_LIB(event, event_init,
1470 [MOZ_SYSTEM_LIBEVENT=1
1471 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
1472 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
1473 [MOZ_SYSTEM_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
1475 CFLAGS=$_SAVE_CFLAGS
1476 LDFLAGS=$_SAVE_LDFLAGS
1479 AC_SUBST(MOZ_SYSTEM_LIBEVENT)
1481 dnl ========================================================
1482 dnl = If NSS was not detected in the system,
1483 dnl = use the one in the source tree (mozilla/security/nss)
1484 dnl ========================================================
1486 MOZ_ARG_WITH_BOOL(system-nss,
1487 [ --with-system-nss Use system installed NSS],
1490 if test -n "$_USE_SYSTEM_NSS"; then
1491 AM_PATH_NSS(3.50, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
1494 NSS_CFLAGS="$NSS_CFLAGS -I${DIST}/include/nss"
1495 if test -z "$MOZ_SYSTEM_NSS"; then
1496 case "${OS_ARCH}" in
1497 # Only few platforms have been tested with GYP
1498 WINNT|Darwin|Linux|DragonFly|FreeBSD|NetBSD|OpenBSD|SunOS)
1501 AC_MSG_ERROR([building in-tree NSS is not supported on this platform. Use --with-system-nss])
1506 dnl system ZLIB support
1507 dnl ========================================================
1508 MOZ_ZLIB_CHECK([1.2.3])
1510 if test -z "$SKIP_LIBRARY_CHECKS"; then
1512 dnl ========================================================
1513 dnl system PNG Support
1514 dnl ========================================================
1515 MOZ_ARG_WITH_STRING(system-png,
1516 [ --with-system-png[=PFX]
1517 Use system libpng [installed at prefix PFX]],
1520 _SAVE_CFLAGS=$CFLAGS
1521 _SAVE_LDFLAGS=$LDFLAGS
1523 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
1524 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
1525 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
1527 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
1530 AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"],
1531 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1532 AC_CHECK_LIB(png, png_get_acTL, ,
1533 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
1535 if test "$MOZ_SYSTEM_PNG" = 1; then
1536 AC_TRY_COMPILE([ #include <stdio.h>
1537 #include <sys/types.h>
1539 [ #if PNG_LIBPNG_VER < $MOZPNG
1540 #error "Insufficient libpng version ($MOZPNG required)."
1542 #ifndef PNG_UINT_31_MAX
1543 #error "Insufficient libpng version."
1546 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1548 CFLAGS=$_SAVE_CFLAGS
1549 LDFLAGS=$_SAVE_LDFLAGS
1552 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then
1553 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
1554 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
1557 fi # SKIP_LIBRARY_CHECKS
1559 dnl ========================================================
1563 dnl ========================================================
1565 MOZ_ARG_HEADER(Application)
1567 ENABLE_SYSTEM_EXTENSION_DIRS=1
1568 MOZ_BRANDING_DIRECTORY=
1569 MOZ_OFFICIAL_BRANDING=
1570 MOZ_AUTH_EXTENSION=1
1571 if test "$MOZ_IOS"; then
1574 MOZ_PREF_EXTENSIONS=1
1576 MOZ_UNIVERSALCHARDET=1
1581 MOZ_USE_NATIVE_POPUP_WINDOWS=
1582 MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
1584 MOZ_BINARY_EXTENSIONS=
1587 case "$target_os" in
1590 AC_DEFINE(NS_ENABLE_TSF)
1594 # Optional Firefox for Android partner distribution directory.
1595 MOZ_ARG_WITH_STRING(android-distribution-directory,
1596 [ --with-android-distribution-directory=dir
1597 Optional Firefox for Android partner distribution directory.],
1598 MOZ_ANDROID_DISTRIBUTION_DIRECTORY=$withval)
1600 if test -n "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY"; then
1601 # A distribution directory must have an assets/distribution directory.
1602 # See https://wiki.mozilla.org/Mobile/Distribution_Files.
1603 if test ! -d "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY/assets/distribution" ; then
1604 AC_MSG_ERROR([--with-android-distribution-directory does not contain assets/distribution;
1605 (looked for ${MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets/distribution).])
1608 AC_SUBST(MOZ_ANDROID_DISTRIBUTION_DIRECTORY)
1610 dnl ========================================================
1611 dnl = Trademarked Branding
1612 dnl ========================================================
1613 MOZ_ARG_ENABLE_BOOL(official-branding,
1614 [ --enable-official-branding
1615 Enable Official mozilla.org Branding
1616 Do not distribute builds with
1617 --enable-official-branding unless you have
1618 permission to use trademarks per
1619 http://www.mozilla.org/foundation/trademarks/ .],
1620 MOZ_OFFICIAL_BRANDING=1,
1621 MOZ_OFFICIAL_BRANDING=)
1623 # Allow the application to influence configure with a confvars.sh script.
1624 AC_MSG_CHECKING([if app-specific confvars.sh exists])
1625 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
1626 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
1627 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
1632 if test "$EARLY_BETA_OR_EARLIER"; then
1633 MOZ_NEW_CERT_STORAGE=1
1634 AC_DEFINE(MOZ_NEW_CERT_STORAGE)
1636 AC_SUBST(MOZ_NEW_CERT_STORAGE)
1638 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
1639 MOZ_ARG_WITH_STRING(app-name,
1640 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
1641 WITH_APP_NAME=$withval,
1644 if test -n "$WITH_APP_NAME" ; then
1645 MOZ_APP_NAME="$WITH_APP_NAME"
1648 MOZ_ARG_WITH_STRING(app-basename,
1649 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
1650 WITH_APP_BASENAME=$withval,
1653 if test -n "$WITH_APP_BASENAME" ; then
1654 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
1657 dnl ========================================================
1658 dnl Ensure Android SDK and build-tools versions depending on
1660 dnl ========================================================
1662 case "$MOZ_BUILD_APP" in
1668 dnl ========================================================
1670 dnl = Toolkit Options
1672 dnl ========================================================
1673 MOZ_ARG_HEADER(Toolkit Options)
1675 dnl ========================================================
1676 dnl = Enable the toolkit as needed =
1677 dnl ========================================================
1679 case "$MOZ_WIDGET_TOOLKIT" in
1682 LDFLAGS="$LDFLAGS -framework Cocoa"
1683 # Use -Wl as a trick to avoid -framework and framework names from
1684 # being separated by AC_SUBST_LIST.
1685 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'
1687 CFLAGS="$CFLAGS $TK_CFLAGS"
1688 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1689 MOZ_USER_DIR="Mozilla"
1690 MOZ_FS_LAYOUT=bundle
1694 LDFLAGS="$LDFLAGS -framework UIKit"
1696 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'
1697 CFLAGS="$CFLAGS $TK_CFLAGS"
1698 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1699 MOZ_USER_DIR="Mozilla"
1700 MOZ_FS_LAYOUT=bundle
1705 if test "$OS_TARGET" = Darwin; then
1706 LDFLAGS="$LDFLAGS -lobjc"
1709 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
1710 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
1711 case "$MOZ_WIDGET_TOOLKIT" in
1717 if test "$COMPILE_ENVIRONMENT"; then
1718 if test "$MOZ_WIDGET_TOOLKIT" = gtk; then
1719 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)
1720 MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
1721 TK_CFLAGS=$MOZ_GTK3_CFLAGS
1722 TK_LIBS=$MOZ_GTK3_LIBS
1723 dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
1724 dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
1725 AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
1726 GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32
1728 if test "$MOZ_ENABLE_GTK"; then
1729 if test "$MOZ_X11"; then
1730 GDK_PACKAGES=gdk-x11-2.0
1732 AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
1733 AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
1735 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)
1736 MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
1738 fi # COMPILE_ENVIRONMENT
1740 AC_SUBST(MOZ_FS_LAYOUT)
1742 AC_SUBST_LIST(TK_CFLAGS)
1743 AC_SUBST_LIST(TK_LIBS)
1745 dnl ========================================================
1747 dnl = Components & Features
1749 dnl ========================================================
1750 MOZ_ARG_HEADER(Components and Features)
1752 AC_SUBST(MOZ_OFFICIAL_BRANDING)
1753 if test -n "$MOZ_OFFICIAL_BRANDING"; then
1754 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
1755 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
1757 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
1758 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
1762 MOZ_ARG_WITH_STRING(branding,
1763 [ --with-branding=dir Use branding from the specified directory.],
1764 MOZ_BRANDING_DIRECTORY=$withval)
1766 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
1767 if test -z "$REAL_BRANDING_DIRECTORY"; then
1768 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
1771 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1772 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
1773 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1774 . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
1777 AC_SUBST(MOZ_BRANDING_DIRECTORY)
1779 dnl ========================================================
1780 dnl = Distribution ID
1781 dnl ========================================================
1782 MOZ_ARG_WITH_STRING(distribution-id,
1783 [ --with-distribution-id=ID
1784 Set distribution-specific id (default=org.mozilla)],
1785 [ val=`echo $withval`
1786 MOZ_DISTRIBUTION_ID="$val"])
1788 if test -z "$MOZ_DISTRIBUTION_ID"; then
1789 MOZ_DISTRIBUTION_ID="org.mozilla"
1792 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
1793 AC_SUBST(MOZ_DISTRIBUTION_ID)
1795 dnl ========================================================
1796 dnl = libproxy support
1797 dnl ========================================================
1799 if test "$MOZ_ENABLE_GTK"
1801 MOZ_ENABLE_LIBPROXY=
1803 MOZ_ARG_ENABLE_BOOL(libproxy,
1804 [ --enable-libproxy Enable libproxy support ],
1805 MOZ_ENABLE_LIBPROXY=1,
1806 MOZ_ENABLE_LIBPROXY=)
1808 if test "$MOZ_ENABLE_LIBPROXY"
1810 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
1811 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
1814 AC_SUBST(MOZ_ENABLE_LIBPROXY)
1816 dnl ========================================================
1818 dnl ========================================================
1820 if test "$MOZ_ENABLE_GTK"
1824 MOZ_ARG_DISABLE_BOOL(dbus,
1825 [ --disable-dbus Disable dbus support ],
1829 if test "$MOZ_ENABLE_DBUS"
1831 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
1832 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
1833 AC_DEFINE(MOZ_ENABLE_DBUS)
1836 AC_SUBST(MOZ_ENABLE_DBUS)
1838 dnl =========================================================
1839 dnl = Whether to exclude hyphenations files in the build
1840 dnl =========================================================
1841 if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
1842 AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
1845 AC_TRY_COMPILE([#include <linux/ethtool.h>],
1846 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
1847 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
1849 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
1851 if test -n "$MOZ_WEBRTC"; then
1852 if test -n "$MOZ_X11"; then
1853 MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
1857 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
1859 dnl ========================================================
1860 dnl = Apple platform decoder support
1861 dnl ========================================================
1862 if test "$COMPILE_ENVIRONMENT"; then
1863 if test -n "$MOZ_APPLEMEDIA"; then
1864 # hack in frameworks for fmp4 - see bug 1029974
1865 # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
1866 LDFLAGS="$LDFLAGS -framework AudioToolbox"
1867 dnl Verify CoreMedia is available.
1868 AC_CHECK_HEADERS([CoreMedia/CoreMedia.h VideoToolbox/VideoToolbox.h], [],
1869 [AC_MSG_ERROR([MacOS X 10.9 SDK or later is required])])
1871 fi # COMPILE_ENVIRONMENT
1873 dnl ========================================================
1874 dnl = Handle dependent MEDIA defines
1875 dnl ========================================================
1878 AC_DEFINE(MOZ_WEBM_ENCODER)
1879 AC_SUBST(MOZ_WEBM_ENCODER)
1881 dnl ========================================================
1883 dnl ========================================================
1885 MOZ_ARG_DISABLE_BOOL(negotiateauth,
1886 [ --disable-negotiateauth Disable GSS-API negotiation ],
1887 MOZ_AUTH_EXTENSION=,
1888 MOZ_AUTH_EXTENSION=1 )
1890 if test -n "$MOZ_IOS" -a -n "$MOZ_AUTH_EXTENSION"; then
1891 AC_MSG_ERROR([negotiateauth is not supported on iOS.])
1894 dnl ========================================================
1895 dnl Pref extensions (autoconfig)
1896 dnl ========================================================
1897 MOZ_ARG_DISABLE_BOOL(pref-extensions,
1898 [ --disable-pref-extensions
1899 Disable pref extensions such as autoconfig],
1900 MOZ_PREF_EXTENSIONS=,
1901 MOZ_PREF_EXTENSIONS=1 )
1903 dnl ========================================================
1904 dnl Searching of system directories for extensions.
1905 dnl Note: this switch is meant to be used for test builds
1906 dnl whose behavior should not depend on what happens to be
1907 dnl installed on the local machine.
1908 dnl ========================================================
1909 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
1910 [ --disable-system-extension-dirs
1911 Disable searching system- and account-global
1912 directories for extensions of any kind; use
1913 only profile-specific extension directories],
1914 ENABLE_SYSTEM_EXTENSION_DIRS=,
1915 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
1916 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
1917 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
1920 dnl ========================================================
1921 dnl = Universalchardet
1922 dnl ========================================================
1923 MOZ_ARG_DISABLE_BOOL(universalchardet,
1924 [ --disable-universalchardet
1925 Disable universal encoding detection],
1926 MOZ_UNIVERSALCHARDET=,
1927 MOZ_UNIVERSALCHARDET=1 )
1929 dnl ========================================================
1931 dnl ========================================================
1933 if test "$COMPILE_ENVIRONMENT" ; then
1935 dnl Moved gamepad platform check to moz.build, linux header check still needed here.
1936 if test "$OS_TARGET" = "Linux"; then
1937 MOZ_CHECK_HEADER([linux/joystick.h])
1938 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
1939 AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
1943 fi # COMPILE_ENVIRONMENT
1946 dnl ========================================================
1947 dnl = Breakpad crash reporting (on by default on supported platforms)
1948 dnl ========================================================
1951 i?86-*-mingw*|x86_64-*-mingw*|aarch64-*-mingw*)
1954 i?86-apple-darwin*|x86_64-apple-darwin*)
1955 if test -z "$MOZ_IOS"; then
1959 *-android*|*-linuxandroid*)
1960 dnl Android/arm is arm-unknown-linux-androideabi, so android condition should
1961 dnl be before Linux condition
1964 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
1965 if test "$MOZ_ENABLE_GTK"; then
1971 MOZ_ARG_DISABLE_BOOL(crashreporter,
1972 [ --disable-crashreporter Disable breakpad crash reporting],
1973 [MOZ_CRASHREPORTER=],
1974 [MOZ_CRASHREPORTER=F # Force enable breakpad])
1976 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin" -a "$MOZ_WIDGET_TOOLKIT" != "android"; then
1977 if test "$MOZ_CRASHREPORTER" = F; then
1978 AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
1983 if test -n "$MOZ_CRASHREPORTER"; then
1984 AC_DEFINE(MOZ_CRASHREPORTER)
1986 if test "$OS_TARGET" = "Linux" && \
1987 test -z "$SKIP_LIBRARY_CHECKS"; then
1988 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
1991 if test "$OS_ARCH" = "WINNT"; then
1992 if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
1993 MOZ_CRASHREPORTER_INJECTOR=1
1994 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
1999 dnl ========================================================
2000 dnl = Enable compilation of specific extension modules
2001 dnl ========================================================
2003 MOZ_ARG_ENABLE_STRING(extensions,
2004 [ --enable-extensions Enable extensions],
2005 [ for option in `echo $enableval | sed 's/,/ /g'`; do
2006 if test "$option" = "yes" -o "$option" = "all"; then
2007 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
2008 elif test "$option" = "no" -o "$option" = "none"; then
2010 elif test "$option" = "default"; then
2011 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
2012 elif test `echo "$option" | grep -c \^-` != 0; then
2013 option=`echo $option | sed 's/^-//'`
2014 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
2016 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
2019 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
2021 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
2022 dnl when trying to build a nonexistent extension.
2023 for extension in $MOZ_EXTENSIONS; do
2024 if test ! -d "${srcdir}/extensions/${extension}"; then
2025 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
2029 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
2030 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
2033 # Avoid defining MOZ_ENABLE_CAIRO_FT on Windows platforms because
2034 # "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
2035 if test -n "$MOZ_TREE_FREETYPE" -a "$OS_TARGET" != WINNT; then
2036 MOZ_ENABLE_CAIRO_FT=1
2037 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2038 CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
2039 AC_SUBST_LIST(CAIRO_FT_CFLAGS)
2042 AC_CHECK_PROGS(WGET, wget, "")
2045 dnl ========================================================
2047 dnl ========================================================
2049 if test "$MOZ_IOS"; then
2053 MOZ_ARG_DISABLE_BOOL(updater,
2054 [ --disable-updater Disable building of updater],
2058 if test -n "$MOZ_UPDATER"; then
2059 AC_DEFINE(MOZ_UPDATER)
2062 dnl ========================================================
2063 dnl parental controls (for Windows Vista)
2064 dnl ========================================================
2065 MOZ_ARG_DISABLE_BOOL(parental-controls,
2066 [ --disable-parental-controls
2067 Do not build parental controls],
2068 MOZ_DISABLE_PARENTAL_CONTROLS=1,
2069 MOZ_DISABLE_PARENTAL_CONTROLS=)
2070 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
2071 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
2074 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
2076 dnl ========================================================
2077 dnl = Disable smartcard support
2078 dnl ========================================================
2079 if test -n "$MOZ_NO_SMART_CARDS"; then
2080 AC_DEFINE(MOZ_NO_SMART_CARDS)
2082 AC_SUBST(MOZ_NO_SMART_CARDS)
2084 dnl ========================================================
2085 dnl = Sandboxing support
2086 dnl ========================================================
2087 if test -n "$MOZ_TSAN" -o -n "$MOZ_ASAN"; then
2088 # Bug 1182565: TSan conflicts with sandboxing on Linux.
2089 # Bug 1287971: LSan also conflicts with sandboxing on Linux.
2097 MOZ_ARG_DISABLE_BOOL(sandbox,
2098 [ --disable-sandbox Disable sandboxing support],
2102 case "$OS_TARGET" in
2103 WINNT|Darwin|OpenBSD)
2109 # Linux sandbox is only available on x86 and x86_64.
2116 # Only enable the sandbox by default on Linux, OpenBSD, macOS, and Windows
2121 if test -n "$MOZ_SANDBOX"; then
2122 AC_DEFINE(MOZ_SANDBOX)
2125 AC_SUBST(MOZ_SANDBOX)
2128 dnl ========================================================
2130 dnl = Module specific options
2132 dnl ========================================================
2133 MOZ_ARG_HEADER(Individual module options)
2135 dnl ========================================================
2136 dnl Check for sqlite
2137 dnl ========================================================
2140 MOZ_ARG_ENABLE_BOOL(system-sqlite,
2141 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
2142 MOZ_SYSTEM_SQLITE=1,
2143 MOZ_SYSTEM_SQLITE= )
2145 if test -n "$MOZ_SYSTEM_SQLITE"
2147 dnl ============================
2148 dnl === SQLite Version check ===
2149 dnl ============================
2150 dnl Check to see if the system SQLite package is new enough.
2151 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
2153 dnl ==============================
2154 dnl === SQLite fdatasync check ===
2155 dnl ==============================
2156 dnl Check to see if fdatasync is available
2157 AC_CHECK_FUNC(fdatasync)
2160 if test -n "$MOZ_SYSTEM_SQLITE"; then
2161 AC_DEFINE(MOZ_SYSTEM_SQLITE)
2163 AC_SUBST(MOZ_SYSTEM_SQLITE)
2165 dnl ========================================================
2166 dnl = Disable zipwriter
2167 dnl ========================================================
2168 MOZ_ARG_DISABLE_BOOL(zipwriter,
2169 [ --disable-zipwriter Disable zipwriter component],
2172 AC_SUBST(MOZ_ZIPWRITER)
2174 dnl ========================================================
2176 dnl = Feature options that require extra sources to be pulled
2178 dnl ========================================================
2179 dnl MOZ_ARG_HEADER(Features that require extra sources)
2181 dnl ========================================================
2183 dnl = Runtime debugging and Optimization Options
2185 dnl ========================================================
2186 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
2188 dnl ========================================================
2189 dnl enable mobile optimizations
2190 dnl ========================================================
2191 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
2192 [ --enable-mobile-optimize
2193 Enable mobile optimizations],
2194 MOZ_GFX_OPTIMIZE_MOBILE=1)
2196 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
2198 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
2199 # We ignore paint will resample on mobile for performance.
2200 # We may want to revisit this later.
2201 MOZ_IGNORE_PAINT_WILL_RESAMPLE=1
2203 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
2204 AC_DEFINE(MOZ_IGNORE_PAINT_WILL_RESAMPLE)
2207 dnl ========================================================
2208 dnl = Enable code optimization. ON by default.
2209 dnl ========================================================
2211 # Use value from moz.configure if one is defined. Else use our computed
2213 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
2214 MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
2217 if test "$COMPILE_ENVIRONMENT"; then
2218 if test -n "$MOZ_OPTIMIZE"; then
2219 AC_MSG_CHECKING([for valid C compiler optimization flags])
2220 _SAVE_CFLAGS=$CFLAGS
2221 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
2222 AC_TRY_COMPILE([#include <stdio.h>],
2223 [printf("Hello World\n");],
2226 AC_MSG_RESULT([$_results])
2227 if test "$_results" = "no"; then
2228 AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
2230 CFLAGS=$_SAVE_CFLAGS
2231 if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
2232 # When using llvm-based LTO, non numeric optimization levels are
2233 # not supported by the linker, so force the linker to use -O2 (
2234 # which doesn't influence the level compilation units are actually
2236 case " $MOZ_OPTIMIZE_FLAGS " in
2237 *\ -Os\ *|*\ -Oz\ *)
2238 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
2243 fi # COMPILE_ENVIRONMENT
2245 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
2246 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
2247 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
2249 dnl ========================================================
2250 dnl = Enable runtime logging
2251 dnl ========================================================
2252 AC_DEFINE(MOZ_LOGGING)
2253 AC_DEFINE(FORCE_PR_LOG)
2255 dnl ========================================================
2256 dnl = This will enable logging of addref, release, ctor, dtor.
2257 dnl ========================================================
2258 _ENABLE_LOGREFCNT=42
2259 MOZ_ARG_ENABLE_BOOL(logrefcnt,
2260 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
2261 _ENABLE_LOGREFCNT=1,
2262 _ENABLE_LOGREFCNT= )
2263 if test "$_ENABLE_LOGREFCNT" = "1"; then
2264 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
2265 elif test -z "$_ENABLE_LOGREFCNT"; then
2266 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
2269 dnl ========================================================
2270 dnl moz_dump_painting
2271 dnl ========================================================
2272 MOZ_ARG_ENABLE_BOOL(dump-painting,
2273 [ --enable-dump-painting Enable paint debugging.],
2274 MOZ_DUMP_PAINTING=1,
2275 MOZ_DUMP_PAINTING= )
2276 if test -n "$MOZ_DUMP_PAINTING"; then
2277 AC_DEFINE(MOZ_DUMP_PAINTING)
2278 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
2280 if test -n "$MOZ_DEBUG"; then
2281 AC_DEFINE(MOZ_DUMP_PAINTING)
2284 case "${OS_TARGET}" in
2285 Android|WINNT|Darwin)
2286 MOZ_GLUE_IN_PROGRAM=
2289 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
2290 MOZ_GLUE_IN_PROGRAM=1
2291 AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
2295 dnl ========================================================
2296 dnl = Jemalloc build setup
2297 dnl ========================================================
2298 if test -z "$MOZ_MEMORY"; then
2301 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
2302 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.])
2307 dnl The generic feature tests that determine how to compute ncpus are long and
2308 dnl complicated. Therefore, simply define special cpp variables for the
2309 dnl platforms we have special knowledge of.
2312 export MOZ_NO_DEBUG_RTL=1
2316 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
2318 dnl ========================================================
2319 dnl = Enable using the clang plugin to build
2320 dnl ========================================================
2322 if test -n "$COMPILE_ENVIRONMENT"; then
2323 MOZ_CONFIG_CLANG_PLUGIN
2324 fi # COMPILE_ENVIRONMENT
2326 dnl ========================================================
2327 dnl = Enable stripping of libs & executables
2328 dnl ========================================================
2329 MOZ_ARG_ENABLE_BOOL(strip,
2330 [ --enable-strip Enable stripping of libs & executables ],
2334 dnl ========================================================
2335 dnl = Enable stripping of libs & executables when packaging
2336 dnl ========================================================
2337 MOZ_ARG_ENABLE_BOOL(install-strip,
2338 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
2342 dnl ========================================================
2343 dnl = frontend JS debug mode
2344 dnl ========================================================
2346 MOZ_ARG_ENABLE_BOOL(debug-js-modules,
2347 [ --enable-debug-js-modules Enable debug mode for frontend JS libraries],
2351 AC_SUBST(DEBUG_JS_MODULES)
2353 dnl ========================================================
2355 dnl = Profiling and Instrumenting
2357 dnl ========================================================
2358 MOZ_ARG_HEADER(Profiling and Instrumenting)
2360 dnl ========================================================
2361 dnl = Offer a way to disable the startup cache
2362 dnl ========================================================
2364 MOZ_ARG_DISABLE_BOOL(startupcache,
2365 [ --disable-startupcache Disable startup cache ],
2366 MOZ_DISABLE_STARTUPCACHE=1,
2367 MOZ_DISABLE_STARTUPCACHE=)
2369 if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
2370 AC_DEFINE(MOZ_DISABLE_STARTUPCACHE)
2372 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
2374 dnl ========================================================
2375 dnl = Support for demangling undefined symbols
2376 dnl ========================================================
2377 if test -z "$SKIP_LIBRARY_CHECKS"; then
2380 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
2384 # Demangle only for debug or DMD builds
2385 MOZ_DEMANGLE_SYMBOLS=
2386 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
2387 MOZ_DEMANGLE_SYMBOLS=1
2388 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
2390 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
2392 dnl ========================================================
2393 dnl = Support for gcc stack unwinding (from gcc 3.3)
2394 dnl ========================================================
2395 if test -z "$SKIP_LIBRARY_CHECKS"; then
2398 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
2402 dnl ========================================================
2404 dnl ========================================================
2406 MOZ_ARG_WITH_STRING(jitreport-granularity,
2407 [ --jitreport-granularity=N
2408 Default granularity at which to report JIT code
2411 1 - code ranges for whole functions only
2412 2 - per-line information
2413 3 - per-op information],
2414 JITREPORT_GRANULARITY=$withval,
2415 JITREPORT_GRANULARITY=3)
2417 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
2419 dnl ========================================================
2423 dnl ========================================================
2424 MOZ_ARG_HEADER(Misc. Options)
2426 dnl ========================================================
2427 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
2428 dnl ========================================================
2429 MOZ_ARG_WITH_STRING(user-appdir,
2430 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
2431 [ val=`echo $withval`
2432 if echo "$val" | grep "\/" >/dev/null; then
2433 AC_MSG_ERROR("Homedir must be single relative path.")
2438 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
2440 if test -z "$SKIP_COMPILER_CHECKS"; then
2441 dnl ========================================================
2443 dnl = Compiler Options
2445 dnl ========================================================
2446 MOZ_ARG_HEADER(Compiler Options)
2448 dnl ========================================================
2449 dnl Check for gcc -pipe support
2450 dnl ========================================================
2451 AC_MSG_CHECKING([for -pipe support])
2452 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
2453 dnl Any gcc that supports firefox supports -pipe.
2454 CFLAGS="$CFLAGS -pipe"
2455 CXXFLAGS="$CXXFLAGS -pipe"
2456 AC_MSG_RESULT([yes])
2461 fi # ! SKIP_COMPILER_CHECKS
2465 if test "$COMPILE_ENVIRONMENT"; then
2467 fi # COMPILE_ENVIRONMENT
2469 dnl ========================================================
2471 dnl = Static Build Options
2473 dnl ========================================================
2474 MOZ_ARG_HEADER(Static build options)
2476 if test -z "$MOZ_SYSTEM_ZLIB"; then
2477 if test -n "$JS_SHARED_LIBRARY" -o -n "$MOZ_LINKER" -o "$MOZ_WIDGET_TOOLKIT" = android; then
2479 AC_DEFINE(ZLIB_IN_MOZGLUE)
2483 AC_SUBST(ZLIB_IN_MOZGLUE)
2485 dnl ========================================================
2487 dnl = Standalone module options
2489 dnl ========================================================
2490 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
2493 dnl ========================================================
2495 if test -z "$SKIP_PATH_CHECKS"; then
2496 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
2497 if test "$MOZ_ENABLE_GTK" ; then
2498 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
2503 if test -z "${GLIB_GMODULE_LIBS}" \
2504 -a -n "${GLIB_CONFIG}"\
2505 -a "${GLIB_CONFIG}" != no\
2507 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
2510 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
2512 if test "$USE_FC_FREETYPE"; then
2513 if test "$COMPILE_ENVIRONMENT"; then
2514 dnl ========================================================
2515 dnl = Check for freetype2 functionality
2516 dnl ========================================================
2517 if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
2519 _SAVE_CFLAGS="$CFLAGS"
2520 LIBS="$LIBS $FT2_LIBS"
2521 CFLAGS="$CFLAGS $FT2_CFLAGS"
2523 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
2524 ac_cv_member_FT_Bitmap_Size_y_ppem,
2525 [AC_TRY_COMPILE([#include <ft2build.h>
2526 #include FT_FREETYPE_H],
2528 if (sizeof s.y_ppem) return 0;
2530 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
2531 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
2532 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
2533 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
2535 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
2537 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
2538 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
2539 [FT_Bitmap_Size structure includes y_ppem field])
2541 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
2544 CFLAGS="$_SAVE_CFLAGS"
2547 _SAVE_CPPFLAGS="$CPPFLAGS"
2548 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
2549 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
2550 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
2551 CPPFLAGS="$_SAVE_CPPFLAGS"
2555 dnl ========================================================
2556 dnl Check if we need the 32-bit Linux SSE2 error dialog
2557 dnl ========================================================
2559 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
2561 dnl ========================================================
2562 dnl Check for pixman and cairo
2563 dnl ========================================================
2566 MOZ_ARG_ENABLE_BOOL(system-cairo,
2567 [ --enable-system-cairo Obsolete: do not use this option],
2568 AC_MSG_ERROR(--enable-system-cairo is not supported),
2572 MOZ_ARG_ENABLE_BOOL(system-pixman,
2573 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
2575 MOZ_TREE_PIXMAN=force,
2578 if test "$MOZ_TREE_PIXMAN"; then
2579 AC_DEFINE(MOZ_TREE_PIXMAN)
2581 PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.19.2)
2584 MOZ_CAIRO_CFLAGS="-I${DIST}/include/cairo"
2585 AC_DEFINE(MOZ_TREE_CAIRO)
2587 if test "$OS_ARCH" = "WINNT"; then
2588 # For now we assume that we will have a uint64_t available through
2589 # one of the above headers or mozstdint.h.
2590 AC_DEFINE(HAVE_UINT64_T)
2593 # Define macros for cairo-features.h
2594 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
2595 if test "$MOZ_X11"; then
2596 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
2597 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
2598 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
2600 if test "$_HAVE_FREETYPE2"; then
2601 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2602 MOZ_ENABLE_CAIRO_FT=1
2603 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
2606 case "$MOZ_WIDGET_TOOLKIT" in
2608 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
2609 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
2610 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
2613 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
2614 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
2615 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
2617 if test "$COMPILE_ENVIRONMENT"; then
2618 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
2622 if test "$USE_FC_FREETYPE"; then
2623 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
2625 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
2626 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
2628 AC_SUBST(PS_SURFACE_FEATURE)
2629 AC_SUBST(SVG_SURFACE_FEATURE)
2630 AC_SUBST(XLIB_SURFACE_FEATURE)
2631 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
2632 AC_SUBST(QUARTZ_SURFACE_FEATURE)
2633 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
2634 AC_SUBST(WIN32_SURFACE_FEATURE)
2635 AC_SUBST(OS2_SURFACE_FEATURE)
2636 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
2637 AC_SUBST(FT_FONT_FEATURE)
2638 AC_SUBST(FC_FONT_FEATURE)
2639 AC_SUBST(WIN32_FONT_FEATURE)
2640 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
2641 AC_SUBST(QUARTZ_FONT_FEATURE)
2642 AC_SUBST(PNG_FUNCTIONS_FEATURE)
2643 AC_SUBST(QT_SURFACE_FEATURE)
2644 AC_SUBST(TEE_SURFACE_FEATURE)
2646 if test "$MOZ_X11"; then
2647 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
2650 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
2652 case "$MOZ_WIDGET_TOOLKIT" in
2654 TK_CFLAGS="$MOZ_CAIRO_CFLAGS $MOZ_PIXMAN_CFLAGS"
2655 TK_LIBS="$MOZ_CAIRO_LIBS $MOZ_PIXMAN_LIBS"
2659 AC_SUBST(MOZ_TREE_CAIRO)
2660 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
2661 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
2662 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
2663 AC_SUBST(MOZ_TREE_PIXMAN)
2665 BINDGEN_SYSTEM_FLAGS="$_BINDGEN_CFLAGS $NSPR_CFLAGS $NSS_CFLAGS $MOZ_PIXMAN_CFLAGS $MOZ_CAIRO_CFLAGS"
2666 AC_SUBST(BINDGEN_SYSTEM_FLAGS)
2667 BINDGEN_SYSTEM_TOML_FLAGS="$BINDGEN_SYSTEM_FLAGS"
2668 AC_SUBST_TOML_LIST(BINDGEN_SYSTEM_TOML_FLAGS)
2670 dnl ========================================================
2672 dnl ========================================================
2673 MOZ_ARG_DISABLE_BOOL(xul,
2674 [ --disable-xul Disable XUL],
2676 if test "$MOZ_XUL"; then
2679 dnl remove extensions that require XUL
2680 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
2685 dnl ========================================================
2686 dnl necko configuration options
2687 dnl ========================================================
2690 dnl option to disable necko's wifi scanner
2693 if test "$MOZ_WIDGET_TOOLKIT"; then
2695 case "$OS_TARGET" in
2697 if test -z "$MOZ_IOS"; then
2701 DragonFly|FreeBSD|WINNT)
2712 MOZ_ARG_DISABLE_BOOL(necko-wifi,
2713 [ --disable-necko-wifi Disable necko wifi scanner],
2717 if test "$NECKO_WIFI"; then
2718 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
2719 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
2721 AC_DEFINE(NECKO_WIFI)
2722 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
2724 AC_SUBST(NECKO_WIFI)
2725 AC_SUBST(NECKO_WIFI_DBUS)
2728 dnl option to disable cookies
2730 MOZ_ARG_DISABLE_BOOL(cookies,
2731 [ --disable-cookies Disable cookie support],
2734 AC_SUBST(NECKO_COOKIES)
2735 if test "$NECKO_COOKIES"; then
2736 AC_DEFINE(NECKO_COOKIES)
2737 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
2740 dnl ========================================================
2742 dnl = Maintainer debug option (no --enable equivalent)
2744 dnl ========================================================
2747 AC_SUBST_LIST(ASFLAGS)
2751 AC_SUBST(MOZ_AUTH_EXTENSION)
2752 AC_SUBST(MOZ_PREF_EXTENSIONS)
2753 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
2754 AC_SUBST_LIST(WARNINGS_CFLAGS)
2755 AC_SUBST_SET(MOZ_EXTENSIONS)
2757 AC_SUBST(MOZ_UNIVERSALCHARDET)
2758 AC_SUBST(MOZ_SPELLCHECK)
2759 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
2760 AC_SUBST(MOZ_CRASHREPORTER)
2761 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
2762 AC_SUBST(MOZ_STUB_INSTALLER)
2763 AC_SUBST(MOZ_UPDATER)
2765 AC_SUBST(MOZ_ANDROID_APPLICATION_CLASS)
2766 AC_SUBST(MOZ_ANDROID_BROWSER_INTENT_CLASS)
2767 AC_SUBST(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
2768 AC_SUBST(ENABLE_STRIP)
2769 AC_SUBST(PKG_SKIP_STRIP)
2770 AC_SUBST(STRIP_FLAGS)
2771 AC_SUBST(INCREMENTAL_LINKER)
2773 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
2775 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
2776 AC_SUBST(MOZ_LINKER_EXTRACT)
2778 if test -n "$MOZ_BINARY_EXTENSIONS"; then
2779 AC_DEFINE(MOZ_BINARY_EXTENSIONS)
2782 AC_SUBST(MOZ_REQUIRE_SIGNING)
2783 if test "$MOZ_REQUIRE_SIGNING" = 1; then
2784 AC_DEFINE(MOZ_REQUIRE_SIGNING)
2787 dnl ========================================================
2788 dnl = Mac bundle name prefix
2789 dnl ========================================================
2790 MOZ_ARG_WITH_STRING(macbundlename-prefix,
2791 [ --with-macbundlename-prefix=prefix
2792 Prefix for MOZ_MACBUNDLE_NAME],
2793 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
2795 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
2796 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
2797 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
2800 if test "$MOZ_DEBUG"; then
2801 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
2803 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
2805 AC_SUBST(MOZ_MACBUNDLE_NAME)
2807 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
2808 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
2809 # Otherwise, use MOZ_APP_DISPLAYNAME
2810 if test -z "$MOZ_MACBUNDLE_ID"; then
2811 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
2813 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
2814 if test "$MOZ_DEBUG"; then
2815 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
2818 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
2819 AC_SUBST(MOZ_MACBUNDLE_ID)
2821 dnl ========================================================
2822 dnl = Child Process Name for IPC
2823 dnl ========================================================
2824 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
2825 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
2827 # We want to let Android unpack the file at install time, but it only does
2828 # so if the file is named libsomething.so. The lib/ path is also required
2829 # because the unpacked file will be under the lib/ subdirectory and will
2830 # need to be executed from that path.
2831 MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
2833 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
2834 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
2836 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
2837 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
2838 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
2840 # The following variables are available to branding and application
2841 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
2842 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
2843 # impacts profile location and user-visible fields.
2844 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
2845 # versions of a given application (e.g. Aurora and Firefox both use
2846 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
2847 # for application.ini's "Name" field, which controls profile location in
2848 # the absence of a "Profile" field (see below), and various system
2849 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
2850 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
2851 # Mac Bundle name, Updater, Installer), it is typically used for nightly
2852 # builds (e.g. Aurora for Firefox).
2853 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
2854 # defaults to a lowercase form of MOZ_APP_BASENAME.
2855 # - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
2856 # profile name and remoting. If not set, defaults to MOZ_APP_NAME.
2857 # - MOZ_APP_PROFILE: When set, used for application.ini's
2858 # "Profile" field, which controls profile location.
2859 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
2860 # crash reporter server url.
2861 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
2863 # The following environment variables used to have an effect, but don't anymore:
2864 # - MOZ_APP_VERSION: Defines the application version number. This was replaced with
2865 # the contents from the version.txt file in the application directory, or
2866 # browser/config/version.txt if there isn't one.
2867 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
2868 # in the "About" window. This was replaced with the contents from the
2869 # version_display.txt or version.txt in the application directory, or
2870 # browser/config/version_display.txt.
2872 if test -z "$MOZ_APP_NAME"; then
2873 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
2876 if test -z "$MOZ_APP_REMOTINGNAME"; then
2877 MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
2880 if test -z "$ANDROID_PACKAGE_NAME" ; then
2881 # When we got rid of the Aurora channel we decided to replace the old
2882 # Nightly ANDROID_PACKAGE_NAME with Aurora. To make sure this is inherited
2883 # by all mozilla-central based branches we make this the new "default"
2884 # for Fennec. Non mozilla-central based branches set ANDROID_PACKAGE_NAME
2885 # in their mozconfig, so they will never get this. If there are ever
2886 # non-Fennec builds for Android, they will fall into the else block
2887 # and use their own default name.
2888 # https://bugzilla.mozilla.org/show_bug.cgi?id=1357808 has additional
2889 # background on this.
2890 if test "$MOZ_APP_NAME" = "fennec"; then
2891 ANDROID_PACKAGE_NAME="org.mozilla.fennec_aurora"
2893 ANDROID_PACKAGE_NAME="org.mozilla.$MOZ_APP_NAME"
2897 # For extensions and langpacks, we require a max version that is compatible
2898 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
2899 # 24.0a1 and 24.0a2 aren't affected
2901 # 24.1.1 becomes 24.*
2902 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
2903 if test -z "$IS_ALPHA"; then
2905 if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
2906 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
2908 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
2912 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
2915 AC_SUBST(MOZ_APP_NAME)
2916 AC_SUBST(MOZ_APP_REMOTINGNAME)
2917 AC_SUBST(MOZ_APP_DISPLAYNAME)
2918 AC_SUBST(MOZ_APP_BASENAME)
2919 AC_SUBST(MOZ_APP_VENDOR)
2920 AC_SUBST(MOZ_APP_PROFILE)
2921 AC_SUBST(MOZ_APP_ID)
2922 AC_SUBST(MAR_CHANNEL_ID)
2923 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
2924 AC_SUBST(MOZ_PROFILE_MIGRATOR)
2925 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
2926 AC_SUBST(MOZ_APP_UA_NAME)
2927 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
2928 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
2929 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
2931 AC_SUBST(MOZ_APP_MAXVERSION)
2932 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
2933 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
2934 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
2937 AC_SUBST(MOZ_PKG_SPECIAL)
2938 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
2940 if test "$MOZILLA_OFFICIAL"; then
2941 # Build revisions should always be present in official builds
2942 MOZ_INCLUDE_SOURCE_INFO=1
2945 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
2946 # explicitly set the repository and changeset information in.
2947 AC_SUBST(MOZ_SOURCE_REPO)
2948 AC_SUBST(MOZ_SOURCE_CHANGESET)
2949 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
2951 dnl If we have any service that uploads data (and requires data submission
2952 dnl policy alert), set MOZ_DATA_REPORTING.
2953 dnl We need SUBST for build system and DEFINE for xul preprocessor.
2954 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER" || test -n "$MOZ_NORMANDY"; then
2955 MOZ_DATA_REPORTING=1
2956 AC_DEFINE(MOZ_DATA_REPORTING)
2957 AC_SUBST(MOZ_DATA_REPORTING)
2961 AC_SUBST(WIN32_REDIST_DIR)
2962 AC_SUBST(WIN_UCRT_REDIST_DIR)
2964 dnl ========================================================
2966 dnl ========================================================
2970 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
2976 dnl Echo the CFLAGS to remove extra whitespace.
2978 $_COMPILATION_CFLAGS \
2982 $_WARNINGS_CXXFLAGS \
2983 $_COMPILATION_CXXFLAGS \
2986 COMPILE_CFLAGS=`echo \
2990 COMPILE_CXXFLAGS=`echo \
2991 $_DEFINES_CXXFLAGS \
2995 $_WARNINGS_HOST_CFLAGS \
2996 $_COMPILATION_HOST_CFLAGS \
2999 HOST_CXXFLAGS=`echo \
3000 $_WARNINGS_HOST_CXXFLAGS \
3001 $_COMPILATION_HOST_CXXFLAGS \
3004 AC_SUBST(MOZ_SYSTEM_PNG)
3006 AC_SUBST_LIST(MOZ_PNG_CFLAGS)
3007 AC_SUBST_LIST(MOZ_PNG_LIBS)
3009 AC_SUBST(MOZ_SYSTEM_NSPR)
3011 AC_SUBST(MOZ_SYSTEM_NSS)
3013 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
3014 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
3015 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
3016 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
3017 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
3018 OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
3019 OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
3021 AC_SUBST(HOST_CMFLAGS)
3022 AC_SUBST(HOST_CMMFLAGS)
3023 AC_SUBST(OS_COMPILE_CMFLAGS)
3024 AC_SUBST(OS_COMPILE_CMMFLAGS)
3027 OS_CXXFLAGS="$CXXFLAGS"
3028 OS_CPPFLAGS="$CPPFLAGS"
3029 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
3030 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
3031 OS_LDFLAGS="$LDFLAGS"
3033 AC_SUBST_LIST(OS_CFLAGS)
3034 AC_SUBST_LIST(OS_CXXFLAGS)
3035 AC_SUBST_LIST(OS_CPPFLAGS)
3036 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
3037 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
3038 AC_SUBST_LIST(OS_LDFLAGS)
3043 AC_SUBST_LIST(HOST_CFLAGS)
3044 AC_SUBST_LIST(HOST_CPPFLAGS)
3045 AC_SUBST_LIST(HOST_CXXFLAGS)
3046 AC_SUBST(HOST_LDFLAGS)
3047 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
3048 AC_SUBST(HOST_BIN_SUFFIX)
3050 AC_SUBST(TARGET_XPCOM_ABI)
3051 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
3052 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
3053 AC_SUBST(HAVE_X86_AVX2)
3054 AC_SUBST(HAVE_ALTIVEC)
3056 AC_SUBST_LIST(DSO_CFLAGS)
3057 AC_SUBST_LIST(DSO_PIC_CFLAGS)
3058 AC_SUBST(DSO_LDOPTS)
3059 AC_SUBST(BIN_SUFFIX)
3061 AC_SUBST(NS_ENABLE_TSF)
3062 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
3063 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
3065 AC_SUBST(MOZ_DEVTOOLS)
3067 AC_SUBST(MOZ_PACKAGE_JSSHELL)
3068 AC_SUBST(MOZ_FOLD_LIBS)
3069 AC_SUBST_LIST(MOZ_FOLD_LIBS_FLAGS)
3073 dnl Host JavaScript runtime, if any, to use during cross compiles.
3076 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
3078 if test -n "$COMPILE_ENVIRONMENT"; then
3079 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
3081 dnl Check for missing components
3082 if test "$MOZ_X11"; then
3083 dnl ====================================================
3084 dnl = Check if X headers exist
3085 dnl ====================================================
3086 _SAVE_CFLAGS=$CFLAGS
3087 CFLAGS="$CFLAGS $XCFLAGS"
3091 #include <X11/Xlib.h>
3092 #include <X11/Intrinsic.h>
3093 #include <X11/extensions/XShm.h>
3097 if ((dpy = XOpenDisplay(NULL)) == NULL) {
3098 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
3102 [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
3103 CFLAGS="$_SAVE_CFLAGS"
3105 if test -n "$MISSING_X"; then
3106 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
3111 fi # COMPILE_ENVIRONMENT
3113 dnl Set various defines and substitutions
3114 dnl ========================================================
3116 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
3117 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
3118 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
3119 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
3120 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
3121 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
3122 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
3123 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
3124 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
3127 AC_SUBST(MOZ_DEV_EDITION)
3128 if test -n "$MOZ_DEV_EDITION"; then
3129 AC_DEFINE(MOZ_DEV_EDITION)
3132 if test "$MOZ_DEBUG" -o "$DEVELOPER_OPTIONS"; then
3136 if test -n "$A11Y_LOG"; then
3140 dnl Spit out some output
3141 dnl ========================================================
3143 dnl The following defines are used by xpcom
3144 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
3156 # Avoid using obsolete NSPR features
3157 AC_DEFINE(NO_NSPR_10_SUPPORT)
3159 MOZ_CREATE_CONFIG_STATUS()
3161 rm -fr confdefs* $ac_clean_files