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 # C5038: Enable initializer list order warnings
172 # The -w1#### flag treats warning C#### as if it was a warning level
173 # 1 warning, and thus enables it because we enable /W3 warnings. We
174 # don't use -we#### because it would enable warning C#### but treat
175 # it as an error, even in third-party code.
176 # https://docs.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level
177 CXXFLAGS="$CXXFLAGS -w15038"
179 # C5026: move constructor was implicitly defined as deleted
180 CXXFLAGS="$CXXFLAGS -wd5026"
182 # C5027: move assignment operator was implicitly defined as deleted
183 CXXFLAGS="$CXXFLAGS -wd5027"
185 # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
186 CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
188 # https://connect.microsoft.com/VisualStudio/feedback/details/888527/warnings-on-dbghelp-h
189 # for dbghelp.h, imagehlp.h, and shobj.h
190 # C4091: 'typedef ': ignored on left of '' when no variable is declared
191 CFLAGS="$CFLAGS -wd4091"
192 CXXFLAGS="$CXXFLAGS -wd4091"
194 # This is intended as a temporary hack to support building with VS2015.
195 # 'noexcept' used with no exception handling mode specified;
196 # termination on exception is not guaranteed. Specify /EHsc
197 CXXFLAGS="$CXXFLAGS -wd4577"
199 if test -n "$WIN_UCRT_REDIST_DIR"; then
200 if test ! -d "$WIN_UCRT_REDIST_DIR"; then
201 AC_MSG_ERROR([Invalid Windows UCRT Redist directory: ${WIN_UCRT_REDIST_DIR}])
203 WIN_UCRT_REDIST_DIR=`cd "$WIN_UCRT_REDIST_DIR" && pwd -W`
206 AC_SUBST(MSVC_C_RUNTIME_DLL)
207 AC_SUBST(MSVC_CXX_RUNTIME_DLL)
209 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
211 if test -n "$WIN32_REDIST_DIR"; then
212 if test ! -d "$WIN32_REDIST_DIR"; then
213 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
215 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd -W`
218 # Check linker version, except in lld builds
223 _LD_FULL_VERSION=`"${LINKER}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
224 _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
225 if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
226 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
233 unset _MSVC_VER_FILTER
236 STL_FLAGS="-I${DIST}/stl_wrappers"
237 CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
238 CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
240 # Check w32api version
241 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
242 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
243 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
244 AC_TRY_COMPILE([#include <w32api.h>],
245 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
246 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
247 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
248 #error "test failed."
250 , [ res=yes ], [ res=no ])
251 AC_MSG_RESULT([$res])
252 if test "$res" != "yes"; then
253 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
255 # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
256 # causing problems with local implementations with the same name.
257 AC_DEFINE(STRSAFE_NO_DEPRECATE)
260 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
261 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
262 # Require OS features provided by IE 8.0 (Win7)
263 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0800)
268 if test -n "$_WIN32_MSVC"; then
270 SKIP_COMPILER_CHECKS=1
271 SKIP_LIBRARY_CHECKS=1
273 # Since we're skipping compiler and library checks, hard-code
276 AC_DEFINE(HAVE_ISATTY)
279 fi # COMPILE_ENVIRONMENT
284 AC_SUBST_LIST(STL_FLAGS)
285 AC_SUBST(WRAP_STL_INCLUDES)
287 dnl ========================================================
288 dnl Checks for programs.
289 dnl ========================================================
290 if test "$COMPILE_ENVIRONMENT"; then
296 fi # COMPILE_ENVIRONMENT
298 dnl ========================================================
299 dnl set the defaults first
300 dnl ========================================================
301 MOZ_USER_DIR=".mozilla"
303 MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
307 dnl Configure platform-specific CPU architecture compiler options.
308 dnl ==============================================================
309 if test "$COMPILE_ENVIRONMENT"; then
312 if test "$OS_TARGET" = Android; then
313 dnl Default Android builds to ARMv7.
316 fi # COMPILE_ENVIRONMENT
318 dnl ========================================================
319 dnl Android libstdc++, placed here so it can use MOZ_ARCH
321 dnl ========================================================
324 if test "$COMPILE_ENVIRONMENT"; then
326 fi # COMPILE_ENVIRONMENT
328 dnl ========================================================
329 dnl Suppress Clang Argument Warnings
330 dnl ========================================================
331 WARNINGS_CFLAGS="$_WARNINGS_CFLAGS"
332 if test -n "${CLANG_CC}${CLANG_CL}"; then
333 WARNINGS_CFLAGS="-Qunused-arguments $WARNINGS_CFLAGS"
334 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
336 if test -n "${CLANG_CXX}${CLANG_CL}"; then
337 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
340 if test -n "$COMPILE_ENVIRONMENT"; then
344 dnl ========================================================
345 dnl Add optional and non-optional hardening flags
346 dnl ========================================================
348 CFLAGS="$CFLAGS $MOZ_HARDENING_CFLAGS"
349 CPPFLAGS="$CPPFLAGS $MOZ_HARDENING_CFLAGS"
350 CXXFLAGS="$CXXFLAGS $MOZ_HARDENING_CFLAGS"
351 LDFLAGS="$LDFLAGS $MOZ_HARDENING_LDFLAGS"
353 dnl ========================================================
354 dnl GNU specific defaults
355 dnl ========================================================
356 if test "$GNU_CC"; then
360 SSSE3_FLAGS="-mssse3"
361 # FIXME: Let us build with strict aliasing. bug 414641.
362 CFLAGS="$CFLAGS -fno-strict-aliasing"
363 WARNINGS_AS_ERRORS='-Werror'
366 if test "$OS_ARCH" != "WINNT" -o -z "$CLANG_CC"; then
367 DSO_PIC_CFLAGS='-fPIC'
368 ASFLAGS="$ASFLAGS -fPIC"
371 AC_MSG_CHECKING([for --noexecstack option to as])
373 CFLAGS="$CFLAGS -Wa,--noexecstack"
374 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
375 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
378 AC_MSG_CHECKING([for -z noexecstack option to ld])
379 _SAVE_LDFLAGS=$LDFLAGS
380 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
381 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
383 LDFLAGS=$_SAVE_LDFLAGS)
385 AC_MSG_CHECKING([for -z text option to ld])
386 _SAVE_LDFLAGS=$LDFLAGS
387 LDFLAGS="$LDFLAGS -Wl,-z,text"
388 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
390 LDFLAGS=$_SAVE_LDFLAGS)
392 AC_MSG_CHECKING([for -z relro option to ld])
393 _SAVE_LDFLAGS=$LDFLAGS
394 LDFLAGS="$LDFLAGS -Wl,-z,relro"
395 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
397 LDFLAGS=$_SAVE_LDFLAGS)
399 AC_MSG_CHECKING([for -z nocopyreloc option to ld])
400 _SAVE_LDFLAGS=$LDFLAGS
401 LDFLAGS="$LDFLAGS -Wl,-z,nocopyreloc"
402 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
404 LDFLAGS=$_SAVE_LDFLAGS)
406 AC_MSG_CHECKING([for -Bsymbolic-functions option to ld])
407 _SAVE_LDFLAGS=$LDFLAGS
408 LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
409 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
411 LDFLAGS=$_SAVE_LDFLAGS)
413 AC_MSG_CHECKING([for --build-id=sha1 option to ld])
414 _SAVE_LDFLAGS=$LDFLAGS
415 LDFLAGS="$LDFLAGS -Wl,--build-id=sha1"
416 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
418 LDFLAGS=$_SAVE_LDFLAGS)
420 AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
421 HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
422 _SAVE_LDFLAGS=$LDFLAGS
423 LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
424 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
425 [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
427 LDFLAGS=$_SAVE_LDFLAGS
429 # Check for -mssse3 on $CC
430 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
431 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
433 CFLAGS="$CFLAGS -mssse3"
434 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
435 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
439 # Check for -msse4.1 on $CC
440 AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
441 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
443 CFLAGS="$CFLAGS -msse4.1"
444 AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
445 [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
449 case "${CPU_ARCH}" in
451 AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
453 [asm volatile ("vpermq \$0xd8,%ymm0,%ymm0 \n");],
454 result="yes", result="no")
455 AC_MSG_RESULT("$result")
456 if test "$result" = "yes"; then
462 AC_MSG_CHECKING([whether we can enable AltiVec support])
465 CFLAGS="$CFLAGS -maltivec"
466 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
474 if test "$GCC_USE_GNU_LD"; then
475 # Some tools like ASan use a runtime library that is only
476 # linked against executables, so we must allow undefined
477 # symbols for shared objects in some cases.
478 if test -z "$MOZ_ASAN$MOZ_MSAN$MOZ_UBSAN$MOZ_TSAN$FUZZING_INTERFACES"; then
479 # Don't allow undefined symbols in libraries
480 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
482 # BSDs need `environ' exposed for posix_spawn (bug 753046)
484 DragonFly|FreeBSD|NetBSD|OpenBSD)
485 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
486 DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
488 DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
495 _DEFINES_CFLAGS="-include $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
496 _USE_CPP_INCLUDE_FLAG=1
498 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
501 if test "$GNU_CXX"; then
502 # FIXME: Let us build with strict aliasing. bug 414641.
503 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
505 _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
506 _USE_CPP_INCLUDE_FLAG=1
509 # For profiling builds keep the symbol information
510 if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
512 Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
513 STRIP_FLAGS="--strip-debug"
518 dnl ========================================================
520 dnl ========================================================
522 if test "$MOZ_DMD"; then
523 if test "${CPU_ARCH}" = "arm"; then
524 CFLAGS="$CFLAGS -funwind-tables"
525 CXXFLAGS="$CXXFLAGS -funwind-tables"
529 dnl ========================================================
530 dnl System overrides of the defaults for host
531 dnl ========================================================
534 if test -n "$_WIN32_MSVC"; then
535 HOST_CFLAGS="$HOST_CFLAGS -nologo"
537 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
539 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
540 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
543 case "${host_cpu}" in
545 if test -n "$_WIN32_MSVC"; then
546 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
550 if test -n "$_WIN32_MSVC"; then
551 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
553 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
559 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
560 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
563 *-linux*|*-kfreebsd*-gnu|*-gnu*)
564 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
565 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
569 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
570 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
574 dnl ========================================================
575 dnl System overrides of the defaults for target
576 dnl ========================================================
580 MOZ_OPTIMIZE_FLAGS="-O3"
581 CXXFLAGS="$CXXFLAGS -stdlib=libc++"
583 STRIP_FLAGS="$STRIP_FLAGS -x -S"
584 # Ensure that if we're targeting iOS an SDK was provided.
585 AC_CACHE_CHECK(for iOS target,
587 [AC_TRY_COMPILE([#include <TargetConditionals.h>
588 #if !(TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
592 ac_cv_ios_target="yes",
593 ac_cv_ios_target="no")])
594 if test "$ac_cv_ios_target" = "yes" -a -z $MOZ_IOS; then
595 AC_MSG_ERROR([targeting iOS but not using an iOS SDK?])
597 if test -z "$MOZ_IOS"; then
598 # The ExceptionHandling framework is needed for Objective-C exception
599 # logging code in nsObjCExceptions.h. Currently we only use that in debug
601 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -framework ExceptionHandling";
604 dnl DTrace and -dead_strip don't interact well. See bug 403132.
605 dnl ===================================================================
606 if test "x$enable_dtrace" = "xyes"; then
607 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
609 dnl check for the presence of the -dead_strip linker flag
610 AC_MSG_CHECKING([for -dead_strip option to ld])
611 _SAVE_LDFLAGS=$LDFLAGS
612 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
613 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
614 if test -n "$_HAVE_DEAD_STRIP" ; then
616 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
621 LDFLAGS=$_SAVE_LDFLAGS
624 MOZ_FIX_LINK_PATHS="-Wl,-executable_path,${DIST}/bin"
627 *-android*|*-linuxandroid*)
628 AC_DEFINE(NO_PW_GECOS)
630 if test "$COMPILE_ENVIRONMENT"; then
634 MOZ_GFX_OPTIMIZE_MOBILE=1
635 if test -z "$CLANG_CC"; then
636 MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
638 # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
639 # -Oz is smaller than -Os on clang.
640 MOZ_OPTIMIZE_FLAGS="-Oz"
641 # Disable the outliner, which causes performance regressions, and is
642 # enabled on some platforms at -Oz.
643 if test -z "$MOZ_LTO"; then
644 DISABLE_OUTLINER="-mno-outline"
646 CFLAGS="$CFLAGS $DISABLE_OUTLINER"
647 AC_TRY_COMPILE(,,[MOZ_OPTIMIZE_FLAGS="$MOZ_OPTIMIZE_FLAGS $DISABLE_OUTLINER"])
648 CFLAGS="$_SAVE_CFLAGS"
650 DISABLE_OUTLINER="-Wl,-plugin-opt=-enable-machine-outliner=never"
651 _SAVE_LDFLAGS=$LDFLAGS
652 LDFLAGS="$LDFLAGS $MOZ_LTO_LDFLAGS $DISABLE_OUTLINER"
653 AC_TRY_LINK(,,[MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS $DISABLE_OUTLINER"])
654 LDFLAGS="$_SAVE_LDFLAGS"
660 if test "$GNU_CC" -o "$GNU_CXX"; then
661 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
662 if test -n "$MOZ_DEBUG"; then
663 MOZ_OPTIMIZE_FLAGS="-Os"
665 MOZ_OPTIMIZE_FLAGS="-O2"
667 if test -z "$CLANG_CC"; then
668 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
672 case "${target_cpu}" in
674 CFLAGS="$CFLAGS -mieee"
675 CXXFLAGS="$CXXFLAGS -mieee"
682 # certain versions of cygwin's makedepend barf on the
683 # #include <string> vs -I./dist/include/string issue so don't use it
684 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
688 CFLAGS="$CFLAGS -mms-bitfields"
689 CXXFLAGS="$CXXFLAGS -mms-bitfields"
691 # Use temp file for windres (bug 213281)
692 RCFLAGS='-O coff --use-temp-file'
693 # mingw doesn't require kernel32, user32, and advapi32 explicitly
694 LIBS="$LIBS -luuid -lusp10 -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
697 MOZ_OPTIMIZE_FLAGS="-O1"
699 WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
700 WIN32_GUI_EXE_LDFLAGS=-mwindows
702 if test -z "$CLANG_CC"; then
703 # Use static libgcc and libstdc++
704 LDFLAGS="$LDFLAGS -static"
706 # GCC/binutils can't link to a function if we try to include dllexport function
707 # in the same library as dllimport caller. To work around it, we build NSPR
708 # and NSS with -mnop-fun-dllimport flag. The drawback of this solution is that
709 # function thunks need to be generated for cross-DLL calls.
710 MOZ_FOLD_LIBS_FLAGS="-mnop-fun-dllimport"
712 # Silence problematic clang warnings
713 CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
716 TARGET_COMPILER_ABI=msvc
717 RANLIB='echo not_ranlib'
718 STRIP='echo not_strip'
720 # aarch64 doesn't support subsystems below 6.02
721 if test "$CPU_ARCH" = "aarch64"; then
722 WIN32_SUBSYSTEM_VERSION=6.02
724 WIN32_SUBSYSTEM_VERSION=6.01
726 WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
727 WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
728 DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
729 _USE_CPP_INCLUDE_FLAG=1
730 _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
731 _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
732 CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
733 CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
734 if test -z "$CLANG_CL"; then
735 CPPFLAGS="$CPPFLAGS -utf-8"
737 if test "$CPU_ARCH" = "x86"; then
738 dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
739 dnl more recent, so set that explicitly here unless another
740 dnl target arch has already been set.
742 if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
743 CFLAGS="$CFLAGS -arch:SSE2"
745 if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
746 CXXFLAGS="$CXXFLAGS -arch:SSE2"
749 SSE_FLAGS="-arch:SSE"
750 SSE2_FLAGS="-arch:SSE2"
751 dnl MSVC allows the use of intrinsics without any flags
752 dnl and doesn't have a separate arch for SSSE3
753 SSSE3_FLAGS="-arch:SSE2"
755 dnl clang-cl requires appropriate flags to enable SSSE3 support
756 dnl on all architectures.
757 if test -n "$CLANG_CL"; then
758 SSSE3_FLAGS="-mssse3"
760 dnl VS2013+ supports -Gw for better linker optimizations.
761 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
762 dnl Disabled on ASan because it causes false-positive ODR violations.
763 if test -z "$MOZ_ASAN"; then
765 CXXFLAGS="$CXXFLAGS -Gw"
767 # String tail merging doesn't play nice with ASan's ODR checker.
768 LDFLAGS="$LDFLAGS -opt:nolldtailmerge"
770 # khuey says we can safely ignore MSVC warning C4251
771 # MSVC warning C4244 (implicit type conversion may lose data) warns
772 # and requires workarounds for perfectly valid code. Also, GCC/clang
773 # don't warn about it by default. So for consistency/sanity, we turn
774 # it off on MSVC, too.
775 # MSVC warning C4267 warns for narrowing type conversions from size_t
776 # to 32-bit integer types on 64-bit platforms. Since this is virtually
777 # the same thing as C4244, we disable C4267, too.
778 # MSVC warning C4800 warns when a value is implicitly cast to bool,
779 # because this also forces narrowing to a single byte, which can be a
780 # perf hit. But this matters so little in practice (and often we want
781 # that behavior) that it's better to turn it off.
782 # MSVC warning C4595 warns non-member operator new or delete functions
783 # may not be declared inline, as of VS2015 Update 2.
784 CFLAGS="$CFLAGS -wd4244 -wd4267"
785 CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4267 -wd4800 -wd4595"
786 # Silence "warning C4065: switch statement contains 'default' but no
787 # 'case' labels". See bug 1461304.
788 CXXFLAGS="$CXXFLAGS -wd4065"
789 if test -n "$CLANG_CL"; then
790 # XXX We should combine some of these with our generic GCC-style
793 # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
794 CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
795 # We use offsetof on non-POD objects all the time.
796 # We also suppress this warning on other platforms.
797 CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
798 # This warns for reasonable things like:
799 # enum { X = 0xffffffffU };
800 # which is annoying for IDL headers.
801 CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
802 # This warns for cases that would be reached by the Microsoft
803 # #include rules, but also currently warns on cases that would
804 # *also* be reached by standard C++ include rules. That
805 # behavior doesn't seem useful, so we turn it off.
806 CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
807 # We normally error out on unknown pragmas, but since clang-cl
808 # claims to be MSVC, it would be difficult to add
809 # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
810 # use such pragmas, so just ignore them.
811 CFLAGS="$CFLAGS -Wno-unknown-pragmas"
812 CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
813 # We get errors about various #pragma intrinsic directives from
814 # clang-cl, and we don't need to hear about those.
815 CFLAGS="$CFLAGS -Wno-ignored-pragmas"
816 CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
817 # clang-cl's Intrin.h marks things like _ReadWriteBarrier
818 # as __attribute((__deprecated__)). This is nice to know,
819 # but since we don't get the equivalent warning from MSVC,
820 # let's just ignore it.
821 CFLAGS="$CFLAGS -Wno-deprecated-declarations"
822 CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
823 # We use a function like:
824 # __declspec(noreturn) __inline void f() {}
825 # which -Winvalid-noreturn complains about. Again, MSVC seems
826 # OK with it, so let's silence the warning.
827 CFLAGS="$CFLAGS -Wno-invalid-noreturn"
828 CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
829 # Missing |override| on virtual function declarations isn't
830 # something that MSVC currently warns about.
831 CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
832 # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
833 # declaration on |operator delete(void*)|. However, clang-cl
834 # must internally declare |operator delete(void*)| differently,
835 # which causes this warning for virtually every file in the
836 # tree. clang-cl doesn't support -fno-exceptions or equivalent,
837 # so there doesn't seem to be any way to convince clang-cl to
838 # declare |delete| differently. Therefore, suppress this
840 CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
841 # At least one MSVC header and several headers in-tree have
842 # unused typedefs, so turn this on.
843 CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
844 # jemalloc uses __declspec(allocator) as a profiler hint,
845 # which clang-cl doesn't understand.
846 CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
847 # __attribute__((unused)) really means "might be unused" and
848 # we use it to avoid warnings about things that are unused
849 # in some compilation units, but used in many others. This
850 # warning insists on complaining about the latter case, which
851 # is annoying, and rather noisy.
852 CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused"
854 # make 'foo == bar;' error out
855 CFLAGS="$CFLAGS -we4553"
856 CXXFLAGS="$CXXFLAGS -we4553"
857 # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
858 CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
859 LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
860 MOZ_DEBUG_LDFLAGS='-DEBUG'
861 WARNINGS_AS_ERRORS='-WX'
862 # Use a higher optimization level for clang-cl, so we can come closer
863 # to MSVC's performance numbers (see bug 1443590).
864 if test -n "$CLANG_CL"; then
865 MOZ_OPTIMIZE_FLAGS='-O2'
867 MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
870 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE"
871 if test -z "$DEVELOPER_OPTIONS"; then
872 LDFLAGS="$LDFLAGS -RELEASE"
875 dnl Minimum reqiurement of Gecko is VS2015 or later which supports
876 dnl both SSSE3 and SSE4.1.
877 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
878 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
879 dnl allow AVX2 code from VS2015
882 AC_DEFINE(WIN32_LEAN_AND_MEAN)
883 dnl See http://support.microsoft.com/kb/143208 to use STL
886 MOZ_USER_DIR="Mozilla"
890 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.])
894 if test -n "$GNU_CC" -a -z "$CLANG_CC"; then
895 CFLAGS="$CFLAGS -fno-keep-inline-dllexport"
896 CXXFLAGS="$CXXFLAGS -fno-keep-inline-dllexport"
901 if test -n "$GNU_CC"; then
902 CFLAGS="$CFLAGS -mstackrealign"
903 CXXFLAGS="$CXXFLAGS -mstackrealign"
904 LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
905 if test -z "$CLANG_CC"; then
906 LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup"
909 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
910 LDFLAGS="$LDFLAGS -SAFESEH"
916 if test -n "$_WIN32_MSVC"; then
917 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
922 if test -n "$_WIN32_MSVC"; then
923 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:ARM64"
928 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
935 CFLAGS="$CFLAGS -Dunix"
936 CXXFLAGS="$CXXFLAGS -Dunix"
937 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
938 DSO_PIC_CFLAGS='-fPIC -DPIC'
940 MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
942 DSO_PIC_CFLAGS='-fPIC -DPIC'
945 # This will fail on a.out systems prior to 1.5.1_ALPHA.
946 if test "$LIBRUNPATH"; then
947 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
952 if test -z "$X11BASE"; then
955 MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
957 DSO_PIC_CFLAGS='-fPIC'
958 DSO_LDOPTS='-shared -fPIC'
959 if test "$LIBRUNPATH"; then
960 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
965 MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
970 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
971 MOZ_OPTIMIZE_FLAGS="-O"
974 AC_SUBST_LIST(MMX_FLAGS)
975 AC_SUBST_LIST(SSE_FLAGS)
976 AC_SUBST_LIST(SSE2_FLAGS)
977 AC_SUBST_LIST(SSSE3_FLAGS)
980 if test -n "$MOZ_LINKER"; then
981 AC_DEFINE(MOZ_LINKER)
983 AC_CHECK_PROGS(XZ, xz)
986 if test -z "$COMPILE_ENVIRONMENT"; then
987 SKIP_COMPILER_CHECKS=1
988 SKIP_LIBRARY_CHECKS=1
993 fi # COMPILE_ENVIRONMENT
995 if test -z "$SKIP_COMPILER_CHECKS"; then
996 dnl Checks for typedefs, structures, and compiler characteristics.
997 dnl ========================================================
1012 case "${OS_TARGET}" in
1016 STL_FLAGS="-I${DIST}/stl_wrappers"
1021 if test "$MOZ_BUILD_APP" = "tools/crashreporter"; then
1025 dnl Checks for header files.
1026 dnl ========================================================
1028 case "$target_os" in
1029 bitrig*|dragonfly*|freebsd*|openbsd*)
1030 # for stuff like -lXshm
1031 CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
1035 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
1036 AC_CACHE_CHECK(for sockaddr_in.sin_len,
1037 ac_cv_sockaddr_in_sin_len,
1038 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1039 #include <sys/types.h>
1041 #include <netinet/in.h>
1042 struct sockaddr_in x;
1043 void *foo = (void*) &x.sin_len;],
1045 [ac_cv_sockaddr_in_sin_len=true],
1046 [ac_cv_sockaddr_in_sin_len=false])])
1047 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
1048 AC_DEFINE(HAVE_SIN_LEN)
1049 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
1050 AC_DEFINE(HAVE_SCONN_LEN)
1053 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
1054 ac_cv_sockaddr_in6_sin6_len,
1055 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1056 #include <sys/types.h>
1058 #include <netinet/in.h>
1059 struct sockaddr_in6 x;
1060 void *foo = (void*) &x.sin6_len;],
1062 [ac_cv_sockaddr_in6_sin6_len=true],
1063 [ac_cv_sockaddr_in6_sin6_len=false])])
1064 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
1065 AC_DEFINE(HAVE_SIN6_LEN)
1068 AC_CACHE_CHECK(for sockaddr.sa_len,
1069 ac_cv_sockaddr_sa_len,
1070 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
1071 #include <sys/types.h>
1073 #include <sys/socket.h>
1075 void *foo = (void*) &x.sa_len;],
1077 [ac_cv_sockaddr_sa_len=true],
1078 [ac_cv_sockaddr_sa_len=false])])
1079 if test "$ac_cv_sockaddr_sa_len" = true ; then
1080 AC_DEFINE(HAVE_SA_LEN)
1083 MOZ_ARG_ENABLE_BOOL(dtrace,
1084 [ --enable-dtrace build with dtrace support if available (default=no)],
1085 [enable_dtrace="yes"],)
1086 if test "x$enable_dtrace" = "xyes"; then
1087 MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
1088 if test -n "$HAVE_DTRACE"; then
1089 AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
1091 AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
1094 AC_SUBST(HAVE_DTRACE)
1096 dnl Checks for libraries.
1097 dnl ========================================================
1098 AC_CHECK_LIB(c_r, gethostbyname_r)
1100 dnl We don't want to link with libdl even if it's present on OS X, since
1101 dnl it's not used and not part of the default installation. OS/2 has dlfcn
1103 dnl We don't want to link against libm or libpthread on Darwin since
1104 dnl they both are just symlinks to libSystem and explicitly linking
1105 dnl against libSystem causes issues when debugging (see bug 299601).
1110 AC_SEARCH_LIBS(dlopen, dl,
1111 MOZ_CHECK_HEADER(dlfcn.h,
1112 AC_DEFINE(HAVE_DLOPEN)))
1116 _SAVE_CFLAGS="$CFLAGS"
1117 CFLAGS="$CFLAGS -D_GNU_SOURCE"
1118 AC_CHECK_FUNCS(dladdr memmem)
1119 CFLAGS="$_SAVE_CFLAGS"
1121 if test ! "$GNU_CXX"; then
1122 AC_CHECK_LIB(C, demangle)
1125 AC_CHECK_LIB(socket, socket)
1128 XLIBS="$X_EXTRA_LIBS"
1130 dnl ========================================================
1131 dnl Checks for X libraries.
1132 dnl Ordering is important.
1133 dnl Xt is dependent upon SM as of X11R6
1134 dnl ========================================================
1135 if test -n "$MOZ_X11"; then
1136 AC_DEFINE_UNQUOTED(FUNCPROTO,15)
1137 _SAVE_LDFLAGS="$LDFLAGS"
1139 LDFLAGS="$XLDFLAGS $LDFLAGS"
1140 AC_CHECK_LIB(X11, XDrawLines, [XLIBS="-lX11 $XLIBS"],
1141 [MISSING_X="$MISSING_X -lX11"], $XLIBS)
1142 AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
1143 [MISSING_X="$MISSING_X -lXext"], $XLIBS)
1145 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
1146 unset ac_cv_lib_Xt_XtFree
1147 AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
1148 AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
1149 AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
1150 [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
1153 dnl ========================================================
1155 dnl ========================================================
1156 AC_CHECK_LIB(xcb, xcb_connect, [XLIBS="-lxcb $XLIBS"],
1157 [MISSING_X="$MISSING_X -lxcb"], $XLIBS)
1158 AC_CHECK_LIB(xcb-shm, xcb_shm_query_version, [XLIBS="-lxcb-shm $XLIBS"],
1159 [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS)
1160 AC_CHECK_LIB(X11-xcb, XGetXCBConnection, [XLIBS="-lX11-xcb $XLIBS"],
1161 [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS)
1163 LDFLAGS="$_SAVE_LDFLAGS"
1167 AC_SUBST_LIST(XCFLAGS)
1168 AC_SUBST_LIST(XLDFLAGS)
1169 AC_SUBST_LIST(XLIBS)
1170 AC_SUBST_LIST(XEXT_LIBS)
1171 AC_SUBST_LIST(XT_LIBS)
1173 dnl ========================================================
1174 dnl = pthread support
1175 dnl = Start by checking whether the system support pthreads
1176 dnl ========================================================
1177 case "$target_os" in
1182 AC_CHECK_LIB(pthreads, pthread_create,
1183 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
1184 AC_CHECK_LIB(pthread, pthread_create,
1185 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
1186 AC_CHECK_LIB(c_r, pthread_create,
1187 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
1188 AC_CHECK_LIB(c, pthread_create,
1197 dnl ========================================================
1198 dnl Do the platform specific pthread hackery
1199 dnl ========================================================
1200 if test "$MOZ_USE_PTHREADS"x != x
1203 dnl See if -pthread is supported.
1206 ac_cv_have_dash_pthread=no
1207 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
1208 echo 'int main() { return 0; }' | cat > conftest.c
1209 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
1210 if test $? -eq 0; then
1211 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1212 ac_cv_have_dash_pthread=yes
1213 case "$target_os" in
1215 # Freebsd doesn't use -pthread for compiles, it uses them for linking
1218 CFLAGS="$CFLAGS -pthread"
1219 CXXFLAGS="$CXXFLAGS -pthread"
1225 AC_MSG_RESULT($ac_cv_have_dash_pthread)
1228 dnl See if -pthreads is supported.
1230 ac_cv_have_dash_pthreads=no
1231 if test "$ac_cv_have_dash_pthread" = "no"; then
1232 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
1233 echo 'int main() { return 0; }' | cat > conftest.c
1234 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
1235 if test $? -eq 0; then
1236 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
1237 ac_cv_have_dash_pthreads=yes
1238 CFLAGS="$CFLAGS -pthreads"
1239 CXXFLAGS="$CXXFLAGS -pthreads"
1243 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
1248 AC_DEFINE(_REENTRANT)
1249 AC_DEFINE(_THREAD_SAFE)
1250 dnl -pthread links in -lpthread, so don't specify it explicitly.
1251 if test "$ac_cv_have_dash_pthread" = "yes"; then
1252 _PTHREAD_LDFLAGS="-pthread"
1256 *-*-openbsd*|*-*-bsdi*)
1257 AC_DEFINE(_REENTRANT)
1258 AC_DEFINE(_THREAD_SAFE)
1259 dnl -pthread links in -lc_r, so don't specify it explicitly.
1260 if test "$ac_cv_have_dash_pthread" = "yes"; then
1261 _PTHREAD_LDFLAGS="-pthread"
1265 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
1266 AC_DEFINE(_REENTRANT)
1270 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
1271 AC_SUBST(MOZ_USE_PTHREADS)
1272 MOZ_CHECK_HEADERS(pthread.h)
1276 dnl Checks for library functions.
1277 dnl ========================================================
1278 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall)
1280 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1281 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1282 ac_cv_clock_monotonic,
1283 [for libs in "" -lrt; do
1286 dnl clock_gettime is available on OSX since 10.12, so depending on MACOSX_DEPLOYMENT_TARGET,
1287 dnl we should or not be able to use it. To detect if we can, we need to make the
1288 dnl availability attribute strict, so that compilation fails when the target is < 10.12.
1289 AC_TRY_LINK([#define availability(os, ...) availability(os, strict, __VA_ARGS)
1291 [ struct timespec ts;
1292 clock_gettime(CLOCK_MONOTONIC, &ts); ],
1293 ac_cv_clock_monotonic=$libs
1296 ac_cv_clock_monotonic=no)
1299 if test "$ac_cv_clock_monotonic" != "no"; then
1300 HAVE_CLOCK_MONOTONIC=1
1301 REALTIME_LIBS=$ac_cv_clock_monotonic
1302 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1303 AC_SUBST(HAVE_CLOCK_MONOTONIC)
1304 AC_SUBST_LIST(REALTIME_LIBS)
1307 dnl Turn on warnings-as-errors to prevent implicit declaration of
1308 dnl pthread_cond_timedwait_monotonic_np, which can cause this test to
1309 dnl inadvertently pass even if the function does not really exist.
1310 _SAVE_CFLAGS="$CFLAGS"
1311 CFLAGS="$CFLAGS $WARNINGS_AS_ERRORS"
1312 AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
1313 ac_cv_pthread_cond_timedwait_monotonic_np,
1314 AC_TRY_LINK([#include <pthread.h>],
1315 [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
1316 ac_cv_pthread_cond_timewait_monotonic_np=yes,
1317 ac_cv_pthread_cond_timewait_monotonic_np=no))
1318 if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
1319 AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
1321 CFLAGS=$_SAVE_CFLAGS
1325 ac_cv_func_res_ninit,
1326 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
1327 dnl no need for res_ninit() on NetBSD and OpenBSD
1328 ac_cv_func_res_ninit=no
1332 #define _BSD_SOURCE 1
1334 #include <sys/types.h>
1335 #include <netinet/in.h>
1336 #include <arpa/nameser.h>
1339 [int foo = res_ninit(&_res);],
1340 [ac_cv_func_res_ninit=yes],
1341 [ac_cv_func_res_ninit=no])
1345 if test "$ac_cv_func_res_ninit" = "yes"; then
1346 AC_DEFINE(HAVE_RES_NINIT)
1347 dnl must add the link line we do something as foolish as this... dougt
1349 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
1350 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
1355 dnl **********************
1356 dnl *** va_copy checks ***
1357 AC_CACHE_CHECK([for an implementation of va_copy()],
1359 [AC_TRY_COMPILE([#include <stdarg.h>
1361 void f (int i, ...) {
1362 va_list args1, args2;
1363 va_start (args1, i);
1364 va_copy (args2, args1);
1365 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1367 va_end (args1); va_end (args2);
1369 [f(0, 42); return 0],
1370 [ac_cv_va_copy=yes],
1374 AC_CACHE_CHECK([whether va_list can be copied by value],
1376 [AC_TRY_COMPILE([#include <stdarg.h>
1378 void f (int i, ...) {
1379 va_list args1, args2;
1380 va_start (args1, i);
1382 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
1384 va_end (args1); va_end (args2);
1386 [f(0, 42); return 0],
1387 [ac_cv_va_val_copy=yes],
1388 [ac_cv_va_val_copy=no],
1391 if test "x$ac_cv_va_copy" = "xyes"; then
1392 AC_DEFINE(VA_COPY, va_copy)
1393 AC_DEFINE(HAVE_VA_COPY)
1396 if test "x$ac_cv_va_val_copy" = "xno"; then
1397 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
1400 dnl ===================================================================
1401 dnl ========================================================
1402 dnl Put your C++ language/feature checks below
1403 dnl ========================================================
1407 if test "$GNU_CC"; then
1408 if test "$CPU_ARCH" = "arm" ; then
1409 AC_CACHE_CHECK(for ARM EABI,
1413 #if defined(__ARM_EABI__)
1416 #error Not ARM EABI.
1419 ac_cv_gcc_arm_eabi="yes",
1420 ac_cv_gcc_arm_eabi="no")])
1421 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
1423 ARM_ABI_PREFIX=eabi-
1425 ARM_ABI_PREFIX=oabi-
1429 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
1432 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
1433 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
1434 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
1436 _SAVE_LDFLAGS=$LDFLAGS
1437 LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
1438 AC_CACHE_CHECK(for __thread keyword for TLS variables,
1439 ac_cv_thread_keyword,
1440 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
1441 [return tlsIsMainThread;],
1442 ac_cv_thread_keyword=yes,
1443 ac_cv_thread_keyword=no)])
1444 LDFLAGS=$_SAVE_LDFLAGS
1445 # The custom dynamic linker doesn't support TLS variables
1447 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
1448 # mips builds fail with TLS variables because of a binutils bug.
1450 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
1455 *-android*|*-linuxandroid*)
1462 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
1468 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
1469 if test -n "$MOZ_LINKER"; then
1470 if test "$CPU_ARCH" = arm; then
1471 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
1472 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
1473 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1474 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1478 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
1479 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
1480 dnl Since the linker only understands the sysv ones, no need to build the
1481 dnl gnu style tables anyways.
1482 LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
1485 dnl End of C++ language/feature checks
1488 dnl ========================================================
1489 dnl = Internationalization checks
1490 dnl ========================================================
1492 dnl Internationalization and Locale support is different
1493 dnl on various UNIX platforms. Checks for specific i18n
1494 dnl features go here.
1496 AC_HAVE_FUNCS(localeconv)
1498 fi # ! SKIP_COMPILER_CHECKS
1500 if test -n "${COMPILE_ENVIRONMENT}"; then
1505 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1506 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1507 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1510 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1511 dnl features that Windows actually does support.
1513 if test -n "$SKIP_COMPILER_CHECKS"; then
1514 dnl Windows has malloc.h
1515 AC_DEFINE(MALLOC_H, [<malloc.h>])
1516 AC_DEFINE(HAVE_FORCEINLINE)
1517 AC_DEFINE(HAVE_LOCALECONV)
1518 fi # SKIP_COMPILER_CHECKS
1520 dnl Mozilla specific options
1521 dnl ========================================================
1522 dnl The macros used for command line options
1523 dnl are defined in build/autoconf/altoptions.m4.
1525 dnl ========================================================
1527 dnl = Check for external package dependencies
1529 dnl ========================================================
1530 MOZ_ARG_HEADER(External Packages)
1532 case "$OS_TARGET" in
1533 WINNT|Darwin|Android)
1543 dnl ========================================================
1544 dnl system libevent Support
1545 dnl ========================================================
1546 MOZ_ARG_WITH_STRING(system-libevent,
1547 [ --with-system-libevent[=PFX]
1548 Use system libevent [installed at prefix PFX]],
1549 LIBEVENT_DIR=$withval)
1551 _SAVE_CFLAGS=$CFLAGS
1552 _SAVE_LDFLAGS=$LDFLAGS
1554 if test "$LIBEVENT_DIR" = yes; then
1555 PKG_CHECK_MODULES(MOZ_LIBEVENT, libevent,
1556 MOZ_SYSTEM_LIBEVENT=1,
1559 if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
1560 MOZ_SYSTEM_LIBEVENT=
1561 elif test -z "$MOZ_SYSTEM_LIBEVENT"; then
1562 CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
1563 LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
1564 MOZ_CHECK_HEADER(event.h,
1565 [if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
1566 AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
1568 AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
1569 AC_CHECK_LIB(event, event_init,
1570 [MOZ_SYSTEM_LIBEVENT=1
1571 MOZ_LIBEVENT_CFLAGS="-I${LIBEVENT_DIR}/include"
1572 MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
1573 [MOZ_SYSTEM_LIBEVENT= MOZ_LIBEVENT_CFLAGS= MOZ_LIBEVENT_LIBS=])
1575 CFLAGS=$_SAVE_CFLAGS
1576 LDFLAGS=$_SAVE_LDFLAGS
1579 AC_SUBST(MOZ_SYSTEM_LIBEVENT)
1581 dnl ========================================================
1582 dnl = If NSS was not detected in the system,
1583 dnl = use the one in the source tree (mozilla/security/nss)
1584 dnl ========================================================
1586 MOZ_ARG_WITH_BOOL(system-nss,
1587 [ --with-system-nss Use system installed NSS],
1590 if test -n "$_USE_SYSTEM_NSS"; then
1591 AM_PATH_NSS(3.42, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
1594 NSS_CFLAGS="$NSS_CFLAGS -I${DIST}/include/nss"
1595 if test -z "$MOZ_SYSTEM_NSS"; then
1596 case "${OS_ARCH}" in
1597 # Only few platforms have been tested with GYP
1598 WINNT|Darwin|Linux|DragonFly|FreeBSD|NetBSD|OpenBSD|SunOS)
1601 AC_MSG_ERROR([building in-tree NSS is not supported on this platform. Use --with-system-nss])
1606 dnl system ZLIB support
1607 dnl ========================================================
1608 MOZ_ZLIB_CHECK([1.2.3])
1610 if test -z "$SKIP_LIBRARY_CHECKS"; then
1612 dnl ========================================================
1613 dnl system PNG Support
1614 dnl ========================================================
1615 MOZ_ARG_WITH_STRING(system-png,
1616 [ --with-system-png[=PFX]
1617 Use system libpng [installed at prefix PFX]],
1620 _SAVE_CFLAGS=$CFLAGS
1621 _SAVE_LDFLAGS=$LDFLAGS
1623 if test -n "${PNG_DIR}" -a "${PNG_DIR}" != "yes"; then
1624 CFLAGS="-I${PNG_DIR}/include $CFLAGS"
1625 LDFLAGS="-L${PNG_DIR}/lib $LDFLAGS"
1627 if test -z "$PNG_DIR" -o "$PNG_DIR" = no; then
1630 AC_CHECK_LIB(png, png_get_valid, [MOZ_SYSTEM_PNG=1 MOZ_PNG_LIBS="-lpng"],
1631 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1632 AC_CHECK_LIB(png, png_get_acTL, ,
1633 AC_MSG_ERROR([--with-system-png won't work because the system's libpng doesn't have APNG support]))
1635 if test "$MOZ_SYSTEM_PNG" = 1; then
1636 AC_TRY_COMPILE([ #include <stdio.h>
1637 #include <sys/types.h>
1639 [ #if PNG_LIBPNG_VER < $MOZPNG
1640 #error "Insufficient libpng version ($MOZPNG required)."
1642 #ifndef PNG_UINT_31_MAX
1643 #error "Insufficient libpng version."
1646 AC_MSG_ERROR([--with-system-png requested but no working libpng found]))
1648 CFLAGS=$_SAVE_CFLAGS
1649 LDFLAGS=$_SAVE_LDFLAGS
1652 if test "${PNG_DIR}" -a -d "${PNG_DIR}" -a "$MOZ_SYSTEM_PNG" = 1; then
1653 MOZ_PNG_CFLAGS="-I${PNG_DIR}/include"
1654 MOZ_PNG_LIBS="-L${PNG_DIR}/lib ${MOZ_PNG_LIBS}"
1657 fi # SKIP_LIBRARY_CHECKS
1659 dnl ========================================================
1663 dnl ========================================================
1665 MOZ_ARG_HEADER(Application)
1667 ENABLE_SYSTEM_EXTENSION_DIRS=1
1668 MOZ_BRANDING_DIRECTORY=
1669 MOZ_OFFICIAL_BRANDING=
1670 MOZ_AUTH_EXTENSION=1
1671 if test "$MOZ_IOS"; then
1674 MOZ_PREF_EXTENSIONS=1
1676 MOZ_TOOLKIT_SEARCH=1
1677 MOZ_UNIVERSALCHARDET=1
1682 MOZ_USE_NATIVE_POPUP_WINDOWS=
1683 MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
1684 MOZ_CONTENT_SANDBOX=
1687 MOZ_BINARY_EXTENSIONS=
1690 case "$target_os" in
1693 AC_DEFINE(NS_ENABLE_TSF)
1697 # Optional Firefox for Android partner distribution directory.
1698 MOZ_ARG_WITH_STRING(android-distribution-directory,
1699 [ --with-android-distribution-directory=dir
1700 Optional Firefox for Android partner distribution directory.],
1701 MOZ_ANDROID_DISTRIBUTION_DIRECTORY=$withval)
1703 if test -n "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY"; then
1704 # A distribution directory must have an assets/distribution directory.
1705 # See https://wiki.mozilla.org/Mobile/Distribution_Files.
1706 if test ! -d "$MOZ_ANDROID_DISTRIBUTION_DIRECTORY/assets/distribution" ; then
1707 AC_MSG_ERROR([--with-android-distribution-directory does not contain assets/distribution;
1708 (looked for ${MOZ_ANDROID_DISTRIBUTION_DIRECTORY}/assets/distribution).])
1711 AC_SUBST(MOZ_ANDROID_DISTRIBUTION_DIRECTORY)
1713 dnl ========================================================
1714 dnl = Trademarked Branding
1715 dnl ========================================================
1716 MOZ_ARG_ENABLE_BOOL(official-branding,
1717 [ --enable-official-branding
1718 Enable Official mozilla.org Branding
1719 Do not distribute builds with
1720 --enable-official-branding unless you have
1721 permission to use trademarks per
1722 http://www.mozilla.org/foundation/trademarks/ .],
1723 MOZ_OFFICIAL_BRANDING=1,
1724 MOZ_OFFICIAL_BRANDING=)
1726 # Allow the application to influence configure with a confvars.sh script.
1727 AC_MSG_CHECKING([if app-specific confvars.sh exists])
1728 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
1729 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
1730 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
1735 # Allow influencing configure with a defines.sh script.
1736 . "${srcdir}/build/defines.sh"
1738 # If we're not building a release build, define EARLY_BETA_OR_EARLIER if it is
1740 if test "$BUILDING_RELEASE"; then
1741 # Override value in defines.sh, if any
1742 EARLY_BETA_OR_EARLIER=
1743 elif test "$EARLY_BETA_OR_EARLIER"; then
1744 AC_DEFINE(EARLY_BETA_OR_EARLIER)
1746 AC_SUBST(EARLY_BETA_OR_EARLIER)
1748 # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
1749 MOZ_ARG_WITH_STRING(app-name,
1750 [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
1751 WITH_APP_NAME=$withval,
1754 if test -n "$WITH_APP_NAME" ; then
1755 MOZ_APP_NAME="$WITH_APP_NAME"
1758 MOZ_ARG_WITH_STRING(app-basename,
1759 [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
1760 WITH_APP_BASENAME=$withval,
1763 if test -n "$WITH_APP_BASENAME" ; then
1764 MOZ_APP_BASENAME="$WITH_APP_BASENAME"
1767 # Special cases where we need to AC_DEFINE something. Also a holdover for apps
1768 # that haven't made a confvars.sh yet. Don't add new stuff here, use
1770 case "$MOZ_BUILD_APP" in
1772 AC_DEFINE(MOZ_PHOENIX)
1776 AC_DEFINE(MOZ_XULRUNNER)
1780 # Graphene is a desktop runtime for running applications with a HTML UI.
1781 if test -n "$MOZ_GRAPHENE"; then
1782 AC_DEFINE(MOZ_GRAPHENE)
1785 AC_SUBST(MOZ_PHOENIX)
1786 AC_SUBST(MOZ_XULRUNNER)
1788 dnl ========================================================
1789 dnl Ensure Android SDK and build-tools versions depending on
1791 dnl ========================================================
1793 case "$MOZ_BUILD_APP" in
1799 dnl ========================================================
1801 dnl = Toolkit Options
1803 dnl ========================================================
1804 MOZ_ARG_HEADER(Toolkit Options)
1806 dnl ========================================================
1807 dnl = Enable the toolkit as needed =
1808 dnl ========================================================
1810 case "$MOZ_WIDGET_TOOLKIT" in
1813 LDFLAGS="$LDFLAGS -framework Cocoa"
1814 # Use -Wl as a trick to avoid -framework and framework names from
1815 # being separated by AC_SUBST_LIST.
1816 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'
1818 CFLAGS="$CFLAGS $TK_CFLAGS"
1819 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1820 MOZ_USER_DIR="Mozilla"
1821 MOZ_FS_LAYOUT=bundle
1825 LDFLAGS="$LDFLAGS -framework UIKit"
1827 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'
1828 CFLAGS="$CFLAGS $TK_CFLAGS"
1829 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1830 MOZ_USER_DIR="Mozilla"
1831 MOZ_FS_LAYOUT=bundle
1836 if test "$OS_TARGET" = Darwin; then
1837 LDFLAGS="$LDFLAGS -lobjc"
1840 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
1841 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
1842 case "$MOZ_WIDGET_TOOLKIT" in
1848 if test "$COMPILE_ENVIRONMENT"; then
1849 if test "$MOZ_WIDGET_TOOLKIT" = gtk3; then
1850 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)
1851 MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
1852 TK_CFLAGS=$MOZ_GTK3_CFLAGS
1853 TK_LIBS=$MOZ_GTK3_LIBS
1854 dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
1855 dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
1856 AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
1857 GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32
1859 if test "$MOZ_ENABLE_GTK"; then
1860 if test "$MOZ_X11"; then
1861 GDK_PACKAGES=gdk-x11-2.0
1863 AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
1864 AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
1866 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)
1867 MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
1869 fi # COMPILE_ENVIRONMENT
1871 AC_SUBST(MOZ_FS_LAYOUT)
1873 dnl ========================================================
1874 dnl = startup-notification support module
1875 dnl ========================================================
1877 if test "$MOZ_ENABLE_GTK"
1879 MOZ_ENABLE_STARTUP_NOTIFICATION=
1881 MOZ_ARG_ENABLE_BOOL(startup-notification,
1882 [ --enable-startup-notification
1883 Enable startup-notification support (default: disabled) ],
1884 MOZ_ENABLE_STARTUP_NOTIFICATION=force,
1885 MOZ_ENABLE_STARTUP_NOTIFICATION=)
1886 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
1888 PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
1889 libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
1890 [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
1891 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
1893 AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
1895 MOZ_ENABLE_STARTUP_NOTIFICATION=
1899 if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
1900 AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
1903 TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
1905 AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
1907 AC_SUBST_LIST(TK_CFLAGS)
1908 AC_SUBST_LIST(TK_LIBS)
1913 dnl ========================================================
1915 dnl = Components & Features
1917 dnl ========================================================
1918 MOZ_ARG_HEADER(Components and Features)
1920 AC_SUBST(MOZ_OFFICIAL_BRANDING)
1921 if test -n "$MOZ_OFFICIAL_BRANDING"; then
1922 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
1923 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
1925 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
1926 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
1930 MOZ_ARG_WITH_STRING(branding,
1931 [ --with-branding=dir Use branding from the specified directory.],
1932 MOZ_BRANDING_DIRECTORY=$withval)
1934 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
1935 if test -z "$REAL_BRANDING_DIRECTORY"; then
1936 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
1939 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1940 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
1941 elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1942 . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
1945 AC_SUBST(MOZ_BRANDING_DIRECTORY)
1947 dnl ========================================================
1948 dnl = Distribution ID
1949 dnl ========================================================
1950 MOZ_ARG_WITH_STRING(distribution-id,
1951 [ --with-distribution-id=ID
1952 Set distribution-specific id (default=org.mozilla)],
1953 [ val=`echo $withval`
1954 MOZ_DISTRIBUTION_ID="$val"])
1956 if test -z "$MOZ_DISTRIBUTION_ID"; then
1957 MOZ_DISTRIBUTION_ID="org.mozilla"
1960 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
1961 AC_SUBST(MOZ_DISTRIBUTION_ID)
1963 dnl ========================================================
1964 dnl = GConf support module
1965 dnl ========================================================
1969 if test "$MOZ_ENABLE_GTK"
1974 dnl ========================================================
1975 dnl = GConf support module
1976 dnl ========================================================
1977 MOZ_ARG_DISABLE_BOOL(gconf,
1978 [ --disable-gconf Disable Gconf support ],
1982 if test "$MOZ_ENABLE_GCONF"
1984 PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
1985 MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
1988 if test -n "$MOZ_ENABLE_GCONF";
1990 AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
1992 AC_MSG_WARN([Many automated tests will fail with --disable-gconf. See bug 1167201.])
1997 if test "$MOZ_ENABLE_GCONF"; then
1998 AC_DEFINE(MOZ_ENABLE_GCONF)
2001 AC_SUBST(MOZ_ENABLE_GCONF)
2004 dnl ========================================================
2005 dnl = libproxy support
2006 dnl ========================================================
2008 if test "$MOZ_ENABLE_GTK"
2010 MOZ_ENABLE_LIBPROXY=
2012 MOZ_ARG_ENABLE_BOOL(libproxy,
2013 [ --enable-libproxy Enable libproxy support ],
2014 MOZ_ENABLE_LIBPROXY=1,
2015 MOZ_ENABLE_LIBPROXY=)
2017 if test "$MOZ_ENABLE_LIBPROXY"
2019 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
2020 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
2023 AC_SUBST(MOZ_ENABLE_LIBPROXY)
2025 dnl ========================================================
2027 dnl ========================================================
2029 if test "$MOZ_ENABLE_GTK"
2033 MOZ_ARG_DISABLE_BOOL(dbus,
2034 [ --disable-dbus Disable dbus support ],
2038 if test "$MOZ_ENABLE_DBUS"
2040 PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
2041 PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
2042 AC_DEFINE(MOZ_ENABLE_DBUS)
2045 AC_SUBST(MOZ_ENABLE_DBUS)
2047 dnl =========================================================
2048 dnl = Whether to exclude hyphenations files in the build
2049 dnl =========================================================
2050 if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
2051 AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
2054 AC_TRY_COMPILE([#include <linux/ethtool.h>],
2055 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
2056 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
2058 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
2060 if test -n "$MOZ_WEBRTC"; then
2061 if test -n "$MOZ_X11"; then
2062 MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
2066 AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
2068 dnl ========================================================
2069 dnl = Apple platform decoder support
2070 dnl ========================================================
2071 if test "$COMPILE_ENVIRONMENT"; then
2072 if test -n "$MOZ_APPLEMEDIA"; then
2073 # hack in frameworks for fmp4 - see bug 1029974
2074 # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
2075 LDFLAGS="$LDFLAGS -framework AudioToolbox"
2076 dnl Verify CoreMedia is available.
2077 AC_CHECK_HEADERS([CoreMedia/CoreMedia.h VideoToolbox/VideoToolbox.h], [],
2078 [AC_MSG_ERROR([MacOS X 10.9 SDK or later is required])])
2080 fi # COMPILE_ENVIRONMENT
2082 dnl ========================================================
2083 dnl = Handle dependent MEDIA defines
2084 dnl ========================================================
2087 AC_DEFINE(MOZ_WEBM_ENCODER)
2088 AC_SUBST(MOZ_WEBM_ENCODER)
2090 dnl ========================================================
2092 dnl ========================================================
2094 MOZ_ARG_DISABLE_BOOL(negotiateauth,
2095 [ --disable-negotiateauth Disable GSS-API negotiation ],
2096 MOZ_AUTH_EXTENSION=,
2097 MOZ_AUTH_EXTENSION=1 )
2099 if test -n "$MOZ_IOS" -a -n "$MOZ_AUTH_EXTENSION"; then
2100 AC_MSG_ERROR([negotiateauth is not supported on iOS.])
2103 dnl ========================================================
2104 dnl Pref extensions (autoconfig)
2105 dnl ========================================================
2106 MOZ_ARG_DISABLE_BOOL(pref-extensions,
2107 [ --disable-pref-extensions
2108 Disable pref extensions such as autoconfig],
2109 MOZ_PREF_EXTENSIONS=,
2110 MOZ_PREF_EXTENSIONS=1 )
2112 dnl ========================================================
2113 dnl Searching of system directories for extensions.
2114 dnl Note: this switch is meant to be used for test builds
2115 dnl whose behavior should not depend on what happens to be
2116 dnl installed on the local machine.
2117 dnl ========================================================
2118 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
2119 [ --disable-system-extension-dirs
2120 Disable searching system- and account-global
2121 directories for extensions of any kind; use
2122 only profile-specific extension directories],
2123 ENABLE_SYSTEM_EXTENSION_DIRS=,
2124 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
2125 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
2126 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
2129 dnl ========================================================
2130 dnl = Universalchardet
2131 dnl ========================================================
2132 MOZ_ARG_DISABLE_BOOL(universalchardet,
2133 [ --disable-universalchardet
2134 Disable universal encoding detection],
2135 MOZ_UNIVERSALCHARDET=,
2136 MOZ_UNIVERSALCHARDET=1 )
2138 dnl ========================================================
2140 dnl ========================================================
2142 if test "$COMPILE_ENVIRONMENT" ; then
2144 dnl Moved gamepad platform check to moz.build, linux header check still needed here.
2145 if test "$OS_TARGET" = "Linux"; then
2146 MOZ_CHECK_HEADER([linux/joystick.h])
2147 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
2148 AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
2152 fi # COMPILE_ENVIRONMENT
2155 dnl ========================================================
2156 dnl = Breakpad crash reporting (on by default on supported platforms)
2157 dnl ========================================================
2160 i?86-*-mingw*|x86_64-*-mingw*|aarch64-*-mingw*)
2163 i?86-apple-darwin*|x86_64-apple-darwin*)
2164 if test -z "$MOZ_IOS"; then
2168 *-android*|*-linuxandroid*)
2169 dnl Android/arm is arm-unknown-linux-androideabi, so android condition should
2170 dnl be before Linux condition
2173 i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
2174 if test "$MOZ_ENABLE_GTK"; then
2180 MOZ_ARG_DISABLE_BOOL(crashreporter,
2181 [ --disable-crashreporter Disable breakpad crash reporting],
2182 [MOZ_CRASHREPORTER=],
2183 [MOZ_CRASHREPORTER=F # Force enable breakpad])
2185 if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin"; then
2186 if test "$MOZ_CRASHREPORTER" = F; then
2187 AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
2192 if test -n "$MOZ_CRASHREPORTER"; then
2193 AC_DEFINE(MOZ_CRASHREPORTER)
2195 if test "$OS_TARGET" = "Linux" && \
2196 test -z "$SKIP_LIBRARY_CHECKS"; then
2197 PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
2200 if test "$OS_ARCH" = "WINNT"; then
2201 if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
2202 MOZ_CRASHREPORTER_INJECTOR=1
2203 AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
2208 dnl ========================================================
2209 dnl = Enable compilation of specific extension modules
2210 dnl ========================================================
2212 MOZ_ARG_ENABLE_STRING(extensions,
2213 [ --enable-extensions Enable extensions],
2214 [ for option in `echo $enableval | sed 's/,/ /g'`; do
2215 if test "$option" = "yes" -o "$option" = "all"; then
2216 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
2217 elif test "$option" = "no" -o "$option" = "none"; then
2219 elif test "$option" = "default"; then
2220 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
2221 elif test `echo "$option" | grep -c \^-` != 0; then
2222 option=`echo $option | sed 's/^-//'`
2223 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
2225 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
2228 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
2230 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
2231 dnl when trying to build a nonexistent extension.
2232 for extension in $MOZ_EXTENSIONS; do
2233 if test ! -d "${srcdir}/extensions/${extension}"; then
2234 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
2238 if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
2239 AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
2242 # Avoid defining MOZ_ENABLE_CAIRO_FT on Windows platforms because
2243 # "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
2244 if test -n "$MOZ_TREE_FREETYPE" -a "$OS_TARGET" != WINNT; then
2245 MOZ_ENABLE_CAIRO_FT=1
2246 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2247 CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
2248 AC_SUBST_LIST(CAIRO_FT_CFLAGS)
2251 AC_CHECK_PROGS(WGET, wget, "")
2254 dnl ========================================================
2255 dnl Enable building the signmar program.
2256 dnl This option is much different than the --enable-verify-mar option.
2257 dnl --enable-verify-mar is for enabling the verification check on MAR
2258 dnl files in the updater. The --enable-signmar option is for building
2259 dnl the signmar program.
2260 dnl ========================================================
2262 MOZ_ARG_ENABLE_BOOL(signmar,
2263 [ --enable-signmar Enable building the signmar program],
2264 MOZ_ENABLE_SIGNMAR=1,
2265 MOZ_ENABLE_SIGNMAR= )
2267 if test -n "$MOZ_ENABLE_SIGNMAR"; then
2268 if test -z "$COMPILE_ENVIRONMENT" ; then
2269 AC_MSG_WARN([Cannot --enable-signmar with --disable-compile-environment])
2272 AC_DEFINE(MOZ_ENABLE_SIGNMAR)
2276 dnl ========================================================
2278 dnl ========================================================
2280 if test "$MOZ_IOS"; then
2284 MOZ_ARG_DISABLE_BOOL(updater,
2285 [ --disable-updater Disable building of updater],
2289 if test -n "$MOZ_UPDATER"; then
2290 AC_DEFINE(MOZ_UPDATER)
2293 dnl ========================================================
2294 dnl parental controls (for Windows Vista)
2295 dnl ========================================================
2296 MOZ_ARG_DISABLE_BOOL(parental-controls,
2297 [ --disable-parental-controls
2298 Do not build parental controls],
2299 MOZ_DISABLE_PARENTAL_CONTROLS=1,
2300 MOZ_DISABLE_PARENTAL_CONTROLS=)
2301 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
2302 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
2305 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
2307 dnl ========================================================
2308 dnl = Disable smartcard support
2309 dnl ========================================================
2310 if test -n "$MOZ_NO_SMART_CARDS"; then
2311 AC_DEFINE(MOZ_NO_SMART_CARDS)
2313 AC_SUBST(MOZ_NO_SMART_CARDS)
2315 dnl ========================================================
2316 dnl = Sandboxing support
2317 dnl ========================================================
2318 if test -n "$MOZ_TSAN" -o -n "$MOZ_ASAN"; then
2319 # Bug 1182565: TSan conflicts with sandboxing on Linux.
2320 # Bug 1287971: LSan also conflicts with sandboxing on Linux.
2328 MOZ_ARG_DISABLE_BOOL(sandbox,
2329 [ --disable-sandbox Disable sandboxing support],
2333 dnl ========================================================
2334 dnl = Content process sandboxing
2335 dnl ========================================================
2337 case "$OS_TARGET" in
2339 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
2342 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
2347 MOZ_CONTENT_SANDBOX=$MOZ_SANDBOX
2353 MOZ_ARG_ENABLE_BOOL(content-sandbox,
2354 [ --enable-content-sandbox Enable sandboxing support for content-processes
2355 --disable-content-sandbox Disable sandboxing support for content-processes],
2356 MOZ_CONTENT_SANDBOX=1,
2357 MOZ_CONTENT_SANDBOX=)
2359 if test -n "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_SANDBOX"; then
2360 AC_MSG_ERROR([--enable-content-sandbox and --disable-sandbox are conflicting options])
2363 if test -n "$MOZ_CONTENT_SANDBOX"; then
2364 AC_DEFINE(MOZ_CONTENT_SANDBOX)
2367 AC_SUBST(MOZ_CONTENT_SANDBOX)
2369 dnl ========================================================
2370 dnl = Gecko Media Plugin sandboxing
2371 dnl ========================================================
2374 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
2379 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
2384 MOZ_GMP_SANDBOX=$MOZ_SANDBOX
2388 if test -n "$MOZ_GMP_SANDBOX"; then
2389 AC_DEFINE(MOZ_GMP_SANDBOX)
2392 AC_SUBST(MOZ_GMP_SANDBOX)
2394 if test -z "$MOZ_CONTENT_SANDBOX" -a -z "$MOZ_GMP_SANDBOX"; then
2398 if test -n "$MOZ_SANDBOX"; then
2399 AC_DEFINE(MOZ_SANDBOX)
2402 AC_SUBST(MOZ_SANDBOX)
2405 dnl ========================================================
2407 dnl = Module specific options
2409 dnl ========================================================
2410 MOZ_ARG_HEADER(Individual module options)
2412 dnl ========================================================
2413 dnl Check for sqlite
2414 dnl ========================================================
2417 MOZ_ARG_ENABLE_BOOL(system-sqlite,
2418 [ --enable-system-sqlite Use system sqlite (located with pkgconfig)],
2419 MOZ_SYSTEM_SQLITE=1,
2420 MOZ_SYSTEM_SQLITE= )
2422 if test -n "$MOZ_SYSTEM_SQLITE"
2424 dnl ============================
2425 dnl === SQLite Version check ===
2426 dnl ============================
2427 dnl Check to see if the system SQLite package is new enough.
2428 PKG_CHECK_MODULES(SQLITE, sqlite3 >= $SQLITE_VERSION)
2430 dnl ==============================
2431 dnl === SQLite fdatasync check ===
2432 dnl ==============================
2433 dnl Check to see if fdatasync is available
2434 AC_CHECK_FUNC(fdatasync)
2437 if test -n "$MOZ_SYSTEM_SQLITE"; then
2438 AC_DEFINE(MOZ_SYSTEM_SQLITE)
2440 AC_SUBST(MOZ_SYSTEM_SQLITE)
2442 dnl ========================================================
2443 dnl = Disable zipwriter
2444 dnl ========================================================
2445 MOZ_ARG_DISABLE_BOOL(zipwriter,
2446 [ --disable-zipwriter Disable zipwriter component],
2449 AC_SUBST(MOZ_ZIPWRITER)
2451 dnl ========================================================
2453 dnl = Feature options that require extra sources to be pulled
2455 dnl ========================================================
2456 dnl MOZ_ARG_HEADER(Features that require extra sources)
2458 dnl ========================================================
2460 dnl = Runtime debugging and Optimization Options
2462 dnl ========================================================
2463 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
2465 dnl ========================================================
2466 dnl enable mobile optimizations
2467 dnl ========================================================
2468 MOZ_ARG_ENABLE_BOOL(mobile-optimize,
2469 [ --enable-mobile-optimize
2470 Enable mobile optimizations],
2471 MOZ_GFX_OPTIMIZE_MOBILE=1)
2473 AC_SUBST(MOZ_GFX_OPTIMIZE_MOBILE)
2475 if test "$MOZ_GFX_OPTIMIZE_MOBILE"; then
2476 # We ignore paint will resample on mobile for performance.
2477 # We may want to revisit this later.
2478 MOZ_IGNORE_PAINT_WILL_RESAMPLE=1
2480 AC_DEFINE(MOZ_GFX_OPTIMIZE_MOBILE)
2481 AC_DEFINE(MOZ_IGNORE_PAINT_WILL_RESAMPLE)
2484 dnl ========================================================
2485 dnl = Enable code optimization. ON by default.
2486 dnl ========================================================
2488 # Use value from moz.configure if one is defined. Else use our computed
2490 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
2491 MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
2494 MOZ_SET_FRAMEPTR_FLAGS
2496 if test "$COMPILE_ENVIRONMENT"; then
2497 if test -n "$MOZ_OPTIMIZE"; then
2498 AC_MSG_CHECKING([for valid C compiler optimization flags])
2499 _SAVE_CFLAGS=$CFLAGS
2500 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
2501 AC_TRY_COMPILE([#include <stdio.h>],
2502 [printf("Hello World\n");],
2505 AC_MSG_RESULT([$_results])
2506 if test "$_results" = "no"; then
2507 AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
2509 CFLAGS=$_SAVE_CFLAGS
2510 if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
2511 # When using llvm-based LTO, non numeric optimization levels are
2512 # not supported by the linker, so force the linker to use -O2 (
2513 # which doesn't influence the level compilation units are actually
2515 case " $MOZ_OPTIMIZE_FLAGS " in
2516 *\ -Os\ *|*\ -Oz\ *)
2517 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
2522 fi # COMPILE_ENVIRONMENT
2524 AC_SUBST_LIST(MOZ_FRAMEPTR_FLAGS)
2525 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
2526 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
2527 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
2529 dnl ========================================================
2530 dnl = Disable treating compiler warnings as errors
2531 dnl ========================================================
2532 if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
2533 WARNINGS_AS_ERRORS=''
2536 dnl ========================================================
2537 dnl = Enable runtime logging
2538 dnl ========================================================
2539 AC_DEFINE(MOZ_LOGGING)
2540 AC_DEFINE(FORCE_PR_LOG)
2542 dnl ========================================================
2543 dnl = This will enable logging of addref, release, ctor, dtor.
2544 dnl ========================================================
2545 _ENABLE_LOGREFCNT=42
2546 MOZ_ARG_ENABLE_BOOL(logrefcnt,
2547 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
2548 _ENABLE_LOGREFCNT=1,
2549 _ENABLE_LOGREFCNT= )
2550 if test "$_ENABLE_LOGREFCNT" = "1"; then
2551 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
2552 elif test -z "$_ENABLE_LOGREFCNT"; then
2553 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
2556 dnl ========================================================
2557 dnl moz_dump_painting
2558 dnl ========================================================
2559 MOZ_ARG_ENABLE_BOOL(dump-painting,
2560 [ --enable-dump-painting Enable paint debugging.],
2561 MOZ_DUMP_PAINTING=1,
2562 MOZ_DUMP_PAINTING= )
2563 if test -n "$MOZ_DUMP_PAINTING"; then
2564 AC_DEFINE(MOZ_DUMP_PAINTING)
2565 AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
2567 if test -n "$MOZ_DEBUG"; then
2568 AC_DEFINE(MOZ_DUMP_PAINTING)
2571 case "${OS_TARGET}" in
2572 Android|WINNT|Darwin)
2573 MOZ_GLUE_IN_PROGRAM=
2576 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
2577 MOZ_GLUE_IN_PROGRAM=1
2578 AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
2582 dnl ========================================================
2583 dnl = Jemalloc build setup
2584 dnl ========================================================
2585 if test -z "$MOZ_MEMORY"; then
2588 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
2589 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.])
2594 dnl The generic feature tests that determine how to compute ncpus are long and
2595 dnl complicated. Therefore, simply define special cpp variables for the
2596 dnl platforms we have special knowledge of.
2599 export MOZ_NO_DEBUG_RTL=1
2603 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
2605 dnl ========================================================
2606 dnl = Enable using the clang plugin to build
2607 dnl ========================================================
2609 if test -n "$COMPILE_ENVIRONMENT"; then
2610 MOZ_CONFIG_CLANG_PLUGIN
2611 fi # COMPILE_ENVIRONMENT
2613 dnl ========================================================
2614 dnl = Enable stripping of libs & executables
2615 dnl ========================================================
2616 MOZ_ARG_ENABLE_BOOL(strip,
2617 [ --enable-strip Enable stripping of libs & executables ],
2621 dnl ========================================================
2622 dnl = Enable stripping of libs & executables when packaging
2623 dnl ========================================================
2624 MOZ_ARG_ENABLE_BOOL(install-strip,
2625 [ --enable-install-strip Enable stripping of libs & executables when packaging ],
2629 dnl ========================================================
2630 dnl = frontend JS debug mode
2631 dnl ========================================================
2633 MOZ_ARG_ENABLE_BOOL(debug-js-modules,
2634 [ --enable-debug-js-modules Enable debug mode for frontend JS libraries],
2638 AC_SUBST(DEBUG_JS_MODULES)
2640 dnl ========================================================
2642 dnl = Profiling and Instrumenting
2644 dnl ========================================================
2645 MOZ_ARG_HEADER(Profiling and Instrumenting)
2647 dnl ========================================================
2648 dnl = Offer a way to disable the startup cache
2649 dnl ========================================================
2651 MOZ_ARG_DISABLE_BOOL(startupcache,
2652 [ --disable-startupcache Disable startup cache ],
2653 MOZ_DISABLE_STARTUPCACHE=1,
2654 MOZ_DISABLE_STARTUPCACHE=)
2656 if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
2657 AC_DEFINE(MOZ_DISABLE_STARTUPCACHE)
2659 AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
2661 dnl ========================================================
2662 dnl = Support for demangling undefined symbols
2663 dnl ========================================================
2664 if test -z "$SKIP_LIBRARY_CHECKS"; then
2667 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
2671 # Demangle only for debug or DMD builds
2672 MOZ_DEMANGLE_SYMBOLS=
2673 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
2674 MOZ_DEMANGLE_SYMBOLS=1
2675 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
2677 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
2679 dnl ========================================================
2680 dnl = Support for gcc stack unwinding (from gcc 3.3)
2681 dnl ========================================================
2682 if test -z "$SKIP_LIBRARY_CHECKS"; then
2685 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
2689 dnl ========================================================
2691 dnl ========================================================
2693 MOZ_ARG_WITH_STRING(jitreport-granularity,
2694 [ --jitreport-granularity=N
2695 Default granularity at which to report JIT code
2698 1 - code ranges for whole functions only
2699 2 - per-line information
2700 3 - per-op information],
2701 JITREPORT_GRANULARITY=$withval,
2702 JITREPORT_GRANULARITY=3)
2704 AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
2706 dnl ========================================================
2710 dnl ========================================================
2711 MOZ_ARG_HEADER(Misc. Options)
2713 dnl ========================================================
2714 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
2715 dnl ========================================================
2716 MOZ_ARG_WITH_STRING(user-appdir,
2717 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
2718 [ val=`echo $withval`
2719 if echo "$val" | grep "\/" >/dev/null; then
2720 AC_MSG_ERROR("Homedir must be single relative path.")
2725 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
2727 if test -z "$SKIP_COMPILER_CHECKS"; then
2728 dnl ========================================================
2730 dnl = Compiler Options
2732 dnl ========================================================
2733 MOZ_ARG_HEADER(Compiler Options)
2735 dnl ========================================================
2736 dnl Check for gcc -pipe support
2737 dnl ========================================================
2738 AC_MSG_CHECKING([for -pipe support])
2739 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
2740 dnl Any gcc that supports firefox supports -pipe.
2741 CFLAGS="$CFLAGS -pipe"
2742 CXXFLAGS="$CXXFLAGS -pipe"
2743 AC_MSG_RESULT([yes])
2748 fi # ! SKIP_COMPILER_CHECKS
2750 AC_DEFINE(CPP_THROW_NEW, [throw()])
2753 if test "$COMPILE_ENVIRONMENT"; then
2755 fi # COMPILE_ENVIRONMENT
2757 dnl ========================================================
2759 dnl = Static Build Options
2761 dnl ========================================================
2762 MOZ_ARG_HEADER(Static build options)
2764 if test -z "$MOZ_SYSTEM_ZLIB"; then
2765 if test -n "$JS_SHARED_LIBRARY" -o -n "$MOZ_LINKER"; then
2767 AC_DEFINE(ZLIB_IN_MOZGLUE)
2771 AC_SUBST(ZLIB_IN_MOZGLUE)
2773 dnl ========================================================
2775 dnl = Standalone module options
2777 dnl ========================================================
2778 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
2781 dnl ========================================================
2783 if test -z "$SKIP_PATH_CHECKS"; then
2784 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
2785 if test "$MOZ_ENABLE_GTK" ; then
2786 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
2791 if test -z "${GLIB_GMODULE_LIBS}" \
2792 -a -n "${GLIB_CONFIG}"\
2793 -a "${GLIB_CONFIG}" != no\
2795 GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
2798 AC_SUBST_LIST(GLIB_GMODULE_LIBS)
2800 if test "$USE_FC_FREETYPE"; then
2801 if test "$COMPILE_ENVIRONMENT"; then
2802 dnl ========================================================
2803 dnl = Check for freetype2 functionality
2804 dnl ========================================================
2805 if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
2807 _SAVE_CFLAGS="$CFLAGS"
2808 LIBS="$LIBS $FT2_LIBS"
2809 CFLAGS="$CFLAGS $FT2_CFLAGS"
2811 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
2812 ac_cv_member_FT_Bitmap_Size_y_ppem,
2813 [AC_TRY_COMPILE([#include <ft2build.h>
2814 #include FT_FREETYPE_H],
2816 if (sizeof s.y_ppem) return 0;
2818 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
2819 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
2820 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
2821 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
2823 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
2825 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
2826 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
2827 [FT_Bitmap_Size structure includes y_ppem field])
2829 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
2832 CFLAGS="$_SAVE_CFLAGS"
2835 _SAVE_CPPFLAGS="$CPPFLAGS"
2836 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
2837 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
2838 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
2839 CPPFLAGS="$_SAVE_CPPFLAGS"
2843 dnl ========================================================
2844 dnl Check if we need the 32-bit Linux SSE2 error dialog
2845 dnl ========================================================
2847 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
2849 dnl ========================================================
2850 dnl Check for pixman and cairo
2851 dnl ========================================================
2854 MOZ_ARG_ENABLE_BOOL(system-cairo,
2855 [ --enable-system-cairo Obsolete: do not use this option],
2856 AC_MSG_ERROR(--enable-system-cairo is not supported),
2860 MOZ_ARG_ENABLE_BOOL(system-pixman,
2861 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
2863 MOZ_TREE_PIXMAN=force,
2866 if test "$MOZ_TREE_PIXMAN"; then
2867 AC_DEFINE(MOZ_TREE_PIXMAN)
2869 PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.19.2)
2872 MOZ_CAIRO_CFLAGS="-I${DIST}/include/cairo"
2873 AC_DEFINE(MOZ_TREE_CAIRO)
2875 if test "$OS_ARCH" = "WINNT"; then
2876 # For now we assume that we will have a uint64_t available through
2877 # one of the above headers or mozstdint.h.
2878 AC_DEFINE(HAVE_UINT64_T)
2881 # Define macros for cairo-features.h
2882 TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
2883 if test "$MOZ_X11"; then
2884 XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
2885 XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
2886 PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
2888 if test "$_HAVE_FREETYPE2"; then
2889 FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
2890 MOZ_ENABLE_CAIRO_FT=1
2891 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
2894 case "$MOZ_WIDGET_TOOLKIT" in
2896 QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
2897 QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
2898 QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
2901 WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
2902 WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
2903 WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
2905 if test "$COMPILE_ENVIRONMENT"; then
2906 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
2910 if test "$USE_FC_FREETYPE"; then
2911 FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
2913 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
2914 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
2916 AC_SUBST(PS_SURFACE_FEATURE)
2917 AC_SUBST(SVG_SURFACE_FEATURE)
2918 AC_SUBST(XLIB_SURFACE_FEATURE)
2919 AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
2920 AC_SUBST(QUARTZ_SURFACE_FEATURE)
2921 AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
2922 AC_SUBST(WIN32_SURFACE_FEATURE)
2923 AC_SUBST(OS2_SURFACE_FEATURE)
2924 AC_SUBST(DIRECTFB_SURFACE_FEATURE)
2925 AC_SUBST(FT_FONT_FEATURE)
2926 AC_SUBST(FC_FONT_FEATURE)
2927 AC_SUBST(WIN32_FONT_FEATURE)
2928 AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
2929 AC_SUBST(QUARTZ_FONT_FEATURE)
2930 AC_SUBST(PNG_FUNCTIONS_FEATURE)
2931 AC_SUBST(QT_SURFACE_FEATURE)
2932 AC_SUBST(TEE_SURFACE_FEATURE)
2934 if test "$MOZ_X11"; then
2935 MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
2938 CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
2940 case "$MOZ_WIDGET_TOOLKIT" in
2942 TK_CFLAGS="$MOZ_CAIRO_CFLAGS $MOZ_PIXMAN_CFLAGS"
2943 TK_LIBS="$MOZ_CAIRO_LIBS $MOZ_PIXMAN_LIBS"
2947 AC_SUBST(MOZ_TREE_CAIRO)
2948 AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
2949 AC_SUBST_LIST(MOZ_CAIRO_LIBS)
2950 AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
2951 AC_SUBST(MOZ_TREE_PIXMAN)
2953 BINDGEN_SYSTEM_FLAGS="$_BINDGEN_CFLAGS $NSPR_CFLAGS $NSS_CFLAGS $MOZ_PIXMAN_CFLAGS $MOZ_CAIRO_CFLAGS"
2954 AC_SUBST(BINDGEN_SYSTEM_FLAGS)
2955 BINDGEN_SYSTEM_TOML_FLAGS="$BINDGEN_SYSTEM_FLAGS"
2956 AC_SUBST_TOML_LIST(BINDGEN_SYSTEM_TOML_FLAGS)
2958 dnl ========================================================
2960 dnl ========================================================
2961 MOZ_ARG_DISABLE_BOOL(xul,
2962 [ --disable-xul Disable XUL],
2964 if test "$MOZ_XUL"; then
2967 dnl remove extensions that require XUL
2968 MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
2973 dnl ========================================================
2974 dnl necko configuration options
2975 dnl ========================================================
2978 dnl option to disable necko's wifi scanner
2981 if test "$MOZ_WIDGET_TOOLKIT"; then
2983 case "$OS_TARGET" in
2985 if test -z "$MOZ_IOS"; then
2989 DragonFly|FreeBSD|WINNT)
3000 MOZ_ARG_DISABLE_BOOL(necko-wifi,
3001 [ --disable-necko-wifi Disable necko wifi scanner],
3005 if test "$NECKO_WIFI"; then
3006 if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
3007 AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
3009 AC_DEFINE(NECKO_WIFI)
3010 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
3012 AC_SUBST(NECKO_WIFI)
3013 AC_SUBST(NECKO_WIFI_DBUS)
3016 dnl option to disable cookies
3018 MOZ_ARG_DISABLE_BOOL(cookies,
3019 [ --disable-cookies Disable cookie support],
3022 AC_SUBST(NECKO_COOKIES)
3023 if test "$NECKO_COOKIES"; then
3024 AC_DEFINE(NECKO_COOKIES)
3025 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
3028 dnl ========================================================
3030 dnl = Maintainer debug option (no --enable equivalent)
3032 dnl ========================================================
3035 AC_SUBST_LIST(ASFLAGS)
3039 AC_SUBST(MOZ_AUTH_EXTENSION)
3040 AC_SUBST(MOZ_PREF_EXTENSIONS)
3041 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
3042 AC_SUBST(WARNINGS_AS_ERRORS)
3043 AC_SUBST_LIST(WARNINGS_CFLAGS)
3044 AC_SUBST_SET(MOZ_EXTENSIONS)
3045 AC_SUBST(MOZ_TOOLKIT_SEARCH)
3047 AC_SUBST(MOZ_UNIVERSALCHARDET)
3048 AC_SUBST(MOZ_SPELLCHECK)
3049 AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
3050 AC_SUBST(MOZ_CRASHREPORTER)
3051 AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
3052 AC_SUBST(MOZ_STUB_INSTALLER)
3053 AC_SUBST(MOZ_ENABLE_SIGNMAR)
3054 AC_SUBST(MOZ_UPDATER)
3056 AC_SUBST(MOZ_ANDROID_APPLICATION_CLASS)
3057 AC_SUBST(MOZ_ANDROID_BROWSER_INTENT_CLASS)
3058 AC_SUBST(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
3059 AC_SUBST(ENABLE_STRIP)
3060 AC_SUBST(PKG_SKIP_STRIP)
3061 AC_SUBST(STRIP_FLAGS)
3062 AC_SUBST(INCREMENTAL_LINKER)
3064 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
3066 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
3067 AC_SUBST(MOZ_LINKER_EXTRACT)
3069 if test -n "$MOZ_BINARY_EXTENSIONS"; then
3070 AC_DEFINE(MOZ_BINARY_EXTENSIONS)
3073 AC_SUBST(MOZ_REQUIRE_SIGNING)
3074 if test "$MOZ_REQUIRE_SIGNING" = 1; then
3075 AC_DEFINE(MOZ_REQUIRE_SIGNING)
3078 dnl ========================================================
3079 dnl = Mac bundle name prefix
3080 dnl ========================================================
3081 MOZ_ARG_WITH_STRING(macbundlename-prefix,
3082 [ --with-macbundlename-prefix=prefix
3083 Prefix for MOZ_MACBUNDLE_NAME],
3084 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
3086 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
3087 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
3088 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
3091 if test "$MOZ_DEBUG"; then
3092 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
3094 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
3096 AC_SUBST(MOZ_MACBUNDLE_NAME)
3098 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
3099 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
3100 # Otherwise, use MOZ_APP_DISPLAYNAME
3101 if test -z "$MOZ_MACBUNDLE_ID"; then
3102 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
3104 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
3105 if test "$MOZ_DEBUG"; then
3106 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
3109 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
3110 AC_SUBST(MOZ_MACBUNDLE_ID)
3112 dnl ========================================================
3113 dnl = Child Process Name for IPC
3114 dnl ========================================================
3115 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
3116 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
3118 # We want to let Android unpack the file at install time, but it only does
3119 # so if the file is named libsomething.so. The lib/ path is also required
3120 # because the unpacked file will be under the lib/ subdirectory and will
3121 # need to be executed from that path.
3122 MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
3124 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
3125 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
3127 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
3128 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
3129 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
3131 # The following variables are available to branding and application
3132 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
3133 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
3134 # impacts profile location and user-visible fields.
3135 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
3136 # versions of a given application (e.g. Aurora and Firefox both use
3137 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
3138 # for application.ini's "Name" field, which controls profile location in
3139 # the absence of a "Profile" field (see below), and various system
3140 # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
3141 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
3142 # Mac Bundle name, Updater, Installer), it is typically used for nightly
3143 # builds (e.g. Aurora for Firefox).
3144 # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
3145 # defaults to a lowercase form of MOZ_APP_BASENAME.
3146 # - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
3147 # profile name and remoting. If not set, defaults to MOZ_APP_NAME.
3148 # - MOZ_APP_PROFILE: When set, used for application.ini's
3149 # "Profile" field, which controls profile location.
3150 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
3151 # crash reporter server url.
3152 # - MOZ_APP_ANDROID_VERSION_CODE: On Android, "android:versionCode" for
3153 # the main application is set to the value of this variable. If not
3154 # set, it falls back to a Mozilla-specific value derived from the
3156 # - MOZ_ANDROID_SHARED_ID: On Android, "android:sharedUserId" for all Android
3157 # packages produced.
3158 # - MOZ_ANDROID_GCM_SENDERID: On Android, the Android GCM Sender ID used. GCM
3159 # sender IDs are not sensitive: see, http://stackoverflow.com/a/18216063.
3160 # - MOZ_MMA_GCM_SENDERID: This GCM Sender ID is used for MMA integration.
3161 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
3163 # The following environment variables used to have an effect, but don't anymore:
3164 # - MOZ_APP_VERSION: Defines the application version number. This was replaced with
3165 # the contents from the version.txt file in the application directory, or
3166 # browser/config/version.txt if there isn't one.
3167 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
3168 # in the "About" window. This was replaced with the contents from the
3169 # version_display.txt or version.txt in the application directory, or
3170 # browser/config/version_display.txt.
3172 if test -z "$MOZ_APP_NAME"; then
3173 MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
3176 if test -z "$MOZ_APP_REMOTINGNAME"; then
3177 MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
3180 if test -z "$ANDROID_PACKAGE_NAME" ; then
3181 # When we got rid of the Aurora channel we decided to replace the old
3182 # Nightly ANDROID_PACKAGE_NAME with Aurora. To make sure this is inherited
3183 # by all mozilla-central based branches we make this the new "default"
3184 # for Fennec. Non mozilla-central based branches set ANDROID_PACKAGE_NAME
3185 # in their mozconfig, so they will never get this. If there are ever
3186 # non-Fennec builds for Android, they will fall into the else block
3187 # and use their own default name.
3188 # https://bugzilla.mozilla.org/show_bug.cgi?id=1357808 has additional
3189 # background on this.
3190 if test "$MOZ_APP_NAME" = "fennec"; then
3191 ANDROID_PACKAGE_NAME="org.mozilla.fennec_aurora"
3193 ANDROID_PACKAGE_NAME="org.mozilla.$MOZ_APP_NAME"
3197 # Mozilla released Firefox for Android {Release,Beta} and {Aurora,Nightly} to
3198 # the public with specific common shared IDs and we need to keep them
3199 # consistent forever. The specific common values are set by per-channel
3200 # branding; all other channels use a generic sharedID, set below.
3201 if test -z "$MOZ_ANDROID_SHARED_ID" ; then
3202 MOZ_ANDROID_SHARED_ID="${ANDROID_PACKAGE_NAME}.sharedID"
3205 # For extensions and langpacks, we require a max version that is compatible
3206 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
3207 # 24.0a1 and 24.0a2 aren't affected
3209 # 24.1.1 becomes 24.*
3210 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
3211 if test -z "$IS_ALPHA"; then
3213 if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
3214 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
3216 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
3220 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
3223 AC_SUBST(MOZ_APP_NAME)
3224 AC_SUBST(MOZ_APP_REMOTINGNAME)
3225 AC_SUBST(MOZ_APP_DISPLAYNAME)
3226 AC_SUBST(MOZ_APP_BASENAME)
3227 AC_SUBST(MOZ_APP_VENDOR)
3228 AC_SUBST(MOZ_APP_PROFILE)
3229 AC_SUBST(MOZ_APP_ID)
3230 AC_SUBST(MOZ_APP_ANDROID_VERSION_CODE)
3231 AC_SUBST(MOZ_ANDROID_SHARED_ID)
3232 AC_SUBST(MOZ_ANDROID_GCM_SENDERID)
3233 AC_SUBST(MOZ_MMA_GCM_SENDERID)
3234 AC_SUBST(MAR_CHANNEL_ID)
3235 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
3236 AC_SUBST(MOZ_PROFILE_MIGRATOR)
3237 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
3238 AC_SUBST(MOZ_APP_UA_NAME)
3239 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
3240 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
3241 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
3243 AC_SUBST(MOZ_APP_MAXVERSION)
3244 AC_SUBST(MOZ_UA_OS_AGNOSTIC)
3245 if test -n "$MOZ_UA_OS_AGNOSTIC"; then
3246 AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
3249 AC_SUBST(MOZ_PKG_SPECIAL)
3250 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
3252 if test "$MOZILLA_OFFICIAL"; then
3253 # Build revisions should always be present in official builds
3254 MOZ_INCLUDE_SOURCE_INFO=1
3257 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
3258 # explicitly set the repository and changeset information in.
3259 AC_SUBST(MOZ_SOURCE_REPO)
3260 AC_SUBST(MOZ_SOURCE_CHANGESET)
3261 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
3263 if test "$MOZ_TELEMETRY_REPORTING"; then
3264 AC_DEFINE(MOZ_TELEMETRY_REPORTING)
3266 # Enable Telemetry by default for nightly and aurora channels
3267 if test -z "$RELEASE_OR_BETA"; then
3268 AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
3272 dnl If we have any service that uploads data (and requires data submission
3273 dnl policy alert), set MOZ_DATA_REPORTING.
3274 dnl We need SUBST for build system and DEFINE for xul preprocessor.
3275 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
3276 MOZ_DATA_REPORTING=1
3277 AC_DEFINE(MOZ_DATA_REPORTING)
3278 AC_SUBST(MOZ_DATA_REPORTING)
3282 AC_SUBST(WIN32_REDIST_DIR)
3283 AC_SUBST(WIN_UCRT_REDIST_DIR)
3285 dnl ========================================================
3287 dnl ========================================================
3291 if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
3297 dnl Echo the CFLAGS to remove extra whitespace.
3299 $_COMPILATION_CFLAGS \
3303 $_WARNINGS_CXXFLAGS \
3304 $_COMPILATION_CXXFLAGS \
3307 COMPILE_CFLAGS=`echo \
3311 COMPILE_CXXFLAGS=`echo \
3312 $_DEFINES_CXXFLAGS \
3316 $_WARNINGS_HOST_CFLAGS \
3317 $_COMPILATION_HOST_CFLAGS \
3320 HOST_CXXFLAGS=`echo \
3321 $_WARNINGS_HOST_CXXFLAGS \
3322 $_COMPILATION_HOST_CXXFLAGS \
3325 AC_SUBST(MOZ_SYSTEM_PNG)
3327 AC_SUBST_LIST(MOZ_PNG_CFLAGS)
3328 AC_SUBST_LIST(MOZ_PNG_LIBS)
3330 AC_SUBST(MOZ_SYSTEM_NSPR)
3332 AC_SUBST(MOZ_SYSTEM_NSS)
3334 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
3335 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
3336 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
3337 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
3338 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
3339 OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
3340 OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
3342 AC_SUBST(HOST_CMFLAGS)
3343 AC_SUBST(HOST_CMMFLAGS)
3344 AC_SUBST(OS_COMPILE_CMFLAGS)
3345 AC_SUBST(OS_COMPILE_CMMFLAGS)
3348 OS_CXXFLAGS="$CXXFLAGS"
3349 OS_CPPFLAGS="$CPPFLAGS"
3350 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
3351 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
3352 OS_LDFLAGS="$LDFLAGS"
3354 AC_SUBST_LIST(OS_CFLAGS)
3355 AC_SUBST_LIST(OS_CXXFLAGS)
3356 AC_SUBST_LIST(OS_CPPFLAGS)
3357 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
3358 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
3359 AC_SUBST_LIST(OS_LDFLAGS)
3364 AC_SUBST_LIST(HOST_CFLAGS)
3365 AC_SUBST_LIST(HOST_CPPFLAGS)
3366 AC_SUBST_LIST(HOST_CXXFLAGS)
3367 AC_SUBST(HOST_LDFLAGS)
3368 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
3369 AC_SUBST(HOST_BIN_SUFFIX)
3371 AC_SUBST(TARGET_XPCOM_ABI)
3372 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
3373 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
3374 AC_SUBST(HAVE_X86_AVX2)
3375 AC_SUBST(HAVE_ALTIVEC)
3377 AC_SUBST_LIST(DSO_CFLAGS)
3378 AC_SUBST_LIST(DSO_PIC_CFLAGS)
3379 AC_SUBST(DSO_LDOPTS)
3380 AC_SUBST(BIN_SUFFIX)
3382 AC_SUBST(NS_ENABLE_TSF)
3383 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
3384 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
3386 AC_SUBST(MOZ_DEVTOOLS)
3388 AC_SUBST(MOZ_PACKAGE_JSSHELL)
3389 AC_SUBST(MOZ_FOLD_LIBS)
3390 AC_SUBST_LIST(MOZ_FOLD_LIBS_FLAGS)
3394 dnl Host JavaScript runtime, if any, to use during cross compiles.
3397 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
3399 if test -n "$COMPILE_ENVIRONMENT"; then
3400 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
3402 dnl Check for missing components
3403 if test "$MOZ_X11"; then
3404 dnl ====================================================
3405 dnl = Check if X headers exist
3406 dnl ====================================================
3407 _SAVE_CFLAGS=$CFLAGS
3408 CFLAGS="$CFLAGS $XCFLAGS"
3412 #include <X11/Xlib.h>
3413 #include <X11/Intrinsic.h>
3414 #include <X11/extensions/XShm.h>
3418 if ((dpy = XOpenDisplay(NULL)) == NULL) {
3419 fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
3423 [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
3424 CFLAGS="$_SAVE_CFLAGS"
3426 if test -n "$MISSING_X"; then
3427 AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
3432 fi # COMPILE_ENVIRONMENT
3434 dnl Set various defines and substitutions
3435 dnl ========================================================
3437 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
3438 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
3439 ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
3440 ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
3441 ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
3442 ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
3443 AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
3444 AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
3445 AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
3448 AC_SUBST(MOZ_DEV_EDITION)
3449 if test -n "$MOZ_DEV_EDITION"; then
3450 AC_DEFINE(MOZ_DEV_EDITION)
3453 if test "$MOZ_DEBUG" -o "$DEVELOPER_OPTIONS"; then
3457 if test -n "$A11Y_LOG"; then
3461 dnl Spit out some output
3462 dnl ========================================================
3464 dnl The following defines are used by xpcom
3465 _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
3478 # Avoid using obsolete NSPR features
3479 AC_DEFINE(NO_NSPR_10_SUPPORT)
3481 MOZ_CREATE_CONFIG_STATUS()
3483 rm -fr confdefs* $ac_clean_files