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_UNIVERSALCHARDET=1
1220 MOZ_BINARY_EXTENSIONS=
1223 dnl ========================================================
1224 dnl = Trademarked Branding
1225 dnl ========================================================
1226 MOZ_ARG_ENABLE_BOOL(official-branding,
1227 [ --enable-official-branding
1228 Enable Official mozilla.org Branding
1229 Do not distribute builds with
1230 --enable-official-branding unless you have
1231 permission to use trademarks per
1232 http://www.mozilla.org/foundation/trademarks/ .],
1233 MOZ_OFFICIAL_BRANDING=1,
1234 MOZ_OFFICIAL_BRANDING=)
1236 # Allow the application to influence configure with a confvars.sh script.
1237 AC_MSG_CHECKING([if app-specific confvars.sh exists])
1238 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
1239 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
1240 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
1245 dnl ========================================================
1246 dnl Ensure Android SDK and build-tools versions depending on
1248 dnl ========================================================
1250 case "$MOZ_BUILD_APP" in
1256 dnl ========================================================
1258 dnl = Toolkit Options
1260 dnl ========================================================
1261 MOZ_ARG_HEADER(Toolkit Options)
1263 dnl ========================================================
1264 dnl = Enable the toolkit as needed =
1265 dnl ========================================================
1267 case "$MOZ_WIDGET_TOOLKIT" in
1270 LDFLAGS="$LDFLAGS -framework Cocoa"
1271 # Use -Wl as a trick to avoid -framework and framework names from
1272 # being separated by AC_SUBST_LIST.
1273 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'
1275 CFLAGS="$CFLAGS $TK_CFLAGS"
1276 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1277 MOZ_USER_DIR="Mozilla"
1281 LDFLAGS="$LDFLAGS -framework UIKit"
1283 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'
1284 CFLAGS="$CFLAGS $TK_CFLAGS"
1285 CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
1286 MOZ_USER_DIR="Mozilla"
1291 if test "$OS_TARGET" = Darwin; then
1292 LDFLAGS="$LDFLAGS -lobjc"
1295 dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
1296 dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
1297 case "$MOZ_WIDGET_TOOLKIT" in
1303 if test "$COMPILE_ENVIRONMENT"; then
1304 if test "$MOZ_WIDGET_TOOLKIT" = gtk; then
1305 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)
1306 MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
1307 TK_CFLAGS=$MOZ_GTK3_CFLAGS
1308 TK_LIBS=$MOZ_GTK3_LIBS
1309 dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
1310 dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
1311 AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
1313 if test "$MOZ_ENABLE_GTK"; then
1314 AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
1315 AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
1317 fi # COMPILE_ENVIRONMENT
1319 AC_SUBST_LIST(TK_CFLAGS)
1320 AC_SUBST_LIST(TK_LIBS)
1322 dnl ========================================================
1324 dnl = Components & Features
1326 dnl ========================================================
1327 MOZ_ARG_HEADER(Components and Features)
1329 AC_SUBST(MOZ_OFFICIAL_BRANDING)
1330 if test -n "$MOZ_OFFICIAL_BRANDING"; then
1331 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
1332 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
1334 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
1335 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
1339 MOZ_ARG_WITH_STRING(branding,
1340 [ --with-branding=dir Use branding from the specified directory.],
1341 MOZ_BRANDING_DIRECTORY=$withval)
1343 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
1344 if test -z "$REAL_BRANDING_DIRECTORY"; then
1345 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
1348 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1349 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
1352 AC_SUBST(MOZ_BRANDING_DIRECTORY)
1354 dnl ========================================================
1355 dnl = Distribution ID
1356 dnl ========================================================
1357 MOZ_ARG_WITH_STRING(distribution-id,
1358 [ --with-distribution-id=ID
1359 Set distribution-specific id (default=org.mozilla)],
1360 [ val=`echo $withval`
1361 MOZ_DISTRIBUTION_ID="$val"])
1363 if test -z "$MOZ_DISTRIBUTION_ID"; then
1364 MOZ_DISTRIBUTION_ID="org.mozilla"
1367 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
1368 AC_SUBST(MOZ_DISTRIBUTION_ID)
1370 AC_TRY_COMPILE([#include <linux/ethtool.h>],
1371 [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
1372 MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
1374 AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
1376 dnl ========================================================
1377 dnl = Apple platform decoder support
1378 dnl ========================================================
1379 if test "$COMPILE_ENVIRONMENT"; then
1380 if test -n "$MOZ_APPLEMEDIA"; then
1381 # hack in frameworks for fmp4 - see bug 1029974
1382 # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
1383 LDFLAGS="$LDFLAGS -framework AudioToolbox"
1384 dnl Verify CoreMedia is available.
1385 AC_CHECK_HEADERS([CoreMedia/CoreMedia.h VideoToolbox/VideoToolbox.h], [],
1386 [AC_MSG_ERROR([MacOS X 10.9 SDK or later is required])])
1388 fi # COMPILE_ENVIRONMENT
1390 dnl ========================================================
1391 dnl Searching of system directories for extensions.
1392 dnl Note: this switch is meant to be used for test builds
1393 dnl whose behavior should not depend on what happens to be
1394 dnl installed on the local machine.
1395 dnl ========================================================
1396 MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
1397 [ --disable-system-extension-dirs
1398 Disable searching system- and account-global
1399 directories for extensions of any kind; use
1400 only profile-specific extension directories],
1401 ENABLE_SYSTEM_EXTENSION_DIRS=,
1402 ENABLE_SYSTEM_EXTENSION_DIRS=1 )
1403 if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
1404 AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
1407 dnl ========================================================
1408 dnl = Universalchardet
1409 dnl ========================================================
1410 MOZ_ARG_DISABLE_BOOL(universalchardet,
1411 [ --disable-universalchardet
1412 Disable universal encoding detection],
1413 MOZ_UNIVERSALCHARDET=,
1414 MOZ_UNIVERSALCHARDET=1 )
1416 dnl ========================================================
1418 dnl ========================================================
1420 if test "$COMPILE_ENVIRONMENT" ; then
1422 dnl Moved gamepad platform check to moz.build, linux header check still needed here.
1423 if test "$OS_TARGET" = "Linux"; then
1424 MOZ_CHECK_HEADER([linux/joystick.h])
1425 if test "$ac_cv_header_linux_joystick_h" != "yes"; then
1426 AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers.])
1430 fi # COMPILE_ENVIRONMENT
1433 # Avoid defining MOZ_ENABLE_CAIRO_FT on Windows platforms because
1434 # "cairo-ft-font.c" includes <dlfcn.h>, which only exists on posix platforms
1435 if test -n "$MOZ_TREE_FREETYPE" -a "$OS_TARGET" != WINNT; then
1436 MOZ_ENABLE_CAIRO_FT=1
1437 CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
1438 AC_SUBST_LIST(CAIRO_FT_CFLAGS)
1441 dnl ========================================================
1443 dnl ========================================================
1445 MOZ_ARG_DISABLE_BOOL(updater,
1446 [ --disable-updater Disable building of updater],
1450 if test -n "$MOZ_UPDATER"; then
1451 AC_DEFINE(MOZ_UPDATER)
1454 dnl ========================================================
1455 dnl = Disable smartcard support
1456 dnl ========================================================
1457 if test -n "$MOZ_NO_SMART_CARDS"; then
1458 AC_DEFINE(MOZ_NO_SMART_CARDS)
1460 AC_SUBST(MOZ_NO_SMART_CARDS)
1462 dnl ========================================================
1464 dnl = Module specific options
1466 dnl ========================================================
1467 MOZ_ARG_HEADER(Individual module options)
1469 dnl ==============================
1470 dnl === SQLite fdatasync check ===
1471 dnl ==============================
1472 dnl Check to see if fdatasync is available and make use of it
1473 AC_CHECK_FUNC(fdatasync)
1475 dnl ========================================================
1476 dnl = Disable zipwriter
1477 dnl ========================================================
1478 MOZ_ARG_DISABLE_BOOL(zipwriter,
1479 [ --disable-zipwriter Disable zipwriter component],
1482 AC_SUBST(MOZ_ZIPWRITER)
1484 dnl ========================================================
1486 dnl = Feature options that require extra sources to be pulled
1488 dnl ========================================================
1489 dnl MOZ_ARG_HEADER(Features that require extra sources)
1491 dnl ========================================================
1493 dnl = Runtime debugging and Optimization Options
1495 dnl ========================================================
1496 MOZ_ARG_HEADER(Runtime debugging and Optimizations)
1498 dnl ========================================================
1499 dnl = Enable code optimization. ON by default.
1500 dnl ========================================================
1502 # Use value from moz.configure if one is defined. Else use our computed
1504 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
1505 MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
1508 if test "$COMPILE_ENVIRONMENT"; then
1509 if test -n "$MOZ_OPTIMIZE"; then
1510 AC_MSG_CHECKING([for valid C compiler optimization flags])
1511 _SAVE_CFLAGS=$CFLAGS
1512 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
1513 AC_TRY_COMPILE([#include <stdio.h>],
1514 [printf("Hello World\n");],
1517 AC_MSG_RESULT([$_results])
1518 if test "$_results" = "no"; then
1519 AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
1521 CFLAGS=$_SAVE_CFLAGS
1522 if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
1523 # When using llvm-based LTO, non numeric optimization levels are
1524 # not supported by the linker, so force the linker to use -O2 (
1525 # which doesn't influence the level compilation units are actually
1527 case " $MOZ_OPTIMIZE_FLAGS " in
1528 *\ -Os\ *|*\ -Oz\ *)
1529 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
1534 fi # COMPILE_ENVIRONMENT
1536 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
1537 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
1538 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
1540 case "${OS_TARGET}" in
1541 Android|WINNT|Darwin)
1542 MOZ_GLUE_IN_PROGRAM=
1545 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
1546 MOZ_GLUE_IN_PROGRAM=1
1547 AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
1551 dnl ========================================================
1552 dnl = Jemalloc build setup
1553 dnl ========================================================
1554 if test -z "$MOZ_MEMORY"; then
1557 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
1558 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.])
1563 dnl The generic feature tests that determine how to compute ncpus are long and
1564 dnl complicated. Therefore, simply define special cpp variables for the
1565 dnl platforms we have special knowledge of.
1568 export MOZ_NO_DEBUG_RTL=1
1572 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
1574 dnl ========================================================
1575 dnl = Enable using the clang plugin to build
1576 dnl ========================================================
1578 if test -n "$COMPILE_ENVIRONMENT"; then
1579 MOZ_CONFIG_CLANG_PLUGIN
1580 fi # COMPILE_ENVIRONMENT
1582 dnl ========================================================
1584 dnl = Profiling and Instrumenting
1586 dnl ========================================================
1587 MOZ_ARG_HEADER(Profiling and Instrumenting)
1589 dnl ========================================================
1590 dnl = Support for demangling undefined symbols
1591 dnl ========================================================
1592 if test -z "$SKIP_LIBRARY_CHECKS"; then
1595 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
1599 # Demangle only for debug or DMD builds
1600 MOZ_DEMANGLE_SYMBOLS=
1601 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
1602 MOZ_DEMANGLE_SYMBOLS=1
1603 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
1605 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
1607 dnl ========================================================
1608 dnl = Support for gcc stack unwinding (from gcc 3.3)
1609 dnl ========================================================
1610 if test -z "$SKIP_LIBRARY_CHECKS"; then
1613 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
1617 dnl ========================================================
1621 dnl ========================================================
1622 MOZ_ARG_HEADER(Misc. Options)
1624 dnl ========================================================
1625 dnl = Location of the mozilla user directory (default is ~/.mozilla).],
1626 dnl ========================================================
1627 MOZ_ARG_WITH_STRING(user-appdir,
1628 [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
1629 [ val=`echo $withval`
1630 if echo "$val" | grep "\/" >/dev/null; then
1631 AC_MSG_ERROR("Homedir must be single relative path.")
1636 AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
1638 if test -z "$SKIP_COMPILER_CHECKS"; then
1639 dnl ========================================================
1641 dnl = Compiler Options
1643 dnl ========================================================
1644 MOZ_ARG_HEADER(Compiler Options)
1646 dnl ========================================================
1647 dnl Check for gcc -pipe support
1648 dnl ========================================================
1649 AC_MSG_CHECKING([for -pipe support])
1650 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
1651 dnl Any gcc that supports firefox supports -pipe.
1652 CFLAGS="$CFLAGS -pipe"
1653 CXXFLAGS="$CXXFLAGS -pipe"
1654 AC_MSG_RESULT([yes])
1659 fi # ! SKIP_COMPILER_CHECKS
1663 if test "$COMPILE_ENVIRONMENT"; then
1665 fi # COMPILE_ENVIRONMENT
1667 dnl ========================================================
1669 dnl = Static Build Options
1671 dnl ========================================================
1672 MOZ_ARG_HEADER(Static build options)
1674 if test -z "$MOZ_SYSTEM_ZLIB"; then
1675 if test -n "$JS_SHARED_LIBRARY" -o -n "$MOZ_LINKER" -o "$MOZ_WIDGET_TOOLKIT" = android; then
1677 AC_DEFINE(ZLIB_IN_MOZGLUE)
1681 AC_SUBST(ZLIB_IN_MOZGLUE)
1683 dnl ========================================================
1685 dnl = Standalone module options
1687 dnl ========================================================
1688 MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
1691 dnl ========================================================
1693 if test -z "$SKIP_PATH_CHECKS"; then
1694 if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
1695 if test "$MOZ_ENABLE_GTK" ; then
1696 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
1701 if test "$USE_FC_FREETYPE"; then
1702 if test "$COMPILE_ENVIRONMENT"; then
1703 dnl ========================================================
1704 dnl = Check for freetype2 functionality
1705 dnl ========================================================
1706 if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
1708 _SAVE_CFLAGS="$CFLAGS"
1709 LIBS="$LIBS $FT2_LIBS"
1710 CFLAGS="$CFLAGS $FT2_CFLAGS"
1712 AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
1713 ac_cv_member_FT_Bitmap_Size_y_ppem,
1714 [AC_TRY_COMPILE([#include <ft2build.h>
1715 #include FT_FREETYPE_H],
1717 if (sizeof s.y_ppem) return 0;
1719 ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
1720 ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
1721 if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
1722 HAVE_FT_BITMAP_SIZE_Y_PPEM=1
1724 HAVE_FT_BITMAP_SIZE_Y_PPEM=0
1726 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
1727 $HAVE_FT_BITMAP_SIZE_Y_PPEM,
1728 [FT_Bitmap_Size structure includes y_ppem field])
1730 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
1733 CFLAGS="$_SAVE_CFLAGS"
1736 _SAVE_CPPFLAGS="$CPPFLAGS"
1737 CPPFLAGS="$CPPFLAGS $FT2_CFLAGS"
1738 MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
1739 [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
1740 CPPFLAGS="$_SAVE_CPPFLAGS"
1744 dnl ========================================================
1745 dnl Check if we need the 32-bit Linux SSE2 error dialog
1746 dnl ========================================================
1748 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
1750 dnl ========================================================
1751 dnl Check for pixman and cairo
1752 dnl ========================================================
1755 MOZ_ARG_ENABLE_BOOL(system-pixman,
1756 [ --enable-system-pixman Use system pixman (located with pkgconfig)],
1758 MOZ_TREE_PIXMAN=force,
1761 if test "$MOZ_TREE_PIXMAN"; then
1762 AC_DEFINE(MOZ_TREE_PIXMAN)
1764 PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.36.0)
1767 if test "$OS_ARCH" = "WINNT"; then
1768 # For now we assume that we will have a uint64_t available through
1769 # one of the above headers or mozstdint.h.
1770 AC_DEFINE(HAVE_UINT64_T)
1773 if test "$_HAVE_FREETYPE2"; then
1774 MOZ_ENABLE_CAIRO_FT=1
1775 CAIRO_FT_CFLAGS="$FT2_CFLAGS"
1778 case "$MOZ_WIDGET_TOOLKIT" in
1780 if test "$COMPILE_ENVIRONMENT"; then
1781 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
1785 AC_SUBST(MOZ_ENABLE_CAIRO_FT)
1786 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
1788 AC_SUBST(MOZ_TREE_PIXMAN)
1790 dnl ========================================================
1792 dnl = Maintainer debug option (no --enable equivalent)
1794 dnl ========================================================
1796 AC_SUBST_LIST(ASFLAGS)
1797 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
1798 AC_SUBST_LIST(WARNINGS_CFLAGS)
1800 AC_SUBST(MOZ_UNIVERSALCHARDET)
1801 AC_SUBST(MOZ_STUB_INSTALLER)
1802 AC_SUBST(MOZ_UPDATER)
1804 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
1806 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
1808 if test -n "$MOZ_BINARY_EXTENSIONS"; then
1809 AC_DEFINE(MOZ_BINARY_EXTENSIONS)
1812 dnl ========================================================
1813 dnl = Mac bundle name prefix
1814 dnl ========================================================
1815 MOZ_ARG_WITH_STRING(macbundlename-prefix,
1816 [ --with-macbundlename-prefix=prefix
1817 Prefix for MOZ_MACBUNDLE_NAME],
1818 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
1820 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
1821 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
1822 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
1825 if test "$MOZ_DEBUG"; then
1826 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
1828 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
1830 AC_SUBST(MOZ_MACBUNDLE_NAME)
1832 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
1833 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
1834 # Otherwise, use MOZ_APP_DISPLAYNAME
1835 if test -z "$MOZ_MACBUNDLE_ID"; then
1836 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
1838 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
1839 if test "$MOZ_DEBUG"; then
1840 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
1843 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
1844 AC_SUBST(MOZ_MACBUNDLE_ID)
1846 dnl ========================================================
1847 dnl = Child Process Name for IPC
1848 dnl ========================================================
1849 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
1850 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
1852 # We want to let Android unpack the file at install time, but it only does
1853 # so if the file is named libsomething.so. The lib/ path is also required
1854 # because the unpacked file will be under the lib/ subdirectory and will
1855 # need to be executed from that path.
1856 MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
1858 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
1859 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
1861 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
1862 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
1863 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
1865 # The following variables are available to branding and application
1866 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
1867 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
1868 # impacts profile location and user-visible fields.
1869 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
1870 # Mac Bundle name, Updater, Installer), it is typically used for nightly
1871 # builds (e.g. Aurora for Firefox).
1872 # - MOZ_APP_PROFILE: When set, used for application.ini's
1873 # "Profile" field, which controls profile location.
1874 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
1875 # crash reporter server url.
1876 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
1878 # The following environment variables used to have an effect, but don't anymore:
1879 # - MOZ_APP_VERSION: Defines the application version number. This was replaced with
1880 # the contents from the version.txt file in the application directory, or
1881 # browser/config/version.txt if there isn't one.
1882 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
1883 # in the "About" window. This was replaced with the contents from the
1884 # version_display.txt or version.txt in the application directory, or
1885 # browser/config/version_display.txt.
1887 # For extensions and langpacks, we require a max version that is compatible
1888 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
1889 # 24.0a1 and 24.0a2 aren't affected
1891 # 24.1.1 becomes 24.*
1892 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
1893 if test -z "$IS_ALPHA"; then
1895 if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
1896 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
1898 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
1902 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
1905 AC_SUBST(MOZ_APP_DISPLAYNAME)
1906 AC_SUBST(MOZ_APP_VENDOR)
1907 AC_SUBST(MOZ_APP_PROFILE)
1908 AC_SUBST(MOZ_APP_ID)
1909 AC_SUBST(MAR_CHANNEL_ID)
1910 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
1911 AC_SUBST(MOZ_PROFILE_MIGRATOR)
1912 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
1913 AC_SUBST(MOZ_APP_UA_NAME)
1914 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
1915 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
1916 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
1918 AC_SUBST(MOZ_APP_MAXVERSION)
1919 AC_SUBST(MOZ_PKG_SPECIAL)
1920 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
1922 if test "$MOZILLA_OFFICIAL"; then
1923 # Build revisions should always be present in official builds
1924 MOZ_INCLUDE_SOURCE_INFO=1
1927 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
1928 # explicitly set the repository and changeset information in.
1929 AC_SUBST(MOZ_SOURCE_REPO)
1930 AC_SUBST(MOZ_SOURCE_CHANGESET)
1931 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
1933 dnl If we have any service that uploads data (and requires data submission
1934 dnl policy alert), set MOZ_DATA_REPORTING.
1935 dnl We need SUBST for build system and DEFINE for xul preprocessor.
1936 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER" || test -n "$MOZ_NORMANDY"; then
1937 MOZ_DATA_REPORTING=1
1938 AC_DEFINE(MOZ_DATA_REPORTING)
1939 AC_SUBST(MOZ_DATA_REPORTING)
1943 AC_SUBST(WIN32_REDIST_DIR)
1944 AC_SUBST(WIN_UCRT_REDIST_DIR)
1946 dnl Echo the CFLAGS to remove extra whitespace.
1948 $_COMPILATION_CFLAGS \
1952 $_WARNINGS_CXXFLAGS \
1953 $_COMPILATION_CXXFLAGS \
1956 COMPILE_CFLAGS=`echo \
1960 COMPILE_CXXFLAGS=`echo \
1961 $_DEFINES_CXXFLAGS \
1965 $_WARNINGS_HOST_CFLAGS \
1966 $_COMPILATION_HOST_CFLAGS \
1969 HOST_CXXFLAGS=`echo \
1970 $_WARNINGS_HOST_CXXFLAGS \
1971 $_COMPILATION_HOST_CXXFLAGS \
1974 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
1975 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
1976 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
1977 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
1978 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
1979 OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
1980 OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
1982 AC_SUBST(HOST_CMFLAGS)
1983 AC_SUBST(HOST_CMMFLAGS)
1984 AC_SUBST(OS_COMPILE_CMFLAGS)
1985 AC_SUBST(OS_COMPILE_CMMFLAGS)
1988 OS_CXXFLAGS="$CXXFLAGS"
1989 OS_CPPFLAGS="$CPPFLAGS"
1990 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
1991 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
1992 OS_LDFLAGS="$LDFLAGS"
1994 AC_SUBST_LIST(OS_CFLAGS)
1995 AC_SUBST_LIST(OS_CXXFLAGS)
1996 AC_SUBST_LIST(OS_CPPFLAGS)
1997 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
1998 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
1999 AC_SUBST_LIST(OS_LDFLAGS)
2004 AC_SUBST_LIST(HOST_CFLAGS)
2005 AC_SUBST_LIST(HOST_CPPFLAGS)
2006 AC_SUBST_LIST(HOST_CXXFLAGS)
2007 AC_SUBST(HOST_LDFLAGS)
2008 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
2009 AC_SUBST(HOST_BIN_SUFFIX)
2011 AC_SUBST(TARGET_XPCOM_ABI)
2012 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
2013 AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
2014 AC_SUBST(HAVE_X86_AVX2)
2016 AC_SUBST(DSO_LDOPTS)
2017 AC_SUBST(BIN_SUFFIX)
2019 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
2020 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
2022 AC_SUBST(MOZ_DEVTOOLS)
2024 AC_SUBST(MOZ_PACKAGE_JSSHELL)
2028 dnl Host JavaScript runtime, if any, to use during cross compiles.
2031 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
2033 if test -n "$COMPILE_ENVIRONMENT"; then
2034 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
2035 fi # COMPILE_ENVIRONMENT
2037 dnl Set various defines and substitutions
2038 dnl ========================================================
2040 if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
2041 AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
2044 AC_SUBST(MOZ_DEV_EDITION)
2045 if test -n "$MOZ_DEV_EDITION"; then
2046 AC_DEFINE(MOZ_DEV_EDITION)
2049 if test "$MOZ_DEBUG" -o "$DEVELOPER_OPTIONS"; then
2053 if test -n "$A11Y_LOG"; then
2057 dnl Windows AccessibilityHandler
2058 dnl ========================================================
2060 if test -z "$MOZ_HANDLER_CLSID"; then
2061 MOZ_HANDLER_CLSID="4a195748-dca2-45fb-9295-0a139e76a9e7"
2062 MOZ_IHANDLERCONTROL_IID="3316ce35-f892-4832-97c5-06c52c03cdba"
2063 MOZ_ASYNCIHANDLERCONTROL_IID="15b48b76-ad38-4ad3-bd1a-d3c48a5a9947"
2064 MOZ_IGECKOBACKCHANNEL_IID="dd2e4a89-999e-4d65-8b65-440c923ddb61"
2067 AC_SUBST(MOZ_HANDLER_CLSID)
2068 AC_SUBST(MOZ_IHANDLERCONTROL_IID)
2069 AC_SUBST(MOZ_ASYNCIHANDLERCONTROL_IID)
2070 AC_SUBST(MOZ_IGECKOBACKCHANNEL_IID)
2072 dnl Spit out some output
2073 dnl ========================================================
2075 # Avoid using obsolete NSPR features
2076 AC_DEFINE(NO_NSPR_10_SUPPORT)
2078 MOZ_CREATE_CONFIG_STATUS()
2080 rm -fr confdefs* $ac_clean_files