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 ========================================================
50 dnl Set various checks
51 dnl ========================================================
54 dnl Initialize the Pthread test variables early so they can be
55 dnl overridden by each platform.
56 dnl ========================================================
60 LDFLAGS="$LDFLAGS $LINKER_LDFLAGS"
62 if test "$COMPILE_ENVIRONMENT"; then
64 fi # COMPILE_ENVIRONMENT
67 *-android*|*-linuxandroid*)
70 AC_PATH_PROG(OBJCOPY,objcopy)
76 dnl ========================================================
77 dnl Checks for compilers.
78 dnl ========================================================
80 if test "$COMPILE_ENVIRONMENT"; then
82 # Run some logic to figure out exe extensions (mostly for mingw's sake)
85 if test "$target" != "$host"; then
91 # Work around the conftest.exe access problem on Windows
95 MOZ_PATH_PROGS(AS, $AS as, $CC)
96 AC_CHECK_PROGS(STRIP, strip, :)
97 AC_CHECK_PROGS(OTOOL, otool, :)
102 dnl ========================================================
103 dnl Special win32 checks
104 dnl ========================================================
110 if test "$GCC" != "yes"; then
111 # Check to see if we are really running in a msvc environemnt
114 # Make sure compilers are valid
115 CXXFLAGS="$CXXFLAGS -TP"
118 AC_TRY_COMPILE([#include <stdio.h>],
119 [ printf("Hello World\n"); ],,
120 AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
123 AC_TRY_COMPILE([#include <new.h>],
124 [ unsigned *test = new unsigned(42); ],,
125 AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
128 AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
129 AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
130 AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
132 MSVC_C_RUNTIME_DLL=vcruntime140.dll
133 MSVC_CXX_RUNTIME_DLL=msvcp140.dll
135 # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
136 CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
138 if test -n "$WIN_UCRT_REDIST_DIR"; then
139 if test ! -d "$WIN_UCRT_REDIST_DIR"; then
140 AC_MSG_ERROR([Invalid Windows UCRT Redist directory: ${WIN_UCRT_REDIST_DIR}])
142 WIN_UCRT_REDIST_DIR=`cd "$WIN_UCRT_REDIST_DIR" && (pwd -W 2>/dev/null || pwd)`
145 AC_SUBST(MSVC_C_RUNTIME_DLL)
146 AC_SUBST(MSVC_CXX_RUNTIME_DLL)
148 AC_DEFINE(HAVE_SEH_EXCEPTIONS)
150 if test -n "$WIN32_REDIST_DIR"; then
151 if test ! -d "$WIN32_REDIST_DIR"; then
152 AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
154 WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && (pwd -W 2>/dev/null || pwd)`
158 STL_FLAGS="-I${DIST}/stl_wrappers"
160 # Check w32api version
161 _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
162 _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
163 AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
164 AC_TRY_COMPILE([#include <w32api.h>],
165 #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
166 (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
167 __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
168 #error "test failed."
170 , [ res=yes ], [ res=no ])
171 AC_MSG_RESULT([$res])
172 if test "$res" != "yes"; then
173 AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
175 # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
176 # causing problems with local implementations with the same name.
177 AC_DEFINE(STRSAFE_NO_DEPRECATE)
180 CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
181 CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
183 AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
184 AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
185 # Require OS features provided by IE 8.0 (Win7)
186 AC_DEFINE_UNQUOTED(_WIN32_IE,0x0800)
191 if test -n "$_WIN32_MSVC"; then
193 SKIP_COMPILER_CHECKS=1
194 SKIP_LIBRARY_CHECKS=1
196 # Since we're skipping compiler and library checks, hard-code
199 AC_DEFINE(HAVE_ISATTY)
202 fi # COMPILE_ENVIRONMENT
207 AC_SUBST_LIST(STL_FLAGS)
208 AC_SUBST(WRAP_STL_INCLUDES)
210 dnl ========================================================
211 dnl set the defaults first
212 dnl ========================================================
213 MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
215 dnl Configure platform-specific CPU architecture compiler options.
216 dnl ==============================================================
217 if test "$COMPILE_ENVIRONMENT"; then
219 fi # COMPILE_ENVIRONMENT
221 dnl ========================================================
222 dnl Android libstdc++
223 dnl ========================================================
226 if test "$COMPILE_ENVIRONMENT"; then
228 fi # COMPILE_ENVIRONMENT
230 dnl ========================================================
231 dnl Suppress Clang Argument Warnings
232 dnl ========================================================
233 WARNINGS_CFLAGS="$_WARNINGS_CFLAGS"
234 if test -n "${CLANG_CC}${CLANG_CL}"; then
235 WARNINGS_CFLAGS="-Qunused-arguments $WARNINGS_CFLAGS"
236 CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
238 if test -n "${CLANG_CXX}${CLANG_CL}"; then
239 _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
242 if test -n "$COMPILE_ENVIRONMENT"; then
246 dnl ========================================================
247 dnl GNU specific defaults
248 dnl ========================================================
249 if test "$GNU_CC"; then
250 CFLAGS="$CFLAGS -fno-strict-aliasing"
252 if test "$OS_ARCH" != "WINNT" -o -z "$CLANG_CC"; then
253 DSO_PIC_CFLAGS='-fPIC'
254 ASFLAGS="$ASFLAGS -fPIC"
257 AC_MSG_CHECKING([for --noexecstack option to as])
259 CFLAGS="$CFLAGS -Wa,--noexecstack"
260 AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
261 [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
264 AC_MSG_CHECKING([for -z noexecstack option to ld])
265 _SAVE_LDFLAGS=$LDFLAGS
266 LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
267 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
269 LDFLAGS=$_SAVE_LDFLAGS)
271 AC_MSG_CHECKING([for -z text option to ld])
272 _SAVE_LDFLAGS=$LDFLAGS
273 LDFLAGS="$LDFLAGS -Wl,-z,text"
274 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
276 LDFLAGS=$_SAVE_LDFLAGS)
278 AC_MSG_CHECKING([for -z relro option to ld])
279 _SAVE_LDFLAGS=$LDFLAGS
280 LDFLAGS="$LDFLAGS -Wl,-z,relro"
281 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
283 LDFLAGS=$_SAVE_LDFLAGS)
285 AC_MSG_CHECKING([for -z nocopyreloc option to ld])
286 _SAVE_LDFLAGS=$LDFLAGS
287 LDFLAGS="$LDFLAGS -Wl,-z,nocopyreloc"
288 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
290 LDFLAGS=$_SAVE_LDFLAGS)
292 AC_MSG_CHECKING([for -Bsymbolic-functions option to ld])
293 _SAVE_LDFLAGS=$LDFLAGS
294 LDFLAGS="$LDFLAGS -Wl,-Bsymbolic-functions"
295 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
297 LDFLAGS=$_SAVE_LDFLAGS)
299 AC_MSG_CHECKING([for --build-id=sha1 option to ld])
300 _SAVE_LDFLAGS=$LDFLAGS
301 LDFLAGS="$LDFLAGS -Wl,--build-id=sha1"
302 AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
304 LDFLAGS=$_SAVE_LDFLAGS)
306 AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
307 HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
308 _SAVE_LDFLAGS=$LDFLAGS
309 LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
310 AC_TRY_LINK(,,AC_MSG_RESULT([yes])
311 [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
313 LDFLAGS=$_SAVE_LDFLAGS
316 if test "$GCC_USE_GNU_LD"; then
317 # Some tools like ASan use a runtime library that is only
318 # linked against executables, so we must allow undefined
319 # symbols for shared objects in some cases.
320 if test -z "$MOZ_ASAN$MOZ_MSAN$MOZ_UBSAN$MOZ_TSAN$FUZZING_INTERFACES"; then
321 # Don't allow undefined symbols in libraries
322 DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
324 # BSDs need `environ' exposed for posix_spawn (bug 753046)
326 DragonFly|FreeBSD|NetBSD|OpenBSD)
327 if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
328 DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
330 DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
337 _DEFINES_CFLAGS="-include $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
339 ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
342 if test "$GNU_CXX"; then
343 CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
345 _DEFINES_CXXFLAGS="-DMOZILLA_CLIENT -include $_objdir/mozilla-config.h"
348 dnl ========================================================
349 dnl System overrides of the defaults for host
350 dnl ========================================================
353 if test -n "$_WIN32_MSVC"; then
354 HOST_CFLAGS="$HOST_CFLAGS"
356 HOST_CFLAGS="$HOST_CFLAGS -mwindows"
358 HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
359 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
362 case "${host_cpu}" in
364 if test -n "$_WIN32_MSVC"; then
365 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
369 if test -n "$_WIN32_MSVC"; then
370 HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
372 HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
378 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX -DXP_MACOSX"
379 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
382 *-linux*|*-kfreebsd*-gnu|*-gnu*)
383 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
384 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
388 HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
389 HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
393 dnl ========================================================
394 dnl System overrides of the defaults for target
395 dnl ========================================================
399 MOZ_OPTIMIZE_FLAGS="-O3"
402 dnl DTrace and -dead_strip don't interact well. See bug 403132.
403 dnl ===================================================================
404 if test "x$enable_dtrace" = "xyes"; then
405 echo "Skipping -dead_strip because DTrace is enabled. See bug 403132."
407 dnl check for the presence of the -dead_strip linker flag
408 AC_MSG_CHECKING([for -dead_strip option to ld])
409 _SAVE_LDFLAGS=$LDFLAGS
410 LDFLAGS="$LDFLAGS -Wl,-dead_strip"
411 AC_TRY_LINK(,[return 0;],_HAVE_DEAD_STRIP=1,_HAVE_DEAD_STRIP=)
412 if test -n "$_HAVE_DEAD_STRIP" ; then
414 MOZ_OPTIMIZE_LDFLAGS="-Wl,-dead_strip"
419 LDFLAGS=$_SAVE_LDFLAGS
425 *-android*|*-linuxandroid*)
426 if test -z "$CLANG_CC"; then
427 MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
429 # From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
430 # -Oz is smaller than -Os on clang.
431 MOZ_OPTIMIZE_FLAGS="-Oz"
432 # Disable the outliner, which causes performance regressions, and is
433 # enabled on some platforms at -Oz.
434 if test -z "$MOZ_LTO"; then
435 DISABLE_OUTLINER="-mno-outline"
437 CFLAGS="$CFLAGS $DISABLE_OUTLINER"
438 AC_TRY_COMPILE(,,[MOZ_OPTIMIZE_FLAGS="$MOZ_OPTIMIZE_FLAGS $DISABLE_OUTLINER"])
439 CFLAGS="$_SAVE_CFLAGS"
441 DISABLE_OUTLINER="-Wl,-plugin-opt=-enable-machine-outliner=never"
442 _SAVE_LDFLAGS=$LDFLAGS
443 LDFLAGS="$LDFLAGS $MOZ_LTO_LDFLAGS $DISABLE_OUTLINER"
444 AC_TRY_LINK(,,[MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS $DISABLE_OUTLINER"])
445 LDFLAGS="$_SAVE_LDFLAGS"
451 if test "$GNU_CC" -o "$GNU_CXX"; then
452 MOZ_PGO_OPTIMIZE_FLAGS="-O3"
453 if test -n "$MOZ_DEBUG"; then
454 MOZ_OPTIMIZE_FLAGS="-Os"
456 MOZ_OPTIMIZE_FLAGS="-O2"
458 if test -z "$CLANG_CC"; then
459 MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
463 case "${target_cpu}" in
465 CFLAGS="$CFLAGS -mieee"
466 CXXFLAGS="$CXXFLAGS -mieee"
472 # certain versions of cygwin's makedepend barf on the
473 # #include <string> vs -I./dist/include/string issue so don't use it
474 if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
475 # $GNU_CC will match gcc and clang; while $CLANG_CC will match only clang
476 if test -z "$CLANG_CC"; then
477 AC_MSG_ERROR(Firefox cannot be built with mingw-gcc and requires a mingw-clang toolchain to work)
483 MOZ_OPTIMIZE_FLAGS="-O2"
485 WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
486 WIN32_GUI_EXE_LDFLAGS=-mwindows
488 # Silence problematic clang warnings
489 CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
490 LDFLAGS="$LDFLAGS -Wl,--no-insert-timestamp"
492 TARGET_COMPILER_ABI=msvc
493 STRIP='echo not_strip'
494 # aarch64 doesn't support subsystems below 6.02
495 if test "$CPU_ARCH" = "aarch64"; then
496 WIN32_SUBSYSTEM_VERSION=6.02
498 WIN32_SUBSYSTEM_VERSION=6.01
500 WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
501 WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
502 DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
503 _DEFINES_CFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
504 _DEFINES_CXXFLAGS="-FI $_objdir/mozilla-config.h -DMOZILLA_CLIENT"
505 CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
506 CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
507 if test "$CPU_ARCH" = "x86"; then
508 dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
509 dnl more recent, so set that explicitly here unless another
510 dnl target arch has already been set.
512 if test -z `echo $CFLAGS | grep -i [-/]arch:`; then
513 CFLAGS="$CFLAGS -arch:SSE2"
515 if test -z `echo $CXXFLAGS | grep -i [-/]arch:`; then
516 CXXFLAGS="$CXXFLAGS -arch:SSE2"
520 dnl VS2013+ supports -Gw for better linker optimizations.
521 dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
522 dnl Disabled on ASan because it causes false-positive ODR violations.
523 if test -z "$MOZ_ASAN"; then
525 CXXFLAGS="$CXXFLAGS -Gw"
527 # String tail merging doesn't play nice with ASan's ODR checker.
528 LDFLAGS="$LDFLAGS -opt:nolldtailmerge"
530 # XXX We should combine some of these with our generic GCC-style
533 # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
534 CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
535 # We use offsetof on non-POD objects all the time.
536 # We also suppress this warning on other platforms.
537 CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
538 # This warns for reasonable things like:
539 # enum { X = 0xffffffffU };
540 # which is annoying for IDL headers.
541 CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
542 # This warns for cases that would be reached by the Microsoft
543 # #include rules, but also currently warns on cases that would
544 # *also* be reached by standard C++ include rules. That
545 # behavior doesn't seem useful, so we turn it off.
546 CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
547 # We normally error out on unknown pragmas, but since clang-cl
548 # claims to be MSVC, it would be difficult to add
549 # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
550 # use such pragmas, so just ignore them.
551 CFLAGS="$CFLAGS -Wno-unknown-pragmas"
552 CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
553 # We get errors about various #pragma intrinsic directives from
554 # clang-cl, and we don't need to hear about those.
555 CFLAGS="$CFLAGS -Wno-ignored-pragmas"
556 CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
557 # clang-cl's Intrin.h marks things like _ReadWriteBarrier
558 # as __attribute((__deprecated__)). This is nice to know,
559 # but since we don't get the equivalent warning from MSVC,
560 # let's just ignore it.
561 CFLAGS="$CFLAGS -Wno-deprecated-declarations"
562 CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
563 # We use a function like:
564 # __declspec(noreturn) __inline void f() {}
565 # which -Winvalid-noreturn complains about. Again, MSVC seems
566 # OK with it, so let's silence the warning.
567 CFLAGS="$CFLAGS -Wno-invalid-noreturn"
568 CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
569 # Missing |override| on virtual function declarations isn't
570 # something that MSVC currently warns about.
571 CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
572 # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
573 # declaration on |operator delete(void*)|. However, clang-cl
574 # must internally declare |operator delete(void*)| differently,
575 # which causes this warning for virtually every file in the
576 # tree. clang-cl doesn't support -fno-exceptions or equivalent,
577 # so there doesn't seem to be any way to convince clang-cl to
578 # declare |delete| differently. Therefore, suppress this
580 CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
581 # Macros like STDMETHOD() and IFACEMETHOD() can declare
582 # __attribute__((nothrow)) on their respective method declarations,
583 # while the definitions are left without the matching attribute.
584 CXXFLAGS="$CXXFLAGS -Wno-microsoft-exception-spec"
585 # At least one MSVC header and several headers in-tree have
586 # unused typedefs, so turn this on.
587 CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
588 # jemalloc uses __declspec(allocator) as a profiler hint,
589 # which clang-cl doesn't understand.
590 CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
591 # __attribute__((unused)) really means "might be unused" and
592 # we use it to avoid warnings about things that are unused
593 # in some compilation units, but used in many others. This
594 # warning insists on complaining about the latter case, which
595 # is annoying, and rather noisy.
596 CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused"
597 # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
598 CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
599 MOZ_DEBUG_LDFLAGS='-DEBUG'
600 if test "$HOST_OS_ARCH" != "WINNT"; then
601 # %_PDB% is a special signal to emit only the PDB basename. This
602 # avoids problems in Windows tools that don't like forward-slashes.
603 MOZ_DEBUG_LDFLAGS="$MOZ_DEBUG_LDFLAGS -PDBALTPATH:%_PDB%"
605 MOZ_OPTIMIZE_FLAGS='-O2'
607 LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE"
609 AC_DEFINE(WIN32_LEAN_AND_MEAN)
610 dnl See http://support.microsoft.com/kb/143208 to use STL
616 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.])
622 if test -n "$GNU_CC"; then
623 CFLAGS="$CFLAGS -mstackrealign"
624 CXXFLAGS="$CXXFLAGS -mstackrealign"
625 LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
627 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
628 LDFLAGS="$LDFLAGS -SAFESEH"
634 if test -n "$_WIN32_MSVC"; then
635 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
640 if test -n "$_WIN32_MSVC"; then
641 DSO_LDOPTS="$DSO_LDOPTS -MACHINE:ARM64"
646 AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
652 CFLAGS="$CFLAGS -Dunix"
653 CXXFLAGS="$CXXFLAGS -Dunix"
654 if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
655 DSO_PIC_CFLAGS='-fPIC -DPIC'
657 MOZ_PROGRAM_LDFLAGS="$MOZ_PROGRAM_LDFLAGS -Wl,--export-dynamic"
659 DSO_PIC_CFLAGS='-fPIC -DPIC'
662 # This will fail on a.out systems prior to 1.5.1_ALPHA.
663 if test "$LIBRUNPATH"; then
664 DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
669 if test -z "$X11BASE"; then
672 MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
673 DSO_PIC_CFLAGS='-fPIC'
674 DSO_LDOPTS='-shared -fPIC'
675 if test "$LIBRUNPATH"; then
676 DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
681 MOZ_FIX_LINK_PATHS="-L${DIST}/bin"
686 CFLAGS="$CFLAGS $DSO_PIC_CFLAGS"
687 CXXFLAGS="$CXXFLAGS $DSO_PIC_CFLAGS"
689 if test -z "$MOZ_OPTIMIZE_FLAGS"; then
690 MOZ_OPTIMIZE_FLAGS="-O"
694 if test -z "$COMPILE_ENVIRONMENT"; then
695 SKIP_COMPILER_CHECKS=1
696 SKIP_LIBRARY_CHECKS=1
700 fi # COMPILE_ENVIRONMENT
702 if test -z "$SKIP_COMPILER_CHECKS"; then
703 dnl Checks for typedefs, structures, and compiler characteristics.
704 dnl ========================================================
719 case "${OS_TARGET}" in
723 STL_FLAGS="-I${DIST}/stl_wrappers"
728 if test "$MOZ_BUILD_APP" = "tools/crashreporter"; then
731 if test "$MOZ_BUILD_APP" = "tools/crashreporter/injector"; then
735 dnl Checks for header files.
736 dnl ========================================================
739 dnl Checks for libraries.
740 dnl ========================================================
741 AC_CHECK_LIB(c_r, gethostbyname_r)
743 dnl We don't want to link with libdl even if it's present on OS X, since
744 dnl it's not used and not part of the default installation. OS/2 has dlfcn
746 dnl We don't want to link against libm or libpthread on Darwin since
747 dnl they both are just symlinks to libSystem and explicitly linking
748 dnl against libSystem causes issues when debugging (see bug 299601).
753 AC_SEARCH_LIBS(dlopen, dl,
754 MOZ_CHECK_HEADER(dlfcn.h,
755 AC_DEFINE(HAVE_DLOPEN)))
759 _SAVE_CFLAGS="$CFLAGS"
760 CFLAGS="$CFLAGS -D_GNU_SOURCE"
761 AC_CHECK_FUNCS(dladdr)
762 CFLAGS="$_SAVE_CFLAGS"
764 if test ! "$GNU_CXX"; then
765 AC_CHECK_LIB(C, demangle)
768 AC_CHECK_LIB(socket, socket)
770 dnl ========================================================
771 dnl = pthread support
772 dnl = Start by checking whether the system support pthreads
773 dnl ========================================================
779 AC_CHECK_LIB(pthreads, pthread_create,
780 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
781 AC_CHECK_LIB(pthread, pthread_create,
782 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
783 AC_CHECK_LIB(c_r, pthread_create,
784 MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
785 AC_CHECK_LIB(c, pthread_create,
794 dnl ========================================================
795 dnl Do the platform specific pthread hackery
796 dnl ========================================================
797 if test "$MOZ_USE_PTHREADS"x != x
800 dnl See if -pthread is supported.
803 ac_cv_have_dash_pthread=no
804 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
805 echo 'int main() { return 0; }' | cat > conftest.c
806 ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
807 if test $? -eq 0; then
808 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
809 ac_cv_have_dash_pthread=yes
812 # Freebsd doesn't use -pthread for compiles, it uses them for linking
815 CFLAGS="$CFLAGS -pthread"
816 CXXFLAGS="$CXXFLAGS -pthread"
822 AC_MSG_RESULT($ac_cv_have_dash_pthread)
825 dnl See if -pthreads is supported.
827 ac_cv_have_dash_pthreads=no
828 if test "$ac_cv_have_dash_pthread" = "no"; then
829 AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
830 echo 'int main() { return 0; }' | cat > conftest.c
831 ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
832 if test $? -eq 0; then
833 if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
834 ac_cv_have_dash_pthreads=yes
835 CFLAGS="$CFLAGS -pthreads"
836 CXXFLAGS="$CXXFLAGS -pthreads"
840 AC_MSG_RESULT($ac_cv_have_dash_pthreads)
845 AC_DEFINE(_REENTRANT)
846 AC_DEFINE(_THREAD_SAFE)
847 dnl -pthread links in -lpthread, so don't specify it explicitly.
848 if test "$ac_cv_have_dash_pthread" = "yes"; then
849 _PTHREAD_LDFLAGS="-pthread"
853 *-*-openbsd*|*-*-bsdi*)
854 AC_DEFINE(_REENTRANT)
855 AC_DEFINE(_THREAD_SAFE)
856 dnl -pthread links in -lc_r, so don't specify it explicitly.
857 if test "$ac_cv_have_dash_pthread" = "yes"; then
858 _PTHREAD_LDFLAGS="-pthread"
862 *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
863 AC_DEFINE(_REENTRANT)
867 LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
868 AC_SUBST(MOZ_USE_PTHREADS)
869 MOZ_CHECK_HEADERS(pthread.h)
873 dnl Checks for library functions.
874 dnl ========================================================
875 AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid setpriority strerror syscall lutimes)
877 dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
878 AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
879 ac_cv_clock_monotonic,
880 [for libs in "" -lrt; do
883 dnl clock_gettime is available on OSX since 10.12, so depending on MACOSX_DEPLOYMENT_TARGET,
884 dnl we should or not be able to use it. To detect if we can, we need to make the
885 dnl availability attribute strict, so that compilation fails when the target is < 10.12.
886 AC_TRY_LINK([#define availability(os, ...) availability(os, strict, __VA_ARGS)
888 [ struct timespec ts;
889 clock_gettime(CLOCK_MONOTONIC, &ts); ],
890 ac_cv_clock_monotonic=$libs
893 ac_cv_clock_monotonic=no)
896 if test "$ac_cv_clock_monotonic" != "no"; then
897 HAVE_CLOCK_MONOTONIC=1
898 REALTIME_LIBS=$ac_cv_clock_monotonic
899 AC_DEFINE(HAVE_CLOCK_MONOTONIC)
900 AC_SUBST(HAVE_CLOCK_MONOTONIC)
901 AC_SUBST_LIST(REALTIME_LIBS)
906 ac_cv_func_res_ninit,
907 [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
908 dnl no need for res_ninit() on NetBSD and OpenBSD
909 ac_cv_func_res_ninit=no
913 #define _BSD_SOURCE 1
915 #include <sys/types.h>
916 #include <netinet/in.h>
917 #include <arpa/nameser.h>
920 [int foo = res_ninit(&_res);],
921 [ac_cv_func_res_ninit=yes],
922 [ac_cv_func_res_ninit=no])
926 if test "$ac_cv_func_res_ninit" = "yes"; then
927 AC_DEFINE(HAVE_RES_NINIT)
928 dnl must add the link line we do something as foolish as this... dougt
930 dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
931 dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
936 dnl ===================================================================
937 dnl ========================================================
938 dnl Put your C++ language/feature checks below
939 dnl ========================================================
943 if test "$GNU_CC"; then
944 if test "$CPU_ARCH" = "arm" ; then
945 AC_CACHE_CHECK(for ARM EABI,
949 #if defined(__ARM_EABI__)
955 ac_cv_gcc_arm_eabi="yes",
956 ac_cv_gcc_arm_eabi="no")])
957 if test "$ac_cv_gcc_arm_eabi" = "yes"; then
965 TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
968 # try harder, when checking for __thread support, see bug 521750 comment #33 and below
969 # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
970 # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
972 _SAVE_LDFLAGS=$LDFLAGS
973 LDFLAGS="$LDFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
974 AC_CACHE_CHECK(for __thread keyword for TLS variables,
975 ac_cv_thread_keyword,
976 [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
977 [return tlsIsMainThread;],
978 ac_cv_thread_keyword=yes,
979 ac_cv_thread_keyword=no)])
980 LDFLAGS=$_SAVE_LDFLAGS
981 # The custom dynamic linker doesn't support TLS variables
982 if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
983 # mips builds fail with TLS variables because of a binutils bug.
985 # OpenBSD doesn't have TLS support, and the test succeeds with clang++
990 *-android*|*-linuxandroid*)
997 AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
1002 if test -n "$MOZ_LINKER"; then
1003 dnl gold emits wrong sysv-style elf hash tables when building both sysv and
1004 dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
1005 dnl Since the linker only understands the sysv ones, no need to build the
1006 dnl gnu style tables anyways.
1007 LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
1010 dnl End of C++ language/feature checks
1013 dnl ========================================================
1014 dnl = Internationalization checks
1015 dnl ========================================================
1017 dnl Internationalization and Locale support is different
1018 dnl on various UNIX platforms. Checks for specific i18n
1019 dnl features go here.
1021 AC_HAVE_FUNCS(localeconv)
1023 fi # ! SKIP_COMPILER_CHECKS
1025 if test -n "${COMPILE_ENVIRONMENT}"; then
1030 if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
1031 TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
1032 AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
1035 dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
1036 dnl features that Windows actually does support.
1038 if test -n "$SKIP_COMPILER_CHECKS"; then
1039 dnl Windows has malloc.h
1040 AC_DEFINE(MALLOC_H, [<malloc.h>])
1041 AC_DEFINE(HAVE_FORCEINLINE)
1042 AC_DEFINE(HAVE_LOCALECONV)
1043 fi # SKIP_COMPILER_CHECKS
1045 dnl Mozilla specific options
1046 dnl ========================================================
1047 dnl The macros used for command line options
1048 dnl are defined in build/autoconf/altoptions.m4.
1050 dnl ========================================================
1054 dnl ========================================================
1056 MOZ_BRANDING_DIRECTORY=
1057 MOZ_OFFICIAL_BRANDING=
1059 MOZ_BINARY_EXTENSIONS=
1062 dnl ========================================================
1063 dnl = Trademarked Branding
1064 dnl ========================================================
1065 MOZ_ARG_ENABLE_BOOL(official-branding,
1066 [ --enable-official-branding
1067 Enable Official mozilla.org Branding
1068 Do not distribute builds with
1069 --enable-official-branding unless you have
1070 permission to use trademarks per
1071 http://www.mozilla.org/foundation/trademarks/ .],
1072 MOZ_OFFICIAL_BRANDING=1,
1073 MOZ_OFFICIAL_BRANDING=)
1075 # Allow the application to influence configure with a confvars.sh script.
1076 AC_MSG_CHECKING([if app-specific confvars.sh exists])
1077 if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
1078 AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
1079 . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
1084 AC_SUBST(MOZ_OFFICIAL_BRANDING)
1085 if test -n "$MOZ_OFFICIAL_BRANDING"; then
1086 if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
1087 AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
1089 MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
1090 AC_DEFINE(MOZ_OFFICIAL_BRANDING)
1094 MOZ_ARG_WITH_STRING(branding,
1095 [ --with-branding=dir Use branding from the specified directory.],
1096 MOZ_BRANDING_DIRECTORY=$withval)
1098 REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
1099 if test -z "$REAL_BRANDING_DIRECTORY"; then
1100 REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
1103 if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
1104 . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
1107 AC_SUBST(MOZ_BRANDING_DIRECTORY)
1109 dnl ========================================================
1110 dnl = Distribution ID
1111 dnl ========================================================
1112 MOZ_ARG_WITH_STRING(distribution-id,
1113 [ --with-distribution-id=ID
1114 Set distribution-specific id (default=org.mozilla)],
1115 [ val=`echo $withval`
1116 MOZ_DISTRIBUTION_ID="$val"])
1118 if test -z "$MOZ_DISTRIBUTION_ID"; then
1119 MOZ_DISTRIBUTION_ID="org.mozilla"
1122 AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
1123 AC_SUBST(MOZ_DISTRIBUTION_ID)
1125 dnl ========================================================
1126 dnl = Enable code optimization. ON by default.
1127 dnl ========================================================
1129 # Use value from moz.configure if one is defined. Else use our computed
1131 if test -n "${MOZ_CONFIGURE_OPTIMIZE_FLAGS}"; then
1132 MOZ_OPTIMIZE_FLAGS=${MOZ_CONFIGURE_OPTIMIZE_FLAGS}
1135 if test "$COMPILE_ENVIRONMENT"; then
1136 if test -n "$MOZ_OPTIMIZE"; then
1137 AC_MSG_CHECKING([for valid C compiler optimization flags])
1138 _SAVE_CFLAGS=$CFLAGS
1139 CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
1140 AC_TRY_COMPILE([#include <stdio.h>],
1141 [printf("Hello World\n");],
1144 AC_MSG_RESULT([$_results])
1145 if test "$_results" = "no"; then
1146 AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
1148 CFLAGS=$_SAVE_CFLAGS
1149 if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
1150 # When using llvm-based LTO, non numeric optimization levels are
1151 # not supported by the linker, so force the linker to use -O2 (
1152 # which doesn't influence the level compilation units are actually
1154 case " $MOZ_OPTIMIZE_FLAGS " in
1155 *\ -Os\ *|*\ -Oz\ *)
1156 MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
1161 fi # COMPILE_ENVIRONMENT
1163 AC_SUBST_LIST(MOZ_OPTIMIZE_FLAGS)
1164 AC_SUBST_LIST(MOZ_OPTIMIZE_LDFLAGS)
1165 AC_SUBST_LIST(MOZ_PGO_OPTIMIZE_FLAGS)
1167 case "${OS_TARGET}" in
1168 Android|WINNT|Darwin)
1169 MOZ_GLUE_IN_PROGRAM=
1172 dnl On !Android !Windows !OSX, we only want to link executables against mozglue
1173 MOZ_GLUE_IN_PROGRAM=1
1174 AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
1178 dnl ========================================================
1179 dnl = Jemalloc build setup
1180 dnl ========================================================
1181 if test -z "$MOZ_MEMORY"; then
1184 if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
1185 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.])
1190 dnl The generic feature tests that determine how to compute ncpus are long and
1191 dnl complicated. Therefore, simply define special cpp variables for the
1192 dnl platforms we have special knowledge of.
1195 export MOZ_NO_DEBUG_RTL=1
1199 AC_SUBST(MOZ_GLUE_IN_PROGRAM)
1201 dnl ========================================================
1202 dnl = Enable using the clang plugin to build
1203 dnl ========================================================
1205 if test -n "$COMPILE_ENVIRONMENT"; then
1206 MOZ_CONFIG_CLANG_PLUGIN
1207 fi # COMPILE_ENVIRONMENT
1209 dnl ========================================================
1210 dnl = Support for demangling undefined symbols
1211 dnl ========================================================
1212 if test -z "$SKIP_LIBRARY_CHECKS"; then
1215 AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
1219 # Demangle only for debug or DMD builds
1220 MOZ_DEMANGLE_SYMBOLS=
1221 if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
1222 MOZ_DEMANGLE_SYMBOLS=1
1223 AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
1225 AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
1227 dnl ========================================================
1228 dnl = Support for gcc stack unwinding (from gcc 3.3)
1229 dnl ========================================================
1230 if test -z "$SKIP_LIBRARY_CHECKS"; then
1233 MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
1237 if test -z "$SKIP_COMPILER_CHECKS"; then
1238 dnl ========================================================
1239 dnl Check for gcc -pipe support
1240 dnl ========================================================
1241 AC_MSG_CHECKING([for -pipe support])
1242 if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
1243 dnl Any gcc that supports firefox supports -pipe.
1244 CFLAGS="$CFLAGS -pipe"
1245 CXXFLAGS="$CXXFLAGS -pipe"
1246 AC_MSG_RESULT([yes])
1251 fi # ! SKIP_COMPILER_CHECKS
1255 if test "$COMPILE_ENVIRONMENT"; then
1257 fi # COMPILE_ENVIRONMENT
1259 dnl ========================================================
1260 dnl Check if we need the 32-bit Linux SSE2 error dialog
1261 dnl ========================================================
1263 AC_SUBST(MOZ_LINUX_32_SSE2_STARTUP_ERROR)
1265 dnl ========================================================
1267 dnl ========================================================
1269 if test "$OS_ARCH" = "WINNT"; then
1270 # For now we assume that we will have a uint64_t available through
1271 # one of the above headers or mozstdint.h.
1272 AC_DEFINE(HAVE_UINT64_T)
1275 case "$MOZ_WIDGET_TOOLKIT" in
1277 if test "$COMPILE_ENVIRONMENT"; then
1278 MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
1282 AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
1284 dnl ========================================================
1286 dnl = Maintainer debug option (no --enable equivalent)
1288 dnl ========================================================
1290 AC_SUBST_LIST(ASFLAGS)
1291 AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
1292 AC_SUBST_LIST(WARNINGS_CFLAGS)
1294 AC_SUBST(MOZ_STUB_INSTALLER)
1296 AC_SUBST_LIST(MOZ_FIX_LINK_PATHS)
1298 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
1300 if test -n "$MOZ_BINARY_EXTENSIONS"; then
1301 AC_DEFINE(MOZ_BINARY_EXTENSIONS)
1304 dnl ========================================================
1305 dnl = Mac bundle name prefix
1306 dnl ========================================================
1307 MOZ_ARG_WITH_STRING(macbundlename-prefix,
1308 [ --with-macbundlename-prefix=prefix
1309 Prefix for MOZ_MACBUNDLE_NAME],
1310 [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
1312 MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
1313 if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
1314 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
1317 if test "$MOZ_DEBUG"; then
1318 MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
1320 MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
1322 AC_SUBST(MOZ_MACBUNDLE_NAME)
1324 dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
1325 # If the MOZ_MACBUNDLE_ID is defined in the configure.sh, use it
1326 # Otherwise, use MOZ_APP_DISPLAYNAME
1327 if test -z "$MOZ_MACBUNDLE_ID"; then
1328 MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr 'A-Z' 'a-z' | tr -dc 'a-z-'`
1330 MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
1331 if test "$MOZ_DEBUG"; then
1332 MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
1335 AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
1336 AC_SUBST(MOZ_MACBUNDLE_ID)
1338 dnl ========================================================
1339 dnl = Child Process Name for IPC
1340 dnl ========================================================
1341 if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
1342 MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
1344 # We want to let Android unpack the file at install time, but it only does
1345 # so if the file is named libsomething.so. The lib/ path is also required
1346 # because the unpacked file will be under the lib/ subdirectory and will
1347 # need to be executed from that path.
1348 MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
1350 MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
1351 MOZ_CHILD_PROCESS_BUNDLENAME="${MOZ_APP_DISPLAYNAME}CP"
1353 AC_SUBST(MOZ_CHILD_PROCESS_NAME)
1354 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
1355 AC_SUBST(MOZ_CHILD_PROCESS_BUNDLENAME)
1357 # The following variables are available to branding and application
1358 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
1359 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
1360 # impacts profile location and user-visible fields.
1361 # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
1362 # Mac Bundle name, Updater, Installer), it is typically used for nightly
1363 # builds (e.g. Aurora for Firefox).
1364 # - MOZ_APP_PROFILE: When set, used for application.ini's
1365 # "Profile" field, which controls profile location.
1366 # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
1367 # crash reporter server url.
1368 # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
1370 # The following environment variables used to have an effect, but don't anymore:
1371 # - MOZ_APP_VERSION: Defines the application version number. This was replaced with
1372 # the contents from the version.txt file in the application directory, or
1373 # browser/config/version.txt if there isn't one.
1374 # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
1375 # in the "About" window. This was replaced with the contents from the
1376 # version_display.txt or version.txt in the application directory, or
1377 # browser/config/version_display.txt.
1379 # For extensions and langpacks, we require a max version that is compatible
1380 # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
1381 # 24.0a1 and 24.0a2 aren't affected
1383 # 24.1.1 becomes 24.*
1384 IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
1385 if test -z "$IS_ALPHA"; then
1387 if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
1388 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
1390 MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
1394 MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
1397 AC_SUBST(MOZ_APP_DISPLAYNAME)
1398 AC_SUBST(MOZ_APP_VENDOR)
1399 AC_SUBST(MOZ_APP_PROFILE)
1400 AC_SUBST(MOZ_APP_ID)
1401 AC_SUBST(MAR_CHANNEL_ID)
1402 AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
1403 AC_SUBST(MOZ_PROFILE_MIGRATOR)
1404 AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
1405 AC_SUBST(MOZ_APP_UA_NAME)
1406 AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
1407 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL, $BROWSER_CHROME_URL)
1408 AC_DEFINE_UNQUOTED(BROWSER_CHROME_URL_QUOTED, "$BROWSER_CHROME_URL")
1410 AC_SUBST(MOZ_APP_MAXVERSION)
1411 AC_SUBST(MOZ_PKG_SPECIAL)
1412 AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
1414 if test "$MOZILLA_OFFICIAL"; then
1415 # Build revisions should always be present in official builds
1416 MOZ_INCLUDE_SOURCE_INFO=1
1419 # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
1420 # explicitly set the repository and changeset information in.
1421 AC_SUBST(MOZ_SOURCE_REPO)
1422 AC_SUBST(MOZ_SOURCE_CHANGESET)
1423 AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
1425 dnl If we have any service that uploads data (and requires data submission
1426 dnl policy alert), set MOZ_DATA_REPORTING.
1427 dnl We need SUBST for build system and DEFINE for xul preprocessor.
1428 if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER" || test -n "$MOZ_NORMANDY"; then
1429 MOZ_DATA_REPORTING=1
1430 AC_DEFINE(MOZ_DATA_REPORTING)
1431 AC_SUBST(MOZ_DATA_REPORTING)
1435 AC_SUBST(WIN32_REDIST_DIR)
1436 AC_SUBST(WIN_UCRT_REDIST_DIR)
1438 dnl Echo the CFLAGS to remove extra whitespace.
1440 $_COMPILATION_CFLAGS \
1444 $_WARNINGS_CXXFLAGS \
1445 $_COMPILATION_CXXFLAGS \
1448 COMPILE_CFLAGS=`echo \
1452 COMPILE_CXXFLAGS=`echo \
1453 $_DEFINES_CXXFLAGS \
1457 $_WARNINGS_HOST_CFLAGS \
1458 $_COMPILATION_HOST_CFLAGS \
1461 HOST_CXXFLAGS=`echo \
1462 $_WARNINGS_HOST_CXXFLAGS \
1463 $_COMPILATION_HOST_CXXFLAGS \
1466 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
1467 HOST_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
1468 OS_COMPILE_CMFLAGS="-x objective-c -fobjc-exceptions"
1469 OS_COMPILE_CMMFLAGS="-x objective-c++ -fobjc-exceptions"
1470 if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
1471 OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
1472 OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
1474 AC_SUBST(HOST_CMFLAGS)
1475 AC_SUBST(HOST_CMMFLAGS)
1476 AC_SUBST(OS_COMPILE_CMFLAGS)
1477 AC_SUBST(OS_COMPILE_CMMFLAGS)
1480 OS_CXXFLAGS="$CXXFLAGS"
1481 OS_CPPFLAGS="$CPPFLAGS"
1482 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
1483 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
1484 OS_LDFLAGS="$LDFLAGS"
1486 AC_SUBST_LIST(OS_CFLAGS)
1487 AC_SUBST_LIST(OS_CXXFLAGS)
1488 AC_SUBST_LIST(OS_CPPFLAGS)
1489 AC_SUBST_LIST(OS_COMPILE_CFLAGS)
1490 AC_SUBST_LIST(OS_COMPILE_CXXFLAGS)
1491 AC_SUBST_LIST(OS_LDFLAGS)
1496 AC_SUBST_LIST(HOST_CFLAGS)
1497 AC_SUBST_LIST(HOST_CPPFLAGS)
1498 AC_SUBST_LIST(HOST_CXXFLAGS)
1499 AC_SUBST(HOST_LDFLAGS)
1500 AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
1501 AC_SUBST(HOST_BIN_SUFFIX)
1503 AC_SUBST(TARGET_XPCOM_ABI)
1505 AC_SUBST(DSO_LDOPTS)
1506 AC_SUBST(BIN_SUFFIX)
1508 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
1509 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
1511 AC_SUBST(MOZ_DEVTOOLS)
1513 AC_SUBST(MOZ_PACKAGE_JSSHELL)
1517 dnl Host JavaScript runtime, if any, to use during cross compiles.
1520 AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
1522 if test -n "$COMPILE_ENVIRONMENT"; then
1523 AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
1524 fi # COMPILE_ENVIRONMENT
1526 dnl Set various defines and substitutions
1527 dnl ========================================================
1529 AC_SUBST(MOZ_DEV_EDITION)
1530 if test -n "$MOZ_DEV_EDITION"; then
1531 AC_DEFINE(MOZ_DEV_EDITION)
1534 dnl Windows AccessibilityHandler
1535 dnl ========================================================
1537 if test -z "$MOZ_HANDLER_CLSID"; then
1538 MOZ_HANDLER_CLSID="4a195748-dca2-45fb-9295-0a139e76a9e7"
1539 MOZ_IHANDLERCONTROL_IID="3316ce35-f892-4832-97c5-06c52c03cdba"
1540 MOZ_ASYNCIHANDLERCONTROL_IID="15b48b76-ad38-4ad3-bd1a-d3c48a5a9947"
1541 MOZ_IGECKOBACKCHANNEL_IID="dd2e4a89-999e-4d65-8b65-440c923ddb61"
1544 AC_SUBST(MOZ_HANDLER_CLSID)
1545 AC_SUBST(MOZ_IHANDLERCONTROL_IID)
1546 AC_SUBST(MOZ_ASYNCIHANDLERCONTROL_IID)
1547 AC_SUBST(MOZ_IGECKOBACKCHANNEL_IID)
1549 dnl Spit out some output
1550 dnl ========================================================
1552 # Avoid using obsolete NSPR features
1553 AC_DEFINE(NO_NSPR_10_SUPPORT)
1555 MOZ_CREATE_CONFIG_STATUS()
1557 rm -fr confdefs* $ac_clean_files