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
64 STARTUP_NOTIFICATION_VERSION=0.8
68 dnl Set various checks
69 dnl ========================================================
72 dnl Initialize the Pthread test variables early so they can be
73 dnl overridden by each platform.
74 dnl ========================================================
78 LDFLAGS="$LDFLAGS $LINKER_LDFLAGS"
80 if test "$COMPILE_ENVIRONMENT"; then
82 fi # COMPILE_ENVIRONMENT
85 *-android*|*-linuxandroid*)
88 AC_PATH_PROG(OBJCOPY,objcopy)
98 AC_SUBST(ANDROID_PACKAGE_NAME)
101 dnl ========================================================
102 dnl Checks for compilers.
103 dnl ========================================================
105 if test "$COMPILE_ENVIRONMENT"; then
107 if test "$target" != "$host"; then
113 # Work around the conftest.exe access problem on Windows
118 MOZ_PATH_PROGS(AS, $AS as, $CC)
119 AC_CHECK_PROGS(STRIP, strip, :)
120 AC_CHECK_PROGS(OTOOL, otool, :)
123 if test -n "$MOZ_WINCONSOLE"; then
124 AC_DEFINE(MOZ_WINCONSOLE)
129 dnl ========================================================
130 dnl Special win32 checks
131 dnl ========================================================
137 if test "$GCC" != "yes"; then
138 # Check to see if we are really running in a msvc environemnt
141 # Make sure compilers are valid
142 CFLAGS="$CFLAGS -nologo"
143 CXXFLAGS="$CXXFLAGS -TP -nologo"
146 AC_TRY_COMPILE([#include <stdio.h>],
147 [ printf("Hello World\n"); ],,
148 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
151 AC_TRY_COMPILE([#include <new.h>],
152 [ unsigned *test = new unsigned(42); ],,
153 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
157 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
160 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
161 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
162 AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
165 MSVC_C_RUNTIME_DLL=vcruntime140.dll
166 MSVC_CXX_RUNTIME_DLL=msvcp140.dll
168 # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
169 CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
171 if test -n "$WIN_UCRT_REDIST_DIR"; then
172 if test ! -d "$WIN_UCRT_REDIST_DIR"; then
173 AC_MSG_ERROR([Invalid Windows UCRT Redist directory: ${WIN_UCRT_REDIST_DIR}])
175 WIN_UCRT_REDIST_DIR=`cd "$WIN_UCRT_REDIST_DIR" && pwd -W`
178 AC_SUBST(MSVC_C_RUNTIME_DLL)
179 AC_SUBST(MSVC_CXX_RUNTIME_DLL)
181 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
183 if test -n "$WIN32_REDIST_DIR"; then
184 if test ! -d "$WIN32_REDIST_DIR"; then
185 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
187 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd -W`
190 # Check linker version, except in lld builds
195 _LD_FULL_VERSION=`"${LINKER}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
196 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
197 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
198 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
205 unset _MSVC_VER_FILTER
208 STL_FLAGS="-I${DIST}/stl_wrappers"
210 # Check w32api version
211 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
212 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
213 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
214 AC_TRY_COMPILE([#include <w32api.h>],
215 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
216 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
217 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
218 #error "test failed."
220 , [ res=yes ], [ res=no ])
221 AC_MSG_RESULT([$res])
222 if test "$res" != "yes"; then
223 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
225 # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
226 # causing problems with local implementations with the same name.
227 AC_DEFINE(STRSAFE_NO_DEPRECATE)
230 CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
231 CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
233 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
234 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
235 # Require OS features provided by IE 8.0 (Win7)
236 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0800)
241 if test -n "$_WIN32_MSVC"; then
243 SKIP_COMPILER_CHECKS=1
244 SKIP_LIBRARY_CHECKS=1
246 # Since we're skipping compiler and library checks, hard-code
249 AC_DEFINE(HAVE_ISATTY)
252 fi # COMPILE_ENVIRONMENT
257 AC_SUBST_LIST(STL_FLAGS)
258 AC_SUBST(WRAP_STL_INCLUDES)
260 dnl ========================================================
261 dnl Checks for programs.
262 dnl ========================================================
263 if test "$COMPILE_ENVIRONMENT"; then
269 fi # COMPILE_ENVIRONMENT
271 dnl ========================================================
272 dnl set the defaults first
273 dnl ========================================================
274 MOZ_USER_DIR=".mozilla"
276 MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
280 dnl Configure platform-specific CPU architecture compiler options.
281 dnl ==============================================================
282 if test "$COMPILE_ENVIRONMENT"; then
284 fi # COMPILE_ENVIRONMENT
286 dnl ========================================================
287 dnl Android libstdc++
288 dnl ========================================================
291 if test "$COMPILE_ENVIRONMENT"; then
293 fi # COMPILE_ENVIRONMENT
295 dnl ========================================================
296 dnl Suppress Clang Argument Warnings
297 dnl ========================================================
298 WARNINGS_CFLAGS="$_WARNINGS_CFLAGS"
299 if test -n "${CLANG_CC}${CLANG_CL}"; then
300 WARNINGS_CFLAGS="-Qunused-arguments $WARNINGS_CFLAGS"
301 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
303 if test -n "${CLANG_CXX}${CLANG_CL}"; then
304 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
307 if test -n "$COMPILE_ENVIRONMENT"; then
311 dnl ========================================================
312 dnl GNU specific defaults
313 dnl ========================================================
314 if test "$GNU_CC"; then
318 SSSE3_FLAGS="-mssse3"
319 # FIXME: Let us build with strict aliasing. bug 414641.
320 CFLAGS="$CFLAGS -fno-strict-aliasing"
323 if test "$OS_ARCH" != "WINNT" -o -z "$CLANG_CC"; then
324 DSO_PIC_CFLAGS='-fPIC'
325 ASFLAGS="$ASFLAGS -fPIC"
328 AC_MSG_CHECKING([for --noexecstack option to as])
330 CFLAGS="$CFLAGS -Wa,--noexecstack"
331 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
332 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
335 AC_MSG_CHECKING([for -z noexecstack option to ld])
336 _SAVE_LDFLAGS=$LDFLAGS
337 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
338 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
340 LDFLAGS=$_SAVE_LDFLAGS)
342 AC_MSG_CHECKING([for -z text option to ld])
343 _SAVE_LDFLAGS=$LDFLAGS
344 LDFLAGS="$LDFLAGS -Wl,-z,text"
345 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
347 LDFLAGS=$_SAVE_LDFLAGS)
349 AC_MSG_CHECKING([for -z relro option to ld])
350 _SAVE_LDFLAGS=$LDFLAGS
351 LDFLAGS="$LDFLAGS -Wl,-z,relro"
352 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
354 LDFLAGS=$_SAVE_LDFLAGS)
356 AC_MSG_CHECKING([for -z nocopyreloc option to ld])
357 _SAVE_LDFLAGS=$LDFLAGS
358 LDFLAGS="$LDFLAGS -Wl,-z,nocopyreloc"
359 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
361 LDFLAGS=$_SAVE_LDFLAGS)
363 AC_MSG_CHECKING([for -Bsymbolic-functions option to ld])
364 _SAVE_LDFLAGS=$LDFLAGS
365 LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
366 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
368 LDFLAGS=$_SAVE_LDFLAGS)
370 AC_MSG_CHECKING([for --build-id=sha1 option to ld])
371 _SAVE_LDFLAGS=$LDFLAGS
372 LDFLAGS="$LDFLAGS -Wl,--build-id=sha1"
373 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
375 LDFLAGS=$_SAVE_LDFLAGS)
377 AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
378 HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
379 _SAVE_LDFLAGS=$LDFLAGS
380 LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
381 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
382 [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
384 LDFLAGS=$_SAVE_LDFLAGS
386 # Check for -mssse3 on $CC
387 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
388 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
390 CFLAGS="$CFLAGS -mssse3"
391 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
392 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
396 # Check for -msse4.1 on $CC
397 AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
398 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
400 CFLAGS="$CFLAGS -msse4.1"
401 AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
402 [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
406 case "${CPU_ARCH}" in
408 AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
410 [asm volatile ("vpermq \$0xd8,%ymm0,%ymm0 \n");],
411 result="yes", result="no")
412 AC_MSG_RESULT("$result")
413 if test "$result" = "yes"; then
419 AC_MSG_CHECKING([whether we can enable AltiVec support])
422 CFLAGS="$CFLAGS -maltivec"
423 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
431 if test "$GCC_USE_GNU_LD"; then
432 # Some tools like ASan use a runtime library that is only
433 # linked against executables, so we must allow undefined
434 # symbols for shared objects in some cases.
435 if test -z "$MOZ_ASAN$MOZ_MSAN$MOZ_UBSAN$MOZ_TSAN$FUZZING_INTERFACES"; then
436 # Don't allow undefined symbols in libraries
437 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
439 # BSDs need `environ' exposed for posix_spawn (bug 753046)
441 DragonFly|FreeBSD|NetBSD|OpenBSD)
442 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
443 DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
445 DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
452 _DEFINES_CFLAGS="-include $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
453 _USE_CPP_INCLUDE_FLAG=1
455 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
458 if test "$GNU_CXX"; then
459 # FIXME: Let us build with strict aliasing. bug 414641.
460 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
462 _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
463 _USE_CPP_INCLUDE_FLAG=1
466 # For profiling builds keep the symbol information
467 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
469 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
470 STRIP_FLAGS="--strip-debug"
475 dnl ========================================================
477 dnl ========================================================
479 if test "$MOZ_DMD"; then
480 if test "${CPU_ARCH}" = "arm"; then
481 CFLAGS="$CFLAGS -funwind-tables"
482 CXXFLAGS="$CXXFLAGS -funwind-tables"
486 dnl ========================================================
487 dnl System overrides of the defaults for host
488 dnl ========================================================
491 if test -n "$_WIN32_MSVC"; then
492 HOST_CFLAGS="$HOST_CFLAGS -nologo"
494 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
496 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
497 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
500 case "${host_cpu}" in
502 if test -n "$_WIN32_MSVC"; then
503 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
507 if test -n "$_WIN32_MSVC"; then
508 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
510 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
516 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
517 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
520 *-linux*|*-kfreebsd*-gnu|*-gnu*)
521 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
522 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
526 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
527 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
531 dnl ========================================================
532 dnl System overrides of the defaults for target
533 dnl ========================================================
537 MOZ_OPTIMIZE_FLAGS="-O3"
538 CXXFLAGS="$CXXFLAGS -stdlib=libc++"
540 STRIP_FLAGS="$STRIP_FLAGS -x -S"
541 # Ensure that if we're targeting iOS an SDK was provided.
542 AC_CACHE_CHECK(for iOS target,
544 [AC_TRY_COMPILE([#include <TargetConditionals.h>
545 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
549 ac_cv_ios_target="yes",
550 ac_cv_ios_target="no")])
551 if test "$ac_cv_ios_target" = "yes" -a -z $MOZ_IOS; then
552 AC_MSG_ERROR([targeting iOS but not using an iOS SDK?])
554 if test -z "$MOZ_IOS"; then
555 # The ExceptionHandling framework is needed for Objective-C exception
556 # logging code in nsObjCExceptions.h. Currently we only use that in debug
558 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
561 dnl DTrace and -dead_strip don't interact well. See bug 403132.
562 dnl ===================================================================
563 if test "x$enable_dtrace" = "xyes"; then
564 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
566 dnl check for the presence of the -dead_strip linker flag
567 AC_MSG_CHECKING([for -dead_strip option to ld])
568 _SAVE_LDFLAGS=$LDFLAGS
569 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
570 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
571 if test -n "$_HAVE_DEAD_STRIP" ; then
573 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
578 LDFLAGS=$_SAVE_LDFLAGS
581 MOZ_FIX_LINK_PATHS="-Wl,-executable_path,${DIST}/bin"
584 *-android*|*-linuxandroid*)
585 if test "$COMPILE_ENVIRONMENT" -a -n "$MOZ_MEMORY"; then
589 MOZ_GFX_OPTIMIZE_MOBILE=1
590 if test -z "$CLANG_CC"; then
591 MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
593 # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
594 # -Oz is smaller than -Os on clang.
595 MOZ_OPTIMIZE_FLAGS="-Oz"
596 # Disable the outliner, which causes performance regressions, and is
597 # enabled on some platforms at -Oz.
598 if test -z "$MOZ_LTO"; then
599 DISABLE_OUTLINER="-mno-outline"
601 CFLAGS="$CFLAGS $DISABLE_OUTLINER"
602 AC_TRY_COMPILE(,,[MOZ_OPTIMIZE_FLAGS="$MOZ_OPTIMIZE_FLAGS $DISABLE_OUTLINER"])
603 CFLAGS="$_SAVE_CFLAGS"
605 DISABLE_OUTLINER="-Wl,-plugin-opt=-enable-machine-outliner=never"
606 _SAVE_LDFLAGS=$LDFLAGS
607 LDFLAGS="$LDFLAGS $MOZ_LTO_LDFLAGS $DISABLE_OUTLINER"
608 AC_TRY_LINK(,,[MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS $DISABLE_OUTLINER"])
609 LDFLAGS="$_SAVE_LDFLAGS"
615 if test "$GNU_CC" -o "$GNU_CXX"; then
616 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
617 if test -n "$MOZ_DEBUG"; then
618 MOZ_OPTIMIZE_FLAGS="-Os"
620 MOZ_OPTIMIZE_FLAGS="-O2"
622 if test -z "$CLANG_CC"; then
623 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
627 case "${target_cpu}" in
629 CFLAGS="$CFLAGS -mieee"
630 CXXFLAGS="$CXXFLAGS -mieee"
637 # certain versions of cygwin's makedepend barf on the
638 # #include <string> vs -I./dist/include/string issue so don't use it
639 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
640 # $GNU_CC will match gcc and clang; while $CLANG_CC will match only clang
641 if test -z "$CLANG_CC"; then
642 AC_MSG_ERROR(Firefox cannot be built with mingw-gcc and requires a mingw-clang toolchain to work)
646 # Use temp file for windres (bug 213281)
647 RCFLAGS='-O coff --use-temp-file'
648 # mingw doesn't require kernel32, user32, and advapi32 explicitly
649 LIBS="$LIBS -luuid -lusp10 -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
652 MOZ_OPTIMIZE_FLAGS="-O2"
654 WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
655 WIN32_GUI_EXE_LDFLAGS=-mwindows
657 # Silence problematic clang warnings
658 CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
660 TARGET_COMPILER_ABI=msvc
661 RANLIB='echo not_ranlib'
662 STRIP='echo not_strip'
664 # aarch64 doesn't support subsystems below 6.02
665 if test "$CPU_ARCH" = "aarch64"; then
666 WIN32_SUBSYSTEM_VERSION=6.02
668 WIN32_SUBSYSTEM_VERSION=6.01
670 WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
671 WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
672 DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
673 _USE_CPP_INCLUDE_FLAG=1
674 _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
675 _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
676 CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
677 CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
678 if test -z "$CLANG_CL"; then
679 CPPFLAGS="$CPPFLAGS -utf-8"
681 if test "$CPU_ARCH" = "x86"; then
682 dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
683 dnl more recent, so set that explicitly here unless another
684 dnl target arch has already been set.
686 if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
687 CFLAGS="$CFLAGS -arch:SSE2"
689 if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
690 CXXFLAGS="$CXXFLAGS -arch:SSE2"
693 SSE_FLAGS="-arch:SSE"
694 SSE2_FLAGS="-arch:SSE2"
695 dnl MSVC allows the use of intrinsics without any flags
696 dnl and doesn't have a separate arch for SSSE3
697 SSSE3_FLAGS="-arch:SSE2"
699 dnl clang-cl requires appropriate flags to enable SSSE3 support
700 dnl on all architectures.
701 if test -n "$CLANG_CL"; then
702 SSSE3_FLAGS="-mssse3"
704 dnl VS2013+ supports -Gw for better linker optimizations.
705 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
706 dnl Disabled on ASan because it causes false-positive ODR violations.
707 if test -z "$MOZ_ASAN"; then
709 CXXFLAGS="$CXXFLAGS -Gw"
711 # String tail merging doesn't play nice with ASan's ODR checker.
712 LDFLAGS="$LDFLAGS -opt:nolldtailmerge"
714 if test -n "$CLANG_CL"; then
715 # XXX We should combine some of these with our generic GCC-style
718 # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
719 CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
720 # We use offsetof on non-POD objects all the time.
721 # We also suppress this warning on other platforms.
722 CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
723 # This warns for reasonable things like:
724 # enum { X = 0xffffffffU };
725 # which is annoying for IDL headers.
726 CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
727 # This warns for cases that would be reached by the Microsoft
728 # #include rules, but also currently warns on cases that would
729 # *also* be reached by standard C++ include rules. That
730 # behavior doesn't seem useful, so we turn it off.
731 CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
732 # We normally error out on unknown pragmas, but since clang-cl
733 # claims to be MSVC, it would be difficult to add
734 # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
735 # use such pragmas, so just ignore them.
736 CFLAGS="$CFLAGS -Wno-unknown-pragmas"
737 CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
738 # We get errors about various #pragma intrinsic directives from
739 # clang-cl, and we don't need to hear about those.
740 CFLAGS="$CFLAGS -Wno-ignored-pragmas"
741 CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
742 # clang-cl's Intrin.h marks things like _ReadWriteBarrier
743 # as __attribute((__deprecated__)). This is nice to know,
744 # but since we don't get the equivalent warning from MSVC,
745 # let's just ignore it.
746 CFLAGS="$CFLAGS -Wno-deprecated-declarations"
747 CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
748 # We use a function like:
749 # __declspec(noreturn) __inline void f() {}
750 # which -Winvalid-noreturn complains about. Again, MSVC seems
751 # OK with it, so let's silence the warning.
752 CFLAGS="$CFLAGS -Wno-invalid-noreturn"
753 CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
754 # Missing |override| on virtual function declarations isn't
755 # something that MSVC currently warns about.
756 CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
757 # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
758 # declaration on |operator delete(void*)|. However, clang-cl
759 # must internally declare |operator delete(void*)| differently,
760 # which causes this warning for virtually every file in the
761 # tree. clang-cl doesn't support -fno-exceptions or equivalent,
762 # so there doesn't seem to be any way to convince clang-cl to
763 # declare |delete| differently. Therefore, suppress this
765 CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
766 # Macros like STDMETHOD() and IFACEMETHOD() can declare
767 # __attribute__((nothrow)) on their respective method declarations,
768 # while the definitions are left without the matching attribute.
769 CXXFLAGS="$CXXFLAGS -Wno-microsoft-exception-spec"
770 # At least one MSVC header and several headers in-tree have
771 # unused typedefs, so turn this on.
772 CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
773 # jemalloc uses __declspec(allocator) as a profiler hint,
774 # which clang-cl doesn't understand.
775 CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
776 # __attribute__((unused)) really means "might be unused" and
777 # we use it to avoid warnings about things that are unused
778 # in some compilation units, but used in many others. This
779 # warning insists on complaining about the latter case, which
780 # is annoying, and rather noisy.
781 CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused"
783 # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
784 CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
785 LIBS="$LIBS user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
786 MOZ_DEBUG_LDFLAGS='-DEBUG'
787 # Use a higher optimization level for clang-cl, so we can come closer
788 # to MSVC's performance numbers (see bug 1443590).
789 if test -n "$CLANG_CL"; then
790 MOZ_OPTIMIZE_FLAGS='-O2'
792 MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
795 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE"
796 if test -z "$DEVELOPER_OPTIONS"; then
797 LDFLAGS="$LDFLAGS -RELEASE"
800 dnl Minimum reqiurement of Gecko is VS2015 or later which supports
801 dnl both SSSE3 and SSE4.1.
802 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
803 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
804 dnl allow AVX2 code from VS2015
807 AC_DEFINE(WIN32_LEAN_AND_MEAN)
808 dnl See http://support.microsoft.com/kb/143208 to use STL
811 MOZ_USER_DIR="Mozilla"
815 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.])
821 if test -n "$GNU_CC"; then
822 CFLAGS="$CFLAGS -mstackrealign"
823 CXXFLAGS="$CXXFLAGS -mstackrealign"
824 LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
826 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
827 LDFLAGS="$LDFLAGS -SAFESEH"
833 if test -n "$_WIN32_MSVC"; then
834 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
839 if test -n "$_WIN32_MSVC"; then
840 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:ARM64"
845 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
852 CFLAGS="$CFLAGS -Dunix"
853 CXXFLAGS="$CXXFLAGS -Dunix"
854 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
855 DSO_PIC_CFLAGS='-fPIC -DPIC'
857 MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
859 DSO_PIC_CFLAGS='-fPIC -DPIC'
862 # This will fail on a.out systems prior to 1.5.1_ALPHA.
863 if test "$LIBRUNPATH"; then
864 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
869 if test -z "$X11BASE"; then
872 MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
874 DSO_PIC_CFLAGS='-fPIC'
875 DSO_LDOPTS='-shared -fPIC'
876 if test "$LIBRUNPATH"; then
877 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
882 MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
887 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
888 MOZ_OPTIMIZE_FLAGS="-O"
891 AC_SUBST_LIST(MMX_FLAGS)
892 AC_SUBST_LIST(SSE_FLAGS)
893 AC_SUBST_LIST(SSE2_FLAGS)
894 AC_SUBST_LIST(SSSE3_FLAGS)
897 if test -n "$MOZ_LINKER"; then
898 AC_DEFINE(MOZ_LINKER)
900 AC_CHECK_PROGS(XZ, xz)
903 if test -z "$COMPILE_ENVIRONMENT"; then
904 SKIP_COMPILER_CHECKS=1
905 SKIP_LIBRARY_CHECKS=1
910 fi # COMPILE_ENVIRONMENT
912 if test -z "$SKIP_COMPILER_CHECKS"; then
913 dnl Checks for typedefs, structures, and compiler characteristics.
914 dnl ========================================================
929 case "${OS_TARGET}" in
933 STL_FLAGS="-I${DIST}/stl_wrappers"
938 if test "$MOZ_BUILD_APP" = "tools/crashreporter"; then
942 dnl Checks for header files.
943 dnl ========================================================
946 bitrig*|dragonfly*|freebsd*|openbsd*)
947 # for stuff like -lXshm
948 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
952 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
953 AC_CACHE_CHECK(for sockaddr_in.sin_len,
954 ac_cv_sockaddr_in_sin_len,
955 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
956 #include <sys/types.h>
958 #include <netinet/in.h>
959 struct sockaddr_in x;
960 void *foo = (void*) &x.sin_len;],
962 [ac_cv_sockaddr_in_sin_len=true],
963 [ac_cv_sockaddr_in_sin_len=false])])
964 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
965 AC_DEFINE(HAVE_SIN_LEN)
966 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
967 AC_DEFINE(HAVE_SCONN_LEN)
970 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
971 ac_cv_sockaddr_in6_sin6_len,
972 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
973 #include <sys/types.h>
975 #include <netinet/in.h>
976 struct sockaddr_in6 x;
977 void *foo = (void*) &x.sin6_len;],
979 [ac_cv_sockaddr_in6_sin6_len=true],
980 [ac_cv_sockaddr_in6_sin6_len=false])])
981 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
982 AC_DEFINE(HAVE_SIN6_LEN)
985 AC_CACHE_CHECK(for sockaddr.sa_len,
986 ac_cv_sockaddr_sa_len,
987 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
988 #include <sys/types.h>
990 #include <sys/socket.h>
992 void *foo = (void*) &x.sa_len;],
994 [ac_cv_sockaddr_sa_len=true],
995 [ac_cv_sockaddr_sa_len=false])])
996 if test "$ac_cv_sockaddr_sa_len" = true ; then
997 AC_DEFINE(HAVE_SA_LEN)
1000 MOZ_ARG_ENABLE_BOOL(dtrace,
1001 [ --enable-dtrace build with dtrace support if available (default=no)],
1002 [enable_dtrace="yes"],)
1003 if test "x$enable_dtrace" = "xyes"; then
1004 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
1005 if test -n "$HAVE_DTRACE"; then
1006 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
1008 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
1011 AC_SUBST(HAVE_DTRACE)
1013 dnl Checks for libraries.
1014 dnl ========================================================
1015 AC_CHECK_LIB(c_r, gethostbyname_r)
1017 dnl We don't want to link with libdl even if it's present on OS X, since
1018 dnl it's not used and not part of the default installation. OS/2 has dlfcn
1020 dnl We don't want to link against libm or libpthread on Darwin since
1021 dnl they both are just symlinks to libSystem and explicitly linking
1022 dnl against libSystem causes issues when debugging (see bug 299601).
1027 AC_SEARCH_LIBS(dlopen, dl,
1028 MOZ_CHECK_HEADER(dlfcn.h,
1029 AC_DEFINE(HAVE_DLOPEN)))
1033 _SAVE_CFLAGS="$CFLAGS"
1034 CFLAGS="$CFLAGS -D_GNU_SOURCE"
1035 AC_CHECK_FUNCS(dladdr memmem)
1036 CFLAGS="$_SAVE_CFLAGS"
1038 if test ! "$GNU_CXX"; then
1039 AC_CHECK_LIB(C, demangle)
1042 AC_CHECK_LIB(socket, socket)
1045 XLIBS="$X_EXTRA_LIBS"
1047 dnl ========================================================
1048 dnl Checks for X libraries.
1049 dnl Ordering is important.
1050 dnl Xt is dependent upon SM as of X11R6
1051 dnl ========================================================
1052 if test -n "$MOZ_X11"; then
1053 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
1054 _SAVE_LDFLAGS="$LDFLAGS"
1056 LDFLAGS="$XLDFLAGS $LDFLAGS"
1057 AC_CHECK_LIB(X11, XDrawLines, [XLIBS="-lX11 $XLIBS"],
1058 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
1059 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
1060 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
1062 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
1063 unset ac_cv_lib_Xt_XtFree
1064 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
1065 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
1066 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
1067 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
1070 dnl ========================================================
1072 dnl ========================================================
1073 AC_CHECK_LIB(xcb, xcb_connect, [XLIBS="-lxcb $XLIBS"],
1074 [MISSING_X="$MISSING_X -lxcb"], $XLIBS)
1075 AC_CHECK_LIB(xcb-shm, xcb_shm_query_version, [XLIBS="-lxcb-shm $XLIBS"],
1076 [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS)
1077 AC_CHECK_LIB(X11-xcb, XGetXCBConnection, [XLIBS="-lX11-xcb $XLIBS"],
1078 [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS)
1080 LDFLAGS="$_SAVE_LDFLAGS"
1084 AC_SUBST_LIST(XCFLAGS)
1085 AC_SUBST_LIST(XLDFLAGS)
1086 AC_SUBST_LIST(XLIBS)
1087 AC_SUBST_LIST(XEXT_LIBS)
1088 AC_SUBST_LIST(XT_LIBS)
1090 dnl ========================================================
1091 dnl = pthread support
1092 dnl = Start by checking whether the system support pthreads
1093 dnl ========================================================
1094 case "$target_os" in
1099 AC_CHECK_LIB(pthreads, pthread_create,
1100 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
1101 AC_CHECK_LIB(pthread, pthread_create,
1102 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
1103 AC_CHECK_LIB(c_r, pthread_create,
1104 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
1105 AC_CHECK_LIB(c, pthread_create,
1114 dnl ========================================================
1115 dnl Do the platform specific pthread hackery
1116 dnl ========================================================
1117 if test "$MOZ_USE_PTHREADS"x != x
1120 dnl See if -pthread is supported.
1123 ac_cv_have_dash_pthread=no
1124 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
1125 echo 'int main() { return 0; }' | cat > conftest.c
1126 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
1127 if test $? -eq 0; then
1128 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1129 ac_cv_have_dash_pthread=yes
1130 case "$target_os" in
1132 # Freebsd doesn't use -pthread for compiles, it uses them for linking
1135 CFLAGS="$CFLAGS -pthread"
1136 CXXFLAGS="$CXXFLAGS -pthread"
1142 AC_MSG_RESULT($ac_cv_have_dash_pthread)
1145 dnl See if -pthreads is supported.
1147 ac_cv_have_dash_pthreads=no
1148 if test "$ac_cv_have_dash_pthread" = "no"; then
1149 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
1150 echo 'int main() { return 0; }' | cat > conftest.c
1151 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
1152 if test $? -eq 0; then
1153 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1154 ac_cv_have_dash_pthreads=yes
1155 CFLAGS="$CFLAGS -pthreads"
1156 CXXFLAGS="$CXXFLAGS -pthreads"
1160 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
1165 AC_DEFINE(_REENTRANT)
1166 AC_DEFINE(_THREAD_SAFE)
1167 dnl -pthread links in -lpthread, so don't specify it explicitly.
1168 if test "$ac_cv_have_dash_pthread" = "yes"; then
1169 _PTHREAD_LDFLAGS="-pthread"
1173 *-*-openbsd*|*-*-bsdi*)
1174 AC_DEFINE(_REENTRANT)
1175 AC_DEFINE(_THREAD_SAFE)
1176 dnl -pthread links in -lc_r, so don't specify it explicitly.
1177 if test "$ac_cv_have_dash_pthread" = "yes"; then
1178 _PTHREAD_LDFLAGS="-pthread"
1182 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
1183 AC_DEFINE(_REENTRANT)
1187 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
1188 AC_SUBST(MOZ_USE_PTHREADS)
1189 MOZ_CHECK_HEADERS(pthread.h)
1193 dnl Checks for library functions.
1194 dnl ========================================================
1195 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall)
1197 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1198 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1199 ac_cv_clock_monotonic,
1200 [for libs in "" -lrt; do
1202 _SAVE_CFLAGS="$CFLAGS"
1204 CFLAGS="$CFLAGS $DSO_PIC_CFLAGS"
1205 dnl clock_gettime is available on OSX since 10.12, so depending on MACOSX_DEPLOYMENT_TARGET,
1206 dnl we should or not be able to use it. To detect if we can, we need to make the
1207 dnl availability attribute strict, so that compilation fails when the target is < 10.12.
1208 AC_TRY_LINK([#define availability(os, ...) availability(os, strict, __VA_ARGS)
1210 [ struct timespec ts;
1211 clock_gettime(CLOCK_MONOTONIC, &ts); ],
1212 ac_cv_clock_monotonic=$libs
1215 ac_cv_clock_monotonic=no)
1217 CFLAGS="$_SAVE_CFLAGS"
1219 if test "$ac_cv_clock_monotonic" != "no"; then
1220 HAVE_CLOCK_MONOTONIC=1
1221 REALTIME_LIBS=$ac_cv_clock_monotonic
1222 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1223 AC_SUBST(HAVE_CLOCK_MONOTONIC)
1224 AC_SUBST_LIST(REALTIME_LIBS)
1227 dnl Turn on warnings-as-errors to prevent implicit declaration of
1228 dnl pthread_cond_timedwait_monotonic_np, which can cause this test to
1229 dnl inadvertently pass even if the function does not really exist.
1230 _SAVE_CFLAGS="$CFLAGS"
1231 CFLAGS="$CFLAGS $WARNINGS_AS_ERRORS"
1232 AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
1233 ac_cv_pthread_cond_timedwait_monotonic_np,
1234 AC_TRY_LINK([#include <pthread.h>],
1235 [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
1236 ac_cv_pthread_cond_timewait_monotonic_np=yes,
1237 ac_cv_pthread_cond_timewait_monotonic_np=no))
1238 if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
1239 AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
1241 CFLAGS=$_SAVE_CFLAGS
1245 ac_cv_func_res_ninit,
1246 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
1247 dnl no need for res_ninit() on NetBSD and OpenBSD
1248 ac_cv_func_res_ninit=no
1252 #define _BSD_SOURCE 1
1254 #include <sys/types.h>
1255 #include <netinet/in.h>
1256 #include <arpa/nameser.h>
1259 [int foo = res_ninit(&_res);],
1260 [ac_cv_func_res_ninit=yes],
1261 [ac_cv_func_res_ninit=no])
1265 if test "$ac_cv_func_res_ninit" = "yes"; then
1266 AC_DEFINE(HAVE_RES_NINIT)
1267 dnl must add the link line we do something as foolish as this... dougt
1269 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
1270 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
1275 dnl **********************
1276 dnl *** va_copy checks ***
1277 AC_CACHE_CHECK([for an implementation of va_copy()],
1279 [AC_TRY_COMPILE([#include <stdarg.h>
1281 void f (int i, ...) {
1282 va_list args1, args2;
1283 va_start (args1, i);
1284 va_copy (args2, args1);
1285 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1287 va_end (args1); va_end (args2);
1289 [f(0, 42); return 0],
1290 [ac_cv_va_copy=yes],
1294 AC_CACHE_CHECK([whether va_list can be copied by value],
1296 [AC_TRY_COMPILE([#include <stdarg.h>
1298 void f (int i, ...) {
1299 va_list args1, args2;
1300 va_start (args1, i);
1302 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1304 va_end (args1); va_end (args2);
1306 [f(0, 42); return 0],
1307 [ac_cv_va_val_copy=yes],
1308 [ac_cv_va_val_copy=no],
1311 if test "x$ac_cv_va_copy" = "xyes"; then
1312 AC_DEFINE(VA_COPY, va_copy)
1313 AC_DEFINE(HAVE_VA_COPY)
1316 if test "x$ac_cv_va_val_copy" = "xno"; then
1317 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
1320 dnl ===================================================================
1321 dnl ========================================================
1322 dnl Put your C++ language/feature checks below
1323 dnl ========================================================
1327 if test "$GNU_CC"; then
1328 if test "$CPU_ARCH" = "arm" ; then
1329 AC_CACHE_CHECK(for ARM EABI,
1333 #if defined(__ARM_EABI__)
1336 #error Not ARM EABI.
1339 ac_cv_gcc_arm_eabi="yes",
1340 ac_cv_gcc_arm_eabi="no")])
1341 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
1343 ARM_ABI_PREFIX=eabi-
1345 ARM_ABI_PREFIX=oabi-
1349 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
1352 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
1353 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
1354 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
1356 _SAVE_LDFLAGS=$LDFLAGS
1357 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
1358 AC_CACHE_CHECK(for __thread keyword for TLS variables,
1359 ac_cv_thread_keyword,
1360 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
1361 [return tlsIsMainThread;],
1362 ac_cv_thread_keyword=yes,
1363 ac_cv_thread_keyword=no)])
1364 LDFLAGS=$_SAVE_LDFLAGS
1365 # The custom dynamic linker doesn't support TLS variables
1367 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
1368 # mips builds fail with TLS variables because of a binutils bug.
1370 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
1375 *-android*|*-linuxandroid*)
1382 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
1388 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
1389 if test -n "$MOZ_LINKER"; then
1390 if test "$CPU_ARCH" = arm; then
1391 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
1392 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
1393 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1394 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1398 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
1399 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
1400 dnl Since the linker only understands the sysv ones, no need to build the
1401 dnl gnu style tables anyways.
1402 LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
1405 dnl End of C++ language/feature checks
1408 dnl ========================================================
1409 dnl = Internationalization checks
1410 dnl ========================================================
1412 dnl Internationalization and Locale support is different
1413 dnl on various UNIX platforms. Checks for specific i18n
1414 dnl features go here.
1416 AC_HAVE_FUNCS(localeconv)
1418 fi # ! SKIP_COMPILER_CHECKS
1420 if test -n "${COMPILE_ENVIRONMENT}"; then
1425 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1426 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1427 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1430 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1431 dnl features that Windows actually does support.
1433 if test -n "$SKIP_COMPILER_CHECKS"; then
1434 dnl Windows has malloc.h
1435 AC_DEFINE(MALLOC_H, [<malloc.h>])
1436 AC_DEFINE(HAVE_FORCEINLINE)
1437 AC_DEFINE(HAVE_LOCALECONV)
1438 fi # SKIP_COMPILER_CHECKS
1440 dnl Mozilla specific options
1441 dnl ========================================================
1442 dnl The macros used for command line options
1443 dnl are defined in build/autoconf/altoptions.m4.
1445 dnl ========================================================
1447 dnl = Check for external package dependencies
1449 dnl ========================================================
1450 MOZ_ARG_HEADER(External Packages)
1452 case "$OS_TARGET" in
1453 WINNT|Darwin|Android)
1463 dnl ========================================================
1464 dnl system libevent Support
1465 dnl ========================================================
1466 MOZ_ARG_WITH_STRING(system-libevent,
1467 [ --with-system-libevent[=PFX]
1468 Use system libevent [installed at prefix PFX]],
1469 LIBEVENT_DIR=$withval)
1471 _SAVE_CFLAGS=$CFLAGS
1472 _SAVE_LDFLAGS=$LDFLAGS
1474 if test "$LIBEVENT_DIR" = yes; then
1475 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
1476 MOZ_SYSTEM_LIBEVENT=1,
1479 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
1480 MOZ_SYSTEM_LIBEVENT=
1481 elif test -z "$MOZ_SYSTEM_LIBEVENT"; then
1482 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
1483 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
1484 MOZ_CHECK_HEADER(event.h,
1485 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
1486 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
1488 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
1489 AC_CHECK_LIB(event, event_init,
1490 [MOZ_SYSTEM_LIBEVENT=1
1491 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
1492 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
1493 [MOZ_SYSTEM_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
1495 CFLAGS=$_SAVE_CFLAGS
1496 LDFLAGS=$_SAVE_LDFLAGS
1499 AC_SUBST(MOZ_SYSTEM_LIBEVENT)
1501 dnl ========================================================
1502 dnl = If NSS was not detected in the system,
1503 dnl = use the one in the source tree (mozilla/security/nss)
1504 dnl ========================================================
1506 MOZ_ARG_WITH_BOOL(system-nss,
1507 [ --with-system-nss Use system installed NSS],
1510 if test -n "$_USE_SYSTEM_NSS"; then
1511 AM_PATH_NSS(3.49, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
1514 NSS_CFLAGS="$NSS_CFLAGS -I${DIST}/include/nss"
1515 if test -z "$MOZ_SYSTEM_NSS"; then
1516 case "${OS_ARCH}" in
1517 # Only few platforms have been tested with GYP
1518 WINNT|Darwin|Linux|DragonFly|FreeBSD|NetBSD|OpenBSD|SunOS)
1521 AC_MSG_ERROR([building in-tree NSS is not supported on this platform. Use --with-system-nss])
1526 dnl system ZLIB support
1527 dnl ========================================================
1528 MOZ_ZLIB_CHECK([1.2.3])
1530 if test -z "$SKIP_LIBRARY_CHECKS"; then
1532 dnl ========================================================
1533 dnl system PNG Support
1534 dnl ========================================================
1535 MOZ_ARG_WITH_STRING(system-png,
1536 [ --with-system-png[=PFX]
1537 Use system libpng [installed at prefix PFX]],
1540 _SAVE_CFLAGS=$CFLAGS
1541 _SAVE_LDFLAGS=$LDFLAGS
1543 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
1544 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
1545 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
1547 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
1550 AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"],
1551 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1552 AC_CHECK_LIB(png, png_get_acTL, ,
1553 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
1555 if test "$MOZ_SYSTEM_PNG" = 1; then
1556 AC_TRY_COMPILE([ #include <stdio.h>
1557 #include <sys/types.h>
1559 [ #if PNG_LIBPNG_VER < $MOZPNG
1560 #error "Insufficient libpng version ($MOZPNG required)."
1562 #ifndef PNG_UINT_31_MAX
1563 #error "Insufficient libpng version."
1566 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1568 CFLAGS=$_SAVE_CFLAGS
1569 LDFLAGS=$_SAVE_LDFLAGS
1572 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then
1573 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
1574 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
1577 fi # SKIP_LIBRARY_CHECKS
1579 dnl ========================================================
1583 dnl ========================================================
1585 MOZ_ARG_HEADER(Application)
1587 ENABLE_SYSTEM_EXTENSION_DIRS=1
1588 MOZ_BRANDING_DIRECTORY=
1589 MOZ_OFFICIAL_BRANDING=
1590 MOZ_AUTH_EXTENSION=1
1591 if test "$MOZ_IOS"; then
1594 MOZ_PREF_EXTENSIONS=1
1596 MOZ_UNIVERSALCHARDET=1
1601 MOZ_USE_NATIVE_POPUP_WINDOWS=
1602 MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
1604 MOZ_BINARY_EXTENSIONS=
1607 case "$target_os" in
1610 AC_DEFINE(NS_ENABLE_TSF)
1614 # Optional Firefox for Android partner distribution directory.
1615 MOZ_ARG_WITH_STRING(android-distribution-directory,
1616 [ --with-android-distribution-directory=dir
1617 Optional Firefox for Android partner distribution directory.],
1618 MOZ_ANDROID_DISTRIBUTION_DIRECTORY=$withval)
1620 if test -n "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY"; then
1621 # A distribution directory must have an assets/distribution directory.
1622 # See https://wiki.mozilla.org/Mobile/Distribution_Files.
1623 if test ! -d "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY/assets/distribution" ; then
1624 AC_MSG_ERROR([--with-android-distribution-directory does not contain assets/distribution;
1625 (looked for ${MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets/distribution).])
1628 AC_SUBST(MOZ_ANDROID_DISTRIBUTION_DIRECTORY)
1630 dnl ========================================================
1631 dnl = Trademarked Branding
1632 dnl ========================================================
1633 MOZ_ARG_ENABLE_BOOL(official-branding,
1634 [ --enable-official-branding
1635 Enable Official mozilla.org Branding
1636 Do not distribute builds with
1637 --enable-official-branding unless you have
1638 permission to use trademarks per
1639 http://www.mozilla.org/foundation/trademarks/ .],
1640 MOZ_OFFICIAL_BRANDING=1,
1641 MOZ_OFFICIAL_BRANDING=)
1643 # Allow the application to influence configure with a confvars.sh script.
1644 AC_MSG_CHECKING([if app-specific confvars.sh exists])
1645 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
1646 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
1647 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
1652 # Allow influencing configure with a defines.sh script.
1653 . "${srcdir}/build/defines.sh"
1655 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
1657 if test "$BUILDING_RELEASE"; then
1658 # Override value in defines.sh, if any
1659 EARLY_BETA_OR_EARLIER=
1660 elif test "$EARLY_BETA_OR_EARLIER"; then
1661 AC_DEFINE(EARLY_BETA_OR_EARLIER)
1663 AC_SUBST(EARLY_BETA_OR_EARLIER)
1665 if test "$EARLY_BETA_OR_EARLIER"; then
1666 MOZ_NEW_CERT_STORAGE=1
1667 AC_DEFINE(MOZ_NEW_CERT_STORAGE)
1669 AC_SUBST(MOZ_NEW_CERT_STORAGE)
1671 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
1672 MOZ_ARG_WITH_STRING(app-name,
1673 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
1674 WITH_APP_NAME=$withval,
1677 if test -n "$WITH_APP_NAME" ; then
1678 MOZ_APP_NAME="$WITH_APP_NAME"
1681 MOZ_ARG_WITH_STRING(app-basename,
1682 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
1683 WITH_APP_BASENAME=$withval,
1686 if test -n "$WITH_APP_BASENAME" ; then
1687 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
1690 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
1691 # that haven't made a confvars.sh yet. Don't add new stuff here, use
1693 case "$MOZ_BUILD_APP" in
1695 AC_DEFINE(MOZ_PHOENIX)
1699 # Graphene is a desktop runtime for running applications with a HTML UI.
1700 if test -n "$MOZ_GRAPHENE"; then
1701 AC_DEFINE(MOZ_GRAPHENE)
1704 AC_SUBST(MOZ_PHOENIX)
1706 dnl ========================================================
1707 dnl Ensure Android SDK and build-tools versions depending on
1709 dnl ========================================================
1711 case "$MOZ_BUILD_APP" in
1717 dnl ========================================================
1719 dnl = Toolkit Options
1721 dnl ========================================================
1722 MOZ_ARG_HEADER(Toolkit Options)
1724 dnl ========================================================
1725 dnl = Enable the toolkit as needed =
1726 dnl ========================================================
1728 case "$MOZ_WIDGET_TOOLKIT" in
1731 LDFLAGS="$LDFLAGS -framework Cocoa"
1732 # Use -Wl as a trick to avoid -framework and framework names from
1733 # being separated by AC_SUBST_LIST.
1734 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'
1736 CFLAGS="$CFLAGS $TK_CFLAGS"
1737 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1738 MOZ_USER_DIR="Mozilla"
1739 MOZ_FS_LAYOUT=bundle
1743 LDFLAGS="$LDFLAGS -framework UIKit"
1745 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'
1746 CFLAGS="$CFLAGS $TK_CFLAGS"
1747 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1748 MOZ_USER_DIR="Mozilla"
1749 MOZ_FS_LAYOUT=bundle
1754 if test "$OS_TARGET" = Darwin; then
1755 LDFLAGS="$LDFLAGS -lobjc"
1758 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
1759 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
1760 case "$MOZ_WIDGET_TOOLKIT" in
1766 if test "$COMPILE_ENVIRONMENT"; then
1767 if test "$MOZ_WIDGET_TOOLKIT" = gtk; then
1768 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)
1769 MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
1770 TK_CFLAGS=$MOZ_GTK3_CFLAGS
1771 TK_LIBS=$MOZ_GTK3_LIBS
1772 dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
1773 dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
1774 AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
1775 GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32
1777 if test "$MOZ_ENABLE_GTK"; then
1778 if test "$MOZ_X11"; then
1779 GDK_PACKAGES=gdk-x11-2.0
1781 AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
1782 AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
1784 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)
1785 MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
1787 fi # COMPILE_ENVIRONMENT
1789 AC_SUBST(MOZ_FS_LAYOUT)
1791 dnl ========================================================
1792 dnl = startup-notification support module
1793 dnl ========================================================
1795 if test "$MOZ_ENABLE_GTK"
1797 MOZ_ENABLE_STARTUP_NOTIFICATION=
1799 MOZ_ARG_ENABLE_BOOL(startup-notification,
1800 [ --enable-startup-notification
1801 Enable startup-notification support (default: disabled) ],
1802 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
1803 MOZ_ENABLE_STARTUP_NOTIFICATION=)
1804 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
1806 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
1807 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
1808 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
1809 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
1811 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
1813 MOZ_ENABLE_STARTUP_NOTIFICATION=
1817 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
1818 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
1821 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
1823 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
1825 AC_SUBST_LIST(TK_CFLAGS)
1826 AC_SUBST_LIST(TK_LIBS)
1828 dnl ========================================================
1830 dnl = Components & Features
1832 dnl ========================================================
1833 MOZ_ARG_HEADER(Components and Features)
1835 AC_SUBST(MOZ_OFFICIAL_BRANDING)
1836 if test -n "$MOZ_OFFICIAL_BRANDING"; then
1837 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
1838 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
1840 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
1841 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
1845 MOZ_ARG_WITH_STRING(branding,
1846 [ --with-branding=dir Use branding from the specified directory.],
1847 MOZ_BRANDING_DIRECTORY=$withval)
1849 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
1850 if test -z "$REAL_BRANDING_DIRECTORY"; then
1851 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
1854 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1855 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
1856 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1857 . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
1860 AC_SUBST(MOZ_BRANDING_DIRECTORY)
1862 dnl ========================================================
1863 dnl = Distribution ID
1864 dnl ========================================================
1865 MOZ_ARG_WITH_STRING(distribution-id,
1866 [ --with-distribution-id=ID
1867 Set distribution-specific id (default=org.mozilla)],
1868 [ val=`echo $withval`
1869 MOZ_DISTRIBUTION_ID="$val"])
1871 if test -z "$MOZ_DISTRIBUTION_ID"; then
1872 MOZ_DISTRIBUTION_ID="org.mozilla"
1875 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
1876 AC_SUBST(MOZ_DISTRIBUTION_ID)
1878 dnl ========================================================
1879 dnl = libproxy support
1880 dnl ========================================================
1882 if test "$MOZ_ENABLE_GTK"
1884 MOZ_ENABLE_LIBPROXY=
1886 MOZ_ARG_ENABLE_BOOL(libproxy,
1887 [ --enable-libproxy Enable libproxy support ],
1888 MOZ_ENABLE_LIBPROXY=1,
1889 MOZ_ENABLE_LIBPROXY=)
1891 if test "$MOZ_ENABLE_LIBPROXY"
1893 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
1894 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
1897 AC_SUBST(MOZ_ENABLE_LIBPROXY)
1899 dnl ========================================================
1901 dnl ========================================================
1903 if test "$MOZ_ENABLE_GTK"
1907 MOZ_ARG_DISABLE_BOOL(dbus,
1908 [ --disable-dbus Disable dbus support ],
1912 if test "$MOZ_ENABLE_DBUS"
1914 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
1915 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
1916 AC_DEFINE(MOZ_ENABLE_DBUS)
1919 AC_SUBST(MOZ_ENABLE_DBUS)
1921 dnl =========================================================
1922 dnl = Whether to exclude hyphenations files in the build
1923 dnl =========================================================
1924 if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
1925 AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
1928 AC_TRY_COMPILE([#include <linux/ethtool.h>],
1929 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
1930 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
1932 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
1934 if test -n "$MOZ_WEBRTC"; then
1935 if test -n "$MOZ_X11"; then
1936 MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
1940 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
1942 dnl ========================================================
1943 dnl = Apple platform decoder support
1944 dnl ========================================================
1945 if test "$COMPILE_ENVIRONMENT"; then
1946 if test -n "$MOZ_APPLEMEDIA"; then
1947 # hack in frameworks for fmp4 - see bug 1029974
1948 # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
1949 LDFLAGS="$LDFLAGS -framework AudioToolbox"
1950 dnl Verify CoreMedia is available.
1951 AC_CHECK_HEADERS([CoreMedia/CoreMedia.h VideoToolbox/VideoToolbox.h], [],
1952 [AC_MSG_ERROR([MacOS X 10.9 SDK or later is required])])
1954 fi # COMPILE_ENVIRONMENT
1956 dnl ========================================================
1957 dnl = Handle dependent MEDIA defines
1958 dnl ========================================================
1961 AC_DEFINE(MOZ_WEBM_ENCODER)
1962 AC_SUBST(MOZ_WEBM_ENCODER)
1964 dnl ========================================================
1966 dnl ========================================================
1968 MOZ_ARG_DISABLE_BOOL(negotiateauth,
1969 [ --disable-negotiateauth Disable GSS-API negotiation ],
1970 MOZ_AUTH_EXTENSION=,
1971 MOZ_AUTH_EXTENSION=1 )
1973 if test -n "$MOZ_IOS" -a -n "$MOZ_AUTH_EXTENSION"; then
1974 AC_MSG_ERROR([negotiateauth is not supported on iOS.])
1977 dnl ========================================================
1978 dnl Pref extensions (autoconfig)
1979 dnl ========================================================
1980 MOZ_ARG_DISABLE_BOOL(pref-extensions,
1981 [ --disable-pref-extensions
1982 Disable pref extensions such as autoconfig],
1983 MOZ_PREF_EXTENSIONS=,
1984 MOZ_PREF_EXTENSIONS=1 )
1986 dnl ========================================================
1987 dnl Searching of system directories for extensions.
1988 dnl Note: this switch is meant to be used for test builds
1989 dnl whose behavior should not depend on what happens to be
1990 dnl installed on the local machine.
1991 dnl ========================================================
1992 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
1993 [ --disable-system-extension-dirs
1994 Disable searching system- and account-global
1995 directories for extensions of any kind; use
1996 only profile-specific extension directories],
1997 ENABLE_SYSTEM_EXTENSION_DIRS=,
1998 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
1999 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
2000 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
2003 dnl ========================================================
2004 dnl = Universalchardet
2005 dnl ========================================================
2006 MOZ_ARG_DISABLE_BOOL(universalchardet,
2007 [ --disable-universalchardet
2008 Disable universal encoding detection],
2009 MOZ_UNIVERSALCHARDET=,
2010 MOZ_UNIVERSALCHARDET=1 )
2012 dnl ========================================================
2014 dnl ========================================================
2016 if test "$COMPILE_ENVIRONMENT" ; then
2018 dnl Moved gamepad platform check to moz.build, linux header check still needed here.
2019 if test "$OS_TARGET" = "Linux"; then
2020 MOZ_CHECK_HEADER([linux/joystick.h])
2021 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
2022 AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
2026 fi # COMPILE_ENVIRONMENT
2029 dnl ========================================================
2030 dnl = Breakpad crash reporting (on by default on supported platforms)
2031 dnl ========================================================
2034 i?86-*-mingw*|x86_64-*-mingw*|aarch64-*-mingw*)
2037 i?86-apple-darwin*|x86_64-apple-darwin*)
2038 if test -z "$MOZ_IOS"; then
2042 *-android*|*-linuxandroid*)
2043 dnl Android/arm is arm-unknown-linux-androideabi, so android condition should
2044 dnl be before Linux condition
2047 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
2048 if test "$MOZ_ENABLE_GTK"; then
2054 MOZ_ARG_DISABLE_BOOL(crashreporter,
2055 [ --disable-crashreporter Disable breakpad crash reporting],
2056 [MOZ_CRASHREPORTER=],
2057 [MOZ_CRASHREPORTER=F # Force enable breakpad])
2059 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin" -a "$MOZ_WIDGET_TOOLKIT" != "android"; then
2060 if test "$MOZ_CRASHREPORTER" = F; then
2061 AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
2066 if test -n "$MOZ_CRASHREPORTER"; then
2067 AC_DEFINE(MOZ_CRASHREPORTER)
2069 if test "$OS_TARGET" = "Linux" && \
2070 test -z "$SKIP_LIBRARY_CHECKS"; then
2071 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
2074 if test "$OS_ARCH" = "WINNT"; then
2075 if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
2076 MOZ_CRASHREPORTER_INJECTOR=1
2077 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
2082 dnl ========================================================
2083 dnl = Enable compilation of specific extension modules
2084 dnl ========================================================
2086 MOZ_ARG_ENABLE_STRING(extensions,
2087 [ --enable-extensions Enable extensions],
2088 [ for option in `echo $enableval | sed 's/,/ /g'`; do
2089 if test "$option" = "yes" -o "$option" = "all"; then
2090 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
2091 elif test "$option" = "no" -o "$option" = "none"; then
2093 elif test "$option" = "default"; then
2094 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
2095 elif test `echo "$option" | grep -c \^-` != 0; then
2096 option=`echo $option | sed 's/^-//'`
2097 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
2099 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
2102 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
2104 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
2105 dnl when trying to build a nonexistent extension.
2106 for extension in $MOZ_EXTENSIONS; do
2107 if test ! -d "${srcdir}/extensions/${extension}"; then
2108 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
2112 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
2113 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
2116 # Avoid defining MOZ_ENABLE_CAIRO_FT on Windows platforms because
2117 # "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
2118 if test -n "$MOZ_TREE_FREETYPE" -a "$OS_TARGET" != WINNT; then
2119 MOZ_ENABLE_CAIRO_FT=1
2120 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2121 CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
2122 AC_SUBST_LIST(CAIRO_FT_CFLAGS)
2125 AC_CHECK_PROGS(WGET, wget, "")
2128 dnl ========================================================
2130 dnl ========================================================
2132 if test "$MOZ_IOS"; then
2136 MOZ_ARG_DISABLE_BOOL(updater,
2137 [ --disable-updater Disable building of updater],
2141 if test -n "$MOZ_UPDATER"; then
2142 AC_DEFINE(MOZ_UPDATER)
2145 dnl ========================================================
2146 dnl parental controls (for Windows Vista)
2147 dnl ========================================================
2148 MOZ_ARG_DISABLE_BOOL(parental-controls,
2149 [ --disable-parental-controls
2150 Do not build parental controls],
2151 MOZ_DISABLE_PARENTAL_CONTROLS=1,
2152 MOZ_DISABLE_PARENTAL_CONTROLS=)
2153 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
2154 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
2157 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
2159 dnl ========================================================
2160 dnl = Disable smartcard support
2161 dnl ========================================================
2162 if test -n "$MOZ_NO_SMART_CARDS"; then
2163 AC_DEFINE(MOZ_NO_SMART_CARDS)
2165 AC_SUBST(MOZ_NO_SMART_CARDS)
2167 dnl ========================================================
2168 dnl = Sandboxing support
2169 dnl ========================================================
2170 if test -n "$MOZ_TSAN" -o -n "$MOZ_ASAN"; then
2171 # Bug 1182565: TSan conflicts with sandboxing on Linux.
2172 # Bug 1287971: LSan also conflicts with sandboxing on Linux.
2180 MOZ_ARG_DISABLE_BOOL(sandbox,
2181 [ --disable-sandbox Disable sandboxing support],
2185 case "$OS_TARGET" in
2186 WINNT|Darwin|OpenBSD)
2192 # Linux sandbox is only available on x86 and x86_64.
2199 # Only enable the sandbox by default on Linux, OpenBSD, macOS, and Windows
2204 if test -n "$MOZ_SANDBOX"; then
2205 AC_DEFINE(MOZ_SANDBOX)
2208 AC_SUBST(MOZ_SANDBOX)
2211 dnl ========================================================
2213 dnl = Module specific options
2215 dnl ========================================================
2216 MOZ_ARG_HEADER(Individual module options)
2218 dnl ========================================================
2219 dnl Check for sqlite
2220 dnl ========================================================
2223 MOZ_ARG_ENABLE_BOOL(system-sqlite,
2224 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
2225 MOZ_SYSTEM_SQLITE=1,
2226 MOZ_SYSTEM_SQLITE= )
2228 if test -n "$MOZ_SYSTEM_SQLITE"
2230 dnl ============================
2231 dnl === SQLite Version check ===
2232 dnl ============================
2233 dnl Check to see if the system SQLite package is new enough.
2234 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
2236 dnl ==============================
2237 dnl === SQLite fdatasync check ===
2238 dnl ==============================
2239 dnl Check to see if fdatasync is available
2240 AC_CHECK_FUNC(fdatasync)
2243 if test -n "$MOZ_SYSTEM_SQLITE"; then
2244 AC_DEFINE(MOZ_SYSTEM_SQLITE)
2246 AC_SUBST(MOZ_SYSTEM_SQLITE)
2248 dnl ========================================================
2249 dnl = Disable zipwriter
2250 dnl ========================================================
2251 MOZ_ARG_DISABLE_BOOL(zipwriter,
2252 [ --disable-zipwriter Disable zipwriter component],
2255 AC_SUBST(MOZ_ZIPWRITER)
2257 dnl ========================================================
2259 dnl = Feature options that require extra sources to be pulled
2261 dnl ========================================================
2262 dnl MOZ_ARG_HEADER(Features that require extra sources)
2264 dnl ========================================================
2266 dnl = Runtime debugging and Optimization Options
2268 dnl ========================================================
2269 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
2271 dnl ========================================================
2272 dnl enable mobile optimizations
2273 dnl ========================================================
2274 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
2275 [ --enable-mobile-optimize
2276 Enable mobile optimizations],
2277 MOZ_GFX_OPTIMIZE_MOBILE=1)
2279 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
2281 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
2282 # We ignore paint will resample on mobile for performance.
2283 # We may want to revisit this later.
2284 MOZ_IGNORE_PAINT_WILL_RESAMPLE=1
2286 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
2287 AC_DEFINE(MOZ_IGNORE_PAINT_WILL_RESAMPLE)
2290 dnl ========================================================
2291 dnl = Enable code optimization. ON by default.
2292 dnl ========================================================
2294 # Use value from moz.configure if one is defined. Else use our computed
2296 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
2297 MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
2300 if test "$COMPILE_ENVIRONMENT"; then
2301 if test -n "$MOZ_OPTIMIZE"; then
2302 AC_MSG_CHECKING([for valid C compiler optimization flags])
2303 _SAVE_CFLAGS=$CFLAGS
2304 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
2305 AC_TRY_COMPILE([#include <stdio.h>],
2306 [printf("Hello World\n");],
2309 AC_MSG_RESULT([$_results])
2310 if test "$_results" = "no"; then
2311 AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
2313 CFLAGS=$_SAVE_CFLAGS
2314 if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
2315 # When using llvm-based LTO, non numeric optimization levels are
2316 # not supported by the linker, so force the linker to use -O2 (
2317 # which doesn't influence the level compilation units are actually
2319 case " $MOZ_OPTIMIZE_FLAGS " in
2320 *\ -Os\ *|*\ -Oz\ *)
2321 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
2326 fi # COMPILE_ENVIRONMENT
2328 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
2329 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
2330 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
2332 dnl ========================================================
2333 dnl = Enable runtime logging
2334 dnl ========================================================
2335 AC_DEFINE(MOZ_LOGGING)
2336 AC_DEFINE(FORCE_PR_LOG)
2338 dnl ========================================================
2339 dnl = This will enable logging of addref, release, ctor, dtor.
2340 dnl ========================================================
2341 _ENABLE_LOGREFCNT=42
2342 MOZ_ARG_ENABLE_BOOL(logrefcnt,
2343 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
2344 _ENABLE_LOGREFCNT=1,
2345 _ENABLE_LOGREFCNT= )
2346 if test "$_ENABLE_LOGREFCNT" = "1"; then
2347 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
2348 elif test -z "$_ENABLE_LOGREFCNT"; then
2349 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
2352 dnl ========================================================
2353 dnl moz_dump_painting
2354 dnl ========================================================
2355 MOZ_ARG_ENABLE_BOOL(dump-painting,
2356 [ --enable-dump-painting Enable paint debugging.],
2357 MOZ_DUMP_PAINTING=1,
2358 MOZ_DUMP_PAINTING= )
2359 if test -n "$MOZ_DUMP_PAINTING"; then
2360 AC_DEFINE(MOZ_DUMP_PAINTING)
2361 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
2363 if test -n "$MOZ_DEBUG"; then
2364 AC_DEFINE(MOZ_DUMP_PAINTING)
2367 case "${OS_TARGET}" in
2368 Android|WINNT|Darwin)
2369 MOZ_GLUE_IN_PROGRAM=
2372 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
2373 MOZ_GLUE_IN_PROGRAM=1
2374 AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
2378 dnl ========================================================
2379 dnl = Jemalloc build setup
2380 dnl ========================================================
2381 if test -z "$MOZ_MEMORY"; then
2384 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
2385 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.])
2390 dnl The generic feature tests that determine how to compute ncpus are long and
2391 dnl complicated. Therefore, simply define special cpp variables for the
2392 dnl platforms we have special knowledge of.
2395 export MOZ_NO_DEBUG_RTL=1
2399 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
2401 dnl ========================================================
2402 dnl = Enable using the clang plugin to build
2403 dnl ========================================================
2405 if test -n "$COMPILE_ENVIRONMENT"; then
2406 MOZ_CONFIG_CLANG_PLUGIN
2407 fi # COMPILE_ENVIRONMENT
2409 dnl ========================================================
2410 dnl = Enable stripping of libs & executables
2411 dnl ========================================================
2412 MOZ_ARG_ENABLE_BOOL(strip,
2413 [ --enable-strip Enable stripping of libs & executables ],
2417 dnl ========================================================
2418 dnl = Enable stripping of libs & executables when packaging
2419 dnl ========================================================
2420 MOZ_ARG_ENABLE_BOOL(install-strip,
2421 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
2425 dnl ========================================================
2426 dnl = frontend JS debug mode
2427 dnl ========================================================
2429 MOZ_ARG_ENABLE_BOOL(debug-js-modules,
2430 [ --enable-debug-js-modules Enable debug mode for frontend JS libraries],
2434 AC_SUBST(DEBUG_JS_MODULES)
2436 dnl ========================================================
2438 dnl = Profiling and Instrumenting
2440 dnl ========================================================
2441 MOZ_ARG_HEADER(Profiling and Instrumenting)
2443 dnl ========================================================
2444 dnl = Offer a way to disable the startup cache
2445 dnl ========================================================
2447 MOZ_ARG_DISABLE_BOOL(startupcache,
2448 [ --disable-startupcache Disable startup cache ],
2449 MOZ_DISABLE_STARTUPCACHE=1,
2450 MOZ_DISABLE_STARTUPCACHE=)
2452 if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
2453 AC_DEFINE(MOZ_DISABLE_STARTUPCACHE)
2455 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
2457 dnl ========================================================
2458 dnl = Support for demangling undefined symbols
2459 dnl ========================================================
2460 if test -z "$SKIP_LIBRARY_CHECKS"; then
2463 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
2467 # Demangle only for debug or DMD builds
2468 MOZ_DEMANGLE_SYMBOLS=
2469 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
2470 MOZ_DEMANGLE_SYMBOLS=1
2471 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
2473 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
2475 dnl ========================================================
2476 dnl = Support for gcc stack unwinding (from gcc 3.3)
2477 dnl ========================================================
2478 if test -z "$SKIP_LIBRARY_CHECKS"; then
2481 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
2485 dnl ========================================================
2487 dnl ========================================================
2489 MOZ_ARG_WITH_STRING(jitreport-granularity,
2490 [ --jitreport-granularity=N
2491 Default granularity at which to report JIT code
2494 1 - code ranges for whole functions only
2495 2 - per-line information
2496 3 - per-op information],
2497 JITREPORT_GRANULARITY=$withval,
2498 JITREPORT_GRANULARITY=3)
2500 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
2502 dnl ========================================================
2506 dnl ========================================================
2507 MOZ_ARG_HEADER(Misc. Options)
2509 dnl ========================================================
2510 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
2511 dnl ========================================================
2512 MOZ_ARG_WITH_STRING(user-appdir,
2513 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
2514 [ val=`echo $withval`
2515 if echo "$val" | grep "\/" >/dev/null; then
2516 AC_MSG_ERROR("Homedir must be single relative path.")
2521 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
2523 if test -z "$SKIP_COMPILER_CHECKS"; then
2524 dnl ========================================================
2526 dnl = Compiler Options
2528 dnl ========================================================
2529 MOZ_ARG_HEADER(Compiler Options)
2531 dnl ========================================================
2532 dnl Check for gcc -pipe support
2533 dnl ========================================================
2534 AC_MSG_CHECKING([for -pipe support])
2535 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
2536 dnl Any gcc that supports firefox supports -pipe.
2537 CFLAGS="$CFLAGS -pipe"
2538 CXXFLAGS="$CXXFLAGS -pipe"
2539 AC_MSG_RESULT([yes])
2544 fi # ! SKIP_COMPILER_CHECKS
2548 if test "$COMPILE_ENVIRONMENT"; then
2550 fi # COMPILE_ENVIRONMENT
2552 dnl ========================================================
2554 dnl = Static Build Options
2556 dnl ========================================================
2557 MOZ_ARG_HEADER(Static build options)
2559 if test -z "$MOZ_SYSTEM_ZLIB"; then
2560 if test -n "$JS_SHARED_LIBRARY" -o -n "$MOZ_LINKER" -o "$MOZ_WIDGET_TOOLKIT" = android; then
2562 AC_DEFINE(ZLIB_IN_MOZGLUE)
2566 AC_SUBST(ZLIB_IN_MOZGLUE)
2568 dnl ========================================================
2570 dnl = Standalone module options
2572 dnl ========================================================
2573 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
2576 dnl ========================================================
2578 if test -z "$SKIP_PATH_CHECKS"; then
2579 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
2580 if test "$MOZ_ENABLE_GTK" ; then
2581 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
2586 if test -z "${GLIB_GMODULE_LIBS}" \
2587 -a -n "${GLIB_CONFIG}"\
2588 -a "${GLIB_CONFIG}" != no\
2590 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
2593 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
2595 if test "$USE_FC_FREETYPE"; then
2596 if test "$COMPILE_ENVIRONMENT"; then
2597 dnl ========================================================
2598 dnl = Check for freetype2 functionality
2599 dnl ========================================================
2600 if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
2602 _SAVE_CFLAGS="$CFLAGS"
2603 LIBS="$LIBS $FT2_LIBS"
2604 CFLAGS="$CFLAGS $FT2_CFLAGS"
2606 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
2607 ac_cv_member_FT_Bitmap_Size_y_ppem,
2608 [AC_TRY_COMPILE([#include <ft2build.h>
2609 #include FT_FREETYPE_H],
2611 if (sizeof s.y_ppem) return 0;
2613 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
2614 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
2615 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
2616 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
2618 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
2620 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
2621 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
2622 [FT_Bitmap_Size structure includes y_ppem field])
2624 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
2627 CFLAGS="$_SAVE_CFLAGS"
2630 _SAVE_CPPFLAGS="$CPPFLAGS"
2631 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
2632 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
2633 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
2634 CPPFLAGS="$_SAVE_CPPFLAGS"
2638 dnl ========================================================
2639 dnl Check if we need the 32-bit Linux SSE2 error dialog
2640 dnl ========================================================
2642 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
2644 dnl ========================================================
2645 dnl Check for pixman and cairo
2646 dnl ========================================================
2649 MOZ_ARG_ENABLE_BOOL(system-cairo,
2650 [ --enable-system-cairo Obsolete: do not use this option],
2651 AC_MSG_ERROR(--enable-system-cairo is not supported),
2655 MOZ_ARG_ENABLE_BOOL(system-pixman,
2656 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
2658 MOZ_TREE_PIXMAN=force,
2661 if test "$MOZ_TREE_PIXMAN"; then
2662 AC_DEFINE(MOZ_TREE_PIXMAN)
2664 PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.19.2)
2667 MOZ_CAIRO_CFLAGS="-I${DIST}/include/cairo"
2668 AC_DEFINE(MOZ_TREE_CAIRO)
2670 if test "$OS_ARCH" = "WINNT"; then
2671 # For now we assume that we will have a uint64_t available through
2672 # one of the above headers or mozstdint.h.
2673 AC_DEFINE(HAVE_UINT64_T)
2676 # Define macros for cairo-features.h
2677 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
2678 if test "$MOZ_X11"; then
2679 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
2680 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
2681 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
2683 if test "$_HAVE_FREETYPE2"; then
2684 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2685 MOZ_ENABLE_CAIRO_FT=1
2686 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
2689 case "$MOZ_WIDGET_TOOLKIT" in
2691 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
2692 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
2693 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
2696 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
2697 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
2698 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
2700 if test "$COMPILE_ENVIRONMENT"; then
2701 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
2705 if test "$USE_FC_FREETYPE"; then
2706 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
2708 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
2709 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
2711 AC_SUBST(PS_SURFACE_FEATURE)
2712 AC_SUBST(SVG_SURFACE_FEATURE)
2713 AC_SUBST(XLIB_SURFACE_FEATURE)
2714 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
2715 AC_SUBST(QUARTZ_SURFACE_FEATURE)
2716 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
2717 AC_SUBST(WIN32_SURFACE_FEATURE)
2718 AC_SUBST(OS2_SURFACE_FEATURE)
2719 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
2720 AC_SUBST(FT_FONT_FEATURE)
2721 AC_SUBST(FC_FONT_FEATURE)
2722 AC_SUBST(WIN32_FONT_FEATURE)
2723 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
2724 AC_SUBST(QUARTZ_FONT_FEATURE)
2725 AC_SUBST(PNG_FUNCTIONS_FEATURE)
2726 AC_SUBST(QT_SURFACE_FEATURE)
2727 AC_SUBST(TEE_SURFACE_FEATURE)
2729 if test "$MOZ_X11"; then
2730 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
2733 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
2735 case "$MOZ_WIDGET_TOOLKIT" in
2737 TK_CFLAGS="$MOZ_CAIRO_CFLAGS $MOZ_PIXMAN_CFLAGS"
2738 TK_LIBS="$MOZ_CAIRO_LIBS $MOZ_PIXMAN_LIBS"
2742 AC_SUBST(MOZ_TREE_CAIRO)
2743 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
2744 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
2745 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
2746 AC_SUBST(MOZ_TREE_PIXMAN)
2748 BINDGEN_SYSTEM_FLAGS="$_BINDGEN_CFLAGS $NSPR_CFLAGS $NSS_CFLAGS $MOZ_PIXMAN_CFLAGS $MOZ_CAIRO_CFLAGS"
2749 AC_SUBST(BINDGEN_SYSTEM_FLAGS)
2750 BINDGEN_SYSTEM_TOML_FLAGS="$BINDGEN_SYSTEM_FLAGS"
2751 AC_SUBST_TOML_LIST(BINDGEN_SYSTEM_TOML_FLAGS)
2753 dnl ========================================================
2755 dnl ========================================================
2756 MOZ_ARG_DISABLE_BOOL(xul,
2757 [ --disable-xul Disable XUL],
2759 if test "$MOZ_XUL"; then
2762 dnl remove extensions that require XUL
2763 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
2768 dnl ========================================================
2769 dnl necko configuration options
2770 dnl ========================================================
2773 dnl option to disable necko's wifi scanner
2776 if test "$MOZ_WIDGET_TOOLKIT"; then
2778 case "$OS_TARGET" in
2780 if test -z "$MOZ_IOS"; then
2784 DragonFly|FreeBSD|WINNT)
2795 MOZ_ARG_DISABLE_BOOL(necko-wifi,
2796 [ --disable-necko-wifi Disable necko wifi scanner],
2800 if test "$NECKO_WIFI"; then
2801 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
2802 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
2804 AC_DEFINE(NECKO_WIFI)
2805 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
2807 AC_SUBST(NECKO_WIFI)
2808 AC_SUBST(NECKO_WIFI_DBUS)
2811 dnl option to disable cookies
2813 MOZ_ARG_DISABLE_BOOL(cookies,
2814 [ --disable-cookies Disable cookie support],
2817 AC_SUBST(NECKO_COOKIES)
2818 if test "$NECKO_COOKIES"; then
2819 AC_DEFINE(NECKO_COOKIES)
2820 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
2823 dnl ========================================================
2825 dnl = Maintainer debug option (no --enable equivalent)
2827 dnl ========================================================
2830 AC_SUBST_LIST(ASFLAGS)
2834 AC_SUBST(MOZ_AUTH_EXTENSION)
2835 AC_SUBST(MOZ_PREF_EXTENSIONS)
2836 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
2837 AC_SUBST_LIST(WARNINGS_CFLAGS)
2838 AC_SUBST_SET(MOZ_EXTENSIONS)
2840 AC_SUBST(MOZ_UNIVERSALCHARDET)
2841 AC_SUBST(MOZ_SPELLCHECK)
2842 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
2843 AC_SUBST(MOZ_CRASHREPORTER)
2844 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
2845 AC_SUBST(MOZ_STUB_INSTALLER)
2846 AC_SUBST(MOZ_UPDATER)
2848 AC_SUBST(MOZ_ANDROID_APPLICATION_CLASS)
2849 AC_SUBST(MOZ_ANDROID_BROWSER_INTENT_CLASS)
2850 AC_SUBST(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
2851 AC_SUBST(ENABLE_STRIP)
2852 AC_SUBST(PKG_SKIP_STRIP)
2853 AC_SUBST(STRIP_FLAGS)
2854 AC_SUBST(INCREMENTAL_LINKER)
2856 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
2858 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
2859 AC_SUBST(MOZ_LINKER_EXTRACT)
2861 if test -n "$MOZ_BINARY_EXTENSIONS"; then
2862 AC_DEFINE(MOZ_BINARY_EXTENSIONS)
2865 AC_SUBST(MOZ_REQUIRE_SIGNING)
2866 if test "$MOZ_REQUIRE_SIGNING" = 1; then
2867 AC_DEFINE(MOZ_REQUIRE_SIGNING)
2870 dnl ========================================================
2871 dnl = Mac bundle name prefix
2872 dnl ========================================================
2873 MOZ_ARG_WITH_STRING(macbundlename-prefix,
2874 [ --with-macbundlename-prefix=prefix
2875 Prefix for MOZ_MACBUNDLE_NAME],
2876 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
2878 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
2879 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
2880 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
2883 if test "$MOZ_DEBUG"; then
2884 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
2886 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
2888 AC_SUBST(MOZ_MACBUNDLE_NAME)
2890 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
2891 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
2892 # Otherwise, use MOZ_APP_DISPLAYNAME
2893 if test -z "$MOZ_MACBUNDLE_ID"; then
2894 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
2896 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
2897 if test "$MOZ_DEBUG"; then
2898 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
2901 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
2902 AC_SUBST(MOZ_MACBUNDLE_ID)
2904 dnl ========================================================
2905 dnl = Child Process Name for IPC
2906 dnl ========================================================
2907 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
2908 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
2910 # We want to let Android unpack the file at install time, but it only does
2911 # so if the file is named libsomething.so. The lib/ path is also required
2912 # because the unpacked file will be under the lib/ subdirectory and will
2913 # need to be executed from that path.
2914 MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
2916 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
2917 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
2919 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
2920 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
2921 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
2923 # The following variables are available to branding and application
2924 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
2925 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
2926 # impacts profile location and user-visible fields.
2927 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
2928 # versions of a given application (e.g. Aurora and Firefox both use
2929 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
2930 # for application.ini's "Name" field, which controls profile location in
2931 # the absence of a "Profile" field (see below), and various system
2932 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
2933 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
2934 # Mac Bundle name, Updater, Installer), it is typically used for nightly
2935 # builds (e.g. Aurora for Firefox).
2936 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
2937 # defaults to a lowercase form of MOZ_APP_BASENAME.
2938 # - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
2939 # profile name and remoting. If not set, defaults to MOZ_APP_NAME.
2940 # - MOZ_APP_PROFILE: When set, used for application.ini's
2941 # "Profile" field, which controls profile location.
2942 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
2943 # crash reporter server url.
2944 # - MOZ_APP_ANDROID_VERSION_CODE: On Android, "android:versionCode" for
2945 # the main application is set to the value of this variable. If not
2946 # set, it falls back to a Mozilla-specific value derived from the
2948 # - MOZ_ANDROID_SHARED_ID: On Android, "android:sharedUserId" for all Android
2949 # packages produced.
2950 # - MOZ_ANDROID_GCM_SENDERID: On Android, the Android GCM Sender ID used. GCM
2951 # sender IDs are not sensitive: see, http://stackoverflow.com/a/18216063.
2952 # - MOZ_MMA_GCM_SENDERID: This GCM Sender ID is used for MMA integration.
2953 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
2955 # The following environment variables used to have an effect, but don't anymore:
2956 # - MOZ_APP_VERSION: Defines the application version number. This was replaced with
2957 # the contents from the version.txt file in the application directory, or
2958 # browser/config/version.txt if there isn't one.
2959 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
2960 # in the "About" window. This was replaced with the contents from the
2961 # version_display.txt or version.txt in the application directory, or
2962 # browser/config/version_display.txt.
2964 if test -z "$MOZ_APP_NAME"; then
2965 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
2968 if test -z "$MOZ_APP_REMOTINGNAME"; then
2969 MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
2972 if test -z "$ANDROID_PACKAGE_NAME" ; then
2973 # When we got rid of the Aurora channel we decided to replace the old
2974 # Nightly ANDROID_PACKAGE_NAME with Aurora. To make sure this is inherited
2975 # by all mozilla-central based branches we make this the new "default"
2976 # for Fennec. Non mozilla-central based branches set ANDROID_PACKAGE_NAME
2977 # in their mozconfig, so they will never get this. If there are ever
2978 # non-Fennec builds for Android, they will fall into the else block
2979 # and use their own default name.
2980 # https://bugzilla.mozilla.org/show_bug.cgi?id=1357808 has additional
2981 # background on this.
2982 if test "$MOZ_APP_NAME" = "fennec"; then
2983 ANDROID_PACKAGE_NAME="org.mozilla.fennec_aurora"
2985 ANDROID_PACKAGE_NAME="org.mozilla.$MOZ_APP_NAME"
2989 # Mozilla released Firefox for Android {Release,Beta} and {Aurora,Nightly} to
2990 # the public with specific common shared IDs and we need to keep them
2991 # consistent forever. The specific common values are set by per-channel
2992 # branding; all other channels use a generic sharedID, set below.
2993 if test -z "$MOZ_ANDROID_SHARED_ID" ; then
2994 MOZ_ANDROID_SHARED_ID="${ANDROID_PACKAGE_NAME}.sharedID"
2997 # For extensions and langpacks, we require a max version that is compatible
2998 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
2999 # 24.0a1 and 24.0a2 aren't affected
3001 # 24.1.1 becomes 24.*
3002 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
3003 if test -z "$IS_ALPHA"; then
3005 if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
3006 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
3008 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
3012 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
3015 AC_SUBST(MOZ_APP_NAME)
3016 AC_SUBST(MOZ_APP_REMOTINGNAME)
3017 AC_SUBST(MOZ_APP_DISPLAYNAME)
3018 AC_SUBST(MOZ_APP_BASENAME)
3019 AC_SUBST(MOZ_APP_VENDOR)
3020 AC_SUBST(MOZ_APP_PROFILE)
3021 AC_SUBST(MOZ_APP_ID)
3022 AC_SUBST(MOZ_APP_ANDROID_VERSION_CODE)
3023 AC_SUBST(MOZ_ANDROID_SHARED_ID)
3024 AC_SUBST(MOZ_ANDROID_GCM_SENDERID)
3025 AC_SUBST(MOZ_MMA_GCM_SENDERID)
3026 AC_SUBST(MAR_CHANNEL_ID)
3027 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
3028 AC_SUBST(MOZ_PROFILE_MIGRATOR)
3029 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
3030 AC_SUBST(MOZ_APP_UA_NAME)
3031 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
3032 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
3033 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
3035 AC_SUBST(MOZ_APP_MAXVERSION)
3036 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
3037 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
3038 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
3041 AC_SUBST(MOZ_PKG_SPECIAL)
3042 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
3044 if test "$MOZILLA_OFFICIAL"; then
3045 # Build revisions should always be present in official builds
3046 MOZ_INCLUDE_SOURCE_INFO=1
3049 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
3050 # explicitly set the repository and changeset information in.
3051 AC_SUBST(MOZ_SOURCE_REPO)
3052 AC_SUBST(MOZ_SOURCE_CHANGESET)
3053 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
3055 dnl If we have any service that uploads data (and requires data submission
3056 dnl policy alert), set MOZ_DATA_REPORTING.
3057 dnl We need SUBST for build system and DEFINE for xul preprocessor.
3058 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER" || test -n "$MOZ_NORMANDY"; then
3059 MOZ_DATA_REPORTING=1
3060 AC_DEFINE(MOZ_DATA_REPORTING)
3061 AC_SUBST(MOZ_DATA_REPORTING)
3065 AC_SUBST(WIN32_REDIST_DIR)
3066 AC_SUBST(WIN_UCRT_REDIST_DIR)
3068 dnl ========================================================
3070 dnl ========================================================
3074 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
3080 dnl Echo the CFLAGS to remove extra whitespace.
3082 $_COMPILATION_CFLAGS \
3086 $_WARNINGS_CXXFLAGS \
3087 $_COMPILATION_CXXFLAGS \
3090 COMPILE_CFLAGS=`echo \
3094 COMPILE_CXXFLAGS=`echo \
3095 $_DEFINES_CXXFLAGS \
3099 $_WARNINGS_HOST_CFLAGS \
3100 $_COMPILATION_HOST_CFLAGS \
3103 HOST_CXXFLAGS=`echo \
3104 $_WARNINGS_HOST_CXXFLAGS \
3105 $_COMPILATION_HOST_CXXFLAGS \
3108 AC_SUBST(MOZ_SYSTEM_PNG)
3110 AC_SUBST_LIST(MOZ_PNG_CFLAGS)
3111 AC_SUBST_LIST(MOZ_PNG_LIBS)
3113 AC_SUBST(MOZ_SYSTEM_NSPR)
3115 AC_SUBST(MOZ_SYSTEM_NSS)
3117 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
3118 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
3119 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
3120 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
3121 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
3122 OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
3123 OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
3125 AC_SUBST(HOST_CMFLAGS)
3126 AC_SUBST(HOST_CMMFLAGS)
3127 AC_SUBST(OS_COMPILE_CMFLAGS)
3128 AC_SUBST(OS_COMPILE_CMMFLAGS)
3131 OS_CXXFLAGS="$CXXFLAGS"
3132 OS_CPPFLAGS="$CPPFLAGS"
3133 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
3134 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
3135 OS_LDFLAGS="$LDFLAGS"
3137 AC_SUBST_LIST(OS_CFLAGS)
3138 AC_SUBST_LIST(OS_CXXFLAGS)
3139 AC_SUBST_LIST(OS_CPPFLAGS)
3140 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
3141 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
3142 AC_SUBST_LIST(OS_LDFLAGS)
3147 AC_SUBST_LIST(HOST_CFLAGS)
3148 AC_SUBST_LIST(HOST_CPPFLAGS)
3149 AC_SUBST_LIST(HOST_CXXFLAGS)
3150 AC_SUBST(HOST_LDFLAGS)
3151 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
3152 AC_SUBST(HOST_BIN_SUFFIX)
3154 AC_SUBST(TARGET_XPCOM_ABI)
3155 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
3156 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
3157 AC_SUBST(HAVE_X86_AVX2)
3158 AC_SUBST(HAVE_ALTIVEC)
3160 AC_SUBST_LIST(DSO_CFLAGS)
3161 AC_SUBST_LIST(DSO_PIC_CFLAGS)
3162 AC_SUBST(DSO_LDOPTS)
3163 AC_SUBST(BIN_SUFFIX)
3165 AC_SUBST(NS_ENABLE_TSF)
3166 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
3167 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
3169 AC_SUBST(MOZ_DEVTOOLS)
3171 AC_SUBST(MOZ_PACKAGE_JSSHELL)
3172 AC_SUBST(MOZ_FOLD_LIBS)
3173 AC_SUBST_LIST(MOZ_FOLD_LIBS_FLAGS)
3177 dnl Host JavaScript runtime, if any, to use during cross compiles.
3180 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
3182 if test -n "$COMPILE_ENVIRONMENT"; then
3183 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
3185 dnl Check for missing components
3186 if test "$MOZ_X11"; then
3187 dnl ====================================================
3188 dnl = Check if X headers exist
3189 dnl ====================================================
3190 _SAVE_CFLAGS=$CFLAGS
3191 CFLAGS="$CFLAGS $XCFLAGS"
3195 #include <X11/Xlib.h>
3196 #include <X11/Intrinsic.h>
3197 #include <X11/extensions/XShm.h>
3201 if ((dpy = XOpenDisplay(NULL)) == NULL) {
3202 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
3206 [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
3207 CFLAGS="$_SAVE_CFLAGS"
3209 if test -n "$MISSING_X"; then
3210 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
3215 fi # COMPILE_ENVIRONMENT
3217 dnl Set various defines and substitutions
3218 dnl ========================================================
3220 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
3221 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
3222 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
3223 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
3224 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
3225 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
3226 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
3227 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
3228 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
3231 AC_SUBST(MOZ_DEV_EDITION)
3232 if test -n "$MOZ_DEV_EDITION"; then
3233 AC_DEFINE(MOZ_DEV_EDITION)
3236 if test "$MOZ_DEBUG" -o "$DEVELOPER_OPTIONS"; then
3240 if test -n "$A11Y_LOG"; then
3244 dnl Spit out some output
3245 dnl ========================================================
3247 dnl The following defines are used by xpcom
3248 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
3260 # Avoid using obsolete NSPR features
3261 AC_DEFINE(NO_NSPR_10_SUPPORT)
3263 MOZ_CREATE_CONFIG_STATUS()
3265 rm -fr confdefs* $ac_clean_files