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"
209 CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
210 CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
212 # Check w32api version
213 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
214 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
215 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
216 AC_TRY_COMPILE([#include <w32api.h>],
217 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
218 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
219 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
220 #error "test failed."
222 , [ res=yes ], [ res=no ])
223 AC_MSG_RESULT([$res])
224 if test "$res" != "yes"; then
225 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
227 # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
228 # causing problems with local implementations with the same name.
229 AC_DEFINE(STRSAFE_NO_DEPRECATE)
232 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
233 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
234 # Require OS features provided by IE 8.0 (Win7)
235 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0800)
240 if test -n "$_WIN32_MSVC"; then
242 SKIP_COMPILER_CHECKS=1
243 SKIP_LIBRARY_CHECKS=1
245 # Since we're skipping compiler and library checks, hard-code
248 AC_DEFINE(HAVE_ISATTY)
251 fi # COMPILE_ENVIRONMENT
256 AC_SUBST_LIST(STL_FLAGS)
257 AC_SUBST(WRAP_STL_INCLUDES)
259 dnl ========================================================
260 dnl Checks for programs.
261 dnl ========================================================
262 if test "$COMPILE_ENVIRONMENT"; then
268 fi # COMPILE_ENVIRONMENT
270 dnl ========================================================
271 dnl set the defaults first
272 dnl ========================================================
273 MOZ_USER_DIR=".mozilla"
275 MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
279 dnl Configure platform-specific CPU architecture compiler options.
280 dnl ==============================================================
281 if test "$COMPILE_ENVIRONMENT"; then
283 fi # COMPILE_ENVIRONMENT
285 dnl ========================================================
286 dnl Android libstdc++
287 dnl ========================================================
290 if test "$COMPILE_ENVIRONMENT"; then
292 fi # COMPILE_ENVIRONMENT
294 dnl ========================================================
295 dnl Suppress Clang Argument Warnings
296 dnl ========================================================
297 WARNINGS_CFLAGS="$_WARNINGS_CFLAGS"
298 if test -n "${CLANG_CC}${CLANG_CL}"; then
299 WARNINGS_CFLAGS="-Qunused-arguments $WARNINGS_CFLAGS"
300 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
302 if test -n "${CLANG_CXX}${CLANG_CL}"; then
303 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
306 if test -n "$COMPILE_ENVIRONMENT"; then
310 dnl ========================================================
311 dnl Add optional and non-optional hardening flags
312 dnl ========================================================
314 CFLAGS="$CFLAGS $MOZ_HARDENING_CFLAGS"
315 CPPFLAGS="$CPPFLAGS $MOZ_HARDENING_CFLAGS"
316 CXXFLAGS="$CXXFLAGS $MOZ_HARDENING_CFLAGS"
317 LDFLAGS="$LDFLAGS $MOZ_HARDENING_LDFLAGS"
319 dnl ========================================================
320 dnl GNU specific defaults
321 dnl ========================================================
322 if test "$GNU_CC"; then
326 SSSE3_FLAGS="-mssse3"
327 # FIXME: Let us build with strict aliasing. bug 414641.
328 CFLAGS="$CFLAGS -fno-strict-aliasing"
329 WARNINGS_AS_ERRORS='-Werror'
332 if test "$OS_ARCH" != "WINNT" -o -z "$CLANG_CC"; then
333 DSO_PIC_CFLAGS='-fPIC'
334 ASFLAGS="$ASFLAGS -fPIC"
337 AC_MSG_CHECKING([for --noexecstack option to as])
339 CFLAGS="$CFLAGS -Wa,--noexecstack"
340 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
341 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
344 AC_MSG_CHECKING([for -z noexecstack option to ld])
345 _SAVE_LDFLAGS=$LDFLAGS
346 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
347 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
349 LDFLAGS=$_SAVE_LDFLAGS)
351 AC_MSG_CHECKING([for -z text option to ld])
352 _SAVE_LDFLAGS=$LDFLAGS
353 LDFLAGS="$LDFLAGS -Wl,-z,text"
354 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
356 LDFLAGS=$_SAVE_LDFLAGS)
358 AC_MSG_CHECKING([for -z relro option to ld])
359 _SAVE_LDFLAGS=$LDFLAGS
360 LDFLAGS="$LDFLAGS -Wl,-z,relro"
361 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
363 LDFLAGS=$_SAVE_LDFLAGS)
365 AC_MSG_CHECKING([for -z nocopyreloc option to ld])
366 _SAVE_LDFLAGS=$LDFLAGS
367 LDFLAGS="$LDFLAGS -Wl,-z,nocopyreloc"
368 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
370 LDFLAGS=$_SAVE_LDFLAGS)
372 AC_MSG_CHECKING([for -Bsymbolic-functions option to ld])
373 _SAVE_LDFLAGS=$LDFLAGS
374 LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
375 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
377 LDFLAGS=$_SAVE_LDFLAGS)
379 AC_MSG_CHECKING([for --build-id=sha1 option to ld])
380 _SAVE_LDFLAGS=$LDFLAGS
381 LDFLAGS="$LDFLAGS -Wl,--build-id=sha1"
382 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
384 LDFLAGS=$_SAVE_LDFLAGS)
386 AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
387 HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
388 _SAVE_LDFLAGS=$LDFLAGS
389 LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
390 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
391 [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
393 LDFLAGS=$_SAVE_LDFLAGS
395 # Check for -mssse3 on $CC
396 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
397 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
399 CFLAGS="$CFLAGS -mssse3"
400 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
401 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
405 # Check for -msse4.1 on $CC
406 AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
407 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
409 CFLAGS="$CFLAGS -msse4.1"
410 AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
411 [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
415 case "${CPU_ARCH}" in
417 AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
419 [asm volatile ("vpermq \$0xd8,%ymm0,%ymm0 \n");],
420 result="yes", result="no")
421 AC_MSG_RESULT("$result")
422 if test "$result" = "yes"; then
428 AC_MSG_CHECKING([whether we can enable AltiVec support])
431 CFLAGS="$CFLAGS -maltivec"
432 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
440 if test "$GCC_USE_GNU_LD"; then
441 # Some tools like ASan use a runtime library that is only
442 # linked against executables, so we must allow undefined
443 # symbols for shared objects in some cases.
444 if test -z "$MOZ_ASAN$MOZ_MSAN$MOZ_UBSAN$MOZ_TSAN$FUZZING_INTERFACES"; then
445 # Don't allow undefined symbols in libraries
446 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
448 # BSDs need `environ' exposed for posix_spawn (bug 753046)
450 DragonFly|FreeBSD|NetBSD|OpenBSD)
451 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
452 DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
454 DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
461 _DEFINES_CFLAGS="-include $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
462 _USE_CPP_INCLUDE_FLAG=1
464 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
467 if test "$GNU_CXX"; then
468 # FIXME: Let us build with strict aliasing. bug 414641.
469 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
471 _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
472 _USE_CPP_INCLUDE_FLAG=1
475 # For profiling builds keep the symbol information
476 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
478 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
479 STRIP_FLAGS="--strip-debug"
484 dnl ========================================================
486 dnl ========================================================
488 if test "$MOZ_DMD"; then
489 if test "${CPU_ARCH}" = "arm"; then
490 CFLAGS="$CFLAGS -funwind-tables"
491 CXXFLAGS="$CXXFLAGS -funwind-tables"
495 dnl ========================================================
496 dnl System overrides of the defaults for host
497 dnl ========================================================
500 if test -n "$_WIN32_MSVC"; then
501 HOST_CFLAGS="$HOST_CFLAGS -nologo"
503 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
505 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
506 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
509 case "${host_cpu}" in
511 if test -n "$_WIN32_MSVC"; then
512 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
516 if test -n "$_WIN32_MSVC"; then
517 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
519 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
525 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
526 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
529 *-linux*|*-kfreebsd*-gnu|*-gnu*)
530 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
531 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
535 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
536 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
540 dnl ========================================================
541 dnl System overrides of the defaults for target
542 dnl ========================================================
546 MOZ_OPTIMIZE_FLAGS="-O3"
547 CXXFLAGS="$CXXFLAGS -stdlib=libc++"
549 STRIP_FLAGS="$STRIP_FLAGS -x -S"
550 # Ensure that if we're targeting iOS an SDK was provided.
551 AC_CACHE_CHECK(for iOS target,
553 [AC_TRY_COMPILE([#include <TargetConditionals.h>
554 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
558 ac_cv_ios_target="yes",
559 ac_cv_ios_target="no")])
560 if test "$ac_cv_ios_target" = "yes" -a -z $MOZ_IOS; then
561 AC_MSG_ERROR([targeting iOS but not using an iOS SDK?])
563 if test -z "$MOZ_IOS"; then
564 # The ExceptionHandling framework is needed for Objective-C exception
565 # logging code in nsObjCExceptions.h. Currently we only use that in debug
567 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
570 dnl DTrace and -dead_strip don't interact well. See bug 403132.
571 dnl ===================================================================
572 if test "x$enable_dtrace" = "xyes"; then
573 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
575 dnl check for the presence of the -dead_strip linker flag
576 AC_MSG_CHECKING([for -dead_strip option to ld])
577 _SAVE_LDFLAGS=$LDFLAGS
578 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
579 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
580 if test -n "$_HAVE_DEAD_STRIP" ; then
582 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
587 LDFLAGS=$_SAVE_LDFLAGS
590 MOZ_FIX_LINK_PATHS="-Wl,-executable_path,${DIST}/bin"
593 *-android*|*-linuxandroid*)
594 if test "$COMPILE_ENVIRONMENT"; then
598 MOZ_GFX_OPTIMIZE_MOBILE=1
599 if test -z "$CLANG_CC"; then
600 MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
602 # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
603 # -Oz is smaller than -Os on clang.
604 MOZ_OPTIMIZE_FLAGS="-Oz"
605 # Disable the outliner, which causes performance regressions, and is
606 # enabled on some platforms at -Oz.
607 if test -z "$MOZ_LTO"; then
608 DISABLE_OUTLINER="-mno-outline"
610 CFLAGS="$CFLAGS $DISABLE_OUTLINER"
611 AC_TRY_COMPILE(,,[MOZ_OPTIMIZE_FLAGS="$MOZ_OPTIMIZE_FLAGS $DISABLE_OUTLINER"])
612 CFLAGS="$_SAVE_CFLAGS"
614 DISABLE_OUTLINER="-Wl,-plugin-opt=-enable-machine-outliner=never"
615 _SAVE_LDFLAGS=$LDFLAGS
616 LDFLAGS="$LDFLAGS $MOZ_LTO_LDFLAGS $DISABLE_OUTLINER"
617 AC_TRY_LINK(,,[MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS $DISABLE_OUTLINER"])
618 LDFLAGS="$_SAVE_LDFLAGS"
624 if test "$GNU_CC" -o "$GNU_CXX"; then
625 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
626 if test -n "$MOZ_DEBUG"; then
627 MOZ_OPTIMIZE_FLAGS="-Os"
629 MOZ_OPTIMIZE_FLAGS="-O2"
631 if test -z "$CLANG_CC"; then
632 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
636 case "${target_cpu}" in
638 CFLAGS="$CFLAGS -mieee"
639 CXXFLAGS="$CXXFLAGS -mieee"
646 # certain versions of cygwin's makedepend barf on the
647 # #include <string> vs -I./dist/include/string issue so don't use it
648 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
653 # Use temp file for windres (bug 213281)
654 RCFLAGS='-O coff --use-temp-file'
655 # mingw doesn't require kernel32, user32, and advapi32 explicitly
656 LIBS="$LIBS -luuid -lusp10 -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
659 MOZ_OPTIMIZE_FLAGS="-O2"
661 WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
662 WIN32_GUI_EXE_LDFLAGS=-mwindows
664 if test -z "$CLANG_CC"; then
665 # Use static libgcc and libstdc++
666 LDFLAGS="$LDFLAGS -static"
668 # GCC/binutils can't link to a function if we try to include dllexport function
669 # in the same library as dllimport caller. To work around it, we build NSPR
670 # and NSS with -mnop-fun-dllimport flag. The drawback of this solution is that
671 # function thunks need to be generated for cross-DLL calls.
672 MOZ_FOLD_LIBS_FLAGS="-mnop-fun-dllimport"
674 # Silence problematic clang warnings
675 CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
678 TARGET_COMPILER_ABI=msvc
679 RANLIB='echo not_ranlib'
680 STRIP='echo not_strip'
682 # aarch64 doesn't support subsystems below 6.02
683 if test "$CPU_ARCH" = "aarch64"; then
684 WIN32_SUBSYSTEM_VERSION=6.02
686 WIN32_SUBSYSTEM_VERSION=6.01
688 WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
689 WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
690 DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
691 _USE_CPP_INCLUDE_FLAG=1
692 _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
693 _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
694 CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
695 CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
696 if test -z "$CLANG_CL"; then
697 CPPFLAGS="$CPPFLAGS -utf-8"
699 if test "$CPU_ARCH" = "x86"; then
700 dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
701 dnl more recent, so set that explicitly here unless another
702 dnl target arch has already been set.
704 if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
705 CFLAGS="$CFLAGS -arch:SSE2"
707 if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
708 CXXFLAGS="$CXXFLAGS -arch:SSE2"
711 SSE_FLAGS="-arch:SSE"
712 SSE2_FLAGS="-arch:SSE2"
713 dnl MSVC allows the use of intrinsics without any flags
714 dnl and doesn't have a separate arch for SSSE3
715 SSSE3_FLAGS="-arch:SSE2"
717 dnl clang-cl requires appropriate flags to enable SSSE3 support
718 dnl on all architectures.
719 if test -n "$CLANG_CL"; then
720 SSSE3_FLAGS="-mssse3"
722 dnl VS2013+ supports -Gw for better linker optimizations.
723 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
724 dnl Disabled on ASan because it causes false-positive ODR violations.
725 if test -z "$MOZ_ASAN"; then
727 CXXFLAGS="$CXXFLAGS -Gw"
729 # String tail merging doesn't play nice with ASan's ODR checker.
730 LDFLAGS="$LDFLAGS -opt:nolldtailmerge"
732 if test -n "$CLANG_CL"; then
733 # XXX We should combine some of these with our generic GCC-style
736 # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
737 CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
738 # We use offsetof on non-POD objects all the time.
739 # We also suppress this warning on other platforms.
740 CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
741 # This warns for reasonable things like:
742 # enum { X = 0xffffffffU };
743 # which is annoying for IDL headers.
744 CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
745 # This warns for cases that would be reached by the Microsoft
746 # #include rules, but also currently warns on cases that would
747 # *also* be reached by standard C++ include rules. That
748 # behavior doesn't seem useful, so we turn it off.
749 CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
750 # We normally error out on unknown pragmas, but since clang-cl
751 # claims to be MSVC, it would be difficult to add
752 # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
753 # use such pragmas, so just ignore them.
754 CFLAGS="$CFLAGS -Wno-unknown-pragmas"
755 CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
756 # We get errors about various #pragma intrinsic directives from
757 # clang-cl, and we don't need to hear about those.
758 CFLAGS="$CFLAGS -Wno-ignored-pragmas"
759 CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
760 # clang-cl's Intrin.h marks things like _ReadWriteBarrier
761 # as __attribute((__deprecated__)). This is nice to know,
762 # but since we don't get the equivalent warning from MSVC,
763 # let's just ignore it.
764 CFLAGS="$CFLAGS -Wno-deprecated-declarations"
765 CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
766 # We use a function like:
767 # __declspec(noreturn) __inline void f() {}
768 # which -Winvalid-noreturn complains about. Again, MSVC seems
769 # OK with it, so let's silence the warning.
770 CFLAGS="$CFLAGS -Wno-invalid-noreturn"
771 CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
772 # Missing |override| on virtual function declarations isn't
773 # something that MSVC currently warns about.
774 CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
775 # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
776 # declaration on |operator delete(void*)|. However, clang-cl
777 # must internally declare |operator delete(void*)| differently,
778 # which causes this warning for virtually every file in the
779 # tree. clang-cl doesn't support -fno-exceptions or equivalent,
780 # so there doesn't seem to be any way to convince clang-cl to
781 # declare |delete| differently. Therefore, suppress this
783 CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
784 # At least one MSVC header and several headers in-tree have
785 # unused typedefs, so turn this on.
786 CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
787 # jemalloc uses __declspec(allocator) as a profiler hint,
788 # which clang-cl doesn't understand.
789 CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
790 # __attribute__((unused)) really means "might be unused" and
791 # we use it to avoid warnings about things that are unused
792 # in some compilation units, but used in many others. This
793 # warning insists on complaining about the latter case, which
794 # is annoying, and rather noisy.
795 CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused"
797 # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
798 CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
799 LIBS="$LIBS user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
800 MOZ_DEBUG_LDFLAGS='-DEBUG'
801 WARNINGS_AS_ERRORS='-WX'
802 # Use a higher optimization level for clang-cl, so we can come closer
803 # to MSVC's performance numbers (see bug 1443590).
804 if test -n "$CLANG_CL"; then
805 MOZ_OPTIMIZE_FLAGS='-O2'
807 MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
810 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE"
811 if test -z "$DEVELOPER_OPTIONS"; then
812 LDFLAGS="$LDFLAGS -RELEASE"
815 dnl Minimum reqiurement of Gecko is VS2015 or later which supports
816 dnl both SSSE3 and SSE4.1.
817 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
818 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
819 dnl allow AVX2 code from VS2015
822 AC_DEFINE(WIN32_LEAN_AND_MEAN)
823 dnl See http://support.microsoft.com/kb/143208 to use STL
826 MOZ_USER_DIR="Mozilla"
830 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.])
834 if test -n "$GNU_CC" -a -z "$CLANG_CC"; then
835 CFLAGS="$CFLAGS -fno-keep-inline-dllexport"
836 CXXFLAGS="$CXXFLAGS -fno-keep-inline-dllexport"
841 if test -n "$GNU_CC"; then
842 CFLAGS="$CFLAGS -mstackrealign"
843 CXXFLAGS="$CXXFLAGS -mstackrealign"
844 LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
846 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
847 LDFLAGS="$LDFLAGS -SAFESEH"
853 if test -n "$_WIN32_MSVC"; then
854 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
859 if test -n "$_WIN32_MSVC"; then
860 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:ARM64"
865 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
872 CFLAGS="$CFLAGS -Dunix"
873 CXXFLAGS="$CXXFLAGS -Dunix"
874 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
875 DSO_PIC_CFLAGS='-fPIC -DPIC'
877 MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
879 DSO_PIC_CFLAGS='-fPIC -DPIC'
882 # This will fail on a.out systems prior to 1.5.1_ALPHA.
883 if test "$LIBRUNPATH"; then
884 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
889 if test -z "$X11BASE"; then
892 MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
894 DSO_PIC_CFLAGS='-fPIC'
895 DSO_LDOPTS='-shared -fPIC'
896 if test "$LIBRUNPATH"; then
897 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
902 MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
907 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
908 MOZ_OPTIMIZE_FLAGS="-O"
911 AC_SUBST_LIST(MMX_FLAGS)
912 AC_SUBST_LIST(SSE_FLAGS)
913 AC_SUBST_LIST(SSE2_FLAGS)
914 AC_SUBST_LIST(SSSE3_FLAGS)
917 if test -n "$MOZ_LINKER"; then
918 AC_DEFINE(MOZ_LINKER)
920 AC_CHECK_PROGS(XZ, xz)
923 if test -z "$COMPILE_ENVIRONMENT"; then
924 SKIP_COMPILER_CHECKS=1
925 SKIP_LIBRARY_CHECKS=1
930 fi # COMPILE_ENVIRONMENT
932 if test -z "$SKIP_COMPILER_CHECKS"; then
933 dnl Checks for typedefs, structures, and compiler characteristics.
934 dnl ========================================================
949 case "${OS_TARGET}" in
953 STL_FLAGS="-I${DIST}/stl_wrappers"
958 if test "$MOZ_BUILD_APP" = "tools/crashreporter"; then
962 dnl Checks for header files.
963 dnl ========================================================
966 bitrig*|dragonfly*|freebsd*|openbsd*)
967 # for stuff like -lXshm
968 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
972 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
973 AC_CACHE_CHECK(for sockaddr_in.sin_len,
974 ac_cv_sockaddr_in_sin_len,
975 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
976 #include <sys/types.h>
978 #include <netinet/in.h>
979 struct sockaddr_in x;
980 void *foo = (void*) &x.sin_len;],
982 [ac_cv_sockaddr_in_sin_len=true],
983 [ac_cv_sockaddr_in_sin_len=false])])
984 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
985 AC_DEFINE(HAVE_SIN_LEN)
986 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
987 AC_DEFINE(HAVE_SCONN_LEN)
990 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
991 ac_cv_sockaddr_in6_sin6_len,
992 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
993 #include <sys/types.h>
995 #include <netinet/in.h>
996 struct sockaddr_in6 x;
997 void *foo = (void*) &x.sin6_len;],
999 [ac_cv_sockaddr_in6_sin6_len=true],
1000 [ac_cv_sockaddr_in6_sin6_len=false])])
1001 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
1002 AC_DEFINE(HAVE_SIN6_LEN)
1005 AC_CACHE_CHECK(for sockaddr.sa_len,
1006 ac_cv_sockaddr_sa_len,
1007 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1008 #include <sys/types.h>
1010 #include <sys/socket.h>
1012 void *foo = (void*) &x.sa_len;],
1014 [ac_cv_sockaddr_sa_len=true],
1015 [ac_cv_sockaddr_sa_len=false])])
1016 if test "$ac_cv_sockaddr_sa_len" = true ; then
1017 AC_DEFINE(HAVE_SA_LEN)
1020 MOZ_ARG_ENABLE_BOOL(dtrace,
1021 [ --enable-dtrace build with dtrace support if available (default=no)],
1022 [enable_dtrace="yes"],)
1023 if test "x$enable_dtrace" = "xyes"; then
1024 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
1025 if test -n "$HAVE_DTRACE"; then
1026 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
1028 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
1031 AC_SUBST(HAVE_DTRACE)
1033 dnl Checks for libraries.
1034 dnl ========================================================
1035 AC_CHECK_LIB(c_r, gethostbyname_r)
1037 dnl We don't want to link with libdl even if it's present on OS X, since
1038 dnl it's not used and not part of the default installation. OS/2 has dlfcn
1040 dnl We don't want to link against libm or libpthread on Darwin since
1041 dnl they both are just symlinks to libSystem and explicitly linking
1042 dnl against libSystem causes issues when debugging (see bug 299601).
1047 AC_SEARCH_LIBS(dlopen, dl,
1048 MOZ_CHECK_HEADER(dlfcn.h,
1049 AC_DEFINE(HAVE_DLOPEN)))
1053 _SAVE_CFLAGS="$CFLAGS"
1054 CFLAGS="$CFLAGS -D_GNU_SOURCE"
1055 AC_CHECK_FUNCS(dladdr memmem)
1056 CFLAGS="$_SAVE_CFLAGS"
1058 if test ! "$GNU_CXX"; then
1059 AC_CHECK_LIB(C, demangle)
1062 AC_CHECK_LIB(socket, socket)
1065 XLIBS="$X_EXTRA_LIBS"
1067 dnl ========================================================
1068 dnl Checks for X libraries.
1069 dnl Ordering is important.
1070 dnl Xt is dependent upon SM as of X11R6
1071 dnl ========================================================
1072 if test -n "$MOZ_X11"; then
1073 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
1074 _SAVE_LDFLAGS="$LDFLAGS"
1076 LDFLAGS="$XLDFLAGS $LDFLAGS"
1077 AC_CHECK_LIB(X11, XDrawLines, [XLIBS="-lX11 $XLIBS"],
1078 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
1079 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
1080 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
1082 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
1083 unset ac_cv_lib_Xt_XtFree
1084 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
1085 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
1086 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
1087 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
1090 dnl ========================================================
1092 dnl ========================================================
1093 AC_CHECK_LIB(xcb, xcb_connect, [XLIBS="-lxcb $XLIBS"],
1094 [MISSING_X="$MISSING_X -lxcb"], $XLIBS)
1095 AC_CHECK_LIB(xcb-shm, xcb_shm_query_version, [XLIBS="-lxcb-shm $XLIBS"],
1096 [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS)
1097 AC_CHECK_LIB(X11-xcb, XGetXCBConnection, [XLIBS="-lX11-xcb $XLIBS"],
1098 [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS)
1100 LDFLAGS="$_SAVE_LDFLAGS"
1104 AC_SUBST_LIST(XCFLAGS)
1105 AC_SUBST_LIST(XLDFLAGS)
1106 AC_SUBST_LIST(XLIBS)
1107 AC_SUBST_LIST(XEXT_LIBS)
1108 AC_SUBST_LIST(XT_LIBS)
1110 dnl ========================================================
1111 dnl = pthread support
1112 dnl = Start by checking whether the system support pthreads
1113 dnl ========================================================
1114 case "$target_os" in
1119 AC_CHECK_LIB(pthreads, pthread_create,
1120 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
1121 AC_CHECK_LIB(pthread, pthread_create,
1122 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
1123 AC_CHECK_LIB(c_r, pthread_create,
1124 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
1125 AC_CHECK_LIB(c, pthread_create,
1134 dnl ========================================================
1135 dnl Do the platform specific pthread hackery
1136 dnl ========================================================
1137 if test "$MOZ_USE_PTHREADS"x != x
1140 dnl See if -pthread is supported.
1143 ac_cv_have_dash_pthread=no
1144 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
1145 echo 'int main() { return 0; }' | cat > conftest.c
1146 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
1147 if test $? -eq 0; then
1148 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1149 ac_cv_have_dash_pthread=yes
1150 case "$target_os" in
1152 # Freebsd doesn't use -pthread for compiles, it uses them for linking
1155 CFLAGS="$CFLAGS -pthread"
1156 CXXFLAGS="$CXXFLAGS -pthread"
1162 AC_MSG_RESULT($ac_cv_have_dash_pthread)
1165 dnl See if -pthreads is supported.
1167 ac_cv_have_dash_pthreads=no
1168 if test "$ac_cv_have_dash_pthread" = "no"; then
1169 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
1170 echo 'int main() { return 0; }' | cat > conftest.c
1171 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
1172 if test $? -eq 0; then
1173 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1174 ac_cv_have_dash_pthreads=yes
1175 CFLAGS="$CFLAGS -pthreads"
1176 CXXFLAGS="$CXXFLAGS -pthreads"
1180 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
1185 AC_DEFINE(_REENTRANT)
1186 AC_DEFINE(_THREAD_SAFE)
1187 dnl -pthread links in -lpthread, so don't specify it explicitly.
1188 if test "$ac_cv_have_dash_pthread" = "yes"; then
1189 _PTHREAD_LDFLAGS="-pthread"
1193 *-*-openbsd*|*-*-bsdi*)
1194 AC_DEFINE(_REENTRANT)
1195 AC_DEFINE(_THREAD_SAFE)
1196 dnl -pthread links in -lc_r, so don't specify it explicitly.
1197 if test "$ac_cv_have_dash_pthread" = "yes"; then
1198 _PTHREAD_LDFLAGS="-pthread"
1202 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
1203 AC_DEFINE(_REENTRANT)
1207 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
1208 AC_SUBST(MOZ_USE_PTHREADS)
1209 MOZ_CHECK_HEADERS(pthread.h)
1213 dnl Checks for library functions.
1214 dnl ========================================================
1215 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall)
1217 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1218 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1219 ac_cv_clock_monotonic,
1220 [for libs in "" -lrt; do
1222 _SAVE_CFLAGS="$CFLAGS"
1224 CFLAGS="$CFLAGS $DSO_PIC_CFLAGS"
1225 dnl clock_gettime is available on OSX since 10.12, so depending on MACOSX_DEPLOYMENT_TARGET,
1226 dnl we should or not be able to use it. To detect if we can, we need to make the
1227 dnl availability attribute strict, so that compilation fails when the target is < 10.12.
1228 AC_TRY_LINK([#define availability(os, ...) availability(os, strict, __VA_ARGS)
1230 [ struct timespec ts;
1231 clock_gettime(CLOCK_MONOTONIC, &ts); ],
1232 ac_cv_clock_monotonic=$libs
1235 ac_cv_clock_monotonic=no)
1237 CFLAGS="$_SAVE_CFLAGS"
1239 if test "$ac_cv_clock_monotonic" != "no"; then
1240 HAVE_CLOCK_MONOTONIC=1
1241 REALTIME_LIBS=$ac_cv_clock_monotonic
1242 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1243 AC_SUBST(HAVE_CLOCK_MONOTONIC)
1244 AC_SUBST_LIST(REALTIME_LIBS)
1247 dnl Turn on warnings-as-errors to prevent implicit declaration of
1248 dnl pthread_cond_timedwait_monotonic_np, which can cause this test to
1249 dnl inadvertently pass even if the function does not really exist.
1250 _SAVE_CFLAGS="$CFLAGS"
1251 CFLAGS="$CFLAGS $WARNINGS_AS_ERRORS"
1252 AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
1253 ac_cv_pthread_cond_timedwait_monotonic_np,
1254 AC_TRY_LINK([#include <pthread.h>],
1255 [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
1256 ac_cv_pthread_cond_timewait_monotonic_np=yes,
1257 ac_cv_pthread_cond_timewait_monotonic_np=no))
1258 if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
1259 AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
1261 CFLAGS=$_SAVE_CFLAGS
1265 ac_cv_func_res_ninit,
1266 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
1267 dnl no need for res_ninit() on NetBSD and OpenBSD
1268 ac_cv_func_res_ninit=no
1272 #define _BSD_SOURCE 1
1274 #include <sys/types.h>
1275 #include <netinet/in.h>
1276 #include <arpa/nameser.h>
1279 [int foo = res_ninit(&_res);],
1280 [ac_cv_func_res_ninit=yes],
1281 [ac_cv_func_res_ninit=no])
1285 if test "$ac_cv_func_res_ninit" = "yes"; then
1286 AC_DEFINE(HAVE_RES_NINIT)
1287 dnl must add the link line we do something as foolish as this... dougt
1289 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
1290 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
1295 dnl **********************
1296 dnl *** va_copy checks ***
1297 AC_CACHE_CHECK([for an implementation of va_copy()],
1299 [AC_TRY_COMPILE([#include <stdarg.h>
1301 void f (int i, ...) {
1302 va_list args1, args2;
1303 va_start (args1, i);
1304 va_copy (args2, args1);
1305 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1307 va_end (args1); va_end (args2);
1309 [f(0, 42); return 0],
1310 [ac_cv_va_copy=yes],
1314 AC_CACHE_CHECK([whether va_list can be copied by value],
1316 [AC_TRY_COMPILE([#include <stdarg.h>
1318 void f (int i, ...) {
1319 va_list args1, args2;
1320 va_start (args1, i);
1322 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1324 va_end (args1); va_end (args2);
1326 [f(0, 42); return 0],
1327 [ac_cv_va_val_copy=yes],
1328 [ac_cv_va_val_copy=no],
1331 if test "x$ac_cv_va_copy" = "xyes"; then
1332 AC_DEFINE(VA_COPY, va_copy)
1333 AC_DEFINE(HAVE_VA_COPY)
1336 if test "x$ac_cv_va_val_copy" = "xno"; then
1337 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
1340 dnl ===================================================================
1341 dnl ========================================================
1342 dnl Put your C++ language/feature checks below
1343 dnl ========================================================
1347 if test "$GNU_CC"; then
1348 if test "$CPU_ARCH" = "arm" ; then
1349 AC_CACHE_CHECK(for ARM EABI,
1353 #if defined(__ARM_EABI__)
1356 #error Not ARM EABI.
1359 ac_cv_gcc_arm_eabi="yes",
1360 ac_cv_gcc_arm_eabi="no")])
1361 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
1363 ARM_ABI_PREFIX=eabi-
1365 ARM_ABI_PREFIX=oabi-
1369 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
1372 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
1373 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
1374 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
1376 _SAVE_LDFLAGS=$LDFLAGS
1377 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
1378 AC_CACHE_CHECK(for __thread keyword for TLS variables,
1379 ac_cv_thread_keyword,
1380 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
1381 [return tlsIsMainThread;],
1382 ac_cv_thread_keyword=yes,
1383 ac_cv_thread_keyword=no)])
1384 LDFLAGS=$_SAVE_LDFLAGS
1385 # The custom dynamic linker doesn't support TLS variables
1387 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
1388 # mips builds fail with TLS variables because of a binutils bug.
1390 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
1395 *-android*|*-linuxandroid*)
1402 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
1408 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
1409 if test -n "$MOZ_LINKER"; then
1410 if test "$CPU_ARCH" = arm; then
1411 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
1412 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
1413 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1414 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1418 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
1419 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
1420 dnl Since the linker only understands the sysv ones, no need to build the
1421 dnl gnu style tables anyways.
1422 LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
1425 dnl End of C++ language/feature checks
1428 dnl ========================================================
1429 dnl = Internationalization checks
1430 dnl ========================================================
1432 dnl Internationalization and Locale support is different
1433 dnl on various UNIX platforms. Checks for specific i18n
1434 dnl features go here.
1436 AC_HAVE_FUNCS(localeconv)
1438 fi # ! SKIP_COMPILER_CHECKS
1440 if test -n "${COMPILE_ENVIRONMENT}"; then
1445 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1446 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1447 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1450 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1451 dnl features that Windows actually does support.
1453 if test -n "$SKIP_COMPILER_CHECKS"; then
1454 dnl Windows has malloc.h
1455 AC_DEFINE(MALLOC_H, [<malloc.h>])
1456 AC_DEFINE(HAVE_FORCEINLINE)
1457 AC_DEFINE(HAVE_LOCALECONV)
1458 fi # SKIP_COMPILER_CHECKS
1460 dnl Mozilla specific options
1461 dnl ========================================================
1462 dnl The macros used for command line options
1463 dnl are defined in build/autoconf/altoptions.m4.
1465 dnl ========================================================
1467 dnl = Check for external package dependencies
1469 dnl ========================================================
1470 MOZ_ARG_HEADER(External Packages)
1472 case "$OS_TARGET" in
1473 WINNT|Darwin|Android)
1483 dnl ========================================================
1484 dnl system libevent Support
1485 dnl ========================================================
1486 MOZ_ARG_WITH_STRING(system-libevent,
1487 [ --with-system-libevent[=PFX]
1488 Use system libevent [installed at prefix PFX]],
1489 LIBEVENT_DIR=$withval)
1491 _SAVE_CFLAGS=$CFLAGS
1492 _SAVE_LDFLAGS=$LDFLAGS
1494 if test "$LIBEVENT_DIR" = yes; then
1495 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
1496 MOZ_SYSTEM_LIBEVENT=1,
1499 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
1500 MOZ_SYSTEM_LIBEVENT=
1501 elif test -z "$MOZ_SYSTEM_LIBEVENT"; then
1502 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
1503 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
1504 MOZ_CHECK_HEADER(event.h,
1505 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
1506 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
1508 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
1509 AC_CHECK_LIB(event, event_init,
1510 [MOZ_SYSTEM_LIBEVENT=1
1511 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
1512 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
1513 [MOZ_SYSTEM_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
1515 CFLAGS=$_SAVE_CFLAGS
1516 LDFLAGS=$_SAVE_LDFLAGS
1519 AC_SUBST(MOZ_SYSTEM_LIBEVENT)
1521 dnl ========================================================
1522 dnl = If NSS was not detected in the system,
1523 dnl = use the one in the source tree (mozilla/security/nss)
1524 dnl ========================================================
1526 MOZ_ARG_WITH_BOOL(system-nss,
1527 [ --with-system-nss Use system installed NSS],
1530 if test -n "$_USE_SYSTEM_NSS"; then
1531 AM_PATH_NSS(3.46, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
1534 NSS_CFLAGS="$NSS_CFLAGS -I${DIST}/include/nss"
1535 if test -z "$MOZ_SYSTEM_NSS"; then
1536 case "${OS_ARCH}" in
1537 # Only few platforms have been tested with GYP
1538 WINNT|Darwin|Linux|DragonFly|FreeBSD|NetBSD|OpenBSD|SunOS)
1541 AC_MSG_ERROR([building in-tree NSS is not supported on this platform. Use --with-system-nss])
1546 dnl system ZLIB support
1547 dnl ========================================================
1548 MOZ_ZLIB_CHECK([1.2.3])
1550 if test -z "$SKIP_LIBRARY_CHECKS"; then
1552 dnl ========================================================
1553 dnl system PNG Support
1554 dnl ========================================================
1555 MOZ_ARG_WITH_STRING(system-png,
1556 [ --with-system-png[=PFX]
1557 Use system libpng [installed at prefix PFX]],
1560 _SAVE_CFLAGS=$CFLAGS
1561 _SAVE_LDFLAGS=$LDFLAGS
1563 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
1564 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
1565 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
1567 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
1570 AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"],
1571 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1572 AC_CHECK_LIB(png, png_get_acTL, ,
1573 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
1575 if test "$MOZ_SYSTEM_PNG" = 1; then
1576 AC_TRY_COMPILE([ #include <stdio.h>
1577 #include <sys/types.h>
1579 [ #if PNG_LIBPNG_VER < $MOZPNG
1580 #error "Insufficient libpng version ($MOZPNG required)."
1582 #ifndef PNG_UINT_31_MAX
1583 #error "Insufficient libpng version."
1586 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1588 CFLAGS=$_SAVE_CFLAGS
1589 LDFLAGS=$_SAVE_LDFLAGS
1592 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then
1593 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
1594 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
1597 fi # SKIP_LIBRARY_CHECKS
1599 dnl ========================================================
1603 dnl ========================================================
1605 MOZ_ARG_HEADER(Application)
1607 ENABLE_SYSTEM_EXTENSION_DIRS=1
1608 MOZ_BRANDING_DIRECTORY=
1609 MOZ_OFFICIAL_BRANDING=
1610 MOZ_AUTH_EXTENSION=1
1611 if test "$MOZ_IOS"; then
1614 MOZ_PREF_EXTENSIONS=1
1616 MOZ_UNIVERSALCHARDET=1
1621 MOZ_USE_NATIVE_POPUP_WINDOWS=
1622 MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
1624 MOZ_BINARY_EXTENSIONS=
1627 case "$target_os" in
1630 AC_DEFINE(NS_ENABLE_TSF)
1634 # Optional Firefox for Android partner distribution directory.
1635 MOZ_ARG_WITH_STRING(android-distribution-directory,
1636 [ --with-android-distribution-directory=dir
1637 Optional Firefox for Android partner distribution directory.],
1638 MOZ_ANDROID_DISTRIBUTION_DIRECTORY=$withval)
1640 if test -n "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY"; then
1641 # A distribution directory must have an assets/distribution directory.
1642 # See https://wiki.mozilla.org/Mobile/Distribution_Files.
1643 if test ! -d "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY/assets/distribution" ; then
1644 AC_MSG_ERROR([--with-android-distribution-directory does not contain assets/distribution;
1645 (looked for ${MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets/distribution).])
1648 AC_SUBST(MOZ_ANDROID_DISTRIBUTION_DIRECTORY)
1650 dnl ========================================================
1651 dnl = Trademarked Branding
1652 dnl ========================================================
1653 MOZ_ARG_ENABLE_BOOL(official-branding,
1654 [ --enable-official-branding
1655 Enable Official mozilla.org Branding
1656 Do not distribute builds with
1657 --enable-official-branding unless you have
1658 permission to use trademarks per
1659 http://www.mozilla.org/foundation/trademarks/ .],
1660 MOZ_OFFICIAL_BRANDING=1,
1661 MOZ_OFFICIAL_BRANDING=)
1663 # Allow the application to influence configure with a confvars.sh script.
1664 AC_MSG_CHECKING([if app-specific confvars.sh exists])
1665 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
1666 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
1667 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
1672 # Allow influencing configure with a defines.sh script.
1673 . "${srcdir}/build/defines.sh"
1675 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
1677 if test "$BUILDING_RELEASE"; then
1678 # Override value in defines.sh, if any
1679 EARLY_BETA_OR_EARLIER=
1680 elif test "$EARLY_BETA_OR_EARLIER"; then
1681 AC_DEFINE(EARLY_BETA_OR_EARLIER)
1683 AC_SUBST(EARLY_BETA_OR_EARLIER)
1685 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
1686 MOZ_ARG_WITH_STRING(app-name,
1687 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
1688 WITH_APP_NAME=$withval,
1691 if test -n "$WITH_APP_NAME" ; then
1692 MOZ_APP_NAME="$WITH_APP_NAME"
1695 MOZ_ARG_WITH_STRING(app-basename,
1696 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
1697 WITH_APP_BASENAME=$withval,
1700 if test -n "$WITH_APP_BASENAME" ; then
1701 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
1704 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
1705 # that haven't made a confvars.sh yet. Don't add new stuff here, use
1707 case "$MOZ_BUILD_APP" in
1709 AC_DEFINE(MOZ_PHOENIX)
1713 # Graphene is a desktop runtime for running applications with a HTML UI.
1714 if test -n "$MOZ_GRAPHENE"; then
1715 AC_DEFINE(MOZ_GRAPHENE)
1718 AC_SUBST(MOZ_PHOENIX)
1720 dnl ========================================================
1721 dnl Ensure Android SDK and build-tools versions depending on
1723 dnl ========================================================
1725 case "$MOZ_BUILD_APP" in
1731 dnl ========================================================
1733 dnl = Toolkit Options
1735 dnl ========================================================
1736 MOZ_ARG_HEADER(Toolkit Options)
1738 dnl ========================================================
1739 dnl = Enable the toolkit as needed =
1740 dnl ========================================================
1742 case "$MOZ_WIDGET_TOOLKIT" in
1745 LDFLAGS="$LDFLAGS -framework Cocoa"
1746 # Use -Wl as a trick to avoid -framework and framework names from
1747 # being separated by AC_SUBST_LIST.
1748 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'
1750 CFLAGS="$CFLAGS $TK_CFLAGS"
1751 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1752 MOZ_USER_DIR="Mozilla"
1753 MOZ_FS_LAYOUT=bundle
1757 LDFLAGS="$LDFLAGS -framework UIKit"
1759 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'
1760 CFLAGS="$CFLAGS $TK_CFLAGS"
1761 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1762 MOZ_USER_DIR="Mozilla"
1763 MOZ_FS_LAYOUT=bundle
1768 if test "$OS_TARGET" = Darwin; then
1769 LDFLAGS="$LDFLAGS -lobjc"
1772 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
1773 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
1774 case "$MOZ_WIDGET_TOOLKIT" in
1780 if test "$COMPILE_ENVIRONMENT"; then
1781 if test "$MOZ_WIDGET_TOOLKIT" = gtk; then
1782 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)
1783 MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
1784 TK_CFLAGS=$MOZ_GTK3_CFLAGS
1785 TK_LIBS=$MOZ_GTK3_LIBS
1786 dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
1787 dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
1788 AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
1789 GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32
1791 if test "$MOZ_ENABLE_GTK"; then
1792 if test "$MOZ_X11"; then
1793 GDK_PACKAGES=gdk-x11-2.0
1795 AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
1796 AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
1798 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)
1799 MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
1801 fi # COMPILE_ENVIRONMENT
1803 AC_SUBST(MOZ_FS_LAYOUT)
1805 dnl ========================================================
1806 dnl = startup-notification support module
1807 dnl ========================================================
1809 if test "$MOZ_ENABLE_GTK"
1811 MOZ_ENABLE_STARTUP_NOTIFICATION=
1813 MOZ_ARG_ENABLE_BOOL(startup-notification,
1814 [ --enable-startup-notification
1815 Enable startup-notification support (default: disabled) ],
1816 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
1817 MOZ_ENABLE_STARTUP_NOTIFICATION=)
1818 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
1820 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
1821 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
1822 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
1823 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
1825 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
1827 MOZ_ENABLE_STARTUP_NOTIFICATION=
1831 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
1832 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
1835 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
1837 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
1839 AC_SUBST_LIST(TK_CFLAGS)
1840 AC_SUBST_LIST(TK_LIBS)
1842 dnl ========================================================
1844 dnl = Components & Features
1846 dnl ========================================================
1847 MOZ_ARG_HEADER(Components and Features)
1849 AC_SUBST(MOZ_OFFICIAL_BRANDING)
1850 if test -n "$MOZ_OFFICIAL_BRANDING"; then
1851 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
1852 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
1854 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
1855 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
1859 MOZ_ARG_WITH_STRING(branding,
1860 [ --with-branding=dir Use branding from the specified directory.],
1861 MOZ_BRANDING_DIRECTORY=$withval)
1863 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
1864 if test -z "$REAL_BRANDING_DIRECTORY"; then
1865 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
1868 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1869 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
1870 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1871 . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
1874 AC_SUBST(MOZ_BRANDING_DIRECTORY)
1876 dnl ========================================================
1877 dnl = Distribution ID
1878 dnl ========================================================
1879 MOZ_ARG_WITH_STRING(distribution-id,
1880 [ --with-distribution-id=ID
1881 Set distribution-specific id (default=org.mozilla)],
1882 [ val=`echo $withval`
1883 MOZ_DISTRIBUTION_ID="$val"])
1885 if test -z "$MOZ_DISTRIBUTION_ID"; then
1886 MOZ_DISTRIBUTION_ID="org.mozilla"
1889 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
1890 AC_SUBST(MOZ_DISTRIBUTION_ID)
1892 dnl ========================================================
1893 dnl = libproxy support
1894 dnl ========================================================
1896 if test "$MOZ_ENABLE_GTK"
1898 MOZ_ENABLE_LIBPROXY=
1900 MOZ_ARG_ENABLE_BOOL(libproxy,
1901 [ --enable-libproxy Enable libproxy support ],
1902 MOZ_ENABLE_LIBPROXY=1,
1903 MOZ_ENABLE_LIBPROXY=)
1905 if test "$MOZ_ENABLE_LIBPROXY"
1907 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
1908 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
1911 AC_SUBST(MOZ_ENABLE_LIBPROXY)
1913 dnl ========================================================
1915 dnl ========================================================
1917 if test "$MOZ_ENABLE_GTK"
1921 MOZ_ARG_DISABLE_BOOL(dbus,
1922 [ --disable-dbus Disable dbus support ],
1926 if test "$MOZ_ENABLE_DBUS"
1928 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
1929 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
1930 AC_DEFINE(MOZ_ENABLE_DBUS)
1933 AC_SUBST(MOZ_ENABLE_DBUS)
1935 dnl =========================================================
1936 dnl = Whether to exclude hyphenations files in the build
1937 dnl =========================================================
1938 if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
1939 AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
1942 AC_TRY_COMPILE([#include <linux/ethtool.h>],
1943 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
1944 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
1946 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
1948 if test -n "$MOZ_WEBRTC"; then
1949 if test -n "$MOZ_X11"; then
1950 MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
1954 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
1956 dnl ========================================================
1957 dnl = Apple platform decoder support
1958 dnl ========================================================
1959 if test "$COMPILE_ENVIRONMENT"; then
1960 if test -n "$MOZ_APPLEMEDIA"; then
1961 # hack in frameworks for fmp4 - see bug 1029974
1962 # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
1963 LDFLAGS="$LDFLAGS -framework AudioToolbox"
1964 dnl Verify CoreMedia is available.
1965 AC_CHECK_HEADERS([CoreMedia/CoreMedia.h VideoToolbox/VideoToolbox.h], [],
1966 [AC_MSG_ERROR([MacOS X 10.9 SDK or later is required])])
1968 fi # COMPILE_ENVIRONMENT
1970 dnl ========================================================
1971 dnl = Handle dependent MEDIA defines
1972 dnl ========================================================
1975 AC_DEFINE(MOZ_WEBM_ENCODER)
1976 AC_SUBST(MOZ_WEBM_ENCODER)
1978 dnl ========================================================
1980 dnl ========================================================
1982 MOZ_ARG_DISABLE_BOOL(negotiateauth,
1983 [ --disable-negotiateauth Disable GSS-API negotiation ],
1984 MOZ_AUTH_EXTENSION=,
1985 MOZ_AUTH_EXTENSION=1 )
1987 if test -n "$MOZ_IOS" -a -n "$MOZ_AUTH_EXTENSION"; then
1988 AC_MSG_ERROR([negotiateauth is not supported on iOS.])
1991 dnl ========================================================
1992 dnl Pref extensions (autoconfig)
1993 dnl ========================================================
1994 MOZ_ARG_DISABLE_BOOL(pref-extensions,
1995 [ --disable-pref-extensions
1996 Disable pref extensions such as autoconfig],
1997 MOZ_PREF_EXTENSIONS=,
1998 MOZ_PREF_EXTENSIONS=1 )
2000 dnl ========================================================
2001 dnl Searching of system directories for extensions.
2002 dnl Note: this switch is meant to be used for test builds
2003 dnl whose behavior should not depend on what happens to be
2004 dnl installed on the local machine.
2005 dnl ========================================================
2006 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
2007 [ --disable-system-extension-dirs
2008 Disable searching system- and account-global
2009 directories for extensions of any kind; use
2010 only profile-specific extension directories],
2011 ENABLE_SYSTEM_EXTENSION_DIRS=,
2012 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
2013 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
2014 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
2017 dnl ========================================================
2018 dnl = Universalchardet
2019 dnl ========================================================
2020 MOZ_ARG_DISABLE_BOOL(universalchardet,
2021 [ --disable-universalchardet
2022 Disable universal encoding detection],
2023 MOZ_UNIVERSALCHARDET=,
2024 MOZ_UNIVERSALCHARDET=1 )
2026 dnl ========================================================
2028 dnl ========================================================
2030 if test "$COMPILE_ENVIRONMENT" ; then
2032 dnl Moved gamepad platform check to moz.build, linux header check still needed here.
2033 if test "$OS_TARGET" = "Linux"; then
2034 MOZ_CHECK_HEADER([linux/joystick.h])
2035 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
2036 AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
2040 fi # COMPILE_ENVIRONMENT
2043 dnl ========================================================
2044 dnl = Breakpad crash reporting (on by default on supported platforms)
2045 dnl ========================================================
2048 i?86-*-mingw*|x86_64-*-mingw*|aarch64-*-mingw*)
2051 i?86-apple-darwin*|x86_64-apple-darwin*)
2052 if test -z "$MOZ_IOS"; then
2056 *-android*|*-linuxandroid*)
2057 dnl Android/arm is arm-unknown-linux-androideabi, so android condition should
2058 dnl be before Linux condition
2061 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
2062 if test "$MOZ_ENABLE_GTK"; then
2068 MOZ_ARG_DISABLE_BOOL(crashreporter,
2069 [ --disable-crashreporter Disable breakpad crash reporting],
2070 [MOZ_CRASHREPORTER=],
2071 [MOZ_CRASHREPORTER=F # Force enable breakpad])
2073 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin" -a "$MOZ_WIDGET_TOOLKIT" != "android"; then
2074 if test "$MOZ_CRASHREPORTER" = F; then
2075 AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
2080 if test -n "$MOZ_CRASHREPORTER"; then
2081 AC_DEFINE(MOZ_CRASHREPORTER)
2083 if test "$OS_TARGET" = "Linux" && \
2084 test -z "$SKIP_LIBRARY_CHECKS"; then
2085 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
2088 if test "$OS_ARCH" = "WINNT"; then
2089 if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
2090 MOZ_CRASHREPORTER_INJECTOR=1
2091 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
2096 dnl ========================================================
2097 dnl = Enable compilation of specific extension modules
2098 dnl ========================================================
2100 MOZ_ARG_ENABLE_STRING(extensions,
2101 [ --enable-extensions Enable extensions],
2102 [ for option in `echo $enableval | sed 's/,/ /g'`; do
2103 if test "$option" = "yes" -o "$option" = "all"; then
2104 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
2105 elif test "$option" = "no" -o "$option" = "none"; then
2107 elif test "$option" = "default"; then
2108 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
2109 elif test `echo "$option" | grep -c \^-` != 0; then
2110 option=`echo $option | sed 's/^-//'`
2111 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
2113 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
2116 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
2118 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
2119 dnl when trying to build a nonexistent extension.
2120 for extension in $MOZ_EXTENSIONS; do
2121 if test ! -d "${srcdir}/extensions/${extension}"; then
2122 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
2126 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
2127 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
2130 # Avoid defining MOZ_ENABLE_CAIRO_FT on Windows platforms because
2131 # "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
2132 if test -n "$MOZ_TREE_FREETYPE" -a "$OS_TARGET" != WINNT; then
2133 MOZ_ENABLE_CAIRO_FT=1
2134 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2135 CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
2136 AC_SUBST_LIST(CAIRO_FT_CFLAGS)
2139 AC_CHECK_PROGS(WGET, wget, "")
2142 dnl ========================================================
2144 dnl ========================================================
2146 if test "$MOZ_IOS"; then
2150 MOZ_ARG_DISABLE_BOOL(updater,
2151 [ --disable-updater Disable building of updater],
2155 if test -n "$MOZ_UPDATER"; then
2156 AC_DEFINE(MOZ_UPDATER)
2159 dnl ========================================================
2160 dnl parental controls (for Windows Vista)
2161 dnl ========================================================
2162 MOZ_ARG_DISABLE_BOOL(parental-controls,
2163 [ --disable-parental-controls
2164 Do not build parental controls],
2165 MOZ_DISABLE_PARENTAL_CONTROLS=1,
2166 MOZ_DISABLE_PARENTAL_CONTROLS=)
2167 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
2168 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
2171 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
2173 dnl ========================================================
2174 dnl = Disable smartcard support
2175 dnl ========================================================
2176 if test -n "$MOZ_NO_SMART_CARDS"; then
2177 AC_DEFINE(MOZ_NO_SMART_CARDS)
2179 AC_SUBST(MOZ_NO_SMART_CARDS)
2181 dnl ========================================================
2182 dnl = Sandboxing support
2183 dnl ========================================================
2184 if test -n "$MOZ_TSAN" -o -n "$MOZ_ASAN"; then
2185 # Bug 1182565: TSan conflicts with sandboxing on Linux.
2186 # Bug 1287971: LSan also conflicts with sandboxing on Linux.
2194 MOZ_ARG_DISABLE_BOOL(sandbox,
2195 [ --disable-sandbox Disable sandboxing support],
2199 case "$OS_TARGET" in
2206 # Linux sandbox is only available on x86 and x86_64.
2213 # Only enable the sandbox by default on Linux, macOS, and Windows
2218 if test -n "$MOZ_SANDBOX"; then
2219 AC_DEFINE(MOZ_SANDBOX)
2222 AC_SUBST(MOZ_SANDBOX)
2225 dnl ========================================================
2227 dnl = Module specific options
2229 dnl ========================================================
2230 MOZ_ARG_HEADER(Individual module options)
2232 dnl ========================================================
2233 dnl Check for sqlite
2234 dnl ========================================================
2237 MOZ_ARG_ENABLE_BOOL(system-sqlite,
2238 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
2239 MOZ_SYSTEM_SQLITE=1,
2240 MOZ_SYSTEM_SQLITE= )
2242 if test -n "$MOZ_SYSTEM_SQLITE"
2244 dnl ============================
2245 dnl === SQLite Version check ===
2246 dnl ============================
2247 dnl Check to see if the system SQLite package is new enough.
2248 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
2250 dnl ==============================
2251 dnl === SQLite fdatasync check ===
2252 dnl ==============================
2253 dnl Check to see if fdatasync is available
2254 AC_CHECK_FUNC(fdatasync)
2257 if test -n "$MOZ_SYSTEM_SQLITE"; then
2258 AC_DEFINE(MOZ_SYSTEM_SQLITE)
2260 AC_SUBST(MOZ_SYSTEM_SQLITE)
2262 dnl ========================================================
2263 dnl = Disable zipwriter
2264 dnl ========================================================
2265 MOZ_ARG_DISABLE_BOOL(zipwriter,
2266 [ --disable-zipwriter Disable zipwriter component],
2269 AC_SUBST(MOZ_ZIPWRITER)
2271 dnl ========================================================
2273 dnl = Feature options that require extra sources to be pulled
2275 dnl ========================================================
2276 dnl MOZ_ARG_HEADER(Features that require extra sources)
2278 dnl ========================================================
2280 dnl = Runtime debugging and Optimization Options
2282 dnl ========================================================
2283 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
2285 dnl ========================================================
2286 dnl enable mobile optimizations
2287 dnl ========================================================
2288 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
2289 [ --enable-mobile-optimize
2290 Enable mobile optimizations],
2291 MOZ_GFX_OPTIMIZE_MOBILE=1)
2293 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
2295 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
2296 # We ignore paint will resample on mobile for performance.
2297 # We may want to revisit this later.
2298 MOZ_IGNORE_PAINT_WILL_RESAMPLE=1
2300 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
2301 AC_DEFINE(MOZ_IGNORE_PAINT_WILL_RESAMPLE)
2304 dnl ========================================================
2305 dnl = Enable code optimization. ON by default.
2306 dnl ========================================================
2308 # Use value from moz.configure if one is defined. Else use our computed
2310 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
2311 MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
2314 if test "$COMPILE_ENVIRONMENT"; then
2315 if test -n "$MOZ_OPTIMIZE"; then
2316 AC_MSG_CHECKING([for valid C compiler optimization flags])
2317 _SAVE_CFLAGS=$CFLAGS
2318 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
2319 AC_TRY_COMPILE([#include <stdio.h>],
2320 [printf("Hello World\n");],
2323 AC_MSG_RESULT([$_results])
2324 if test "$_results" = "no"; then
2325 AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
2327 CFLAGS=$_SAVE_CFLAGS
2328 if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
2329 # When using llvm-based LTO, non numeric optimization levels are
2330 # not supported by the linker, so force the linker to use -O2 (
2331 # which doesn't influence the level compilation units are actually
2333 case " $MOZ_OPTIMIZE_FLAGS " in
2334 *\ -Os\ *|*\ -Oz\ *)
2335 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
2340 fi # COMPILE_ENVIRONMENT
2342 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
2343 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
2344 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
2346 dnl ========================================================
2347 dnl = Disable treating compiler warnings as errors
2348 dnl ========================================================
2349 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
2350 WARNINGS_AS_ERRORS=''
2353 dnl ========================================================
2354 dnl = Enable runtime logging
2355 dnl ========================================================
2356 AC_DEFINE(MOZ_LOGGING)
2357 AC_DEFINE(FORCE_PR_LOG)
2359 dnl ========================================================
2360 dnl = This will enable logging of addref, release, ctor, dtor.
2361 dnl ========================================================
2362 _ENABLE_LOGREFCNT=42
2363 MOZ_ARG_ENABLE_BOOL(logrefcnt,
2364 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
2365 _ENABLE_LOGREFCNT=1,
2366 _ENABLE_LOGREFCNT= )
2367 if test "$_ENABLE_LOGREFCNT" = "1"; then
2368 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
2369 elif test -z "$_ENABLE_LOGREFCNT"; then
2370 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
2373 dnl ========================================================
2374 dnl moz_dump_painting
2375 dnl ========================================================
2376 MOZ_ARG_ENABLE_BOOL(dump-painting,
2377 [ --enable-dump-painting Enable paint debugging.],
2378 MOZ_DUMP_PAINTING=1,
2379 MOZ_DUMP_PAINTING= )
2380 if test -n "$MOZ_DUMP_PAINTING"; then
2381 AC_DEFINE(MOZ_DUMP_PAINTING)
2382 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
2384 if test -n "$MOZ_DEBUG"; then
2385 AC_DEFINE(MOZ_DUMP_PAINTING)
2388 case "${OS_TARGET}" in
2389 Android|WINNT|Darwin)
2390 MOZ_GLUE_IN_PROGRAM=
2393 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
2394 MOZ_GLUE_IN_PROGRAM=1
2395 AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
2399 dnl ========================================================
2400 dnl = Jemalloc build setup
2401 dnl ========================================================
2402 if test -z "$MOZ_MEMORY"; then
2405 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
2406 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.])
2411 dnl The generic feature tests that determine how to compute ncpus are long and
2412 dnl complicated. Therefore, simply define special cpp variables for the
2413 dnl platforms we have special knowledge of.
2416 export MOZ_NO_DEBUG_RTL=1
2420 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
2422 dnl ========================================================
2423 dnl = Enable using the clang plugin to build
2424 dnl ========================================================
2426 if test -n "$COMPILE_ENVIRONMENT"; then
2427 MOZ_CONFIG_CLANG_PLUGIN
2428 fi # COMPILE_ENVIRONMENT
2430 dnl ========================================================
2431 dnl = Enable stripping of libs & executables
2432 dnl ========================================================
2433 MOZ_ARG_ENABLE_BOOL(strip,
2434 [ --enable-strip Enable stripping of libs & executables ],
2438 dnl ========================================================
2439 dnl = Enable stripping of libs & executables when packaging
2440 dnl ========================================================
2441 MOZ_ARG_ENABLE_BOOL(install-strip,
2442 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
2446 dnl ========================================================
2447 dnl = frontend JS debug mode
2448 dnl ========================================================
2450 MOZ_ARG_ENABLE_BOOL(debug-js-modules,
2451 [ --enable-debug-js-modules Enable debug mode for frontend JS libraries],
2455 AC_SUBST(DEBUG_JS_MODULES)
2457 dnl ========================================================
2459 dnl = Profiling and Instrumenting
2461 dnl ========================================================
2462 MOZ_ARG_HEADER(Profiling and Instrumenting)
2464 dnl ========================================================
2465 dnl = Offer a way to disable the startup cache
2466 dnl ========================================================
2468 MOZ_ARG_DISABLE_BOOL(startupcache,
2469 [ --disable-startupcache Disable startup cache ],
2470 MOZ_DISABLE_STARTUPCACHE=1,
2471 MOZ_DISABLE_STARTUPCACHE=)
2473 if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
2474 AC_DEFINE(MOZ_DISABLE_STARTUPCACHE)
2476 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
2478 dnl ========================================================
2479 dnl = Support for demangling undefined symbols
2480 dnl ========================================================
2481 if test -z "$SKIP_LIBRARY_CHECKS"; then
2484 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
2488 # Demangle only for debug or DMD builds
2489 MOZ_DEMANGLE_SYMBOLS=
2490 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
2491 MOZ_DEMANGLE_SYMBOLS=1
2492 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
2494 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
2496 dnl ========================================================
2497 dnl = Support for gcc stack unwinding (from gcc 3.3)
2498 dnl ========================================================
2499 if test -z "$SKIP_LIBRARY_CHECKS"; then
2502 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
2506 dnl ========================================================
2508 dnl ========================================================
2510 MOZ_ARG_WITH_STRING(jitreport-granularity,
2511 [ --jitreport-granularity=N
2512 Default granularity at which to report JIT code
2515 1 - code ranges for whole functions only
2516 2 - per-line information
2517 3 - per-op information],
2518 JITREPORT_GRANULARITY=$withval,
2519 JITREPORT_GRANULARITY=3)
2521 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
2523 dnl ========================================================
2527 dnl ========================================================
2528 MOZ_ARG_HEADER(Misc. Options)
2530 dnl ========================================================
2531 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
2532 dnl ========================================================
2533 MOZ_ARG_WITH_STRING(user-appdir,
2534 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
2535 [ val=`echo $withval`
2536 if echo "$val" | grep "\/" >/dev/null; then
2537 AC_MSG_ERROR("Homedir must be single relative path.")
2542 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
2544 if test -z "$SKIP_COMPILER_CHECKS"; then
2545 dnl ========================================================
2547 dnl = Compiler Options
2549 dnl ========================================================
2550 MOZ_ARG_HEADER(Compiler Options)
2552 dnl ========================================================
2553 dnl Check for gcc -pipe support
2554 dnl ========================================================
2555 AC_MSG_CHECKING([for -pipe support])
2556 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
2557 dnl Any gcc that supports firefox supports -pipe.
2558 CFLAGS="$CFLAGS -pipe"
2559 CXXFLAGS="$CXXFLAGS -pipe"
2560 AC_MSG_RESULT([yes])
2565 fi # ! SKIP_COMPILER_CHECKS
2569 if test "$COMPILE_ENVIRONMENT"; then
2571 fi # COMPILE_ENVIRONMENT
2573 dnl ========================================================
2575 dnl = Static Build Options
2577 dnl ========================================================
2578 MOZ_ARG_HEADER(Static build options)
2580 if test -z "$MOZ_SYSTEM_ZLIB"; then
2581 if test -n "$JS_SHARED_LIBRARY" -o -n "$MOZ_LINKER"; then
2583 AC_DEFINE(ZLIB_IN_MOZGLUE)
2587 AC_SUBST(ZLIB_IN_MOZGLUE)
2589 dnl ========================================================
2591 dnl = Standalone module options
2593 dnl ========================================================
2594 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
2597 dnl ========================================================
2599 if test -z "$SKIP_PATH_CHECKS"; then
2600 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
2601 if test "$MOZ_ENABLE_GTK" ; then
2602 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
2607 if test -z "${GLIB_GMODULE_LIBS}" \
2608 -a -n "${GLIB_CONFIG}"\
2609 -a "${GLIB_CONFIG}" != no\
2611 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
2614 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
2616 if test "$USE_FC_FREETYPE"; then
2617 if test "$COMPILE_ENVIRONMENT"; then
2618 dnl ========================================================
2619 dnl = Check for freetype2 functionality
2620 dnl ========================================================
2621 if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
2623 _SAVE_CFLAGS="$CFLAGS"
2624 LIBS="$LIBS $FT2_LIBS"
2625 CFLAGS="$CFLAGS $FT2_CFLAGS"
2627 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
2628 ac_cv_member_FT_Bitmap_Size_y_ppem,
2629 [AC_TRY_COMPILE([#include <ft2build.h>
2630 #include FT_FREETYPE_H],
2632 if (sizeof s.y_ppem) return 0;
2634 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
2635 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
2636 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
2637 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
2639 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
2641 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
2642 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
2643 [FT_Bitmap_Size structure includes y_ppem field])
2645 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
2648 CFLAGS="$_SAVE_CFLAGS"
2651 _SAVE_CPPFLAGS="$CPPFLAGS"
2652 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
2653 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
2654 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
2655 CPPFLAGS="$_SAVE_CPPFLAGS"
2659 dnl ========================================================
2660 dnl Check if we need the 32-bit Linux SSE2 error dialog
2661 dnl ========================================================
2663 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
2665 dnl ========================================================
2666 dnl Check for pixman and cairo
2667 dnl ========================================================
2670 MOZ_ARG_ENABLE_BOOL(system-cairo,
2671 [ --enable-system-cairo Obsolete: do not use this option],
2672 AC_MSG_ERROR(--enable-system-cairo is not supported),
2676 MOZ_ARG_ENABLE_BOOL(system-pixman,
2677 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
2679 MOZ_TREE_PIXMAN=force,
2682 if test "$MOZ_TREE_PIXMAN"; then
2683 AC_DEFINE(MOZ_TREE_PIXMAN)
2685 PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.19.2)
2688 MOZ_CAIRO_CFLAGS="-I${DIST}/include/cairo"
2689 AC_DEFINE(MOZ_TREE_CAIRO)
2691 if test "$OS_ARCH" = "WINNT"; then
2692 # For now we assume that we will have a uint64_t available through
2693 # one of the above headers or mozstdint.h.
2694 AC_DEFINE(HAVE_UINT64_T)
2697 # Define macros for cairo-features.h
2698 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
2699 if test "$MOZ_X11"; then
2700 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
2701 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
2702 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
2704 if test "$_HAVE_FREETYPE2"; then
2705 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2706 MOZ_ENABLE_CAIRO_FT=1
2707 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
2710 case "$MOZ_WIDGET_TOOLKIT" in
2712 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
2713 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
2714 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
2717 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
2718 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
2719 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
2721 if test "$COMPILE_ENVIRONMENT"; then
2722 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
2726 if test "$USE_FC_FREETYPE"; then
2727 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
2729 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
2730 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
2732 AC_SUBST(PS_SURFACE_FEATURE)
2733 AC_SUBST(SVG_SURFACE_FEATURE)
2734 AC_SUBST(XLIB_SURFACE_FEATURE)
2735 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
2736 AC_SUBST(QUARTZ_SURFACE_FEATURE)
2737 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
2738 AC_SUBST(WIN32_SURFACE_FEATURE)
2739 AC_SUBST(OS2_SURFACE_FEATURE)
2740 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
2741 AC_SUBST(FT_FONT_FEATURE)
2742 AC_SUBST(FC_FONT_FEATURE)
2743 AC_SUBST(WIN32_FONT_FEATURE)
2744 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
2745 AC_SUBST(QUARTZ_FONT_FEATURE)
2746 AC_SUBST(PNG_FUNCTIONS_FEATURE)
2747 AC_SUBST(QT_SURFACE_FEATURE)
2748 AC_SUBST(TEE_SURFACE_FEATURE)
2750 if test "$MOZ_X11"; then
2751 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
2754 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
2756 case "$MOZ_WIDGET_TOOLKIT" in
2758 TK_CFLAGS="$MOZ_CAIRO_CFLAGS $MOZ_PIXMAN_CFLAGS"
2759 TK_LIBS="$MOZ_CAIRO_LIBS $MOZ_PIXMAN_LIBS"
2763 AC_SUBST(MOZ_TREE_CAIRO)
2764 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
2765 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
2766 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
2767 AC_SUBST(MOZ_TREE_PIXMAN)
2769 BINDGEN_SYSTEM_FLAGS="$_BINDGEN_CFLAGS $NSPR_CFLAGS $NSS_CFLAGS $MOZ_PIXMAN_CFLAGS $MOZ_CAIRO_CFLAGS"
2770 AC_SUBST(BINDGEN_SYSTEM_FLAGS)
2771 BINDGEN_SYSTEM_TOML_FLAGS="$BINDGEN_SYSTEM_FLAGS"
2772 AC_SUBST_TOML_LIST(BINDGEN_SYSTEM_TOML_FLAGS)
2774 dnl ========================================================
2776 dnl ========================================================
2777 MOZ_ARG_DISABLE_BOOL(xul,
2778 [ --disable-xul Disable XUL],
2780 if test "$MOZ_XUL"; then
2783 dnl remove extensions that require XUL
2784 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
2789 dnl ========================================================
2790 dnl necko configuration options
2791 dnl ========================================================
2794 dnl option to disable necko's wifi scanner
2797 if test "$MOZ_WIDGET_TOOLKIT"; then
2799 case "$OS_TARGET" in
2801 if test -z "$MOZ_IOS"; then
2805 DragonFly|FreeBSD|WINNT)
2816 MOZ_ARG_DISABLE_BOOL(necko-wifi,
2817 [ --disable-necko-wifi Disable necko wifi scanner],
2821 if test "$NECKO_WIFI"; then
2822 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
2823 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
2825 AC_DEFINE(NECKO_WIFI)
2826 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
2828 AC_SUBST(NECKO_WIFI)
2829 AC_SUBST(NECKO_WIFI_DBUS)
2832 dnl option to disable cookies
2834 MOZ_ARG_DISABLE_BOOL(cookies,
2835 [ --disable-cookies Disable cookie support],
2838 AC_SUBST(NECKO_COOKIES)
2839 if test "$NECKO_COOKIES"; then
2840 AC_DEFINE(NECKO_COOKIES)
2841 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
2844 dnl ========================================================
2846 dnl = Maintainer debug option (no --enable equivalent)
2848 dnl ========================================================
2851 AC_SUBST_LIST(ASFLAGS)
2855 AC_SUBST(MOZ_AUTH_EXTENSION)
2856 AC_SUBST(MOZ_PREF_EXTENSIONS)
2857 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
2858 AC_SUBST(WARNINGS_AS_ERRORS)
2859 AC_SUBST_LIST(WARNINGS_CFLAGS)
2860 AC_SUBST_SET(MOZ_EXTENSIONS)
2862 AC_SUBST(MOZ_UNIVERSALCHARDET)
2863 AC_SUBST(MOZ_SPELLCHECK)
2864 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
2865 AC_SUBST(MOZ_CRASHREPORTER)
2866 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
2867 AC_SUBST(MOZ_STUB_INSTALLER)
2868 AC_SUBST(MOZ_UPDATER)
2870 AC_SUBST(MOZ_ANDROID_APPLICATION_CLASS)
2871 AC_SUBST(MOZ_ANDROID_BROWSER_INTENT_CLASS)
2872 AC_SUBST(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
2873 AC_SUBST(ENABLE_STRIP)
2874 AC_SUBST(PKG_SKIP_STRIP)
2875 AC_SUBST(STRIP_FLAGS)
2876 AC_SUBST(INCREMENTAL_LINKER)
2878 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
2880 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
2881 AC_SUBST(MOZ_LINKER_EXTRACT)
2883 if test -n "$MOZ_BINARY_EXTENSIONS"; then
2884 AC_DEFINE(MOZ_BINARY_EXTENSIONS)
2887 AC_SUBST(MOZ_REQUIRE_SIGNING)
2888 if test "$MOZ_REQUIRE_SIGNING" = 1; then
2889 AC_DEFINE(MOZ_REQUIRE_SIGNING)
2892 dnl ========================================================
2893 dnl = Mac bundle name prefix
2894 dnl ========================================================
2895 MOZ_ARG_WITH_STRING(macbundlename-prefix,
2896 [ --with-macbundlename-prefix=prefix
2897 Prefix for MOZ_MACBUNDLE_NAME],
2898 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
2900 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
2901 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
2902 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
2905 if test "$MOZ_DEBUG"; then
2906 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
2908 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
2910 AC_SUBST(MOZ_MACBUNDLE_NAME)
2912 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
2913 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
2914 # Otherwise, use MOZ_APP_DISPLAYNAME
2915 if test -z "$MOZ_MACBUNDLE_ID"; then
2916 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
2918 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
2919 if test "$MOZ_DEBUG"; then
2920 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
2923 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
2924 AC_SUBST(MOZ_MACBUNDLE_ID)
2926 dnl ========================================================
2927 dnl = Child Process Name for IPC
2928 dnl ========================================================
2929 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
2930 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
2932 # We want to let Android unpack the file at install time, but it only does
2933 # so if the file is named libsomething.so. The lib/ path is also required
2934 # because the unpacked file will be under the lib/ subdirectory and will
2935 # need to be executed from that path.
2936 MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
2938 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
2939 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
2941 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
2942 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
2943 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
2945 # The following variables are available to branding and application
2946 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
2947 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
2948 # impacts profile location and user-visible fields.
2949 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
2950 # versions of a given application (e.g. Aurora and Firefox both use
2951 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
2952 # for application.ini's "Name" field, which controls profile location in
2953 # the absence of a "Profile" field (see below), and various system
2954 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
2955 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
2956 # Mac Bundle name, Updater, Installer), it is typically used for nightly
2957 # builds (e.g. Aurora for Firefox).
2958 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
2959 # defaults to a lowercase form of MOZ_APP_BASENAME.
2960 # - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
2961 # profile name and remoting. If not set, defaults to MOZ_APP_NAME.
2962 # - MOZ_APP_PROFILE: When set, used for application.ini's
2963 # "Profile" field, which controls profile location.
2964 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
2965 # crash reporter server url.
2966 # - MOZ_APP_ANDROID_VERSION_CODE: On Android, "android:versionCode" for
2967 # the main application is set to the value of this variable. If not
2968 # set, it falls back to a Mozilla-specific value derived from the
2970 # - MOZ_ANDROID_SHARED_ID: On Android, "android:sharedUserId" for all Android
2971 # packages produced.
2972 # - MOZ_ANDROID_GCM_SENDERID: On Android, the Android GCM Sender ID used. GCM
2973 # sender IDs are not sensitive: see, http://stackoverflow.com/a/18216063.
2974 # - MOZ_MMA_GCM_SENDERID: This GCM Sender ID is used for MMA integration.
2975 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
2977 # The following environment variables used to have an effect, but don't anymore:
2978 # - MOZ_APP_VERSION: Defines the application version number. This was replaced with
2979 # the contents from the version.txt file in the application directory, or
2980 # browser/config/version.txt if there isn't one.
2981 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
2982 # in the "About" window. This was replaced with the contents from the
2983 # version_display.txt or version.txt in the application directory, or
2984 # browser/config/version_display.txt.
2986 if test -z "$MOZ_APP_NAME"; then
2987 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
2990 if test -z "$MOZ_APP_REMOTINGNAME"; then
2991 MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
2994 if test -z "$ANDROID_PACKAGE_NAME" ; then
2995 # When we got rid of the Aurora channel we decided to replace the old
2996 # Nightly ANDROID_PACKAGE_NAME with Aurora. To make sure this is inherited
2997 # by all mozilla-central based branches we make this the new "default"
2998 # for Fennec. Non mozilla-central based branches set ANDROID_PACKAGE_NAME
2999 # in their mozconfig, so they will never get this. If there are ever
3000 # non-Fennec builds for Android, they will fall into the else block
3001 # and use their own default name.
3002 # https://bugzilla.mozilla.org/show_bug.cgi?id=1357808 has additional
3003 # background on this.
3004 if test "$MOZ_APP_NAME" = "fennec"; then
3005 ANDROID_PACKAGE_NAME="org.mozilla.fennec_aurora"
3007 ANDROID_PACKAGE_NAME="org.mozilla.$MOZ_APP_NAME"
3011 # Mozilla released Firefox for Android {Release,Beta} and {Aurora,Nightly} to
3012 # the public with specific common shared IDs and we need to keep them
3013 # consistent forever. The specific common values are set by per-channel
3014 # branding; all other channels use a generic sharedID, set below.
3015 if test -z "$MOZ_ANDROID_SHARED_ID" ; then
3016 MOZ_ANDROID_SHARED_ID="${ANDROID_PACKAGE_NAME}.sharedID"
3019 # For extensions and langpacks, we require a max version that is compatible
3020 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
3021 # 24.0a1 and 24.0a2 aren't affected
3023 # 24.1.1 becomes 24.*
3024 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
3025 if test -z "$IS_ALPHA"; then
3027 if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
3028 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
3030 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
3034 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
3037 AC_SUBST(MOZ_APP_NAME)
3038 AC_SUBST(MOZ_APP_REMOTINGNAME)
3039 AC_SUBST(MOZ_APP_DISPLAYNAME)
3040 AC_SUBST(MOZ_APP_BASENAME)
3041 AC_SUBST(MOZ_APP_VENDOR)
3042 AC_SUBST(MOZ_APP_PROFILE)
3043 AC_SUBST(MOZ_APP_ID)
3044 AC_SUBST(MOZ_APP_ANDROID_VERSION_CODE)
3045 AC_SUBST(MOZ_ANDROID_SHARED_ID)
3046 AC_SUBST(MOZ_ANDROID_GCM_SENDERID)
3047 AC_SUBST(MOZ_MMA_GCM_SENDERID)
3048 AC_SUBST(MAR_CHANNEL_ID)
3049 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
3050 AC_SUBST(MOZ_PROFILE_MIGRATOR)
3051 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
3052 AC_SUBST(MOZ_APP_UA_NAME)
3053 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
3054 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
3055 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
3057 AC_SUBST(MOZ_APP_MAXVERSION)
3058 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
3059 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
3060 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
3063 AC_SUBST(MOZ_PKG_SPECIAL)
3064 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
3066 if test "$MOZILLA_OFFICIAL"; then
3067 # Build revisions should always be present in official builds
3068 MOZ_INCLUDE_SOURCE_INFO=1
3071 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
3072 # explicitly set the repository and changeset information in.
3073 AC_SUBST(MOZ_SOURCE_REPO)
3074 AC_SUBST(MOZ_SOURCE_CHANGESET)
3075 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
3077 dnl If we have any service that uploads data (and requires data submission
3078 dnl policy alert), set MOZ_DATA_REPORTING.
3079 dnl We need SUBST for build system and DEFINE for xul preprocessor.
3080 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER" || test -n "$MOZ_NORMANDY"; then
3081 MOZ_DATA_REPORTING=1
3082 AC_DEFINE(MOZ_DATA_REPORTING)
3083 AC_SUBST(MOZ_DATA_REPORTING)
3087 AC_SUBST(WIN32_REDIST_DIR)
3088 AC_SUBST(WIN_UCRT_REDIST_DIR)
3090 dnl ========================================================
3092 dnl ========================================================
3096 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
3102 dnl Echo the CFLAGS to remove extra whitespace.
3104 $_COMPILATION_CFLAGS \
3108 $_WARNINGS_CXXFLAGS \
3109 $_COMPILATION_CXXFLAGS \
3112 COMPILE_CFLAGS=`echo \
3116 COMPILE_CXXFLAGS=`echo \
3117 $_DEFINES_CXXFLAGS \
3121 $_WARNINGS_HOST_CFLAGS \
3122 $_COMPILATION_HOST_CFLAGS \
3125 HOST_CXXFLAGS=`echo \
3126 $_WARNINGS_HOST_CXXFLAGS \
3127 $_COMPILATION_HOST_CXXFLAGS \
3130 AC_SUBST(MOZ_SYSTEM_PNG)
3132 AC_SUBST_LIST(MOZ_PNG_CFLAGS)
3133 AC_SUBST_LIST(MOZ_PNG_LIBS)
3135 AC_SUBST(MOZ_SYSTEM_NSPR)
3137 AC_SUBST(MOZ_SYSTEM_NSS)
3139 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
3140 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
3141 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
3142 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
3143 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
3144 OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
3145 OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
3147 AC_SUBST(HOST_CMFLAGS)
3148 AC_SUBST(HOST_CMMFLAGS)
3149 AC_SUBST(OS_COMPILE_CMFLAGS)
3150 AC_SUBST(OS_COMPILE_CMMFLAGS)
3153 OS_CXXFLAGS="$CXXFLAGS"
3154 OS_CPPFLAGS="$CPPFLAGS"
3155 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
3156 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
3157 OS_LDFLAGS="$LDFLAGS"
3159 AC_SUBST_LIST(OS_CFLAGS)
3160 AC_SUBST_LIST(OS_CXXFLAGS)
3161 AC_SUBST_LIST(OS_CPPFLAGS)
3162 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
3163 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
3164 AC_SUBST_LIST(OS_LDFLAGS)
3169 AC_SUBST_LIST(HOST_CFLAGS)
3170 AC_SUBST_LIST(HOST_CPPFLAGS)
3171 AC_SUBST_LIST(HOST_CXXFLAGS)
3172 AC_SUBST(HOST_LDFLAGS)
3173 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
3174 AC_SUBST(HOST_BIN_SUFFIX)
3176 AC_SUBST(TARGET_XPCOM_ABI)
3177 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
3178 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
3179 AC_SUBST(HAVE_X86_AVX2)
3180 AC_SUBST(HAVE_ALTIVEC)
3182 AC_SUBST_LIST(DSO_CFLAGS)
3183 AC_SUBST_LIST(DSO_PIC_CFLAGS)
3184 AC_SUBST(DSO_LDOPTS)
3185 AC_SUBST(BIN_SUFFIX)
3187 AC_SUBST(NS_ENABLE_TSF)
3188 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
3189 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
3191 AC_SUBST(MOZ_DEVTOOLS)
3193 AC_SUBST(MOZ_PACKAGE_JSSHELL)
3194 AC_SUBST(MOZ_FOLD_LIBS)
3195 AC_SUBST_LIST(MOZ_FOLD_LIBS_FLAGS)
3199 dnl Host JavaScript runtime, if any, to use during cross compiles.
3202 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
3204 if test -n "$COMPILE_ENVIRONMENT"; then
3205 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
3207 dnl Check for missing components
3208 if test "$MOZ_X11"; then
3209 dnl ====================================================
3210 dnl = Check if X headers exist
3211 dnl ====================================================
3212 _SAVE_CFLAGS=$CFLAGS
3213 CFLAGS="$CFLAGS $XCFLAGS"
3217 #include <X11/Xlib.h>
3218 #include <X11/Intrinsic.h>
3219 #include <X11/extensions/XShm.h>
3223 if ((dpy = XOpenDisplay(NULL)) == NULL) {
3224 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
3228 [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
3229 CFLAGS="$_SAVE_CFLAGS"
3231 if test -n "$MISSING_X"; then
3232 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
3237 fi # COMPILE_ENVIRONMENT
3239 dnl Set various defines and substitutions
3240 dnl ========================================================
3242 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
3243 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
3244 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
3245 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
3246 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
3247 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
3248 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
3249 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
3250 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
3253 AC_SUBST(MOZ_DEV_EDITION)
3254 if test -n "$MOZ_DEV_EDITION"; then
3255 AC_DEFINE(MOZ_DEV_EDITION)
3258 if test "$MOZ_DEBUG" -o "$DEVELOPER_OPTIONS"; then
3262 if test -n "$A11Y_LOG"; then
3266 dnl Spit out some output
3267 dnl ========================================================
3269 dnl The following defines are used by xpcom
3270 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
3282 # Avoid using obsolete NSPR features
3283 AC_DEFINE(NO_NSPR_10_SUPPORT)
3285 MOZ_CREATE_CONFIG_STATUS()
3287 rm -fr confdefs* $ac_clean_files