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
65 STARTUP_NOTIFICATION_VERSION=0.8
69 dnl Set various checks
70 dnl ========================================================
73 dnl Initialize the Pthread test variables early so they can be
74 dnl overridden by each platform.
75 dnl ========================================================
79 LDFLAGS="$LDFLAGS $LINKER_LDFLAGS"
81 if test "$COMPILE_ENVIRONMENT"; then
83 fi # COMPILE_ENVIRONMENT
86 *-android*|*-linuxandroid*)
90 AC_PATH_PROG(OBJCOPY,objcopy)
100 AC_SUBST(ANDROID_SOURCE)
101 AC_SUBST(ANDROID_PACKAGE_NAME)
104 dnl ========================================================
105 dnl Checks for compilers.
106 dnl ========================================================
108 if test "$COMPILE_ENVIRONMENT"; then
110 if test "$target" != "$host"; then
116 # Work around the conftest.exe access problem on Windows
121 MOZ_PATH_PROGS(AS, $AS as, $CC)
122 AC_CHECK_PROGS(STRIP, strip, :)
123 AC_CHECK_PROGS(OTOOL, otool, :)
126 if test -n "$MOZ_WINCONSOLE"; then
127 AC_DEFINE(MOZ_WINCONSOLE)
132 dnl ========================================================
133 dnl Special win32 checks
134 dnl ========================================================
140 if test "$GCC" != "yes"; then
141 # Check to see if we are really running in a msvc environemnt
144 # Make sure compilers are valid
145 CFLAGS="$CFLAGS -nologo"
146 CXXFLAGS="$CXXFLAGS -TP -nologo"
149 AC_TRY_COMPILE([#include <stdio.h>],
150 [ printf("Hello World\n"); ],,
151 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
154 AC_TRY_COMPILE([#include <new.h>],
155 [ unsigned *test = new unsigned(42); ],,
156 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
160 _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
163 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
164 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
165 AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
168 MSVC_C_RUNTIME_DLL=vcruntime140.dll
169 MSVC_CXX_RUNTIME_DLL=msvcp140.dll
171 # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
172 CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
174 if test -n "$WIN_UCRT_REDIST_DIR"; then
175 if test ! -d "$WIN_UCRT_REDIST_DIR"; then
176 AC_MSG_ERROR([Invalid Windows UCRT Redist directory: ${WIN_UCRT_REDIST_DIR}])
178 WIN_UCRT_REDIST_DIR=`cd "$WIN_UCRT_REDIST_DIR" && pwd -W`
181 AC_SUBST(MSVC_C_RUNTIME_DLL)
182 AC_SUBST(MSVC_CXX_RUNTIME_DLL)
184 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
186 if test -n "$WIN32_REDIST_DIR"; then
187 if test ! -d "$WIN32_REDIST_DIR"; then
188 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
190 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd -W`
193 # Check linker version, except in lld builds
198 _LD_FULL_VERSION=`"${LINKER}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
199 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
200 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
201 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
208 unset _MSVC_VER_FILTER
211 STL_FLAGS="-I${DIST}/stl_wrappers"
212 CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
213 CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
215 # Check w32api version
216 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
217 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
218 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
219 AC_TRY_COMPILE([#include <w32api.h>],
220 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
221 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
222 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
223 #error "test failed."
225 , [ res=yes ], [ res=no ])
226 AC_MSG_RESULT([$res])
227 if test "$res" != "yes"; then
228 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
230 # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
231 # causing problems with local implementations with the same name.
232 AC_DEFINE(STRSAFE_NO_DEPRECATE)
235 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
236 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
237 # Require OS features provided by IE 8.0 (Win7)
238 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0800)
243 if test -n "$_WIN32_MSVC"; then
245 SKIP_COMPILER_CHECKS=1
246 SKIP_LIBRARY_CHECKS=1
248 # Since we're skipping compiler and library checks, hard-code
251 AC_DEFINE(HAVE_ISATTY)
254 fi # COMPILE_ENVIRONMENT
259 AC_SUBST_LIST(STL_FLAGS)
260 AC_SUBST(WRAP_STL_INCLUDES)
262 dnl ========================================================
263 dnl Checks for programs.
264 dnl ========================================================
265 if test "$COMPILE_ENVIRONMENT"; then
271 fi # COMPILE_ENVIRONMENT
273 dnl ========================================================
274 dnl set the defaults first
275 dnl ========================================================
276 MOZ_USER_DIR=".mozilla"
278 MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
282 dnl Configure platform-specific CPU architecture compiler options.
283 dnl ==============================================================
284 if test "$COMPILE_ENVIRONMENT"; then
287 if test "$OS_TARGET" = Android; then
288 dnl Default Android builds to ARMv7.
291 fi # COMPILE_ENVIRONMENT
293 dnl ========================================================
294 dnl Android libstdc++, placed here so it can use MOZ_ARCH
296 dnl ========================================================
299 if test "$COMPILE_ENVIRONMENT"; then
301 fi # COMPILE_ENVIRONMENT
303 dnl ========================================================
304 dnl Suppress Clang Argument Warnings
305 dnl ========================================================
306 WARNINGS_CFLAGS="$_WARNINGS_CFLAGS"
307 if test -n "${CLANG_CC}${CLANG_CL}"; then
308 WARNINGS_CFLAGS="-Qunused-arguments $WARNINGS_CFLAGS"
309 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
311 if test -n "${CLANG_CXX}${CLANG_CL}"; then
312 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
315 if test -n "$COMPILE_ENVIRONMENT"; then
319 dnl ========================================================
320 dnl Add optional and non-optional hardening flags
321 dnl ========================================================
323 CFLAGS="$CFLAGS $MOZ_HARDENING_CFLAGS"
324 CPPFLAGS="$CPPFLAGS $MOZ_HARDENING_CFLAGS"
325 CXXFLAGS="$CXXFLAGS $MOZ_HARDENING_CFLAGS"
326 LDFLAGS="$LDFLAGS $MOZ_HARDENING_LDFLAGS"
328 dnl ========================================================
329 dnl GNU specific defaults
330 dnl ========================================================
331 if test "$GNU_CC"; then
335 SSSE3_FLAGS="-mssse3"
336 # FIXME: Let us build with strict aliasing. bug 414641.
337 CFLAGS="$CFLAGS -fno-strict-aliasing"
338 WARNINGS_AS_ERRORS='-Werror'
341 if test "$OS_ARCH" != "WINNT" -o -z "$CLANG_CC"; then
342 DSO_PIC_CFLAGS='-fPIC'
343 ASFLAGS="$ASFLAGS -fPIC"
346 AC_MSG_CHECKING([for --noexecstack option to as])
348 CFLAGS="$CFLAGS -Wa,--noexecstack"
349 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
350 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
353 AC_MSG_CHECKING([for -z noexecstack option to ld])
354 _SAVE_LDFLAGS=$LDFLAGS
355 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
356 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
358 LDFLAGS=$_SAVE_LDFLAGS)
360 AC_MSG_CHECKING([for -z text option to ld])
361 _SAVE_LDFLAGS=$LDFLAGS
362 LDFLAGS="$LDFLAGS -Wl,-z,text"
363 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
365 LDFLAGS=$_SAVE_LDFLAGS)
367 AC_MSG_CHECKING([for -z relro option to ld])
368 _SAVE_LDFLAGS=$LDFLAGS
369 LDFLAGS="$LDFLAGS -Wl,-z,relro"
370 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
372 LDFLAGS=$_SAVE_LDFLAGS)
374 AC_MSG_CHECKING([for -z nocopyreloc option to ld])
375 _SAVE_LDFLAGS=$LDFLAGS
376 LDFLAGS="$LDFLAGS -Wl,-z,nocopyreloc"
377 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
379 LDFLAGS=$_SAVE_LDFLAGS)
381 AC_MSG_CHECKING([for -Bsymbolic-functions option to ld])
382 _SAVE_LDFLAGS=$LDFLAGS
383 LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
384 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
386 LDFLAGS=$_SAVE_LDFLAGS)
388 AC_MSG_CHECKING([for --build-id=sha1 option to ld])
389 _SAVE_LDFLAGS=$LDFLAGS
390 LDFLAGS="$LDFLAGS -Wl,--build-id=sha1"
391 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
393 LDFLAGS=$_SAVE_LDFLAGS)
395 AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
396 HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
397 _SAVE_LDFLAGS=$LDFLAGS
398 LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
399 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
400 [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
402 LDFLAGS=$_SAVE_LDFLAGS
404 # Check for -mssse3 on $CC
405 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
406 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
408 CFLAGS="$CFLAGS -mssse3"
409 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
410 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
414 # Check for -msse4.1 on $CC
415 AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
416 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
418 CFLAGS="$CFLAGS -msse4.1"
419 AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
420 [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
424 case "${CPU_ARCH}" in
426 AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
428 [asm volatile ("vpermq \$0xd8,%ymm0,%ymm0 \n");],
429 result="yes", result="no")
430 AC_MSG_RESULT("$result")
431 if test "$result" = "yes"; then
437 AC_MSG_CHECKING([whether we can enable AltiVec support])
440 CFLAGS="$CFLAGS -maltivec"
441 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
449 if test "$GCC_USE_GNU_LD"; then
450 # Some tools like ASan use a runtime library that is only
451 # linked against executables, so we must allow undefined
452 # symbols for shared objects in some cases.
453 if test -z "$MOZ_ASAN$MOZ_MSAN$MOZ_UBSAN$MOZ_TSAN$FUZZING_INTERFACES"; then
454 # Don't allow undefined symbols in libraries
455 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
457 # BSDs need `environ' exposed for posix_spawn (bug 753046)
459 DragonFly|FreeBSD|NetBSD|OpenBSD)
460 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
461 DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
463 DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
470 _DEFINES_CFLAGS="-include $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
471 _USE_CPP_INCLUDE_FLAG=1
473 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
476 if test "$GNU_CXX"; then
477 # FIXME: Let us build with strict aliasing. bug 414641.
478 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
480 _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
481 _USE_CPP_INCLUDE_FLAG=1
484 # For profiling builds keep the symbol information
485 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
487 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
488 STRIP_FLAGS="--strip-debug"
493 dnl ========================================================
495 dnl ========================================================
497 if test "$MOZ_DMD"; then
498 if test "${CPU_ARCH}" = "arm"; then
499 CFLAGS="$CFLAGS -funwind-tables"
500 CXXFLAGS="$CXXFLAGS -funwind-tables"
504 dnl ========================================================
505 dnl System overrides of the defaults for host
506 dnl ========================================================
509 if test -n "$_WIN32_MSVC"; then
510 HOST_CFLAGS="$HOST_CFLAGS -nologo"
512 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
514 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
515 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
518 case "${host_cpu}" in
520 if test -n "$_WIN32_MSVC"; then
521 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
525 if test -n "$_WIN32_MSVC"; then
526 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
528 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
534 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
535 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
538 *-linux*|*-kfreebsd*-gnu|*-gnu*)
539 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
540 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
544 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
545 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
549 dnl ========================================================
550 dnl System overrides of the defaults for target
551 dnl ========================================================
555 MOZ_OPTIMIZE_FLAGS="-O3"
556 CXXFLAGS="$CXXFLAGS -stdlib=libc++"
558 STRIP_FLAGS="$STRIP_FLAGS -x -S"
559 # Ensure that if we're targeting iOS an SDK was provided.
560 AC_CACHE_CHECK(for iOS target,
562 [AC_TRY_COMPILE([#include <TargetConditionals.h>
563 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
567 ac_cv_ios_target="yes",
568 ac_cv_ios_target="no")])
569 if test "$ac_cv_ios_target" = "yes" -a -z $MOZ_IOS; then
570 AC_MSG_ERROR([targeting iOS but not using an iOS SDK?])
572 if test -z "$MOZ_IOS"; then
573 # The ExceptionHandling framework is needed for Objective-C exception
574 # logging code in nsObjCExceptions.h. Currently we only use that in debug
576 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
579 dnl DTrace and -dead_strip don't interact well. See bug 403132.
580 dnl ===================================================================
581 if test "x$enable_dtrace" = "xyes"; then
582 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
584 dnl check for the presence of the -dead_strip linker flag
585 AC_MSG_CHECKING([for -dead_strip option to ld])
586 _SAVE_LDFLAGS=$LDFLAGS
587 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
588 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
589 if test -n "$_HAVE_DEAD_STRIP" ; then
591 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
596 LDFLAGS=$_SAVE_LDFLAGS
599 MOZ_FIX_LINK_PATHS="-Wl,-executable_path,${DIST}/bin"
602 *-android*|*-linuxandroid*)
603 AC_DEFINE(NO_PW_GECOS)
605 if test "$COMPILE_ENVIRONMENT"; then
609 MOZ_GFX_OPTIMIZE_MOBILE=1
610 if test -z "$CLANG_CC"; then
611 MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
613 # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
614 # -Oz is smaller than -Os on clang.
615 MOZ_OPTIMIZE_FLAGS="-Oz"
616 # Disable the outliner, which causes performance regressions, and is
617 # enabled on some platforms at -Oz.
618 if test -z "$MOZ_LTO"; then
619 DISABLE_OUTLINER="-mno-outline"
621 CFLAGS="$CFLAGS $DISABLE_OUTLINER"
622 AC_TRY_COMPILE(,,[MOZ_OPTIMIZE_FLAGS="$MOZ_OPTIMIZE_FLAGS $DISABLE_OUTLINER"])
623 CFLAGS="$_SAVE_CFLAGS"
625 DISABLE_OUTLINER="-Wl,-plugin-opt=-enable-machine-outliner=never"
626 _SAVE_LDFLAGS=$LDFLAGS
627 LDFLAGS="$LDFLAGS $MOZ_LTO_LDFLAGS $DISABLE_OUTLINER"
628 AC_TRY_LINK(,,[MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS $DISABLE_OUTLINER"])
629 LDFLAGS="$_SAVE_LDFLAGS"
635 if test "$GNU_CC" -o "$GNU_CXX"; then
636 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
637 if test -n "$MOZ_DEBUG"; then
638 MOZ_OPTIMIZE_FLAGS="-Os"
640 MOZ_OPTIMIZE_FLAGS="-O2"
642 if test -z "$CLANG_CC"; then
643 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
647 case "${target_cpu}" in
649 CFLAGS="$CFLAGS -mieee"
650 CXXFLAGS="$CXXFLAGS -mieee"
657 # certain versions of cygwin's makedepend barf on the
658 # #include <string> vs -I./dist/include/string issue so don't use it
659 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
663 CFLAGS="$CFLAGS -mms-bitfields"
664 CXXFLAGS="$CXXFLAGS -mms-bitfields"
666 # Use temp file for windres (bug 213281)
667 RCFLAGS='-O coff --use-temp-file'
668 # mingw doesn't require kernel32, user32, and advapi32 explicitly
669 LIBS="$LIBS -luuid -lusp10 -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
672 MOZ_OPTIMIZE_FLAGS="-O1"
674 WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
675 WIN32_GUI_EXE_LDFLAGS=-mwindows
677 if test -z "$CLANG_CC"; then
678 # Use static libgcc and libstdc++
679 LDFLAGS="$LDFLAGS -static"
681 # GCC/binutils can't link to a function if we try to include dllexport function
682 # in the same library as dllimport caller. To work around it, we build NSPR
683 # and NSS with -mnop-fun-dllimport flag. The drawback of this solution is that
684 # function thunks need to be generated for cross-DLL calls.
685 MOZ_FOLD_LIBS_FLAGS="-mnop-fun-dllimport"
687 # Silence problematic clang warnings
688 CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
691 TARGET_COMPILER_ABI=msvc
692 RANLIB='echo not_ranlib'
693 STRIP='echo not_strip'
695 # aarch64 doesn't support subsystems below 6.02
696 if test "$CPU_ARCH" = "aarch64"; then
697 WIN32_SUBSYSTEM_VERSION=6.02
699 WIN32_SUBSYSTEM_VERSION=6.01
701 WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
702 WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
703 DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
704 _USE_CPP_INCLUDE_FLAG=1
705 _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
706 _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
707 CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
708 CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
709 if test -z "$CLANG_CL"; then
710 CPPFLAGS="$CPPFLAGS -utf-8"
712 if test "$CPU_ARCH" = "x86"; then
713 dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
714 dnl more recent, so set that explicitly here unless another
715 dnl target arch has already been set.
717 if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
718 CFLAGS="$CFLAGS -arch:SSE2"
720 if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
721 CXXFLAGS="$CXXFLAGS -arch:SSE2"
724 SSE_FLAGS="-arch:SSE"
725 SSE2_FLAGS="-arch:SSE2"
726 dnl MSVC allows the use of intrinsics without any flags
727 dnl and doesn't have a separate arch for SSSE3
728 SSSE3_FLAGS="-arch:SSE2"
730 dnl clang-cl requires appropriate flags to enable SSSE3 support
731 dnl on all architectures.
732 if test -n "$CLANG_CL"; then
733 SSSE3_FLAGS="-mssse3"
735 dnl VS2013+ supports -Gw for better linker optimizations.
736 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
737 dnl Disabled on ASan because it causes false-positive ODR violations.
738 if test -z "$MOZ_ASAN"; then
740 CXXFLAGS="$CXXFLAGS -Gw"
742 # String tail merging doesn't play nice with ASan's ODR checker.
743 LDFLAGS="$LDFLAGS -opt:nolldtailmerge"
745 if test -n "$CLANG_CL"; then
746 # XXX We should combine some of these with our generic GCC-style
749 # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
750 CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
751 # We use offsetof on non-POD objects all the time.
752 # We also suppress this warning on other platforms.
753 CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
754 # This warns for reasonable things like:
755 # enum { X = 0xffffffffU };
756 # which is annoying for IDL headers.
757 CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
758 # This warns for cases that would be reached by the Microsoft
759 # #include rules, but also currently warns on cases that would
760 # *also* be reached by standard C++ include rules. That
761 # behavior doesn't seem useful, so we turn it off.
762 CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
763 # We normally error out on unknown pragmas, but since clang-cl
764 # claims to be MSVC, it would be difficult to add
765 # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
766 # use such pragmas, so just ignore them.
767 CFLAGS="$CFLAGS -Wno-unknown-pragmas"
768 CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
769 # We get errors about various #pragma intrinsic directives from
770 # clang-cl, and we don't need to hear about those.
771 CFLAGS="$CFLAGS -Wno-ignored-pragmas"
772 CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
773 # clang-cl's Intrin.h marks things like _ReadWriteBarrier
774 # as __attribute((__deprecated__)). This is nice to know,
775 # but since we don't get the equivalent warning from MSVC,
776 # let's just ignore it.
777 CFLAGS="$CFLAGS -Wno-deprecated-declarations"
778 CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
779 # We use a function like:
780 # __declspec(noreturn) __inline void f() {}
781 # which -Winvalid-noreturn complains about. Again, MSVC seems
782 # OK with it, so let's silence the warning.
783 CFLAGS="$CFLAGS -Wno-invalid-noreturn"
784 CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
785 # Missing |override| on virtual function declarations isn't
786 # something that MSVC currently warns about.
787 CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
788 # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
789 # declaration on |operator delete(void*)|. However, clang-cl
790 # must internally declare |operator delete(void*)| differently,
791 # which causes this warning for virtually every file in the
792 # tree. clang-cl doesn't support -fno-exceptions or equivalent,
793 # so there doesn't seem to be any way to convince clang-cl to
794 # declare |delete| differently. Therefore, suppress this
796 CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
797 # At least one MSVC header and several headers in-tree have
798 # unused typedefs, so turn this on.
799 CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
800 # jemalloc uses __declspec(allocator) as a profiler hint,
801 # which clang-cl doesn't understand.
802 CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
803 # __attribute__((unused)) really means "might be unused" and
804 # we use it to avoid warnings about things that are unused
805 # in some compilation units, but used in many others. This
806 # warning insists on complaining about the latter case, which
807 # is annoying, and rather noisy.
808 CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused"
810 # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
811 CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
812 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
813 MOZ_DEBUG_LDFLAGS='-DEBUG'
814 WARNINGS_AS_ERRORS='-WX'
815 # Use a higher optimization level for clang-cl, so we can come closer
816 # to MSVC's performance numbers (see bug 1443590).
817 if test -n "$CLANG_CL"; then
818 MOZ_OPTIMIZE_FLAGS='-O2'
820 MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
823 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE"
824 if test -z "$DEVELOPER_OPTIONS"; then
825 LDFLAGS="$LDFLAGS -RELEASE"
828 dnl Minimum reqiurement of Gecko is VS2015 or later which supports
829 dnl both SSSE3 and SSE4.1.
830 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
831 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
832 dnl allow AVX2 code from VS2015
835 AC_DEFINE(WIN32_LEAN_AND_MEAN)
836 dnl See http://support.microsoft.com/kb/143208 to use STL
839 MOZ_USER_DIR="Mozilla"
843 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.])
847 if test -n "$GNU_CC" -a -z "$CLANG_CC"; then
848 CFLAGS="$CFLAGS -fno-keep-inline-dllexport"
849 CXXFLAGS="$CXXFLAGS -fno-keep-inline-dllexport"
854 if test -n "$GNU_CC"; then
855 CFLAGS="$CFLAGS -mstackrealign"
856 CXXFLAGS="$CXXFLAGS -mstackrealign"
857 LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
858 if test -z "$CLANG_CC"; then
859 LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup"
862 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
863 LDFLAGS="$LDFLAGS -SAFESEH"
869 if test -n "$_WIN32_MSVC"; then
870 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
875 if test -n "$_WIN32_MSVC"; then
876 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:ARM64"
881 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
888 CFLAGS="$CFLAGS -Dunix"
889 CXXFLAGS="$CXXFLAGS -Dunix"
890 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
891 DSO_PIC_CFLAGS='-fPIC -DPIC'
893 MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
895 DSO_PIC_CFLAGS='-fPIC -DPIC'
898 # This will fail on a.out systems prior to 1.5.1_ALPHA.
899 if test "$LIBRUNPATH"; then
900 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
905 if test -z "$X11BASE"; then
908 MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
910 DSO_PIC_CFLAGS='-fPIC'
911 DSO_LDOPTS='-shared -fPIC'
912 if test "$LIBRUNPATH"; then
913 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
918 MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
923 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
924 MOZ_OPTIMIZE_FLAGS="-O"
927 AC_SUBST_LIST(MMX_FLAGS)
928 AC_SUBST_LIST(SSE_FLAGS)
929 AC_SUBST_LIST(SSE2_FLAGS)
930 AC_SUBST_LIST(SSSE3_FLAGS)
933 if test -n "$MOZ_LINKER"; then
934 AC_DEFINE(MOZ_LINKER)
936 AC_CHECK_PROGS(XZ, xz)
939 if test -z "$COMPILE_ENVIRONMENT"; then
940 SKIP_COMPILER_CHECKS=1
941 SKIP_LIBRARY_CHECKS=1
946 fi # COMPILE_ENVIRONMENT
948 if test -z "$SKIP_COMPILER_CHECKS"; then
949 dnl Checks for typedefs, structures, and compiler characteristics.
950 dnl ========================================================
965 case "${OS_TARGET}" in
969 STL_FLAGS="-I${DIST}/stl_wrappers"
974 if test "$MOZ_BUILD_APP" = "tools/crashreporter"; then
978 dnl Checks for header files.
979 dnl ========================================================
982 bitrig*|dragonfly*|freebsd*|openbsd*)
983 # for stuff like -lXshm
984 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
988 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
989 AC_CACHE_CHECK(for sockaddr_in.sin_len,
990 ac_cv_sockaddr_in_sin_len,
991 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
992 #include <sys/types.h>
994 #include <netinet/in.h>
995 struct sockaddr_in x;
996 void *foo = (void*) &x.sin_len;],
998 [ac_cv_sockaddr_in_sin_len=true],
999 [ac_cv_sockaddr_in_sin_len=false])])
1000 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
1001 AC_DEFINE(HAVE_SIN_LEN)
1002 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
1003 AC_DEFINE(HAVE_SCONN_LEN)
1006 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
1007 ac_cv_sockaddr_in6_sin6_len,
1008 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1009 #include <sys/types.h>
1011 #include <netinet/in.h>
1012 struct sockaddr_in6 x;
1013 void *foo = (void*) &x.sin6_len;],
1015 [ac_cv_sockaddr_in6_sin6_len=true],
1016 [ac_cv_sockaddr_in6_sin6_len=false])])
1017 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
1018 AC_DEFINE(HAVE_SIN6_LEN)
1021 AC_CACHE_CHECK(for sockaddr.sa_len,
1022 ac_cv_sockaddr_sa_len,
1023 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1024 #include <sys/types.h>
1026 #include <sys/socket.h>
1028 void *foo = (void*) &x.sa_len;],
1030 [ac_cv_sockaddr_sa_len=true],
1031 [ac_cv_sockaddr_sa_len=false])])
1032 if test "$ac_cv_sockaddr_sa_len" = true ; then
1033 AC_DEFINE(HAVE_SA_LEN)
1036 MOZ_ARG_ENABLE_BOOL(dtrace,
1037 [ --enable-dtrace build with dtrace support if available (default=no)],
1038 [enable_dtrace="yes"],)
1039 if test "x$enable_dtrace" = "xyes"; then
1040 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
1041 if test -n "$HAVE_DTRACE"; then
1042 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
1044 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
1047 AC_SUBST(HAVE_DTRACE)
1049 dnl Checks for libraries.
1050 dnl ========================================================
1051 AC_CHECK_LIB(c_r, gethostbyname_r)
1053 dnl We don't want to link with libdl even if it's present on OS X, since
1054 dnl it's not used and not part of the default installation. OS/2 has dlfcn
1056 dnl We don't want to link against libm or libpthread on Darwin since
1057 dnl they both are just symlinks to libSystem and explicitly linking
1058 dnl against libSystem causes issues when debugging (see bug 299601).
1063 AC_SEARCH_LIBS(dlopen, dl,
1064 MOZ_CHECK_HEADER(dlfcn.h,
1065 AC_DEFINE(HAVE_DLOPEN)))
1069 _SAVE_CFLAGS="$CFLAGS"
1070 CFLAGS="$CFLAGS -D_GNU_SOURCE"
1071 AC_CHECK_FUNCS(dladdr memmem)
1072 CFLAGS="$_SAVE_CFLAGS"
1074 if test ! "$GNU_CXX"; then
1075 AC_CHECK_LIB(C, demangle)
1078 AC_CHECK_LIB(socket, socket)
1081 XLIBS="$X_EXTRA_LIBS"
1083 dnl ========================================================
1084 dnl Checks for X libraries.
1085 dnl Ordering is important.
1086 dnl Xt is dependent upon SM as of X11R6
1087 dnl ========================================================
1088 if test -n "$MOZ_X11"; then
1089 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
1090 _SAVE_LDFLAGS="$LDFLAGS"
1092 LDFLAGS="$XLDFLAGS $LDFLAGS"
1093 AC_CHECK_LIB(X11, XDrawLines, [XLIBS="-lX11 $XLIBS"],
1094 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
1095 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
1096 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
1098 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
1099 unset ac_cv_lib_Xt_XtFree
1100 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
1101 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
1102 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
1103 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
1106 dnl ========================================================
1108 dnl ========================================================
1109 AC_CHECK_LIB(xcb, xcb_connect, [XLIBS="-lxcb $XLIBS"],
1110 [MISSING_X="$MISSING_X -lxcb"], $XLIBS)
1111 AC_CHECK_LIB(xcb-shm, xcb_shm_query_version, [XLIBS="-lxcb-shm $XLIBS"],
1112 [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS)
1113 AC_CHECK_LIB(X11-xcb, XGetXCBConnection, [XLIBS="-lX11-xcb $XLIBS"],
1114 [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS)
1116 LDFLAGS="$_SAVE_LDFLAGS"
1120 AC_SUBST_LIST(XCFLAGS)
1121 AC_SUBST_LIST(XLDFLAGS)
1122 AC_SUBST_LIST(XLIBS)
1123 AC_SUBST_LIST(XEXT_LIBS)
1124 AC_SUBST_LIST(XT_LIBS)
1126 dnl ========================================================
1127 dnl = pthread support
1128 dnl = Start by checking whether the system support pthreads
1129 dnl ========================================================
1130 case "$target_os" in
1135 AC_CHECK_LIB(pthreads, pthread_create,
1136 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
1137 AC_CHECK_LIB(pthread, pthread_create,
1138 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
1139 AC_CHECK_LIB(c_r, pthread_create,
1140 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
1141 AC_CHECK_LIB(c, pthread_create,
1150 dnl ========================================================
1151 dnl Do the platform specific pthread hackery
1152 dnl ========================================================
1153 if test "$MOZ_USE_PTHREADS"x != x
1156 dnl See if -pthread is supported.
1159 ac_cv_have_dash_pthread=no
1160 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
1161 echo 'int main() { return 0; }' | cat > conftest.c
1162 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
1163 if test $? -eq 0; then
1164 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1165 ac_cv_have_dash_pthread=yes
1166 case "$target_os" in
1168 # Freebsd doesn't use -pthread for compiles, it uses them for linking
1171 CFLAGS="$CFLAGS -pthread"
1172 CXXFLAGS="$CXXFLAGS -pthread"
1178 AC_MSG_RESULT($ac_cv_have_dash_pthread)
1181 dnl See if -pthreads is supported.
1183 ac_cv_have_dash_pthreads=no
1184 if test "$ac_cv_have_dash_pthread" = "no"; then
1185 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
1186 echo 'int main() { return 0; }' | cat > conftest.c
1187 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
1188 if test $? -eq 0; then
1189 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1190 ac_cv_have_dash_pthreads=yes
1191 CFLAGS="$CFLAGS -pthreads"
1192 CXXFLAGS="$CXXFLAGS -pthreads"
1196 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
1201 AC_DEFINE(_REENTRANT)
1202 AC_DEFINE(_THREAD_SAFE)
1203 dnl -pthread links in -lpthread, so don't specify it explicitly.
1204 if test "$ac_cv_have_dash_pthread" = "yes"; then
1205 _PTHREAD_LDFLAGS="-pthread"
1209 *-*-openbsd*|*-*-bsdi*)
1210 AC_DEFINE(_REENTRANT)
1211 AC_DEFINE(_THREAD_SAFE)
1212 dnl -pthread links in -lc_r, so don't specify it explicitly.
1213 if test "$ac_cv_have_dash_pthread" = "yes"; then
1214 _PTHREAD_LDFLAGS="-pthread"
1218 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
1219 AC_DEFINE(_REENTRANT)
1223 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
1224 AC_SUBST(MOZ_USE_PTHREADS)
1225 MOZ_CHECK_HEADERS(pthread.h)
1229 dnl Checks for library functions.
1230 dnl ========================================================
1231 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall)
1233 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1234 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1235 ac_cv_clock_monotonic,
1236 [for libs in "" -lrt; do
1238 _SAVE_CFLAGS="$CFLAGS"
1240 CFLAGS="$CFLAGS $DSO_PIC_CFLAGS"
1241 dnl clock_gettime is available on OSX since 10.12, so depending on MACOSX_DEPLOYMENT_TARGET,
1242 dnl we should or not be able to use it. To detect if we can, we need to make the
1243 dnl availability attribute strict, so that compilation fails when the target is < 10.12.
1244 AC_TRY_LINK([#define availability(os, ...) availability(os, strict, __VA_ARGS)
1246 [ struct timespec ts;
1247 clock_gettime(CLOCK_MONOTONIC, &ts); ],
1248 ac_cv_clock_monotonic=$libs
1251 ac_cv_clock_monotonic=no)
1253 CFLAGS="$_SAVE_CFLAGS"
1255 if test "$ac_cv_clock_monotonic" != "no"; then
1256 HAVE_CLOCK_MONOTONIC=1
1257 REALTIME_LIBS=$ac_cv_clock_monotonic
1258 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1259 AC_SUBST(HAVE_CLOCK_MONOTONIC)
1260 AC_SUBST_LIST(REALTIME_LIBS)
1263 dnl Turn on warnings-as-errors to prevent implicit declaration of
1264 dnl pthread_cond_timedwait_monotonic_np, which can cause this test to
1265 dnl inadvertently pass even if the function does not really exist.
1266 _SAVE_CFLAGS="$CFLAGS"
1267 CFLAGS="$CFLAGS $WARNINGS_AS_ERRORS"
1268 AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
1269 ac_cv_pthread_cond_timedwait_monotonic_np,
1270 AC_TRY_LINK([#include <pthread.h>],
1271 [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
1272 ac_cv_pthread_cond_timewait_monotonic_np=yes,
1273 ac_cv_pthread_cond_timewait_monotonic_np=no))
1274 if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
1275 AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
1277 CFLAGS=$_SAVE_CFLAGS
1281 ac_cv_func_res_ninit,
1282 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
1283 dnl no need for res_ninit() on NetBSD and OpenBSD
1284 ac_cv_func_res_ninit=no
1288 #define _BSD_SOURCE 1
1290 #include <sys/types.h>
1291 #include <netinet/in.h>
1292 #include <arpa/nameser.h>
1295 [int foo = res_ninit(&_res);],
1296 [ac_cv_func_res_ninit=yes],
1297 [ac_cv_func_res_ninit=no])
1301 if test "$ac_cv_func_res_ninit" = "yes"; then
1302 AC_DEFINE(HAVE_RES_NINIT)
1303 dnl must add the link line we do something as foolish as this... dougt
1305 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
1306 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
1311 dnl **********************
1312 dnl *** va_copy checks ***
1313 AC_CACHE_CHECK([for an implementation of va_copy()],
1315 [AC_TRY_COMPILE([#include <stdarg.h>
1317 void f (int i, ...) {
1318 va_list args1, args2;
1319 va_start (args1, i);
1320 va_copy (args2, args1);
1321 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1323 va_end (args1); va_end (args2);
1325 [f(0, 42); return 0],
1326 [ac_cv_va_copy=yes],
1330 AC_CACHE_CHECK([whether va_list can be copied by value],
1332 [AC_TRY_COMPILE([#include <stdarg.h>
1334 void f (int i, ...) {
1335 va_list args1, args2;
1336 va_start (args1, i);
1338 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1340 va_end (args1); va_end (args2);
1342 [f(0, 42); return 0],
1343 [ac_cv_va_val_copy=yes],
1344 [ac_cv_va_val_copy=no],
1347 if test "x$ac_cv_va_copy" = "xyes"; then
1348 AC_DEFINE(VA_COPY, va_copy)
1349 AC_DEFINE(HAVE_VA_COPY)
1352 if test "x$ac_cv_va_val_copy" = "xno"; then
1353 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
1356 dnl ===================================================================
1357 dnl ========================================================
1358 dnl Put your C++ language/feature checks below
1359 dnl ========================================================
1363 if test "$GNU_CC"; then
1364 if test "$CPU_ARCH" = "arm" ; then
1365 AC_CACHE_CHECK(for ARM EABI,
1369 #if defined(__ARM_EABI__)
1372 #error Not ARM EABI.
1375 ac_cv_gcc_arm_eabi="yes",
1376 ac_cv_gcc_arm_eabi="no")])
1377 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
1379 ARM_ABI_PREFIX=eabi-
1381 ARM_ABI_PREFIX=oabi-
1385 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
1388 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
1389 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
1390 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
1392 _SAVE_LDFLAGS=$LDFLAGS
1393 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
1394 AC_CACHE_CHECK(for __thread keyword for TLS variables,
1395 ac_cv_thread_keyword,
1396 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
1397 [return tlsIsMainThread;],
1398 ac_cv_thread_keyword=yes,
1399 ac_cv_thread_keyword=no)])
1400 LDFLAGS=$_SAVE_LDFLAGS
1401 # The custom dynamic linker doesn't support TLS variables
1403 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
1404 # mips builds fail with TLS variables because of a binutils bug.
1406 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
1411 *-android*|*-linuxandroid*)
1418 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
1424 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
1425 if test -n "$MOZ_LINKER"; then
1426 if test "$CPU_ARCH" = arm; then
1427 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
1428 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
1429 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1430 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1434 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
1435 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
1436 dnl Since the linker only understands the sysv ones, no need to build the
1437 dnl gnu style tables anyways.
1438 LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
1441 dnl End of C++ language/feature checks
1444 dnl ========================================================
1445 dnl = Internationalization checks
1446 dnl ========================================================
1448 dnl Internationalization and Locale support is different
1449 dnl on various UNIX platforms. Checks for specific i18n
1450 dnl features go here.
1452 AC_HAVE_FUNCS(localeconv)
1454 fi # ! SKIP_COMPILER_CHECKS
1456 if test -n "${COMPILE_ENVIRONMENT}"; then
1461 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1462 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1463 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1466 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1467 dnl features that Windows actually does support.
1469 if test -n "$SKIP_COMPILER_CHECKS"; then
1470 dnl Windows has malloc.h
1471 AC_DEFINE(MALLOC_H, [<malloc.h>])
1472 AC_DEFINE(HAVE_FORCEINLINE)
1473 AC_DEFINE(HAVE_LOCALECONV)
1474 fi # SKIP_COMPILER_CHECKS
1476 dnl Mozilla specific options
1477 dnl ========================================================
1478 dnl The macros used for command line options
1479 dnl are defined in build/autoconf/altoptions.m4.
1481 dnl ========================================================
1483 dnl = Check for external package dependencies
1485 dnl ========================================================
1486 MOZ_ARG_HEADER(External Packages)
1488 case "$OS_TARGET" in
1489 WINNT|Darwin|Android)
1499 dnl ========================================================
1500 dnl system libevent Support
1501 dnl ========================================================
1502 MOZ_ARG_WITH_STRING(system-libevent,
1503 [ --with-system-libevent[=PFX]
1504 Use system libevent [installed at prefix PFX]],
1505 LIBEVENT_DIR=$withval)
1507 _SAVE_CFLAGS=$CFLAGS
1508 _SAVE_LDFLAGS=$LDFLAGS
1510 if test "$LIBEVENT_DIR" = yes; then
1511 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
1512 MOZ_SYSTEM_LIBEVENT=1,
1515 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
1516 MOZ_SYSTEM_LIBEVENT=
1517 elif test -z "$MOZ_SYSTEM_LIBEVENT"; then
1518 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
1519 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
1520 MOZ_CHECK_HEADER(event.h,
1521 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
1522 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
1524 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
1525 AC_CHECK_LIB(event, event_init,
1526 [MOZ_SYSTEM_LIBEVENT=1
1527 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
1528 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
1529 [MOZ_SYSTEM_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
1531 CFLAGS=$_SAVE_CFLAGS
1532 LDFLAGS=$_SAVE_LDFLAGS
1535 AC_SUBST(MOZ_SYSTEM_LIBEVENT)
1537 dnl ========================================================
1538 dnl = If NSS was not detected in the system,
1539 dnl = use the one in the source tree (mozilla/security/nss)
1540 dnl ========================================================
1542 MOZ_ARG_WITH_BOOL(system-nss,
1543 [ --with-system-nss Use system installed NSS],
1546 if test -n "$_USE_SYSTEM_NSS"; then
1547 AM_PATH_NSS(3.42, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
1550 NSS_CFLAGS="$NSS_CFLAGS -I${DIST}/include/nss"
1551 if test -z "$MOZ_SYSTEM_NSS"; then
1552 case "${OS_ARCH}" in
1553 # Only few platforms have been tested with GYP
1554 WINNT|Darwin|Linux|DragonFly|FreeBSD|NetBSD|OpenBSD|SunOS)
1557 AC_MSG_ERROR([building in-tree NSS is not supported on this platform. Use --with-system-nss])
1562 dnl system ZLIB support
1563 dnl ========================================================
1564 MOZ_ZLIB_CHECK([1.2.3])
1566 if test -z "$SKIP_LIBRARY_CHECKS"; then
1568 dnl ========================================================
1569 dnl system PNG Support
1570 dnl ========================================================
1571 MOZ_ARG_WITH_STRING(system-png,
1572 [ --with-system-png[=PFX]
1573 Use system libpng [installed at prefix PFX]],
1576 _SAVE_CFLAGS=$CFLAGS
1577 _SAVE_LDFLAGS=$LDFLAGS
1579 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
1580 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
1581 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
1583 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
1586 AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"],
1587 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1588 AC_CHECK_LIB(png, png_get_acTL, ,
1589 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
1591 if test "$MOZ_SYSTEM_PNG" = 1; then
1592 AC_TRY_COMPILE([ #include <stdio.h>
1593 #include <sys/types.h>
1595 [ #if PNG_LIBPNG_VER < $MOZPNG
1596 #error "Insufficient libpng version ($MOZPNG required)."
1598 #ifndef PNG_UINT_31_MAX
1599 #error "Insufficient libpng version."
1602 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1604 CFLAGS=$_SAVE_CFLAGS
1605 LDFLAGS=$_SAVE_LDFLAGS
1608 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then
1609 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
1610 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
1613 fi # SKIP_LIBRARY_CHECKS
1615 dnl ========================================================
1619 dnl ========================================================
1621 MOZ_ARG_HEADER(Application)
1623 ENABLE_SYSTEM_EXTENSION_DIRS=1
1624 MOZ_BRANDING_DIRECTORY=
1625 MOZ_OFFICIAL_BRANDING=
1626 MOZ_AUTH_EXTENSION=1
1627 if test "$MOZ_IOS"; then
1630 MOZ_PREF_EXTENSIONS=1
1632 MOZ_TOOLKIT_SEARCH=1
1633 MOZ_UNIVERSALCHARDET=1
1638 MOZ_USE_NATIVE_POPUP_WINDOWS=
1639 MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
1640 MOZ_CONTENT_SANDBOX=
1643 MOZ_BINARY_EXTENSIONS=
1646 case "$target_os" in
1649 AC_DEFINE(NS_ENABLE_TSF)
1653 # Optional Firefox for Android partner distribution directory.
1654 MOZ_ARG_WITH_STRING(android-distribution-directory,
1655 [ --with-android-distribution-directory=dir
1656 Optional Firefox for Android partner distribution directory.],
1657 MOZ_ANDROID_DISTRIBUTION_DIRECTORY=$withval)
1659 if test -n "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY"; then
1660 # A distribution directory must have an assets/distribution directory.
1661 # See https://wiki.mozilla.org/Mobile/Distribution_Files.
1662 if test ! -d "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY/assets/distribution" ; then
1663 AC_MSG_ERROR([--with-android-distribution-directory does not contain assets/distribution;
1664 (looked for ${MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets/distribution).])
1667 AC_SUBST(MOZ_ANDROID_DISTRIBUTION_DIRECTORY)
1669 dnl ========================================================
1670 dnl = Trademarked Branding
1671 dnl ========================================================
1672 MOZ_ARG_ENABLE_BOOL(official-branding,
1673 [ --enable-official-branding
1674 Enable Official mozilla.org Branding
1675 Do not distribute builds with
1676 --enable-official-branding unless you have
1677 permission to use trademarks per
1678 http://www.mozilla.org/foundation/trademarks/ .],
1679 MOZ_OFFICIAL_BRANDING=1,
1680 MOZ_OFFICIAL_BRANDING=)
1682 # Allow the application to influence configure with a confvars.sh script.
1683 AC_MSG_CHECKING([if app-specific confvars.sh exists])
1684 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
1685 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
1686 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
1691 # Allow influencing configure with a defines.sh script.
1692 . "${srcdir}/build/defines.sh"
1694 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
1696 if test "$BUILDING_RELEASE"; then
1697 # Override value in defines.sh, if any
1698 EARLY_BETA_OR_EARLIER=
1699 elif test "$EARLY_BETA_OR_EARLIER"; then
1700 AC_DEFINE(EARLY_BETA_OR_EARLIER)
1702 AC_SUBST(EARLY_BETA_OR_EARLIER)
1704 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
1705 MOZ_ARG_WITH_STRING(app-name,
1706 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
1707 WITH_APP_NAME=$withval,
1710 if test -n "$WITH_APP_NAME" ; then
1711 MOZ_APP_NAME="$WITH_APP_NAME"
1714 MOZ_ARG_WITH_STRING(app-basename,
1715 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
1716 WITH_APP_BASENAME=$withval,
1719 if test -n "$WITH_APP_BASENAME" ; then
1720 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
1723 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
1724 # that haven't made a confvars.sh yet. Don't add new stuff here, use
1726 case "$MOZ_BUILD_APP" in
1728 AC_DEFINE(MOZ_PHOENIX)
1732 AC_DEFINE(MOZ_XULRUNNER)
1736 # Graphene is a desktop runtime for running applications with a HTML UI.
1737 if test -n "$MOZ_GRAPHENE"; then
1738 AC_DEFINE(MOZ_GRAPHENE)
1741 AC_SUBST(MOZ_PHOENIX)
1742 AC_SUBST(MOZ_XULRUNNER)
1744 dnl ========================================================
1745 dnl Ensure Android SDK and build-tools versions depending on
1747 dnl ========================================================
1749 case "$MOZ_BUILD_APP" in
1755 dnl ========================================================
1757 dnl = Toolkit Options
1759 dnl ========================================================
1760 MOZ_ARG_HEADER(Toolkit Options)
1762 dnl ========================================================
1763 dnl = Enable the toolkit as needed =
1764 dnl ========================================================
1766 case "$MOZ_WIDGET_TOOLKIT" in
1769 LDFLAGS="$LDFLAGS -framework Cocoa"
1770 # Use -Wl as a trick to avoid -framework and framework names from
1771 # being separated by AC_SUBST_LIST.
1772 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'
1774 CFLAGS="$CFLAGS $TK_CFLAGS"
1775 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1776 MOZ_USER_DIR="Mozilla"
1777 MOZ_FS_LAYOUT=bundle
1781 LDFLAGS="$LDFLAGS -framework UIKit"
1783 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'
1784 CFLAGS="$CFLAGS $TK_CFLAGS"
1785 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1786 MOZ_USER_DIR="Mozilla"
1787 MOZ_FS_LAYOUT=bundle
1792 if test "$OS_TARGET" = Darwin; then
1793 LDFLAGS="$LDFLAGS -lobjc"
1796 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
1797 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
1798 case "$MOZ_WIDGET_TOOLKIT" in
1804 if test "$COMPILE_ENVIRONMENT"; then
1805 if test "$MOZ_WIDGET_TOOLKIT" = gtk3; then
1806 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)
1807 MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
1808 TK_CFLAGS=$MOZ_GTK3_CFLAGS
1809 TK_LIBS=$MOZ_GTK3_LIBS
1810 dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
1811 dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
1812 AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
1813 GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32
1815 if test "$MOZ_ENABLE_GTK"; then
1816 if test "$MOZ_X11"; then
1817 GDK_PACKAGES=gdk-x11-2.0
1819 AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
1820 AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
1822 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)
1823 MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
1825 fi # COMPILE_ENVIRONMENT
1827 AC_SUBST(MOZ_FS_LAYOUT)
1829 dnl ========================================================
1830 dnl = startup-notification support module
1831 dnl ========================================================
1833 if test "$MOZ_ENABLE_GTK"
1835 MOZ_ENABLE_STARTUP_NOTIFICATION=
1837 MOZ_ARG_ENABLE_BOOL(startup-notification,
1838 [ --enable-startup-notification
1839 Enable startup-notification support (default: disabled) ],
1840 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
1841 MOZ_ENABLE_STARTUP_NOTIFICATION=)
1842 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
1844 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
1845 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
1846 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
1847 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
1849 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
1851 MOZ_ENABLE_STARTUP_NOTIFICATION=
1855 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
1856 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
1859 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
1861 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
1863 AC_SUBST_LIST(TK_CFLAGS)
1864 AC_SUBST_LIST(TK_LIBS)
1869 dnl ========================================================
1871 dnl = Components & Features
1873 dnl ========================================================
1874 MOZ_ARG_HEADER(Components and Features)
1876 AC_SUBST(MOZ_OFFICIAL_BRANDING)
1877 if test -n "$MOZ_OFFICIAL_BRANDING"; then
1878 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
1879 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
1881 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
1882 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
1886 MOZ_ARG_WITH_STRING(branding,
1887 [ --with-branding=dir Use branding from the specified directory.],
1888 MOZ_BRANDING_DIRECTORY=$withval)
1890 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
1891 if test -z "$REAL_BRANDING_DIRECTORY"; then
1892 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
1895 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1896 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
1897 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1898 . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
1901 AC_SUBST(MOZ_BRANDING_DIRECTORY)
1903 dnl ========================================================
1904 dnl = Distribution ID
1905 dnl ========================================================
1906 MOZ_ARG_WITH_STRING(distribution-id,
1907 [ --with-distribution-id=ID
1908 Set distribution-specific id (default=org.mozilla)],
1909 [ val=`echo $withval`
1910 MOZ_DISTRIBUTION_ID="$val"])
1912 if test -z "$MOZ_DISTRIBUTION_ID"; then
1913 MOZ_DISTRIBUTION_ID="org.mozilla"
1916 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
1917 AC_SUBST(MOZ_DISTRIBUTION_ID)
1919 dnl ========================================================
1920 dnl = GConf support module
1921 dnl ========================================================
1925 if test "$MOZ_ENABLE_GTK"
1930 dnl ========================================================
1931 dnl = GConf support module
1932 dnl ========================================================
1933 MOZ_ARG_DISABLE_BOOL(gconf,
1934 [ --disable-gconf Disable Gconf support ],
1938 if test "$MOZ_ENABLE_GCONF"
1940 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
1941 MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
1944 if test -n "$MOZ_ENABLE_GCONF";
1946 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
1948 AC_MSG_WARN([Many automated tests will fail with --disable-gconf. See bug 1167201.])
1953 if test "$MOZ_ENABLE_GCONF"; then
1954 AC_DEFINE(MOZ_ENABLE_GCONF)
1957 AC_SUBST(MOZ_ENABLE_GCONF)
1960 dnl ========================================================
1961 dnl = libproxy support
1962 dnl ========================================================
1964 if test "$MOZ_ENABLE_GTK"
1966 MOZ_ENABLE_LIBPROXY=
1968 MOZ_ARG_ENABLE_BOOL(libproxy,
1969 [ --enable-libproxy Enable libproxy support ],
1970 MOZ_ENABLE_LIBPROXY=1,
1971 MOZ_ENABLE_LIBPROXY=)
1973 if test "$MOZ_ENABLE_LIBPROXY"
1975 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
1976 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
1979 AC_SUBST(MOZ_ENABLE_LIBPROXY)
1981 dnl ========================================================
1983 dnl ========================================================
1985 if test "$MOZ_ENABLE_GTK"
1989 MOZ_ARG_DISABLE_BOOL(dbus,
1990 [ --disable-dbus Disable dbus support ],
1994 if test "$MOZ_ENABLE_DBUS"
1996 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
1997 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
1998 AC_DEFINE(MOZ_ENABLE_DBUS)
2001 AC_SUBST(MOZ_ENABLE_DBUS)
2003 dnl =========================================================
2004 dnl = Whether to exclude hyphenations files in the build
2005 dnl =========================================================
2006 if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
2007 AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
2010 AC_TRY_COMPILE([#include <linux/ethtool.h>],
2011 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
2012 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
2014 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
2016 if test -n "$MOZ_WEBRTC"; then
2017 if test -n "$MOZ_X11"; then
2018 MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
2022 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
2024 dnl ========================================================
2025 dnl = Apple platform decoder support
2026 dnl ========================================================
2027 if test "$COMPILE_ENVIRONMENT"; then
2028 if test -n "$MOZ_APPLEMEDIA"; then
2029 # hack in frameworks for fmp4 - see bug 1029974
2030 # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
2031 LDFLAGS="$LDFLAGS -framework AudioToolbox"
2032 dnl Verify CoreMedia is available.
2033 AC_CHECK_HEADERS([CoreMedia/CoreMedia.h VideoToolbox/VideoToolbox.h], [],
2034 [AC_MSG_ERROR([MacOS X 10.9 SDK or later is required])])
2036 fi # COMPILE_ENVIRONMENT
2038 dnl ========================================================
2039 dnl = Handle dependent MEDIA defines
2040 dnl ========================================================
2043 AC_DEFINE(MOZ_WEBM_ENCODER)
2044 AC_SUBST(MOZ_WEBM_ENCODER)
2046 dnl ========================================================
2048 dnl ========================================================
2050 MOZ_ARG_DISABLE_BOOL(negotiateauth,
2051 [ --disable-negotiateauth Disable GSS-API negotiation ],
2052 MOZ_AUTH_EXTENSION=,
2053 MOZ_AUTH_EXTENSION=1 )
2055 if test -n "$MOZ_IOS" -a -n "$MOZ_AUTH_EXTENSION"; then
2056 AC_MSG_ERROR([negotiateauth is not supported on iOS.])
2059 dnl ========================================================
2060 dnl Pref extensions (autoconfig)
2061 dnl ========================================================
2062 MOZ_ARG_DISABLE_BOOL(pref-extensions,
2063 [ --disable-pref-extensions
2064 Disable pref extensions such as autoconfig],
2065 MOZ_PREF_EXTENSIONS=,
2066 MOZ_PREF_EXTENSIONS=1 )
2068 dnl ========================================================
2069 dnl Searching of system directories for extensions.
2070 dnl Note: this switch is meant to be used for test builds
2071 dnl whose behavior should not depend on what happens to be
2072 dnl installed on the local machine.
2073 dnl ========================================================
2074 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
2075 [ --disable-system-extension-dirs
2076 Disable searching system- and account-global
2077 directories for extensions of any kind; use
2078 only profile-specific extension directories],
2079 ENABLE_SYSTEM_EXTENSION_DIRS=,
2080 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
2081 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
2082 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
2085 dnl ========================================================
2086 dnl = Universalchardet
2087 dnl ========================================================
2088 MOZ_ARG_DISABLE_BOOL(universalchardet,
2089 [ --disable-universalchardet
2090 Disable universal encoding detection],
2091 MOZ_UNIVERSALCHARDET=,
2092 MOZ_UNIVERSALCHARDET=1 )
2094 dnl ========================================================
2096 dnl ========================================================
2098 if test "$COMPILE_ENVIRONMENT" ; then
2100 dnl Moved gamepad platform check to moz.build, linux header check still needed here.
2101 if test "$OS_TARGET" = "Linux"; then
2102 MOZ_CHECK_HEADER([linux/joystick.h])
2103 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
2104 AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
2108 fi # COMPILE_ENVIRONMENT
2111 dnl ========================================================
2112 dnl = Breakpad crash reporting (on by default on supported platforms)
2113 dnl ========================================================
2116 i?86-*-mingw*|x86_64-*-mingw*|aarch64-*-mingw*)
2119 i?86-apple-darwin*|x86_64-apple-darwin*)
2120 if test -z "$MOZ_IOS"; then
2124 *-android*|*-linuxandroid*)
2125 dnl Android/arm is arm-unknown-linux-androideabi, so android condition should
2126 dnl be before Linux condition
2129 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
2130 if test "$MOZ_ENABLE_GTK"; then
2136 MOZ_ARG_DISABLE_BOOL(crashreporter,
2137 [ --disable-crashreporter Disable breakpad crash reporting],
2138 [MOZ_CRASHREPORTER=],
2139 [MOZ_CRASHREPORTER=F # Force enable breakpad])
2141 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin"; then
2142 if test "$MOZ_CRASHREPORTER" = F; then
2143 AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
2148 if test -n "$MOZ_CRASHREPORTER"; then
2149 AC_DEFINE(MOZ_CRASHREPORTER)
2151 if test "$OS_TARGET" = "Linux" && \
2152 test -z "$SKIP_LIBRARY_CHECKS"; then
2153 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
2156 if test "$OS_ARCH" = "WINNT"; then
2157 if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
2158 MOZ_CRASHREPORTER_INJECTOR=1
2159 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
2164 dnl ========================================================
2165 dnl = Enable compilation of specific extension modules
2166 dnl ========================================================
2168 MOZ_ARG_ENABLE_STRING(extensions,
2169 [ --enable-extensions Enable extensions],
2170 [ for option in `echo $enableval | sed 's/,/ /g'`; do
2171 if test "$option" = "yes" -o "$option" = "all"; then
2172 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
2173 elif test "$option" = "no" -o "$option" = "none"; then
2175 elif test "$option" = "default"; then
2176 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
2177 elif test `echo "$option" | grep -c \^-` != 0; then
2178 option=`echo $option | sed 's/^-//'`
2179 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
2181 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
2184 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
2186 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
2187 dnl when trying to build a nonexistent extension.
2188 for extension in $MOZ_EXTENSIONS; do
2189 if test ! -d "${srcdir}/extensions/${extension}"; then
2190 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
2194 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
2195 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
2198 # Avoid defining MOZ_ENABLE_CAIRO_FT on Windows platforms because
2199 # "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
2200 if test -n "$MOZ_TREE_FREETYPE" -a "$OS_TARGET" != WINNT; then
2201 MOZ_ENABLE_CAIRO_FT=1
2202 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2203 CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
2204 AC_SUBST_LIST(CAIRO_FT_CFLAGS)
2207 AC_CHECK_PROGS(WGET, wget, "")
2210 dnl ========================================================
2211 dnl Enable building the signmar program.
2212 dnl This option is much different than the --enable-verify-mar option.
2213 dnl --enable-verify-mar is for enabling the verification check on MAR
2214 dnl files in the updater. The --enable-signmar option is for building
2215 dnl the signmar program.
2216 dnl ========================================================
2218 MOZ_ARG_ENABLE_BOOL(signmar,
2219 [ --enable-signmar Enable building the signmar program],
2220 MOZ_ENABLE_SIGNMAR=1,
2221 MOZ_ENABLE_SIGNMAR= )
2223 if test -n "$MOZ_ENABLE_SIGNMAR"; then
2224 if test -z "$COMPILE_ENVIRONMENT" ; then
2225 AC_MSG_WARN([Cannot --enable-signmar with --disable-compile-environment])
2228 AC_DEFINE(MOZ_ENABLE_SIGNMAR)
2232 dnl ========================================================
2234 dnl ========================================================
2236 if test "$MOZ_IOS"; then
2240 MOZ_ARG_DISABLE_BOOL(updater,
2241 [ --disable-updater Disable building of updater],
2245 if test -n "$MOZ_UPDATER"; then
2246 AC_DEFINE(MOZ_UPDATER)
2249 dnl ========================================================
2250 dnl parental controls (for Windows Vista)
2251 dnl ========================================================
2252 MOZ_ARG_DISABLE_BOOL(parental-controls,
2253 [ --disable-parental-controls
2254 Do not build parental controls],
2255 MOZ_DISABLE_PARENTAL_CONTROLS=1,
2256 MOZ_DISABLE_PARENTAL_CONTROLS=)
2257 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
2258 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
2261 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
2263 dnl ========================================================
2264 dnl = Disable smartcard support
2265 dnl ========================================================
2266 if test -n "$MOZ_NO_SMART_CARDS"; then
2267 AC_DEFINE(MOZ_NO_SMART_CARDS)
2269 AC_SUBST(MOZ_NO_SMART_CARDS)
2271 dnl ========================================================
2272 dnl = Sandboxing support
2273 dnl ========================================================
2274 if test -n "$MOZ_TSAN" -o -n "$MOZ_ASAN"; then
2275 # Bug 1182565: TSan conflicts with sandboxing on Linux.
2276 # Bug 1287971: LSan also conflicts with sandboxing on Linux.
2284 MOZ_ARG_DISABLE_BOOL(sandbox,
2285 [ --disable-sandbox Disable sandboxing support],
2289 dnl ========================================================
2290 dnl = Content process sandboxing
2291 dnl ========================================================
2293 case "$OS_TARGET" in
2295 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
2298 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
2303 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
2309 MOZ_ARG_ENABLE_BOOL(content-sandbox,
2310 [ --enable-content-sandbox Enable sandboxing support for content-processes
2311 --disable-content-sandbox Disable sandboxing support for content-processes],
2312 MOZ_CONTENT_SANDBOX=1,
2313 MOZ_CONTENT_SANDBOX=)
2315 if test -n "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_SANDBOX"; then
2316 AC_MSG_ERROR([--enable-content-sandbox and --disable-sandbox are conflicting options])
2319 if test -n "$MOZ_CONTENT_SANDBOX"; then
2320 AC_DEFINE(MOZ_CONTENT_SANDBOX)
2323 AC_SUBST(MOZ_CONTENT_SANDBOX)
2325 dnl ========================================================
2326 dnl = Gecko Media Plugin sandboxing
2327 dnl ========================================================
2330 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
2335 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
2340 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
2344 if test -n "$MOZ_GMP_SANDBOX"; then
2345 AC_DEFINE(MOZ_GMP_SANDBOX)
2348 AC_SUBST(MOZ_GMP_SANDBOX)
2350 if test -z "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_GMP_SANDBOX"; then
2354 if test -n "$MOZ_SANDBOX"; then
2355 AC_DEFINE(MOZ_SANDBOX)
2358 AC_SUBST(MOZ_SANDBOX)
2361 dnl ========================================================
2363 dnl = Module specific options
2365 dnl ========================================================
2366 MOZ_ARG_HEADER(Individual module options)
2368 dnl ========================================================
2369 dnl Check for sqlite
2370 dnl ========================================================
2373 MOZ_ARG_ENABLE_BOOL(system-sqlite,
2374 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
2375 MOZ_SYSTEM_SQLITE=1,
2376 MOZ_SYSTEM_SQLITE= )
2378 if test -n "$MOZ_SYSTEM_SQLITE"
2380 dnl ============================
2381 dnl === SQLite Version check ===
2382 dnl ============================
2383 dnl Check to see if the system SQLite package is new enough.
2384 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
2386 dnl ==============================
2387 dnl === SQLite fdatasync check ===
2388 dnl ==============================
2389 dnl Check to see if fdatasync is available
2390 AC_CHECK_FUNC(fdatasync)
2393 if test -n "$MOZ_SYSTEM_SQLITE"; then
2394 AC_DEFINE(MOZ_SYSTEM_SQLITE)
2396 AC_SUBST(MOZ_SYSTEM_SQLITE)
2398 dnl ========================================================
2399 dnl = Disable zipwriter
2400 dnl ========================================================
2401 MOZ_ARG_DISABLE_BOOL(zipwriter,
2402 [ --disable-zipwriter Disable zipwriter component],
2405 AC_SUBST(MOZ_ZIPWRITER)
2407 dnl ========================================================
2409 dnl = Feature options that require extra sources to be pulled
2411 dnl ========================================================
2412 dnl MOZ_ARG_HEADER(Features that require extra sources)
2414 dnl ========================================================
2416 dnl = Runtime debugging and Optimization Options
2418 dnl ========================================================
2419 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
2421 dnl ========================================================
2422 dnl enable mobile optimizations
2423 dnl ========================================================
2424 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
2425 [ --enable-mobile-optimize
2426 Enable mobile optimizations],
2427 MOZ_GFX_OPTIMIZE_MOBILE=1)
2429 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
2431 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
2432 # We ignore paint will resample on mobile for performance.
2433 # We may want to revisit this later.
2434 MOZ_IGNORE_PAINT_WILL_RESAMPLE=1
2436 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
2437 AC_DEFINE(MOZ_IGNORE_PAINT_WILL_RESAMPLE)
2440 dnl ========================================================
2441 dnl = Enable code optimization. ON by default.
2442 dnl ========================================================
2444 # Use value from moz.configure if one is defined. Else use our computed
2446 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
2447 MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
2450 MOZ_SET_FRAMEPTR_FLAGS
2452 if test "$COMPILE_ENVIRONMENT"; then
2453 if test -n "$MOZ_OPTIMIZE"; then
2454 AC_MSG_CHECKING([for valid C compiler optimization flags])
2455 _SAVE_CFLAGS=$CFLAGS
2456 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
2457 AC_TRY_COMPILE([#include <stdio.h>],
2458 [printf("Hello World\n");],
2461 AC_MSG_RESULT([$_results])
2462 if test "$_results" = "no"; then
2463 AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
2465 CFLAGS=$_SAVE_CFLAGS
2466 if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
2467 # When using llvm-based LTO, non numeric optimization levels are
2468 # not supported by the linker, so force the linker to use -O2 (
2469 # which doesn't influence the level compilation units are actually
2471 case " $MOZ_OPTIMIZE_FLAGS " in
2472 *\ -Os\ *|*\ -Oz\ *)
2473 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
2478 fi # COMPILE_ENVIRONMENT
2480 AC_SUBST_LIST(MOZ_FRAMEPTR_FLAGS)
2481 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
2482 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
2483 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
2485 dnl ========================================================
2486 dnl = Disable treating compiler warnings as errors
2487 dnl ========================================================
2488 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
2489 WARNINGS_AS_ERRORS=''
2492 dnl ========================================================
2493 dnl = Enable runtime logging
2494 dnl ========================================================
2495 AC_DEFINE(MOZ_LOGGING)
2496 AC_DEFINE(FORCE_PR_LOG)
2498 dnl ========================================================
2499 dnl = This will enable logging of addref, release, ctor, dtor.
2500 dnl ========================================================
2501 _ENABLE_LOGREFCNT=42
2502 MOZ_ARG_ENABLE_BOOL(logrefcnt,
2503 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
2504 _ENABLE_LOGREFCNT=1,
2505 _ENABLE_LOGREFCNT= )
2506 if test "$_ENABLE_LOGREFCNT" = "1"; then
2507 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
2508 elif test -z "$_ENABLE_LOGREFCNT"; then
2509 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
2512 dnl ========================================================
2513 dnl moz_dump_painting
2514 dnl ========================================================
2515 MOZ_ARG_ENABLE_BOOL(dump-painting,
2516 [ --enable-dump-painting Enable paint debugging.],
2517 MOZ_DUMP_PAINTING=1,
2518 MOZ_DUMP_PAINTING= )
2519 if test -n "$MOZ_DUMP_PAINTING"; then
2520 AC_DEFINE(MOZ_DUMP_PAINTING)
2521 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
2523 if test -n "$MOZ_DEBUG"; then
2524 AC_DEFINE(MOZ_DUMP_PAINTING)
2527 case "${OS_TARGET}" in
2528 Android|WINNT|Darwin)
2529 MOZ_GLUE_IN_PROGRAM=
2532 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
2533 MOZ_GLUE_IN_PROGRAM=1
2534 AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
2538 dnl ========================================================
2539 dnl = Jemalloc build setup
2540 dnl ========================================================
2541 if test -z "$MOZ_MEMORY"; then
2544 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
2545 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.])
2550 dnl The generic feature tests that determine how to compute ncpus are long and
2551 dnl complicated. Therefore, simply define special cpp variables for the
2552 dnl platforms we have special knowledge of.
2555 export MOZ_NO_DEBUG_RTL=1
2559 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
2561 dnl ========================================================
2562 dnl = Enable using the clang plugin to build
2563 dnl ========================================================
2565 if test -n "$COMPILE_ENVIRONMENT"; then
2566 MOZ_CONFIG_CLANG_PLUGIN
2567 fi # COMPILE_ENVIRONMENT
2569 dnl ========================================================
2570 dnl = Enable stripping of libs & executables
2571 dnl ========================================================
2572 MOZ_ARG_ENABLE_BOOL(strip,
2573 [ --enable-strip Enable stripping of libs & executables ],
2577 dnl ========================================================
2578 dnl = Enable stripping of libs & executables when packaging
2579 dnl ========================================================
2580 MOZ_ARG_ENABLE_BOOL(install-strip,
2581 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
2585 dnl ========================================================
2586 dnl = frontend JS debug mode
2587 dnl ========================================================
2589 MOZ_ARG_ENABLE_BOOL(debug-js-modules,
2590 [ --enable-debug-js-modules Enable debug mode for frontend JS libraries],
2594 AC_SUBST(DEBUG_JS_MODULES)
2596 dnl ========================================================
2598 dnl = Profiling and Instrumenting
2600 dnl ========================================================
2601 MOZ_ARG_HEADER(Profiling and Instrumenting)
2603 dnl ========================================================
2604 dnl = Offer a way to disable the startup cache
2605 dnl ========================================================
2607 MOZ_ARG_DISABLE_BOOL(startupcache,
2608 [ --disable-startupcache Disable startup cache ],
2609 MOZ_DISABLE_STARTUPCACHE=1,
2610 MOZ_DISABLE_STARTUPCACHE=)
2612 if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
2613 AC_DEFINE(MOZ_DISABLE_STARTUPCACHE)
2615 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
2617 dnl ========================================================
2618 dnl = Support for demangling undefined symbols
2619 dnl ========================================================
2620 if test -z "$SKIP_LIBRARY_CHECKS"; then
2623 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
2627 # Demangle only for debug or DMD builds
2628 MOZ_DEMANGLE_SYMBOLS=
2629 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
2630 MOZ_DEMANGLE_SYMBOLS=1
2631 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
2633 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
2635 dnl ========================================================
2636 dnl = Support for gcc stack unwinding (from gcc 3.3)
2637 dnl ========================================================
2638 if test -z "$SKIP_LIBRARY_CHECKS"; then
2641 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
2645 dnl ========================================================
2647 dnl ========================================================
2649 MOZ_ARG_WITH_STRING(jitreport-granularity,
2650 [ --jitreport-granularity=N
2651 Default granularity at which to report JIT code
2654 1 - code ranges for whole functions only
2655 2 - per-line information
2656 3 - per-op information],
2657 JITREPORT_GRANULARITY=$withval,
2658 JITREPORT_GRANULARITY=3)
2660 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
2662 dnl ========================================================
2666 dnl ========================================================
2667 MOZ_ARG_HEADER(Misc. Options)
2669 dnl ========================================================
2670 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
2671 dnl ========================================================
2672 MOZ_ARG_WITH_STRING(user-appdir,
2673 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
2674 [ val=`echo $withval`
2675 if echo "$val" | grep "\/" >/dev/null; then
2676 AC_MSG_ERROR("Homedir must be single relative path.")
2681 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
2683 if test -z "$SKIP_COMPILER_CHECKS"; then
2684 dnl ========================================================
2686 dnl = Compiler Options
2688 dnl ========================================================
2689 MOZ_ARG_HEADER(Compiler Options)
2691 dnl ========================================================
2692 dnl Check for gcc -pipe support
2693 dnl ========================================================
2694 AC_MSG_CHECKING([for -pipe support])
2695 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
2696 dnl Any gcc that supports firefox supports -pipe.
2697 CFLAGS="$CFLAGS -pipe"
2698 CXXFLAGS="$CXXFLAGS -pipe"
2699 AC_MSG_RESULT([yes])
2704 fi # ! SKIP_COMPILER_CHECKS
2706 AC_DEFINE(CPP_THROW_NEW, [throw()])
2709 if test "$COMPILE_ENVIRONMENT"; then
2711 fi # COMPILE_ENVIRONMENT
2713 dnl ========================================================
2715 dnl = Static Build Options
2717 dnl ========================================================
2718 MOZ_ARG_HEADER(Static build options)
2720 if test -z "$MOZ_SYSTEM_ZLIB"; then
2721 if test -n "$JS_SHARED_LIBRARY" -o -n "$MOZ_LINKER"; then
2723 AC_DEFINE(ZLIB_IN_MOZGLUE)
2727 AC_SUBST(ZLIB_IN_MOZGLUE)
2729 dnl ========================================================
2731 dnl = Standalone module options
2733 dnl ========================================================
2734 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
2737 dnl ========================================================
2739 if test -z "$SKIP_PATH_CHECKS"; then
2740 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
2741 if test "$MOZ_ENABLE_GTK" ; then
2742 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
2747 if test -z "${GLIB_GMODULE_LIBS}" \
2748 -a -n "${GLIB_CONFIG}"\
2749 -a "${GLIB_CONFIG}" != no\
2751 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
2754 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
2756 if test "$USE_FC_FREETYPE"; then
2757 if test "$COMPILE_ENVIRONMENT"; then
2758 dnl ========================================================
2759 dnl = Check for freetype2 functionality
2760 dnl ========================================================
2761 if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
2763 _SAVE_CFLAGS="$CFLAGS"
2764 LIBS="$LIBS $FT2_LIBS"
2765 CFLAGS="$CFLAGS $FT2_CFLAGS"
2767 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
2768 ac_cv_member_FT_Bitmap_Size_y_ppem,
2769 [AC_TRY_COMPILE([#include <ft2build.h>
2770 #include FT_FREETYPE_H],
2772 if (sizeof s.y_ppem) return 0;
2774 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
2775 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
2776 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
2777 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
2779 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
2781 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
2782 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
2783 [FT_Bitmap_Size structure includes y_ppem field])
2785 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
2788 CFLAGS="$_SAVE_CFLAGS"
2791 _SAVE_CPPFLAGS="$CPPFLAGS"
2792 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
2793 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
2794 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
2795 CPPFLAGS="$_SAVE_CPPFLAGS"
2799 dnl ========================================================
2800 dnl Check if we need the 32-bit Linux SSE2 error dialog
2801 dnl ========================================================
2803 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
2805 dnl ========================================================
2806 dnl Check for pixman and cairo
2807 dnl ========================================================
2810 MOZ_ARG_ENABLE_BOOL(system-cairo,
2811 [ --enable-system-cairo Obsolete: do not use this option],
2812 AC_MSG_ERROR(--enable-system-cairo is not supported),
2816 MOZ_ARG_ENABLE_BOOL(system-pixman,
2817 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
2819 MOZ_TREE_PIXMAN=force,
2822 if test "$MOZ_TREE_PIXMAN"; then
2823 AC_DEFINE(MOZ_TREE_PIXMAN)
2825 PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.19.2)
2828 MOZ_CAIRO_CFLAGS="-I${DIST}/include/cairo"
2829 AC_DEFINE(MOZ_TREE_CAIRO)
2831 if test "$OS_ARCH" = "WINNT"; then
2832 # For now we assume that we will have a uint64_t available through
2833 # one of the above headers or mozstdint.h.
2834 AC_DEFINE(HAVE_UINT64_T)
2837 # Define macros for cairo-features.h
2838 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
2839 if test "$MOZ_X11"; then
2840 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
2841 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
2842 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
2844 if test "$_HAVE_FREETYPE2"; then
2845 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2846 MOZ_ENABLE_CAIRO_FT=1
2847 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
2850 case "$MOZ_WIDGET_TOOLKIT" in
2852 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
2853 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
2854 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
2857 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
2858 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
2859 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
2861 if test "$COMPILE_ENVIRONMENT"; then
2862 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
2866 if test "$USE_FC_FREETYPE"; then
2867 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
2869 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
2870 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
2872 AC_SUBST(PS_SURFACE_FEATURE)
2873 AC_SUBST(SVG_SURFACE_FEATURE)
2874 AC_SUBST(XLIB_SURFACE_FEATURE)
2875 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
2876 AC_SUBST(QUARTZ_SURFACE_FEATURE)
2877 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
2878 AC_SUBST(WIN32_SURFACE_FEATURE)
2879 AC_SUBST(OS2_SURFACE_FEATURE)
2880 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
2881 AC_SUBST(FT_FONT_FEATURE)
2882 AC_SUBST(FC_FONT_FEATURE)
2883 AC_SUBST(WIN32_FONT_FEATURE)
2884 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
2885 AC_SUBST(QUARTZ_FONT_FEATURE)
2886 AC_SUBST(PNG_FUNCTIONS_FEATURE)
2887 AC_SUBST(QT_SURFACE_FEATURE)
2888 AC_SUBST(TEE_SURFACE_FEATURE)
2890 if test "$MOZ_X11"; then
2891 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
2894 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
2896 case "$MOZ_WIDGET_TOOLKIT" in
2898 TK_CFLAGS="$MOZ_CAIRO_CFLAGS $MOZ_PIXMAN_CFLAGS"
2899 TK_LIBS="$MOZ_CAIRO_LIBS $MOZ_PIXMAN_LIBS"
2903 AC_SUBST(MOZ_TREE_CAIRO)
2904 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
2905 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
2906 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
2907 AC_SUBST(MOZ_TREE_PIXMAN)
2909 BINDGEN_SYSTEM_FLAGS="$_BINDGEN_CFLAGS $NSPR_CFLAGS $NSS_CFLAGS $MOZ_PIXMAN_CFLAGS $MOZ_CAIRO_CFLAGS"
2910 AC_SUBST(BINDGEN_SYSTEM_FLAGS)
2911 BINDGEN_SYSTEM_TOML_FLAGS="$BINDGEN_SYSTEM_FLAGS"
2912 AC_SUBST_TOML_LIST(BINDGEN_SYSTEM_TOML_FLAGS)
2914 dnl ========================================================
2916 dnl ========================================================
2917 MOZ_ARG_DISABLE_BOOL(xul,
2918 [ --disable-xul Disable XUL],
2920 if test "$MOZ_XUL"; then
2923 dnl remove extensions that require XUL
2924 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
2929 dnl ========================================================
2930 dnl necko configuration options
2931 dnl ========================================================
2934 dnl option to disable necko's wifi scanner
2937 if test "$MOZ_WIDGET_TOOLKIT"; then
2939 case "$OS_TARGET" in
2941 if test -z "$MOZ_IOS"; then
2945 DragonFly|FreeBSD|WINNT)
2956 MOZ_ARG_DISABLE_BOOL(necko-wifi,
2957 [ --disable-necko-wifi Disable necko wifi scanner],
2961 if test "$NECKO_WIFI"; then
2962 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
2963 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
2965 AC_DEFINE(NECKO_WIFI)
2966 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
2968 AC_SUBST(NECKO_WIFI)
2969 AC_SUBST(NECKO_WIFI_DBUS)
2972 dnl option to disable cookies
2974 MOZ_ARG_DISABLE_BOOL(cookies,
2975 [ --disable-cookies Disable cookie support],
2978 AC_SUBST(NECKO_COOKIES)
2979 if test "$NECKO_COOKIES"; then
2980 AC_DEFINE(NECKO_COOKIES)
2981 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
2984 dnl ========================================================
2986 dnl = Maintainer debug option (no --enable equivalent)
2988 dnl ========================================================
2991 AC_SUBST_LIST(ASFLAGS)
2995 AC_SUBST(MOZ_AUTH_EXTENSION)
2996 AC_SUBST(MOZ_PREF_EXTENSIONS)
2997 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
2998 AC_SUBST(WARNINGS_AS_ERRORS)
2999 AC_SUBST_LIST(WARNINGS_CFLAGS)
3000 AC_SUBST_SET(MOZ_EXTENSIONS)
3001 AC_SUBST(MOZ_TOOLKIT_SEARCH)
3003 AC_SUBST(MOZ_UNIVERSALCHARDET)
3004 AC_SUBST(MOZ_SPELLCHECK)
3005 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
3006 AC_SUBST(MOZ_CRASHREPORTER)
3007 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
3008 AC_SUBST(MOZ_STUB_INSTALLER)
3009 AC_SUBST(MOZ_ENABLE_SIGNMAR)
3010 AC_SUBST(MOZ_UPDATER)
3012 AC_SUBST(MOZ_ANDROID_APPLICATION_CLASS)
3013 AC_SUBST(MOZ_ANDROID_BROWSER_INTENT_CLASS)
3014 AC_SUBST(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
3015 AC_SUBST(ENABLE_STRIP)
3016 AC_SUBST(PKG_SKIP_STRIP)
3017 AC_SUBST(STRIP_FLAGS)
3018 AC_SUBST(INCREMENTAL_LINKER)
3020 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
3022 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
3023 AC_SUBST(MOZ_LINKER_EXTRACT)
3025 if test -n "$MOZ_BINARY_EXTENSIONS"; then
3026 AC_DEFINE(MOZ_BINARY_EXTENSIONS)
3029 AC_SUBST(MOZ_REQUIRE_SIGNING)
3030 if test "$MOZ_REQUIRE_SIGNING" = 1; then
3031 AC_DEFINE(MOZ_REQUIRE_SIGNING)
3034 dnl ========================================================
3035 dnl = Mac bundle name prefix
3036 dnl ========================================================
3037 MOZ_ARG_WITH_STRING(macbundlename-prefix,
3038 [ --with-macbundlename-prefix=prefix
3039 Prefix for MOZ_MACBUNDLE_NAME],
3040 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
3042 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
3043 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
3044 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
3047 if test "$MOZ_DEBUG"; then
3048 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
3050 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
3052 AC_SUBST(MOZ_MACBUNDLE_NAME)
3054 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
3055 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
3056 # Otherwise, use MOZ_APP_DISPLAYNAME
3057 if test -z "$MOZ_MACBUNDLE_ID"; then
3058 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
3060 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
3061 if test "$MOZ_DEBUG"; then
3062 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
3065 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
3066 AC_SUBST(MOZ_MACBUNDLE_ID)
3068 dnl ========================================================
3069 dnl = Child Process Name for IPC
3070 dnl ========================================================
3071 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
3072 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
3074 # We want to let Android unpack the file at install time, but it only does
3075 # so if the file is named libsomething.so. The lib/ path is also required
3076 # because the unpacked file will be under the lib/ subdirectory and will
3077 # need to be executed from that path.
3078 MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
3080 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
3081 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
3083 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
3084 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
3085 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
3087 # The following variables are available to branding and application
3088 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
3089 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
3090 # impacts profile location and user-visible fields.
3091 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
3092 # versions of a given application (e.g. Aurora and Firefox both use
3093 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
3094 # for application.ini's "Name" field, which controls profile location in
3095 # the absence of a "Profile" field (see below), and various system
3096 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
3097 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
3098 # Mac Bundle name, Updater, Installer), it is typically used for nightly
3099 # builds (e.g. Aurora for Firefox).
3100 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
3101 # defaults to a lowercase form of MOZ_APP_BASENAME.
3102 # - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
3103 # profile name and remoting. If not set, defaults to MOZ_APP_NAME.
3104 # - MOZ_APP_PROFILE: When set, used for application.ini's
3105 # "Profile" field, which controls profile location.
3106 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
3107 # crash reporter server url.
3108 # - MOZ_APP_ANDROID_VERSION_CODE: On Android, "android:versionCode" for
3109 # the main application is set to the value of this variable. If not
3110 # set, it falls back to a Mozilla-specific value derived from the
3112 # - MOZ_ANDROID_SHARED_ID: On Android, "android:sharedUserId" for all Android
3113 # packages produced.
3114 # - MOZ_ANDROID_GCM_SENDERID: On Android, the Android GCM Sender ID used. GCM
3115 # sender IDs are not sensitive: see, http://stackoverflow.com/a/18216063.
3116 # - MOZ_MMA_GCM_SENDERID: This GCM Sender ID is used for MMA integration.
3117 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
3119 # The following environment variables used to have an effect, but don't anymore:
3120 # - MOZ_APP_VERSION: Defines the application version number. This was replaced with
3121 # the contents from the version.txt file in the application directory, or
3122 # browser/config/version.txt if there isn't one.
3123 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
3124 # in the "About" window. This was replaced with the contents from the
3125 # version_display.txt or version.txt in the application directory, or
3126 # browser/config/version_display.txt.
3128 if test -z "$MOZ_APP_NAME"; then
3129 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
3132 if test -z "$MOZ_APP_REMOTINGNAME"; then
3133 MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
3136 if test -z "$ANDROID_PACKAGE_NAME" ; then
3137 # When we got rid of the Aurora channel we decided to replace the old
3138 # Nightly ANDROID_PACKAGE_NAME with Aurora. To make sure this is inherited
3139 # by all mozilla-central based branches we make this the new "default"
3140 # for Fennec. Non mozilla-central based branches set ANDROID_PACKAGE_NAME
3141 # in their mozconfig, so they will never get this. If there are ever
3142 # non-Fennec builds for Android, they will fall into the else block
3143 # and use their own default name.
3144 # https://bugzilla.mozilla.org/show_bug.cgi?id=1357808 has additional
3145 # background on this.
3146 if test "$MOZ_APP_NAME" = "fennec"; then
3147 ANDROID_PACKAGE_NAME="org.mozilla.fennec_aurora"
3149 ANDROID_PACKAGE_NAME="org.mozilla.$MOZ_APP_NAME"
3153 # Mozilla released Firefox for Android {Release,Beta} and {Aurora,Nightly} to
3154 # the public with specific common shared IDs and we need to keep them
3155 # consistent forever. The specific common values are set by per-channel
3156 # branding; all other channels use a generic sharedID, set below.
3157 if test -z "$MOZ_ANDROID_SHARED_ID" ; then
3158 MOZ_ANDROID_SHARED_ID="${ANDROID_PACKAGE_NAME}.sharedID"
3161 # For extensions and langpacks, we require a max version that is compatible
3162 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
3163 # 24.0a1 and 24.0a2 aren't affected
3165 # 24.1.1 becomes 24.*
3166 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
3167 if test -z "$IS_ALPHA"; then
3169 if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
3170 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
3172 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
3176 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
3179 AC_SUBST(MOZ_APP_NAME)
3180 AC_SUBST(MOZ_APP_REMOTINGNAME)
3181 AC_SUBST(MOZ_APP_DISPLAYNAME)
3182 AC_SUBST(MOZ_APP_BASENAME)
3183 AC_SUBST(MOZ_APP_VENDOR)
3184 AC_SUBST(MOZ_APP_PROFILE)
3185 AC_SUBST(MOZ_APP_ID)
3186 AC_SUBST(MOZ_APP_ANDROID_VERSION_CODE)
3187 AC_SUBST(MOZ_ANDROID_SHARED_ID)
3188 AC_SUBST(MOZ_ANDROID_GCM_SENDERID)
3189 AC_SUBST(MOZ_MMA_GCM_SENDERID)
3190 AC_SUBST(MAR_CHANNEL_ID)
3191 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
3192 AC_SUBST(MOZ_PROFILE_MIGRATOR)
3193 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
3194 AC_SUBST(MOZ_APP_UA_NAME)
3195 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
3196 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
3197 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
3199 AC_SUBST(MOZ_APP_MAXVERSION)
3200 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
3201 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
3202 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
3205 AC_SUBST(MOZ_PKG_SPECIAL)
3206 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
3208 if test "$MOZILLA_OFFICIAL"; then
3209 # Build revisions should always be present in official builds
3210 MOZ_INCLUDE_SOURCE_INFO=1
3213 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
3214 # explicitly set the repository and changeset information in.
3215 AC_SUBST(MOZ_SOURCE_REPO)
3216 AC_SUBST(MOZ_SOURCE_CHANGESET)
3217 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
3219 if test "$MOZ_TELEMETRY_REPORTING"; then
3220 AC_DEFINE(MOZ_TELEMETRY_REPORTING)
3222 # Enable Telemetry by default for nightly and aurora channels
3223 if test -z "$RELEASE_OR_BETA"; then
3224 AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
3228 dnl If we have any service that uploads data (and requires data submission
3229 dnl policy alert), set MOZ_DATA_REPORTING.
3230 dnl We need SUBST for build system and DEFINE for xul preprocessor.
3231 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
3232 MOZ_DATA_REPORTING=1
3233 AC_DEFINE(MOZ_DATA_REPORTING)
3234 AC_SUBST(MOZ_DATA_REPORTING)
3238 AC_SUBST(WIN32_REDIST_DIR)
3239 AC_SUBST(WIN_UCRT_REDIST_DIR)
3241 dnl ========================================================
3243 dnl ========================================================
3247 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
3253 dnl Echo the CFLAGS to remove extra whitespace.
3255 $_COMPILATION_CFLAGS \
3259 $_WARNINGS_CXXFLAGS \
3260 $_COMPILATION_CXXFLAGS \
3263 COMPILE_CFLAGS=`echo \
3267 COMPILE_CXXFLAGS=`echo \
3268 $_DEFINES_CXXFLAGS \
3272 $_WARNINGS_HOST_CFLAGS \
3273 $_COMPILATION_HOST_CFLAGS \
3276 HOST_CXXFLAGS=`echo \
3277 $_WARNINGS_HOST_CXXFLAGS \
3278 $_COMPILATION_HOST_CXXFLAGS \
3281 AC_SUBST(MOZ_SYSTEM_PNG)
3283 AC_SUBST_LIST(MOZ_PNG_CFLAGS)
3284 AC_SUBST_LIST(MOZ_PNG_LIBS)
3286 AC_SUBST(MOZ_SYSTEM_NSPR)
3288 AC_SUBST(MOZ_SYSTEM_NSS)
3290 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
3291 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
3292 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
3293 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
3294 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
3295 OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
3296 OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
3298 AC_SUBST(HOST_CMFLAGS)
3299 AC_SUBST(HOST_CMMFLAGS)
3300 AC_SUBST(OS_COMPILE_CMFLAGS)
3301 AC_SUBST(OS_COMPILE_CMMFLAGS)
3304 OS_CXXFLAGS="$CXXFLAGS"
3305 OS_CPPFLAGS="$CPPFLAGS"
3306 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
3307 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
3308 OS_LDFLAGS="$LDFLAGS"
3310 AC_SUBST_LIST(OS_CFLAGS)
3311 AC_SUBST_LIST(OS_CXXFLAGS)
3312 AC_SUBST_LIST(OS_CPPFLAGS)
3313 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
3314 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
3315 AC_SUBST_LIST(OS_LDFLAGS)
3320 AC_SUBST_LIST(HOST_CFLAGS)
3321 AC_SUBST_LIST(HOST_CPPFLAGS)
3322 AC_SUBST_LIST(HOST_CXXFLAGS)
3323 AC_SUBST(HOST_LDFLAGS)
3324 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
3325 AC_SUBST(HOST_BIN_SUFFIX)
3327 AC_SUBST(TARGET_XPCOM_ABI)
3328 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
3329 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
3330 AC_SUBST(HAVE_X86_AVX2)
3331 AC_SUBST(HAVE_ALTIVEC)
3333 AC_SUBST_LIST(DSO_CFLAGS)
3334 AC_SUBST_LIST(DSO_PIC_CFLAGS)
3335 AC_SUBST(DSO_LDOPTS)
3336 AC_SUBST(BIN_SUFFIX)
3338 AC_SUBST(NS_ENABLE_TSF)
3339 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
3340 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
3342 AC_SUBST(MOZ_DEVTOOLS)
3344 AC_SUBST(MOZ_PACKAGE_JSSHELL)
3345 AC_SUBST(MOZ_FOLD_LIBS)
3346 AC_SUBST_LIST(MOZ_FOLD_LIBS_FLAGS)
3350 dnl Host JavaScript runtime, if any, to use during cross compiles.
3353 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
3355 if test -n "$COMPILE_ENVIRONMENT"; then
3356 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
3358 dnl Check for missing components
3359 if test "$MOZ_X11"; then
3360 dnl ====================================================
3361 dnl = Check if X headers exist
3362 dnl ====================================================
3363 _SAVE_CFLAGS=$CFLAGS
3364 CFLAGS="$CFLAGS $XCFLAGS"
3368 #include <X11/Xlib.h>
3369 #include <X11/Intrinsic.h>
3370 #include <X11/extensions/XShm.h>
3374 if ((dpy = XOpenDisplay(NULL)) == NULL) {
3375 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
3379 [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
3380 CFLAGS="$_SAVE_CFLAGS"
3382 if test -n "$MISSING_X"; then
3383 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
3388 fi # COMPILE_ENVIRONMENT
3390 dnl Set various defines and substitutions
3391 dnl ========================================================
3393 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
3394 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
3395 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
3396 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
3397 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
3398 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
3399 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
3400 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
3401 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
3404 AC_SUBST(MOZ_DEV_EDITION)
3405 if test -n "$MOZ_DEV_EDITION"; then
3406 AC_DEFINE(MOZ_DEV_EDITION)
3409 if test "$MOZ_DEBUG" -o "$DEVELOPER_OPTIONS"; then
3413 if test -n "$A11Y_LOG"; then
3417 dnl Spit out some output
3418 dnl ========================================================
3420 dnl The following defines are used by xpcom
3421 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
3434 # Avoid using obsolete NSPR features
3435 AC_DEFINE(NO_NSPR_10_SUPPORT)
3437 MOZ_CREATE_CONFIG_STATUS()
3439 rm -fr confdefs* $ac_clean_files