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 minimum version of toolkit libs used by mozilla
47 dnl ========================================================
49 GLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_42
50 GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_42
53 GDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_14
56 dnl Set various checks
57 dnl ========================================================
60 dnl Initialize the Pthread test variables early so they can be
61 dnl overridden by each platform.
62 dnl ========================================================
66 LDFLAGS="$LDFLAGS $LINKER_LDFLAGS"
68 if test "$COMPILE_ENVIRONMENT"; then
70 fi # COMPILE_ENVIRONMENT
73 *-android*|*-linuxandroid*)
76 AC_PATH_PROG(OBJCOPY,objcopy)
82 dnl ========================================================
83 dnl Checks for compilers.
84 dnl ========================================================
86 if test "$COMPILE_ENVIRONMENT"; then
88 # Run some logic to figure out exe extensions (mostly for mingw's sake)
91 if test "$target" != "$host"; then
97 # Work around the conftest.exe access problem on Windows
101 MOZ_PATH_PROGS(AS, $AS as, $CC)
102 AC_CHECK_PROGS(STRIP, strip, :)
103 AC_CHECK_PROGS(OTOOL, otool, :)
108 dnl ========================================================
109 dnl Special win32 checks
110 dnl ========================================================
116 if test "$GCC" != "yes"; then
117 # Check to see if we are really running in a msvc environemnt
120 # Make sure compilers are valid
121 CXXFLAGS="$CXXFLAGS -TP"
124 AC_TRY_COMPILE([#include <stdio.h>],
125 [ printf("Hello World\n"); ],,
126 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
129 AC_TRY_COMPILE([#include <new.h>],
130 [ unsigned *test = new unsigned(42); ],,
131 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
134 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
135 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
136 AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
138 MSVC_C_RUNTIME_DLL=vcruntime140.dll
139 MSVC_CXX_RUNTIME_DLL=msvcp140.dll
141 # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
142 CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
144 if test -n "$WIN_UCRT_REDIST_DIR"; then
145 if test ! -d "$WIN_UCRT_REDIST_DIR"; then
146 AC_MSG_ERROR([Invalid Windows UCRT Redist directory: ${WIN_UCRT_REDIST_DIR}])
148 WIN_UCRT_REDIST_DIR=`cd "$WIN_UCRT_REDIST_DIR" && (pwd -W 2>/dev/null || pwd)`
151 AC_SUBST(MSVC_C_RUNTIME_DLL)
152 AC_SUBST(MSVC_CXX_RUNTIME_DLL)
154 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
156 if test -n "$WIN32_REDIST_DIR"; then
157 if test ! -d "$WIN32_REDIST_DIR"; then
158 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
160 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && (pwd -W 2>/dev/null || pwd)`
164 STL_FLAGS="-I${DIST}/stl_wrappers"
166 # Check w32api version
167 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
168 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
169 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
170 AC_TRY_COMPILE([#include <w32api.h>],
171 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
172 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
173 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
174 #error "test failed."
176 , [ res=yes ], [ res=no ])
177 AC_MSG_RESULT([$res])
178 if test "$res" != "yes"; then
179 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
181 # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
182 # causing problems with local implementations with the same name.
183 AC_DEFINE(STRSAFE_NO_DEPRECATE)
186 CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
187 CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
189 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
190 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
191 # Require OS features provided by IE 8.0 (Win7)
192 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0800)
197 if test -n "$_WIN32_MSVC"; then
199 SKIP_COMPILER_CHECKS=1
200 SKIP_LIBRARY_CHECKS=1
202 # Since we're skipping compiler and library checks, hard-code
205 AC_DEFINE(HAVE_ISATTY)
208 fi # COMPILE_ENVIRONMENT
213 AC_SUBST_LIST(STL_FLAGS)
214 AC_SUBST(WRAP_STL_INCLUDES)
216 dnl ========================================================
217 dnl set the defaults first
218 dnl ========================================================
219 MOZ_USER_DIR=".mozilla"
221 MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
223 dnl Configure platform-specific CPU architecture compiler options.
224 dnl ==============================================================
225 if test "$COMPILE_ENVIRONMENT"; then
227 fi # COMPILE_ENVIRONMENT
229 dnl ========================================================
230 dnl Android libstdc++
231 dnl ========================================================
234 if test "$COMPILE_ENVIRONMENT"; then
236 fi # COMPILE_ENVIRONMENT
238 dnl ========================================================
239 dnl Suppress Clang Argument Warnings
240 dnl ========================================================
241 WARNINGS_CFLAGS="$_WARNINGS_CFLAGS"
242 if test -n "${CLANG_CC}${CLANG_CL}"; then
243 WARNINGS_CFLAGS="-Qunused-arguments $WARNINGS_CFLAGS"
244 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
246 if test -n "${CLANG_CXX}${CLANG_CL}"; then
247 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
250 if test -n "$COMPILE_ENVIRONMENT"; then
254 dnl ========================================================
255 dnl GNU specific defaults
256 dnl ========================================================
257 if test "$GNU_CC"; then
261 SSSE3_FLAGS="-mssse3"
262 CFLAGS="$CFLAGS -fno-strict-aliasing"
264 if test "$OS_ARCH" != "WINNT" -o -z "$CLANG_CC"; then
265 DSO_PIC_CFLAGS='-fPIC'
266 ASFLAGS="$ASFLAGS -fPIC"
269 AC_MSG_CHECKING([for --noexecstack option to as])
271 CFLAGS="$CFLAGS -Wa,--noexecstack"
272 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
273 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
276 AC_MSG_CHECKING([for -z noexecstack option to ld])
277 _SAVE_LDFLAGS=$LDFLAGS
278 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
279 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
281 LDFLAGS=$_SAVE_LDFLAGS)
283 AC_MSG_CHECKING([for -z text option to ld])
284 _SAVE_LDFLAGS=$LDFLAGS
285 LDFLAGS="$LDFLAGS -Wl,-z,text"
286 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
288 LDFLAGS=$_SAVE_LDFLAGS)
290 AC_MSG_CHECKING([for -z relro option to ld])
291 _SAVE_LDFLAGS=$LDFLAGS
292 LDFLAGS="$LDFLAGS -Wl,-z,relro"
293 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
295 LDFLAGS=$_SAVE_LDFLAGS)
297 AC_MSG_CHECKING([for -z now option to ld])
298 _SAVE_LDFLAGS=$LDFLAGS
299 LDFLAGS="$LDFLAGS -Wl,-z,now"
300 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
302 LDFLAGS=$_SAVE_LDFLAGS)
304 AC_MSG_CHECKING([for -z nocopyreloc option to ld])
305 _SAVE_LDFLAGS=$LDFLAGS
306 LDFLAGS="$LDFLAGS -Wl,-z,nocopyreloc"
307 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
309 LDFLAGS=$_SAVE_LDFLAGS)
311 AC_MSG_CHECKING([for -Bsymbolic-functions option to ld])
312 _SAVE_LDFLAGS=$LDFLAGS
313 LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
314 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
316 LDFLAGS=$_SAVE_LDFLAGS)
318 AC_MSG_CHECKING([for --build-id=sha1 option to ld])
319 _SAVE_LDFLAGS=$LDFLAGS
320 LDFLAGS="$LDFLAGS -Wl,--build-id=sha1"
321 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
323 LDFLAGS=$_SAVE_LDFLAGS)
325 AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
326 HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
327 _SAVE_LDFLAGS=$LDFLAGS
328 LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
329 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
330 [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
332 LDFLAGS=$_SAVE_LDFLAGS
334 # Check for -mssse3 on $CC
335 AC_MSG_CHECKING([if toolchain supports -mssse3 option])
336 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
338 CFLAGS="$CFLAGS -mssse3"
339 AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
340 [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
344 # Check for -msse4.1 on $CC
345 AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
346 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
348 CFLAGS="$CFLAGS -msse4.1"
349 AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
350 [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
354 case "${CPU_ARCH}" in
356 AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
358 [asm volatile ("vpermq \$0xd8,%ymm0,%ymm0 \n");],
359 result="yes", result="no")
360 AC_MSG_RESULT("$result")
361 if test "$result" = "yes"; then
368 if test "$GCC_USE_GNU_LD"; then
369 # Some tools like ASan use a runtime library that is only
370 # linked against executables, so we must allow undefined
371 # symbols for shared objects in some cases.
372 if test -z "$MOZ_ASAN$MOZ_MSAN$MOZ_UBSAN$MOZ_TSAN$FUZZING_INTERFACES"; then
373 # Don't allow undefined symbols in libraries
374 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
376 # BSDs need `environ' exposed for posix_spawn (bug 753046)
378 DragonFly|FreeBSD|NetBSD|OpenBSD)
379 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
380 DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
382 DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
389 _DEFINES_CFLAGS="-include $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
391 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
394 if test "$GNU_CXX"; then
395 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
397 _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
400 dnl ========================================================
401 dnl System overrides of the defaults for host
402 dnl ========================================================
405 if test -n "$_WIN32_MSVC"; then
406 HOST_CFLAGS="$HOST_CFLAGS"
408 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
410 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
411 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
414 case "${host_cpu}" in
416 if test -n "$_WIN32_MSVC"; then
417 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
421 if test -n "$_WIN32_MSVC"; then
422 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
424 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
430 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
431 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
434 *-linux*|*-kfreebsd*-gnu|*-gnu*)
435 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
436 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
440 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
441 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
445 dnl ========================================================
446 dnl System overrides of the defaults for target
447 dnl ========================================================
451 MOZ_OPTIMIZE_FLAGS="-O3"
454 dnl DTrace and -dead_strip don't interact well. See bug 403132.
455 dnl ===================================================================
456 if test "x$enable_dtrace" = "xyes"; then
457 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
459 dnl check for the presence of the -dead_strip linker flag
460 AC_MSG_CHECKING([for -dead_strip option to ld])
461 _SAVE_LDFLAGS=$LDFLAGS
462 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
463 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
464 if test -n "$_HAVE_DEAD_STRIP" ; then
466 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
471 LDFLAGS=$_SAVE_LDFLAGS
477 *-android*|*-linuxandroid*)
478 if test "$COMPILE_ENVIRONMENT" -a -n "$MOZ_MEMORY"; then
482 if test -z "$CLANG_CC"; then
483 MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
485 # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
486 # -Oz is smaller than -Os on clang.
487 MOZ_OPTIMIZE_FLAGS="-Oz"
488 # Disable the outliner, which causes performance regressions, and is
489 # enabled on some platforms at -Oz.
490 if test -z "$MOZ_LTO"; then
491 DISABLE_OUTLINER="-mno-outline"
493 CFLAGS="$CFLAGS $DISABLE_OUTLINER"
494 AC_TRY_COMPILE(,,[MOZ_OPTIMIZE_FLAGS="$MOZ_OPTIMIZE_FLAGS $DISABLE_OUTLINER"])
495 CFLAGS="$_SAVE_CFLAGS"
497 DISABLE_OUTLINER="-Wl,-plugin-opt=-enable-machine-outliner=never"
498 _SAVE_LDFLAGS=$LDFLAGS
499 LDFLAGS="$LDFLAGS $MOZ_LTO_LDFLAGS $DISABLE_OUTLINER"
500 AC_TRY_LINK(,,[MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS $DISABLE_OUTLINER"])
501 LDFLAGS="$_SAVE_LDFLAGS"
507 if test "$GNU_CC" -o "$GNU_CXX"; then
508 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
509 if test -n "$MOZ_DEBUG"; then
510 MOZ_OPTIMIZE_FLAGS="-Os"
512 MOZ_OPTIMIZE_FLAGS="-O2"
514 if test -z "$CLANG_CC"; then
515 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
519 case "${target_cpu}" in
521 CFLAGS="$CFLAGS -mieee"
522 CXXFLAGS="$CXXFLAGS -mieee"
528 # certain versions of cygwin's makedepend barf on the
529 # #include <string> vs -I./dist/include/string issue so don't use it
530 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
531 # $GNU_CC will match gcc and clang; while $CLANG_CC will match only clang
532 if test -z "$CLANG_CC"; then
533 AC_MSG_ERROR(Firefox cannot be built with mingw-gcc and requires a mingw-clang toolchain to work)
537 # mingw doesn't require kernel32, user32, and advapi32 explicitly
538 LIBS="$LIBS -luuid -lusp10 -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
541 MOZ_OPTIMIZE_FLAGS="-O2"
543 WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
544 WIN32_GUI_EXE_LDFLAGS=-mwindows
546 # Silence problematic clang warnings
547 CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
548 LDFLAGS="$LDFLAGS -Wl,--no-insert-timestamp"
550 TARGET_COMPILER_ABI=msvc
551 STRIP='echo not_strip'
552 # aarch64 doesn't support subsystems below 6.02
553 if test "$CPU_ARCH" = "aarch64"; then
554 WIN32_SUBSYSTEM_VERSION=6.02
556 WIN32_SUBSYSTEM_VERSION=6.01
558 WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
559 WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
560 DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
561 _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
562 _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
563 CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
564 CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
565 if test "$CPU_ARCH" = "x86"; then
566 dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
567 dnl more recent, so set that explicitly here unless another
568 dnl target arch has already been set.
570 if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
571 CFLAGS="$CFLAGS -arch:SSE2"
573 if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
574 CXXFLAGS="$CXXFLAGS -arch:SSE2"
577 SSE_FLAGS="-arch:SSE"
578 SSE2_FLAGS="-arch:SSE2"
579 dnl MSVC allows the use of intrinsics without any flags
580 dnl and doesn't have a separate arch for SSSE3
581 SSSE3_FLAGS="-arch:SSE2"
583 dnl clang-cl requires appropriate flags to enable SSSE3 support
584 dnl on all architectures.
585 SSSE3_FLAGS="-mssse3"
586 dnl VS2013+ supports -Gw for better linker optimizations.
587 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
588 dnl Disabled on ASan because it causes false-positive ODR violations.
589 if test -z "$MOZ_ASAN"; then
591 CXXFLAGS="$CXXFLAGS -Gw"
593 # String tail merging doesn't play nice with ASan's ODR checker.
594 LDFLAGS="$LDFLAGS -opt:nolldtailmerge"
596 # XXX We should combine some of these with our generic GCC-style
599 # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
600 CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
601 # We use offsetof on non-POD objects all the time.
602 # We also suppress this warning on other platforms.
603 CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
604 # This warns for reasonable things like:
605 # enum { X = 0xffffffffU };
606 # which is annoying for IDL headers.
607 CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
608 # This warns for cases that would be reached by the Microsoft
609 # #include rules, but also currently warns on cases that would
610 # *also* be reached by standard C++ include rules. That
611 # behavior doesn't seem useful, so we turn it off.
612 CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
613 # We normally error out on unknown pragmas, but since clang-cl
614 # claims to be MSVC, it would be difficult to add
615 # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
616 # use such pragmas, so just ignore them.
617 CFLAGS="$CFLAGS -Wno-unknown-pragmas"
618 CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
619 # We get errors about various #pragma intrinsic directives from
620 # clang-cl, and we don't need to hear about those.
621 CFLAGS="$CFLAGS -Wno-ignored-pragmas"
622 CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
623 # clang-cl's Intrin.h marks things like _ReadWriteBarrier
624 # as __attribute((__deprecated__)). This is nice to know,
625 # but since we don't get the equivalent warning from MSVC,
626 # let's just ignore it.
627 CFLAGS="$CFLAGS -Wno-deprecated-declarations"
628 CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
629 # We use a function like:
630 # __declspec(noreturn) __inline void f() {}
631 # which -Winvalid-noreturn complains about. Again, MSVC seems
632 # OK with it, so let's silence the warning.
633 CFLAGS="$CFLAGS -Wno-invalid-noreturn"
634 CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
635 # Missing |override| on virtual function declarations isn't
636 # something that MSVC currently warns about.
637 CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
638 # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
639 # declaration on |operator delete(void*)|. However, clang-cl
640 # must internally declare |operator delete(void*)| differently,
641 # which causes this warning for virtually every file in the
642 # tree. clang-cl doesn't support -fno-exceptions or equivalent,
643 # so there doesn't seem to be any way to convince clang-cl to
644 # declare |delete| differently. Therefore, suppress this
646 CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
647 # Macros like STDMETHOD() and IFACEMETHOD() can declare
648 # __attribute__((nothrow)) on their respective method declarations,
649 # while the definitions are left without the matching attribute.
650 CXXFLAGS="$CXXFLAGS -Wno-microsoft-exception-spec"
651 # At least one MSVC header and several headers in-tree have
652 # unused typedefs, so turn this on.
653 CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
654 # jemalloc uses __declspec(allocator) as a profiler hint,
655 # which clang-cl doesn't understand.
656 CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
657 # __attribute__((unused)) really means "might be unused" and
658 # we use it to avoid warnings about things that are unused
659 # in some compilation units, but used in many others. This
660 # warning insists on complaining about the latter case, which
661 # is annoying, and rather noisy.
662 CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused"
663 # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
664 CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
665 LIBS="$LIBS user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
666 MOZ_DEBUG_LDFLAGS='-DEBUG'
667 if test "$HOST_OS_ARCH" != "WINNT"; then
668 # %_PDB% is a special signal to emit only the PDB basename. This
669 # avoids problems in Windows tools that don't like forward-slashes.
670 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -PDBALTPATH:%_PDB%"
672 MOZ_OPTIMIZE_FLAGS='-O2'
674 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE"
675 dnl Minimum reqiurement of Gecko is VS2015 or later which supports
676 dnl both SSSE3 and SSE4.1.
677 HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
678 HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
679 dnl allow AVX2 code from VS2015
682 AC_DEFINE(WIN32_LEAN_AND_MEAN)
683 dnl See http://support.microsoft.com/kb/143208 to use STL
686 MOZ_USER_DIR="Mozilla"
690 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.])
696 if test -n "$GNU_CC"; then
697 CFLAGS="$CFLAGS -mstackrealign"
698 CXXFLAGS="$CXXFLAGS -mstackrealign"
699 LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
701 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
702 LDFLAGS="$LDFLAGS -SAFESEH"
708 if test -n "$_WIN32_MSVC"; then
709 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
714 if test -n "$_WIN32_MSVC"; then
715 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:ARM64"
720 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
726 CFLAGS="$CFLAGS -Dunix"
727 CXXFLAGS="$CXXFLAGS -Dunix"
728 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
729 DSO_PIC_CFLAGS='-fPIC -DPIC'
731 MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
733 DSO_PIC_CFLAGS='-fPIC -DPIC'
736 # This will fail on a.out systems prior to 1.5.1_ALPHA.
737 if test "$LIBRUNPATH"; then
738 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
743 if test -z "$X11BASE"; then
746 MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
747 DSO_PIC_CFLAGS='-fPIC'
748 DSO_LDOPTS='-shared -fPIC'
749 if test "$LIBRUNPATH"; then
750 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
755 MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
760 CFLAGS="$CFLAGS $DSO_PIC_CFLAGS"
761 CXXFLAGS="$CXXFLAGS $DSO_PIC_CFLAGS"
763 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
764 MOZ_OPTIMIZE_FLAGS="-O"
767 AC_SUBST_LIST(MMX_FLAGS)
768 AC_SUBST_LIST(SSE_FLAGS)
769 AC_SUBST_LIST(SSE2_FLAGS)
770 AC_SUBST_LIST(SSSE3_FLAGS)
773 if test -n "$MOZ_LINKER"; then
774 AC_DEFINE(MOZ_LINKER)
777 if test -z "$COMPILE_ENVIRONMENT"; then
778 SKIP_COMPILER_CHECKS=1
779 SKIP_LIBRARY_CHECKS=1
783 fi # COMPILE_ENVIRONMENT
785 if test -z "$SKIP_COMPILER_CHECKS"; then
786 dnl Checks for typedefs, structures, and compiler characteristics.
787 dnl ========================================================
802 case "${OS_TARGET}" in
806 STL_FLAGS="-I${DIST}/stl_wrappers"
811 if test "$MOZ_BUILD_APP" = "tools/crashreporter"; then
814 if test "$MOZ_BUILD_APP" = "tools/crashreporter/injector"; then
818 dnl Checks for header files.
819 dnl ========================================================
822 dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
823 AC_CACHE_CHECK(for sockaddr_in.sin_len,
824 ac_cv_sockaddr_in_sin_len,
825 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
826 #include <sys/types.h>
828 #include <netinet/in.h>
829 struct sockaddr_in x;
830 void *foo = (void*) &x.sin_len;],
832 [ac_cv_sockaddr_in_sin_len=true],
833 [ac_cv_sockaddr_in_sin_len=false])])
834 if test "$ac_cv_sockaddr_in_sin_len" = true ; then
835 AC_DEFINE(HAVE_SIN_LEN)
836 dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
837 AC_DEFINE(HAVE_SCONN_LEN)
840 AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
841 ac_cv_sockaddr_in6_sin6_len,
842 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
843 #include <sys/types.h>
845 #include <netinet/in.h>
846 struct sockaddr_in6 x;
847 void *foo = (void*) &x.sin6_len;],
849 [ac_cv_sockaddr_in6_sin6_len=true],
850 [ac_cv_sockaddr_in6_sin6_len=false])])
851 if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
852 AC_DEFINE(HAVE_SIN6_LEN)
855 AC_CACHE_CHECK(for sockaddr.sa_len,
856 ac_cv_sockaddr_sa_len,
857 [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
858 #include <sys/types.h>
860 #include <sys/socket.h>
862 void *foo = (void*) &x.sa_len;],
864 [ac_cv_sockaddr_sa_len=true],
865 [ac_cv_sockaddr_sa_len=false])])
866 if test "$ac_cv_sockaddr_sa_len" = true ; then
867 AC_DEFINE(HAVE_SA_LEN)
870 dnl Checks for libraries.
871 dnl ========================================================
872 AC_CHECK_LIB(c_r, gethostbyname_r)
874 dnl We don't want to link with libdl even if it's present on OS X, since
875 dnl it's not used and not part of the default installation. OS/2 has dlfcn
877 dnl We don't want to link against libm or libpthread on Darwin since
878 dnl they both are just symlinks to libSystem and explicitly linking
879 dnl against libSystem causes issues when debugging (see bug 299601).
884 AC_SEARCH_LIBS(dlopen, dl,
885 MOZ_CHECK_HEADER(dlfcn.h,
886 AC_DEFINE(HAVE_DLOPEN)))
890 _SAVE_CFLAGS="$CFLAGS"
891 CFLAGS="$CFLAGS -D_GNU_SOURCE"
892 AC_CHECK_FUNCS(dladdr)
893 CFLAGS="$_SAVE_CFLAGS"
895 if test ! "$GNU_CXX"; then
896 AC_CHECK_LIB(C, demangle)
899 AC_CHECK_LIB(socket, socket)
901 dnl ========================================================
902 dnl = pthread support
903 dnl = Start by checking whether the system support pthreads
904 dnl ========================================================
910 AC_CHECK_LIB(pthreads, pthread_create,
911 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
912 AC_CHECK_LIB(pthread, pthread_create,
913 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
914 AC_CHECK_LIB(c_r, pthread_create,
915 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
916 AC_CHECK_LIB(c, pthread_create,
925 dnl ========================================================
926 dnl Do the platform specific pthread hackery
927 dnl ========================================================
928 if test "$MOZ_USE_PTHREADS"x != x
931 dnl See if -pthread is supported.
934 ac_cv_have_dash_pthread=no
935 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
936 echo 'int main() { return 0; }' | cat > conftest.c
937 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
938 if test $? -eq 0; then
939 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
940 ac_cv_have_dash_pthread=yes
943 # Freebsd doesn't use -pthread for compiles, it uses them for linking
946 CFLAGS="$CFLAGS -pthread"
947 CXXFLAGS="$CXXFLAGS -pthread"
953 AC_MSG_RESULT($ac_cv_have_dash_pthread)
956 dnl See if -pthreads is supported.
958 ac_cv_have_dash_pthreads=no
959 if test "$ac_cv_have_dash_pthread" = "no"; then
960 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
961 echo 'int main() { return 0; }' | cat > conftest.c
962 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
963 if test $? -eq 0; then
964 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
965 ac_cv_have_dash_pthreads=yes
966 CFLAGS="$CFLAGS -pthreads"
967 CXXFLAGS="$CXXFLAGS -pthreads"
971 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
976 AC_DEFINE(_REENTRANT)
977 AC_DEFINE(_THREAD_SAFE)
978 dnl -pthread links in -lpthread, so don't specify it explicitly.
979 if test "$ac_cv_have_dash_pthread" = "yes"; then
980 _PTHREAD_LDFLAGS="-pthread"
984 *-*-openbsd*|*-*-bsdi*)
985 AC_DEFINE(_REENTRANT)
986 AC_DEFINE(_THREAD_SAFE)
987 dnl -pthread links in -lc_r, so don't specify it explicitly.
988 if test "$ac_cv_have_dash_pthread" = "yes"; then
989 _PTHREAD_LDFLAGS="-pthread"
993 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
994 AC_DEFINE(_REENTRANT)
998 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
999 AC_SUBST(MOZ_USE_PTHREADS)
1000 MOZ_CHECK_HEADERS(pthread.h)
1004 dnl Checks for library functions.
1005 dnl ========================================================
1006 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall lutimes)
1008 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
1009 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
1010 ac_cv_clock_monotonic,
1011 [for libs in "" -lrt; do
1014 dnl clock_gettime is available on OSX since 10.12, so depending on MACOSX_DEPLOYMENT_TARGET,
1015 dnl we should or not be able to use it. To detect if we can, we need to make the
1016 dnl availability attribute strict, so that compilation fails when the target is < 10.12.
1017 AC_TRY_LINK([#define availability(os, ...) availability(os, strict, __VA_ARGS)
1019 [ struct timespec ts;
1020 clock_gettime(CLOCK_MONOTONIC, &ts); ],
1021 ac_cv_clock_monotonic=$libs
1024 ac_cv_clock_monotonic=no)
1027 if test "$ac_cv_clock_monotonic" != "no"; then
1028 HAVE_CLOCK_MONOTONIC=1
1029 REALTIME_LIBS=$ac_cv_clock_monotonic
1030 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
1031 AC_SUBST(HAVE_CLOCK_MONOTONIC)
1032 AC_SUBST_LIST(REALTIME_LIBS)
1035 dnl Turn on warnings-as-errors to prevent implicit declaration of
1036 dnl pthread_cond_timedwait_monotonic_np, which can cause this test to
1037 dnl inadvertently pass even if the function does not really exist.
1038 _SAVE_CFLAGS="$CFLAGS"
1039 CFLAGS="$CFLAGS $WARNINGS_AS_ERRORS"
1040 AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
1041 ac_cv_pthread_cond_timedwait_monotonic_np,
1042 AC_TRY_LINK([#include <pthread.h>],
1043 [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
1044 ac_cv_pthread_cond_timewait_monotonic_np=yes,
1045 ac_cv_pthread_cond_timewait_monotonic_np=no))
1046 if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
1047 AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
1049 CFLAGS=$_SAVE_CFLAGS
1053 ac_cv_func_res_ninit,
1054 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
1055 dnl no need for res_ninit() on NetBSD and OpenBSD
1056 ac_cv_func_res_ninit=no
1060 #define _BSD_SOURCE 1
1062 #include <sys/types.h>
1063 #include <netinet/in.h>
1064 #include <arpa/nameser.h>
1067 [int foo = res_ninit(&_res);],
1068 [ac_cv_func_res_ninit=yes],
1069 [ac_cv_func_res_ninit=no])
1073 if test "$ac_cv_func_res_ninit" = "yes"; then
1074 AC_DEFINE(HAVE_RES_NINIT)
1075 dnl must add the link line we do something as foolish as this... dougt
1077 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
1078 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
1083 dnl ===================================================================
1084 dnl ========================================================
1085 dnl Put your C++ language/feature checks below
1086 dnl ========================================================
1090 if test "$GNU_CC"; then
1091 if test "$CPU_ARCH" = "arm" ; then
1092 AC_CACHE_CHECK(for ARM EABI,
1096 #if defined(__ARM_EABI__)
1099 #error Not ARM EABI.
1102 ac_cv_gcc_arm_eabi="yes",
1103 ac_cv_gcc_arm_eabi="no")])
1104 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
1106 ARM_ABI_PREFIX=eabi-
1108 ARM_ABI_PREFIX=oabi-
1112 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
1115 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
1116 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
1117 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
1119 _SAVE_LDFLAGS=$LDFLAGS
1120 LDFLAGS="$LDFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
1121 AC_CACHE_CHECK(for __thread keyword for TLS variables,
1122 ac_cv_thread_keyword,
1123 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
1124 [return tlsIsMainThread;],
1125 ac_cv_thread_keyword=yes,
1126 ac_cv_thread_keyword=no)])
1127 LDFLAGS=$_SAVE_LDFLAGS
1128 # The custom dynamic linker doesn't support TLS variables
1129 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
1130 # mips builds fail with TLS variables because of a binutils bug.
1132 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
1137 *-android*|*-linuxandroid*)
1144 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
1149 dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
1150 if test -n "$MOZ_LINKER"; then
1151 if test "$CPU_ARCH" = arm; then
1152 dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
1153 if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
1154 LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1155 _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
1159 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
1160 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
1161 dnl Since the linker only understands the sysv ones, no need to build the
1162 dnl gnu style tables anyways.
1163 LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
1166 dnl End of C++ language/feature checks
1169 dnl ========================================================
1170 dnl = Internationalization checks
1171 dnl ========================================================
1173 dnl Internationalization and Locale support is different
1174 dnl on various UNIX platforms. Checks for specific i18n
1175 dnl features go here.
1177 AC_HAVE_FUNCS(localeconv)
1179 fi # ! SKIP_COMPILER_CHECKS
1181 if test -n "${COMPILE_ENVIRONMENT}"; then
1186 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1187 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1188 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1191 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1192 dnl features that Windows actually does support.
1194 if test -n "$SKIP_COMPILER_CHECKS"; then
1195 dnl Windows has malloc.h
1196 AC_DEFINE(MALLOC_H, [<malloc.h>])
1197 AC_DEFINE(HAVE_FORCEINLINE)
1198 AC_DEFINE(HAVE_LOCALECONV)
1199 fi # SKIP_COMPILER_CHECKS
1201 dnl Mozilla specific options
1202 dnl ========================================================
1203 dnl The macros used for command line options
1204 dnl are defined in build/autoconf/altoptions.m4.
1206 dnl ========================================================
1210 dnl ========================================================
1212 MOZ_ARG_HEADER(Application)
1214 ENABLE_SYSTEM_EXTENSION_DIRS=1
1215 MOZ_BRANDING_DIRECTORY=
1216 MOZ_OFFICIAL_BRANDING=
1217 MOZ_AUTH_EXTENSION=1
1218 MOZ_UNIVERSALCHARDET=1
1222 MOZ_BINARY_EXTENSIONS=
1225 dnl ========================================================
1226 dnl = Trademarked Branding
1227 dnl ========================================================
1228 MOZ_ARG_ENABLE_BOOL(official-branding,
1229 [ --enable-official-branding
1230 Enable Official mozilla.org Branding
1231 Do not distribute builds with
1232 --enable-official-branding unless you have
1233 permission to use trademarks per
1234 http://www.mozilla.org/foundation/trademarks/ .],
1235 MOZ_OFFICIAL_BRANDING=1,
1236 MOZ_OFFICIAL_BRANDING=)
1238 # Allow the application to influence configure with a confvars.sh script.
1239 AC_MSG_CHECKING([if app-specific confvars.sh exists])
1240 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
1241 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
1242 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
1247 dnl ========================================================
1248 dnl Ensure Android SDK and build-tools versions depending on
1250 dnl ========================================================
1252 case "$MOZ_BUILD_APP" in
1258 dnl ========================================================
1260 dnl = Toolkit Options
1262 dnl ========================================================
1263 MOZ_ARG_HEADER(Toolkit Options)
1265 dnl ========================================================
1266 dnl = Enable the toolkit as needed =
1267 dnl ========================================================
1269 case "$MOZ_WIDGET_TOOLKIT" in
1272 LDFLAGS="$LDFLAGS -framework Cocoa"
1273 # Use -Wl as a trick to avoid -framework and framework names from
1274 # being separated by AC_SUBST_LIST.
1275 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'
1277 CFLAGS="$CFLAGS $TK_CFLAGS"
1278 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1279 MOZ_USER_DIR="Mozilla"
1283 LDFLAGS="$LDFLAGS -framework UIKit"
1285 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'
1286 CFLAGS="$CFLAGS $TK_CFLAGS"
1287 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1288 MOZ_USER_DIR="Mozilla"
1293 if test "$OS_TARGET" = Darwin; then
1294 LDFLAGS="$LDFLAGS -lobjc"
1297 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
1298 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
1299 case "$MOZ_WIDGET_TOOLKIT" in
1305 if test "$COMPILE_ENVIRONMENT"; then
1306 if test "$MOZ_WIDGET_TOOLKIT" = gtk; then
1307 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)
1308 MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
1309 TK_CFLAGS=$MOZ_GTK3_CFLAGS
1310 TK_LIBS=$MOZ_GTK3_LIBS
1311 dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
1312 dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
1313 AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
1315 if test "$MOZ_ENABLE_GTK"; then
1316 AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
1317 AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
1319 fi # COMPILE_ENVIRONMENT
1321 AC_SUBST_LIST(TK_CFLAGS)
1322 AC_SUBST_LIST(TK_LIBS)
1324 dnl ========================================================
1326 dnl = Components & Features
1328 dnl ========================================================
1329 MOZ_ARG_HEADER(Components and Features)
1331 AC_SUBST(MOZ_OFFICIAL_BRANDING)
1332 if test -n "$MOZ_OFFICIAL_BRANDING"; then
1333 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
1334 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
1336 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
1337 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
1341 MOZ_ARG_WITH_STRING(branding,
1342 [ --with-branding=dir Use branding from the specified directory.],
1343 MOZ_BRANDING_DIRECTORY=$withval)
1345 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
1346 if test -z "$REAL_BRANDING_DIRECTORY"; then
1347 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
1350 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1351 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
1354 AC_SUBST(MOZ_BRANDING_DIRECTORY)
1356 dnl ========================================================
1357 dnl = Distribution ID
1358 dnl ========================================================
1359 MOZ_ARG_WITH_STRING(distribution-id,
1360 [ --with-distribution-id=ID
1361 Set distribution-specific id (default=org.mozilla)],
1362 [ val=`echo $withval`
1363 MOZ_DISTRIBUTION_ID="$val"])
1365 if test -z "$MOZ_DISTRIBUTION_ID"; then
1366 MOZ_DISTRIBUTION_ID="org.mozilla"
1369 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
1370 AC_SUBST(MOZ_DISTRIBUTION_ID)
1372 dnl ========================================================
1373 dnl = libproxy support
1374 dnl ========================================================
1376 if test "$MOZ_ENABLE_GTK"
1378 MOZ_ENABLE_LIBPROXY=
1380 MOZ_ARG_ENABLE_BOOL(libproxy,
1381 [ --enable-libproxy Enable libproxy support ],
1382 MOZ_ENABLE_LIBPROXY=1,
1383 MOZ_ENABLE_LIBPROXY=)
1385 if test "$MOZ_ENABLE_LIBPROXY"
1387 PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
1388 AC_DEFINE(MOZ_ENABLE_LIBPROXY)
1391 AC_SUBST(MOZ_ENABLE_LIBPROXY)
1393 AC_TRY_COMPILE([#include <linux/ethtool.h>],
1394 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
1395 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
1397 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
1399 dnl ========================================================
1400 dnl = Apple platform decoder support
1401 dnl ========================================================
1402 if test "$COMPILE_ENVIRONMENT"; then
1403 if test -n "$MOZ_APPLEMEDIA"; then
1404 # hack in frameworks for fmp4 - see bug 1029974
1405 # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
1406 LDFLAGS="$LDFLAGS -framework AudioToolbox"
1407 dnl Verify CoreMedia is available.
1408 AC_CHECK_HEADERS([CoreMedia/CoreMedia.h VideoToolbox/VideoToolbox.h], [],
1409 [AC_MSG_ERROR([MacOS X 10.9 SDK or later is required])])
1411 fi # COMPILE_ENVIRONMENT
1413 dnl ========================================================
1415 dnl ========================================================
1417 MOZ_ARG_DISABLE_BOOL(negotiateauth,
1418 [ --disable-negotiateauth Disable GSS-API negotiation ],
1419 MOZ_AUTH_EXTENSION=,
1420 MOZ_AUTH_EXTENSION=1 )
1421 if test "$MOZ_AUTH_EXTENSION"; then
1422 AC_DEFINE(MOZ_AUTH_EXTENSION)
1425 dnl ========================================================
1426 dnl Searching of system directories for extensions.
1427 dnl Note: this switch is meant to be used for test builds
1428 dnl whose behavior should not depend on what happens to be
1429 dnl installed on the local machine.
1430 dnl ========================================================
1431 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
1432 [ --disable-system-extension-dirs
1433 Disable searching system- and account-global
1434 directories for extensions of any kind; use
1435 only profile-specific extension directories],
1436 ENABLE_SYSTEM_EXTENSION_DIRS=,
1437 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
1438 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
1439 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
1442 dnl ========================================================
1443 dnl = Universalchardet
1444 dnl ========================================================
1445 MOZ_ARG_DISABLE_BOOL(universalchardet,
1446 [ --disable-universalchardet
1447 Disable universal encoding detection],
1448 MOZ_UNIVERSALCHARDET=,
1449 MOZ_UNIVERSALCHARDET=1 )
1451 dnl ========================================================
1453 dnl ========================================================
1455 if test "$COMPILE_ENVIRONMENT" ; then
1457 dnl Moved gamepad platform check to moz.build, linux header check still needed here.
1458 if test "$OS_TARGET" = "Linux"; then
1459 MOZ_CHECK_HEADER([linux/joystick.h])
1460 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
1461 AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
1465 fi # COMPILE_ENVIRONMENT
1468 dnl ========================================================
1469 dnl = Enable compilation of specific extension modules
1470 dnl ========================================================
1472 MOZ_ARG_ENABLE_STRING(extensions,
1473 [ --enable-extensions Enable extensions],
1474 [ for option in `echo $enableval | sed 's/,/ /g'`; do
1475 if test "$option" = "yes" -o "$option" = "all"; then
1476 AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
1477 elif test "$option" = "no" -o "$option" = "none"; then
1479 elif test "$option" = "default"; then
1480 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
1481 elif test `echo "$option" | grep -c \^-` != 0; then
1482 option=`echo $option | sed 's/^-//'`
1483 MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
1485 MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
1488 MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
1490 dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
1491 dnl when trying to build a nonexistent extension.
1492 for extension in $MOZ_EXTENSIONS; do
1493 if test ! -d "${srcdir}/extensions/${extension}"; then
1494 AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
1498 # Avoid defining MOZ_ENABLE_CAIRO_FT on Windows platforms because
1499 # "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
1500 if test -n "$MOZ_TREE_FREETYPE" -a "$OS_TARGET" != WINNT; then
1501 MOZ_ENABLE_CAIRO_FT=1
1502 CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
1503 AC_SUBST_LIST(CAIRO_FT_CFLAGS)
1506 dnl ========================================================
1508 dnl ========================================================
1510 MOZ_ARG_DISABLE_BOOL(updater,
1511 [ --disable-updater Disable building of updater],
1515 if test -n "$MOZ_UPDATER"; then
1516 AC_DEFINE(MOZ_UPDATER)
1519 dnl ========================================================
1520 dnl parental controls (for Windows Vista)
1521 dnl ========================================================
1522 MOZ_ARG_DISABLE_BOOL(parental-controls,
1523 [ --disable-parental-controls
1524 Do not build parental controls],
1525 MOZ_DISABLE_PARENTAL_CONTROLS=1,
1526 MOZ_DISABLE_PARENTAL_CONTROLS=)
1527 if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
1528 AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
1531 AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
1533 dnl ========================================================
1534 dnl = Disable smartcard support
1535 dnl ========================================================
1536 if test -n "$MOZ_NO_SMART_CARDS"; then
1537 AC_DEFINE(MOZ_NO_SMART_CARDS)
1539 AC_SUBST(MOZ_NO_SMART_CARDS)
1541 dnl ========================================================
1542 dnl = Sandboxing support
1543 dnl ========================================================
1544 if test -n "$MOZ_TSAN" -o -n "$MOZ_ASAN"; then
1545 # Bug 1182565: TSan conflicts with sandboxing on Linux.
1546 # Bug 1287971: LSan also conflicts with sandboxing on Linux.
1554 MOZ_ARG_DISABLE_BOOL(sandbox,
1555 [ --disable-sandbox Disable sandboxing support],
1559 case "$OS_TARGET" in
1560 WINNT|Darwin|OpenBSD)
1564 x86_64|x86|arm|aarch64)
1566 # Linux sandbox is only available on x86{,_64} and arm{,64}.
1573 # Only enable the sandbox by default on Linux, OpenBSD, macOS, and Windows
1578 if test -n "$MOZ_SANDBOX"; then
1579 AC_DEFINE(MOZ_SANDBOX)
1582 AC_SUBST(MOZ_SANDBOX)
1585 dnl ========================================================
1587 dnl = Module specific options
1589 dnl ========================================================
1590 MOZ_ARG_HEADER(Individual module options)
1592 dnl ==============================
1593 dnl === SQLite fdatasync check ===
1594 dnl ==============================
1595 dnl Check to see if fdatasync is available and make use of it
1596 AC_CHECK_FUNC(fdatasync)
1598 dnl ========================================================
1599 dnl = Disable zipwriter
1600 dnl ========================================================
1601 MOZ_ARG_DISABLE_BOOL(zipwriter,
1602 [ --disable-zipwriter Disable zipwriter component],
1605 AC_SUBST(MOZ_ZIPWRITER)
1607 dnl ========================================================
1609 dnl = Feature options that require extra sources to be pulled
1611 dnl ========================================================
1612 dnl MOZ_ARG_HEADER(Features that require extra sources)
1614 dnl ========================================================
1616 dnl = Runtime debugging and Optimization Options
1618 dnl ========================================================
1619 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
1621 dnl ========================================================
1622 dnl = Enable code optimization. ON by default.
1623 dnl ========================================================
1625 # Use value from moz.configure if one is defined. Else use our computed
1627 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
1628 MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
1631 if test "$COMPILE_ENVIRONMENT"; then
1632 if test -n "$MOZ_OPTIMIZE"; then
1633 AC_MSG_CHECKING([for valid C compiler optimization flags])
1634 _SAVE_CFLAGS=$CFLAGS
1635 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
1636 AC_TRY_COMPILE([#include <stdio.h>],
1637 [printf("Hello World\n");],
1640 AC_MSG_RESULT([$_results])
1641 if test "$_results" = "no"; then
1642 AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
1644 CFLAGS=$_SAVE_CFLAGS
1645 if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
1646 # When using llvm-based LTO, non numeric optimization levels are
1647 # not supported by the linker, so force the linker to use -O2 (
1648 # which doesn't influence the level compilation units are actually
1650 case " $MOZ_OPTIMIZE_FLAGS " in
1651 *\ -Os\ *|*\ -Oz\ *)
1652 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
1657 fi # COMPILE_ENVIRONMENT
1659 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
1660 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
1661 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
1663 dnl ========================================================
1664 dnl = Enable runtime logging
1665 dnl ========================================================
1666 AC_DEFINE(MOZ_LOGGING)
1667 AC_DEFINE(FORCE_PR_LOG)
1669 dnl ========================================================
1670 dnl = This will enable logging of addref, release, ctor, dtor.
1671 dnl ========================================================
1672 _ENABLE_LOGREFCNT=42
1673 MOZ_ARG_ENABLE_BOOL(logrefcnt,
1674 [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
1675 _ENABLE_LOGREFCNT=1,
1676 _ENABLE_LOGREFCNT= )
1677 if test "$_ENABLE_LOGREFCNT" = "1"; then
1678 AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
1679 elif test -z "$_ENABLE_LOGREFCNT"; then
1680 AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
1683 case "${OS_TARGET}" in
1684 Android|WINNT|Darwin)
1685 MOZ_GLUE_IN_PROGRAM=
1688 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
1689 MOZ_GLUE_IN_PROGRAM=1
1690 AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
1694 dnl ========================================================
1695 dnl = Jemalloc build setup
1696 dnl ========================================================
1697 if test -z "$MOZ_MEMORY"; then
1700 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
1701 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.])
1706 dnl The generic feature tests that determine how to compute ncpus are long and
1707 dnl complicated. Therefore, simply define special cpp variables for the
1708 dnl platforms we have special knowledge of.
1711 export MOZ_NO_DEBUG_RTL=1
1715 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
1717 dnl ========================================================
1718 dnl = Enable using the clang plugin to build
1719 dnl ========================================================
1721 if test -n "$COMPILE_ENVIRONMENT"; then
1722 MOZ_CONFIG_CLANG_PLUGIN
1723 fi # COMPILE_ENVIRONMENT
1725 dnl ========================================================
1727 dnl = Profiling and Instrumenting
1729 dnl ========================================================
1730 MOZ_ARG_HEADER(Profiling and Instrumenting)
1732 dnl ========================================================
1733 dnl = Support for demangling undefined symbols
1734 dnl ========================================================
1735 if test -z "$SKIP_LIBRARY_CHECKS"; then
1738 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
1742 # Demangle only for debug or DMD builds
1743 MOZ_DEMANGLE_SYMBOLS=
1744 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
1745 MOZ_DEMANGLE_SYMBOLS=1
1746 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
1748 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
1750 dnl ========================================================
1751 dnl = Support for gcc stack unwinding (from gcc 3.3)
1752 dnl ========================================================
1753 if test -z "$SKIP_LIBRARY_CHECKS"; then
1756 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
1760 dnl ========================================================
1764 dnl ========================================================
1765 MOZ_ARG_HEADER(Misc. Options)
1767 dnl ========================================================
1768 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
1769 dnl ========================================================
1770 MOZ_ARG_WITH_STRING(user-appdir,
1771 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
1772 [ val=`echo $withval`
1773 if echo "$val" | grep "\/" >/dev/null; then
1774 AC_MSG_ERROR("Homedir must be single relative path.")
1779 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
1781 if test -z "$SKIP_COMPILER_CHECKS"; then
1782 dnl ========================================================
1784 dnl = Compiler Options
1786 dnl ========================================================
1787 MOZ_ARG_HEADER(Compiler Options)
1789 dnl ========================================================
1790 dnl Check for gcc -pipe support
1791 dnl ========================================================
1792 AC_MSG_CHECKING([for -pipe support])
1793 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
1794 dnl Any gcc that supports firefox supports -pipe.
1795 CFLAGS="$CFLAGS -pipe"
1796 CXXFLAGS="$CXXFLAGS -pipe"
1797 AC_MSG_RESULT([yes])
1802 fi # ! SKIP_COMPILER_CHECKS
1806 if test "$COMPILE_ENVIRONMENT"; then
1808 fi # COMPILE_ENVIRONMENT
1810 dnl ========================================================
1812 dnl = Static Build Options
1814 dnl ========================================================
1815 MOZ_ARG_HEADER(Static build options)
1817 if test -z "$MOZ_SYSTEM_ZLIB"; then
1818 if test -n "$JS_SHARED_LIBRARY" -o -n "$MOZ_LINKER" -o "$MOZ_WIDGET_TOOLKIT" = android; then
1820 AC_DEFINE(ZLIB_IN_MOZGLUE)
1824 AC_SUBST(ZLIB_IN_MOZGLUE)
1826 dnl ========================================================
1828 dnl = Standalone module options
1830 dnl ========================================================
1831 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
1834 dnl ========================================================
1836 if test -z "$SKIP_PATH_CHECKS"; then
1837 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
1838 if test "$MOZ_ENABLE_GTK" ; then
1839 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
1844 if test "$USE_FC_FREETYPE"; then
1845 if test "$COMPILE_ENVIRONMENT"; then
1846 dnl ========================================================
1847 dnl = Check for freetype2 functionality
1848 dnl ========================================================
1849 if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
1851 _SAVE_CFLAGS="$CFLAGS"
1852 LIBS="$LIBS $FT2_LIBS"
1853 CFLAGS="$CFLAGS $FT2_CFLAGS"
1855 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
1856 ac_cv_member_FT_Bitmap_Size_y_ppem,
1857 [AC_TRY_COMPILE([#include <ft2build.h>
1858 #include FT_FREETYPE_H],
1860 if (sizeof s.y_ppem) return 0;
1862 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
1863 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
1864 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
1865 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
1867 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
1869 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
1870 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
1871 [FT_Bitmap_Size structure includes y_ppem field])
1873 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
1876 CFLAGS="$_SAVE_CFLAGS"
1879 _SAVE_CPPFLAGS="$CPPFLAGS"
1880 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS"
1881 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
1882 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
1883 CPPFLAGS="$_SAVE_CPPFLAGS"
1887 dnl ========================================================
1888 dnl Check if we need the 32-bit Linux SSE2 error dialog
1889 dnl ========================================================
1891 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
1893 dnl ========================================================
1894 dnl Check for pixman and cairo
1895 dnl ========================================================
1898 MOZ_ARG_ENABLE_BOOL(system-pixman,
1899 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
1901 MOZ_TREE_PIXMAN=force,
1904 if test "$MOZ_TREE_PIXMAN"; then
1905 AC_DEFINE(MOZ_TREE_PIXMAN)
1907 PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.36.0)
1910 if test "$OS_ARCH" = "WINNT"; then
1911 # For now we assume that we will have a uint64_t available through
1912 # one of the above headers or mozstdint.h.
1913 AC_DEFINE(HAVE_UINT64_T)
1916 if test "$_HAVE_FREETYPE2"; then
1917 MOZ_ENABLE_CAIRO_FT=1
1918 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
1921 case "$MOZ_WIDGET_TOOLKIT" in
1923 if test "$COMPILE_ENVIRONMENT"; then
1924 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
1928 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
1929 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
1931 AC_SUBST(MOZ_TREE_PIXMAN)
1933 dnl ========================================================
1935 dnl = Maintainer debug option (no --enable equivalent)
1937 dnl ========================================================
1939 AC_SUBST_LIST(ASFLAGS)
1940 AC_SUBST(MOZ_AUTH_EXTENSION)
1941 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
1942 AC_SUBST_LIST(WARNINGS_CFLAGS)
1943 AC_SUBST_SET(MOZ_EXTENSIONS)
1945 AC_SUBST(MOZ_UNIVERSALCHARDET)
1946 AC_SUBST(MOZ_STUB_INSTALLER)
1947 AC_SUBST(MOZ_UPDATER)
1949 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
1951 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
1953 if test -n "$MOZ_BINARY_EXTENSIONS"; then
1954 AC_DEFINE(MOZ_BINARY_EXTENSIONS)
1957 dnl ========================================================
1958 dnl = Mac bundle name prefix
1959 dnl ========================================================
1960 MOZ_ARG_WITH_STRING(macbundlename-prefix,
1961 [ --with-macbundlename-prefix=prefix
1962 Prefix for MOZ_MACBUNDLE_NAME],
1963 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
1965 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
1966 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
1967 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
1970 if test "$MOZ_DEBUG"; then
1971 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
1973 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
1975 AC_SUBST(MOZ_MACBUNDLE_NAME)
1977 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
1978 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
1979 # Otherwise, use MOZ_APP_DISPLAYNAME
1980 if test -z "$MOZ_MACBUNDLE_ID"; then
1981 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
1983 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
1984 if test "$MOZ_DEBUG"; then
1985 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
1988 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
1989 AC_SUBST(MOZ_MACBUNDLE_ID)
1991 dnl ========================================================
1992 dnl = Child Process Name for IPC
1993 dnl ========================================================
1994 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
1995 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
1997 # We want to let Android unpack the file at install time, but it only does
1998 # so if the file is named libsomething.so. The lib/ path is also required
1999 # because the unpacked file will be under the lib/ subdirectory and will
2000 # need to be executed from that path.
2001 MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
2003 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
2004 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
2006 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
2007 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
2008 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
2010 # The following variables are available to branding and application
2011 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
2012 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
2013 # impacts profile location and user-visible fields.
2014 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
2015 # Mac Bundle name, Updater, Installer), it is typically used for nightly
2016 # builds (e.g. Aurora for Firefox).
2017 # - MOZ_APP_PROFILE: When set, used for application.ini's
2018 # "Profile" field, which controls profile location.
2019 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
2020 # crash reporter server url.
2021 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
2023 # The following environment variables used to have an effect, but don't anymore:
2024 # - MOZ_APP_VERSION: Defines the application version number. This was replaced with
2025 # the contents from the version.txt file in the application directory, or
2026 # browser/config/version.txt if there isn't one.
2027 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
2028 # in the "About" window. This was replaced with the contents from the
2029 # version_display.txt or version.txt in the application directory, or
2030 # browser/config/version_display.txt.
2032 # For extensions and langpacks, we require a max version that is compatible
2033 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
2034 # 24.0a1 and 24.0a2 aren't affected
2036 # 24.1.1 becomes 24.*
2037 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
2038 if test -z "$IS_ALPHA"; then
2040 if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
2041 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
2043 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
2047 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
2050 AC_SUBST(MOZ_APP_DISPLAYNAME)
2051 AC_SUBST(MOZ_APP_VENDOR)
2052 AC_SUBST(MOZ_APP_PROFILE)
2053 AC_SUBST(MOZ_APP_ID)
2054 AC_SUBST(MAR_CHANNEL_ID)
2055 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
2056 AC_SUBST(MOZ_PROFILE_MIGRATOR)
2057 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
2058 AC_SUBST(MOZ_APP_UA_NAME)
2059 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
2060 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
2061 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
2063 AC_SUBST(MOZ_APP_MAXVERSION)
2064 AC_SUBST(MOZ_PKG_SPECIAL)
2065 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
2067 if test "$MOZILLA_OFFICIAL"; then
2068 # Build revisions should always be present in official builds
2069 MOZ_INCLUDE_SOURCE_INFO=1
2072 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
2073 # explicitly set the repository and changeset information in.
2074 AC_SUBST(MOZ_SOURCE_REPO)
2075 AC_SUBST(MOZ_SOURCE_CHANGESET)
2076 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
2078 dnl If we have any service that uploads data (and requires data submission
2079 dnl policy alert), set MOZ_DATA_REPORTING.
2080 dnl We need SUBST for build system and DEFINE for xul preprocessor.
2081 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER" || test -n "$MOZ_NORMANDY"; then
2082 MOZ_DATA_REPORTING=1
2083 AC_DEFINE(MOZ_DATA_REPORTING)
2084 AC_SUBST(MOZ_DATA_REPORTING)
2088 AC_SUBST(WIN32_REDIST_DIR)
2089 AC_SUBST(WIN_UCRT_REDIST_DIR)
2091 dnl Echo the CFLAGS to remove extra whitespace.
2093 $_COMPILATION_CFLAGS \
2097 $_WARNINGS_CXXFLAGS \
2098 $_COMPILATION_CXXFLAGS \
2101 COMPILE_CFLAGS=`echo \
2105 COMPILE_CXXFLAGS=`echo \
2106 $_DEFINES_CXXFLAGS \
2110 $_WARNINGS_HOST_CFLAGS \
2111 $_COMPILATION_HOST_CFLAGS \
2114 HOST_CXXFLAGS=`echo \
2115 $_WARNINGS_HOST_CXXFLAGS \
2116 $_COMPILATION_HOST_CXXFLAGS \
2119 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
2120 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
2121 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
2122 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
2123 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
2124 OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
2125 OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
2127 AC_SUBST(HOST_CMFLAGS)
2128 AC_SUBST(HOST_CMMFLAGS)
2129 AC_SUBST(OS_COMPILE_CMFLAGS)
2130 AC_SUBST(OS_COMPILE_CMMFLAGS)
2133 OS_CXXFLAGS="$CXXFLAGS"
2134 OS_CPPFLAGS="$CPPFLAGS"
2135 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
2136 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
2137 OS_LDFLAGS="$LDFLAGS"
2139 AC_SUBST_LIST(OS_CFLAGS)
2140 AC_SUBST_LIST(OS_CXXFLAGS)
2141 AC_SUBST_LIST(OS_CPPFLAGS)
2142 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
2143 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
2144 AC_SUBST_LIST(OS_LDFLAGS)
2149 AC_SUBST_LIST(HOST_CFLAGS)
2150 AC_SUBST_LIST(HOST_CPPFLAGS)
2151 AC_SUBST_LIST(HOST_CXXFLAGS)
2152 AC_SUBST(HOST_LDFLAGS)
2153 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
2154 AC_SUBST(HOST_BIN_SUFFIX)
2156 AC_SUBST(TARGET_XPCOM_ABI)
2157 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
2158 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
2159 AC_SUBST(HAVE_X86_AVX2)
2161 AC_SUBST(DSO_LDOPTS)
2162 AC_SUBST(BIN_SUFFIX)
2164 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
2165 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
2167 AC_SUBST(MOZ_DEVTOOLS)
2169 AC_SUBST(MOZ_PACKAGE_JSSHELL)
2173 dnl Host JavaScript runtime, if any, to use during cross compiles.
2176 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
2178 if test -n "$COMPILE_ENVIRONMENT"; then
2179 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
2180 fi # COMPILE_ENVIRONMENT
2182 dnl Set various defines and substitutions
2183 dnl ========================================================
2185 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
2186 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
2189 AC_SUBST(MOZ_DEV_EDITION)
2190 if test -n "$MOZ_DEV_EDITION"; then
2191 AC_DEFINE(MOZ_DEV_EDITION)
2194 if test "$MOZ_DEBUG" -o "$DEVELOPER_OPTIONS"; then
2198 if test -n "$A11Y_LOG"; then
2202 dnl Windows AccessibilityHandler
2203 dnl ========================================================
2205 if test -z "$MOZ_HANDLER_CLSID"; then
2206 MOZ_HANDLER_CLSID="4a195748-dca2-45fb-9295-0a139e76a9e7"
2207 MOZ_IHANDLERCONTROL_IID="3316ce35-f892-4832-97c5-06c52c03cdba"
2208 MOZ_ASYNCIHANDLERCONTROL_IID="15b48b76-ad38-4ad3-bd1a-d3c48a5a9947"
2209 MOZ_IGECKOBACKCHANNEL_IID="dd2e4a89-999e-4d65-8b65-440c923ddb61"
2212 AC_SUBST(MOZ_HANDLER_CLSID)
2213 AC_SUBST(MOZ_IHANDLERCONTROL_IID)
2214 AC_SUBST(MOZ_ASYNCIHANDLERCONTROL_IID)
2215 AC_SUBST(MOZ_IGECKOBACKCHANNEL_IID)
2217 dnl Spit out some output
2218 dnl ========================================================
2220 # Avoid using obsolete NSPR features
2221 AC_DEFINE(NO_NSPR_10_SUPPORT)
2223 MOZ_CREATE_CONFIG_STATUS()
2225 rm -fr confdefs* $ac_clean_files